@rjsf/antd 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/antd.esm.js +103 -159
- package/dist/antd.esm.js.map +3 -3
- package/dist/antd.umd.js +82 -134
- package/dist/index.cjs +84 -137
- package/dist/index.cjs.map +3 -3
- package/lib/templates/ArrayFieldItemTemplate/index.d.ts +3 -3
- package/lib/templates/ArrayFieldItemTemplate/index.js +1 -1
- package/lib/templates/ArrayFieldItemTemplate/index.js.map +1 -1
- package/lib/templates/ArrayFieldTemplate/index.d.ts +1 -1
- package/lib/templates/ArrayFieldTemplate/index.js +2 -3
- package/lib/templates/ArrayFieldTemplate/index.js.map +1 -1
- package/lib/templates/BaseInputTemplate/index.js +3 -2
- package/lib/templates/BaseInputTemplate/index.js.map +1 -1
- package/lib/templates/FieldTemplate/index.js +2 -2
- package/lib/templates/FieldTemplate/index.js.map +1 -1
- package/lib/templates/ObjectFieldTemplate/index.js +2 -2
- package/lib/templates/ObjectFieldTemplate/index.js.map +1 -1
- package/lib/templates/WrapIfAdditionalTemplate/index.js +2 -3
- package/lib/templates/WrapIfAdditionalTemplate/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/widgets/AltDateTimeWidget/index.d.ts +1 -1
- package/lib/widgets/AltDateTimeWidget/index.js +2 -2
- package/lib/widgets/AltDateTimeWidget/index.js.map +1 -1
- package/lib/widgets/AltDateWidget/index.d.ts +1 -1
- package/lib/widgets/AltDateWidget/index.js +9 -61
- package/lib/widgets/AltDateWidget/index.js.map +1 -1
- package/lib/widgets/CheckboxWidget/index.js +3 -2
- package/lib/widgets/CheckboxWidget/index.js.map +1 -1
- package/lib/widgets/CheckboxesWidget/index.d.ts +1 -1
- package/lib/widgets/CheckboxesWidget/index.js +4 -3
- package/lib/widgets/CheckboxesWidget/index.js.map +1 -1
- package/lib/widgets/DateTimeWidget/index.js +2 -1
- package/lib/widgets/DateTimeWidget/index.js.map +1 -1
- package/lib/widgets/DateWidget/index.js +2 -1
- package/lib/widgets/DateWidget/index.js.map +1 -1
- package/lib/widgets/PasswordWidget/index.js +2 -1
- package/lib/widgets/PasswordWidget/index.js.map +1 -1
- package/lib/widgets/RadioWidget/index.d.ts +1 -1
- package/lib/widgets/RadioWidget/index.js +4 -3
- package/lib/widgets/RadioWidget/index.js.map +1 -1
- package/lib/widgets/RangeWidget/index.js +2 -1
- package/lib/widgets/RangeWidget/index.js.map +1 -1
- package/lib/widgets/SelectWidget/index.d.ts +1 -1
- package/lib/widgets/SelectWidget/index.js +3 -2
- package/lib/widgets/SelectWidget/index.js.map +1 -1
- package/lib/widgets/TextareaWidget/index.d.ts +1 -1
- package/lib/widgets/TextareaWidget/index.js +3 -2
- package/lib/widgets/TextareaWidget/index.js.map +1 -1
- package/package.json +7 -7
- package/src/templates/ArrayFieldItemTemplate/index.tsx +3 -3
- package/src/templates/ArrayFieldTemplate/index.tsx +2 -10
- package/src/templates/BaseInputTemplate/index.tsx +5 -3
- package/src/templates/FieldTemplate/index.tsx +6 -4
- package/src/templates/ObjectFieldTemplate/index.tsx +2 -2
- package/src/templates/WrapIfAdditionalTemplate/index.tsx +4 -7
- package/src/widgets/AltDateTimeWidget/index.tsx +2 -2
- package/src/widgets/AltDateWidget/index.tsx +21 -120
- package/src/widgets/CheckboxWidget/index.tsx +4 -2
- package/src/widgets/CheckboxesWidget/index.tsx +16 -3
- package/src/widgets/DateTimeWidget/index.tsx +2 -1
- package/src/widgets/DateWidget/index.tsx +2 -1
- package/src/widgets/PasswordWidget/index.tsx +2 -1
- package/src/widgets/RadioWidget/index.tsx +5 -3
- package/src/widgets/RangeWidget/index.tsx +2 -1
- package/src/widgets/SelectWidget/index.tsx +4 -2
- package/src/widgets/TextareaWidget/index.tsx +4 -2
package/dist/index.cjs
CHANGED
|
@@ -99,11 +99,6 @@ function ArrayFieldTemplate(props) {
|
|
|
99
99
|
registry,
|
|
100
100
|
uiOptions
|
|
101
101
|
);
|
|
102
|
-
const ArrayFieldItemTemplate2 = (0, import_utils2.getTemplate)(
|
|
103
|
-
"ArrayFieldItemTemplate",
|
|
104
|
-
registry,
|
|
105
|
-
uiOptions
|
|
106
|
-
);
|
|
107
102
|
const ArrayFieldTitleTemplate = (0, import_utils2.getTemplate)(
|
|
108
103
|
"ArrayFieldTitleTemplate",
|
|
109
104
|
registry,
|
|
@@ -148,7 +143,7 @@ function ArrayFieldTemplate(props) {
|
|
|
148
143
|
) }),
|
|
149
144
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_antd2.Col, { className: "row array-item-list", span: 24, children: [
|
|
150
145
|
!showOptionalDataControlInTitle ? optionalDataControl : void 0,
|
|
151
|
-
items
|
|
146
|
+
items
|
|
152
147
|
] }),
|
|
153
148
|
canAdd && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_antd2.Col, { span: 24, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_antd2.Row, { gutter: rowGutter, justify: "end", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_antd2.Col, { flex: "192px", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
154
149
|
AddButton2,
|
|
@@ -174,8 +169,9 @@ var INPUT_STYLE = {
|
|
|
174
169
|
function BaseInputTemplate(props) {
|
|
175
170
|
const {
|
|
176
171
|
disabled,
|
|
177
|
-
|
|
172
|
+
registry,
|
|
178
173
|
id,
|
|
174
|
+
htmlName,
|
|
179
175
|
onBlur,
|
|
180
176
|
onChange,
|
|
181
177
|
onChangeOverride,
|
|
@@ -187,6 +183,7 @@ function BaseInputTemplate(props) {
|
|
|
187
183
|
value,
|
|
188
184
|
type
|
|
189
185
|
} = props;
|
|
186
|
+
const { formContext } = registry;
|
|
190
187
|
const inputProps = (0, import_utils3.getInputProps)(schema, type, options, false);
|
|
191
188
|
const { readonlyAsDisabled = true } = formContext;
|
|
192
189
|
const handleNumberChange = (nextValue) => onChange(nextValue);
|
|
@@ -198,7 +195,7 @@ function BaseInputTemplate(props) {
|
|
|
198
195
|
{
|
|
199
196
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
200
197
|
id,
|
|
201
|
-
name: id,
|
|
198
|
+
name: htmlName || id,
|
|
202
199
|
onBlur: !readonly ? handleBlur : void 0,
|
|
203
200
|
onChange: !readonly ? handleNumberChange : void 0,
|
|
204
201
|
onFocus: !readonly ? handleFocus : void 0,
|
|
@@ -214,7 +211,7 @@ function BaseInputTemplate(props) {
|
|
|
214
211
|
{
|
|
215
212
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
216
213
|
id,
|
|
217
|
-
name: id,
|
|
214
|
+
name: htmlName || id,
|
|
218
215
|
onBlur: !readonly ? handleBlur : void 0,
|
|
219
216
|
onChange: !readonly ? handleTextChange : void 0,
|
|
220
217
|
onFocus: !readonly ? handleFocus : void 0,
|
|
@@ -378,8 +375,9 @@ function FieldTemplate(props) {
|
|
|
378
375
|
hidden,
|
|
379
376
|
id,
|
|
380
377
|
label,
|
|
381
|
-
|
|
382
|
-
|
|
378
|
+
onKeyRename,
|
|
379
|
+
onKeyRenameBlur,
|
|
380
|
+
onRemoveProperty,
|
|
383
381
|
rawErrors,
|
|
384
382
|
rawDescription,
|
|
385
383
|
rawHelp,
|
|
@@ -425,8 +423,9 @@ function FieldTemplate(props) {
|
|
|
425
423
|
disabled,
|
|
426
424
|
id,
|
|
427
425
|
label,
|
|
428
|
-
|
|
429
|
-
|
|
426
|
+
onKeyRename,
|
|
427
|
+
onKeyRenameBlur,
|
|
428
|
+
onRemoveProperty,
|
|
430
429
|
readonly,
|
|
431
430
|
required,
|
|
432
431
|
schema,
|
|
@@ -492,7 +491,7 @@ function ObjectFieldTemplate(props) {
|
|
|
492
491
|
disabled,
|
|
493
492
|
formData,
|
|
494
493
|
fieldPathId,
|
|
495
|
-
|
|
494
|
+
onAddProperty,
|
|
496
495
|
optionalDataControl,
|
|
497
496
|
properties,
|
|
498
497
|
readonly,
|
|
@@ -584,7 +583,7 @@ function ObjectFieldTemplate(props) {
|
|
|
584
583
|
id: (0, import_utils8.buttonId)(fieldPathId, "add"),
|
|
585
584
|
className: "rjsf-object-property-expand",
|
|
586
585
|
disabled: disabled || readonly,
|
|
587
|
-
onClick:
|
|
586
|
+
onClick: onAddProperty,
|
|
588
587
|
uiSchema,
|
|
589
588
|
registry
|
|
590
589
|
}
|
|
@@ -715,8 +714,8 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
715
714
|
disabled,
|
|
716
715
|
id,
|
|
717
716
|
label,
|
|
718
|
-
|
|
719
|
-
|
|
717
|
+
onRemoveProperty,
|
|
718
|
+
onKeyRenameBlur,
|
|
720
719
|
readonly,
|
|
721
720
|
required,
|
|
722
721
|
registry,
|
|
@@ -739,7 +738,6 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
739
738
|
if (!additional) {
|
|
740
739
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: classNames4, style, children });
|
|
741
740
|
}
|
|
742
|
-
const handleBlur = ({ target }) => onKeyChange(target && target.value);
|
|
743
741
|
const uiOptions = uiSchema ? uiSchema[import_utils10.UI_OPTIONS_KEY] : {};
|
|
744
742
|
const buttonUiOptions = {
|
|
745
743
|
...uiSchema,
|
|
@@ -766,7 +764,7 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
766
764
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
767
765
|
id: `${id}-key`,
|
|
768
766
|
name: `${id}-key`,
|
|
769
|
-
onBlur: !readonly ?
|
|
767
|
+
onBlur: !readonly ? onKeyRenameBlur : void 0,
|
|
770
768
|
style: INPUT_STYLE2,
|
|
771
769
|
type: "text"
|
|
772
770
|
}
|
|
@@ -780,7 +778,7 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
780
778
|
id: (0, import_utils10.buttonId)(id, "remove"),
|
|
781
779
|
className: "rjsf-object-property-remove",
|
|
782
780
|
disabled: disabled || readonly,
|
|
783
|
-
onClick:
|
|
781
|
+
onClick: onRemoveProperty,
|
|
784
782
|
uiSchema: buttonUiOptions,
|
|
785
783
|
registry
|
|
786
784
|
}
|
|
@@ -817,109 +815,34 @@ function generateTemplates() {
|
|
|
817
815
|
var templates_default = generateTemplates();
|
|
818
816
|
|
|
819
817
|
// src/widgets/AltDateWidget/index.tsx
|
|
820
|
-
var import_react4 = require("react");
|
|
821
818
|
var import_antd12 = require("antd");
|
|
822
819
|
var import_utils11 = require("@rjsf/utils");
|
|
823
820
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
824
|
-
var readyForChange = (state) => {
|
|
825
|
-
return Object.values(state).every((value) => value !== -1);
|
|
826
|
-
};
|
|
827
821
|
function AltDateWidget(props) {
|
|
828
|
-
const {
|
|
829
|
-
|
|
830
|
-
disabled,
|
|
831
|
-
formContext,
|
|
832
|
-
id,
|
|
833
|
-
onBlur,
|
|
834
|
-
onChange,
|
|
835
|
-
onFocus,
|
|
836
|
-
options,
|
|
837
|
-
readonly,
|
|
838
|
-
registry,
|
|
839
|
-
showTime,
|
|
840
|
-
value
|
|
841
|
-
} = props;
|
|
842
|
-
const { translateString, widgets } = registry;
|
|
843
|
-
const { SelectWidget: SelectWidget2 } = widgets;
|
|
822
|
+
const { autofocus, disabled, id, name, onBlur, onFocus, options, readonly, registry } = props;
|
|
823
|
+
const { formContext, translateString } = registry;
|
|
844
824
|
const { rowGutter = 24 } = formContext;
|
|
845
|
-
const
|
|
846
|
-
(0, import_react4.useEffect)(() => {
|
|
847
|
-
setState((0, import_utils11.parseDateString)(value, showTime));
|
|
848
|
-
}, [showTime, value]);
|
|
849
|
-
const handleChange = (property, nextValue) => {
|
|
850
|
-
const nextState = {
|
|
851
|
-
...state,
|
|
852
|
-
[property]: typeof nextValue === "undefined" ? -1 : nextValue
|
|
853
|
-
};
|
|
854
|
-
if (readyForChange(nextState)) {
|
|
855
|
-
onChange((0, import_utils11.toDateString)(nextState, showTime));
|
|
856
|
-
} else {
|
|
857
|
-
setState(nextState);
|
|
858
|
-
}
|
|
859
|
-
};
|
|
860
|
-
const handleNow = (event) => {
|
|
861
|
-
event.preventDefault();
|
|
862
|
-
if (disabled || readonly) {
|
|
863
|
-
return;
|
|
864
|
-
}
|
|
865
|
-
const nextState = (0, import_utils11.parseDateString)((/* @__PURE__ */ new Date()).toJSON(), showTime);
|
|
866
|
-
onChange((0, import_utils11.toDateString)(nextState, showTime));
|
|
867
|
-
};
|
|
868
|
-
const handleClear = (event) => {
|
|
869
|
-
event.preventDefault();
|
|
870
|
-
if (disabled || readonly) {
|
|
871
|
-
return;
|
|
872
|
-
}
|
|
873
|
-
onChange(void 0);
|
|
874
|
-
};
|
|
875
|
-
const renderDateElement = (elemProps) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
876
|
-
SelectWidget2,
|
|
877
|
-
{
|
|
878
|
-
autofocus: elemProps.autofocus,
|
|
879
|
-
className: "form-control",
|
|
880
|
-
disabled: elemProps.disabled,
|
|
881
|
-
id: elemProps.id,
|
|
882
|
-
name: elemProps.name,
|
|
883
|
-
onBlur: elemProps.onBlur,
|
|
884
|
-
onChange: (elemValue) => elemProps.select(elemProps.type, elemValue),
|
|
885
|
-
onFocus: elemProps.onFocus,
|
|
886
|
-
options: {
|
|
887
|
-
enumOptions: (0, import_utils11.dateRangeOptions)(elemProps.range[0], elemProps.range[1])
|
|
888
|
-
},
|
|
889
|
-
placeholder: elemProps.type,
|
|
890
|
-
readonly: elemProps.readonly,
|
|
891
|
-
schema: { type: "integer" },
|
|
892
|
-
value: elemProps.value,
|
|
893
|
-
registry,
|
|
894
|
-
label: "",
|
|
895
|
-
"aria-describedby": (0, import_utils11.ariaDescribedByIds)(id)
|
|
896
|
-
}
|
|
897
|
-
);
|
|
825
|
+
const { elements, handleChange, handleClear, handleSetNow } = (0, import_utils11.useAltDateWidgetProps)(props);
|
|
898
826
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_antd12.Row, { gutter: [Math.floor(rowGutter / 2), Math.floor(rowGutter / 2)], children: [
|
|
899
|
-
(
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
select: handleChange,
|
|
917
|
-
// NOTE: antd components accept -1 rather than issue a warning
|
|
918
|
-
// like material-ui, so we need to convert -1 to undefined here.
|
|
919
|
-
value: elemProps.value || -1 < 0 ? void 0 : elemProps.value
|
|
920
|
-
}) }, elemId);
|
|
827
|
+
elements.map((elemProps, i) => {
|
|
828
|
+
const elemId = `${id}_${elemProps.type}`;
|
|
829
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_antd12.Col, { flex: "88px", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
830
|
+
import_utils11.DateElement,
|
|
831
|
+
{
|
|
832
|
+
rootId: id,
|
|
833
|
+
name,
|
|
834
|
+
select: handleChange,
|
|
835
|
+
...elemProps,
|
|
836
|
+
disabled,
|
|
837
|
+
readonly,
|
|
838
|
+
registry,
|
|
839
|
+
onBlur,
|
|
840
|
+
onFocus,
|
|
841
|
+
autofocus: autofocus && i === 0
|
|
842
|
+
}
|
|
843
|
+
) }, elemId);
|
|
921
844
|
}),
|
|
922
|
-
!options.hideNowButton && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_antd12.Col, { flex: "88px", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_antd12.Button, { block: true, className: "btn-now", onClick:
|
|
845
|
+
!options.hideNowButton && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_antd12.Col, { flex: "88px", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_antd12.Button, { block: true, className: "btn-now", onClick: handleSetNow, type: "primary", children: translateString(import_utils11.TranslatableString.NowLabel) }) }),
|
|
923
846
|
!options.hideClearButton && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_antd12.Col, { flex: "88px", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_antd12.Button, { block: true, className: "btn-clear", danger: true, onClick: handleClear, type: "primary", children: translateString(import_utils11.TranslatableString.ClearLabel) }) })
|
|
924
847
|
] });
|
|
925
848
|
}
|
|
@@ -930,25 +853,38 @@ AltDateWidget.defaultProps = {
|
|
|
930
853
|
yearsRange: [1900, (/* @__PURE__ */ new Date()).getFullYear() + 2]
|
|
931
854
|
},
|
|
932
855
|
readonly: false,
|
|
933
|
-
|
|
856
|
+
time: false
|
|
934
857
|
};
|
|
935
858
|
|
|
936
859
|
// src/widgets/AltDateTimeWidget/index.tsx
|
|
937
860
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
938
861
|
function AltDateTimeWidget(props) {
|
|
939
862
|
const { AltDateWidget: AltDateWidget2 } = props.registry.widgets;
|
|
940
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AltDateWidget2, {
|
|
863
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AltDateWidget2, { time: true, ...props });
|
|
941
864
|
}
|
|
942
865
|
AltDateTimeWidget.defaultProps = {
|
|
943
866
|
...AltDateWidget.defaultProps,
|
|
944
|
-
|
|
867
|
+
time: true
|
|
945
868
|
};
|
|
946
869
|
|
|
947
870
|
// src/widgets/CheckboxesWidget/index.tsx
|
|
948
871
|
var import_antd13 = require("antd");
|
|
949
872
|
var import_utils12 = require("@rjsf/utils");
|
|
950
873
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
951
|
-
function CheckboxesWidget({
|
|
874
|
+
function CheckboxesWidget({
|
|
875
|
+
autofocus,
|
|
876
|
+
disabled,
|
|
877
|
+
registry,
|
|
878
|
+
id,
|
|
879
|
+
htmlName,
|
|
880
|
+
onBlur,
|
|
881
|
+
onChange,
|
|
882
|
+
onFocus,
|
|
883
|
+
options,
|
|
884
|
+
readonly,
|
|
885
|
+
value
|
|
886
|
+
}) {
|
|
887
|
+
const { formContext } = registry;
|
|
952
888
|
const { readonlyAsDisabled = true } = formContext;
|
|
953
889
|
const { enumOptions, enumDisabled, inline, emptyValue } = options;
|
|
954
890
|
const handleChange = (nextValue) => onChange((0, import_utils12.enumOptionsValueForIndex)(nextValue, enumOptions, emptyValue));
|
|
@@ -964,7 +900,7 @@ function CheckboxesWidget({ autofocus, disabled, formContext, id, onBlur, onChan
|
|
|
964
900
|
import_antd13.Checkbox.Group,
|
|
965
901
|
{
|
|
966
902
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
967
|
-
name: id,
|
|
903
|
+
name: htmlName || id,
|
|
968
904
|
onChange: !readonly ? handleChange : void 0,
|
|
969
905
|
value: selectedIndexes,
|
|
970
906
|
...extraProps,
|
|
@@ -974,7 +910,7 @@ function CheckboxesWidget({ autofocus, disabled, formContext, id, onBlur, onChan
|
|
|
974
910
|
import_antd13.Checkbox,
|
|
975
911
|
{
|
|
976
912
|
id: (0, import_utils12.optionId)(id, i),
|
|
977
|
-
name: id,
|
|
913
|
+
name: htmlName || id,
|
|
978
914
|
autoFocus: i === 0 ? autofocus : false,
|
|
979
915
|
disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1,
|
|
980
916
|
value: String(i),
|
|
@@ -992,7 +928,8 @@ var import_antd14 = require("antd");
|
|
|
992
928
|
var import_utils13 = require("@rjsf/utils");
|
|
993
929
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
994
930
|
function CheckboxWidget(props) {
|
|
995
|
-
const { autofocus, disabled,
|
|
931
|
+
const { autofocus, disabled, registry, id, htmlName, label, hideLabel, onBlur, onChange, onFocus, readonly, value } = props;
|
|
932
|
+
const { formContext } = registry;
|
|
996
933
|
const { readonlyAsDisabled = true } = formContext;
|
|
997
934
|
const handleChange = ({ target }) => onChange(target.checked);
|
|
998
935
|
const handleBlur = ({ target }) => onBlur(id, target && target.checked);
|
|
@@ -1008,7 +945,7 @@ function CheckboxWidget(props) {
|
|
|
1008
945
|
checked: typeof value === "undefined" ? false : value,
|
|
1009
946
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1010
947
|
id,
|
|
1011
|
-
name: id,
|
|
948
|
+
name: htmlName || id,
|
|
1012
949
|
onChange: !readonly ? handleChange : void 0,
|
|
1013
950
|
...extraProps,
|
|
1014
951
|
"aria-describedby": (0, import_utils13.ariaDescribedByIds)(id),
|
|
@@ -1026,7 +963,8 @@ var DATE_PICKER_STYLE = {
|
|
|
1026
963
|
width: "100%"
|
|
1027
964
|
};
|
|
1028
965
|
function DateTimeWidget(props) {
|
|
1029
|
-
const { disabled,
|
|
966
|
+
const { disabled, registry, id, onBlur, onChange, onFocus, placeholder, readonly, value } = props;
|
|
967
|
+
const { formContext } = registry;
|
|
1030
968
|
const { readonlyAsDisabled = true } = formContext;
|
|
1031
969
|
const handleChange = (nextValue) => onChange(nextValue && nextValue.toISOString());
|
|
1032
970
|
const handleBlur = () => onBlur(id, value);
|
|
@@ -1060,7 +998,8 @@ var DATE_PICKER_STYLE2 = {
|
|
|
1060
998
|
width: "100%"
|
|
1061
999
|
};
|
|
1062
1000
|
function DateWidget(props) {
|
|
1063
|
-
const { disabled,
|
|
1001
|
+
const { disabled, registry, id, onBlur, onChange, onFocus, placeholder, readonly, value } = props;
|
|
1002
|
+
const { formContext } = registry;
|
|
1064
1003
|
const { readonlyAsDisabled = true } = formContext;
|
|
1065
1004
|
const handleChange = (nextValue) => onChange(nextValue && nextValue.format("YYYY-MM-DD"));
|
|
1066
1005
|
const handleBlur = () => onBlur(id, value);
|
|
@@ -1090,7 +1029,8 @@ var import_antd17 = require("antd");
|
|
|
1090
1029
|
var import_utils16 = require("@rjsf/utils");
|
|
1091
1030
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1092
1031
|
function PasswordWidget(props) {
|
|
1093
|
-
const { disabled,
|
|
1032
|
+
const { disabled, registry, id, onBlur, onChange, onFocus, options, placeholder, readonly, value } = props;
|
|
1033
|
+
const { formContext } = registry;
|
|
1094
1034
|
const { readonlyAsDisabled = true } = formContext;
|
|
1095
1035
|
const emptyValue = options.emptyValue || "";
|
|
1096
1036
|
const handleChange = ({ target }) => onChange(target.value === "" ? emptyValue : target.value);
|
|
@@ -1119,8 +1059,9 @@ var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
|
1119
1059
|
function RadioWidget({
|
|
1120
1060
|
autofocus,
|
|
1121
1061
|
disabled,
|
|
1122
|
-
|
|
1062
|
+
registry,
|
|
1123
1063
|
id,
|
|
1064
|
+
htmlName,
|
|
1124
1065
|
onBlur,
|
|
1125
1066
|
onChange,
|
|
1126
1067
|
onFocus,
|
|
@@ -1128,6 +1069,7 @@ function RadioWidget({
|
|
|
1128
1069
|
readonly,
|
|
1129
1070
|
value
|
|
1130
1071
|
}) {
|
|
1072
|
+
const { formContext } = registry;
|
|
1131
1073
|
const { readonlyAsDisabled = true } = formContext;
|
|
1132
1074
|
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
1133
1075
|
const handleChange = ({ target: { value: nextValue } }) => onChange((0, import_utils17.enumOptionsValueForIndex)(nextValue, enumOptions, emptyValue));
|
|
@@ -1139,7 +1081,7 @@ function RadioWidget({
|
|
|
1139
1081
|
{
|
|
1140
1082
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1141
1083
|
id,
|
|
1142
|
-
name: id,
|
|
1084
|
+
name: htmlName || id,
|
|
1143
1085
|
onChange: !readonly ? handleChange : void 0,
|
|
1144
1086
|
onBlur: !readonly ? handleBlur : void 0,
|
|
1145
1087
|
onFocus: !readonly ? handleFocus : void 0,
|
|
@@ -1149,7 +1091,7 @@ function RadioWidget({
|
|
|
1149
1091
|
import_antd18.Radio,
|
|
1150
1092
|
{
|
|
1151
1093
|
id: (0, import_utils17.optionId)(id, i),
|
|
1152
|
-
name: id,
|
|
1094
|
+
name: htmlName || id,
|
|
1153
1095
|
autoFocus: i === 0 ? autofocus : false,
|
|
1154
1096
|
disabled: disabled || Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1,
|
|
1155
1097
|
value: String(i),
|
|
@@ -1169,7 +1111,7 @@ function RangeWidget(props) {
|
|
|
1169
1111
|
const {
|
|
1170
1112
|
autofocus,
|
|
1171
1113
|
disabled,
|
|
1172
|
-
|
|
1114
|
+
registry,
|
|
1173
1115
|
id,
|
|
1174
1116
|
onBlur,
|
|
1175
1117
|
onChange,
|
|
@@ -1180,6 +1122,7 @@ function RangeWidget(props) {
|
|
|
1180
1122
|
schema,
|
|
1181
1123
|
value
|
|
1182
1124
|
} = props;
|
|
1125
|
+
const { formContext } = registry;
|
|
1183
1126
|
const { readonlyAsDisabled = true } = formContext;
|
|
1184
1127
|
const { min, max, step } = (0, import_utils18.rangeSpec)(schema);
|
|
1185
1128
|
const emptyValue = options.emptyValue || "";
|
|
@@ -1213,7 +1156,7 @@ function RangeWidget(props) {
|
|
|
1213
1156
|
var import_antd20 = require("antd");
|
|
1214
1157
|
var import_utils19 = require("@rjsf/utils");
|
|
1215
1158
|
var import_isString2 = __toESM(require("lodash/isString"), 1);
|
|
1216
|
-
var
|
|
1159
|
+
var import_react4 = require("react");
|
|
1217
1160
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1218
1161
|
var SELECT_STYLE = {
|
|
1219
1162
|
width: "100%"
|
|
@@ -1221,8 +1164,9 @@ var SELECT_STYLE = {
|
|
|
1221
1164
|
function SelectWidget({
|
|
1222
1165
|
autofocus,
|
|
1223
1166
|
disabled,
|
|
1224
|
-
|
|
1167
|
+
registry,
|
|
1225
1168
|
id,
|
|
1169
|
+
htmlName,
|
|
1226
1170
|
multiple,
|
|
1227
1171
|
onBlur,
|
|
1228
1172
|
onChange,
|
|
@@ -1233,6 +1177,7 @@ function SelectWidget({
|
|
|
1233
1177
|
value,
|
|
1234
1178
|
schema
|
|
1235
1179
|
}) {
|
|
1180
|
+
const { formContext } = registry;
|
|
1236
1181
|
const { readonlyAsDisabled = true } = formContext;
|
|
1237
1182
|
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
1238
1183
|
const handleChange = (nextValue) => onChange((0, import_utils19.enumOptionsValueForIndex)(nextValue, enumOptions, emptyValue));
|
|
@@ -1247,10 +1192,10 @@ function SelectWidget({
|
|
|
1247
1192
|
const getPopupContainer = (node) => node.parentNode;
|
|
1248
1193
|
const selectedIndexes = (0, import_utils19.enumOptionsIndexForValue)(value, enumOptions, multiple);
|
|
1249
1194
|
const extraProps = {
|
|
1250
|
-
name: id
|
|
1195
|
+
name: htmlName || id
|
|
1251
1196
|
};
|
|
1252
1197
|
const showPlaceholderOption = !multiple && schema.default === void 0;
|
|
1253
|
-
const selectOptions = (0,
|
|
1198
|
+
const selectOptions = (0, import_react4.useMemo)(() => {
|
|
1254
1199
|
if (Array.isArray(enumOptions)) {
|
|
1255
1200
|
const options2 = enumOptions.map(({ value: optionValue, label: optionLabel }, index) => ({
|
|
1256
1201
|
disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(optionValue) !== -1,
|
|
@@ -1296,8 +1241,9 @@ var INPUT_STYLE3 = {
|
|
|
1296
1241
|
};
|
|
1297
1242
|
function TextareaWidget({
|
|
1298
1243
|
disabled,
|
|
1299
|
-
|
|
1244
|
+
registry,
|
|
1300
1245
|
id,
|
|
1246
|
+
htmlName,
|
|
1301
1247
|
onBlur,
|
|
1302
1248
|
onChange,
|
|
1303
1249
|
onFocus,
|
|
@@ -1306,6 +1252,7 @@ function TextareaWidget({
|
|
|
1306
1252
|
readonly,
|
|
1307
1253
|
value
|
|
1308
1254
|
}) {
|
|
1255
|
+
const { formContext } = registry;
|
|
1309
1256
|
const { readonlyAsDisabled = true } = formContext;
|
|
1310
1257
|
const handleChange = ({ target }) => onChange(target.value === "" ? options.emptyValue : target.value);
|
|
1311
1258
|
const handleBlur = ({ target }) => onBlur(id, target && target.value);
|
|
@@ -1318,7 +1265,7 @@ function TextareaWidget({
|
|
|
1318
1265
|
{
|
|
1319
1266
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1320
1267
|
id,
|
|
1321
|
-
name: id,
|
|
1268
|
+
name: htmlName || id,
|
|
1322
1269
|
onBlur: !readonly ? handleBlur : void 0,
|
|
1323
1270
|
onChange: !readonly ? handleChange : void 0,
|
|
1324
1271
|
onFocus: !readonly ? handleFocus : void 0,
|