|
|
@ -1,4 +1,5 @@ |
|
|
|
<script lang="ts" setup> |
|
|
|
<script lang="ts" setup> |
|
|
|
|
|
|
|
import { onUnmounted } from '@vue/runtime-core' |
|
|
|
import { RelationTypes, UITypes } from 'nocodb-sdk' |
|
|
|
import { RelationTypes, UITypes } from 'nocodb-sdk' |
|
|
|
import type { ColumnType, LinkToAnotherRecordType } from 'nocodb-sdk' |
|
|
|
import type { ColumnType, LinkToAnotherRecordType } from 'nocodb-sdk' |
|
|
|
import { |
|
|
|
import { |
|
|
@ -12,6 +13,7 @@ import { |
|
|
|
useVModel, |
|
|
|
useVModel, |
|
|
|
watch, |
|
|
|
watch, |
|
|
|
} from '#imports' |
|
|
|
} from '#imports' |
|
|
|
|
|
|
|
import { useSelectedCellKeyupListener } from '~/composables/useSelectedCellKeyupListener' |
|
|
|
import { IsPublicInj } from '~/context' |
|
|
|
import { IsPublicInj } from '~/context' |
|
|
|
|
|
|
|
|
|
|
|
const props = defineProps<{ modelValue: boolean }>() |
|
|
|
const props = defineProps<{ modelValue: boolean }>() |
|
|
@ -38,6 +40,8 @@ const { addLTARRef, isNew } = useSmartsheetRowStoreOrThrow() |
|
|
|
|
|
|
|
|
|
|
|
const isPublic = inject(IsPublicInj, ref(false)) |
|
|
|
const isPublic = inject(IsPublicInj, ref(false)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const selectedRowIndex = ref(0) |
|
|
|
|
|
|
|
|
|
|
|
const linkRow = async (row: Record<string, any>) => { |
|
|
|
const linkRow = async (row: Record<string, any>) => { |
|
|
|
if (isNew.value) { |
|
|
|
if (isNew.value) { |
|
|
|
addLTARRef(row, column?.value as ColumnType) |
|
|
|
addLTARRef(row, column?.value as ColumnType) |
|
|
@ -54,6 +58,7 @@ watch(vModel, (nextVal, prevVal) => { |
|
|
|
childrenExcludedListPagination.query = '' |
|
|
|
childrenExcludedListPagination.query = '' |
|
|
|
childrenExcludedListPagination.page = 1 |
|
|
|
childrenExcludedListPagination.page = 1 |
|
|
|
loadChildrenExcludedList() |
|
|
|
loadChildrenExcludedList() |
|
|
|
|
|
|
|
selectedRowIndex.value = 0 |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
@ -99,13 +104,29 @@ watch(expandedFormDlg, (nexVal) => { |
|
|
|
if (!nexVal && !isNew.value) vModel.value = false |
|
|
|
if (!nexVal && !isNew.value) vModel.value = false |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
// useEventListener((e: KeyboardEvent) => { |
|
|
|
const removeListeners = useSelectedCellKeyupListener(vModel, (e: KeyboardEvent) => { |
|
|
|
// switch (e.key) { |
|
|
|
switch (e.key) { |
|
|
|
// case 'Enter': |
|
|
|
case 'ArrowUp': |
|
|
|
// e.preventDefault() |
|
|
|
selectedRowIndex.value = Math.max(0, selectedRowIndex.value - 1) |
|
|
|
// break |
|
|
|
e.stopPropagation() |
|
|
|
// } |
|
|
|
break |
|
|
|
// }) |
|
|
|
case 'ArrowDown': |
|
|
|
|
|
|
|
selectedRowIndex.value = Math.min(childrenExcludedList.value?.list?.length - 1, selectedRowIndex.value + 1) |
|
|
|
|
|
|
|
e.stopPropagation() |
|
|
|
|
|
|
|
break |
|
|
|
|
|
|
|
case 'Enter': |
|
|
|
|
|
|
|
const selectedRow = childrenExcludedList.value?.list?.[selectedRowIndex.value] |
|
|
|
|
|
|
|
if (selectedRow) { |
|
|
|
|
|
|
|
linkRow(selectedRow) |
|
|
|
|
|
|
|
e.stopPropagation() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
break |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, true) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onUnmounted(() => { |
|
|
|
|
|
|
|
removeListeners() |
|
|
|
|
|
|
|
}) |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<template> |
|
|
|
<template> |
|
|
@ -123,6 +144,7 @@ watch(expandedFormDlg, (nexVal) => { |
|
|
|
:placeholder="$t('placeholder.filterQuery')" |
|
|
|
:placeholder="$t('placeholder.filterQuery')" |
|
|
|
class="max-w-[200px]" |
|
|
|
class="max-w-[200px]" |
|
|
|
size="small" |
|
|
|
size="small" |
|
|
|
|
|
|
|
@keydown.capture.stop |
|
|
|
/> |
|
|
|
/> |
|
|
|
|
|
|
|
|
|
|
|
<div class="flex-1" /> |
|
|
|
<div class="flex-1" /> |
|
|
@ -142,6 +164,7 @@ watch(expandedFormDlg, (nexVal) => { |
|
|
|
:key="i" |
|
|
|
:key="i" |
|
|
|
class="!my-4 cursor-pointer hover:(!bg-gray-200/50 shadow-md) group" |
|
|
|
class="!my-4 cursor-pointer hover:(!bg-gray-200/50 shadow-md) group" |
|
|
|
@click="linkRow(refRow)" |
|
|
|
@click="linkRow(refRow)" |
|
|
|
|
|
|
|
:class="{'nc-selected-row':selectedRowIndex === i}" |
|
|
|
> |
|
|
|
> |
|
|
|
{{ refRow[relatedTablePrimaryValueProp] }} |
|
|
|
{{ refRow[relatedTablePrimaryValueProp] }} |
|
|
|
<span class="hidden group-hover:(inline) text-gray-400 text-[11px] ml-1"> |
|
|
|
<span class="hidden group-hover:(inline) text-gray-400 text-[11px] ml-1"> |
|
|
@ -183,4 +206,8 @@ watch(expandedFormDlg, (nexVal) => { |
|
|
|
:deep(.ant-pagination-item a) { |
|
|
|
:deep(.ant-pagination-item a) { |
|
|
|
line-height: 21px !important; |
|
|
|
line-height: 21px !important; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
:deep(.nc-selected-row) { |
|
|
|
|
|
|
|
@apply !ring; |
|
|
|
|
|
|
|
} |
|
|
|
</style> |
|
|
|
</style> |
|
|
|