From 835f55b9a5225401594f3bcb2a107d98a4dd092c Mon Sep 17 00:00:00 2001 From: Ramesh Mane <101566080+rameshmane7218@users.noreply.github.com> Date: Sat, 9 Mar 2024 11:51:14 +0000 Subject: [PATCH] fix(nc-gui): prevent clear prefilled readonly or hidden fields on clicking clear form --- packages/nc-gui/composables/useSharedFormViewStore.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/nc-gui/composables/useSharedFormViewStore.ts b/packages/nc-gui/composables/useSharedFormViewStore.ts index dce85a3107..64675920da 100644 --- a/packages/nc-gui/composables/useSharedFormViewStore.ts +++ b/packages/nc-gui/composables/useSharedFormViewStore.ts @@ -81,6 +81,8 @@ const [useProvideSharedFormStore, useSharedFormStore] = useInjectionState((share const route = useRoute() const formState = ref>({}) + + const preFilledformState = ref>({}) const { state: additionalState } = useProvideSmartsheetRowStore( meta as Ref, @@ -250,7 +252,11 @@ const [useProvideSharedFormStore, useSharedFormStore] = useInjectionState((share formResetHook.trigger() additionalState.value = {} - formState.value = {} + formState.value = { + ...([PreFilledMode.Locked, PreFilledMode.Hidden].includes(sharedViewMeta.value.preFilledMode) + ? preFilledformState.value + : {}), + } v$.value?.$reset() } @@ -273,6 +279,8 @@ const [useProvideSharedFormStore, useSharedFormStore] = useInjectionState((share if (preFillValue !== undefined) { // Prefill form state formState.value[c.title] = preFillValue + // preFilledformState will be used in clear for to fill the filled data + preFilledformState.value[c.title] = preFillValue // Update column switch (sharedViewMeta.value.preFilledMode) {