@rjsf/antd 6.4.1 → 6.5.0

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.umd.js CHANGED
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@rjsf/core'), require('antd'), require('@rjsf/utils'), require('react/jsx-runtime'), require('classnames'), require('react'), require('@ant-design/icons/ExclamationCircleOutlined'), require('@ant-design/icons/ArrowDownOutlined'), require('@ant-design/icons/ArrowUpOutlined'), require('@ant-design/icons/CopyOutlined'), require('@ant-design/icons/DeleteOutlined'), require('@ant-design/icons/PlusCircleOutlined'), require('@ant-design/icons/CloseOutlined'), require('lodash/isObject'), require('lodash/isNumber'), require('lodash/isString'), require('dayjs')) :
3
- typeof define === 'function' && define.amd ? define(['exports', '@rjsf/core', 'antd', '@rjsf/utils', 'react/jsx-runtime', 'classnames', 'react', '@ant-design/icons/ExclamationCircleOutlined', '@ant-design/icons/ArrowDownOutlined', '@ant-design/icons/ArrowUpOutlined', '@ant-design/icons/CopyOutlined', '@ant-design/icons/DeleteOutlined', '@ant-design/icons/PlusCircleOutlined', '@ant-design/icons/CloseOutlined', 'lodash/isObject', 'lodash/isNumber', 'lodash/isString', 'dayjs'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@rjsf/antd"] = {}, global.core, global.antd, global.utils, global.jsxRuntime, global.classNames, global.react, global.ExclamationCircleOutlined, global.ArrowDownOutlined, global.ArrowUpOutlined, global.CopyOutlined, global.DeleteOutlined, global.PlusCircleOutlined, global.CloseOutlined, global.isObject, global.isNumber, global.isString, global.dayjs));
5
- })(this, (function (exports, core, antd, utils, jsxRuntime, classNames, react, ExclamationCircleOutlined, ArrowDownOutlined, ArrowUpOutlined, CopyOutlined, DeleteOutlined, PlusCircleOutlined, CloseOutlined, isObject, isNumber, isString, dayjs) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@rjsf/core'), require('antd'), require('@rjsf/utils'), require('react/jsx-runtime'), require('classnames'), require('react'), require('@ant-design/icons'), require('lodash/isObject'), require('lodash/isNumber'), require('lodash/isString'), require('dayjs')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', '@rjsf/core', 'antd', '@rjsf/utils', 'react/jsx-runtime', 'classnames', 'react', '@ant-design/icons', 'lodash/isObject', 'lodash/isNumber', 'lodash/isString', 'dayjs'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@rjsf/antd"] = {}, global.core, global.antd, global.utils, global.jsxRuntime, global.classNames, global.react, global.icons, global.isObject, global.isNumber, global.isString, global.dayjs));
5
+ })(this, (function (exports, core, antd, utils, jsxRuntime, classNames, react, icons, isObject, isNumber, isString, dayjs) { 'use strict';
6
6
 
7
7
  // src/index.ts
8
8
  var BTN_GRP_STYLE = {
@@ -109,6 +109,7 @@
109
109
  options,
110
110
  placeholder,
111
111
  readonly,
112
+ required,
112
113
  schema,
113
114
  value,
114
115
  type
@@ -129,6 +130,7 @@
129
130
  },
130
131
  [onChange, options.emptyValue]
131
132
  );
133
+ const { min, max, ...restInputProps } = inputProps;
132
134
  const input = inputProps.type === "number" || inputProps.type === "integer" ? /* @__PURE__ */ jsxRuntime.jsx(
133
135
  antd.InputNumber,
134
136
  {
@@ -139,9 +141,14 @@
139
141
  onChange: !readonly ? handleNumberChange : void 0,
140
142
  onFocus: !readonly ? handleFocus : void 0,
141
143
  placeholder,
144
+ required,
142
145
  style: INPUT_STYLE,
146
+ changeOnWheel: false,
143
147
  list: schema.examples ? utils.examplesId(id) : void 0,
144
- ...inputProps,
148
+ ...restInputProps,
149
+ min: typeof min === "number" ? min : void 0,
150
+ max: typeof max === "number" ? max : void 0,
151
+ type: void 0,
145
152
  value,
146
153
  "aria-describedby": utils.ariaDescribedByIds(id, !!schema.examples)
147
154
  }
@@ -155,6 +162,7 @@
155
162
  onChange: !readonly ? handleTextChange : void 0,
156
163
  onFocus: !readonly ? handleFocus : void 0,
157
164
  placeholder,
165
+ required,
158
166
  style: INPUT_STYLE,
159
167
  list: schema.examples ? utils.examplesId(id) : void 0,
160
168
  ...inputProps,
@@ -175,24 +183,33 @@
175
183
  }
176
184
  return /* @__PURE__ */ jsxRuntime.jsx("span", { id, children: /* @__PURE__ */ jsxRuntime.jsx(core.RichDescription, { description, registry, uiSchema }) });
177
185
  }
186
+ var antdMajor = parseInt(antd.version.split(".")[0], 10);
178
187
  function ErrorList({
179
188
  errors,
180
189
  registry
181
190
  }) {
182
191
  const { translateString } = registry;
183
- const renderErrors = () => /* @__PURE__ */ jsxRuntime.jsx(antd.List, { className: "list-group", size: "small", children: errors.map((error, index) => /* @__PURE__ */ jsxRuntime.jsx(antd.List.Item, { children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Space, { children: [
184
- /* @__PURE__ */ jsxRuntime.jsx(ExclamationCircleOutlined, {}),
185
- error.stack
186
- ] }) }, index)) });
187
- return /* @__PURE__ */ jsxRuntime.jsx(
188
- antd.Alert,
192
+ const { token } = antd.theme.useToken();
193
+ const itemBorder = `${token.lineWidth}px ${token.lineType} ${token.colorSplit}`;
194
+ const renderErrors = () => /* @__PURE__ */ jsxRuntime.jsx("ul", { style: { margin: 0, padding: 0, listStyle: "none" }, children: errors.map((error, index) => /* @__PURE__ */ jsxRuntime.jsx(
195
+ "li",
189
196
  {
190
- className: "panel panel-danger errors",
191
- description: renderErrors(),
192
- message: translateString(utils.TranslatableString.ErrorsLabel),
193
- type: "error"
194
- }
195
- );
197
+ style: {
198
+ display: "flex",
199
+ alignItems: "center",
200
+ padding: `${token.paddingXS}px ${token.padding}px`,
201
+ color: token.colorText,
202
+ borderBlockEnd: index < errors.length - 1 ? itemBorder : "none"
203
+ },
204
+ children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Space, { children: [
205
+ /* @__PURE__ */ jsxRuntime.jsx(icons.ExclamationCircleOutlined, {}),
206
+ error.stack
207
+ ] })
208
+ },
209
+ index
210
+ )) });
211
+ const headerProp = antdMajor >= 6 ? { title: translateString(utils.TranslatableString.ErrorsLabel) } : { message: translateString(utils.TranslatableString.ErrorsLabel) };
212
+ return /* @__PURE__ */ jsxRuntime.jsx(antd.Alert, { className: "panel panel-danger errors", description: renderErrors(), type: "error", ...headerProp });
196
213
  }
197
214
  function IconButton(props) {
198
215
  const { iconType = "default", icon, onClick, uiSchema, registry, color, ...otherProps } = props;
@@ -222,7 +239,7 @@
222
239
  iconType: "primary",
223
240
  block: true,
224
241
  ...props,
225
- icon: /* @__PURE__ */ jsxRuntime.jsx(PlusCircleOutlined, {})
242
+ icon: /* @__PURE__ */ jsxRuntime.jsx(icons.PlusCircleOutlined, {})
226
243
  }
227
244
  );
228
245
  }
@@ -230,19 +247,19 @@
230
247
  const {
231
248
  registry: { translateString }
232
249
  } = props;
233
- return /* @__PURE__ */ jsxRuntime.jsx(IconButton, { title: translateString(utils.TranslatableString.CopyButton), ...props, icon: /* @__PURE__ */ jsxRuntime.jsx(CopyOutlined, {}) });
250
+ return /* @__PURE__ */ jsxRuntime.jsx(IconButton, { title: translateString(utils.TranslatableString.CopyButton), ...props, icon: /* @__PURE__ */ jsxRuntime.jsx(icons.CopyOutlined, {}) });
234
251
  }
235
252
  function MoveDownButton(props) {
236
253
  const {
237
254
  registry: { translateString }
238
255
  } = props;
239
- return /* @__PURE__ */ jsxRuntime.jsx(IconButton, { title: translateString(utils.TranslatableString.MoveDownButton), ...props, icon: /* @__PURE__ */ jsxRuntime.jsx(ArrowDownOutlined, {}) });
256
+ return /* @__PURE__ */ jsxRuntime.jsx(IconButton, { title: translateString(utils.TranslatableString.MoveDownButton), ...props, icon: /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowDownOutlined, {}) });
240
257
  }
241
258
  function MoveUpButton(props) {
242
259
  const {
243
260
  registry: { translateString }
244
261
  } = props;
245
- return /* @__PURE__ */ jsxRuntime.jsx(IconButton, { title: translateString(utils.TranslatableString.MoveUpButton), ...props, icon: /* @__PURE__ */ jsxRuntime.jsx(ArrowUpOutlined, {}) });
262
+ return /* @__PURE__ */ jsxRuntime.jsx(IconButton, { title: translateString(utils.TranslatableString.MoveUpButton), ...props, icon: /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowUpOutlined, {}) });
246
263
  }
247
264
  function RemoveButton(props) {
248
265
  const options = utils.getUiOptions(props.uiSchema);
@@ -257,7 +274,7 @@
257
274
  block: !!options.block,
258
275
  iconType: "primary",
259
276
  ...props,
260
- icon: /* @__PURE__ */ jsxRuntime.jsx(DeleteOutlined, {})
277
+ icon: /* @__PURE__ */ jsxRuntime.jsx(icons.DeleteOutlined, {})
261
278
  }
262
279
  );
263
280
  }
@@ -271,7 +288,7 @@
271
288
  title: translateString(utils.TranslatableString.ClearButton),
272
289
  ...props,
273
290
  iconType: "link",
274
- icon: /* @__PURE__ */ jsxRuntime.jsx(CloseOutlined, {})
291
+ icon: /* @__PURE__ */ jsxRuntime.jsx(icons.CloseOutlined, {})
275
292
  }
276
293
  );
277
294
  }
@@ -612,7 +629,8 @@
612
629
  onBlur: !readonly ? onKeyRenameBlur : void 0,
613
630
  style: INPUT_STYLE2,
614
631
  type: "text"
615
- }
632
+ },
633
+ label
616
634
  )
617
635
  }
618
636
  ) }) }),
@@ -712,22 +730,23 @@
712
730
  const { formContext } = registry;
713
731
  const { readonlyAsDisabled = true } = formContext;
714
732
  const { enumOptions, enumDisabled, inline, emptyValue } = options;
715
- const handleChange = (nextValue) => onChange(utils.enumOptionsValueForIndex(nextValue, enumOptions, emptyValue));
716
- const handleBlur = ({ target }) => onBlur(id, utils.enumOptionsValueForIndex(target.value, enumOptions, emptyValue));
717
- const handleFocus = ({ target }) => onFocus(id, utils.enumOptionsValueForIndex(target.value, enumOptions, emptyValue));
733
+ const optionValueFormat = utils.getOptionValueFormat(options);
734
+ const handleChange = (nextValue) => onChange(utils.enumOptionValueDecoder(nextValue, enumOptions, optionValueFormat, emptyValue));
735
+ const handleBlur = ({ target }) => onBlur(id, utils.enumOptionValueDecoder(target.value, enumOptions, optionValueFormat, emptyValue));
736
+ const handleFocus = ({ target }) => onFocus(id, utils.enumOptionValueDecoder(target.value, enumOptions, optionValueFormat, emptyValue));
718
737
  const extraProps = {
719
738
  id,
720
739
  onBlur: !readonly ? handleBlur : void 0,
721
740
  onFocus: !readonly ? handleFocus : void 0
722
741
  };
723
- const selectedIndexes = utils.enumOptionsIndexForValue(value, enumOptions, true);
742
+ const selectValue = utils.enumOptionSelectedValue(value, enumOptions, true, optionValueFormat, []);
724
743
  return Array.isArray(enumOptions) && enumOptions.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(
725
744
  antd.Checkbox.Group,
726
745
  {
727
746
  disabled: disabled || readonlyAsDisabled && readonly,
728
747
  name: htmlName || id,
729
748
  onChange: !readonly ? handleChange : void 0,
730
- value: selectedIndexes,
749
+ value: selectValue,
731
750
  ...extraProps,
732
751
  "aria-describedby": utils.ariaDescribedByIds(id),
733
752
  children: Array.isArray(enumOptions) && enumOptions.map((option, i) => /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
@@ -738,7 +757,7 @@
738
757
  name: htmlName || id,
739
758
  autoFocus: i === 0 ? autofocus : false,
740
759
  disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1,
741
- value: String(i),
760
+ value: utils.enumOptionValueEncoder(option.value, i, optionValueFormat),
742
761
  children: option.label
743
762
  }
744
763
  ),
@@ -870,10 +889,11 @@
870
889
  const { formContext } = registry;
871
890
  const { readonlyAsDisabled = true } = formContext;
872
891
  const { enumOptions, enumDisabled, emptyValue } = options;
873
- const handleChange = ({ target: { value: nextValue } }) => onChange(utils.enumOptionsValueForIndex(nextValue, enumOptions, emptyValue));
874
- const handleBlur = ({ target }) => onBlur(id, utils.enumOptionsValueForIndex(target && target.value, enumOptions, emptyValue));
875
- const handleFocus = ({ target }) => onFocus(id, utils.enumOptionsValueForIndex(target && target.value, enumOptions, emptyValue));
876
- const selectedIndexes = utils.enumOptionsIndexForValue(value, enumOptions);
892
+ const optionValueFormat = utils.getOptionValueFormat(options);
893
+ const handleChange = ({ target: { value: nextValue } }) => onChange(utils.enumOptionValueDecoder(nextValue, enumOptions, optionValueFormat, emptyValue));
894
+ const handleBlur = ({ target }) => onBlur(id, utils.enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue));
895
+ const handleFocus = ({ target }) => onFocus(id, utils.enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue));
896
+ const selectValue = utils.enumOptionSelectedValue(value, enumOptions, false, optionValueFormat, emptyValue);
877
897
  return /* @__PURE__ */ jsxRuntime.jsx(
878
898
  antd.Radio.Group,
879
899
  {
@@ -883,7 +903,7 @@
883
903
  onChange: !readonly ? handleChange : void 0,
884
904
  onBlur: !readonly ? handleBlur : void 0,
885
905
  onFocus: !readonly ? handleFocus : void 0,
886
- value: selectedIndexes,
906
+ value: selectValue,
887
907
  "aria-describedby": utils.ariaDescribedByIds(id),
888
908
  children: Array.isArray(enumOptions) && enumOptions.map((option, i) => /* @__PURE__ */ jsxRuntime.jsx(
889
909
  antd.Radio,
@@ -892,7 +912,7 @@
892
912
  name: htmlName || id,
893
913
  autoFocus: i === 0 ? autofocus : false,
894
914
  disabled: disabled || Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1,
895
- value: String(i),
915
+ value: utils.enumOptionValueEncoder(option.value, i, optionValueFormat),
896
916
  children: option.label
897
917
  },
898
918
  i
@@ -967,9 +987,10 @@
967
987
  const { formContext } = registry;
968
988
  const { readonlyAsDisabled = true } = formContext;
969
989
  const { enumOptions, enumDisabled, emptyValue } = options;
970
- const handleChange = (nextValue) => onChange(utils.enumOptionsValueForIndex(nextValue, enumOptions, emptyValue));
971
- const handleBlur = () => onBlur(id, utils.enumOptionsValueForIndex(value, enumOptions, emptyValue));
972
- const handleFocus = () => onFocus(id, utils.enumOptionsValueForIndex(value, enumOptions, emptyValue));
990
+ const optionValueFormat = utils.getOptionValueFormat(options);
991
+ const handleChange = (nextValue) => onChange(utils.enumOptionValueDecoder(nextValue, enumOptions, optionValueFormat, emptyValue));
992
+ const handleBlur = () => onBlur(id, utils.enumOptionValueDecoder(value, enumOptions, optionValueFormat, emptyValue));
993
+ const handleFocus = () => onFocus(id, utils.enumOptionValueDecoder(value, enumOptions, optionValueFormat, emptyValue));
973
994
  const filterOption = (input, option) => {
974
995
  if (option && isString(option.label)) {
975
996
  return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
@@ -977,7 +998,7 @@
977
998
  return false;
978
999
  };
979
1000
  const getPopupContainer = SelectWidget.getPopupContainerCallback();
980
- const selectedIndexes = utils.enumOptionsIndexForValue(value, enumOptions, multiple);
1001
+ const selectValue = utils.enumOptionSelectedValue(value, enumOptions, !!multiple, optionValueFormat, emptyValue);
981
1002
  const extraProps = {
982
1003
  name: htmlName || id
983
1004
  };
@@ -987,7 +1008,7 @@
987
1008
  const options2 = enumOptions.map(({ value: optionValue, label: optionLabel }, index) => ({
988
1009
  disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(optionValue) !== -1,
989
1010
  key: String(index),
990
- value: String(index),
1011
+ value: utils.enumOptionValueEncoder(optionValue, index, optionValueFormat),
991
1012
  label: optionLabel
992
1013
  }));
993
1014
  if (showPlaceholderOption) {
@@ -996,7 +1017,7 @@
996
1017
  return options2;
997
1018
  }
998
1019
  return void 0;
999
- }, [enumDisabled, enumOptions, placeholder, showPlaceholderOption]);
1020
+ }, [enumDisabled, enumOptions, placeholder, showPlaceholderOption, optionValueFormat]);
1000
1021
  return /* @__PURE__ */ jsxRuntime.jsx(
1001
1022
  antd.Select,
1002
1023
  {
@@ -1011,7 +1032,7 @@
1011
1032
  onFocus: !readonly ? handleFocus : void 0,
1012
1033
  placeholder,
1013
1034
  style: SELECT_STYLE,
1014
- value: selectedIndexes,
1035
+ value: selectValue,
1015
1036
  ...extraProps,
1016
1037
  onOpenChange: setOpen,
1017
1038
  filterOption,
package/dist/index.cjs CHANGED
@@ -165,6 +165,7 @@ function BaseInputTemplate(props) {
165
165
  options,
166
166
  placeholder,
167
167
  readonly,
168
+ required,
168
169
  schema,
169
170
  value,
170
171
  type
@@ -185,6 +186,7 @@ function BaseInputTemplate(props) {
185
186
  },
186
187
  [onChange, options.emptyValue]
187
188
  );
189
+ const { min, max, ...restInputProps } = inputProps;
188
190
  const input = inputProps.type === "number" || inputProps.type === "integer" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
189
191
  import_antd3.InputNumber,
190
192
  {
@@ -195,9 +197,14 @@ function BaseInputTemplate(props) {
195
197
  onChange: !readonly ? handleNumberChange : void 0,
196
198
  onFocus: !readonly ? handleFocus : void 0,
197
199
  placeholder,
200
+ required,
198
201
  style: INPUT_STYLE,
202
+ changeOnWheel: false,
199
203
  list: schema.examples ? (0, import_utils3.examplesId)(id) : void 0,
200
- ...inputProps,
204
+ ...restInputProps,
205
+ min: typeof min === "number" ? min : void 0,
206
+ max: typeof max === "number" ? max : void 0,
207
+ type: void 0,
201
208
  value,
202
209
  "aria-describedby": (0, import_utils3.ariaDescribedByIds)(id, !!schema.examples)
203
210
  }
@@ -211,6 +218,7 @@ function BaseInputTemplate(props) {
211
218
  onChange: !readonly ? handleTextChange : void 0,
212
219
  onFocus: !readonly ? handleFocus : void 0,
213
220
  placeholder,
221
+ required,
214
222
  style: INPUT_STYLE,
215
223
  list: schema.examples ? (0, import_utils3.examplesId)(id) : void 0,
216
224
  ...inputProps,
@@ -238,37 +246,41 @@ function DescriptionField(props) {
238
246
 
239
247
  // src/templates/ErrorList/index.tsx
240
248
  var import_antd4 = require("antd");
241
- var import_ExclamationCircleOutlined = __toESM(require("@ant-design/icons/ExclamationCircleOutlined"), 1);
249
+ var import_icons = require("@ant-design/icons");
242
250
  var import_utils4 = require("@rjsf/utils");
243
251
  var import_jsx_runtime5 = require("react/jsx-runtime");
252
+ var antdMajor = parseInt(import_antd4.version.split(".")[0], 10);
244
253
  function ErrorList({
245
254
  errors,
246
255
  registry
247
256
  }) {
248
257
  const { translateString } = registry;
249
- const renderErrors = () => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_antd4.List, { className: "list-group", size: "small", children: errors.map((error, index) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_antd4.List.Item, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_antd4.Space, { children: [
250
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ExclamationCircleOutlined.default, {}),
251
- error.stack
252
- ] }) }, index)) });
253
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
254
- import_antd4.Alert,
258
+ const { token } = import_antd4.theme.useToken();
259
+ const itemBorder = `${token.lineWidth}px ${token.lineType} ${token.colorSplit}`;
260
+ const renderErrors = () => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("ul", { style: { margin: 0, padding: 0, listStyle: "none" }, children: errors.map((error, index) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
261
+ "li",
255
262
  {
256
- className: "panel panel-danger errors",
257
- description: renderErrors(),
258
- message: translateString(import_utils4.TranslatableString.ErrorsLabel),
259
- type: "error"
260
- }
261
- );
263
+ style: {
264
+ display: "flex",
265
+ alignItems: "center",
266
+ padding: `${token.paddingXS}px ${token.padding}px`,
267
+ color: token.colorText,
268
+ borderBlockEnd: index < errors.length - 1 ? itemBorder : "none"
269
+ },
270
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_antd4.Space, { children: [
271
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_icons.ExclamationCircleOutlined, {}),
272
+ error.stack
273
+ ] })
274
+ },
275
+ index
276
+ )) });
277
+ const headerProp = antdMajor >= 6 ? { title: translateString(import_utils4.TranslatableString.ErrorsLabel) } : { message: translateString(import_utils4.TranslatableString.ErrorsLabel) };
278
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_antd4.Alert, { className: "panel panel-danger errors", description: renderErrors(), type: "error", ...headerProp });
262
279
  }
263
280
 
264
281
  // src/templates/IconButton/index.tsx
265
282
  var import_antd5 = require("antd");
266
- var import_ArrowDownOutlined = __toESM(require("@ant-design/icons/ArrowDownOutlined"), 1);
267
- var import_ArrowUpOutlined = __toESM(require("@ant-design/icons/ArrowUpOutlined"), 1);
268
- var import_CopyOutlined = __toESM(require("@ant-design/icons/CopyOutlined"), 1);
269
- var import_DeleteOutlined = __toESM(require("@ant-design/icons/DeleteOutlined"), 1);
270
- var import_PlusCircleOutlined = __toESM(require("@ant-design/icons/PlusCircleOutlined"), 1);
271
- var import_CloseOutlined = __toESM(require("@ant-design/icons/CloseOutlined"), 1);
283
+ var import_icons2 = require("@ant-design/icons");
272
284
  var import_utils5 = require("@rjsf/utils");
273
285
  var import_jsx_runtime6 = require("react/jsx-runtime");
274
286
  function IconButton(props) {
@@ -299,7 +311,7 @@ function AddButton(props) {
299
311
  iconType: "primary",
300
312
  block: true,
301
313
  ...props,
302
- icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_PlusCircleOutlined.default, {})
314
+ icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons2.PlusCircleOutlined, {})
303
315
  }
304
316
  );
305
317
  }
@@ -307,19 +319,19 @@ function CopyButton(props) {
307
319
  const {
308
320
  registry: { translateString }
309
321
  } = props;
310
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(IconButton, { title: translateString(import_utils5.TranslatableString.CopyButton), ...props, icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_CopyOutlined.default, {}) });
322
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(IconButton, { title: translateString(import_utils5.TranslatableString.CopyButton), ...props, icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons2.CopyOutlined, {}) });
311
323
  }
312
324
  function MoveDownButton(props) {
313
325
  const {
314
326
  registry: { translateString }
315
327
  } = props;
316
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(IconButton, { title: translateString(import_utils5.TranslatableString.MoveDownButton), ...props, icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_ArrowDownOutlined.default, {}) });
328
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(IconButton, { title: translateString(import_utils5.TranslatableString.MoveDownButton), ...props, icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons2.ArrowDownOutlined, {}) });
317
329
  }
318
330
  function MoveUpButton(props) {
319
331
  const {
320
332
  registry: { translateString }
321
333
  } = props;
322
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(IconButton, { title: translateString(import_utils5.TranslatableString.MoveUpButton), ...props, icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_ArrowUpOutlined.default, {}) });
334
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(IconButton, { title: translateString(import_utils5.TranslatableString.MoveUpButton), ...props, icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons2.ArrowUpOutlined, {}) });
323
335
  }
324
336
  function RemoveButton(props) {
325
337
  const options = (0, import_utils5.getUiOptions)(props.uiSchema);
@@ -334,7 +346,7 @@ function RemoveButton(props) {
334
346
  block: !!options.block,
335
347
  iconType: "primary",
336
348
  ...props,
337
- icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_DeleteOutlined.default, {})
349
+ icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons2.DeleteOutlined, {})
338
350
  }
339
351
  );
340
352
  }
@@ -348,7 +360,7 @@ function ClearButton(props) {
348
360
  title: translateString(import_utils5.TranslatableString.ClearButton),
349
361
  ...props,
350
362
  iconType: "link",
351
- icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_CloseOutlined.default, {})
363
+ icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons2.CloseOutlined, {})
352
364
  }
353
365
  );
354
366
  }
@@ -734,7 +746,8 @@ function WrapIfAdditionalTemplate(props) {
734
746
  onBlur: !readonly ? onKeyRenameBlur : void 0,
735
747
  style: INPUT_STYLE2,
736
748
  type: "text"
737
- }
749
+ },
750
+ label
738
751
  )
739
752
  }
740
753
  ) }) }),
@@ -847,22 +860,23 @@ function CheckboxesWidget({
847
860
  const { formContext } = registry;
848
861
  const { readonlyAsDisabled = true } = formContext;
849
862
  const { enumOptions, enumDisabled, inline, emptyValue } = options;
850
- const handleChange = (nextValue) => onChange((0, import_utils12.enumOptionsValueForIndex)(nextValue, enumOptions, emptyValue));
851
- const handleBlur = ({ target }) => onBlur(id, (0, import_utils12.enumOptionsValueForIndex)(target.value, enumOptions, emptyValue));
852
- const handleFocus = ({ target }) => onFocus(id, (0, import_utils12.enumOptionsValueForIndex)(target.value, enumOptions, emptyValue));
863
+ const optionValueFormat = (0, import_utils12.getOptionValueFormat)(options);
864
+ const handleChange = (nextValue) => onChange((0, import_utils12.enumOptionValueDecoder)(nextValue, enumOptions, optionValueFormat, emptyValue));
865
+ const handleBlur = ({ target }) => onBlur(id, (0, import_utils12.enumOptionValueDecoder)(target.value, enumOptions, optionValueFormat, emptyValue));
866
+ const handleFocus = ({ target }) => onFocus(id, (0, import_utils12.enumOptionValueDecoder)(target.value, enumOptions, optionValueFormat, emptyValue));
853
867
  const extraProps = {
854
868
  id,
855
869
  onBlur: !readonly ? handleBlur : void 0,
856
870
  onFocus: !readonly ? handleFocus : void 0
857
871
  };
858
- const selectedIndexes = (0, import_utils12.enumOptionsIndexForValue)(value, enumOptions, true);
872
+ const selectValue = (0, import_utils12.enumOptionSelectedValue)(value, enumOptions, true, optionValueFormat, []);
859
873
  return Array.isArray(enumOptions) && enumOptions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_jsx_runtime18.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
860
874
  import_antd13.Checkbox.Group,
861
875
  {
862
876
  disabled: disabled || readonlyAsDisabled && readonly,
863
877
  name: htmlName || id,
864
878
  onChange: !readonly ? handleChange : void 0,
865
- value: selectedIndexes,
879
+ value: selectValue,
866
880
  ...extraProps,
867
881
  "aria-describedby": (0, import_utils12.ariaDescribedByIds)(id),
868
882
  children: Array.isArray(enumOptions) && enumOptions.map((option, i) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { children: [
@@ -873,7 +887,7 @@ function CheckboxesWidget({
873
887
  name: htmlName || id,
874
888
  autoFocus: i === 0 ? autofocus : false,
875
889
  disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1,
876
- value: String(i),
890
+ value: (0, import_utils12.enumOptionValueEncoder)(option.value, i, optionValueFormat),
877
891
  children: option.label
878
892
  }
879
893
  ),
@@ -1032,10 +1046,11 @@ function RadioWidget({
1032
1046
  const { formContext } = registry;
1033
1047
  const { readonlyAsDisabled = true } = formContext;
1034
1048
  const { enumOptions, enumDisabled, emptyValue } = options;
1035
- const handleChange = ({ target: { value: nextValue } }) => onChange((0, import_utils17.enumOptionsValueForIndex)(nextValue, enumOptions, emptyValue));
1036
- const handleBlur = ({ target }) => onBlur(id, (0, import_utils17.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue));
1037
- const handleFocus = ({ target }) => onFocus(id, (0, import_utils17.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue));
1038
- const selectedIndexes = (0, import_utils17.enumOptionsIndexForValue)(value, enumOptions);
1049
+ const optionValueFormat = (0, import_utils17.getOptionValueFormat)(options);
1050
+ const handleChange = ({ target: { value: nextValue } }) => onChange((0, import_utils17.enumOptionValueDecoder)(nextValue, enumOptions, optionValueFormat, emptyValue));
1051
+ const handleBlur = ({ target }) => onBlur(id, (0, import_utils17.enumOptionValueDecoder)(target && target.value, enumOptions, optionValueFormat, emptyValue));
1052
+ const handleFocus = ({ target }) => onFocus(id, (0, import_utils17.enumOptionValueDecoder)(target && target.value, enumOptions, optionValueFormat, emptyValue));
1053
+ const selectValue = (0, import_utils17.enumOptionSelectedValue)(value, enumOptions, false, optionValueFormat, emptyValue);
1039
1054
  return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
1040
1055
  import_antd18.Radio.Group,
1041
1056
  {
@@ -1045,7 +1060,7 @@ function RadioWidget({
1045
1060
  onChange: !readonly ? handleChange : void 0,
1046
1061
  onBlur: !readonly ? handleBlur : void 0,
1047
1062
  onFocus: !readonly ? handleFocus : void 0,
1048
- value: selectedIndexes,
1063
+ value: selectValue,
1049
1064
  "aria-describedby": (0, import_utils17.ariaDescribedByIds)(id),
1050
1065
  children: Array.isArray(enumOptions) && enumOptions.map((option, i) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
1051
1066
  import_antd18.Radio,
@@ -1054,7 +1069,7 @@ function RadioWidget({
1054
1069
  name: htmlName || id,
1055
1070
  autoFocus: i === 0 ? autofocus : false,
1056
1071
  disabled: disabled || Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1,
1057
- value: String(i),
1072
+ value: (0, import_utils17.enumOptionValueEncoder)(option.value, i, optionValueFormat),
1058
1073
  children: option.label
1059
1074
  },
1060
1075
  i
@@ -1141,9 +1156,10 @@ function SelectWidget({
1141
1156
  const { formContext } = registry;
1142
1157
  const { readonlyAsDisabled = true } = formContext;
1143
1158
  const { enumOptions, enumDisabled, emptyValue } = options;
1144
- const handleChange = (nextValue) => onChange((0, import_utils19.enumOptionsValueForIndex)(nextValue, enumOptions, emptyValue));
1145
- const handleBlur = () => onBlur(id, (0, import_utils19.enumOptionsValueForIndex)(value, enumOptions, emptyValue));
1146
- const handleFocus = () => onFocus(id, (0, import_utils19.enumOptionsValueForIndex)(value, enumOptions, emptyValue));
1159
+ const optionValueFormat = (0, import_utils19.getOptionValueFormat)(options);
1160
+ const handleChange = (nextValue) => onChange((0, import_utils19.enumOptionValueDecoder)(nextValue, enumOptions, optionValueFormat, emptyValue));
1161
+ const handleBlur = () => onBlur(id, (0, import_utils19.enumOptionValueDecoder)(value, enumOptions, optionValueFormat, emptyValue));
1162
+ const handleFocus = () => onFocus(id, (0, import_utils19.enumOptionValueDecoder)(value, enumOptions, optionValueFormat, emptyValue));
1147
1163
  const filterOption = (input, option) => {
1148
1164
  if (option && (0, import_isString2.default)(option.label)) {
1149
1165
  return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
@@ -1151,7 +1167,7 @@ function SelectWidget({
1151
1167
  return false;
1152
1168
  };
1153
1169
  const getPopupContainer = SelectWidget.getPopupContainerCallback();
1154
- const selectedIndexes = (0, import_utils19.enumOptionsIndexForValue)(value, enumOptions, multiple);
1170
+ const selectValue = (0, import_utils19.enumOptionSelectedValue)(value, enumOptions, !!multiple, optionValueFormat, emptyValue);
1155
1171
  const extraProps = {
1156
1172
  name: htmlName || id
1157
1173
  };
@@ -1161,7 +1177,7 @@ function SelectWidget({
1161
1177
  const options2 = enumOptions.map(({ value: optionValue, label: optionLabel }, index) => ({
1162
1178
  disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(optionValue) !== -1,
1163
1179
  key: String(index),
1164
- value: String(index),
1180
+ value: (0, import_utils19.enumOptionValueEncoder)(optionValue, index, optionValueFormat),
1165
1181
  label: optionLabel
1166
1182
  }));
1167
1183
  if (showPlaceholderOption) {
@@ -1170,7 +1186,7 @@ function SelectWidget({
1170
1186
  return options2;
1171
1187
  }
1172
1188
  return void 0;
1173
- }, [enumDisabled, enumOptions, placeholder, showPlaceholderOption]);
1189
+ }, [enumDisabled, enumOptions, placeholder, showPlaceholderOption, optionValueFormat]);
1174
1190
  return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1175
1191
  import_antd20.Select,
1176
1192
  {
@@ -1185,7 +1201,7 @@ function SelectWidget({
1185
1201
  onFocus: !readonly ? handleFocus : void 0,
1186
1202
  placeholder,
1187
1203
  style: SELECT_STYLE,
1188
- value: selectedIndexes,
1204
+ value: selectValue,
1189
1205
  ...extraProps,
1190
1206
  onOpenChange: setOpen,
1191
1207
  filterOption,