@rjsf/antd 6.0.0-beta.22 → 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 +45 -110
- package/dist/antd.esm.js.map +3 -3
- package/dist/antd.umd.js +24 -85
- package/dist/index.cjs +26 -88
- package/dist/index.cjs.map +3 -3
- 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/package.json +7 -7
- package/src/widgets/AltDateTimeWidget/index.tsx +2 -2
- package/src/widgets/AltDateWidget/index.tsx +21 -107
package/dist/antd.esm.js
CHANGED
|
@@ -802,103 +802,38 @@ function generateTemplates() {
|
|
|
802
802
|
var templates_default = generateTemplates();
|
|
803
803
|
|
|
804
804
|
// src/widgets/AltDateWidget/index.tsx
|
|
805
|
-
import { useEffect, useState } from "react";
|
|
806
805
|
import { Row as Row7, Col as Col7, Button as Button3 } from "antd";
|
|
807
806
|
import {
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
parseDateString,
|
|
812
|
-
toDateString,
|
|
813
|
-
TranslatableString as TranslatableString4
|
|
807
|
+
DateElement,
|
|
808
|
+
TranslatableString as TranslatableString4,
|
|
809
|
+
useAltDateWidgetProps
|
|
814
810
|
} from "@rjsf/utils";
|
|
815
811
|
import { jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
816
|
-
var readyForChange = (state) => {
|
|
817
|
-
return Object.values(state).every((value) => value !== -1);
|
|
818
|
-
};
|
|
819
812
|
function AltDateWidget(props) {
|
|
820
|
-
const { autofocus, disabled, id,
|
|
821
|
-
const { formContext, translateString
|
|
822
|
-
const { SelectWidget: SelectWidget2 } = widgets;
|
|
813
|
+
const { autofocus, disabled, id, name, onBlur, onFocus, options, readonly, registry } = props;
|
|
814
|
+
const { formContext, translateString } = registry;
|
|
823
815
|
const { rowGutter = 24 } = formContext;
|
|
824
|
-
const
|
|
825
|
-
useEffect(() => {
|
|
826
|
-
setState(parseDateString(value, showTime));
|
|
827
|
-
}, [showTime, value]);
|
|
828
|
-
const handleChange = (property, nextValue) => {
|
|
829
|
-
const nextState = {
|
|
830
|
-
...state,
|
|
831
|
-
[property]: typeof nextValue === "undefined" ? -1 : nextValue
|
|
832
|
-
};
|
|
833
|
-
if (readyForChange(nextState)) {
|
|
834
|
-
onChange(toDateString(nextState, showTime));
|
|
835
|
-
} else {
|
|
836
|
-
setState(nextState);
|
|
837
|
-
}
|
|
838
|
-
};
|
|
839
|
-
const handleNow = (event) => {
|
|
840
|
-
event.preventDefault();
|
|
841
|
-
if (disabled || readonly) {
|
|
842
|
-
return;
|
|
843
|
-
}
|
|
844
|
-
const nextState = parseDateString((/* @__PURE__ */ new Date()).toJSON(), showTime);
|
|
845
|
-
onChange(toDateString(nextState, showTime));
|
|
846
|
-
};
|
|
847
|
-
const handleClear = (event) => {
|
|
848
|
-
event.preventDefault();
|
|
849
|
-
if (disabled || readonly) {
|
|
850
|
-
return;
|
|
851
|
-
}
|
|
852
|
-
onChange(void 0);
|
|
853
|
-
};
|
|
854
|
-
const renderDateElement = (elemProps) => /* @__PURE__ */ jsx16(
|
|
855
|
-
SelectWidget2,
|
|
856
|
-
{
|
|
857
|
-
autofocus: elemProps.autofocus,
|
|
858
|
-
className: "form-control",
|
|
859
|
-
disabled: elemProps.disabled,
|
|
860
|
-
id: elemProps.id,
|
|
861
|
-
name: elemProps.name,
|
|
862
|
-
onBlur: elemProps.onBlur,
|
|
863
|
-
onChange: (elemValue) => elemProps.select(elemProps.type, elemValue),
|
|
864
|
-
onFocus: elemProps.onFocus,
|
|
865
|
-
options: {
|
|
866
|
-
enumOptions: dateRangeOptions(elemProps.range[0], elemProps.range[1])
|
|
867
|
-
},
|
|
868
|
-
placeholder: elemProps.type,
|
|
869
|
-
readonly: elemProps.readonly,
|
|
870
|
-
schema: { type: "integer" },
|
|
871
|
-
value: elemProps.value,
|
|
872
|
-
registry,
|
|
873
|
-
label: "",
|
|
874
|
-
"aria-describedby": ariaDescribedByIds2(id)
|
|
875
|
-
}
|
|
876
|
-
);
|
|
816
|
+
const { elements, handleChange, handleClear, handleSetNow } = useAltDateWidgetProps(props);
|
|
877
817
|
return /* @__PURE__ */ jsxs9(Row7, { gutter: [Math.floor(rowGutter / 2), Math.floor(rowGutter / 2)], children: [
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
select: handleChange,
|
|
896
|
-
// NOTE: antd components accept -1 rather than issue a warning
|
|
897
|
-
// like material-ui, so we need to convert -1 to undefined here.
|
|
898
|
-
value: elemProps.value || -1 < 0 ? void 0 : elemProps.value
|
|
899
|
-
}) }, 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);
|
|
900
835
|
}),
|
|
901
|
-
!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) }) }),
|
|
902
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) }) })
|
|
903
838
|
] });
|
|
904
839
|
}
|
|
@@ -909,24 +844,24 @@ AltDateWidget.defaultProps = {
|
|
|
909
844
|
yearsRange: [1900, (/* @__PURE__ */ new Date()).getFullYear() + 2]
|
|
910
845
|
},
|
|
911
846
|
readonly: false,
|
|
912
|
-
|
|
847
|
+
time: false
|
|
913
848
|
};
|
|
914
849
|
|
|
915
850
|
// src/widgets/AltDateTimeWidget/index.tsx
|
|
916
851
|
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
917
852
|
function AltDateTimeWidget(props) {
|
|
918
853
|
const { AltDateWidget: AltDateWidget2 } = props.registry.widgets;
|
|
919
|
-
return /* @__PURE__ */ jsx17(AltDateWidget2, {
|
|
854
|
+
return /* @__PURE__ */ jsx17(AltDateWidget2, { time: true, ...props });
|
|
920
855
|
}
|
|
921
856
|
AltDateTimeWidget.defaultProps = {
|
|
922
857
|
...AltDateWidget.defaultProps,
|
|
923
|
-
|
|
858
|
+
time: true
|
|
924
859
|
};
|
|
925
860
|
|
|
926
861
|
// src/widgets/CheckboxesWidget/index.tsx
|
|
927
862
|
import { Checkbox } from "antd";
|
|
928
863
|
import {
|
|
929
|
-
ariaDescribedByIds as
|
|
864
|
+
ariaDescribedByIds as ariaDescribedByIds2,
|
|
930
865
|
enumOptionsIndexForValue,
|
|
931
866
|
enumOptionsValueForIndex,
|
|
932
867
|
optionId
|
|
@@ -965,7 +900,7 @@ function CheckboxesWidget({
|
|
|
965
900
|
onChange: !readonly ? handleChange : void 0,
|
|
966
901
|
value: selectedIndexes,
|
|
967
902
|
...extraProps,
|
|
968
|
-
"aria-describedby":
|
|
903
|
+
"aria-describedby": ariaDescribedByIds2(id),
|
|
969
904
|
children: Array.isArray(enumOptions) && enumOptions.map((option, i) => /* @__PURE__ */ jsxs10("span", { children: [
|
|
970
905
|
/* @__PURE__ */ jsx18(
|
|
971
906
|
Checkbox,
|
|
@@ -987,7 +922,7 @@ function CheckboxesWidget({
|
|
|
987
922
|
// src/widgets/CheckboxWidget/index.tsx
|
|
988
923
|
import { Checkbox as Checkbox2 } from "antd";
|
|
989
924
|
import {
|
|
990
|
-
ariaDescribedByIds as
|
|
925
|
+
ariaDescribedByIds as ariaDescribedByIds3,
|
|
991
926
|
labelValue
|
|
992
927
|
} from "@rjsf/utils";
|
|
993
928
|
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
@@ -1012,7 +947,7 @@ function CheckboxWidget(props) {
|
|
|
1012
947
|
name: htmlName || id,
|
|
1013
948
|
onChange: !readonly ? handleChange : void 0,
|
|
1014
949
|
...extraProps,
|
|
1015
|
-
"aria-describedby":
|
|
950
|
+
"aria-describedby": ariaDescribedByIds3(id),
|
|
1016
951
|
children: labelValue(label, hideLabel, "")
|
|
1017
952
|
}
|
|
1018
953
|
);
|
|
@@ -1021,7 +956,7 @@ function CheckboxWidget(props) {
|
|
|
1021
956
|
// src/widgets/DateTimeWidget/index.tsx
|
|
1022
957
|
import dayjs from "dayjs";
|
|
1023
958
|
import {
|
|
1024
|
-
ariaDescribedByIds as
|
|
959
|
+
ariaDescribedByIds as ariaDescribedByIds4
|
|
1025
960
|
} from "@rjsf/utils";
|
|
1026
961
|
import { DatePicker } from "antd";
|
|
1027
962
|
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
@@ -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";
|
|
@@ -1087,7 +1022,7 @@ function DateWidget(props) {
|
|
|
1087
1022
|
showTime: false,
|
|
1088
1023
|
style: DATE_PICKER_STYLE2,
|
|
1089
1024
|
value: value && dayjs2(value),
|
|
1090
|
-
"aria-describedby":
|
|
1025
|
+
"aria-describedby": ariaDescribedByIds5(id)
|
|
1091
1026
|
}
|
|
1092
1027
|
);
|
|
1093
1028
|
}
|
|
@@ -1095,7 +1030,7 @@ function DateWidget(props) {
|
|
|
1095
1030
|
// src/widgets/PasswordWidget/index.tsx
|
|
1096
1031
|
import { Input as Input3 } from "antd";
|
|
1097
1032
|
import {
|
|
1098
|
-
ariaDescribedByIds as
|
|
1033
|
+
ariaDescribedByIds as ariaDescribedByIds6
|
|
1099
1034
|
} from "@rjsf/utils";
|
|
1100
1035
|
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
1101
1036
|
function PasswordWidget(props) {
|
|
@@ -1117,7 +1052,7 @@ function PasswordWidget(props) {
|
|
|
1117
1052
|
onFocus: !readonly ? handleFocus : void 0,
|
|
1118
1053
|
placeholder,
|
|
1119
1054
|
value: value || "",
|
|
1120
|
-
"aria-describedby":
|
|
1055
|
+
"aria-describedby": ariaDescribedByIds6(id)
|
|
1121
1056
|
}
|
|
1122
1057
|
);
|
|
1123
1058
|
}
|
|
@@ -1125,7 +1060,7 @@ function PasswordWidget(props) {
|
|
|
1125
1060
|
// src/widgets/RadioWidget/index.tsx
|
|
1126
1061
|
import { Radio } from "antd";
|
|
1127
1062
|
import {
|
|
1128
|
-
ariaDescribedByIds as
|
|
1063
|
+
ariaDescribedByIds as ariaDescribedByIds7,
|
|
1129
1064
|
enumOptionsIndexForValue as enumOptionsIndexForValue2,
|
|
1130
1065
|
enumOptionsValueForIndex as enumOptionsValueForIndex2,
|
|
1131
1066
|
optionId as optionId2
|
|
@@ -1161,7 +1096,7 @@ function RadioWidget({
|
|
|
1161
1096
|
onBlur: !readonly ? handleBlur : void 0,
|
|
1162
1097
|
onFocus: !readonly ? handleFocus : void 0,
|
|
1163
1098
|
value: selectedIndexes,
|
|
1164
|
-
"aria-describedby":
|
|
1099
|
+
"aria-describedby": ariaDescribedByIds7(id),
|
|
1165
1100
|
children: Array.isArray(enumOptions) && enumOptions.map((option, i) => /* @__PURE__ */ jsx23(
|
|
1166
1101
|
Radio,
|
|
1167
1102
|
{
|
|
@@ -1181,7 +1116,7 @@ function RadioWidget({
|
|
|
1181
1116
|
// src/widgets/RangeWidget/index.tsx
|
|
1182
1117
|
import { Slider } from "antd";
|
|
1183
1118
|
import {
|
|
1184
|
-
ariaDescribedByIds as
|
|
1119
|
+
ariaDescribedByIds as ariaDescribedByIds8,
|
|
1185
1120
|
rangeSpec
|
|
1186
1121
|
} from "@rjsf/utils";
|
|
1187
1122
|
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
@@ -1225,7 +1160,7 @@ function RangeWidget(props) {
|
|
|
1225
1160
|
step,
|
|
1226
1161
|
value,
|
|
1227
1162
|
...extraProps,
|
|
1228
|
-
"aria-describedby":
|
|
1163
|
+
"aria-describedby": ariaDescribedByIds8(id)
|
|
1229
1164
|
}
|
|
1230
1165
|
);
|
|
1231
1166
|
}
|
|
@@ -1233,7 +1168,7 @@ function RangeWidget(props) {
|
|
|
1233
1168
|
// src/widgets/SelectWidget/index.tsx
|
|
1234
1169
|
import { Select } from "antd";
|
|
1235
1170
|
import {
|
|
1236
|
-
ariaDescribedByIds as
|
|
1171
|
+
ariaDescribedByIds as ariaDescribedByIds9,
|
|
1237
1172
|
enumOptionsIndexForValue as enumOptionsIndexForValue3,
|
|
1238
1173
|
enumOptionsValueForIndex as enumOptionsValueForIndex3
|
|
1239
1174
|
} from "@rjsf/utils";
|
|
@@ -1308,7 +1243,7 @@ function SelectWidget({
|
|
|
1308
1243
|
value: selectedIndexes,
|
|
1309
1244
|
...extraProps,
|
|
1310
1245
|
filterOption,
|
|
1311
|
-
"aria-describedby":
|
|
1246
|
+
"aria-describedby": ariaDescribedByIds9(id),
|
|
1312
1247
|
options: selectOptions
|
|
1313
1248
|
}
|
|
1314
1249
|
);
|
|
@@ -1317,7 +1252,7 @@ function SelectWidget({
|
|
|
1317
1252
|
// src/widgets/TextareaWidget/index.tsx
|
|
1318
1253
|
import { Input as Input4 } from "antd";
|
|
1319
1254
|
import {
|
|
1320
|
-
ariaDescribedByIds as
|
|
1255
|
+
ariaDescribedByIds as ariaDescribedByIds10
|
|
1321
1256
|
} from "@rjsf/utils";
|
|
1322
1257
|
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
1323
1258
|
var INPUT_STYLE3 = {
|
|
@@ -1358,7 +1293,7 @@ function TextareaWidget({
|
|
|
1358
1293
|
style: INPUT_STYLE3,
|
|
1359
1294
|
value,
|
|
1360
1295
|
...extraProps,
|
|
1361
|
-
"aria-describedby":
|
|
1296
|
+
"aria-describedby": ariaDescribedByIds10(id)
|
|
1362
1297
|
}
|
|
1363
1298
|
);
|
|
1364
1299
|
}
|