diff --git a/packages/nc-gui-v2/components.d.ts b/packages/nc-gui-v2/components.d.ts index 81c6f68b43..16738d7540 100644 --- a/packages/nc-gui-v2/components.d.ts +++ b/packages/nc-gui-v2/components.d.ts @@ -15,6 +15,7 @@ declare module '@vue/runtime-core' { ACardMeta: typeof import('ant-design-vue/es')['CardMeta'] ACarousel: typeof import('ant-design-vue/es')['Carousel'] ACheckbox: typeof import('ant-design-vue/es')['Checkbox'] + ACheckboxGroup: typeof import('ant-design-vue/es')['CheckboxGroup'] ACol: typeof import('ant-design-vue/es')['Col'] ACollapse: typeof import('ant-design-vue/es')['Collapse'] ACollapsePanel: typeof import('ant-design-vue/es')['CollapsePanel'] diff --git a/packages/nc-gui-v2/components/dlg/TableCreate.vue b/packages/nc-gui-v2/components/dlg/TableCreate.vue index d1963b552d..8c0349777c 100644 --- a/packages/nc-gui-v2/components/dlg/TableCreate.vue +++ b/packages/nc-gui-v2/components/dlg/TableCreate.vue @@ -45,6 +45,11 @@ const validators = computed(() => { }) const { validateInfos } = useForm(table, validators) +const systemColumnsCheckboxInfo = SYSTEM_COLUMNS.map((c, index) => ({ + value: c, + disabled: index === 0, +})) + onMounted(() => { generateUniqueTitle() @@ -78,8 +83,8 @@ onMounted(() => { /> -
-
+
+
{{ isAdvanceOptVisible ? 'Hide' : 'Show' }} more @@ -95,32 +100,29 @@ onMounted(() => {
-
+
{{ $t('msg.info.addDefaultColumns') }}
- - - - ID - - - - - title - - - - created_at - - - - updated_at - + + +
diff --git a/packages/nc-gui-v2/composables/useTable.ts b/packages/nc-gui-v2/composables/useTable.ts index 63ba8a2ce6..3da3c15639 100644 --- a/packages/nc-gui-v2/composables/useTable.ts +++ b/packages/nc-gui-v2/composables/useTable.ts @@ -1,16 +1,15 @@ import { Modal, message } from 'ant-design-vue' import type { LinkToAnotherRecordType, TableType } from 'nocodb-sdk' import { UITypes } from 'nocodb-sdk' -import { useProject } from './useProject' -import { TabType } from '~/composables/useTabs' -import { extractSdkResponseErrorMsg } from '~/utils' import { useNuxtApp } from '#app' +import { TabType } from '~/composables/useTabs' +import { SYSTEM_COLUMNS, extractSdkResponseErrorMsg, useProject } from '#imports' export function useTable(onTableCreate?: (tableMeta: TableType) => void) { const table = reactive<{ title: string; table_name: string; columns: string[] }>({ title: '', table_name: '', - columns: ['id', 'title', 'created_at', 'updated_at'], + columns: SYSTEM_COLUMNS, }) const { $e, $api } = useNuxtApp() diff --git a/packages/nc-gui-v2/lib/constants.ts b/packages/nc-gui-v2/lib/constants.ts index 21806b0541..7b6465b2aa 100644 --- a/packages/nc-gui-v2/lib/constants.ts +++ b/packages/nc-gui-v2/lib/constants.ts @@ -1,2 +1,3 @@ export const NOCO = 'noco' export const USER_PROJECT_ROLES = 'user_project_roles' +export const SYSTEM_COLUMNS = ['id', 'title', 'created_at', 'updated_at']