|
|
@ -1,5 +1,4 @@ |
|
|
|
<script lang="ts" setup> |
|
|
|
<script lang="ts" setup> |
|
|
|
import type { VNodeRef } from '@vue/runtime-core' |
|
|
|
|
|
|
|
import { type ColumnType, isLinksOrLTAR, isSystemColumn } from 'nocodb-sdk' |
|
|
|
import { type ColumnType, isLinksOrLTAR, isSystemColumn } from 'nocodb-sdk' |
|
|
|
import type { Row } from '#imports' |
|
|
|
import type { Row } from '#imports' |
|
|
|
import InboxIcon from '~icons/nc-icons/inbox' |
|
|
|
import InboxIcon from '~icons/nc-icons/inbox' |
|
|
@ -42,6 +41,8 @@ const injectedColumn = inject(ColumnInj, ref()) |
|
|
|
|
|
|
|
|
|
|
|
const readOnly = inject(ReadonlyInj, ref(false)) |
|
|
|
const readOnly = inject(ReadonlyInj, ref(false)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const filterQueryRef = ref() |
|
|
|
|
|
|
|
|
|
|
|
const { isSharedBase } = storeToRefs(useBase()) |
|
|
|
const { isSharedBase } = storeToRefs(useBase()) |
|
|
|
|
|
|
|
|
|
|
|
const { |
|
|
|
const { |
|
|
@ -63,15 +64,6 @@ const { |
|
|
|
|
|
|
|
|
|
|
|
const { isNew, state, removeLTARRef, addLTARRef } = useSmartsheetRowStoreOrThrow() |
|
|
|
const { isNew, state, removeLTARRef, addLTARRef } = useSmartsheetRowStoreOrThrow() |
|
|
|
|
|
|
|
|
|
|
|
const colTitle = computed(() => injectedColumn.value?.title || '') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const isDataExist = computed<boolean>(() => { |
|
|
|
|
|
|
|
return childrenList.value?.pageInfo?.totalRows || (isNew.value && state.value?.[colTitle.value]?.length) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const filterQueryFocus: VNodeRef = (el) => |
|
|
|
|
|
|
|
vModel.value && (isPublic.value || readOnly.value ? isDataExist.value : true) && (el as HTMLInputElement)?.focus() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
watch( |
|
|
|
watch( |
|
|
|
[vModel, isForm], |
|
|
|
[vModel, isForm], |
|
|
|
(nextVal) => { |
|
|
|
(nextVal) => { |
|
|
@ -112,6 +104,8 @@ const expandedFormDlg = ref(false) |
|
|
|
|
|
|
|
|
|
|
|
const expandedFormRow = ref({}) |
|
|
|
const expandedFormRow = ref({}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const colTitle = computed(() => injectedColumn.value?.title || '') |
|
|
|
|
|
|
|
|
|
|
|
const onClick = (row: Row) => { |
|
|
|
const onClick = (row: Row) => { |
|
|
|
if (readOnly.value) return |
|
|
|
if (readOnly.value) return |
|
|
|
expandedFormRow.value = row |
|
|
|
expandedFormRow.value = row |
|
|
@ -135,6 +129,10 @@ watch(expandedFormDlg, () => { |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
watch(filterQueryRef, () => { |
|
|
|
|
|
|
|
filterQueryRef.value?.focus() |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
onKeyStroke('Escape', () => { |
|
|
|
onKeyStroke('Escape', () => { |
|
|
|
vModel.value = false |
|
|
|
vModel.value = false |
|
|
|
}) |
|
|
|
}) |
|
|
@ -166,6 +164,10 @@ const totalItemsToShow = computed(() => { |
|
|
|
return childrenListCount.value |
|
|
|
return childrenListCount.value |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const isDataExist = computed<boolean>(() => { |
|
|
|
|
|
|
|
return childrenList.value?.pageInfo?.totalRows || (isNew.value && state.value?.[colTitle.value]?.length) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
const linkOrUnLink = (rowRef: Record<string, string>, id: string) => { |
|
|
|
const linkOrUnLink = (rowRef: Record<string, string>, id: string) => { |
|
|
|
if (isSharedBase.value) return |
|
|
|
if (isSharedBase.value) return |
|
|
|
if (readOnly.value) return |
|
|
|
if (readOnly.value) return |
|
|
@ -200,10 +202,10 @@ const linkOrUnLink = (rowRef: Record<string, string>, id: string) => { |
|
|
|
:display-value="headerDisplayValue" |
|
|
|
:display-value="headerDisplayValue" |
|
|
|
/> |
|
|
|
/> |
|
|
|
<div v-if="!isForm" class="flex mt-2 mb-2 items-center gap-2"> |
|
|
|
<div v-if="!isForm" class="flex mt-2 mb-2 items-center gap-2"> |
|
|
|
<div class="flex items-center border-1 p-1 rounded-md w-full border-gray-200 focus-within:!border-primary"> |
|
|
|
<div class="flex items-center border-1 p-1 rounded-md w-full border-gray-200 !focus-within:border-primary"> |
|
|
|
<MdiMagnify class="w-5 h-5 ml-2 text-gray-500" /> |
|
|
|
<MdiMagnify class="w-5 h-5 ml-2 text-gray-500" /> |
|
|
|
<a-input |
|
|
|
<a-input |
|
|
|
:ref="filterQueryFocus" |
|
|
|
ref="filterQueryRef" |
|
|
|
v-model:value="childrenListPagination.query" |
|
|
|
v-model:value="childrenListPagination.query" |
|
|
|
:placeholder="`Search in ${relatedTableMeta?.title}`" |
|
|
|
:placeholder="`Search in ${relatedTableMeta?.title}`" |
|
|
|
class="w-full !sm:rounded-md xs:min-h-8 !xs:rounded-xl" |
|
|
|
class="w-full !sm:rounded-md xs:min-h-8 !xs:rounded-xl" |
|
|
|