From d03fc7bd57d24c6298607cb104393de4390efb27 Mon Sep 17 00:00:00 2001 From: Ramesh Mane <101566080+rameshmane7218@users.noreply.github.com> Date: Tue, 10 Dec 2024 10:15:34 +0000 Subject: [PATCH 1/2] fix(nc-gui): auto same duration cell value --- packages/nc-gui/components/cell/Duration.vue | 23 +++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/packages/nc-gui/components/cell/Duration.vue b/packages/nc-gui/components/cell/Duration.vue index 7c8f6bea83..1430ae9b0b 100644 --- a/packages/nc-gui/components/cell/Duration.vue +++ b/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 tempState = ref() + const localState = computed({ - get: () => convertMS2Duration(modelValue, durationType.value), + get: () => { + if (tempState.value === undefined) { + return convertMS2Duration(modelValue, durationType.value) + } + + return tempState.value + }, set: (val) => { + tempState.value = val + isEdited.value = true const res = convertDurationToSeconds(val, durationType.value) if (res._isValid) { 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) { emit('update:modelValue', durationInMS.value) } + isEdited.value = false + + tempState.value = undefined } const isExpandedFormOpen = inject(IsExpandedFormOpenInj, ref(false))! From 5e8b194712eca4a4265bac8d2dd90f5716eb01c0 Mon Sep 17 00:00:00 2001 From: Ramesh Mane <101566080+rameshmane7218@users.noreply.github.com> Date: Tue, 10 Dec 2024 10:15:34 +0000 Subject: [PATCH 2/2] fix(nc-gui): handle handleSelectOption fun condition properly --- packages/nc-gui/components/nc/List/index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nc-gui/components/nc/List/index.vue b/packages/nc-gui/components/nc/List/index.vue index 64f6cc6f0e..4ae20e2611 100644 --- a/packages/nc-gui/components/nc/List/index.vue +++ b/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. */ const handleSelectOption = (option: NcListItemType, index?: number) => { - if (!option?.[optionValueKey] || option?.disabled) return + if (!ncIsObject(option) || !(optionValueKey in option) || option.disabled) return if (index !== undefined) { activeOptionIndex.value = index