Browse Source

fix(nc-gui): prevent clear prefilled readonly or hidden fields on clicking clear form

pull/7786/head
Ramesh Mane 8 months ago
parent
commit
835f55b9a5
  1. 10
      packages/nc-gui/composables/useSharedFormViewStore.ts

10
packages/nc-gui/composables/useSharedFormViewStore.ts

@ -81,6 +81,8 @@ const [useProvideSharedFormStore, useSharedFormStore] = useInjectionState((share
const route = useRoute()
const formState = ref<Record<string, any>>({})
const preFilledformState = ref<Record<string, any>>({})
const { state: additionalState } = useProvideSmartsheetRowStore(
meta as Ref<TableType>,
@ -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) {

Loading…
Cancel
Save