Browse Source

fix(nc-gui): add clear form btn in shared form

pull/7664/head
Ramesh Mane 9 months ago
parent
commit
5152275e51
  1. 3
      packages/nc-gui/components/smartsheet/Form.vue
  2. 9
      packages/nc-gui/composables/useSharedFormViewStore.ts

3
packages/nc-gui/components/smartsheet/Form.vue

@ -1193,6 +1193,9 @@ useEventListener(
&:not(.nc-cell-longtext) { &:not(.nc-cell-longtext) {
@apply px-2 py-2; @apply px-2 py-2;
} }
:deep(textarea) {
@apply !p-2;
}
} }
.form-meta-input { .form-meta-input {

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

@ -226,6 +226,14 @@ const [useProvideSharedFormStore, useSharedFormStore] = useInjectionState((share
progress.value = false progress.value = false
} }
const clearForm = async () => {
formResetHook.trigger()
additionalState.value = {}
formState.value = {}
v$.value?.$reset()
}
/** reset form if show_blank_form is true */ /** reset form if show_blank_form is true */
watch(submitted, (nextVal) => { watch(submitted, (nextVal) => {
if (nextVal && sharedFormView.value?.show_blank_form) { if (nextVal && sharedFormView.value?.show_blank_form) {
@ -261,6 +269,7 @@ const [useProvideSharedFormStore, useSharedFormStore] = useInjectionState((share
loadSharedView, loadSharedView,
columns, columns,
submitForm, submitForm,
clearForm,
progress, progress,
meta, meta,
validators, validators,

Loading…
Cancel
Save