@rjsf/core 5.1.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 +898 -763
- 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 +865 -730
- package/dist/core.esm.js.map +1 -1
- package/dist/core.umd.development.js +899 -766
- 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 +23 -17
- package/package.json +6 -5
package/dist/core.esm.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { Component, useState, useCallback, useEffect, useReducer, useMemo, createRef, forwardRef } from 'react';
|
|
3
|
+
import { isFixedItems, allowAdditionalItems, getUiOptions, ITEMS_KEY, getTemplate, TranslatableString, isCustomWidget, getWidget, optionsList, deepEquals, ERRORS_KEY, asNumber, REF_KEY, orderProperties, PROPERTIES_KEY, ADDITIONAL_PROPERTY_FLAG, ANY_OF_KEY, ONE_OF_KEY, mergeObjects, UI_OPTIONS_KEY, descriptionId, getSchemaType, ID_KEY, hasWidget, titleId, getInputProps, examplesId, ariaDescribedByIds, getSubmitButtonOptions, errorId, helpId, canExpand, parseDateString, toDateString, pad, schemaRequiresTrueValue, enumOptionsValueForIndex, enumOptionsIsSelected, optionId, enumOptionsSelectValue, enumOptionsDeselectValue, utcToLocal, localToUTC, dataURItoBlob, enumOptionsIndexForValue, englishStringTranslator, createSchemaUtils, shouldRender, isObject as isObject$1, RJSF_ADDITONAL_PROPERTIES_FLAG, NAME_KEY } from '@rjsf/utils';
|
|
3
4
|
import get from 'lodash-es/get';
|
|
4
5
|
import isEmpty from 'lodash-es/isEmpty';
|
|
5
6
|
import _pick from 'lodash-es/pick';
|
|
@@ -10,6 +11,7 @@ import { nanoid } from 'nanoid';
|
|
|
10
11
|
import omit from 'lodash-es/omit';
|
|
11
12
|
import has from 'lodash-es/has';
|
|
12
13
|
import unset from 'lodash-es/unset';
|
|
14
|
+
import Markdown from 'markdown-to-jsx';
|
|
13
15
|
|
|
14
16
|
function _defineProperties(target, props) {
|
|
15
17
|
for (var i = 0; i < props.length; i++) {
|
|
@@ -189,7 +191,7 @@ var ArrayField = /*#__PURE__*/function (_Component) {
|
|
|
189
191
|
onChange = _this$props3.onChange,
|
|
190
192
|
errorSchema = _this$props3.errorSchema;
|
|
191
193
|
var newErrorSchema;
|
|
192
|
-
if (
|
|
194
|
+
if (errorSchema) {
|
|
193
195
|
newErrorSchema = {};
|
|
194
196
|
for (var idx in errorSchema) {
|
|
195
197
|
var i = parseInt(idx);
|
|
@@ -230,7 +232,7 @@ var ArrayField = /*#__PURE__*/function (_Component) {
|
|
|
230
232
|
var newFormData = arrayData.map(function (item, i) {
|
|
231
233
|
// We need to treat undefined items as nulls to have validation.
|
|
232
234
|
// See https://github.com/tdegrunt/jsonschema/issues/206
|
|
233
|
-
var jsonValue = typeof value ===
|
|
235
|
+
var jsonValue = typeof value === 'undefined' ? null : value;
|
|
234
236
|
return index === i ? jsonValue : item;
|
|
235
237
|
});
|
|
236
238
|
onChange(newFormData, errorSchema && errorSchema && _extends({}, errorSchema, (_extends2 = {}, _extends2[index] = newErrorSchema, _extends2)), id);
|
|
@@ -290,10 +292,10 @@ var ArrayField = /*#__PURE__*/function (_Component) {
|
|
|
290
292
|
if (Array.isArray(itemSchema.type)) {
|
|
291
293
|
// While we don't yet support composite/nullable jsonschema types, it's
|
|
292
294
|
// future-proof to check for requirement against these.
|
|
293
|
-
return !itemSchema.type.includes(
|
|
295
|
+
return !itemSchema.type.includes('null');
|
|
294
296
|
}
|
|
295
297
|
// All non-null array item types are inherently required by design
|
|
296
|
-
return itemSchema.type !==
|
|
298
|
+
return itemSchema.type !== 'null';
|
|
297
299
|
}
|
|
298
300
|
/** Determines whether more items can be added to the array. If the uiSchema indicates the array doesn't allow adding
|
|
299
301
|
* then false is returned. Otherwise, if the schema indicates that there are a maximum number of items and the
|
|
@@ -366,14 +368,15 @@ var ArrayField = /*#__PURE__*/function (_Component) {
|
|
|
366
368
|
uiSchema = _this$props7.uiSchema,
|
|
367
369
|
idSchema = _this$props7.idSchema,
|
|
368
370
|
registry = _this$props7.registry;
|
|
369
|
-
var schemaUtils = registry.schemaUtils
|
|
371
|
+
var schemaUtils = registry.schemaUtils,
|
|
372
|
+
translateString = registry.translateString;
|
|
370
373
|
if (!(ITEMS_KEY in schema)) {
|
|
371
374
|
var uiOptions = getUiOptions(uiSchema);
|
|
372
|
-
var UnsupportedFieldTemplate = getTemplate(
|
|
373
|
-
return
|
|
375
|
+
var UnsupportedFieldTemplate = getTemplate('UnsupportedFieldTemplate', registry, uiOptions);
|
|
376
|
+
return jsx(UnsupportedFieldTemplate, {
|
|
374
377
|
schema: schema,
|
|
375
378
|
idSchema: idSchema,
|
|
376
|
-
reason:
|
|
379
|
+
reason: translateString(TranslatableString.MissingItems),
|
|
377
380
|
registry: registry
|
|
378
381
|
});
|
|
379
382
|
}
|
|
@@ -416,7 +419,7 @@ var ArrayField = /*#__PURE__*/function (_Component) {
|
|
|
416
419
|
onFocus = _this$props8.onFocus,
|
|
417
420
|
idPrefix = _this$props8.idPrefix,
|
|
418
421
|
_this$props8$idSepara = _this$props8.idSeparator,
|
|
419
|
-
idSeparator = _this$props8$idSepara === void 0 ?
|
|
422
|
+
idSeparator = _this$props8$idSepara === void 0 ? '_' : _this$props8$idSepara,
|
|
420
423
|
rawErrors = _this$props8.rawErrors;
|
|
421
424
|
var keyedFormData = this.state.keyedFormData;
|
|
422
425
|
var title = schema.title === undefined ? name : schema.title;
|
|
@@ -471,8 +474,8 @@ var ArrayField = /*#__PURE__*/function (_Component) {
|
|
|
471
474
|
rawErrors: rawErrors,
|
|
472
475
|
registry: registry
|
|
473
476
|
};
|
|
474
|
-
var Template = getTemplate(
|
|
475
|
-
return
|
|
477
|
+
var Template = getTemplate('ArrayFieldTemplate', registry, uiOptions);
|
|
478
|
+
return jsx(Template, _extends({}, arrayProps));
|
|
476
479
|
}
|
|
477
480
|
/** Renders an array using the custom widget provided by the user in the `uiSchema`
|
|
478
481
|
*/;
|
|
@@ -505,8 +508,9 @@ var ArrayField = /*#__PURE__*/function (_Component) {
|
|
|
505
508
|
widget = _getUiOptions2.widget,
|
|
506
509
|
options = _objectWithoutPropertiesLoose(_getUiOptions2, _excluded$9);
|
|
507
510
|
var Widget = getWidget(schema, widget, widgets);
|
|
508
|
-
return
|
|
511
|
+
return jsx(Widget, {
|
|
509
512
|
id: idSchema.$id,
|
|
513
|
+
name: name,
|
|
510
514
|
multiple: true,
|
|
511
515
|
onChange: this.onSelectChange,
|
|
512
516
|
onBlur: onBlur,
|
|
@@ -558,11 +562,12 @@ var ArrayField = /*#__PURE__*/function (_Component) {
|
|
|
558
562
|
var enumOptions = optionsList(itemsSchema);
|
|
559
563
|
var _getUiOptions3 = getUiOptions(uiSchema),
|
|
560
564
|
_getUiOptions3$widget = _getUiOptions3.widget,
|
|
561
|
-
widget = _getUiOptions3$widget === void 0 ?
|
|
565
|
+
widget = _getUiOptions3$widget === void 0 ? 'select' : _getUiOptions3$widget,
|
|
562
566
|
options = _objectWithoutPropertiesLoose(_getUiOptions3, _excluded2);
|
|
563
567
|
var Widget = getWidget(schema, widget, widgets);
|
|
564
|
-
return
|
|
568
|
+
return jsx(Widget, {
|
|
565
569
|
id: idSchema.$id,
|
|
570
|
+
name: name,
|
|
566
571
|
multiple: true,
|
|
567
572
|
onChange: this.onSelectChange,
|
|
568
573
|
onBlur: onBlur,
|
|
@@ -611,12 +616,13 @@ var ArrayField = /*#__PURE__*/function (_Component) {
|
|
|
611
616
|
formContext = registry.formContext;
|
|
612
617
|
var _getUiOptions4 = getUiOptions(uiSchema),
|
|
613
618
|
_getUiOptions4$widget = _getUiOptions4.widget,
|
|
614
|
-
widget = _getUiOptions4$widget === void 0 ?
|
|
619
|
+
widget = _getUiOptions4$widget === void 0 ? 'files' : _getUiOptions4$widget,
|
|
615
620
|
options = _objectWithoutPropertiesLoose(_getUiOptions4, _excluded3);
|
|
616
621
|
var Widget = getWidget(schema, widget, widgets);
|
|
617
|
-
return
|
|
622
|
+
return jsx(Widget, {
|
|
618
623
|
options: options,
|
|
619
624
|
id: idSchema.$id,
|
|
625
|
+
name: name,
|
|
620
626
|
multiple: true,
|
|
621
627
|
onChange: this.onSelectChange,
|
|
622
628
|
onBlur: onBlur,
|
|
@@ -632,7 +638,7 @@ var ArrayField = /*#__PURE__*/function (_Component) {
|
|
|
632
638
|
formContext: formContext,
|
|
633
639
|
autofocus: autofocus,
|
|
634
640
|
rawErrors: rawErrors,
|
|
635
|
-
label:
|
|
641
|
+
label: ''
|
|
636
642
|
});
|
|
637
643
|
}
|
|
638
644
|
/** Renders an array that has a maximum limit of items
|
|
@@ -648,7 +654,7 @@ var ArrayField = /*#__PURE__*/function (_Component) {
|
|
|
648
654
|
errorSchema = _this$props12.errorSchema,
|
|
649
655
|
idPrefix = _this$props12.idPrefix,
|
|
650
656
|
_this$props12$idSepar = _this$props12.idSeparator,
|
|
651
|
-
idSeparator = _this$props12$idSepar === void 0 ?
|
|
657
|
+
idSeparator = _this$props12$idSepar === void 0 ? '_' : _this$props12$idSepar,
|
|
652
658
|
idSchema = _this$props12.idSchema,
|
|
653
659
|
name = _this$props12.name,
|
|
654
660
|
_this$props12$disable = _this$props12.disabled,
|
|
@@ -684,7 +690,7 @@ var ArrayField = /*#__PURE__*/function (_Component) {
|
|
|
684
690
|
var canAdd = this.canAddItem(items) && !!additionalSchema;
|
|
685
691
|
var arrayProps = {
|
|
686
692
|
canAdd: canAdd,
|
|
687
|
-
className:
|
|
693
|
+
className: 'field field-array field-array-fixed-items',
|
|
688
694
|
disabled: disabled,
|
|
689
695
|
idSchema: idSchema,
|
|
690
696
|
formData: formData,
|
|
@@ -729,8 +735,8 @@ var ArrayField = /*#__PURE__*/function (_Component) {
|
|
|
729
735
|
formContext: formContext,
|
|
730
736
|
rawErrors: rawErrors
|
|
731
737
|
};
|
|
732
|
-
var Template = getTemplate(
|
|
733
|
-
return
|
|
738
|
+
var Template = getTemplate('ArrayFieldTemplate', registry, uiOptions);
|
|
739
|
+
return jsx(Template, _extends({}, arrayProps));
|
|
734
740
|
}
|
|
735
741
|
/** Renders the individual array item using a `SchemaField` along with the additional properties required to be send
|
|
736
742
|
* back to the `ArrayFieldItemTemplate`.
|
|
@@ -786,7 +792,7 @@ var ArrayField = /*#__PURE__*/function (_Component) {
|
|
|
786
792
|
return has[key];
|
|
787
793
|
});
|
|
788
794
|
return {
|
|
789
|
-
children:
|
|
795
|
+
children: jsx(ItemSchemaField, {
|
|
790
796
|
name: name,
|
|
791
797
|
index: index,
|
|
792
798
|
schema: itemSchema,
|
|
@@ -808,7 +814,7 @@ var ArrayField = /*#__PURE__*/function (_Component) {
|
|
|
808
814
|
autofocus: autofocus,
|
|
809
815
|
rawErrors: rawErrors
|
|
810
816
|
}),
|
|
811
|
-
className:
|
|
817
|
+
className: 'array-item',
|
|
812
818
|
disabled: disabled,
|
|
813
819
|
canAdd: canAdd,
|
|
814
820
|
hasToolbar: has.toolbar,
|
|
@@ -830,8 +836,11 @@ var ArrayField = /*#__PURE__*/function (_Component) {
|
|
|
830
836
|
_createClass(ArrayField, [{
|
|
831
837
|
key: "itemTitle",
|
|
832
838
|
get: function get$1() {
|
|
833
|
-
var
|
|
834
|
-
|
|
839
|
+
var _this$props14 = this.props,
|
|
840
|
+
schema = _this$props14.schema,
|
|
841
|
+
registry = _this$props14.registry;
|
|
842
|
+
var translateString = registry.translateString;
|
|
843
|
+
return get(schema, [ITEMS_KEY, 'title'], get(schema, [ITEMS_KEY, 'description'], translateString(TranslatableString.ArrayItemTitle)));
|
|
835
844
|
}
|
|
836
845
|
}]);
|
|
837
846
|
return ArrayField;
|
|
@@ -860,19 +869,22 @@ function BooleanField(props) {
|
|
|
860
869
|
rawErrors = props.rawErrors;
|
|
861
870
|
var title = schema.title;
|
|
862
871
|
var widgets = registry.widgets,
|
|
863
|
-
formContext = registry.formContext
|
|
872
|
+
formContext = registry.formContext,
|
|
873
|
+
translateString = registry.translateString;
|
|
864
874
|
var _getUiOptions = getUiOptions(uiSchema),
|
|
865
875
|
_getUiOptions$widget = _getUiOptions.widget,
|
|
866
|
-
widget = _getUiOptions$widget === void 0 ?
|
|
876
|
+
widget = _getUiOptions$widget === void 0 ? 'checkbox' : _getUiOptions$widget,
|
|
867
877
|
options = _objectWithoutPropertiesLoose(_getUiOptions, _excluded$8);
|
|
868
878
|
var Widget = getWidget(schema, widget, widgets);
|
|
879
|
+
var yes = translateString(TranslatableString.YesLabel);
|
|
880
|
+
var no = translateString(TranslatableString.NoLabel);
|
|
869
881
|
var enumOptions;
|
|
870
882
|
if (Array.isArray(schema.oneOf)) {
|
|
871
883
|
enumOptions = optionsList({
|
|
872
884
|
oneOf: schema.oneOf.map(function (option) {
|
|
873
885
|
if (isObject(option)) {
|
|
874
886
|
return _extends({}, option, {
|
|
875
|
-
title: option.title || (option["const"] === true ?
|
|
887
|
+
title: option.title || (option["const"] === true ? yes : no)
|
|
876
888
|
});
|
|
877
889
|
}
|
|
878
890
|
return undefined;
|
|
@@ -886,14 +898,14 @@ function BooleanField(props) {
|
|
|
886
898
|
var schemaWithEnumNames = schema;
|
|
887
899
|
var enums = (_schema$enum = schema["enum"]) != null ? _schema$enum : [true, false];
|
|
888
900
|
if (!schemaWithEnumNames.enumNames && enums.length === 2 && enums.every(function (v) {
|
|
889
|
-
return typeof v ===
|
|
901
|
+
return typeof v === 'boolean';
|
|
890
902
|
})) {
|
|
891
903
|
enumOptions = [{
|
|
892
904
|
value: enums[0],
|
|
893
|
-
label: enums[0] ?
|
|
905
|
+
label: enums[0] ? yes : no
|
|
894
906
|
}, {
|
|
895
907
|
value: enums[1],
|
|
896
|
-
label: enums[1] ?
|
|
908
|
+
label: enums[1] ? yes : no
|
|
897
909
|
}];
|
|
898
910
|
} else {
|
|
899
911
|
enumOptions = optionsList({
|
|
@@ -903,13 +915,14 @@ function BooleanField(props) {
|
|
|
903
915
|
});
|
|
904
916
|
}
|
|
905
917
|
}
|
|
906
|
-
return
|
|
918
|
+
return jsx(Widget, {
|
|
907
919
|
options: _extends({}, options, {
|
|
908
920
|
enumOptions: enumOptions
|
|
909
921
|
}),
|
|
910
922
|
schema: schema,
|
|
911
923
|
uiSchema: uiSchema,
|
|
912
924
|
id: idSchema.$id,
|
|
925
|
+
name: name,
|
|
913
926
|
onChange: onChange,
|
|
914
927
|
onFocus: onFocus,
|
|
915
928
|
onBlur: onBlur,
|
|
@@ -926,9 +939,6 @@ function BooleanField(props) {
|
|
|
926
939
|
}
|
|
927
940
|
|
|
928
941
|
var _excluded$7 = ["widget", "placeholder", "autofocus", "autocomplete", "title"];
|
|
929
|
-
/** The prefix used when a oneOf option does not have a title
|
|
930
|
-
*/
|
|
931
|
-
var UNKNOWN_OPTION_PREFIX = "Option";
|
|
932
942
|
/** The `AnyOfField` component is used to render a field in the schema that is an `anyOf`, `allOf` or `oneOf`. It tracks
|
|
933
943
|
* the currently selected option and cleans up any irrelevant data in `formData`.
|
|
934
944
|
*
|
|
@@ -962,7 +972,7 @@ var AnyOfField = /*#__PURE__*/function (_Component) {
|
|
|
962
972
|
if (newFormData && newOption) {
|
|
963
973
|
// Call getDefaultFormState to make sure defaults are populated on change. Pass "excludeObjectChildren"
|
|
964
974
|
// so that only the root objects themselves are created without adding undefined children properties
|
|
965
|
-
newFormData = schemaUtils.getDefaultFormState(newOption, newFormData,
|
|
975
|
+
newFormData = schemaUtils.getDefaultFormState(newOption, newFormData, 'excludeObjectChildren');
|
|
966
976
|
}
|
|
967
977
|
onChange(newFormData, undefined, _this.getFieldId());
|
|
968
978
|
_this.setState({
|
|
@@ -1049,12 +1059,13 @@ var AnyOfField = /*#__PURE__*/function (_Component) {
|
|
|
1049
1059
|
var _this$props4 = this.props,
|
|
1050
1060
|
idSchema = _this$props4.idSchema,
|
|
1051
1061
|
schema = _this$props4.schema;
|
|
1052
|
-
return "" + idSchema.$id + (schema.oneOf ?
|
|
1062
|
+
return "" + idSchema.$id + (schema.oneOf ? '__oneof_select' : '__anyof_select');
|
|
1053
1063
|
}
|
|
1054
1064
|
/** Renders the `AnyOfField` selector along with a `SchemaField` for the value of the `formData`
|
|
1055
1065
|
*/;
|
|
1056
1066
|
_proto.render = function render() {
|
|
1057
1067
|
var _this$props5 = this.props,
|
|
1068
|
+
name = _this$props5.name,
|
|
1058
1069
|
baseType = _this$props5.baseType,
|
|
1059
1070
|
_this$props5$disabled = _this$props5.disabled,
|
|
1060
1071
|
disabled = _this$props5$disabled === void 0 ? false : _this$props5$disabled,
|
|
@@ -1067,14 +1078,15 @@ var AnyOfField = /*#__PURE__*/function (_Component) {
|
|
|
1067
1078
|
schema = _this$props5.schema,
|
|
1068
1079
|
uiSchema = _this$props5.uiSchema;
|
|
1069
1080
|
var widgets = registry.widgets,
|
|
1070
|
-
fields = registry.fields
|
|
1081
|
+
fields = registry.fields,
|
|
1082
|
+
translateString = registry.translateString;
|
|
1071
1083
|
var _SchemaField = fields.SchemaField;
|
|
1072
1084
|
var _this$state2 = this.state,
|
|
1073
1085
|
selectedOption = _this$state2.selectedOption,
|
|
1074
1086
|
retrievedOptions = _this$state2.retrievedOptions;
|
|
1075
1087
|
var _getUiOptions = getUiOptions(uiSchema),
|
|
1076
1088
|
_getUiOptions$widget = _getUiOptions.widget,
|
|
1077
|
-
widget = _getUiOptions$widget === void 0 ?
|
|
1089
|
+
widget = _getUiOptions$widget === void 0 ? 'select' : _getUiOptions$widget,
|
|
1078
1090
|
placeholder = _getUiOptions.placeholder,
|
|
1079
1091
|
autofocus = _getUiOptions.autofocus,
|
|
1080
1092
|
autocomplete = _getUiOptions.autocomplete,
|
|
@@ -1082,7 +1094,7 @@ var AnyOfField = /*#__PURE__*/function (_Component) {
|
|
|
1082
1094
|
title = _getUiOptions$title === void 0 ? schema.title : _getUiOptions$title,
|
|
1083
1095
|
uiOptions = _objectWithoutPropertiesLoose(_getUiOptions, _excluded$7);
|
|
1084
1096
|
var Widget = getWidget({
|
|
1085
|
-
type:
|
|
1097
|
+
type: 'number'
|
|
1086
1098
|
}, widget, widgets);
|
|
1087
1099
|
var rawErrors = get(errorSchema, ERRORS_KEY, []);
|
|
1088
1100
|
var fieldErrorSchema = omit(errorSchema, [ERRORS_KEY]);
|
|
@@ -1095,43 +1107,47 @@ var AnyOfField = /*#__PURE__*/function (_Component) {
|
|
|
1095
1107
|
type: baseType
|
|
1096
1108
|
});
|
|
1097
1109
|
}
|
|
1098
|
-
var
|
|
1110
|
+
var translateEnum = title ? TranslatableString.TitleOptionPrefix : TranslatableString.OptionPrefix;
|
|
1111
|
+
var translateParams = title ? [title] : [];
|
|
1099
1112
|
var enumOptions = retrievedOptions.map(function (opt, index) {
|
|
1100
1113
|
return {
|
|
1101
|
-
label: opt.title ||
|
|
1114
|
+
label: opt.title || translateString(translateEnum, translateParams.concat(String(index + 1))),
|
|
1102
1115
|
value: index
|
|
1103
1116
|
};
|
|
1104
1117
|
});
|
|
1105
|
-
return
|
|
1106
|
-
className:
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1118
|
+
return jsxs("div", {
|
|
1119
|
+
className: 'panel panel-default panel-body',
|
|
1120
|
+
children: [jsx("div", {
|
|
1121
|
+
className: 'form-group',
|
|
1122
|
+
children: jsx(Widget, {
|
|
1123
|
+
id: this.getFieldId(),
|
|
1124
|
+
name: "" + name + (schema.oneOf ? '__oneof_select' : '__anyof_select'),
|
|
1125
|
+
schema: {
|
|
1126
|
+
type: 'number',
|
|
1127
|
+
"default": 0
|
|
1128
|
+
},
|
|
1129
|
+
onChange: this.onOptionChange,
|
|
1130
|
+
onBlur: onBlur,
|
|
1131
|
+
onFocus: onFocus,
|
|
1132
|
+
disabled: disabled || isEmpty(enumOptions),
|
|
1133
|
+
multiple: false,
|
|
1134
|
+
rawErrors: rawErrors,
|
|
1135
|
+
errorSchema: fieldErrorSchema,
|
|
1136
|
+
value: selectedOption >= 0 ? selectedOption : undefined,
|
|
1137
|
+
options: _extends({
|
|
1138
|
+
enumOptions: enumOptions
|
|
1139
|
+
}, uiOptions),
|
|
1140
|
+
registry: registry,
|
|
1141
|
+
formContext: formContext,
|
|
1142
|
+
placeholder: placeholder,
|
|
1143
|
+
autocomplete: autocomplete,
|
|
1144
|
+
autofocus: autofocus,
|
|
1145
|
+
label: ''
|
|
1146
|
+
})
|
|
1147
|
+
}), option !== null && jsx(_SchemaField, _extends({}, this.props, {
|
|
1148
|
+
schema: optionSchema
|
|
1149
|
+
}))]
|
|
1150
|
+
});
|
|
1135
1151
|
};
|
|
1136
1152
|
return AnyOfField;
|
|
1137
1153
|
}(Component);
|
|
@@ -1182,27 +1198,27 @@ function NumberField(props) {
|
|
|
1182
1198
|
setLastValue(value);
|
|
1183
1199
|
// Normalize decimals that don't start with a zero character in advance so
|
|
1184
1200
|
// that the rest of the normalization logic is simpler
|
|
1185
|
-
if (("" + value).charAt(0) ===
|
|
1201
|
+
if (("" + value).charAt(0) === '.') {
|
|
1186
1202
|
value = "0" + value;
|
|
1187
1203
|
}
|
|
1188
1204
|
// Check that the value is a string (this can happen if the widget used is a
|
|
1189
1205
|
// <select>, due to an enum declaration etc) then, if the value ends in a
|
|
1190
1206
|
// trailing decimal point or multiple zeroes, strip the trailing values
|
|
1191
|
-
var processed = typeof value ===
|
|
1207
|
+
var processed = typeof value === 'string' && value.match(trailingCharMatcherWithPrefix) ? asNumber(value.replace(trailingCharMatcher, '')) : asNumber(value);
|
|
1192
1208
|
onChange(processed);
|
|
1193
1209
|
}, [onChange]);
|
|
1194
|
-
if (typeof lastValue ===
|
|
1210
|
+
if (typeof lastValue === 'string' && typeof value === 'number') {
|
|
1195
1211
|
// Construct a regular expression that checks for a string that consists
|
|
1196
1212
|
// of the formData value suffixed with zero or one '.' characters and zero
|
|
1197
1213
|
// or more '0' characters
|
|
1198
|
-
var re = new RegExp(("" + value).replace(
|
|
1214
|
+
var re = new RegExp(("" + value).replace('.', '\\.') + '\\.?0*$');
|
|
1199
1215
|
// If the cached "lastValue" is a match, use that instead of the formData
|
|
1200
1216
|
// value to prevent the input value from changing in the UI
|
|
1201
1217
|
if (lastValue.match(re)) {
|
|
1202
1218
|
value = lastValue;
|
|
1203
1219
|
}
|
|
1204
1220
|
}
|
|
1205
|
-
return
|
|
1221
|
+
return jsx(StringField, _extends({}, props, {
|
|
1206
1222
|
formData: value,
|
|
1207
1223
|
onChange: handleChange
|
|
1208
1224
|
}));
|
|
@@ -1243,7 +1259,7 @@ var ObjectField = /*#__PURE__*/function (_Component) {
|
|
|
1243
1259
|
// fields which are "mandated" by the schema, these fields can
|
|
1244
1260
|
// be set to undefined by clicking a "delete field" button, so
|
|
1245
1261
|
// set empty values to the empty string.
|
|
1246
|
-
value =
|
|
1262
|
+
value = '';
|
|
1247
1263
|
}
|
|
1248
1264
|
var newFormData = _extends({}, formData, (_extends2 = {}, _extends2[name] = value, _extends2));
|
|
1249
1265
|
onChange(newFormData, errorSchema && errorSchema && _extends({}, errorSchema, (_extends3 = {}, _extends3[name] = newErrorSchema, _extends3)), id);
|
|
@@ -1264,7 +1280,7 @@ var ObjectField = /*#__PURE__*/function (_Component) {
|
|
|
1264
1280
|
var uiSchema = _this.props.uiSchema;
|
|
1265
1281
|
var _getUiOptions = getUiOptions(uiSchema),
|
|
1266
1282
|
_getUiOptions$duplica = _getUiOptions.duplicateKeySuffixSeparator,
|
|
1267
|
-
duplicateKeySuffixSeparator = _getUiOptions$duplica === void 0 ?
|
|
1283
|
+
duplicateKeySuffixSeparator = _getUiOptions$duplica === void 0 ? '-' : _getUiOptions$duplica;
|
|
1268
1284
|
var index = 0;
|
|
1269
1285
|
var newKey = preferredKey;
|
|
1270
1286
|
while (has(formData, newKey)) {
|
|
@@ -1319,10 +1335,10 @@ var ObjectField = /*#__PURE__*/function (_Component) {
|
|
|
1319
1335
|
type = apSchema.type;
|
|
1320
1336
|
}
|
|
1321
1337
|
if (!type && (ANY_OF_KEY in apSchema || ONE_OF_KEY in apSchema)) {
|
|
1322
|
-
type =
|
|
1338
|
+
type = 'object';
|
|
1323
1339
|
}
|
|
1324
1340
|
}
|
|
1325
|
-
var newKey = _this.getAvailableKey(
|
|
1341
|
+
var newKey = _this.getAvailableKey('newKey', newFormData);
|
|
1326
1342
|
// Cast this to make the `set` work properly
|
|
1327
1343
|
set(newFormData, newKey, _this.getDefaultValue(type));
|
|
1328
1344
|
onChange(newFormData);
|
|
@@ -1353,22 +1369,22 @@ var ObjectField = /*#__PURE__*/function (_Component) {
|
|
|
1353
1369
|
* @param type - The type of the new additional schema property
|
|
1354
1370
|
*/
|
|
1355
1371
|
_proto.getDefaultValue = function getDefaultValue(type) {
|
|
1372
|
+
var translateString = this.props.registry.translateString;
|
|
1356
1373
|
switch (type) {
|
|
1357
|
-
case
|
|
1358
|
-
return "New Value";
|
|
1359
|
-
case "array":
|
|
1374
|
+
case 'array':
|
|
1360
1375
|
return [];
|
|
1361
|
-
case
|
|
1376
|
+
case 'boolean':
|
|
1362
1377
|
return false;
|
|
1363
|
-
case
|
|
1378
|
+
case 'null':
|
|
1364
1379
|
return null;
|
|
1365
|
-
case
|
|
1380
|
+
case 'number':
|
|
1366
1381
|
return 0;
|
|
1367
|
-
case
|
|
1382
|
+
case 'object':
|
|
1368
1383
|
return {};
|
|
1384
|
+
case 'string':
|
|
1369
1385
|
default:
|
|
1370
1386
|
// We don't have a datatype for some reason (perhaps additionalProperties was true)
|
|
1371
|
-
return
|
|
1387
|
+
return translateString(TranslatableString.NewStringDefault);
|
|
1372
1388
|
}
|
|
1373
1389
|
}
|
|
1374
1390
|
/** Handles the adding of a new additional property on the given `schema`. Calls the `onChange` callback once the new
|
|
@@ -1415,25 +1431,31 @@ var ObjectField = /*#__PURE__*/function (_Component) {
|
|
|
1415
1431
|
var properties = Object.keys(schemaProperties);
|
|
1416
1432
|
orderedProperties = orderProperties(properties, uiOptions.order);
|
|
1417
1433
|
} catch (err) {
|
|
1418
|
-
return
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1434
|
+
return jsxs("div", {
|
|
1435
|
+
children: [jsxs("p", {
|
|
1436
|
+
className: 'config-error',
|
|
1437
|
+
style: {
|
|
1438
|
+
color: 'red'
|
|
1439
|
+
},
|
|
1440
|
+
children: ["Invalid ", name || 'root', " object field configuration:", jsx("em", {
|
|
1441
|
+
children: err.message
|
|
1442
|
+
}), "."]
|
|
1443
|
+
}), jsx("pre", {
|
|
1444
|
+
children: JSON.stringify(schema)
|
|
1445
|
+
})]
|
|
1446
|
+
});
|
|
1424
1447
|
}
|
|
1425
|
-
var Template = getTemplate(
|
|
1448
|
+
var Template = getTemplate('ObjectFieldTemplate', registry, uiOptions);
|
|
1426
1449
|
var templateProps = {
|
|
1427
1450
|
title: uiOptions.title || title,
|
|
1428
1451
|
description: description,
|
|
1429
1452
|
properties: orderedProperties.map(function (name) {
|
|
1430
1453
|
var addedByAdditionalProperties = has(schema, [PROPERTIES_KEY, name, ADDITIONAL_PROPERTY_FLAG]);
|
|
1431
1454
|
var fieldUiSchema = addedByAdditionalProperties ? uiSchema.additionalProperties : uiSchema[name];
|
|
1432
|
-
var hidden = getUiOptions(fieldUiSchema).widget ===
|
|
1455
|
+
var hidden = getUiOptions(fieldUiSchema).widget === 'hidden';
|
|
1433
1456
|
var fieldIdSchema = get(idSchema, [name], {});
|
|
1434
1457
|
return {
|
|
1435
|
-
content:
|
|
1436
|
-
key: name,
|
|
1458
|
+
content: jsx(SchemaField, {
|
|
1437
1459
|
name: name,
|
|
1438
1460
|
required: _this2.isRequired(name),
|
|
1439
1461
|
schema: get(schema, [PROPERTIES_KEY, name], {}),
|
|
@@ -1454,7 +1476,7 @@ var ObjectField = /*#__PURE__*/function (_Component) {
|
|
|
1454
1476
|
readonly: readonly,
|
|
1455
1477
|
hideError: hideError,
|
|
1456
1478
|
onDropPropertyClick: _this2.onDropPropertyClick
|
|
1457
|
-
}),
|
|
1479
|
+
}, name),
|
|
1458
1480
|
name: name,
|
|
1459
1481
|
readonly: readonly,
|
|
1460
1482
|
disabled: disabled,
|
|
@@ -1472,7 +1494,7 @@ var ObjectField = /*#__PURE__*/function (_Component) {
|
|
|
1472
1494
|
formContext: formContext,
|
|
1473
1495
|
registry: registry
|
|
1474
1496
|
};
|
|
1475
|
-
return
|
|
1497
|
+
return jsx(Template, _extends({}, templateProps, {
|
|
1476
1498
|
onAddClick: this.handleAddClick
|
|
1477
1499
|
}));
|
|
1478
1500
|
};
|
|
@@ -1482,13 +1504,13 @@ var ObjectField = /*#__PURE__*/function (_Component) {
|
|
|
1482
1504
|
var _excluded$6 = ["__errors"];
|
|
1483
1505
|
/** The map of component type to FieldName */
|
|
1484
1506
|
var COMPONENT_TYPES = {
|
|
1485
|
-
array:
|
|
1486
|
-
"boolean":
|
|
1487
|
-
integer:
|
|
1488
|
-
number:
|
|
1489
|
-
object:
|
|
1490
|
-
string:
|
|
1491
|
-
"null":
|
|
1507
|
+
array: 'ArrayField',
|
|
1508
|
+
"boolean": 'BooleanField',
|
|
1509
|
+
integer: 'NumberField',
|
|
1510
|
+
number: 'NumberField',
|
|
1511
|
+
object: 'ObjectField',
|
|
1512
|
+
string: 'StringField',
|
|
1513
|
+
"null": 'NullField'
|
|
1492
1514
|
};
|
|
1493
1515
|
/** Computes and returns which `Field` implementation to return in order to render the field represented by the
|
|
1494
1516
|
* `schema`. The `uiOptions` are used to alter what potential `Field` implementation is actually returned. If no
|
|
@@ -1502,15 +1524,16 @@ var COMPONENT_TYPES = {
|
|
|
1502
1524
|
*/
|
|
1503
1525
|
function getFieldComponent(schema, uiOptions, idSchema, registry) {
|
|
1504
1526
|
var field = uiOptions.field;
|
|
1505
|
-
var fields = registry.fields
|
|
1506
|
-
|
|
1527
|
+
var fields = registry.fields,
|
|
1528
|
+
translateString = registry.translateString;
|
|
1529
|
+
if (typeof field === 'function') {
|
|
1507
1530
|
return field;
|
|
1508
1531
|
}
|
|
1509
|
-
if (typeof field ===
|
|
1532
|
+
if (typeof field === 'string' && field in fields) {
|
|
1510
1533
|
return fields[field];
|
|
1511
1534
|
}
|
|
1512
1535
|
var schemaType = getSchemaType(schema);
|
|
1513
|
-
var type = Array.isArray(schemaType) ? schemaType[0] : schemaType ||
|
|
1536
|
+
var type = Array.isArray(schemaType) ? schemaType[0] : schemaType || '';
|
|
1514
1537
|
var componentName = COMPONENT_TYPES[type];
|
|
1515
1538
|
// If the type is not defined and the schema uses 'anyOf' or 'oneOf', don't
|
|
1516
1539
|
// render a field and let the MultiSchemaField component handle the form display
|
|
@@ -1520,11 +1543,11 @@ function getFieldComponent(schema, uiOptions, idSchema, registry) {
|
|
|
1520
1543
|
};
|
|
1521
1544
|
}
|
|
1522
1545
|
return componentName in fields ? fields[componentName] : function () {
|
|
1523
|
-
var UnsupportedFieldTemplate = getTemplate(
|
|
1524
|
-
return
|
|
1546
|
+
var UnsupportedFieldTemplate = getTemplate('UnsupportedFieldTemplate', registry, uiOptions);
|
|
1547
|
+
return jsx(UnsupportedFieldTemplate, {
|
|
1525
1548
|
schema: schema,
|
|
1526
1549
|
idSchema: idSchema,
|
|
1527
|
-
reason:
|
|
1550
|
+
reason: translateString(TranslatableString.UnknownFieldType, [String(schema.type)]),
|
|
1528
1551
|
registry: registry
|
|
1529
1552
|
});
|
|
1530
1553
|
};
|
|
@@ -1554,17 +1577,17 @@ function SchemaFieldRender(props) {
|
|
|
1554
1577
|
var formContext = registry.formContext,
|
|
1555
1578
|
schemaUtils = registry.schemaUtils;
|
|
1556
1579
|
var uiOptions = getUiOptions(uiSchema);
|
|
1557
|
-
var FieldTemplate = getTemplate(
|
|
1558
|
-
var DescriptionFieldTemplate = getTemplate(
|
|
1559
|
-
var FieldHelpTemplate = getTemplate(
|
|
1560
|
-
var FieldErrorTemplate = getTemplate(
|
|
1580
|
+
var FieldTemplate = getTemplate('FieldTemplate', registry, uiOptions);
|
|
1581
|
+
var DescriptionFieldTemplate = getTemplate('DescriptionFieldTemplate', registry, uiOptions);
|
|
1582
|
+
var FieldHelpTemplate = getTemplate('FieldHelpTemplate', registry, uiOptions);
|
|
1583
|
+
var FieldErrorTemplate = getTemplate('FieldErrorTemplate', registry, uiOptions);
|
|
1561
1584
|
var schema = schemaUtils.retrieveSchema(_schema, formData);
|
|
1562
1585
|
var fieldId = _idSchema[ID_KEY];
|
|
1563
1586
|
var idSchema = mergeObjects(schemaUtils.toIdSchema(schema, fieldId, formData, idPrefix, idSeparator), _idSchema);
|
|
1564
1587
|
/** Intermediary `onChange` handler for field components that will inject the `id` of the current field into the
|
|
1565
1588
|
* `onChange` chain if it is not already being provided from a deeper level in the hierarchy
|
|
1566
1589
|
*/
|
|
1567
|
-
var handleFieldComponentChange =
|
|
1590
|
+
var handleFieldComponentChange = useCallback(function (formData, newErrorSchema, id) {
|
|
1568
1591
|
var theId = id || fieldId;
|
|
1569
1592
|
return onChange(formData, newErrorSchema, theId);
|
|
1570
1593
|
}, [fieldId, onChange]);
|
|
@@ -1583,11 +1606,11 @@ function SchemaFieldRender(props) {
|
|
|
1583
1606
|
__errors = _ref.__errors,
|
|
1584
1607
|
fieldErrorSchema = _objectWithoutPropertiesLoose(_ref, _excluded$6);
|
|
1585
1608
|
// See #439: uiSchema: Don't pass consumed class names or style to child components
|
|
1586
|
-
var fieldUiSchema = omit(uiSchema, [
|
|
1609
|
+
var fieldUiSchema = omit(uiSchema, ['ui:classNames', 'classNames', 'ui:style']);
|
|
1587
1610
|
if (UI_OPTIONS_KEY in fieldUiSchema) {
|
|
1588
|
-
fieldUiSchema[UI_OPTIONS_KEY] = omit(fieldUiSchema[UI_OPTIONS_KEY], [
|
|
1611
|
+
fieldUiSchema[UI_OPTIONS_KEY] = omit(fieldUiSchema[UI_OPTIONS_KEY], ['classNames', 'style']);
|
|
1589
1612
|
}
|
|
1590
|
-
var field =
|
|
1613
|
+
var field = jsx(FieldComponent, _extends({}, props, {
|
|
1591
1614
|
onChange: handleFieldComponentChange,
|
|
1592
1615
|
idSchema: idSchema,
|
|
1593
1616
|
schema: schema,
|
|
@@ -1608,15 +1631,15 @@ function SchemaFieldRender(props) {
|
|
|
1608
1631
|
} else {
|
|
1609
1632
|
label = ADDITIONAL_PROPERTY_FLAG in schema ? name : uiOptions.title || props.schema.title || schema.title || name;
|
|
1610
1633
|
}
|
|
1611
|
-
var description = uiOptions.description || props.schema.description || schema.description ||
|
|
1634
|
+
var description = uiOptions.description || props.schema.description || schema.description || '';
|
|
1612
1635
|
var help = uiOptions.help;
|
|
1613
|
-
var hidden = uiOptions.widget ===
|
|
1614
|
-
var classNames = [
|
|
1636
|
+
var hidden = uiOptions.widget === 'hidden';
|
|
1637
|
+
var classNames = ['form-group', 'field', "field-" + schema.type];
|
|
1615
1638
|
if (!hideError && __errors && __errors.length > 0) {
|
|
1616
|
-
classNames.push(
|
|
1639
|
+
classNames.push('field-error has-error has-danger');
|
|
1617
1640
|
}
|
|
1618
1641
|
if (uiSchema !== null && uiSchema !== void 0 && uiSchema.classNames) {
|
|
1619
|
-
if (process.env.NODE_ENV !==
|
|
1642
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1620
1643
|
console.warn("'uiSchema.classNames' is deprecated and may be removed in a major release; Use 'ui:classNames' instead.");
|
|
1621
1644
|
}
|
|
1622
1645
|
classNames.push(uiSchema.classNames);
|
|
@@ -1624,7 +1647,7 @@ function SchemaFieldRender(props) {
|
|
|
1624
1647
|
if (uiOptions.classNames) {
|
|
1625
1648
|
classNames.push(uiOptions.classNames);
|
|
1626
1649
|
}
|
|
1627
|
-
var helpComponent =
|
|
1650
|
+
var helpComponent = jsx(FieldHelpTemplate, {
|
|
1628
1651
|
help: help,
|
|
1629
1652
|
idSchema: idSchema,
|
|
1630
1653
|
schema: schema,
|
|
@@ -1632,7 +1655,7 @@ function SchemaFieldRender(props) {
|
|
|
1632
1655
|
hasErrors: !hideError && __errors && __errors.length > 0,
|
|
1633
1656
|
registry: registry
|
|
1634
1657
|
});
|
|
1635
|
-
var errorsComponent = hideError ? undefined :
|
|
1658
|
+
var errorsComponent = hideError ? undefined : jsx(FieldErrorTemplate, {
|
|
1636
1659
|
errors: __errors,
|
|
1637
1660
|
errorSchema: errorSchema,
|
|
1638
1661
|
idSchema: idSchema,
|
|
@@ -1641,7 +1664,7 @@ function SchemaFieldRender(props) {
|
|
|
1641
1664
|
registry: registry
|
|
1642
1665
|
});
|
|
1643
1666
|
var fieldProps = {
|
|
1644
|
-
description:
|
|
1667
|
+
description: jsx(DescriptionFieldTemplate, {
|
|
1645
1668
|
id: descriptionId(id),
|
|
1646
1669
|
description: description,
|
|
1647
1670
|
schema: schema,
|
|
@@ -1650,7 +1673,7 @@ function SchemaFieldRender(props) {
|
|
|
1650
1673
|
}),
|
|
1651
1674
|
rawDescription: description,
|
|
1652
1675
|
help: helpComponent,
|
|
1653
|
-
rawHelp: typeof help ===
|
|
1676
|
+
rawHelp: typeof help === 'string' ? help : undefined,
|
|
1654
1677
|
errors: errorsComponent,
|
|
1655
1678
|
rawErrors: hideError ? undefined : __errors,
|
|
1656
1679
|
id: id,
|
|
@@ -1664,7 +1687,7 @@ function SchemaFieldRender(props) {
|
|
|
1664
1687
|
readonly: readonly,
|
|
1665
1688
|
hideError: hideError,
|
|
1666
1689
|
displayLabel: displayLabel,
|
|
1667
|
-
classNames: classNames.join(
|
|
1690
|
+
classNames: classNames.join(' ').trim(),
|
|
1668
1691
|
style: uiOptions.style,
|
|
1669
1692
|
formContext: formContext,
|
|
1670
1693
|
formData: formData,
|
|
@@ -1674,68 +1697,72 @@ function SchemaFieldRender(props) {
|
|
|
1674
1697
|
};
|
|
1675
1698
|
var _AnyOfField = registry.fields.AnyOfField;
|
|
1676
1699
|
var _OneOfField = registry.fields.OneOfField;
|
|
1677
|
-
var isReplacingAnyOrOneOf = (uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema[
|
|
1678
|
-
return
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
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
|
-
|
|
1700
|
+
var isReplacingAnyOrOneOf = (uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema['ui:field']) && (uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema['ui:fieldReplacesAnyOrOneOf']) === true;
|
|
1701
|
+
return jsx(FieldTemplate, _extends({}, fieldProps, {
|
|
1702
|
+
children: jsxs(Fragment, {
|
|
1703
|
+
children: [field, schema.anyOf && !isReplacingAnyOrOneOf && !schemaUtils.isSelect(schema) && jsx(_AnyOfField, {
|
|
1704
|
+
name: name,
|
|
1705
|
+
disabled: disabled,
|
|
1706
|
+
readonly: readonly,
|
|
1707
|
+
hideError: hideError,
|
|
1708
|
+
errorSchema: errorSchema,
|
|
1709
|
+
formData: formData,
|
|
1710
|
+
formContext: formContext,
|
|
1711
|
+
idPrefix: idPrefix,
|
|
1712
|
+
idSchema: idSchema,
|
|
1713
|
+
idSeparator: idSeparator,
|
|
1714
|
+
onBlur: props.onBlur,
|
|
1715
|
+
onChange: props.onChange,
|
|
1716
|
+
onFocus: props.onFocus,
|
|
1717
|
+
options: schema.anyOf.map(function (_schema) {
|
|
1718
|
+
return schemaUtils.retrieveSchema(isObject(_schema) ? _schema : {}, formData);
|
|
1719
|
+
}),
|
|
1720
|
+
baseType: schema.type,
|
|
1721
|
+
registry: registry,
|
|
1722
|
+
schema: schema,
|
|
1723
|
+
uiSchema: uiSchema
|
|
1724
|
+
}), schema.oneOf && !isReplacingAnyOrOneOf && !schemaUtils.isSelect(schema) && jsx(_OneOfField, {
|
|
1725
|
+
name: name,
|
|
1726
|
+
disabled: disabled,
|
|
1727
|
+
readonly: readonly,
|
|
1728
|
+
hideError: hideError,
|
|
1729
|
+
errorSchema: errorSchema,
|
|
1730
|
+
formData: formData,
|
|
1731
|
+
formContext: formContext,
|
|
1732
|
+
idPrefix: idPrefix,
|
|
1733
|
+
idSchema: idSchema,
|
|
1734
|
+
idSeparator: idSeparator,
|
|
1735
|
+
onBlur: props.onBlur,
|
|
1736
|
+
onChange: props.onChange,
|
|
1737
|
+
onFocus: props.onFocus,
|
|
1738
|
+
options: schema.oneOf.map(function (_schema) {
|
|
1739
|
+
return schemaUtils.retrieveSchema(isObject(_schema) ? _schema : {}, formData);
|
|
1740
|
+
}),
|
|
1741
|
+
baseType: schema.type,
|
|
1742
|
+
registry: registry,
|
|
1743
|
+
schema: schema,
|
|
1744
|
+
uiSchema: uiSchema
|
|
1745
|
+
})]
|
|
1746
|
+
})
|
|
1747
|
+
}));
|
|
1721
1748
|
}
|
|
1722
1749
|
/** The `SchemaField` component determines whether it is necessary to rerender the component based on any props changes
|
|
1723
1750
|
* and if so, calls the `SchemaFieldRender` component with the props.
|
|
1724
1751
|
*/
|
|
1725
|
-
var SchemaField = /*#__PURE__*/function (
|
|
1726
|
-
_inheritsLoose(SchemaField,
|
|
1752
|
+
var SchemaField = /*#__PURE__*/function (_Component) {
|
|
1753
|
+
_inheritsLoose(SchemaField, _Component);
|
|
1727
1754
|
function SchemaField() {
|
|
1728
|
-
return
|
|
1755
|
+
return _Component.apply(this, arguments) || this;
|
|
1729
1756
|
}
|
|
1730
1757
|
var _proto = SchemaField.prototype;
|
|
1731
1758
|
_proto.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {
|
|
1732
1759
|
return !deepEquals(this.props, nextProps);
|
|
1733
1760
|
};
|
|
1734
1761
|
_proto.render = function render() {
|
|
1735
|
-
return
|
|
1762
|
+
return jsx(SchemaFieldRender, _extends({}, this.props));
|
|
1736
1763
|
};
|
|
1737
1764
|
return SchemaField;
|
|
1738
|
-
}(
|
|
1765
|
+
}(Component);
|
|
1739
1766
|
|
|
1740
1767
|
var _excluded$5 = ["widget", "placeholder"];
|
|
1741
1768
|
/** The `StringField` component is used to render a schema field that represents a string type
|
|
@@ -1766,7 +1793,7 @@ function StringField(props) {
|
|
|
1766
1793
|
formContext = registry.formContext,
|
|
1767
1794
|
schemaUtils = registry.schemaUtils;
|
|
1768
1795
|
var enumOptions = schemaUtils.isSelect(schema) ? optionsList(schema) : undefined;
|
|
1769
|
-
var defaultWidget = enumOptions ?
|
|
1796
|
+
var defaultWidget = enumOptions ? 'select' : 'text';
|
|
1770
1797
|
if (format && hasWidget(schema, format, widgets)) {
|
|
1771
1798
|
defaultWidget = format;
|
|
1772
1799
|
}
|
|
@@ -1774,16 +1801,17 @@ function StringField(props) {
|
|
|
1774
1801
|
_getUiOptions$widget = _getUiOptions.widget,
|
|
1775
1802
|
widget = _getUiOptions$widget === void 0 ? defaultWidget : _getUiOptions$widget,
|
|
1776
1803
|
_getUiOptions$placeho = _getUiOptions.placeholder,
|
|
1777
|
-
placeholder = _getUiOptions$placeho === void 0 ?
|
|
1804
|
+
placeholder = _getUiOptions$placeho === void 0 ? '' : _getUiOptions$placeho,
|
|
1778
1805
|
options = _objectWithoutPropertiesLoose(_getUiOptions, _excluded$5);
|
|
1779
1806
|
var Widget = getWidget(schema, widget, widgets);
|
|
1780
|
-
return
|
|
1807
|
+
return jsx(Widget, {
|
|
1781
1808
|
options: _extends({}, options, {
|
|
1782
1809
|
enumOptions: enumOptions
|
|
1783
1810
|
}),
|
|
1784
1811
|
schema: schema,
|
|
1785
1812
|
uiSchema: uiSchema,
|
|
1786
1813
|
id: idSchema.$id,
|
|
1814
|
+
name: name,
|
|
1787
1815
|
label: title === undefined ? name : title,
|
|
1788
1816
|
value: formData,
|
|
1789
1817
|
onChange: onChange,
|
|
@@ -1848,8 +1876,8 @@ function ArrayFieldDescriptionTemplate(props) {
|
|
|
1848
1876
|
if (!description || !displayLabel) {
|
|
1849
1877
|
return null;
|
|
1850
1878
|
}
|
|
1851
|
-
var DescriptionFieldTemplate = getTemplate(
|
|
1852
|
-
return
|
|
1879
|
+
var DescriptionFieldTemplate = getTemplate('DescriptionFieldTemplate', registry, options);
|
|
1880
|
+
return jsx(DescriptionFieldTemplate, {
|
|
1853
1881
|
id: descriptionId(idSchema),
|
|
1854
1882
|
description: description,
|
|
1855
1883
|
schema: schema,
|
|
@@ -1884,39 +1912,43 @@ function ArrayFieldItemTemplate(props) {
|
|
|
1884
1912
|
flex: 1,
|
|
1885
1913
|
paddingLeft: 6,
|
|
1886
1914
|
paddingRight: 6,
|
|
1887
|
-
fontWeight:
|
|
1915
|
+
fontWeight: 'bold'
|
|
1888
1916
|
};
|
|
1889
|
-
return
|
|
1890
|
-
className: className
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1917
|
+
return jsxs("div", {
|
|
1918
|
+
className: className,
|
|
1919
|
+
children: [jsx("div", {
|
|
1920
|
+
className: hasToolbar ? 'col-xs-9' : 'col-xs-12',
|
|
1921
|
+
children: children
|
|
1922
|
+
}), hasToolbar && jsx("div", {
|
|
1923
|
+
className: 'col-xs-3 array-item-toolbox',
|
|
1924
|
+
children: jsxs("div", {
|
|
1925
|
+
className: 'btn-group',
|
|
1926
|
+
style: {
|
|
1927
|
+
display: 'flex',
|
|
1928
|
+
justifyContent: 'space-around'
|
|
1929
|
+
},
|
|
1930
|
+
children: [(hasMoveUp || hasMoveDown) && jsx(MoveUpButton, {
|
|
1931
|
+
style: btnStyle,
|
|
1932
|
+
disabled: disabled || readonly || !hasMoveUp,
|
|
1933
|
+
onClick: onReorderClick(index, index - 1),
|
|
1934
|
+
uiSchema: uiSchema,
|
|
1935
|
+
registry: registry
|
|
1936
|
+
}), (hasMoveUp || hasMoveDown) && jsx(MoveDownButton, {
|
|
1937
|
+
style: btnStyle,
|
|
1938
|
+
disabled: disabled || readonly || !hasMoveDown,
|
|
1939
|
+
onClick: onReorderClick(index, index + 1),
|
|
1940
|
+
uiSchema: uiSchema,
|
|
1941
|
+
registry: registry
|
|
1942
|
+
}), hasRemove && jsx(RemoveButton, {
|
|
1943
|
+
style: btnStyle,
|
|
1944
|
+
disabled: disabled || readonly,
|
|
1945
|
+
onClick: onDropIndexClick(index),
|
|
1946
|
+
uiSchema: uiSchema,
|
|
1947
|
+
registry: registry
|
|
1948
|
+
})]
|
|
1949
|
+
})
|
|
1950
|
+
})]
|
|
1951
|
+
});
|
|
1920
1952
|
}
|
|
1921
1953
|
|
|
1922
1954
|
var _excluded$4 = ["key"];
|
|
@@ -1938,42 +1970,42 @@ function ArrayFieldTemplate(props) {
|
|
|
1938
1970
|
schema = props.schema,
|
|
1939
1971
|
title = props.title;
|
|
1940
1972
|
var uiOptions = getUiOptions(uiSchema);
|
|
1941
|
-
var ArrayFieldDescriptionTemplate = getTemplate(
|
|
1942
|
-
var ArrayFieldItemTemplate = getTemplate(
|
|
1943
|
-
var ArrayFieldTitleTemplate = getTemplate(
|
|
1973
|
+
var ArrayFieldDescriptionTemplate = getTemplate('ArrayFieldDescriptionTemplate', registry, uiOptions);
|
|
1974
|
+
var ArrayFieldItemTemplate = getTemplate('ArrayFieldItemTemplate', registry, uiOptions);
|
|
1975
|
+
var ArrayFieldTitleTemplate = getTemplate('ArrayFieldTitleTemplate', registry, uiOptions);
|
|
1944
1976
|
// Button templates are not overridden in the uiSchema
|
|
1945
1977
|
var AddButton = registry.templates.ButtonTemplates.AddButton;
|
|
1946
|
-
return
|
|
1978
|
+
return jsxs("fieldset", {
|
|
1947
1979
|
className: className,
|
|
1948
|
-
id: idSchema.$id
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
},
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
})
|
|
1980
|
+
id: idSchema.$id,
|
|
1981
|
+
children: [jsx(ArrayFieldTitleTemplate, {
|
|
1982
|
+
idSchema: idSchema,
|
|
1983
|
+
title: uiOptions.title || title,
|
|
1984
|
+
required: required,
|
|
1985
|
+
schema: schema,
|
|
1986
|
+
uiSchema: uiSchema,
|
|
1987
|
+
registry: registry
|
|
1988
|
+
}), jsx(ArrayFieldDescriptionTemplate, {
|
|
1989
|
+
idSchema: idSchema,
|
|
1990
|
+
description: uiOptions.description || schema.description,
|
|
1991
|
+
schema: schema,
|
|
1992
|
+
uiSchema: uiSchema,
|
|
1993
|
+
registry: registry
|
|
1994
|
+
}), jsx("div", {
|
|
1995
|
+
className: 'row array-item-list',
|
|
1996
|
+
children: items && items.map(function (_ref) {
|
|
1997
|
+
var key = _ref.key,
|
|
1998
|
+
itemProps = _objectWithoutPropertiesLoose(_ref, _excluded$4);
|
|
1999
|
+
return jsx(ArrayFieldItemTemplate, _extends({}, itemProps), key);
|
|
2000
|
+
})
|
|
2001
|
+
}), canAdd && jsx(AddButton, {
|
|
2002
|
+
className: 'array-item-add',
|
|
2003
|
+
onClick: onAddClick,
|
|
2004
|
+
disabled: disabled || readonly,
|
|
2005
|
+
uiSchema: uiSchema,
|
|
2006
|
+
registry: registry
|
|
2007
|
+
})]
|
|
2008
|
+
});
|
|
1977
2009
|
}
|
|
1978
2010
|
|
|
1979
2011
|
/** The `ArrayFieldTitleTemplate` component renders a `TitleFieldTemplate` with an `id` derived from
|
|
@@ -1994,8 +2026,8 @@ function ArrayFieldTitleTemplate(props) {
|
|
|
1994
2026
|
if (!title || !displayLabel) {
|
|
1995
2027
|
return null;
|
|
1996
2028
|
}
|
|
1997
|
-
var TitleFieldTemplate = getTemplate(
|
|
1998
|
-
return
|
|
2029
|
+
var TitleFieldTemplate = getTemplate('TitleFieldTemplate', registry, options);
|
|
2030
|
+
return jsx(TitleFieldTemplate, {
|
|
1999
2031
|
id: titleId(idSchema),
|
|
2000
2032
|
title: title,
|
|
2001
2033
|
required: required,
|
|
@@ -2005,7 +2037,7 @@ function ArrayFieldTitleTemplate(props) {
|
|
|
2005
2037
|
});
|
|
2006
2038
|
}
|
|
2007
2039
|
|
|
2008
|
-
var _excluded$3 = ["id", "value", "readonly", "disabled", "autofocus", "onBlur", "onFocus", "onChange", "options", "schema", "uiSchema", "formContext", "registry", "rawErrors", "type"];
|
|
2040
|
+
var _excluded$3 = ["id", "name", "value", "readonly", "disabled", "autofocus", "onBlur", "onFocus", "onChange", "onChangeOverride", "options", "schema", "uiSchema", "formContext", "registry", "rawErrors", "type"];
|
|
2009
2041
|
/** The `BaseInputTemplate` is the template to use to render the basic `<input>` component for the `core` theme.
|
|
2010
2042
|
* It is used as the template for rendering many of the <input> based widgets that differ by `type` and callbacks only.
|
|
2011
2043
|
* It can be customized/overridden for other themes or individual implementations as needed.
|
|
@@ -2021,6 +2053,7 @@ function BaseInputTemplate(props) {
|
|
|
2021
2053
|
onBlur = props.onBlur,
|
|
2022
2054
|
onFocus = props.onFocus,
|
|
2023
2055
|
onChange = props.onChange,
|
|
2056
|
+
onChangeOverride = props.onChangeOverride,
|
|
2024
2057
|
options = props.options,
|
|
2025
2058
|
schema = props.schema,
|
|
2026
2059
|
type = props.type,
|
|
@@ -2028,19 +2061,19 @@ function BaseInputTemplate(props) {
|
|
|
2028
2061
|
// Note: since React 15.2.0 we can't forward unknown element attributes, so we
|
|
2029
2062
|
// exclude the "options" and "schema" ones here.
|
|
2030
2063
|
if (!id) {
|
|
2031
|
-
console.log(
|
|
2064
|
+
console.log('No id for', props);
|
|
2032
2065
|
throw new Error("no id for props " + JSON.stringify(props));
|
|
2033
2066
|
}
|
|
2034
2067
|
var inputProps = _extends({}, rest, getInputProps(schema, type, options));
|
|
2035
2068
|
var inputValue;
|
|
2036
|
-
if (inputProps.type ===
|
|
2037
|
-
inputValue = value || value === 0 ? value :
|
|
2069
|
+
if (inputProps.type === 'number' || inputProps.type === 'integer') {
|
|
2070
|
+
inputValue = value || value === 0 ? value : '';
|
|
2038
2071
|
} else {
|
|
2039
|
-
inputValue = value == null ?
|
|
2072
|
+
inputValue = value == null ? '' : value;
|
|
2040
2073
|
}
|
|
2041
2074
|
var _onChange = useCallback(function (_ref) {
|
|
2042
2075
|
var value = _ref.target.value;
|
|
2043
|
-
return onChange(value ===
|
|
2076
|
+
return onChange(value === '' ? options.emptyValue : value);
|
|
2044
2077
|
}, [onChange, options]);
|
|
2045
2078
|
var _onBlur = useCallback(function (_ref2) {
|
|
2046
2079
|
var value = _ref2.target.value;
|
|
@@ -2050,29 +2083,30 @@ function BaseInputTemplate(props) {
|
|
|
2050
2083
|
var value = _ref3.target.value;
|
|
2051
2084
|
return onFocus(id, value);
|
|
2052
2085
|
}, [onFocus, id]);
|
|
2053
|
-
return
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2086
|
+
return jsxs(Fragment, {
|
|
2087
|
+
children: [jsx("input", _extends({
|
|
2088
|
+
id: id,
|
|
2089
|
+
name: id,
|
|
2090
|
+
className: 'form-control',
|
|
2091
|
+
readOnly: readonly,
|
|
2092
|
+
disabled: disabled,
|
|
2093
|
+
autoFocus: autofocus,
|
|
2094
|
+
value: inputValue
|
|
2095
|
+
}, inputProps, {
|
|
2096
|
+
list: schema.examples ? examplesId(id) : undefined,
|
|
2097
|
+
onChange: onChangeOverride || _onChange,
|
|
2098
|
+
onBlur: _onBlur,
|
|
2099
|
+
onFocus: _onFocus,
|
|
2100
|
+
"aria-describedby": ariaDescribedByIds(id, !!schema.examples)
|
|
2101
|
+
})), Array.isArray(schema.examples) && jsx("datalist", {
|
|
2102
|
+
id: examplesId(id),
|
|
2103
|
+
children: schema.examples.concat(schema["default"] && !schema.examples.includes(schema["default"]) ? [schema["default"]] : []).map(function (example) {
|
|
2104
|
+
return jsx("option", {
|
|
2105
|
+
value: example
|
|
2106
|
+
}, example);
|
|
2107
|
+
})
|
|
2108
|
+
}, "datalist_" + id)]
|
|
2109
|
+
});
|
|
2076
2110
|
}
|
|
2077
2111
|
|
|
2078
2112
|
/** The `SubmitButton` renders a button that represent the `Submit` action on a form
|
|
@@ -2087,50 +2121,58 @@ function SubmitButton(_ref) {
|
|
|
2087
2121
|
if (norender) {
|
|
2088
2122
|
return null;
|
|
2089
2123
|
}
|
|
2090
|
-
return
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2124
|
+
return jsx("div", {
|
|
2125
|
+
children: jsx("button", _extends({
|
|
2126
|
+
type: 'submit'
|
|
2127
|
+
}, submitButtonProps, {
|
|
2128
|
+
className: "btn btn-info " + submitButtonProps.className,
|
|
2129
|
+
children: submitText
|
|
2130
|
+
}))
|
|
2131
|
+
});
|
|
2095
2132
|
}
|
|
2096
2133
|
|
|
2097
2134
|
var _excluded$2 = ["iconType", "icon", "className", "uiSchema", "registry"];
|
|
2098
2135
|
function IconButton(props) {
|
|
2099
2136
|
var _props$iconType = props.iconType,
|
|
2100
|
-
iconType = _props$iconType === void 0 ?
|
|
2137
|
+
iconType = _props$iconType === void 0 ? 'default' : _props$iconType,
|
|
2101
2138
|
icon = props.icon,
|
|
2102
2139
|
className = props.className,
|
|
2103
2140
|
otherProps = _objectWithoutPropertiesLoose(props, _excluded$2);
|
|
2104
|
-
return
|
|
2105
|
-
type:
|
|
2141
|
+
return jsx("button", _extends({
|
|
2142
|
+
type: 'button',
|
|
2106
2143
|
className: "btn btn-" + iconType + " " + className
|
|
2107
|
-
}, otherProps
|
|
2108
|
-
|
|
2144
|
+
}, otherProps, {
|
|
2145
|
+
children: jsx("i", {
|
|
2146
|
+
className: "glyphicon glyphicon-" + icon
|
|
2147
|
+
})
|
|
2109
2148
|
}));
|
|
2110
2149
|
}
|
|
2111
2150
|
function MoveDownButton(props) {
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2151
|
+
var translateString = props.registry.translateString;
|
|
2152
|
+
return jsx(IconButton, _extends({
|
|
2153
|
+
title: translateString(TranslatableString.MoveDownButton),
|
|
2154
|
+
className: 'array-item-move-down'
|
|
2115
2155
|
}, props, {
|
|
2116
|
-
icon:
|
|
2156
|
+
icon: 'arrow-down'
|
|
2117
2157
|
}));
|
|
2118
2158
|
}
|
|
2119
2159
|
function MoveUpButton(props) {
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2160
|
+
var translateString = props.registry.translateString;
|
|
2161
|
+
return jsx(IconButton, _extends({
|
|
2162
|
+
title: translateString(TranslatableString.MoveUpButton),
|
|
2163
|
+
className: 'array-item-move-up'
|
|
2123
2164
|
}, props, {
|
|
2124
|
-
icon:
|
|
2165
|
+
icon: 'arrow-up'
|
|
2125
2166
|
}));
|
|
2126
2167
|
}
|
|
2127
2168
|
function RemoveButton(props) {
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2169
|
+
var translateString = props.registry.translateString;
|
|
2170
|
+
return jsx(IconButton, _extends({
|
|
2171
|
+
title: translateString(TranslatableString.RemoveButton),
|
|
2172
|
+
className: 'array-item-remove'
|
|
2131
2173
|
}, props, {
|
|
2132
|
-
iconType:
|
|
2133
|
-
icon:
|
|
2174
|
+
iconType: 'danger',
|
|
2175
|
+
icon: 'remove'
|
|
2134
2176
|
}));
|
|
2135
2177
|
}
|
|
2136
2178
|
|
|
@@ -2141,19 +2183,22 @@ function AddButton(_ref) {
|
|
|
2141
2183
|
onClick = _ref.onClick,
|
|
2142
2184
|
disabled = _ref.disabled,
|
|
2143
2185
|
registry = _ref.registry;
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2186
|
+
var translateString = registry.translateString;
|
|
2187
|
+
return jsx("div", {
|
|
2188
|
+
className: 'row',
|
|
2189
|
+
children: jsx("p", {
|
|
2190
|
+
className: "col-xs-3 col-xs-offset-9 text-right " + className,
|
|
2191
|
+
children: jsx(IconButton, {
|
|
2192
|
+
iconType: 'info',
|
|
2193
|
+
icon: 'plus',
|
|
2194
|
+
className: 'btn-add col-xs-12',
|
|
2195
|
+
title: translateString(TranslatableString.AddButton),
|
|
2196
|
+
onClick: onClick,
|
|
2197
|
+
disabled: disabled,
|
|
2198
|
+
registry: registry
|
|
2199
|
+
})
|
|
2200
|
+
})
|
|
2201
|
+
});
|
|
2157
2202
|
}
|
|
2158
2203
|
|
|
2159
2204
|
function buttonTemplates() {
|
|
@@ -2176,16 +2221,18 @@ function DescriptionField(props) {
|
|
|
2176
2221
|
if (!description) {
|
|
2177
2222
|
return null;
|
|
2178
2223
|
}
|
|
2179
|
-
if (typeof description ===
|
|
2180
|
-
return
|
|
2224
|
+
if (typeof description === 'string') {
|
|
2225
|
+
return jsx("p", {
|
|
2181
2226
|
id: id,
|
|
2182
|
-
className:
|
|
2183
|
-
|
|
2227
|
+
className: 'field-description',
|
|
2228
|
+
children: description
|
|
2229
|
+
});
|
|
2184
2230
|
} else {
|
|
2185
|
-
return
|
|
2231
|
+
return jsx("div", {
|
|
2186
2232
|
id: id,
|
|
2187
|
-
className:
|
|
2188
|
-
|
|
2233
|
+
className: 'field-description',
|
|
2234
|
+
children: description
|
|
2235
|
+
});
|
|
2189
2236
|
}
|
|
2190
2237
|
}
|
|
2191
2238
|
|
|
@@ -2194,24 +2241,30 @@ function DescriptionField(props) {
|
|
|
2194
2241
|
* @param props - The `ErrorListProps` for this component
|
|
2195
2242
|
*/
|
|
2196
2243
|
function ErrorList(_ref) {
|
|
2197
|
-
var errors = _ref.errors
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
className:
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
className:
|
|
2210
|
-
|
|
2211
|
-
|
|
2244
|
+
var errors = _ref.errors,
|
|
2245
|
+
registry = _ref.registry;
|
|
2246
|
+
var translateString = registry.translateString;
|
|
2247
|
+
return jsxs("div", {
|
|
2248
|
+
className: 'panel panel-danger errors',
|
|
2249
|
+
children: [jsx("div", {
|
|
2250
|
+
className: 'panel-heading',
|
|
2251
|
+
children: jsx("h3", {
|
|
2252
|
+
className: 'panel-title',
|
|
2253
|
+
children: translateString(TranslatableString.ErrorsLabel)
|
|
2254
|
+
})
|
|
2255
|
+
}), jsx("ul", {
|
|
2256
|
+
className: 'list-group',
|
|
2257
|
+
children: errors.map(function (error, i) {
|
|
2258
|
+
return jsx("li", {
|
|
2259
|
+
className: 'list-group-item text-danger',
|
|
2260
|
+
children: error.stack
|
|
2261
|
+
}, i);
|
|
2262
|
+
})
|
|
2263
|
+
})]
|
|
2264
|
+
});
|
|
2212
2265
|
}
|
|
2213
2266
|
|
|
2214
|
-
var REQUIRED_FIELD_SYMBOL$1 =
|
|
2267
|
+
var REQUIRED_FIELD_SYMBOL$1 = '*';
|
|
2215
2268
|
/** Renders a label for a field
|
|
2216
2269
|
*
|
|
2217
2270
|
* @param props - The `LabelProps` for this component
|
|
@@ -2223,12 +2276,14 @@ function Label(props) {
|
|
|
2223
2276
|
if (!label) {
|
|
2224
2277
|
return null;
|
|
2225
2278
|
}
|
|
2226
|
-
return
|
|
2227
|
-
className:
|
|
2228
|
-
htmlFor: id
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2279
|
+
return jsxs("label", {
|
|
2280
|
+
className: 'control-label',
|
|
2281
|
+
htmlFor: id,
|
|
2282
|
+
children: [label, required && jsx("span", {
|
|
2283
|
+
className: 'required',
|
|
2284
|
+
children: REQUIRED_FIELD_SYMBOL$1
|
|
2285
|
+
})]
|
|
2286
|
+
});
|
|
2232
2287
|
}
|
|
2233
2288
|
|
|
2234
2289
|
/** The `FieldTemplate` component is the template used by `SchemaField` to render any field. It renders the field
|
|
@@ -2249,17 +2304,20 @@ function FieldTemplate(props) {
|
|
|
2249
2304
|
registry = props.registry,
|
|
2250
2305
|
uiSchema = props.uiSchema;
|
|
2251
2306
|
var uiOptions = getUiOptions(uiSchema);
|
|
2252
|
-
var WrapIfAdditionalTemplate = getTemplate(
|
|
2307
|
+
var WrapIfAdditionalTemplate = getTemplate('WrapIfAdditionalTemplate', registry, uiOptions);
|
|
2253
2308
|
if (hidden) {
|
|
2254
|
-
return
|
|
2255
|
-
className:
|
|
2256
|
-
|
|
2309
|
+
return jsx("div", {
|
|
2310
|
+
className: 'hidden',
|
|
2311
|
+
children: children
|
|
2312
|
+
});
|
|
2257
2313
|
}
|
|
2258
|
-
return
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2314
|
+
return jsxs(WrapIfAdditionalTemplate, _extends({}, props, {
|
|
2315
|
+
children: [displayLabel && jsx(Label, {
|
|
2316
|
+
label: label,
|
|
2317
|
+
required: required,
|
|
2318
|
+
id: id
|
|
2319
|
+
}), displayLabel && description ? description : null, children, errors, help]
|
|
2320
|
+
}));
|
|
2263
2321
|
}
|
|
2264
2322
|
|
|
2265
2323
|
/** The `FieldErrorTemplate` component renders the errors local to the particular field
|
|
@@ -2274,17 +2332,20 @@ function FieldErrorTemplate(props) {
|
|
|
2274
2332
|
return null;
|
|
2275
2333
|
}
|
|
2276
2334
|
var id = errorId(idSchema);
|
|
2277
|
-
return
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2335
|
+
return jsx("div", {
|
|
2336
|
+
children: jsx("ul", {
|
|
2337
|
+
id: id,
|
|
2338
|
+
className: 'error-detail bs-callout bs-callout-info',
|
|
2339
|
+
children: errors.filter(function (elem) {
|
|
2340
|
+
return !!elem;
|
|
2341
|
+
}).map(function (error, index) {
|
|
2342
|
+
return jsx("li", {
|
|
2343
|
+
className: 'text-danger',
|
|
2344
|
+
children: error
|
|
2345
|
+
}, index);
|
|
2346
|
+
})
|
|
2347
|
+
})
|
|
2348
|
+
});
|
|
2288
2349
|
}
|
|
2289
2350
|
|
|
2290
2351
|
/** The `FieldHelpTemplate` component renders any help desired for a field
|
|
@@ -2298,16 +2359,18 @@ function FieldHelpTemplate(props) {
|
|
|
2298
2359
|
return null;
|
|
2299
2360
|
}
|
|
2300
2361
|
var id = helpId(idSchema);
|
|
2301
|
-
if (typeof help ===
|
|
2302
|
-
return
|
|
2362
|
+
if (typeof help === 'string') {
|
|
2363
|
+
return jsx("p", {
|
|
2303
2364
|
id: id,
|
|
2304
|
-
className:
|
|
2305
|
-
|
|
2365
|
+
className: 'help-block',
|
|
2366
|
+
children: help
|
|
2367
|
+
});
|
|
2306
2368
|
}
|
|
2307
|
-
return
|
|
2369
|
+
return jsx("div", {
|
|
2308
2370
|
id: id,
|
|
2309
|
-
className:
|
|
2310
|
-
|
|
2371
|
+
className: 'help-block',
|
|
2372
|
+
children: help
|
|
2373
|
+
});
|
|
2311
2374
|
}
|
|
2312
2375
|
|
|
2313
2376
|
/** The `ObjectFieldTemplate` is the template to use to render all the inner properties of an object along with the
|
|
@@ -2330,37 +2393,38 @@ function ObjectFieldTemplate(props) {
|
|
|
2330
2393
|
title = props.title,
|
|
2331
2394
|
uiSchema = props.uiSchema;
|
|
2332
2395
|
var options = getUiOptions(uiSchema);
|
|
2333
|
-
var TitleFieldTemplate = getTemplate(
|
|
2334
|
-
var DescriptionFieldTemplate = getTemplate(
|
|
2396
|
+
var TitleFieldTemplate = getTemplate('TitleFieldTemplate', registry, options);
|
|
2397
|
+
var DescriptionFieldTemplate = getTemplate('DescriptionFieldTemplate', registry, options);
|
|
2335
2398
|
// Button templates are not overridden in the uiSchema
|
|
2336
2399
|
var AddButton = registry.templates.ButtonTemplates.AddButton;
|
|
2337
|
-
return
|
|
2338
|
-
id: idSchema.$id
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2400
|
+
return jsxs("fieldset", {
|
|
2401
|
+
id: idSchema.$id,
|
|
2402
|
+
children: [(options.title || title) && jsx(TitleFieldTemplate, {
|
|
2403
|
+
id: titleId(idSchema),
|
|
2404
|
+
title: options.title || title,
|
|
2405
|
+
required: required,
|
|
2406
|
+
schema: schema,
|
|
2407
|
+
uiSchema: uiSchema,
|
|
2408
|
+
registry: registry
|
|
2409
|
+
}), (options.description || description) && jsx(DescriptionFieldTemplate, {
|
|
2410
|
+
id: descriptionId(idSchema),
|
|
2411
|
+
description: options.description || description,
|
|
2412
|
+
schema: schema,
|
|
2413
|
+
uiSchema: uiSchema,
|
|
2414
|
+
registry: registry
|
|
2415
|
+
}), properties.map(function (prop) {
|
|
2416
|
+
return prop.content;
|
|
2417
|
+
}), canExpand(schema, uiSchema, formData) && jsx(AddButton, {
|
|
2418
|
+
className: 'object-property-expand',
|
|
2419
|
+
onClick: onAddClick(schema),
|
|
2420
|
+
disabled: disabled || readonly,
|
|
2421
|
+
uiSchema: uiSchema,
|
|
2422
|
+
registry: registry
|
|
2423
|
+
})]
|
|
2424
|
+
});
|
|
2361
2425
|
}
|
|
2362
2426
|
|
|
2363
|
-
var REQUIRED_FIELD_SYMBOL =
|
|
2427
|
+
var REQUIRED_FIELD_SYMBOL = '*';
|
|
2364
2428
|
/** The `TitleField` is the template to use to render the title of a field
|
|
2365
2429
|
*
|
|
2366
2430
|
* @param props - The `TitleFieldProps` for this component
|
|
@@ -2369,11 +2433,13 @@ function TitleField(props) {
|
|
|
2369
2433
|
var id = props.id,
|
|
2370
2434
|
title = props.title,
|
|
2371
2435
|
required = props.required;
|
|
2372
|
-
return
|
|
2373
|
-
id: id
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2436
|
+
return jsxs("legend", {
|
|
2437
|
+
id: id,
|
|
2438
|
+
children: [title, required && jsx("span", {
|
|
2439
|
+
className: 'required',
|
|
2440
|
+
children: REQUIRED_FIELD_SYMBOL
|
|
2441
|
+
})]
|
|
2442
|
+
});
|
|
2377
2443
|
}
|
|
2378
2444
|
|
|
2379
2445
|
/** The `UnsupportedField` component is used to render a field in the schema is one that is not supported by
|
|
@@ -2384,10 +2450,29 @@ function TitleField(props) {
|
|
|
2384
2450
|
function UnsupportedField(props) {
|
|
2385
2451
|
var schema = props.schema,
|
|
2386
2452
|
idSchema = props.idSchema,
|
|
2387
|
-
reason = props.reason
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2453
|
+
reason = props.reason,
|
|
2454
|
+
registry = props.registry;
|
|
2455
|
+
var translateString = registry.translateString;
|
|
2456
|
+
var translateEnum = TranslatableString.UnsupportedField;
|
|
2457
|
+
var translateParams = [];
|
|
2458
|
+
if (idSchema && idSchema.$id) {
|
|
2459
|
+
translateEnum = TranslatableString.UnsupportedFieldWithId;
|
|
2460
|
+
translateParams.push(idSchema.$id);
|
|
2461
|
+
}
|
|
2462
|
+
if (reason) {
|
|
2463
|
+
translateEnum = translateEnum === TranslatableString.UnsupportedField ? TranslatableString.UnsupportedFieldWithReason : TranslatableString.UnsupportedFieldWithIdAndReason;
|
|
2464
|
+
translateParams.push(reason);
|
|
2465
|
+
}
|
|
2466
|
+
return jsxs("div", {
|
|
2467
|
+
className: 'unsupported-field',
|
|
2468
|
+
children: [jsx("p", {
|
|
2469
|
+
children: jsx(Markdown, {
|
|
2470
|
+
children: translateString(translateEnum, translateParams)
|
|
2471
|
+
})
|
|
2472
|
+
}), schema && jsx("pre", {
|
|
2473
|
+
children: JSON.stringify(schema, null, 2)
|
|
2474
|
+
})]
|
|
2475
|
+
});
|
|
2391
2476
|
}
|
|
2392
2477
|
|
|
2393
2478
|
/** The `WrapIfAdditional` component is used by the `FieldTemplate` to rename, or remove properties that are
|
|
@@ -2409,51 +2494,60 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
2409
2494
|
children = props.children,
|
|
2410
2495
|
uiSchema = props.uiSchema,
|
|
2411
2496
|
registry = props.registry;
|
|
2497
|
+
var templates = registry.templates,
|
|
2498
|
+
translateString = registry.translateString;
|
|
2412
2499
|
// Button templates are not overridden in the uiSchema
|
|
2413
|
-
var RemoveButton =
|
|
2414
|
-
var keyLabel = label
|
|
2500
|
+
var RemoveButton = templates.ButtonTemplates.RemoveButton;
|
|
2501
|
+
var keyLabel = translateString(TranslatableString.KeyLabel, [label]);
|
|
2415
2502
|
var additional = (ADDITIONAL_PROPERTY_FLAG in schema);
|
|
2416
2503
|
if (!additional) {
|
|
2417
|
-
return
|
|
2504
|
+
return jsx("div", {
|
|
2418
2505
|
className: classNames,
|
|
2419
|
-
style: style
|
|
2420
|
-
|
|
2506
|
+
style: style,
|
|
2507
|
+
children: children
|
|
2508
|
+
});
|
|
2421
2509
|
}
|
|
2422
|
-
return
|
|
2510
|
+
return jsx("div", {
|
|
2423
2511
|
className: classNames,
|
|
2424
|
-
style: style
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2512
|
+
style: style,
|
|
2513
|
+
children: jsxs("div", {
|
|
2514
|
+
className: 'row',
|
|
2515
|
+
children: [jsx("div", {
|
|
2516
|
+
className: 'col-xs-5 form-additional',
|
|
2517
|
+
children: jsxs("div", {
|
|
2518
|
+
className: 'form-group',
|
|
2519
|
+
children: [jsx(Label, {
|
|
2520
|
+
label: keyLabel,
|
|
2521
|
+
required: required,
|
|
2522
|
+
id: id + "-key"
|
|
2523
|
+
}), jsx("input", {
|
|
2524
|
+
className: 'form-control',
|
|
2525
|
+
type: 'text',
|
|
2526
|
+
id: id + "-key",
|
|
2527
|
+
onBlur: function onBlur(event) {
|
|
2528
|
+
return onKeyChange(event.target.value);
|
|
2529
|
+
},
|
|
2530
|
+
defaultValue: label
|
|
2531
|
+
})]
|
|
2532
|
+
})
|
|
2533
|
+
}), jsx("div", {
|
|
2534
|
+
className: 'form-additional form-group col-xs-5',
|
|
2535
|
+
children: children
|
|
2536
|
+
}), jsx("div", {
|
|
2537
|
+
className: 'col-xs-2',
|
|
2538
|
+
children: jsx(RemoveButton, {
|
|
2539
|
+
className: 'array-item-remove btn-block',
|
|
2540
|
+
style: {
|
|
2541
|
+
border: '0'
|
|
2542
|
+
},
|
|
2543
|
+
disabled: disabled || readonly,
|
|
2544
|
+
onClick: onDropPropertyClick(label),
|
|
2545
|
+
uiSchema: uiSchema,
|
|
2546
|
+
registry: registry
|
|
2547
|
+
})
|
|
2548
|
+
})]
|
|
2549
|
+
})
|
|
2550
|
+
});
|
|
2457
2551
|
}
|
|
2458
2552
|
|
|
2459
2553
|
function templates() {
|
|
@@ -2502,29 +2596,29 @@ function dateElementProps(state, time, yearsRange) {
|
|
|
2502
2596
|
minute = state.minute,
|
|
2503
2597
|
second = state.second;
|
|
2504
2598
|
var data = [{
|
|
2505
|
-
type:
|
|
2599
|
+
type: 'year',
|
|
2506
2600
|
range: yearsRange,
|
|
2507
2601
|
value: year
|
|
2508
2602
|
}, {
|
|
2509
|
-
type:
|
|
2603
|
+
type: 'month',
|
|
2510
2604
|
range: [1, 12],
|
|
2511
2605
|
value: month
|
|
2512
2606
|
}, {
|
|
2513
|
-
type:
|
|
2607
|
+
type: 'day',
|
|
2514
2608
|
range: [1, 31],
|
|
2515
2609
|
value: day
|
|
2516
2610
|
}];
|
|
2517
2611
|
if (time) {
|
|
2518
2612
|
data.push({
|
|
2519
|
-
type:
|
|
2613
|
+
type: 'hour',
|
|
2520
2614
|
range: [0, 23],
|
|
2521
2615
|
value: hour
|
|
2522
2616
|
}, {
|
|
2523
|
-
type:
|
|
2617
|
+
type: 'minute',
|
|
2524
2618
|
range: [0, 59],
|
|
2525
2619
|
value: minute
|
|
2526
2620
|
}, {
|
|
2527
|
-
type:
|
|
2621
|
+
type: 'second',
|
|
2528
2622
|
range: [0, 59],
|
|
2529
2623
|
value: second
|
|
2530
2624
|
});
|
|
@@ -2537,20 +2631,22 @@ function DateElement(_ref) {
|
|
|
2537
2631
|
value = _ref.value,
|
|
2538
2632
|
select = _ref.select,
|
|
2539
2633
|
rootId = _ref.rootId,
|
|
2634
|
+
name = _ref.name,
|
|
2540
2635
|
disabled = _ref.disabled,
|
|
2541
2636
|
readonly = _ref.readonly,
|
|
2542
2637
|
autofocus = _ref.autofocus,
|
|
2543
2638
|
registry = _ref.registry,
|
|
2544
2639
|
onBlur = _ref.onBlur,
|
|
2545
2640
|
onFocus = _ref.onFocus;
|
|
2546
|
-
var id = rootId +
|
|
2641
|
+
var id = rootId + '_' + type;
|
|
2547
2642
|
var SelectWidget = registry.widgets.SelectWidget;
|
|
2548
|
-
return
|
|
2643
|
+
return jsx(SelectWidget, {
|
|
2549
2644
|
schema: {
|
|
2550
|
-
type:
|
|
2645
|
+
type: 'integer'
|
|
2551
2646
|
},
|
|
2552
2647
|
id: id,
|
|
2553
|
-
|
|
2648
|
+
name: name,
|
|
2649
|
+
className: 'form-control',
|
|
2554
2650
|
options: {
|
|
2555
2651
|
enumOptions: rangeOptions(range[0], range[1])
|
|
2556
2652
|
},
|
|
@@ -2565,7 +2661,7 @@ function DateElement(_ref) {
|
|
|
2565
2661
|
onBlur: onBlur,
|
|
2566
2662
|
onFocus: onFocus,
|
|
2567
2663
|
registry: registry,
|
|
2568
|
-
label:
|
|
2664
|
+
label: '',
|
|
2569
2665
|
"aria-describedby": ariaDescribedByIds(rootId)
|
|
2570
2666
|
});
|
|
2571
2667
|
}
|
|
@@ -2583,11 +2679,13 @@ function AltDateWidget(_ref2) {
|
|
|
2583
2679
|
autofocus = _ref2$autofocus === void 0 ? false : _ref2$autofocus,
|
|
2584
2680
|
options = _ref2.options,
|
|
2585
2681
|
id = _ref2.id,
|
|
2682
|
+
name = _ref2.name,
|
|
2586
2683
|
registry = _ref2.registry,
|
|
2587
2684
|
onBlur = _ref2.onBlur,
|
|
2588
2685
|
onFocus = _ref2.onFocus,
|
|
2589
2686
|
onChange = _ref2.onChange,
|
|
2590
2687
|
value = _ref2.value;
|
|
2688
|
+
var translateString = registry.translateString;
|
|
2591
2689
|
var _useReducer = useReducer(function (state, action) {
|
|
2592
2690
|
return _extends({}, state, action);
|
|
2593
2691
|
}, parseDateString(value, time)),
|
|
@@ -2621,39 +2719,45 @@ function AltDateWidget(_ref2) {
|
|
|
2621
2719
|
if (disabled || readonly) {
|
|
2622
2720
|
return;
|
|
2623
2721
|
}
|
|
2624
|
-
setState(parseDateString(
|
|
2722
|
+
setState(parseDateString('', time));
|
|
2625
2723
|
onChange(undefined);
|
|
2626
2724
|
}, [disabled, readonly, time, onChange]);
|
|
2627
|
-
return
|
|
2628
|
-
className:
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2725
|
+
return jsxs("ul", {
|
|
2726
|
+
className: 'list-inline',
|
|
2727
|
+
children: [dateElementProps(state, time, options.yearsRange).map(function (elemProps, i) {
|
|
2728
|
+
return jsx("li", {
|
|
2729
|
+
className: 'list-inline-item',
|
|
2730
|
+
children: jsx(DateElement, _extends({
|
|
2731
|
+
rootId: id,
|
|
2732
|
+
name: name,
|
|
2733
|
+
select: handleChange
|
|
2734
|
+
}, elemProps, {
|
|
2735
|
+
disabled: disabled,
|
|
2736
|
+
readonly: readonly,
|
|
2737
|
+
registry: registry,
|
|
2738
|
+
onBlur: onBlur,
|
|
2739
|
+
onFocus: onFocus,
|
|
2740
|
+
autofocus: autofocus && i === 0
|
|
2741
|
+
}))
|
|
2742
|
+
}, i);
|
|
2743
|
+
}), (options.hideNowButton !== 'undefined' ? !options.hideNowButton : true) && jsx("li", {
|
|
2744
|
+
className: 'list-inline-item',
|
|
2745
|
+
children: jsx("a", {
|
|
2746
|
+
href: '#',
|
|
2747
|
+
className: 'btn btn-info btn-now',
|
|
2748
|
+
onClick: handleSetNow,
|
|
2749
|
+
children: translateString(TranslatableString.NowLabel)
|
|
2750
|
+
})
|
|
2751
|
+
}), (options.hideClearButton !== 'undefined' ? !options.hideClearButton : true) && jsx("li", {
|
|
2752
|
+
className: 'list-inline-item',
|
|
2753
|
+
children: jsx("a", {
|
|
2754
|
+
href: '#',
|
|
2755
|
+
className: 'btn btn-warning btn-clear',
|
|
2756
|
+
onClick: handleClear,
|
|
2757
|
+
children: translateString(TranslatableString.ClearLabel)
|
|
2758
|
+
})
|
|
2759
|
+
})]
|
|
2760
|
+
});
|
|
2657
2761
|
}
|
|
2658
2762
|
|
|
2659
2763
|
var _excluded$1 = ["time"];
|
|
@@ -2667,7 +2771,7 @@ function AltDateTimeWidget(_ref) {
|
|
|
2667
2771
|
time = _ref$time === void 0 ? true : _ref$time,
|
|
2668
2772
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
2669
2773
|
var AltDateWidget = props.registry.widgets.AltDateWidget;
|
|
2670
|
-
return
|
|
2774
|
+
return jsx(AltDateWidget, _extends({
|
|
2671
2775
|
time: time
|
|
2672
2776
|
}, props));
|
|
2673
2777
|
}
|
|
@@ -2692,7 +2796,7 @@ function CheckboxWidget(_ref) {
|
|
|
2692
2796
|
onFocus = _ref.onFocus,
|
|
2693
2797
|
onChange = _ref.onChange,
|
|
2694
2798
|
registry = _ref.registry;
|
|
2695
|
-
var DescriptionFieldTemplate = getTemplate(
|
|
2799
|
+
var DescriptionFieldTemplate = getTemplate('DescriptionFieldTemplate', registry, options);
|
|
2696
2800
|
// Because an unchecked checkbox will cause html5 validation to fail, only add
|
|
2697
2801
|
// the "required" attribute if the field value must be "true", due to the
|
|
2698
2802
|
// "const" or "enum" keywords
|
|
@@ -2706,27 +2810,32 @@ function CheckboxWidget(_ref) {
|
|
|
2706
2810
|
var handleFocus = useCallback(function (event) {
|
|
2707
2811
|
return onFocus(id, event.target.checked);
|
|
2708
2812
|
}, [onFocus, id]);
|
|
2709
|
-
return
|
|
2710
|
-
className: "checkbox " + (disabled || readonly ?
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2813
|
+
return jsxs("div", {
|
|
2814
|
+
className: "checkbox " + (disabled || readonly ? 'disabled' : ''),
|
|
2815
|
+
children: [schema.description && jsx(DescriptionFieldTemplate, {
|
|
2816
|
+
id: descriptionId(id),
|
|
2817
|
+
description: schema.description,
|
|
2818
|
+
schema: schema,
|
|
2819
|
+
uiSchema: uiSchema,
|
|
2820
|
+
registry: registry
|
|
2821
|
+
}), jsxs("label", {
|
|
2822
|
+
children: [jsx("input", {
|
|
2823
|
+
type: 'checkbox',
|
|
2824
|
+
id: id,
|
|
2825
|
+
name: id,
|
|
2826
|
+
checked: typeof value === 'undefined' ? false : value,
|
|
2827
|
+
required: required,
|
|
2828
|
+
disabled: disabled || readonly,
|
|
2829
|
+
autoFocus: autofocus,
|
|
2830
|
+
onChange: handleChange,
|
|
2831
|
+
onBlur: handleBlur,
|
|
2832
|
+
onFocus: handleFocus,
|
|
2833
|
+
"aria-describedby": ariaDescribedByIds(id)
|
|
2834
|
+
}), jsx("span", {
|
|
2835
|
+
children: label
|
|
2836
|
+
})]
|
|
2837
|
+
})]
|
|
2838
|
+
});
|
|
2730
2839
|
}
|
|
2731
2840
|
|
|
2732
2841
|
/** The `CheckboxesWidget` is a widget for rendering checkbox groups.
|
|
@@ -2759,41 +2868,48 @@ function CheckboxesWidget(_ref) {
|
|
|
2759
2868
|
var value = _ref3.target.value;
|
|
2760
2869
|
return onFocus(id, enumOptionsValueForIndex(value, enumOptions, emptyValue));
|
|
2761
2870
|
}, [onFocus, id]);
|
|
2762
|
-
return
|
|
2763
|
-
className:
|
|
2764
|
-
id: id
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2871
|
+
return jsx("div", {
|
|
2872
|
+
className: 'checkboxes',
|
|
2873
|
+
id: id,
|
|
2874
|
+
children: Array.isArray(enumOptions) && enumOptions.map(function (option, index) {
|
|
2875
|
+
var checked = enumOptionsIsSelected(option.value, checkboxesValues);
|
|
2876
|
+
var itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
2877
|
+
var disabledCls = disabled || itemDisabled || readonly ? 'disabled' : '';
|
|
2878
|
+
var handleChange = function handleChange(event) {
|
|
2879
|
+
if (event.target.checked) {
|
|
2880
|
+
onChange(enumOptionsSelectValue(index, checkboxesValues, enumOptions));
|
|
2881
|
+
} else {
|
|
2882
|
+
onChange(enumOptionsDeselectValue(index, checkboxesValues, enumOptions));
|
|
2883
|
+
}
|
|
2884
|
+
};
|
|
2885
|
+
var checkbox = jsxs("span", {
|
|
2886
|
+
children: [jsx("input", {
|
|
2887
|
+
type: 'checkbox',
|
|
2888
|
+
id: optionId(id, index),
|
|
2889
|
+
name: id,
|
|
2890
|
+
checked: checked,
|
|
2891
|
+
value: String(index),
|
|
2892
|
+
disabled: disabled || itemDisabled || readonly,
|
|
2893
|
+
autoFocus: autofocus && index === 0,
|
|
2894
|
+
onChange: handleChange,
|
|
2895
|
+
onBlur: handleBlur,
|
|
2896
|
+
onFocus: handleFocus,
|
|
2897
|
+
"aria-describedby": ariaDescribedByIds(id)
|
|
2898
|
+
}), jsx("span", {
|
|
2899
|
+
children: option.label
|
|
2900
|
+
})]
|
|
2901
|
+
});
|
|
2902
|
+
return inline ? jsx("label", {
|
|
2903
|
+
className: "checkbox-inline " + disabledCls,
|
|
2904
|
+
children: checkbox
|
|
2905
|
+
}, index) : jsx("div", {
|
|
2906
|
+
className: "checkbox " + disabledCls,
|
|
2907
|
+
children: jsx("label", {
|
|
2908
|
+
children: checkbox
|
|
2909
|
+
})
|
|
2910
|
+
}, index);
|
|
2911
|
+
})
|
|
2912
|
+
});
|
|
2797
2913
|
}
|
|
2798
2914
|
|
|
2799
2915
|
/** The `ColorWidget` component uses the `BaseInputTemplate` changing the type to `color` and disables it when it is
|
|
@@ -2806,9 +2922,9 @@ function ColorWidget(props) {
|
|
|
2806
2922
|
readonly = props.readonly,
|
|
2807
2923
|
options = props.options,
|
|
2808
2924
|
registry = props.registry;
|
|
2809
|
-
var BaseInputTemplate = getTemplate(
|
|
2810
|
-
return
|
|
2811
|
-
type:
|
|
2925
|
+
var BaseInputTemplate = getTemplate('BaseInputTemplate', registry, options);
|
|
2926
|
+
return jsx(BaseInputTemplate, _extends({
|
|
2927
|
+
type: 'color'
|
|
2812
2928
|
}, props, {
|
|
2813
2929
|
disabled: disabled || readonly
|
|
2814
2930
|
}));
|
|
@@ -2823,12 +2939,12 @@ function DateWidget(props) {
|
|
|
2823
2939
|
var onChange = props.onChange,
|
|
2824
2940
|
options = props.options,
|
|
2825
2941
|
registry = props.registry;
|
|
2826
|
-
var BaseInputTemplate = getTemplate(
|
|
2942
|
+
var BaseInputTemplate = getTemplate('BaseInputTemplate', registry, options);
|
|
2827
2943
|
var handleChange = useCallback(function (value) {
|
|
2828
2944
|
return onChange(value || undefined);
|
|
2829
2945
|
}, [onChange]);
|
|
2830
|
-
return
|
|
2831
|
-
type:
|
|
2946
|
+
return jsx(BaseInputTemplate, _extends({
|
|
2947
|
+
type: 'date'
|
|
2832
2948
|
}, props, {
|
|
2833
2949
|
onChange: handleChange
|
|
2834
2950
|
}));
|
|
@@ -2844,9 +2960,9 @@ function DateTimeWidget(props) {
|
|
|
2844
2960
|
value = props.value,
|
|
2845
2961
|
options = props.options,
|
|
2846
2962
|
registry = props.registry;
|
|
2847
|
-
var BaseInputTemplate = getTemplate(
|
|
2848
|
-
return
|
|
2849
|
-
type:
|
|
2963
|
+
var BaseInputTemplate = getTemplate('BaseInputTemplate', registry, options);
|
|
2964
|
+
return jsx(BaseInputTemplate, _extends({
|
|
2965
|
+
type: 'datetime-local'
|
|
2850
2966
|
}, props, {
|
|
2851
2967
|
value: utcToLocal(value),
|
|
2852
2968
|
onChange: function onChange(value) {
|
|
@@ -2862,9 +2978,9 @@ function DateTimeWidget(props) {
|
|
|
2862
2978
|
function EmailWidget(props) {
|
|
2863
2979
|
var options = props.options,
|
|
2864
2980
|
registry = props.registry;
|
|
2865
|
-
var BaseInputTemplate = getTemplate(
|
|
2866
|
-
return
|
|
2867
|
-
type:
|
|
2981
|
+
var BaseInputTemplate = getTemplate('BaseInputTemplate', registry, options);
|
|
2982
|
+
return jsx(BaseInputTemplate, _extends({
|
|
2983
|
+
type: 'email'
|
|
2868
2984
|
}, props));
|
|
2869
2985
|
}
|
|
2870
2986
|
|
|
@@ -2872,7 +2988,7 @@ function addNameToDataURL(dataURL, name) {
|
|
|
2872
2988
|
if (dataURL === null) {
|
|
2873
2989
|
return null;
|
|
2874
2990
|
}
|
|
2875
|
-
return dataURL.replace(
|
|
2991
|
+
return dataURL.replace(';base64', ";name=" + encodeURIComponent(name) + ";base64");
|
|
2876
2992
|
}
|
|
2877
2993
|
function processFile(file) {
|
|
2878
2994
|
var name = file.name,
|
|
@@ -2883,7 +2999,7 @@ function processFile(file) {
|
|
|
2883
2999
|
reader.onerror = reject;
|
|
2884
3000
|
reader.onload = function (event) {
|
|
2885
3001
|
var _event$target;
|
|
2886
|
-
if (typeof ((_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.result) ===
|
|
3002
|
+
if (typeof ((_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.result) === 'string') {
|
|
2887
3003
|
resolve({
|
|
2888
3004
|
dataURL: addNameToDataURL(event.target.result, name),
|
|
2889
3005
|
name: name,
|
|
@@ -2906,24 +3022,29 @@ function processFiles(files) {
|
|
|
2906
3022
|
return Promise.all(Array.from(files).map(processFile));
|
|
2907
3023
|
}
|
|
2908
3024
|
function FilesInfo(_ref) {
|
|
2909
|
-
var filesInfo = _ref.filesInfo
|
|
3025
|
+
var filesInfo = _ref.filesInfo,
|
|
3026
|
+
registry = _ref.registry;
|
|
2910
3027
|
if (filesInfo.length === 0) {
|
|
2911
3028
|
return null;
|
|
2912
3029
|
}
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
3030
|
+
var translateString = registry.translateString;
|
|
3031
|
+
return jsx("ul", {
|
|
3032
|
+
className: 'file-info',
|
|
3033
|
+
children: filesInfo.map(function (fileInfo, key) {
|
|
3034
|
+
var name = fileInfo.name,
|
|
3035
|
+
size = fileInfo.size,
|
|
3036
|
+
type = fileInfo.type;
|
|
3037
|
+
return jsx("li", {
|
|
3038
|
+
children: jsx(Markdown, {
|
|
3039
|
+
children: translateString(TranslatableString.FilesInfo, [name, type, String(size)])
|
|
3040
|
+
})
|
|
3041
|
+
}, key);
|
|
3042
|
+
})
|
|
3043
|
+
});
|
|
2923
3044
|
}
|
|
2924
3045
|
function extractFileInfo(dataURLs) {
|
|
2925
3046
|
return dataURLs.filter(function (dataURL) {
|
|
2926
|
-
return
|
|
3047
|
+
return dataURL;
|
|
2927
3048
|
}).map(function (dataURL) {
|
|
2928
3049
|
var _dataURItoBlob = dataURItoBlob(dataURL),
|
|
2929
3050
|
blob = _dataURItoBlob.blob,
|
|
@@ -2939,16 +3060,15 @@ function extractFileInfo(dataURLs) {
|
|
|
2939
3060
|
* The `FileWidget` is a widget for rendering file upload fields.
|
|
2940
3061
|
* It is typically used with a string property with data-url format.
|
|
2941
3062
|
*/
|
|
2942
|
-
function FileWidget(
|
|
2943
|
-
var
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
options = _ref2.options;
|
|
3063
|
+
function FileWidget(props) {
|
|
3064
|
+
var disabled = props.disabled,
|
|
3065
|
+
readonly = props.readonly,
|
|
3066
|
+
multiple = props.multiple,
|
|
3067
|
+
onChange = props.onChange,
|
|
3068
|
+
value = props.value,
|
|
3069
|
+
options = props.options,
|
|
3070
|
+
registry = props.registry;
|
|
3071
|
+
var BaseInputTemplate = getTemplate('BaseInputTemplate', registry, options);
|
|
2952
3072
|
var extractedFilesInfo = useMemo(function () {
|
|
2953
3073
|
return Array.isArray(value) ? extractFileInfo(value) : extractFileInfo([value]);
|
|
2954
3074
|
}, [value]);
|
|
@@ -2971,20 +3091,18 @@ function FileWidget(_ref2) {
|
|
|
2971
3091
|
}
|
|
2972
3092
|
});
|
|
2973
3093
|
}, [multiple, onChange]);
|
|
2974
|
-
return
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
})
|
|
2986
|
-
filesInfo: filesInfo
|
|
2987
|
-
}));
|
|
3094
|
+
return jsxs("div", {
|
|
3095
|
+
children: [jsx(BaseInputTemplate, _extends({}, props, {
|
|
3096
|
+
disabled: disabled || readonly,
|
|
3097
|
+
type: 'file',
|
|
3098
|
+
onChangeOverride: handleChange,
|
|
3099
|
+
value: '',
|
|
3100
|
+
accept: options.accept ? String(options.accept) : undefined
|
|
3101
|
+
})), jsx(FilesInfo, {
|
|
3102
|
+
filesInfo: filesInfo,
|
|
3103
|
+
registry: registry
|
|
3104
|
+
})]
|
|
3105
|
+
});
|
|
2988
3106
|
}
|
|
2989
3107
|
|
|
2990
3108
|
/** The `HiddenWidget` is a widget for rendering a hidden input field.
|
|
@@ -2995,11 +3113,11 @@ function FileWidget(_ref2) {
|
|
|
2995
3113
|
function HiddenWidget(_ref) {
|
|
2996
3114
|
var id = _ref.id,
|
|
2997
3115
|
value = _ref.value;
|
|
2998
|
-
return
|
|
2999
|
-
type:
|
|
3116
|
+
return jsx("input", {
|
|
3117
|
+
type: 'hidden',
|
|
3000
3118
|
id: id,
|
|
3001
3119
|
name: id,
|
|
3002
|
-
value: typeof value ===
|
|
3120
|
+
value: typeof value === 'undefined' ? '' : value
|
|
3003
3121
|
});
|
|
3004
3122
|
}
|
|
3005
3123
|
|
|
@@ -3010,9 +3128,9 @@ function HiddenWidget(_ref) {
|
|
|
3010
3128
|
function PasswordWidget(props) {
|
|
3011
3129
|
var options = props.options,
|
|
3012
3130
|
registry = props.registry;
|
|
3013
|
-
var BaseInputTemplate = getTemplate(
|
|
3014
|
-
return
|
|
3015
|
-
type:
|
|
3131
|
+
var BaseInputTemplate = getTemplate('BaseInputTemplate', registry, options);
|
|
3132
|
+
return jsx(BaseInputTemplate, _extends({
|
|
3133
|
+
type: 'password'
|
|
3016
3134
|
}, props));
|
|
3017
3135
|
}
|
|
3018
3136
|
|
|
@@ -3047,38 +3165,45 @@ function RadioWidget(_ref) {
|
|
|
3047
3165
|
var value = _ref3.target.value;
|
|
3048
3166
|
return onFocus(id, enumOptionsValueForIndex(value, enumOptions, emptyValue));
|
|
3049
3167
|
}, [onFocus, id]);
|
|
3050
|
-
return
|
|
3051
|
-
className:
|
|
3052
|
-
id: id
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3168
|
+
return jsx("div", {
|
|
3169
|
+
className: 'field-radio-group',
|
|
3170
|
+
id: id,
|
|
3171
|
+
children: Array.isArray(enumOptions) && enumOptions.map(function (option, i) {
|
|
3172
|
+
var checked = enumOptionsIsSelected(option.value, value);
|
|
3173
|
+
var itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
3174
|
+
var disabledCls = disabled || itemDisabled || readonly ? 'disabled' : '';
|
|
3175
|
+
var handleChange = function handleChange() {
|
|
3176
|
+
return onChange(option.value);
|
|
3177
|
+
};
|
|
3178
|
+
var radio = jsxs("span", {
|
|
3179
|
+
children: [jsx("input", {
|
|
3180
|
+
type: 'radio',
|
|
3181
|
+
id: optionId(id, i),
|
|
3182
|
+
checked: checked,
|
|
3183
|
+
name: name,
|
|
3184
|
+
required: required,
|
|
3185
|
+
value: String(i),
|
|
3186
|
+
disabled: disabled || itemDisabled || readonly,
|
|
3187
|
+
autoFocus: autofocus && i === 0,
|
|
3188
|
+
onChange: handleChange,
|
|
3189
|
+
onBlur: handleBlur,
|
|
3190
|
+
onFocus: handleFocus,
|
|
3191
|
+
"aria-describedby": ariaDescribedByIds(id)
|
|
3192
|
+
}), jsx("span", {
|
|
3193
|
+
children: option.label
|
|
3194
|
+
})]
|
|
3195
|
+
});
|
|
3196
|
+
return inline ? jsx("label", {
|
|
3197
|
+
className: "radio-inline " + disabledCls,
|
|
3198
|
+
children: radio
|
|
3199
|
+
}, i) : jsx("div", {
|
|
3200
|
+
className: "radio " + disabledCls,
|
|
3201
|
+
children: jsx("label", {
|
|
3202
|
+
children: radio
|
|
3203
|
+
})
|
|
3204
|
+
}, i);
|
|
3205
|
+
})
|
|
3206
|
+
});
|
|
3082
3207
|
}
|
|
3083
3208
|
|
|
3084
3209
|
/** The `RangeWidget` component uses the `BaseInputTemplate` changing the type to `range` and wrapping the result
|
|
@@ -3089,13 +3214,15 @@ function RadioWidget(_ref) {
|
|
|
3089
3214
|
function RangeWidget(props) {
|
|
3090
3215
|
var value = props.value,
|
|
3091
3216
|
BaseInputTemplate = props.registry.templates.BaseInputTemplate;
|
|
3092
|
-
return
|
|
3093
|
-
className:
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3217
|
+
return jsxs("div", {
|
|
3218
|
+
className: 'field-range-wrapper',
|
|
3219
|
+
children: [jsx(BaseInputTemplate, _extends({
|
|
3220
|
+
type: 'range'
|
|
3221
|
+
}, props)), jsx("span", {
|
|
3222
|
+
className: 'range-view',
|
|
3223
|
+
children: value
|
|
3224
|
+
})]
|
|
3225
|
+
});
|
|
3099
3226
|
}
|
|
3100
3227
|
|
|
3101
3228
|
function getValue(event, multiple) {
|
|
@@ -3132,7 +3259,7 @@ function SelectWidget(_ref) {
|
|
|
3132
3259
|
var enumOptions = options.enumOptions,
|
|
3133
3260
|
enumDisabled = options.enumDisabled,
|
|
3134
3261
|
optEmptyVal = options.emptyValue;
|
|
3135
|
-
var emptyValue = multiple ? [] :
|
|
3262
|
+
var emptyValue = multiple ? [] : '';
|
|
3136
3263
|
var handleFocus = useCallback(function (event) {
|
|
3137
3264
|
var newValue = getValue(event, multiple);
|
|
3138
3265
|
return onFocus(id, enumOptionsValueForIndex(newValue, enumOptions, optEmptyVal));
|
|
@@ -3146,31 +3273,33 @@ function SelectWidget(_ref) {
|
|
|
3146
3273
|
return onChange(enumOptionsValueForIndex(newValue, enumOptions, optEmptyVal));
|
|
3147
3274
|
}, [onChange, schema, multiple, options]);
|
|
3148
3275
|
var selectedIndexes = enumOptionsIndexForValue(value, enumOptions, multiple);
|
|
3149
|
-
return
|
|
3276
|
+
return jsxs("select", {
|
|
3150
3277
|
id: id,
|
|
3151
3278
|
name: id,
|
|
3152
3279
|
multiple: multiple,
|
|
3153
|
-
className:
|
|
3154
|
-
value: typeof selectedIndexes ===
|
|
3280
|
+
className: 'form-control',
|
|
3281
|
+
value: typeof selectedIndexes === 'undefined' ? emptyValue : selectedIndexes,
|
|
3155
3282
|
required: required,
|
|
3156
3283
|
disabled: disabled || readonly,
|
|
3157
3284
|
autoFocus: autofocus,
|
|
3158
3285
|
onBlur: handleBlur,
|
|
3159
3286
|
onFocus: handleFocus,
|
|
3160
3287
|
onChange: handleChange,
|
|
3161
|
-
"aria-describedby": ariaDescribedByIds(id)
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3288
|
+
"aria-describedby": ariaDescribedByIds(id),
|
|
3289
|
+
children: [!multiple && schema["default"] === undefined && jsx("option", {
|
|
3290
|
+
value: '',
|
|
3291
|
+
children: placeholder
|
|
3292
|
+
}), Array.isArray(enumOptions) && enumOptions.map(function (_ref2, i) {
|
|
3293
|
+
var value = _ref2.value,
|
|
3294
|
+
label = _ref2.label;
|
|
3295
|
+
var disabled = enumDisabled && enumDisabled.indexOf(value) !== -1;
|
|
3296
|
+
return jsx("option", {
|
|
3297
|
+
value: String(i),
|
|
3298
|
+
disabled: disabled,
|
|
3299
|
+
children: label
|
|
3300
|
+
}, i);
|
|
3301
|
+
})]
|
|
3302
|
+
});
|
|
3174
3303
|
}
|
|
3175
3304
|
|
|
3176
3305
|
/** The `TextareaWidget` is a widget for rendering input fields as textarea.
|
|
@@ -3193,7 +3322,7 @@ function TextareaWidget(_ref) {
|
|
|
3193
3322
|
onFocus = _ref.onFocus;
|
|
3194
3323
|
var handleChange = useCallback(function (_ref2) {
|
|
3195
3324
|
var value = _ref2.target.value;
|
|
3196
|
-
return onChange(value ===
|
|
3325
|
+
return onChange(value === '' ? options.emptyValue : value);
|
|
3197
3326
|
}, [onChange, options.emptyValue]);
|
|
3198
3327
|
var handleBlur = useCallback(function (_ref3) {
|
|
3199
3328
|
var value = _ref3.target.value;
|
|
@@ -3203,11 +3332,11 @@ function TextareaWidget(_ref) {
|
|
|
3203
3332
|
var value = _ref4.target.value;
|
|
3204
3333
|
return onFocus(id, value);
|
|
3205
3334
|
}, [id, onFocus]);
|
|
3206
|
-
return
|
|
3335
|
+
return jsx("textarea", {
|
|
3207
3336
|
id: id,
|
|
3208
3337
|
name: id,
|
|
3209
|
-
className:
|
|
3210
|
-
value: value ? value :
|
|
3338
|
+
className: 'form-control',
|
|
3339
|
+
value: value ? value : '',
|
|
3211
3340
|
placeholder: placeholder,
|
|
3212
3341
|
required: required,
|
|
3213
3342
|
disabled: disabled,
|
|
@@ -3232,8 +3361,8 @@ TextareaWidget.defaultProps = {
|
|
|
3232
3361
|
function TextWidget(props) {
|
|
3233
3362
|
var options = props.options,
|
|
3234
3363
|
registry = props.registry;
|
|
3235
|
-
var BaseInputTemplate = getTemplate(
|
|
3236
|
-
return
|
|
3364
|
+
var BaseInputTemplate = getTemplate('BaseInputTemplate', registry, options);
|
|
3365
|
+
return jsx(BaseInputTemplate, _extends({}, props));
|
|
3237
3366
|
}
|
|
3238
3367
|
|
|
3239
3368
|
/** The `URLWidget` component uses the `BaseInputTemplate` changing the type to `url`.
|
|
@@ -3243,9 +3372,9 @@ function TextWidget(props) {
|
|
|
3243
3372
|
function URLWidget(props) {
|
|
3244
3373
|
var options = props.options,
|
|
3245
3374
|
registry = props.registry;
|
|
3246
|
-
var BaseInputTemplate = getTemplate(
|
|
3247
|
-
return
|
|
3248
|
-
type:
|
|
3375
|
+
var BaseInputTemplate = getTemplate('BaseInputTemplate', registry, options);
|
|
3376
|
+
return jsx(BaseInputTemplate, _extends({
|
|
3377
|
+
type: 'url'
|
|
3249
3378
|
}, props));
|
|
3250
3379
|
}
|
|
3251
3380
|
|
|
@@ -3256,9 +3385,9 @@ function URLWidget(props) {
|
|
|
3256
3385
|
function UpDownWidget(props) {
|
|
3257
3386
|
var options = props.options,
|
|
3258
3387
|
registry = props.registry;
|
|
3259
|
-
var BaseInputTemplate = getTemplate(
|
|
3260
|
-
return
|
|
3261
|
-
type:
|
|
3388
|
+
var BaseInputTemplate = getTemplate('BaseInputTemplate', registry, options);
|
|
3389
|
+
return jsx(BaseInputTemplate, _extends({
|
|
3390
|
+
type: 'number'
|
|
3262
3391
|
}, props));
|
|
3263
3392
|
}
|
|
3264
3393
|
|
|
@@ -3295,7 +3424,8 @@ function getDefaultRegistry() {
|
|
|
3295
3424
|
templates: templates(),
|
|
3296
3425
|
widgets: widgets(),
|
|
3297
3426
|
rootSchema: {},
|
|
3298
|
-
formContext: {}
|
|
3427
|
+
formContext: {},
|
|
3428
|
+
translateString: englishStringTranslator
|
|
3299
3429
|
};
|
|
3300
3430
|
}
|
|
3301
3431
|
|
|
@@ -3318,7 +3448,7 @@ var Form = /*#__PURE__*/function (_Component) {
|
|
|
3318
3448
|
_this.formElement = void 0;
|
|
3319
3449
|
_this.getUsedFormData = function (formData, fields) {
|
|
3320
3450
|
// For the case of a single input form
|
|
3321
|
-
if (fields.length === 0 && typeof formData !==
|
|
3451
|
+
if (fields.length === 0 && typeof formData !== 'object') {
|
|
3322
3452
|
return formData;
|
|
3323
3453
|
}
|
|
3324
3454
|
// _pick has incorrect type definition, it works with string[][], because lodash/hasIn supports it
|
|
@@ -3339,22 +3469,22 @@ var Form = /*#__PURE__*/function (_Component) {
|
|
|
3339
3469
|
paths = [[]];
|
|
3340
3470
|
}
|
|
3341
3471
|
Object.keys(_obj).forEach(function (key) {
|
|
3342
|
-
if (typeof _obj[key] ===
|
|
3472
|
+
if (typeof _obj[key] === 'object') {
|
|
3343
3473
|
var newPaths = paths.map(function (path) {
|
|
3344
3474
|
return [].concat(path, [key]);
|
|
3345
3475
|
});
|
|
3346
3476
|
// If an object is marked with additionalProperties, all its keys are valid
|
|
3347
|
-
if (_obj[key][RJSF_ADDITONAL_PROPERTIES_FLAG] && _obj[key][NAME_KEY] !==
|
|
3477
|
+
if (_obj[key][RJSF_ADDITONAL_PROPERTIES_FLAG] && _obj[key][NAME_KEY] !== '') {
|
|
3348
3478
|
acc.push(_obj[key][NAME_KEY]);
|
|
3349
3479
|
} else {
|
|
3350
3480
|
getAllPaths(_obj[key], acc, newPaths);
|
|
3351
3481
|
}
|
|
3352
|
-
} else if (key === NAME_KEY && _obj[key] !==
|
|
3482
|
+
} else if (key === NAME_KEY && _obj[key] !== '') {
|
|
3353
3483
|
paths.forEach(function (path) {
|
|
3354
3484
|
var formValue = get(formData, path);
|
|
3355
3485
|
// adds path to fieldNames if it points to a value
|
|
3356
3486
|
// or an empty object/array
|
|
3357
|
-
if (typeof formValue !==
|
|
3487
|
+
if (typeof formValue !== 'object' || isEmpty(formValue)) {
|
|
3358
3488
|
acc.push(path);
|
|
3359
3489
|
}
|
|
3360
3490
|
});
|
|
@@ -3387,7 +3517,7 @@ var Form = /*#__PURE__*/function (_Component) {
|
|
|
3387
3517
|
var newFormData = formData;
|
|
3388
3518
|
if (omitExtraData === true && liveOmit === true) {
|
|
3389
3519
|
var retrievedSchema = schemaUtils.retrieveSchema(schema, formData);
|
|
3390
|
-
var pathSchema = schemaUtils.toPathSchema(retrievedSchema,
|
|
3520
|
+
var pathSchema = schemaUtils.toPathSchema(retrievedSchema, '', formData);
|
|
3391
3521
|
var fieldNames = _this.getFieldNames(pathSchema, formData);
|
|
3392
3522
|
newFormData = _this.getUsedFormData(formData, fieldNames);
|
|
3393
3523
|
state = {
|
|
@@ -3413,7 +3543,7 @@ var Form = /*#__PURE__*/function (_Component) {
|
|
|
3413
3543
|
schemaValidationErrorSchema: schemaValidationErrorSchema
|
|
3414
3544
|
};
|
|
3415
3545
|
} else if (!noValidate && newErrorSchema) {
|
|
3416
|
-
var _errorSchema = extraErrors ? mergeObjects(newErrorSchema, extraErrors,
|
|
3546
|
+
var _errorSchema = extraErrors ? mergeObjects(newErrorSchema, extraErrors, 'preventDuplicates') : newErrorSchema;
|
|
3417
3547
|
state = {
|
|
3418
3548
|
formData: newFormData,
|
|
3419
3549
|
errorSchema: _errorSchema,
|
|
@@ -3453,7 +3583,7 @@ var Form = /*#__PURE__*/function (_Component) {
|
|
|
3453
3583
|
schemaUtils = _this$state2.schemaUtils;
|
|
3454
3584
|
if (omitExtraData === true) {
|
|
3455
3585
|
var retrievedSchema = schemaUtils.retrieveSchema(schema, newFormData);
|
|
3456
|
-
var pathSchema = schemaUtils.toPathSchema(retrievedSchema,
|
|
3586
|
+
var pathSchema = schemaUtils.toPathSchema(retrievedSchema, '', newFormData);
|
|
3457
3587
|
var fieldNames = _this.getFieldNames(pathSchema, newFormData);
|
|
3458
3588
|
newFormData = _this.getUsedFormData(newFormData, fieldNames);
|
|
3459
3589
|
}
|
|
@@ -3472,20 +3602,20 @@ var Form = /*#__PURE__*/function (_Component) {
|
|
|
3472
3602
|
if (onSubmit) {
|
|
3473
3603
|
onSubmit(_extends({}, _this.state, {
|
|
3474
3604
|
formData: newFormData,
|
|
3475
|
-
status:
|
|
3605
|
+
status: 'submitted'
|
|
3476
3606
|
}), event);
|
|
3477
3607
|
}
|
|
3478
3608
|
});
|
|
3479
3609
|
}
|
|
3480
3610
|
};
|
|
3481
3611
|
if (!props.validator) {
|
|
3482
|
-
throw new Error(
|
|
3612
|
+
throw new Error('A validator is required for Form functionality to work');
|
|
3483
3613
|
}
|
|
3484
3614
|
_this.state = _this.getStateFromProps(props, props.formData);
|
|
3485
3615
|
if (_this.props.onChange && !deepEquals(_this.state.formData, _this.props.formData)) {
|
|
3486
3616
|
_this.props.onChange(_this.state);
|
|
3487
3617
|
}
|
|
3488
|
-
_this.formElement = /*#__PURE__*/
|
|
3618
|
+
_this.formElement = /*#__PURE__*/createRef();
|
|
3489
3619
|
return _this;
|
|
3490
3620
|
}
|
|
3491
3621
|
/** React lifecycle method that gets called before new props are provided, updates the state based on new props. It
|
|
@@ -3512,10 +3642,10 @@ var Form = /*#__PURE__*/function (_Component) {
|
|
|
3512
3642
|
*/;
|
|
3513
3643
|
_proto.getStateFromProps = function getStateFromProps(props, inputFormData) {
|
|
3514
3644
|
var state = this.state || {};
|
|
3515
|
-
var schema =
|
|
3516
|
-
var uiSchema = (
|
|
3517
|
-
var edit = typeof inputFormData !==
|
|
3518
|
-
var liveValidate =
|
|
3645
|
+
var schema = 'schema' in props ? props.schema : this.props.schema;
|
|
3646
|
+
var uiSchema = ('uiSchema' in props ? props.uiSchema : this.props.uiSchema) || {};
|
|
3647
|
+
var edit = typeof inputFormData !== 'undefined';
|
|
3648
|
+
var liveValidate = 'liveValidate' in props ? props.liveValidate : this.props.liveValidate;
|
|
3519
3649
|
var mustValidate = edit && !props.noValidate && liveValidate;
|
|
3520
3650
|
var rootSchema = schema;
|
|
3521
3651
|
var schemaUtils = state.schemaUtils;
|
|
@@ -3564,7 +3694,7 @@ var Form = /*#__PURE__*/function (_Component) {
|
|
|
3564
3694
|
errorSchema = merged.errorSchema;
|
|
3565
3695
|
errors = merged.errors;
|
|
3566
3696
|
}
|
|
3567
|
-
var idSchema = schemaUtils.toIdSchema(retrievedSchema, uiSchema[
|
|
3697
|
+
var idSchema = schemaUtils.toIdSchema(retrievedSchema, uiSchema['ui:rootFieldId'], formData, props.idPrefix, props.idSeparator);
|
|
3568
3698
|
var nextState = {
|
|
3569
3699
|
schemaUtils: schemaUtils,
|
|
3570
3700
|
schema: schema,
|
|
@@ -3616,14 +3746,15 @@ var Form = /*#__PURE__*/function (_Component) {
|
|
|
3616
3746
|
uiSchema = _this$state3.uiSchema;
|
|
3617
3747
|
var formContext = this.props.formContext;
|
|
3618
3748
|
var options = getUiOptions(uiSchema);
|
|
3619
|
-
var ErrorListTemplate = getTemplate(
|
|
3749
|
+
var ErrorListTemplate = getTemplate('ErrorListTemplate', registry, options);
|
|
3620
3750
|
if (errors && errors.length) {
|
|
3621
|
-
return
|
|
3751
|
+
return jsx(ErrorListTemplate, {
|
|
3622
3752
|
errors: errors,
|
|
3623
3753
|
errorSchema: errorSchema || {},
|
|
3624
3754
|
schema: schema,
|
|
3625
3755
|
uiSchema: uiSchema,
|
|
3626
|
-
formContext: formContext
|
|
3756
|
+
formContext: formContext,
|
|
3757
|
+
registry: registry
|
|
3627
3758
|
});
|
|
3628
3759
|
}
|
|
3629
3760
|
return null;
|
|
@@ -3636,12 +3767,14 @@ var Form = /*#__PURE__*/function (_Component) {
|
|
|
3636
3767
|
/** Returns the registry for the form */
|
|
3637
3768
|
_proto.getRegistry = function getRegistry() {
|
|
3638
3769
|
var _this$props$templates;
|
|
3770
|
+
var customTranslateString = this.props.translateString;
|
|
3639
3771
|
var schemaUtils = this.state.schemaUtils;
|
|
3640
3772
|
var _getDefaultRegistry = getDefaultRegistry(),
|
|
3641
3773
|
fields = _getDefaultRegistry.fields,
|
|
3642
3774
|
templates = _getDefaultRegistry.templates,
|
|
3643
3775
|
widgets = _getDefaultRegistry.widgets,
|
|
3644
|
-
formContext = _getDefaultRegistry.formContext
|
|
3776
|
+
formContext = _getDefaultRegistry.formContext,
|
|
3777
|
+
translateString = _getDefaultRegistry.translateString;
|
|
3645
3778
|
return {
|
|
3646
3779
|
fields: _extends({}, fields, this.props.fields),
|
|
3647
3780
|
templates: _extends({}, templates, this.props.templates, {
|
|
@@ -3650,13 +3783,14 @@ var Form = /*#__PURE__*/function (_Component) {
|
|
|
3650
3783
|
widgets: _extends({}, widgets, this.props.widgets),
|
|
3651
3784
|
rootSchema: this.props.schema,
|
|
3652
3785
|
formContext: this.props.formContext || formContext,
|
|
3653
|
-
schemaUtils: schemaUtils
|
|
3786
|
+
schemaUtils: schemaUtils,
|
|
3787
|
+
translateString: customTranslateString || translateString
|
|
3654
3788
|
};
|
|
3655
3789
|
}
|
|
3656
3790
|
/** Provides a function that can be used to programmatically submit the `Form` */;
|
|
3657
3791
|
_proto.submit = function submit() {
|
|
3658
3792
|
if (this.formElement.current) {
|
|
3659
|
-
this.formElement.current.dispatchEvent(new CustomEvent(
|
|
3793
|
+
this.formElement.current.dispatchEvent(new CustomEvent('submit', {
|
|
3660
3794
|
cancelable: true
|
|
3661
3795
|
}));
|
|
3662
3796
|
this.formElement.current.requestSubmit();
|
|
@@ -3671,12 +3805,12 @@ var Form = /*#__PURE__*/function (_Component) {
|
|
|
3671
3805
|
_proto.focusOnError = function focusOnError(error) {
|
|
3672
3806
|
var _this$props4 = this.props,
|
|
3673
3807
|
_this$props4$idPrefix = _this$props4.idPrefix,
|
|
3674
|
-
idPrefix = _this$props4$idPrefix === void 0 ?
|
|
3808
|
+
idPrefix = _this$props4$idPrefix === void 0 ? 'root' : _this$props4$idPrefix,
|
|
3675
3809
|
_this$props4$idSepara = _this$props4.idSeparator,
|
|
3676
|
-
idSeparator = _this$props4$idSepara === void 0 ?
|
|
3810
|
+
idSeparator = _this$props4$idSepara === void 0 ? '_' : _this$props4$idSepara;
|
|
3677
3811
|
var property = error.property;
|
|
3678
3812
|
var path = _toPath(property);
|
|
3679
|
-
if (path[0] ===
|
|
3813
|
+
if (path[0] === '') {
|
|
3680
3814
|
// Most of the time the `.foo` property results in the first element being empty, so replace it with the idPrefix
|
|
3681
3815
|
path[0] = idPrefix;
|
|
3682
3816
|
} else {
|
|
@@ -3728,7 +3862,7 @@ var Form = /*#__PURE__*/function (_Component) {
|
|
|
3728
3862
|
if (onError) {
|
|
3729
3863
|
onError(errors);
|
|
3730
3864
|
} else {
|
|
3731
|
-
console.error(
|
|
3865
|
+
console.error('Form validation failed', errors);
|
|
3732
3866
|
}
|
|
3733
3867
|
});
|
|
3734
3868
|
return false;
|
|
@@ -3745,7 +3879,7 @@ var Form = /*#__PURE__*/function (_Component) {
|
|
|
3745
3879
|
idPrefix = _this$props6.idPrefix,
|
|
3746
3880
|
idSeparator = _this$props6.idSeparator,
|
|
3747
3881
|
_this$props6$classNam = _this$props6.className,
|
|
3748
|
-
className = _this$props6$classNam === void 0 ?
|
|
3882
|
+
className = _this$props6$classNam === void 0 ? '' : _this$props6$classNam,
|
|
3749
3883
|
tagName = _this$props6.tagName,
|
|
3750
3884
|
name = _this$props6.name,
|
|
3751
3885
|
method = _this$props6.method,
|
|
@@ -3762,7 +3896,7 @@ var Form = /*#__PURE__*/function (_Component) {
|
|
|
3762
3896
|
readonly = _this$props6$readonly === void 0 ? false : _this$props6$readonly,
|
|
3763
3897
|
formContext = _this$props6.formContext,
|
|
3764
3898
|
_this$props6$showErro = _this$props6.showErrorList,
|
|
3765
|
-
showErrorList = _this$props6$showErro === void 0 ?
|
|
3899
|
+
showErrorList = _this$props6$showErro === void 0 ? 'top' : _this$props6$showErro,
|
|
3766
3900
|
_internalFormWrapper = _this$props6._internalFormWrapper;
|
|
3767
3901
|
var _this$state4 = this.state,
|
|
3768
3902
|
schema = _this$state4.schema,
|
|
@@ -3777,9 +3911,9 @@ var Form = /*#__PURE__*/function (_Component) {
|
|
|
3777
3911
|
// PropTypes.elementType to use for the inner tag, so we'll need to pass `tagName` along if it is provided.
|
|
3778
3912
|
// NOTE, the `as` prop is native to `semantic-ui` and is emulated in the `material-ui` theme
|
|
3779
3913
|
var as = _internalFormWrapper ? tagName : undefined;
|
|
3780
|
-
var FormTag = _internalFormWrapper || tagName ||
|
|
3781
|
-
return
|
|
3782
|
-
className: className ? className :
|
|
3914
|
+
var FormTag = _internalFormWrapper || tagName || 'form';
|
|
3915
|
+
return jsxs(FormTag, {
|
|
3916
|
+
className: className ? className : 'rjsf',
|
|
3783
3917
|
id: id,
|
|
3784
3918
|
name: name,
|
|
3785
3919
|
method: method,
|
|
@@ -3791,27 +3925,28 @@ var Form = /*#__PURE__*/function (_Component) {
|
|
|
3791
3925
|
noValidate: noHtml5Validate,
|
|
3792
3926
|
onSubmit: this.onSubmit,
|
|
3793
3927
|
as: as,
|
|
3794
|
-
ref: this.formElement
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3928
|
+
ref: this.formElement,
|
|
3929
|
+
children: [showErrorList === 'top' && this.renderErrors(registry), jsx(_SchemaField, {
|
|
3930
|
+
name: '',
|
|
3931
|
+
schema: schema,
|
|
3932
|
+
uiSchema: uiSchema,
|
|
3933
|
+
errorSchema: errorSchema,
|
|
3934
|
+
idSchema: idSchema,
|
|
3935
|
+
idPrefix: idPrefix,
|
|
3936
|
+
idSeparator: idSeparator,
|
|
3937
|
+
formContext: formContext,
|
|
3938
|
+
formData: formData,
|
|
3939
|
+
onChange: this.onChange,
|
|
3940
|
+
onBlur: this.onBlur,
|
|
3941
|
+
onFocus: this.onFocus,
|
|
3942
|
+
registry: registry,
|
|
3943
|
+
disabled: disabled,
|
|
3944
|
+
readonly: readonly
|
|
3945
|
+
}), children ? children : jsx(SubmitButton, {
|
|
3946
|
+
uiSchema: uiSchema,
|
|
3947
|
+
registry: registry
|
|
3948
|
+
}), showErrorList === 'bottom' && this.renderErrors(registry)]
|
|
3949
|
+
});
|
|
3815
3950
|
};
|
|
3816
3951
|
return Form;
|
|
3817
3952
|
}(Component);
|
|
@@ -3830,7 +3965,7 @@ function withTheme(themeProps) {
|
|
|
3830
3965
|
templates = _extends({}, themeProps === null || themeProps === void 0 ? void 0 : themeProps.templates, templates, {
|
|
3831
3966
|
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)
|
|
3832
3967
|
});
|
|
3833
|
-
return
|
|
3968
|
+
return jsx(Form, _extends({}, themeProps, directProps, {
|
|
3834
3969
|
fields: fields,
|
|
3835
3970
|
widgets: widgets,
|
|
3836
3971
|
templates: templates,
|