@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/antd.umd.js
CHANGED
|
@@ -50,11 +50,6 @@
|
|
|
50
50
|
registry,
|
|
51
51
|
uiOptions
|
|
52
52
|
);
|
|
53
|
-
const ArrayFieldItemTemplate2 = utils.getTemplate(
|
|
54
|
-
"ArrayFieldItemTemplate",
|
|
55
|
-
registry,
|
|
56
|
-
uiOptions
|
|
57
|
-
);
|
|
58
53
|
const ArrayFieldTitleTemplate = utils.getTemplate(
|
|
59
54
|
"ArrayFieldTitleTemplate",
|
|
60
55
|
registry,
|
|
@@ -99,7 +94,7 @@
|
|
|
99
94
|
) }),
|
|
100
95
|
/* @__PURE__ */ jsxRuntime.jsxs(antd.Col, { className: "row array-item-list", span: 24, children: [
|
|
101
96
|
!showOptionalDataControlInTitle ? optionalDataControl : void 0,
|
|
102
|
-
items
|
|
97
|
+
items
|
|
103
98
|
] }),
|
|
104
99
|
canAdd && /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: 24, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Row, { gutter: rowGutter, justify: "end", children: /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { flex: "192px", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
105
100
|
AddButton2,
|
|
@@ -120,8 +115,9 @@
|
|
|
120
115
|
function BaseInputTemplate(props) {
|
|
121
116
|
const {
|
|
122
117
|
disabled,
|
|
123
|
-
|
|
118
|
+
registry,
|
|
124
119
|
id,
|
|
120
|
+
htmlName,
|
|
125
121
|
onBlur,
|
|
126
122
|
onChange,
|
|
127
123
|
onChangeOverride,
|
|
@@ -133,6 +129,7 @@
|
|
|
133
129
|
value,
|
|
134
130
|
type
|
|
135
131
|
} = props;
|
|
132
|
+
const { formContext } = registry;
|
|
136
133
|
const inputProps = utils.getInputProps(schema, type, options, false);
|
|
137
134
|
const { readonlyAsDisabled = true } = formContext;
|
|
138
135
|
const handleNumberChange = (nextValue) => onChange(nextValue);
|
|
@@ -144,7 +141,7 @@
|
|
|
144
141
|
{
|
|
145
142
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
146
143
|
id,
|
|
147
|
-
name: id,
|
|
144
|
+
name: htmlName || id,
|
|
148
145
|
onBlur: !readonly ? handleBlur : void 0,
|
|
149
146
|
onChange: !readonly ? handleNumberChange : void 0,
|
|
150
147
|
onFocus: !readonly ? handleFocus : void 0,
|
|
@@ -160,7 +157,7 @@
|
|
|
160
157
|
{
|
|
161
158
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
162
159
|
id,
|
|
163
|
-
name: id,
|
|
160
|
+
name: htmlName || id,
|
|
164
161
|
onBlur: !readonly ? handleBlur : void 0,
|
|
165
162
|
onChange: !readonly ? handleTextChange : void 0,
|
|
166
163
|
onFocus: !readonly ? handleFocus : void 0,
|
|
@@ -295,8 +292,9 @@
|
|
|
295
292
|
hidden,
|
|
296
293
|
id,
|
|
297
294
|
label,
|
|
298
|
-
|
|
299
|
-
|
|
295
|
+
onKeyRename,
|
|
296
|
+
onKeyRenameBlur,
|
|
297
|
+
onRemoveProperty,
|
|
300
298
|
rawErrors,
|
|
301
299
|
rawDescription,
|
|
302
300
|
rawHelp,
|
|
@@ -342,8 +340,9 @@
|
|
|
342
340
|
disabled,
|
|
343
341
|
id,
|
|
344
342
|
label,
|
|
345
|
-
|
|
346
|
-
|
|
343
|
+
onKeyRename,
|
|
344
|
+
onKeyRenameBlur,
|
|
345
|
+
onRemoveProperty,
|
|
347
346
|
readonly,
|
|
348
347
|
required,
|
|
349
348
|
schema,
|
|
@@ -392,7 +391,7 @@
|
|
|
392
391
|
disabled,
|
|
393
392
|
formData,
|
|
394
393
|
fieldPathId,
|
|
395
|
-
|
|
394
|
+
onAddProperty,
|
|
396
395
|
optionalDataControl,
|
|
397
396
|
properties,
|
|
398
397
|
readonly,
|
|
@@ -484,7 +483,7 @@
|
|
|
484
483
|
id: utils.buttonId(fieldPathId, "add"),
|
|
485
484
|
className: "rjsf-object-property-expand",
|
|
486
485
|
disabled: disabled || readonly,
|
|
487
|
-
onClick:
|
|
486
|
+
onClick: onAddProperty,
|
|
488
487
|
uiSchema,
|
|
489
488
|
registry
|
|
490
489
|
}
|
|
@@ -596,8 +595,8 @@
|
|
|
596
595
|
disabled,
|
|
597
596
|
id,
|
|
598
597
|
label,
|
|
599
|
-
|
|
600
|
-
|
|
598
|
+
onRemoveProperty,
|
|
599
|
+
onKeyRenameBlur,
|
|
601
600
|
readonly,
|
|
602
601
|
required,
|
|
603
602
|
registry,
|
|
@@ -620,7 +619,6 @@
|
|
|
620
619
|
if (!additional) {
|
|
621
620
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames4, style, children });
|
|
622
621
|
}
|
|
623
|
-
const handleBlur = ({ target }) => onKeyChange(target && target.value);
|
|
624
622
|
const uiOptions = uiSchema ? uiSchema[utils.UI_OPTIONS_KEY] : {};
|
|
625
623
|
const buttonUiOptions = {
|
|
626
624
|
...uiSchema,
|
|
@@ -647,7 +645,7 @@
|
|
|
647
645
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
648
646
|
id: `${id}-key`,
|
|
649
647
|
name: `${id}-key`,
|
|
650
|
-
onBlur: !readonly ?
|
|
648
|
+
onBlur: !readonly ? onKeyRenameBlur : void 0,
|
|
651
649
|
style: INPUT_STYLE2,
|
|
652
650
|
type: "text"
|
|
653
651
|
}
|
|
@@ -661,7 +659,7 @@
|
|
|
661
659
|
id: utils.buttonId(id, "remove"),
|
|
662
660
|
className: "rjsf-object-property-remove",
|
|
663
661
|
disabled: disabled || readonly,
|
|
664
|
-
onClick:
|
|
662
|
+
onClick: onRemoveProperty,
|
|
665
663
|
uiSchema: buttonUiOptions,
|
|
666
664
|
registry
|
|
667
665
|
}
|
|
@@ -696,105 +694,31 @@
|
|
|
696
694
|
};
|
|
697
695
|
}
|
|
698
696
|
var templates_default = generateTemplates();
|
|
699
|
-
var readyForChange = (state) => {
|
|
700
|
-
return Object.values(state).every((value) => value !== -1);
|
|
701
|
-
};
|
|
702
697
|
function AltDateWidget(props) {
|
|
703
|
-
const {
|
|
704
|
-
|
|
705
|
-
disabled,
|
|
706
|
-
formContext,
|
|
707
|
-
id,
|
|
708
|
-
onBlur,
|
|
709
|
-
onChange,
|
|
710
|
-
onFocus,
|
|
711
|
-
options,
|
|
712
|
-
readonly,
|
|
713
|
-
registry,
|
|
714
|
-
showTime,
|
|
715
|
-
value
|
|
716
|
-
} = props;
|
|
717
|
-
const { translateString, widgets } = registry;
|
|
718
|
-
const { SelectWidget: SelectWidget2 } = widgets;
|
|
698
|
+
const { autofocus, disabled, id, name, onBlur, onFocus, options, readonly, registry } = props;
|
|
699
|
+
const { formContext, translateString } = registry;
|
|
719
700
|
const { rowGutter = 24 } = formContext;
|
|
720
|
-
const
|
|
721
|
-
react.useEffect(() => {
|
|
722
|
-
setState(utils.parseDateString(value, showTime));
|
|
723
|
-
}, [showTime, value]);
|
|
724
|
-
const handleChange = (property, nextValue) => {
|
|
725
|
-
const nextState = {
|
|
726
|
-
...state,
|
|
727
|
-
[property]: typeof nextValue === "undefined" ? -1 : nextValue
|
|
728
|
-
};
|
|
729
|
-
if (readyForChange(nextState)) {
|
|
730
|
-
onChange(utils.toDateString(nextState, showTime));
|
|
731
|
-
} else {
|
|
732
|
-
setState(nextState);
|
|
733
|
-
}
|
|
734
|
-
};
|
|
735
|
-
const handleNow = (event) => {
|
|
736
|
-
event.preventDefault();
|
|
737
|
-
if (disabled || readonly) {
|
|
738
|
-
return;
|
|
739
|
-
}
|
|
740
|
-
const nextState = utils.parseDateString((/* @__PURE__ */ new Date()).toJSON(), showTime);
|
|
741
|
-
onChange(utils.toDateString(nextState, showTime));
|
|
742
|
-
};
|
|
743
|
-
const handleClear = (event) => {
|
|
744
|
-
event.preventDefault();
|
|
745
|
-
if (disabled || readonly) {
|
|
746
|
-
return;
|
|
747
|
-
}
|
|
748
|
-
onChange(void 0);
|
|
749
|
-
};
|
|
750
|
-
const renderDateElement = (elemProps) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
751
|
-
SelectWidget2,
|
|
752
|
-
{
|
|
753
|
-
autofocus: elemProps.autofocus,
|
|
754
|
-
className: "form-control",
|
|
755
|
-
disabled: elemProps.disabled,
|
|
756
|
-
id: elemProps.id,
|
|
757
|
-
name: elemProps.name,
|
|
758
|
-
onBlur: elemProps.onBlur,
|
|
759
|
-
onChange: (elemValue) => elemProps.select(elemProps.type, elemValue),
|
|
760
|
-
onFocus: elemProps.onFocus,
|
|
761
|
-
options: {
|
|
762
|
-
enumOptions: utils.dateRangeOptions(elemProps.range[0], elemProps.range[1])
|
|
763
|
-
},
|
|
764
|
-
placeholder: elemProps.type,
|
|
765
|
-
readonly: elemProps.readonly,
|
|
766
|
-
schema: { type: "integer" },
|
|
767
|
-
value: elemProps.value,
|
|
768
|
-
registry,
|
|
769
|
-
label: "",
|
|
770
|
-
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
771
|
-
}
|
|
772
|
-
);
|
|
701
|
+
const { elements, handleChange, handleClear, handleSetNow } = utils.useAltDateWidgetProps(props);
|
|
773
702
|
return /* @__PURE__ */ jsxRuntime.jsxs(antd.Row, { gutter: [Math.floor(rowGutter / 2), Math.floor(rowGutter / 2)], children: [
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
select: handleChange,
|
|
792
|
-
// NOTE: antd components accept -1 rather than issue a warning
|
|
793
|
-
// like material-ui, so we need to convert -1 to undefined here.
|
|
794
|
-
value: elemProps.value || -1 < 0 ? void 0 : elemProps.value
|
|
795
|
-
}) }, elemId);
|
|
703
|
+
elements.map((elemProps, i) => {
|
|
704
|
+
const elemId = `${id}_${elemProps.type}`;
|
|
705
|
+
return /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { flex: "88px", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
706
|
+
utils.DateElement,
|
|
707
|
+
{
|
|
708
|
+
rootId: id,
|
|
709
|
+
name,
|
|
710
|
+
select: handleChange,
|
|
711
|
+
...elemProps,
|
|
712
|
+
disabled,
|
|
713
|
+
readonly,
|
|
714
|
+
registry,
|
|
715
|
+
onBlur,
|
|
716
|
+
onFocus,
|
|
717
|
+
autofocus: autofocus && i === 0
|
|
718
|
+
}
|
|
719
|
+
) }, elemId);
|
|
796
720
|
}),
|
|
797
|
-
!options.hideNowButton && /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { flex: "88px", children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { block: true, className: "btn-now", onClick:
|
|
721
|
+
!options.hideNowButton && /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { flex: "88px", children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { block: true, className: "btn-now", onClick: handleSetNow, type: "primary", children: translateString(utils.TranslatableString.NowLabel) }) }),
|
|
798
722
|
!options.hideClearButton && /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { flex: "88px", children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { block: true, className: "btn-clear", danger: true, onClick: handleClear, type: "primary", children: translateString(utils.TranslatableString.ClearLabel) }) })
|
|
799
723
|
] });
|
|
800
724
|
}
|
|
@@ -805,17 +729,30 @@
|
|
|
805
729
|
yearsRange: [1900, (/* @__PURE__ */ new Date()).getFullYear() + 2]
|
|
806
730
|
},
|
|
807
731
|
readonly: false,
|
|
808
|
-
|
|
732
|
+
time: false
|
|
809
733
|
};
|
|
810
734
|
function AltDateTimeWidget(props) {
|
|
811
735
|
const { AltDateWidget: AltDateWidget2 } = props.registry.widgets;
|
|
812
|
-
return /* @__PURE__ */ jsxRuntime.jsx(AltDateWidget2, {
|
|
736
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AltDateWidget2, { time: true, ...props });
|
|
813
737
|
}
|
|
814
738
|
AltDateTimeWidget.defaultProps = {
|
|
815
739
|
...AltDateWidget.defaultProps,
|
|
816
|
-
|
|
740
|
+
time: true
|
|
817
741
|
};
|
|
818
|
-
function CheckboxesWidget({
|
|
742
|
+
function CheckboxesWidget({
|
|
743
|
+
autofocus,
|
|
744
|
+
disabled,
|
|
745
|
+
registry,
|
|
746
|
+
id,
|
|
747
|
+
htmlName,
|
|
748
|
+
onBlur,
|
|
749
|
+
onChange,
|
|
750
|
+
onFocus,
|
|
751
|
+
options,
|
|
752
|
+
readonly,
|
|
753
|
+
value
|
|
754
|
+
}) {
|
|
755
|
+
const { formContext } = registry;
|
|
819
756
|
const { readonlyAsDisabled = true } = formContext;
|
|
820
757
|
const { enumOptions, enumDisabled, inline, emptyValue } = options;
|
|
821
758
|
const handleChange = (nextValue) => onChange(utils.enumOptionsValueForIndex(nextValue, enumOptions, emptyValue));
|
|
@@ -831,7 +768,7 @@
|
|
|
831
768
|
antd.Checkbox.Group,
|
|
832
769
|
{
|
|
833
770
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
834
|
-
name: id,
|
|
771
|
+
name: htmlName || id,
|
|
835
772
|
onChange: !readonly ? handleChange : void 0,
|
|
836
773
|
value: selectedIndexes,
|
|
837
774
|
...extraProps,
|
|
@@ -841,7 +778,7 @@
|
|
|
841
778
|
antd.Checkbox,
|
|
842
779
|
{
|
|
843
780
|
id: utils.optionId(id, i),
|
|
844
|
-
name: id,
|
|
781
|
+
name: htmlName || id,
|
|
845
782
|
autoFocus: i === 0 ? autofocus : false,
|
|
846
783
|
disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1,
|
|
847
784
|
value: String(i),
|
|
@@ -854,7 +791,8 @@
|
|
|
854
791
|
) }) : null;
|
|
855
792
|
}
|
|
856
793
|
function CheckboxWidget(props) {
|
|
857
|
-
const { autofocus, disabled,
|
|
794
|
+
const { autofocus, disabled, registry, id, htmlName, label, hideLabel, onBlur, onChange, onFocus, readonly, value } = props;
|
|
795
|
+
const { formContext } = registry;
|
|
858
796
|
const { readonlyAsDisabled = true } = formContext;
|
|
859
797
|
const handleChange = ({ target }) => onChange(target.checked);
|
|
860
798
|
const handleBlur = ({ target }) => onBlur(id, target && target.checked);
|
|
@@ -870,7 +808,7 @@
|
|
|
870
808
|
checked: typeof value === "undefined" ? false : value,
|
|
871
809
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
872
810
|
id,
|
|
873
|
-
name: id,
|
|
811
|
+
name: htmlName || id,
|
|
874
812
|
onChange: !readonly ? handleChange : void 0,
|
|
875
813
|
...extraProps,
|
|
876
814
|
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
@@ -882,7 +820,8 @@
|
|
|
882
820
|
width: "100%"
|
|
883
821
|
};
|
|
884
822
|
function DateTimeWidget(props) {
|
|
885
|
-
const { disabled,
|
|
823
|
+
const { disabled, registry, id, onBlur, onChange, onFocus, placeholder, readonly, value } = props;
|
|
824
|
+
const { formContext } = registry;
|
|
886
825
|
const { readonlyAsDisabled = true } = formContext;
|
|
887
826
|
const handleChange = (nextValue) => onChange(nextValue && nextValue.toISOString());
|
|
888
827
|
const handleBlur = () => onBlur(id, value);
|
|
@@ -910,7 +849,8 @@
|
|
|
910
849
|
width: "100%"
|
|
911
850
|
};
|
|
912
851
|
function DateWidget(props) {
|
|
913
|
-
const { disabled,
|
|
852
|
+
const { disabled, registry, id, onBlur, onChange, onFocus, placeholder, readonly, value } = props;
|
|
853
|
+
const { formContext } = registry;
|
|
914
854
|
const { readonlyAsDisabled = true } = formContext;
|
|
915
855
|
const handleChange = (nextValue) => onChange(nextValue && nextValue.format("YYYY-MM-DD"));
|
|
916
856
|
const handleBlur = () => onBlur(id, value);
|
|
@@ -935,7 +875,8 @@
|
|
|
935
875
|
);
|
|
936
876
|
}
|
|
937
877
|
function PasswordWidget(props) {
|
|
938
|
-
const { disabled,
|
|
878
|
+
const { disabled, registry, id, onBlur, onChange, onFocus, options, placeholder, readonly, value } = props;
|
|
879
|
+
const { formContext } = registry;
|
|
939
880
|
const { readonlyAsDisabled = true } = formContext;
|
|
940
881
|
const emptyValue = options.emptyValue || "";
|
|
941
882
|
const handleChange = ({ target }) => onChange(target.value === "" ? emptyValue : target.value);
|
|
@@ -959,8 +900,9 @@
|
|
|
959
900
|
function RadioWidget({
|
|
960
901
|
autofocus,
|
|
961
902
|
disabled,
|
|
962
|
-
|
|
903
|
+
registry,
|
|
963
904
|
id,
|
|
905
|
+
htmlName,
|
|
964
906
|
onBlur,
|
|
965
907
|
onChange,
|
|
966
908
|
onFocus,
|
|
@@ -968,6 +910,7 @@
|
|
|
968
910
|
readonly,
|
|
969
911
|
value
|
|
970
912
|
}) {
|
|
913
|
+
const { formContext } = registry;
|
|
971
914
|
const { readonlyAsDisabled = true } = formContext;
|
|
972
915
|
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
973
916
|
const handleChange = ({ target: { value: nextValue } }) => onChange(utils.enumOptionsValueForIndex(nextValue, enumOptions, emptyValue));
|
|
@@ -979,7 +922,7 @@
|
|
|
979
922
|
{
|
|
980
923
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
981
924
|
id,
|
|
982
|
-
name: id,
|
|
925
|
+
name: htmlName || id,
|
|
983
926
|
onChange: !readonly ? handleChange : void 0,
|
|
984
927
|
onBlur: !readonly ? handleBlur : void 0,
|
|
985
928
|
onFocus: !readonly ? handleFocus : void 0,
|
|
@@ -989,7 +932,7 @@
|
|
|
989
932
|
antd.Radio,
|
|
990
933
|
{
|
|
991
934
|
id: utils.optionId(id, i),
|
|
992
|
-
name: id,
|
|
935
|
+
name: htmlName || id,
|
|
993
936
|
autoFocus: i === 0 ? autofocus : false,
|
|
994
937
|
disabled: disabled || Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1,
|
|
995
938
|
value: String(i),
|
|
@@ -1004,7 +947,7 @@
|
|
|
1004
947
|
const {
|
|
1005
948
|
autofocus,
|
|
1006
949
|
disabled,
|
|
1007
|
-
|
|
950
|
+
registry,
|
|
1008
951
|
id,
|
|
1009
952
|
onBlur,
|
|
1010
953
|
onChange,
|
|
@@ -1015,6 +958,7 @@
|
|
|
1015
958
|
schema,
|
|
1016
959
|
value
|
|
1017
960
|
} = props;
|
|
961
|
+
const { formContext } = registry;
|
|
1018
962
|
const { readonlyAsDisabled = true } = formContext;
|
|
1019
963
|
const { min, max, step } = utils.rangeSpec(schema);
|
|
1020
964
|
const emptyValue = options.emptyValue || "";
|
|
@@ -1049,8 +993,9 @@
|
|
|
1049
993
|
function SelectWidget({
|
|
1050
994
|
autofocus,
|
|
1051
995
|
disabled,
|
|
1052
|
-
|
|
996
|
+
registry,
|
|
1053
997
|
id,
|
|
998
|
+
htmlName,
|
|
1054
999
|
multiple,
|
|
1055
1000
|
onBlur,
|
|
1056
1001
|
onChange,
|
|
@@ -1061,6 +1006,7 @@
|
|
|
1061
1006
|
value,
|
|
1062
1007
|
schema
|
|
1063
1008
|
}) {
|
|
1009
|
+
const { formContext } = registry;
|
|
1064
1010
|
const { readonlyAsDisabled = true } = formContext;
|
|
1065
1011
|
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
1066
1012
|
const handleChange = (nextValue) => onChange(utils.enumOptionsValueForIndex(nextValue, enumOptions, emptyValue));
|
|
@@ -1075,7 +1021,7 @@
|
|
|
1075
1021
|
const getPopupContainer = (node) => node.parentNode;
|
|
1076
1022
|
const selectedIndexes = utils.enumOptionsIndexForValue(value, enumOptions, multiple);
|
|
1077
1023
|
const extraProps = {
|
|
1078
|
-
name: id
|
|
1024
|
+
name: htmlName || id
|
|
1079
1025
|
};
|
|
1080
1026
|
const showPlaceholderOption = !multiple && schema.default === void 0;
|
|
1081
1027
|
const selectOptions = react.useMemo(() => {
|
|
@@ -1119,8 +1065,9 @@
|
|
|
1119
1065
|
};
|
|
1120
1066
|
function TextareaWidget({
|
|
1121
1067
|
disabled,
|
|
1122
|
-
|
|
1068
|
+
registry,
|
|
1123
1069
|
id,
|
|
1070
|
+
htmlName,
|
|
1124
1071
|
onBlur,
|
|
1125
1072
|
onChange,
|
|
1126
1073
|
onFocus,
|
|
@@ -1129,6 +1076,7 @@
|
|
|
1129
1076
|
readonly,
|
|
1130
1077
|
value
|
|
1131
1078
|
}) {
|
|
1079
|
+
const { formContext } = registry;
|
|
1132
1080
|
const { readonlyAsDisabled = true } = formContext;
|
|
1133
1081
|
const handleChange = ({ target }) => onChange(target.value === "" ? options.emptyValue : target.value);
|
|
1134
1082
|
const handleBlur = ({ target }) => onBlur(id, target && target.value);
|
|
@@ -1141,7 +1089,7 @@
|
|
|
1141
1089
|
{
|
|
1142
1090
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1143
1091
|
id,
|
|
1144
|
-
name: id,
|
|
1092
|
+
name: htmlName || id,
|
|
1145
1093
|
onBlur: !readonly ? handleBlur : void 0,
|
|
1146
1094
|
onChange: !readonly ? handleChange : void 0,
|
|
1147
1095
|
onFocus: !readonly ? handleFocus : void 0,
|