|
|
@ -1,10 +1,18 @@ |
|
|
|
import type { ColumnType, LinkToAnotherRecordType, PaginatedType, TableType } from 'nocodb-sdk' |
|
|
|
import type { ColumnType, LinkToAnotherRecordType, PaginatedType, TableType } from 'nocodb-sdk' |
|
|
|
import type { ComputedRef, Ref } from 'vue' |
|
|
|
import type { ComputedRef, Ref } from 'vue' |
|
|
|
import { Modal, message } from 'ant-design-vue' |
|
|
|
import { Modal, message } from 'ant-design-vue' |
|
|
|
import { useInjectionState, useMetas, useProject } from '#imports' |
|
|
|
import { |
|
|
|
import { NOCO } from '~/lib' |
|
|
|
NOCO, |
|
|
|
|
|
|
|
computed, |
|
|
|
|
|
|
|
extractSdkResponseErrorMsg, |
|
|
|
|
|
|
|
reactive, |
|
|
|
|
|
|
|
ref, |
|
|
|
|
|
|
|
useInjectionState, |
|
|
|
|
|
|
|
useMetas, |
|
|
|
|
|
|
|
useNuxtApp, |
|
|
|
|
|
|
|
useProject, |
|
|
|
|
|
|
|
} from '#imports' |
|
|
|
import type { Row } from '~/composables' |
|
|
|
import type { Row } from '~/composables' |
|
|
|
import { extractSdkResponseErrorMsg } from '~/utils' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
interface DataApiResponse { |
|
|
|
interface DataApiResponse { |
|
|
|
list: Record<string, any> |
|
|
|
list: Record<string, any> |
|
|
@ -13,13 +21,13 @@ interface DataApiResponse { |
|
|
|
|
|
|
|
|
|
|
|
/** Store for managing Link to another cells */ |
|
|
|
/** Store for managing Link to another cells */ |
|
|
|
const [useProvideLTARStore, useLTARStore] = useInjectionState( |
|
|
|
const [useProvideLTARStore, useLTARStore] = useInjectionState( |
|
|
|
(column: Ref<Required<ColumnType>>, row?: Ref<Row>, isNewRow: ComputedRef<boolean> | Ref<boolean>, reloadData = () => {}) => { |
|
|
|
(column: Ref<Required<ColumnType>>, row: Ref<Row>, isNewRow: ComputedRef<boolean> | Ref<boolean>, reloadData = () => {}) => { |
|
|
|
// state
|
|
|
|
// state
|
|
|
|
const { metas, getMeta } = useMetas() |
|
|
|
const { metas, getMeta } = useMetas() |
|
|
|
const { project } = useProject() |
|
|
|
const { project } = useProject() |
|
|
|
const { $api } = useNuxtApp() |
|
|
|
const { $api } = useNuxtApp() |
|
|
|
const childrenExcludedList: Ref<DataApiResponse | undefined> = ref() |
|
|
|
const childrenExcludedList = ref<DataApiResponse | undefined>() |
|
|
|
const childrenList: Ref<DataApiResponse | undefined> = ref() |
|
|
|
const childrenList = ref<DataApiResponse | undefined>() |
|
|
|
const childrenExcludedListPagination = reactive({ |
|
|
|
const childrenExcludedListPagination = reactive({ |
|
|
|
page: 1, |
|
|
|
page: 1, |
|
|
|
query: '', |
|
|
|
query: '', |
|
|
@ -95,12 +103,13 @@ const [useProvideLTARStore, useLTARStore] = useInjectionState( |
|
|
|
colOptions.type as 'mm' | 'hm', |
|
|
|
colOptions.type as 'mm' | 'hm', |
|
|
|
column?.value?.title, |
|
|
|
column?.value?.title, |
|
|
|
{ |
|
|
|
{ |
|
|
|
limit: childrenExcludedListPagination.size, |
|
|
|
limit: String(childrenExcludedListPagination.size), |
|
|
|
offset: childrenExcludedListPagination.size * (childrenExcludedListPagination.page - 1), |
|
|
|
offset: String(childrenExcludedListPagination.size * (childrenExcludedListPagination.page - 1)), |
|
|
|
|
|
|
|
// todo: where clause is missing from type
|
|
|
|
where: |
|
|
|
where: |
|
|
|
childrenExcludedListPagination.query && |
|
|
|
childrenExcludedListPagination.query && |
|
|
|
`(${relatedTablePrimaryValueProp.value},like,${childrenExcludedListPagination.query})`, |
|
|
|
`(${relatedTablePrimaryValueProp.value},like,${childrenExcludedListPagination.query})`, |
|
|
|
}, |
|
|
|
} as any, |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (e: any) { |
|
|
|
} catch (e: any) { |
|
|
@ -120,10 +129,10 @@ const [useProvideLTARStore, useLTARStore] = useInjectionState( |
|
|
|
colOptions.type as 'mm' | 'hm', |
|
|
|
colOptions.type as 'mm' | 'hm', |
|
|
|
column?.value?.title, |
|
|
|
column?.value?.title, |
|
|
|
{ |
|
|
|
{ |
|
|
|
limit: childrenListPagination.size, |
|
|
|
limit: String(childrenListPagination.size), |
|
|
|
offset: childrenListPagination.size * (childrenListPagination.page - 1), |
|
|
|
offset: String(childrenListPagination.size * (childrenListPagination.page - 1)), |
|
|
|
where: childrenListPagination.query && `(${relatedTablePrimaryValueProp.value},like,${childrenListPagination.query})`, |
|
|
|
where: childrenListPagination.query && `(${relatedTablePrimaryValueProp.value},like,${childrenListPagination.query})`, |
|
|
|
}, |
|
|
|
} as any, |
|
|
|
) |
|
|
|
) |
|
|
|
} catch (e: any) { |
|
|
|
} catch (e: any) { |
|
|
|
message.error(`Failed to load children list: ${await extractSdkResponseErrorMsg(e)}`) |
|
|
|
message.error(`Failed to load children list: ${await extractSdkResponseErrorMsg(e)}`) |
|
|
|