From 10633df624346a07ab0fc1b1bc10677253e45279 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Mon, 16 Jan 2023 12:24:05 +0800 Subject: [PATCH 01/23] fix(nc-gui): include kanban grouping field --- packages/nc-gui/composables/useSharedView.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/nc-gui/composables/useSharedView.ts b/packages/nc-gui/composables/useSharedView.ts index 89ee00b4b6..d349a7c38f 100644 --- a/packages/nc-gui/composables/useSharedView.ts +++ b/packages/nc-gui/composables/useSharedView.ts @@ -9,7 +9,7 @@ import type { TableType, ViewType, } from 'nocodb-sdk' -import { UITypes } from 'nocodb-sdk' +import { UITypes, ViewTypes } from 'nocodb-sdk' import { computed, useGlobal, useMetas, useNuxtApp, useState } from '#imports' export function useSharedView() { @@ -70,8 +70,17 @@ export function useSharedView() { meta.value = { ...viewMeta.model } let order = 1 + + // include kanban grouping field column to share view + // even it is unselected in Fields + // so that it won't break kanban share view + let kanbanGroupingFieldId = '' + if (viewMeta.type === ViewTypes.KANBAN) { + kanbanGroupingFieldId = (await $api.dbView.kanbanRead(viewMeta.id)).fk_grp_col_id! + } + meta.value!.columns = [...viewMeta.model.columns] - .filter((c) => c.show) + .filter((c) => c.show || (viewMeta.type === ViewTypes.KANBAN && c.id === kanbanGroupingFieldId)) .map((c) => ({ ...c, order: order++ })) .sort((a, b) => a.order - b.order) From a09068ecd64d81452e0bdfeea53b9436435fadf8 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Mon, 16 Jan 2023 12:24:13 +0800 Subject: [PATCH 02/23] fix(nocodb): include kanban grouping field --- .../src/lib/meta/api/publicApis/publicMetaApis.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/nocodb/src/lib/meta/api/publicApis/publicMetaApis.ts b/packages/nocodb/src/lib/meta/api/publicApis/publicMetaApis.ts index cac3f8a8cb..a57e65f2ee 100644 --- a/packages/nocodb/src/lib/meta/api/publicApis/publicMetaApis.ts +++ b/packages/nocodb/src/lib/meta/api/publicApis/publicMetaApis.ts @@ -7,9 +7,11 @@ import { LinkToAnotherRecordType, RelationTypes, UITypes, + ViewTypes, } from 'nocodb-sdk'; import Column from '../../../models/Column'; import Base from '../../../models/Base'; +import KanbanView from '../../../models/KanbanView'; import Project from '../../../models/Project'; import LinkToAnotherRecordColumn from '../../../models/LinkToAnotherRecordColumn'; @@ -39,13 +41,21 @@ export async function viewMetaGet(req: Request, res: Response) { // todo: return only required props delete view['password']; - // const columnsById = c; + // include kanban grouping field column to share view + // even it is unselected in Fields + // so that it won't break kanban share view + let kanbanGroupingFieldId; + if (view.type === ViewTypes.KANBAN) { + kanbanGroupingFieldId = (await KanbanView.get(view.id)).fk_grp_col_id; + } view.model.columns = view.columns .filter((c) => { const column = view.model.columnsById[c.fk_column_id]; return ( c.show || + (view.type === ViewTypes.KANBAN && + c.fk_column_id === kanbanGroupingFieldId) || (column.rqd && !column.cdf && !column.ai) || column.pk || view.model.columns.some( From 0d847375178ed7922a1530d7f2c3d7b0d37a3183 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Mon, 16 Jan 2023 14:23:48 +0800 Subject: [PATCH 03/23] feat(sdk): add column get api --- .../nocodb/src/lib/meta/api/columnApis.ts | 14 +++++++++ scripts/sdk/swagger.json | 31 ++++++++++++------- 2 files changed, 33 insertions(+), 12 deletions(-) diff --git a/packages/nocodb/src/lib/meta/api/columnApis.ts b/packages/nocodb/src/lib/meta/api/columnApis.ts index aaec69a65e..f16b8d3f8c 100644 --- a/packages/nocodb/src/lib/meta/api/columnApis.ts +++ b/packages/nocodb/src/lib/meta/api/columnApis.ts @@ -101,6 +101,10 @@ async function createHmAndBtColumn( } } +export async function columnGet(req: Request, res: Response) { + res.json(await Column.get({ colId: req.params.columnId })); +} + export async function columnAdd( req: Request, res: Response @@ -1811,21 +1815,31 @@ async function createColumnIndex({ } const router = Router({ mergeParams: true }); + router.post( '/api/v1/db/meta/tables/:tableId/columns/', metaApiMetrics, ncMetaAclMw(columnAdd, 'columnAdd') ); + router.patch( '/api/v1/db/meta/columns/:columnId', metaApiMetrics, ncMetaAclMw(columnUpdate, 'columnUpdate') ); + router.delete( '/api/v1/db/meta/columns/:columnId', metaApiMetrics, ncMetaAclMw(columnDelete, 'columnDelete') ); + +router.get( + '/api/v1/db/meta/columns/:columnId', + metaApiMetrics, + ncMetaAclMw(columnGet, 'columnGet') +); + router.post( '/api/v1/db/meta/columns/:columnId/primary', metaApiMetrics, diff --git a/scripts/sdk/swagger.json b/scripts/sdk/swagger.json index 9bc4fc64f2..bc6b326c92 100644 --- a/scripts/sdk/swagger.json +++ b/scripts/sdk/swagger.json @@ -1972,8 +1972,7 @@ "project_id": { "type": "string" }, - "meta": { - } + "meta": {} } } } @@ -2105,7 +2104,7 @@ ] }, "delete": { - "summary": "", + "summary": "Column Delete", "operationId": "db-table-column-delete", "responses": { "200": { @@ -2115,6 +2114,18 @@ "tags": [ "DB table column" ] + }, + "get": { + "summary": "Column Get", + "operationId": "db-table-column-get", + "responses": { + "200": { + "description": "OK" + } + }, + "tags": [ + "DB Table Column" + ] } }, "/api/v1/db/meta/columns/{columnId}/primary": { @@ -2194,8 +2205,7 @@ "order": { "type": "number" }, - "meta": { - }, + "meta": {}, "title": { "type": "string" }, @@ -7492,8 +7502,7 @@ "number" ] }, - "meta": { - } + "meta": {} }, "required": [ "table_name", @@ -7591,8 +7600,7 @@ "uuid": { "type": "string" }, - "meta": { - }, + "meta": {}, "show_system_fields": { "type": "boolean" }, @@ -7835,8 +7843,7 @@ "$ref": "#/components/schemas/Column" } }, - "meta": { - } + "meta": {} }, "required": [ "table_name", @@ -10042,4 +10049,4 @@ } } } -} +} \ No newline at end of file From 07bf406c77f704e11aa3538d98b17f117a4ccb02 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Mon, 16 Jan 2023 14:24:05 +0800 Subject: [PATCH 04/23] feat(sdk): add column get api --- packages/nocodb-sdk/src/lib/Api.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/packages/nocodb-sdk/src/lib/Api.ts b/packages/nocodb-sdk/src/lib/Api.ts index 0b94ec37fe..2dc2830f19 100644 --- a/packages/nocodb-sdk/src/lib/Api.ts +++ b/packages/nocodb-sdk/src/lib/Api.ts @@ -2264,6 +2264,7 @@ export class Api< * * @tags DB table column * @name Delete + * @summary Column Delete * @request DELETE:/api/v1/db/meta/columns/{columnId} * @response `200` `void` OK */ @@ -2274,6 +2275,22 @@ export class Api< ...params, }), + /** + * No description + * + * @tags DB Table Column + * @name Get + * @summary Column Get + * @request GET:/api/v1/db/meta/columns/{columnId} + * @response `200` `void` OK + */ + get: (columnId: string, params: RequestParams = {}) => + this.request({ + path: `/api/v1/db/meta/columns/${columnId}`, + method: 'GET', + ...params, + }), + /** * No description * From 2adbc68fce88e4592b8d269937e321cebad4c988 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Mon, 16 Jan 2023 14:28:22 +0800 Subject: [PATCH 05/23] fix(nc-gui): get groupingFieldColumn logic --- packages/nc-gui/composables/useKanbanViewStore.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/nc-gui/composables/useKanbanViewStore.ts b/packages/nc-gui/composables/useKanbanViewStore.ts index e75351e669..4beaf05004 100644 --- a/packages/nc-gui/composables/useKanbanViewStore.ts +++ b/packages/nc-gui/composables/useKanbanViewStore.ts @@ -145,7 +145,8 @@ const [useProvideKanbanViewStore, useKanbanViewStore] = useInjectionState( ...(isUIAllowed('filterSync') ? {} : { filterArrJson: JSON.stringify(nestedFilters.value) }), where, }) - : await fetchSharedViewData({ sortsArr: sorts.value, filtersArr: nestedFilters.value }) + : // TODO: add range + await fetchSharedViewData({ sortsArr: sorts.value, filtersArr: nestedFilters.value }) formattedData.value.set(stackTitle, [...formattedData.value.get(stackTitle)!, ...formatData(response.list)]) } @@ -155,9 +156,11 @@ const [useProvideKanbanViewStore, useKanbanViewStore] = useInjectionState( kanbanMetaData.value = isPublic.value ? (sharedView.value?.view as KanbanType) : await $api.dbView.kanbanRead(viewMeta.value.id) + // set groupingField - groupingFieldColumn.value = - (meta.value.columns as ColumnType[]).filter((f) => f.id === kanbanMetaData.value.fk_grp_col_id)[0] || {} + // avoid getting from meta.value.columns + // it would be undefiend as grouping field can be unselected before passing to share view + groupingFieldColumn.value = (await $api.dbTableColumn.get(kanbanMetaData.value.fk_grp_col_id!))! as ColumnType groupingField.value = groupingFieldColumn.value.title! From b9935d14cb14ddccd39bc4713fa6c8d27f1fa128 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Mon, 16 Jan 2023 14:48:31 +0800 Subject: [PATCH 06/23] fix(nc-gui): exclude kanban fk_grp_col_id from meta.value.columns --- packages/nc-gui/composables/useSharedView.ts | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/packages/nc-gui/composables/useSharedView.ts b/packages/nc-gui/composables/useSharedView.ts index d349a7c38f..93477fadbc 100644 --- a/packages/nc-gui/composables/useSharedView.ts +++ b/packages/nc-gui/composables/useSharedView.ts @@ -9,7 +9,7 @@ import type { TableType, ViewType, } from 'nocodb-sdk' -import { UITypes, ViewTypes } from 'nocodb-sdk' +import { UITypes } from 'nocodb-sdk' import { computed, useGlobal, useMetas, useNuxtApp, useState } from '#imports' export function useSharedView() { @@ -71,16 +71,8 @@ export function useSharedView() { let order = 1 - // include kanban grouping field column to share view - // even it is unselected in Fields - // so that it won't break kanban share view - let kanbanGroupingFieldId = '' - if (viewMeta.type === ViewTypes.KANBAN) { - kanbanGroupingFieldId = (await $api.dbView.kanbanRead(viewMeta.id)).fk_grp_col_id! - } - meta.value!.columns = [...viewMeta.model.columns] - .filter((c) => c.show || (viewMeta.type === ViewTypes.KANBAN && c.id === kanbanGroupingFieldId)) + .filter((c) => c.show) .map((c) => ({ ...c, order: order++ })) .sort((a, b) => a.order - b.order) From 00dbc6ecd5e6e76c242e4db785fe8ef9a1399c7b Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Mon, 16 Jan 2023 14:48:37 +0800 Subject: [PATCH 07/23] fix(nocodb): exclude kanban fk_grp_col_id from meta.value.columns --- .../src/lib/meta/api/publicApis/publicMetaApis.ts | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/packages/nocodb/src/lib/meta/api/publicApis/publicMetaApis.ts b/packages/nocodb/src/lib/meta/api/publicApis/publicMetaApis.ts index a57e65f2ee..9bb4aaf946 100644 --- a/packages/nocodb/src/lib/meta/api/publicApis/publicMetaApis.ts +++ b/packages/nocodb/src/lib/meta/api/publicApis/publicMetaApis.ts @@ -7,11 +7,9 @@ import { LinkToAnotherRecordType, RelationTypes, UITypes, - ViewTypes, } from 'nocodb-sdk'; import Column from '../../../models/Column'; import Base from '../../../models/Base'; -import KanbanView from '../../../models/KanbanView'; import Project from '../../../models/Project'; import LinkToAnotherRecordColumn from '../../../models/LinkToAnotherRecordColumn'; @@ -41,21 +39,11 @@ export async function viewMetaGet(req: Request, res: Response) { // todo: return only required props delete view['password']; - // include kanban grouping field column to share view - // even it is unselected in Fields - // so that it won't break kanban share view - let kanbanGroupingFieldId; - if (view.type === ViewTypes.KANBAN) { - kanbanGroupingFieldId = (await KanbanView.get(view.id)).fk_grp_col_id; - } - view.model.columns = view.columns .filter((c) => { const column = view.model.columnsById[c.fk_column_id]; return ( c.show || - (view.type === ViewTypes.KANBAN && - c.fk_column_id === kanbanGroupingFieldId) || (column.rqd && !column.cdf && !column.ai) || column.pk || view.model.columns.some( From 653312773dca96705ca7f21a979810e87d7c6fcb Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Mon, 16 Jan 2023 14:49:34 +0800 Subject: [PATCH 08/23] fix(nc-gui): prohibit to display unshared cover image column --- .../smartsheet/toolbar/FieldsMenu.vue | 41 +++++++++++-------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/packages/nc-gui/components/smartsheet/toolbar/FieldsMenu.vue b/packages/nc-gui/components/smartsheet/toolbar/FieldsMenu.vue index d2b6eda8cb..8a3f66dada 100644 --- a/packages/nc-gui/components/smartsheet/toolbar/FieldsMenu.vue +++ b/packages/nc-gui/components/smartsheet/toolbar/FieldsMenu.vue @@ -84,11 +84,31 @@ const onMove = (_event: { moved: { newIndex: number } }) => { $e('a:fields:reorder') } +const coverOptions = computed(() => { + const filterFields = + fields.value + ?.filter((el) => el.fk_column_id && metaColumnById.value[el.fk_column_id].uidt === UITypes.Attachment) + .map((field) => { + return { + value: field.fk_column_id, + label: field.title, + } + }) ?? [] + return [{ value: null, label: 'No Image' }, ...filterFields] +}) + const coverImageColumnId = computed({ - get: () => - (activeView.value?.type === ViewTypes.GALLERY || activeView.value?.type === ViewTypes.KANBAN) && activeView.value?.view - ? (activeView.value?.view as GalleryType).fk_cover_image_col_id - : undefined, + get: () => { + const fk_cover_image_col_id = + (activeView.value?.type === ViewTypes.GALLERY || activeView.value?.type === ViewTypes.KANBAN) && activeView.value?.view + ? (activeView.value?.view as GalleryType).fk_cover_image_col_id + : undefined + // check if `fk_cover_image_col_id` is in `coverOptions` + // e.g. in share view, users may not share the cover image column + if (coverOptions.value?.find((o) => o.value === fk_cover_image_col_id)) return fk_cover_image_col_id + // set to `No Image` + return null + }, set: async (val) => { if ( (activeView.value?.type === ViewTypes.GALLERY || activeView.value?.type === ViewTypes.KANBAN) && @@ -113,19 +133,6 @@ const coverImageColumnId = computed({ }, }) -const coverOptions = computed(() => { - const filterFields = - fields.value - ?.filter((el) => el.fk_column_id && metaColumnById.value[el.fk_column_id].uidt === UITypes.Attachment) - .map((field) => { - return { - value: field.fk_column_id, - label: field.title, - } - }) ?? [] - return [{ value: null, label: 'No Image' }, ...filterFields] -}) - const getIcon = (c: ColumnType) => h(isVirtualCol(c) ? resolveComponent('SmartsheetHeaderVirtualCellIcon') : resolveComponent('SmartsheetHeaderCellIcon'), { columnMeta: c, From 10421b8370d19d740b6f1c433ff854cf15d6f7be Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Mon, 16 Jan 2023 17:16:41 +0800 Subject: [PATCH 09/23] feat(sdk): add offset to list --- packages/nocodb-sdk/src/lib/Api.ts | 1 + scripts/sdk/swagger.json | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/packages/nocodb-sdk/src/lib/Api.ts b/packages/nocodb-sdk/src/lib/Api.ts index 2dc2830f19..7b619c0d85 100644 --- a/packages/nocodb-sdk/src/lib/Api.ts +++ b/packages/nocodb-sdk/src/lib/Api.ts @@ -3593,6 +3593,7 @@ export class Api< where?: string; /** Query params for nested data */ nested?: any; + offset?: number; }, params: RequestParams = {} ) => diff --git a/scripts/sdk/swagger.json b/scripts/sdk/swagger.json index bc6b326c92..62fb7a6df3 100644 --- a/scripts/sdk/swagger.json +++ b/scripts/sdk/swagger.json @@ -3887,6 +3887,13 @@ "in": "query", "name": "nested", "description": "Query params for nested data" + }, + { + "schema": { + "type": "number" + }, + "in": "query", + "name": "offset" } ], "responses": { From 8b84a76bcb26884695d5bf8ca831f38d35f6cc07 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Mon, 16 Jan 2023 17:22:00 +0800 Subject: [PATCH 10/23] fix(nc-gui): include offset in fetchSharedViewData --- .../nc-gui/composables/useKanbanViewStore.ts | 3 +-- packages/nc-gui/composables/useSharedView.ts | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/packages/nc-gui/composables/useKanbanViewStore.ts b/packages/nc-gui/composables/useKanbanViewStore.ts index 4beaf05004..dcd4110e6b 100644 --- a/packages/nc-gui/composables/useKanbanViewStore.ts +++ b/packages/nc-gui/composables/useKanbanViewStore.ts @@ -145,8 +145,7 @@ const [useProvideKanbanViewStore, useKanbanViewStore] = useInjectionState( ...(isUIAllowed('filterSync') ? {} : { filterArrJson: JSON.stringify(nestedFilters.value) }), where, }) - : // TODO: add range - await fetchSharedViewData({ sortsArr: sorts.value, filtersArr: nestedFilters.value }) + : await fetchSharedViewData({ sortsArr: sorts.value, filtersArr: nestedFilters.value, offset: params.offset }) formattedData.value.set(stackTitle, [...formattedData.value.get(stackTitle)!, ...formatData(response.list)]) } diff --git a/packages/nc-gui/composables/useSharedView.ts b/packages/nc-gui/composables/useSharedView.ts index 93477fadbc..c3129a95a0 100644 --- a/packages/nc-gui/composables/useSharedView.ts +++ b/packages/nc-gui/composables/useSharedView.ts @@ -93,16 +93,27 @@ export function useSharedView() { Object.keys(relatedMetas).forEach((key) => setMeta(relatedMetas[key])) } - const fetchSharedViewData = async ({ sortsArr, filtersArr }: { sortsArr: SortType[]; filtersArr: FilterType[] }) => { + const fetchSharedViewData = async ({ + sortsArr, + filtersArr, + offset, + }: { + sortsArr: SortType[] + filtersArr: FilterType[] + offset?: number + }) => { if (!sharedView.value) return - const page = paginationData.value.page || 1 - const pageSize = paginationData.value.pageSize || appInfoDefaultLimit + if (!offset) { + const page = paginationData.value.page || 1 + const pageSize = paginationData.value.pageSize || appInfoDefaultLimit + offset = (page - 1) * pageSize + } const { data } = await $api.public.dataList( sharedView.value.uuid!, { - offset: (page - 1) * pageSize, + offset, filterArrJson: JSON.stringify(filtersArr ?? nestedFilters.value), sortArrJson: JSON.stringify(sortsArr ?? sorts.value), } as any, From 2c36fcec2b2d01d49a3623ba1595a37e2f1793b4 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Mon, 16 Jan 2023 18:55:00 +0800 Subject: [PATCH 11/23] fix(nc-gui): get public gallery data from sharedView.view --- packages/nc-gui/composables/useViewData.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/nc-gui/composables/useViewData.ts b/packages/nc-gui/composables/useViewData.ts index b572c9aea2..96e8d45ede 100644 --- a/packages/nc-gui/composables/useViewData.ts +++ b/packages/nc-gui/composables/useViewData.ts @@ -49,7 +49,9 @@ export function useViewData( const { getMeta } = useMetas() const appInfoDefaultLimit = appInfo.defaultLimit || 25 + const _paginationData = ref({ page: 1, pageSize: appInfoDefaultLimit }) + const aggCommentCount = ref<{ row_id: string; count: number }[]>([]) const galleryData = ref() @@ -64,7 +66,7 @@ export function useViewData( const { project, isSharedBase } = useProject() - const { fetchSharedViewData, paginationData: sharedPaginationData } = useSharedView() + const { sharedView, fetchSharedViewData, paginationData: sharedPaginationData } = useSharedView() const { $api, $e } = useNuxtApp() @@ -203,8 +205,10 @@ export function useViewData( } async function loadGalleryData() { - if (!viewMeta?.value?.id || isPublic.value) return - galleryData.value = await $api.dbView.galleryRead(viewMeta.value.id) + if (!viewMeta?.value?.id) return + galleryData.value = isPublic.value + ? (sharedView.value?.view as GalleryType) + : await $api.dbView.galleryRead(viewMeta.value.id) } async function insertRow( From 7bfb208746043de3c14697c899949aa6561f0aa5 Mon Sep 17 00:00:00 2001 From: Ekaterina Balakina Date: Mon, 16 Jan 2023 15:38:19 +0300 Subject: [PATCH 12/23] undo removal of select options --- packages/nc-gui/components.d.ts | 1 + .../smartsheet/column/SelectOptions.vue | 155 +++++++++++++----- .../Grid/Column/SelectOptionColumn.ts | 17 ++ .../tests/columnSingleSelect.spec.ts | 7 + 4 files changed, 135 insertions(+), 45 deletions(-) diff --git a/packages/nc-gui/components.d.ts b/packages/nc-gui/components.d.ts index 48b2a268f5..f411158fb1 100644 --- a/packages/nc-gui/components.d.ts +++ b/packages/nc-gui/components.d.ts @@ -124,6 +124,7 @@ declare module '@vue/runtime-core' { MdiArrowDownDropCircleOutline: typeof import('~icons/mdi/arrow-down-drop-circle-outline')['default'] MdiArrowExpand: typeof import('~icons/mdi/arrow-expand')['default'] MdiArrowLeftBold: typeof import('~icons/mdi/arrow-left-bold')['default'] + MdiArrowULeftBottom: typeof import('~icons/mdi/arrow-u-left-bottom')['default'] MdiAt: typeof import('~icons/mdi/at')['default'] MdiBackburger: typeof import('~icons/mdi/backburger')['default'] MdiBookOpenOutline: typeof import('~icons/mdi/book-open-outline')['default'] diff --git a/packages/nc-gui/components/smartsheet/column/SelectOptions.vue b/packages/nc-gui/components/smartsheet/column/SelectOptions.vue index c7169640dc..6999debf89 100644 --- a/packages/nc-gui/components/smartsheet/column/SelectOptions.vue +++ b/packages/nc-gui/components/smartsheet/column/SelectOptions.vue @@ -3,6 +3,14 @@ import Draggable from 'vuedraggable' import { UITypes } from 'nocodb-sdk' import { IsKanbanInj, enumColor, onMounted, useColumnCreateStoreOrThrow, useVModel, watch } from '#imports' +interface Option { + color: string + title: string + id?: string + fk_colum_id?: string + order?: number +} + const props = defineProps<{ value: any }>() @@ -13,7 +21,10 @@ const vModel = useVModel(props, 'value', emit) const { setAdditionalValidations, validateInfos, isPg, isMysql } = useColumnCreateStoreOrThrow() -let options = $ref([]) +let options = $ref([]) +let renderedOptions = $ref<(Option & { status?: 'remove' })[]>([]) +let savedDefaultOption = $ref