Browse Source

refactor: group import statements

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/4406/head
Pranav C 2 years ago
parent
commit
0d98aac265
  1. 18
      packages/nc-gui/components/cell/MultiSelect.vue
  2. 6
      packages/nc-gui/components/cell/SingleSelect.vue

18
packages/nc-gui/components/cell/MultiSelect.vue

@ -10,6 +10,7 @@ import {
ReadonlyInj,
computed,
enumColor,
extractSdkResponseErrorMsg,
h,
inject,
onMounted,
@ -21,7 +22,6 @@ import {
useSelectedCellKeyupListener,
watch,
} from '#imports'
import { extractSdkResponseErrorMsg } from '~/utils'
import MdiCloseCircle from '~icons/mdi/close-circle'
interface Props {
@ -107,13 +107,13 @@ const selectedTitles = computed(() =>
? typeof modelValue === 'string'
? isMysql
? modelValue.split(',').sort((a, b) => {
const opa = options.value.find((el) => el.title === a)
const opb = options.value.find((el) => el.title === b)
if (opa && opb) {
return opa.order! - opb.order!
}
return 0
})
const opa = options.value.find((el) => el.title === a)
const opb = options.value.find((el) => el.title === b)
if (opa && opb) {
return opa.order! - opb.order!
}
return 0
})
: modelValue.split(',')
: modelValue
: [],
@ -284,13 +284,13 @@ const onTagClick = (e: Event, onClose: Function) => {
<template #tagRender="{ value: val, onClose }">
<a-tag
@click="onTagClick($event, onClose)"
v-if="options.find((el) => el.title === val)"
class="rounded-tag nc-selected-option"
:style="{ display: 'flex', alignItems: 'center' }"
:color="options.find((el) => el.title === val)?.color"
:closable="(active || editable) && (vModel.length > 1 || !column?.rqd)"
:close-icon="h(MdiCloseCircle, { class: ['ms-close-icon'] })"
@click="onTagClick($event, onClose)"
@close="onClose"
>
<span

6
packages/nc-gui/components/cell/SingleSelect.vue

@ -3,7 +3,6 @@ import { message } from 'ant-design-vue'
import tinycolor from 'tinycolor2'
import type { Select as AntSelect } from 'ant-design-vue'
import type { SelectOptionType } from 'nocodb-sdk'
import { useSelectedCellKeyupListener } from '~/composables/useSelectedCellKeyupListener'
import {
ActiveCellInj,
ColumnInj,
@ -12,11 +11,12 @@ import {
ReadonlyInj,
computed,
enumColor,
extractSdkResponseErrorMsg,
inject,
ref,
useSelectedCellKeyupListener,
watch,
} from '#imports'
import { extractSdkResponseErrorMsg } from '~/utils'
interface Props {
modelValue?: string | undefined
@ -57,7 +57,7 @@ const options = computed<(SelectOptionType & { value: string })[]>(() => {
if (column?.value.colOptions) {
const opts = column.value.colOptions
? // todo: fix colOptions type, options does not exist as a property
(column.value.colOptions as any).options.filter((el: SelectOptionType) => el.title !== '') || []
(column.value.colOptions as any).options.filter((el: SelectOptionType) => el.title !== '') || []
: []
for (const op of opts.filter((el: any) => el.order === null)) {
op.title = op.title.replace(/^'/, '').replace(/'$/, '')

Loading…
Cancel
Save