@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.esm.js
CHANGED
|
@@ -64,11 +64,6 @@ function ArrayFieldTemplate(props) {
|
|
|
64
64
|
registry,
|
|
65
65
|
uiOptions
|
|
66
66
|
);
|
|
67
|
-
const ArrayFieldItemTemplate2 = getTemplate2(
|
|
68
|
-
"ArrayFieldItemTemplate",
|
|
69
|
-
registry,
|
|
70
|
-
uiOptions
|
|
71
|
-
);
|
|
72
67
|
const ArrayFieldTitleTemplate = getTemplate2(
|
|
73
68
|
"ArrayFieldTitleTemplate",
|
|
74
69
|
registry,
|
|
@@ -113,7 +108,7 @@ function ArrayFieldTemplate(props) {
|
|
|
113
108
|
) }),
|
|
114
109
|
/* @__PURE__ */ jsxs2(Col2, { className: "row array-item-list", span: 24, children: [
|
|
115
110
|
!showOptionalDataControlInTitle ? optionalDataControl : void 0,
|
|
116
|
-
items
|
|
111
|
+
items
|
|
117
112
|
] }),
|
|
118
113
|
canAdd && /* @__PURE__ */ jsx2(Col2, { span: 24, children: /* @__PURE__ */ jsx2(Row2, { gutter: rowGutter, justify: "end", children: /* @__PURE__ */ jsx2(Col2, { flex: "192px", children: /* @__PURE__ */ jsx2(
|
|
119
114
|
AddButton2,
|
|
@@ -143,8 +138,9 @@ var INPUT_STYLE = {
|
|
|
143
138
|
function BaseInputTemplate(props) {
|
|
144
139
|
const {
|
|
145
140
|
disabled,
|
|
146
|
-
|
|
141
|
+
registry,
|
|
147
142
|
id,
|
|
143
|
+
htmlName,
|
|
148
144
|
onBlur,
|
|
149
145
|
onChange,
|
|
150
146
|
onChangeOverride,
|
|
@@ -156,6 +152,7 @@ function BaseInputTemplate(props) {
|
|
|
156
152
|
value,
|
|
157
153
|
type
|
|
158
154
|
} = props;
|
|
155
|
+
const { formContext } = registry;
|
|
159
156
|
const inputProps = getInputProps(schema, type, options, false);
|
|
160
157
|
const { readonlyAsDisabled = true } = formContext;
|
|
161
158
|
const handleNumberChange = (nextValue) => onChange(nextValue);
|
|
@@ -167,7 +164,7 @@ function BaseInputTemplate(props) {
|
|
|
167
164
|
{
|
|
168
165
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
169
166
|
id,
|
|
170
|
-
name: id,
|
|
167
|
+
name: htmlName || id,
|
|
171
168
|
onBlur: !readonly ? handleBlur : void 0,
|
|
172
169
|
onChange: !readonly ? handleNumberChange : void 0,
|
|
173
170
|
onFocus: !readonly ? handleFocus : void 0,
|
|
@@ -183,7 +180,7 @@ function BaseInputTemplate(props) {
|
|
|
183
180
|
{
|
|
184
181
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
185
182
|
id,
|
|
186
|
-
name: id,
|
|
183
|
+
name: htmlName || id,
|
|
187
184
|
onBlur: !readonly ? handleBlur : void 0,
|
|
188
185
|
onChange: !readonly ? handleTextChange : void 0,
|
|
189
186
|
onFocus: !readonly ? handleFocus : void 0,
|
|
@@ -353,8 +350,9 @@ function FieldTemplate(props) {
|
|
|
353
350
|
hidden,
|
|
354
351
|
id,
|
|
355
352
|
label,
|
|
356
|
-
|
|
357
|
-
|
|
353
|
+
onKeyRename,
|
|
354
|
+
onKeyRenameBlur,
|
|
355
|
+
onRemoveProperty,
|
|
358
356
|
rawErrors,
|
|
359
357
|
rawDescription,
|
|
360
358
|
rawHelp,
|
|
@@ -400,8 +398,9 @@ function FieldTemplate(props) {
|
|
|
400
398
|
disabled,
|
|
401
399
|
id,
|
|
402
400
|
label,
|
|
403
|
-
|
|
404
|
-
|
|
401
|
+
onKeyRename,
|
|
402
|
+
onKeyRenameBlur,
|
|
403
|
+
onRemoveProperty,
|
|
405
404
|
readonly,
|
|
406
405
|
required,
|
|
407
406
|
schema,
|
|
@@ -474,7 +473,7 @@ function ObjectFieldTemplate(props) {
|
|
|
474
473
|
disabled,
|
|
475
474
|
formData,
|
|
476
475
|
fieldPathId,
|
|
477
|
-
|
|
476
|
+
onAddProperty,
|
|
478
477
|
optionalDataControl,
|
|
479
478
|
properties,
|
|
480
479
|
readonly,
|
|
@@ -566,7 +565,7 @@ function ObjectFieldTemplate(props) {
|
|
|
566
565
|
id: buttonId2(fieldPathId, "add"),
|
|
567
566
|
className: "rjsf-object-property-expand",
|
|
568
567
|
disabled: disabled || readonly,
|
|
569
|
-
onClick:
|
|
568
|
+
onClick: onAddProperty,
|
|
570
569
|
uiSchema,
|
|
571
570
|
registry
|
|
572
571
|
}
|
|
@@ -702,8 +701,8 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
702
701
|
disabled,
|
|
703
702
|
id,
|
|
704
703
|
label,
|
|
705
|
-
|
|
706
|
-
|
|
704
|
+
onRemoveProperty,
|
|
705
|
+
onKeyRenameBlur,
|
|
707
706
|
readonly,
|
|
708
707
|
required,
|
|
709
708
|
registry,
|
|
@@ -726,7 +725,6 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
726
725
|
if (!additional) {
|
|
727
726
|
return /* @__PURE__ */ jsx15("div", { className: classNames4, style, children });
|
|
728
727
|
}
|
|
729
|
-
const handleBlur = ({ target }) => onKeyChange(target && target.value);
|
|
730
728
|
const uiOptions = uiSchema ? uiSchema[UI_OPTIONS_KEY] : {};
|
|
731
729
|
const buttonUiOptions = {
|
|
732
730
|
...uiSchema,
|
|
@@ -753,7 +751,7 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
753
751
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
754
752
|
id: `${id}-key`,
|
|
755
753
|
name: `${id}-key`,
|
|
756
|
-
onBlur: !readonly ?
|
|
754
|
+
onBlur: !readonly ? onKeyRenameBlur : void 0,
|
|
757
755
|
style: INPUT_STYLE2,
|
|
758
756
|
type: "text"
|
|
759
757
|
}
|
|
@@ -767,7 +765,7 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
767
765
|
id: buttonId3(id, "remove"),
|
|
768
766
|
className: "rjsf-object-property-remove",
|
|
769
767
|
disabled: disabled || readonly,
|
|
770
|
-
onClick:
|
|
768
|
+
onClick: onRemoveProperty,
|
|
771
769
|
uiSchema: buttonUiOptions,
|
|
772
770
|
registry
|
|
773
771
|
}
|
|
@@ -804,116 +802,38 @@ function generateTemplates() {
|
|
|
804
802
|
var templates_default = generateTemplates();
|
|
805
803
|
|
|
806
804
|
// src/widgets/AltDateWidget/index.tsx
|
|
807
|
-
import { useEffect, useState } from "react";
|
|
808
805
|
import { Row as Row7, Col as Col7, Button as Button3 } from "antd";
|
|
809
806
|
import {
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
parseDateString,
|
|
814
|
-
toDateString,
|
|
815
|
-
TranslatableString as TranslatableString4
|
|
807
|
+
DateElement,
|
|
808
|
+
TranslatableString as TranslatableString4,
|
|
809
|
+
useAltDateWidgetProps
|
|
816
810
|
} from "@rjsf/utils";
|
|
817
811
|
import { jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
818
|
-
var readyForChange = (state) => {
|
|
819
|
-
return Object.values(state).every((value) => value !== -1);
|
|
820
|
-
};
|
|
821
812
|
function AltDateWidget(props) {
|
|
822
|
-
const {
|
|
823
|
-
|
|
824
|
-
disabled,
|
|
825
|
-
formContext,
|
|
826
|
-
id,
|
|
827
|
-
onBlur,
|
|
828
|
-
onChange,
|
|
829
|
-
onFocus,
|
|
830
|
-
options,
|
|
831
|
-
readonly,
|
|
832
|
-
registry,
|
|
833
|
-
showTime,
|
|
834
|
-
value
|
|
835
|
-
} = props;
|
|
836
|
-
const { translateString, widgets } = registry;
|
|
837
|
-
const { SelectWidget: SelectWidget2 } = widgets;
|
|
813
|
+
const { autofocus, disabled, id, name, onBlur, onFocus, options, readonly, registry } = props;
|
|
814
|
+
const { formContext, translateString } = registry;
|
|
838
815
|
const { rowGutter = 24 } = formContext;
|
|
839
|
-
const
|
|
840
|
-
useEffect(() => {
|
|
841
|
-
setState(parseDateString(value, showTime));
|
|
842
|
-
}, [showTime, value]);
|
|
843
|
-
const handleChange = (property, nextValue) => {
|
|
844
|
-
const nextState = {
|
|
845
|
-
...state,
|
|
846
|
-
[property]: typeof nextValue === "undefined" ? -1 : nextValue
|
|
847
|
-
};
|
|
848
|
-
if (readyForChange(nextState)) {
|
|
849
|
-
onChange(toDateString(nextState, showTime));
|
|
850
|
-
} else {
|
|
851
|
-
setState(nextState);
|
|
852
|
-
}
|
|
853
|
-
};
|
|
854
|
-
const handleNow = (event) => {
|
|
855
|
-
event.preventDefault();
|
|
856
|
-
if (disabled || readonly) {
|
|
857
|
-
return;
|
|
858
|
-
}
|
|
859
|
-
const nextState = parseDateString((/* @__PURE__ */ new Date()).toJSON(), showTime);
|
|
860
|
-
onChange(toDateString(nextState, showTime));
|
|
861
|
-
};
|
|
862
|
-
const handleClear = (event) => {
|
|
863
|
-
event.preventDefault();
|
|
864
|
-
if (disabled || readonly) {
|
|
865
|
-
return;
|
|
866
|
-
}
|
|
867
|
-
onChange(void 0);
|
|
868
|
-
};
|
|
869
|
-
const renderDateElement = (elemProps) => /* @__PURE__ */ jsx16(
|
|
870
|
-
SelectWidget2,
|
|
871
|
-
{
|
|
872
|
-
autofocus: elemProps.autofocus,
|
|
873
|
-
className: "form-control",
|
|
874
|
-
disabled: elemProps.disabled,
|
|
875
|
-
id: elemProps.id,
|
|
876
|
-
name: elemProps.name,
|
|
877
|
-
onBlur: elemProps.onBlur,
|
|
878
|
-
onChange: (elemValue) => elemProps.select(elemProps.type, elemValue),
|
|
879
|
-
onFocus: elemProps.onFocus,
|
|
880
|
-
options: {
|
|
881
|
-
enumOptions: dateRangeOptions(elemProps.range[0], elemProps.range[1])
|
|
882
|
-
},
|
|
883
|
-
placeholder: elemProps.type,
|
|
884
|
-
readonly: elemProps.readonly,
|
|
885
|
-
schema: { type: "integer" },
|
|
886
|
-
value: elemProps.value,
|
|
887
|
-
registry,
|
|
888
|
-
label: "",
|
|
889
|
-
"aria-describedby": ariaDescribedByIds2(id)
|
|
890
|
-
}
|
|
891
|
-
);
|
|
816
|
+
const { elements, handleChange, handleClear, handleSetNow } = useAltDateWidgetProps(props);
|
|
892
817
|
return /* @__PURE__ */ jsxs9(Row7, { gutter: [Math.floor(rowGutter / 2), Math.floor(rowGutter / 2)], children: [
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
select: handleChange,
|
|
911
|
-
// NOTE: antd components accept -1 rather than issue a warning
|
|
912
|
-
// like material-ui, so we need to convert -1 to undefined here.
|
|
913
|
-
value: elemProps.value || -1 < 0 ? void 0 : elemProps.value
|
|
914
|
-
}) }, elemId);
|
|
818
|
+
elements.map((elemProps, i) => {
|
|
819
|
+
const elemId = `${id}_${elemProps.type}`;
|
|
820
|
+
return /* @__PURE__ */ jsx16(Col7, { flex: "88px", children: /* @__PURE__ */ jsx16(
|
|
821
|
+
DateElement,
|
|
822
|
+
{
|
|
823
|
+
rootId: id,
|
|
824
|
+
name,
|
|
825
|
+
select: handleChange,
|
|
826
|
+
...elemProps,
|
|
827
|
+
disabled,
|
|
828
|
+
readonly,
|
|
829
|
+
registry,
|
|
830
|
+
onBlur,
|
|
831
|
+
onFocus,
|
|
832
|
+
autofocus: autofocus && i === 0
|
|
833
|
+
}
|
|
834
|
+
) }, elemId);
|
|
915
835
|
}),
|
|
916
|
-
!options.hideNowButton && /* @__PURE__ */ jsx16(Col7, { flex: "88px", children: /* @__PURE__ */ jsx16(Button3, { block: true, className: "btn-now", onClick:
|
|
836
|
+
!options.hideNowButton && /* @__PURE__ */ jsx16(Col7, { flex: "88px", children: /* @__PURE__ */ jsx16(Button3, { block: true, className: "btn-now", onClick: handleSetNow, type: "primary", children: translateString(TranslatableString4.NowLabel) }) }),
|
|
917
837
|
!options.hideClearButton && /* @__PURE__ */ jsx16(Col7, { flex: "88px", children: /* @__PURE__ */ jsx16(Button3, { block: true, className: "btn-clear", danger: true, onClick: handleClear, type: "primary", children: translateString(TranslatableString4.ClearLabel) }) })
|
|
918
838
|
] });
|
|
919
839
|
}
|
|
@@ -924,30 +844,43 @@ AltDateWidget.defaultProps = {
|
|
|
924
844
|
yearsRange: [1900, (/* @__PURE__ */ new Date()).getFullYear() + 2]
|
|
925
845
|
},
|
|
926
846
|
readonly: false,
|
|
927
|
-
|
|
847
|
+
time: false
|
|
928
848
|
};
|
|
929
849
|
|
|
930
850
|
// src/widgets/AltDateTimeWidget/index.tsx
|
|
931
851
|
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
932
852
|
function AltDateTimeWidget(props) {
|
|
933
853
|
const { AltDateWidget: AltDateWidget2 } = props.registry.widgets;
|
|
934
|
-
return /* @__PURE__ */ jsx17(AltDateWidget2, {
|
|
854
|
+
return /* @__PURE__ */ jsx17(AltDateWidget2, { time: true, ...props });
|
|
935
855
|
}
|
|
936
856
|
AltDateTimeWidget.defaultProps = {
|
|
937
857
|
...AltDateWidget.defaultProps,
|
|
938
|
-
|
|
858
|
+
time: true
|
|
939
859
|
};
|
|
940
860
|
|
|
941
861
|
// src/widgets/CheckboxesWidget/index.tsx
|
|
942
862
|
import { Checkbox } from "antd";
|
|
943
863
|
import {
|
|
944
|
-
ariaDescribedByIds as
|
|
864
|
+
ariaDescribedByIds as ariaDescribedByIds2,
|
|
945
865
|
enumOptionsIndexForValue,
|
|
946
866
|
enumOptionsValueForIndex,
|
|
947
867
|
optionId
|
|
948
868
|
} from "@rjsf/utils";
|
|
949
869
|
import { Fragment as Fragment3, jsx as jsx18, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
950
|
-
function CheckboxesWidget({
|
|
870
|
+
function CheckboxesWidget({
|
|
871
|
+
autofocus,
|
|
872
|
+
disabled,
|
|
873
|
+
registry,
|
|
874
|
+
id,
|
|
875
|
+
htmlName,
|
|
876
|
+
onBlur,
|
|
877
|
+
onChange,
|
|
878
|
+
onFocus,
|
|
879
|
+
options,
|
|
880
|
+
readonly,
|
|
881
|
+
value
|
|
882
|
+
}) {
|
|
883
|
+
const { formContext } = registry;
|
|
951
884
|
const { readonlyAsDisabled = true } = formContext;
|
|
952
885
|
const { enumOptions, enumDisabled, inline, emptyValue } = options;
|
|
953
886
|
const handleChange = (nextValue) => onChange(enumOptionsValueForIndex(nextValue, enumOptions, emptyValue));
|
|
@@ -963,17 +896,17 @@ function CheckboxesWidget({ autofocus, disabled, formContext, id, onBlur, onChan
|
|
|
963
896
|
Checkbox.Group,
|
|
964
897
|
{
|
|
965
898
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
966
|
-
name: id,
|
|
899
|
+
name: htmlName || id,
|
|
967
900
|
onChange: !readonly ? handleChange : void 0,
|
|
968
901
|
value: selectedIndexes,
|
|
969
902
|
...extraProps,
|
|
970
|
-
"aria-describedby":
|
|
903
|
+
"aria-describedby": ariaDescribedByIds2(id),
|
|
971
904
|
children: Array.isArray(enumOptions) && enumOptions.map((option, i) => /* @__PURE__ */ jsxs10("span", { children: [
|
|
972
905
|
/* @__PURE__ */ jsx18(
|
|
973
906
|
Checkbox,
|
|
974
907
|
{
|
|
975
908
|
id: optionId(id, i),
|
|
976
|
-
name: id,
|
|
909
|
+
name: htmlName || id,
|
|
977
910
|
autoFocus: i === 0 ? autofocus : false,
|
|
978
911
|
disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1,
|
|
979
912
|
value: String(i),
|
|
@@ -989,12 +922,13 @@ function CheckboxesWidget({ autofocus, disabled, formContext, id, onBlur, onChan
|
|
|
989
922
|
// src/widgets/CheckboxWidget/index.tsx
|
|
990
923
|
import { Checkbox as Checkbox2 } from "antd";
|
|
991
924
|
import {
|
|
992
|
-
ariaDescribedByIds as
|
|
925
|
+
ariaDescribedByIds as ariaDescribedByIds3,
|
|
993
926
|
labelValue
|
|
994
927
|
} from "@rjsf/utils";
|
|
995
928
|
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
996
929
|
function CheckboxWidget(props) {
|
|
997
|
-
const { autofocus, disabled,
|
|
930
|
+
const { autofocus, disabled, registry, id, htmlName, label, hideLabel, onBlur, onChange, onFocus, readonly, value } = props;
|
|
931
|
+
const { formContext } = registry;
|
|
998
932
|
const { readonlyAsDisabled = true } = formContext;
|
|
999
933
|
const handleChange = ({ target }) => onChange(target.checked);
|
|
1000
934
|
const handleBlur = ({ target }) => onBlur(id, target && target.checked);
|
|
@@ -1010,10 +944,10 @@ function CheckboxWidget(props) {
|
|
|
1010
944
|
checked: typeof value === "undefined" ? false : value,
|
|
1011
945
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1012
946
|
id,
|
|
1013
|
-
name: id,
|
|
947
|
+
name: htmlName || id,
|
|
1014
948
|
onChange: !readonly ? handleChange : void 0,
|
|
1015
949
|
...extraProps,
|
|
1016
|
-
"aria-describedby":
|
|
950
|
+
"aria-describedby": ariaDescribedByIds3(id),
|
|
1017
951
|
children: labelValue(label, hideLabel, "")
|
|
1018
952
|
}
|
|
1019
953
|
);
|
|
@@ -1022,7 +956,7 @@ function CheckboxWidget(props) {
|
|
|
1022
956
|
// src/widgets/DateTimeWidget/index.tsx
|
|
1023
957
|
import dayjs from "dayjs";
|
|
1024
958
|
import {
|
|
1025
|
-
ariaDescribedByIds as
|
|
959
|
+
ariaDescribedByIds as ariaDescribedByIds4
|
|
1026
960
|
} from "@rjsf/utils";
|
|
1027
961
|
import { DatePicker } from "antd";
|
|
1028
962
|
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
@@ -1030,7 +964,8 @@ var DATE_PICKER_STYLE = {
|
|
|
1030
964
|
width: "100%"
|
|
1031
965
|
};
|
|
1032
966
|
function DateTimeWidget(props) {
|
|
1033
|
-
const { disabled,
|
|
967
|
+
const { disabled, registry, id, onBlur, onChange, onFocus, placeholder, readonly, value } = props;
|
|
968
|
+
const { formContext } = registry;
|
|
1034
969
|
const { readonlyAsDisabled = true } = formContext;
|
|
1035
970
|
const handleChange = (nextValue) => onChange(nextValue && nextValue.toISOString());
|
|
1036
971
|
const handleBlur = () => onBlur(id, value);
|
|
@@ -1050,7 +985,7 @@ function DateTimeWidget(props) {
|
|
|
1050
985
|
showTime: true,
|
|
1051
986
|
style: DATE_PICKER_STYLE,
|
|
1052
987
|
value: value && dayjs(value),
|
|
1053
|
-
"aria-describedby":
|
|
988
|
+
"aria-describedby": ariaDescribedByIds4(id)
|
|
1054
989
|
}
|
|
1055
990
|
);
|
|
1056
991
|
}
|
|
@@ -1058,7 +993,7 @@ function DateTimeWidget(props) {
|
|
|
1058
993
|
// src/widgets/DateWidget/index.tsx
|
|
1059
994
|
import dayjs2 from "dayjs";
|
|
1060
995
|
import {
|
|
1061
|
-
ariaDescribedByIds as
|
|
996
|
+
ariaDescribedByIds as ariaDescribedByIds5
|
|
1062
997
|
} from "@rjsf/utils";
|
|
1063
998
|
import { DatePicker as DatePicker2 } from "antd";
|
|
1064
999
|
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
@@ -1066,7 +1001,8 @@ var DATE_PICKER_STYLE2 = {
|
|
|
1066
1001
|
width: "100%"
|
|
1067
1002
|
};
|
|
1068
1003
|
function DateWidget(props) {
|
|
1069
|
-
const { disabled,
|
|
1004
|
+
const { disabled, registry, id, onBlur, onChange, onFocus, placeholder, readonly, value } = props;
|
|
1005
|
+
const { formContext } = registry;
|
|
1070
1006
|
const { readonlyAsDisabled = true } = formContext;
|
|
1071
1007
|
const handleChange = (nextValue) => onChange(nextValue && nextValue.format("YYYY-MM-DD"));
|
|
1072
1008
|
const handleBlur = () => onBlur(id, value);
|
|
@@ -1086,7 +1022,7 @@ function DateWidget(props) {
|
|
|
1086
1022
|
showTime: false,
|
|
1087
1023
|
style: DATE_PICKER_STYLE2,
|
|
1088
1024
|
value: value && dayjs2(value),
|
|
1089
|
-
"aria-describedby":
|
|
1025
|
+
"aria-describedby": ariaDescribedByIds5(id)
|
|
1090
1026
|
}
|
|
1091
1027
|
);
|
|
1092
1028
|
}
|
|
@@ -1094,11 +1030,12 @@ function DateWidget(props) {
|
|
|
1094
1030
|
// src/widgets/PasswordWidget/index.tsx
|
|
1095
1031
|
import { Input as Input3 } from "antd";
|
|
1096
1032
|
import {
|
|
1097
|
-
ariaDescribedByIds as
|
|
1033
|
+
ariaDescribedByIds as ariaDescribedByIds6
|
|
1098
1034
|
} from "@rjsf/utils";
|
|
1099
1035
|
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
1100
1036
|
function PasswordWidget(props) {
|
|
1101
|
-
const { disabled,
|
|
1037
|
+
const { disabled, registry, id, onBlur, onChange, onFocus, options, placeholder, readonly, value } = props;
|
|
1038
|
+
const { formContext } = registry;
|
|
1102
1039
|
const { readonlyAsDisabled = true } = formContext;
|
|
1103
1040
|
const emptyValue = options.emptyValue || "";
|
|
1104
1041
|
const handleChange = ({ target }) => onChange(target.value === "" ? emptyValue : target.value);
|
|
@@ -1115,7 +1052,7 @@ function PasswordWidget(props) {
|
|
|
1115
1052
|
onFocus: !readonly ? handleFocus : void 0,
|
|
1116
1053
|
placeholder,
|
|
1117
1054
|
value: value || "",
|
|
1118
|
-
"aria-describedby":
|
|
1055
|
+
"aria-describedby": ariaDescribedByIds6(id)
|
|
1119
1056
|
}
|
|
1120
1057
|
);
|
|
1121
1058
|
}
|
|
@@ -1123,7 +1060,7 @@ function PasswordWidget(props) {
|
|
|
1123
1060
|
// src/widgets/RadioWidget/index.tsx
|
|
1124
1061
|
import { Radio } from "antd";
|
|
1125
1062
|
import {
|
|
1126
|
-
ariaDescribedByIds as
|
|
1063
|
+
ariaDescribedByIds as ariaDescribedByIds7,
|
|
1127
1064
|
enumOptionsIndexForValue as enumOptionsIndexForValue2,
|
|
1128
1065
|
enumOptionsValueForIndex as enumOptionsValueForIndex2,
|
|
1129
1066
|
optionId as optionId2
|
|
@@ -1132,8 +1069,9 @@ import { jsx as jsx23 } from "react/jsx-runtime";
|
|
|
1132
1069
|
function RadioWidget({
|
|
1133
1070
|
autofocus,
|
|
1134
1071
|
disabled,
|
|
1135
|
-
|
|
1072
|
+
registry,
|
|
1136
1073
|
id,
|
|
1074
|
+
htmlName,
|
|
1137
1075
|
onBlur,
|
|
1138
1076
|
onChange,
|
|
1139
1077
|
onFocus,
|
|
@@ -1141,6 +1079,7 @@ function RadioWidget({
|
|
|
1141
1079
|
readonly,
|
|
1142
1080
|
value
|
|
1143
1081
|
}) {
|
|
1082
|
+
const { formContext } = registry;
|
|
1144
1083
|
const { readonlyAsDisabled = true } = formContext;
|
|
1145
1084
|
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
1146
1085
|
const handleChange = ({ target: { value: nextValue } }) => onChange(enumOptionsValueForIndex2(nextValue, enumOptions, emptyValue));
|
|
@@ -1152,17 +1091,17 @@ function RadioWidget({
|
|
|
1152
1091
|
{
|
|
1153
1092
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1154
1093
|
id,
|
|
1155
|
-
name: id,
|
|
1094
|
+
name: htmlName || id,
|
|
1156
1095
|
onChange: !readonly ? handleChange : void 0,
|
|
1157
1096
|
onBlur: !readonly ? handleBlur : void 0,
|
|
1158
1097
|
onFocus: !readonly ? handleFocus : void 0,
|
|
1159
1098
|
value: selectedIndexes,
|
|
1160
|
-
"aria-describedby":
|
|
1099
|
+
"aria-describedby": ariaDescribedByIds7(id),
|
|
1161
1100
|
children: Array.isArray(enumOptions) && enumOptions.map((option, i) => /* @__PURE__ */ jsx23(
|
|
1162
1101
|
Radio,
|
|
1163
1102
|
{
|
|
1164
1103
|
id: optionId2(id, i),
|
|
1165
|
-
name: id,
|
|
1104
|
+
name: htmlName || id,
|
|
1166
1105
|
autoFocus: i === 0 ? autofocus : false,
|
|
1167
1106
|
disabled: disabled || Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1,
|
|
1168
1107
|
value: String(i),
|
|
@@ -1177,7 +1116,7 @@ function RadioWidget({
|
|
|
1177
1116
|
// src/widgets/RangeWidget/index.tsx
|
|
1178
1117
|
import { Slider } from "antd";
|
|
1179
1118
|
import {
|
|
1180
|
-
ariaDescribedByIds as
|
|
1119
|
+
ariaDescribedByIds as ariaDescribedByIds8,
|
|
1181
1120
|
rangeSpec
|
|
1182
1121
|
} from "@rjsf/utils";
|
|
1183
1122
|
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
@@ -1185,7 +1124,7 @@ function RangeWidget(props) {
|
|
|
1185
1124
|
const {
|
|
1186
1125
|
autofocus,
|
|
1187
1126
|
disabled,
|
|
1188
|
-
|
|
1127
|
+
registry,
|
|
1189
1128
|
id,
|
|
1190
1129
|
onBlur,
|
|
1191
1130
|
onChange,
|
|
@@ -1196,6 +1135,7 @@ function RangeWidget(props) {
|
|
|
1196
1135
|
schema,
|
|
1197
1136
|
value
|
|
1198
1137
|
} = props;
|
|
1138
|
+
const { formContext } = registry;
|
|
1199
1139
|
const { readonlyAsDisabled = true } = formContext;
|
|
1200
1140
|
const { min, max, step } = rangeSpec(schema);
|
|
1201
1141
|
const emptyValue = options.emptyValue || "";
|
|
@@ -1220,7 +1160,7 @@ function RangeWidget(props) {
|
|
|
1220
1160
|
step,
|
|
1221
1161
|
value,
|
|
1222
1162
|
...extraProps,
|
|
1223
|
-
"aria-describedby":
|
|
1163
|
+
"aria-describedby": ariaDescribedByIds8(id)
|
|
1224
1164
|
}
|
|
1225
1165
|
);
|
|
1226
1166
|
}
|
|
@@ -1228,7 +1168,7 @@ function RangeWidget(props) {
|
|
|
1228
1168
|
// src/widgets/SelectWidget/index.tsx
|
|
1229
1169
|
import { Select } from "antd";
|
|
1230
1170
|
import {
|
|
1231
|
-
ariaDescribedByIds as
|
|
1171
|
+
ariaDescribedByIds as ariaDescribedByIds9,
|
|
1232
1172
|
enumOptionsIndexForValue as enumOptionsIndexForValue3,
|
|
1233
1173
|
enumOptionsValueForIndex as enumOptionsValueForIndex3
|
|
1234
1174
|
} from "@rjsf/utils";
|
|
@@ -1241,8 +1181,9 @@ var SELECT_STYLE = {
|
|
|
1241
1181
|
function SelectWidget({
|
|
1242
1182
|
autofocus,
|
|
1243
1183
|
disabled,
|
|
1244
|
-
|
|
1184
|
+
registry,
|
|
1245
1185
|
id,
|
|
1186
|
+
htmlName,
|
|
1246
1187
|
multiple,
|
|
1247
1188
|
onBlur,
|
|
1248
1189
|
onChange,
|
|
@@ -1253,6 +1194,7 @@ function SelectWidget({
|
|
|
1253
1194
|
value,
|
|
1254
1195
|
schema
|
|
1255
1196
|
}) {
|
|
1197
|
+
const { formContext } = registry;
|
|
1256
1198
|
const { readonlyAsDisabled = true } = formContext;
|
|
1257
1199
|
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
1258
1200
|
const handleChange = (nextValue) => onChange(enumOptionsValueForIndex3(nextValue, enumOptions, emptyValue));
|
|
@@ -1267,7 +1209,7 @@ function SelectWidget({
|
|
|
1267
1209
|
const getPopupContainer = (node) => node.parentNode;
|
|
1268
1210
|
const selectedIndexes = enumOptionsIndexForValue3(value, enumOptions, multiple);
|
|
1269
1211
|
const extraProps = {
|
|
1270
|
-
name: id
|
|
1212
|
+
name: htmlName || id
|
|
1271
1213
|
};
|
|
1272
1214
|
const showPlaceholderOption = !multiple && schema.default === void 0;
|
|
1273
1215
|
const selectOptions = useMemo(() => {
|
|
@@ -1301,7 +1243,7 @@ function SelectWidget({
|
|
|
1301
1243
|
value: selectedIndexes,
|
|
1302
1244
|
...extraProps,
|
|
1303
1245
|
filterOption,
|
|
1304
|
-
"aria-describedby":
|
|
1246
|
+
"aria-describedby": ariaDescribedByIds9(id),
|
|
1305
1247
|
options: selectOptions
|
|
1306
1248
|
}
|
|
1307
1249
|
);
|
|
@@ -1310,7 +1252,7 @@ function SelectWidget({
|
|
|
1310
1252
|
// src/widgets/TextareaWidget/index.tsx
|
|
1311
1253
|
import { Input as Input4 } from "antd";
|
|
1312
1254
|
import {
|
|
1313
|
-
ariaDescribedByIds as
|
|
1255
|
+
ariaDescribedByIds as ariaDescribedByIds10
|
|
1314
1256
|
} from "@rjsf/utils";
|
|
1315
1257
|
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
1316
1258
|
var INPUT_STYLE3 = {
|
|
@@ -1318,8 +1260,9 @@ var INPUT_STYLE3 = {
|
|
|
1318
1260
|
};
|
|
1319
1261
|
function TextareaWidget({
|
|
1320
1262
|
disabled,
|
|
1321
|
-
|
|
1263
|
+
registry,
|
|
1322
1264
|
id,
|
|
1265
|
+
htmlName,
|
|
1323
1266
|
onBlur,
|
|
1324
1267
|
onChange,
|
|
1325
1268
|
onFocus,
|
|
@@ -1328,6 +1271,7 @@ function TextareaWidget({
|
|
|
1328
1271
|
readonly,
|
|
1329
1272
|
value
|
|
1330
1273
|
}) {
|
|
1274
|
+
const { formContext } = registry;
|
|
1331
1275
|
const { readonlyAsDisabled = true } = formContext;
|
|
1332
1276
|
const handleChange = ({ target }) => onChange(target.value === "" ? options.emptyValue : target.value);
|
|
1333
1277
|
const handleBlur = ({ target }) => onBlur(id, target && target.value);
|
|
@@ -1340,7 +1284,7 @@ function TextareaWidget({
|
|
|
1340
1284
|
{
|
|
1341
1285
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1342
1286
|
id,
|
|
1343
|
-
name: id,
|
|
1287
|
+
name: htmlName || id,
|
|
1344
1288
|
onBlur: !readonly ? handleBlur : void 0,
|
|
1345
1289
|
onChange: !readonly ? handleChange : void 0,
|
|
1346
1290
|
onFocus: !readonly ? handleFocus : void 0,
|
|
@@ -1349,7 +1293,7 @@ function TextareaWidget({
|
|
|
1349
1293
|
style: INPUT_STYLE3,
|
|
1350
1294
|
value,
|
|
1351
1295
|
...extraProps,
|
|
1352
|
-
"aria-describedby":
|
|
1296
|
+
"aria-describedby": ariaDescribedByIds10(id)
|
|
1353
1297
|
}
|
|
1354
1298
|
);
|
|
1355
1299
|
}
|