|
|
@ -1,7 +1,7 @@ |
|
|
|
<script lang="ts" setup> |
|
|
|
<script lang="ts" setup> |
|
|
|
import type { Row } from '~/composables' |
|
|
|
import type { Row } from '~/composables' |
|
|
|
import { useProvideSmartsheetRowStore, useSmartsheetStoreOrThrow } from '#imports' |
|
|
|
import { useProvideSmartsheetRowStore, useSmartsheetStoreOrThrow } from '#imports' |
|
|
|
import { ReloadRowDataHookInj, ReloadViewDataHookInj } from '~/context' |
|
|
|
import { ReloadRowDataHookInj } from '~/context' |
|
|
|
|
|
|
|
|
|
|
|
interface Props { |
|
|
|
interface Props { |
|
|
|
row: Row |
|
|
|
row: Row |
|
|
@ -11,7 +11,7 @@ const props = defineProps<Props>() |
|
|
|
const currentRow = toRef(props, 'row') |
|
|
|
const currentRow = toRef(props, 'row') |
|
|
|
|
|
|
|
|
|
|
|
const { meta } = useSmartsheetStoreOrThrow() |
|
|
|
const { meta } = useSmartsheetStoreOrThrow() |
|
|
|
const { isNew, state, syncLTARRefs, loadRow } = useProvideSmartsheetRowStore(meta, currentRow) |
|
|
|
const { isNew, state, syncLTARRefs } = useProvideSmartsheetRowStore(meta, currentRow) |
|
|
|
|
|
|
|
|
|
|
|
// on changing isNew(new record insert) status sync LTAR cell values |
|
|
|
// on changing isNew(new record insert) status sync LTAR cell values |
|
|
|
watch(isNew, async (nextVal, prevVal) => { |
|
|
|
watch(isNew, async (nextVal, prevVal) => { |
|
|
@ -23,12 +23,14 @@ watch(isNew, async (nextVal, prevVal) => { |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const reloadViewDataTrigger = inject(ReloadViewDataHookInj)! |
|
|
|
|
|
|
|
|
|
|
|
// override reload trigger and use it to reload row |
|
|
|
// override reload trigger and use it to reload row |
|
|
|
const reloadHook = createEventHook() |
|
|
|
const reloadHook = createEventHook() |
|
|
|
|
|
|
|
|
|
|
|
reloadHook.on(() => { |
|
|
|
reloadHook.on(() => { |
|
|
|
if (isNew.value) return |
|
|
|
if (isNew.value) return |
|
|
|
loadRow() |
|
|
|
reloadViewDataTrigger?.trigger() |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
provide(ReloadRowDataHookInj, reloadHook) |
|
|
|
provide(ReloadRowDataHookInj, reloadHook) |
|
|
|