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
}
if (isHiddenCol(col)) {
if (isHiddenCol(col, meta.value)) {
return false
}

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

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

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

@ -27,7 +27,7 @@ const options = computed<ColumnType[]>(
return true
}
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 */
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 (isHiddenCol(c)) {
if (isHiddenCol(c,meta.value)) {
/** ignore mm relation column, created by and last modified by system field */
return false
}
@ -60,7 +60,7 @@ const options = computed<SelectProps['options']>(() =>
return true
}
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 */
return false
}

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

@ -87,7 +87,7 @@ const [useProvideViewColumns, useViewColumns] = useInjectionState(
fields.value = meta.value?.columns
?.filter((column: ColumnType) => {
// filter created by and last modified by system columns
if (isHiddenCol(column)) return false
if (isHiddenCol(column, meta.value)) return false
return true
})
.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 { RelationTypes } from '~/lib/globals';
enum UITypes {
ID = 'ID',
@ -208,17 +209,25 @@ export function isCreatedOrLastModifiedByCol(
}
export function isHiddenCol(
col: (ColumnReqType | ColumnType) & { system?: number | boolean }
col: (ColumnReqType | ColumnType) & {
colOptions?: any;
system?: number | boolean;
},
tableMeta: Partial<TableType>
) {
return (
col.system &&
(
[
UITypes.CreatedBy,
UITypes.LastModifiedBy,
UITypes.LinkToAnotherRecord,
] as string[]
).includes(col.uidt)
if (!col.system) return false;
// hide belongs to column in mm tables only
if (col.uidt === UITypes.LinkToAnotherRecord) {
if (col.colOptions?.type === RelationTypes.BELONGS_TO && tableMeta?.mm) {
return true;
}
// hide system columns in other tables which are has-many used for mm
return col.colOptions?.type === RelationTypes.HAS_MANY;
}
return ([UITypes.CreatedBy, UITypes.LastModifiedBy] as string[]).includes(
col.uidt
);
}

Loading…
Cancel
Save