|
|
@ -1,4 +1,14 @@ |
|
|
|
import type { ColumnType, LinkToAnotherRecordType, PaginatedType, RequestParams, TableType } from 'nocodb-sdk' |
|
|
|
import { |
|
|
|
|
|
|
|
UITypes, |
|
|
|
|
|
|
|
type ColumnType, |
|
|
|
|
|
|
|
type LinkToAnotherRecordType, |
|
|
|
|
|
|
|
type PaginatedType, |
|
|
|
|
|
|
|
type RequestParams, |
|
|
|
|
|
|
|
type TableType, |
|
|
|
|
|
|
|
dateFormats, |
|
|
|
|
|
|
|
timeFormats, |
|
|
|
|
|
|
|
parseStringDateTime, |
|
|
|
|
|
|
|
} from 'nocodb-sdk' |
|
|
|
import type { ComputedRef, Ref } from 'vue' |
|
|
|
import type { ComputedRef, Ref } from 'vue' |
|
|
|
import { |
|
|
|
import { |
|
|
|
IsPublicInj, |
|
|
|
IsPublicInj, |
|
|
@ -20,6 +30,7 @@ import { |
|
|
|
useRouter, |
|
|
|
useRouter, |
|
|
|
useSharedView, |
|
|
|
useSharedView, |
|
|
|
watch, |
|
|
|
watch, |
|
|
|
|
|
|
|
parseProp, |
|
|
|
} from '#imports' |
|
|
|
} from '#imports' |
|
|
|
import type { Row } from '#imports' |
|
|
|
import type { Row } from '#imports' |
|
|
|
|
|
|
|
|
|
|
@ -124,10 +135,52 @@ const [useProvideLTARStore, useLTARStore] = useInjectionState( |
|
|
|
const relatedTablePrimaryKeyProps = computed(() => { |
|
|
|
const relatedTablePrimaryKeyProps = computed(() => { |
|
|
|
return relatedTableMeta.value?.columns?.filter((c) => c.pk)?.map((c) => c.title) ?? [] |
|
|
|
return relatedTableMeta.value?.columns?.filter((c) => c.pk)?.map((c) => c.title) ?? [] |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
const displayValueProp = computed(() => { |
|
|
|
const displayValueProp = computed(() => { |
|
|
|
return (meta.value?.columns?.find((c: Required<ColumnType>) => c.pv) || relatedTableMeta?.value?.columns?.[0])?.title |
|
|
|
return (meta.value?.columns?.find((c: Required<ColumnType>) => c.pv) || relatedTableMeta?.value?.columns?.[0])?.title |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const displayValueTypeAndFormatProp = computed(() => { |
|
|
|
|
|
|
|
let displayValueTypeAndFormat = { |
|
|
|
|
|
|
|
type: '', |
|
|
|
|
|
|
|
format: '', |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
let currentColumn = relatedTableMeta.value?.columns?.find((c) => c.pv) || relatedTableMeta?.value?.columns?.[0] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (currentColumn) { |
|
|
|
|
|
|
|
if (currentColumn?.uidt === UITypes.DateTime) { |
|
|
|
|
|
|
|
displayValueTypeAndFormat = { |
|
|
|
|
|
|
|
type: currentColumn?.uidt, |
|
|
|
|
|
|
|
format: `${parseProp(currentColumn?.meta)?.date_format ?? dateFormats[0]} ${ |
|
|
|
|
|
|
|
parseProp(currentColumn?.meta)?.time_format ?? timeFormats[0] |
|
|
|
|
|
|
|
}`,
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (currentColumn?.uidt === UITypes.Time) { |
|
|
|
|
|
|
|
displayValueTypeAndFormat = { |
|
|
|
|
|
|
|
type: currentColumn?.uidt, |
|
|
|
|
|
|
|
format: `${timeFormats[0]}`, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return displayValueTypeAndFormat |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const headerDisplayValue = computed(() => { |
|
|
|
|
|
|
|
if ( |
|
|
|
|
|
|
|
row.value.row[displayValueProp.value] && |
|
|
|
|
|
|
|
displayValueTypeAndFormatProp.value.type && |
|
|
|
|
|
|
|
displayValueTypeAndFormatProp.value.format |
|
|
|
|
|
|
|
) { |
|
|
|
|
|
|
|
return parseStringDateTime( |
|
|
|
|
|
|
|
row.value.row[displayValueProp.value], |
|
|
|
|
|
|
|
displayValueTypeAndFormatProp.value.format, |
|
|
|
|
|
|
|
!(displayValueTypeAndFormatProp.value.format === UITypes.Time), |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return row.value.row[displayValueProp.value] |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
const loadChildrenExcludedList = async (activeState?: any) => { |
|
|
|
const loadChildrenExcludedList = async (activeState?: any) => { |
|
|
|
if (activeState) newRowState.state = activeState |
|
|
|
if (activeState) newRowState.state = activeState |
|
|
|
try { |
|
|
|
try { |
|
|
@ -470,6 +523,7 @@ const [useProvideLTARStore, useLTARStore] = useInjectionState( |
|
|
|
relatedTableMeta, |
|
|
|
relatedTableMeta, |
|
|
|
loadRelatedTableMeta, |
|
|
|
loadRelatedTableMeta, |
|
|
|
relatedTableDisplayValueProp, |
|
|
|
relatedTableDisplayValueProp, |
|
|
|
|
|
|
|
displayValueTypeAndFormatProp, |
|
|
|
childrenExcludedList, |
|
|
|
childrenExcludedList, |
|
|
|
childrenList, |
|
|
|
childrenList, |
|
|
|
childrenListCount, |
|
|
|
childrenListCount, |
|
|
@ -491,6 +545,7 @@ const [useProvideLTARStore, useLTARStore] = useInjectionState( |
|
|
|
isChildrenExcludedLoading, |
|
|
|
isChildrenExcludedLoading, |
|
|
|
deleteRelatedRow, |
|
|
|
deleteRelatedRow, |
|
|
|
getRelatedTableRowId, |
|
|
|
getRelatedTableRowId, |
|
|
|
|
|
|
|
headerDisplayValue |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
'ltar-store', |
|
|
|
'ltar-store', |
|
|
|