This commit is contained in:
rizky 2024-07-27 13:59:09 -07:00
parent 0e3b4f7c4a
commit 15c905ee72
1 changed files with 10 additions and 4 deletions

View File

@ -37,14 +37,21 @@ export const Field: FC<FieldProp> = (arg) => {
if (field.status === "init" && !isEditor) return null; if (field.status === "init" && !isEditor) return null;
const errors = fm.error.get(name); const errors = fm.error.get(name);
const props = { ...arg.props }; const props = { ...arg.props };
delete props.className;
let editorClassName = "";
if (isEditor) {
editorClassName =
props.className.split(" ").find((e: string) => e.startsWith("s-")) || "";
}
return ( return (
<LabelDiv <LabelDiv
mode={sub_type === "table-edit" ? "div" : "label"} mode={sub_type === "table-edit" ? "div" : "label"}
{...props}
className={cx( className={cx(
"field", "field",
"c-flex", "c-flex c-relative",
editorClassName,
field.type === "single-option" && sub_type === "checkbox" field.type === "single-option" && sub_type === "checkbox"
? css` ? css`
padding: 5px 0px 0px 7.5px; padding: 5px 0px 0px 7.5px;
@ -71,11 +78,10 @@ export const Field: FC<FieldProp> = (arg) => {
} }
` `
)} )}
{...props}
ref={typeof arg.field_ref === "function" ? arg.field_ref : undefined} ref={typeof arg.field_ref === "function" ? arg.field_ref : undefined}
> >
{showlabel !== "n" && <Label field={field} fm={fm} />} {showlabel !== "n" && <Label field={field} fm={fm} />}
<div className="field-input c-flex c-flex-1 c-flex-col"> <div className={cx("field-input c-flex c-flex-1 c-flex-col")}>
<FieldInput <FieldInput
field={field} field={field}
fm={fm} fm={fm}