diff --git a/comps/form/field/type/TypeInput.tsx b/comps/form/field/type/TypeInput.tsx index 4243471..f58315a 100755 --- a/comps/form/field/type/TypeInput.tsx +++ b/comps/form/field/type/TypeInput.tsx @@ -8,6 +8,7 @@ import { FMLocal, FieldLocal, FieldProp } from "../../typings"; import { FieldMoney } from "./TypeMoney"; import { FieldRichText } from "./TypeRichText"; import { FieldUpload } from "./TypeUpload"; +import { FieldToggle } from "./TypeToggle"; export type PropTypeInput = { type: "input"; @@ -21,6 +22,7 @@ export type PropTypeInput = { | "datetime-local" | "time" | "money" + | "toggle" | "rich-text" | "upload" | "file" @@ -30,7 +32,7 @@ export type PropTypeInput = { onFocus?: (e: FocusEvent) => void; onBlur?: (e: FocusEvent) => void; onChange?: (val: any) => void; - model_upload?: "upload" | "import" + model_upload?: "upload" | "import"; }; const parse = parser.exportAsFunctionAny("en-US"); @@ -95,6 +97,45 @@ export const FieldTypeInput: FC<{ }; switch (type_field) { + case "toggle": + return ( +
+
+ { + const check = e.target.checked; + if (check) { + fm.data[field.name] = true; + } else { + fm.data[field.name] = false; + } + renderOnChange(); + }} + /> +
+
+
{" "} +
+ ); case "textarea": return ( ); case "upload": - return ; + return ( + + ); case "money": return ; case "rich-text": diff --git a/comps/form/field/type/TypeToggle.tsx b/comps/form/field/type/TypeToggle.tsx index c2b4677..01b11f5 100755 --- a/comps/form/field/type/TypeToggle.tsx +++ b/comps/form/field/type/TypeToggle.tsx @@ -66,7 +66,6 @@ export const FieldToggle: FC<{ (local.ref = ref)} type="checkbox" - id="toggleB" checked={checked} className="c-sr-only" onChange={(e) => {