mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
833 B
29 lines
833 B
2 years ago
|
<script lang="ts" setup>
|
||
|
import type { Row } from '~/composables'
|
||
2 years ago
|
import { useProvideSmartsheetRowStore, useSmartsheetStoreOrThrow } from '#imports'
|
||
2 years ago
|
|
||
|
interface Props {
|
||
|
row: Row
|
||
|
}
|
||
|
|
||
|
const props = defineProps<Props>()
|
||
2 years ago
|
const currentRow = toRef(props, 'row')
|
||
2 years ago
|
|
||
|
const { meta } = useSmartsheetStoreOrThrow()
|
||
2 years ago
|
const { isNew, state, syncLTARRefs } = useProvideSmartsheetRowStore(meta, currentRow)
|
||
2 years ago
|
|
||
|
// on changing isNew(new record insert) status sync LTAR cell values
|
||
|
watch(isNew, async (nextVal, prevVal) => {
|
||
|
if (prevVal && !nextVal) {
|
||
2 years ago
|
await syncLTARRefs(currentRow.value.row)
|
||
2 years ago
|
// update row values without invoking api
|
||
2 years ago
|
currentRow.value.row = { ...currentRow.value.row, ...state.value }
|
||
|
currentRow.value.oldRow = { ...currentRow.value.row, ...state.value }
|
||
2 years ago
|
}
|
||
2 years ago
|
})
|
||
2 years ago
|
</script>
|
||
|
|
||
|
<template>
|
||
2 years ago
|
<slot :state="state" />
|
||
2 years ago
|
</template>
|