Browse Source

refactor: hide mm relation system columns from ui

pull/7524/head
Pranav C 10 months ago
parent
commit
bd6115eb5e
  1. 4
      packages/nc-gui/composables/useViewColumns.ts
  2. 8
      packages/nocodb-sdk/src/lib/UITypes.ts
  3. 1
      packages/nocodb-sdk/src/lib/index.ts

4
packages/nc-gui/composables/useViewColumns.ts

@ -1,4 +1,4 @@
import { ViewTypes, isCreatedOrLastModifiedByCol, isSystemColumn } from 'nocodb-sdk' import { ViewTypes, isCreatedOrLastModifiedByCol, isMMSystemCol, isSystemColumn } from 'nocodb-sdk'
import type { ColumnType, GridColumnReqType, GridColumnType, MapType, TableType, ViewType } from 'nocodb-sdk' import type { ColumnType, GridColumnReqType, GridColumnType, MapType, TableType, ViewType } from 'nocodb-sdk'
import type { ComputedRef, Ref } from 'vue' import type { ComputedRef, Ref } from 'vue'
import { computed, ref, storeToRefs, useBase, useNuxtApp, useRoles, useUndoRedo, watch } from '#imports' import { computed, ref, storeToRefs, useBase, useNuxtApp, useRoles, useUndoRedo, watch } from '#imports'
@ -72,7 +72,7 @@ const [useProvideViewColumns, useViewColumns] = useInjectionState(
fields.value = meta.value?.columns fields.value = meta.value?.columns
?.filter((column: ColumnType) => { ?.filter((column: ColumnType) => {
// filter created by and last modified by system columns // filter created by and last modified by system columns
if (isCreatedOrLastModifiedByCol(column) && column.system) return false if ((isCreatedOrLastModifiedByCol(column) || isMMSystemCol(column)) && column.system) return false
return true return true
}) })
.map((column: ColumnType) => { .map((column: ColumnType) => {

8
packages/nocodb-sdk/src/lib/UITypes.ts

@ -162,6 +162,14 @@ export function isCreatedOrLastModifiedByCol(
); );
} }
export function isMMSystemCol(
col: (ColumnReqType | ColumnType) & { system?: number | boolean }
) {
return (
col.system && [UITypes.LinkToAnotherRecord].includes(<UITypes>col.uidt)
);
}
export function isLinksOrLTAR( export function isLinksOrLTAR(
colOrUidt: ColumnType | { uidt: UITypes | string } | UITypes | string colOrUidt: ColumnType | { uidt: UITypes | string } | UITypes | string
) { ) {

1
packages/nocodb-sdk/src/lib/index.ts

@ -16,6 +16,7 @@ export {
isLinksOrLTAR, isLinksOrLTAR,
isCreatedOrLastModifiedTimeCol, isCreatedOrLastModifiedTimeCol,
isCreatedOrLastModifiedByCol, isCreatedOrLastModifiedByCol,
isMMSystemCol
} from '~/lib/UITypes'; } from '~/lib/UITypes';
export { default as CustomAPI, FileType } from '~/lib/CustomAPI'; export { default as CustomAPI, FileType } from '~/lib/CustomAPI';
export { default as TemplateGenerator } from '~/lib/TemplateGenerator'; export { default as TemplateGenerator } from '~/lib/TemplateGenerator';

Loading…
Cancel
Save