|
|
@ -1,6 +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' |
|
|
|
|
|
|
|
|
|
|
|
interface Props { |
|
|
|
interface Props { |
|
|
|
row: Row |
|
|
|
row: Row |
|
|
@ -10,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 } = useProvideSmartsheetRowStore(meta, currentRow) |
|
|
|
const { isNew, state, syncLTARRefs, loadRow } = 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) => { |
|
|
@ -21,6 +22,16 @@ watch(isNew, async (nextVal, prevVal) => { |
|
|
|
currentRow.value.oldRow = { ...currentRow.value.row, ...state.value } |
|
|
|
currentRow.value.oldRow = { ...currentRow.value.row, ...state.value } |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// override reload trigger and use it to reload row |
|
|
|
|
|
|
|
const reloadHook = createEventHook() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
reloadHook.on(() => { |
|
|
|
|
|
|
|
if (isNew.value) return |
|
|
|
|
|
|
|
loadRow() |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
provide(ReloadRowDataHookInj, reloadHook) |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<template> |
|
|
|
<template> |
|
|
|