|
|
@ -1,4 +1,5 @@ |
|
|
|
<script setup lang="ts"> |
|
|
|
<script setup lang="ts"> |
|
|
|
|
|
|
|
import type { ColumnType, LinkToAnotherRecordType, TableType } from 'nocodb-sdk' |
|
|
|
import { UITypes, isSystemColumn } from 'nocodb-sdk' |
|
|
|
import { UITypes, isSystemColumn } from 'nocodb-sdk' |
|
|
|
import { useColumnCreateStoreOrThrow } from '#imports' |
|
|
|
import { useColumnCreateStoreOrThrow } from '#imports' |
|
|
|
import { MetaInj } from '~/context' |
|
|
|
import { MetaInj } from '~/context' |
|
|
@ -27,25 +28,17 @@ const refTables = $computed(() => { |
|
|
|
return [] |
|
|
|
return [] |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// todo: type issues with ColumnType so we have to cast to any |
|
|
|
|
|
|
|
return ( |
|
|
|
|
|
|
|
meta.columns |
|
|
|
|
|
|
|
?.filter((c: any) => c.uidt === UITypes.LinkToAnotherRecord && c.colOptions?.type !== 'bt' && !c.system) |
|
|
|
|
|
|
|
.map((c) => ({ |
|
|
|
|
|
|
|
col: c.colOptions, |
|
|
|
|
|
|
|
column: c, |
|
|
|
|
|
|
|
...tables.find((t) => t.id === (c.colOptions as any)?.fk_related_model_id), |
|
|
|
|
|
|
|
})) |
|
|
|
|
|
|
|
.filter((table: any) => table.col?.fk_related_model_id === table.id && !table.mm) ?? [] |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
return meta.columns |
|
|
|
return meta.columns |
|
|
|
.filter((c) => c.uidt === UITypes.LinkToAnotherRecord && !c.system) |
|
|
|
.filter((c: ColumnType) => c.uidt === UITypes.LinkToAnotherRecord && !c.system) |
|
|
|
.map((c) => ({ |
|
|
|
.map<TableType & { col: LinkToAnotherRecordType; column: ColumnType }>((c: ColumnType) => ({ |
|
|
|
col: c.colOptions, |
|
|
|
col: c.colOptions, |
|
|
|
column: c, |
|
|
|
column: c, |
|
|
|
...tables.find((t) => t.id === c.colOptions.fk_related_model_id), |
|
|
|
...tables.find((t) => t.id === (c.colOptions as LinkToAnotherRecordType).fk_related_model_id), |
|
|
|
})) |
|
|
|
})) |
|
|
|
.filter((table) => table.col.fk_related_model_id === table.id && !table.mm) |
|
|
|
.filter( |
|
|
|
|
|
|
|
(table: TableType & { col: LinkToAnotherRecordType; column: ColumnType }) => |
|
|
|
|
|
|
|
table.col.fk_related_model_id === table.id && !table.mm, |
|
|
|
|
|
|
|
) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
const columns = $computed(() => { |
|
|
|
const columns = $computed(() => { |
|
|
|