From 8425b4ea95bfd7abf32db703bbef0763bae085cf Mon Sep 17 00:00:00 2001 From: rizky Date: Fri, 22 Nov 2024 06:26:59 -0700 Subject: [PATCH] fix --- comps/form/Form.tsx | 2 +- comps/form/base/BaseField.tsx | 59 ++++++++++++++---- comps/form/base/BaseForm.tsx | 112 +++++++++++++++++++++++++++------- comps/form/field/Field.tsx | 29 ++++++--- comps/list/TableList.tsx | 7 +-- 5 files changed, 163 insertions(+), 46 deletions(-) diff --git a/comps/form/Form.tsx b/comps/form/Form.tsx index c623ca6..e4d5407 100755 --- a/comps/form/Form.tsx +++ b/comps/form/Form.tsx @@ -10,7 +10,7 @@ import { getPathname } from "lib/utils/pathname"; import { sofDeleteField as softDeleteField } from "lib/utils/soft-del-rel"; import { toast } from "../ui/toast"; -const editorFormWidth = {} as Record; +export const editorFormWidth = {} as Record; export type { FMLocal } from "./typings"; diff --git a/comps/form/base/BaseField.tsx b/comps/form/base/BaseField.tsx index f8cbb92..58623ed 100755 --- a/comps/form/base/BaseField.tsx +++ b/comps/form/base/BaseField.tsx @@ -19,18 +19,32 @@ export const BaseField = (prop: { typeof field.prefix === "function" ? field.prefix() : typeof field.prefix === "string" - ? field.prefix - : null; + ? field.prefix + : null; const suffix = typeof field.suffix === "function" ? field.suffix() : typeof field.suffix === "string" - ? field.prefix - : null; + ? field.prefix + : null; const name = field.name; const errors = fm.error.get(name); const showlabel = arg.show_label || "y"; + + const disabled = + typeof field.disabled === "function" ? field.disabled() : field.disabled; + const show = + typeof field.hidden === "function" + ? field.hidden() + : typeof field.hidden === "string" + ? field.hidden === "n" + ? false + : true + : typeof field.hidden === "boolean" + ? field.hidden + : true; + return (