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

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

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

Loading…
Cancel
Save