@rjsf/core 5.2.0 → 5.2.1
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/LICENSE.md +183 -183
- package/README.md +1 -1
- package/dist/core.cjs.development.js +831 -735
- package/dist/core.cjs.development.js.map +1 -1
- package/dist/core.cjs.production.min.js +1 -1
- package/dist/core.cjs.production.min.js.map +1 -1
- package/dist/core.esm.js +798 -701
- package/dist/core.esm.js.map +1 -1
- package/dist/core.umd.development.js +833 -738
- package/dist/core.umd.development.js.map +1 -1
- package/dist/core.umd.production.min.js +1 -1
- package/dist/core.umd.production.min.js.map +1 -1
- package/dist/index.d.ts +17 -17
- package/package.json +5 -5
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var react = require('react');
|
|
6
7
|
var utils = require('@rjsf/utils');
|
|
7
8
|
var get = require('lodash/get');
|
|
8
9
|
var isEmpty = require('lodash/isEmpty');
|
|
@@ -18,7 +19,6 @@ var Markdown = require('markdown-to-jsx');
|
|
|
18
19
|
|
|
19
20
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
20
21
|
|
|
21
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
22
22
|
var get__default = /*#__PURE__*/_interopDefaultLegacy(get);
|
|
23
23
|
var isEmpty__default = /*#__PURE__*/_interopDefaultLegacy(isEmpty);
|
|
24
24
|
var _pick__default = /*#__PURE__*/_interopDefaultLegacy(_pick);
|
|
@@ -249,7 +249,7 @@ var ArrayField = /*#__PURE__*/function (_Component) {
|
|
|
249
249
|
var newFormData = arrayData.map(function (item, i) {
|
|
250
250
|
// We need to treat undefined items as nulls to have validation.
|
|
251
251
|
// See https://github.com/tdegrunt/jsonschema/issues/206
|
|
252
|
-
var jsonValue = typeof value ===
|
|
252
|
+
var jsonValue = typeof value === 'undefined' ? null : value;
|
|
253
253
|
return index === i ? jsonValue : item;
|
|
254
254
|
});
|
|
255
255
|
onChange(newFormData, errorSchema && errorSchema && _extends({}, errorSchema, (_extends2 = {}, _extends2[index] = newErrorSchema, _extends2)), id);
|
|
@@ -309,10 +309,10 @@ var ArrayField = /*#__PURE__*/function (_Component) {
|
|
|
309
309
|
if (Array.isArray(itemSchema.type)) {
|
|
310
310
|
// While we don't yet support composite/nullable jsonschema types, it's
|
|
311
311
|
// future-proof to check for requirement against these.
|
|
312
|
-
return !itemSchema.type.includes(
|
|
312
|
+
return !itemSchema.type.includes('null');
|
|
313
313
|
}
|
|
314
314
|
// All non-null array item types are inherently required by design
|
|
315
|
-
return itemSchema.type !==
|
|
315
|
+
return itemSchema.type !== 'null';
|
|
316
316
|
}
|
|
317
317
|
/** Determines whether more items can be added to the array. If the uiSchema indicates the array doesn't allow adding
|
|
318
318
|
* then false is returned. Otherwise, if the schema indicates that there are a maximum number of items and the
|
|
@@ -389,8 +389,8 @@ var ArrayField = /*#__PURE__*/function (_Component) {
|
|
|
389
389
|
translateString = registry.translateString;
|
|
390
390
|
if (!(utils.ITEMS_KEY in schema)) {
|
|
391
391
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
392
|
-
var UnsupportedFieldTemplate = utils.getTemplate(
|
|
393
|
-
return
|
|
392
|
+
var UnsupportedFieldTemplate = utils.getTemplate('UnsupportedFieldTemplate', registry, uiOptions);
|
|
393
|
+
return jsxRuntime.jsx(UnsupportedFieldTemplate, {
|
|
394
394
|
schema: schema,
|
|
395
395
|
idSchema: idSchema,
|
|
396
396
|
reason: translateString(utils.TranslatableString.MissingItems),
|
|
@@ -436,7 +436,7 @@ var ArrayField = /*#__PURE__*/function (_Component) {
|
|
|
436
436
|
onFocus = _this$props8.onFocus,
|
|
437
437
|
idPrefix = _this$props8.idPrefix,
|
|
438
438
|
_this$props8$idSepara = _this$props8.idSeparator,
|
|
439
|
-
idSeparator = _this$props8$idSepara === void 0 ?
|
|
439
|
+
idSeparator = _this$props8$idSepara === void 0 ? '_' : _this$props8$idSepara,
|
|
440
440
|
rawErrors = _this$props8.rawErrors;
|
|
441
441
|
var keyedFormData = this.state.keyedFormData;
|
|
442
442
|
var title = schema.title === undefined ? name : schema.title;
|
|
@@ -491,8 +491,8 @@ var ArrayField = /*#__PURE__*/function (_Component) {
|
|
|
491
491
|
rawErrors: rawErrors,
|
|
492
492
|
registry: registry
|
|
493
493
|
};
|
|
494
|
-
var Template = utils.getTemplate(
|
|
495
|
-
return
|
|
494
|
+
var Template = utils.getTemplate('ArrayFieldTemplate', registry, uiOptions);
|
|
495
|
+
return jsxRuntime.jsx(Template, _extends({}, arrayProps));
|
|
496
496
|
}
|
|
497
497
|
/** Renders an array using the custom widget provided by the user in the `uiSchema`
|
|
498
498
|
*/;
|
|
@@ -525,8 +525,9 @@ var ArrayField = /*#__PURE__*/function (_Component) {
|
|
|
525
525
|
widget = _getUiOptions2.widget,
|
|
526
526
|
options = _objectWithoutPropertiesLoose(_getUiOptions2, _excluded$9);
|
|
527
527
|
var Widget = utils.getWidget(schema, widget, widgets);
|
|
528
|
-
return
|
|
528
|
+
return jsxRuntime.jsx(Widget, {
|
|
529
529
|
id: idSchema.$id,
|
|
530
|
+
name: name,
|
|
530
531
|
multiple: true,
|
|
531
532
|
onChange: this.onSelectChange,
|
|
532
533
|
onBlur: onBlur,
|
|
@@ -578,11 +579,12 @@ var ArrayField = /*#__PURE__*/function (_Component) {
|
|
|
578
579
|
var enumOptions = utils.optionsList(itemsSchema);
|
|
579
580
|
var _getUiOptions3 = utils.getUiOptions(uiSchema),
|
|
580
581
|
_getUiOptions3$widget = _getUiOptions3.widget,
|
|
581
|
-
widget = _getUiOptions3$widget === void 0 ?
|
|
582
|
+
widget = _getUiOptions3$widget === void 0 ? 'select' : _getUiOptions3$widget,
|
|
582
583
|
options = _objectWithoutPropertiesLoose(_getUiOptions3, _excluded2);
|
|
583
584
|
var Widget = utils.getWidget(schema, widget, widgets);
|
|
584
|
-
return
|
|
585
|
+
return jsxRuntime.jsx(Widget, {
|
|
585
586
|
id: idSchema.$id,
|
|
587
|
+
name: name,
|
|
586
588
|
multiple: true,
|
|
587
589
|
onChange: this.onSelectChange,
|
|
588
590
|
onBlur: onBlur,
|
|
@@ -631,12 +633,13 @@ var ArrayField = /*#__PURE__*/function (_Component) {
|
|
|
631
633
|
formContext = registry.formContext;
|
|
632
634
|
var _getUiOptions4 = utils.getUiOptions(uiSchema),
|
|
633
635
|
_getUiOptions4$widget = _getUiOptions4.widget,
|
|
634
|
-
widget = _getUiOptions4$widget === void 0 ?
|
|
636
|
+
widget = _getUiOptions4$widget === void 0 ? 'files' : _getUiOptions4$widget,
|
|
635
637
|
options = _objectWithoutPropertiesLoose(_getUiOptions4, _excluded3);
|
|
636
638
|
var Widget = utils.getWidget(schema, widget, widgets);
|
|
637
|
-
return
|
|
639
|
+
return jsxRuntime.jsx(Widget, {
|
|
638
640
|
options: options,
|
|
639
641
|
id: idSchema.$id,
|
|
642
|
+
name: name,
|
|
640
643
|
multiple: true,
|
|
641
644
|
onChange: this.onSelectChange,
|
|
642
645
|
onBlur: onBlur,
|
|
@@ -652,7 +655,7 @@ var ArrayField = /*#__PURE__*/function (_Component) {
|
|
|
652
655
|
formContext: formContext,
|
|
653
656
|
autofocus: autofocus,
|
|
654
657
|
rawErrors: rawErrors,
|
|
655
|
-
label:
|
|
658
|
+
label: ''
|
|
656
659
|
});
|
|
657
660
|
}
|
|
658
661
|
/** Renders an array that has a maximum limit of items
|
|
@@ -668,7 +671,7 @@ var ArrayField = /*#__PURE__*/function (_Component) {
|
|
|
668
671
|
errorSchema = _this$props12.errorSchema,
|
|
669
672
|
idPrefix = _this$props12.idPrefix,
|
|
670
673
|
_this$props12$idSepar = _this$props12.idSeparator,
|
|
671
|
-
idSeparator = _this$props12$idSepar === void 0 ?
|
|
674
|
+
idSeparator = _this$props12$idSepar === void 0 ? '_' : _this$props12$idSepar,
|
|
672
675
|
idSchema = _this$props12.idSchema,
|
|
673
676
|
name = _this$props12.name,
|
|
674
677
|
_this$props12$disable = _this$props12.disabled,
|
|
@@ -704,7 +707,7 @@ var ArrayField = /*#__PURE__*/function (_Component) {
|
|
|
704
707
|
var canAdd = this.canAddItem(items) && !!additionalSchema;
|
|
705
708
|
var arrayProps = {
|
|
706
709
|
canAdd: canAdd,
|
|
707
|
-
className:
|
|
710
|
+
className: 'field field-array field-array-fixed-items',
|
|
708
711
|
disabled: disabled,
|
|
709
712
|
idSchema: idSchema,
|
|
710
713
|
formData: formData,
|
|
@@ -749,8 +752,8 @@ var ArrayField = /*#__PURE__*/function (_Component) {
|
|
|
749
752
|
formContext: formContext,
|
|
750
753
|
rawErrors: rawErrors
|
|
751
754
|
};
|
|
752
|
-
var Template = utils.getTemplate(
|
|
753
|
-
return
|
|
755
|
+
var Template = utils.getTemplate('ArrayFieldTemplate', registry, uiOptions);
|
|
756
|
+
return jsxRuntime.jsx(Template, _extends({}, arrayProps));
|
|
754
757
|
}
|
|
755
758
|
/** Renders the individual array item using a `SchemaField` along with the additional properties required to be send
|
|
756
759
|
* back to the `ArrayFieldItemTemplate`.
|
|
@@ -806,7 +809,7 @@ var ArrayField = /*#__PURE__*/function (_Component) {
|
|
|
806
809
|
return has[key];
|
|
807
810
|
});
|
|
808
811
|
return {
|
|
809
|
-
children:
|
|
812
|
+
children: jsxRuntime.jsx(ItemSchemaField, {
|
|
810
813
|
name: name,
|
|
811
814
|
index: index,
|
|
812
815
|
schema: itemSchema,
|
|
@@ -828,7 +831,7 @@ var ArrayField = /*#__PURE__*/function (_Component) {
|
|
|
828
831
|
autofocus: autofocus,
|
|
829
832
|
rawErrors: rawErrors
|
|
830
833
|
}),
|
|
831
|
-
className:
|
|
834
|
+
className: 'array-item',
|
|
832
835
|
disabled: disabled,
|
|
833
836
|
canAdd: canAdd,
|
|
834
837
|
hasToolbar: has.toolbar,
|
|
@@ -854,11 +857,11 @@ var ArrayField = /*#__PURE__*/function (_Component) {
|
|
|
854
857
|
schema = _this$props14.schema,
|
|
855
858
|
registry = _this$props14.registry;
|
|
856
859
|
var translateString = registry.translateString;
|
|
857
|
-
return get__default["default"](schema, [utils.ITEMS_KEY,
|
|
860
|
+
return get__default["default"](schema, [utils.ITEMS_KEY, 'title'], get__default["default"](schema, [utils.ITEMS_KEY, 'description'], translateString(utils.TranslatableString.ArrayItemTitle)));
|
|
858
861
|
}
|
|
859
862
|
}]);
|
|
860
863
|
return ArrayField;
|
|
861
|
-
}(
|
|
864
|
+
}(react.Component);
|
|
862
865
|
|
|
863
866
|
var _excluded$8 = ["widget"];
|
|
864
867
|
/** The `BooleanField` component is used to render a field in the schema is boolean. It constructs `enumOptions` for the
|
|
@@ -887,7 +890,7 @@ function BooleanField(props) {
|
|
|
887
890
|
translateString = registry.translateString;
|
|
888
891
|
var _getUiOptions = utils.getUiOptions(uiSchema),
|
|
889
892
|
_getUiOptions$widget = _getUiOptions.widget,
|
|
890
|
-
widget = _getUiOptions$widget === void 0 ?
|
|
893
|
+
widget = _getUiOptions$widget === void 0 ? 'checkbox' : _getUiOptions$widget,
|
|
891
894
|
options = _objectWithoutPropertiesLoose(_getUiOptions, _excluded$8);
|
|
892
895
|
var Widget = utils.getWidget(schema, widget, widgets);
|
|
893
896
|
var yes = translateString(utils.TranslatableString.YesLabel);
|
|
@@ -912,7 +915,7 @@ function BooleanField(props) {
|
|
|
912
915
|
var schemaWithEnumNames = schema;
|
|
913
916
|
var enums = (_schema$enum = schema["enum"]) != null ? _schema$enum : [true, false];
|
|
914
917
|
if (!schemaWithEnumNames.enumNames && enums.length === 2 && enums.every(function (v) {
|
|
915
|
-
return typeof v ===
|
|
918
|
+
return typeof v === 'boolean';
|
|
916
919
|
})) {
|
|
917
920
|
enumOptions = [{
|
|
918
921
|
value: enums[0],
|
|
@@ -929,13 +932,14 @@ function BooleanField(props) {
|
|
|
929
932
|
});
|
|
930
933
|
}
|
|
931
934
|
}
|
|
932
|
-
return
|
|
935
|
+
return jsxRuntime.jsx(Widget, {
|
|
933
936
|
options: _extends({}, options, {
|
|
934
937
|
enumOptions: enumOptions
|
|
935
938
|
}),
|
|
936
939
|
schema: schema,
|
|
937
940
|
uiSchema: uiSchema,
|
|
938
941
|
id: idSchema.$id,
|
|
942
|
+
name: name,
|
|
939
943
|
onChange: onChange,
|
|
940
944
|
onFocus: onFocus,
|
|
941
945
|
onBlur: onBlur,
|
|
@@ -985,7 +989,7 @@ var AnyOfField = /*#__PURE__*/function (_Component) {
|
|
|
985
989
|
if (newFormData && newOption) {
|
|
986
990
|
// Call getDefaultFormState to make sure defaults are populated on change. Pass "excludeObjectChildren"
|
|
987
991
|
// so that only the root objects themselves are created without adding undefined children properties
|
|
988
|
-
newFormData = schemaUtils.getDefaultFormState(newOption, newFormData,
|
|
992
|
+
newFormData = schemaUtils.getDefaultFormState(newOption, newFormData, 'excludeObjectChildren');
|
|
989
993
|
}
|
|
990
994
|
onChange(newFormData, undefined, _this.getFieldId());
|
|
991
995
|
_this.setState({
|
|
@@ -1072,12 +1076,13 @@ var AnyOfField = /*#__PURE__*/function (_Component) {
|
|
|
1072
1076
|
var _this$props4 = this.props,
|
|
1073
1077
|
idSchema = _this$props4.idSchema,
|
|
1074
1078
|
schema = _this$props4.schema;
|
|
1075
|
-
return "" + idSchema.$id + (schema.oneOf ?
|
|
1079
|
+
return "" + idSchema.$id + (schema.oneOf ? '__oneof_select' : '__anyof_select');
|
|
1076
1080
|
}
|
|
1077
1081
|
/** Renders the `AnyOfField` selector along with a `SchemaField` for the value of the `formData`
|
|
1078
1082
|
*/;
|
|
1079
1083
|
_proto.render = function render() {
|
|
1080
1084
|
var _this$props5 = this.props,
|
|
1085
|
+
name = _this$props5.name,
|
|
1081
1086
|
baseType = _this$props5.baseType,
|
|
1082
1087
|
_this$props5$disabled = _this$props5.disabled,
|
|
1083
1088
|
disabled = _this$props5$disabled === void 0 ? false : _this$props5$disabled,
|
|
@@ -1098,7 +1103,7 @@ var AnyOfField = /*#__PURE__*/function (_Component) {
|
|
|
1098
1103
|
retrievedOptions = _this$state2.retrievedOptions;
|
|
1099
1104
|
var _getUiOptions = utils.getUiOptions(uiSchema),
|
|
1100
1105
|
_getUiOptions$widget = _getUiOptions.widget,
|
|
1101
|
-
widget = _getUiOptions$widget === void 0 ?
|
|
1106
|
+
widget = _getUiOptions$widget === void 0 ? 'select' : _getUiOptions$widget,
|
|
1102
1107
|
placeholder = _getUiOptions.placeholder,
|
|
1103
1108
|
autofocus = _getUiOptions.autofocus,
|
|
1104
1109
|
autocomplete = _getUiOptions.autocomplete,
|
|
@@ -1106,7 +1111,7 @@ var AnyOfField = /*#__PURE__*/function (_Component) {
|
|
|
1106
1111
|
title = _getUiOptions$title === void 0 ? schema.title : _getUiOptions$title,
|
|
1107
1112
|
uiOptions = _objectWithoutPropertiesLoose(_getUiOptions, _excluded$7);
|
|
1108
1113
|
var Widget = utils.getWidget({
|
|
1109
|
-
type:
|
|
1114
|
+
type: 'number'
|
|
1110
1115
|
}, widget, widgets);
|
|
1111
1116
|
var rawErrors = get__default["default"](errorSchema, utils.ERRORS_KEY, []);
|
|
1112
1117
|
var fieldErrorSchema = omit__default["default"](errorSchema, [utils.ERRORS_KEY]);
|
|
@@ -1127,39 +1132,42 @@ var AnyOfField = /*#__PURE__*/function (_Component) {
|
|
|
1127
1132
|
value: index
|
|
1128
1133
|
};
|
|
1129
1134
|
});
|
|
1130
|
-
return
|
|
1131
|
-
className:
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1135
|
+
return jsxRuntime.jsxs("div", {
|
|
1136
|
+
className: 'panel panel-default panel-body',
|
|
1137
|
+
children: [jsxRuntime.jsx("div", {
|
|
1138
|
+
className: 'form-group',
|
|
1139
|
+
children: jsxRuntime.jsx(Widget, {
|
|
1140
|
+
id: this.getFieldId(),
|
|
1141
|
+
name: "" + name + (schema.oneOf ? '__oneof_select' : '__anyof_select'),
|
|
1142
|
+
schema: {
|
|
1143
|
+
type: 'number',
|
|
1144
|
+
"default": 0
|
|
1145
|
+
},
|
|
1146
|
+
onChange: this.onOptionChange,
|
|
1147
|
+
onBlur: onBlur,
|
|
1148
|
+
onFocus: onFocus,
|
|
1149
|
+
disabled: disabled || isEmpty__default["default"](enumOptions),
|
|
1150
|
+
multiple: false,
|
|
1151
|
+
rawErrors: rawErrors,
|
|
1152
|
+
errorSchema: fieldErrorSchema,
|
|
1153
|
+
value: selectedOption >= 0 ? selectedOption : undefined,
|
|
1154
|
+
options: _extends({
|
|
1155
|
+
enumOptions: enumOptions
|
|
1156
|
+
}, uiOptions),
|
|
1157
|
+
registry: registry,
|
|
1158
|
+
formContext: formContext,
|
|
1159
|
+
placeholder: placeholder,
|
|
1160
|
+
autocomplete: autocomplete,
|
|
1161
|
+
autofocus: autofocus,
|
|
1162
|
+
label: ''
|
|
1163
|
+
})
|
|
1164
|
+
}), option !== null && jsxRuntime.jsx(_SchemaField, _extends({}, this.props, {
|
|
1165
|
+
schema: optionSchema
|
|
1166
|
+
}))]
|
|
1167
|
+
});
|
|
1160
1168
|
};
|
|
1161
1169
|
return AnyOfField;
|
|
1162
|
-
}(
|
|
1170
|
+
}(react.Component);
|
|
1163
1171
|
|
|
1164
1172
|
// Matches a string that ends in a . character, optionally followed by a sequence of
|
|
1165
1173
|
// digits followed by any number of 0 characters up until the end of the line.
|
|
@@ -1193,7 +1201,7 @@ function NumberField(props) {
|
|
|
1193
1201
|
onChange = props.onChange,
|
|
1194
1202
|
formData = props.formData,
|
|
1195
1203
|
initialValue = props.value;
|
|
1196
|
-
var _useState =
|
|
1204
|
+
var _useState = react.useState(initialValue),
|
|
1197
1205
|
lastValue = _useState[0],
|
|
1198
1206
|
setLastValue = _useState[1];
|
|
1199
1207
|
var StringField = registry.fields.StringField;
|
|
@@ -1202,32 +1210,32 @@ function NumberField(props) {
|
|
|
1202
1210
|
*
|
|
1203
1211
|
* @param value - The current value for the change occurring
|
|
1204
1212
|
*/
|
|
1205
|
-
var handleChange =
|
|
1213
|
+
var handleChange = react.useCallback(function (value) {
|
|
1206
1214
|
// Cache the original value in component state
|
|
1207
1215
|
setLastValue(value);
|
|
1208
1216
|
// Normalize decimals that don't start with a zero character in advance so
|
|
1209
1217
|
// that the rest of the normalization logic is simpler
|
|
1210
|
-
if (("" + value).charAt(0) ===
|
|
1218
|
+
if (("" + value).charAt(0) === '.') {
|
|
1211
1219
|
value = "0" + value;
|
|
1212
1220
|
}
|
|
1213
1221
|
// Check that the value is a string (this can happen if the widget used is a
|
|
1214
1222
|
// <select>, due to an enum declaration etc) then, if the value ends in a
|
|
1215
1223
|
// trailing decimal point or multiple zeroes, strip the trailing values
|
|
1216
|
-
var processed = typeof value ===
|
|
1224
|
+
var processed = typeof value === 'string' && value.match(trailingCharMatcherWithPrefix) ? utils.asNumber(value.replace(trailingCharMatcher, '')) : utils.asNumber(value);
|
|
1217
1225
|
onChange(processed);
|
|
1218
1226
|
}, [onChange]);
|
|
1219
|
-
if (typeof lastValue ===
|
|
1227
|
+
if (typeof lastValue === 'string' && typeof value === 'number') {
|
|
1220
1228
|
// Construct a regular expression that checks for a string that consists
|
|
1221
1229
|
// of the formData value suffixed with zero or one '.' characters and zero
|
|
1222
1230
|
// or more '0' characters
|
|
1223
|
-
var re = new RegExp(("" + value).replace(
|
|
1231
|
+
var re = new RegExp(("" + value).replace('.', '\\.') + '\\.?0*$');
|
|
1224
1232
|
// If the cached "lastValue" is a match, use that instead of the formData
|
|
1225
1233
|
// value to prevent the input value from changing in the UI
|
|
1226
1234
|
if (lastValue.match(re)) {
|
|
1227
1235
|
value = lastValue;
|
|
1228
1236
|
}
|
|
1229
1237
|
}
|
|
1230
|
-
return
|
|
1238
|
+
return jsxRuntime.jsx(StringField, _extends({}, props, {
|
|
1231
1239
|
formData: value,
|
|
1232
1240
|
onChange: handleChange
|
|
1233
1241
|
}));
|
|
@@ -1268,7 +1276,7 @@ var ObjectField = /*#__PURE__*/function (_Component) {
|
|
|
1268
1276
|
// fields which are "mandated" by the schema, these fields can
|
|
1269
1277
|
// be set to undefined by clicking a "delete field" button, so
|
|
1270
1278
|
// set empty values to the empty string.
|
|
1271
|
-
value =
|
|
1279
|
+
value = '';
|
|
1272
1280
|
}
|
|
1273
1281
|
var newFormData = _extends({}, formData, (_extends2 = {}, _extends2[name] = value, _extends2));
|
|
1274
1282
|
onChange(newFormData, errorSchema && errorSchema && _extends({}, errorSchema, (_extends3 = {}, _extends3[name] = newErrorSchema, _extends3)), id);
|
|
@@ -1289,7 +1297,7 @@ var ObjectField = /*#__PURE__*/function (_Component) {
|
|
|
1289
1297
|
var uiSchema = _this.props.uiSchema;
|
|
1290
1298
|
var _getUiOptions = utils.getUiOptions(uiSchema),
|
|
1291
1299
|
_getUiOptions$duplica = _getUiOptions.duplicateKeySuffixSeparator,
|
|
1292
|
-
duplicateKeySuffixSeparator = _getUiOptions$duplica === void 0 ?
|
|
1300
|
+
duplicateKeySuffixSeparator = _getUiOptions$duplica === void 0 ? '-' : _getUiOptions$duplica;
|
|
1293
1301
|
var index = 0;
|
|
1294
1302
|
var newKey = preferredKey;
|
|
1295
1303
|
while (has__default["default"](formData, newKey)) {
|
|
@@ -1344,10 +1352,10 @@ var ObjectField = /*#__PURE__*/function (_Component) {
|
|
|
1344
1352
|
type = apSchema.type;
|
|
1345
1353
|
}
|
|
1346
1354
|
if (!type && (utils.ANY_OF_KEY in apSchema || utils.ONE_OF_KEY in apSchema)) {
|
|
1347
|
-
type =
|
|
1355
|
+
type = 'object';
|
|
1348
1356
|
}
|
|
1349
1357
|
}
|
|
1350
|
-
var newKey = _this.getAvailableKey(
|
|
1358
|
+
var newKey = _this.getAvailableKey('newKey', newFormData);
|
|
1351
1359
|
// Cast this to make the `set` work properly
|
|
1352
1360
|
set__default["default"](newFormData, newKey, _this.getDefaultValue(type));
|
|
1353
1361
|
onChange(newFormData);
|
|
@@ -1380,17 +1388,17 @@ var ObjectField = /*#__PURE__*/function (_Component) {
|
|
|
1380
1388
|
_proto.getDefaultValue = function getDefaultValue(type) {
|
|
1381
1389
|
var translateString = this.props.registry.translateString;
|
|
1382
1390
|
switch (type) {
|
|
1383
|
-
case
|
|
1391
|
+
case 'array':
|
|
1384
1392
|
return [];
|
|
1385
|
-
case
|
|
1393
|
+
case 'boolean':
|
|
1386
1394
|
return false;
|
|
1387
|
-
case
|
|
1395
|
+
case 'null':
|
|
1388
1396
|
return null;
|
|
1389
|
-
case
|
|
1397
|
+
case 'number':
|
|
1390
1398
|
return 0;
|
|
1391
|
-
case
|
|
1399
|
+
case 'object':
|
|
1392
1400
|
return {};
|
|
1393
|
-
case
|
|
1401
|
+
case 'string':
|
|
1394
1402
|
default:
|
|
1395
1403
|
// We don't have a datatype for some reason (perhaps additionalProperties was true)
|
|
1396
1404
|
return translateString(utils.TranslatableString.NewStringDefault);
|
|
@@ -1440,25 +1448,31 @@ var ObjectField = /*#__PURE__*/function (_Component) {
|
|
|
1440
1448
|
var properties = Object.keys(schemaProperties);
|
|
1441
1449
|
orderedProperties = utils.orderProperties(properties, uiOptions.order);
|
|
1442
1450
|
} catch (err) {
|
|
1443
|
-
return
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1451
|
+
return jsxRuntime.jsxs("div", {
|
|
1452
|
+
children: [jsxRuntime.jsxs("p", {
|
|
1453
|
+
className: 'config-error',
|
|
1454
|
+
style: {
|
|
1455
|
+
color: 'red'
|
|
1456
|
+
},
|
|
1457
|
+
children: ["Invalid ", name || 'root', " object field configuration:", jsxRuntime.jsx("em", {
|
|
1458
|
+
children: err.message
|
|
1459
|
+
}), "."]
|
|
1460
|
+
}), jsxRuntime.jsx("pre", {
|
|
1461
|
+
children: JSON.stringify(schema)
|
|
1462
|
+
})]
|
|
1463
|
+
});
|
|
1449
1464
|
}
|
|
1450
|
-
var Template = utils.getTemplate(
|
|
1465
|
+
var Template = utils.getTemplate('ObjectFieldTemplate', registry, uiOptions);
|
|
1451
1466
|
var templateProps = {
|
|
1452
1467
|
title: uiOptions.title || title,
|
|
1453
1468
|
description: description,
|
|
1454
1469
|
properties: orderedProperties.map(function (name) {
|
|
1455
1470
|
var addedByAdditionalProperties = has__default["default"](schema, [utils.PROPERTIES_KEY, name, utils.ADDITIONAL_PROPERTY_FLAG]);
|
|
1456
1471
|
var fieldUiSchema = addedByAdditionalProperties ? uiSchema.additionalProperties : uiSchema[name];
|
|
1457
|
-
var hidden = utils.getUiOptions(fieldUiSchema).widget ===
|
|
1472
|
+
var hidden = utils.getUiOptions(fieldUiSchema).widget === 'hidden';
|
|
1458
1473
|
var fieldIdSchema = get__default["default"](idSchema, [name], {});
|
|
1459
1474
|
return {
|
|
1460
|
-
content:
|
|
1461
|
-
key: name,
|
|
1475
|
+
content: jsxRuntime.jsx(SchemaField, {
|
|
1462
1476
|
name: name,
|
|
1463
1477
|
required: _this2.isRequired(name),
|
|
1464
1478
|
schema: get__default["default"](schema, [utils.PROPERTIES_KEY, name], {}),
|
|
@@ -1479,7 +1493,7 @@ var ObjectField = /*#__PURE__*/function (_Component) {
|
|
|
1479
1493
|
readonly: readonly,
|
|
1480
1494
|
hideError: hideError,
|
|
1481
1495
|
onDropPropertyClick: _this2.onDropPropertyClick
|
|
1482
|
-
}),
|
|
1496
|
+
}, name),
|
|
1483
1497
|
name: name,
|
|
1484
1498
|
readonly: readonly,
|
|
1485
1499
|
disabled: disabled,
|
|
@@ -1497,23 +1511,23 @@ var ObjectField = /*#__PURE__*/function (_Component) {
|
|
|
1497
1511
|
formContext: formContext,
|
|
1498
1512
|
registry: registry
|
|
1499
1513
|
};
|
|
1500
|
-
return
|
|
1514
|
+
return jsxRuntime.jsx(Template, _extends({}, templateProps, {
|
|
1501
1515
|
onAddClick: this.handleAddClick
|
|
1502
1516
|
}));
|
|
1503
1517
|
};
|
|
1504
1518
|
return ObjectField;
|
|
1505
|
-
}(
|
|
1519
|
+
}(react.Component);
|
|
1506
1520
|
|
|
1507
1521
|
var _excluded$6 = ["__errors"];
|
|
1508
1522
|
/** The map of component type to FieldName */
|
|
1509
1523
|
var COMPONENT_TYPES = {
|
|
1510
|
-
array:
|
|
1511
|
-
"boolean":
|
|
1512
|
-
integer:
|
|
1513
|
-
number:
|
|
1514
|
-
object:
|
|
1515
|
-
string:
|
|
1516
|
-
"null":
|
|
1524
|
+
array: 'ArrayField',
|
|
1525
|
+
"boolean": 'BooleanField',
|
|
1526
|
+
integer: 'NumberField',
|
|
1527
|
+
number: 'NumberField',
|
|
1528
|
+
object: 'ObjectField',
|
|
1529
|
+
string: 'StringField',
|
|
1530
|
+
"null": 'NullField'
|
|
1517
1531
|
};
|
|
1518
1532
|
/** Computes and returns which `Field` implementation to return in order to render the field represented by the
|
|
1519
1533
|
* `schema`. The `uiOptions` are used to alter what potential `Field` implementation is actually returned. If no
|
|
@@ -1529,14 +1543,14 @@ function getFieldComponent(schema, uiOptions, idSchema, registry) {
|
|
|
1529
1543
|
var field = uiOptions.field;
|
|
1530
1544
|
var fields = registry.fields,
|
|
1531
1545
|
translateString = registry.translateString;
|
|
1532
|
-
if (typeof field ===
|
|
1546
|
+
if (typeof field === 'function') {
|
|
1533
1547
|
return field;
|
|
1534
1548
|
}
|
|
1535
|
-
if (typeof field ===
|
|
1549
|
+
if (typeof field === 'string' && field in fields) {
|
|
1536
1550
|
return fields[field];
|
|
1537
1551
|
}
|
|
1538
1552
|
var schemaType = utils.getSchemaType(schema);
|
|
1539
|
-
var type = Array.isArray(schemaType) ? schemaType[0] : schemaType ||
|
|
1553
|
+
var type = Array.isArray(schemaType) ? schemaType[0] : schemaType || '';
|
|
1540
1554
|
var componentName = COMPONENT_TYPES[type];
|
|
1541
1555
|
// If the type is not defined and the schema uses 'anyOf' or 'oneOf', don't
|
|
1542
1556
|
// render a field and let the MultiSchemaField component handle the form display
|
|
@@ -1546,8 +1560,8 @@ function getFieldComponent(schema, uiOptions, idSchema, registry) {
|
|
|
1546
1560
|
};
|
|
1547
1561
|
}
|
|
1548
1562
|
return componentName in fields ? fields[componentName] : function () {
|
|
1549
|
-
var UnsupportedFieldTemplate = utils.getTemplate(
|
|
1550
|
-
return
|
|
1563
|
+
var UnsupportedFieldTemplate = utils.getTemplate('UnsupportedFieldTemplate', registry, uiOptions);
|
|
1564
|
+
return jsxRuntime.jsx(UnsupportedFieldTemplate, {
|
|
1551
1565
|
schema: schema,
|
|
1552
1566
|
idSchema: idSchema,
|
|
1553
1567
|
reason: translateString(utils.TranslatableString.UnknownFieldType, [String(schema.type)]),
|
|
@@ -1580,17 +1594,17 @@ function SchemaFieldRender(props) {
|
|
|
1580
1594
|
var formContext = registry.formContext,
|
|
1581
1595
|
schemaUtils = registry.schemaUtils;
|
|
1582
1596
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
1583
|
-
var FieldTemplate = utils.getTemplate(
|
|
1584
|
-
var DescriptionFieldTemplate = utils.getTemplate(
|
|
1585
|
-
var FieldHelpTemplate = utils.getTemplate(
|
|
1586
|
-
var FieldErrorTemplate = utils.getTemplate(
|
|
1597
|
+
var FieldTemplate = utils.getTemplate('FieldTemplate', registry, uiOptions);
|
|
1598
|
+
var DescriptionFieldTemplate = utils.getTemplate('DescriptionFieldTemplate', registry, uiOptions);
|
|
1599
|
+
var FieldHelpTemplate = utils.getTemplate('FieldHelpTemplate', registry, uiOptions);
|
|
1600
|
+
var FieldErrorTemplate = utils.getTemplate('FieldErrorTemplate', registry, uiOptions);
|
|
1587
1601
|
var schema = schemaUtils.retrieveSchema(_schema, formData);
|
|
1588
1602
|
var fieldId = _idSchema[utils.ID_KEY];
|
|
1589
1603
|
var idSchema = utils.mergeObjects(schemaUtils.toIdSchema(schema, fieldId, formData, idPrefix, idSeparator), _idSchema);
|
|
1590
1604
|
/** Intermediary `onChange` handler for field components that will inject the `id` of the current field into the
|
|
1591
1605
|
* `onChange` chain if it is not already being provided from a deeper level in the hierarchy
|
|
1592
1606
|
*/
|
|
1593
|
-
var handleFieldComponentChange =
|
|
1607
|
+
var handleFieldComponentChange = react.useCallback(function (formData, newErrorSchema, id) {
|
|
1594
1608
|
var theId = id || fieldId;
|
|
1595
1609
|
return onChange(formData, newErrorSchema, theId);
|
|
1596
1610
|
}, [fieldId, onChange]);
|
|
@@ -1609,11 +1623,11 @@ function SchemaFieldRender(props) {
|
|
|
1609
1623
|
__errors = _ref.__errors,
|
|
1610
1624
|
fieldErrorSchema = _objectWithoutPropertiesLoose(_ref, _excluded$6);
|
|
1611
1625
|
// See #439: uiSchema: Don't pass consumed class names or style to child components
|
|
1612
|
-
var fieldUiSchema = omit__default["default"](uiSchema, [
|
|
1626
|
+
var fieldUiSchema = omit__default["default"](uiSchema, ['ui:classNames', 'classNames', 'ui:style']);
|
|
1613
1627
|
if (utils.UI_OPTIONS_KEY in fieldUiSchema) {
|
|
1614
|
-
fieldUiSchema[utils.UI_OPTIONS_KEY] = omit__default["default"](fieldUiSchema[utils.UI_OPTIONS_KEY], [
|
|
1628
|
+
fieldUiSchema[utils.UI_OPTIONS_KEY] = omit__default["default"](fieldUiSchema[utils.UI_OPTIONS_KEY], ['classNames', 'style']);
|
|
1615
1629
|
}
|
|
1616
|
-
var field =
|
|
1630
|
+
var field = jsxRuntime.jsx(FieldComponent, _extends({}, props, {
|
|
1617
1631
|
onChange: handleFieldComponentChange,
|
|
1618
1632
|
idSchema: idSchema,
|
|
1619
1633
|
schema: schema,
|
|
@@ -1634,12 +1648,12 @@ function SchemaFieldRender(props) {
|
|
|
1634
1648
|
} else {
|
|
1635
1649
|
label = utils.ADDITIONAL_PROPERTY_FLAG in schema ? name : uiOptions.title || props.schema.title || schema.title || name;
|
|
1636
1650
|
}
|
|
1637
|
-
var description = uiOptions.description || props.schema.description || schema.description ||
|
|
1651
|
+
var description = uiOptions.description || props.schema.description || schema.description || '';
|
|
1638
1652
|
var help = uiOptions.help;
|
|
1639
|
-
var hidden = uiOptions.widget ===
|
|
1640
|
-
var classNames = [
|
|
1653
|
+
var hidden = uiOptions.widget === 'hidden';
|
|
1654
|
+
var classNames = ['form-group', 'field', "field-" + schema.type];
|
|
1641
1655
|
if (!hideError && __errors && __errors.length > 0) {
|
|
1642
|
-
classNames.push(
|
|
1656
|
+
classNames.push('field-error has-error has-danger');
|
|
1643
1657
|
}
|
|
1644
1658
|
if (uiSchema !== null && uiSchema !== void 0 && uiSchema.classNames) {
|
|
1645
1659
|
{
|
|
@@ -1650,7 +1664,7 @@ function SchemaFieldRender(props) {
|
|
|
1650
1664
|
if (uiOptions.classNames) {
|
|
1651
1665
|
classNames.push(uiOptions.classNames);
|
|
1652
1666
|
}
|
|
1653
|
-
var helpComponent =
|
|
1667
|
+
var helpComponent = jsxRuntime.jsx(FieldHelpTemplate, {
|
|
1654
1668
|
help: help,
|
|
1655
1669
|
idSchema: idSchema,
|
|
1656
1670
|
schema: schema,
|
|
@@ -1658,7 +1672,7 @@ function SchemaFieldRender(props) {
|
|
|
1658
1672
|
hasErrors: !hideError && __errors && __errors.length > 0,
|
|
1659
1673
|
registry: registry
|
|
1660
1674
|
});
|
|
1661
|
-
var errorsComponent = hideError ? undefined :
|
|
1675
|
+
var errorsComponent = hideError ? undefined : jsxRuntime.jsx(FieldErrorTemplate, {
|
|
1662
1676
|
errors: __errors,
|
|
1663
1677
|
errorSchema: errorSchema,
|
|
1664
1678
|
idSchema: idSchema,
|
|
@@ -1667,7 +1681,7 @@ function SchemaFieldRender(props) {
|
|
|
1667
1681
|
registry: registry
|
|
1668
1682
|
});
|
|
1669
1683
|
var fieldProps = {
|
|
1670
|
-
description:
|
|
1684
|
+
description: jsxRuntime.jsx(DescriptionFieldTemplate, {
|
|
1671
1685
|
id: utils.descriptionId(id),
|
|
1672
1686
|
description: description,
|
|
1673
1687
|
schema: schema,
|
|
@@ -1676,7 +1690,7 @@ function SchemaFieldRender(props) {
|
|
|
1676
1690
|
}),
|
|
1677
1691
|
rawDescription: description,
|
|
1678
1692
|
help: helpComponent,
|
|
1679
|
-
rawHelp: typeof help ===
|
|
1693
|
+
rawHelp: typeof help === 'string' ? help : undefined,
|
|
1680
1694
|
errors: errorsComponent,
|
|
1681
1695
|
rawErrors: hideError ? undefined : __errors,
|
|
1682
1696
|
id: id,
|
|
@@ -1690,7 +1704,7 @@ function SchemaFieldRender(props) {
|
|
|
1690
1704
|
readonly: readonly,
|
|
1691
1705
|
hideError: hideError,
|
|
1692
1706
|
displayLabel: displayLabel,
|
|
1693
|
-
classNames: classNames.join(
|
|
1707
|
+
classNames: classNames.join(' ').trim(),
|
|
1694
1708
|
style: uiOptions.style,
|
|
1695
1709
|
formContext: formContext,
|
|
1696
1710
|
formData: formData,
|
|
@@ -1700,68 +1714,72 @@ function SchemaFieldRender(props) {
|
|
|
1700
1714
|
};
|
|
1701
1715
|
var _AnyOfField = registry.fields.AnyOfField;
|
|
1702
1716
|
var _OneOfField = registry.fields.OneOfField;
|
|
1703
|
-
var isReplacingAnyOrOneOf = (uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema[
|
|
1704
|
-
return
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1717
|
+
var isReplacingAnyOrOneOf = (uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema['ui:field']) && (uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema['ui:fieldReplacesAnyOrOneOf']) === true;
|
|
1718
|
+
return jsxRuntime.jsx(FieldTemplate, _extends({}, fieldProps, {
|
|
1719
|
+
children: jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1720
|
+
children: [field, schema.anyOf && !isReplacingAnyOrOneOf && !schemaUtils.isSelect(schema) && jsxRuntime.jsx(_AnyOfField, {
|
|
1721
|
+
name: name,
|
|
1722
|
+
disabled: disabled,
|
|
1723
|
+
readonly: readonly,
|
|
1724
|
+
hideError: hideError,
|
|
1725
|
+
errorSchema: errorSchema,
|
|
1726
|
+
formData: formData,
|
|
1727
|
+
formContext: formContext,
|
|
1728
|
+
idPrefix: idPrefix,
|
|
1729
|
+
idSchema: idSchema,
|
|
1730
|
+
idSeparator: idSeparator,
|
|
1731
|
+
onBlur: props.onBlur,
|
|
1732
|
+
onChange: props.onChange,
|
|
1733
|
+
onFocus: props.onFocus,
|
|
1734
|
+
options: schema.anyOf.map(function (_schema) {
|
|
1735
|
+
return schemaUtils.retrieveSchema(isObject__default["default"](_schema) ? _schema : {}, formData);
|
|
1736
|
+
}),
|
|
1737
|
+
baseType: schema.type,
|
|
1738
|
+
registry: registry,
|
|
1739
|
+
schema: schema,
|
|
1740
|
+
uiSchema: uiSchema
|
|
1741
|
+
}), schema.oneOf && !isReplacingAnyOrOneOf && !schemaUtils.isSelect(schema) && jsxRuntime.jsx(_OneOfField, {
|
|
1742
|
+
name: name,
|
|
1743
|
+
disabled: disabled,
|
|
1744
|
+
readonly: readonly,
|
|
1745
|
+
hideError: hideError,
|
|
1746
|
+
errorSchema: errorSchema,
|
|
1747
|
+
formData: formData,
|
|
1748
|
+
formContext: formContext,
|
|
1749
|
+
idPrefix: idPrefix,
|
|
1750
|
+
idSchema: idSchema,
|
|
1751
|
+
idSeparator: idSeparator,
|
|
1752
|
+
onBlur: props.onBlur,
|
|
1753
|
+
onChange: props.onChange,
|
|
1754
|
+
onFocus: props.onFocus,
|
|
1755
|
+
options: schema.oneOf.map(function (_schema) {
|
|
1756
|
+
return schemaUtils.retrieveSchema(isObject__default["default"](_schema) ? _schema : {}, formData);
|
|
1757
|
+
}),
|
|
1758
|
+
baseType: schema.type,
|
|
1759
|
+
registry: registry,
|
|
1760
|
+
schema: schema,
|
|
1761
|
+
uiSchema: uiSchema
|
|
1762
|
+
})]
|
|
1763
|
+
})
|
|
1764
|
+
}));
|
|
1747
1765
|
}
|
|
1748
1766
|
/** The `SchemaField` component determines whether it is necessary to rerender the component based on any props changes
|
|
1749
1767
|
* and if so, calls the `SchemaFieldRender` component with the props.
|
|
1750
1768
|
*/
|
|
1751
|
-
var SchemaField = /*#__PURE__*/function (
|
|
1752
|
-
_inheritsLoose(SchemaField,
|
|
1769
|
+
var SchemaField = /*#__PURE__*/function (_Component) {
|
|
1770
|
+
_inheritsLoose(SchemaField, _Component);
|
|
1753
1771
|
function SchemaField() {
|
|
1754
|
-
return
|
|
1772
|
+
return _Component.apply(this, arguments) || this;
|
|
1755
1773
|
}
|
|
1756
1774
|
var _proto = SchemaField.prototype;
|
|
1757
1775
|
_proto.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {
|
|
1758
1776
|
return !utils.deepEquals(this.props, nextProps);
|
|
1759
1777
|
};
|
|
1760
1778
|
_proto.render = function render() {
|
|
1761
|
-
return
|
|
1779
|
+
return jsxRuntime.jsx(SchemaFieldRender, _extends({}, this.props));
|
|
1762
1780
|
};
|
|
1763
1781
|
return SchemaField;
|
|
1764
|
-
}(
|
|
1782
|
+
}(react.Component);
|
|
1765
1783
|
|
|
1766
1784
|
var _excluded$5 = ["widget", "placeholder"];
|
|
1767
1785
|
/** The `StringField` component is used to render a schema field that represents a string type
|
|
@@ -1792,7 +1810,7 @@ function StringField(props) {
|
|
|
1792
1810
|
formContext = registry.formContext,
|
|
1793
1811
|
schemaUtils = registry.schemaUtils;
|
|
1794
1812
|
var enumOptions = schemaUtils.isSelect(schema) ? utils.optionsList(schema) : undefined;
|
|
1795
|
-
var defaultWidget = enumOptions ?
|
|
1813
|
+
var defaultWidget = enumOptions ? 'select' : 'text';
|
|
1796
1814
|
if (format && utils.hasWidget(schema, format, widgets)) {
|
|
1797
1815
|
defaultWidget = format;
|
|
1798
1816
|
}
|
|
@@ -1800,16 +1818,17 @@ function StringField(props) {
|
|
|
1800
1818
|
_getUiOptions$widget = _getUiOptions.widget,
|
|
1801
1819
|
widget = _getUiOptions$widget === void 0 ? defaultWidget : _getUiOptions$widget,
|
|
1802
1820
|
_getUiOptions$placeho = _getUiOptions.placeholder,
|
|
1803
|
-
placeholder = _getUiOptions$placeho === void 0 ?
|
|
1821
|
+
placeholder = _getUiOptions$placeho === void 0 ? '' : _getUiOptions$placeho,
|
|
1804
1822
|
options = _objectWithoutPropertiesLoose(_getUiOptions, _excluded$5);
|
|
1805
1823
|
var Widget = utils.getWidget(schema, widget, widgets);
|
|
1806
|
-
return
|
|
1824
|
+
return jsxRuntime.jsx(Widget, {
|
|
1807
1825
|
options: _extends({}, options, {
|
|
1808
1826
|
enumOptions: enumOptions
|
|
1809
1827
|
}),
|
|
1810
1828
|
schema: schema,
|
|
1811
1829
|
uiSchema: uiSchema,
|
|
1812
1830
|
id: idSchema.$id,
|
|
1831
|
+
name: name,
|
|
1813
1832
|
label: title === undefined ? name : title,
|
|
1814
1833
|
value: formData,
|
|
1815
1834
|
onChange: onChange,
|
|
@@ -1834,7 +1853,7 @@ function StringField(props) {
|
|
|
1834
1853
|
function NullField(props) {
|
|
1835
1854
|
var formData = props.formData,
|
|
1836
1855
|
onChange = props.onChange;
|
|
1837
|
-
|
|
1856
|
+
react.useEffect(function () {
|
|
1838
1857
|
if (formData === undefined) {
|
|
1839
1858
|
onChange(null);
|
|
1840
1859
|
}
|
|
@@ -1874,8 +1893,8 @@ function ArrayFieldDescriptionTemplate(props) {
|
|
|
1874
1893
|
if (!description || !displayLabel) {
|
|
1875
1894
|
return null;
|
|
1876
1895
|
}
|
|
1877
|
-
var DescriptionFieldTemplate = utils.getTemplate(
|
|
1878
|
-
return
|
|
1896
|
+
var DescriptionFieldTemplate = utils.getTemplate('DescriptionFieldTemplate', registry, options);
|
|
1897
|
+
return jsxRuntime.jsx(DescriptionFieldTemplate, {
|
|
1879
1898
|
id: utils.descriptionId(idSchema),
|
|
1880
1899
|
description: description,
|
|
1881
1900
|
schema: schema,
|
|
@@ -1910,39 +1929,43 @@ function ArrayFieldItemTemplate(props) {
|
|
|
1910
1929
|
flex: 1,
|
|
1911
1930
|
paddingLeft: 6,
|
|
1912
1931
|
paddingRight: 6,
|
|
1913
|
-
fontWeight:
|
|
1932
|
+
fontWeight: 'bold'
|
|
1914
1933
|
};
|
|
1915
|
-
return
|
|
1916
|
-
className: className
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1934
|
+
return jsxRuntime.jsxs("div", {
|
|
1935
|
+
className: className,
|
|
1936
|
+
children: [jsxRuntime.jsx("div", {
|
|
1937
|
+
className: hasToolbar ? 'col-xs-9' : 'col-xs-12',
|
|
1938
|
+
children: children
|
|
1939
|
+
}), hasToolbar && jsxRuntime.jsx("div", {
|
|
1940
|
+
className: 'col-xs-3 array-item-toolbox',
|
|
1941
|
+
children: jsxRuntime.jsxs("div", {
|
|
1942
|
+
className: 'btn-group',
|
|
1943
|
+
style: {
|
|
1944
|
+
display: 'flex',
|
|
1945
|
+
justifyContent: 'space-around'
|
|
1946
|
+
},
|
|
1947
|
+
children: [(hasMoveUp || hasMoveDown) && jsxRuntime.jsx(MoveUpButton, {
|
|
1948
|
+
style: btnStyle,
|
|
1949
|
+
disabled: disabled || readonly || !hasMoveUp,
|
|
1950
|
+
onClick: onReorderClick(index, index - 1),
|
|
1951
|
+
uiSchema: uiSchema,
|
|
1952
|
+
registry: registry
|
|
1953
|
+
}), (hasMoveUp || hasMoveDown) && jsxRuntime.jsx(MoveDownButton, {
|
|
1954
|
+
style: btnStyle,
|
|
1955
|
+
disabled: disabled || readonly || !hasMoveDown,
|
|
1956
|
+
onClick: onReorderClick(index, index + 1),
|
|
1957
|
+
uiSchema: uiSchema,
|
|
1958
|
+
registry: registry
|
|
1959
|
+
}), hasRemove && jsxRuntime.jsx(RemoveButton, {
|
|
1960
|
+
style: btnStyle,
|
|
1961
|
+
disabled: disabled || readonly,
|
|
1962
|
+
onClick: onDropIndexClick(index),
|
|
1963
|
+
uiSchema: uiSchema,
|
|
1964
|
+
registry: registry
|
|
1965
|
+
})]
|
|
1966
|
+
})
|
|
1967
|
+
})]
|
|
1968
|
+
});
|
|
1946
1969
|
}
|
|
1947
1970
|
|
|
1948
1971
|
var _excluded$4 = ["key"];
|
|
@@ -1964,42 +1987,42 @@ function ArrayFieldTemplate(props) {
|
|
|
1964
1987
|
schema = props.schema,
|
|
1965
1988
|
title = props.title;
|
|
1966
1989
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
1967
|
-
var ArrayFieldDescriptionTemplate = utils.getTemplate(
|
|
1968
|
-
var ArrayFieldItemTemplate = utils.getTemplate(
|
|
1969
|
-
var ArrayFieldTitleTemplate = utils.getTemplate(
|
|
1990
|
+
var ArrayFieldDescriptionTemplate = utils.getTemplate('ArrayFieldDescriptionTemplate', registry, uiOptions);
|
|
1991
|
+
var ArrayFieldItemTemplate = utils.getTemplate('ArrayFieldItemTemplate', registry, uiOptions);
|
|
1992
|
+
var ArrayFieldTitleTemplate = utils.getTemplate('ArrayFieldTitleTemplate', registry, uiOptions);
|
|
1970
1993
|
// Button templates are not overridden in the uiSchema
|
|
1971
1994
|
var AddButton = registry.templates.ButtonTemplates.AddButton;
|
|
1972
|
-
return
|
|
1995
|
+
return jsxRuntime.jsxs("fieldset", {
|
|
1973
1996
|
className: className,
|
|
1974
|
-
id: idSchema.$id
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
},
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
})
|
|
1997
|
+
id: idSchema.$id,
|
|
1998
|
+
children: [jsxRuntime.jsx(ArrayFieldTitleTemplate, {
|
|
1999
|
+
idSchema: idSchema,
|
|
2000
|
+
title: uiOptions.title || title,
|
|
2001
|
+
required: required,
|
|
2002
|
+
schema: schema,
|
|
2003
|
+
uiSchema: uiSchema,
|
|
2004
|
+
registry: registry
|
|
2005
|
+
}), jsxRuntime.jsx(ArrayFieldDescriptionTemplate, {
|
|
2006
|
+
idSchema: idSchema,
|
|
2007
|
+
description: uiOptions.description || schema.description,
|
|
2008
|
+
schema: schema,
|
|
2009
|
+
uiSchema: uiSchema,
|
|
2010
|
+
registry: registry
|
|
2011
|
+
}), jsxRuntime.jsx("div", {
|
|
2012
|
+
className: 'row array-item-list',
|
|
2013
|
+
children: items && items.map(function (_ref) {
|
|
2014
|
+
var key = _ref.key,
|
|
2015
|
+
itemProps = _objectWithoutPropertiesLoose(_ref, _excluded$4);
|
|
2016
|
+
return jsxRuntime.jsx(ArrayFieldItemTemplate, _extends({}, itemProps), key);
|
|
2017
|
+
})
|
|
2018
|
+
}), canAdd && jsxRuntime.jsx(AddButton, {
|
|
2019
|
+
className: 'array-item-add',
|
|
2020
|
+
onClick: onAddClick,
|
|
2021
|
+
disabled: disabled || readonly,
|
|
2022
|
+
uiSchema: uiSchema,
|
|
2023
|
+
registry: registry
|
|
2024
|
+
})]
|
|
2025
|
+
});
|
|
2003
2026
|
}
|
|
2004
2027
|
|
|
2005
2028
|
/** The `ArrayFieldTitleTemplate` component renders a `TitleFieldTemplate` with an `id` derived from
|
|
@@ -2020,8 +2043,8 @@ function ArrayFieldTitleTemplate(props) {
|
|
|
2020
2043
|
if (!title || !displayLabel) {
|
|
2021
2044
|
return null;
|
|
2022
2045
|
}
|
|
2023
|
-
var TitleFieldTemplate = utils.getTemplate(
|
|
2024
|
-
return
|
|
2046
|
+
var TitleFieldTemplate = utils.getTemplate('TitleFieldTemplate', registry, options);
|
|
2047
|
+
return jsxRuntime.jsx(TitleFieldTemplate, {
|
|
2025
2048
|
id: utils.titleId(idSchema),
|
|
2026
2049
|
title: title,
|
|
2027
2050
|
required: required,
|
|
@@ -2031,7 +2054,7 @@ function ArrayFieldTitleTemplate(props) {
|
|
|
2031
2054
|
});
|
|
2032
2055
|
}
|
|
2033
2056
|
|
|
2034
|
-
var _excluded$3 = ["id", "value", "readonly", "disabled", "autofocus", "onBlur", "onFocus", "onChange", "options", "schema", "uiSchema", "formContext", "registry", "rawErrors", "type"];
|
|
2057
|
+
var _excluded$3 = ["id", "name", "value", "readonly", "disabled", "autofocus", "onBlur", "onFocus", "onChange", "onChangeOverride", "options", "schema", "uiSchema", "formContext", "registry", "rawErrors", "type"];
|
|
2035
2058
|
/** The `BaseInputTemplate` is the template to use to render the basic `<input>` component for the `core` theme.
|
|
2036
2059
|
* It is used as the template for rendering many of the <input> based widgets that differ by `type` and callbacks only.
|
|
2037
2060
|
* It can be customized/overridden for other themes or individual implementations as needed.
|
|
@@ -2047,6 +2070,7 @@ function BaseInputTemplate(props) {
|
|
|
2047
2070
|
onBlur = props.onBlur,
|
|
2048
2071
|
onFocus = props.onFocus,
|
|
2049
2072
|
onChange = props.onChange,
|
|
2073
|
+
onChangeOverride = props.onChangeOverride,
|
|
2050
2074
|
options = props.options,
|
|
2051
2075
|
schema = props.schema,
|
|
2052
2076
|
type = props.type,
|
|
@@ -2054,51 +2078,52 @@ function BaseInputTemplate(props) {
|
|
|
2054
2078
|
// Note: since React 15.2.0 we can't forward unknown element attributes, so we
|
|
2055
2079
|
// exclude the "options" and "schema" ones here.
|
|
2056
2080
|
if (!id) {
|
|
2057
|
-
console.log(
|
|
2081
|
+
console.log('No id for', props);
|
|
2058
2082
|
throw new Error("no id for props " + JSON.stringify(props));
|
|
2059
2083
|
}
|
|
2060
2084
|
var inputProps = _extends({}, rest, utils.getInputProps(schema, type, options));
|
|
2061
2085
|
var inputValue;
|
|
2062
|
-
if (inputProps.type ===
|
|
2063
|
-
inputValue = value || value === 0 ? value :
|
|
2086
|
+
if (inputProps.type === 'number' || inputProps.type === 'integer') {
|
|
2087
|
+
inputValue = value || value === 0 ? value : '';
|
|
2064
2088
|
} else {
|
|
2065
|
-
inputValue = value == null ?
|
|
2089
|
+
inputValue = value == null ? '' : value;
|
|
2066
2090
|
}
|
|
2067
|
-
var _onChange =
|
|
2091
|
+
var _onChange = react.useCallback(function (_ref) {
|
|
2068
2092
|
var value = _ref.target.value;
|
|
2069
|
-
return onChange(value ===
|
|
2093
|
+
return onChange(value === '' ? options.emptyValue : value);
|
|
2070
2094
|
}, [onChange, options]);
|
|
2071
|
-
var _onBlur =
|
|
2095
|
+
var _onBlur = react.useCallback(function (_ref2) {
|
|
2072
2096
|
var value = _ref2.target.value;
|
|
2073
2097
|
return onBlur(id, value);
|
|
2074
2098
|
}, [onBlur, id]);
|
|
2075
|
-
var _onFocus =
|
|
2099
|
+
var _onFocus = react.useCallback(function (_ref3) {
|
|
2076
2100
|
var value = _ref3.target.value;
|
|
2077
2101
|
return onFocus(id, value);
|
|
2078
2102
|
}, [onFocus, id]);
|
|
2079
|
-
return
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2103
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
2104
|
+
children: [jsxRuntime.jsx("input", _extends({
|
|
2105
|
+
id: id,
|
|
2106
|
+
name: id,
|
|
2107
|
+
className: 'form-control',
|
|
2108
|
+
readOnly: readonly,
|
|
2109
|
+
disabled: disabled,
|
|
2110
|
+
autoFocus: autofocus,
|
|
2111
|
+
value: inputValue
|
|
2112
|
+
}, inputProps, {
|
|
2113
|
+
list: schema.examples ? utils.examplesId(id) : undefined,
|
|
2114
|
+
onChange: onChangeOverride || _onChange,
|
|
2115
|
+
onBlur: _onBlur,
|
|
2116
|
+
onFocus: _onFocus,
|
|
2117
|
+
"aria-describedby": utils.ariaDescribedByIds(id, !!schema.examples)
|
|
2118
|
+
})), Array.isArray(schema.examples) && jsxRuntime.jsx("datalist", {
|
|
2119
|
+
id: utils.examplesId(id),
|
|
2120
|
+
children: schema.examples.concat(schema["default"] && !schema.examples.includes(schema["default"]) ? [schema["default"]] : []).map(function (example) {
|
|
2121
|
+
return jsxRuntime.jsx("option", {
|
|
2122
|
+
value: example
|
|
2123
|
+
}, example);
|
|
2124
|
+
})
|
|
2125
|
+
}, "datalist_" + id)]
|
|
2126
|
+
});
|
|
2102
2127
|
}
|
|
2103
2128
|
|
|
2104
2129
|
/** The `SubmitButton` renders a button that represent the `Submit` action on a form
|
|
@@ -2113,53 +2138,58 @@ function SubmitButton(_ref) {
|
|
|
2113
2138
|
if (norender) {
|
|
2114
2139
|
return null;
|
|
2115
2140
|
}
|
|
2116
|
-
return
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2141
|
+
return jsxRuntime.jsx("div", {
|
|
2142
|
+
children: jsxRuntime.jsx("button", _extends({
|
|
2143
|
+
type: 'submit'
|
|
2144
|
+
}, submitButtonProps, {
|
|
2145
|
+
className: "btn btn-info " + submitButtonProps.className,
|
|
2146
|
+
children: submitText
|
|
2147
|
+
}))
|
|
2148
|
+
});
|
|
2121
2149
|
}
|
|
2122
2150
|
|
|
2123
2151
|
var _excluded$2 = ["iconType", "icon", "className", "uiSchema", "registry"];
|
|
2124
2152
|
function IconButton(props) {
|
|
2125
2153
|
var _props$iconType = props.iconType,
|
|
2126
|
-
iconType = _props$iconType === void 0 ?
|
|
2154
|
+
iconType = _props$iconType === void 0 ? 'default' : _props$iconType,
|
|
2127
2155
|
icon = props.icon,
|
|
2128
2156
|
className = props.className,
|
|
2129
2157
|
otherProps = _objectWithoutPropertiesLoose(props, _excluded$2);
|
|
2130
|
-
return
|
|
2131
|
-
type:
|
|
2158
|
+
return jsxRuntime.jsx("button", _extends({
|
|
2159
|
+
type: 'button',
|
|
2132
2160
|
className: "btn btn-" + iconType + " " + className
|
|
2133
|
-
}, otherProps
|
|
2134
|
-
|
|
2161
|
+
}, otherProps, {
|
|
2162
|
+
children: jsxRuntime.jsx("i", {
|
|
2163
|
+
className: "glyphicon glyphicon-" + icon
|
|
2164
|
+
})
|
|
2135
2165
|
}));
|
|
2136
2166
|
}
|
|
2137
2167
|
function MoveDownButton(props) {
|
|
2138
2168
|
var translateString = props.registry.translateString;
|
|
2139
|
-
return
|
|
2169
|
+
return jsxRuntime.jsx(IconButton, _extends({
|
|
2140
2170
|
title: translateString(utils.TranslatableString.MoveDownButton),
|
|
2141
|
-
className:
|
|
2171
|
+
className: 'array-item-move-down'
|
|
2142
2172
|
}, props, {
|
|
2143
|
-
icon:
|
|
2173
|
+
icon: 'arrow-down'
|
|
2144
2174
|
}));
|
|
2145
2175
|
}
|
|
2146
2176
|
function MoveUpButton(props) {
|
|
2147
2177
|
var translateString = props.registry.translateString;
|
|
2148
|
-
return
|
|
2178
|
+
return jsxRuntime.jsx(IconButton, _extends({
|
|
2149
2179
|
title: translateString(utils.TranslatableString.MoveUpButton),
|
|
2150
|
-
className:
|
|
2180
|
+
className: 'array-item-move-up'
|
|
2151
2181
|
}, props, {
|
|
2152
|
-
icon:
|
|
2182
|
+
icon: 'arrow-up'
|
|
2153
2183
|
}));
|
|
2154
2184
|
}
|
|
2155
2185
|
function RemoveButton(props) {
|
|
2156
2186
|
var translateString = props.registry.translateString;
|
|
2157
|
-
return
|
|
2187
|
+
return jsxRuntime.jsx(IconButton, _extends({
|
|
2158
2188
|
title: translateString(utils.TranslatableString.RemoveButton),
|
|
2159
|
-
className:
|
|
2189
|
+
className: 'array-item-remove'
|
|
2160
2190
|
}, props, {
|
|
2161
|
-
iconType:
|
|
2162
|
-
icon:
|
|
2191
|
+
iconType: 'danger',
|
|
2192
|
+
icon: 'remove'
|
|
2163
2193
|
}));
|
|
2164
2194
|
}
|
|
2165
2195
|
|
|
@@ -2171,19 +2201,21 @@ function AddButton(_ref) {
|
|
|
2171
2201
|
disabled = _ref.disabled,
|
|
2172
2202
|
registry = _ref.registry;
|
|
2173
2203
|
var translateString = registry.translateString;
|
|
2174
|
-
return
|
|
2175
|
-
className:
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2204
|
+
return jsxRuntime.jsx("div", {
|
|
2205
|
+
className: 'row',
|
|
2206
|
+
children: jsxRuntime.jsx("p", {
|
|
2207
|
+
className: "col-xs-3 col-xs-offset-9 text-right " + className,
|
|
2208
|
+
children: jsxRuntime.jsx(IconButton, {
|
|
2209
|
+
iconType: 'info',
|
|
2210
|
+
icon: 'plus',
|
|
2211
|
+
className: 'btn-add col-xs-12',
|
|
2212
|
+
title: translateString(utils.TranslatableString.AddButton),
|
|
2213
|
+
onClick: onClick,
|
|
2214
|
+
disabled: disabled,
|
|
2215
|
+
registry: registry
|
|
2216
|
+
})
|
|
2217
|
+
})
|
|
2218
|
+
});
|
|
2187
2219
|
}
|
|
2188
2220
|
|
|
2189
2221
|
function buttonTemplates() {
|
|
@@ -2206,16 +2238,18 @@ function DescriptionField(props) {
|
|
|
2206
2238
|
if (!description) {
|
|
2207
2239
|
return null;
|
|
2208
2240
|
}
|
|
2209
|
-
if (typeof description ===
|
|
2210
|
-
return
|
|
2241
|
+
if (typeof description === 'string') {
|
|
2242
|
+
return jsxRuntime.jsx("p", {
|
|
2211
2243
|
id: id,
|
|
2212
|
-
className:
|
|
2213
|
-
|
|
2244
|
+
className: 'field-description',
|
|
2245
|
+
children: description
|
|
2246
|
+
});
|
|
2214
2247
|
} else {
|
|
2215
|
-
return
|
|
2248
|
+
return jsxRuntime.jsx("div", {
|
|
2216
2249
|
id: id,
|
|
2217
|
-
className:
|
|
2218
|
-
|
|
2250
|
+
className: 'field-description',
|
|
2251
|
+
children: description
|
|
2252
|
+
});
|
|
2219
2253
|
}
|
|
2220
2254
|
}
|
|
2221
2255
|
|
|
@@ -2227,23 +2261,27 @@ function ErrorList(_ref) {
|
|
|
2227
2261
|
var errors = _ref.errors,
|
|
2228
2262
|
registry = _ref.registry;
|
|
2229
2263
|
var translateString = registry.translateString;
|
|
2230
|
-
return
|
|
2231
|
-
className:
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2264
|
+
return jsxRuntime.jsxs("div", {
|
|
2265
|
+
className: 'panel panel-danger errors',
|
|
2266
|
+
children: [jsxRuntime.jsx("div", {
|
|
2267
|
+
className: 'panel-heading',
|
|
2268
|
+
children: jsxRuntime.jsx("h3", {
|
|
2269
|
+
className: 'panel-title',
|
|
2270
|
+
children: translateString(utils.TranslatableString.ErrorsLabel)
|
|
2271
|
+
})
|
|
2272
|
+
}), jsxRuntime.jsx("ul", {
|
|
2273
|
+
className: 'list-group',
|
|
2274
|
+
children: errors.map(function (error, i) {
|
|
2275
|
+
return jsxRuntime.jsx("li", {
|
|
2276
|
+
className: 'list-group-item text-danger',
|
|
2277
|
+
children: error.stack
|
|
2278
|
+
}, i);
|
|
2279
|
+
})
|
|
2280
|
+
})]
|
|
2281
|
+
});
|
|
2244
2282
|
}
|
|
2245
2283
|
|
|
2246
|
-
var REQUIRED_FIELD_SYMBOL$1 =
|
|
2284
|
+
var REQUIRED_FIELD_SYMBOL$1 = '*';
|
|
2247
2285
|
/** Renders a label for a field
|
|
2248
2286
|
*
|
|
2249
2287
|
* @param props - The `LabelProps` for this component
|
|
@@ -2255,12 +2293,14 @@ function Label(props) {
|
|
|
2255
2293
|
if (!label) {
|
|
2256
2294
|
return null;
|
|
2257
2295
|
}
|
|
2258
|
-
return
|
|
2259
|
-
className:
|
|
2260
|
-
htmlFor: id
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2296
|
+
return jsxRuntime.jsxs("label", {
|
|
2297
|
+
className: 'control-label',
|
|
2298
|
+
htmlFor: id,
|
|
2299
|
+
children: [label, required && jsxRuntime.jsx("span", {
|
|
2300
|
+
className: 'required',
|
|
2301
|
+
children: REQUIRED_FIELD_SYMBOL$1
|
|
2302
|
+
})]
|
|
2303
|
+
});
|
|
2264
2304
|
}
|
|
2265
2305
|
|
|
2266
2306
|
/** The `FieldTemplate` component is the template used by `SchemaField` to render any field. It renders the field
|
|
@@ -2281,17 +2321,20 @@ function FieldTemplate(props) {
|
|
|
2281
2321
|
registry = props.registry,
|
|
2282
2322
|
uiSchema = props.uiSchema;
|
|
2283
2323
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
2284
|
-
var WrapIfAdditionalTemplate = utils.getTemplate(
|
|
2324
|
+
var WrapIfAdditionalTemplate = utils.getTemplate('WrapIfAdditionalTemplate', registry, uiOptions);
|
|
2285
2325
|
if (hidden) {
|
|
2286
|
-
return
|
|
2287
|
-
className:
|
|
2288
|
-
|
|
2326
|
+
return jsxRuntime.jsx("div", {
|
|
2327
|
+
className: 'hidden',
|
|
2328
|
+
children: children
|
|
2329
|
+
});
|
|
2289
2330
|
}
|
|
2290
|
-
return
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2331
|
+
return jsxRuntime.jsxs(WrapIfAdditionalTemplate, _extends({}, props, {
|
|
2332
|
+
children: [displayLabel && jsxRuntime.jsx(Label, {
|
|
2333
|
+
label: label,
|
|
2334
|
+
required: required,
|
|
2335
|
+
id: id
|
|
2336
|
+
}), displayLabel && description ? description : null, children, errors, help]
|
|
2337
|
+
}));
|
|
2295
2338
|
}
|
|
2296
2339
|
|
|
2297
2340
|
/** The `FieldErrorTemplate` component renders the errors local to the particular field
|
|
@@ -2306,17 +2349,20 @@ function FieldErrorTemplate(props) {
|
|
|
2306
2349
|
return null;
|
|
2307
2350
|
}
|
|
2308
2351
|
var id = utils.errorId(idSchema);
|
|
2309
|
-
return
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2352
|
+
return jsxRuntime.jsx("div", {
|
|
2353
|
+
children: jsxRuntime.jsx("ul", {
|
|
2354
|
+
id: id,
|
|
2355
|
+
className: 'error-detail bs-callout bs-callout-info',
|
|
2356
|
+
children: errors.filter(function (elem) {
|
|
2357
|
+
return !!elem;
|
|
2358
|
+
}).map(function (error, index) {
|
|
2359
|
+
return jsxRuntime.jsx("li", {
|
|
2360
|
+
className: 'text-danger',
|
|
2361
|
+
children: error
|
|
2362
|
+
}, index);
|
|
2363
|
+
})
|
|
2364
|
+
})
|
|
2365
|
+
});
|
|
2320
2366
|
}
|
|
2321
2367
|
|
|
2322
2368
|
/** The `FieldHelpTemplate` component renders any help desired for a field
|
|
@@ -2330,16 +2376,18 @@ function FieldHelpTemplate(props) {
|
|
|
2330
2376
|
return null;
|
|
2331
2377
|
}
|
|
2332
2378
|
var id = utils.helpId(idSchema);
|
|
2333
|
-
if (typeof help ===
|
|
2334
|
-
return
|
|
2379
|
+
if (typeof help === 'string') {
|
|
2380
|
+
return jsxRuntime.jsx("p", {
|
|
2335
2381
|
id: id,
|
|
2336
|
-
className:
|
|
2337
|
-
|
|
2382
|
+
className: 'help-block',
|
|
2383
|
+
children: help
|
|
2384
|
+
});
|
|
2338
2385
|
}
|
|
2339
|
-
return
|
|
2386
|
+
return jsxRuntime.jsx("div", {
|
|
2340
2387
|
id: id,
|
|
2341
|
-
className:
|
|
2342
|
-
|
|
2388
|
+
className: 'help-block',
|
|
2389
|
+
children: help
|
|
2390
|
+
});
|
|
2343
2391
|
}
|
|
2344
2392
|
|
|
2345
2393
|
/** The `ObjectFieldTemplate` is the template to use to render all the inner properties of an object along with the
|
|
@@ -2362,37 +2410,38 @@ function ObjectFieldTemplate(props) {
|
|
|
2362
2410
|
title = props.title,
|
|
2363
2411
|
uiSchema = props.uiSchema;
|
|
2364
2412
|
var options = utils.getUiOptions(uiSchema);
|
|
2365
|
-
var TitleFieldTemplate = utils.getTemplate(
|
|
2366
|
-
var DescriptionFieldTemplate = utils.getTemplate(
|
|
2413
|
+
var TitleFieldTemplate = utils.getTemplate('TitleFieldTemplate', registry, options);
|
|
2414
|
+
var DescriptionFieldTemplate = utils.getTemplate('DescriptionFieldTemplate', registry, options);
|
|
2367
2415
|
// Button templates are not overridden in the uiSchema
|
|
2368
2416
|
var AddButton = registry.templates.ButtonTemplates.AddButton;
|
|
2369
|
-
return
|
|
2370
|
-
id: idSchema.$id
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2417
|
+
return jsxRuntime.jsxs("fieldset", {
|
|
2418
|
+
id: idSchema.$id,
|
|
2419
|
+
children: [(options.title || title) && jsxRuntime.jsx(TitleFieldTemplate, {
|
|
2420
|
+
id: utils.titleId(idSchema),
|
|
2421
|
+
title: options.title || title,
|
|
2422
|
+
required: required,
|
|
2423
|
+
schema: schema,
|
|
2424
|
+
uiSchema: uiSchema,
|
|
2425
|
+
registry: registry
|
|
2426
|
+
}), (options.description || description) && jsxRuntime.jsx(DescriptionFieldTemplate, {
|
|
2427
|
+
id: utils.descriptionId(idSchema),
|
|
2428
|
+
description: options.description || description,
|
|
2429
|
+
schema: schema,
|
|
2430
|
+
uiSchema: uiSchema,
|
|
2431
|
+
registry: registry
|
|
2432
|
+
}), properties.map(function (prop) {
|
|
2433
|
+
return prop.content;
|
|
2434
|
+
}), utils.canExpand(schema, uiSchema, formData) && jsxRuntime.jsx(AddButton, {
|
|
2435
|
+
className: 'object-property-expand',
|
|
2436
|
+
onClick: onAddClick(schema),
|
|
2437
|
+
disabled: disabled || readonly,
|
|
2438
|
+
uiSchema: uiSchema,
|
|
2439
|
+
registry: registry
|
|
2440
|
+
})]
|
|
2441
|
+
});
|
|
2393
2442
|
}
|
|
2394
2443
|
|
|
2395
|
-
var REQUIRED_FIELD_SYMBOL =
|
|
2444
|
+
var REQUIRED_FIELD_SYMBOL = '*';
|
|
2396
2445
|
/** The `TitleField` is the template to use to render the title of a field
|
|
2397
2446
|
*
|
|
2398
2447
|
* @param props - The `TitleFieldProps` for this component
|
|
@@ -2401,11 +2450,13 @@ function TitleField(props) {
|
|
|
2401
2450
|
var id = props.id,
|
|
2402
2451
|
title = props.title,
|
|
2403
2452
|
required = props.required;
|
|
2404
|
-
return
|
|
2405
|
-
id: id
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2453
|
+
return jsxRuntime.jsxs("legend", {
|
|
2454
|
+
id: id,
|
|
2455
|
+
children: [title, required && jsxRuntime.jsx("span", {
|
|
2456
|
+
className: 'required',
|
|
2457
|
+
children: REQUIRED_FIELD_SYMBOL
|
|
2458
|
+
})]
|
|
2459
|
+
});
|
|
2409
2460
|
}
|
|
2410
2461
|
|
|
2411
2462
|
/** The `UnsupportedField` component is used to render a field in the schema is one that is not supported by
|
|
@@ -2429,9 +2480,16 @@ function UnsupportedField(props) {
|
|
|
2429
2480
|
translateEnum = translateEnum === utils.TranslatableString.UnsupportedField ? utils.TranslatableString.UnsupportedFieldWithReason : utils.TranslatableString.UnsupportedFieldWithIdAndReason;
|
|
2430
2481
|
translateParams.push(reason);
|
|
2431
2482
|
}
|
|
2432
|
-
return
|
|
2433
|
-
className:
|
|
2434
|
-
|
|
2483
|
+
return jsxRuntime.jsxs("div", {
|
|
2484
|
+
className: 'unsupported-field',
|
|
2485
|
+
children: [jsxRuntime.jsx("p", {
|
|
2486
|
+
children: jsxRuntime.jsx(Markdown__default["default"], {
|
|
2487
|
+
children: translateString(translateEnum, translateParams)
|
|
2488
|
+
})
|
|
2489
|
+
}), schema && jsxRuntime.jsx("pre", {
|
|
2490
|
+
children: JSON.stringify(schema, null, 2)
|
|
2491
|
+
})]
|
|
2492
|
+
});
|
|
2435
2493
|
}
|
|
2436
2494
|
|
|
2437
2495
|
/** The `WrapIfAdditional` component is used by the `FieldTemplate` to rename, or remove properties that are
|
|
@@ -2460,46 +2518,53 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
2460
2518
|
var keyLabel = translateString(utils.TranslatableString.KeyLabel, [label]);
|
|
2461
2519
|
var additional = (utils.ADDITIONAL_PROPERTY_FLAG in schema);
|
|
2462
2520
|
if (!additional) {
|
|
2463
|
-
return
|
|
2521
|
+
return jsxRuntime.jsx("div", {
|
|
2464
2522
|
className: classNames,
|
|
2465
|
-
style: style
|
|
2466
|
-
|
|
2523
|
+
style: style,
|
|
2524
|
+
children: children
|
|
2525
|
+
});
|
|
2467
2526
|
}
|
|
2468
|
-
return
|
|
2527
|
+
return jsxRuntime.jsx("div", {
|
|
2469
2528
|
className: classNames,
|
|
2470
|
-
style: style
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2529
|
+
style: style,
|
|
2530
|
+
children: jsxRuntime.jsxs("div", {
|
|
2531
|
+
className: 'row',
|
|
2532
|
+
children: [jsxRuntime.jsx("div", {
|
|
2533
|
+
className: 'col-xs-5 form-additional',
|
|
2534
|
+
children: jsxRuntime.jsxs("div", {
|
|
2535
|
+
className: 'form-group',
|
|
2536
|
+
children: [jsxRuntime.jsx(Label, {
|
|
2537
|
+
label: keyLabel,
|
|
2538
|
+
required: required,
|
|
2539
|
+
id: id + "-key"
|
|
2540
|
+
}), jsxRuntime.jsx("input", {
|
|
2541
|
+
className: 'form-control',
|
|
2542
|
+
type: 'text',
|
|
2543
|
+
id: id + "-key",
|
|
2544
|
+
onBlur: function onBlur(event) {
|
|
2545
|
+
return onKeyChange(event.target.value);
|
|
2546
|
+
},
|
|
2547
|
+
defaultValue: label
|
|
2548
|
+
})]
|
|
2549
|
+
})
|
|
2550
|
+
}), jsxRuntime.jsx("div", {
|
|
2551
|
+
className: 'form-additional form-group col-xs-5',
|
|
2552
|
+
children: children
|
|
2553
|
+
}), jsxRuntime.jsx("div", {
|
|
2554
|
+
className: 'col-xs-2',
|
|
2555
|
+
children: jsxRuntime.jsx(RemoveButton, {
|
|
2556
|
+
className: 'array-item-remove btn-block',
|
|
2557
|
+
style: {
|
|
2558
|
+
border: '0'
|
|
2559
|
+
},
|
|
2560
|
+
disabled: disabled || readonly,
|
|
2561
|
+
onClick: onDropPropertyClick(label),
|
|
2562
|
+
uiSchema: uiSchema,
|
|
2563
|
+
registry: registry
|
|
2564
|
+
})
|
|
2565
|
+
})]
|
|
2566
|
+
})
|
|
2567
|
+
});
|
|
2503
2568
|
}
|
|
2504
2569
|
|
|
2505
2570
|
function templates() {
|
|
@@ -2548,29 +2613,29 @@ function dateElementProps(state, time, yearsRange) {
|
|
|
2548
2613
|
minute = state.minute,
|
|
2549
2614
|
second = state.second;
|
|
2550
2615
|
var data = [{
|
|
2551
|
-
type:
|
|
2616
|
+
type: 'year',
|
|
2552
2617
|
range: yearsRange,
|
|
2553
2618
|
value: year
|
|
2554
2619
|
}, {
|
|
2555
|
-
type:
|
|
2620
|
+
type: 'month',
|
|
2556
2621
|
range: [1, 12],
|
|
2557
2622
|
value: month
|
|
2558
2623
|
}, {
|
|
2559
|
-
type:
|
|
2624
|
+
type: 'day',
|
|
2560
2625
|
range: [1, 31],
|
|
2561
2626
|
value: day
|
|
2562
2627
|
}];
|
|
2563
2628
|
if (time) {
|
|
2564
2629
|
data.push({
|
|
2565
|
-
type:
|
|
2630
|
+
type: 'hour',
|
|
2566
2631
|
range: [0, 23],
|
|
2567
2632
|
value: hour
|
|
2568
2633
|
}, {
|
|
2569
|
-
type:
|
|
2634
|
+
type: 'minute',
|
|
2570
2635
|
range: [0, 59],
|
|
2571
2636
|
value: minute
|
|
2572
2637
|
}, {
|
|
2573
|
-
type:
|
|
2638
|
+
type: 'second',
|
|
2574
2639
|
range: [0, 59],
|
|
2575
2640
|
value: second
|
|
2576
2641
|
});
|
|
@@ -2583,20 +2648,22 @@ function DateElement(_ref) {
|
|
|
2583
2648
|
value = _ref.value,
|
|
2584
2649
|
select = _ref.select,
|
|
2585
2650
|
rootId = _ref.rootId,
|
|
2651
|
+
name = _ref.name,
|
|
2586
2652
|
disabled = _ref.disabled,
|
|
2587
2653
|
readonly = _ref.readonly,
|
|
2588
2654
|
autofocus = _ref.autofocus,
|
|
2589
2655
|
registry = _ref.registry,
|
|
2590
2656
|
onBlur = _ref.onBlur,
|
|
2591
2657
|
onFocus = _ref.onFocus;
|
|
2592
|
-
var id = rootId +
|
|
2658
|
+
var id = rootId + '_' + type;
|
|
2593
2659
|
var SelectWidget = registry.widgets.SelectWidget;
|
|
2594
|
-
return
|
|
2660
|
+
return jsxRuntime.jsx(SelectWidget, {
|
|
2595
2661
|
schema: {
|
|
2596
|
-
type:
|
|
2662
|
+
type: 'integer'
|
|
2597
2663
|
},
|
|
2598
2664
|
id: id,
|
|
2599
|
-
|
|
2665
|
+
name: name,
|
|
2666
|
+
className: 'form-control',
|
|
2600
2667
|
options: {
|
|
2601
2668
|
enumOptions: rangeOptions(range[0], range[1])
|
|
2602
2669
|
},
|
|
@@ -2611,7 +2678,7 @@ function DateElement(_ref) {
|
|
|
2611
2678
|
onBlur: onBlur,
|
|
2612
2679
|
onFocus: onFocus,
|
|
2613
2680
|
registry: registry,
|
|
2614
|
-
label:
|
|
2681
|
+
label: '',
|
|
2615
2682
|
"aria-describedby": utils.ariaDescribedByIds(rootId)
|
|
2616
2683
|
});
|
|
2617
2684
|
}
|
|
@@ -2629,33 +2696,34 @@ function AltDateWidget(_ref2) {
|
|
|
2629
2696
|
autofocus = _ref2$autofocus === void 0 ? false : _ref2$autofocus,
|
|
2630
2697
|
options = _ref2.options,
|
|
2631
2698
|
id = _ref2.id,
|
|
2699
|
+
name = _ref2.name,
|
|
2632
2700
|
registry = _ref2.registry,
|
|
2633
2701
|
onBlur = _ref2.onBlur,
|
|
2634
2702
|
onFocus = _ref2.onFocus,
|
|
2635
2703
|
onChange = _ref2.onChange,
|
|
2636
2704
|
value = _ref2.value;
|
|
2637
2705
|
var translateString = registry.translateString;
|
|
2638
|
-
var _useReducer =
|
|
2706
|
+
var _useReducer = react.useReducer(function (state, action) {
|
|
2639
2707
|
return _extends({}, state, action);
|
|
2640
2708
|
}, utils.parseDateString(value, time)),
|
|
2641
2709
|
state = _useReducer[0],
|
|
2642
2710
|
setState = _useReducer[1];
|
|
2643
|
-
|
|
2711
|
+
react.useEffect(function () {
|
|
2644
2712
|
if (value && value !== utils.toDateString(state, time)) {
|
|
2645
2713
|
setState(utils.parseDateString(value, time));
|
|
2646
2714
|
}
|
|
2647
2715
|
}, [value, state, time]);
|
|
2648
|
-
|
|
2716
|
+
react.useEffect(function () {
|
|
2649
2717
|
if (readyForChange(state)) {
|
|
2650
2718
|
// Only propagate to parent state if we have a complete date{time}
|
|
2651
2719
|
onChange(utils.toDateString(state, time));
|
|
2652
2720
|
}
|
|
2653
2721
|
}, [state, time, onChange]);
|
|
2654
|
-
var handleChange =
|
|
2722
|
+
var handleChange = react.useCallback(function (property, value) {
|
|
2655
2723
|
var _setState;
|
|
2656
2724
|
setState((_setState = {}, _setState[property] = value, _setState));
|
|
2657
2725
|
}, []);
|
|
2658
|
-
var handleSetNow =
|
|
2726
|
+
var handleSetNow = react.useCallback(function (event) {
|
|
2659
2727
|
event.preventDefault();
|
|
2660
2728
|
if (disabled || readonly) {
|
|
2661
2729
|
return;
|
|
@@ -2663,44 +2731,50 @@ function AltDateWidget(_ref2) {
|
|
|
2663
2731
|
var nowDateObj = utils.parseDateString(new Date().toJSON(), time);
|
|
2664
2732
|
setState(nowDateObj);
|
|
2665
2733
|
}, [disabled, readonly, time]);
|
|
2666
|
-
var handleClear =
|
|
2734
|
+
var handleClear = react.useCallback(function (event) {
|
|
2667
2735
|
event.preventDefault();
|
|
2668
2736
|
if (disabled || readonly) {
|
|
2669
2737
|
return;
|
|
2670
2738
|
}
|
|
2671
|
-
setState(utils.parseDateString(
|
|
2739
|
+
setState(utils.parseDateString('', time));
|
|
2672
2740
|
onChange(undefined);
|
|
2673
2741
|
}, [disabled, readonly, time, onChange]);
|
|
2674
|
-
return
|
|
2675
|
-
className:
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2742
|
+
return jsxRuntime.jsxs("ul", {
|
|
2743
|
+
className: 'list-inline',
|
|
2744
|
+
children: [dateElementProps(state, time, options.yearsRange).map(function (elemProps, i) {
|
|
2745
|
+
return jsxRuntime.jsx("li", {
|
|
2746
|
+
className: 'list-inline-item',
|
|
2747
|
+
children: jsxRuntime.jsx(DateElement, _extends({
|
|
2748
|
+
rootId: id,
|
|
2749
|
+
name: name,
|
|
2750
|
+
select: handleChange
|
|
2751
|
+
}, elemProps, {
|
|
2752
|
+
disabled: disabled,
|
|
2753
|
+
readonly: readonly,
|
|
2754
|
+
registry: registry,
|
|
2755
|
+
onBlur: onBlur,
|
|
2756
|
+
onFocus: onFocus,
|
|
2757
|
+
autofocus: autofocus && i === 0
|
|
2758
|
+
}))
|
|
2759
|
+
}, i);
|
|
2760
|
+
}), (options.hideNowButton !== 'undefined' ? !options.hideNowButton : true) && jsxRuntime.jsx("li", {
|
|
2761
|
+
className: 'list-inline-item',
|
|
2762
|
+
children: jsxRuntime.jsx("a", {
|
|
2763
|
+
href: '#',
|
|
2764
|
+
className: 'btn btn-info btn-now',
|
|
2765
|
+
onClick: handleSetNow,
|
|
2766
|
+
children: translateString(utils.TranslatableString.NowLabel)
|
|
2767
|
+
})
|
|
2768
|
+
}), (options.hideClearButton !== 'undefined' ? !options.hideClearButton : true) && jsxRuntime.jsx("li", {
|
|
2769
|
+
className: 'list-inline-item',
|
|
2770
|
+
children: jsxRuntime.jsx("a", {
|
|
2771
|
+
href: '#',
|
|
2772
|
+
className: 'btn btn-warning btn-clear',
|
|
2773
|
+
onClick: handleClear,
|
|
2774
|
+
children: translateString(utils.TranslatableString.ClearLabel)
|
|
2775
|
+
})
|
|
2776
|
+
})]
|
|
2777
|
+
});
|
|
2704
2778
|
}
|
|
2705
2779
|
|
|
2706
2780
|
var _excluded$1 = ["time"];
|
|
@@ -2714,7 +2788,7 @@ function AltDateTimeWidget(_ref) {
|
|
|
2714
2788
|
time = _ref$time === void 0 ? true : _ref$time,
|
|
2715
2789
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
2716
2790
|
var AltDateWidget = props.registry.widgets.AltDateWidget;
|
|
2717
|
-
return
|
|
2791
|
+
return jsxRuntime.jsx(AltDateWidget, _extends({
|
|
2718
2792
|
time: time
|
|
2719
2793
|
}, props));
|
|
2720
2794
|
}
|
|
@@ -2739,41 +2813,46 @@ function CheckboxWidget(_ref) {
|
|
|
2739
2813
|
onFocus = _ref.onFocus,
|
|
2740
2814
|
onChange = _ref.onChange,
|
|
2741
2815
|
registry = _ref.registry;
|
|
2742
|
-
var DescriptionFieldTemplate = utils.getTemplate(
|
|
2816
|
+
var DescriptionFieldTemplate = utils.getTemplate('DescriptionFieldTemplate', registry, options);
|
|
2743
2817
|
// Because an unchecked checkbox will cause html5 validation to fail, only add
|
|
2744
2818
|
// the "required" attribute if the field value must be "true", due to the
|
|
2745
2819
|
// "const" or "enum" keywords
|
|
2746
2820
|
var required = utils.schemaRequiresTrueValue(schema);
|
|
2747
|
-
var handleChange =
|
|
2821
|
+
var handleChange = react.useCallback(function (event) {
|
|
2748
2822
|
return onChange(event.target.checked);
|
|
2749
2823
|
}, [onChange]);
|
|
2750
|
-
var handleBlur =
|
|
2824
|
+
var handleBlur = react.useCallback(function (event) {
|
|
2751
2825
|
return onBlur(id, event.target.checked);
|
|
2752
2826
|
}, [onBlur, id]);
|
|
2753
|
-
var handleFocus =
|
|
2827
|
+
var handleFocus = react.useCallback(function (event) {
|
|
2754
2828
|
return onFocus(id, event.target.checked);
|
|
2755
2829
|
}, [onFocus, id]);
|
|
2756
|
-
return
|
|
2757
|
-
className: "checkbox " + (disabled || readonly ?
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2830
|
+
return jsxRuntime.jsxs("div", {
|
|
2831
|
+
className: "checkbox " + (disabled || readonly ? 'disabled' : ''),
|
|
2832
|
+
children: [schema.description && jsxRuntime.jsx(DescriptionFieldTemplate, {
|
|
2833
|
+
id: utils.descriptionId(id),
|
|
2834
|
+
description: schema.description,
|
|
2835
|
+
schema: schema,
|
|
2836
|
+
uiSchema: uiSchema,
|
|
2837
|
+
registry: registry
|
|
2838
|
+
}), jsxRuntime.jsxs("label", {
|
|
2839
|
+
children: [jsxRuntime.jsx("input", {
|
|
2840
|
+
type: 'checkbox',
|
|
2841
|
+
id: id,
|
|
2842
|
+
name: id,
|
|
2843
|
+
checked: typeof value === 'undefined' ? false : value,
|
|
2844
|
+
required: required,
|
|
2845
|
+
disabled: disabled || readonly,
|
|
2846
|
+
autoFocus: autofocus,
|
|
2847
|
+
onChange: handleChange,
|
|
2848
|
+
onBlur: handleBlur,
|
|
2849
|
+
onFocus: handleFocus,
|
|
2850
|
+
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
2851
|
+
}), jsxRuntime.jsx("span", {
|
|
2852
|
+
children: label
|
|
2853
|
+
})]
|
|
2854
|
+
})]
|
|
2855
|
+
});
|
|
2777
2856
|
}
|
|
2778
2857
|
|
|
2779
2858
|
/** The `CheckboxesWidget` is a widget for rendering checkbox groups.
|
|
@@ -2798,49 +2877,56 @@ function CheckboxesWidget(_ref) {
|
|
|
2798
2877
|
onBlur = _ref.onBlur,
|
|
2799
2878
|
onFocus = _ref.onFocus;
|
|
2800
2879
|
var checkboxesValues = Array.isArray(value) ? value : [value];
|
|
2801
|
-
var handleBlur =
|
|
2880
|
+
var handleBlur = react.useCallback(function (_ref2) {
|
|
2802
2881
|
var value = _ref2.target.value;
|
|
2803
2882
|
return onBlur(id, utils.enumOptionsValueForIndex(value, enumOptions, emptyValue));
|
|
2804
2883
|
}, [onBlur, id]);
|
|
2805
|
-
var handleFocus =
|
|
2884
|
+
var handleFocus = react.useCallback(function (_ref3) {
|
|
2806
2885
|
var value = _ref3.target.value;
|
|
2807
2886
|
return onFocus(id, utils.enumOptionsValueForIndex(value, enumOptions, emptyValue));
|
|
2808
2887
|
}, [onFocus, id]);
|
|
2809
|
-
return
|
|
2810
|
-
className:
|
|
2811
|
-
id: id
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2888
|
+
return jsxRuntime.jsx("div", {
|
|
2889
|
+
className: 'checkboxes',
|
|
2890
|
+
id: id,
|
|
2891
|
+
children: Array.isArray(enumOptions) && enumOptions.map(function (option, index) {
|
|
2892
|
+
var checked = utils.enumOptionsIsSelected(option.value, checkboxesValues);
|
|
2893
|
+
var itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
2894
|
+
var disabledCls = disabled || itemDisabled || readonly ? 'disabled' : '';
|
|
2895
|
+
var handleChange = function handleChange(event) {
|
|
2896
|
+
if (event.target.checked) {
|
|
2897
|
+
onChange(utils.enumOptionsSelectValue(index, checkboxesValues, enumOptions));
|
|
2898
|
+
} else {
|
|
2899
|
+
onChange(utils.enumOptionsDeselectValue(index, checkboxesValues, enumOptions));
|
|
2900
|
+
}
|
|
2901
|
+
};
|
|
2902
|
+
var checkbox = jsxRuntime.jsxs("span", {
|
|
2903
|
+
children: [jsxRuntime.jsx("input", {
|
|
2904
|
+
type: 'checkbox',
|
|
2905
|
+
id: utils.optionId(id, index),
|
|
2906
|
+
name: id,
|
|
2907
|
+
checked: checked,
|
|
2908
|
+
value: String(index),
|
|
2909
|
+
disabled: disabled || itemDisabled || readonly,
|
|
2910
|
+
autoFocus: autofocus && index === 0,
|
|
2911
|
+
onChange: handleChange,
|
|
2912
|
+
onBlur: handleBlur,
|
|
2913
|
+
onFocus: handleFocus,
|
|
2914
|
+
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
2915
|
+
}), jsxRuntime.jsx("span", {
|
|
2916
|
+
children: option.label
|
|
2917
|
+
})]
|
|
2918
|
+
});
|
|
2919
|
+
return inline ? jsxRuntime.jsx("label", {
|
|
2920
|
+
className: "checkbox-inline " + disabledCls,
|
|
2921
|
+
children: checkbox
|
|
2922
|
+
}, index) : jsxRuntime.jsx("div", {
|
|
2923
|
+
className: "checkbox " + disabledCls,
|
|
2924
|
+
children: jsxRuntime.jsx("label", {
|
|
2925
|
+
children: checkbox
|
|
2926
|
+
})
|
|
2927
|
+
}, index);
|
|
2928
|
+
})
|
|
2929
|
+
});
|
|
2844
2930
|
}
|
|
2845
2931
|
|
|
2846
2932
|
/** The `ColorWidget` component uses the `BaseInputTemplate` changing the type to `color` and disables it when it is
|
|
@@ -2853,9 +2939,9 @@ function ColorWidget(props) {
|
|
|
2853
2939
|
readonly = props.readonly,
|
|
2854
2940
|
options = props.options,
|
|
2855
2941
|
registry = props.registry;
|
|
2856
|
-
var BaseInputTemplate = utils.getTemplate(
|
|
2857
|
-
return
|
|
2858
|
-
type:
|
|
2942
|
+
var BaseInputTemplate = utils.getTemplate('BaseInputTemplate', registry, options);
|
|
2943
|
+
return jsxRuntime.jsx(BaseInputTemplate, _extends({
|
|
2944
|
+
type: 'color'
|
|
2859
2945
|
}, props, {
|
|
2860
2946
|
disabled: disabled || readonly
|
|
2861
2947
|
}));
|
|
@@ -2870,12 +2956,12 @@ function DateWidget(props) {
|
|
|
2870
2956
|
var onChange = props.onChange,
|
|
2871
2957
|
options = props.options,
|
|
2872
2958
|
registry = props.registry;
|
|
2873
|
-
var BaseInputTemplate = utils.getTemplate(
|
|
2874
|
-
var handleChange =
|
|
2959
|
+
var BaseInputTemplate = utils.getTemplate('BaseInputTemplate', registry, options);
|
|
2960
|
+
var handleChange = react.useCallback(function (value) {
|
|
2875
2961
|
return onChange(value || undefined);
|
|
2876
2962
|
}, [onChange]);
|
|
2877
|
-
return
|
|
2878
|
-
type:
|
|
2963
|
+
return jsxRuntime.jsx(BaseInputTemplate, _extends({
|
|
2964
|
+
type: 'date'
|
|
2879
2965
|
}, props, {
|
|
2880
2966
|
onChange: handleChange
|
|
2881
2967
|
}));
|
|
@@ -2891,9 +2977,9 @@ function DateTimeWidget(props) {
|
|
|
2891
2977
|
value = props.value,
|
|
2892
2978
|
options = props.options,
|
|
2893
2979
|
registry = props.registry;
|
|
2894
|
-
var BaseInputTemplate = utils.getTemplate(
|
|
2895
|
-
return
|
|
2896
|
-
type:
|
|
2980
|
+
var BaseInputTemplate = utils.getTemplate('BaseInputTemplate', registry, options);
|
|
2981
|
+
return jsxRuntime.jsx(BaseInputTemplate, _extends({
|
|
2982
|
+
type: 'datetime-local'
|
|
2897
2983
|
}, props, {
|
|
2898
2984
|
value: utils.utcToLocal(value),
|
|
2899
2985
|
onChange: function onChange(value) {
|
|
@@ -2909,9 +2995,9 @@ function DateTimeWidget(props) {
|
|
|
2909
2995
|
function EmailWidget(props) {
|
|
2910
2996
|
var options = props.options,
|
|
2911
2997
|
registry = props.registry;
|
|
2912
|
-
var BaseInputTemplate = utils.getTemplate(
|
|
2913
|
-
return
|
|
2914
|
-
type:
|
|
2998
|
+
var BaseInputTemplate = utils.getTemplate('BaseInputTemplate', registry, options);
|
|
2999
|
+
return jsxRuntime.jsx(BaseInputTemplate, _extends({
|
|
3000
|
+
type: 'email'
|
|
2915
3001
|
}, props));
|
|
2916
3002
|
}
|
|
2917
3003
|
|
|
@@ -2919,7 +3005,7 @@ function addNameToDataURL(dataURL, name) {
|
|
|
2919
3005
|
if (dataURL === null) {
|
|
2920
3006
|
return null;
|
|
2921
3007
|
}
|
|
2922
|
-
return dataURL.replace(
|
|
3008
|
+
return dataURL.replace(';base64', ";name=" + encodeURIComponent(name) + ";base64");
|
|
2923
3009
|
}
|
|
2924
3010
|
function processFile(file) {
|
|
2925
3011
|
var name = file.name,
|
|
@@ -2930,7 +3016,7 @@ function processFile(file) {
|
|
|
2930
3016
|
reader.onerror = reject;
|
|
2931
3017
|
reader.onload = function (event) {
|
|
2932
3018
|
var _event$target;
|
|
2933
|
-
if (typeof ((_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.result) ===
|
|
3019
|
+
if (typeof ((_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.result) === 'string') {
|
|
2934
3020
|
resolve({
|
|
2935
3021
|
dataURL: addNameToDataURL(event.target.result, name),
|
|
2936
3022
|
name: name,
|
|
@@ -2959,20 +3045,23 @@ function FilesInfo(_ref) {
|
|
|
2959
3045
|
return null;
|
|
2960
3046
|
}
|
|
2961
3047
|
var translateString = registry.translateString;
|
|
2962
|
-
return
|
|
2963
|
-
className:
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
3048
|
+
return jsxRuntime.jsx("ul", {
|
|
3049
|
+
className: 'file-info',
|
|
3050
|
+
children: filesInfo.map(function (fileInfo, key) {
|
|
3051
|
+
var name = fileInfo.name,
|
|
3052
|
+
size = fileInfo.size,
|
|
3053
|
+
type = fileInfo.type;
|
|
3054
|
+
return jsxRuntime.jsx("li", {
|
|
3055
|
+
children: jsxRuntime.jsx(Markdown__default["default"], {
|
|
3056
|
+
children: translateString(utils.TranslatableString.FilesInfo, [name, type, String(size)])
|
|
3057
|
+
})
|
|
3058
|
+
}, key);
|
|
3059
|
+
})
|
|
3060
|
+
});
|
|
2972
3061
|
}
|
|
2973
3062
|
function extractFileInfo(dataURLs) {
|
|
2974
3063
|
return dataURLs.filter(function (dataURL) {
|
|
2975
|
-
return
|
|
3064
|
+
return dataURL;
|
|
2976
3065
|
}).map(function (dataURL) {
|
|
2977
3066
|
var _dataURItoBlob = utils.dataURItoBlob(dataURL),
|
|
2978
3067
|
blob = _dataURItoBlob.blob,
|
|
@@ -2988,24 +3077,22 @@ function extractFileInfo(dataURLs) {
|
|
|
2988
3077
|
* The `FileWidget` is a widget for rendering file upload fields.
|
|
2989
3078
|
* It is typically used with a string property with data-url format.
|
|
2990
3079
|
*/
|
|
2991
|
-
function FileWidget(
|
|
2992
|
-
var
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
registry = _ref2.registry;
|
|
3002
|
-
var extractedFilesInfo = React.useMemo(function () {
|
|
3080
|
+
function FileWidget(props) {
|
|
3081
|
+
var disabled = props.disabled,
|
|
3082
|
+
readonly = props.readonly,
|
|
3083
|
+
multiple = props.multiple,
|
|
3084
|
+
onChange = props.onChange,
|
|
3085
|
+
value = props.value,
|
|
3086
|
+
options = props.options,
|
|
3087
|
+
registry = props.registry;
|
|
3088
|
+
var BaseInputTemplate = utils.getTemplate('BaseInputTemplate', registry, options);
|
|
3089
|
+
var extractedFilesInfo = react.useMemo(function () {
|
|
3003
3090
|
return Array.isArray(value) ? extractFileInfo(value) : extractFileInfo([value]);
|
|
3004
3091
|
}, [value]);
|
|
3005
|
-
var _useState =
|
|
3092
|
+
var _useState = react.useState(extractedFilesInfo),
|
|
3006
3093
|
filesInfo = _useState[0],
|
|
3007
3094
|
setFilesInfo = _useState[1];
|
|
3008
|
-
var handleChange =
|
|
3095
|
+
var handleChange = react.useCallback(function (event) {
|
|
3009
3096
|
if (!event.target.files) {
|
|
3010
3097
|
return;
|
|
3011
3098
|
}
|
|
@@ -3021,21 +3108,18 @@ function FileWidget(_ref2) {
|
|
|
3021
3108
|
}
|
|
3022
3109
|
});
|
|
3023
3110
|
}, [multiple, onChange]);
|
|
3024
|
-
return
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
})
|
|
3036
|
-
filesInfo: filesInfo,
|
|
3037
|
-
registry: registry
|
|
3038
|
-
}));
|
|
3111
|
+
return jsxRuntime.jsxs("div", {
|
|
3112
|
+
children: [jsxRuntime.jsx(BaseInputTemplate, _extends({}, props, {
|
|
3113
|
+
disabled: disabled || readonly,
|
|
3114
|
+
type: 'file',
|
|
3115
|
+
onChangeOverride: handleChange,
|
|
3116
|
+
value: '',
|
|
3117
|
+
accept: options.accept ? String(options.accept) : undefined
|
|
3118
|
+
})), jsxRuntime.jsx(FilesInfo, {
|
|
3119
|
+
filesInfo: filesInfo,
|
|
3120
|
+
registry: registry
|
|
3121
|
+
})]
|
|
3122
|
+
});
|
|
3039
3123
|
}
|
|
3040
3124
|
|
|
3041
3125
|
/** The `HiddenWidget` is a widget for rendering a hidden input field.
|
|
@@ -3046,11 +3130,11 @@ function FileWidget(_ref2) {
|
|
|
3046
3130
|
function HiddenWidget(_ref) {
|
|
3047
3131
|
var id = _ref.id,
|
|
3048
3132
|
value = _ref.value;
|
|
3049
|
-
return
|
|
3050
|
-
type:
|
|
3133
|
+
return jsxRuntime.jsx("input", {
|
|
3134
|
+
type: 'hidden',
|
|
3051
3135
|
id: id,
|
|
3052
3136
|
name: id,
|
|
3053
|
-
value: typeof value ===
|
|
3137
|
+
value: typeof value === 'undefined' ? '' : value
|
|
3054
3138
|
});
|
|
3055
3139
|
}
|
|
3056
3140
|
|
|
@@ -3061,9 +3145,9 @@ function HiddenWidget(_ref) {
|
|
|
3061
3145
|
function PasswordWidget(props) {
|
|
3062
3146
|
var options = props.options,
|
|
3063
3147
|
registry = props.registry;
|
|
3064
|
-
var BaseInputTemplate = utils.getTemplate(
|
|
3065
|
-
return
|
|
3066
|
-
type:
|
|
3148
|
+
var BaseInputTemplate = utils.getTemplate('BaseInputTemplate', registry, options);
|
|
3149
|
+
return jsxRuntime.jsx(BaseInputTemplate, _extends({
|
|
3150
|
+
type: 'password'
|
|
3067
3151
|
}, props));
|
|
3068
3152
|
}
|
|
3069
3153
|
|
|
@@ -3090,46 +3174,53 @@ function RadioWidget(_ref) {
|
|
|
3090
3174
|
enumDisabled = options.enumDisabled,
|
|
3091
3175
|
inline = options.inline,
|
|
3092
3176
|
emptyValue = options.emptyValue;
|
|
3093
|
-
var handleBlur =
|
|
3177
|
+
var handleBlur = react.useCallback(function (_ref2) {
|
|
3094
3178
|
var value = _ref2.target.value;
|
|
3095
3179
|
return onBlur(id, utils.enumOptionsValueForIndex(value, enumOptions, emptyValue));
|
|
3096
3180
|
}, [onBlur, id]);
|
|
3097
|
-
var handleFocus =
|
|
3181
|
+
var handleFocus = react.useCallback(function (_ref3) {
|
|
3098
3182
|
var value = _ref3.target.value;
|
|
3099
3183
|
return onFocus(id, utils.enumOptionsValueForIndex(value, enumOptions, emptyValue));
|
|
3100
3184
|
}, [onFocus, id]);
|
|
3101
|
-
return
|
|
3102
|
-
className:
|
|
3103
|
-
id: id
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3185
|
+
return jsxRuntime.jsx("div", {
|
|
3186
|
+
className: 'field-radio-group',
|
|
3187
|
+
id: id,
|
|
3188
|
+
children: Array.isArray(enumOptions) && enumOptions.map(function (option, i) {
|
|
3189
|
+
var checked = utils.enumOptionsIsSelected(option.value, value);
|
|
3190
|
+
var itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
3191
|
+
var disabledCls = disabled || itemDisabled || readonly ? 'disabled' : '';
|
|
3192
|
+
var handleChange = function handleChange() {
|
|
3193
|
+
return onChange(option.value);
|
|
3194
|
+
};
|
|
3195
|
+
var radio = jsxRuntime.jsxs("span", {
|
|
3196
|
+
children: [jsxRuntime.jsx("input", {
|
|
3197
|
+
type: 'radio',
|
|
3198
|
+
id: utils.optionId(id, i),
|
|
3199
|
+
checked: checked,
|
|
3200
|
+
name: name,
|
|
3201
|
+
required: required,
|
|
3202
|
+
value: String(i),
|
|
3203
|
+
disabled: disabled || itemDisabled || readonly,
|
|
3204
|
+
autoFocus: autofocus && i === 0,
|
|
3205
|
+
onChange: handleChange,
|
|
3206
|
+
onBlur: handleBlur,
|
|
3207
|
+
onFocus: handleFocus,
|
|
3208
|
+
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
3209
|
+
}), jsxRuntime.jsx("span", {
|
|
3210
|
+
children: option.label
|
|
3211
|
+
})]
|
|
3212
|
+
});
|
|
3213
|
+
return inline ? jsxRuntime.jsx("label", {
|
|
3214
|
+
className: "radio-inline " + disabledCls,
|
|
3215
|
+
children: radio
|
|
3216
|
+
}, i) : jsxRuntime.jsx("div", {
|
|
3217
|
+
className: "radio " + disabledCls,
|
|
3218
|
+
children: jsxRuntime.jsx("label", {
|
|
3219
|
+
children: radio
|
|
3220
|
+
})
|
|
3221
|
+
}, i);
|
|
3222
|
+
})
|
|
3223
|
+
});
|
|
3133
3224
|
}
|
|
3134
3225
|
|
|
3135
3226
|
/** The `RangeWidget` component uses the `BaseInputTemplate` changing the type to `range` and wrapping the result
|
|
@@ -3140,13 +3231,15 @@ function RadioWidget(_ref) {
|
|
|
3140
3231
|
function RangeWidget(props) {
|
|
3141
3232
|
var value = props.value,
|
|
3142
3233
|
BaseInputTemplate = props.registry.templates.BaseInputTemplate;
|
|
3143
|
-
return
|
|
3144
|
-
className:
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3234
|
+
return jsxRuntime.jsxs("div", {
|
|
3235
|
+
className: 'field-range-wrapper',
|
|
3236
|
+
children: [jsxRuntime.jsx(BaseInputTemplate, _extends({
|
|
3237
|
+
type: 'range'
|
|
3238
|
+
}, props)), jsxRuntime.jsx("span", {
|
|
3239
|
+
className: 'range-view',
|
|
3240
|
+
children: value
|
|
3241
|
+
})]
|
|
3242
|
+
});
|
|
3150
3243
|
}
|
|
3151
3244
|
|
|
3152
3245
|
function getValue(event, multiple) {
|
|
@@ -3183,45 +3276,47 @@ function SelectWidget(_ref) {
|
|
|
3183
3276
|
var enumOptions = options.enumOptions,
|
|
3184
3277
|
enumDisabled = options.enumDisabled,
|
|
3185
3278
|
optEmptyVal = options.emptyValue;
|
|
3186
|
-
var emptyValue = multiple ? [] :
|
|
3187
|
-
var handleFocus =
|
|
3279
|
+
var emptyValue = multiple ? [] : '';
|
|
3280
|
+
var handleFocus = react.useCallback(function (event) {
|
|
3188
3281
|
var newValue = getValue(event, multiple);
|
|
3189
3282
|
return onFocus(id, utils.enumOptionsValueForIndex(newValue, enumOptions, optEmptyVal));
|
|
3190
3283
|
}, [onFocus, id, schema, multiple, options]);
|
|
3191
|
-
var handleBlur =
|
|
3284
|
+
var handleBlur = react.useCallback(function (event) {
|
|
3192
3285
|
var newValue = getValue(event, multiple);
|
|
3193
3286
|
return onBlur(id, utils.enumOptionsValueForIndex(newValue, enumOptions, optEmptyVal));
|
|
3194
3287
|
}, [onBlur, id, schema, multiple, options]);
|
|
3195
|
-
var handleChange =
|
|
3288
|
+
var handleChange = react.useCallback(function (event) {
|
|
3196
3289
|
var newValue = getValue(event, multiple);
|
|
3197
3290
|
return onChange(utils.enumOptionsValueForIndex(newValue, enumOptions, optEmptyVal));
|
|
3198
3291
|
}, [onChange, schema, multiple, options]);
|
|
3199
3292
|
var selectedIndexes = utils.enumOptionsIndexForValue(value, enumOptions, multiple);
|
|
3200
|
-
return
|
|
3293
|
+
return jsxRuntime.jsxs("select", {
|
|
3201
3294
|
id: id,
|
|
3202
3295
|
name: id,
|
|
3203
3296
|
multiple: multiple,
|
|
3204
|
-
className:
|
|
3205
|
-
value: typeof selectedIndexes ===
|
|
3297
|
+
className: 'form-control',
|
|
3298
|
+
value: typeof selectedIndexes === 'undefined' ? emptyValue : selectedIndexes,
|
|
3206
3299
|
required: required,
|
|
3207
3300
|
disabled: disabled || readonly,
|
|
3208
3301
|
autoFocus: autofocus,
|
|
3209
3302
|
onBlur: handleBlur,
|
|
3210
3303
|
onFocus: handleFocus,
|
|
3211
3304
|
onChange: handleChange,
|
|
3212
|
-
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3305
|
+
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
3306
|
+
children: [!multiple && schema["default"] === undefined && jsxRuntime.jsx("option", {
|
|
3307
|
+
value: '',
|
|
3308
|
+
children: placeholder
|
|
3309
|
+
}), Array.isArray(enumOptions) && enumOptions.map(function (_ref2, i) {
|
|
3310
|
+
var value = _ref2.value,
|
|
3311
|
+
label = _ref2.label;
|
|
3312
|
+
var disabled = enumDisabled && enumDisabled.indexOf(value) !== -1;
|
|
3313
|
+
return jsxRuntime.jsx("option", {
|
|
3314
|
+
value: String(i),
|
|
3315
|
+
disabled: disabled,
|
|
3316
|
+
children: label
|
|
3317
|
+
}, i);
|
|
3318
|
+
})]
|
|
3319
|
+
});
|
|
3225
3320
|
}
|
|
3226
3321
|
|
|
3227
3322
|
/** The `TextareaWidget` is a widget for rendering input fields as textarea.
|
|
@@ -3242,23 +3337,23 @@ function TextareaWidget(_ref) {
|
|
|
3242
3337
|
onChange = _ref.onChange,
|
|
3243
3338
|
onBlur = _ref.onBlur,
|
|
3244
3339
|
onFocus = _ref.onFocus;
|
|
3245
|
-
var handleChange =
|
|
3340
|
+
var handleChange = react.useCallback(function (_ref2) {
|
|
3246
3341
|
var value = _ref2.target.value;
|
|
3247
|
-
return onChange(value ===
|
|
3342
|
+
return onChange(value === '' ? options.emptyValue : value);
|
|
3248
3343
|
}, [onChange, options.emptyValue]);
|
|
3249
|
-
var handleBlur =
|
|
3344
|
+
var handleBlur = react.useCallback(function (_ref3) {
|
|
3250
3345
|
var value = _ref3.target.value;
|
|
3251
3346
|
return onBlur(id, value);
|
|
3252
3347
|
}, [onBlur, id]);
|
|
3253
|
-
var handleFocus =
|
|
3348
|
+
var handleFocus = react.useCallback(function (_ref4) {
|
|
3254
3349
|
var value = _ref4.target.value;
|
|
3255
3350
|
return onFocus(id, value);
|
|
3256
3351
|
}, [id, onFocus]);
|
|
3257
|
-
return
|
|
3352
|
+
return jsxRuntime.jsx("textarea", {
|
|
3258
3353
|
id: id,
|
|
3259
3354
|
name: id,
|
|
3260
|
-
className:
|
|
3261
|
-
value: value ? value :
|
|
3355
|
+
className: 'form-control',
|
|
3356
|
+
value: value ? value : '',
|
|
3262
3357
|
placeholder: placeholder,
|
|
3263
3358
|
required: required,
|
|
3264
3359
|
disabled: disabled,
|
|
@@ -3283,8 +3378,8 @@ TextareaWidget.defaultProps = {
|
|
|
3283
3378
|
function TextWidget(props) {
|
|
3284
3379
|
var options = props.options,
|
|
3285
3380
|
registry = props.registry;
|
|
3286
|
-
var BaseInputTemplate = utils.getTemplate(
|
|
3287
|
-
return
|
|
3381
|
+
var BaseInputTemplate = utils.getTemplate('BaseInputTemplate', registry, options);
|
|
3382
|
+
return jsxRuntime.jsx(BaseInputTemplate, _extends({}, props));
|
|
3288
3383
|
}
|
|
3289
3384
|
|
|
3290
3385
|
/** The `URLWidget` component uses the `BaseInputTemplate` changing the type to `url`.
|
|
@@ -3294,9 +3389,9 @@ function TextWidget(props) {
|
|
|
3294
3389
|
function URLWidget(props) {
|
|
3295
3390
|
var options = props.options,
|
|
3296
3391
|
registry = props.registry;
|
|
3297
|
-
var BaseInputTemplate = utils.getTemplate(
|
|
3298
|
-
return
|
|
3299
|
-
type:
|
|
3392
|
+
var BaseInputTemplate = utils.getTemplate('BaseInputTemplate', registry, options);
|
|
3393
|
+
return jsxRuntime.jsx(BaseInputTemplate, _extends({
|
|
3394
|
+
type: 'url'
|
|
3300
3395
|
}, props));
|
|
3301
3396
|
}
|
|
3302
3397
|
|
|
@@ -3307,9 +3402,9 @@ function URLWidget(props) {
|
|
|
3307
3402
|
function UpDownWidget(props) {
|
|
3308
3403
|
var options = props.options,
|
|
3309
3404
|
registry = props.registry;
|
|
3310
|
-
var BaseInputTemplate = utils.getTemplate(
|
|
3311
|
-
return
|
|
3312
|
-
type:
|
|
3405
|
+
var BaseInputTemplate = utils.getTemplate('BaseInputTemplate', registry, options);
|
|
3406
|
+
return jsxRuntime.jsx(BaseInputTemplate, _extends({
|
|
3407
|
+
type: 'number'
|
|
3313
3408
|
}, props));
|
|
3314
3409
|
}
|
|
3315
3410
|
|
|
@@ -3370,7 +3465,7 @@ var Form = /*#__PURE__*/function (_Component) {
|
|
|
3370
3465
|
_this.formElement = void 0;
|
|
3371
3466
|
_this.getUsedFormData = function (formData, fields) {
|
|
3372
3467
|
// For the case of a single input form
|
|
3373
|
-
if (fields.length === 0 && typeof formData !==
|
|
3468
|
+
if (fields.length === 0 && typeof formData !== 'object') {
|
|
3374
3469
|
return formData;
|
|
3375
3470
|
}
|
|
3376
3471
|
// _pick has incorrect type definition, it works with string[][], because lodash/hasIn supports it
|
|
@@ -3391,22 +3486,22 @@ var Form = /*#__PURE__*/function (_Component) {
|
|
|
3391
3486
|
paths = [[]];
|
|
3392
3487
|
}
|
|
3393
3488
|
Object.keys(_obj).forEach(function (key) {
|
|
3394
|
-
if (typeof _obj[key] ===
|
|
3489
|
+
if (typeof _obj[key] === 'object') {
|
|
3395
3490
|
var newPaths = paths.map(function (path) {
|
|
3396
3491
|
return [].concat(path, [key]);
|
|
3397
3492
|
});
|
|
3398
3493
|
// If an object is marked with additionalProperties, all its keys are valid
|
|
3399
|
-
if (_obj[key][utils.RJSF_ADDITONAL_PROPERTIES_FLAG] && _obj[key][utils.NAME_KEY] !==
|
|
3494
|
+
if (_obj[key][utils.RJSF_ADDITONAL_PROPERTIES_FLAG] && _obj[key][utils.NAME_KEY] !== '') {
|
|
3400
3495
|
acc.push(_obj[key][utils.NAME_KEY]);
|
|
3401
3496
|
} else {
|
|
3402
3497
|
getAllPaths(_obj[key], acc, newPaths);
|
|
3403
3498
|
}
|
|
3404
|
-
} else if (key === utils.NAME_KEY && _obj[key] !==
|
|
3499
|
+
} else if (key === utils.NAME_KEY && _obj[key] !== '') {
|
|
3405
3500
|
paths.forEach(function (path) {
|
|
3406
3501
|
var formValue = get__default["default"](formData, path);
|
|
3407
3502
|
// adds path to fieldNames if it points to a value
|
|
3408
3503
|
// or an empty object/array
|
|
3409
|
-
if (typeof formValue !==
|
|
3504
|
+
if (typeof formValue !== 'object' || isEmpty__default["default"](formValue)) {
|
|
3410
3505
|
acc.push(path);
|
|
3411
3506
|
}
|
|
3412
3507
|
});
|
|
@@ -3439,7 +3534,7 @@ var Form = /*#__PURE__*/function (_Component) {
|
|
|
3439
3534
|
var newFormData = formData;
|
|
3440
3535
|
if (omitExtraData === true && liveOmit === true) {
|
|
3441
3536
|
var retrievedSchema = schemaUtils.retrieveSchema(schema, formData);
|
|
3442
|
-
var pathSchema = schemaUtils.toPathSchema(retrievedSchema,
|
|
3537
|
+
var pathSchema = schemaUtils.toPathSchema(retrievedSchema, '', formData);
|
|
3443
3538
|
var fieldNames = _this.getFieldNames(pathSchema, formData);
|
|
3444
3539
|
newFormData = _this.getUsedFormData(formData, fieldNames);
|
|
3445
3540
|
state = {
|
|
@@ -3465,7 +3560,7 @@ var Form = /*#__PURE__*/function (_Component) {
|
|
|
3465
3560
|
schemaValidationErrorSchema: schemaValidationErrorSchema
|
|
3466
3561
|
};
|
|
3467
3562
|
} else if (!noValidate && newErrorSchema) {
|
|
3468
|
-
var _errorSchema = extraErrors ? utils.mergeObjects(newErrorSchema, extraErrors,
|
|
3563
|
+
var _errorSchema = extraErrors ? utils.mergeObjects(newErrorSchema, extraErrors, 'preventDuplicates') : newErrorSchema;
|
|
3469
3564
|
state = {
|
|
3470
3565
|
formData: newFormData,
|
|
3471
3566
|
errorSchema: _errorSchema,
|
|
@@ -3505,7 +3600,7 @@ var Form = /*#__PURE__*/function (_Component) {
|
|
|
3505
3600
|
schemaUtils = _this$state2.schemaUtils;
|
|
3506
3601
|
if (omitExtraData === true) {
|
|
3507
3602
|
var retrievedSchema = schemaUtils.retrieveSchema(schema, newFormData);
|
|
3508
|
-
var pathSchema = schemaUtils.toPathSchema(retrievedSchema,
|
|
3603
|
+
var pathSchema = schemaUtils.toPathSchema(retrievedSchema, '', newFormData);
|
|
3509
3604
|
var fieldNames = _this.getFieldNames(pathSchema, newFormData);
|
|
3510
3605
|
newFormData = _this.getUsedFormData(newFormData, fieldNames);
|
|
3511
3606
|
}
|
|
@@ -3524,20 +3619,20 @@ var Form = /*#__PURE__*/function (_Component) {
|
|
|
3524
3619
|
if (onSubmit) {
|
|
3525
3620
|
onSubmit(_extends({}, _this.state, {
|
|
3526
3621
|
formData: newFormData,
|
|
3527
|
-
status:
|
|
3622
|
+
status: 'submitted'
|
|
3528
3623
|
}), event);
|
|
3529
3624
|
}
|
|
3530
3625
|
});
|
|
3531
3626
|
}
|
|
3532
3627
|
};
|
|
3533
3628
|
if (!props.validator) {
|
|
3534
|
-
throw new Error(
|
|
3629
|
+
throw new Error('A validator is required for Form functionality to work');
|
|
3535
3630
|
}
|
|
3536
3631
|
_this.state = _this.getStateFromProps(props, props.formData);
|
|
3537
3632
|
if (_this.props.onChange && !utils.deepEquals(_this.state.formData, _this.props.formData)) {
|
|
3538
3633
|
_this.props.onChange(_this.state);
|
|
3539
3634
|
}
|
|
3540
|
-
_this.formElement = /*#__PURE__*/
|
|
3635
|
+
_this.formElement = /*#__PURE__*/react.createRef();
|
|
3541
3636
|
return _this;
|
|
3542
3637
|
}
|
|
3543
3638
|
/** React lifecycle method that gets called before new props are provided, updates the state based on new props. It
|
|
@@ -3564,10 +3659,10 @@ var Form = /*#__PURE__*/function (_Component) {
|
|
|
3564
3659
|
*/;
|
|
3565
3660
|
_proto.getStateFromProps = function getStateFromProps(props, inputFormData) {
|
|
3566
3661
|
var state = this.state || {};
|
|
3567
|
-
var schema =
|
|
3568
|
-
var uiSchema = (
|
|
3569
|
-
var edit = typeof inputFormData !==
|
|
3570
|
-
var liveValidate =
|
|
3662
|
+
var schema = 'schema' in props ? props.schema : this.props.schema;
|
|
3663
|
+
var uiSchema = ('uiSchema' in props ? props.uiSchema : this.props.uiSchema) || {};
|
|
3664
|
+
var edit = typeof inputFormData !== 'undefined';
|
|
3665
|
+
var liveValidate = 'liveValidate' in props ? props.liveValidate : this.props.liveValidate;
|
|
3571
3666
|
var mustValidate = edit && !props.noValidate && liveValidate;
|
|
3572
3667
|
var rootSchema = schema;
|
|
3573
3668
|
var schemaUtils = state.schemaUtils;
|
|
@@ -3616,7 +3711,7 @@ var Form = /*#__PURE__*/function (_Component) {
|
|
|
3616
3711
|
errorSchema = merged.errorSchema;
|
|
3617
3712
|
errors = merged.errors;
|
|
3618
3713
|
}
|
|
3619
|
-
var idSchema = schemaUtils.toIdSchema(retrievedSchema, uiSchema[
|
|
3714
|
+
var idSchema = schemaUtils.toIdSchema(retrievedSchema, uiSchema['ui:rootFieldId'], formData, props.idPrefix, props.idSeparator);
|
|
3620
3715
|
var nextState = {
|
|
3621
3716
|
schemaUtils: schemaUtils,
|
|
3622
3717
|
schema: schema,
|
|
@@ -3668,9 +3763,9 @@ var Form = /*#__PURE__*/function (_Component) {
|
|
|
3668
3763
|
uiSchema = _this$state3.uiSchema;
|
|
3669
3764
|
var formContext = this.props.formContext;
|
|
3670
3765
|
var options = utils.getUiOptions(uiSchema);
|
|
3671
|
-
var ErrorListTemplate = utils.getTemplate(
|
|
3766
|
+
var ErrorListTemplate = utils.getTemplate('ErrorListTemplate', registry, options);
|
|
3672
3767
|
if (errors && errors.length) {
|
|
3673
|
-
return
|
|
3768
|
+
return jsxRuntime.jsx(ErrorListTemplate, {
|
|
3674
3769
|
errors: errors,
|
|
3675
3770
|
errorSchema: errorSchema || {},
|
|
3676
3771
|
schema: schema,
|
|
@@ -3712,7 +3807,7 @@ var Form = /*#__PURE__*/function (_Component) {
|
|
|
3712
3807
|
/** Provides a function that can be used to programmatically submit the `Form` */;
|
|
3713
3808
|
_proto.submit = function submit() {
|
|
3714
3809
|
if (this.formElement.current) {
|
|
3715
|
-
this.formElement.current.dispatchEvent(new CustomEvent(
|
|
3810
|
+
this.formElement.current.dispatchEvent(new CustomEvent('submit', {
|
|
3716
3811
|
cancelable: true
|
|
3717
3812
|
}));
|
|
3718
3813
|
this.formElement.current.requestSubmit();
|
|
@@ -3727,12 +3822,12 @@ var Form = /*#__PURE__*/function (_Component) {
|
|
|
3727
3822
|
_proto.focusOnError = function focusOnError(error) {
|
|
3728
3823
|
var _this$props4 = this.props,
|
|
3729
3824
|
_this$props4$idPrefix = _this$props4.idPrefix,
|
|
3730
|
-
idPrefix = _this$props4$idPrefix === void 0 ?
|
|
3825
|
+
idPrefix = _this$props4$idPrefix === void 0 ? 'root' : _this$props4$idPrefix,
|
|
3731
3826
|
_this$props4$idSepara = _this$props4.idSeparator,
|
|
3732
|
-
idSeparator = _this$props4$idSepara === void 0 ?
|
|
3827
|
+
idSeparator = _this$props4$idSepara === void 0 ? '_' : _this$props4$idSepara;
|
|
3733
3828
|
var property = error.property;
|
|
3734
3829
|
var path = _toPath__default["default"](property);
|
|
3735
|
-
if (path[0] ===
|
|
3830
|
+
if (path[0] === '') {
|
|
3736
3831
|
// Most of the time the `.foo` property results in the first element being empty, so replace it with the idPrefix
|
|
3737
3832
|
path[0] = idPrefix;
|
|
3738
3833
|
} else {
|
|
@@ -3784,7 +3879,7 @@ var Form = /*#__PURE__*/function (_Component) {
|
|
|
3784
3879
|
if (onError) {
|
|
3785
3880
|
onError(errors);
|
|
3786
3881
|
} else {
|
|
3787
|
-
console.error(
|
|
3882
|
+
console.error('Form validation failed', errors);
|
|
3788
3883
|
}
|
|
3789
3884
|
});
|
|
3790
3885
|
return false;
|
|
@@ -3801,7 +3896,7 @@ var Form = /*#__PURE__*/function (_Component) {
|
|
|
3801
3896
|
idPrefix = _this$props6.idPrefix,
|
|
3802
3897
|
idSeparator = _this$props6.idSeparator,
|
|
3803
3898
|
_this$props6$classNam = _this$props6.className,
|
|
3804
|
-
className = _this$props6$classNam === void 0 ?
|
|
3899
|
+
className = _this$props6$classNam === void 0 ? '' : _this$props6$classNam,
|
|
3805
3900
|
tagName = _this$props6.tagName,
|
|
3806
3901
|
name = _this$props6.name,
|
|
3807
3902
|
method = _this$props6.method,
|
|
@@ -3818,7 +3913,7 @@ var Form = /*#__PURE__*/function (_Component) {
|
|
|
3818
3913
|
readonly = _this$props6$readonly === void 0 ? false : _this$props6$readonly,
|
|
3819
3914
|
formContext = _this$props6.formContext,
|
|
3820
3915
|
_this$props6$showErro = _this$props6.showErrorList,
|
|
3821
|
-
showErrorList = _this$props6$showErro === void 0 ?
|
|
3916
|
+
showErrorList = _this$props6$showErro === void 0 ? 'top' : _this$props6$showErro,
|
|
3822
3917
|
_internalFormWrapper = _this$props6._internalFormWrapper;
|
|
3823
3918
|
var _this$state4 = this.state,
|
|
3824
3919
|
schema = _this$state4.schema,
|
|
@@ -3833,9 +3928,9 @@ var Form = /*#__PURE__*/function (_Component) {
|
|
|
3833
3928
|
// PropTypes.elementType to use for the inner tag, so we'll need to pass `tagName` along if it is provided.
|
|
3834
3929
|
// NOTE, the `as` prop is native to `semantic-ui` and is emulated in the `material-ui` theme
|
|
3835
3930
|
var as = _internalFormWrapper ? tagName : undefined;
|
|
3836
|
-
var FormTag = _internalFormWrapper || tagName ||
|
|
3837
|
-
return
|
|
3838
|
-
className: className ? className :
|
|
3931
|
+
var FormTag = _internalFormWrapper || tagName || 'form';
|
|
3932
|
+
return jsxRuntime.jsxs(FormTag, {
|
|
3933
|
+
className: className ? className : 'rjsf',
|
|
3839
3934
|
id: id,
|
|
3840
3935
|
name: name,
|
|
3841
3936
|
method: method,
|
|
@@ -3847,35 +3942,36 @@ var Form = /*#__PURE__*/function (_Component) {
|
|
|
3847
3942
|
noValidate: noHtml5Validate,
|
|
3848
3943
|
onSubmit: this.onSubmit,
|
|
3849
3944
|
as: as,
|
|
3850
|
-
ref: this.formElement
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3945
|
+
ref: this.formElement,
|
|
3946
|
+
children: [showErrorList === 'top' && this.renderErrors(registry), jsxRuntime.jsx(_SchemaField, {
|
|
3947
|
+
name: '',
|
|
3948
|
+
schema: schema,
|
|
3949
|
+
uiSchema: uiSchema,
|
|
3950
|
+
errorSchema: errorSchema,
|
|
3951
|
+
idSchema: idSchema,
|
|
3952
|
+
idPrefix: idPrefix,
|
|
3953
|
+
idSeparator: idSeparator,
|
|
3954
|
+
formContext: formContext,
|
|
3955
|
+
formData: formData,
|
|
3956
|
+
onChange: this.onChange,
|
|
3957
|
+
onBlur: this.onBlur,
|
|
3958
|
+
onFocus: this.onFocus,
|
|
3959
|
+
registry: registry,
|
|
3960
|
+
disabled: disabled,
|
|
3961
|
+
readonly: readonly
|
|
3962
|
+
}), children ? children : jsxRuntime.jsx(SubmitButton, {
|
|
3963
|
+
uiSchema: uiSchema,
|
|
3964
|
+
registry: registry
|
|
3965
|
+
}), showErrorList === 'bottom' && this.renderErrors(registry)]
|
|
3966
|
+
});
|
|
3871
3967
|
};
|
|
3872
3968
|
return Form;
|
|
3873
|
-
}(
|
|
3969
|
+
}(react.Component);
|
|
3874
3970
|
|
|
3875
3971
|
var _excluded = ["fields", "widgets", "templates"];
|
|
3876
3972
|
/** A Higher-Order component that creates a wrapper around a `Form` with the overrides from the `WithThemeProps` */
|
|
3877
3973
|
function withTheme(themeProps) {
|
|
3878
|
-
return /*#__PURE__*/
|
|
3974
|
+
return /*#__PURE__*/react.forwardRef(function (_ref, ref) {
|
|
3879
3975
|
var _themeProps$templates, _templates;
|
|
3880
3976
|
var fields = _ref.fields,
|
|
3881
3977
|
widgets = _ref.widgets,
|
|
@@ -3886,7 +3982,7 @@ function withTheme(themeProps) {
|
|
|
3886
3982
|
templates = _extends({}, themeProps === null || themeProps === void 0 ? void 0 : themeProps.templates, templates, {
|
|
3887
3983
|
ButtonTemplates: _extends({}, themeProps === null || themeProps === void 0 ? void 0 : (_themeProps$templates = themeProps.templates) === null || _themeProps$templates === void 0 ? void 0 : _themeProps$templates.ButtonTemplates, (_templates = templates) === null || _templates === void 0 ? void 0 : _templates.ButtonTemplates)
|
|
3888
3984
|
});
|
|
3889
|
-
return
|
|
3985
|
+
return jsxRuntime.jsx(Form, _extends({}, themeProps, directProps, {
|
|
3890
3986
|
fields: fields,
|
|
3891
3987
|
widgets: widgets,
|
|
3892
3988
|
templates: templates,
|