@rjsf/mantine 6.0.0-beta.20 → 6.0.0-beta.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +187 -139
- package/dist/index.cjs.map +4 -4
- package/dist/mantine.esm.js +186 -138
- package/dist/mantine.esm.js.map +4 -4
- package/dist/mantine.umd.js +75 -29
- package/lib/templates/ArrayFieldItemTemplate.d.ts +3 -3
- package/lib/templates/ArrayFieldItemTemplate.js +1 -1
- package/lib/templates/ArrayFieldItemTemplate.js.map +1 -1
- package/lib/templates/ArrayFieldTemplate.d.ts +1 -1
- package/lib/templates/ArrayFieldTemplate.js +5 -6
- package/lib/templates/ArrayFieldTemplate.js.map +1 -1
- package/lib/templates/BaseInputTemplate.js +2 -2
- package/lib/templates/BaseInputTemplate.js.map +1 -1
- package/lib/templates/ObjectFieldTemplate.js +5 -4
- package/lib/templates/ObjectFieldTemplate.js.map +1 -1
- package/lib/templates/OptionalDataControlsTemplate.d.ts +10 -0
- package/lib/templates/OptionalDataControlsTemplate.js +22 -0
- package/lib/templates/OptionalDataControlsTemplate.js.map +1 -0
- package/lib/templates/TitleField.js +8 -4
- package/lib/templates/TitleField.js.map +1 -1
- package/lib/templates/WrapIfAdditionalTemplate.js +2 -4
- package/lib/templates/WrapIfAdditionalTemplate.js.map +1 -1
- package/lib/templates/index.js +2 -0
- package/lib/templates/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/widgets/CheckboxWidget.js +2 -2
- package/lib/widgets/CheckboxWidget.js.map +1 -1
- package/lib/widgets/CheckboxesWidget.js +2 -2
- package/lib/widgets/CheckboxesWidget.js.map +1 -1
- package/lib/widgets/RadioWidget.js +2 -2
- package/lib/widgets/RadioWidget.js.map +1 -1
- package/lib/widgets/SelectWidget.js +2 -2
- package/lib/widgets/SelectWidget.js.map +1 -1
- package/lib/widgets/TextareaWidget.js +2 -2
- package/lib/widgets/TextareaWidget.js.map +1 -1
- package/package.json +7 -7
- package/src/templates/ArrayFieldItemTemplate.tsx +3 -3
- package/src/templates/ArrayFieldTemplate.tsx +6 -13
- package/src/templates/BaseInputTemplate.tsx +3 -2
- package/src/templates/ObjectFieldTemplate.tsx +6 -3
- package/src/templates/OptionalDataControlsTemplate.tsx +44 -0
- package/src/templates/TitleField.tsx +12 -3
- package/src/templates/WrapIfAdditionalTemplate.tsx +4 -10
- package/src/templates/index.ts +2 -0
- package/src/widgets/CheckboxWidget.tsx +2 -1
- package/src/widgets/CheckboxesWidget.tsx +2 -1
- package/src/widgets/RadioWidget.tsx +2 -1
- package/src/widgets/SelectWidget.tsx +2 -1
- package/src/widgets/TextareaWidget.tsx +2 -1
package/dist/index.cjs
CHANGED
|
@@ -74,6 +74,7 @@ function ArrayFieldTemplate(props) {
|
|
|
74
74
|
disabled,
|
|
75
75
|
fieldPathId,
|
|
76
76
|
items,
|
|
77
|
+
optionalDataControl,
|
|
77
78
|
onAddClick,
|
|
78
79
|
readonly,
|
|
79
80
|
required,
|
|
@@ -88,16 +89,12 @@ function ArrayFieldTemplate(props) {
|
|
|
88
89
|
registry,
|
|
89
90
|
uiOptions
|
|
90
91
|
);
|
|
91
|
-
const ArrayFieldItemTemplate2 = (0, import_utils2.getTemplate)(
|
|
92
|
-
"ArrayFieldItemTemplate",
|
|
93
|
-
registry,
|
|
94
|
-
uiOptions
|
|
95
|
-
);
|
|
96
92
|
const ArrayFieldTitleTemplate2 = (0, import_utils2.getTemplate)(
|
|
97
93
|
"ArrayFieldTitleTemplate",
|
|
98
94
|
registry,
|
|
99
95
|
uiOptions
|
|
100
96
|
);
|
|
97
|
+
const showOptionalDataControlInTitle = !readonly && !disabled;
|
|
101
98
|
const {
|
|
102
99
|
ButtonTemplates: { AddButton: AddButton2 }
|
|
103
100
|
} = registry.templates;
|
|
@@ -109,7 +106,8 @@ function ArrayFieldTemplate(props) {
|
|
|
109
106
|
title: uiOptions.title || title,
|
|
110
107
|
schema,
|
|
111
108
|
uiSchema,
|
|
112
|
-
registry
|
|
109
|
+
registry,
|
|
110
|
+
optionalDataControl: showOptionalDataControlInTitle ? optionalDataControl : void 0
|
|
113
111
|
}
|
|
114
112
|
);
|
|
115
113
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_core2.Fieldset, { legend, className, id: fieldPathId.$id, children: [
|
|
@@ -123,7 +121,10 @@ function ArrayFieldTemplate(props) {
|
|
|
123
121
|
registry
|
|
124
122
|
}
|
|
125
123
|
),
|
|
126
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.
|
|
124
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_core2.Box, { className: "row rjsf-array-item-list", children: [
|
|
125
|
+
!showOptionalDataControlInTitle ? optionalDataControl : void 0,
|
|
126
|
+
items
|
|
127
|
+
] }),
|
|
127
128
|
canAdd && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_core2.Group, { justify: "flex-end", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
128
129
|
AddButton2,
|
|
129
130
|
{
|
|
@@ -199,6 +200,7 @@ var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
|
199
200
|
function BaseInputTemplate(props) {
|
|
200
201
|
const {
|
|
201
202
|
id,
|
|
203
|
+
htmlName,
|
|
202
204
|
type,
|
|
203
205
|
schema,
|
|
204
206
|
value,
|
|
@@ -244,7 +246,7 @@ function BaseInputTemplate(props) {
|
|
|
244
246
|
import_core4.NumberInput,
|
|
245
247
|
{
|
|
246
248
|
id,
|
|
247
|
-
name: id,
|
|
249
|
+
name: htmlName || id,
|
|
248
250
|
label: (0, import_utils4.labelValue)(label || void 0, hideLabel, false),
|
|
249
251
|
required,
|
|
250
252
|
autoFocus: autofocus,
|
|
@@ -266,7 +268,7 @@ function BaseInputTemplate(props) {
|
|
|
266
268
|
import_core4.TextInput,
|
|
267
269
|
{
|
|
268
270
|
id,
|
|
269
|
-
name: id,
|
|
271
|
+
name: htmlName || id,
|
|
270
272
|
label: (0, import_utils4.labelValue)(label || void 0, hideLabel, false),
|
|
271
273
|
required,
|
|
272
274
|
autoFocus: autofocus,
|
|
@@ -673,7 +675,8 @@ function ObjectFieldTemplate(props) {
|
|
|
673
675
|
description,
|
|
674
676
|
disabled,
|
|
675
677
|
properties,
|
|
676
|
-
|
|
678
|
+
optionalDataControl,
|
|
679
|
+
onAddProperty,
|
|
677
680
|
readonly,
|
|
678
681
|
required,
|
|
679
682
|
schema,
|
|
@@ -689,6 +692,7 @@ function ObjectFieldTemplate(props) {
|
|
|
689
692
|
registry,
|
|
690
693
|
uiOptions
|
|
691
694
|
);
|
|
695
|
+
const showOptionalDataControlInTitle = !readonly && !disabled;
|
|
692
696
|
const {
|
|
693
697
|
ButtonTemplates: { AddButton: AddButton2 }
|
|
694
698
|
} = registry.templates;
|
|
@@ -704,7 +708,8 @@ function ObjectFieldTemplate(props) {
|
|
|
704
708
|
required,
|
|
705
709
|
schema,
|
|
706
710
|
uiSchema,
|
|
707
|
-
registry
|
|
711
|
+
registry,
|
|
712
|
+
optionalDataControl: showOptionalDataControlInTitle ? optionalDataControl : void 0
|
|
708
713
|
}
|
|
709
714
|
),
|
|
710
715
|
description && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
@@ -717,14 +722,17 @@ function ObjectFieldTemplate(props) {
|
|
|
717
722
|
registry
|
|
718
723
|
}
|
|
719
724
|
),
|
|
720
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.
|
|
725
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
721
726
|
import_core14.SimpleGrid,
|
|
722
727
|
{
|
|
723
728
|
cols: gridCols,
|
|
724
729
|
spacing: gridSpacing,
|
|
725
730
|
verticalSpacing: gridVerticalSpacing,
|
|
726
731
|
mb: "sm",
|
|
727
|
-
children:
|
|
732
|
+
children: [
|
|
733
|
+
!showOptionalDataControlInTitle ? optionalDataControl : void 0,
|
|
734
|
+
properties.filter((e) => !e.hidden).map((element) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_core14.Box, { children: element.content }, element.name))
|
|
735
|
+
]
|
|
728
736
|
}
|
|
729
737
|
),
|
|
730
738
|
(0, import_utils13.canExpand)(schema, uiSchema, formData) && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_core14.Group, { mt: "xs", justify: "flex-end", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
@@ -732,7 +740,7 @@ function ObjectFieldTemplate(props) {
|
|
|
732
740
|
{
|
|
733
741
|
id: (0, import_utils13.buttonId)(fieldPathId, "add"),
|
|
734
742
|
disabled: disabled || readonly,
|
|
735
|
-
onClick:
|
|
743
|
+
onClick: onAddProperty,
|
|
736
744
|
className: "rjsf-object-property-expand",
|
|
737
745
|
uiSchema,
|
|
738
746
|
registry
|
|
@@ -741,19 +749,57 @@ function ObjectFieldTemplate(props) {
|
|
|
741
749
|
] });
|
|
742
750
|
}
|
|
743
751
|
|
|
752
|
+
// src/templates/OptionalDataControlsTemplate.tsx
|
|
753
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
754
|
+
function OptionalDataControlsTemplate(props) {
|
|
755
|
+
const { id, registry, label, onAddClick, onRemoveClick } = props;
|
|
756
|
+
if (onAddClick) {
|
|
757
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
758
|
+
AddButton,
|
|
759
|
+
{
|
|
760
|
+
id,
|
|
761
|
+
registry,
|
|
762
|
+
icon: "plus",
|
|
763
|
+
className: "rjsf-add-optional-data",
|
|
764
|
+
onClick: onAddClick,
|
|
765
|
+
title: label
|
|
766
|
+
}
|
|
767
|
+
);
|
|
768
|
+
} else if (onRemoveClick) {
|
|
769
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
770
|
+
RemoveButton,
|
|
771
|
+
{
|
|
772
|
+
id,
|
|
773
|
+
registry,
|
|
774
|
+
icon: "remove",
|
|
775
|
+
className: "rjsf-remove-optional-data",
|
|
776
|
+
onClick: onRemoveClick,
|
|
777
|
+
title: label
|
|
778
|
+
}
|
|
779
|
+
);
|
|
780
|
+
}
|
|
781
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("em", { id, children: label });
|
|
782
|
+
}
|
|
783
|
+
|
|
744
784
|
// src/templates/TitleField.tsx
|
|
745
785
|
var import_core15 = require("@mantine/core");
|
|
746
|
-
var
|
|
786
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
747
787
|
function TitleField(props) {
|
|
748
|
-
const { id, title } = props;
|
|
749
|
-
|
|
788
|
+
const { id, title, optionalDataControl } = props;
|
|
789
|
+
let heading = title ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_core15.Title, { id, order: 3, fw: "normal", children: title }) : null;
|
|
790
|
+
if (optionalDataControl) {
|
|
791
|
+
heading = /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_core15.Grid, { children: [
|
|
792
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_core15.Grid.Col, { span: "auto", children: heading }),
|
|
793
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_core15.Grid.Col, { span: "content", children: optionalDataControl })
|
|
794
|
+
] });
|
|
795
|
+
}
|
|
796
|
+
return heading;
|
|
750
797
|
}
|
|
751
798
|
|
|
752
799
|
// src/templates/WrapIfAdditionalTemplate.tsx
|
|
753
|
-
var import_react2 = require("react");
|
|
754
800
|
var import_utils14 = require("@rjsf/utils");
|
|
755
801
|
var import_core16 = require("@mantine/core");
|
|
756
|
-
var
|
|
802
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
757
803
|
function WrapIfAdditionalTemplate(props) {
|
|
758
804
|
const {
|
|
759
805
|
id,
|
|
@@ -765,8 +811,8 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
765
811
|
disabled,
|
|
766
812
|
schema,
|
|
767
813
|
uiSchema,
|
|
768
|
-
|
|
769
|
-
|
|
814
|
+
onKeyRenameBlur,
|
|
815
|
+
onRemoveProperty,
|
|
770
816
|
registry,
|
|
771
817
|
children
|
|
772
818
|
} = props;
|
|
@@ -774,21 +820,17 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
774
820
|
const { RemoveButton: RemoveButton2 } = templates.ButtonTemplates;
|
|
775
821
|
const keyLabel = translateString(import_utils14.TranslatableString.KeyLabel, [label]);
|
|
776
822
|
const additional = import_utils14.ADDITIONAL_PROPERTY_FLAG in schema;
|
|
777
|
-
const handleBlur = (0, import_react2.useCallback)(
|
|
778
|
-
({ target }) => onKeyChange(target && target.value),
|
|
779
|
-
[onKeyChange]
|
|
780
|
-
);
|
|
781
823
|
if (!additional) {
|
|
782
|
-
return /* @__PURE__ */ (0,
|
|
824
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: classNames, style, children });
|
|
783
825
|
}
|
|
784
826
|
const uiOptions = uiSchema ? uiSchema[import_utils14.UI_OPTIONS_KEY] : {};
|
|
785
827
|
const buttonUiOptions = {
|
|
786
828
|
...uiSchema,
|
|
787
829
|
[import_utils14.UI_OPTIONS_KEY]: { ...uiOptions, block: true }
|
|
788
830
|
};
|
|
789
|
-
return /* @__PURE__ */ (0,
|
|
790
|
-
/* @__PURE__ */ (0,
|
|
791
|
-
/* @__PURE__ */ (0,
|
|
831
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: classNames, style, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_core16.Flex, { gap: "xs", align: "end", justify: "center", children: [
|
|
832
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_core16.Grid, { w: "100%", align: "center", children: [
|
|
833
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_core16.Grid.Col, { span: 6, className: "form-additional", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "form-group", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
792
834
|
import_core16.TextInput,
|
|
793
835
|
{
|
|
794
836
|
className: "form-group",
|
|
@@ -798,19 +840,19 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
798
840
|
disabled: disabled || readonly,
|
|
799
841
|
id: `${id}-key`,
|
|
800
842
|
name: `${id}-key`,
|
|
801
|
-
onBlur: !readonly ?
|
|
843
|
+
onBlur: !readonly ? onKeyRenameBlur : void 0
|
|
802
844
|
}
|
|
803
845
|
) }) }),
|
|
804
|
-
/* @__PURE__ */ (0,
|
|
846
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_core16.Grid.Col, { span: 6, className: "form-additional", children })
|
|
805
847
|
] }),
|
|
806
|
-
/* @__PURE__ */ (0,
|
|
848
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
807
849
|
RemoveButton2,
|
|
808
850
|
{
|
|
809
851
|
id: (0, import_utils14.buttonId)(id, "remove"),
|
|
810
852
|
iconType: "sm",
|
|
811
853
|
className: "rjsf-array-item-remove",
|
|
812
854
|
disabled: disabled || readonly,
|
|
813
|
-
onClick:
|
|
855
|
+
onClick: onRemoveProperty,
|
|
814
856
|
uiSchema: buttonUiOptions,
|
|
815
857
|
registry
|
|
816
858
|
}
|
|
@@ -820,9 +862,9 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
820
862
|
|
|
821
863
|
// src/templates/MultiSchemaFieldTemplate.tsx
|
|
822
864
|
var import_core17 = require("@mantine/core");
|
|
823
|
-
var
|
|
865
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
824
866
|
function MultiSchemaFieldTemplate({ selector, optionSchemaField }) {
|
|
825
|
-
return /* @__PURE__ */ (0,
|
|
867
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_core17.Stack, { style: { marginBottom: "1rem" }, children: [
|
|
826
868
|
selector,
|
|
827
869
|
optionSchemaField
|
|
828
870
|
] });
|
|
@@ -843,6 +885,7 @@ function generateTemplates() {
|
|
|
843
885
|
FieldHelpTemplate,
|
|
844
886
|
GridTemplate,
|
|
845
887
|
ObjectFieldTemplate,
|
|
888
|
+
OptionalDataControlsTemplate,
|
|
846
889
|
TitleFieldTemplate: TitleField,
|
|
847
890
|
WrapIfAdditionalTemplate,
|
|
848
891
|
MultiSchemaFieldTemplate
|
|
@@ -855,10 +898,10 @@ var import_dayjs2 = __toESM(require("dayjs"), 1);
|
|
|
855
898
|
var import_customParseFormat = __toESM(require("dayjs/plugin/customParseFormat"), 1);
|
|
856
899
|
|
|
857
900
|
// src/widgets/DateTime/AltDateWidget.tsx
|
|
858
|
-
var
|
|
901
|
+
var import_react2 = require("react");
|
|
859
902
|
var import_utils15 = require("@rjsf/utils");
|
|
860
903
|
var import_core18 = require("@mantine/core");
|
|
861
|
-
var
|
|
904
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
862
905
|
function readyForChange(state) {
|
|
863
906
|
return Object.values(state).every((value) => value !== -1);
|
|
864
907
|
}
|
|
@@ -878,11 +921,11 @@ function AltDateWidget(props) {
|
|
|
878
921
|
registry
|
|
879
922
|
} = props;
|
|
880
923
|
const { translateString } = registry;
|
|
881
|
-
const [state, setState] = (0,
|
|
882
|
-
(0,
|
|
924
|
+
const [state, setState] = (0, import_react2.useState)((0, import_utils15.parseDateString)(value, showTime));
|
|
925
|
+
(0, import_react2.useEffect)(() => {
|
|
883
926
|
setState((0, import_utils15.parseDateString)(value, showTime));
|
|
884
927
|
}, [showTime, value]);
|
|
885
|
-
const handleChange = (0,
|
|
928
|
+
const handleChange = (0, import_react2.useCallback)(
|
|
886
929
|
(property, nextValue) => {
|
|
887
930
|
const nextState = {
|
|
888
931
|
...state,
|
|
@@ -896,20 +939,20 @@ function AltDateWidget(props) {
|
|
|
896
939
|
},
|
|
897
940
|
[state, onChange, showTime]
|
|
898
941
|
);
|
|
899
|
-
const handleSetNow = (0,
|
|
942
|
+
const handleSetNow = (0, import_react2.useCallback)(() => {
|
|
900
943
|
if (!disabled && !readonly) {
|
|
901
944
|
const nextState = (0, import_utils15.parseDateString)((/* @__PURE__ */ new Date()).toJSON(), showTime);
|
|
902
945
|
onChange((0, import_utils15.toDateString)(nextState, showTime));
|
|
903
946
|
}
|
|
904
947
|
}, [disabled, readonly, showTime, onChange]);
|
|
905
|
-
const handleClear = (0,
|
|
948
|
+
const handleClear = (0, import_react2.useCallback)(() => {
|
|
906
949
|
if (!disabled && !readonly) {
|
|
907
950
|
onChange("");
|
|
908
951
|
}
|
|
909
952
|
}, [disabled, readonly, onChange]);
|
|
910
|
-
return /* @__PURE__ */ (0,
|
|
911
|
-
!hideLabel && !!label && /* @__PURE__ */ (0,
|
|
912
|
-
/* @__PURE__ */ (0,
|
|
953
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
954
|
+
!hideLabel && !!label && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_core18.Input.Label, { id: (0, import_utils15.titleId)(id), required, children: label }),
|
|
955
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_core18.Flex, { gap: "xs", align: "center", wrap: "nowrap", children: [
|
|
913
956
|
(0, import_utils15.getDateElementProps)(
|
|
914
957
|
state,
|
|
915
958
|
showTime,
|
|
@@ -917,7 +960,7 @@ function AltDateWidget(props) {
|
|
|
917
960
|
options.format
|
|
918
961
|
).map((elemProps, i) => {
|
|
919
962
|
const elemId = id + "_" + elemProps.type;
|
|
920
|
-
return /* @__PURE__ */ (0,
|
|
963
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_core18.Box, { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
921
964
|
import_core18.Select,
|
|
922
965
|
{
|
|
923
966
|
id: elemId,
|
|
@@ -934,12 +977,12 @@ function AltDateWidget(props) {
|
|
|
934
977
|
}
|
|
935
978
|
) }, i);
|
|
936
979
|
}),
|
|
937
|
-
/* @__PURE__ */ (0,
|
|
938
|
-
(options.hideNowButton !== "undefined" ? !options.hideNowButton : true) && /* @__PURE__ */ (0,
|
|
939
|
-
(options.hideClearButton !== "undefined" ? !options.hideClearButton : true) && /* @__PURE__ */ (0,
|
|
980
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_core18.Group, { wrap: "nowrap", gap: 3, children: [
|
|
981
|
+
(options.hideNowButton !== "undefined" ? !options.hideNowButton : true) && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_core18.Button, { variant: "subtle", size: "xs", onClick: handleSetNow, children: translateString(import_utils15.TranslatableString.NowLabel) }),
|
|
982
|
+
(options.hideClearButton !== "undefined" ? !options.hideClearButton : true) && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_core18.Button, { variant: "subtle", size: "xs", onClick: handleClear, children: translateString(import_utils15.TranslatableString.ClearLabel) })
|
|
940
983
|
] })
|
|
941
984
|
] }),
|
|
942
|
-
rawErrors && rawErrors?.length > 0 && rawErrors.map((error, index) => /* @__PURE__ */ (0,
|
|
985
|
+
rawErrors && rawErrors?.length > 0 && rawErrors.map((error, index) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_core18.Input.Error, { children: error }, `alt-date-widget-input-errors-${index}`))
|
|
943
986
|
] });
|
|
944
987
|
}
|
|
945
988
|
AltDateWidget.defaultProps = {
|
|
@@ -947,10 +990,10 @@ AltDateWidget.defaultProps = {
|
|
|
947
990
|
};
|
|
948
991
|
|
|
949
992
|
// src/widgets/DateTime/AltDateTimeWidget.tsx
|
|
950
|
-
var
|
|
993
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
951
994
|
function AltDateTimeWidget(props) {
|
|
952
995
|
const { AltDateWidget: AltDateWidget2 } = props.registry.widgets;
|
|
953
|
-
return /* @__PURE__ */ (0,
|
|
996
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(AltDateWidget2, { showTime: true, ...props });
|
|
954
997
|
}
|
|
955
998
|
AltDateTimeWidget.defaultProps = {
|
|
956
999
|
...AltDateWidget?.defaultProps,
|
|
@@ -958,11 +1001,11 @@ AltDateTimeWidget.defaultProps = {
|
|
|
958
1001
|
};
|
|
959
1002
|
|
|
960
1003
|
// src/widgets/DateTime/DateTimeInput.tsx
|
|
961
|
-
var
|
|
1004
|
+
var import_react3 = require("react");
|
|
962
1005
|
var import_utils16 = require("@rjsf/utils");
|
|
963
1006
|
var import_dayjs = __toESM(require("dayjs"), 1);
|
|
964
1007
|
var import_dates = require("@mantine/dates");
|
|
965
|
-
var
|
|
1008
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
966
1009
|
var dateParser = (input, format) => {
|
|
967
1010
|
if (!input) {
|
|
968
1011
|
return null;
|
|
@@ -996,23 +1039,23 @@ function DateTimeInput(props) {
|
|
|
996
1039
|
valueFormat,
|
|
997
1040
|
displayFormat
|
|
998
1041
|
} = props;
|
|
999
|
-
const handleChange = (0,
|
|
1042
|
+
const handleChange = (0, import_react3.useCallback)(
|
|
1000
1043
|
(nextValue) => {
|
|
1001
1044
|
onChange(dateFormat(nextValue, valueFormat));
|
|
1002
1045
|
},
|
|
1003
1046
|
[onChange, valueFormat]
|
|
1004
1047
|
);
|
|
1005
|
-
const handleBlur = (0,
|
|
1048
|
+
const handleBlur = (0, import_react3.useCallback)(() => {
|
|
1006
1049
|
if (onBlur) {
|
|
1007
1050
|
onBlur(id, value);
|
|
1008
1051
|
}
|
|
1009
1052
|
}, [onBlur, id, value]);
|
|
1010
|
-
const handleFocus = (0,
|
|
1053
|
+
const handleFocus = (0, import_react3.useCallback)(() => {
|
|
1011
1054
|
if (onFocus) {
|
|
1012
1055
|
onFocus(id, value);
|
|
1013
1056
|
}
|
|
1014
1057
|
}, [onFocus, id, value]);
|
|
1015
|
-
return /* @__PURE__ */ (0,
|
|
1058
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1016
1059
|
import_dates.DateInput,
|
|
1017
1060
|
{
|
|
1018
1061
|
id,
|
|
@@ -1038,10 +1081,10 @@ function DateTimeInput(props) {
|
|
|
1038
1081
|
}
|
|
1039
1082
|
|
|
1040
1083
|
// src/widgets/DateTime/DateWidget.tsx
|
|
1041
|
-
var
|
|
1084
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1042
1085
|
function DateWidget(props) {
|
|
1043
1086
|
const { valueFormat = "YYYY-MM-DD", displayFormat, ...otherOptions } = props.options;
|
|
1044
|
-
return /* @__PURE__ */ (0,
|
|
1087
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1045
1088
|
DateTimeInput,
|
|
1046
1089
|
{
|
|
1047
1090
|
...props,
|
|
@@ -1053,10 +1096,10 @@ function DateWidget(props) {
|
|
|
1053
1096
|
}
|
|
1054
1097
|
|
|
1055
1098
|
// src/widgets/DateTime/DateTimeWidget.tsx
|
|
1056
|
-
var
|
|
1099
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1057
1100
|
function DateTimeWidget(props) {
|
|
1058
1101
|
const { valueFormat = "YYYY-MM-DD HH:mm:ss", displayFormat, ...otherOptions } = props.options;
|
|
1059
|
-
return /* @__PURE__ */ (0,
|
|
1102
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1060
1103
|
DateTimeInput,
|
|
1061
1104
|
{
|
|
1062
1105
|
...props,
|
|
@@ -1068,10 +1111,10 @@ function DateTimeWidget(props) {
|
|
|
1068
1111
|
}
|
|
1069
1112
|
|
|
1070
1113
|
// src/widgets/DateTime/TimeWidget.tsx
|
|
1071
|
-
var
|
|
1114
|
+
var import_react4 = require("react");
|
|
1072
1115
|
var import_utils17 = require("@rjsf/utils");
|
|
1073
1116
|
var import_dates2 = require("@mantine/dates");
|
|
1074
|
-
var
|
|
1117
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1075
1118
|
function TimeWidget(props) {
|
|
1076
1119
|
const {
|
|
1077
1120
|
id,
|
|
@@ -1091,13 +1134,13 @@ function TimeWidget(props) {
|
|
|
1091
1134
|
onFocus
|
|
1092
1135
|
} = props;
|
|
1093
1136
|
const emptyValue = options.emptyValue || "";
|
|
1094
|
-
const handleChange = (0,
|
|
1137
|
+
const handleChange = (0, import_react4.useCallback)(
|
|
1095
1138
|
(e) => {
|
|
1096
1139
|
onChange(e.target.value === "" ? emptyValue : e.target.value);
|
|
1097
1140
|
},
|
|
1098
1141
|
[onChange, emptyValue]
|
|
1099
1142
|
);
|
|
1100
|
-
const handleBlur = (0,
|
|
1143
|
+
const handleBlur = (0, import_react4.useCallback)(
|
|
1101
1144
|
({ target }) => {
|
|
1102
1145
|
if (onBlur) {
|
|
1103
1146
|
onBlur(id, target && target.value);
|
|
@@ -1105,7 +1148,7 @@ function TimeWidget(props) {
|
|
|
1105
1148
|
},
|
|
1106
1149
|
[onBlur, id]
|
|
1107
1150
|
);
|
|
1108
|
-
const handleFocus = (0,
|
|
1151
|
+
const handleFocus = (0, import_react4.useCallback)(
|
|
1109
1152
|
({ target }) => {
|
|
1110
1153
|
if (onFocus) {
|
|
1111
1154
|
onFocus(id, target && target.value);
|
|
@@ -1113,7 +1156,7 @@ function TimeWidget(props) {
|
|
|
1113
1156
|
},
|
|
1114
1157
|
[onFocus, id]
|
|
1115
1158
|
);
|
|
1116
|
-
return /* @__PURE__ */ (0,
|
|
1159
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1117
1160
|
import_dates2.TimeInput,
|
|
1118
1161
|
{
|
|
1119
1162
|
id,
|
|
@@ -1136,13 +1179,14 @@ function TimeWidget(props) {
|
|
|
1136
1179
|
}
|
|
1137
1180
|
|
|
1138
1181
|
// src/widgets/CheckboxesWidget.tsx
|
|
1139
|
-
var
|
|
1182
|
+
var import_react5 = require("react");
|
|
1140
1183
|
var import_utils18 = require("@rjsf/utils");
|
|
1141
1184
|
var import_core19 = require("@mantine/core");
|
|
1142
|
-
var
|
|
1185
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1143
1186
|
function CheckboxesWidget(props) {
|
|
1144
1187
|
const {
|
|
1145
1188
|
id,
|
|
1189
|
+
htmlName,
|
|
1146
1190
|
value,
|
|
1147
1191
|
required,
|
|
1148
1192
|
disabled,
|
|
@@ -1158,7 +1202,7 @@ function CheckboxesWidget(props) {
|
|
|
1158
1202
|
} = props;
|
|
1159
1203
|
const { enumOptions, enumDisabled, inline, emptyValue } = options;
|
|
1160
1204
|
const themeProps = cleanupOptions(options);
|
|
1161
|
-
const handleChange = (0,
|
|
1205
|
+
const handleChange = (0, import_react5.useCallback)(
|
|
1162
1206
|
(nextValue) => {
|
|
1163
1207
|
if (!disabled && !readonly && onChange) {
|
|
1164
1208
|
onChange((0, import_utils18.enumOptionsValueForIndex)(nextValue, enumOptions, emptyValue));
|
|
@@ -1166,7 +1210,7 @@ function CheckboxesWidget(props) {
|
|
|
1166
1210
|
},
|
|
1167
1211
|
[onChange, disabled, readonly, enumOptions, emptyValue]
|
|
1168
1212
|
);
|
|
1169
|
-
const handleBlur = (0,
|
|
1213
|
+
const handleBlur = (0, import_react5.useCallback)(
|
|
1170
1214
|
({ target }) => {
|
|
1171
1215
|
if (onBlur) {
|
|
1172
1216
|
onBlur(id, (0, import_utils18.enumOptionsValueForIndex)(target.value, enumOptions, emptyValue));
|
|
@@ -1174,7 +1218,7 @@ function CheckboxesWidget(props) {
|
|
|
1174
1218
|
},
|
|
1175
1219
|
[onBlur, id, enumOptions, emptyValue]
|
|
1176
1220
|
);
|
|
1177
|
-
const handleFocus = (0,
|
|
1221
|
+
const handleFocus = (0, import_react5.useCallback)(
|
|
1178
1222
|
({ target }) => {
|
|
1179
1223
|
if (onFocus) {
|
|
1180
1224
|
onFocus(id, (0, import_utils18.enumOptionsValueForIndex)(target.value, enumOptions, emptyValue));
|
|
@@ -1183,9 +1227,9 @@ function CheckboxesWidget(props) {
|
|
|
1183
1227
|
[onFocus, id, enumOptions, emptyValue]
|
|
1184
1228
|
);
|
|
1185
1229
|
const selectedIndexes = (0, import_utils18.enumOptionsIndexForValue)(value, enumOptions, true);
|
|
1186
|
-
return Array.isArray(enumOptions) && enumOptions.length > 0 ? /* @__PURE__ */ (0,
|
|
1187
|
-
!hideLabel && !!label && /* @__PURE__ */ (0,
|
|
1188
|
-
/* @__PURE__ */ (0,
|
|
1230
|
+
return Array.isArray(enumOptions) && enumOptions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
|
|
1231
|
+
!hideLabel && !!label && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_core19.Input.Label, { id: (0, import_utils18.titleId)(id), required, children: label }),
|
|
1232
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1189
1233
|
import_core19.Checkbox.Group,
|
|
1190
1234
|
{
|
|
1191
1235
|
id,
|
|
@@ -1196,11 +1240,11 @@ function CheckboxesWidget(props) {
|
|
|
1196
1240
|
error: rawErrors && rawErrors.length > 0 ? rawErrors.join("\n") : void 0,
|
|
1197
1241
|
"aria-describedby": (0, import_utils18.ariaDescribedByIds)(id),
|
|
1198
1242
|
...themeProps,
|
|
1199
|
-
children: Array.isArray(enumOptions) ? /* @__PURE__ */ (0,
|
|
1243
|
+
children: Array.isArray(enumOptions) ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_core19.Flex, { mt: "xs", direction: inline ? "row" : "column", gap: "xs", wrap: "wrap", children: enumOptions.map((option, i) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1200
1244
|
import_core19.Checkbox,
|
|
1201
1245
|
{
|
|
1202
1246
|
id: (0, import_utils18.optionId)(id, i),
|
|
1203
|
-
name: id,
|
|
1247
|
+
name: htmlName || id,
|
|
1204
1248
|
value: String(i),
|
|
1205
1249
|
label: option.label,
|
|
1206
1250
|
disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1,
|
|
@@ -1216,14 +1260,15 @@ function CheckboxesWidget(props) {
|
|
|
1216
1260
|
}
|
|
1217
1261
|
|
|
1218
1262
|
// src/widgets/CheckboxWidget.tsx
|
|
1219
|
-
var
|
|
1263
|
+
var import_react6 = require("react");
|
|
1220
1264
|
var import_utils20 = require("@rjsf/utils");
|
|
1221
1265
|
var import_core20 = require("@mantine/core");
|
|
1222
|
-
var
|
|
1266
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1223
1267
|
function CheckboxWidget(props) {
|
|
1224
1268
|
const {
|
|
1225
1269
|
id,
|
|
1226
1270
|
name,
|
|
1271
|
+
htmlName,
|
|
1227
1272
|
value = false,
|
|
1228
1273
|
required,
|
|
1229
1274
|
disabled,
|
|
@@ -1246,7 +1291,7 @@ function CheckboxWidget(props) {
|
|
|
1246
1291
|
registry,
|
|
1247
1292
|
options
|
|
1248
1293
|
);
|
|
1249
|
-
const handleCheckboxChange = (0,
|
|
1294
|
+
const handleCheckboxChange = (0, import_react6.useCallback)(
|
|
1250
1295
|
(e) => {
|
|
1251
1296
|
if (!disabled && !readonly && onChange) {
|
|
1252
1297
|
onChange(e.currentTarget.checked);
|
|
@@ -1254,7 +1299,7 @@ function CheckboxWidget(props) {
|
|
|
1254
1299
|
},
|
|
1255
1300
|
[onChange, disabled, readonly]
|
|
1256
1301
|
);
|
|
1257
|
-
const handleBlur = (0,
|
|
1302
|
+
const handleBlur = (0, import_react6.useCallback)(
|
|
1258
1303
|
({ target }) => {
|
|
1259
1304
|
if (onBlur) {
|
|
1260
1305
|
onBlur(id, target.checked);
|
|
@@ -1262,7 +1307,7 @@ function CheckboxWidget(props) {
|
|
|
1262
1307
|
},
|
|
1263
1308
|
[onBlur, id]
|
|
1264
1309
|
);
|
|
1265
|
-
const handleFocus = (0,
|
|
1310
|
+
const handleFocus = (0, import_react6.useCallback)(
|
|
1266
1311
|
({ target }) => {
|
|
1267
1312
|
if (onFocus) {
|
|
1268
1313
|
onFocus(id, target.checked);
|
|
@@ -1271,8 +1316,8 @@ function CheckboxWidget(props) {
|
|
|
1271
1316
|
[onFocus, id]
|
|
1272
1317
|
);
|
|
1273
1318
|
const description = options.description || schema.description;
|
|
1274
|
-
return /* @__PURE__ */ (0,
|
|
1275
|
-
!hideLabel && !!description && /* @__PURE__ */ (0,
|
|
1319
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
|
|
1320
|
+
!hideLabel && !!description && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1276
1321
|
DescriptionFieldTemplate,
|
|
1277
1322
|
{
|
|
1278
1323
|
id: (0, import_utils20.descriptionId)(id),
|
|
@@ -1282,11 +1327,11 @@ function CheckboxWidget(props) {
|
|
|
1282
1327
|
registry
|
|
1283
1328
|
}
|
|
1284
1329
|
),
|
|
1285
|
-
/* @__PURE__ */ (0,
|
|
1330
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1286
1331
|
import_core20.Checkbox,
|
|
1287
1332
|
{
|
|
1288
1333
|
id,
|
|
1289
|
-
name,
|
|
1334
|
+
name: htmlName || name,
|
|
1290
1335
|
label: (0, import_utils20.labelValue)(label || void 0, hideLabel, false),
|
|
1291
1336
|
disabled: disabled || readonly,
|
|
1292
1337
|
required,
|
|
@@ -1304,10 +1349,10 @@ function CheckboxWidget(props) {
|
|
|
1304
1349
|
}
|
|
1305
1350
|
|
|
1306
1351
|
// src/widgets/ColorWidget.tsx
|
|
1307
|
-
var
|
|
1352
|
+
var import_react7 = require("react");
|
|
1308
1353
|
var import_utils22 = require("@rjsf/utils");
|
|
1309
1354
|
var import_core21 = require("@mantine/core");
|
|
1310
|
-
var
|
|
1355
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
1311
1356
|
function ColorWidget(props) {
|
|
1312
1357
|
const {
|
|
1313
1358
|
id,
|
|
@@ -1327,13 +1372,13 @@ function ColorWidget(props) {
|
|
|
1327
1372
|
onFocus
|
|
1328
1373
|
} = props;
|
|
1329
1374
|
const themeProps = cleanupOptions(options);
|
|
1330
|
-
const handleChange = (0,
|
|
1375
|
+
const handleChange = (0, import_react7.useCallback)(
|
|
1331
1376
|
(nextValue) => {
|
|
1332
1377
|
onChange(nextValue);
|
|
1333
1378
|
},
|
|
1334
1379
|
[onChange]
|
|
1335
1380
|
);
|
|
1336
|
-
const handleBlur = (0,
|
|
1381
|
+
const handleBlur = (0, import_react7.useCallback)(
|
|
1337
1382
|
({ target }) => {
|
|
1338
1383
|
if (onBlur) {
|
|
1339
1384
|
onBlur(id, target && target.value);
|
|
@@ -1341,7 +1386,7 @@ function ColorWidget(props) {
|
|
|
1341
1386
|
},
|
|
1342
1387
|
[onBlur, id]
|
|
1343
1388
|
);
|
|
1344
|
-
const handleFocus = (0,
|
|
1389
|
+
const handleFocus = (0, import_react7.useCallback)(
|
|
1345
1390
|
({ target }) => {
|
|
1346
1391
|
if (onFocus) {
|
|
1347
1392
|
onFocus(id, target && target.value);
|
|
@@ -1349,7 +1394,7 @@ function ColorWidget(props) {
|
|
|
1349
1394
|
},
|
|
1350
1395
|
[onFocus, id]
|
|
1351
1396
|
);
|
|
1352
|
-
return /* @__PURE__ */ (0,
|
|
1397
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1353
1398
|
import_core21.ColorInput,
|
|
1354
1399
|
{
|
|
1355
1400
|
id,
|
|
@@ -1372,10 +1417,10 @@ function ColorWidget(props) {
|
|
|
1372
1417
|
}
|
|
1373
1418
|
|
|
1374
1419
|
// src/widgets/FileWidget.tsx
|
|
1375
|
-
var
|
|
1420
|
+
var import_react8 = require("react");
|
|
1376
1421
|
var import_utils24 = require("@rjsf/utils");
|
|
1377
1422
|
var import_core22 = require("@mantine/core");
|
|
1378
|
-
var
|
|
1423
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
1379
1424
|
function addNameToDataURL(dataURL, name) {
|
|
1380
1425
|
if (dataURL === null) {
|
|
1381
1426
|
return null;
|
|
@@ -1450,7 +1495,7 @@ function FileWidget(props) {
|
|
|
1450
1495
|
onChange
|
|
1451
1496
|
} = props;
|
|
1452
1497
|
const themeProps = cleanupOptions(options);
|
|
1453
|
-
const handleChange = (0,
|
|
1498
|
+
const handleChange = (0, import_react8.useCallback)(
|
|
1454
1499
|
(files) => {
|
|
1455
1500
|
if (typeof files === "object") {
|
|
1456
1501
|
processFiles(multiple ? files : [files]).then((filesInfoEvent) => {
|
|
@@ -1466,7 +1511,7 @@ function FileWidget(props) {
|
|
|
1466
1511
|
},
|
|
1467
1512
|
[multiple, value, onChange]
|
|
1468
1513
|
);
|
|
1469
|
-
const handleRemoveFile = (0,
|
|
1514
|
+
const handleRemoveFile = (0, import_react8.useCallback)(
|
|
1470
1515
|
(index) => {
|
|
1471
1516
|
if (multiple) {
|
|
1472
1517
|
const newValue = value.filter((_, i) => i !== index);
|
|
@@ -1477,17 +1522,17 @@ function FileWidget(props) {
|
|
|
1477
1522
|
},
|
|
1478
1523
|
[multiple, value, onChange]
|
|
1479
1524
|
);
|
|
1480
|
-
const ValueComponent = (0,
|
|
1525
|
+
const ValueComponent = (0, import_react8.useCallback)(
|
|
1481
1526
|
(props2) => {
|
|
1482
1527
|
const filesInfo = props2.value ? extractFileInfo(Array.isArray(props2.value) ? props2.value : [props2.value]) : null;
|
|
1483
1528
|
if (Array.isArray(filesInfo) && filesInfo.length > 0) {
|
|
1484
|
-
return /* @__PURE__ */ (0,
|
|
1529
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_core22.Pill.Group, { children: filesInfo.map((file, index) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_core22.Pill, { withRemoveButton: true, onRemove: () => handleRemoveFile(index), children: file.name }, index)) });
|
|
1485
1530
|
}
|
|
1486
1531
|
return null;
|
|
1487
1532
|
},
|
|
1488
1533
|
[handleRemoveFile]
|
|
1489
1534
|
);
|
|
1490
|
-
return /* @__PURE__ */ (0,
|
|
1535
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
1491
1536
|
import_core22.FileInput,
|
|
1492
1537
|
{
|
|
1493
1538
|
id,
|
|
@@ -1509,10 +1554,10 @@ function FileWidget(props) {
|
|
|
1509
1554
|
}
|
|
1510
1555
|
|
|
1511
1556
|
// src/widgets/PasswordWidget.tsx
|
|
1512
|
-
var
|
|
1557
|
+
var import_react9 = require("react");
|
|
1513
1558
|
var import_utils26 = require("@rjsf/utils");
|
|
1514
1559
|
var import_core23 = require("@mantine/core");
|
|
1515
|
-
var
|
|
1560
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
1516
1561
|
function PasswordWidget(props) {
|
|
1517
1562
|
const {
|
|
1518
1563
|
id,
|
|
@@ -1533,13 +1578,13 @@ function PasswordWidget(props) {
|
|
|
1533
1578
|
} = props;
|
|
1534
1579
|
const emptyValue = options.emptyValue || "";
|
|
1535
1580
|
const themeProps = cleanupOptions(options);
|
|
1536
|
-
const handleChange = (0,
|
|
1581
|
+
const handleChange = (0, import_react9.useCallback)(
|
|
1537
1582
|
(e) => {
|
|
1538
1583
|
onChange(e.target.value === "" ? emptyValue : e.target.value);
|
|
1539
1584
|
},
|
|
1540
1585
|
[onChange, emptyValue]
|
|
1541
1586
|
);
|
|
1542
|
-
const handleBlur = (0,
|
|
1587
|
+
const handleBlur = (0, import_react9.useCallback)(
|
|
1543
1588
|
({ target }) => {
|
|
1544
1589
|
if (onBlur) {
|
|
1545
1590
|
onBlur(id, target && target.value);
|
|
@@ -1547,7 +1592,7 @@ function PasswordWidget(props) {
|
|
|
1547
1592
|
},
|
|
1548
1593
|
[onBlur, id]
|
|
1549
1594
|
);
|
|
1550
|
-
const handleFocus = (0,
|
|
1595
|
+
const handleFocus = (0, import_react9.useCallback)(
|
|
1551
1596
|
({ target }) => {
|
|
1552
1597
|
if (onFocus) {
|
|
1553
1598
|
onFocus(id, target && target.value);
|
|
@@ -1555,7 +1600,7 @@ function PasswordWidget(props) {
|
|
|
1555
1600
|
},
|
|
1556
1601
|
[onFocus, id]
|
|
1557
1602
|
);
|
|
1558
|
-
return /* @__PURE__ */ (0,
|
|
1603
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
1559
1604
|
import_core23.PasswordInput,
|
|
1560
1605
|
{
|
|
1561
1606
|
id,
|
|
@@ -1577,13 +1622,14 @@ function PasswordWidget(props) {
|
|
|
1577
1622
|
}
|
|
1578
1623
|
|
|
1579
1624
|
// src/widgets/RadioWidget.tsx
|
|
1580
|
-
var
|
|
1625
|
+
var import_react10 = require("react");
|
|
1581
1626
|
var import_utils28 = require("@rjsf/utils");
|
|
1582
1627
|
var import_core24 = require("@mantine/core");
|
|
1583
|
-
var
|
|
1628
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
1584
1629
|
function RadioWidget(props) {
|
|
1585
1630
|
const {
|
|
1586
1631
|
id,
|
|
1632
|
+
htmlName,
|
|
1587
1633
|
value,
|
|
1588
1634
|
required,
|
|
1589
1635
|
disabled,
|
|
@@ -1599,7 +1645,7 @@ function RadioWidget(props) {
|
|
|
1599
1645
|
} = props;
|
|
1600
1646
|
const { enumOptions, enumDisabled, inline, emptyValue } = options;
|
|
1601
1647
|
const themeProps = cleanupOptions(options);
|
|
1602
|
-
const handleChange = (0,
|
|
1648
|
+
const handleChange = (0, import_react10.useCallback)(
|
|
1603
1649
|
(nextValue) => {
|
|
1604
1650
|
if (!disabled && !readonly && onChange) {
|
|
1605
1651
|
onChange((0, import_utils28.enumOptionsValueForIndex)(nextValue, enumOptions, emptyValue));
|
|
@@ -1607,7 +1653,7 @@ function RadioWidget(props) {
|
|
|
1607
1653
|
},
|
|
1608
1654
|
[onChange, disabled, readonly, enumOptions, emptyValue]
|
|
1609
1655
|
);
|
|
1610
|
-
const handleBlur = (0,
|
|
1656
|
+
const handleBlur = (0, import_react10.useCallback)(
|
|
1611
1657
|
({ target }) => {
|
|
1612
1658
|
if (onBlur) {
|
|
1613
1659
|
onBlur(id, (0, import_utils28.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue));
|
|
@@ -1615,7 +1661,7 @@ function RadioWidget(props) {
|
|
|
1615
1661
|
},
|
|
1616
1662
|
[onBlur, id, enumOptions, emptyValue]
|
|
1617
1663
|
);
|
|
1618
|
-
const handleFocus = (0,
|
|
1664
|
+
const handleFocus = (0, import_react10.useCallback)(
|
|
1619
1665
|
({ target }) => {
|
|
1620
1666
|
if (onFocus) {
|
|
1621
1667
|
onFocus(id, (0, import_utils28.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue));
|
|
@@ -1624,11 +1670,11 @@ function RadioWidget(props) {
|
|
|
1624
1670
|
[onFocus, id, enumOptions, emptyValue]
|
|
1625
1671
|
);
|
|
1626
1672
|
const selected = (0, import_utils28.enumOptionsIndexForValue)(value, enumOptions);
|
|
1627
|
-
return /* @__PURE__ */ (0,
|
|
1673
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
1628
1674
|
import_core24.Radio.Group,
|
|
1629
1675
|
{
|
|
1630
1676
|
id,
|
|
1631
|
-
name: id,
|
|
1677
|
+
name: htmlName || id,
|
|
1632
1678
|
value: selected,
|
|
1633
1679
|
label: !hideLabel ? label : void 0,
|
|
1634
1680
|
onChange: handleChange,
|
|
@@ -1637,7 +1683,7 @@ function RadioWidget(props) {
|
|
|
1637
1683
|
error: rawErrors && rawErrors.length > 0 ? rawErrors.join("\n") : void 0,
|
|
1638
1684
|
"aria-describedby": (0, import_utils28.ariaDescribedByIds)(id),
|
|
1639
1685
|
...themeProps,
|
|
1640
|
-
children: Array.isArray(enumOptions) ? /* @__PURE__ */ (0,
|
|
1686
|
+
children: Array.isArray(enumOptions) ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_core24.Flex, { mt: "xs", direction: inline ? "row" : "column", gap: "xs", wrap: "wrap", children: enumOptions.map((option, i) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
1641
1687
|
import_core24.Radio,
|
|
1642
1688
|
{
|
|
1643
1689
|
id: (0, import_utils28.optionId)(id, i),
|
|
@@ -1655,10 +1701,10 @@ function RadioWidget(props) {
|
|
|
1655
1701
|
}
|
|
1656
1702
|
|
|
1657
1703
|
// src/widgets/RangeWidget.tsx
|
|
1658
|
-
var
|
|
1704
|
+
var import_react11 = require("react");
|
|
1659
1705
|
var import_utils30 = require("@rjsf/utils");
|
|
1660
1706
|
var import_core25 = require("@mantine/core");
|
|
1661
|
-
var
|
|
1707
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
1662
1708
|
function RangeWidget(props) {
|
|
1663
1709
|
const {
|
|
1664
1710
|
id,
|
|
@@ -1679,7 +1725,7 @@ function RangeWidget(props) {
|
|
|
1679
1725
|
} = props;
|
|
1680
1726
|
const themeProps = cleanupOptions(options);
|
|
1681
1727
|
const { min, max, step } = (0, import_utils30.rangeSpec)(schema);
|
|
1682
|
-
const handleChange = (0,
|
|
1728
|
+
const handleChange = (0, import_react11.useCallback)(
|
|
1683
1729
|
(nextValue) => {
|
|
1684
1730
|
if (!disabled && !readonly && onChange) {
|
|
1685
1731
|
onChange(nextValue);
|
|
@@ -1687,20 +1733,20 @@ function RangeWidget(props) {
|
|
|
1687
1733
|
},
|
|
1688
1734
|
[onChange, disabled, readonly]
|
|
1689
1735
|
);
|
|
1690
|
-
const handleBlur = (0,
|
|
1736
|
+
const handleBlur = (0, import_react11.useCallback)(() => {
|
|
1691
1737
|
if (onBlur) {
|
|
1692
1738
|
onBlur(id, value);
|
|
1693
1739
|
}
|
|
1694
1740
|
}, [onBlur, id, value]);
|
|
1695
|
-
const handleFocus = (0,
|
|
1741
|
+
const handleFocus = (0, import_react11.useCallback)(() => {
|
|
1696
1742
|
if (onFocus) {
|
|
1697
1743
|
onFocus(id, value);
|
|
1698
1744
|
}
|
|
1699
1745
|
}, [onFocus, id, value]);
|
|
1700
|
-
return /* @__PURE__ */ (0,
|
|
1701
|
-
!hideLabel && !!label && /* @__PURE__ */ (0,
|
|
1702
|
-
options?.description && /* @__PURE__ */ (0,
|
|
1703
|
-
/* @__PURE__ */ (0,
|
|
1746
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
1747
|
+
!hideLabel && !!label && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_core25.Input.Label, { id: (0, import_utils30.titleId)(id), required, children: label }),
|
|
1748
|
+
options?.description && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_core25.Input.Description, { children: options.description }),
|
|
1749
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
1704
1750
|
import_core25.Slider,
|
|
1705
1751
|
{
|
|
1706
1752
|
id,
|
|
@@ -1718,18 +1764,19 @@ function RangeWidget(props) {
|
|
|
1718
1764
|
"aria-describedby": (0, import_utils30.ariaDescribedByIds)(id)
|
|
1719
1765
|
}
|
|
1720
1766
|
),
|
|
1721
|
-
rawErrors && rawErrors?.length > 0 && rawErrors.map((error, index) => /* @__PURE__ */ (0,
|
|
1767
|
+
rawErrors && rawErrors?.length > 0 && rawErrors.map((error, index) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_core25.Input.Error, { children: error }, `range-widget-input-errors-${index}`))
|
|
1722
1768
|
] });
|
|
1723
1769
|
}
|
|
1724
1770
|
|
|
1725
1771
|
// src/widgets/SelectWidget.tsx
|
|
1726
|
-
var
|
|
1772
|
+
var import_react12 = require("react");
|
|
1727
1773
|
var import_utils32 = require("@rjsf/utils");
|
|
1728
1774
|
var import_core26 = require("@mantine/core");
|
|
1729
|
-
var
|
|
1775
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
1730
1776
|
function SelectWidget(props) {
|
|
1731
1777
|
const {
|
|
1732
1778
|
id,
|
|
1779
|
+
htmlName,
|
|
1733
1780
|
value,
|
|
1734
1781
|
placeholder,
|
|
1735
1782
|
required,
|
|
@@ -1747,7 +1794,7 @@ function SelectWidget(props) {
|
|
|
1747
1794
|
} = props;
|
|
1748
1795
|
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
1749
1796
|
const themeProps = cleanupOptions(options);
|
|
1750
|
-
const handleChange = (0,
|
|
1797
|
+
const handleChange = (0, import_react12.useCallback)(
|
|
1751
1798
|
(nextValue) => {
|
|
1752
1799
|
if (!disabled && !readonly && onChange) {
|
|
1753
1800
|
onChange((0, import_utils32.enumOptionsValueForIndex)(nextValue, enumOptions, emptyValue));
|
|
@@ -1755,7 +1802,7 @@ function SelectWidget(props) {
|
|
|
1755
1802
|
},
|
|
1756
1803
|
[onChange, disabled, readonly, enumOptions, emptyValue]
|
|
1757
1804
|
);
|
|
1758
|
-
const handleBlur = (0,
|
|
1805
|
+
const handleBlur = (0, import_react12.useCallback)(
|
|
1759
1806
|
({ target }) => {
|
|
1760
1807
|
if (onBlur) {
|
|
1761
1808
|
onBlur(id, (0, import_utils32.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue));
|
|
@@ -1763,7 +1810,7 @@ function SelectWidget(props) {
|
|
|
1763
1810
|
},
|
|
1764
1811
|
[onBlur, id, enumOptions, emptyValue]
|
|
1765
1812
|
);
|
|
1766
|
-
const handleFocus = (0,
|
|
1813
|
+
const handleFocus = (0, import_react12.useCallback)(
|
|
1767
1814
|
({ target }) => {
|
|
1768
1815
|
if (onFocus) {
|
|
1769
1816
|
onFocus(id, (0, import_utils32.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue));
|
|
@@ -1772,7 +1819,7 @@ function SelectWidget(props) {
|
|
|
1772
1819
|
[onFocus, id, enumOptions, emptyValue]
|
|
1773
1820
|
);
|
|
1774
1821
|
const selectedIndexes = (0, import_utils32.enumOptionsIndexForValue)(value, enumOptions, multiple);
|
|
1775
|
-
const selectOptions = (0,
|
|
1822
|
+
const selectOptions = (0, import_react12.useMemo)(() => {
|
|
1776
1823
|
if (Array.isArray(enumOptions)) {
|
|
1777
1824
|
return enumOptions.map((option, index) => ({
|
|
1778
1825
|
key: String(index),
|
|
@@ -1784,11 +1831,11 @@ function SelectWidget(props) {
|
|
|
1784
1831
|
return [];
|
|
1785
1832
|
}, [enumDisabled, enumOptions]);
|
|
1786
1833
|
const Component = multiple ? import_core26.MultiSelect : import_core26.Select;
|
|
1787
|
-
return /* @__PURE__ */ (0,
|
|
1834
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
1788
1835
|
Component,
|
|
1789
1836
|
{
|
|
1790
1837
|
id,
|
|
1791
|
-
name: id,
|
|
1838
|
+
name: htmlName || id,
|
|
1792
1839
|
label: (0, import_utils32.labelValue)(label || void 0, hideLabel, false),
|
|
1793
1840
|
data: selectOptions,
|
|
1794
1841
|
value: multiple ? selectedIndexes : selectedIndexes,
|
|
@@ -1809,14 +1856,15 @@ function SelectWidget(props) {
|
|
|
1809
1856
|
}
|
|
1810
1857
|
|
|
1811
1858
|
// src/widgets/TextareaWidget.tsx
|
|
1812
|
-
var
|
|
1859
|
+
var import_react13 = require("react");
|
|
1813
1860
|
var import_utils34 = require("@rjsf/utils");
|
|
1814
1861
|
var import_core27 = require("@mantine/core");
|
|
1815
|
-
var
|
|
1862
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
1816
1863
|
function TextareaWidget(props) {
|
|
1817
1864
|
const {
|
|
1818
1865
|
id,
|
|
1819
1866
|
name,
|
|
1867
|
+
htmlName,
|
|
1820
1868
|
value,
|
|
1821
1869
|
placeholder,
|
|
1822
1870
|
required,
|
|
@@ -1833,13 +1881,13 @@ function TextareaWidget(props) {
|
|
|
1833
1881
|
} = props;
|
|
1834
1882
|
const themeProps = cleanupOptions(options);
|
|
1835
1883
|
const emptyValue = options?.emptyValue ?? "";
|
|
1836
|
-
const handleChange = (0,
|
|
1884
|
+
const handleChange = (0, import_react13.useCallback)(
|
|
1837
1885
|
(e) => {
|
|
1838
1886
|
onChange(e.target.value === "" ? emptyValue : e.target.value);
|
|
1839
1887
|
},
|
|
1840
1888
|
[onChange, emptyValue]
|
|
1841
1889
|
);
|
|
1842
|
-
const handleBlur = (0,
|
|
1890
|
+
const handleBlur = (0, import_react13.useCallback)(
|
|
1843
1891
|
({ target }) => {
|
|
1844
1892
|
if (onBlur) {
|
|
1845
1893
|
onBlur(id, target && target.value);
|
|
@@ -1847,7 +1895,7 @@ function TextareaWidget(props) {
|
|
|
1847
1895
|
},
|
|
1848
1896
|
[onBlur, id]
|
|
1849
1897
|
);
|
|
1850
|
-
const handleFocus = (0,
|
|
1898
|
+
const handleFocus = (0, import_react13.useCallback)(
|
|
1851
1899
|
({ target }) => {
|
|
1852
1900
|
if (onFocus) {
|
|
1853
1901
|
onFocus(id, target && target.value);
|
|
@@ -1855,11 +1903,11 @@ function TextareaWidget(props) {
|
|
|
1855
1903
|
},
|
|
1856
1904
|
[onFocus, id]
|
|
1857
1905
|
);
|
|
1858
|
-
return /* @__PURE__ */ (0,
|
|
1906
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
1859
1907
|
import_core27.Textarea,
|
|
1860
1908
|
{
|
|
1861
1909
|
id,
|
|
1862
|
-
name,
|
|
1910
|
+
name: htmlName || name,
|
|
1863
1911
|
value: value || "",
|
|
1864
1912
|
placeholder: placeholder || void 0,
|
|
1865
1913
|
required,
|