From 3ff70ff87bda0e5ad735bde47d2b3259a9eee586 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Mon, 8 Aug 2022 15:32:25 +0800 Subject: [PATCH] fix(gui-v2): required form fields logic --- packages/nc-gui-v2/components/smartsheet/Form.vue | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/nc-gui-v2/components/smartsheet/Form.vue b/packages/nc-gui-v2/components/smartsheet/Form.vue index 03ebb9c138..548690661c 100644 --- a/packages/nc-gui-v2/components/smartsheet/Form.vue +++ b/packages/nc-gui-v2/components/smartsheet/Form.vue @@ -140,7 +140,7 @@ function onMove(event: any) { } function hideColumn(idx: number) { - if (isDbRequired(localColumns.value[idx])) { + if (isDbRequired(localColumns.value[idx]) || localColumns.value[idx].required) { toast.info("Required field can't be removed") return } @@ -170,12 +170,16 @@ async function addAllColumns() { async function removeAllColumns() { for (const col of (formColumnData as Record)?.value) { - if (isDbRequired(col) || col.required) { + if (isDbRequired(col) || !!col.required) { continue } col.show = false } - await hideAll((localColumns as Record)?.value.filter(isDbRequired).map((f: Record) => f.fk_column_id)) + await hideAll( + (localColumns as Record)?.value + .filter((f: Record) => isDbRequired(f) || !!f.required) + .map((f: Record) => f.fk_column_id), + ) $e('a:form-view:remove-all') } @@ -286,6 +290,7 @@ watch(
+ {{ element.required }}