Browse Source

Merge pull request #10015 from nocodb/nc-fix/auto-save-duration-cell-value

fix(nc-gui): auto same duration cell value
nc-feat/ai-fill-poc
Raju Udava 1 day ago committed by GitHub
parent
commit
18c6c538c9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 23
      packages/nc-gui/components/cell/Duration.vue
  2. 2
      packages/nc-gui/components/nc/List/index.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))!

2
packages/nc-gui/components/nc/List/index.vue

@ -196,7 +196,7 @@ const handleResetHoverEffect = (clearActiveOption = false, newActiveIndex?: numb
* It updates the model value, emits a change event, and optionally closes the dropdown. * It updates the model value, emits a change event, and optionally closes the dropdown.
*/ */
const handleSelectOption = (option: NcListItemType, index?: number) => { const handleSelectOption = (option: NcListItemType, index?: number) => {
if (!option?.[optionValueKey] || option?.disabled) return if (!ncIsObject(option) || !(optionValueKey in option) || option.disabled) return
if (index !== undefined) { if (index !== undefined) {
activeOptionIndex.value = index activeOptionIndex.value = index

Loading…
Cancel
Save