@rjsf/antd 6.6.0 → 6.6.2
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 +79 -136
- package/dist/antd.esm.js.map +4 -4
- package/dist/antd.umd.js +55 -63
- package/dist/index.cjs +80 -91
- package/dist/index.cjs.map +4 -4
- package/lib/index.d.ts +3 -3
- package/lib/index.js.map +1 -1
- package/lib/templates/ArrayFieldItemTemplate/index.d.ts +1 -1
- 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 +1 -1
- package/lib/templates/ArrayFieldTemplate/index.js.map +1 -1
- package/lib/templates/BaseInputTemplate/index.d.ts +1 -1
- package/lib/templates/BaseInputTemplate/index.js +3 -4
- package/lib/templates/BaseInputTemplate/index.js.map +1 -1
- package/lib/templates/ErrorList/index.d.ts +1 -1
- package/lib/templates/ErrorList/index.js +2 -2
- package/lib/templates/ErrorList/index.js.map +1 -1
- package/lib/templates/FieldDescriptionTemplate/index.d.ts +1 -1
- package/lib/templates/FieldErrorTemplate/index.d.ts +1 -1
- package/lib/templates/FieldErrorTemplate/index.js.map +1 -1
- package/lib/templates/FieldHelpTemplate/index.d.ts +1 -1
- package/lib/templates/FieldHelpTemplate/index.js.map +1 -1
- package/lib/templates/FieldTemplate/index.d.ts +1 -1
- package/lib/templates/FieldTemplate/index.js +1 -1
- package/lib/templates/FieldTemplate/index.js.map +1 -1
- package/lib/templates/GridTemplate/index.d.ts +1 -1
- package/lib/templates/IconButton/index.d.ts +2 -2
- package/lib/templates/IconButton/index.js +1 -1
- package/lib/templates/IconButton/index.js.map +1 -1
- package/lib/templates/MultiSchemaFieldTemplate/index.d.ts +1 -1
- package/lib/templates/ObjectFieldTemplate/index.d.ts +1 -1
- package/lib/templates/ObjectFieldTemplate/index.js +1 -1
- package/lib/templates/ObjectFieldTemplate/index.js.map +1 -1
- package/lib/templates/OptionalDataControlsTemplate/index.d.ts +1 -1
- package/lib/templates/OptionalDataControlsTemplate/index.js +1 -1
- package/lib/templates/OptionalDataControlsTemplate/index.js.map +1 -1
- package/lib/templates/SubmitButton/index.d.ts +1 -1
- package/lib/templates/SubmitButton/index.js.map +1 -1
- package/lib/templates/TitleField/index.d.ts +1 -1
- package/lib/templates/TitleField/index.js +4 -1
- package/lib/templates/TitleField/index.js.map +1 -1
- package/lib/templates/WrapIfAdditionalTemplate/index.d.ts +1 -1
- package/lib/templates/WrapIfAdditionalTemplate/index.js +1 -1
- package/lib/templates/WrapIfAdditionalTemplate/index.js.map +1 -1
- package/lib/templates/index.d.ts +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/widgets/AltDateTimeWidget/index.d.ts +1 -1
- package/lib/widgets/AltDateWidget/index.d.ts +1 -1
- package/lib/widgets/AltDateWidget/index.js +1 -1
- package/lib/widgets/AltDateWidget/index.js.map +1 -1
- package/lib/widgets/CheckboxWidget/index.d.ts +1 -1
- package/lib/widgets/CheckboxWidget/index.js +1 -1
- package/lib/widgets/CheckboxWidget/index.js.map +1 -1
- package/lib/widgets/CheckboxesWidget/index.d.ts +1 -1
- package/lib/widgets/CheckboxesWidget/index.js +3 -3
- package/lib/widgets/CheckboxesWidget/index.js.map +1 -1
- package/lib/widgets/DateTimeWidget/index.d.ts +3 -3
- package/lib/widgets/DateTimeWidget/index.js +4 -16
- package/lib/widgets/DateTimeWidget/index.js.map +1 -1
- package/lib/widgets/DateWidget/index.d.ts +9 -2
- package/lib/widgets/DateWidget/index.js +10 -6
- package/lib/widgets/DateWidget/index.js.map +1 -1
- package/lib/widgets/PasswordWidget/index.d.ts +1 -1
- package/lib/widgets/PasswordWidget/index.js +1 -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 +1 -1
- package/lib/widgets/RadioWidget/index.js.map +1 -1
- package/lib/widgets/RangeWidget/index.d.ts +1 -1
- package/lib/widgets/RangeWidget/index.js +1 -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 +6 -6
- package/lib/widgets/SelectWidget/index.js.map +1 -1
- package/lib/widgets/TextareaWidget/index.d.ts +1 -1
- package/lib/widgets/TextareaWidget/index.js +1 -1
- package/lib/widgets/TextareaWidget/index.js.map +1 -1
- package/lib/widgets/index.d.ts +1 -1
- package/package.json +9 -9
- package/src/index.ts +4 -3
- package/src/templates/ArrayFieldItemTemplate/index.tsx +2 -8
- package/src/templates/ArrayFieldTemplate/index.tsx +2 -4
- package/src/templates/BaseInputTemplate/index.tsx +7 -8
- package/src/templates/ErrorList/index.tsx +4 -2
- package/src/templates/FieldDescriptionTemplate/index.tsx +1 -1
- package/src/templates/FieldErrorTemplate/index.tsx +2 -1
- package/src/templates/FieldHelpTemplate/index.tsx +2 -1
- package/src/templates/FieldTemplate/index.tsx +2 -9
- package/src/templates/GridTemplate/index.tsx +1 -1
- package/src/templates/IconButton/index.tsx +5 -10
- package/src/templates/MultiSchemaFieldTemplate/index.tsx +1 -1
- package/src/templates/ObjectFieldTemplate/index.tsx +2 -6
- package/src/templates/OptionalDataControlsTemplate/index.tsx +3 -2
- package/src/templates/SubmitButton/index.tsx +4 -2
- package/src/templates/TitleField/index.tsx +5 -1
- package/src/templates/WrapIfAdditionalTemplate/index.tsx +2 -10
- package/src/templates/index.ts +1 -1
- package/src/widgets/AltDateTimeWidget/index.tsx +1 -1
- package/src/widgets/AltDateWidget/index.tsx +2 -10
- package/src/widgets/CheckboxWidget/index.tsx +5 -11
- package/src/widgets/CheckboxesWidget/index.tsx +27 -32
- package/src/widgets/DateTimeWidget/index.tsx +5 -43
- package/src/widgets/DateWidget/index.tsx +28 -15
- package/src/widgets/PasswordWidget/index.tsx +3 -9
- package/src/widgets/RadioWidget/index.tsx +6 -9
- package/src/widgets/RangeWidget/index.tsx +2 -9
- package/src/widgets/SelectWidget/index.tsx +16 -17
- package/src/widgets/TextareaWidget/index.tsx +3 -9
- package/src/widgets/index.ts +1 -1
package/dist/antd.umd.js
CHANGED
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
const { readonlyAsDisabled = true } = formContext;
|
|
120
120
|
const { ClearButton: ClearButton2 } = registry.templates.ButtonTemplates;
|
|
121
121
|
const handleNumberChange = (nextValue) => onChange(nextValue);
|
|
122
|
-
const handleTextChange = onChangeOverride
|
|
122
|
+
const handleTextChange = onChangeOverride || (({ target }) => onChange(target.value === "" ? options.emptyValue : target.value));
|
|
123
123
|
const handleBlur = ({ target }) => onBlur(id, target && target.value);
|
|
124
124
|
const handleFocus = ({ target }) => onFocus(id, target && target.value);
|
|
125
125
|
const handleClear = react.useCallback(
|
|
@@ -486,7 +486,8 @@
|
|
|
486
486
|
block: false
|
|
487
487
|
}
|
|
488
488
|
);
|
|
489
|
-
}
|
|
489
|
+
}
|
|
490
|
+
if (onRemoveClick) {
|
|
490
491
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
491
492
|
RemoveButton,
|
|
492
493
|
{
|
|
@@ -544,6 +545,7 @@
|
|
|
544
545
|
className: labelClassName,
|
|
545
546
|
htmlFor: id,
|
|
546
547
|
onClick: handleLabelClick,
|
|
548
|
+
onKeyDown: (e) => (e.key === "Enter" || e.key === " ") && handleLabelClick(),
|
|
547
549
|
title: typeof title === "string" ? title : "",
|
|
548
550
|
children: labelChildren
|
|
549
551
|
}
|
|
@@ -740,7 +742,7 @@
|
|
|
740
742
|
onFocus: !readonly ? handleFocus : void 0
|
|
741
743
|
};
|
|
742
744
|
const selectValue = utils.enumOptionSelectedValue(value, enumOptions, true, optionValueFormat, []);
|
|
743
|
-
return Array.isArray(enumOptions) && enumOptions.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
745
|
+
return Array.isArray(enumOptions) && enumOptions.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
744
746
|
antd.Checkbox.Group,
|
|
745
747
|
{
|
|
746
748
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
@@ -749,22 +751,25 @@
|
|
|
749
751
|
value: selectValue,
|
|
750
752
|
...extraProps,
|
|
751
753
|
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
752
|
-
children: Array.isArray(enumOptions) && enumOptions.map((option, i) =>
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
754
|
+
children: Array.isArray(enumOptions) && enumOptions.map((option, i) => (
|
|
755
|
+
// oxlint-disable-next-line react/no-array-index-key
|
|
756
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
757
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
758
|
+
antd.Checkbox,
|
|
759
|
+
{
|
|
760
|
+
id: utils.optionId(id, i),
|
|
761
|
+
name: htmlName || id,
|
|
762
|
+
autoFocus: i === 0 ? autofocus : false,
|
|
763
|
+
disabled: Array.isArray(enumDisabled) && enumDisabled.includes(option.value),
|
|
764
|
+
value: utils.enumOptionValueEncoder(option.value, i, optionValueFormat),
|
|
765
|
+
children: option.label
|
|
766
|
+
}
|
|
767
|
+
),
|
|
768
|
+
!inline && /* @__PURE__ */ jsxRuntime.jsx("br", {})
|
|
769
|
+
] }, i)
|
|
770
|
+
))
|
|
766
771
|
}
|
|
767
|
-
)
|
|
772
|
+
) : null;
|
|
768
773
|
}
|
|
769
774
|
function CheckboxWidget(props) {
|
|
770
775
|
const { autofocus, disabled, registry, id, htmlName, label, hideLabel, onBlur, onChange, onFocus, readonly, value } = props;
|
|
@@ -795,14 +800,24 @@
|
|
|
795
800
|
var DATE_PICKER_STYLE = {
|
|
796
801
|
width: "100%"
|
|
797
802
|
};
|
|
798
|
-
function
|
|
799
|
-
|
|
803
|
+
function DateWidget({
|
|
804
|
+
disabled,
|
|
805
|
+
registry,
|
|
806
|
+
id,
|
|
807
|
+
onBlur,
|
|
808
|
+
onChange,
|
|
809
|
+
onFocus,
|
|
810
|
+
placeholder,
|
|
811
|
+
readonly,
|
|
812
|
+
value,
|
|
813
|
+
showTime = false
|
|
814
|
+
}) {
|
|
800
815
|
const { formContext } = registry;
|
|
801
816
|
const { readonlyAsDisabled = true } = formContext;
|
|
802
|
-
const handleChange = (nextValue) => onChange(nextValue && nextValue.toISOString());
|
|
817
|
+
const handleChange = (nextValue) => onChange(nextValue && (showTime ? nextValue.toISOString() : nextValue.format("YYYY-MM-DD")));
|
|
803
818
|
const handleBlur = () => onBlur(id, value);
|
|
804
819
|
const handleFocus = () => onFocus(id, value);
|
|
805
|
-
const getPopupContainer = (
|
|
820
|
+
const getPopupContainer = DateWidget.getPopupContainerCallback();
|
|
806
821
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
807
822
|
antd.DatePicker,
|
|
808
823
|
{
|
|
@@ -814,41 +829,16 @@
|
|
|
814
829
|
onChange: !readonly ? handleChange : void 0,
|
|
815
830
|
onFocus: !readonly ? handleFocus : void 0,
|
|
816
831
|
placeholder,
|
|
817
|
-
showTime
|
|
832
|
+
showTime,
|
|
818
833
|
style: DATE_PICKER_STYLE,
|
|
819
834
|
value: value && dayjs(value),
|
|
820
835
|
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
821
836
|
}
|
|
822
837
|
);
|
|
823
838
|
}
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
function DateWidget(props) {
|
|
828
|
-
const { disabled, registry, id, onBlur, onChange, onFocus, placeholder, readonly, value } = props;
|
|
829
|
-
const { formContext } = registry;
|
|
830
|
-
const { readonlyAsDisabled = true } = formContext;
|
|
831
|
-
const handleChange = (nextValue) => onChange(nextValue && nextValue.format("YYYY-MM-DD"));
|
|
832
|
-
const handleBlur = () => onBlur(id, value);
|
|
833
|
-
const handleFocus = () => onFocus(id, value);
|
|
834
|
-
const getPopupContainer = (node) => node.parentNode;
|
|
835
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
836
|
-
antd.DatePicker,
|
|
837
|
-
{
|
|
838
|
-
disabled: disabled || readonlyAsDisabled && readonly,
|
|
839
|
-
getPopupContainer,
|
|
840
|
-
id,
|
|
841
|
-
name: id,
|
|
842
|
-
onBlur: !readonly ? handleBlur : void 0,
|
|
843
|
-
onChange: !readonly ? handleChange : void 0,
|
|
844
|
-
onFocus: !readonly ? handleFocus : void 0,
|
|
845
|
-
placeholder,
|
|
846
|
-
showTime: false,
|
|
847
|
-
style: DATE_PICKER_STYLE2,
|
|
848
|
-
value: value && dayjs(value),
|
|
849
|
-
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
850
|
-
}
|
|
851
|
-
);
|
|
839
|
+
DateWidget.getPopupContainerCallback = () => (node) => node.parentNode;
|
|
840
|
+
function DateTimeWidget(props) {
|
|
841
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DateWidget, { showTime: true, ...props });
|
|
852
842
|
}
|
|
853
843
|
function PasswordWidget(props) {
|
|
854
844
|
const { disabled, registry, id, onBlur, onChange, onFocus, options, placeholder, readonly, value } = props;
|
|
@@ -911,11 +901,11 @@
|
|
|
911
901
|
id: utils.optionId(id, i),
|
|
912
902
|
name: htmlName || id,
|
|
913
903
|
autoFocus: i === 0 ? autofocus : false,
|
|
914
|
-
disabled: disabled || Array.isArray(enumDisabled) && enumDisabled.
|
|
904
|
+
disabled: disabled || Array.isArray(enumDisabled) && enumDisabled.includes(option.value),
|
|
915
905
|
value: utils.enumOptionValueEncoder(option.value, i, optionValueFormat),
|
|
916
906
|
children: option.label
|
|
917
907
|
},
|
|
918
|
-
|
|
908
|
+
String(option.value)
|
|
919
909
|
))
|
|
920
910
|
}
|
|
921
911
|
);
|
|
@@ -993,7 +983,7 @@
|
|
|
993
983
|
const handleFocus = () => onFocus(id, utils.enumOptionValueDecoder(value, enumOptions, optionValueFormat, emptyValue));
|
|
994
984
|
const filterOption = (input, option) => {
|
|
995
985
|
if (option && isString(option.label)) {
|
|
996
|
-
return option.label.toLowerCase().
|
|
986
|
+
return option.label.toLowerCase().includes(input.toLowerCase());
|
|
997
987
|
}
|
|
998
988
|
return false;
|
|
999
989
|
};
|
|
@@ -1005,16 +995,18 @@
|
|
|
1005
995
|
const showPlaceholderOption = !multiple && schema.default === void 0;
|
|
1006
996
|
const selectOptions = react.useMemo(() => {
|
|
1007
997
|
if (Array.isArray(enumOptions)) {
|
|
1008
|
-
const
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
998
|
+
const enumOptionsList = enumOptions.map(
|
|
999
|
+
({ value: optionValue, label: optionLabel }, index) => ({
|
|
1000
|
+
disabled: Array.isArray(enumDisabled) && enumDisabled.includes(optionValue),
|
|
1001
|
+
key: String(index),
|
|
1002
|
+
value: utils.enumOptionValueEncoder(optionValue, index, optionValueFormat),
|
|
1003
|
+
label: optionLabel
|
|
1004
|
+
})
|
|
1005
|
+
);
|
|
1014
1006
|
if (showPlaceholderOption) {
|
|
1015
|
-
|
|
1007
|
+
enumOptionsList.unshift({ value: "", label: placeholder || "" });
|
|
1016
1008
|
}
|
|
1017
|
-
return
|
|
1009
|
+
return enumOptionsList;
|
|
1018
1010
|
}
|
|
1019
1011
|
return void 0;
|
|
1020
1012
|
}, [enumDisabled, enumOptions, placeholder, showPlaceholderOption, optionValueFormat]);
|
|
@@ -1035,7 +1027,7 @@
|
|
|
1035
1027
|
value: selectValue,
|
|
1036
1028
|
...extraProps,
|
|
1037
1029
|
onOpenChange: setOpen,
|
|
1038
|
-
filterOption,
|
|
1030
|
+
showSearch: { filterOption },
|
|
1039
1031
|
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
1040
1032
|
options: selectOptions
|
|
1041
1033
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -175,7 +175,7 @@ function BaseInputTemplate(props) {
|
|
|
175
175
|
const { readonlyAsDisabled = true } = formContext;
|
|
176
176
|
const { ClearButton: ClearButton2 } = registry.templates.ButtonTemplates;
|
|
177
177
|
const handleNumberChange = (nextValue) => onChange(nextValue);
|
|
178
|
-
const handleTextChange = onChangeOverride
|
|
178
|
+
const handleTextChange = onChangeOverride || (({ target }) => onChange(target.value === "" ? options.emptyValue : target.value));
|
|
179
179
|
const handleBlur = ({ target }) => onBlur(id, target && target.value);
|
|
180
180
|
const handleFocus = ({ target }) => onFocus(id, target && target.value);
|
|
181
181
|
const handleClear = (0, import_react2.useCallback)(
|
|
@@ -234,9 +234,9 @@ function BaseInputTemplate(props) {
|
|
|
234
234
|
}
|
|
235
235
|
|
|
236
236
|
// src/templates/ErrorList/index.tsx
|
|
237
|
-
var import_antd4 = require("antd");
|
|
238
237
|
var import_icons = require("@ant-design/icons");
|
|
239
238
|
var import_utils4 = require("@rjsf/utils");
|
|
239
|
+
var import_antd4 = require("antd");
|
|
240
240
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
241
241
|
var antdMajor = parseInt(import_antd4.version.split(".")[0], 10);
|
|
242
242
|
function ErrorList({
|
|
@@ -587,7 +587,8 @@ function OptionalDataControlsTemplate(props) {
|
|
|
587
587
|
block: false
|
|
588
588
|
}
|
|
589
589
|
);
|
|
590
|
-
}
|
|
590
|
+
}
|
|
591
|
+
if (onRemoveClick) {
|
|
591
592
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
592
593
|
RemoveButton,
|
|
593
594
|
{
|
|
@@ -656,6 +657,7 @@ function TitleField({
|
|
|
656
657
|
className: labelClassName,
|
|
657
658
|
htmlFor: id,
|
|
658
659
|
onClick: handleLabelClick,
|
|
660
|
+
onKeyDown: (e) => (e.key === "Enter" || e.key === " ") && handleLabelClick(),
|
|
659
661
|
title: typeof title === "string" ? title : "",
|
|
660
662
|
children: labelChildren
|
|
661
663
|
}
|
|
@@ -843,7 +845,10 @@ function AltDateWidget({ autofocus = false, disabled = false, options, readonly
|
|
|
843
845
|
// src/widgets/CheckboxesWidget/index.tsx
|
|
844
846
|
var import_utils12 = require("@rjsf/utils");
|
|
845
847
|
var import_antd13 = require("antd");
|
|
846
|
-
var import_jsx_runtime18 =
|
|
848
|
+
var import_jsx_runtime18 = (
|
|
849
|
+
// oxlint-disable-next-line react/no-array-index-key
|
|
850
|
+
require("react/jsx-runtime")
|
|
851
|
+
);
|
|
847
852
|
function CheckboxesWidget({
|
|
848
853
|
autofocus,
|
|
849
854
|
disabled,
|
|
@@ -870,7 +875,7 @@ function CheckboxesWidget({
|
|
|
870
875
|
onFocus: !readonly ? handleFocus : void 0
|
|
871
876
|
};
|
|
872
877
|
const selectValue = (0, import_utils12.enumOptionSelectedValue)(value, enumOptions, true, optionValueFormat, []);
|
|
873
|
-
return Array.isArray(enumOptions) && enumOptions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
878
|
+
return Array.isArray(enumOptions) && enumOptions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
874
879
|
import_antd13.Checkbox.Group,
|
|
875
880
|
{
|
|
876
881
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
@@ -886,7 +891,7 @@ function CheckboxesWidget({
|
|
|
886
891
|
id: (0, import_utils12.optionId)(id, i),
|
|
887
892
|
name: htmlName || id,
|
|
888
893
|
autoFocus: i === 0 ? autofocus : false,
|
|
889
|
-
disabled: Array.isArray(enumDisabled) && enumDisabled.
|
|
894
|
+
disabled: Array.isArray(enumDisabled) && enumDisabled.includes(option.value),
|
|
890
895
|
value: (0, import_utils12.enumOptionValueEncoder)(option.value, i, optionValueFormat),
|
|
891
896
|
children: option.label
|
|
892
897
|
}
|
|
@@ -894,7 +899,7 @@ function CheckboxesWidget({
|
|
|
894
899
|
!inline && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("br", {})
|
|
895
900
|
] }, i))
|
|
896
901
|
}
|
|
897
|
-
)
|
|
902
|
+
) : null;
|
|
898
903
|
}
|
|
899
904
|
|
|
900
905
|
// src/widgets/CheckboxWidget/index.tsx
|
|
@@ -928,7 +933,7 @@ function CheckboxWidget(props) {
|
|
|
928
933
|
);
|
|
929
934
|
}
|
|
930
935
|
|
|
931
|
-
// src/widgets/
|
|
936
|
+
// src/widgets/DateWidget/index.tsx
|
|
932
937
|
var import_utils14 = require("@rjsf/utils");
|
|
933
938
|
var import_antd15 = require("antd");
|
|
934
939
|
var import_dayjs = __toESM(require("dayjs"), 1);
|
|
@@ -936,14 +941,24 @@ var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
|
936
941
|
var DATE_PICKER_STYLE = {
|
|
937
942
|
width: "100%"
|
|
938
943
|
};
|
|
939
|
-
function
|
|
940
|
-
|
|
944
|
+
function DateWidget({
|
|
945
|
+
disabled,
|
|
946
|
+
registry,
|
|
947
|
+
id,
|
|
948
|
+
onBlur,
|
|
949
|
+
onChange,
|
|
950
|
+
onFocus,
|
|
951
|
+
placeholder,
|
|
952
|
+
readonly,
|
|
953
|
+
value,
|
|
954
|
+
showTime = false
|
|
955
|
+
}) {
|
|
941
956
|
const { formContext } = registry;
|
|
942
957
|
const { readonlyAsDisabled = true } = formContext;
|
|
943
|
-
const handleChange = (nextValue) => onChange(nextValue && nextValue.toISOString());
|
|
958
|
+
const handleChange = (nextValue) => onChange(nextValue && (showTime ? nextValue.toISOString() : nextValue.format("YYYY-MM-DD")));
|
|
944
959
|
const handleBlur = () => onBlur(id, value);
|
|
945
960
|
const handleFocus = () => onFocus(id, value);
|
|
946
|
-
const getPopupContainer = (
|
|
961
|
+
const getPopupContainer = DateWidget.getPopupContainerCallback();
|
|
947
962
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
948
963
|
import_antd15.DatePicker,
|
|
949
964
|
{
|
|
@@ -955,52 +970,24 @@ function DateTimeWidget(props) {
|
|
|
955
970
|
onChange: !readonly ? handleChange : void 0,
|
|
956
971
|
onFocus: !readonly ? handleFocus : void 0,
|
|
957
972
|
placeholder,
|
|
958
|
-
showTime
|
|
973
|
+
showTime,
|
|
959
974
|
style: DATE_PICKER_STYLE,
|
|
960
975
|
value: value && (0, import_dayjs.default)(value),
|
|
961
976
|
"aria-describedby": (0, import_utils14.ariaDescribedByIds)(id)
|
|
962
977
|
}
|
|
963
978
|
);
|
|
964
979
|
}
|
|
980
|
+
DateWidget.getPopupContainerCallback = () => (node) => node.parentNode;
|
|
965
981
|
|
|
966
|
-
// src/widgets/
|
|
967
|
-
var import_utils15 = require("@rjsf/utils");
|
|
968
|
-
var import_antd16 = require("antd");
|
|
969
|
-
var import_dayjs2 = __toESM(require("dayjs"), 1);
|
|
982
|
+
// src/widgets/DateTimeWidget/index.tsx
|
|
970
983
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
};
|
|
974
|
-
function DateWidget(props) {
|
|
975
|
-
const { disabled, registry, id, onBlur, onChange, onFocus, placeholder, readonly, value } = props;
|
|
976
|
-
const { formContext } = registry;
|
|
977
|
-
const { readonlyAsDisabled = true } = formContext;
|
|
978
|
-
const handleChange = (nextValue) => onChange(nextValue && nextValue.format("YYYY-MM-DD"));
|
|
979
|
-
const handleBlur = () => onBlur(id, value);
|
|
980
|
-
const handleFocus = () => onFocus(id, value);
|
|
981
|
-
const getPopupContainer = (node) => node.parentNode;
|
|
982
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
983
|
-
import_antd16.DatePicker,
|
|
984
|
-
{
|
|
985
|
-
disabled: disabled || readonlyAsDisabled && readonly,
|
|
986
|
-
getPopupContainer,
|
|
987
|
-
id,
|
|
988
|
-
name: id,
|
|
989
|
-
onBlur: !readonly ? handleBlur : void 0,
|
|
990
|
-
onChange: !readonly ? handleChange : void 0,
|
|
991
|
-
onFocus: !readonly ? handleFocus : void 0,
|
|
992
|
-
placeholder,
|
|
993
|
-
showTime: false,
|
|
994
|
-
style: DATE_PICKER_STYLE2,
|
|
995
|
-
value: value && (0, import_dayjs2.default)(value),
|
|
996
|
-
"aria-describedby": (0, import_utils15.ariaDescribedByIds)(id)
|
|
997
|
-
}
|
|
998
|
-
);
|
|
984
|
+
function DateTimeWidget(props) {
|
|
985
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DateWidget, { showTime: true, ...props });
|
|
999
986
|
}
|
|
1000
987
|
|
|
1001
988
|
// src/widgets/PasswordWidget/index.tsx
|
|
1002
|
-
var
|
|
1003
|
-
var
|
|
989
|
+
var import_utils15 = require("@rjsf/utils");
|
|
990
|
+
var import_antd16 = require("antd");
|
|
1004
991
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1005
992
|
function PasswordWidget(props) {
|
|
1006
993
|
const { disabled, registry, id, onBlur, onChange, onFocus, options, placeholder, readonly, value } = props;
|
|
@@ -1011,7 +998,7 @@ function PasswordWidget(props) {
|
|
|
1011
998
|
const handleBlur = ({ target }) => onBlur(id, target.value);
|
|
1012
999
|
const handleFocus = ({ target }) => onFocus(id, target.value);
|
|
1013
1000
|
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1014
|
-
|
|
1001
|
+
import_antd16.Input.Password,
|
|
1015
1002
|
{
|
|
1016
1003
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1017
1004
|
id,
|
|
@@ -1021,14 +1008,14 @@ function PasswordWidget(props) {
|
|
|
1021
1008
|
onFocus: !readonly ? handleFocus : void 0,
|
|
1022
1009
|
placeholder,
|
|
1023
1010
|
value: value || "",
|
|
1024
|
-
"aria-describedby": (0,
|
|
1011
|
+
"aria-describedby": (0, import_utils15.ariaDescribedByIds)(id)
|
|
1025
1012
|
}
|
|
1026
1013
|
);
|
|
1027
1014
|
}
|
|
1028
1015
|
|
|
1029
1016
|
// src/widgets/RadioWidget/index.tsx
|
|
1030
|
-
var
|
|
1031
|
-
var
|
|
1017
|
+
var import_utils16 = require("@rjsf/utils");
|
|
1018
|
+
var import_antd17 = require("antd");
|
|
1032
1019
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1033
1020
|
function RadioWidget({
|
|
1034
1021
|
autofocus,
|
|
@@ -1046,13 +1033,13 @@ function RadioWidget({
|
|
|
1046
1033
|
const { formContext } = registry;
|
|
1047
1034
|
const { readonlyAsDisabled = true } = formContext;
|
|
1048
1035
|
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
1049
|
-
const optionValueFormat = (0,
|
|
1050
|
-
const handleChange = ({ target: { value: nextValue } }) => onChange((0,
|
|
1051
|
-
const handleBlur = ({ target }) => onBlur(id, (0,
|
|
1052
|
-
const handleFocus = ({ target }) => onFocus(id, (0,
|
|
1053
|
-
const selectValue = (0,
|
|
1036
|
+
const optionValueFormat = (0, import_utils16.getOptionValueFormat)(options);
|
|
1037
|
+
const handleChange = ({ target: { value: nextValue } }) => onChange((0, import_utils16.enumOptionValueDecoder)(nextValue, enumOptions, optionValueFormat, emptyValue));
|
|
1038
|
+
const handleBlur = ({ target }) => onBlur(id, (0, import_utils16.enumOptionValueDecoder)(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
1039
|
+
const handleFocus = ({ target }) => onFocus(id, (0, import_utils16.enumOptionValueDecoder)(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
1040
|
+
const selectValue = (0, import_utils16.enumOptionSelectedValue)(value, enumOptions, false, optionValueFormat, emptyValue);
|
|
1054
1041
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1055
|
-
|
|
1042
|
+
import_antd17.Radio.Group,
|
|
1056
1043
|
{
|
|
1057
1044
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1058
1045
|
id,
|
|
@@ -1061,26 +1048,26 @@ function RadioWidget({
|
|
|
1061
1048
|
onBlur: !readonly ? handleBlur : void 0,
|
|
1062
1049
|
onFocus: !readonly ? handleFocus : void 0,
|
|
1063
1050
|
value: selectValue,
|
|
1064
|
-
"aria-describedby": (0,
|
|
1051
|
+
"aria-describedby": (0, import_utils16.ariaDescribedByIds)(id),
|
|
1065
1052
|
children: Array.isArray(enumOptions) && enumOptions.map((option, i) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1066
|
-
|
|
1053
|
+
import_antd17.Radio,
|
|
1067
1054
|
{
|
|
1068
|
-
id: (0,
|
|
1055
|
+
id: (0, import_utils16.optionId)(id, i),
|
|
1069
1056
|
name: htmlName || id,
|
|
1070
1057
|
autoFocus: i === 0 ? autofocus : false,
|
|
1071
|
-
disabled: disabled || Array.isArray(enumDisabled) && enumDisabled.
|
|
1072
|
-
value: (0,
|
|
1058
|
+
disabled: disabled || Array.isArray(enumDisabled) && enumDisabled.includes(option.value),
|
|
1059
|
+
value: (0, import_utils16.enumOptionValueEncoder)(option.value, i, optionValueFormat),
|
|
1073
1060
|
children: option.label
|
|
1074
1061
|
},
|
|
1075
|
-
|
|
1062
|
+
String(option.value)
|
|
1076
1063
|
))
|
|
1077
1064
|
}
|
|
1078
1065
|
);
|
|
1079
1066
|
}
|
|
1080
1067
|
|
|
1081
1068
|
// src/widgets/RangeWidget/index.tsx
|
|
1082
|
-
var
|
|
1083
|
-
var
|
|
1069
|
+
var import_utils17 = require("@rjsf/utils");
|
|
1070
|
+
var import_antd18 = require("antd");
|
|
1084
1071
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1085
1072
|
function RangeWidget(props) {
|
|
1086
1073
|
const {
|
|
@@ -1099,7 +1086,7 @@ function RangeWidget(props) {
|
|
|
1099
1086
|
} = props;
|
|
1100
1087
|
const { formContext } = registry;
|
|
1101
1088
|
const { readonlyAsDisabled = true } = formContext;
|
|
1102
|
-
const { min, max, step } = (0,
|
|
1089
|
+
const { min, max, step } = (0, import_utils17.rangeSpec)(schema);
|
|
1103
1090
|
const emptyValue = options.emptyValue || "";
|
|
1104
1091
|
const handleChange = (nextValue) => onChange(nextValue === "" ? emptyValue : nextValue);
|
|
1105
1092
|
const handleBlur = () => onBlur(id, value);
|
|
@@ -1110,7 +1097,7 @@ function RangeWidget(props) {
|
|
|
1110
1097
|
onFocus: !readonly ? handleFocus : void 0
|
|
1111
1098
|
};
|
|
1112
1099
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1113
|
-
|
|
1100
|
+
import_antd18.Slider,
|
|
1114
1101
|
{
|
|
1115
1102
|
autoFocus: autofocus,
|
|
1116
1103
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
@@ -1122,15 +1109,15 @@ function RangeWidget(props) {
|
|
|
1122
1109
|
step,
|
|
1123
1110
|
value,
|
|
1124
1111
|
...extraProps,
|
|
1125
|
-
"aria-describedby": (0,
|
|
1112
|
+
"aria-describedby": (0, import_utils17.ariaDescribedByIds)(id)
|
|
1126
1113
|
}
|
|
1127
1114
|
);
|
|
1128
1115
|
}
|
|
1129
1116
|
|
|
1130
1117
|
// src/widgets/SelectWidget/index.tsx
|
|
1131
1118
|
var import_react5 = require("react");
|
|
1132
|
-
var
|
|
1133
|
-
var
|
|
1119
|
+
var import_utils18 = require("@rjsf/utils");
|
|
1120
|
+
var import_antd19 = require("antd");
|
|
1134
1121
|
var import_isString2 = __toESM(require("lodash/isString"), 1);
|
|
1135
1122
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1136
1123
|
var SELECT_STYLE = {
|
|
@@ -1156,39 +1143,41 @@ function SelectWidget({
|
|
|
1156
1143
|
const { formContext } = registry;
|
|
1157
1144
|
const { readonlyAsDisabled = true } = formContext;
|
|
1158
1145
|
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
1159
|
-
const optionValueFormat = (0,
|
|
1160
|
-
const handleChange = (nextValue) => onChange((0,
|
|
1161
|
-
const handleBlur = () => onBlur(id, (0,
|
|
1162
|
-
const handleFocus = () => onFocus(id, (0,
|
|
1146
|
+
const optionValueFormat = (0, import_utils18.getOptionValueFormat)(options);
|
|
1147
|
+
const handleChange = (nextValue) => onChange((0, import_utils18.enumOptionValueDecoder)(nextValue, enumOptions, optionValueFormat, emptyValue));
|
|
1148
|
+
const handleBlur = () => onBlur(id, (0, import_utils18.enumOptionValueDecoder)(value, enumOptions, optionValueFormat, emptyValue));
|
|
1149
|
+
const handleFocus = () => onFocus(id, (0, import_utils18.enumOptionValueDecoder)(value, enumOptions, optionValueFormat, emptyValue));
|
|
1163
1150
|
const filterOption = (input, option) => {
|
|
1164
1151
|
if (option && (0, import_isString2.default)(option.label)) {
|
|
1165
|
-
return option.label.toLowerCase().
|
|
1152
|
+
return option.label.toLowerCase().includes(input.toLowerCase());
|
|
1166
1153
|
}
|
|
1167
1154
|
return false;
|
|
1168
1155
|
};
|
|
1169
1156
|
const getPopupContainer = SelectWidget.getPopupContainerCallback();
|
|
1170
|
-
const selectValue = (0,
|
|
1157
|
+
const selectValue = (0, import_utils18.enumOptionSelectedValue)(value, enumOptions, !!multiple, optionValueFormat, emptyValue);
|
|
1171
1158
|
const extraProps = {
|
|
1172
1159
|
name: htmlName || id
|
|
1173
1160
|
};
|
|
1174
1161
|
const showPlaceholderOption = !multiple && schema.default === void 0;
|
|
1175
1162
|
const selectOptions = (0, import_react5.useMemo)(() => {
|
|
1176
1163
|
if (Array.isArray(enumOptions)) {
|
|
1177
|
-
const
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1164
|
+
const enumOptionsList = enumOptions.map(
|
|
1165
|
+
({ value: optionValue, label: optionLabel }, index) => ({
|
|
1166
|
+
disabled: Array.isArray(enumDisabled) && enumDisabled.includes(optionValue),
|
|
1167
|
+
key: String(index),
|
|
1168
|
+
value: (0, import_utils18.enumOptionValueEncoder)(optionValue, index, optionValueFormat),
|
|
1169
|
+
label: optionLabel
|
|
1170
|
+
})
|
|
1171
|
+
);
|
|
1183
1172
|
if (showPlaceholderOption) {
|
|
1184
|
-
|
|
1173
|
+
enumOptionsList.unshift({ value: "", label: placeholder || "" });
|
|
1185
1174
|
}
|
|
1186
|
-
return
|
|
1175
|
+
return enumOptionsList;
|
|
1187
1176
|
}
|
|
1188
1177
|
return void 0;
|
|
1189
1178
|
}, [enumDisabled, enumOptions, placeholder, showPlaceholderOption, optionValueFormat]);
|
|
1190
1179
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1191
|
-
|
|
1180
|
+
import_antd19.Select,
|
|
1192
1181
|
{
|
|
1193
1182
|
open,
|
|
1194
1183
|
autoFocus: autofocus,
|
|
@@ -1204,8 +1193,8 @@ function SelectWidget({
|
|
|
1204
1193
|
value: selectValue,
|
|
1205
1194
|
...extraProps,
|
|
1206
1195
|
onOpenChange: setOpen,
|
|
1207
|
-
filterOption,
|
|
1208
|
-
"aria-describedby": (0,
|
|
1196
|
+
showSearch: { filterOption },
|
|
1197
|
+
"aria-describedby": (0, import_utils18.ariaDescribedByIds)(id),
|
|
1209
1198
|
options: selectOptions
|
|
1210
1199
|
}
|
|
1211
1200
|
);
|
|
@@ -1213,8 +1202,8 @@ function SelectWidget({
|
|
|
1213
1202
|
SelectWidget.getPopupContainerCallback = () => (node) => node.parentElement;
|
|
1214
1203
|
|
|
1215
1204
|
// src/widgets/TextareaWidget/index.tsx
|
|
1216
|
-
var
|
|
1217
|
-
var
|
|
1205
|
+
var import_utils19 = require("@rjsf/utils");
|
|
1206
|
+
var import_antd20 = require("antd");
|
|
1218
1207
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1219
1208
|
var INPUT_STYLE3 = {
|
|
1220
1209
|
width: "100%"
|
|
@@ -1241,7 +1230,7 @@ function TextareaWidget({
|
|
|
1241
1230
|
type: "textarea"
|
|
1242
1231
|
};
|
|
1243
1232
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1244
|
-
|
|
1233
|
+
import_antd20.Input.TextArea,
|
|
1245
1234
|
{
|
|
1246
1235
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1247
1236
|
id,
|
|
@@ -1254,7 +1243,7 @@ function TextareaWidget({
|
|
|
1254
1243
|
style: INPUT_STYLE3,
|
|
1255
1244
|
value,
|
|
1256
1245
|
...extraProps,
|
|
1257
|
-
"aria-describedby": (0,
|
|
1246
|
+
"aria-describedby": (0, import_utils19.ariaDescribedByIds)(id)
|
|
1258
1247
|
}
|
|
1259
1248
|
);
|
|
1260
1249
|
}
|