@rjsf/antd 5.3.0 → 5.4.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.cjs.development.js +130 -67
- package/dist/antd.cjs.development.js.map +1 -1
- package/dist/antd.cjs.production.min.js +1 -1
- package/dist/antd.cjs.production.min.js.map +1 -1
- package/dist/antd.esm.js +131 -68
- package/dist/antd.esm.js.map +1 -1
- package/dist/antd.umd.development.js +130 -67
- package/dist/antd.umd.development.js.map +1 -1
- package/dist/antd.umd.production.min.js +1 -1
- package/dist/antd.umd.production.min.js.map +1 -1
- package/package.json +6 -7
package/dist/antd.esm.js
CHANGED
|
@@ -3,7 +3,7 @@ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
|
3
3
|
import Button from 'antd/es/button';
|
|
4
4
|
import Col from 'antd/es/col';
|
|
5
5
|
import Row from 'antd/es/row';
|
|
6
|
-
import { getUiOptions, getTemplate, getInputProps, ariaDescribedByIds, examplesId, TranslatableString, errorId, titleId, descriptionId, canExpand, getSubmitButtonOptions, UI_OPTIONS_KEY, ADDITIONAL_PROPERTY_FLAG, parseDateString, toDateString, pad, enumOptionsIndexForValue, optionId, enumOptionsValueForIndex, rangeSpec } from '@rjsf/utils';
|
|
6
|
+
import { getUiOptions, getTemplate, getInputProps, ariaDescribedByIds, examplesId, TranslatableString, errorId, titleId, descriptionId, canExpand, getSubmitButtonOptions, UI_OPTIONS_KEY, ADDITIONAL_PROPERTY_FLAG, parseDateString, toDateString, pad, enumOptionsIndexForValue, optionId, enumOptionsValueForIndex, labelValue, rangeSpec } from '@rjsf/utils';
|
|
7
7
|
import classNames from 'classnames';
|
|
8
8
|
import { ConfigConsumer } from 'antd/es/config-provider/context';
|
|
9
9
|
import Input from 'antd/es/input';
|
|
@@ -193,7 +193,7 @@ function ArrayFieldTemplate(props) {
|
|
|
193
193
|
span: 24,
|
|
194
194
|
style: DESCRIPTION_COL_STYLE$1,
|
|
195
195
|
children: jsx(ArrayFieldDescriptionTemplate, {
|
|
196
|
-
description: uiOptions.description || schema.description
|
|
196
|
+
description: uiOptions.description || schema.description,
|
|
197
197
|
idSchema: idSchema,
|
|
198
198
|
schema: schema,
|
|
199
199
|
uiSchema: uiSchema,
|
|
@@ -475,7 +475,9 @@ function FieldTemplate(props) {
|
|
|
475
475
|
labelCol = _formContext$labelCol === void 0 ? VERTICAL_LABEL_COL$1 : _formContext$labelCol,
|
|
476
476
|
_formContext$wrapperC = formContext.wrapperCol,
|
|
477
477
|
wrapperCol = _formContext$wrapperC === void 0 ? VERTICAL_WRAPPER_COL$1 : _formContext$wrapperC,
|
|
478
|
-
wrapperStyle = formContext.wrapperStyle
|
|
478
|
+
wrapperStyle = formContext.wrapperStyle,
|
|
479
|
+
_formContext$descript = formContext.descriptionLocation,
|
|
480
|
+
descriptionLocation = _formContext$descript === void 0 ? 'below' : _formContext$descript;
|
|
479
481
|
var uiOptions = getUiOptions(uiSchema);
|
|
480
482
|
var WrapIfAdditionalTemplate = getTemplate('WrapIfAdditionalTemplate', registry, uiOptions);
|
|
481
483
|
if (hidden) {
|
|
@@ -484,6 +486,19 @@ function FieldTemplate(props) {
|
|
|
484
486
|
children: children
|
|
485
487
|
});
|
|
486
488
|
}
|
|
489
|
+
// check to see if there is rawDescription(string) before using description(ReactNode)
|
|
490
|
+
// to prevent showing a blank description area
|
|
491
|
+
var descriptionNode = rawDescription ? description : undefined;
|
|
492
|
+
var descriptionProps = {};
|
|
493
|
+
switch (descriptionLocation) {
|
|
494
|
+
case 'tooltip':
|
|
495
|
+
descriptionProps.tooltip = descriptionNode;
|
|
496
|
+
break;
|
|
497
|
+
case 'below':
|
|
498
|
+
default:
|
|
499
|
+
descriptionProps.extra = descriptionNode;
|
|
500
|
+
break;
|
|
501
|
+
}
|
|
487
502
|
return jsx(WrapIfAdditionalTemplate, {
|
|
488
503
|
classNames: classNames,
|
|
489
504
|
style: style,
|
|
@@ -497,9 +512,8 @@ function FieldTemplate(props) {
|
|
|
497
512
|
schema: schema,
|
|
498
513
|
uiSchema: uiSchema,
|
|
499
514
|
registry: registry,
|
|
500
|
-
children: id === 'root' ? children : jsx(Form$1.Item, {
|
|
515
|
+
children: id === 'root' ? children : jsx(Form$1.Item, _extends({
|
|
501
516
|
colon: colon,
|
|
502
|
-
extra: rawDescription && description,
|
|
503
517
|
hasFeedback: schema.type !== 'array' && schema.type !== 'object',
|
|
504
518
|
help: !!rawHelp && help || (rawErrors !== null && rawErrors !== void 0 && rawErrors.length ? errors : undefined),
|
|
505
519
|
htmlFor: id,
|
|
@@ -508,9 +522,10 @@ function FieldTemplate(props) {
|
|
|
508
522
|
required: required,
|
|
509
523
|
style: wrapperStyle,
|
|
510
524
|
validateStatus: rawErrors !== null && rawErrors !== void 0 && rawErrors.length ? 'error' : undefined,
|
|
511
|
-
wrapperCol: wrapperCol
|
|
525
|
+
wrapperCol: wrapperCol
|
|
526
|
+
}, descriptionProps, {
|
|
512
527
|
children: children
|
|
513
|
-
})
|
|
528
|
+
}))
|
|
514
529
|
});
|
|
515
530
|
}
|
|
516
531
|
|
|
@@ -600,23 +615,23 @@ function ObjectFieldTemplate(props) {
|
|
|
600
615
|
id: idSchema.$id,
|
|
601
616
|
children: [jsxs(Row, {
|
|
602
617
|
gutter: rowGutter,
|
|
603
|
-
children: [
|
|
618
|
+
children: [title && jsx(Col, {
|
|
604
619
|
className: labelColClassName,
|
|
605
620
|
span: 24,
|
|
606
621
|
children: jsx(TitleFieldTemplate, {
|
|
607
622
|
id: titleId(idSchema),
|
|
608
|
-
title:
|
|
623
|
+
title: title,
|
|
609
624
|
required: required,
|
|
610
625
|
schema: schema,
|
|
611
626
|
uiSchema: uiSchema,
|
|
612
627
|
registry: registry
|
|
613
628
|
})
|
|
614
|
-
}),
|
|
629
|
+
}), description && jsx(Col, {
|
|
615
630
|
span: 24,
|
|
616
631
|
style: DESCRIPTION_COL_STYLE,
|
|
617
632
|
children: jsx(DescriptionFieldTemplate, {
|
|
618
633
|
id: descriptionId(idSchema),
|
|
619
|
-
description:
|
|
634
|
+
description: description,
|
|
620
635
|
schema: schema,
|
|
621
636
|
uiSchema: uiSchema,
|
|
622
637
|
registry: registry
|
|
@@ -1053,14 +1068,20 @@ function CheckboxesWidget(_ref) {
|
|
|
1053
1068
|
disabled = _ref.disabled,
|
|
1054
1069
|
formContext = _ref.formContext,
|
|
1055
1070
|
id = _ref.id,
|
|
1071
|
+
label = _ref.label,
|
|
1072
|
+
hideLabel = _ref.hideLabel,
|
|
1056
1073
|
onBlur = _ref.onBlur,
|
|
1057
1074
|
onChange = _ref.onChange,
|
|
1058
1075
|
onFocus = _ref.onFocus,
|
|
1059
1076
|
options = _ref.options,
|
|
1060
1077
|
readonly = _ref.readonly,
|
|
1078
|
+
registry = _ref.registry,
|
|
1079
|
+
schema = _ref.schema,
|
|
1080
|
+
uiSchema = _ref.uiSchema,
|
|
1061
1081
|
value = _ref.value;
|
|
1062
1082
|
var _formContext$readonly = formContext.readonlyAsDisabled,
|
|
1063
1083
|
readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
|
|
1084
|
+
var TitleFieldTemplate = getTemplate('TitleFieldTemplate', registry, options);
|
|
1064
1085
|
var enumOptions = options.enumOptions,
|
|
1065
1086
|
enumDisabled = options.enumDisabled,
|
|
1066
1087
|
inline = options.inline,
|
|
@@ -1084,26 +1105,36 @@ function CheckboxesWidget(_ref) {
|
|
|
1084
1105
|
onFocus: !readonly ? handleFocus : undefined
|
|
1085
1106
|
};
|
|
1086
1107
|
var selectedIndexes = enumOptionsIndexForValue(value, enumOptions, true);
|
|
1087
|
-
return Array.isArray(enumOptions) && enumOptions.length > 0 ?
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1108
|
+
return Array.isArray(enumOptions) && enumOptions.length > 0 ? jsxs(Fragment, {
|
|
1109
|
+
children: [!hideLabel && !!label && jsx("div", {
|
|
1110
|
+
children: jsx(TitleFieldTemplate, {
|
|
1111
|
+
id: titleId(id),
|
|
1112
|
+
title: label,
|
|
1113
|
+
schema: schema,
|
|
1114
|
+
uiSchema: uiSchema,
|
|
1115
|
+
registry: registry
|
|
1116
|
+
})
|
|
1117
|
+
}), jsx(Checkbox.Group, _extends({
|
|
1118
|
+
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1119
|
+
name: id,
|
|
1120
|
+
onChange: !readonly ? handleChange : undefined,
|
|
1121
|
+
value: selectedIndexes
|
|
1122
|
+
}, extraProps, {
|
|
1123
|
+
"aria-describedby": ariaDescribedByIds(id),
|
|
1124
|
+
children: Array.isArray(enumOptions) && enumOptions.map(function (option, i) {
|
|
1125
|
+
return jsxs("span", {
|
|
1126
|
+
children: [jsx(Checkbox, {
|
|
1127
|
+
id: optionId(id, i),
|
|
1128
|
+
name: id,
|
|
1129
|
+
autoFocus: i === 0 ? autofocus : false,
|
|
1130
|
+
disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(value) !== -1,
|
|
1131
|
+
value: String(i),
|
|
1132
|
+
children: option.label
|
|
1133
|
+
}), !inline && jsx("br", {})]
|
|
1134
|
+
}, i);
|
|
1135
|
+
})
|
|
1136
|
+
}))]
|
|
1137
|
+
}) : null;
|
|
1107
1138
|
}
|
|
1108
1139
|
|
|
1109
1140
|
/** The `CheckBoxWidget` is a widget for rendering boolean properties.
|
|
@@ -1112,18 +1143,25 @@ function CheckboxesWidget(_ref) {
|
|
|
1112
1143
|
* @param props - The `WidgetProps` for this component
|
|
1113
1144
|
*/
|
|
1114
1145
|
function CheckboxWidget(props) {
|
|
1146
|
+
var _options$description;
|
|
1115
1147
|
var autofocus = props.autofocus,
|
|
1116
1148
|
disabled = props.disabled,
|
|
1117
1149
|
formContext = props.formContext,
|
|
1118
1150
|
id = props.id,
|
|
1119
1151
|
label = props.label,
|
|
1152
|
+
hideLabel = props.hideLabel,
|
|
1120
1153
|
onBlur = props.onBlur,
|
|
1121
1154
|
onChange = props.onChange,
|
|
1122
1155
|
onFocus = props.onFocus,
|
|
1123
1156
|
readonly = props.readonly,
|
|
1124
|
-
value = props.value
|
|
1157
|
+
value = props.value,
|
|
1158
|
+
registry = props.registry,
|
|
1159
|
+
options = props.options,
|
|
1160
|
+
schema = props.schema,
|
|
1161
|
+
uiSchema = props.uiSchema;
|
|
1125
1162
|
var _formContext$readonly = formContext.readonlyAsDisabled,
|
|
1126
1163
|
readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
|
|
1164
|
+
var DescriptionFieldTemplate = getTemplate('DescriptionFieldTemplate', registry, options);
|
|
1127
1165
|
var handleChange = function handleChange(_ref) {
|
|
1128
1166
|
var target = _ref.target;
|
|
1129
1167
|
return onChange(target.checked);
|
|
@@ -1142,17 +1180,28 @@ function CheckboxWidget(props) {
|
|
|
1142
1180
|
onBlur: !readonly ? handleBlur : undefined,
|
|
1143
1181
|
onFocus: !readonly ? handleFocus : undefined
|
|
1144
1182
|
};
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1183
|
+
var description = (_options$description = options.description) != null ? _options$description : schema.description;
|
|
1184
|
+
return jsxs(Fragment, {
|
|
1185
|
+
children: [!hideLabel && !!description && jsx("div", {
|
|
1186
|
+
children: jsx(DescriptionFieldTemplate, {
|
|
1187
|
+
id: descriptionId(id),
|
|
1188
|
+
description: description,
|
|
1189
|
+
schema: schema,
|
|
1190
|
+
uiSchema: uiSchema,
|
|
1191
|
+
registry: registry
|
|
1192
|
+
})
|
|
1193
|
+
}), jsx(Checkbox, _extends({
|
|
1194
|
+
autoFocus: autofocus,
|
|
1195
|
+
checked: typeof value === 'undefined' ? false : value,
|
|
1196
|
+
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1197
|
+
id: id,
|
|
1198
|
+
name: id,
|
|
1199
|
+
onChange: !readonly ? handleChange : undefined
|
|
1200
|
+
}, extraProps, {
|
|
1201
|
+
"aria-describedby": ariaDescribedByIds(id),
|
|
1202
|
+
children: labelValue(label, hideLabel, '')
|
|
1203
|
+
}))]
|
|
1204
|
+
});
|
|
1156
1205
|
}
|
|
1157
1206
|
|
|
1158
1207
|
var DatePicker = /*#__PURE__*/generatePicker(dayjsGenerateConfig);
|
|
@@ -1422,6 +1471,8 @@ function SelectWidget(_ref) {
|
|
|
1422
1471
|
_ref$formContext = _ref.formContext,
|
|
1423
1472
|
formContext = _ref$formContext === void 0 ? {} : _ref$formContext,
|
|
1424
1473
|
id = _ref.id,
|
|
1474
|
+
label = _ref.label,
|
|
1475
|
+
hideLabel = _ref.hideLabel,
|
|
1425
1476
|
multiple = _ref.multiple,
|
|
1426
1477
|
onBlur = _ref.onBlur,
|
|
1427
1478
|
onChange = _ref.onChange,
|
|
@@ -1429,9 +1480,13 @@ function SelectWidget(_ref) {
|
|
|
1429
1480
|
options = _ref.options,
|
|
1430
1481
|
placeholder = _ref.placeholder,
|
|
1431
1482
|
readonly = _ref.readonly,
|
|
1483
|
+
registry = _ref.registry,
|
|
1484
|
+
schema = _ref.schema,
|
|
1485
|
+
uiSchema = _ref.uiSchema,
|
|
1432
1486
|
value = _ref.value;
|
|
1433
1487
|
var _formContext$readonly = formContext.readonlyAsDisabled,
|
|
1434
1488
|
readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
|
|
1489
|
+
var TitleFieldTemplate = getTemplate('TitleFieldTemplate', registry, options);
|
|
1435
1490
|
var enumOptions = options.enumOptions,
|
|
1436
1491
|
enumDisabled = options.enumDisabled,
|
|
1437
1492
|
emptyValue = options.emptyValue;
|
|
@@ -1460,31 +1515,39 @@ function SelectWidget(_ref) {
|
|
|
1460
1515
|
var extraProps = {
|
|
1461
1516
|
name: id
|
|
1462
1517
|
};
|
|
1463
|
-
return
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1518
|
+
return jsxs(Fragment, {
|
|
1519
|
+
children: [!hideLabel && !!label && jsx(TitleFieldTemplate, {
|
|
1520
|
+
id: titleId(id),
|
|
1521
|
+
title: label,
|
|
1522
|
+
schema: schema,
|
|
1523
|
+
uiSchema: uiSchema,
|
|
1524
|
+
registry: registry
|
|
1525
|
+
}), jsx(Select, _extends({
|
|
1526
|
+
autoFocus: autofocus,
|
|
1527
|
+
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1528
|
+
getPopupContainer: getPopupContainer,
|
|
1529
|
+
id: id,
|
|
1530
|
+
mode: typeof multiple !== 'undefined' ? 'multiple' : undefined,
|
|
1531
|
+
onBlur: !readonly ? handleBlur : undefined,
|
|
1532
|
+
onChange: !readonly ? handleChange : undefined,
|
|
1533
|
+
onFocus: !readonly ? handleFocus : undefined,
|
|
1534
|
+
placeholder: placeholder,
|
|
1535
|
+
style: SELECT_STYLE,
|
|
1536
|
+
value: selectedIndexes
|
|
1537
|
+
}, extraProps, {
|
|
1538
|
+
filterOption: filterOption,
|
|
1539
|
+
"aria-describedby": ariaDescribedByIds(id),
|
|
1540
|
+
children: Array.isArray(enumOptions) && enumOptions.map(function (_ref2, index) {
|
|
1541
|
+
var optionValue = _ref2.value,
|
|
1542
|
+
optionLabel = _ref2.label;
|
|
1543
|
+
return jsx(Select.Option, {
|
|
1544
|
+
disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(optionValue) !== -1,
|
|
1545
|
+
value: String(index),
|
|
1546
|
+
children: optionLabel
|
|
1547
|
+
}, String(index));
|
|
1548
|
+
})
|
|
1549
|
+
}))]
|
|
1550
|
+
});
|
|
1488
1551
|
}
|
|
1489
1552
|
|
|
1490
1553
|
var INPUT_STYLE = {
|