Browse Source

refactor(nc-gui): remove imports

pull/3801/head
braks 2 years ago
parent
commit
4cd0da5874
  1. 11
      packages/nc-gui/components/smartsheet/toolbar/FieldListAutoCompleteDropdown.vue
  2. 11
      packages/nc-gui/components/smartsheet/toolbar/FieldsMenu.vue

11
packages/nc-gui/components/smartsheet/toolbar/FieldListAutoCompleteDropdown.vue

@ -2,9 +2,7 @@
import type { SelectProps } from 'ant-design-vue' import type { SelectProps } from 'ant-design-vue'
import type { ColumnType, LinkToAnotherRecordType } from 'nocodb-sdk' import type { ColumnType, LinkToAnotherRecordType } from 'nocodb-sdk'
import { RelationTypes, UITypes, isVirtualCol } from 'nocodb-sdk' import { RelationTypes, UITypes, isVirtualCol } from 'nocodb-sdk'
import { MetaInj, computed } from '#imports' import { MetaInj, computed, inject, ref, resolveComponent } from '#imports'
import VirtualCellIcon from '~/components/smartsheet-header/VirtualCellIcon.vue'
import CellIcon from '~/components/smartsheet-header/CellIcon.vue'
interface Props { interface Props {
modelValue?: string modelValue?: string
@ -38,9 +36,12 @@ const options = computed<SelectProps['options']>(() =>
.map((c: ColumnType) => ({ .map((c: ColumnType) => ({
value: c.id, value: c.id,
label: c.title, label: c.title,
icon: h(isVirtualCol(c) ? VirtualCellIcon : CellIcon, { icon: h(
isVirtualCol(c) ? resolveComponent('SmartsheetHeaderVirtualCellIcon') : resolveComponent('SmartsheetHeaderCellIcon'),
{
columnMeta: c, columnMeta: c,
}), },
),
c, c,
})), })),
) )

11
packages/nc-gui/components/smartsheet/toolbar/FieldsMenu.vue

@ -13,12 +13,11 @@ import {
computed, computed,
inject, inject,
ref, ref,
resolveComponent,
useNuxtApp, useNuxtApp,
useViewColumns, useViewColumns,
watch, watch,
} from '#imports' } from '#imports'
import CellIcon from '~/components/smartsheet-header/CellIcon.vue'
import VirtualCellIcon from '~/components/smartsheet-header/VirtualCellIcon.vue'
const meta = inject(MetaInj, ref()) const meta = inject(MetaInj, ref())
@ -89,9 +88,9 @@ const coverImageColumnId = computed({
get: () => get: () =>
activeView.value?.type === ViewTypes.GALLERY ? (activeView.value?.view as GalleryType).fk_cover_image_col_id : undefined, activeView.value?.type === ViewTypes.GALLERY ? (activeView.value?.view as GalleryType).fk_cover_image_col_id : undefined,
set: async (val) => { set: async (val) => {
if (val && activeView.value.type === ViewTypes.GALLERY && activeView.value.id && activeView.value.view) { if (val && activeView.value?.type === ViewTypes.GALLERY && activeView.value?.id && activeView.value?.view) {
await $api.dbView.galleryUpdate(activeView.value.id, { await $api.dbView.galleryUpdate(activeView.value?.id, {
...activeView.value.view, ...activeView.value?.view,
fk_cover_image_col_id: val, fk_cover_image_col_id: val,
}) })
;(activeView.value?.view as GalleryType).fk_cover_image_col_id = val ;(activeView.value?.view as GalleryType).fk_cover_image_col_id = val
@ -112,7 +111,7 @@ const coverOptions = computed<SelectProps['options']>(() => {
}) })
const getIcon = (c: ColumnType) => const getIcon = (c: ColumnType) =>
h(isVirtualCol(c) ? VirtualCellIcon : CellIcon, { h(isVirtualCol(c) ? resolveComponent('SmartsheetHeaderVirtualCellIcon') : resolveComponent('SmartsheetHeaderCellIcon'), {
columnMeta: c, columnMeta: c,
}) })
</script> </script>

Loading…
Cancel
Save