@rjsf/mantine 6.0.0-beta.21 → 6.0.0-beta.23
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 +98 -234
- package/dist/index.cjs.map +4 -4
- package/dist/mantine.esm.js +98 -236
- package/dist/mantine.esm.js.map +4 -4
- package/dist/mantine.umd.js +105 -239
- 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 +2 -3
- 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/FieldHelpTemplate.js +4 -1
- package/lib/templates/FieldHelpTemplate.js.map +1 -1
- package/lib/templates/ObjectFieldTemplate.js +2 -2
- package/lib/templates/ObjectFieldTemplate.js.map +1 -1
- package/lib/templates/WrapIfAdditionalTemplate.js +2 -4
- package/lib/templates/WrapIfAdditionalTemplate.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/DateTime/AltDateTimeWidget.d.ts +1 -7
- package/lib/widgets/DateTime/AltDateTimeWidget.js +1 -6
- package/lib/widgets/DateTime/AltDateTimeWidget.js.map +1 -1
- package/lib/widgets/DateTime/AltDateWidget.d.ts +1 -7
- package/lib/widgets/DateTime/AltDateWidget.js +6 -39
- package/lib/widgets/DateTime/AltDateWidget.js.map +1 -1
- package/lib/widgets/FileWidget.js +9 -87
- package/lib/widgets/FileWidget.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 +2 -10
- package/src/templates/BaseInputTemplate.tsx +3 -2
- package/src/templates/FieldHelpTemplate.tsx +5 -1
- package/src/templates/ObjectFieldTemplate.tsx +2 -2
- package/src/templates/WrapIfAdditionalTemplate.tsx +4 -10
- package/src/widgets/CheckboxWidget.tsx +2 -1
- package/src/widgets/CheckboxesWidget.tsx +2 -1
- package/src/widgets/DateTime/AltDateTimeWidget.tsx +1 -8
- package/src/widgets/DateTime/AltDateWidget.tsx +6 -71
- package/src/widgets/FileWidget.tsx +20 -112
- 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
|
@@ -89,11 +89,6 @@ function ArrayFieldTemplate(props) {
|
|
|
89
89
|
registry,
|
|
90
90
|
uiOptions
|
|
91
91
|
);
|
|
92
|
-
const ArrayFieldItemTemplate2 = (0, import_utils2.getTemplate)(
|
|
93
|
-
"ArrayFieldItemTemplate",
|
|
94
|
-
registry,
|
|
95
|
-
uiOptions
|
|
96
|
-
);
|
|
97
92
|
const ArrayFieldTitleTemplate2 = (0, import_utils2.getTemplate)(
|
|
98
93
|
"ArrayFieldTitleTemplate",
|
|
99
94
|
registry,
|
|
@@ -128,7 +123,7 @@ function ArrayFieldTemplate(props) {
|
|
|
128
123
|
),
|
|
129
124
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_core2.Box, { className: "row rjsf-array-item-list", children: [
|
|
130
125
|
!showOptionalDataControlInTitle ? optionalDataControl : void 0,
|
|
131
|
-
items
|
|
126
|
+
items
|
|
132
127
|
] }),
|
|
133
128
|
canAdd && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_core2.Group, { justify: "flex-end", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
134
129
|
AddButton2,
|
|
@@ -205,6 +200,7 @@ var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
|
205
200
|
function BaseInputTemplate(props) {
|
|
206
201
|
const {
|
|
207
202
|
id,
|
|
203
|
+
htmlName,
|
|
208
204
|
type,
|
|
209
205
|
schema,
|
|
210
206
|
value,
|
|
@@ -250,7 +246,7 @@ function BaseInputTemplate(props) {
|
|
|
250
246
|
import_core4.NumberInput,
|
|
251
247
|
{
|
|
252
248
|
id,
|
|
253
|
-
name: id,
|
|
249
|
+
name: htmlName || id,
|
|
254
250
|
label: (0, import_utils4.labelValue)(label || void 0, hideLabel, false),
|
|
255
251
|
required,
|
|
256
252
|
autoFocus: autofocus,
|
|
@@ -272,7 +268,7 @@ function BaseInputTemplate(props) {
|
|
|
272
268
|
import_core4.TextInput,
|
|
273
269
|
{
|
|
274
270
|
id,
|
|
275
|
-
name: id,
|
|
271
|
+
name: htmlName || id,
|
|
276
272
|
label: (0, import_utils4.labelValue)(label || void 0, hideLabel, false),
|
|
277
273
|
required,
|
|
278
274
|
autoFocus: autofocus,
|
|
@@ -651,8 +647,11 @@ var import_core12 = require("@mantine/core");
|
|
|
651
647
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
652
648
|
function FieldHelpTemplate(props) {
|
|
653
649
|
const { fieldPathId, help } = props;
|
|
650
|
+
if (!help) {
|
|
651
|
+
return null;
|
|
652
|
+
}
|
|
654
653
|
const id = (0, import_utils12.helpId)(fieldPathId);
|
|
655
|
-
return
|
|
654
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_core12.Text, { id, size: "sm", my: "xs", c: "dimmed", children: help });
|
|
656
655
|
}
|
|
657
656
|
|
|
658
657
|
// src/templates/GridTemplate.tsx
|
|
@@ -680,7 +679,7 @@ function ObjectFieldTemplate(props) {
|
|
|
680
679
|
disabled,
|
|
681
680
|
properties,
|
|
682
681
|
optionalDataControl,
|
|
683
|
-
|
|
682
|
+
onAddProperty,
|
|
684
683
|
readonly,
|
|
685
684
|
required,
|
|
686
685
|
schema,
|
|
@@ -744,7 +743,7 @@ function ObjectFieldTemplate(props) {
|
|
|
744
743
|
{
|
|
745
744
|
id: (0, import_utils13.buttonId)(fieldPathId, "add"),
|
|
746
745
|
disabled: disabled || readonly,
|
|
747
|
-
onClick:
|
|
746
|
+
onClick: onAddProperty,
|
|
748
747
|
className: "rjsf-object-property-expand",
|
|
749
748
|
uiSchema,
|
|
750
749
|
registry
|
|
@@ -801,7 +800,6 @@ function TitleField(props) {
|
|
|
801
800
|
}
|
|
802
801
|
|
|
803
802
|
// src/templates/WrapIfAdditionalTemplate.tsx
|
|
804
|
-
var import_react2 = require("react");
|
|
805
803
|
var import_utils14 = require("@rjsf/utils");
|
|
806
804
|
var import_core16 = require("@mantine/core");
|
|
807
805
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
@@ -816,8 +814,8 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
816
814
|
disabled,
|
|
817
815
|
schema,
|
|
818
816
|
uiSchema,
|
|
819
|
-
|
|
820
|
-
|
|
817
|
+
onKeyRenameBlur,
|
|
818
|
+
onRemoveProperty,
|
|
821
819
|
registry,
|
|
822
820
|
children
|
|
823
821
|
} = props;
|
|
@@ -825,10 +823,6 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
825
823
|
const { RemoveButton: RemoveButton2 } = templates.ButtonTemplates;
|
|
826
824
|
const keyLabel = translateString(import_utils14.TranslatableString.KeyLabel, [label]);
|
|
827
825
|
const additional = import_utils14.ADDITIONAL_PROPERTY_FLAG in schema;
|
|
828
|
-
const handleBlur = (0, import_react2.useCallback)(
|
|
829
|
-
({ target }) => onKeyChange(target && target.value),
|
|
830
|
-
[onKeyChange]
|
|
831
|
-
);
|
|
832
826
|
if (!additional) {
|
|
833
827
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: classNames, style, children });
|
|
834
828
|
}
|
|
@@ -849,7 +843,7 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
849
843
|
disabled: disabled || readonly,
|
|
850
844
|
id: `${id}-key`,
|
|
851
845
|
name: `${id}-key`,
|
|
852
|
-
onBlur: !readonly ?
|
|
846
|
+
onBlur: !readonly ? onKeyRenameBlur : void 0
|
|
853
847
|
}
|
|
854
848
|
) }) }),
|
|
855
849
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_core16.Grid.Col, { span: 6, className: "form-additional", children })
|
|
@@ -861,7 +855,7 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
861
855
|
iconType: "sm",
|
|
862
856
|
className: "rjsf-array-item-remove",
|
|
863
857
|
disabled: disabled || readonly,
|
|
864
|
-
onClick:
|
|
858
|
+
onClick: onRemoveProperty,
|
|
865
859
|
uiSchema: buttonUiOptions,
|
|
866
860
|
registry
|
|
867
861
|
}
|
|
@@ -906,70 +900,27 @@ var templates_default = generateTemplates();
|
|
|
906
900
|
var import_dayjs2 = __toESM(require("dayjs"), 1);
|
|
907
901
|
var import_customParseFormat = __toESM(require("dayjs/plugin/customParseFormat"), 1);
|
|
908
902
|
|
|
903
|
+
// src/widgets/DateTime/AltDateTimeWidget.tsx
|
|
904
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
905
|
+
function AltDateTimeWidget(props) {
|
|
906
|
+
const { AltDateWidget: AltDateWidget2 } = props.registry.widgets;
|
|
907
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(AltDateWidget2, { time: true, ...props });
|
|
908
|
+
}
|
|
909
|
+
|
|
909
910
|
// src/widgets/DateTime/AltDateWidget.tsx
|
|
910
|
-
var import_react3 = require("react");
|
|
911
911
|
var import_utils15 = require("@rjsf/utils");
|
|
912
912
|
var import_core18 = require("@mantine/core");
|
|
913
|
-
var
|
|
914
|
-
function readyForChange(state) {
|
|
915
|
-
return Object.values(state).every((value) => value !== -1);
|
|
916
|
-
}
|
|
913
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
917
914
|
function AltDateWidget(props) {
|
|
918
|
-
const {
|
|
919
|
-
id,
|
|
920
|
-
value,
|
|
921
|
-
required,
|
|
922
|
-
disabled,
|
|
923
|
-
readonly,
|
|
924
|
-
label,
|
|
925
|
-
hideLabel,
|
|
926
|
-
rawErrors,
|
|
927
|
-
options,
|
|
928
|
-
onChange,
|
|
929
|
-
showTime = false,
|
|
930
|
-
registry
|
|
931
|
-
} = props;
|
|
915
|
+
const { id, required, disabled, readonly, label, hideLabel, rawErrors, options, registry } = props;
|
|
932
916
|
const { translateString } = registry;
|
|
933
|
-
const
|
|
934
|
-
(0,
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
...state,
|
|
941
|
-
[property]: typeof nextValue === "undefined" ? -1 : nextValue
|
|
942
|
-
};
|
|
943
|
-
if (readyForChange(nextState)) {
|
|
944
|
-
onChange((0, import_utils15.toDateString)(nextState, showTime));
|
|
945
|
-
} else {
|
|
946
|
-
setState(nextState);
|
|
947
|
-
}
|
|
948
|
-
},
|
|
949
|
-
[state, onChange, showTime]
|
|
950
|
-
);
|
|
951
|
-
const handleSetNow = (0, import_react3.useCallback)(() => {
|
|
952
|
-
if (!disabled && !readonly) {
|
|
953
|
-
const nextState = (0, import_utils15.parseDateString)((/* @__PURE__ */ new Date()).toJSON(), showTime);
|
|
954
|
-
onChange((0, import_utils15.toDateString)(nextState, showTime));
|
|
955
|
-
}
|
|
956
|
-
}, [disabled, readonly, showTime, onChange]);
|
|
957
|
-
const handleClear = (0, import_react3.useCallback)(() => {
|
|
958
|
-
if (!disabled && !readonly) {
|
|
959
|
-
onChange("");
|
|
960
|
-
}
|
|
961
|
-
}, [disabled, readonly, onChange]);
|
|
962
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
963
|
-
!hideLabel && !!label && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_core18.Input.Label, { id: (0, import_utils15.titleId)(id), required, children: label }),
|
|
964
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_core18.Flex, { gap: "xs", align: "center", wrap: "nowrap", children: [
|
|
965
|
-
(0, import_utils15.getDateElementProps)(
|
|
966
|
-
state,
|
|
967
|
-
showTime,
|
|
968
|
-
options.yearsRange,
|
|
969
|
-
options.format
|
|
970
|
-
).map((elemProps, i) => {
|
|
971
|
-
const elemId = id + "_" + elemProps.type;
|
|
972
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_core18.Box, { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
917
|
+
const { elements, handleChange, handleClear, handleSetNow } = (0, import_utils15.useAltDateWidgetProps)(props);
|
|
918
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
919
|
+
!hideLabel && !!label && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_core18.Input.Label, { id: (0, import_utils15.titleId)(id), required, children: label }),
|
|
920
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_core18.Flex, { gap: "xs", align: "center", wrap: "nowrap", children: [
|
|
921
|
+
elements.map((elemProps, i) => {
|
|
922
|
+
const elemId = `${id}_${elemProps.type}`;
|
|
923
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_core18.Box, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
973
924
|
import_core18.Select,
|
|
974
925
|
{
|
|
975
926
|
id: elemId,
|
|
@@ -978,7 +929,7 @@ function AltDateWidget(props) {
|
|
|
978
929
|
disabled: disabled || readonly,
|
|
979
930
|
data: (0, import_utils15.dateRangeOptions)(elemProps.range[0], elemProps.range[1]).map((item) => item.value.toString()),
|
|
980
931
|
value: !elemProps.value || elemProps.value < 0 ? null : elemProps.value.toString(),
|
|
981
|
-
onChange: (v) => handleChange(elemProps.type, v),
|
|
932
|
+
onChange: (v) => handleChange(elemProps.type, v || void 0),
|
|
982
933
|
searchable: false,
|
|
983
934
|
allowDeselect: false,
|
|
984
935
|
comboboxProps: { withinPortal: false },
|
|
@@ -986,31 +937,17 @@ function AltDateWidget(props) {
|
|
|
986
937
|
}
|
|
987
938
|
) }, i);
|
|
988
939
|
}),
|
|
989
|
-
/* @__PURE__ */ (0,
|
|
990
|
-
(options.hideNowButton !== "undefined" ? !options.hideNowButton : true) && /* @__PURE__ */ (0,
|
|
991
|
-
(options.hideClearButton !== "undefined" ? !options.hideClearButton : true) && /* @__PURE__ */ (0,
|
|
940
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_core18.Group, { wrap: "nowrap", gap: 3, children: [
|
|
941
|
+
(options.hideNowButton !== "undefined" ? !options.hideNowButton : true) && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_core18.Button, { variant: "subtle", size: "xs", onClick: handleSetNow, children: translateString(import_utils15.TranslatableString.NowLabel) }),
|
|
942
|
+
(options.hideClearButton !== "undefined" ? !options.hideClearButton : true) && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_core18.Button, { variant: "subtle", size: "xs", onClick: handleClear, children: translateString(import_utils15.TranslatableString.ClearLabel) })
|
|
992
943
|
] })
|
|
993
944
|
] }),
|
|
994
|
-
rawErrors && rawErrors?.length > 0 && rawErrors.map((error, index) => /* @__PURE__ */ (0,
|
|
945
|
+
rawErrors && rawErrors?.length > 0 && rawErrors.map((error, index) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_core18.Input.Error, { children: error }, `alt-date-widget-input-errors-${index}`))
|
|
995
946
|
] });
|
|
996
947
|
}
|
|
997
|
-
AltDateWidget.defaultProps = {
|
|
998
|
-
showTime: false
|
|
999
|
-
};
|
|
1000
|
-
|
|
1001
|
-
// src/widgets/DateTime/AltDateTimeWidget.tsx
|
|
1002
|
-
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1003
|
-
function AltDateTimeWidget(props) {
|
|
1004
|
-
const { AltDateWidget: AltDateWidget2 } = props.registry.widgets;
|
|
1005
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(AltDateWidget2, { showTime: true, ...props });
|
|
1006
|
-
}
|
|
1007
|
-
AltDateTimeWidget.defaultProps = {
|
|
1008
|
-
...AltDateWidget?.defaultProps,
|
|
1009
|
-
showTime: true
|
|
1010
|
-
};
|
|
1011
948
|
|
|
1012
949
|
// src/widgets/DateTime/DateTimeInput.tsx
|
|
1013
|
-
var
|
|
950
|
+
var import_react2 = require("react");
|
|
1014
951
|
var import_utils16 = require("@rjsf/utils");
|
|
1015
952
|
var import_dayjs = __toESM(require("dayjs"), 1);
|
|
1016
953
|
var import_dates = require("@mantine/dates");
|
|
@@ -1048,18 +985,18 @@ function DateTimeInput(props) {
|
|
|
1048
985
|
valueFormat,
|
|
1049
986
|
displayFormat
|
|
1050
987
|
} = props;
|
|
1051
|
-
const handleChange = (0,
|
|
988
|
+
const handleChange = (0, import_react2.useCallback)(
|
|
1052
989
|
(nextValue) => {
|
|
1053
990
|
onChange(dateFormat(nextValue, valueFormat));
|
|
1054
991
|
},
|
|
1055
992
|
[onChange, valueFormat]
|
|
1056
993
|
);
|
|
1057
|
-
const handleBlur = (0,
|
|
994
|
+
const handleBlur = (0, import_react2.useCallback)(() => {
|
|
1058
995
|
if (onBlur) {
|
|
1059
996
|
onBlur(id, value);
|
|
1060
997
|
}
|
|
1061
998
|
}, [onBlur, id, value]);
|
|
1062
|
-
const handleFocus = (0,
|
|
999
|
+
const handleFocus = (0, import_react2.useCallback)(() => {
|
|
1063
1000
|
if (onFocus) {
|
|
1064
1001
|
onFocus(id, value);
|
|
1065
1002
|
}
|
|
@@ -1120,7 +1057,7 @@ function DateTimeWidget(props) {
|
|
|
1120
1057
|
}
|
|
1121
1058
|
|
|
1122
1059
|
// src/widgets/DateTime/TimeWidget.tsx
|
|
1123
|
-
var
|
|
1060
|
+
var import_react3 = require("react");
|
|
1124
1061
|
var import_utils17 = require("@rjsf/utils");
|
|
1125
1062
|
var import_dates2 = require("@mantine/dates");
|
|
1126
1063
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
@@ -1143,13 +1080,13 @@ function TimeWidget(props) {
|
|
|
1143
1080
|
onFocus
|
|
1144
1081
|
} = props;
|
|
1145
1082
|
const emptyValue = options.emptyValue || "";
|
|
1146
|
-
const handleChange = (0,
|
|
1083
|
+
const handleChange = (0, import_react3.useCallback)(
|
|
1147
1084
|
(e) => {
|
|
1148
1085
|
onChange(e.target.value === "" ? emptyValue : e.target.value);
|
|
1149
1086
|
},
|
|
1150
1087
|
[onChange, emptyValue]
|
|
1151
1088
|
);
|
|
1152
|
-
const handleBlur = (0,
|
|
1089
|
+
const handleBlur = (0, import_react3.useCallback)(
|
|
1153
1090
|
({ target }) => {
|
|
1154
1091
|
if (onBlur) {
|
|
1155
1092
|
onBlur(id, target && target.value);
|
|
@@ -1157,7 +1094,7 @@ function TimeWidget(props) {
|
|
|
1157
1094
|
},
|
|
1158
1095
|
[onBlur, id]
|
|
1159
1096
|
);
|
|
1160
|
-
const handleFocus = (0,
|
|
1097
|
+
const handleFocus = (0, import_react3.useCallback)(
|
|
1161
1098
|
({ target }) => {
|
|
1162
1099
|
if (onFocus) {
|
|
1163
1100
|
onFocus(id, target && target.value);
|
|
@@ -1188,13 +1125,14 @@ function TimeWidget(props) {
|
|
|
1188
1125
|
}
|
|
1189
1126
|
|
|
1190
1127
|
// src/widgets/CheckboxesWidget.tsx
|
|
1191
|
-
var
|
|
1128
|
+
var import_react4 = require("react");
|
|
1192
1129
|
var import_utils18 = require("@rjsf/utils");
|
|
1193
1130
|
var import_core19 = require("@mantine/core");
|
|
1194
1131
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1195
1132
|
function CheckboxesWidget(props) {
|
|
1196
1133
|
const {
|
|
1197
1134
|
id,
|
|
1135
|
+
htmlName,
|
|
1198
1136
|
value,
|
|
1199
1137
|
required,
|
|
1200
1138
|
disabled,
|
|
@@ -1210,7 +1148,7 @@ function CheckboxesWidget(props) {
|
|
|
1210
1148
|
} = props;
|
|
1211
1149
|
const { enumOptions, enumDisabled, inline, emptyValue } = options;
|
|
1212
1150
|
const themeProps = cleanupOptions(options);
|
|
1213
|
-
const handleChange = (0,
|
|
1151
|
+
const handleChange = (0, import_react4.useCallback)(
|
|
1214
1152
|
(nextValue) => {
|
|
1215
1153
|
if (!disabled && !readonly && onChange) {
|
|
1216
1154
|
onChange((0, import_utils18.enumOptionsValueForIndex)(nextValue, enumOptions, emptyValue));
|
|
@@ -1218,7 +1156,7 @@ function CheckboxesWidget(props) {
|
|
|
1218
1156
|
},
|
|
1219
1157
|
[onChange, disabled, readonly, enumOptions, emptyValue]
|
|
1220
1158
|
);
|
|
1221
|
-
const handleBlur = (0,
|
|
1159
|
+
const handleBlur = (0, import_react4.useCallback)(
|
|
1222
1160
|
({ target }) => {
|
|
1223
1161
|
if (onBlur) {
|
|
1224
1162
|
onBlur(id, (0, import_utils18.enumOptionsValueForIndex)(target.value, enumOptions, emptyValue));
|
|
@@ -1226,7 +1164,7 @@ function CheckboxesWidget(props) {
|
|
|
1226
1164
|
},
|
|
1227
1165
|
[onBlur, id, enumOptions, emptyValue]
|
|
1228
1166
|
);
|
|
1229
|
-
const handleFocus = (0,
|
|
1167
|
+
const handleFocus = (0, import_react4.useCallback)(
|
|
1230
1168
|
({ target }) => {
|
|
1231
1169
|
if (onFocus) {
|
|
1232
1170
|
onFocus(id, (0, import_utils18.enumOptionsValueForIndex)(target.value, enumOptions, emptyValue));
|
|
@@ -1252,7 +1190,7 @@ function CheckboxesWidget(props) {
|
|
|
1252
1190
|
import_core19.Checkbox,
|
|
1253
1191
|
{
|
|
1254
1192
|
id: (0, import_utils18.optionId)(id, i),
|
|
1255
|
-
name: id,
|
|
1193
|
+
name: htmlName || id,
|
|
1256
1194
|
value: String(i),
|
|
1257
1195
|
label: option.label,
|
|
1258
1196
|
disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1,
|
|
@@ -1268,7 +1206,7 @@ function CheckboxesWidget(props) {
|
|
|
1268
1206
|
}
|
|
1269
1207
|
|
|
1270
1208
|
// src/widgets/CheckboxWidget.tsx
|
|
1271
|
-
var
|
|
1209
|
+
var import_react5 = require("react");
|
|
1272
1210
|
var import_utils20 = require("@rjsf/utils");
|
|
1273
1211
|
var import_core20 = require("@mantine/core");
|
|
1274
1212
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
@@ -1276,6 +1214,7 @@ function CheckboxWidget(props) {
|
|
|
1276
1214
|
const {
|
|
1277
1215
|
id,
|
|
1278
1216
|
name,
|
|
1217
|
+
htmlName,
|
|
1279
1218
|
value = false,
|
|
1280
1219
|
required,
|
|
1281
1220
|
disabled,
|
|
@@ -1298,7 +1237,7 @@ function CheckboxWidget(props) {
|
|
|
1298
1237
|
registry,
|
|
1299
1238
|
options
|
|
1300
1239
|
);
|
|
1301
|
-
const handleCheckboxChange = (0,
|
|
1240
|
+
const handleCheckboxChange = (0, import_react5.useCallback)(
|
|
1302
1241
|
(e) => {
|
|
1303
1242
|
if (!disabled && !readonly && onChange) {
|
|
1304
1243
|
onChange(e.currentTarget.checked);
|
|
@@ -1306,7 +1245,7 @@ function CheckboxWidget(props) {
|
|
|
1306
1245
|
},
|
|
1307
1246
|
[onChange, disabled, readonly]
|
|
1308
1247
|
);
|
|
1309
|
-
const handleBlur = (0,
|
|
1248
|
+
const handleBlur = (0, import_react5.useCallback)(
|
|
1310
1249
|
({ target }) => {
|
|
1311
1250
|
if (onBlur) {
|
|
1312
1251
|
onBlur(id, target.checked);
|
|
@@ -1314,7 +1253,7 @@ function CheckboxWidget(props) {
|
|
|
1314
1253
|
},
|
|
1315
1254
|
[onBlur, id]
|
|
1316
1255
|
);
|
|
1317
|
-
const handleFocus = (0,
|
|
1256
|
+
const handleFocus = (0, import_react5.useCallback)(
|
|
1318
1257
|
({ target }) => {
|
|
1319
1258
|
if (onFocus) {
|
|
1320
1259
|
onFocus(id, target.checked);
|
|
@@ -1338,7 +1277,7 @@ function CheckboxWidget(props) {
|
|
|
1338
1277
|
import_core20.Checkbox,
|
|
1339
1278
|
{
|
|
1340
1279
|
id,
|
|
1341
|
-
name,
|
|
1280
|
+
name: htmlName || name,
|
|
1342
1281
|
label: (0, import_utils20.labelValue)(label || void 0, hideLabel, false),
|
|
1343
1282
|
disabled: disabled || readonly,
|
|
1344
1283
|
required,
|
|
@@ -1356,7 +1295,7 @@ function CheckboxWidget(props) {
|
|
|
1356
1295
|
}
|
|
1357
1296
|
|
|
1358
1297
|
// src/widgets/ColorWidget.tsx
|
|
1359
|
-
var
|
|
1298
|
+
var import_react6 = require("react");
|
|
1360
1299
|
var import_utils22 = require("@rjsf/utils");
|
|
1361
1300
|
var import_core21 = require("@mantine/core");
|
|
1362
1301
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
@@ -1379,13 +1318,13 @@ function ColorWidget(props) {
|
|
|
1379
1318
|
onFocus
|
|
1380
1319
|
} = props;
|
|
1381
1320
|
const themeProps = cleanupOptions(options);
|
|
1382
|
-
const handleChange = (0,
|
|
1321
|
+
const handleChange = (0, import_react6.useCallback)(
|
|
1383
1322
|
(nextValue) => {
|
|
1384
1323
|
onChange(nextValue);
|
|
1385
1324
|
},
|
|
1386
1325
|
[onChange]
|
|
1387
1326
|
);
|
|
1388
|
-
const handleBlur = (0,
|
|
1327
|
+
const handleBlur = (0, import_react6.useCallback)(
|
|
1389
1328
|
({ target }) => {
|
|
1390
1329
|
if (onBlur) {
|
|
1391
1330
|
onBlur(id, target && target.value);
|
|
@@ -1393,7 +1332,7 @@ function ColorWidget(props) {
|
|
|
1393
1332
|
},
|
|
1394
1333
|
[onBlur, id]
|
|
1395
1334
|
);
|
|
1396
|
-
const handleFocus = (0,
|
|
1335
|
+
const handleFocus = (0, import_react6.useCallback)(
|
|
1397
1336
|
({ target }) => {
|
|
1398
1337
|
if (onFocus) {
|
|
1399
1338
|
onFocus(id, target && target.value);
|
|
@@ -1424,66 +1363,10 @@ function ColorWidget(props) {
|
|
|
1424
1363
|
}
|
|
1425
1364
|
|
|
1426
1365
|
// src/widgets/FileWidget.tsx
|
|
1427
|
-
var
|
|
1366
|
+
var import_react7 = require("react");
|
|
1428
1367
|
var import_utils24 = require("@rjsf/utils");
|
|
1429
1368
|
var import_core22 = require("@mantine/core");
|
|
1430
1369
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
1431
|
-
function addNameToDataURL(dataURL, name) {
|
|
1432
|
-
if (dataURL === null) {
|
|
1433
|
-
return null;
|
|
1434
|
-
}
|
|
1435
|
-
return dataURL.replace(";base64", `;name=${encodeURIComponent(name)};base64`);
|
|
1436
|
-
}
|
|
1437
|
-
function processFile(file) {
|
|
1438
|
-
const { name, size, type } = file;
|
|
1439
|
-
return new Promise((resolve, reject) => {
|
|
1440
|
-
const reader = new window.FileReader();
|
|
1441
|
-
reader.onerror = reject;
|
|
1442
|
-
reader.onload = (event) => {
|
|
1443
|
-
if (typeof event.target?.result === "string") {
|
|
1444
|
-
resolve({
|
|
1445
|
-
dataURL: addNameToDataURL(event.target.result, name),
|
|
1446
|
-
name,
|
|
1447
|
-
size,
|
|
1448
|
-
type
|
|
1449
|
-
});
|
|
1450
|
-
} else {
|
|
1451
|
-
resolve({
|
|
1452
|
-
dataURL: null,
|
|
1453
|
-
name,
|
|
1454
|
-
size,
|
|
1455
|
-
type
|
|
1456
|
-
});
|
|
1457
|
-
}
|
|
1458
|
-
};
|
|
1459
|
-
reader.readAsDataURL(file);
|
|
1460
|
-
});
|
|
1461
|
-
}
|
|
1462
|
-
function processFiles(files) {
|
|
1463
|
-
return Promise.all(Array.from(files).map(processFile));
|
|
1464
|
-
}
|
|
1465
|
-
function extractFileInfo(dataURLs) {
|
|
1466
|
-
return dataURLs.reduce((acc, dataURL) => {
|
|
1467
|
-
if (!dataURL) {
|
|
1468
|
-
return acc;
|
|
1469
|
-
}
|
|
1470
|
-
try {
|
|
1471
|
-
const { blob, name } = (0, import_utils24.dataURItoBlob)(dataURL);
|
|
1472
|
-
return [
|
|
1473
|
-
...acc,
|
|
1474
|
-
{
|
|
1475
|
-
dataURL,
|
|
1476
|
-
name,
|
|
1477
|
-
size: blob.size,
|
|
1478
|
-
type: blob.type
|
|
1479
|
-
}
|
|
1480
|
-
];
|
|
1481
|
-
} catch (e) {
|
|
1482
|
-
console.log(e);
|
|
1483
|
-
return acc;
|
|
1484
|
-
}
|
|
1485
|
-
}, []);
|
|
1486
|
-
}
|
|
1487
1370
|
function FileWidget(props) {
|
|
1488
1371
|
const {
|
|
1489
1372
|
id,
|
|
@@ -1501,44 +1384,22 @@ function FileWidget(props) {
|
|
|
1501
1384
|
multiple,
|
|
1502
1385
|
onChange
|
|
1503
1386
|
} = props;
|
|
1387
|
+
const { filesInfo, handleChange, handleRemove } = (0, import_utils24.useFileWidgetProps)(value, onChange, multiple);
|
|
1504
1388
|
const themeProps = cleanupOptions(options);
|
|
1505
|
-
const
|
|
1389
|
+
const handleOnChange = (0, import_react7.useCallback)(
|
|
1506
1390
|
(files) => {
|
|
1507
1391
|
if (typeof files === "object") {
|
|
1508
|
-
|
|
1509
|
-
const newValue = filesInfoEvent.map((fileInfo) => fileInfo.dataURL);
|
|
1510
|
-
if (multiple) {
|
|
1511
|
-
onChange(value.concat(newValue));
|
|
1512
|
-
} else {
|
|
1513
|
-
onChange(newValue[0]);
|
|
1514
|
-
}
|
|
1515
|
-
});
|
|
1516
|
-
}
|
|
1517
|
-
return;
|
|
1518
|
-
},
|
|
1519
|
-
[multiple, value, onChange]
|
|
1520
|
-
);
|
|
1521
|
-
const handleRemoveFile = (0, import_react9.useCallback)(
|
|
1522
|
-
(index) => {
|
|
1523
|
-
if (multiple) {
|
|
1524
|
-
const newValue = value.filter((_, i) => i !== index);
|
|
1525
|
-
onChange(newValue);
|
|
1526
|
-
} else {
|
|
1527
|
-
onChange(void 0);
|
|
1392
|
+
handleChange(files);
|
|
1528
1393
|
}
|
|
1529
1394
|
},
|
|
1530
|
-
[
|
|
1531
|
-
);
|
|
1532
|
-
const ValueComponent = (0, import_react9.useCallback)(
|
|
1533
|
-
(props2) => {
|
|
1534
|
-
const filesInfo = props2.value ? extractFileInfo(Array.isArray(props2.value) ? props2.value : [props2.value]) : null;
|
|
1535
|
-
if (Array.isArray(filesInfo) && filesInfo.length > 0) {
|
|
1536
|
-
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)) });
|
|
1537
|
-
}
|
|
1538
|
-
return null;
|
|
1539
|
-
},
|
|
1540
|
-
[handleRemoveFile]
|
|
1395
|
+
[handleChange]
|
|
1541
1396
|
);
|
|
1397
|
+
const ValueComponent = (0, import_react7.useCallback)(() => {
|
|
1398
|
+
if (Array.isArray(filesInfo) && filesInfo.length > 0) {
|
|
1399
|
+
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: () => handleRemove(index), children: file.name }, index)) });
|
|
1400
|
+
}
|
|
1401
|
+
return null;
|
|
1402
|
+
}, [handleRemove, filesInfo]);
|
|
1542
1403
|
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
1543
1404
|
import_core22.FileInput,
|
|
1544
1405
|
{
|
|
@@ -1552,7 +1413,7 @@ function FileWidget(props) {
|
|
|
1552
1413
|
label: (0, import_utils24.labelValue)(label || void 0, hideLabel, false),
|
|
1553
1414
|
multiple: !!multiple,
|
|
1554
1415
|
valueComponent: ValueComponent,
|
|
1555
|
-
onChange:
|
|
1416
|
+
onChange: handleOnChange,
|
|
1556
1417
|
error: rawErrors && rawErrors.length > 0 ? rawErrors.join("\n") : void 0,
|
|
1557
1418
|
...themeProps,
|
|
1558
1419
|
"aria-describedby": (0, import_utils24.ariaDescribedByIds)(id)
|
|
@@ -1561,7 +1422,7 @@ function FileWidget(props) {
|
|
|
1561
1422
|
}
|
|
1562
1423
|
|
|
1563
1424
|
// src/widgets/PasswordWidget.tsx
|
|
1564
|
-
var
|
|
1425
|
+
var import_react8 = require("react");
|
|
1565
1426
|
var import_utils26 = require("@rjsf/utils");
|
|
1566
1427
|
var import_core23 = require("@mantine/core");
|
|
1567
1428
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
@@ -1585,13 +1446,13 @@ function PasswordWidget(props) {
|
|
|
1585
1446
|
} = props;
|
|
1586
1447
|
const emptyValue = options.emptyValue || "";
|
|
1587
1448
|
const themeProps = cleanupOptions(options);
|
|
1588
|
-
const handleChange = (0,
|
|
1449
|
+
const handleChange = (0, import_react8.useCallback)(
|
|
1589
1450
|
(e) => {
|
|
1590
1451
|
onChange(e.target.value === "" ? emptyValue : e.target.value);
|
|
1591
1452
|
},
|
|
1592
1453
|
[onChange, emptyValue]
|
|
1593
1454
|
);
|
|
1594
|
-
const handleBlur = (0,
|
|
1455
|
+
const handleBlur = (0, import_react8.useCallback)(
|
|
1595
1456
|
({ target }) => {
|
|
1596
1457
|
if (onBlur) {
|
|
1597
1458
|
onBlur(id, target && target.value);
|
|
@@ -1599,7 +1460,7 @@ function PasswordWidget(props) {
|
|
|
1599
1460
|
},
|
|
1600
1461
|
[onBlur, id]
|
|
1601
1462
|
);
|
|
1602
|
-
const handleFocus = (0,
|
|
1463
|
+
const handleFocus = (0, import_react8.useCallback)(
|
|
1603
1464
|
({ target }) => {
|
|
1604
1465
|
if (onFocus) {
|
|
1605
1466
|
onFocus(id, target && target.value);
|
|
@@ -1629,13 +1490,14 @@ function PasswordWidget(props) {
|
|
|
1629
1490
|
}
|
|
1630
1491
|
|
|
1631
1492
|
// src/widgets/RadioWidget.tsx
|
|
1632
|
-
var
|
|
1493
|
+
var import_react9 = require("react");
|
|
1633
1494
|
var import_utils28 = require("@rjsf/utils");
|
|
1634
1495
|
var import_core24 = require("@mantine/core");
|
|
1635
1496
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
1636
1497
|
function RadioWidget(props) {
|
|
1637
1498
|
const {
|
|
1638
1499
|
id,
|
|
1500
|
+
htmlName,
|
|
1639
1501
|
value,
|
|
1640
1502
|
required,
|
|
1641
1503
|
disabled,
|
|
@@ -1651,7 +1513,7 @@ function RadioWidget(props) {
|
|
|
1651
1513
|
} = props;
|
|
1652
1514
|
const { enumOptions, enumDisabled, inline, emptyValue } = options;
|
|
1653
1515
|
const themeProps = cleanupOptions(options);
|
|
1654
|
-
const handleChange = (0,
|
|
1516
|
+
const handleChange = (0, import_react9.useCallback)(
|
|
1655
1517
|
(nextValue) => {
|
|
1656
1518
|
if (!disabled && !readonly && onChange) {
|
|
1657
1519
|
onChange((0, import_utils28.enumOptionsValueForIndex)(nextValue, enumOptions, emptyValue));
|
|
@@ -1659,7 +1521,7 @@ function RadioWidget(props) {
|
|
|
1659
1521
|
},
|
|
1660
1522
|
[onChange, disabled, readonly, enumOptions, emptyValue]
|
|
1661
1523
|
);
|
|
1662
|
-
const handleBlur = (0,
|
|
1524
|
+
const handleBlur = (0, import_react9.useCallback)(
|
|
1663
1525
|
({ target }) => {
|
|
1664
1526
|
if (onBlur) {
|
|
1665
1527
|
onBlur(id, (0, import_utils28.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue));
|
|
@@ -1667,7 +1529,7 @@ function RadioWidget(props) {
|
|
|
1667
1529
|
},
|
|
1668
1530
|
[onBlur, id, enumOptions, emptyValue]
|
|
1669
1531
|
);
|
|
1670
|
-
const handleFocus = (0,
|
|
1532
|
+
const handleFocus = (0, import_react9.useCallback)(
|
|
1671
1533
|
({ target }) => {
|
|
1672
1534
|
if (onFocus) {
|
|
1673
1535
|
onFocus(id, (0, import_utils28.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue));
|
|
@@ -1680,7 +1542,7 @@ function RadioWidget(props) {
|
|
|
1680
1542
|
import_core24.Radio.Group,
|
|
1681
1543
|
{
|
|
1682
1544
|
id,
|
|
1683
|
-
name: id,
|
|
1545
|
+
name: htmlName || id,
|
|
1684
1546
|
value: selected,
|
|
1685
1547
|
label: !hideLabel ? label : void 0,
|
|
1686
1548
|
onChange: handleChange,
|
|
@@ -1707,7 +1569,7 @@ function RadioWidget(props) {
|
|
|
1707
1569
|
}
|
|
1708
1570
|
|
|
1709
1571
|
// src/widgets/RangeWidget.tsx
|
|
1710
|
-
var
|
|
1572
|
+
var import_react10 = require("react");
|
|
1711
1573
|
var import_utils30 = require("@rjsf/utils");
|
|
1712
1574
|
var import_core25 = require("@mantine/core");
|
|
1713
1575
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
@@ -1731,7 +1593,7 @@ function RangeWidget(props) {
|
|
|
1731
1593
|
} = props;
|
|
1732
1594
|
const themeProps = cleanupOptions(options);
|
|
1733
1595
|
const { min, max, step } = (0, import_utils30.rangeSpec)(schema);
|
|
1734
|
-
const handleChange = (0,
|
|
1596
|
+
const handleChange = (0, import_react10.useCallback)(
|
|
1735
1597
|
(nextValue) => {
|
|
1736
1598
|
if (!disabled && !readonly && onChange) {
|
|
1737
1599
|
onChange(nextValue);
|
|
@@ -1739,12 +1601,12 @@ function RangeWidget(props) {
|
|
|
1739
1601
|
},
|
|
1740
1602
|
[onChange, disabled, readonly]
|
|
1741
1603
|
);
|
|
1742
|
-
const handleBlur = (0,
|
|
1604
|
+
const handleBlur = (0, import_react10.useCallback)(() => {
|
|
1743
1605
|
if (onBlur) {
|
|
1744
1606
|
onBlur(id, value);
|
|
1745
1607
|
}
|
|
1746
1608
|
}, [onBlur, id, value]);
|
|
1747
|
-
const handleFocus = (0,
|
|
1609
|
+
const handleFocus = (0, import_react10.useCallback)(() => {
|
|
1748
1610
|
if (onFocus) {
|
|
1749
1611
|
onFocus(id, value);
|
|
1750
1612
|
}
|
|
@@ -1775,13 +1637,14 @@ function RangeWidget(props) {
|
|
|
1775
1637
|
}
|
|
1776
1638
|
|
|
1777
1639
|
// src/widgets/SelectWidget.tsx
|
|
1778
|
-
var
|
|
1640
|
+
var import_react11 = require("react");
|
|
1779
1641
|
var import_utils32 = require("@rjsf/utils");
|
|
1780
1642
|
var import_core26 = require("@mantine/core");
|
|
1781
1643
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
1782
1644
|
function SelectWidget(props) {
|
|
1783
1645
|
const {
|
|
1784
1646
|
id,
|
|
1647
|
+
htmlName,
|
|
1785
1648
|
value,
|
|
1786
1649
|
placeholder,
|
|
1787
1650
|
required,
|
|
@@ -1799,7 +1662,7 @@ function SelectWidget(props) {
|
|
|
1799
1662
|
} = props;
|
|
1800
1663
|
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
1801
1664
|
const themeProps = cleanupOptions(options);
|
|
1802
|
-
const handleChange = (0,
|
|
1665
|
+
const handleChange = (0, import_react11.useCallback)(
|
|
1803
1666
|
(nextValue) => {
|
|
1804
1667
|
if (!disabled && !readonly && onChange) {
|
|
1805
1668
|
onChange((0, import_utils32.enumOptionsValueForIndex)(nextValue, enumOptions, emptyValue));
|
|
@@ -1807,7 +1670,7 @@ function SelectWidget(props) {
|
|
|
1807
1670
|
},
|
|
1808
1671
|
[onChange, disabled, readonly, enumOptions, emptyValue]
|
|
1809
1672
|
);
|
|
1810
|
-
const handleBlur = (0,
|
|
1673
|
+
const handleBlur = (0, import_react11.useCallback)(
|
|
1811
1674
|
({ target }) => {
|
|
1812
1675
|
if (onBlur) {
|
|
1813
1676
|
onBlur(id, (0, import_utils32.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue));
|
|
@@ -1815,7 +1678,7 @@ function SelectWidget(props) {
|
|
|
1815
1678
|
},
|
|
1816
1679
|
[onBlur, id, enumOptions, emptyValue]
|
|
1817
1680
|
);
|
|
1818
|
-
const handleFocus = (0,
|
|
1681
|
+
const handleFocus = (0, import_react11.useCallback)(
|
|
1819
1682
|
({ target }) => {
|
|
1820
1683
|
if (onFocus) {
|
|
1821
1684
|
onFocus(id, (0, import_utils32.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue));
|
|
@@ -1824,7 +1687,7 @@ function SelectWidget(props) {
|
|
|
1824
1687
|
[onFocus, id, enumOptions, emptyValue]
|
|
1825
1688
|
);
|
|
1826
1689
|
const selectedIndexes = (0, import_utils32.enumOptionsIndexForValue)(value, enumOptions, multiple);
|
|
1827
|
-
const selectOptions = (0,
|
|
1690
|
+
const selectOptions = (0, import_react11.useMemo)(() => {
|
|
1828
1691
|
if (Array.isArray(enumOptions)) {
|
|
1829
1692
|
return enumOptions.map((option, index) => ({
|
|
1830
1693
|
key: String(index),
|
|
@@ -1840,7 +1703,7 @@ function SelectWidget(props) {
|
|
|
1840
1703
|
Component,
|
|
1841
1704
|
{
|
|
1842
1705
|
id,
|
|
1843
|
-
name: id,
|
|
1706
|
+
name: htmlName || id,
|
|
1844
1707
|
label: (0, import_utils32.labelValue)(label || void 0, hideLabel, false),
|
|
1845
1708
|
data: selectOptions,
|
|
1846
1709
|
value: multiple ? selectedIndexes : selectedIndexes,
|
|
@@ -1861,7 +1724,7 @@ function SelectWidget(props) {
|
|
|
1861
1724
|
}
|
|
1862
1725
|
|
|
1863
1726
|
// src/widgets/TextareaWidget.tsx
|
|
1864
|
-
var
|
|
1727
|
+
var import_react12 = require("react");
|
|
1865
1728
|
var import_utils34 = require("@rjsf/utils");
|
|
1866
1729
|
var import_core27 = require("@mantine/core");
|
|
1867
1730
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
@@ -1869,6 +1732,7 @@ function TextareaWidget(props) {
|
|
|
1869
1732
|
const {
|
|
1870
1733
|
id,
|
|
1871
1734
|
name,
|
|
1735
|
+
htmlName,
|
|
1872
1736
|
value,
|
|
1873
1737
|
placeholder,
|
|
1874
1738
|
required,
|
|
@@ -1885,13 +1749,13 @@ function TextareaWidget(props) {
|
|
|
1885
1749
|
} = props;
|
|
1886
1750
|
const themeProps = cleanupOptions(options);
|
|
1887
1751
|
const emptyValue = options?.emptyValue ?? "";
|
|
1888
|
-
const handleChange = (0,
|
|
1752
|
+
const handleChange = (0, import_react12.useCallback)(
|
|
1889
1753
|
(e) => {
|
|
1890
1754
|
onChange(e.target.value === "" ? emptyValue : e.target.value);
|
|
1891
1755
|
},
|
|
1892
1756
|
[onChange, emptyValue]
|
|
1893
1757
|
);
|
|
1894
|
-
const handleBlur = (0,
|
|
1758
|
+
const handleBlur = (0, import_react12.useCallback)(
|
|
1895
1759
|
({ target }) => {
|
|
1896
1760
|
if (onBlur) {
|
|
1897
1761
|
onBlur(id, target && target.value);
|
|
@@ -1899,7 +1763,7 @@ function TextareaWidget(props) {
|
|
|
1899
1763
|
},
|
|
1900
1764
|
[onBlur, id]
|
|
1901
1765
|
);
|
|
1902
|
-
const handleFocus = (0,
|
|
1766
|
+
const handleFocus = (0, import_react12.useCallback)(
|
|
1903
1767
|
({ target }) => {
|
|
1904
1768
|
if (onFocus) {
|
|
1905
1769
|
onFocus(id, target && target.value);
|
|
@@ -1911,7 +1775,7 @@ function TextareaWidget(props) {
|
|
|
1911
1775
|
import_core27.Textarea,
|
|
1912
1776
|
{
|
|
1913
1777
|
id,
|
|
1914
|
-
name,
|
|
1778
|
+
name: htmlName || name,
|
|
1915
1779
|
value: value || "",
|
|
1916
1780
|
placeholder: placeholder || void 0,
|
|
1917
1781
|
required,
|