mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
647 B
19 lines
647 B
import type { ColumnType, TableType } from 'nocodb-sdk' |
|
import { useMetas } from './useMetas' |
|
|
|
export default function (column: ColumnType) { |
|
const { metas, getMeta } = useMetas() |
|
const childMeta = computed<TableType>(() => { |
|
return metas.value?.[(column.colOptions as any)?.fk_related_model_id as string] |
|
}) |
|
|
|
const loadChildMeta = async () => { |
|
await getMeta((column.colOptions as any)?.fk_related_model_id as string) |
|
} |
|
|
|
const primaryValueProp = computed(() => { |
|
return (childMeta?.value?.columns?.find((c) => c.pv) || childMeta?.value?.columns?.[0])?.title |
|
}) |
|
|
|
return { childMeta, loadChildMeta, primaryValueProp } |
|
}
|
|
|