Browse Source

fix: show bt relation of self-link under system fields

pull/9013/head
Pranav C 4 months ago
parent
commit
3b68f20ee5
  1. 2
      packages/nc-gui/components/smartsheet/column/FormulaOptions.vue
  2. 2
      packages/nc-gui/components/smartsheet/toolbar/CreateGroupBy.vue
  3. 2
      packages/nc-gui/components/smartsheet/toolbar/CreateSort.vue
  4. 4
      packages/nc-gui/components/smartsheet/toolbar/FieldListAutoCompleteDropdown.vue
  5. 2
      packages/nc-gui/composables/useViewColumns.ts
  6. 31
      packages/nocodb-sdk/src/lib/UITypes.ts

2
packages/nc-gui/components/smartsheet/column/FormulaOptions.vue

@ -37,7 +37,7 @@ const supportedColumns = computed(
return false return false
} }
if (isHiddenCol(col)) { if (isHiddenCol(col, meta.value)) {
return false return false
} }

2
packages/nc-gui/components/smartsheet/toolbar/CreateGroupBy.vue

@ -32,7 +32,7 @@ const options = computed<ColumnType[]>(
return false return false
} }
if (isHiddenCol(c)) { if (isHiddenCol(c, meta.value)) {
/** ignore mm relation column, created by and last modified by system field */ /** ignore mm relation column, created by and last modified by system field */
return false return false
} }

2
packages/nc-gui/components/smartsheet/toolbar/CreateSort.vue

@ -27,7 +27,7 @@ const options = computed<ColumnType[]>(
return true return true
} }
if (isSystemColumn(metaColumnById?.value?.[c.id!])) { if (isSystemColumn(metaColumnById?.value?.[c.id!])) {
if (isHiddenCol(c)) { if (isHiddenCol(c,meta.value)) {
/** ignore mm relation column, created by and last modified by system field */ /** ignore mm relation column, created by and last modified by system field */
return false return false
} }

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

@ -39,7 +39,7 @@ const options = computed<SelectProps['options']>(() =>
} }
if (isSystemColumn(metaColumnById?.value?.[c.id!])) { if (isSystemColumn(metaColumnById?.value?.[c.id!])) {
if (isHiddenCol(c)) { if (isHiddenCol(c,meta.value)) {
/** ignore mm relation column, created by and last modified by system field */ /** ignore mm relation column, created by and last modified by system field */
return false return false
} }
@ -60,7 +60,7 @@ const options = computed<SelectProps['options']>(() =>
return true return true
} }
if (isSystemColumn(metaColumnById?.value?.[c.id!])) { if (isSystemColumn(metaColumnById?.value?.[c.id!])) {
if (isHiddenCol(c)) { if (isHiddenCol(c, meta.value)) {
/** ignore mm relation column, created by and last modified by system field */ /** ignore mm relation column, created by and last modified by system field */
return false return false
} }

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

@ -87,7 +87,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 (isHiddenCol(column)) return false if (isHiddenCol(column, meta.value)) return false
return true return true
}) })
.map((column: ColumnType) => { .map((column: ColumnType) => {

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

@ -1,5 +1,6 @@
import { ColumnReqType, ColumnType } from './Api'; import { ColumnReqType, ColumnType, TableType } from './Api';
import { FormulaDataTypes } from './formulaHelpers'; import { FormulaDataTypes } from './formulaHelpers';
import { RelationTypes } from '~/lib/globals';
enum UITypes { enum UITypes {
ID = 'ID', ID = 'ID',
@ -208,17 +209,25 @@ export function isCreatedOrLastModifiedByCol(
} }
export function isHiddenCol( export function isHiddenCol(
col: (ColumnReqType | ColumnType) & { system?: number | boolean } col: (ColumnReqType | ColumnType) & {
colOptions?: any;
system?: number | boolean;
},
tableMeta: Partial<TableType>
) { ) {
return ( if (!col.system) return false;
col.system &&
( // hide belongs to column in mm tables only
[ if (col.uidt === UITypes.LinkToAnotherRecord) {
UITypes.CreatedBy, if (col.colOptions?.type === RelationTypes.BELONGS_TO && tableMeta?.mm) {
UITypes.LastModifiedBy, return true;
UITypes.LinkToAnotherRecord, }
] as string[] // hide system columns in other tables which are has-many used for mm
).includes(col.uidt) return col.colOptions?.type === RelationTypes.HAS_MANY;
}
return ([UITypes.CreatedBy, UITypes.LastModifiedBy] as string[]).includes(
col.uidt
); );
} }

Loading…
Cancel
Save