|
|
@ -21,39 +21,53 @@ const { metas, getMeta } = useMetas() |
|
|
|
|
|
|
|
|
|
|
|
provide(ReadonlyInj, ref(true)) |
|
|
|
provide(ReadonlyInj, ref(true)) |
|
|
|
|
|
|
|
|
|
|
|
const column = inject(ColumnInj) |
|
|
|
const column = inject(ColumnInj, ref()) |
|
|
|
|
|
|
|
|
|
|
|
const meta = inject(MetaInj, ref()) |
|
|
|
const meta = inject(MetaInj, ref()) |
|
|
|
|
|
|
|
|
|
|
|
const value = inject(CellValueInj) |
|
|
|
const cellValue = inject(CellValueInj, ref()) |
|
|
|
|
|
|
|
|
|
|
|
const arrValue = computed(() => (Array.isArray(value?.value) ? value?.value : [value?.value]) ?? []) |
|
|
|
const arrValue = computed(() => { |
|
|
|
|
|
|
|
if (!cellValue.value) return [] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (Array.isArray(cellValue.value)) return cellValue.value |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return [cellValue.value] |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
const relationColumn = computed( |
|
|
|
const relationColumn = computed( |
|
|
|
() => |
|
|
|
() => |
|
|
|
meta.value?.columns?.find((c) => c.id === (column?.value.colOptions as LookupType)?.fk_relation_column_id) as ColumnType & { |
|
|
|
meta.value?.columns?.find((c) => c.id === (column.value?.colOptions as LookupType)?.fk_relation_column_id) as |
|
|
|
colOptions: LinkToAnotherRecordType |
|
|
|
| (ColumnType & { |
|
|
|
}, |
|
|
|
colOptions: LinkToAnotherRecordType | undefined |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
| undefined, |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
watch( |
|
|
|
watch( |
|
|
|
relationColumn, |
|
|
|
relationColumn, |
|
|
|
async () => { |
|
|
|
async (relationCol) => { |
|
|
|
await getMeta(relationColumn.value.colOptions.fk_related_model_id!) |
|
|
|
if (relationCol && relationCol.colOptions) await getMeta(relationCol.colOptions.fk_related_model_id!) |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ immediate: true }, |
|
|
|
{ immediate: true }, |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
const lookupTableMeta = computed(() => metas.value[relationColumn.value.colOptions.fk_related_model_id!]) |
|
|
|
const lookupTableMeta = computed<Record<string, any> | undefined>(() => { |
|
|
|
|
|
|
|
if (relationColumn.value && relationColumn.value?.colOptions) |
|
|
|
|
|
|
|
return metas.value[relationColumn.value.colOptions.fk_related_model_id!] |
|
|
|
|
|
|
|
|
|
|
|
const lookupColumn = computed<any>( |
|
|
|
return undefined |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const lookupColumn = computed( |
|
|
|
() => |
|
|
|
() => |
|
|
|
lookupTableMeta.value?.columns?.find( |
|
|
|
lookupTableMeta.value?.columns?.find((c: any) => c.id === (column.value?.colOptions as LookupType)?.fk_lookup_column_id) as |
|
|
|
(c: Record<string, any>) => c.id === (column?.value.colOptions as LookupType)?.fk_lookup_column_id, |
|
|
|
| ColumnType |
|
|
|
) as ColumnType, |
|
|
|
| undefined, |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
provide(MetaInj, lookupTableMeta) |
|
|
|
provide(MetaInj, lookupTableMeta) |
|
|
|
|
|
|
|
|
|
|
|
provide(CellUrlDisableOverlayInj, ref(true)) |
|
|
|
provide(CellUrlDisableOverlayInj, ref(true)) |
|
|
|
|
|
|
|
|
|
|
|
const timeout = 3000 // in ms |
|
|
|
const timeout = 3000 // in ms |
|
|
|