@rjsf/antd 6.4.2 → 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.esm.js +73 -47
- package/dist/antd.esm.js.map +3 -3
- package/dist/antd.umd.js +61 -43
- package/dist/index.cjs +59 -46
- package/dist/index.cjs.map +3 -3
- package/lib/templates/BaseInputTemplate/index.js +2 -1
- package/lib/templates/BaseInputTemplate/index.js.map +1 -1
- package/lib/templates/ErrorList/index.js +19 -4
- package/lib/templates/ErrorList/index.js.map +1 -1
- package/lib/templates/IconButton/index.js +1 -6
- package/lib/templates/IconButton/index.js.map +1 -1
- package/lib/templates/WrapIfAdditionalTemplate/index.js +1 -1
- package/lib/templates/WrapIfAdditionalTemplate/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/widgets/CheckboxesWidget/index.js +8 -7
- package/lib/widgets/CheckboxesWidget/index.js.map +1 -1
- package/lib/widgets/RadioWidget/index.js +8 -7
- package/lib/widgets/RadioWidget/index.js.map +1 -1
- package/lib/widgets/SelectWidget/index.js +9 -8
- package/lib/widgets/SelectWidget/index.js.map +1 -1
- package/package.json +11 -11
- package/src/templates/BaseInputTemplate/index.tsx +7 -1
- package/src/templates/ErrorList/index.tsx +28 -14
- package/src/templates/IconButton/index.tsx +8 -6
- package/src/templates/WrapIfAdditionalTemplate/index.tsx +1 -0
- package/src/widgets/CheckboxesWidget/index.tsx +12 -8
- package/src/widgets/RadioWidget/index.tsx +11 -8
- package/src/widgets/SelectWidget/index.tsx +13 -9
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
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', '@rjsf/core', 'antd', '@rjsf/utils', 'react/jsx-runtime', 'classnames', 'react', '@ant-design/icons
|
|
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.
|
|
5
|
-
})(this, (function (exports, core, antd, utils, jsxRuntime, classNames, react,
|
|
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 = {
|
|
@@ -130,6 +130,7 @@
|
|
|
130
130
|
},
|
|
131
131
|
[onChange, options.emptyValue]
|
|
132
132
|
);
|
|
133
|
+
const { min, max, ...restInputProps } = inputProps;
|
|
133
134
|
const input = inputProps.type === "number" || inputProps.type === "integer" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
134
135
|
antd.InputNumber,
|
|
135
136
|
{
|
|
@@ -142,8 +143,12 @@
|
|
|
142
143
|
placeholder,
|
|
143
144
|
required,
|
|
144
145
|
style: INPUT_STYLE,
|
|
146
|
+
changeOnWheel: false,
|
|
145
147
|
list: schema.examples ? utils.examplesId(id) : void 0,
|
|
146
|
-
...
|
|
148
|
+
...restInputProps,
|
|
149
|
+
min: typeof min === "number" ? min : void 0,
|
|
150
|
+
max: typeof max === "number" ? max : void 0,
|
|
151
|
+
type: void 0,
|
|
147
152
|
value,
|
|
148
153
|
"aria-describedby": utils.ariaDescribedByIds(id, !!schema.examples)
|
|
149
154
|
}
|
|
@@ -178,24 +183,33 @@
|
|
|
178
183
|
}
|
|
179
184
|
return /* @__PURE__ */ jsxRuntime.jsx("span", { id, children: /* @__PURE__ */ jsxRuntime.jsx(core.RichDescription, { description, registry, uiSchema }) });
|
|
180
185
|
}
|
|
186
|
+
var antdMajor = parseInt(antd.version.split(".")[0], 10);
|
|
181
187
|
function ErrorList({
|
|
182
188
|
errors,
|
|
183
189
|
registry
|
|
184
190
|
}) {
|
|
185
191
|
const { translateString } = registry;
|
|
186
|
-
const
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
191
|
-
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",
|
|
192
196
|
{
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
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 });
|
|
199
213
|
}
|
|
200
214
|
function IconButton(props) {
|
|
201
215
|
const { iconType = "default", icon, onClick, uiSchema, registry, color, ...otherProps } = props;
|
|
@@ -225,7 +239,7 @@
|
|
|
225
239
|
iconType: "primary",
|
|
226
240
|
block: true,
|
|
227
241
|
...props,
|
|
228
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(PlusCircleOutlined, {})
|
|
242
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.PlusCircleOutlined, {})
|
|
229
243
|
}
|
|
230
244
|
);
|
|
231
245
|
}
|
|
@@ -233,19 +247,19 @@
|
|
|
233
247
|
const {
|
|
234
248
|
registry: { translateString }
|
|
235
249
|
} = props;
|
|
236
|
-
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, {}) });
|
|
237
251
|
}
|
|
238
252
|
function MoveDownButton(props) {
|
|
239
253
|
const {
|
|
240
254
|
registry: { translateString }
|
|
241
255
|
} = props;
|
|
242
|
-
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, {}) });
|
|
243
257
|
}
|
|
244
258
|
function MoveUpButton(props) {
|
|
245
259
|
const {
|
|
246
260
|
registry: { translateString }
|
|
247
261
|
} = props;
|
|
248
|
-
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, {}) });
|
|
249
263
|
}
|
|
250
264
|
function RemoveButton(props) {
|
|
251
265
|
const options = utils.getUiOptions(props.uiSchema);
|
|
@@ -260,7 +274,7 @@
|
|
|
260
274
|
block: !!options.block,
|
|
261
275
|
iconType: "primary",
|
|
262
276
|
...props,
|
|
263
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(DeleteOutlined, {})
|
|
277
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.DeleteOutlined, {})
|
|
264
278
|
}
|
|
265
279
|
);
|
|
266
280
|
}
|
|
@@ -274,7 +288,7 @@
|
|
|
274
288
|
title: translateString(utils.TranslatableString.ClearButton),
|
|
275
289
|
...props,
|
|
276
290
|
iconType: "link",
|
|
277
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(CloseOutlined, {})
|
|
291
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.CloseOutlined, {})
|
|
278
292
|
}
|
|
279
293
|
);
|
|
280
294
|
}
|
|
@@ -615,7 +629,8 @@
|
|
|
615
629
|
onBlur: !readonly ? onKeyRenameBlur : void 0,
|
|
616
630
|
style: INPUT_STYLE2,
|
|
617
631
|
type: "text"
|
|
618
|
-
}
|
|
632
|
+
},
|
|
633
|
+
label
|
|
619
634
|
)
|
|
620
635
|
}
|
|
621
636
|
) }) }),
|
|
@@ -715,22 +730,23 @@
|
|
|
715
730
|
const { formContext } = registry;
|
|
716
731
|
const { readonlyAsDisabled = true } = formContext;
|
|
717
732
|
const { enumOptions, enumDisabled, inline, emptyValue } = options;
|
|
718
|
-
const
|
|
719
|
-
const
|
|
720
|
-
const
|
|
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));
|
|
721
737
|
const extraProps = {
|
|
722
738
|
id,
|
|
723
739
|
onBlur: !readonly ? handleBlur : void 0,
|
|
724
740
|
onFocus: !readonly ? handleFocus : void 0
|
|
725
741
|
};
|
|
726
|
-
const
|
|
742
|
+
const selectValue = utils.enumOptionSelectedValue(value, enumOptions, true, optionValueFormat, []);
|
|
727
743
|
return Array.isArray(enumOptions) && enumOptions.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
728
744
|
antd.Checkbox.Group,
|
|
729
745
|
{
|
|
730
746
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
731
747
|
name: htmlName || id,
|
|
732
748
|
onChange: !readonly ? handleChange : void 0,
|
|
733
|
-
value:
|
|
749
|
+
value: selectValue,
|
|
734
750
|
...extraProps,
|
|
735
751
|
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
736
752
|
children: Array.isArray(enumOptions) && enumOptions.map((option, i) => /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
@@ -741,7 +757,7 @@
|
|
|
741
757
|
name: htmlName || id,
|
|
742
758
|
autoFocus: i === 0 ? autofocus : false,
|
|
743
759
|
disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1,
|
|
744
|
-
value:
|
|
760
|
+
value: utils.enumOptionValueEncoder(option.value, i, optionValueFormat),
|
|
745
761
|
children: option.label
|
|
746
762
|
}
|
|
747
763
|
),
|
|
@@ -873,10 +889,11 @@
|
|
|
873
889
|
const { formContext } = registry;
|
|
874
890
|
const { readonlyAsDisabled = true } = formContext;
|
|
875
891
|
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
876
|
-
const
|
|
877
|
-
const
|
|
878
|
-
const
|
|
879
|
-
const
|
|
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);
|
|
880
897
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
881
898
|
antd.Radio.Group,
|
|
882
899
|
{
|
|
@@ -886,7 +903,7 @@
|
|
|
886
903
|
onChange: !readonly ? handleChange : void 0,
|
|
887
904
|
onBlur: !readonly ? handleBlur : void 0,
|
|
888
905
|
onFocus: !readonly ? handleFocus : void 0,
|
|
889
|
-
value:
|
|
906
|
+
value: selectValue,
|
|
890
907
|
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
891
908
|
children: Array.isArray(enumOptions) && enumOptions.map((option, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
892
909
|
antd.Radio,
|
|
@@ -895,7 +912,7 @@
|
|
|
895
912
|
name: htmlName || id,
|
|
896
913
|
autoFocus: i === 0 ? autofocus : false,
|
|
897
914
|
disabled: disabled || Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1,
|
|
898
|
-
value:
|
|
915
|
+
value: utils.enumOptionValueEncoder(option.value, i, optionValueFormat),
|
|
899
916
|
children: option.label
|
|
900
917
|
},
|
|
901
918
|
i
|
|
@@ -970,9 +987,10 @@
|
|
|
970
987
|
const { formContext } = registry;
|
|
971
988
|
const { readonlyAsDisabled = true } = formContext;
|
|
972
989
|
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
973
|
-
const
|
|
974
|
-
const
|
|
975
|
-
const
|
|
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));
|
|
976
994
|
const filterOption = (input, option) => {
|
|
977
995
|
if (option && isString(option.label)) {
|
|
978
996
|
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
|
@@ -980,7 +998,7 @@
|
|
|
980
998
|
return false;
|
|
981
999
|
};
|
|
982
1000
|
const getPopupContainer = SelectWidget.getPopupContainerCallback();
|
|
983
|
-
const
|
|
1001
|
+
const selectValue = utils.enumOptionSelectedValue(value, enumOptions, !!multiple, optionValueFormat, emptyValue);
|
|
984
1002
|
const extraProps = {
|
|
985
1003
|
name: htmlName || id
|
|
986
1004
|
};
|
|
@@ -990,7 +1008,7 @@
|
|
|
990
1008
|
const options2 = enumOptions.map(({ value: optionValue, label: optionLabel }, index) => ({
|
|
991
1009
|
disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(optionValue) !== -1,
|
|
992
1010
|
key: String(index),
|
|
993
|
-
value:
|
|
1011
|
+
value: utils.enumOptionValueEncoder(optionValue, index, optionValueFormat),
|
|
994
1012
|
label: optionLabel
|
|
995
1013
|
}));
|
|
996
1014
|
if (showPlaceholderOption) {
|
|
@@ -999,7 +1017,7 @@
|
|
|
999
1017
|
return options2;
|
|
1000
1018
|
}
|
|
1001
1019
|
return void 0;
|
|
1002
|
-
}, [enumDisabled, enumOptions, placeholder, showPlaceholderOption]);
|
|
1020
|
+
}, [enumDisabled, enumOptions, placeholder, showPlaceholderOption, optionValueFormat]);
|
|
1003
1021
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1004
1022
|
antd.Select,
|
|
1005
1023
|
{
|
|
@@ -1014,7 +1032,7 @@
|
|
|
1014
1032
|
onFocus: !readonly ? handleFocus : void 0,
|
|
1015
1033
|
placeholder,
|
|
1016
1034
|
style: SELECT_STYLE,
|
|
1017
|
-
value:
|
|
1035
|
+
value: selectValue,
|
|
1018
1036
|
...extraProps,
|
|
1019
1037
|
onOpenChange: setOpen,
|
|
1020
1038
|
filterOption,
|
package/dist/index.cjs
CHANGED
|
@@ -186,6 +186,7 @@ function BaseInputTemplate(props) {
|
|
|
186
186
|
},
|
|
187
187
|
[onChange, options.emptyValue]
|
|
188
188
|
);
|
|
189
|
+
const { min, max, ...restInputProps } = inputProps;
|
|
189
190
|
const input = inputProps.type === "number" || inputProps.type === "integer" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
190
191
|
import_antd3.InputNumber,
|
|
191
192
|
{
|
|
@@ -198,8 +199,12 @@ function BaseInputTemplate(props) {
|
|
|
198
199
|
placeholder,
|
|
199
200
|
required,
|
|
200
201
|
style: INPUT_STYLE,
|
|
202
|
+
changeOnWheel: false,
|
|
201
203
|
list: schema.examples ? (0, import_utils3.examplesId)(id) : void 0,
|
|
202
|
-
...
|
|
204
|
+
...restInputProps,
|
|
205
|
+
min: typeof min === "number" ? min : void 0,
|
|
206
|
+
max: typeof max === "number" ? max : void 0,
|
|
207
|
+
type: void 0,
|
|
203
208
|
value,
|
|
204
209
|
"aria-describedby": (0, import_utils3.ariaDescribedByIds)(id, !!schema.examples)
|
|
205
210
|
}
|
|
@@ -241,37 +246,41 @@ function DescriptionField(props) {
|
|
|
241
246
|
|
|
242
247
|
// src/templates/ErrorList/index.tsx
|
|
243
248
|
var import_antd4 = require("antd");
|
|
244
|
-
var
|
|
249
|
+
var import_icons = require("@ant-design/icons");
|
|
245
250
|
var import_utils4 = require("@rjsf/utils");
|
|
246
251
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
252
|
+
var antdMajor = parseInt(import_antd4.version.split(".")[0], 10);
|
|
247
253
|
function ErrorList({
|
|
248
254
|
errors,
|
|
249
255
|
registry
|
|
250
256
|
}) {
|
|
251
257
|
const { translateString } = registry;
|
|
252
|
-
const
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
257
|
-
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",
|
|
258
262
|
{
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
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 });
|
|
265
279
|
}
|
|
266
280
|
|
|
267
281
|
// src/templates/IconButton/index.tsx
|
|
268
282
|
var import_antd5 = require("antd");
|
|
269
|
-
var
|
|
270
|
-
var import_ArrowUpOutlined = __toESM(require("@ant-design/icons/ArrowUpOutlined"), 1);
|
|
271
|
-
var import_CopyOutlined = __toESM(require("@ant-design/icons/CopyOutlined"), 1);
|
|
272
|
-
var import_DeleteOutlined = __toESM(require("@ant-design/icons/DeleteOutlined"), 1);
|
|
273
|
-
var import_PlusCircleOutlined = __toESM(require("@ant-design/icons/PlusCircleOutlined"), 1);
|
|
274
|
-
var import_CloseOutlined = __toESM(require("@ant-design/icons/CloseOutlined"), 1);
|
|
283
|
+
var import_icons2 = require("@ant-design/icons");
|
|
275
284
|
var import_utils5 = require("@rjsf/utils");
|
|
276
285
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
277
286
|
function IconButton(props) {
|
|
@@ -302,7 +311,7 @@ function AddButton(props) {
|
|
|
302
311
|
iconType: "primary",
|
|
303
312
|
block: true,
|
|
304
313
|
...props,
|
|
305
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
314
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons2.PlusCircleOutlined, {})
|
|
306
315
|
}
|
|
307
316
|
);
|
|
308
317
|
}
|
|
@@ -310,19 +319,19 @@ function CopyButton(props) {
|
|
|
310
319
|
const {
|
|
311
320
|
registry: { translateString }
|
|
312
321
|
} = props;
|
|
313
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(IconButton, { title: translateString(import_utils5.TranslatableString.CopyButton), ...props, icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
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, {}) });
|
|
314
323
|
}
|
|
315
324
|
function MoveDownButton(props) {
|
|
316
325
|
const {
|
|
317
326
|
registry: { translateString }
|
|
318
327
|
} = props;
|
|
319
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(IconButton, { title: translateString(import_utils5.TranslatableString.MoveDownButton), ...props, icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
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, {}) });
|
|
320
329
|
}
|
|
321
330
|
function MoveUpButton(props) {
|
|
322
331
|
const {
|
|
323
332
|
registry: { translateString }
|
|
324
333
|
} = props;
|
|
325
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(IconButton, { title: translateString(import_utils5.TranslatableString.MoveUpButton), ...props, icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
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, {}) });
|
|
326
335
|
}
|
|
327
336
|
function RemoveButton(props) {
|
|
328
337
|
const options = (0, import_utils5.getUiOptions)(props.uiSchema);
|
|
@@ -337,7 +346,7 @@ function RemoveButton(props) {
|
|
|
337
346
|
block: !!options.block,
|
|
338
347
|
iconType: "primary",
|
|
339
348
|
...props,
|
|
340
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
349
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons2.DeleteOutlined, {})
|
|
341
350
|
}
|
|
342
351
|
);
|
|
343
352
|
}
|
|
@@ -351,7 +360,7 @@ function ClearButton(props) {
|
|
|
351
360
|
title: translateString(import_utils5.TranslatableString.ClearButton),
|
|
352
361
|
...props,
|
|
353
362
|
iconType: "link",
|
|
354
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
363
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons2.CloseOutlined, {})
|
|
355
364
|
}
|
|
356
365
|
);
|
|
357
366
|
}
|
|
@@ -737,7 +746,8 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
737
746
|
onBlur: !readonly ? onKeyRenameBlur : void 0,
|
|
738
747
|
style: INPUT_STYLE2,
|
|
739
748
|
type: "text"
|
|
740
|
-
}
|
|
749
|
+
},
|
|
750
|
+
label
|
|
741
751
|
)
|
|
742
752
|
}
|
|
743
753
|
) }) }),
|
|
@@ -850,22 +860,23 @@ function CheckboxesWidget({
|
|
|
850
860
|
const { formContext } = registry;
|
|
851
861
|
const { readonlyAsDisabled = true } = formContext;
|
|
852
862
|
const { enumOptions, enumDisabled, inline, emptyValue } = options;
|
|
853
|
-
const
|
|
854
|
-
const
|
|
855
|
-
const
|
|
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));
|
|
856
867
|
const extraProps = {
|
|
857
868
|
id,
|
|
858
869
|
onBlur: !readonly ? handleBlur : void 0,
|
|
859
870
|
onFocus: !readonly ? handleFocus : void 0
|
|
860
871
|
};
|
|
861
|
-
const
|
|
872
|
+
const selectValue = (0, import_utils12.enumOptionSelectedValue)(value, enumOptions, true, optionValueFormat, []);
|
|
862
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)(
|
|
863
874
|
import_antd13.Checkbox.Group,
|
|
864
875
|
{
|
|
865
876
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
866
877
|
name: htmlName || id,
|
|
867
878
|
onChange: !readonly ? handleChange : void 0,
|
|
868
|
-
value:
|
|
879
|
+
value: selectValue,
|
|
869
880
|
...extraProps,
|
|
870
881
|
"aria-describedby": (0, import_utils12.ariaDescribedByIds)(id),
|
|
871
882
|
children: Array.isArray(enumOptions) && enumOptions.map((option, i) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { children: [
|
|
@@ -876,7 +887,7 @@ function CheckboxesWidget({
|
|
|
876
887
|
name: htmlName || id,
|
|
877
888
|
autoFocus: i === 0 ? autofocus : false,
|
|
878
889
|
disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1,
|
|
879
|
-
value:
|
|
890
|
+
value: (0, import_utils12.enumOptionValueEncoder)(option.value, i, optionValueFormat),
|
|
880
891
|
children: option.label
|
|
881
892
|
}
|
|
882
893
|
),
|
|
@@ -1035,10 +1046,11 @@ function RadioWidget({
|
|
|
1035
1046
|
const { formContext } = registry;
|
|
1036
1047
|
const { readonlyAsDisabled = true } = formContext;
|
|
1037
1048
|
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
1038
|
-
const
|
|
1039
|
-
const
|
|
1040
|
-
const
|
|
1041
|
-
const
|
|
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);
|
|
1042
1054
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1043
1055
|
import_antd18.Radio.Group,
|
|
1044
1056
|
{
|
|
@@ -1048,7 +1060,7 @@ function RadioWidget({
|
|
|
1048
1060
|
onChange: !readonly ? handleChange : void 0,
|
|
1049
1061
|
onBlur: !readonly ? handleBlur : void 0,
|
|
1050
1062
|
onFocus: !readonly ? handleFocus : void 0,
|
|
1051
|
-
value:
|
|
1063
|
+
value: selectValue,
|
|
1052
1064
|
"aria-describedby": (0, import_utils17.ariaDescribedByIds)(id),
|
|
1053
1065
|
children: Array.isArray(enumOptions) && enumOptions.map((option, i) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1054
1066
|
import_antd18.Radio,
|
|
@@ -1057,7 +1069,7 @@ function RadioWidget({
|
|
|
1057
1069
|
name: htmlName || id,
|
|
1058
1070
|
autoFocus: i === 0 ? autofocus : false,
|
|
1059
1071
|
disabled: disabled || Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1,
|
|
1060
|
-
value:
|
|
1072
|
+
value: (0, import_utils17.enumOptionValueEncoder)(option.value, i, optionValueFormat),
|
|
1061
1073
|
children: option.label
|
|
1062
1074
|
},
|
|
1063
1075
|
i
|
|
@@ -1144,9 +1156,10 @@ function SelectWidget({
|
|
|
1144
1156
|
const { formContext } = registry;
|
|
1145
1157
|
const { readonlyAsDisabled = true } = formContext;
|
|
1146
1158
|
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
1147
|
-
const
|
|
1148
|
-
const
|
|
1149
|
-
const
|
|
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));
|
|
1150
1163
|
const filterOption = (input, option) => {
|
|
1151
1164
|
if (option && (0, import_isString2.default)(option.label)) {
|
|
1152
1165
|
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
|
@@ -1154,7 +1167,7 @@ function SelectWidget({
|
|
|
1154
1167
|
return false;
|
|
1155
1168
|
};
|
|
1156
1169
|
const getPopupContainer = SelectWidget.getPopupContainerCallback();
|
|
1157
|
-
const
|
|
1170
|
+
const selectValue = (0, import_utils19.enumOptionSelectedValue)(value, enumOptions, !!multiple, optionValueFormat, emptyValue);
|
|
1158
1171
|
const extraProps = {
|
|
1159
1172
|
name: htmlName || id
|
|
1160
1173
|
};
|
|
@@ -1164,7 +1177,7 @@ function SelectWidget({
|
|
|
1164
1177
|
const options2 = enumOptions.map(({ value: optionValue, label: optionLabel }, index) => ({
|
|
1165
1178
|
disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(optionValue) !== -1,
|
|
1166
1179
|
key: String(index),
|
|
1167
|
-
value:
|
|
1180
|
+
value: (0, import_utils19.enumOptionValueEncoder)(optionValue, index, optionValueFormat),
|
|
1168
1181
|
label: optionLabel
|
|
1169
1182
|
}));
|
|
1170
1183
|
if (showPlaceholderOption) {
|
|
@@ -1173,7 +1186,7 @@ function SelectWidget({
|
|
|
1173
1186
|
return options2;
|
|
1174
1187
|
}
|
|
1175
1188
|
return void 0;
|
|
1176
|
-
}, [enumDisabled, enumOptions, placeholder, showPlaceholderOption]);
|
|
1189
|
+
}, [enumDisabled, enumOptions, placeholder, showPlaceholderOption, optionValueFormat]);
|
|
1177
1190
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1178
1191
|
import_antd20.Select,
|
|
1179
1192
|
{
|
|
@@ -1188,7 +1201,7 @@ function SelectWidget({
|
|
|
1188
1201
|
onFocus: !readonly ? handleFocus : void 0,
|
|
1189
1202
|
placeholder,
|
|
1190
1203
|
style: SELECT_STYLE,
|
|
1191
|
-
value:
|
|
1204
|
+
value: selectValue,
|
|
1192
1205
|
...extraProps,
|
|
1193
1206
|
onOpenChange: setOpen,
|
|
1194
1207
|
filterOption,
|