@rjsf/antd 6.0.0-beta.21 → 6.0.0-beta.22

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.
Files changed (61) hide show
  1. package/dist/antd.esm.js +60 -51
  2. package/dist/antd.esm.js.map +3 -3
  3. package/dist/antd.umd.js +60 -51
  4. package/dist/index.cjs +60 -51
  5. package/dist/index.cjs.map +3 -3
  6. package/lib/templates/ArrayFieldItemTemplate/index.d.ts +3 -3
  7. package/lib/templates/ArrayFieldItemTemplate/index.js +1 -1
  8. package/lib/templates/ArrayFieldItemTemplate/index.js.map +1 -1
  9. package/lib/templates/ArrayFieldTemplate/index.d.ts +1 -1
  10. package/lib/templates/ArrayFieldTemplate/index.js +2 -3
  11. package/lib/templates/ArrayFieldTemplate/index.js.map +1 -1
  12. package/lib/templates/BaseInputTemplate/index.js +3 -2
  13. package/lib/templates/BaseInputTemplate/index.js.map +1 -1
  14. package/lib/templates/FieldTemplate/index.js +2 -2
  15. package/lib/templates/FieldTemplate/index.js.map +1 -1
  16. package/lib/templates/ObjectFieldTemplate/index.js +2 -2
  17. package/lib/templates/ObjectFieldTemplate/index.js.map +1 -1
  18. package/lib/templates/WrapIfAdditionalTemplate/index.js +2 -3
  19. package/lib/templates/WrapIfAdditionalTemplate/index.js.map +1 -1
  20. package/lib/tsconfig.tsbuildinfo +1 -1
  21. package/lib/widgets/AltDateWidget/index.js +2 -2
  22. package/lib/widgets/AltDateWidget/index.js.map +1 -1
  23. package/lib/widgets/CheckboxWidget/index.js +3 -2
  24. package/lib/widgets/CheckboxWidget/index.js.map +1 -1
  25. package/lib/widgets/CheckboxesWidget/index.d.ts +1 -1
  26. package/lib/widgets/CheckboxesWidget/index.js +4 -3
  27. package/lib/widgets/CheckboxesWidget/index.js.map +1 -1
  28. package/lib/widgets/DateTimeWidget/index.js +2 -1
  29. package/lib/widgets/DateTimeWidget/index.js.map +1 -1
  30. package/lib/widgets/DateWidget/index.js +2 -1
  31. package/lib/widgets/DateWidget/index.js.map +1 -1
  32. package/lib/widgets/PasswordWidget/index.js +2 -1
  33. package/lib/widgets/PasswordWidget/index.js.map +1 -1
  34. package/lib/widgets/RadioWidget/index.d.ts +1 -1
  35. package/lib/widgets/RadioWidget/index.js +4 -3
  36. package/lib/widgets/RadioWidget/index.js.map +1 -1
  37. package/lib/widgets/RangeWidget/index.js +2 -1
  38. package/lib/widgets/RangeWidget/index.js.map +1 -1
  39. package/lib/widgets/SelectWidget/index.d.ts +1 -1
  40. package/lib/widgets/SelectWidget/index.js +3 -2
  41. package/lib/widgets/SelectWidget/index.js.map +1 -1
  42. package/lib/widgets/TextareaWidget/index.d.ts +1 -1
  43. package/lib/widgets/TextareaWidget/index.js +3 -2
  44. package/lib/widgets/TextareaWidget/index.js.map +1 -1
  45. package/package.json +7 -7
  46. package/src/templates/ArrayFieldItemTemplate/index.tsx +3 -3
  47. package/src/templates/ArrayFieldTemplate/index.tsx +2 -10
  48. package/src/templates/BaseInputTemplate/index.tsx +5 -3
  49. package/src/templates/FieldTemplate/index.tsx +6 -4
  50. package/src/templates/ObjectFieldTemplate/index.tsx +2 -2
  51. package/src/templates/WrapIfAdditionalTemplate/index.tsx +4 -7
  52. package/src/widgets/AltDateWidget/index.tsx +2 -15
  53. package/src/widgets/CheckboxWidget/index.tsx +4 -2
  54. package/src/widgets/CheckboxesWidget/index.tsx +16 -3
  55. package/src/widgets/DateTimeWidget/index.tsx +2 -1
  56. package/src/widgets/DateWidget/index.tsx +2 -1
  57. package/src/widgets/PasswordWidget/index.tsx +2 -1
  58. package/src/widgets/RadioWidget/index.tsx +5 -3
  59. package/src/widgets/RangeWidget/index.tsx +2 -1
  60. package/src/widgets/SelectWidget/index.tsx +4 -2
  61. 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.map(({ key, ...itemProps }) => /* @__PURE__ */ jsx2(ArrayFieldItemTemplate2, { ...itemProps }, key))
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
- formContext,
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
- onDropPropertyClick,
357
- onKeyChange,
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
- onDropPropertyClick,
404
- onKeyChange,
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
- onAddClick,
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: onAddClick(schema),
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
- onDropPropertyClick,
706
- onKeyChange,
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 ? handleBlur : void 0,
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: onDropPropertyClick(label),
768
+ onClick: onRemoveProperty,
771
769
  uiSchema: buttonUiOptions,
772
770
  registry
773
771
  }
@@ -819,21 +817,8 @@ var readyForChange = (state) => {
819
817
  return Object.values(state).every((value) => value !== -1);
820
818
  };
821
819
  function AltDateWidget(props) {
822
- const {
823
- autofocus,
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;
820
+ const { autofocus, disabled, id, onBlur, onChange, onFocus, options, readonly, registry, showTime, value } = props;
821
+ const { formContext, translateString, widgets } = registry;
837
822
  const { SelectWidget: SelectWidget2 } = widgets;
838
823
  const { rowGutter = 24 } = formContext;
839
824
  const [state, setState] = useState(parseDateString(value, showTime));
@@ -947,7 +932,20 @@ import {
947
932
  optionId
948
933
  } from "@rjsf/utils";
949
934
  import { Fragment as Fragment3, jsx as jsx18, jsxs as jsxs10 } from "react/jsx-runtime";
950
- function CheckboxesWidget({ autofocus, disabled, formContext, id, onBlur, onChange, onFocus, options, readonly, value }) {
935
+ function CheckboxesWidget({
936
+ autofocus,
937
+ disabled,
938
+ registry,
939
+ id,
940
+ htmlName,
941
+ onBlur,
942
+ onChange,
943
+ onFocus,
944
+ options,
945
+ readonly,
946
+ value
947
+ }) {
948
+ const { formContext } = registry;
951
949
  const { readonlyAsDisabled = true } = formContext;
952
950
  const { enumOptions, enumDisabled, inline, emptyValue } = options;
953
951
  const handleChange = (nextValue) => onChange(enumOptionsValueForIndex(nextValue, enumOptions, emptyValue));
@@ -963,7 +961,7 @@ function CheckboxesWidget({ autofocus, disabled, formContext, id, onBlur, onChan
963
961
  Checkbox.Group,
964
962
  {
965
963
  disabled: disabled || readonlyAsDisabled && readonly,
966
- name: id,
964
+ name: htmlName || id,
967
965
  onChange: !readonly ? handleChange : void 0,
968
966
  value: selectedIndexes,
969
967
  ...extraProps,
@@ -973,7 +971,7 @@ function CheckboxesWidget({ autofocus, disabled, formContext, id, onBlur, onChan
973
971
  Checkbox,
974
972
  {
975
973
  id: optionId(id, i),
976
- name: id,
974
+ name: htmlName || id,
977
975
  autoFocus: i === 0 ? autofocus : false,
978
976
  disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1,
979
977
  value: String(i),
@@ -994,7 +992,8 @@ import {
994
992
  } from "@rjsf/utils";
995
993
  import { jsx as jsx19 } from "react/jsx-runtime";
996
994
  function CheckboxWidget(props) {
997
- const { autofocus, disabled, formContext, id, label, hideLabel, onBlur, onChange, onFocus, readonly, value } = props;
995
+ const { autofocus, disabled, registry, id, htmlName, label, hideLabel, onBlur, onChange, onFocus, readonly, value } = props;
996
+ const { formContext } = registry;
998
997
  const { readonlyAsDisabled = true } = formContext;
999
998
  const handleChange = ({ target }) => onChange(target.checked);
1000
999
  const handleBlur = ({ target }) => onBlur(id, target && target.checked);
@@ -1010,7 +1009,7 @@ function CheckboxWidget(props) {
1010
1009
  checked: typeof value === "undefined" ? false : value,
1011
1010
  disabled: disabled || readonlyAsDisabled && readonly,
1012
1011
  id,
1013
- name: id,
1012
+ name: htmlName || id,
1014
1013
  onChange: !readonly ? handleChange : void 0,
1015
1014
  ...extraProps,
1016
1015
  "aria-describedby": ariaDescribedByIds4(id),
@@ -1030,7 +1029,8 @@ var DATE_PICKER_STYLE = {
1030
1029
  width: "100%"
1031
1030
  };
1032
1031
  function DateTimeWidget(props) {
1033
- const { disabled, formContext, id, onBlur, onChange, onFocus, placeholder, readonly, value } = props;
1032
+ const { disabled, registry, id, onBlur, onChange, onFocus, placeholder, readonly, value } = props;
1033
+ const { formContext } = registry;
1034
1034
  const { readonlyAsDisabled = true } = formContext;
1035
1035
  const handleChange = (nextValue) => onChange(nextValue && nextValue.toISOString());
1036
1036
  const handleBlur = () => onBlur(id, value);
@@ -1066,7 +1066,8 @@ var DATE_PICKER_STYLE2 = {
1066
1066
  width: "100%"
1067
1067
  };
1068
1068
  function DateWidget(props) {
1069
- const { disabled, formContext, id, onBlur, onChange, onFocus, placeholder, readonly, value } = props;
1069
+ const { disabled, registry, id, onBlur, onChange, onFocus, placeholder, readonly, value } = props;
1070
+ const { formContext } = registry;
1070
1071
  const { readonlyAsDisabled = true } = formContext;
1071
1072
  const handleChange = (nextValue) => onChange(nextValue && nextValue.format("YYYY-MM-DD"));
1072
1073
  const handleBlur = () => onBlur(id, value);
@@ -1098,7 +1099,8 @@ import {
1098
1099
  } from "@rjsf/utils";
1099
1100
  import { jsx as jsx22 } from "react/jsx-runtime";
1100
1101
  function PasswordWidget(props) {
1101
- const { disabled, formContext, id, onBlur, onChange, onFocus, options, placeholder, readonly, value } = props;
1102
+ const { disabled, registry, id, onBlur, onChange, onFocus, options, placeholder, readonly, value } = props;
1103
+ const { formContext } = registry;
1102
1104
  const { readonlyAsDisabled = true } = formContext;
1103
1105
  const emptyValue = options.emptyValue || "";
1104
1106
  const handleChange = ({ target }) => onChange(target.value === "" ? emptyValue : target.value);
@@ -1132,8 +1134,9 @@ import { jsx as jsx23 } from "react/jsx-runtime";
1132
1134
  function RadioWidget({
1133
1135
  autofocus,
1134
1136
  disabled,
1135
- formContext,
1137
+ registry,
1136
1138
  id,
1139
+ htmlName,
1137
1140
  onBlur,
1138
1141
  onChange,
1139
1142
  onFocus,
@@ -1141,6 +1144,7 @@ function RadioWidget({
1141
1144
  readonly,
1142
1145
  value
1143
1146
  }) {
1147
+ const { formContext } = registry;
1144
1148
  const { readonlyAsDisabled = true } = formContext;
1145
1149
  const { enumOptions, enumDisabled, emptyValue } = options;
1146
1150
  const handleChange = ({ target: { value: nextValue } }) => onChange(enumOptionsValueForIndex2(nextValue, enumOptions, emptyValue));
@@ -1152,7 +1156,7 @@ function RadioWidget({
1152
1156
  {
1153
1157
  disabled: disabled || readonlyAsDisabled && readonly,
1154
1158
  id,
1155
- name: id,
1159
+ name: htmlName || id,
1156
1160
  onChange: !readonly ? handleChange : void 0,
1157
1161
  onBlur: !readonly ? handleBlur : void 0,
1158
1162
  onFocus: !readonly ? handleFocus : void 0,
@@ -1162,7 +1166,7 @@ function RadioWidget({
1162
1166
  Radio,
1163
1167
  {
1164
1168
  id: optionId2(id, i),
1165
- name: id,
1169
+ name: htmlName || id,
1166
1170
  autoFocus: i === 0 ? autofocus : false,
1167
1171
  disabled: disabled || Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1,
1168
1172
  value: String(i),
@@ -1185,7 +1189,7 @@ function RangeWidget(props) {
1185
1189
  const {
1186
1190
  autofocus,
1187
1191
  disabled,
1188
- formContext,
1192
+ registry,
1189
1193
  id,
1190
1194
  onBlur,
1191
1195
  onChange,
@@ -1196,6 +1200,7 @@ function RangeWidget(props) {
1196
1200
  schema,
1197
1201
  value
1198
1202
  } = props;
1203
+ const { formContext } = registry;
1199
1204
  const { readonlyAsDisabled = true } = formContext;
1200
1205
  const { min, max, step } = rangeSpec(schema);
1201
1206
  const emptyValue = options.emptyValue || "";
@@ -1241,8 +1246,9 @@ var SELECT_STYLE = {
1241
1246
  function SelectWidget({
1242
1247
  autofocus,
1243
1248
  disabled,
1244
- formContext = {},
1249
+ registry,
1245
1250
  id,
1251
+ htmlName,
1246
1252
  multiple,
1247
1253
  onBlur,
1248
1254
  onChange,
@@ -1253,6 +1259,7 @@ function SelectWidget({
1253
1259
  value,
1254
1260
  schema
1255
1261
  }) {
1262
+ const { formContext } = registry;
1256
1263
  const { readonlyAsDisabled = true } = formContext;
1257
1264
  const { enumOptions, enumDisabled, emptyValue } = options;
1258
1265
  const handleChange = (nextValue) => onChange(enumOptionsValueForIndex3(nextValue, enumOptions, emptyValue));
@@ -1267,7 +1274,7 @@ function SelectWidget({
1267
1274
  const getPopupContainer = (node) => node.parentNode;
1268
1275
  const selectedIndexes = enumOptionsIndexForValue3(value, enumOptions, multiple);
1269
1276
  const extraProps = {
1270
- name: id
1277
+ name: htmlName || id
1271
1278
  };
1272
1279
  const showPlaceholderOption = !multiple && schema.default === void 0;
1273
1280
  const selectOptions = useMemo(() => {
@@ -1318,8 +1325,9 @@ var INPUT_STYLE3 = {
1318
1325
  };
1319
1326
  function TextareaWidget({
1320
1327
  disabled,
1321
- formContext,
1328
+ registry,
1322
1329
  id,
1330
+ htmlName,
1323
1331
  onBlur,
1324
1332
  onChange,
1325
1333
  onFocus,
@@ -1328,6 +1336,7 @@ function TextareaWidget({
1328
1336
  readonly,
1329
1337
  value
1330
1338
  }) {
1339
+ const { formContext } = registry;
1331
1340
  const { readonlyAsDisabled = true } = formContext;
1332
1341
  const handleChange = ({ target }) => onChange(target.value === "" ? options.emptyValue : target.value);
1333
1342
  const handleBlur = ({ target }) => onBlur(id, target && target.value);
@@ -1340,7 +1349,7 @@ function TextareaWidget({
1340
1349
  {
1341
1350
  disabled: disabled || readonlyAsDisabled && readonly,
1342
1351
  id,
1343
- name: id,
1352
+ name: htmlName || id,
1344
1353
  onBlur: !readonly ? handleBlur : void 0,
1345
1354
  onChange: !readonly ? handleChange : void 0,
1346
1355
  onFocus: !readonly ? handleFocus : void 0,