Browse Source

fix(nc-gui): auto same duration cell value

pull/10015/head
Ramesh Mane 2 days ago
parent
commit
d03fc7bd57
  1. 23
      packages/nc-gui/components/cell/Duration.vue

23
packages/nc-gui/components/cell/Duration.vue

@ -30,14 +30,32 @@ const durationType = computed(() => parseProp(column?.value?.meta)?.duration ||
const durationPlaceholder = computed(() => durationOptions[durationType.value].title) const durationPlaceholder = computed(() => durationOptions[durationType.value].title)
const tempState = ref()
const localState = computed({ const localState = computed({
get: () => convertMS2Duration(modelValue, durationType.value), get: () => {
if (tempState.value === undefined) {
return convertMS2Duration(modelValue, durationType.value)
}
return tempState.value
},
set: (val) => { set: (val) => {
tempState.value = val
isEdited.value = true isEdited.value = true
const res = convertDurationToSeconds(val, durationType.value) const res = convertDurationToSeconds(val, durationType.value)
if (res._isValid) { if (res._isValid) {
durationInMS.value = res._sec durationInMS.value = res._sec
} }
if (!val) {
emit('update:modelValue', null)
isEdited.value = false
tempState.value = undefined
} else {
emit('update:modelValue', durationInMS.value)
}
}, },
}) })
@ -63,7 +81,10 @@ const submitDuration = () => {
if (isEdited.value) { if (isEdited.value) {
emit('update:modelValue', durationInMS.value) emit('update:modelValue', durationInMS.value)
} }
isEdited.value = false isEdited.value = false
tempState.value = undefined
} }
const isExpandedFormOpen = inject(IsExpandedFormOpenInj, ref(false))! const isExpandedFormOpen = inject(IsExpandedFormOpenInj, ref(false))!

Loading…
Cancel
Save