public commit

This commit is contained in:
dswbx
2024-11-16 12:01:47 +01:00
commit 90f80c4280
582 changed files with 49291 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
import { Label } from "../templates/FieldTemplate";
import { CheckboxWidget } from "./CheckboxWidget";
import CheckboxesWidget from "./CheckboxesWidget";
import JsonWidget from "./JsonWidget";
import RadioWidget from "./RadioWidget";
import SelectWidget from "./SelectWidget";
const WithLabel = (WrappedComponent, kind?: string) => {
return (props) => {
const hideLabel =
!props.label ||
props.uiSchema["ui:options"]?.hideLabel ||
props.options?.hideLabel ||
props.hideLabel;
return (
<>
{!hideLabel && <Label label={props.label} required={props.required} id={props.id} />}
<WrappedComponent {...props} />
</>
);
};
};
export const widgets = {
RadioWidget: RadioWidget,
CheckboxWidget: WithLabel(CheckboxWidget),
SelectWidget: WithLabel(SelectWidget, "select"),
CheckboxesWidget: WithLabel(CheckboxesWidget),
JsonWidget: WithLabel(JsonWidget)
};