@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
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@rjsf/utils'), require('lodash-es/get'), require('lodash-es/isEmpty'), require('lodash-es/pick'), require('lodash-es/toPath'), require('lodash-es/isObject'), require('lodash-es/set'), require('nanoid'), require('lodash-es/omit'), require('lodash-es/has'), require('lodash-es/unset'), require('markdown-to-jsx')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'react', '@rjsf/utils', 'lodash-es/get', 'lodash-es/isEmpty', 'lodash-es/pick', 'lodash-es/toPath', 'lodash-es/isObject', 'lodash-es/set', 'nanoid', 'lodash-es/omit', 'lodash-es/has', 'lodash-es/unset', 'markdown-to-jsx'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.JSONSchemaForm = {}, global.React, global.utils, global.get, global.isEmpty, global._pick, global._toPath, global.isObject, global.set, global.nanoid, global.omit, global.has, global.unset, global.Markdown));
|
|
5
|
-
})(this, (function (exports,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react/jsx-runtime'), require('react'), require('@rjsf/utils'), require('lodash-es/get'), require('lodash-es/isEmpty'), require('lodash-es/pick'), require('lodash-es/toPath'), require('lodash-es/isObject'), require('lodash-es/set'), require('nanoid'), require('lodash-es/omit'), require('lodash-es/has'), require('lodash-es/unset'), require('markdown-to-jsx')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'react/jsx-runtime', 'react', '@rjsf/utils', 'lodash-es/get', 'lodash-es/isEmpty', 'lodash-es/pick', 'lodash-es/toPath', 'lodash-es/isObject', 'lodash-es/set', 'nanoid', 'lodash-es/omit', 'lodash-es/has', 'lodash-es/unset', 'markdown-to-jsx'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.JSONSchemaForm = {}, global.jsxRuntime, global.React, global.utils, global.get, global.isEmpty, global._pick, global._toPath, global.isObject, global.set, global.nanoid, global.omit, global.has, global.unset, global.Markdown));
|
|
5
|
+
})(this, (function (exports, jsxRuntime, react, utils, get, isEmpty, _pick, _toPath, isObject, set, nanoid, omit, has, unset, Markdown) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
9
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
10
9
|
var get__default = /*#__PURE__*/_interopDefaultLegacy(get);
|
|
11
10
|
var isEmpty__default = /*#__PURE__*/_interopDefaultLegacy(isEmpty);
|
|
12
11
|
var _pick__default = /*#__PURE__*/_interopDefaultLegacy(_pick);
|
|
@@ -237,7 +236,7 @@
|
|
|
237
236
|
var newFormData = arrayData.map(function (item, i) {
|
|
238
237
|
// We need to treat undefined items as nulls to have validation.
|
|
239
238
|
// See https://github.com/tdegrunt/jsonschema/issues/206
|
|
240
|
-
var jsonValue = typeof value ===
|
|
239
|
+
var jsonValue = typeof value === 'undefined' ? null : value;
|
|
241
240
|
return index === i ? jsonValue : item;
|
|
242
241
|
});
|
|
243
242
|
onChange(newFormData, errorSchema && errorSchema && _extends({}, errorSchema, (_extends2 = {}, _extends2[index] = newErrorSchema, _extends2)), id);
|
|
@@ -297,10 +296,10 @@
|
|
|
297
296
|
if (Array.isArray(itemSchema.type)) {
|
|
298
297
|
// While we don't yet support composite/nullable jsonschema types, it's
|
|
299
298
|
// future-proof to check for requirement against these.
|
|
300
|
-
return !itemSchema.type.includes(
|
|
299
|
+
return !itemSchema.type.includes('null');
|
|
301
300
|
}
|
|
302
301
|
// All non-null array item types are inherently required by design
|
|
303
|
-
return itemSchema.type !==
|
|
302
|
+
return itemSchema.type !== 'null';
|
|
304
303
|
}
|
|
305
304
|
/** Determines whether more items can be added to the array. If the uiSchema indicates the array doesn't allow adding
|
|
306
305
|
* then false is returned. Otherwise, if the schema indicates that there are a maximum number of items and the
|
|
@@ -377,8 +376,8 @@
|
|
|
377
376
|
translateString = registry.translateString;
|
|
378
377
|
if (!(utils.ITEMS_KEY in schema)) {
|
|
379
378
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
380
|
-
var UnsupportedFieldTemplate = utils.getTemplate(
|
|
381
|
-
return
|
|
379
|
+
var UnsupportedFieldTemplate = utils.getTemplate('UnsupportedFieldTemplate', registry, uiOptions);
|
|
380
|
+
return jsxRuntime.jsx(UnsupportedFieldTemplate, {
|
|
382
381
|
schema: schema,
|
|
383
382
|
idSchema: idSchema,
|
|
384
383
|
reason: translateString(utils.TranslatableString.MissingItems),
|
|
@@ -424,7 +423,7 @@
|
|
|
424
423
|
onFocus = _this$props8.onFocus,
|
|
425
424
|
idPrefix = _this$props8.idPrefix,
|
|
426
425
|
_this$props8$idSepara = _this$props8.idSeparator,
|
|
427
|
-
idSeparator = _this$props8$idSepara === void 0 ?
|
|
426
|
+
idSeparator = _this$props8$idSepara === void 0 ? '_' : _this$props8$idSepara,
|
|
428
427
|
rawErrors = _this$props8.rawErrors;
|
|
429
428
|
var keyedFormData = this.state.keyedFormData;
|
|
430
429
|
var title = schema.title === undefined ? name : schema.title;
|
|
@@ -479,8 +478,8 @@
|
|
|
479
478
|
rawErrors: rawErrors,
|
|
480
479
|
registry: registry
|
|
481
480
|
};
|
|
482
|
-
var Template = utils.getTemplate(
|
|
483
|
-
return
|
|
481
|
+
var Template = utils.getTemplate('ArrayFieldTemplate', registry, uiOptions);
|
|
482
|
+
return jsxRuntime.jsx(Template, _extends({}, arrayProps));
|
|
484
483
|
}
|
|
485
484
|
/** Renders an array using the custom widget provided by the user in the `uiSchema`
|
|
486
485
|
*/;
|
|
@@ -513,8 +512,9 @@
|
|
|
513
512
|
widget = _getUiOptions2.widget,
|
|
514
513
|
options = _objectWithoutPropertiesLoose(_getUiOptions2, _excluded$9);
|
|
515
514
|
var Widget = utils.getWidget(schema, widget, widgets);
|
|
516
|
-
return
|
|
515
|
+
return jsxRuntime.jsx(Widget, {
|
|
517
516
|
id: idSchema.$id,
|
|
517
|
+
name: name,
|
|
518
518
|
multiple: true,
|
|
519
519
|
onChange: this.onSelectChange,
|
|
520
520
|
onBlur: onBlur,
|
|
@@ -566,11 +566,12 @@
|
|
|
566
566
|
var enumOptions = utils.optionsList(itemsSchema);
|
|
567
567
|
var _getUiOptions3 = utils.getUiOptions(uiSchema),
|
|
568
568
|
_getUiOptions3$widget = _getUiOptions3.widget,
|
|
569
|
-
widget = _getUiOptions3$widget === void 0 ?
|
|
569
|
+
widget = _getUiOptions3$widget === void 0 ? 'select' : _getUiOptions3$widget,
|
|
570
570
|
options = _objectWithoutPropertiesLoose(_getUiOptions3, _excluded2);
|
|
571
571
|
var Widget = utils.getWidget(schema, widget, widgets);
|
|
572
|
-
return
|
|
572
|
+
return jsxRuntime.jsx(Widget, {
|
|
573
573
|
id: idSchema.$id,
|
|
574
|
+
name: name,
|
|
574
575
|
multiple: true,
|
|
575
576
|
onChange: this.onSelectChange,
|
|
576
577
|
onBlur: onBlur,
|
|
@@ -619,12 +620,13 @@
|
|
|
619
620
|
formContext = registry.formContext;
|
|
620
621
|
var _getUiOptions4 = utils.getUiOptions(uiSchema),
|
|
621
622
|
_getUiOptions4$widget = _getUiOptions4.widget,
|
|
622
|
-
widget = _getUiOptions4$widget === void 0 ?
|
|
623
|
+
widget = _getUiOptions4$widget === void 0 ? 'files' : _getUiOptions4$widget,
|
|
623
624
|
options = _objectWithoutPropertiesLoose(_getUiOptions4, _excluded3);
|
|
624
625
|
var Widget = utils.getWidget(schema, widget, widgets);
|
|
625
|
-
return
|
|
626
|
+
return jsxRuntime.jsx(Widget, {
|
|
626
627
|
options: options,
|
|
627
628
|
id: idSchema.$id,
|
|
629
|
+
name: name,
|
|
628
630
|
multiple: true,
|
|
629
631
|
onChange: this.onSelectChange,
|
|
630
632
|
onBlur: onBlur,
|
|
@@ -640,7 +642,7 @@
|
|
|
640
642
|
formContext: formContext,
|
|
641
643
|
autofocus: autofocus,
|
|
642
644
|
rawErrors: rawErrors,
|
|
643
|
-
label:
|
|
645
|
+
label: ''
|
|
644
646
|
});
|
|
645
647
|
}
|
|
646
648
|
/** Renders an array that has a maximum limit of items
|
|
@@ -656,7 +658,7 @@
|
|
|
656
658
|
errorSchema = _this$props12.errorSchema,
|
|
657
659
|
idPrefix = _this$props12.idPrefix,
|
|
658
660
|
_this$props12$idSepar = _this$props12.idSeparator,
|
|
659
|
-
idSeparator = _this$props12$idSepar === void 0 ?
|
|
661
|
+
idSeparator = _this$props12$idSepar === void 0 ? '_' : _this$props12$idSepar,
|
|
660
662
|
idSchema = _this$props12.idSchema,
|
|
661
663
|
name = _this$props12.name,
|
|
662
664
|
_this$props12$disable = _this$props12.disabled,
|
|
@@ -692,7 +694,7 @@
|
|
|
692
694
|
var canAdd = this.canAddItem(items) && !!additionalSchema;
|
|
693
695
|
var arrayProps = {
|
|
694
696
|
canAdd: canAdd,
|
|
695
|
-
className:
|
|
697
|
+
className: 'field field-array field-array-fixed-items',
|
|
696
698
|
disabled: disabled,
|
|
697
699
|
idSchema: idSchema,
|
|
698
700
|
formData: formData,
|
|
@@ -737,8 +739,8 @@
|
|
|
737
739
|
formContext: formContext,
|
|
738
740
|
rawErrors: rawErrors
|
|
739
741
|
};
|
|
740
|
-
var Template = utils.getTemplate(
|
|
741
|
-
return
|
|
742
|
+
var Template = utils.getTemplate('ArrayFieldTemplate', registry, uiOptions);
|
|
743
|
+
return jsxRuntime.jsx(Template, _extends({}, arrayProps));
|
|
742
744
|
}
|
|
743
745
|
/** Renders the individual array item using a `SchemaField` along with the additional properties required to be send
|
|
744
746
|
* back to the `ArrayFieldItemTemplate`.
|
|
@@ -794,7 +796,7 @@
|
|
|
794
796
|
return has[key];
|
|
795
797
|
});
|
|
796
798
|
return {
|
|
797
|
-
children:
|
|
799
|
+
children: jsxRuntime.jsx(ItemSchemaField, {
|
|
798
800
|
name: name,
|
|
799
801
|
index: index,
|
|
800
802
|
schema: itemSchema,
|
|
@@ -816,7 +818,7 @@
|
|
|
816
818
|
autofocus: autofocus,
|
|
817
819
|
rawErrors: rawErrors
|
|
818
820
|
}),
|
|
819
|
-
className:
|
|
821
|
+
className: 'array-item',
|
|
820
822
|
disabled: disabled,
|
|
821
823
|
canAdd: canAdd,
|
|
822
824
|
hasToolbar: has.toolbar,
|
|
@@ -842,11 +844,11 @@
|
|
|
842
844
|
schema = _this$props14.schema,
|
|
843
845
|
registry = _this$props14.registry;
|
|
844
846
|
var translateString = registry.translateString;
|
|
845
|
-
return get__default["default"](schema, [utils.ITEMS_KEY,
|
|
847
|
+
return get__default["default"](schema, [utils.ITEMS_KEY, 'title'], get__default["default"](schema, [utils.ITEMS_KEY, 'description'], translateString(utils.TranslatableString.ArrayItemTitle)));
|
|
846
848
|
}
|
|
847
849
|
}]);
|
|
848
850
|
return ArrayField;
|
|
849
|
-
}(
|
|
851
|
+
}(react.Component);
|
|
850
852
|
|
|
851
853
|
var _excluded$8 = ["widget"];
|
|
852
854
|
/** The `BooleanField` component is used to render a field in the schema is boolean. It constructs `enumOptions` for the
|
|
@@ -875,7 +877,7 @@
|
|
|
875
877
|
translateString = registry.translateString;
|
|
876
878
|
var _getUiOptions = utils.getUiOptions(uiSchema),
|
|
877
879
|
_getUiOptions$widget = _getUiOptions.widget,
|
|
878
|
-
widget = _getUiOptions$widget === void 0 ?
|
|
880
|
+
widget = _getUiOptions$widget === void 0 ? 'checkbox' : _getUiOptions$widget,
|
|
879
881
|
options = _objectWithoutPropertiesLoose(_getUiOptions, _excluded$8);
|
|
880
882
|
var Widget = utils.getWidget(schema, widget, widgets);
|
|
881
883
|
var yes = translateString(utils.TranslatableString.YesLabel);
|
|
@@ -900,7 +902,7 @@
|
|
|
900
902
|
var schemaWithEnumNames = schema;
|
|
901
903
|
var enums = (_schema$enum = schema["enum"]) != null ? _schema$enum : [true, false];
|
|
902
904
|
if (!schemaWithEnumNames.enumNames && enums.length === 2 && enums.every(function (v) {
|
|
903
|
-
return typeof v ===
|
|
905
|
+
return typeof v === 'boolean';
|
|
904
906
|
})) {
|
|
905
907
|
enumOptions = [{
|
|
906
908
|
value: enums[0],
|
|
@@ -917,13 +919,14 @@
|
|
|
917
919
|
});
|
|
918
920
|
}
|
|
919
921
|
}
|
|
920
|
-
return
|
|
922
|
+
return jsxRuntime.jsx(Widget, {
|
|
921
923
|
options: _extends({}, options, {
|
|
922
924
|
enumOptions: enumOptions
|
|
923
925
|
}),
|
|
924
926
|
schema: schema,
|
|
925
927
|
uiSchema: uiSchema,
|
|
926
928
|
id: idSchema.$id,
|
|
929
|
+
name: name,
|
|
927
930
|
onChange: onChange,
|
|
928
931
|
onFocus: onFocus,
|
|
929
932
|
onBlur: onBlur,
|
|
@@ -973,7 +976,7 @@
|
|
|
973
976
|
if (newFormData && newOption) {
|
|
974
977
|
// Call getDefaultFormState to make sure defaults are populated on change. Pass "excludeObjectChildren"
|
|
975
978
|
// so that only the root objects themselves are created without adding undefined children properties
|
|
976
|
-
newFormData = schemaUtils.getDefaultFormState(newOption, newFormData,
|
|
979
|
+
newFormData = schemaUtils.getDefaultFormState(newOption, newFormData, 'excludeObjectChildren');
|
|
977
980
|
}
|
|
978
981
|
onChange(newFormData, undefined, _this.getFieldId());
|
|
979
982
|
_this.setState({
|
|
@@ -1060,12 +1063,13 @@
|
|
|
1060
1063
|
var _this$props4 = this.props,
|
|
1061
1064
|
idSchema = _this$props4.idSchema,
|
|
1062
1065
|
schema = _this$props4.schema;
|
|
1063
|
-
return "" + idSchema.$id + (schema.oneOf ?
|
|
1066
|
+
return "" + idSchema.$id + (schema.oneOf ? '__oneof_select' : '__anyof_select');
|
|
1064
1067
|
}
|
|
1065
1068
|
/** Renders the `AnyOfField` selector along with a `SchemaField` for the value of the `formData`
|
|
1066
1069
|
*/;
|
|
1067
1070
|
_proto.render = function render() {
|
|
1068
1071
|
var _this$props5 = this.props,
|
|
1072
|
+
name = _this$props5.name,
|
|
1069
1073
|
baseType = _this$props5.baseType,
|
|
1070
1074
|
_this$props5$disabled = _this$props5.disabled,
|
|
1071
1075
|
disabled = _this$props5$disabled === void 0 ? false : _this$props5$disabled,
|
|
@@ -1086,7 +1090,7 @@
|
|
|
1086
1090
|
retrievedOptions = _this$state2.retrievedOptions;
|
|
1087
1091
|
var _getUiOptions = utils.getUiOptions(uiSchema),
|
|
1088
1092
|
_getUiOptions$widget = _getUiOptions.widget,
|
|
1089
|
-
widget = _getUiOptions$widget === void 0 ?
|
|
1093
|
+
widget = _getUiOptions$widget === void 0 ? 'select' : _getUiOptions$widget,
|
|
1090
1094
|
placeholder = _getUiOptions.placeholder,
|
|
1091
1095
|
autofocus = _getUiOptions.autofocus,
|
|
1092
1096
|
autocomplete = _getUiOptions.autocomplete,
|
|
@@ -1094,7 +1098,7 @@
|
|
|
1094
1098
|
title = _getUiOptions$title === void 0 ? schema.title : _getUiOptions$title,
|
|
1095
1099
|
uiOptions = _objectWithoutPropertiesLoose(_getUiOptions, _excluded$7);
|
|
1096
1100
|
var Widget = utils.getWidget({
|
|
1097
|
-
type:
|
|
1101
|
+
type: 'number'
|
|
1098
1102
|
}, widget, widgets);
|
|
1099
1103
|
var rawErrors = get__default["default"](errorSchema, utils.ERRORS_KEY, []);
|
|
1100
1104
|
var fieldErrorSchema = omit__default["default"](errorSchema, [utils.ERRORS_KEY]);
|
|
@@ -1115,39 +1119,42 @@
|
|
|
1115
1119
|
value: index
|
|
1116
1120
|
};
|
|
1117
1121
|
});
|
|
1118
|
-
return
|
|
1119
|
-
className:
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1122
|
+
return jsxRuntime.jsxs("div", {
|
|
1123
|
+
className: 'panel panel-default panel-body',
|
|
1124
|
+
children: [jsxRuntime.jsx("div", {
|
|
1125
|
+
className: 'form-group',
|
|
1126
|
+
children: jsxRuntime.jsx(Widget, {
|
|
1127
|
+
id: this.getFieldId(),
|
|
1128
|
+
name: "" + name + (schema.oneOf ? '__oneof_select' : '__anyof_select'),
|
|
1129
|
+
schema: {
|
|
1130
|
+
type: 'number',
|
|
1131
|
+
"default": 0
|
|
1132
|
+
},
|
|
1133
|
+
onChange: this.onOptionChange,
|
|
1134
|
+
onBlur: onBlur,
|
|
1135
|
+
onFocus: onFocus,
|
|
1136
|
+
disabled: disabled || isEmpty__default["default"](enumOptions),
|
|
1137
|
+
multiple: false,
|
|
1138
|
+
rawErrors: rawErrors,
|
|
1139
|
+
errorSchema: fieldErrorSchema,
|
|
1140
|
+
value: selectedOption >= 0 ? selectedOption : undefined,
|
|
1141
|
+
options: _extends({
|
|
1142
|
+
enumOptions: enumOptions
|
|
1143
|
+
}, uiOptions),
|
|
1144
|
+
registry: registry,
|
|
1145
|
+
formContext: formContext,
|
|
1146
|
+
placeholder: placeholder,
|
|
1147
|
+
autocomplete: autocomplete,
|
|
1148
|
+
autofocus: autofocus,
|
|
1149
|
+
label: ''
|
|
1150
|
+
})
|
|
1151
|
+
}), option !== null && jsxRuntime.jsx(_SchemaField, _extends({}, this.props, {
|
|
1152
|
+
schema: optionSchema
|
|
1153
|
+
}))]
|
|
1154
|
+
});
|
|
1148
1155
|
};
|
|
1149
1156
|
return AnyOfField;
|
|
1150
|
-
}(
|
|
1157
|
+
}(react.Component);
|
|
1151
1158
|
|
|
1152
1159
|
// Matches a string that ends in a . character, optionally followed by a sequence of
|
|
1153
1160
|
// digits followed by any number of 0 characters up until the end of the line.
|
|
@@ -1181,7 +1188,7 @@
|
|
|
1181
1188
|
onChange = props.onChange,
|
|
1182
1189
|
formData = props.formData,
|
|
1183
1190
|
initialValue = props.value;
|
|
1184
|
-
var _useState =
|
|
1191
|
+
var _useState = react.useState(initialValue),
|
|
1185
1192
|
lastValue = _useState[0],
|
|
1186
1193
|
setLastValue = _useState[1];
|
|
1187
1194
|
var StringField = registry.fields.StringField;
|
|
@@ -1190,32 +1197,32 @@
|
|
|
1190
1197
|
*
|
|
1191
1198
|
* @param value - The current value for the change occurring
|
|
1192
1199
|
*/
|
|
1193
|
-
var handleChange =
|
|
1200
|
+
var handleChange = react.useCallback(function (value) {
|
|
1194
1201
|
// Cache the original value in component state
|
|
1195
1202
|
setLastValue(value);
|
|
1196
1203
|
// Normalize decimals that don't start with a zero character in advance so
|
|
1197
1204
|
// that the rest of the normalization logic is simpler
|
|
1198
|
-
if (("" + value).charAt(0) ===
|
|
1205
|
+
if (("" + value).charAt(0) === '.') {
|
|
1199
1206
|
value = "0" + value;
|
|
1200
1207
|
}
|
|
1201
1208
|
// Check that the value is a string (this can happen if the widget used is a
|
|
1202
1209
|
// <select>, due to an enum declaration etc) then, if the value ends in a
|
|
1203
1210
|
// trailing decimal point or multiple zeroes, strip the trailing values
|
|
1204
|
-
var processed = typeof value ===
|
|
1211
|
+
var processed = typeof value === 'string' && value.match(trailingCharMatcherWithPrefix) ? utils.asNumber(value.replace(trailingCharMatcher, '')) : utils.asNumber(value);
|
|
1205
1212
|
onChange(processed);
|
|
1206
1213
|
}, [onChange]);
|
|
1207
|
-
if (typeof lastValue ===
|
|
1214
|
+
if (typeof lastValue === 'string' && typeof value === 'number') {
|
|
1208
1215
|
// Construct a regular expression that checks for a string that consists
|
|
1209
1216
|
// of the formData value suffixed with zero or one '.' characters and zero
|
|
1210
1217
|
// or more '0' characters
|
|
1211
|
-
var re = new RegExp(("" + value).replace(
|
|
1218
|
+
var re = new RegExp(("" + value).replace('.', '\\.') + '\\.?0*$');
|
|
1212
1219
|
// If the cached "lastValue" is a match, use that instead of the formData
|
|
1213
1220
|
// value to prevent the input value from changing in the UI
|
|
1214
1221
|
if (lastValue.match(re)) {
|
|
1215
1222
|
value = lastValue;
|
|
1216
1223
|
}
|
|
1217
1224
|
}
|
|
1218
|
-
return
|
|
1225
|
+
return jsxRuntime.jsx(StringField, _extends({}, props, {
|
|
1219
1226
|
formData: value,
|
|
1220
1227
|
onChange: handleChange
|
|
1221
1228
|
}));
|
|
@@ -1256,7 +1263,7 @@
|
|
|
1256
1263
|
// fields which are "mandated" by the schema, these fields can
|
|
1257
1264
|
// be set to undefined by clicking a "delete field" button, so
|
|
1258
1265
|
// set empty values to the empty string.
|
|
1259
|
-
value =
|
|
1266
|
+
value = '';
|
|
1260
1267
|
}
|
|
1261
1268
|
var newFormData = _extends({}, formData, (_extends2 = {}, _extends2[name] = value, _extends2));
|
|
1262
1269
|
onChange(newFormData, errorSchema && errorSchema && _extends({}, errorSchema, (_extends3 = {}, _extends3[name] = newErrorSchema, _extends3)), id);
|
|
@@ -1277,7 +1284,7 @@
|
|
|
1277
1284
|
var uiSchema = _this.props.uiSchema;
|
|
1278
1285
|
var _getUiOptions = utils.getUiOptions(uiSchema),
|
|
1279
1286
|
_getUiOptions$duplica = _getUiOptions.duplicateKeySuffixSeparator,
|
|
1280
|
-
duplicateKeySuffixSeparator = _getUiOptions$duplica === void 0 ?
|
|
1287
|
+
duplicateKeySuffixSeparator = _getUiOptions$duplica === void 0 ? '-' : _getUiOptions$duplica;
|
|
1281
1288
|
var index = 0;
|
|
1282
1289
|
var newKey = preferredKey;
|
|
1283
1290
|
while (has__default["default"](formData, newKey)) {
|
|
@@ -1332,10 +1339,10 @@
|
|
|
1332
1339
|
type = apSchema.type;
|
|
1333
1340
|
}
|
|
1334
1341
|
if (!type && (utils.ANY_OF_KEY in apSchema || utils.ONE_OF_KEY in apSchema)) {
|
|
1335
|
-
type =
|
|
1342
|
+
type = 'object';
|
|
1336
1343
|
}
|
|
1337
1344
|
}
|
|
1338
|
-
var newKey = _this.getAvailableKey(
|
|
1345
|
+
var newKey = _this.getAvailableKey('newKey', newFormData);
|
|
1339
1346
|
// Cast this to make the `set` work properly
|
|
1340
1347
|
set__default["default"](newFormData, newKey, _this.getDefaultValue(type));
|
|
1341
1348
|
onChange(newFormData);
|
|
@@ -1368,17 +1375,17 @@
|
|
|
1368
1375
|
_proto.getDefaultValue = function getDefaultValue(type) {
|
|
1369
1376
|
var translateString = this.props.registry.translateString;
|
|
1370
1377
|
switch (type) {
|
|
1371
|
-
case
|
|
1378
|
+
case 'array':
|
|
1372
1379
|
return [];
|
|
1373
|
-
case
|
|
1380
|
+
case 'boolean':
|
|
1374
1381
|
return false;
|
|
1375
|
-
case
|
|
1382
|
+
case 'null':
|
|
1376
1383
|
return null;
|
|
1377
|
-
case
|
|
1384
|
+
case 'number':
|
|
1378
1385
|
return 0;
|
|
1379
|
-
case
|
|
1386
|
+
case 'object':
|
|
1380
1387
|
return {};
|
|
1381
|
-
case
|
|
1388
|
+
case 'string':
|
|
1382
1389
|
default:
|
|
1383
1390
|
// We don't have a datatype for some reason (perhaps additionalProperties was true)
|
|
1384
1391
|
return translateString(utils.TranslatableString.NewStringDefault);
|
|
@@ -1428,25 +1435,31 @@
|
|
|
1428
1435
|
var properties = Object.keys(schemaProperties);
|
|
1429
1436
|
orderedProperties = utils.orderProperties(properties, uiOptions.order);
|
|
1430
1437
|
} catch (err) {
|
|
1431
|
-
return
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1438
|
+
return jsxRuntime.jsxs("div", {
|
|
1439
|
+
children: [jsxRuntime.jsxs("p", {
|
|
1440
|
+
className: 'config-error',
|
|
1441
|
+
style: {
|
|
1442
|
+
color: 'red'
|
|
1443
|
+
},
|
|
1444
|
+
children: ["Invalid ", name || 'root', " object field configuration:", jsxRuntime.jsx("em", {
|
|
1445
|
+
children: err.message
|
|
1446
|
+
}), "."]
|
|
1447
|
+
}), jsxRuntime.jsx("pre", {
|
|
1448
|
+
children: JSON.stringify(schema)
|
|
1449
|
+
})]
|
|
1450
|
+
});
|
|
1437
1451
|
}
|
|
1438
|
-
var Template = utils.getTemplate(
|
|
1452
|
+
var Template = utils.getTemplate('ObjectFieldTemplate', registry, uiOptions);
|
|
1439
1453
|
var templateProps = {
|
|
1440
1454
|
title: uiOptions.title || title,
|
|
1441
1455
|
description: description,
|
|
1442
1456
|
properties: orderedProperties.map(function (name) {
|
|
1443
1457
|
var addedByAdditionalProperties = has__default["default"](schema, [utils.PROPERTIES_KEY, name, utils.ADDITIONAL_PROPERTY_FLAG]);
|
|
1444
1458
|
var fieldUiSchema = addedByAdditionalProperties ? uiSchema.additionalProperties : uiSchema[name];
|
|
1445
|
-
var hidden = utils.getUiOptions(fieldUiSchema).widget ===
|
|
1459
|
+
var hidden = utils.getUiOptions(fieldUiSchema).widget === 'hidden';
|
|
1446
1460
|
var fieldIdSchema = get__default["default"](idSchema, [name], {});
|
|
1447
1461
|
return {
|
|
1448
|
-
content:
|
|
1449
|
-
key: name,
|
|
1462
|
+
content: jsxRuntime.jsx(SchemaField, {
|
|
1450
1463
|
name: name,
|
|
1451
1464
|
required: _this2.isRequired(name),
|
|
1452
1465
|
schema: get__default["default"](schema, [utils.PROPERTIES_KEY, name], {}),
|
|
@@ -1467,7 +1480,7 @@
|
|
|
1467
1480
|
readonly: readonly,
|
|
1468
1481
|
hideError: hideError,
|
|
1469
1482
|
onDropPropertyClick: _this2.onDropPropertyClick
|
|
1470
|
-
}),
|
|
1483
|
+
}, name),
|
|
1471
1484
|
name: name,
|
|
1472
1485
|
readonly: readonly,
|
|
1473
1486
|
disabled: disabled,
|
|
@@ -1485,23 +1498,23 @@
|
|
|
1485
1498
|
formContext: formContext,
|
|
1486
1499
|
registry: registry
|
|
1487
1500
|
};
|
|
1488
|
-
return
|
|
1501
|
+
return jsxRuntime.jsx(Template, _extends({}, templateProps, {
|
|
1489
1502
|
onAddClick: this.handleAddClick
|
|
1490
1503
|
}));
|
|
1491
1504
|
};
|
|
1492
1505
|
return ObjectField;
|
|
1493
|
-
}(
|
|
1506
|
+
}(react.Component);
|
|
1494
1507
|
|
|
1495
1508
|
var _excluded$6 = ["__errors"];
|
|
1496
1509
|
/** The map of component type to FieldName */
|
|
1497
1510
|
var COMPONENT_TYPES = {
|
|
1498
|
-
array:
|
|
1499
|
-
"boolean":
|
|
1500
|
-
integer:
|
|
1501
|
-
number:
|
|
1502
|
-
object:
|
|
1503
|
-
string:
|
|
1504
|
-
"null":
|
|
1511
|
+
array: 'ArrayField',
|
|
1512
|
+
"boolean": 'BooleanField',
|
|
1513
|
+
integer: 'NumberField',
|
|
1514
|
+
number: 'NumberField',
|
|
1515
|
+
object: 'ObjectField',
|
|
1516
|
+
string: 'StringField',
|
|
1517
|
+
"null": 'NullField'
|
|
1505
1518
|
};
|
|
1506
1519
|
/** Computes and returns which `Field` implementation to return in order to render the field represented by the
|
|
1507
1520
|
* `schema`. The `uiOptions` are used to alter what potential `Field` implementation is actually returned. If no
|
|
@@ -1517,14 +1530,14 @@
|
|
|
1517
1530
|
var field = uiOptions.field;
|
|
1518
1531
|
var fields = registry.fields,
|
|
1519
1532
|
translateString = registry.translateString;
|
|
1520
|
-
if (typeof field ===
|
|
1533
|
+
if (typeof field === 'function') {
|
|
1521
1534
|
return field;
|
|
1522
1535
|
}
|
|
1523
|
-
if (typeof field ===
|
|
1536
|
+
if (typeof field === 'string' && field in fields) {
|
|
1524
1537
|
return fields[field];
|
|
1525
1538
|
}
|
|
1526
1539
|
var schemaType = utils.getSchemaType(schema);
|
|
1527
|
-
var type = Array.isArray(schemaType) ? schemaType[0] : schemaType ||
|
|
1540
|
+
var type = Array.isArray(schemaType) ? schemaType[0] : schemaType || '';
|
|
1528
1541
|
var componentName = COMPONENT_TYPES[type];
|
|
1529
1542
|
// If the type is not defined and the schema uses 'anyOf' or 'oneOf', don't
|
|
1530
1543
|
// render a field and let the MultiSchemaField component handle the form display
|
|
@@ -1534,8 +1547,8 @@
|
|
|
1534
1547
|
};
|
|
1535
1548
|
}
|
|
1536
1549
|
return componentName in fields ? fields[componentName] : function () {
|
|
1537
|
-
var UnsupportedFieldTemplate = utils.getTemplate(
|
|
1538
|
-
return
|
|
1550
|
+
var UnsupportedFieldTemplate = utils.getTemplate('UnsupportedFieldTemplate', registry, uiOptions);
|
|
1551
|
+
return jsxRuntime.jsx(UnsupportedFieldTemplate, {
|
|
1539
1552
|
schema: schema,
|
|
1540
1553
|
idSchema: idSchema,
|
|
1541
1554
|
reason: translateString(utils.TranslatableString.UnknownFieldType, [String(schema.type)]),
|
|
@@ -1568,17 +1581,17 @@
|
|
|
1568
1581
|
var formContext = registry.formContext,
|
|
1569
1582
|
schemaUtils = registry.schemaUtils;
|
|
1570
1583
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
1571
|
-
var FieldTemplate = utils.getTemplate(
|
|
1572
|
-
var DescriptionFieldTemplate = utils.getTemplate(
|
|
1573
|
-
var FieldHelpTemplate = utils.getTemplate(
|
|
1574
|
-
var FieldErrorTemplate = utils.getTemplate(
|
|
1584
|
+
var FieldTemplate = utils.getTemplate('FieldTemplate', registry, uiOptions);
|
|
1585
|
+
var DescriptionFieldTemplate = utils.getTemplate('DescriptionFieldTemplate', registry, uiOptions);
|
|
1586
|
+
var FieldHelpTemplate = utils.getTemplate('FieldHelpTemplate', registry, uiOptions);
|
|
1587
|
+
var FieldErrorTemplate = utils.getTemplate('FieldErrorTemplate', registry, uiOptions);
|
|
1575
1588
|
var schema = schemaUtils.retrieveSchema(_schema, formData);
|
|
1576
1589
|
var fieldId = _idSchema[utils.ID_KEY];
|
|
1577
1590
|
var idSchema = utils.mergeObjects(schemaUtils.toIdSchema(schema, fieldId, formData, idPrefix, idSeparator), _idSchema);
|
|
1578
1591
|
/** Intermediary `onChange` handler for field components that will inject the `id` of the current field into the
|
|
1579
1592
|
* `onChange` chain if it is not already being provided from a deeper level in the hierarchy
|
|
1580
1593
|
*/
|
|
1581
|
-
var handleFieldComponentChange =
|
|
1594
|
+
var handleFieldComponentChange = react.useCallback(function (formData, newErrorSchema, id) {
|
|
1582
1595
|
var theId = id || fieldId;
|
|
1583
1596
|
return onChange(formData, newErrorSchema, theId);
|
|
1584
1597
|
}, [fieldId, onChange]);
|
|
@@ -1597,11 +1610,11 @@
|
|
|
1597
1610
|
__errors = _ref.__errors,
|
|
1598
1611
|
fieldErrorSchema = _objectWithoutPropertiesLoose(_ref, _excluded$6);
|
|
1599
1612
|
// See #439: uiSchema: Don't pass consumed class names or style to child components
|
|
1600
|
-
var fieldUiSchema = omit__default["default"](uiSchema, [
|
|
1613
|
+
var fieldUiSchema = omit__default["default"](uiSchema, ['ui:classNames', 'classNames', 'ui:style']);
|
|
1601
1614
|
if (utils.UI_OPTIONS_KEY in fieldUiSchema) {
|
|
1602
|
-
fieldUiSchema[utils.UI_OPTIONS_KEY] = omit__default["default"](fieldUiSchema[utils.UI_OPTIONS_KEY], [
|
|
1615
|
+
fieldUiSchema[utils.UI_OPTIONS_KEY] = omit__default["default"](fieldUiSchema[utils.UI_OPTIONS_KEY], ['classNames', 'style']);
|
|
1603
1616
|
}
|
|
1604
|
-
var field =
|
|
1617
|
+
var field = jsxRuntime.jsx(FieldComponent, _extends({}, props, {
|
|
1605
1618
|
onChange: handleFieldComponentChange,
|
|
1606
1619
|
idSchema: idSchema,
|
|
1607
1620
|
schema: schema,
|
|
@@ -1622,12 +1635,12 @@
|
|
|
1622
1635
|
} else {
|
|
1623
1636
|
label = utils.ADDITIONAL_PROPERTY_FLAG in schema ? name : uiOptions.title || props.schema.title || schema.title || name;
|
|
1624
1637
|
}
|
|
1625
|
-
var description = uiOptions.description || props.schema.description || schema.description ||
|
|
1638
|
+
var description = uiOptions.description || props.schema.description || schema.description || '';
|
|
1626
1639
|
var help = uiOptions.help;
|
|
1627
|
-
var hidden = uiOptions.widget ===
|
|
1628
|
-
var classNames = [
|
|
1640
|
+
var hidden = uiOptions.widget === 'hidden';
|
|
1641
|
+
var classNames = ['form-group', 'field', "field-" + schema.type];
|
|
1629
1642
|
if (!hideError && __errors && __errors.length > 0) {
|
|
1630
|
-
classNames.push(
|
|
1643
|
+
classNames.push('field-error has-error has-danger');
|
|
1631
1644
|
}
|
|
1632
1645
|
if (uiSchema !== null && uiSchema !== void 0 && uiSchema.classNames) {
|
|
1633
1646
|
{
|
|
@@ -1638,7 +1651,7 @@
|
|
|
1638
1651
|
if (uiOptions.classNames) {
|
|
1639
1652
|
classNames.push(uiOptions.classNames);
|
|
1640
1653
|
}
|
|
1641
|
-
var helpComponent =
|
|
1654
|
+
var helpComponent = jsxRuntime.jsx(FieldHelpTemplate, {
|
|
1642
1655
|
help: help,
|
|
1643
1656
|
idSchema: idSchema,
|
|
1644
1657
|
schema: schema,
|
|
@@ -1646,7 +1659,7 @@
|
|
|
1646
1659
|
hasErrors: !hideError && __errors && __errors.length > 0,
|
|
1647
1660
|
registry: registry
|
|
1648
1661
|
});
|
|
1649
|
-
var errorsComponent = hideError ? undefined :
|
|
1662
|
+
var errorsComponent = hideError ? undefined : jsxRuntime.jsx(FieldErrorTemplate, {
|
|
1650
1663
|
errors: __errors,
|
|
1651
1664
|
errorSchema: errorSchema,
|
|
1652
1665
|
idSchema: idSchema,
|
|
@@ -1655,7 +1668,7 @@
|
|
|
1655
1668
|
registry: registry
|
|
1656
1669
|
});
|
|
1657
1670
|
var fieldProps = {
|
|
1658
|
-
description:
|
|
1671
|
+
description: jsxRuntime.jsx(DescriptionFieldTemplate, {
|
|
1659
1672
|
id: utils.descriptionId(id),
|
|
1660
1673
|
description: description,
|
|
1661
1674
|
schema: schema,
|
|
@@ -1664,7 +1677,7 @@
|
|
|
1664
1677
|
}),
|
|
1665
1678
|
rawDescription: description,
|
|
1666
1679
|
help: helpComponent,
|
|
1667
|
-
rawHelp: typeof help ===
|
|
1680
|
+
rawHelp: typeof help === 'string' ? help : undefined,
|
|
1668
1681
|
errors: errorsComponent,
|
|
1669
1682
|
rawErrors: hideError ? undefined : __errors,
|
|
1670
1683
|
id: id,
|
|
@@ -1678,7 +1691,7 @@
|
|
|
1678
1691
|
readonly: readonly,
|
|
1679
1692
|
hideError: hideError,
|
|
1680
1693
|
displayLabel: displayLabel,
|
|
1681
|
-
classNames: classNames.join(
|
|
1694
|
+
classNames: classNames.join(' ').trim(),
|
|
1682
1695
|
style: uiOptions.style,
|
|
1683
1696
|
formContext: formContext,
|
|
1684
1697
|
formData: formData,
|
|
@@ -1688,68 +1701,72 @@
|
|
|
1688
1701
|
};
|
|
1689
1702
|
var _AnyOfField = registry.fields.AnyOfField;
|
|
1690
1703
|
var _OneOfField = registry.fields.OneOfField;
|
|
1691
|
-
var isReplacingAnyOrOneOf = (uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema[
|
|
1692
|
-
return
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
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
|
-
|
|
1704
|
+
var isReplacingAnyOrOneOf = (uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema['ui:field']) && (uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema['ui:fieldReplacesAnyOrOneOf']) === true;
|
|
1705
|
+
return jsxRuntime.jsx(FieldTemplate, _extends({}, fieldProps, {
|
|
1706
|
+
children: jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1707
|
+
children: [field, schema.anyOf && !isReplacingAnyOrOneOf && !schemaUtils.isSelect(schema) && jsxRuntime.jsx(_AnyOfField, {
|
|
1708
|
+
name: name,
|
|
1709
|
+
disabled: disabled,
|
|
1710
|
+
readonly: readonly,
|
|
1711
|
+
hideError: hideError,
|
|
1712
|
+
errorSchema: errorSchema,
|
|
1713
|
+
formData: formData,
|
|
1714
|
+
formContext: formContext,
|
|
1715
|
+
idPrefix: idPrefix,
|
|
1716
|
+
idSchema: idSchema,
|
|
1717
|
+
idSeparator: idSeparator,
|
|
1718
|
+
onBlur: props.onBlur,
|
|
1719
|
+
onChange: props.onChange,
|
|
1720
|
+
onFocus: props.onFocus,
|
|
1721
|
+
options: schema.anyOf.map(function (_schema) {
|
|
1722
|
+
return schemaUtils.retrieveSchema(isObject__default["default"](_schema) ? _schema : {}, formData);
|
|
1723
|
+
}),
|
|
1724
|
+
baseType: schema.type,
|
|
1725
|
+
registry: registry,
|
|
1726
|
+
schema: schema,
|
|
1727
|
+
uiSchema: uiSchema
|
|
1728
|
+
}), schema.oneOf && !isReplacingAnyOrOneOf && !schemaUtils.isSelect(schema) && jsxRuntime.jsx(_OneOfField, {
|
|
1729
|
+
name: name,
|
|
1730
|
+
disabled: disabled,
|
|
1731
|
+
readonly: readonly,
|
|
1732
|
+
hideError: hideError,
|
|
1733
|
+
errorSchema: errorSchema,
|
|
1734
|
+
formData: formData,
|
|
1735
|
+
formContext: formContext,
|
|
1736
|
+
idPrefix: idPrefix,
|
|
1737
|
+
idSchema: idSchema,
|
|
1738
|
+
idSeparator: idSeparator,
|
|
1739
|
+
onBlur: props.onBlur,
|
|
1740
|
+
onChange: props.onChange,
|
|
1741
|
+
onFocus: props.onFocus,
|
|
1742
|
+
options: schema.oneOf.map(function (_schema) {
|
|
1743
|
+
return schemaUtils.retrieveSchema(isObject__default["default"](_schema) ? _schema : {}, formData);
|
|
1744
|
+
}),
|
|
1745
|
+
baseType: schema.type,
|
|
1746
|
+
registry: registry,
|
|
1747
|
+
schema: schema,
|
|
1748
|
+
uiSchema: uiSchema
|
|
1749
|
+
})]
|
|
1750
|
+
})
|
|
1751
|
+
}));
|
|
1735
1752
|
}
|
|
1736
1753
|
/** The `SchemaField` component determines whether it is necessary to rerender the component based on any props changes
|
|
1737
1754
|
* and if so, calls the `SchemaFieldRender` component with the props.
|
|
1738
1755
|
*/
|
|
1739
|
-
var SchemaField = /*#__PURE__*/function (
|
|
1740
|
-
_inheritsLoose(SchemaField,
|
|
1756
|
+
var SchemaField = /*#__PURE__*/function (_Component) {
|
|
1757
|
+
_inheritsLoose(SchemaField, _Component);
|
|
1741
1758
|
function SchemaField() {
|
|
1742
|
-
return
|
|
1759
|
+
return _Component.apply(this, arguments) || this;
|
|
1743
1760
|
}
|
|
1744
1761
|
var _proto = SchemaField.prototype;
|
|
1745
1762
|
_proto.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {
|
|
1746
1763
|
return !utils.deepEquals(this.props, nextProps);
|
|
1747
1764
|
};
|
|
1748
1765
|
_proto.render = function render() {
|
|
1749
|
-
return
|
|
1766
|
+
return jsxRuntime.jsx(SchemaFieldRender, _extends({}, this.props));
|
|
1750
1767
|
};
|
|
1751
1768
|
return SchemaField;
|
|
1752
|
-
}(
|
|
1769
|
+
}(react.Component);
|
|
1753
1770
|
|
|
1754
1771
|
var _excluded$5 = ["widget", "placeholder"];
|
|
1755
1772
|
/** The `StringField` component is used to render a schema field that represents a string type
|
|
@@ -1780,7 +1797,7 @@
|
|
|
1780
1797
|
formContext = registry.formContext,
|
|
1781
1798
|
schemaUtils = registry.schemaUtils;
|
|
1782
1799
|
var enumOptions = schemaUtils.isSelect(schema) ? utils.optionsList(schema) : undefined;
|
|
1783
|
-
var defaultWidget = enumOptions ?
|
|
1800
|
+
var defaultWidget = enumOptions ? 'select' : 'text';
|
|
1784
1801
|
if (format && utils.hasWidget(schema, format, widgets)) {
|
|
1785
1802
|
defaultWidget = format;
|
|
1786
1803
|
}
|
|
@@ -1788,16 +1805,17 @@
|
|
|
1788
1805
|
_getUiOptions$widget = _getUiOptions.widget,
|
|
1789
1806
|
widget = _getUiOptions$widget === void 0 ? defaultWidget : _getUiOptions$widget,
|
|
1790
1807
|
_getUiOptions$placeho = _getUiOptions.placeholder,
|
|
1791
|
-
placeholder = _getUiOptions$placeho === void 0 ?
|
|
1808
|
+
placeholder = _getUiOptions$placeho === void 0 ? '' : _getUiOptions$placeho,
|
|
1792
1809
|
options = _objectWithoutPropertiesLoose(_getUiOptions, _excluded$5);
|
|
1793
1810
|
var Widget = utils.getWidget(schema, widget, widgets);
|
|
1794
|
-
return
|
|
1811
|
+
return jsxRuntime.jsx(Widget, {
|
|
1795
1812
|
options: _extends({}, options, {
|
|
1796
1813
|
enumOptions: enumOptions
|
|
1797
1814
|
}),
|
|
1798
1815
|
schema: schema,
|
|
1799
1816
|
uiSchema: uiSchema,
|
|
1800
1817
|
id: idSchema.$id,
|
|
1818
|
+
name: name,
|
|
1801
1819
|
label: title === undefined ? name : title,
|
|
1802
1820
|
value: formData,
|
|
1803
1821
|
onChange: onChange,
|
|
@@ -1822,7 +1840,7 @@
|
|
|
1822
1840
|
function NullField(props) {
|
|
1823
1841
|
var formData = props.formData,
|
|
1824
1842
|
onChange = props.onChange;
|
|
1825
|
-
|
|
1843
|
+
react.useEffect(function () {
|
|
1826
1844
|
if (formData === undefined) {
|
|
1827
1845
|
onChange(null);
|
|
1828
1846
|
}
|
|
@@ -1862,8 +1880,8 @@
|
|
|
1862
1880
|
if (!description || !displayLabel) {
|
|
1863
1881
|
return null;
|
|
1864
1882
|
}
|
|
1865
|
-
var DescriptionFieldTemplate = utils.getTemplate(
|
|
1866
|
-
return
|
|
1883
|
+
var DescriptionFieldTemplate = utils.getTemplate('DescriptionFieldTemplate', registry, options);
|
|
1884
|
+
return jsxRuntime.jsx(DescriptionFieldTemplate, {
|
|
1867
1885
|
id: utils.descriptionId(idSchema),
|
|
1868
1886
|
description: description,
|
|
1869
1887
|
schema: schema,
|
|
@@ -1898,39 +1916,43 @@
|
|
|
1898
1916
|
flex: 1,
|
|
1899
1917
|
paddingLeft: 6,
|
|
1900
1918
|
paddingRight: 6,
|
|
1901
|
-
fontWeight:
|
|
1919
|
+
fontWeight: 'bold'
|
|
1902
1920
|
};
|
|
1903
|
-
return
|
|
1904
|
-
className: className
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1921
|
+
return jsxRuntime.jsxs("div", {
|
|
1922
|
+
className: className,
|
|
1923
|
+
children: [jsxRuntime.jsx("div", {
|
|
1924
|
+
className: hasToolbar ? 'col-xs-9' : 'col-xs-12',
|
|
1925
|
+
children: children
|
|
1926
|
+
}), hasToolbar && jsxRuntime.jsx("div", {
|
|
1927
|
+
className: 'col-xs-3 array-item-toolbox',
|
|
1928
|
+
children: jsxRuntime.jsxs("div", {
|
|
1929
|
+
className: 'btn-group',
|
|
1930
|
+
style: {
|
|
1931
|
+
display: 'flex',
|
|
1932
|
+
justifyContent: 'space-around'
|
|
1933
|
+
},
|
|
1934
|
+
children: [(hasMoveUp || hasMoveDown) && jsxRuntime.jsx(MoveUpButton, {
|
|
1935
|
+
style: btnStyle,
|
|
1936
|
+
disabled: disabled || readonly || !hasMoveUp,
|
|
1937
|
+
onClick: onReorderClick(index, index - 1),
|
|
1938
|
+
uiSchema: uiSchema,
|
|
1939
|
+
registry: registry
|
|
1940
|
+
}), (hasMoveUp || hasMoveDown) && jsxRuntime.jsx(MoveDownButton, {
|
|
1941
|
+
style: btnStyle,
|
|
1942
|
+
disabled: disabled || readonly || !hasMoveDown,
|
|
1943
|
+
onClick: onReorderClick(index, index + 1),
|
|
1944
|
+
uiSchema: uiSchema,
|
|
1945
|
+
registry: registry
|
|
1946
|
+
}), hasRemove && jsxRuntime.jsx(RemoveButton, {
|
|
1947
|
+
style: btnStyle,
|
|
1948
|
+
disabled: disabled || readonly,
|
|
1949
|
+
onClick: onDropIndexClick(index),
|
|
1950
|
+
uiSchema: uiSchema,
|
|
1951
|
+
registry: registry
|
|
1952
|
+
})]
|
|
1953
|
+
})
|
|
1954
|
+
})]
|
|
1955
|
+
});
|
|
1934
1956
|
}
|
|
1935
1957
|
|
|
1936
1958
|
var _excluded$4 = ["key"];
|
|
@@ -1952,42 +1974,42 @@
|
|
|
1952
1974
|
schema = props.schema,
|
|
1953
1975
|
title = props.title;
|
|
1954
1976
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
1955
|
-
var ArrayFieldDescriptionTemplate = utils.getTemplate(
|
|
1956
|
-
var ArrayFieldItemTemplate = utils.getTemplate(
|
|
1957
|
-
var ArrayFieldTitleTemplate = utils.getTemplate(
|
|
1977
|
+
var ArrayFieldDescriptionTemplate = utils.getTemplate('ArrayFieldDescriptionTemplate', registry, uiOptions);
|
|
1978
|
+
var ArrayFieldItemTemplate = utils.getTemplate('ArrayFieldItemTemplate', registry, uiOptions);
|
|
1979
|
+
var ArrayFieldTitleTemplate = utils.getTemplate('ArrayFieldTitleTemplate', registry, uiOptions);
|
|
1958
1980
|
// Button templates are not overridden in the uiSchema
|
|
1959
1981
|
var AddButton = registry.templates.ButtonTemplates.AddButton;
|
|
1960
|
-
return
|
|
1982
|
+
return jsxRuntime.jsxs("fieldset", {
|
|
1961
1983
|
className: className,
|
|
1962
|
-
id: idSchema.$id
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
},
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
})
|
|
1984
|
+
id: idSchema.$id,
|
|
1985
|
+
children: [jsxRuntime.jsx(ArrayFieldTitleTemplate, {
|
|
1986
|
+
idSchema: idSchema,
|
|
1987
|
+
title: uiOptions.title || title,
|
|
1988
|
+
required: required,
|
|
1989
|
+
schema: schema,
|
|
1990
|
+
uiSchema: uiSchema,
|
|
1991
|
+
registry: registry
|
|
1992
|
+
}), jsxRuntime.jsx(ArrayFieldDescriptionTemplate, {
|
|
1993
|
+
idSchema: idSchema,
|
|
1994
|
+
description: uiOptions.description || schema.description,
|
|
1995
|
+
schema: schema,
|
|
1996
|
+
uiSchema: uiSchema,
|
|
1997
|
+
registry: registry
|
|
1998
|
+
}), jsxRuntime.jsx("div", {
|
|
1999
|
+
className: 'row array-item-list',
|
|
2000
|
+
children: items && items.map(function (_ref) {
|
|
2001
|
+
var key = _ref.key,
|
|
2002
|
+
itemProps = _objectWithoutPropertiesLoose(_ref, _excluded$4);
|
|
2003
|
+
return jsxRuntime.jsx(ArrayFieldItemTemplate, _extends({}, itemProps), key);
|
|
2004
|
+
})
|
|
2005
|
+
}), canAdd && jsxRuntime.jsx(AddButton, {
|
|
2006
|
+
className: 'array-item-add',
|
|
2007
|
+
onClick: onAddClick,
|
|
2008
|
+
disabled: disabled || readonly,
|
|
2009
|
+
uiSchema: uiSchema,
|
|
2010
|
+
registry: registry
|
|
2011
|
+
})]
|
|
2012
|
+
});
|
|
1991
2013
|
}
|
|
1992
2014
|
|
|
1993
2015
|
/** The `ArrayFieldTitleTemplate` component renders a `TitleFieldTemplate` with an `id` derived from
|
|
@@ -2008,8 +2030,8 @@
|
|
|
2008
2030
|
if (!title || !displayLabel) {
|
|
2009
2031
|
return null;
|
|
2010
2032
|
}
|
|
2011
|
-
var TitleFieldTemplate = utils.getTemplate(
|
|
2012
|
-
return
|
|
2033
|
+
var TitleFieldTemplate = utils.getTemplate('TitleFieldTemplate', registry, options);
|
|
2034
|
+
return jsxRuntime.jsx(TitleFieldTemplate, {
|
|
2013
2035
|
id: utils.titleId(idSchema),
|
|
2014
2036
|
title: title,
|
|
2015
2037
|
required: required,
|
|
@@ -2019,7 +2041,7 @@
|
|
|
2019
2041
|
});
|
|
2020
2042
|
}
|
|
2021
2043
|
|
|
2022
|
-
var _excluded$3 = ["id", "value", "readonly", "disabled", "autofocus", "onBlur", "onFocus", "onChange", "options", "schema", "uiSchema", "formContext", "registry", "rawErrors", "type"];
|
|
2044
|
+
var _excluded$3 = ["id", "name", "value", "readonly", "disabled", "autofocus", "onBlur", "onFocus", "onChange", "onChangeOverride", "options", "schema", "uiSchema", "formContext", "registry", "rawErrors", "type"];
|
|
2023
2045
|
/** The `BaseInputTemplate` is the template to use to render the basic `<input>` component for the `core` theme.
|
|
2024
2046
|
* It is used as the template for rendering many of the <input> based widgets that differ by `type` and callbacks only.
|
|
2025
2047
|
* It can be customized/overridden for other themes or individual implementations as needed.
|
|
@@ -2035,6 +2057,7 @@
|
|
|
2035
2057
|
onBlur = props.onBlur,
|
|
2036
2058
|
onFocus = props.onFocus,
|
|
2037
2059
|
onChange = props.onChange,
|
|
2060
|
+
onChangeOverride = props.onChangeOverride,
|
|
2038
2061
|
options = props.options,
|
|
2039
2062
|
schema = props.schema,
|
|
2040
2063
|
type = props.type,
|
|
@@ -2042,51 +2065,52 @@
|
|
|
2042
2065
|
// Note: since React 15.2.0 we can't forward unknown element attributes, so we
|
|
2043
2066
|
// exclude the "options" and "schema" ones here.
|
|
2044
2067
|
if (!id) {
|
|
2045
|
-
console.log(
|
|
2068
|
+
console.log('No id for', props);
|
|
2046
2069
|
throw new Error("no id for props " + JSON.stringify(props));
|
|
2047
2070
|
}
|
|
2048
2071
|
var inputProps = _extends({}, rest, utils.getInputProps(schema, type, options));
|
|
2049
2072
|
var inputValue;
|
|
2050
|
-
if (inputProps.type ===
|
|
2051
|
-
inputValue = value || value === 0 ? value :
|
|
2073
|
+
if (inputProps.type === 'number' || inputProps.type === 'integer') {
|
|
2074
|
+
inputValue = value || value === 0 ? value : '';
|
|
2052
2075
|
} else {
|
|
2053
|
-
inputValue = value == null ?
|
|
2076
|
+
inputValue = value == null ? '' : value;
|
|
2054
2077
|
}
|
|
2055
|
-
var _onChange =
|
|
2078
|
+
var _onChange = react.useCallback(function (_ref) {
|
|
2056
2079
|
var value = _ref.target.value;
|
|
2057
|
-
return onChange(value ===
|
|
2080
|
+
return onChange(value === '' ? options.emptyValue : value);
|
|
2058
2081
|
}, [onChange, options]);
|
|
2059
|
-
var _onBlur =
|
|
2082
|
+
var _onBlur = react.useCallback(function (_ref2) {
|
|
2060
2083
|
var value = _ref2.target.value;
|
|
2061
2084
|
return onBlur(id, value);
|
|
2062
2085
|
}, [onBlur, id]);
|
|
2063
|
-
var _onFocus =
|
|
2086
|
+
var _onFocus = react.useCallback(function (_ref3) {
|
|
2064
2087
|
var value = _ref3.target.value;
|
|
2065
2088
|
return onFocus(id, value);
|
|
2066
2089
|
}, [onFocus, id]);
|
|
2067
|
-
return
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
2091
|
+
children: [jsxRuntime.jsx("input", _extends({
|
|
2092
|
+
id: id,
|
|
2093
|
+
name: id,
|
|
2094
|
+
className: 'form-control',
|
|
2095
|
+
readOnly: readonly,
|
|
2096
|
+
disabled: disabled,
|
|
2097
|
+
autoFocus: autofocus,
|
|
2098
|
+
value: inputValue
|
|
2099
|
+
}, inputProps, {
|
|
2100
|
+
list: schema.examples ? utils.examplesId(id) : undefined,
|
|
2101
|
+
onChange: onChangeOverride || _onChange,
|
|
2102
|
+
onBlur: _onBlur,
|
|
2103
|
+
onFocus: _onFocus,
|
|
2104
|
+
"aria-describedby": utils.ariaDescribedByIds(id, !!schema.examples)
|
|
2105
|
+
})), Array.isArray(schema.examples) && jsxRuntime.jsx("datalist", {
|
|
2106
|
+
id: utils.examplesId(id),
|
|
2107
|
+
children: schema.examples.concat(schema["default"] && !schema.examples.includes(schema["default"]) ? [schema["default"]] : []).map(function (example) {
|
|
2108
|
+
return jsxRuntime.jsx("option", {
|
|
2109
|
+
value: example
|
|
2110
|
+
}, example);
|
|
2111
|
+
})
|
|
2112
|
+
}, "datalist_" + id)]
|
|
2113
|
+
});
|
|
2090
2114
|
}
|
|
2091
2115
|
|
|
2092
2116
|
/** The `SubmitButton` renders a button that represent the `Submit` action on a form
|
|
@@ -2101,53 +2125,58 @@
|
|
|
2101
2125
|
if (norender) {
|
|
2102
2126
|
return null;
|
|
2103
2127
|
}
|
|
2104
|
-
return
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2128
|
+
return jsxRuntime.jsx("div", {
|
|
2129
|
+
children: jsxRuntime.jsx("button", _extends({
|
|
2130
|
+
type: 'submit'
|
|
2131
|
+
}, submitButtonProps, {
|
|
2132
|
+
className: "btn btn-info " + submitButtonProps.className,
|
|
2133
|
+
children: submitText
|
|
2134
|
+
}))
|
|
2135
|
+
});
|
|
2109
2136
|
}
|
|
2110
2137
|
|
|
2111
2138
|
var _excluded$2 = ["iconType", "icon", "className", "uiSchema", "registry"];
|
|
2112
2139
|
function IconButton(props) {
|
|
2113
2140
|
var _props$iconType = props.iconType,
|
|
2114
|
-
iconType = _props$iconType === void 0 ?
|
|
2141
|
+
iconType = _props$iconType === void 0 ? 'default' : _props$iconType,
|
|
2115
2142
|
icon = props.icon,
|
|
2116
2143
|
className = props.className,
|
|
2117
2144
|
otherProps = _objectWithoutPropertiesLoose(props, _excluded$2);
|
|
2118
|
-
return
|
|
2119
|
-
type:
|
|
2145
|
+
return jsxRuntime.jsx("button", _extends({
|
|
2146
|
+
type: 'button',
|
|
2120
2147
|
className: "btn btn-" + iconType + " " + className
|
|
2121
|
-
}, otherProps
|
|
2122
|
-
|
|
2148
|
+
}, otherProps, {
|
|
2149
|
+
children: jsxRuntime.jsx("i", {
|
|
2150
|
+
className: "glyphicon glyphicon-" + icon
|
|
2151
|
+
})
|
|
2123
2152
|
}));
|
|
2124
2153
|
}
|
|
2125
2154
|
function MoveDownButton(props) {
|
|
2126
2155
|
var translateString = props.registry.translateString;
|
|
2127
|
-
return
|
|
2156
|
+
return jsxRuntime.jsx(IconButton, _extends({
|
|
2128
2157
|
title: translateString(utils.TranslatableString.MoveDownButton),
|
|
2129
|
-
className:
|
|
2158
|
+
className: 'array-item-move-down'
|
|
2130
2159
|
}, props, {
|
|
2131
|
-
icon:
|
|
2160
|
+
icon: 'arrow-down'
|
|
2132
2161
|
}));
|
|
2133
2162
|
}
|
|
2134
2163
|
function MoveUpButton(props) {
|
|
2135
2164
|
var translateString = props.registry.translateString;
|
|
2136
|
-
return
|
|
2165
|
+
return jsxRuntime.jsx(IconButton, _extends({
|
|
2137
2166
|
title: translateString(utils.TranslatableString.MoveUpButton),
|
|
2138
|
-
className:
|
|
2167
|
+
className: 'array-item-move-up'
|
|
2139
2168
|
}, props, {
|
|
2140
|
-
icon:
|
|
2169
|
+
icon: 'arrow-up'
|
|
2141
2170
|
}));
|
|
2142
2171
|
}
|
|
2143
2172
|
function RemoveButton(props) {
|
|
2144
2173
|
var translateString = props.registry.translateString;
|
|
2145
|
-
return
|
|
2174
|
+
return jsxRuntime.jsx(IconButton, _extends({
|
|
2146
2175
|
title: translateString(utils.TranslatableString.RemoveButton),
|
|
2147
|
-
className:
|
|
2176
|
+
className: 'array-item-remove'
|
|
2148
2177
|
}, props, {
|
|
2149
|
-
iconType:
|
|
2150
|
-
icon:
|
|
2178
|
+
iconType: 'danger',
|
|
2179
|
+
icon: 'remove'
|
|
2151
2180
|
}));
|
|
2152
2181
|
}
|
|
2153
2182
|
|
|
@@ -2159,19 +2188,21 @@
|
|
|
2159
2188
|
disabled = _ref.disabled,
|
|
2160
2189
|
registry = _ref.registry;
|
|
2161
2190
|
var translateString = registry.translateString;
|
|
2162
|
-
return
|
|
2163
|
-
className:
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2191
|
+
return jsxRuntime.jsx("div", {
|
|
2192
|
+
className: 'row',
|
|
2193
|
+
children: jsxRuntime.jsx("p", {
|
|
2194
|
+
className: "col-xs-3 col-xs-offset-9 text-right " + className,
|
|
2195
|
+
children: jsxRuntime.jsx(IconButton, {
|
|
2196
|
+
iconType: 'info',
|
|
2197
|
+
icon: 'plus',
|
|
2198
|
+
className: 'btn-add col-xs-12',
|
|
2199
|
+
title: translateString(utils.TranslatableString.AddButton),
|
|
2200
|
+
onClick: onClick,
|
|
2201
|
+
disabled: disabled,
|
|
2202
|
+
registry: registry
|
|
2203
|
+
})
|
|
2204
|
+
})
|
|
2205
|
+
});
|
|
2175
2206
|
}
|
|
2176
2207
|
|
|
2177
2208
|
function buttonTemplates() {
|
|
@@ -2194,16 +2225,18 @@
|
|
|
2194
2225
|
if (!description) {
|
|
2195
2226
|
return null;
|
|
2196
2227
|
}
|
|
2197
|
-
if (typeof description ===
|
|
2198
|
-
return
|
|
2228
|
+
if (typeof description === 'string') {
|
|
2229
|
+
return jsxRuntime.jsx("p", {
|
|
2199
2230
|
id: id,
|
|
2200
|
-
className:
|
|
2201
|
-
|
|
2231
|
+
className: 'field-description',
|
|
2232
|
+
children: description
|
|
2233
|
+
});
|
|
2202
2234
|
} else {
|
|
2203
|
-
return
|
|
2235
|
+
return jsxRuntime.jsx("div", {
|
|
2204
2236
|
id: id,
|
|
2205
|
-
className:
|
|
2206
|
-
|
|
2237
|
+
className: 'field-description',
|
|
2238
|
+
children: description
|
|
2239
|
+
});
|
|
2207
2240
|
}
|
|
2208
2241
|
}
|
|
2209
2242
|
|
|
@@ -2215,23 +2248,27 @@
|
|
|
2215
2248
|
var errors = _ref.errors,
|
|
2216
2249
|
registry = _ref.registry;
|
|
2217
2250
|
var translateString = registry.translateString;
|
|
2218
|
-
return
|
|
2219
|
-
className:
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2251
|
+
return jsxRuntime.jsxs("div", {
|
|
2252
|
+
className: 'panel panel-danger errors',
|
|
2253
|
+
children: [jsxRuntime.jsx("div", {
|
|
2254
|
+
className: 'panel-heading',
|
|
2255
|
+
children: jsxRuntime.jsx("h3", {
|
|
2256
|
+
className: 'panel-title',
|
|
2257
|
+
children: translateString(utils.TranslatableString.ErrorsLabel)
|
|
2258
|
+
})
|
|
2259
|
+
}), jsxRuntime.jsx("ul", {
|
|
2260
|
+
className: 'list-group',
|
|
2261
|
+
children: errors.map(function (error, i) {
|
|
2262
|
+
return jsxRuntime.jsx("li", {
|
|
2263
|
+
className: 'list-group-item text-danger',
|
|
2264
|
+
children: error.stack
|
|
2265
|
+
}, i);
|
|
2266
|
+
})
|
|
2267
|
+
})]
|
|
2268
|
+
});
|
|
2232
2269
|
}
|
|
2233
2270
|
|
|
2234
|
-
var REQUIRED_FIELD_SYMBOL$1 =
|
|
2271
|
+
var REQUIRED_FIELD_SYMBOL$1 = '*';
|
|
2235
2272
|
/** Renders a label for a field
|
|
2236
2273
|
*
|
|
2237
2274
|
* @param props - The `LabelProps` for this component
|
|
@@ -2243,12 +2280,14 @@
|
|
|
2243
2280
|
if (!label) {
|
|
2244
2281
|
return null;
|
|
2245
2282
|
}
|
|
2246
|
-
return
|
|
2247
|
-
className:
|
|
2248
|
-
htmlFor: id
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2283
|
+
return jsxRuntime.jsxs("label", {
|
|
2284
|
+
className: 'control-label',
|
|
2285
|
+
htmlFor: id,
|
|
2286
|
+
children: [label, required && jsxRuntime.jsx("span", {
|
|
2287
|
+
className: 'required',
|
|
2288
|
+
children: REQUIRED_FIELD_SYMBOL$1
|
|
2289
|
+
})]
|
|
2290
|
+
});
|
|
2252
2291
|
}
|
|
2253
2292
|
|
|
2254
2293
|
/** The `FieldTemplate` component is the template used by `SchemaField` to render any field. It renders the field
|
|
@@ -2269,17 +2308,20 @@
|
|
|
2269
2308
|
registry = props.registry,
|
|
2270
2309
|
uiSchema = props.uiSchema;
|
|
2271
2310
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
2272
|
-
var WrapIfAdditionalTemplate = utils.getTemplate(
|
|
2311
|
+
var WrapIfAdditionalTemplate = utils.getTemplate('WrapIfAdditionalTemplate', registry, uiOptions);
|
|
2273
2312
|
if (hidden) {
|
|
2274
|
-
return
|
|
2275
|
-
className:
|
|
2276
|
-
|
|
2313
|
+
return jsxRuntime.jsx("div", {
|
|
2314
|
+
className: 'hidden',
|
|
2315
|
+
children: children
|
|
2316
|
+
});
|
|
2277
2317
|
}
|
|
2278
|
-
return
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2318
|
+
return jsxRuntime.jsxs(WrapIfAdditionalTemplate, _extends({}, props, {
|
|
2319
|
+
children: [displayLabel && jsxRuntime.jsx(Label, {
|
|
2320
|
+
label: label,
|
|
2321
|
+
required: required,
|
|
2322
|
+
id: id
|
|
2323
|
+
}), displayLabel && description ? description : null, children, errors, help]
|
|
2324
|
+
}));
|
|
2283
2325
|
}
|
|
2284
2326
|
|
|
2285
2327
|
/** The `FieldErrorTemplate` component renders the errors local to the particular field
|
|
@@ -2294,17 +2336,20 @@
|
|
|
2294
2336
|
return null;
|
|
2295
2337
|
}
|
|
2296
2338
|
var id = utils.errorId(idSchema);
|
|
2297
|
-
return
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2339
|
+
return jsxRuntime.jsx("div", {
|
|
2340
|
+
children: jsxRuntime.jsx("ul", {
|
|
2341
|
+
id: id,
|
|
2342
|
+
className: 'error-detail bs-callout bs-callout-info',
|
|
2343
|
+
children: errors.filter(function (elem) {
|
|
2344
|
+
return !!elem;
|
|
2345
|
+
}).map(function (error, index) {
|
|
2346
|
+
return jsxRuntime.jsx("li", {
|
|
2347
|
+
className: 'text-danger',
|
|
2348
|
+
children: error
|
|
2349
|
+
}, index);
|
|
2350
|
+
})
|
|
2351
|
+
})
|
|
2352
|
+
});
|
|
2308
2353
|
}
|
|
2309
2354
|
|
|
2310
2355
|
/** The `FieldHelpTemplate` component renders any help desired for a field
|
|
@@ -2318,16 +2363,18 @@
|
|
|
2318
2363
|
return null;
|
|
2319
2364
|
}
|
|
2320
2365
|
var id = utils.helpId(idSchema);
|
|
2321
|
-
if (typeof help ===
|
|
2322
|
-
return
|
|
2366
|
+
if (typeof help === 'string') {
|
|
2367
|
+
return jsxRuntime.jsx("p", {
|
|
2323
2368
|
id: id,
|
|
2324
|
-
className:
|
|
2325
|
-
|
|
2369
|
+
className: 'help-block',
|
|
2370
|
+
children: help
|
|
2371
|
+
});
|
|
2326
2372
|
}
|
|
2327
|
-
return
|
|
2373
|
+
return jsxRuntime.jsx("div", {
|
|
2328
2374
|
id: id,
|
|
2329
|
-
className:
|
|
2330
|
-
|
|
2375
|
+
className: 'help-block',
|
|
2376
|
+
children: help
|
|
2377
|
+
});
|
|
2331
2378
|
}
|
|
2332
2379
|
|
|
2333
2380
|
/** The `ObjectFieldTemplate` is the template to use to render all the inner properties of an object along with the
|
|
@@ -2350,37 +2397,38 @@
|
|
|
2350
2397
|
title = props.title,
|
|
2351
2398
|
uiSchema = props.uiSchema;
|
|
2352
2399
|
var options = utils.getUiOptions(uiSchema);
|
|
2353
|
-
var TitleFieldTemplate = utils.getTemplate(
|
|
2354
|
-
var DescriptionFieldTemplate = utils.getTemplate(
|
|
2400
|
+
var TitleFieldTemplate = utils.getTemplate('TitleFieldTemplate', registry, options);
|
|
2401
|
+
var DescriptionFieldTemplate = utils.getTemplate('DescriptionFieldTemplate', registry, options);
|
|
2355
2402
|
// Button templates are not overridden in the uiSchema
|
|
2356
2403
|
var AddButton = registry.templates.ButtonTemplates.AddButton;
|
|
2357
|
-
return
|
|
2358
|
-
id: idSchema.$id
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2404
|
+
return jsxRuntime.jsxs("fieldset", {
|
|
2405
|
+
id: idSchema.$id,
|
|
2406
|
+
children: [(options.title || title) && jsxRuntime.jsx(TitleFieldTemplate, {
|
|
2407
|
+
id: utils.titleId(idSchema),
|
|
2408
|
+
title: options.title || title,
|
|
2409
|
+
required: required,
|
|
2410
|
+
schema: schema,
|
|
2411
|
+
uiSchema: uiSchema,
|
|
2412
|
+
registry: registry
|
|
2413
|
+
}), (options.description || description) && jsxRuntime.jsx(DescriptionFieldTemplate, {
|
|
2414
|
+
id: utils.descriptionId(idSchema),
|
|
2415
|
+
description: options.description || description,
|
|
2416
|
+
schema: schema,
|
|
2417
|
+
uiSchema: uiSchema,
|
|
2418
|
+
registry: registry
|
|
2419
|
+
}), properties.map(function (prop) {
|
|
2420
|
+
return prop.content;
|
|
2421
|
+
}), utils.canExpand(schema, uiSchema, formData) && jsxRuntime.jsx(AddButton, {
|
|
2422
|
+
className: 'object-property-expand',
|
|
2423
|
+
onClick: onAddClick(schema),
|
|
2424
|
+
disabled: disabled || readonly,
|
|
2425
|
+
uiSchema: uiSchema,
|
|
2426
|
+
registry: registry
|
|
2427
|
+
})]
|
|
2428
|
+
});
|
|
2381
2429
|
}
|
|
2382
2430
|
|
|
2383
|
-
var REQUIRED_FIELD_SYMBOL =
|
|
2431
|
+
var REQUIRED_FIELD_SYMBOL = '*';
|
|
2384
2432
|
/** The `TitleField` is the template to use to render the title of a field
|
|
2385
2433
|
*
|
|
2386
2434
|
* @param props - The `TitleFieldProps` for this component
|
|
@@ -2389,11 +2437,13 @@
|
|
|
2389
2437
|
var id = props.id,
|
|
2390
2438
|
title = props.title,
|
|
2391
2439
|
required = props.required;
|
|
2392
|
-
return
|
|
2393
|
-
id: id
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2440
|
+
return jsxRuntime.jsxs("legend", {
|
|
2441
|
+
id: id,
|
|
2442
|
+
children: [title, required && jsxRuntime.jsx("span", {
|
|
2443
|
+
className: 'required',
|
|
2444
|
+
children: REQUIRED_FIELD_SYMBOL
|
|
2445
|
+
})]
|
|
2446
|
+
});
|
|
2397
2447
|
}
|
|
2398
2448
|
|
|
2399
2449
|
/** The `UnsupportedField` component is used to render a field in the schema is one that is not supported by
|
|
@@ -2417,9 +2467,16 @@
|
|
|
2417
2467
|
translateEnum = translateEnum === utils.TranslatableString.UnsupportedField ? utils.TranslatableString.UnsupportedFieldWithReason : utils.TranslatableString.UnsupportedFieldWithIdAndReason;
|
|
2418
2468
|
translateParams.push(reason);
|
|
2419
2469
|
}
|
|
2420
|
-
return
|
|
2421
|
-
className:
|
|
2422
|
-
|
|
2470
|
+
return jsxRuntime.jsxs("div", {
|
|
2471
|
+
className: 'unsupported-field',
|
|
2472
|
+
children: [jsxRuntime.jsx("p", {
|
|
2473
|
+
children: jsxRuntime.jsx(Markdown__default["default"], {
|
|
2474
|
+
children: translateString(translateEnum, translateParams)
|
|
2475
|
+
})
|
|
2476
|
+
}), schema && jsxRuntime.jsx("pre", {
|
|
2477
|
+
children: JSON.stringify(schema, null, 2)
|
|
2478
|
+
})]
|
|
2479
|
+
});
|
|
2423
2480
|
}
|
|
2424
2481
|
|
|
2425
2482
|
/** The `WrapIfAdditional` component is used by the `FieldTemplate` to rename, or remove properties that are
|
|
@@ -2448,46 +2505,53 @@
|
|
|
2448
2505
|
var keyLabel = translateString(utils.TranslatableString.KeyLabel, [label]);
|
|
2449
2506
|
var additional = (utils.ADDITIONAL_PROPERTY_FLAG in schema);
|
|
2450
2507
|
if (!additional) {
|
|
2451
|
-
return
|
|
2508
|
+
return jsxRuntime.jsx("div", {
|
|
2452
2509
|
className: classNames,
|
|
2453
|
-
style: style
|
|
2454
|
-
|
|
2510
|
+
style: style,
|
|
2511
|
+
children: children
|
|
2512
|
+
});
|
|
2455
2513
|
}
|
|
2456
|
-
return
|
|
2514
|
+
return jsxRuntime.jsx("div", {
|
|
2457
2515
|
className: classNames,
|
|
2458
|
-
style: style
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2516
|
+
style: style,
|
|
2517
|
+
children: jsxRuntime.jsxs("div", {
|
|
2518
|
+
className: 'row',
|
|
2519
|
+
children: [jsxRuntime.jsx("div", {
|
|
2520
|
+
className: 'col-xs-5 form-additional',
|
|
2521
|
+
children: jsxRuntime.jsxs("div", {
|
|
2522
|
+
className: 'form-group',
|
|
2523
|
+
children: [jsxRuntime.jsx(Label, {
|
|
2524
|
+
label: keyLabel,
|
|
2525
|
+
required: required,
|
|
2526
|
+
id: id + "-key"
|
|
2527
|
+
}), jsxRuntime.jsx("input", {
|
|
2528
|
+
className: 'form-control',
|
|
2529
|
+
type: 'text',
|
|
2530
|
+
id: id + "-key",
|
|
2531
|
+
onBlur: function onBlur(event) {
|
|
2532
|
+
return onKeyChange(event.target.value);
|
|
2533
|
+
},
|
|
2534
|
+
defaultValue: label
|
|
2535
|
+
})]
|
|
2536
|
+
})
|
|
2537
|
+
}), jsxRuntime.jsx("div", {
|
|
2538
|
+
className: 'form-additional form-group col-xs-5',
|
|
2539
|
+
children: children
|
|
2540
|
+
}), jsxRuntime.jsx("div", {
|
|
2541
|
+
className: 'col-xs-2',
|
|
2542
|
+
children: jsxRuntime.jsx(RemoveButton, {
|
|
2543
|
+
className: 'array-item-remove btn-block',
|
|
2544
|
+
style: {
|
|
2545
|
+
border: '0'
|
|
2546
|
+
},
|
|
2547
|
+
disabled: disabled || readonly,
|
|
2548
|
+
onClick: onDropPropertyClick(label),
|
|
2549
|
+
uiSchema: uiSchema,
|
|
2550
|
+
registry: registry
|
|
2551
|
+
})
|
|
2552
|
+
})]
|
|
2553
|
+
})
|
|
2554
|
+
});
|
|
2491
2555
|
}
|
|
2492
2556
|
|
|
2493
2557
|
function templates() {
|
|
@@ -2536,29 +2600,29 @@
|
|
|
2536
2600
|
minute = state.minute,
|
|
2537
2601
|
second = state.second;
|
|
2538
2602
|
var data = [{
|
|
2539
|
-
type:
|
|
2603
|
+
type: 'year',
|
|
2540
2604
|
range: yearsRange,
|
|
2541
2605
|
value: year
|
|
2542
2606
|
}, {
|
|
2543
|
-
type:
|
|
2607
|
+
type: 'month',
|
|
2544
2608
|
range: [1, 12],
|
|
2545
2609
|
value: month
|
|
2546
2610
|
}, {
|
|
2547
|
-
type:
|
|
2611
|
+
type: 'day',
|
|
2548
2612
|
range: [1, 31],
|
|
2549
2613
|
value: day
|
|
2550
2614
|
}];
|
|
2551
2615
|
if (time) {
|
|
2552
2616
|
data.push({
|
|
2553
|
-
type:
|
|
2617
|
+
type: 'hour',
|
|
2554
2618
|
range: [0, 23],
|
|
2555
2619
|
value: hour
|
|
2556
2620
|
}, {
|
|
2557
|
-
type:
|
|
2621
|
+
type: 'minute',
|
|
2558
2622
|
range: [0, 59],
|
|
2559
2623
|
value: minute
|
|
2560
2624
|
}, {
|
|
2561
|
-
type:
|
|
2625
|
+
type: 'second',
|
|
2562
2626
|
range: [0, 59],
|
|
2563
2627
|
value: second
|
|
2564
2628
|
});
|
|
@@ -2571,20 +2635,22 @@
|
|
|
2571
2635
|
value = _ref.value,
|
|
2572
2636
|
select = _ref.select,
|
|
2573
2637
|
rootId = _ref.rootId,
|
|
2638
|
+
name = _ref.name,
|
|
2574
2639
|
disabled = _ref.disabled,
|
|
2575
2640
|
readonly = _ref.readonly,
|
|
2576
2641
|
autofocus = _ref.autofocus,
|
|
2577
2642
|
registry = _ref.registry,
|
|
2578
2643
|
onBlur = _ref.onBlur,
|
|
2579
2644
|
onFocus = _ref.onFocus;
|
|
2580
|
-
var id = rootId +
|
|
2645
|
+
var id = rootId + '_' + type;
|
|
2581
2646
|
var SelectWidget = registry.widgets.SelectWidget;
|
|
2582
|
-
return
|
|
2647
|
+
return jsxRuntime.jsx(SelectWidget, {
|
|
2583
2648
|
schema: {
|
|
2584
|
-
type:
|
|
2649
|
+
type: 'integer'
|
|
2585
2650
|
},
|
|
2586
2651
|
id: id,
|
|
2587
|
-
|
|
2652
|
+
name: name,
|
|
2653
|
+
className: 'form-control',
|
|
2588
2654
|
options: {
|
|
2589
2655
|
enumOptions: rangeOptions(range[0], range[1])
|
|
2590
2656
|
},
|
|
@@ -2599,7 +2665,7 @@
|
|
|
2599
2665
|
onBlur: onBlur,
|
|
2600
2666
|
onFocus: onFocus,
|
|
2601
2667
|
registry: registry,
|
|
2602
|
-
label:
|
|
2668
|
+
label: '',
|
|
2603
2669
|
"aria-describedby": utils.ariaDescribedByIds(rootId)
|
|
2604
2670
|
});
|
|
2605
2671
|
}
|
|
@@ -2617,33 +2683,34 @@
|
|
|
2617
2683
|
autofocus = _ref2$autofocus === void 0 ? false : _ref2$autofocus,
|
|
2618
2684
|
options = _ref2.options,
|
|
2619
2685
|
id = _ref2.id,
|
|
2686
|
+
name = _ref2.name,
|
|
2620
2687
|
registry = _ref2.registry,
|
|
2621
2688
|
onBlur = _ref2.onBlur,
|
|
2622
2689
|
onFocus = _ref2.onFocus,
|
|
2623
2690
|
onChange = _ref2.onChange,
|
|
2624
2691
|
value = _ref2.value;
|
|
2625
2692
|
var translateString = registry.translateString;
|
|
2626
|
-
var _useReducer =
|
|
2693
|
+
var _useReducer = react.useReducer(function (state, action) {
|
|
2627
2694
|
return _extends({}, state, action);
|
|
2628
2695
|
}, utils.parseDateString(value, time)),
|
|
2629
2696
|
state = _useReducer[0],
|
|
2630
2697
|
setState = _useReducer[1];
|
|
2631
|
-
|
|
2698
|
+
react.useEffect(function () {
|
|
2632
2699
|
if (value && value !== utils.toDateString(state, time)) {
|
|
2633
2700
|
setState(utils.parseDateString(value, time));
|
|
2634
2701
|
}
|
|
2635
2702
|
}, [value, state, time]);
|
|
2636
|
-
|
|
2703
|
+
react.useEffect(function () {
|
|
2637
2704
|
if (readyForChange(state)) {
|
|
2638
2705
|
// Only propagate to parent state if we have a complete date{time}
|
|
2639
2706
|
onChange(utils.toDateString(state, time));
|
|
2640
2707
|
}
|
|
2641
2708
|
}, [state, time, onChange]);
|
|
2642
|
-
var handleChange =
|
|
2709
|
+
var handleChange = react.useCallback(function (property, value) {
|
|
2643
2710
|
var _setState;
|
|
2644
2711
|
setState((_setState = {}, _setState[property] = value, _setState));
|
|
2645
2712
|
}, []);
|
|
2646
|
-
var handleSetNow =
|
|
2713
|
+
var handleSetNow = react.useCallback(function (event) {
|
|
2647
2714
|
event.preventDefault();
|
|
2648
2715
|
if (disabled || readonly) {
|
|
2649
2716
|
return;
|
|
@@ -2651,44 +2718,50 @@
|
|
|
2651
2718
|
var nowDateObj = utils.parseDateString(new Date().toJSON(), time);
|
|
2652
2719
|
setState(nowDateObj);
|
|
2653
2720
|
}, [disabled, readonly, time]);
|
|
2654
|
-
var handleClear =
|
|
2721
|
+
var handleClear = react.useCallback(function (event) {
|
|
2655
2722
|
event.preventDefault();
|
|
2656
2723
|
if (disabled || readonly) {
|
|
2657
2724
|
return;
|
|
2658
2725
|
}
|
|
2659
|
-
setState(utils.parseDateString(
|
|
2726
|
+
setState(utils.parseDateString('', time));
|
|
2660
2727
|
onChange(undefined);
|
|
2661
2728
|
}, [disabled, readonly, time, onChange]);
|
|
2662
|
-
return
|
|
2663
|
-
className:
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2729
|
+
return jsxRuntime.jsxs("ul", {
|
|
2730
|
+
className: 'list-inline',
|
|
2731
|
+
children: [dateElementProps(state, time, options.yearsRange).map(function (elemProps, i) {
|
|
2732
|
+
return jsxRuntime.jsx("li", {
|
|
2733
|
+
className: 'list-inline-item',
|
|
2734
|
+
children: jsxRuntime.jsx(DateElement, _extends({
|
|
2735
|
+
rootId: id,
|
|
2736
|
+
name: name,
|
|
2737
|
+
select: handleChange
|
|
2738
|
+
}, elemProps, {
|
|
2739
|
+
disabled: disabled,
|
|
2740
|
+
readonly: readonly,
|
|
2741
|
+
registry: registry,
|
|
2742
|
+
onBlur: onBlur,
|
|
2743
|
+
onFocus: onFocus,
|
|
2744
|
+
autofocus: autofocus && i === 0
|
|
2745
|
+
}))
|
|
2746
|
+
}, i);
|
|
2747
|
+
}), (options.hideNowButton !== 'undefined' ? !options.hideNowButton : true) && jsxRuntime.jsx("li", {
|
|
2748
|
+
className: 'list-inline-item',
|
|
2749
|
+
children: jsxRuntime.jsx("a", {
|
|
2750
|
+
href: '#',
|
|
2751
|
+
className: 'btn btn-info btn-now',
|
|
2752
|
+
onClick: handleSetNow,
|
|
2753
|
+
children: translateString(utils.TranslatableString.NowLabel)
|
|
2754
|
+
})
|
|
2755
|
+
}), (options.hideClearButton !== 'undefined' ? !options.hideClearButton : true) && jsxRuntime.jsx("li", {
|
|
2756
|
+
className: 'list-inline-item',
|
|
2757
|
+
children: jsxRuntime.jsx("a", {
|
|
2758
|
+
href: '#',
|
|
2759
|
+
className: 'btn btn-warning btn-clear',
|
|
2760
|
+
onClick: handleClear,
|
|
2761
|
+
children: translateString(utils.TranslatableString.ClearLabel)
|
|
2762
|
+
})
|
|
2763
|
+
})]
|
|
2764
|
+
});
|
|
2692
2765
|
}
|
|
2693
2766
|
|
|
2694
2767
|
var _excluded$1 = ["time"];
|
|
@@ -2702,7 +2775,7 @@
|
|
|
2702
2775
|
time = _ref$time === void 0 ? true : _ref$time,
|
|
2703
2776
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
2704
2777
|
var AltDateWidget = props.registry.widgets.AltDateWidget;
|
|
2705
|
-
return
|
|
2778
|
+
return jsxRuntime.jsx(AltDateWidget, _extends({
|
|
2706
2779
|
time: time
|
|
2707
2780
|
}, props));
|
|
2708
2781
|
}
|
|
@@ -2727,41 +2800,46 @@
|
|
|
2727
2800
|
onFocus = _ref.onFocus,
|
|
2728
2801
|
onChange = _ref.onChange,
|
|
2729
2802
|
registry = _ref.registry;
|
|
2730
|
-
var DescriptionFieldTemplate = utils.getTemplate(
|
|
2803
|
+
var DescriptionFieldTemplate = utils.getTemplate('DescriptionFieldTemplate', registry, options);
|
|
2731
2804
|
// Because an unchecked checkbox will cause html5 validation to fail, only add
|
|
2732
2805
|
// the "required" attribute if the field value must be "true", due to the
|
|
2733
2806
|
// "const" or "enum" keywords
|
|
2734
2807
|
var required = utils.schemaRequiresTrueValue(schema);
|
|
2735
|
-
var handleChange =
|
|
2808
|
+
var handleChange = react.useCallback(function (event) {
|
|
2736
2809
|
return onChange(event.target.checked);
|
|
2737
2810
|
}, [onChange]);
|
|
2738
|
-
var handleBlur =
|
|
2811
|
+
var handleBlur = react.useCallback(function (event) {
|
|
2739
2812
|
return onBlur(id, event.target.checked);
|
|
2740
2813
|
}, [onBlur, id]);
|
|
2741
|
-
var handleFocus =
|
|
2814
|
+
var handleFocus = react.useCallback(function (event) {
|
|
2742
2815
|
return onFocus(id, event.target.checked);
|
|
2743
2816
|
}, [onFocus, id]);
|
|
2744
|
-
return
|
|
2745
|
-
className: "checkbox " + (disabled || readonly ?
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2817
|
+
return jsxRuntime.jsxs("div", {
|
|
2818
|
+
className: "checkbox " + (disabled || readonly ? 'disabled' : ''),
|
|
2819
|
+
children: [schema.description && jsxRuntime.jsx(DescriptionFieldTemplate, {
|
|
2820
|
+
id: utils.descriptionId(id),
|
|
2821
|
+
description: schema.description,
|
|
2822
|
+
schema: schema,
|
|
2823
|
+
uiSchema: uiSchema,
|
|
2824
|
+
registry: registry
|
|
2825
|
+
}), jsxRuntime.jsxs("label", {
|
|
2826
|
+
children: [jsxRuntime.jsx("input", {
|
|
2827
|
+
type: 'checkbox',
|
|
2828
|
+
id: id,
|
|
2829
|
+
name: id,
|
|
2830
|
+
checked: typeof value === 'undefined' ? false : value,
|
|
2831
|
+
required: required,
|
|
2832
|
+
disabled: disabled || readonly,
|
|
2833
|
+
autoFocus: autofocus,
|
|
2834
|
+
onChange: handleChange,
|
|
2835
|
+
onBlur: handleBlur,
|
|
2836
|
+
onFocus: handleFocus,
|
|
2837
|
+
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
2838
|
+
}), jsxRuntime.jsx("span", {
|
|
2839
|
+
children: label
|
|
2840
|
+
})]
|
|
2841
|
+
})]
|
|
2842
|
+
});
|
|
2765
2843
|
}
|
|
2766
2844
|
|
|
2767
2845
|
/** The `CheckboxesWidget` is a widget for rendering checkbox groups.
|
|
@@ -2786,49 +2864,56 @@
|
|
|
2786
2864
|
onBlur = _ref.onBlur,
|
|
2787
2865
|
onFocus = _ref.onFocus;
|
|
2788
2866
|
var checkboxesValues = Array.isArray(value) ? value : [value];
|
|
2789
|
-
var handleBlur =
|
|
2867
|
+
var handleBlur = react.useCallback(function (_ref2) {
|
|
2790
2868
|
var value = _ref2.target.value;
|
|
2791
2869
|
return onBlur(id, utils.enumOptionsValueForIndex(value, enumOptions, emptyValue));
|
|
2792
2870
|
}, [onBlur, id]);
|
|
2793
|
-
var handleFocus =
|
|
2871
|
+
var handleFocus = react.useCallback(function (_ref3) {
|
|
2794
2872
|
var value = _ref3.target.value;
|
|
2795
2873
|
return onFocus(id, utils.enumOptionsValueForIndex(value, enumOptions, emptyValue));
|
|
2796
2874
|
}, [onFocus, id]);
|
|
2797
|
-
return
|
|
2798
|
-
className:
|
|
2799
|
-
id: id
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2875
|
+
return jsxRuntime.jsx("div", {
|
|
2876
|
+
className: 'checkboxes',
|
|
2877
|
+
id: id,
|
|
2878
|
+
children: Array.isArray(enumOptions) && enumOptions.map(function (option, index) {
|
|
2879
|
+
var checked = utils.enumOptionsIsSelected(option.value, checkboxesValues);
|
|
2880
|
+
var itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
2881
|
+
var disabledCls = disabled || itemDisabled || readonly ? 'disabled' : '';
|
|
2882
|
+
var handleChange = function handleChange(event) {
|
|
2883
|
+
if (event.target.checked) {
|
|
2884
|
+
onChange(utils.enumOptionsSelectValue(index, checkboxesValues, enumOptions));
|
|
2885
|
+
} else {
|
|
2886
|
+
onChange(utils.enumOptionsDeselectValue(index, checkboxesValues, enumOptions));
|
|
2887
|
+
}
|
|
2888
|
+
};
|
|
2889
|
+
var checkbox = jsxRuntime.jsxs("span", {
|
|
2890
|
+
children: [jsxRuntime.jsx("input", {
|
|
2891
|
+
type: 'checkbox',
|
|
2892
|
+
id: utils.optionId(id, index),
|
|
2893
|
+
name: id,
|
|
2894
|
+
checked: checked,
|
|
2895
|
+
value: String(index),
|
|
2896
|
+
disabled: disabled || itemDisabled || readonly,
|
|
2897
|
+
autoFocus: autofocus && index === 0,
|
|
2898
|
+
onChange: handleChange,
|
|
2899
|
+
onBlur: handleBlur,
|
|
2900
|
+
onFocus: handleFocus,
|
|
2901
|
+
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
2902
|
+
}), jsxRuntime.jsx("span", {
|
|
2903
|
+
children: option.label
|
|
2904
|
+
})]
|
|
2905
|
+
});
|
|
2906
|
+
return inline ? jsxRuntime.jsx("label", {
|
|
2907
|
+
className: "checkbox-inline " + disabledCls,
|
|
2908
|
+
children: checkbox
|
|
2909
|
+
}, index) : jsxRuntime.jsx("div", {
|
|
2910
|
+
className: "checkbox " + disabledCls,
|
|
2911
|
+
children: jsxRuntime.jsx("label", {
|
|
2912
|
+
children: checkbox
|
|
2913
|
+
})
|
|
2914
|
+
}, index);
|
|
2915
|
+
})
|
|
2916
|
+
});
|
|
2832
2917
|
}
|
|
2833
2918
|
|
|
2834
2919
|
/** The `ColorWidget` component uses the `BaseInputTemplate` changing the type to `color` and disables it when it is
|
|
@@ -2841,9 +2926,9 @@
|
|
|
2841
2926
|
readonly = props.readonly,
|
|
2842
2927
|
options = props.options,
|
|
2843
2928
|
registry = props.registry;
|
|
2844
|
-
var BaseInputTemplate = utils.getTemplate(
|
|
2845
|
-
return
|
|
2846
|
-
type:
|
|
2929
|
+
var BaseInputTemplate = utils.getTemplate('BaseInputTemplate', registry, options);
|
|
2930
|
+
return jsxRuntime.jsx(BaseInputTemplate, _extends({
|
|
2931
|
+
type: 'color'
|
|
2847
2932
|
}, props, {
|
|
2848
2933
|
disabled: disabled || readonly
|
|
2849
2934
|
}));
|
|
@@ -2858,12 +2943,12 @@
|
|
|
2858
2943
|
var onChange = props.onChange,
|
|
2859
2944
|
options = props.options,
|
|
2860
2945
|
registry = props.registry;
|
|
2861
|
-
var BaseInputTemplate = utils.getTemplate(
|
|
2862
|
-
var handleChange =
|
|
2946
|
+
var BaseInputTemplate = utils.getTemplate('BaseInputTemplate', registry, options);
|
|
2947
|
+
var handleChange = react.useCallback(function (value) {
|
|
2863
2948
|
return onChange(value || undefined);
|
|
2864
2949
|
}, [onChange]);
|
|
2865
|
-
return
|
|
2866
|
-
type:
|
|
2950
|
+
return jsxRuntime.jsx(BaseInputTemplate, _extends({
|
|
2951
|
+
type: 'date'
|
|
2867
2952
|
}, props, {
|
|
2868
2953
|
onChange: handleChange
|
|
2869
2954
|
}));
|
|
@@ -2879,9 +2964,9 @@
|
|
|
2879
2964
|
value = props.value,
|
|
2880
2965
|
options = props.options,
|
|
2881
2966
|
registry = props.registry;
|
|
2882
|
-
var BaseInputTemplate = utils.getTemplate(
|
|
2883
|
-
return
|
|
2884
|
-
type:
|
|
2967
|
+
var BaseInputTemplate = utils.getTemplate('BaseInputTemplate', registry, options);
|
|
2968
|
+
return jsxRuntime.jsx(BaseInputTemplate, _extends({
|
|
2969
|
+
type: 'datetime-local'
|
|
2885
2970
|
}, props, {
|
|
2886
2971
|
value: utils.utcToLocal(value),
|
|
2887
2972
|
onChange: function onChange(value) {
|
|
@@ -2897,9 +2982,9 @@
|
|
|
2897
2982
|
function EmailWidget(props) {
|
|
2898
2983
|
var options = props.options,
|
|
2899
2984
|
registry = props.registry;
|
|
2900
|
-
var BaseInputTemplate = utils.getTemplate(
|
|
2901
|
-
return
|
|
2902
|
-
type:
|
|
2985
|
+
var BaseInputTemplate = utils.getTemplate('BaseInputTemplate', registry, options);
|
|
2986
|
+
return jsxRuntime.jsx(BaseInputTemplate, _extends({
|
|
2987
|
+
type: 'email'
|
|
2903
2988
|
}, props));
|
|
2904
2989
|
}
|
|
2905
2990
|
|
|
@@ -2907,7 +2992,7 @@
|
|
|
2907
2992
|
if (dataURL === null) {
|
|
2908
2993
|
return null;
|
|
2909
2994
|
}
|
|
2910
|
-
return dataURL.replace(
|
|
2995
|
+
return dataURL.replace(';base64', ";name=" + encodeURIComponent(name) + ";base64");
|
|
2911
2996
|
}
|
|
2912
2997
|
function processFile(file) {
|
|
2913
2998
|
var name = file.name,
|
|
@@ -2918,7 +3003,7 @@
|
|
|
2918
3003
|
reader.onerror = reject;
|
|
2919
3004
|
reader.onload = function (event) {
|
|
2920
3005
|
var _event$target;
|
|
2921
|
-
if (typeof ((_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.result) ===
|
|
3006
|
+
if (typeof ((_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.result) === 'string') {
|
|
2922
3007
|
resolve({
|
|
2923
3008
|
dataURL: addNameToDataURL(event.target.result, name),
|
|
2924
3009
|
name: name,
|
|
@@ -2947,20 +3032,23 @@
|
|
|
2947
3032
|
return null;
|
|
2948
3033
|
}
|
|
2949
3034
|
var translateString = registry.translateString;
|
|
2950
|
-
return
|
|
2951
|
-
className:
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
3035
|
+
return jsxRuntime.jsx("ul", {
|
|
3036
|
+
className: 'file-info',
|
|
3037
|
+
children: filesInfo.map(function (fileInfo, key) {
|
|
3038
|
+
var name = fileInfo.name,
|
|
3039
|
+
size = fileInfo.size,
|
|
3040
|
+
type = fileInfo.type;
|
|
3041
|
+
return jsxRuntime.jsx("li", {
|
|
3042
|
+
children: jsxRuntime.jsx(Markdown__default["default"], {
|
|
3043
|
+
children: translateString(utils.TranslatableString.FilesInfo, [name, type, String(size)])
|
|
3044
|
+
})
|
|
3045
|
+
}, key);
|
|
3046
|
+
})
|
|
3047
|
+
});
|
|
2960
3048
|
}
|
|
2961
3049
|
function extractFileInfo(dataURLs) {
|
|
2962
3050
|
return dataURLs.filter(function (dataURL) {
|
|
2963
|
-
return
|
|
3051
|
+
return dataURL;
|
|
2964
3052
|
}).map(function (dataURL) {
|
|
2965
3053
|
var _dataURItoBlob = utils.dataURItoBlob(dataURL),
|
|
2966
3054
|
blob = _dataURItoBlob.blob,
|
|
@@ -2976,24 +3064,22 @@
|
|
|
2976
3064
|
* The `FileWidget` is a widget for rendering file upload fields.
|
|
2977
3065
|
* It is typically used with a string property with data-url format.
|
|
2978
3066
|
*/
|
|
2979
|
-
function FileWidget(
|
|
2980
|
-
var
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
registry = _ref2.registry;
|
|
2990
|
-
var extractedFilesInfo = React.useMemo(function () {
|
|
3067
|
+
function FileWidget(props) {
|
|
3068
|
+
var disabled = props.disabled,
|
|
3069
|
+
readonly = props.readonly,
|
|
3070
|
+
multiple = props.multiple,
|
|
3071
|
+
onChange = props.onChange,
|
|
3072
|
+
value = props.value,
|
|
3073
|
+
options = props.options,
|
|
3074
|
+
registry = props.registry;
|
|
3075
|
+
var BaseInputTemplate = utils.getTemplate('BaseInputTemplate', registry, options);
|
|
3076
|
+
var extractedFilesInfo = react.useMemo(function () {
|
|
2991
3077
|
return Array.isArray(value) ? extractFileInfo(value) : extractFileInfo([value]);
|
|
2992
3078
|
}, [value]);
|
|
2993
|
-
var _useState =
|
|
3079
|
+
var _useState = react.useState(extractedFilesInfo),
|
|
2994
3080
|
filesInfo = _useState[0],
|
|
2995
3081
|
setFilesInfo = _useState[1];
|
|
2996
|
-
var handleChange =
|
|
3082
|
+
var handleChange = react.useCallback(function (event) {
|
|
2997
3083
|
if (!event.target.files) {
|
|
2998
3084
|
return;
|
|
2999
3085
|
}
|
|
@@ -3009,21 +3095,18 @@
|
|
|
3009
3095
|
}
|
|
3010
3096
|
});
|
|
3011
3097
|
}, [multiple, onChange]);
|
|
3012
|
-
return
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
})
|
|
3024
|
-
filesInfo: filesInfo,
|
|
3025
|
-
registry: registry
|
|
3026
|
-
}));
|
|
3098
|
+
return jsxRuntime.jsxs("div", {
|
|
3099
|
+
children: [jsxRuntime.jsx(BaseInputTemplate, _extends({}, props, {
|
|
3100
|
+
disabled: disabled || readonly,
|
|
3101
|
+
type: 'file',
|
|
3102
|
+
onChangeOverride: handleChange,
|
|
3103
|
+
value: '',
|
|
3104
|
+
accept: options.accept ? String(options.accept) : undefined
|
|
3105
|
+
})), jsxRuntime.jsx(FilesInfo, {
|
|
3106
|
+
filesInfo: filesInfo,
|
|
3107
|
+
registry: registry
|
|
3108
|
+
})]
|
|
3109
|
+
});
|
|
3027
3110
|
}
|
|
3028
3111
|
|
|
3029
3112
|
/** The `HiddenWidget` is a widget for rendering a hidden input field.
|
|
@@ -3034,11 +3117,11 @@
|
|
|
3034
3117
|
function HiddenWidget(_ref) {
|
|
3035
3118
|
var id = _ref.id,
|
|
3036
3119
|
value = _ref.value;
|
|
3037
|
-
return
|
|
3038
|
-
type:
|
|
3120
|
+
return jsxRuntime.jsx("input", {
|
|
3121
|
+
type: 'hidden',
|
|
3039
3122
|
id: id,
|
|
3040
3123
|
name: id,
|
|
3041
|
-
value: typeof value ===
|
|
3124
|
+
value: typeof value === 'undefined' ? '' : value
|
|
3042
3125
|
});
|
|
3043
3126
|
}
|
|
3044
3127
|
|
|
@@ -3049,9 +3132,9 @@
|
|
|
3049
3132
|
function PasswordWidget(props) {
|
|
3050
3133
|
var options = props.options,
|
|
3051
3134
|
registry = props.registry;
|
|
3052
|
-
var BaseInputTemplate = utils.getTemplate(
|
|
3053
|
-
return
|
|
3054
|
-
type:
|
|
3135
|
+
var BaseInputTemplate = utils.getTemplate('BaseInputTemplate', registry, options);
|
|
3136
|
+
return jsxRuntime.jsx(BaseInputTemplate, _extends({
|
|
3137
|
+
type: 'password'
|
|
3055
3138
|
}, props));
|
|
3056
3139
|
}
|
|
3057
3140
|
|
|
@@ -3078,46 +3161,53 @@
|
|
|
3078
3161
|
enumDisabled = options.enumDisabled,
|
|
3079
3162
|
inline = options.inline,
|
|
3080
3163
|
emptyValue = options.emptyValue;
|
|
3081
|
-
var handleBlur =
|
|
3164
|
+
var handleBlur = react.useCallback(function (_ref2) {
|
|
3082
3165
|
var value = _ref2.target.value;
|
|
3083
3166
|
return onBlur(id, utils.enumOptionsValueForIndex(value, enumOptions, emptyValue));
|
|
3084
3167
|
}, [onBlur, id]);
|
|
3085
|
-
var handleFocus =
|
|
3168
|
+
var handleFocus = react.useCallback(function (_ref3) {
|
|
3086
3169
|
var value = _ref3.target.value;
|
|
3087
3170
|
return onFocus(id, utils.enumOptionsValueForIndex(value, enumOptions, emptyValue));
|
|
3088
3171
|
}, [onFocus, id]);
|
|
3089
|
-
return
|
|
3090
|
-
className:
|
|
3091
|
-
id: id
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3172
|
+
return jsxRuntime.jsx("div", {
|
|
3173
|
+
className: 'field-radio-group',
|
|
3174
|
+
id: id,
|
|
3175
|
+
children: Array.isArray(enumOptions) && enumOptions.map(function (option, i) {
|
|
3176
|
+
var checked = utils.enumOptionsIsSelected(option.value, value);
|
|
3177
|
+
var itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
3178
|
+
var disabledCls = disabled || itemDisabled || readonly ? 'disabled' : '';
|
|
3179
|
+
var handleChange = function handleChange() {
|
|
3180
|
+
return onChange(option.value);
|
|
3181
|
+
};
|
|
3182
|
+
var radio = jsxRuntime.jsxs("span", {
|
|
3183
|
+
children: [jsxRuntime.jsx("input", {
|
|
3184
|
+
type: 'radio',
|
|
3185
|
+
id: utils.optionId(id, i),
|
|
3186
|
+
checked: checked,
|
|
3187
|
+
name: name,
|
|
3188
|
+
required: required,
|
|
3189
|
+
value: String(i),
|
|
3190
|
+
disabled: disabled || itemDisabled || readonly,
|
|
3191
|
+
autoFocus: autofocus && i === 0,
|
|
3192
|
+
onChange: handleChange,
|
|
3193
|
+
onBlur: handleBlur,
|
|
3194
|
+
onFocus: handleFocus,
|
|
3195
|
+
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
3196
|
+
}), jsxRuntime.jsx("span", {
|
|
3197
|
+
children: option.label
|
|
3198
|
+
})]
|
|
3199
|
+
});
|
|
3200
|
+
return inline ? jsxRuntime.jsx("label", {
|
|
3201
|
+
className: "radio-inline " + disabledCls,
|
|
3202
|
+
children: radio
|
|
3203
|
+
}, i) : jsxRuntime.jsx("div", {
|
|
3204
|
+
className: "radio " + disabledCls,
|
|
3205
|
+
children: jsxRuntime.jsx("label", {
|
|
3206
|
+
children: radio
|
|
3207
|
+
})
|
|
3208
|
+
}, i);
|
|
3209
|
+
})
|
|
3210
|
+
});
|
|
3121
3211
|
}
|
|
3122
3212
|
|
|
3123
3213
|
/** The `RangeWidget` component uses the `BaseInputTemplate` changing the type to `range` and wrapping the result
|
|
@@ -3128,13 +3218,15 @@
|
|
|
3128
3218
|
function RangeWidget(props) {
|
|
3129
3219
|
var value = props.value,
|
|
3130
3220
|
BaseInputTemplate = props.registry.templates.BaseInputTemplate;
|
|
3131
|
-
return
|
|
3132
|
-
className:
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3221
|
+
return jsxRuntime.jsxs("div", {
|
|
3222
|
+
className: 'field-range-wrapper',
|
|
3223
|
+
children: [jsxRuntime.jsx(BaseInputTemplate, _extends({
|
|
3224
|
+
type: 'range'
|
|
3225
|
+
}, props)), jsxRuntime.jsx("span", {
|
|
3226
|
+
className: 'range-view',
|
|
3227
|
+
children: value
|
|
3228
|
+
})]
|
|
3229
|
+
});
|
|
3138
3230
|
}
|
|
3139
3231
|
|
|
3140
3232
|
function getValue(event, multiple) {
|
|
@@ -3171,45 +3263,47 @@
|
|
|
3171
3263
|
var enumOptions = options.enumOptions,
|
|
3172
3264
|
enumDisabled = options.enumDisabled,
|
|
3173
3265
|
optEmptyVal = options.emptyValue;
|
|
3174
|
-
var emptyValue = multiple ? [] :
|
|
3175
|
-
var handleFocus =
|
|
3266
|
+
var emptyValue = multiple ? [] : '';
|
|
3267
|
+
var handleFocus = react.useCallback(function (event) {
|
|
3176
3268
|
var newValue = getValue(event, multiple);
|
|
3177
3269
|
return onFocus(id, utils.enumOptionsValueForIndex(newValue, enumOptions, optEmptyVal));
|
|
3178
3270
|
}, [onFocus, id, schema, multiple, options]);
|
|
3179
|
-
var handleBlur =
|
|
3271
|
+
var handleBlur = react.useCallback(function (event) {
|
|
3180
3272
|
var newValue = getValue(event, multiple);
|
|
3181
3273
|
return onBlur(id, utils.enumOptionsValueForIndex(newValue, enumOptions, optEmptyVal));
|
|
3182
3274
|
}, [onBlur, id, schema, multiple, options]);
|
|
3183
|
-
var handleChange =
|
|
3275
|
+
var handleChange = react.useCallback(function (event) {
|
|
3184
3276
|
var newValue = getValue(event, multiple);
|
|
3185
3277
|
return onChange(utils.enumOptionsValueForIndex(newValue, enumOptions, optEmptyVal));
|
|
3186
3278
|
}, [onChange, schema, multiple, options]);
|
|
3187
3279
|
var selectedIndexes = utils.enumOptionsIndexForValue(value, enumOptions, multiple);
|
|
3188
|
-
return
|
|
3280
|
+
return jsxRuntime.jsxs("select", {
|
|
3189
3281
|
id: id,
|
|
3190
3282
|
name: id,
|
|
3191
3283
|
multiple: multiple,
|
|
3192
|
-
className:
|
|
3193
|
-
value: typeof selectedIndexes ===
|
|
3284
|
+
className: 'form-control',
|
|
3285
|
+
value: typeof selectedIndexes === 'undefined' ? emptyValue : selectedIndexes,
|
|
3194
3286
|
required: required,
|
|
3195
3287
|
disabled: disabled || readonly,
|
|
3196
3288
|
autoFocus: autofocus,
|
|
3197
3289
|
onBlur: handleBlur,
|
|
3198
3290
|
onFocus: handleFocus,
|
|
3199
3291
|
onChange: handleChange,
|
|
3200
|
-
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3292
|
+
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
3293
|
+
children: [!multiple && schema["default"] === undefined && jsxRuntime.jsx("option", {
|
|
3294
|
+
value: '',
|
|
3295
|
+
children: placeholder
|
|
3296
|
+
}), Array.isArray(enumOptions) && enumOptions.map(function (_ref2, i) {
|
|
3297
|
+
var value = _ref2.value,
|
|
3298
|
+
label = _ref2.label;
|
|
3299
|
+
var disabled = enumDisabled && enumDisabled.indexOf(value) !== -1;
|
|
3300
|
+
return jsxRuntime.jsx("option", {
|
|
3301
|
+
value: String(i),
|
|
3302
|
+
disabled: disabled,
|
|
3303
|
+
children: label
|
|
3304
|
+
}, i);
|
|
3305
|
+
})]
|
|
3306
|
+
});
|
|
3213
3307
|
}
|
|
3214
3308
|
|
|
3215
3309
|
/** The `TextareaWidget` is a widget for rendering input fields as textarea.
|
|
@@ -3230,23 +3324,23 @@
|
|
|
3230
3324
|
onChange = _ref.onChange,
|
|
3231
3325
|
onBlur = _ref.onBlur,
|
|
3232
3326
|
onFocus = _ref.onFocus;
|
|
3233
|
-
var handleChange =
|
|
3327
|
+
var handleChange = react.useCallback(function (_ref2) {
|
|
3234
3328
|
var value = _ref2.target.value;
|
|
3235
|
-
return onChange(value ===
|
|
3329
|
+
return onChange(value === '' ? options.emptyValue : value);
|
|
3236
3330
|
}, [onChange, options.emptyValue]);
|
|
3237
|
-
var handleBlur =
|
|
3331
|
+
var handleBlur = react.useCallback(function (_ref3) {
|
|
3238
3332
|
var value = _ref3.target.value;
|
|
3239
3333
|
return onBlur(id, value);
|
|
3240
3334
|
}, [onBlur, id]);
|
|
3241
|
-
var handleFocus =
|
|
3335
|
+
var handleFocus = react.useCallback(function (_ref4) {
|
|
3242
3336
|
var value = _ref4.target.value;
|
|
3243
3337
|
return onFocus(id, value);
|
|
3244
3338
|
}, [id, onFocus]);
|
|
3245
|
-
return
|
|
3339
|
+
return jsxRuntime.jsx("textarea", {
|
|
3246
3340
|
id: id,
|
|
3247
3341
|
name: id,
|
|
3248
|
-
className:
|
|
3249
|
-
value: value ? value :
|
|
3342
|
+
className: 'form-control',
|
|
3343
|
+
value: value ? value : '',
|
|
3250
3344
|
placeholder: placeholder,
|
|
3251
3345
|
required: required,
|
|
3252
3346
|
disabled: disabled,
|
|
@@ -3271,8 +3365,8 @@
|
|
|
3271
3365
|
function TextWidget(props) {
|
|
3272
3366
|
var options = props.options,
|
|
3273
3367
|
registry = props.registry;
|
|
3274
|
-
var BaseInputTemplate = utils.getTemplate(
|
|
3275
|
-
return
|
|
3368
|
+
var BaseInputTemplate = utils.getTemplate('BaseInputTemplate', registry, options);
|
|
3369
|
+
return jsxRuntime.jsx(BaseInputTemplate, _extends({}, props));
|
|
3276
3370
|
}
|
|
3277
3371
|
|
|
3278
3372
|
/** The `URLWidget` component uses the `BaseInputTemplate` changing the type to `url`.
|
|
@@ -3282,9 +3376,9 @@
|
|
|
3282
3376
|
function URLWidget(props) {
|
|
3283
3377
|
var options = props.options,
|
|
3284
3378
|
registry = props.registry;
|
|
3285
|
-
var BaseInputTemplate = utils.getTemplate(
|
|
3286
|
-
return
|
|
3287
|
-
type:
|
|
3379
|
+
var BaseInputTemplate = utils.getTemplate('BaseInputTemplate', registry, options);
|
|
3380
|
+
return jsxRuntime.jsx(BaseInputTemplate, _extends({
|
|
3381
|
+
type: 'url'
|
|
3288
3382
|
}, props));
|
|
3289
3383
|
}
|
|
3290
3384
|
|
|
@@ -3295,9 +3389,9 @@
|
|
|
3295
3389
|
function UpDownWidget(props) {
|
|
3296
3390
|
var options = props.options,
|
|
3297
3391
|
registry = props.registry;
|
|
3298
|
-
var BaseInputTemplate = utils.getTemplate(
|
|
3299
|
-
return
|
|
3300
|
-
type:
|
|
3392
|
+
var BaseInputTemplate = utils.getTemplate('BaseInputTemplate', registry, options);
|
|
3393
|
+
return jsxRuntime.jsx(BaseInputTemplate, _extends({
|
|
3394
|
+
type: 'number'
|
|
3301
3395
|
}, props));
|
|
3302
3396
|
}
|
|
3303
3397
|
|
|
@@ -3358,7 +3452,7 @@
|
|
|
3358
3452
|
_this.formElement = void 0;
|
|
3359
3453
|
_this.getUsedFormData = function (formData, fields) {
|
|
3360
3454
|
// For the case of a single input form
|
|
3361
|
-
if (fields.length === 0 && typeof formData !==
|
|
3455
|
+
if (fields.length === 0 && typeof formData !== 'object') {
|
|
3362
3456
|
return formData;
|
|
3363
3457
|
}
|
|
3364
3458
|
// _pick has incorrect type definition, it works with string[][], because lodash/hasIn supports it
|
|
@@ -3379,22 +3473,22 @@
|
|
|
3379
3473
|
paths = [[]];
|
|
3380
3474
|
}
|
|
3381
3475
|
Object.keys(_obj).forEach(function (key) {
|
|
3382
|
-
if (typeof _obj[key] ===
|
|
3476
|
+
if (typeof _obj[key] === 'object') {
|
|
3383
3477
|
var newPaths = paths.map(function (path) {
|
|
3384
3478
|
return [].concat(path, [key]);
|
|
3385
3479
|
});
|
|
3386
3480
|
// If an object is marked with additionalProperties, all its keys are valid
|
|
3387
|
-
if (_obj[key][utils.RJSF_ADDITONAL_PROPERTIES_FLAG] && _obj[key][utils.NAME_KEY] !==
|
|
3481
|
+
if (_obj[key][utils.RJSF_ADDITONAL_PROPERTIES_FLAG] && _obj[key][utils.NAME_KEY] !== '') {
|
|
3388
3482
|
acc.push(_obj[key][utils.NAME_KEY]);
|
|
3389
3483
|
} else {
|
|
3390
3484
|
getAllPaths(_obj[key], acc, newPaths);
|
|
3391
3485
|
}
|
|
3392
|
-
} else if (key === utils.NAME_KEY && _obj[key] !==
|
|
3486
|
+
} else if (key === utils.NAME_KEY && _obj[key] !== '') {
|
|
3393
3487
|
paths.forEach(function (path) {
|
|
3394
3488
|
var formValue = get__default["default"](formData, path);
|
|
3395
3489
|
// adds path to fieldNames if it points to a value
|
|
3396
3490
|
// or an empty object/array
|
|
3397
|
-
if (typeof formValue !==
|
|
3491
|
+
if (typeof formValue !== 'object' || isEmpty__default["default"](formValue)) {
|
|
3398
3492
|
acc.push(path);
|
|
3399
3493
|
}
|
|
3400
3494
|
});
|
|
@@ -3427,7 +3521,7 @@
|
|
|
3427
3521
|
var newFormData = formData;
|
|
3428
3522
|
if (omitExtraData === true && liveOmit === true) {
|
|
3429
3523
|
var retrievedSchema = schemaUtils.retrieveSchema(schema, formData);
|
|
3430
|
-
var pathSchema = schemaUtils.toPathSchema(retrievedSchema,
|
|
3524
|
+
var pathSchema = schemaUtils.toPathSchema(retrievedSchema, '', formData);
|
|
3431
3525
|
var fieldNames = _this.getFieldNames(pathSchema, formData);
|
|
3432
3526
|
newFormData = _this.getUsedFormData(formData, fieldNames);
|
|
3433
3527
|
state = {
|
|
@@ -3453,7 +3547,7 @@
|
|
|
3453
3547
|
schemaValidationErrorSchema: schemaValidationErrorSchema
|
|
3454
3548
|
};
|
|
3455
3549
|
} else if (!noValidate && newErrorSchema) {
|
|
3456
|
-
var _errorSchema = extraErrors ? utils.mergeObjects(newErrorSchema, extraErrors,
|
|
3550
|
+
var _errorSchema = extraErrors ? utils.mergeObjects(newErrorSchema, extraErrors, 'preventDuplicates') : newErrorSchema;
|
|
3457
3551
|
state = {
|
|
3458
3552
|
formData: newFormData,
|
|
3459
3553
|
errorSchema: _errorSchema,
|
|
@@ -3493,7 +3587,7 @@
|
|
|
3493
3587
|
schemaUtils = _this$state2.schemaUtils;
|
|
3494
3588
|
if (omitExtraData === true) {
|
|
3495
3589
|
var retrievedSchema = schemaUtils.retrieveSchema(schema, newFormData);
|
|
3496
|
-
var pathSchema = schemaUtils.toPathSchema(retrievedSchema,
|
|
3590
|
+
var pathSchema = schemaUtils.toPathSchema(retrievedSchema, '', newFormData);
|
|
3497
3591
|
var fieldNames = _this.getFieldNames(pathSchema, newFormData);
|
|
3498
3592
|
newFormData = _this.getUsedFormData(newFormData, fieldNames);
|
|
3499
3593
|
}
|
|
@@ -3512,20 +3606,20 @@
|
|
|
3512
3606
|
if (onSubmit) {
|
|
3513
3607
|
onSubmit(_extends({}, _this.state, {
|
|
3514
3608
|
formData: newFormData,
|
|
3515
|
-
status:
|
|
3609
|
+
status: 'submitted'
|
|
3516
3610
|
}), event);
|
|
3517
3611
|
}
|
|
3518
3612
|
});
|
|
3519
3613
|
}
|
|
3520
3614
|
};
|
|
3521
3615
|
if (!props.validator) {
|
|
3522
|
-
throw new Error(
|
|
3616
|
+
throw new Error('A validator is required for Form functionality to work');
|
|
3523
3617
|
}
|
|
3524
3618
|
_this.state = _this.getStateFromProps(props, props.formData);
|
|
3525
3619
|
if (_this.props.onChange && !utils.deepEquals(_this.state.formData, _this.props.formData)) {
|
|
3526
3620
|
_this.props.onChange(_this.state);
|
|
3527
3621
|
}
|
|
3528
|
-
_this.formElement = /*#__PURE__*/
|
|
3622
|
+
_this.formElement = /*#__PURE__*/react.createRef();
|
|
3529
3623
|
return _this;
|
|
3530
3624
|
}
|
|
3531
3625
|
/** React lifecycle method that gets called before new props are provided, updates the state based on new props. It
|
|
@@ -3552,10 +3646,10 @@
|
|
|
3552
3646
|
*/;
|
|
3553
3647
|
_proto.getStateFromProps = function getStateFromProps(props, inputFormData) {
|
|
3554
3648
|
var state = this.state || {};
|
|
3555
|
-
var schema =
|
|
3556
|
-
var uiSchema = (
|
|
3557
|
-
var edit = typeof inputFormData !==
|
|
3558
|
-
var liveValidate =
|
|
3649
|
+
var schema = 'schema' in props ? props.schema : this.props.schema;
|
|
3650
|
+
var uiSchema = ('uiSchema' in props ? props.uiSchema : this.props.uiSchema) || {};
|
|
3651
|
+
var edit = typeof inputFormData !== 'undefined';
|
|
3652
|
+
var liveValidate = 'liveValidate' in props ? props.liveValidate : this.props.liveValidate;
|
|
3559
3653
|
var mustValidate = edit && !props.noValidate && liveValidate;
|
|
3560
3654
|
var rootSchema = schema;
|
|
3561
3655
|
var schemaUtils = state.schemaUtils;
|
|
@@ -3604,7 +3698,7 @@
|
|
|
3604
3698
|
errorSchema = merged.errorSchema;
|
|
3605
3699
|
errors = merged.errors;
|
|
3606
3700
|
}
|
|
3607
|
-
var idSchema = schemaUtils.toIdSchema(retrievedSchema, uiSchema[
|
|
3701
|
+
var idSchema = schemaUtils.toIdSchema(retrievedSchema, uiSchema['ui:rootFieldId'], formData, props.idPrefix, props.idSeparator);
|
|
3608
3702
|
var nextState = {
|
|
3609
3703
|
schemaUtils: schemaUtils,
|
|
3610
3704
|
schema: schema,
|
|
@@ -3656,9 +3750,9 @@
|
|
|
3656
3750
|
uiSchema = _this$state3.uiSchema;
|
|
3657
3751
|
var formContext = this.props.formContext;
|
|
3658
3752
|
var options = utils.getUiOptions(uiSchema);
|
|
3659
|
-
var ErrorListTemplate = utils.getTemplate(
|
|
3753
|
+
var ErrorListTemplate = utils.getTemplate('ErrorListTemplate', registry, options);
|
|
3660
3754
|
if (errors && errors.length) {
|
|
3661
|
-
return
|
|
3755
|
+
return jsxRuntime.jsx(ErrorListTemplate, {
|
|
3662
3756
|
errors: errors,
|
|
3663
3757
|
errorSchema: errorSchema || {},
|
|
3664
3758
|
schema: schema,
|
|
@@ -3700,7 +3794,7 @@
|
|
|
3700
3794
|
/** Provides a function that can be used to programmatically submit the `Form` */;
|
|
3701
3795
|
_proto.submit = function submit() {
|
|
3702
3796
|
if (this.formElement.current) {
|
|
3703
|
-
this.formElement.current.dispatchEvent(new CustomEvent(
|
|
3797
|
+
this.formElement.current.dispatchEvent(new CustomEvent('submit', {
|
|
3704
3798
|
cancelable: true
|
|
3705
3799
|
}));
|
|
3706
3800
|
this.formElement.current.requestSubmit();
|
|
@@ -3715,12 +3809,12 @@
|
|
|
3715
3809
|
_proto.focusOnError = function focusOnError(error) {
|
|
3716
3810
|
var _this$props4 = this.props,
|
|
3717
3811
|
_this$props4$idPrefix = _this$props4.idPrefix,
|
|
3718
|
-
idPrefix = _this$props4$idPrefix === void 0 ?
|
|
3812
|
+
idPrefix = _this$props4$idPrefix === void 0 ? 'root' : _this$props4$idPrefix,
|
|
3719
3813
|
_this$props4$idSepara = _this$props4.idSeparator,
|
|
3720
|
-
idSeparator = _this$props4$idSepara === void 0 ?
|
|
3814
|
+
idSeparator = _this$props4$idSepara === void 0 ? '_' : _this$props4$idSepara;
|
|
3721
3815
|
var property = error.property;
|
|
3722
3816
|
var path = _toPath__default["default"](property);
|
|
3723
|
-
if (path[0] ===
|
|
3817
|
+
if (path[0] === '') {
|
|
3724
3818
|
// Most of the time the `.foo` property results in the first element being empty, so replace it with the idPrefix
|
|
3725
3819
|
path[0] = idPrefix;
|
|
3726
3820
|
} else {
|
|
@@ -3772,7 +3866,7 @@
|
|
|
3772
3866
|
if (onError) {
|
|
3773
3867
|
onError(errors);
|
|
3774
3868
|
} else {
|
|
3775
|
-
console.error(
|
|
3869
|
+
console.error('Form validation failed', errors);
|
|
3776
3870
|
}
|
|
3777
3871
|
});
|
|
3778
3872
|
return false;
|
|
@@ -3789,7 +3883,7 @@
|
|
|
3789
3883
|
idPrefix = _this$props6.idPrefix,
|
|
3790
3884
|
idSeparator = _this$props6.idSeparator,
|
|
3791
3885
|
_this$props6$classNam = _this$props6.className,
|
|
3792
|
-
className = _this$props6$classNam === void 0 ?
|
|
3886
|
+
className = _this$props6$classNam === void 0 ? '' : _this$props6$classNam,
|
|
3793
3887
|
tagName = _this$props6.tagName,
|
|
3794
3888
|
name = _this$props6.name,
|
|
3795
3889
|
method = _this$props6.method,
|
|
@@ -3806,7 +3900,7 @@
|
|
|
3806
3900
|
readonly = _this$props6$readonly === void 0 ? false : _this$props6$readonly,
|
|
3807
3901
|
formContext = _this$props6.formContext,
|
|
3808
3902
|
_this$props6$showErro = _this$props6.showErrorList,
|
|
3809
|
-
showErrorList = _this$props6$showErro === void 0 ?
|
|
3903
|
+
showErrorList = _this$props6$showErro === void 0 ? 'top' : _this$props6$showErro,
|
|
3810
3904
|
_internalFormWrapper = _this$props6._internalFormWrapper;
|
|
3811
3905
|
var _this$state4 = this.state,
|
|
3812
3906
|
schema = _this$state4.schema,
|
|
@@ -3821,9 +3915,9 @@
|
|
|
3821
3915
|
// PropTypes.elementType to use for the inner tag, so we'll need to pass `tagName` along if it is provided.
|
|
3822
3916
|
// NOTE, the `as` prop is native to `semantic-ui` and is emulated in the `material-ui` theme
|
|
3823
3917
|
var as = _internalFormWrapper ? tagName : undefined;
|
|
3824
|
-
var FormTag = _internalFormWrapper || tagName ||
|
|
3825
|
-
return
|
|
3826
|
-
className: className ? className :
|
|
3918
|
+
var FormTag = _internalFormWrapper || tagName || 'form';
|
|
3919
|
+
return jsxRuntime.jsxs(FormTag, {
|
|
3920
|
+
className: className ? className : 'rjsf',
|
|
3827
3921
|
id: id,
|
|
3828
3922
|
name: name,
|
|
3829
3923
|
method: method,
|
|
@@ -3835,35 +3929,36 @@
|
|
|
3835
3929
|
noValidate: noHtml5Validate,
|
|
3836
3930
|
onSubmit: this.onSubmit,
|
|
3837
3931
|
as: as,
|
|
3838
|
-
ref: this.formElement
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3932
|
+
ref: this.formElement,
|
|
3933
|
+
children: [showErrorList === 'top' && this.renderErrors(registry), jsxRuntime.jsx(_SchemaField, {
|
|
3934
|
+
name: '',
|
|
3935
|
+
schema: schema,
|
|
3936
|
+
uiSchema: uiSchema,
|
|
3937
|
+
errorSchema: errorSchema,
|
|
3938
|
+
idSchema: idSchema,
|
|
3939
|
+
idPrefix: idPrefix,
|
|
3940
|
+
idSeparator: idSeparator,
|
|
3941
|
+
formContext: formContext,
|
|
3942
|
+
formData: formData,
|
|
3943
|
+
onChange: this.onChange,
|
|
3944
|
+
onBlur: this.onBlur,
|
|
3945
|
+
onFocus: this.onFocus,
|
|
3946
|
+
registry: registry,
|
|
3947
|
+
disabled: disabled,
|
|
3948
|
+
readonly: readonly
|
|
3949
|
+
}), children ? children : jsxRuntime.jsx(SubmitButton, {
|
|
3950
|
+
uiSchema: uiSchema,
|
|
3951
|
+
registry: registry
|
|
3952
|
+
}), showErrorList === 'bottom' && this.renderErrors(registry)]
|
|
3953
|
+
});
|
|
3859
3954
|
};
|
|
3860
3955
|
return Form;
|
|
3861
|
-
}(
|
|
3956
|
+
}(react.Component);
|
|
3862
3957
|
|
|
3863
3958
|
var _excluded = ["fields", "widgets", "templates"];
|
|
3864
3959
|
/** A Higher-Order component that creates a wrapper around a `Form` with the overrides from the `WithThemeProps` */
|
|
3865
3960
|
function withTheme(themeProps) {
|
|
3866
|
-
return /*#__PURE__*/
|
|
3961
|
+
return /*#__PURE__*/react.forwardRef(function (_ref, ref) {
|
|
3867
3962
|
var _themeProps$templates, _templates;
|
|
3868
3963
|
var fields = _ref.fields,
|
|
3869
3964
|
widgets = _ref.widgets,
|
|
@@ -3874,7 +3969,7 @@
|
|
|
3874
3969
|
templates = _extends({}, themeProps === null || themeProps === void 0 ? void 0 : themeProps.templates, templates, {
|
|
3875
3970
|
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)
|
|
3876
3971
|
});
|
|
3877
|
-
return
|
|
3972
|
+
return jsxRuntime.jsx(Form, _extends({}, themeProps, directProps, {
|
|
3878
3973
|
fields: fields,
|
|
3879
3974
|
widgets: widgets,
|
|
3880
3975
|
templates: templates,
|