@rjsf/core 5.2.0 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +183 -183
- package/README.md +1 -1
- package/dist/core.cjs.development.js +1017 -826
- 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 +983 -792
- package/dist/core.esm.js.map +1 -1
- package/dist/core.umd.development.js +1017 -828
- 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 +24 -17
- package/package.json +12 -12
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@rjsf/utils'), require('lodash-es/get'), require('lodash-es/isEmpty'), require('lodash-es/pick'), require('lodash-es/toPath'), require('lodash-es/isObject'), require('lodash-es/set'), require('nanoid'), require('lodash-es/omit'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'react', '@rjsf/utils', 'lodash-es/get', 'lodash-es/isEmpty', 'lodash-es/pick', 'lodash-es/toPath', 'lodash-es/isObject', 'lodash-es/set', 'nanoid', 'lodash-es/omit', 'lodash-es/has', 'lodash-es/unset'
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.JSONSchemaForm = {}, global.React, global.utils, global.get, global.isEmpty, global._pick, global._toPath, global.isObject, global.set, global.nanoid, global.omit, global.
|
|
5
|
-
})(this, (function (exports,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react/jsx-runtime'), require('react'), require('@rjsf/utils'), require('lodash-es/get'), require('lodash-es/isEmpty'), require('lodash-es/pick'), require('lodash-es/toPath'), require('lodash-es/cloneDeep'), require('lodash-es/isObject'), require('lodash-es/set'), require('nanoid'), require('lodash-es/omit'), require('markdown-to-jsx'), require('lodash-es/has'), require('lodash-es/unset')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'react/jsx-runtime', 'react', '@rjsf/utils', 'lodash-es/get', 'lodash-es/isEmpty', 'lodash-es/pick', 'lodash-es/toPath', 'lodash-es/cloneDeep', 'lodash-es/isObject', 'lodash-es/set', 'nanoid', 'lodash-es/omit', 'markdown-to-jsx', 'lodash-es/has', 'lodash-es/unset'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.JSONSchemaForm = {}, global.jsxRuntime, global.React, global.utils, global.get, global.isEmpty, global._pick, global._toPath, global.cloneDeep, global.isObject, global.set, global.nanoid, global.omit, global.Markdown, global.has, global.unset));
|
|
5
|
+
})(this, (function (exports, jsxRuntime, react, utils, get, isEmpty, _pick, _toPath, cloneDeep, isObject, set, nanoid, omit, Markdown, has, unset) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
9
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
10
9
|
var get__default = /*#__PURE__*/_interopDefaultLegacy(get);
|
|
11
10
|
var isEmpty__default = /*#__PURE__*/_interopDefaultLegacy(isEmpty);
|
|
12
11
|
var _pick__default = /*#__PURE__*/_interopDefaultLegacy(_pick);
|
|
13
12
|
var _toPath__default = /*#__PURE__*/_interopDefaultLegacy(_toPath);
|
|
13
|
+
var cloneDeep__default = /*#__PURE__*/_interopDefaultLegacy(cloneDeep);
|
|
14
14
|
var isObject__default = /*#__PURE__*/_interopDefaultLegacy(isObject);
|
|
15
15
|
var set__default = /*#__PURE__*/_interopDefaultLegacy(set);
|
|
16
16
|
var omit__default = /*#__PURE__*/_interopDefaultLegacy(omit);
|
|
17
|
+
var Markdown__default = /*#__PURE__*/_interopDefaultLegacy(Markdown);
|
|
17
18
|
var has__default = /*#__PURE__*/_interopDefaultLegacy(has);
|
|
18
19
|
var unset__default = /*#__PURE__*/_interopDefaultLegacy(unset);
|
|
19
|
-
var Markdown__default = /*#__PURE__*/_interopDefaultLegacy(Markdown);
|
|
20
20
|
|
|
21
21
|
function _defineProperties(target, props) {
|
|
22
22
|
for (var i = 0; i < props.length; i++) {
|
|
@@ -153,6 +153,31 @@
|
|
|
153
153
|
_this._handleAddClick(event, index);
|
|
154
154
|
};
|
|
155
155
|
};
|
|
156
|
+
_this.onCopyIndexClick = function (index) {
|
|
157
|
+
return function (event) {
|
|
158
|
+
if (event) {
|
|
159
|
+
event.preventDefault();
|
|
160
|
+
}
|
|
161
|
+
var onChange = _this.props.onChange;
|
|
162
|
+
var keyedFormData = _this.state.keyedFormData;
|
|
163
|
+
var newKeyedFormDataRow = {
|
|
164
|
+
key: generateRowId(),
|
|
165
|
+
item: cloneDeep__default["default"](keyedFormData[index].item)
|
|
166
|
+
};
|
|
167
|
+
var newKeyedFormData = [].concat(keyedFormData);
|
|
168
|
+
if (index !== undefined) {
|
|
169
|
+
newKeyedFormData.splice(index + 1, 0, newKeyedFormDataRow);
|
|
170
|
+
} else {
|
|
171
|
+
newKeyedFormData.push(newKeyedFormDataRow);
|
|
172
|
+
}
|
|
173
|
+
_this.setState({
|
|
174
|
+
keyedFormData: newKeyedFormData,
|
|
175
|
+
updatedKeyedFormData: true
|
|
176
|
+
}, function () {
|
|
177
|
+
return onChange(keyedToPlainFormData(newKeyedFormData));
|
|
178
|
+
});
|
|
179
|
+
};
|
|
180
|
+
};
|
|
156
181
|
_this.onDropIndexClick = function (index) {
|
|
157
182
|
return function (event) {
|
|
158
183
|
if (event) {
|
|
@@ -237,7 +262,7 @@
|
|
|
237
262
|
var newFormData = arrayData.map(function (item, i) {
|
|
238
263
|
// We need to treat undefined items as nulls to have validation.
|
|
239
264
|
// See https://github.com/tdegrunt/jsonschema/issues/206
|
|
240
|
-
var jsonValue = typeof value ===
|
|
265
|
+
var jsonValue = typeof value === 'undefined' ? null : value;
|
|
241
266
|
return index === i ? jsonValue : item;
|
|
242
267
|
});
|
|
243
268
|
onChange(newFormData, errorSchema && errorSchema && _extends({}, errorSchema, (_extends2 = {}, _extends2[index] = newErrorSchema, _extends2)), id);
|
|
@@ -297,10 +322,10 @@
|
|
|
297
322
|
if (Array.isArray(itemSchema.type)) {
|
|
298
323
|
// While we don't yet support composite/nullable jsonschema types, it's
|
|
299
324
|
// future-proof to check for requirement against these.
|
|
300
|
-
return !itemSchema.type.includes(
|
|
325
|
+
return !itemSchema.type.includes('null');
|
|
301
326
|
}
|
|
302
327
|
// All non-null array item types are inherently required by design
|
|
303
|
-
return itemSchema.type !==
|
|
328
|
+
return itemSchema.type !== 'null';
|
|
304
329
|
}
|
|
305
330
|
/** Determines whether more items can be added to the array. If the uiSchema indicates the array doesn't allow adding
|
|
306
331
|
* then false is returned. Otherwise, if the schema indicates that there are a maximum number of items and the
|
|
@@ -312,8 +337,9 @@
|
|
|
312
337
|
_proto.canAddItem = function canAddItem(formItems) {
|
|
313
338
|
var _this$props6 = this.props,
|
|
314
339
|
schema = _this$props6.schema,
|
|
315
|
-
uiSchema = _this$props6.uiSchema
|
|
316
|
-
|
|
340
|
+
uiSchema = _this$props6.uiSchema,
|
|
341
|
+
registry = _this$props6.registry;
|
|
342
|
+
var _getUiOptions = utils.getUiOptions(uiSchema, registry.globalUiOptions),
|
|
317
343
|
addable = _getUiOptions.addable;
|
|
318
344
|
if (addable !== false) {
|
|
319
345
|
// if ui:options.addable was not explicitly set to false, we can add
|
|
@@ -377,8 +403,8 @@
|
|
|
377
403
|
translateString = registry.translateString;
|
|
378
404
|
if (!(utils.ITEMS_KEY in schema)) {
|
|
379
405
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
380
|
-
var UnsupportedFieldTemplate = utils.getTemplate(
|
|
381
|
-
return
|
|
406
|
+
var UnsupportedFieldTemplate = utils.getTemplate('UnsupportedFieldTemplate', registry, uiOptions);
|
|
407
|
+
return jsxRuntime.jsx(UnsupportedFieldTemplate, {
|
|
382
408
|
schema: schema,
|
|
383
409
|
idSchema: idSchema,
|
|
384
410
|
reason: translateString(utils.TranslatableString.MissingItems),
|
|
@@ -424,7 +450,7 @@
|
|
|
424
450
|
onFocus = _this$props8.onFocus,
|
|
425
451
|
idPrefix = _this$props8.idPrefix,
|
|
426
452
|
_this$props8$idSepara = _this$props8.idSeparator,
|
|
427
|
-
idSeparator = _this$props8$idSepara === void 0 ?
|
|
453
|
+
idSeparator = _this$props8$idSepara === void 0 ? '_' : _this$props8$idSepara,
|
|
428
454
|
rawErrors = _this$props8.rawErrors;
|
|
429
455
|
var keyedFormData = this.state.keyedFormData;
|
|
430
456
|
var title = schema.title === undefined ? name : schema.title;
|
|
@@ -479,8 +505,8 @@
|
|
|
479
505
|
rawErrors: rawErrors,
|
|
480
506
|
registry: registry
|
|
481
507
|
};
|
|
482
|
-
var Template = utils.getTemplate(
|
|
483
|
-
return
|
|
508
|
+
var Template = utils.getTemplate('ArrayFieldTemplate', registry, uiOptions);
|
|
509
|
+
return jsxRuntime.jsx(Template, _extends({}, arrayProps));
|
|
484
510
|
}
|
|
485
511
|
/** Renders an array using the custom widget provided by the user in the `uiSchema`
|
|
486
512
|
*/;
|
|
@@ -513,8 +539,9 @@
|
|
|
513
539
|
widget = _getUiOptions2.widget,
|
|
514
540
|
options = _objectWithoutPropertiesLoose(_getUiOptions2, _excluded$9);
|
|
515
541
|
var Widget = utils.getWidget(schema, widget, widgets);
|
|
516
|
-
return
|
|
542
|
+
return jsxRuntime.jsx(Widget, {
|
|
517
543
|
id: idSchema.$id,
|
|
544
|
+
name: name,
|
|
518
545
|
multiple: true,
|
|
519
546
|
onChange: this.onSelectChange,
|
|
520
547
|
onBlur: onBlur,
|
|
@@ -566,11 +593,12 @@
|
|
|
566
593
|
var enumOptions = utils.optionsList(itemsSchema);
|
|
567
594
|
var _getUiOptions3 = utils.getUiOptions(uiSchema),
|
|
568
595
|
_getUiOptions3$widget = _getUiOptions3.widget,
|
|
569
|
-
widget = _getUiOptions3$widget === void 0 ?
|
|
596
|
+
widget = _getUiOptions3$widget === void 0 ? 'select' : _getUiOptions3$widget,
|
|
570
597
|
options = _objectWithoutPropertiesLoose(_getUiOptions3, _excluded2);
|
|
571
598
|
var Widget = utils.getWidget(schema, widget, widgets);
|
|
572
|
-
return
|
|
599
|
+
return jsxRuntime.jsx(Widget, {
|
|
573
600
|
id: idSchema.$id,
|
|
601
|
+
name: name,
|
|
574
602
|
multiple: true,
|
|
575
603
|
onChange: this.onSelectChange,
|
|
576
604
|
onBlur: onBlur,
|
|
@@ -619,12 +647,13 @@
|
|
|
619
647
|
formContext = registry.formContext;
|
|
620
648
|
var _getUiOptions4 = utils.getUiOptions(uiSchema),
|
|
621
649
|
_getUiOptions4$widget = _getUiOptions4.widget,
|
|
622
|
-
widget = _getUiOptions4$widget === void 0 ?
|
|
650
|
+
widget = _getUiOptions4$widget === void 0 ? 'files' : _getUiOptions4$widget,
|
|
623
651
|
options = _objectWithoutPropertiesLoose(_getUiOptions4, _excluded3);
|
|
624
652
|
var Widget = utils.getWidget(schema, widget, widgets);
|
|
625
|
-
return
|
|
653
|
+
return jsxRuntime.jsx(Widget, {
|
|
626
654
|
options: options,
|
|
627
655
|
id: idSchema.$id,
|
|
656
|
+
name: name,
|
|
628
657
|
multiple: true,
|
|
629
658
|
onChange: this.onSelectChange,
|
|
630
659
|
onBlur: onBlur,
|
|
@@ -640,7 +669,7 @@
|
|
|
640
669
|
formContext: formContext,
|
|
641
670
|
autofocus: autofocus,
|
|
642
671
|
rawErrors: rawErrors,
|
|
643
|
-
label:
|
|
672
|
+
label: ''
|
|
644
673
|
});
|
|
645
674
|
}
|
|
646
675
|
/** Renders an array that has a maximum limit of items
|
|
@@ -656,7 +685,7 @@
|
|
|
656
685
|
errorSchema = _this$props12.errorSchema,
|
|
657
686
|
idPrefix = _this$props12.idPrefix,
|
|
658
687
|
_this$props12$idSepar = _this$props12.idSeparator,
|
|
659
|
-
idSeparator = _this$props12$idSepar === void 0 ?
|
|
688
|
+
idSeparator = _this$props12$idSepar === void 0 ? '_' : _this$props12$idSepar,
|
|
660
689
|
idSchema = _this$props12.idSchema,
|
|
661
690
|
name = _this$props12.name,
|
|
662
691
|
_this$props12$disable = _this$props12.disabled,
|
|
@@ -692,7 +721,7 @@
|
|
|
692
721
|
var canAdd = this.canAddItem(items) && !!additionalSchema;
|
|
693
722
|
var arrayProps = {
|
|
694
723
|
canAdd: canAdd,
|
|
695
|
-
className:
|
|
724
|
+
className: 'field field-array field-array-fixed-items',
|
|
696
725
|
disabled: disabled,
|
|
697
726
|
idSchema: idSchema,
|
|
698
727
|
formData: formData,
|
|
@@ -737,8 +766,8 @@
|
|
|
737
766
|
formContext: formContext,
|
|
738
767
|
rawErrors: rawErrors
|
|
739
768
|
};
|
|
740
|
-
var Template = utils.getTemplate(
|
|
741
|
-
return
|
|
769
|
+
var Template = utils.getTemplate('ArrayFieldTemplate', registry, uiOptions);
|
|
770
|
+
return jsxRuntime.jsx(Template, _extends({}, arrayProps));
|
|
742
771
|
}
|
|
743
772
|
/** Renders the individual array item using a `SchemaField` along with the additional properties required to be send
|
|
744
773
|
* back to the `ArrayFieldItemTemplate`.
|
|
@@ -752,10 +781,8 @@
|
|
|
752
781
|
canAdd = props.canAdd,
|
|
753
782
|
_props$canRemove = props.canRemove,
|
|
754
783
|
canRemove = _props$canRemove === void 0 ? true : _props$canRemove,
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
_props$canMoveDown = props.canMoveDown,
|
|
758
|
-
canMoveDown = _props$canMoveDown === void 0 ? true : _props$canMoveDown,
|
|
784
|
+
canMoveUp = props.canMoveUp,
|
|
785
|
+
canMoveDown = props.canMoveDown,
|
|
759
786
|
itemSchema = props.itemSchema,
|
|
760
787
|
itemData = props.itemData,
|
|
761
788
|
itemUiSchema = props.itemUiSchema,
|
|
@@ -777,16 +804,20 @@
|
|
|
777
804
|
formContext = _this$props13.formContext;
|
|
778
805
|
var _registry$fields = registry.fields,
|
|
779
806
|
ArraySchemaField = _registry$fields.ArraySchemaField,
|
|
780
|
-
SchemaField = _registry$fields.SchemaField
|
|
807
|
+
SchemaField = _registry$fields.SchemaField,
|
|
808
|
+
globalUiOptions = registry.globalUiOptions;
|
|
781
809
|
var ItemSchemaField = ArraySchemaField || SchemaField;
|
|
782
|
-
var _getUiOptions5 = utils.getUiOptions(uiSchema),
|
|
810
|
+
var _getUiOptions5 = utils.getUiOptions(uiSchema, globalUiOptions),
|
|
783
811
|
_getUiOptions5$ordera = _getUiOptions5.orderable,
|
|
784
812
|
orderable = _getUiOptions5$ordera === void 0 ? true : _getUiOptions5$ordera,
|
|
785
813
|
_getUiOptions5$remova = _getUiOptions5.removable,
|
|
786
|
-
removable = _getUiOptions5$remova === void 0 ? true : _getUiOptions5$remova
|
|
814
|
+
removable = _getUiOptions5$remova === void 0 ? true : _getUiOptions5$remova,
|
|
815
|
+
_getUiOptions5$copyab = _getUiOptions5.copyable,
|
|
816
|
+
copyable = _getUiOptions5$copyab === void 0 ? false : _getUiOptions5$copyab;
|
|
787
817
|
var has = {
|
|
788
818
|
moveUp: orderable && canMoveUp,
|
|
789
819
|
moveDown: orderable && canMoveDown,
|
|
820
|
+
copy: copyable && canAdd,
|
|
790
821
|
remove: removable && canRemove,
|
|
791
822
|
toolbar: false
|
|
792
823
|
};
|
|
@@ -794,7 +825,7 @@
|
|
|
794
825
|
return has[key];
|
|
795
826
|
});
|
|
796
827
|
return {
|
|
797
|
-
children:
|
|
828
|
+
children: jsxRuntime.jsx(ItemSchemaField, {
|
|
798
829
|
name: name,
|
|
799
830
|
index: index,
|
|
800
831
|
schema: itemSchema,
|
|
@@ -816,9 +847,10 @@
|
|
|
816
847
|
autofocus: autofocus,
|
|
817
848
|
rawErrors: rawErrors
|
|
818
849
|
}),
|
|
819
|
-
className:
|
|
850
|
+
className: 'array-item',
|
|
820
851
|
disabled: disabled,
|
|
821
852
|
canAdd: canAdd,
|
|
853
|
+
hasCopy: has.copy,
|
|
822
854
|
hasToolbar: has.toolbar,
|
|
823
855
|
hasMoveUp: has.moveUp,
|
|
824
856
|
hasMoveDown: has.moveDown,
|
|
@@ -827,6 +859,7 @@
|
|
|
827
859
|
totalItems: totalItems,
|
|
828
860
|
key: key,
|
|
829
861
|
onAddIndexClick: this.onAddIndexClick,
|
|
862
|
+
onCopyIndexClick: this.onCopyIndexClick,
|
|
830
863
|
onDropIndexClick: this.onDropIndexClick,
|
|
831
864
|
onReorderClick: this.onReorderClick,
|
|
832
865
|
readonly: readonly,
|
|
@@ -842,11 +875,11 @@
|
|
|
842
875
|
schema = _this$props14.schema,
|
|
843
876
|
registry = _this$props14.registry;
|
|
844
877
|
var translateString = registry.translateString;
|
|
845
|
-
return get__default["default"](schema, [utils.ITEMS_KEY,
|
|
878
|
+
return get__default["default"](schema, [utils.ITEMS_KEY, 'title'], get__default["default"](schema, [utils.ITEMS_KEY, 'description'], translateString(utils.TranslatableString.ArrayItemTitle)));
|
|
846
879
|
}
|
|
847
880
|
}]);
|
|
848
881
|
return ArrayField;
|
|
849
|
-
}(
|
|
882
|
+
}(react.Component);
|
|
850
883
|
|
|
851
884
|
var _excluded$8 = ["widget"];
|
|
852
885
|
/** The `BooleanField` component is used to render a field in the schema is boolean. It constructs `enumOptions` for the
|
|
@@ -875,7 +908,7 @@
|
|
|
875
908
|
translateString = registry.translateString;
|
|
876
909
|
var _getUiOptions = utils.getUiOptions(uiSchema),
|
|
877
910
|
_getUiOptions$widget = _getUiOptions.widget,
|
|
878
|
-
widget = _getUiOptions$widget === void 0 ?
|
|
911
|
+
widget = _getUiOptions$widget === void 0 ? 'checkbox' : _getUiOptions$widget,
|
|
879
912
|
options = _objectWithoutPropertiesLoose(_getUiOptions, _excluded$8);
|
|
880
913
|
var Widget = utils.getWidget(schema, widget, widgets);
|
|
881
914
|
var yes = translateString(utils.TranslatableString.YesLabel);
|
|
@@ -900,7 +933,7 @@
|
|
|
900
933
|
var schemaWithEnumNames = schema;
|
|
901
934
|
var enums = (_schema$enum = schema["enum"]) != null ? _schema$enum : [true, false];
|
|
902
935
|
if (!schemaWithEnumNames.enumNames && enums.length === 2 && enums.every(function (v) {
|
|
903
|
-
return typeof v ===
|
|
936
|
+
return typeof v === 'boolean';
|
|
904
937
|
})) {
|
|
905
938
|
enumOptions = [{
|
|
906
939
|
value: enums[0],
|
|
@@ -917,13 +950,14 @@
|
|
|
917
950
|
});
|
|
918
951
|
}
|
|
919
952
|
}
|
|
920
|
-
return
|
|
953
|
+
return jsxRuntime.jsx(Widget, {
|
|
921
954
|
options: _extends({}, options, {
|
|
922
955
|
enumOptions: enumOptions
|
|
923
956
|
}),
|
|
924
957
|
schema: schema,
|
|
925
958
|
uiSchema: uiSchema,
|
|
926
959
|
id: idSchema.$id,
|
|
960
|
+
name: name,
|
|
927
961
|
onChange: onChange,
|
|
928
962
|
onFocus: onFocus,
|
|
929
963
|
onBlur: onBlur,
|
|
@@ -973,7 +1007,7 @@
|
|
|
973
1007
|
if (newFormData && newOption) {
|
|
974
1008
|
// Call getDefaultFormState to make sure defaults are populated on change. Pass "excludeObjectChildren"
|
|
975
1009
|
// so that only the root objects themselves are created without adding undefined children properties
|
|
976
|
-
newFormData = schemaUtils.getDefaultFormState(newOption, newFormData,
|
|
1010
|
+
newFormData = schemaUtils.getDefaultFormState(newOption, newFormData, 'excludeObjectChildren');
|
|
977
1011
|
}
|
|
978
1012
|
onChange(newFormData, undefined, _this.getFieldId());
|
|
979
1013
|
_this.setState({
|
|
@@ -1060,12 +1094,13 @@
|
|
|
1060
1094
|
var _this$props4 = this.props,
|
|
1061
1095
|
idSchema = _this$props4.idSchema,
|
|
1062
1096
|
schema = _this$props4.schema;
|
|
1063
|
-
return "" + idSchema.$id + (schema.oneOf ?
|
|
1097
|
+
return "" + idSchema.$id + (schema.oneOf ? '__oneof_select' : '__anyof_select');
|
|
1064
1098
|
}
|
|
1065
1099
|
/** Renders the `AnyOfField` selector along with a `SchemaField` for the value of the `formData`
|
|
1066
1100
|
*/;
|
|
1067
1101
|
_proto.render = function render() {
|
|
1068
1102
|
var _this$props5 = this.props,
|
|
1103
|
+
name = _this$props5.name,
|
|
1069
1104
|
baseType = _this$props5.baseType,
|
|
1070
1105
|
_this$props5$disabled = _this$props5.disabled,
|
|
1071
1106
|
disabled = _this$props5$disabled === void 0 ? false : _this$props5$disabled,
|
|
@@ -1086,7 +1121,7 @@
|
|
|
1086
1121
|
retrievedOptions = _this$state2.retrievedOptions;
|
|
1087
1122
|
var _getUiOptions = utils.getUiOptions(uiSchema),
|
|
1088
1123
|
_getUiOptions$widget = _getUiOptions.widget,
|
|
1089
|
-
widget = _getUiOptions$widget === void 0 ?
|
|
1124
|
+
widget = _getUiOptions$widget === void 0 ? 'select' : _getUiOptions$widget,
|
|
1090
1125
|
placeholder = _getUiOptions.placeholder,
|
|
1091
1126
|
autofocus = _getUiOptions.autofocus,
|
|
1092
1127
|
autocomplete = _getUiOptions.autocomplete,
|
|
@@ -1094,7 +1129,7 @@
|
|
|
1094
1129
|
title = _getUiOptions$title === void 0 ? schema.title : _getUiOptions$title,
|
|
1095
1130
|
uiOptions = _objectWithoutPropertiesLoose(_getUiOptions, _excluded$7);
|
|
1096
1131
|
var Widget = utils.getWidget({
|
|
1097
|
-
type:
|
|
1132
|
+
type: 'number'
|
|
1098
1133
|
}, widget, widgets);
|
|
1099
1134
|
var rawErrors = get__default["default"](errorSchema, utils.ERRORS_KEY, []);
|
|
1100
1135
|
var fieldErrorSchema = omit__default["default"](errorSchema, [utils.ERRORS_KEY]);
|
|
@@ -1115,39 +1150,42 @@
|
|
|
1115
1150
|
value: index
|
|
1116
1151
|
};
|
|
1117
1152
|
});
|
|
1118
|
-
return
|
|
1119
|
-
className:
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1153
|
+
return jsxRuntime.jsxs("div", {
|
|
1154
|
+
className: 'panel panel-default panel-body',
|
|
1155
|
+
children: [jsxRuntime.jsx("div", {
|
|
1156
|
+
className: 'form-group',
|
|
1157
|
+
children: jsxRuntime.jsx(Widget, {
|
|
1158
|
+
id: this.getFieldId(),
|
|
1159
|
+
name: "" + name + (schema.oneOf ? '__oneof_select' : '__anyof_select'),
|
|
1160
|
+
schema: {
|
|
1161
|
+
type: 'number',
|
|
1162
|
+
"default": 0
|
|
1163
|
+
},
|
|
1164
|
+
onChange: this.onOptionChange,
|
|
1165
|
+
onBlur: onBlur,
|
|
1166
|
+
onFocus: onFocus,
|
|
1167
|
+
disabled: disabled || isEmpty__default["default"](enumOptions),
|
|
1168
|
+
multiple: false,
|
|
1169
|
+
rawErrors: rawErrors,
|
|
1170
|
+
errorSchema: fieldErrorSchema,
|
|
1171
|
+
value: selectedOption >= 0 ? selectedOption : undefined,
|
|
1172
|
+
options: _extends({
|
|
1173
|
+
enumOptions: enumOptions
|
|
1174
|
+
}, uiOptions),
|
|
1175
|
+
registry: registry,
|
|
1176
|
+
formContext: formContext,
|
|
1177
|
+
placeholder: placeholder,
|
|
1178
|
+
autocomplete: autocomplete,
|
|
1179
|
+
autofocus: autofocus,
|
|
1180
|
+
label: ''
|
|
1181
|
+
})
|
|
1182
|
+
}), option !== null && jsxRuntime.jsx(_SchemaField, _extends({}, this.props, {
|
|
1183
|
+
schema: optionSchema
|
|
1184
|
+
}))]
|
|
1185
|
+
});
|
|
1148
1186
|
};
|
|
1149
1187
|
return AnyOfField;
|
|
1150
|
-
}(
|
|
1188
|
+
}(react.Component);
|
|
1151
1189
|
|
|
1152
1190
|
// Matches a string that ends in a . character, optionally followed by a sequence of
|
|
1153
1191
|
// digits followed by any number of 0 characters up until the end of the line.
|
|
@@ -1181,7 +1219,7 @@
|
|
|
1181
1219
|
onChange = props.onChange,
|
|
1182
1220
|
formData = props.formData,
|
|
1183
1221
|
initialValue = props.value;
|
|
1184
|
-
var _useState =
|
|
1222
|
+
var _useState = react.useState(initialValue),
|
|
1185
1223
|
lastValue = _useState[0],
|
|
1186
1224
|
setLastValue = _useState[1];
|
|
1187
1225
|
var StringField = registry.fields.StringField;
|
|
@@ -1190,32 +1228,32 @@
|
|
|
1190
1228
|
*
|
|
1191
1229
|
* @param value - The current value for the change occurring
|
|
1192
1230
|
*/
|
|
1193
|
-
var handleChange =
|
|
1231
|
+
var handleChange = react.useCallback(function (value) {
|
|
1194
1232
|
// Cache the original value in component state
|
|
1195
1233
|
setLastValue(value);
|
|
1196
1234
|
// Normalize decimals that don't start with a zero character in advance so
|
|
1197
1235
|
// that the rest of the normalization logic is simpler
|
|
1198
|
-
if (("" + value).charAt(0) ===
|
|
1236
|
+
if (("" + value).charAt(0) === '.') {
|
|
1199
1237
|
value = "0" + value;
|
|
1200
1238
|
}
|
|
1201
1239
|
// Check that the value is a string (this can happen if the widget used is a
|
|
1202
1240
|
// <select>, due to an enum declaration etc) then, if the value ends in a
|
|
1203
1241
|
// trailing decimal point or multiple zeroes, strip the trailing values
|
|
1204
|
-
var processed = typeof value ===
|
|
1242
|
+
var processed = typeof value === 'string' && value.match(trailingCharMatcherWithPrefix) ? utils.asNumber(value.replace(trailingCharMatcher, '')) : utils.asNumber(value);
|
|
1205
1243
|
onChange(processed);
|
|
1206
1244
|
}, [onChange]);
|
|
1207
|
-
if (typeof lastValue ===
|
|
1245
|
+
if (typeof lastValue === 'string' && typeof value === 'number') {
|
|
1208
1246
|
// Construct a regular expression that checks for a string that consists
|
|
1209
1247
|
// of the formData value suffixed with zero or one '.' characters and zero
|
|
1210
1248
|
// or more '0' characters
|
|
1211
|
-
var re = new RegExp(("" + value).replace(
|
|
1249
|
+
var re = new RegExp(("" + value).replace('.', '\\.') + '\\.?0*$');
|
|
1212
1250
|
// If the cached "lastValue" is a match, use that instead of the formData
|
|
1213
1251
|
// value to prevent the input value from changing in the UI
|
|
1214
1252
|
if (lastValue.match(re)) {
|
|
1215
1253
|
value = lastValue;
|
|
1216
1254
|
}
|
|
1217
1255
|
}
|
|
1218
|
-
return
|
|
1256
|
+
return jsxRuntime.jsx(StringField, _extends({}, props, {
|
|
1219
1257
|
formData: value,
|
|
1220
1258
|
onChange: handleChange
|
|
1221
1259
|
}));
|
|
@@ -1256,7 +1294,7 @@
|
|
|
1256
1294
|
// fields which are "mandated" by the schema, these fields can
|
|
1257
1295
|
// be set to undefined by clicking a "delete field" button, so
|
|
1258
1296
|
// set empty values to the empty string.
|
|
1259
|
-
value =
|
|
1297
|
+
value = '';
|
|
1260
1298
|
}
|
|
1261
1299
|
var newFormData = _extends({}, formData, (_extends2 = {}, _extends2[name] = value, _extends2));
|
|
1262
1300
|
onChange(newFormData, errorSchema && errorSchema && _extends({}, errorSchema, (_extends3 = {}, _extends3[name] = newErrorSchema, _extends3)), id);
|
|
@@ -1274,10 +1312,12 @@
|
|
|
1274
1312
|
};
|
|
1275
1313
|
};
|
|
1276
1314
|
_this.getAvailableKey = function (preferredKey, formData) {
|
|
1277
|
-
var
|
|
1278
|
-
|
|
1315
|
+
var _this$props3 = _this.props,
|
|
1316
|
+
uiSchema = _this$props3.uiSchema,
|
|
1317
|
+
registry = _this$props3.registry;
|
|
1318
|
+
var _getUiOptions = utils.getUiOptions(uiSchema, registry.globalUiOptions),
|
|
1279
1319
|
_getUiOptions$duplica = _getUiOptions.duplicateKeySuffixSeparator,
|
|
1280
|
-
duplicateKeySuffixSeparator = _getUiOptions$duplica === void 0 ?
|
|
1320
|
+
duplicateKeySuffixSeparator = _getUiOptions$duplica === void 0 ? '-' : _getUiOptions$duplica;
|
|
1281
1321
|
var index = 0;
|
|
1282
1322
|
var newKey = preferredKey;
|
|
1283
1323
|
while (has__default["default"](formData, newKey)) {
|
|
@@ -1291,10 +1331,10 @@
|
|
|
1291
1331
|
if (oldValue === value) {
|
|
1292
1332
|
return;
|
|
1293
1333
|
}
|
|
1294
|
-
var _this$
|
|
1295
|
-
formData = _this$
|
|
1296
|
-
onChange = _this$
|
|
1297
|
-
errorSchema = _this$
|
|
1334
|
+
var _this$props4 = _this.props,
|
|
1335
|
+
formData = _this$props4.formData,
|
|
1336
|
+
onChange = _this$props4.onChange,
|
|
1337
|
+
errorSchema = _this$props4.errorSchema;
|
|
1298
1338
|
value = _this.getAvailableKey(value, formData);
|
|
1299
1339
|
var newFormData = _extends({}, formData);
|
|
1300
1340
|
var newKeys = (_newKeys = {}, _newKeys[oldValue] = value, _newKeys);
|
|
@@ -1315,10 +1355,10 @@
|
|
|
1315
1355
|
if (!schema.additionalProperties) {
|
|
1316
1356
|
return;
|
|
1317
1357
|
}
|
|
1318
|
-
var _this$
|
|
1319
|
-
formData = _this$
|
|
1320
|
-
onChange = _this$
|
|
1321
|
-
registry = _this$
|
|
1358
|
+
var _this$props5 = _this.props,
|
|
1359
|
+
formData = _this$props5.formData,
|
|
1360
|
+
onChange = _this$props5.onChange,
|
|
1361
|
+
registry = _this$props5.registry;
|
|
1322
1362
|
var newFormData = _extends({}, formData);
|
|
1323
1363
|
var type = undefined;
|
|
1324
1364
|
if (isObject__default["default"](schema.additionalProperties)) {
|
|
@@ -1332,10 +1372,10 @@
|
|
|
1332
1372
|
type = apSchema.type;
|
|
1333
1373
|
}
|
|
1334
1374
|
if (!type && (utils.ANY_OF_KEY in apSchema || utils.ONE_OF_KEY in apSchema)) {
|
|
1335
|
-
type =
|
|
1375
|
+
type = 'object';
|
|
1336
1376
|
}
|
|
1337
1377
|
}
|
|
1338
|
-
var newKey = _this.getAvailableKey(
|
|
1378
|
+
var newKey = _this.getAvailableKey('newKey', newFormData);
|
|
1339
1379
|
// Cast this to make the `set` work properly
|
|
1340
1380
|
set__default["default"](newFormData, newKey, _this.getDefaultValue(type));
|
|
1341
1381
|
onChange(newFormData);
|
|
@@ -1368,17 +1408,17 @@
|
|
|
1368
1408
|
_proto.getDefaultValue = function getDefaultValue(type) {
|
|
1369
1409
|
var translateString = this.props.registry.translateString;
|
|
1370
1410
|
switch (type) {
|
|
1371
|
-
case
|
|
1411
|
+
case 'array':
|
|
1372
1412
|
return [];
|
|
1373
|
-
case
|
|
1413
|
+
case 'boolean':
|
|
1374
1414
|
return false;
|
|
1375
|
-
case
|
|
1415
|
+
case 'null':
|
|
1376
1416
|
return null;
|
|
1377
|
-
case
|
|
1417
|
+
case 'number':
|
|
1378
1418
|
return 0;
|
|
1379
|
-
case
|
|
1419
|
+
case 'object':
|
|
1380
1420
|
return {};
|
|
1381
|
-
case
|
|
1421
|
+
case 'string':
|
|
1382
1422
|
default:
|
|
1383
1423
|
// We don't have a datatype for some reason (perhaps additionalProperties was true)
|
|
1384
1424
|
return translateString(utils.TranslatableString.NewStringDefault);
|
|
@@ -1393,60 +1433,67 @@
|
|
|
1393
1433
|
*/
|
|
1394
1434
|
_proto.render = function render() {
|
|
1395
1435
|
var _this2 = this;
|
|
1396
|
-
var _this$
|
|
1397
|
-
rawSchema = _this$
|
|
1398
|
-
_this$
|
|
1399
|
-
uiSchema = _this$
|
|
1400
|
-
formData = _this$
|
|
1401
|
-
errorSchema = _this$
|
|
1402
|
-
idSchema = _this$
|
|
1403
|
-
name = _this$
|
|
1404
|
-
_this$
|
|
1405
|
-
required = _this$
|
|
1406
|
-
_this$
|
|
1407
|
-
disabled = _this$
|
|
1408
|
-
_this$
|
|
1409
|
-
readonly = _this$
|
|
1410
|
-
hideError = _this$
|
|
1411
|
-
idPrefix = _this$
|
|
1412
|
-
idSeparator = _this$
|
|
1413
|
-
onBlur = _this$
|
|
1414
|
-
onFocus = _this$
|
|
1415
|
-
registry = _this$
|
|
1436
|
+
var _this$props6 = this.props,
|
|
1437
|
+
rawSchema = _this$props6.schema,
|
|
1438
|
+
_this$props6$uiSchema = _this$props6.uiSchema,
|
|
1439
|
+
uiSchema = _this$props6$uiSchema === void 0 ? {} : _this$props6$uiSchema,
|
|
1440
|
+
formData = _this$props6.formData,
|
|
1441
|
+
errorSchema = _this$props6.errorSchema,
|
|
1442
|
+
idSchema = _this$props6.idSchema,
|
|
1443
|
+
name = _this$props6.name,
|
|
1444
|
+
_this$props6$required = _this$props6.required,
|
|
1445
|
+
required = _this$props6$required === void 0 ? false : _this$props6$required,
|
|
1446
|
+
_this$props6$disabled = _this$props6.disabled,
|
|
1447
|
+
disabled = _this$props6$disabled === void 0 ? false : _this$props6$disabled,
|
|
1448
|
+
_this$props6$readonly = _this$props6.readonly,
|
|
1449
|
+
readonly = _this$props6$readonly === void 0 ? false : _this$props6$readonly,
|
|
1450
|
+
hideError = _this$props6.hideError,
|
|
1451
|
+
idPrefix = _this$props6.idPrefix,
|
|
1452
|
+
idSeparator = _this$props6.idSeparator,
|
|
1453
|
+
onBlur = _this$props6.onBlur,
|
|
1454
|
+
onFocus = _this$props6.onFocus,
|
|
1455
|
+
registry = _this$props6.registry;
|
|
1416
1456
|
var fields = registry.fields,
|
|
1417
1457
|
formContext = registry.formContext,
|
|
1418
|
-
schemaUtils = registry.schemaUtils
|
|
1458
|
+
schemaUtils = registry.schemaUtils,
|
|
1459
|
+
translateString = registry.translateString;
|
|
1419
1460
|
var SchemaField = fields.SchemaField;
|
|
1420
1461
|
var schema = schemaUtils.retrieveSchema(rawSchema, formData);
|
|
1421
1462
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
1422
1463
|
var _schema$properties = schema.properties,
|
|
1423
1464
|
schemaProperties = _schema$properties === void 0 ? {} : _schema$properties;
|
|
1424
|
-
var title = schema.title === undefined ? name : schema.title;
|
|
1465
|
+
var title = uiOptions.title || (schema.title === undefined ? name : schema.title);
|
|
1425
1466
|
var description = uiOptions.description || schema.description;
|
|
1426
1467
|
var orderedProperties;
|
|
1427
1468
|
try {
|
|
1428
1469
|
var properties = Object.keys(schemaProperties);
|
|
1429
1470
|
orderedProperties = utils.orderProperties(properties, uiOptions.order);
|
|
1430
1471
|
} catch (err) {
|
|
1431
|
-
return
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1472
|
+
return jsxRuntime.jsxs("div", {
|
|
1473
|
+
children: [jsxRuntime.jsx("p", {
|
|
1474
|
+
className: 'config-error',
|
|
1475
|
+
style: {
|
|
1476
|
+
color: 'red'
|
|
1477
|
+
},
|
|
1478
|
+
children: jsxRuntime.jsx(Markdown__default["default"], {
|
|
1479
|
+
children: translateString(utils.TranslatableString.InvalidObjectField, [name || 'root', err.message])
|
|
1480
|
+
})
|
|
1481
|
+
}), jsxRuntime.jsx("pre", {
|
|
1482
|
+
children: JSON.stringify(schema)
|
|
1483
|
+
})]
|
|
1484
|
+
});
|
|
1437
1485
|
}
|
|
1438
|
-
var Template = utils.getTemplate(
|
|
1486
|
+
var Template = utils.getTemplate('ObjectFieldTemplate', registry, uiOptions);
|
|
1439
1487
|
var templateProps = {
|
|
1440
|
-
title:
|
|
1488
|
+
title: title,
|
|
1441
1489
|
description: description,
|
|
1442
1490
|
properties: orderedProperties.map(function (name) {
|
|
1443
1491
|
var addedByAdditionalProperties = has__default["default"](schema, [utils.PROPERTIES_KEY, name, utils.ADDITIONAL_PROPERTY_FLAG]);
|
|
1444
1492
|
var fieldUiSchema = addedByAdditionalProperties ? uiSchema.additionalProperties : uiSchema[name];
|
|
1445
|
-
var hidden = utils.getUiOptions(fieldUiSchema).widget ===
|
|
1493
|
+
var hidden = utils.getUiOptions(fieldUiSchema).widget === 'hidden';
|
|
1446
1494
|
var fieldIdSchema = get__default["default"](idSchema, [name], {});
|
|
1447
1495
|
return {
|
|
1448
|
-
content:
|
|
1449
|
-
key: name,
|
|
1496
|
+
content: jsxRuntime.jsx(SchemaField, {
|
|
1450
1497
|
name: name,
|
|
1451
1498
|
required: _this2.isRequired(name),
|
|
1452
1499
|
schema: get__default["default"](schema, [utils.PROPERTIES_KEY, name], {}),
|
|
@@ -1467,7 +1514,7 @@
|
|
|
1467
1514
|
readonly: readonly,
|
|
1468
1515
|
hideError: hideError,
|
|
1469
1516
|
onDropPropertyClick: _this2.onDropPropertyClick
|
|
1470
|
-
}),
|
|
1517
|
+
}, name),
|
|
1471
1518
|
name: name,
|
|
1472
1519
|
readonly: readonly,
|
|
1473
1520
|
disabled: disabled,
|
|
@@ -1485,23 +1532,23 @@
|
|
|
1485
1532
|
formContext: formContext,
|
|
1486
1533
|
registry: registry
|
|
1487
1534
|
};
|
|
1488
|
-
return
|
|
1535
|
+
return jsxRuntime.jsx(Template, _extends({}, templateProps, {
|
|
1489
1536
|
onAddClick: this.handleAddClick
|
|
1490
1537
|
}));
|
|
1491
1538
|
};
|
|
1492
1539
|
return ObjectField;
|
|
1493
|
-
}(
|
|
1540
|
+
}(react.Component);
|
|
1494
1541
|
|
|
1495
1542
|
var _excluded$6 = ["__errors"];
|
|
1496
1543
|
/** The map of component type to FieldName */
|
|
1497
1544
|
var COMPONENT_TYPES = {
|
|
1498
|
-
array:
|
|
1499
|
-
"boolean":
|
|
1500
|
-
integer:
|
|
1501
|
-
number:
|
|
1502
|
-
object:
|
|
1503
|
-
string:
|
|
1504
|
-
"null":
|
|
1545
|
+
array: 'ArrayField',
|
|
1546
|
+
"boolean": 'BooleanField',
|
|
1547
|
+
integer: 'NumberField',
|
|
1548
|
+
number: 'NumberField',
|
|
1549
|
+
object: 'ObjectField',
|
|
1550
|
+
string: 'StringField',
|
|
1551
|
+
"null": 'NullField'
|
|
1505
1552
|
};
|
|
1506
1553
|
/** Computes and returns which `Field` implementation to return in order to render the field represented by the
|
|
1507
1554
|
* `schema`. The `uiOptions` are used to alter what potential `Field` implementation is actually returned. If no
|
|
@@ -1517,14 +1564,14 @@
|
|
|
1517
1564
|
var field = uiOptions.field;
|
|
1518
1565
|
var fields = registry.fields,
|
|
1519
1566
|
translateString = registry.translateString;
|
|
1520
|
-
if (typeof field ===
|
|
1567
|
+
if (typeof field === 'function') {
|
|
1521
1568
|
return field;
|
|
1522
1569
|
}
|
|
1523
|
-
if (typeof field ===
|
|
1570
|
+
if (typeof field === 'string' && field in fields) {
|
|
1524
1571
|
return fields[field];
|
|
1525
1572
|
}
|
|
1526
1573
|
var schemaType = utils.getSchemaType(schema);
|
|
1527
|
-
var type = Array.isArray(schemaType) ? schemaType[0] : schemaType ||
|
|
1574
|
+
var type = Array.isArray(schemaType) ? schemaType[0] : schemaType || '';
|
|
1528
1575
|
var componentName = COMPONENT_TYPES[type];
|
|
1529
1576
|
// If the type is not defined and the schema uses 'anyOf' or 'oneOf', don't
|
|
1530
1577
|
// render a field and let the MultiSchemaField component handle the form display
|
|
@@ -1534,8 +1581,8 @@
|
|
|
1534
1581
|
};
|
|
1535
1582
|
}
|
|
1536
1583
|
return componentName in fields ? fields[componentName] : function () {
|
|
1537
|
-
var UnsupportedFieldTemplate = utils.getTemplate(
|
|
1538
|
-
return
|
|
1584
|
+
var UnsupportedFieldTemplate = utils.getTemplate('UnsupportedFieldTemplate', registry, uiOptions);
|
|
1585
|
+
return jsxRuntime.jsx(UnsupportedFieldTemplate, {
|
|
1539
1586
|
schema: schema,
|
|
1540
1587
|
idSchema: idSchema,
|
|
1541
1588
|
reason: translateString(utils.TranslatableString.UnknownFieldType, [String(schema.type)]),
|
|
@@ -1566,19 +1613,20 @@
|
|
|
1566
1613
|
_props$wasPropertyKey = props.wasPropertyKeyModified,
|
|
1567
1614
|
wasPropertyKeyModified = _props$wasPropertyKey === void 0 ? false : _props$wasPropertyKey;
|
|
1568
1615
|
var formContext = registry.formContext,
|
|
1569
|
-
schemaUtils = registry.schemaUtils
|
|
1570
|
-
|
|
1571
|
-
var
|
|
1572
|
-
var
|
|
1573
|
-
var
|
|
1574
|
-
var
|
|
1616
|
+
schemaUtils = registry.schemaUtils,
|
|
1617
|
+
globalUiOptions = registry.globalUiOptions;
|
|
1618
|
+
var uiOptions = utils.getUiOptions(uiSchema, globalUiOptions);
|
|
1619
|
+
var FieldTemplate = utils.getTemplate('FieldTemplate', registry, uiOptions);
|
|
1620
|
+
var DescriptionFieldTemplate = utils.getTemplate('DescriptionFieldTemplate', registry, uiOptions);
|
|
1621
|
+
var FieldHelpTemplate = utils.getTemplate('FieldHelpTemplate', registry, uiOptions);
|
|
1622
|
+
var FieldErrorTemplate = utils.getTemplate('FieldErrorTemplate', registry, uiOptions);
|
|
1575
1623
|
var schema = schemaUtils.retrieveSchema(_schema, formData);
|
|
1576
1624
|
var fieldId = _idSchema[utils.ID_KEY];
|
|
1577
1625
|
var idSchema = utils.mergeObjects(schemaUtils.toIdSchema(schema, fieldId, formData, idPrefix, idSeparator), _idSchema);
|
|
1578
1626
|
/** Intermediary `onChange` handler for field components that will inject the `id` of the current field into the
|
|
1579
1627
|
* `onChange` chain if it is not already being provided from a deeper level in the hierarchy
|
|
1580
1628
|
*/
|
|
1581
|
-
var handleFieldComponentChange =
|
|
1629
|
+
var handleFieldComponentChange = react.useCallback(function (formData, newErrorSchema, id) {
|
|
1582
1630
|
var theId = id || fieldId;
|
|
1583
1631
|
return onChange(formData, newErrorSchema, theId);
|
|
1584
1632
|
}, [fieldId, onChange]);
|
|
@@ -1592,16 +1640,16 @@
|
|
|
1592
1640
|
if (Object.keys(schema).length === 0) {
|
|
1593
1641
|
return null;
|
|
1594
1642
|
}
|
|
1595
|
-
var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema);
|
|
1643
|
+
var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);
|
|
1596
1644
|
var _ref = errorSchema || {},
|
|
1597
1645
|
__errors = _ref.__errors,
|
|
1598
1646
|
fieldErrorSchema = _objectWithoutPropertiesLoose(_ref, _excluded$6);
|
|
1599
1647
|
// See #439: uiSchema: Don't pass consumed class names or style to child components
|
|
1600
|
-
var fieldUiSchema = omit__default["default"](uiSchema, [
|
|
1648
|
+
var fieldUiSchema = omit__default["default"](uiSchema, ['ui:classNames', 'classNames', 'ui:style']);
|
|
1601
1649
|
if (utils.UI_OPTIONS_KEY in fieldUiSchema) {
|
|
1602
|
-
fieldUiSchema[utils.UI_OPTIONS_KEY] = omit__default["default"](fieldUiSchema[utils.UI_OPTIONS_KEY], [
|
|
1650
|
+
fieldUiSchema[utils.UI_OPTIONS_KEY] = omit__default["default"](fieldUiSchema[utils.UI_OPTIONS_KEY], ['classNames', 'style']);
|
|
1603
1651
|
}
|
|
1604
|
-
var field =
|
|
1652
|
+
var field = jsxRuntime.jsx(FieldComponent, _extends({}, props, {
|
|
1605
1653
|
onChange: handleFieldComponentChange,
|
|
1606
1654
|
idSchema: idSchema,
|
|
1607
1655
|
schema: schema,
|
|
@@ -1622,12 +1670,12 @@
|
|
|
1622
1670
|
} else {
|
|
1623
1671
|
label = utils.ADDITIONAL_PROPERTY_FLAG in schema ? name : uiOptions.title || props.schema.title || schema.title || name;
|
|
1624
1672
|
}
|
|
1625
|
-
var description = uiOptions.description || props.schema.description || schema.description ||
|
|
1673
|
+
var description = uiOptions.description || props.schema.description || schema.description || '';
|
|
1626
1674
|
var help = uiOptions.help;
|
|
1627
|
-
var hidden = uiOptions.widget ===
|
|
1628
|
-
var classNames = [
|
|
1675
|
+
var hidden = uiOptions.widget === 'hidden';
|
|
1676
|
+
var classNames = ['form-group', 'field', "field-" + schema.type];
|
|
1629
1677
|
if (!hideError && __errors && __errors.length > 0) {
|
|
1630
|
-
classNames.push(
|
|
1678
|
+
classNames.push('field-error has-error has-danger');
|
|
1631
1679
|
}
|
|
1632
1680
|
if (uiSchema !== null && uiSchema !== void 0 && uiSchema.classNames) {
|
|
1633
1681
|
{
|
|
@@ -1638,7 +1686,7 @@
|
|
|
1638
1686
|
if (uiOptions.classNames) {
|
|
1639
1687
|
classNames.push(uiOptions.classNames);
|
|
1640
1688
|
}
|
|
1641
|
-
var helpComponent =
|
|
1689
|
+
var helpComponent = jsxRuntime.jsx(FieldHelpTemplate, {
|
|
1642
1690
|
help: help,
|
|
1643
1691
|
idSchema: idSchema,
|
|
1644
1692
|
schema: schema,
|
|
@@ -1646,7 +1694,7 @@
|
|
|
1646
1694
|
hasErrors: !hideError && __errors && __errors.length > 0,
|
|
1647
1695
|
registry: registry
|
|
1648
1696
|
});
|
|
1649
|
-
var errorsComponent = hideError ? undefined :
|
|
1697
|
+
var errorsComponent = hideError ? undefined : jsxRuntime.jsx(FieldErrorTemplate, {
|
|
1650
1698
|
errors: __errors,
|
|
1651
1699
|
errorSchema: errorSchema,
|
|
1652
1700
|
idSchema: idSchema,
|
|
@@ -1655,7 +1703,7 @@
|
|
|
1655
1703
|
registry: registry
|
|
1656
1704
|
});
|
|
1657
1705
|
var fieldProps = {
|
|
1658
|
-
description:
|
|
1706
|
+
description: jsxRuntime.jsx(DescriptionFieldTemplate, {
|
|
1659
1707
|
id: utils.descriptionId(id),
|
|
1660
1708
|
description: description,
|
|
1661
1709
|
schema: schema,
|
|
@@ -1664,7 +1712,7 @@
|
|
|
1664
1712
|
}),
|
|
1665
1713
|
rawDescription: description,
|
|
1666
1714
|
help: helpComponent,
|
|
1667
|
-
rawHelp: typeof help ===
|
|
1715
|
+
rawHelp: typeof help === 'string' ? help : undefined,
|
|
1668
1716
|
errors: errorsComponent,
|
|
1669
1717
|
rawErrors: hideError ? undefined : __errors,
|
|
1670
1718
|
id: id,
|
|
@@ -1678,7 +1726,7 @@
|
|
|
1678
1726
|
readonly: readonly,
|
|
1679
1727
|
hideError: hideError,
|
|
1680
1728
|
displayLabel: displayLabel,
|
|
1681
|
-
classNames: classNames.join(
|
|
1729
|
+
classNames: classNames.join(' ').trim(),
|
|
1682
1730
|
style: uiOptions.style,
|
|
1683
1731
|
formContext: formContext,
|
|
1684
1732
|
formData: formData,
|
|
@@ -1688,68 +1736,72 @@
|
|
|
1688
1736
|
};
|
|
1689
1737
|
var _AnyOfField = registry.fields.AnyOfField;
|
|
1690
1738
|
var _OneOfField = registry.fields.OneOfField;
|
|
1691
|
-
var isReplacingAnyOrOneOf = (uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema[
|
|
1692
|
-
return
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1739
|
+
var isReplacingAnyOrOneOf = (uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema['ui:field']) && (uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema['ui:fieldReplacesAnyOrOneOf']) === true;
|
|
1740
|
+
return jsxRuntime.jsx(FieldTemplate, _extends({}, fieldProps, {
|
|
1741
|
+
children: jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1742
|
+
children: [field, schema.anyOf && !isReplacingAnyOrOneOf && !schemaUtils.isSelect(schema) && jsxRuntime.jsx(_AnyOfField, {
|
|
1743
|
+
name: name,
|
|
1744
|
+
disabled: disabled,
|
|
1745
|
+
readonly: readonly,
|
|
1746
|
+
hideError: hideError,
|
|
1747
|
+
errorSchema: errorSchema,
|
|
1748
|
+
formData: formData,
|
|
1749
|
+
formContext: formContext,
|
|
1750
|
+
idPrefix: idPrefix,
|
|
1751
|
+
idSchema: idSchema,
|
|
1752
|
+
idSeparator: idSeparator,
|
|
1753
|
+
onBlur: props.onBlur,
|
|
1754
|
+
onChange: props.onChange,
|
|
1755
|
+
onFocus: props.onFocus,
|
|
1756
|
+
options: schema.anyOf.map(function (_schema) {
|
|
1757
|
+
return schemaUtils.retrieveSchema(isObject__default["default"](_schema) ? _schema : {}, formData);
|
|
1758
|
+
}),
|
|
1759
|
+
baseType: schema.type,
|
|
1760
|
+
registry: registry,
|
|
1761
|
+
schema: schema,
|
|
1762
|
+
uiSchema: uiSchema
|
|
1763
|
+
}), schema.oneOf && !isReplacingAnyOrOneOf && !schemaUtils.isSelect(schema) && jsxRuntime.jsx(_OneOfField, {
|
|
1764
|
+
name: name,
|
|
1765
|
+
disabled: disabled,
|
|
1766
|
+
readonly: readonly,
|
|
1767
|
+
hideError: hideError,
|
|
1768
|
+
errorSchema: errorSchema,
|
|
1769
|
+
formData: formData,
|
|
1770
|
+
formContext: formContext,
|
|
1771
|
+
idPrefix: idPrefix,
|
|
1772
|
+
idSchema: idSchema,
|
|
1773
|
+
idSeparator: idSeparator,
|
|
1774
|
+
onBlur: props.onBlur,
|
|
1775
|
+
onChange: props.onChange,
|
|
1776
|
+
onFocus: props.onFocus,
|
|
1777
|
+
options: schema.oneOf.map(function (_schema) {
|
|
1778
|
+
return schemaUtils.retrieveSchema(isObject__default["default"](_schema) ? _schema : {}, formData);
|
|
1779
|
+
}),
|
|
1780
|
+
baseType: schema.type,
|
|
1781
|
+
registry: registry,
|
|
1782
|
+
schema: schema,
|
|
1783
|
+
uiSchema: uiSchema
|
|
1784
|
+
})]
|
|
1785
|
+
})
|
|
1786
|
+
}));
|
|
1735
1787
|
}
|
|
1736
1788
|
/** The `SchemaField` component determines whether it is necessary to rerender the component based on any props changes
|
|
1737
1789
|
* and if so, calls the `SchemaFieldRender` component with the props.
|
|
1738
1790
|
*/
|
|
1739
|
-
var SchemaField = /*#__PURE__*/function (
|
|
1740
|
-
_inheritsLoose(SchemaField,
|
|
1791
|
+
var SchemaField = /*#__PURE__*/function (_Component) {
|
|
1792
|
+
_inheritsLoose(SchemaField, _Component);
|
|
1741
1793
|
function SchemaField() {
|
|
1742
|
-
return
|
|
1794
|
+
return _Component.apply(this, arguments) || this;
|
|
1743
1795
|
}
|
|
1744
1796
|
var _proto = SchemaField.prototype;
|
|
1745
1797
|
_proto.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {
|
|
1746
1798
|
return !utils.deepEquals(this.props, nextProps);
|
|
1747
1799
|
};
|
|
1748
1800
|
_proto.render = function render() {
|
|
1749
|
-
return
|
|
1801
|
+
return jsxRuntime.jsx(SchemaFieldRender, _extends({}, this.props));
|
|
1750
1802
|
};
|
|
1751
1803
|
return SchemaField;
|
|
1752
|
-
}(
|
|
1804
|
+
}(react.Component);
|
|
1753
1805
|
|
|
1754
1806
|
var _excluded$5 = ["widget", "placeholder"];
|
|
1755
1807
|
/** The `StringField` component is used to render a schema field that represents a string type
|
|
@@ -1780,7 +1832,7 @@
|
|
|
1780
1832
|
formContext = registry.formContext,
|
|
1781
1833
|
schemaUtils = registry.schemaUtils;
|
|
1782
1834
|
var enumOptions = schemaUtils.isSelect(schema) ? utils.optionsList(schema) : undefined;
|
|
1783
|
-
var defaultWidget = enumOptions ?
|
|
1835
|
+
var defaultWidget = enumOptions ? 'select' : 'text';
|
|
1784
1836
|
if (format && utils.hasWidget(schema, format, widgets)) {
|
|
1785
1837
|
defaultWidget = format;
|
|
1786
1838
|
}
|
|
@@ -1788,16 +1840,17 @@
|
|
|
1788
1840
|
_getUiOptions$widget = _getUiOptions.widget,
|
|
1789
1841
|
widget = _getUiOptions$widget === void 0 ? defaultWidget : _getUiOptions$widget,
|
|
1790
1842
|
_getUiOptions$placeho = _getUiOptions.placeholder,
|
|
1791
|
-
placeholder = _getUiOptions$placeho === void 0 ?
|
|
1843
|
+
placeholder = _getUiOptions$placeho === void 0 ? '' : _getUiOptions$placeho,
|
|
1792
1844
|
options = _objectWithoutPropertiesLoose(_getUiOptions, _excluded$5);
|
|
1793
1845
|
var Widget = utils.getWidget(schema, widget, widgets);
|
|
1794
|
-
return
|
|
1846
|
+
return jsxRuntime.jsx(Widget, {
|
|
1795
1847
|
options: _extends({}, options, {
|
|
1796
1848
|
enumOptions: enumOptions
|
|
1797
1849
|
}),
|
|
1798
1850
|
schema: schema,
|
|
1799
1851
|
uiSchema: uiSchema,
|
|
1800
1852
|
id: idSchema.$id,
|
|
1853
|
+
name: name,
|
|
1801
1854
|
label: title === undefined ? name : title,
|
|
1802
1855
|
value: formData,
|
|
1803
1856
|
onChange: onChange,
|
|
@@ -1822,7 +1875,7 @@
|
|
|
1822
1875
|
function NullField(props) {
|
|
1823
1876
|
var formData = props.formData,
|
|
1824
1877
|
onChange = props.onChange;
|
|
1825
|
-
|
|
1878
|
+
react.useEffect(function () {
|
|
1826
1879
|
if (formData === undefined) {
|
|
1827
1880
|
onChange(null);
|
|
1828
1881
|
}
|
|
@@ -1862,8 +1915,8 @@
|
|
|
1862
1915
|
if (!description || !displayLabel) {
|
|
1863
1916
|
return null;
|
|
1864
1917
|
}
|
|
1865
|
-
var DescriptionFieldTemplate = utils.getTemplate(
|
|
1866
|
-
return
|
|
1918
|
+
var DescriptionFieldTemplate = utils.getTemplate('DescriptionFieldTemplate', registry, options);
|
|
1919
|
+
return jsxRuntime.jsx(DescriptionFieldTemplate, {
|
|
1867
1920
|
id: utils.descriptionId(idSchema),
|
|
1868
1921
|
description: description,
|
|
1869
1922
|
schema: schema,
|
|
@@ -1884,13 +1937,16 @@
|
|
|
1884
1937
|
hasMoveDown = props.hasMoveDown,
|
|
1885
1938
|
hasMoveUp = props.hasMoveUp,
|
|
1886
1939
|
hasRemove = props.hasRemove,
|
|
1940
|
+
hasCopy = props.hasCopy,
|
|
1887
1941
|
index = props.index,
|
|
1942
|
+
onCopyIndexClick = props.onCopyIndexClick,
|
|
1888
1943
|
onDropIndexClick = props.onDropIndexClick,
|
|
1889
1944
|
onReorderClick = props.onReorderClick,
|
|
1890
1945
|
readonly = props.readonly,
|
|
1891
1946
|
registry = props.registry,
|
|
1892
1947
|
uiSchema = props.uiSchema;
|
|
1893
1948
|
var _registry$templates$B = registry.templates.ButtonTemplates,
|
|
1949
|
+
CopyButton = _registry$templates$B.CopyButton,
|
|
1894
1950
|
MoveDownButton = _registry$templates$B.MoveDownButton,
|
|
1895
1951
|
MoveUpButton = _registry$templates$B.MoveUpButton,
|
|
1896
1952
|
RemoveButton = _registry$templates$B.RemoveButton;
|
|
@@ -1898,39 +1954,49 @@
|
|
|
1898
1954
|
flex: 1,
|
|
1899
1955
|
paddingLeft: 6,
|
|
1900
1956
|
paddingRight: 6,
|
|
1901
|
-
fontWeight:
|
|
1957
|
+
fontWeight: 'bold'
|
|
1902
1958
|
};
|
|
1903
|
-
return
|
|
1904
|
-
className: className
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1959
|
+
return jsxRuntime.jsxs("div", {
|
|
1960
|
+
className: className,
|
|
1961
|
+
children: [jsxRuntime.jsx("div", {
|
|
1962
|
+
className: hasToolbar ? 'col-xs-9' : 'col-xs-12',
|
|
1963
|
+
children: children
|
|
1964
|
+
}), hasToolbar && jsxRuntime.jsx("div", {
|
|
1965
|
+
className: 'col-xs-3 array-item-toolbox',
|
|
1966
|
+
children: jsxRuntime.jsxs("div", {
|
|
1967
|
+
className: 'btn-group',
|
|
1968
|
+
style: {
|
|
1969
|
+
display: 'flex',
|
|
1970
|
+
justifyContent: 'space-around'
|
|
1971
|
+
},
|
|
1972
|
+
children: [(hasMoveUp || hasMoveDown) && jsxRuntime.jsx(MoveUpButton, {
|
|
1973
|
+
style: btnStyle,
|
|
1974
|
+
disabled: disabled || readonly || !hasMoveUp,
|
|
1975
|
+
onClick: onReorderClick(index, index - 1),
|
|
1976
|
+
uiSchema: uiSchema,
|
|
1977
|
+
registry: registry
|
|
1978
|
+
}), (hasMoveUp || hasMoveDown) && jsxRuntime.jsx(MoveDownButton, {
|
|
1979
|
+
style: btnStyle,
|
|
1980
|
+
disabled: disabled || readonly || !hasMoveDown,
|
|
1981
|
+
onClick: onReorderClick(index, index + 1),
|
|
1982
|
+
uiSchema: uiSchema,
|
|
1983
|
+
registry: registry
|
|
1984
|
+
}), hasCopy && jsxRuntime.jsx(CopyButton, {
|
|
1985
|
+
style: btnStyle,
|
|
1986
|
+
disabled: disabled || readonly,
|
|
1987
|
+
onClick: onCopyIndexClick(index),
|
|
1988
|
+
uiSchema: uiSchema,
|
|
1989
|
+
registry: registry
|
|
1990
|
+
}), hasRemove && jsxRuntime.jsx(RemoveButton, {
|
|
1991
|
+
style: btnStyle,
|
|
1992
|
+
disabled: disabled || readonly,
|
|
1993
|
+
onClick: onDropIndexClick(index),
|
|
1994
|
+
uiSchema: uiSchema,
|
|
1995
|
+
registry: registry
|
|
1996
|
+
})]
|
|
1997
|
+
})
|
|
1998
|
+
})]
|
|
1999
|
+
});
|
|
1934
2000
|
}
|
|
1935
2001
|
|
|
1936
2002
|
var _excluded$4 = ["key"];
|
|
@@ -1952,42 +2018,42 @@
|
|
|
1952
2018
|
schema = props.schema,
|
|
1953
2019
|
title = props.title;
|
|
1954
2020
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
1955
|
-
var ArrayFieldDescriptionTemplate = utils.getTemplate(
|
|
1956
|
-
var ArrayFieldItemTemplate = utils.getTemplate(
|
|
1957
|
-
var ArrayFieldTitleTemplate = utils.getTemplate(
|
|
2021
|
+
var ArrayFieldDescriptionTemplate = utils.getTemplate('ArrayFieldDescriptionTemplate', registry, uiOptions);
|
|
2022
|
+
var ArrayFieldItemTemplate = utils.getTemplate('ArrayFieldItemTemplate', registry, uiOptions);
|
|
2023
|
+
var ArrayFieldTitleTemplate = utils.getTemplate('ArrayFieldTitleTemplate', registry, uiOptions);
|
|
1958
2024
|
// Button templates are not overridden in the uiSchema
|
|
1959
2025
|
var AddButton = registry.templates.ButtonTemplates.AddButton;
|
|
1960
|
-
return
|
|
2026
|
+
return jsxRuntime.jsxs("fieldset", {
|
|
1961
2027
|
className: className,
|
|
1962
|
-
id: idSchema.$id
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
},
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
})
|
|
2028
|
+
id: idSchema.$id,
|
|
2029
|
+
children: [jsxRuntime.jsx(ArrayFieldTitleTemplate, {
|
|
2030
|
+
idSchema: idSchema,
|
|
2031
|
+
title: uiOptions.title || title,
|
|
2032
|
+
required: required,
|
|
2033
|
+
schema: schema,
|
|
2034
|
+
uiSchema: uiSchema,
|
|
2035
|
+
registry: registry
|
|
2036
|
+
}), jsxRuntime.jsx(ArrayFieldDescriptionTemplate, {
|
|
2037
|
+
idSchema: idSchema,
|
|
2038
|
+
description: uiOptions.description || schema.description,
|
|
2039
|
+
schema: schema,
|
|
2040
|
+
uiSchema: uiSchema,
|
|
2041
|
+
registry: registry
|
|
2042
|
+
}), jsxRuntime.jsx("div", {
|
|
2043
|
+
className: 'row array-item-list',
|
|
2044
|
+
children: items && items.map(function (_ref) {
|
|
2045
|
+
var key = _ref.key,
|
|
2046
|
+
itemProps = _objectWithoutPropertiesLoose(_ref, _excluded$4);
|
|
2047
|
+
return jsxRuntime.jsx(ArrayFieldItemTemplate, _extends({}, itemProps), key);
|
|
2048
|
+
})
|
|
2049
|
+
}), canAdd && jsxRuntime.jsx(AddButton, {
|
|
2050
|
+
className: 'array-item-add',
|
|
2051
|
+
onClick: onAddClick,
|
|
2052
|
+
disabled: disabled || readonly,
|
|
2053
|
+
uiSchema: uiSchema,
|
|
2054
|
+
registry: registry
|
|
2055
|
+
})]
|
|
2056
|
+
});
|
|
1991
2057
|
}
|
|
1992
2058
|
|
|
1993
2059
|
/** The `ArrayFieldTitleTemplate` component renders a `TitleFieldTemplate` with an `id` derived from
|
|
@@ -2008,8 +2074,8 @@
|
|
|
2008
2074
|
if (!title || !displayLabel) {
|
|
2009
2075
|
return null;
|
|
2010
2076
|
}
|
|
2011
|
-
var TitleFieldTemplate = utils.getTemplate(
|
|
2012
|
-
return
|
|
2077
|
+
var TitleFieldTemplate = utils.getTemplate('TitleFieldTemplate', registry, options);
|
|
2078
|
+
return jsxRuntime.jsx(TitleFieldTemplate, {
|
|
2013
2079
|
id: utils.titleId(idSchema),
|
|
2014
2080
|
title: title,
|
|
2015
2081
|
required: required,
|
|
@@ -2019,7 +2085,7 @@
|
|
|
2019
2085
|
});
|
|
2020
2086
|
}
|
|
2021
2087
|
|
|
2022
|
-
var _excluded$3 = ["id", "value", "readonly", "disabled", "autofocus", "onBlur", "onFocus", "onChange", "options", "schema", "uiSchema", "formContext", "registry", "rawErrors", "type"];
|
|
2088
|
+
var _excluded$3 = ["id", "name", "value", "readonly", "disabled", "autofocus", "onBlur", "onFocus", "onChange", "onChangeOverride", "options", "schema", "uiSchema", "formContext", "registry", "rawErrors", "type"];
|
|
2023
2089
|
/** The `BaseInputTemplate` is the template to use to render the basic `<input>` component for the `core` theme.
|
|
2024
2090
|
* It is used as the template for rendering many of the <input> based widgets that differ by `type` and callbacks only.
|
|
2025
2091
|
* It can be customized/overridden for other themes or individual implementations as needed.
|
|
@@ -2035,6 +2101,7 @@
|
|
|
2035
2101
|
onBlur = props.onBlur,
|
|
2036
2102
|
onFocus = props.onFocus,
|
|
2037
2103
|
onChange = props.onChange,
|
|
2104
|
+
onChangeOverride = props.onChangeOverride,
|
|
2038
2105
|
options = props.options,
|
|
2039
2106
|
schema = props.schema,
|
|
2040
2107
|
type = props.type,
|
|
@@ -2042,51 +2109,52 @@
|
|
|
2042
2109
|
// Note: since React 15.2.0 we can't forward unknown element attributes, so we
|
|
2043
2110
|
// exclude the "options" and "schema" ones here.
|
|
2044
2111
|
if (!id) {
|
|
2045
|
-
console.log(
|
|
2112
|
+
console.log('No id for', props);
|
|
2046
2113
|
throw new Error("no id for props " + JSON.stringify(props));
|
|
2047
2114
|
}
|
|
2048
2115
|
var inputProps = _extends({}, rest, utils.getInputProps(schema, type, options));
|
|
2049
2116
|
var inputValue;
|
|
2050
|
-
if (inputProps.type ===
|
|
2051
|
-
inputValue = value || value === 0 ? value :
|
|
2117
|
+
if (inputProps.type === 'number' || inputProps.type === 'integer') {
|
|
2118
|
+
inputValue = value || value === 0 ? value : '';
|
|
2052
2119
|
} else {
|
|
2053
|
-
inputValue = value == null ?
|
|
2120
|
+
inputValue = value == null ? '' : value;
|
|
2054
2121
|
}
|
|
2055
|
-
var _onChange =
|
|
2122
|
+
var _onChange = react.useCallback(function (_ref) {
|
|
2056
2123
|
var value = _ref.target.value;
|
|
2057
|
-
return onChange(value ===
|
|
2124
|
+
return onChange(value === '' ? options.emptyValue : value);
|
|
2058
2125
|
}, [onChange, options]);
|
|
2059
|
-
var _onBlur =
|
|
2126
|
+
var _onBlur = react.useCallback(function (_ref2) {
|
|
2060
2127
|
var value = _ref2.target.value;
|
|
2061
2128
|
return onBlur(id, value);
|
|
2062
2129
|
}, [onBlur, id]);
|
|
2063
|
-
var _onFocus =
|
|
2130
|
+
var _onFocus = react.useCallback(function (_ref3) {
|
|
2064
2131
|
var value = _ref3.target.value;
|
|
2065
2132
|
return onFocus(id, value);
|
|
2066
2133
|
}, [onFocus, id]);
|
|
2067
|
-
return
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2134
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
2135
|
+
children: [jsxRuntime.jsx("input", _extends({
|
|
2136
|
+
id: id,
|
|
2137
|
+
name: id,
|
|
2138
|
+
className: 'form-control',
|
|
2139
|
+
readOnly: readonly,
|
|
2140
|
+
disabled: disabled,
|
|
2141
|
+
autoFocus: autofocus,
|
|
2142
|
+
value: inputValue
|
|
2143
|
+
}, inputProps, {
|
|
2144
|
+
list: schema.examples ? utils.examplesId(id) : undefined,
|
|
2145
|
+
onChange: onChangeOverride || _onChange,
|
|
2146
|
+
onBlur: _onBlur,
|
|
2147
|
+
onFocus: _onFocus,
|
|
2148
|
+
"aria-describedby": utils.ariaDescribedByIds(id, !!schema.examples)
|
|
2149
|
+
})), Array.isArray(schema.examples) && jsxRuntime.jsx("datalist", {
|
|
2150
|
+
id: utils.examplesId(id),
|
|
2151
|
+
children: schema.examples.concat(schema["default"] && !schema.examples.includes(schema["default"]) ? [schema["default"]] : []).map(function (example) {
|
|
2152
|
+
return jsxRuntime.jsx("option", {
|
|
2153
|
+
value: example
|
|
2154
|
+
}, example);
|
|
2155
|
+
})
|
|
2156
|
+
}, "datalist_" + id)]
|
|
2157
|
+
});
|
|
2090
2158
|
}
|
|
2091
2159
|
|
|
2092
2160
|
/** The `SubmitButton` renders a button that represent the `Submit` action on a form
|
|
@@ -2101,53 +2169,67 @@
|
|
|
2101
2169
|
if (norender) {
|
|
2102
2170
|
return null;
|
|
2103
2171
|
}
|
|
2104
|
-
return
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2172
|
+
return jsxRuntime.jsx("div", {
|
|
2173
|
+
children: jsxRuntime.jsx("button", _extends({
|
|
2174
|
+
type: 'submit'
|
|
2175
|
+
}, submitButtonProps, {
|
|
2176
|
+
className: "btn btn-info " + submitButtonProps.className,
|
|
2177
|
+
children: submitText
|
|
2178
|
+
}))
|
|
2179
|
+
});
|
|
2109
2180
|
}
|
|
2110
2181
|
|
|
2111
2182
|
var _excluded$2 = ["iconType", "icon", "className", "uiSchema", "registry"];
|
|
2112
2183
|
function IconButton(props) {
|
|
2113
2184
|
var _props$iconType = props.iconType,
|
|
2114
|
-
iconType = _props$iconType === void 0 ?
|
|
2185
|
+
iconType = _props$iconType === void 0 ? 'default' : _props$iconType,
|
|
2115
2186
|
icon = props.icon,
|
|
2116
2187
|
className = props.className,
|
|
2117
2188
|
otherProps = _objectWithoutPropertiesLoose(props, _excluded$2);
|
|
2118
|
-
return
|
|
2119
|
-
type:
|
|
2189
|
+
return jsxRuntime.jsx("button", _extends({
|
|
2190
|
+
type: 'button',
|
|
2120
2191
|
className: "btn btn-" + iconType + " " + className
|
|
2121
|
-
}, otherProps
|
|
2122
|
-
|
|
2192
|
+
}, otherProps, {
|
|
2193
|
+
children: jsxRuntime.jsx("i", {
|
|
2194
|
+
className: "glyphicon glyphicon-" + icon
|
|
2195
|
+
})
|
|
2196
|
+
}));
|
|
2197
|
+
}
|
|
2198
|
+
function CopyButton(props) {
|
|
2199
|
+
var translateString = props.registry.translateString;
|
|
2200
|
+
return jsxRuntime.jsx(IconButton, _extends({
|
|
2201
|
+
title: translateString(utils.TranslatableString.CopyButton),
|
|
2202
|
+
className: 'array-item-copy'
|
|
2203
|
+
}, props, {
|
|
2204
|
+
icon: 'copy'
|
|
2123
2205
|
}));
|
|
2124
2206
|
}
|
|
2125
2207
|
function MoveDownButton(props) {
|
|
2126
2208
|
var translateString = props.registry.translateString;
|
|
2127
|
-
return
|
|
2209
|
+
return jsxRuntime.jsx(IconButton, _extends({
|
|
2128
2210
|
title: translateString(utils.TranslatableString.MoveDownButton),
|
|
2129
|
-
className:
|
|
2211
|
+
className: 'array-item-move-down'
|
|
2130
2212
|
}, props, {
|
|
2131
|
-
icon:
|
|
2213
|
+
icon: 'arrow-down'
|
|
2132
2214
|
}));
|
|
2133
2215
|
}
|
|
2134
2216
|
function MoveUpButton(props) {
|
|
2135
2217
|
var translateString = props.registry.translateString;
|
|
2136
|
-
return
|
|
2218
|
+
return jsxRuntime.jsx(IconButton, _extends({
|
|
2137
2219
|
title: translateString(utils.TranslatableString.MoveUpButton),
|
|
2138
|
-
className:
|
|
2220
|
+
className: 'array-item-move-up'
|
|
2139
2221
|
}, props, {
|
|
2140
|
-
icon:
|
|
2222
|
+
icon: 'arrow-up'
|
|
2141
2223
|
}));
|
|
2142
2224
|
}
|
|
2143
2225
|
function RemoveButton(props) {
|
|
2144
2226
|
var translateString = props.registry.translateString;
|
|
2145
|
-
return
|
|
2227
|
+
return jsxRuntime.jsx(IconButton, _extends({
|
|
2146
2228
|
title: translateString(utils.TranslatableString.RemoveButton),
|
|
2147
|
-
className:
|
|
2229
|
+
className: 'array-item-remove'
|
|
2148
2230
|
}, props, {
|
|
2149
|
-
iconType:
|
|
2150
|
-
icon:
|
|
2231
|
+
iconType: 'danger',
|
|
2232
|
+
icon: 'remove'
|
|
2151
2233
|
}));
|
|
2152
2234
|
}
|
|
2153
2235
|
|
|
@@ -2159,25 +2241,28 @@
|
|
|
2159
2241
|
disabled = _ref.disabled,
|
|
2160
2242
|
registry = _ref.registry;
|
|
2161
2243
|
var translateString = registry.translateString;
|
|
2162
|
-
return
|
|
2163
|
-
className:
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2244
|
+
return jsxRuntime.jsx("div", {
|
|
2245
|
+
className: 'row',
|
|
2246
|
+
children: jsxRuntime.jsx("p", {
|
|
2247
|
+
className: "col-xs-3 col-xs-offset-9 text-right " + className,
|
|
2248
|
+
children: jsxRuntime.jsx(IconButton, {
|
|
2249
|
+
iconType: 'info',
|
|
2250
|
+
icon: 'plus',
|
|
2251
|
+
className: 'btn-add col-xs-12',
|
|
2252
|
+
title: translateString(utils.TranslatableString.AddButton),
|
|
2253
|
+
onClick: onClick,
|
|
2254
|
+
disabled: disabled,
|
|
2255
|
+
registry: registry
|
|
2256
|
+
})
|
|
2257
|
+
})
|
|
2258
|
+
});
|
|
2175
2259
|
}
|
|
2176
2260
|
|
|
2177
2261
|
function buttonTemplates() {
|
|
2178
2262
|
return {
|
|
2179
2263
|
SubmitButton: SubmitButton,
|
|
2180
2264
|
AddButton: AddButton,
|
|
2265
|
+
CopyButton: CopyButton,
|
|
2181
2266
|
MoveDownButton: MoveDownButton,
|
|
2182
2267
|
MoveUpButton: MoveUpButton,
|
|
2183
2268
|
RemoveButton: RemoveButton
|
|
@@ -2194,16 +2279,18 @@
|
|
|
2194
2279
|
if (!description) {
|
|
2195
2280
|
return null;
|
|
2196
2281
|
}
|
|
2197
|
-
if (typeof description ===
|
|
2198
|
-
return
|
|
2282
|
+
if (typeof description === 'string') {
|
|
2283
|
+
return jsxRuntime.jsx("p", {
|
|
2199
2284
|
id: id,
|
|
2200
|
-
className:
|
|
2201
|
-
|
|
2285
|
+
className: 'field-description',
|
|
2286
|
+
children: description
|
|
2287
|
+
});
|
|
2202
2288
|
} else {
|
|
2203
|
-
return
|
|
2289
|
+
return jsxRuntime.jsx("div", {
|
|
2204
2290
|
id: id,
|
|
2205
|
-
className:
|
|
2206
|
-
|
|
2291
|
+
className: 'field-description',
|
|
2292
|
+
children: description
|
|
2293
|
+
});
|
|
2207
2294
|
}
|
|
2208
2295
|
}
|
|
2209
2296
|
|
|
@@ -2215,23 +2302,27 @@
|
|
|
2215
2302
|
var errors = _ref.errors,
|
|
2216
2303
|
registry = _ref.registry;
|
|
2217
2304
|
var translateString = registry.translateString;
|
|
2218
|
-
return
|
|
2219
|
-
className:
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2305
|
+
return jsxRuntime.jsxs("div", {
|
|
2306
|
+
className: 'panel panel-danger errors',
|
|
2307
|
+
children: [jsxRuntime.jsx("div", {
|
|
2308
|
+
className: 'panel-heading',
|
|
2309
|
+
children: jsxRuntime.jsx("h3", {
|
|
2310
|
+
className: 'panel-title',
|
|
2311
|
+
children: translateString(utils.TranslatableString.ErrorsLabel)
|
|
2312
|
+
})
|
|
2313
|
+
}), jsxRuntime.jsx("ul", {
|
|
2314
|
+
className: 'list-group',
|
|
2315
|
+
children: errors.map(function (error, i) {
|
|
2316
|
+
return jsxRuntime.jsx("li", {
|
|
2317
|
+
className: 'list-group-item text-danger',
|
|
2318
|
+
children: error.stack
|
|
2319
|
+
}, i);
|
|
2320
|
+
})
|
|
2321
|
+
})]
|
|
2322
|
+
});
|
|
2232
2323
|
}
|
|
2233
2324
|
|
|
2234
|
-
var REQUIRED_FIELD_SYMBOL$1 =
|
|
2325
|
+
var REQUIRED_FIELD_SYMBOL$1 = '*';
|
|
2235
2326
|
/** Renders a label for a field
|
|
2236
2327
|
*
|
|
2237
2328
|
* @param props - The `LabelProps` for this component
|
|
@@ -2243,12 +2334,14 @@
|
|
|
2243
2334
|
if (!label) {
|
|
2244
2335
|
return null;
|
|
2245
2336
|
}
|
|
2246
|
-
return
|
|
2247
|
-
className:
|
|
2248
|
-
htmlFor: id
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2337
|
+
return jsxRuntime.jsxs("label", {
|
|
2338
|
+
className: 'control-label',
|
|
2339
|
+
htmlFor: id,
|
|
2340
|
+
children: [label, required && jsxRuntime.jsx("span", {
|
|
2341
|
+
className: 'required',
|
|
2342
|
+
children: REQUIRED_FIELD_SYMBOL$1
|
|
2343
|
+
})]
|
|
2344
|
+
});
|
|
2252
2345
|
}
|
|
2253
2346
|
|
|
2254
2347
|
/** The `FieldTemplate` component is the template used by `SchemaField` to render any field. It renders the field
|
|
@@ -2269,17 +2362,20 @@
|
|
|
2269
2362
|
registry = props.registry,
|
|
2270
2363
|
uiSchema = props.uiSchema;
|
|
2271
2364
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
2272
|
-
var WrapIfAdditionalTemplate = utils.getTemplate(
|
|
2365
|
+
var WrapIfAdditionalTemplate = utils.getTemplate('WrapIfAdditionalTemplate', registry, uiOptions);
|
|
2273
2366
|
if (hidden) {
|
|
2274
|
-
return
|
|
2275
|
-
className:
|
|
2276
|
-
|
|
2367
|
+
return jsxRuntime.jsx("div", {
|
|
2368
|
+
className: 'hidden',
|
|
2369
|
+
children: children
|
|
2370
|
+
});
|
|
2277
2371
|
}
|
|
2278
|
-
return
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2372
|
+
return jsxRuntime.jsxs(WrapIfAdditionalTemplate, _extends({}, props, {
|
|
2373
|
+
children: [displayLabel && jsxRuntime.jsx(Label, {
|
|
2374
|
+
label: label,
|
|
2375
|
+
required: required,
|
|
2376
|
+
id: id
|
|
2377
|
+
}), displayLabel && description ? description : null, children, errors, help]
|
|
2378
|
+
}));
|
|
2283
2379
|
}
|
|
2284
2380
|
|
|
2285
2381
|
/** The `FieldErrorTemplate` component renders the errors local to the particular field
|
|
@@ -2294,17 +2390,20 @@
|
|
|
2294
2390
|
return null;
|
|
2295
2391
|
}
|
|
2296
2392
|
var id = utils.errorId(idSchema);
|
|
2297
|
-
return
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2393
|
+
return jsxRuntime.jsx("div", {
|
|
2394
|
+
children: jsxRuntime.jsx("ul", {
|
|
2395
|
+
id: id,
|
|
2396
|
+
className: 'error-detail bs-callout bs-callout-info',
|
|
2397
|
+
children: errors.filter(function (elem) {
|
|
2398
|
+
return !!elem;
|
|
2399
|
+
}).map(function (error, index) {
|
|
2400
|
+
return jsxRuntime.jsx("li", {
|
|
2401
|
+
className: 'text-danger',
|
|
2402
|
+
children: error
|
|
2403
|
+
}, index);
|
|
2404
|
+
})
|
|
2405
|
+
})
|
|
2406
|
+
});
|
|
2308
2407
|
}
|
|
2309
2408
|
|
|
2310
2409
|
/** The `FieldHelpTemplate` component renders any help desired for a field
|
|
@@ -2318,16 +2417,18 @@
|
|
|
2318
2417
|
return null;
|
|
2319
2418
|
}
|
|
2320
2419
|
var id = utils.helpId(idSchema);
|
|
2321
|
-
if (typeof help ===
|
|
2322
|
-
return
|
|
2420
|
+
if (typeof help === 'string') {
|
|
2421
|
+
return jsxRuntime.jsx("p", {
|
|
2323
2422
|
id: id,
|
|
2324
|
-
className:
|
|
2325
|
-
|
|
2423
|
+
className: 'help-block',
|
|
2424
|
+
children: help
|
|
2425
|
+
});
|
|
2326
2426
|
}
|
|
2327
|
-
return
|
|
2427
|
+
return jsxRuntime.jsx("div", {
|
|
2328
2428
|
id: id,
|
|
2329
|
-
className:
|
|
2330
|
-
|
|
2429
|
+
className: 'help-block',
|
|
2430
|
+
children: help
|
|
2431
|
+
});
|
|
2331
2432
|
}
|
|
2332
2433
|
|
|
2333
2434
|
/** The `ObjectFieldTemplate` is the template to use to render all the inner properties of an object along with the
|
|
@@ -2350,37 +2451,38 @@
|
|
|
2350
2451
|
title = props.title,
|
|
2351
2452
|
uiSchema = props.uiSchema;
|
|
2352
2453
|
var options = utils.getUiOptions(uiSchema);
|
|
2353
|
-
var TitleFieldTemplate = utils.getTemplate(
|
|
2354
|
-
var DescriptionFieldTemplate = utils.getTemplate(
|
|
2454
|
+
var TitleFieldTemplate = utils.getTemplate('TitleFieldTemplate', registry, options);
|
|
2455
|
+
var DescriptionFieldTemplate = utils.getTemplate('DescriptionFieldTemplate', registry, options);
|
|
2355
2456
|
// Button templates are not overridden in the uiSchema
|
|
2356
2457
|
var AddButton = registry.templates.ButtonTemplates.AddButton;
|
|
2357
|
-
return
|
|
2358
|
-
id: idSchema.$id
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2458
|
+
return jsxRuntime.jsxs("fieldset", {
|
|
2459
|
+
id: idSchema.$id,
|
|
2460
|
+
children: [(options.title || title) && jsxRuntime.jsx(TitleFieldTemplate, {
|
|
2461
|
+
id: utils.titleId(idSchema),
|
|
2462
|
+
title: options.title || title,
|
|
2463
|
+
required: required,
|
|
2464
|
+
schema: schema,
|
|
2465
|
+
uiSchema: uiSchema,
|
|
2466
|
+
registry: registry
|
|
2467
|
+
}), (options.description || description) && jsxRuntime.jsx(DescriptionFieldTemplate, {
|
|
2468
|
+
id: utils.descriptionId(idSchema),
|
|
2469
|
+
description: options.description || description,
|
|
2470
|
+
schema: schema,
|
|
2471
|
+
uiSchema: uiSchema,
|
|
2472
|
+
registry: registry
|
|
2473
|
+
}), properties.map(function (prop) {
|
|
2474
|
+
return prop.content;
|
|
2475
|
+
}), utils.canExpand(schema, uiSchema, formData) && jsxRuntime.jsx(AddButton, {
|
|
2476
|
+
className: 'object-property-expand',
|
|
2477
|
+
onClick: onAddClick(schema),
|
|
2478
|
+
disabled: disabled || readonly,
|
|
2479
|
+
uiSchema: uiSchema,
|
|
2480
|
+
registry: registry
|
|
2481
|
+
})]
|
|
2482
|
+
});
|
|
2381
2483
|
}
|
|
2382
2484
|
|
|
2383
|
-
var REQUIRED_FIELD_SYMBOL =
|
|
2485
|
+
var REQUIRED_FIELD_SYMBOL = '*';
|
|
2384
2486
|
/** The `TitleField` is the template to use to render the title of a field
|
|
2385
2487
|
*
|
|
2386
2488
|
* @param props - The `TitleFieldProps` for this component
|
|
@@ -2389,11 +2491,13 @@
|
|
|
2389
2491
|
var id = props.id,
|
|
2390
2492
|
title = props.title,
|
|
2391
2493
|
required = props.required;
|
|
2392
|
-
return
|
|
2393
|
-
id: id
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2494
|
+
return jsxRuntime.jsxs("legend", {
|
|
2495
|
+
id: id,
|
|
2496
|
+
children: [title, required && jsxRuntime.jsx("span", {
|
|
2497
|
+
className: 'required',
|
|
2498
|
+
children: REQUIRED_FIELD_SYMBOL
|
|
2499
|
+
})]
|
|
2500
|
+
});
|
|
2397
2501
|
}
|
|
2398
2502
|
|
|
2399
2503
|
/** The `UnsupportedField` component is used to render a field in the schema is one that is not supported by
|
|
@@ -2417,9 +2521,16 @@
|
|
|
2417
2521
|
translateEnum = translateEnum === utils.TranslatableString.UnsupportedField ? utils.TranslatableString.UnsupportedFieldWithReason : utils.TranslatableString.UnsupportedFieldWithIdAndReason;
|
|
2418
2522
|
translateParams.push(reason);
|
|
2419
2523
|
}
|
|
2420
|
-
return
|
|
2421
|
-
className:
|
|
2422
|
-
|
|
2524
|
+
return jsxRuntime.jsxs("div", {
|
|
2525
|
+
className: 'unsupported-field',
|
|
2526
|
+
children: [jsxRuntime.jsx("p", {
|
|
2527
|
+
children: jsxRuntime.jsx(Markdown__default["default"], {
|
|
2528
|
+
children: translateString(translateEnum, translateParams)
|
|
2529
|
+
})
|
|
2530
|
+
}), schema && jsxRuntime.jsx("pre", {
|
|
2531
|
+
children: JSON.stringify(schema, null, 2)
|
|
2532
|
+
})]
|
|
2533
|
+
});
|
|
2423
2534
|
}
|
|
2424
2535
|
|
|
2425
2536
|
/** The `WrapIfAdditional` component is used by the `FieldTemplate` to rename, or remove properties that are
|
|
@@ -2448,46 +2559,53 @@
|
|
|
2448
2559
|
var keyLabel = translateString(utils.TranslatableString.KeyLabel, [label]);
|
|
2449
2560
|
var additional = (utils.ADDITIONAL_PROPERTY_FLAG in schema);
|
|
2450
2561
|
if (!additional) {
|
|
2451
|
-
return
|
|
2562
|
+
return jsxRuntime.jsx("div", {
|
|
2452
2563
|
className: classNames,
|
|
2453
|
-
style: style
|
|
2454
|
-
|
|
2564
|
+
style: style,
|
|
2565
|
+
children: children
|
|
2566
|
+
});
|
|
2455
2567
|
}
|
|
2456
|
-
return
|
|
2568
|
+
return jsxRuntime.jsx("div", {
|
|
2457
2569
|
className: classNames,
|
|
2458
|
-
style: style
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2570
|
+
style: style,
|
|
2571
|
+
children: jsxRuntime.jsxs("div", {
|
|
2572
|
+
className: 'row',
|
|
2573
|
+
children: [jsxRuntime.jsx("div", {
|
|
2574
|
+
className: 'col-xs-5 form-additional',
|
|
2575
|
+
children: jsxRuntime.jsxs("div", {
|
|
2576
|
+
className: 'form-group',
|
|
2577
|
+
children: [jsxRuntime.jsx(Label, {
|
|
2578
|
+
label: keyLabel,
|
|
2579
|
+
required: required,
|
|
2580
|
+
id: id + "-key"
|
|
2581
|
+
}), jsxRuntime.jsx("input", {
|
|
2582
|
+
className: 'form-control',
|
|
2583
|
+
type: 'text',
|
|
2584
|
+
id: id + "-key",
|
|
2585
|
+
onBlur: function onBlur(event) {
|
|
2586
|
+
return onKeyChange(event.target.value);
|
|
2587
|
+
},
|
|
2588
|
+
defaultValue: label
|
|
2589
|
+
})]
|
|
2590
|
+
})
|
|
2591
|
+
}), jsxRuntime.jsx("div", {
|
|
2592
|
+
className: 'form-additional form-group col-xs-5',
|
|
2593
|
+
children: children
|
|
2594
|
+
}), jsxRuntime.jsx("div", {
|
|
2595
|
+
className: 'col-xs-2',
|
|
2596
|
+
children: jsxRuntime.jsx(RemoveButton, {
|
|
2597
|
+
className: 'array-item-remove btn-block',
|
|
2598
|
+
style: {
|
|
2599
|
+
border: '0'
|
|
2600
|
+
},
|
|
2601
|
+
disabled: disabled || readonly,
|
|
2602
|
+
onClick: onDropPropertyClick(label),
|
|
2603
|
+
uiSchema: uiSchema,
|
|
2604
|
+
registry: registry
|
|
2605
|
+
})
|
|
2606
|
+
})]
|
|
2607
|
+
})
|
|
2608
|
+
});
|
|
2491
2609
|
}
|
|
2492
2610
|
|
|
2493
2611
|
function templates() {
|
|
@@ -2536,29 +2654,29 @@
|
|
|
2536
2654
|
minute = state.minute,
|
|
2537
2655
|
second = state.second;
|
|
2538
2656
|
var data = [{
|
|
2539
|
-
type:
|
|
2657
|
+
type: 'year',
|
|
2540
2658
|
range: yearsRange,
|
|
2541
2659
|
value: year
|
|
2542
2660
|
}, {
|
|
2543
|
-
type:
|
|
2661
|
+
type: 'month',
|
|
2544
2662
|
range: [1, 12],
|
|
2545
2663
|
value: month
|
|
2546
2664
|
}, {
|
|
2547
|
-
type:
|
|
2665
|
+
type: 'day',
|
|
2548
2666
|
range: [1, 31],
|
|
2549
2667
|
value: day
|
|
2550
2668
|
}];
|
|
2551
2669
|
if (time) {
|
|
2552
2670
|
data.push({
|
|
2553
|
-
type:
|
|
2671
|
+
type: 'hour',
|
|
2554
2672
|
range: [0, 23],
|
|
2555
2673
|
value: hour
|
|
2556
2674
|
}, {
|
|
2557
|
-
type:
|
|
2675
|
+
type: 'minute',
|
|
2558
2676
|
range: [0, 59],
|
|
2559
2677
|
value: minute
|
|
2560
2678
|
}, {
|
|
2561
|
-
type:
|
|
2679
|
+
type: 'second',
|
|
2562
2680
|
range: [0, 59],
|
|
2563
2681
|
value: second
|
|
2564
2682
|
});
|
|
@@ -2571,20 +2689,22 @@
|
|
|
2571
2689
|
value = _ref.value,
|
|
2572
2690
|
select = _ref.select,
|
|
2573
2691
|
rootId = _ref.rootId,
|
|
2692
|
+
name = _ref.name,
|
|
2574
2693
|
disabled = _ref.disabled,
|
|
2575
2694
|
readonly = _ref.readonly,
|
|
2576
2695
|
autofocus = _ref.autofocus,
|
|
2577
2696
|
registry = _ref.registry,
|
|
2578
2697
|
onBlur = _ref.onBlur,
|
|
2579
2698
|
onFocus = _ref.onFocus;
|
|
2580
|
-
var id = rootId +
|
|
2699
|
+
var id = rootId + '_' + type;
|
|
2581
2700
|
var SelectWidget = registry.widgets.SelectWidget;
|
|
2582
|
-
return
|
|
2701
|
+
return jsxRuntime.jsx(SelectWidget, {
|
|
2583
2702
|
schema: {
|
|
2584
|
-
type:
|
|
2703
|
+
type: 'integer'
|
|
2585
2704
|
},
|
|
2586
2705
|
id: id,
|
|
2587
|
-
|
|
2706
|
+
name: name,
|
|
2707
|
+
className: 'form-control',
|
|
2588
2708
|
options: {
|
|
2589
2709
|
enumOptions: rangeOptions(range[0], range[1])
|
|
2590
2710
|
},
|
|
@@ -2599,7 +2719,7 @@
|
|
|
2599
2719
|
onBlur: onBlur,
|
|
2600
2720
|
onFocus: onFocus,
|
|
2601
2721
|
registry: registry,
|
|
2602
|
-
label:
|
|
2722
|
+
label: '',
|
|
2603
2723
|
"aria-describedby": utils.ariaDescribedByIds(rootId)
|
|
2604
2724
|
});
|
|
2605
2725
|
}
|
|
@@ -2617,33 +2737,34 @@
|
|
|
2617
2737
|
autofocus = _ref2$autofocus === void 0 ? false : _ref2$autofocus,
|
|
2618
2738
|
options = _ref2.options,
|
|
2619
2739
|
id = _ref2.id,
|
|
2740
|
+
name = _ref2.name,
|
|
2620
2741
|
registry = _ref2.registry,
|
|
2621
2742
|
onBlur = _ref2.onBlur,
|
|
2622
2743
|
onFocus = _ref2.onFocus,
|
|
2623
2744
|
onChange = _ref2.onChange,
|
|
2624
2745
|
value = _ref2.value;
|
|
2625
2746
|
var translateString = registry.translateString;
|
|
2626
|
-
var _useReducer =
|
|
2747
|
+
var _useReducer = react.useReducer(function (state, action) {
|
|
2627
2748
|
return _extends({}, state, action);
|
|
2628
2749
|
}, utils.parseDateString(value, time)),
|
|
2629
2750
|
state = _useReducer[0],
|
|
2630
2751
|
setState = _useReducer[1];
|
|
2631
|
-
|
|
2752
|
+
react.useEffect(function () {
|
|
2632
2753
|
if (value && value !== utils.toDateString(state, time)) {
|
|
2633
2754
|
setState(utils.parseDateString(value, time));
|
|
2634
2755
|
}
|
|
2635
2756
|
}, [value, state, time]);
|
|
2636
|
-
|
|
2757
|
+
react.useEffect(function () {
|
|
2637
2758
|
if (readyForChange(state)) {
|
|
2638
2759
|
// Only propagate to parent state if we have a complete date{time}
|
|
2639
2760
|
onChange(utils.toDateString(state, time));
|
|
2640
2761
|
}
|
|
2641
2762
|
}, [state, time, onChange]);
|
|
2642
|
-
var handleChange =
|
|
2763
|
+
var handleChange = react.useCallback(function (property, value) {
|
|
2643
2764
|
var _setState;
|
|
2644
2765
|
setState((_setState = {}, _setState[property] = value, _setState));
|
|
2645
2766
|
}, []);
|
|
2646
|
-
var handleSetNow =
|
|
2767
|
+
var handleSetNow = react.useCallback(function (event) {
|
|
2647
2768
|
event.preventDefault();
|
|
2648
2769
|
if (disabled || readonly) {
|
|
2649
2770
|
return;
|
|
@@ -2651,44 +2772,50 @@
|
|
|
2651
2772
|
var nowDateObj = utils.parseDateString(new Date().toJSON(), time);
|
|
2652
2773
|
setState(nowDateObj);
|
|
2653
2774
|
}, [disabled, readonly, time]);
|
|
2654
|
-
var handleClear =
|
|
2775
|
+
var handleClear = react.useCallback(function (event) {
|
|
2655
2776
|
event.preventDefault();
|
|
2656
2777
|
if (disabled || readonly) {
|
|
2657
2778
|
return;
|
|
2658
2779
|
}
|
|
2659
|
-
setState(utils.parseDateString(
|
|
2780
|
+
setState(utils.parseDateString('', time));
|
|
2660
2781
|
onChange(undefined);
|
|
2661
2782
|
}, [disabled, readonly, time, onChange]);
|
|
2662
|
-
return
|
|
2663
|
-
className:
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2783
|
+
return jsxRuntime.jsxs("ul", {
|
|
2784
|
+
className: 'list-inline',
|
|
2785
|
+
children: [dateElementProps(state, time, options.yearsRange).map(function (elemProps, i) {
|
|
2786
|
+
return jsxRuntime.jsx("li", {
|
|
2787
|
+
className: 'list-inline-item',
|
|
2788
|
+
children: jsxRuntime.jsx(DateElement, _extends({
|
|
2789
|
+
rootId: id,
|
|
2790
|
+
name: name,
|
|
2791
|
+
select: handleChange
|
|
2792
|
+
}, elemProps, {
|
|
2793
|
+
disabled: disabled,
|
|
2794
|
+
readonly: readonly,
|
|
2795
|
+
registry: registry,
|
|
2796
|
+
onBlur: onBlur,
|
|
2797
|
+
onFocus: onFocus,
|
|
2798
|
+
autofocus: autofocus && i === 0
|
|
2799
|
+
}))
|
|
2800
|
+
}, i);
|
|
2801
|
+
}), (options.hideNowButton !== 'undefined' ? !options.hideNowButton : true) && jsxRuntime.jsx("li", {
|
|
2802
|
+
className: 'list-inline-item',
|
|
2803
|
+
children: jsxRuntime.jsx("a", {
|
|
2804
|
+
href: '#',
|
|
2805
|
+
className: 'btn btn-info btn-now',
|
|
2806
|
+
onClick: handleSetNow,
|
|
2807
|
+
children: translateString(utils.TranslatableString.NowLabel)
|
|
2808
|
+
})
|
|
2809
|
+
}), (options.hideClearButton !== 'undefined' ? !options.hideClearButton : true) && jsxRuntime.jsx("li", {
|
|
2810
|
+
className: 'list-inline-item',
|
|
2811
|
+
children: jsxRuntime.jsx("a", {
|
|
2812
|
+
href: '#',
|
|
2813
|
+
className: 'btn btn-warning btn-clear',
|
|
2814
|
+
onClick: handleClear,
|
|
2815
|
+
children: translateString(utils.TranslatableString.ClearLabel)
|
|
2816
|
+
})
|
|
2817
|
+
})]
|
|
2818
|
+
});
|
|
2692
2819
|
}
|
|
2693
2820
|
|
|
2694
2821
|
var _excluded$1 = ["time"];
|
|
@@ -2702,7 +2829,7 @@
|
|
|
2702
2829
|
time = _ref$time === void 0 ? true : _ref$time,
|
|
2703
2830
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
2704
2831
|
var AltDateWidget = props.registry.widgets.AltDateWidget;
|
|
2705
|
-
return
|
|
2832
|
+
return jsxRuntime.jsx(AltDateWidget, _extends({
|
|
2706
2833
|
time: time
|
|
2707
2834
|
}, props));
|
|
2708
2835
|
}
|
|
@@ -2727,41 +2854,46 @@
|
|
|
2727
2854
|
onFocus = _ref.onFocus,
|
|
2728
2855
|
onChange = _ref.onChange,
|
|
2729
2856
|
registry = _ref.registry;
|
|
2730
|
-
var DescriptionFieldTemplate = utils.getTemplate(
|
|
2857
|
+
var DescriptionFieldTemplate = utils.getTemplate('DescriptionFieldTemplate', registry, options);
|
|
2731
2858
|
// Because an unchecked checkbox will cause html5 validation to fail, only add
|
|
2732
2859
|
// the "required" attribute if the field value must be "true", due to the
|
|
2733
2860
|
// "const" or "enum" keywords
|
|
2734
2861
|
var required = utils.schemaRequiresTrueValue(schema);
|
|
2735
|
-
var handleChange =
|
|
2862
|
+
var handleChange = react.useCallback(function (event) {
|
|
2736
2863
|
return onChange(event.target.checked);
|
|
2737
2864
|
}, [onChange]);
|
|
2738
|
-
var handleBlur =
|
|
2865
|
+
var handleBlur = react.useCallback(function (event) {
|
|
2739
2866
|
return onBlur(id, event.target.checked);
|
|
2740
2867
|
}, [onBlur, id]);
|
|
2741
|
-
var handleFocus =
|
|
2868
|
+
var handleFocus = react.useCallback(function (event) {
|
|
2742
2869
|
return onFocus(id, event.target.checked);
|
|
2743
2870
|
}, [onFocus, id]);
|
|
2744
|
-
return
|
|
2745
|
-
className: "checkbox " + (disabled || readonly ?
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2871
|
+
return jsxRuntime.jsxs("div", {
|
|
2872
|
+
className: "checkbox " + (disabled || readonly ? 'disabled' : ''),
|
|
2873
|
+
children: [schema.description && jsxRuntime.jsx(DescriptionFieldTemplate, {
|
|
2874
|
+
id: utils.descriptionId(id),
|
|
2875
|
+
description: schema.description,
|
|
2876
|
+
schema: schema,
|
|
2877
|
+
uiSchema: uiSchema,
|
|
2878
|
+
registry: registry
|
|
2879
|
+
}), jsxRuntime.jsxs("label", {
|
|
2880
|
+
children: [jsxRuntime.jsx("input", {
|
|
2881
|
+
type: 'checkbox',
|
|
2882
|
+
id: id,
|
|
2883
|
+
name: id,
|
|
2884
|
+
checked: typeof value === 'undefined' ? false : value,
|
|
2885
|
+
required: required,
|
|
2886
|
+
disabled: disabled || readonly,
|
|
2887
|
+
autoFocus: autofocus,
|
|
2888
|
+
onChange: handleChange,
|
|
2889
|
+
onBlur: handleBlur,
|
|
2890
|
+
onFocus: handleFocus,
|
|
2891
|
+
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
2892
|
+
}), jsxRuntime.jsx("span", {
|
|
2893
|
+
children: label
|
|
2894
|
+
})]
|
|
2895
|
+
})]
|
|
2896
|
+
});
|
|
2765
2897
|
}
|
|
2766
2898
|
|
|
2767
2899
|
/** The `CheckboxesWidget` is a widget for rendering checkbox groups.
|
|
@@ -2786,49 +2918,56 @@
|
|
|
2786
2918
|
onBlur = _ref.onBlur,
|
|
2787
2919
|
onFocus = _ref.onFocus;
|
|
2788
2920
|
var checkboxesValues = Array.isArray(value) ? value : [value];
|
|
2789
|
-
var handleBlur =
|
|
2921
|
+
var handleBlur = react.useCallback(function (_ref2) {
|
|
2790
2922
|
var value = _ref2.target.value;
|
|
2791
2923
|
return onBlur(id, utils.enumOptionsValueForIndex(value, enumOptions, emptyValue));
|
|
2792
2924
|
}, [onBlur, id]);
|
|
2793
|
-
var handleFocus =
|
|
2925
|
+
var handleFocus = react.useCallback(function (_ref3) {
|
|
2794
2926
|
var value = _ref3.target.value;
|
|
2795
2927
|
return onFocus(id, utils.enumOptionsValueForIndex(value, enumOptions, emptyValue));
|
|
2796
2928
|
}, [onFocus, id]);
|
|
2797
|
-
return
|
|
2798
|
-
className:
|
|
2799
|
-
id: id
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2929
|
+
return jsxRuntime.jsx("div", {
|
|
2930
|
+
className: 'checkboxes',
|
|
2931
|
+
id: id,
|
|
2932
|
+
children: Array.isArray(enumOptions) && enumOptions.map(function (option, index) {
|
|
2933
|
+
var checked = utils.enumOptionsIsSelected(option.value, checkboxesValues);
|
|
2934
|
+
var itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
2935
|
+
var disabledCls = disabled || itemDisabled || readonly ? 'disabled' : '';
|
|
2936
|
+
var handleChange = function handleChange(event) {
|
|
2937
|
+
if (event.target.checked) {
|
|
2938
|
+
onChange(utils.enumOptionsSelectValue(index, checkboxesValues, enumOptions));
|
|
2939
|
+
} else {
|
|
2940
|
+
onChange(utils.enumOptionsDeselectValue(index, checkboxesValues, enumOptions));
|
|
2941
|
+
}
|
|
2942
|
+
};
|
|
2943
|
+
var checkbox = jsxRuntime.jsxs("span", {
|
|
2944
|
+
children: [jsxRuntime.jsx("input", {
|
|
2945
|
+
type: 'checkbox',
|
|
2946
|
+
id: utils.optionId(id, index),
|
|
2947
|
+
name: id,
|
|
2948
|
+
checked: checked,
|
|
2949
|
+
value: String(index),
|
|
2950
|
+
disabled: disabled || itemDisabled || readonly,
|
|
2951
|
+
autoFocus: autofocus && index === 0,
|
|
2952
|
+
onChange: handleChange,
|
|
2953
|
+
onBlur: handleBlur,
|
|
2954
|
+
onFocus: handleFocus,
|
|
2955
|
+
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
2956
|
+
}), jsxRuntime.jsx("span", {
|
|
2957
|
+
children: option.label
|
|
2958
|
+
})]
|
|
2959
|
+
});
|
|
2960
|
+
return inline ? jsxRuntime.jsx("label", {
|
|
2961
|
+
className: "checkbox-inline " + disabledCls,
|
|
2962
|
+
children: checkbox
|
|
2963
|
+
}, index) : jsxRuntime.jsx("div", {
|
|
2964
|
+
className: "checkbox " + disabledCls,
|
|
2965
|
+
children: jsxRuntime.jsx("label", {
|
|
2966
|
+
children: checkbox
|
|
2967
|
+
})
|
|
2968
|
+
}, index);
|
|
2969
|
+
})
|
|
2970
|
+
});
|
|
2832
2971
|
}
|
|
2833
2972
|
|
|
2834
2973
|
/** The `ColorWidget` component uses the `BaseInputTemplate` changing the type to `color` and disables it when it is
|
|
@@ -2841,9 +2980,9 @@
|
|
|
2841
2980
|
readonly = props.readonly,
|
|
2842
2981
|
options = props.options,
|
|
2843
2982
|
registry = props.registry;
|
|
2844
|
-
var BaseInputTemplate = utils.getTemplate(
|
|
2845
|
-
return
|
|
2846
|
-
type:
|
|
2983
|
+
var BaseInputTemplate = utils.getTemplate('BaseInputTemplate', registry, options);
|
|
2984
|
+
return jsxRuntime.jsx(BaseInputTemplate, _extends({
|
|
2985
|
+
type: 'color'
|
|
2847
2986
|
}, props, {
|
|
2848
2987
|
disabled: disabled || readonly
|
|
2849
2988
|
}));
|
|
@@ -2858,12 +2997,12 @@
|
|
|
2858
2997
|
var onChange = props.onChange,
|
|
2859
2998
|
options = props.options,
|
|
2860
2999
|
registry = props.registry;
|
|
2861
|
-
var BaseInputTemplate = utils.getTemplate(
|
|
2862
|
-
var handleChange =
|
|
3000
|
+
var BaseInputTemplate = utils.getTemplate('BaseInputTemplate', registry, options);
|
|
3001
|
+
var handleChange = react.useCallback(function (value) {
|
|
2863
3002
|
return onChange(value || undefined);
|
|
2864
3003
|
}, [onChange]);
|
|
2865
|
-
return
|
|
2866
|
-
type:
|
|
3004
|
+
return jsxRuntime.jsx(BaseInputTemplate, _extends({
|
|
3005
|
+
type: 'date'
|
|
2867
3006
|
}, props, {
|
|
2868
3007
|
onChange: handleChange
|
|
2869
3008
|
}));
|
|
@@ -2879,9 +3018,9 @@
|
|
|
2879
3018
|
value = props.value,
|
|
2880
3019
|
options = props.options,
|
|
2881
3020
|
registry = props.registry;
|
|
2882
|
-
var BaseInputTemplate = utils.getTemplate(
|
|
2883
|
-
return
|
|
2884
|
-
type:
|
|
3021
|
+
var BaseInputTemplate = utils.getTemplate('BaseInputTemplate', registry, options);
|
|
3022
|
+
return jsxRuntime.jsx(BaseInputTemplate, _extends({
|
|
3023
|
+
type: 'datetime-local'
|
|
2885
3024
|
}, props, {
|
|
2886
3025
|
value: utils.utcToLocal(value),
|
|
2887
3026
|
onChange: function onChange(value) {
|
|
@@ -2897,9 +3036,9 @@
|
|
|
2897
3036
|
function EmailWidget(props) {
|
|
2898
3037
|
var options = props.options,
|
|
2899
3038
|
registry = props.registry;
|
|
2900
|
-
var BaseInputTemplate = utils.getTemplate(
|
|
2901
|
-
return
|
|
2902
|
-
type:
|
|
3039
|
+
var BaseInputTemplate = utils.getTemplate('BaseInputTemplate', registry, options);
|
|
3040
|
+
return jsxRuntime.jsx(BaseInputTemplate, _extends({
|
|
3041
|
+
type: 'email'
|
|
2903
3042
|
}, props));
|
|
2904
3043
|
}
|
|
2905
3044
|
|
|
@@ -2907,7 +3046,7 @@
|
|
|
2907
3046
|
if (dataURL === null) {
|
|
2908
3047
|
return null;
|
|
2909
3048
|
}
|
|
2910
|
-
return dataURL.replace(
|
|
3049
|
+
return dataURL.replace(';base64', ";name=" + encodeURIComponent(name) + ";base64");
|
|
2911
3050
|
}
|
|
2912
3051
|
function processFile(file) {
|
|
2913
3052
|
var name = file.name,
|
|
@@ -2918,7 +3057,7 @@
|
|
|
2918
3057
|
reader.onerror = reject;
|
|
2919
3058
|
reader.onload = function (event) {
|
|
2920
3059
|
var _event$target;
|
|
2921
|
-
if (typeof ((_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.result) ===
|
|
3060
|
+
if (typeof ((_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.result) === 'string') {
|
|
2922
3061
|
resolve({
|
|
2923
3062
|
dataURL: addNameToDataURL(event.target.result, name),
|
|
2924
3063
|
name: name,
|
|
@@ -2947,20 +3086,23 @@
|
|
|
2947
3086
|
return null;
|
|
2948
3087
|
}
|
|
2949
3088
|
var translateString = registry.translateString;
|
|
2950
|
-
return
|
|
2951
|
-
className:
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
3089
|
+
return jsxRuntime.jsx("ul", {
|
|
3090
|
+
className: 'file-info',
|
|
3091
|
+
children: filesInfo.map(function (fileInfo, key) {
|
|
3092
|
+
var name = fileInfo.name,
|
|
3093
|
+
size = fileInfo.size,
|
|
3094
|
+
type = fileInfo.type;
|
|
3095
|
+
return jsxRuntime.jsx("li", {
|
|
3096
|
+
children: jsxRuntime.jsx(Markdown__default["default"], {
|
|
3097
|
+
children: translateString(utils.TranslatableString.FilesInfo, [name, type, String(size)])
|
|
3098
|
+
})
|
|
3099
|
+
}, key);
|
|
3100
|
+
})
|
|
3101
|
+
});
|
|
2960
3102
|
}
|
|
2961
3103
|
function extractFileInfo(dataURLs) {
|
|
2962
3104
|
return dataURLs.filter(function (dataURL) {
|
|
2963
|
-
return
|
|
3105
|
+
return dataURL;
|
|
2964
3106
|
}).map(function (dataURL) {
|
|
2965
3107
|
var _dataURItoBlob = utils.dataURItoBlob(dataURL),
|
|
2966
3108
|
blob = _dataURItoBlob.blob,
|
|
@@ -2976,24 +3118,22 @@
|
|
|
2976
3118
|
* The `FileWidget` is a widget for rendering file upload fields.
|
|
2977
3119
|
* It is typically used with a string property with data-url format.
|
|
2978
3120
|
*/
|
|
2979
|
-
function FileWidget(
|
|
2980
|
-
var
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
registry = _ref2.registry;
|
|
2990
|
-
var extractedFilesInfo = React.useMemo(function () {
|
|
3121
|
+
function FileWidget(props) {
|
|
3122
|
+
var disabled = props.disabled,
|
|
3123
|
+
readonly = props.readonly,
|
|
3124
|
+
multiple = props.multiple,
|
|
3125
|
+
onChange = props.onChange,
|
|
3126
|
+
value = props.value,
|
|
3127
|
+
options = props.options,
|
|
3128
|
+
registry = props.registry;
|
|
3129
|
+
var BaseInputTemplate = utils.getTemplate('BaseInputTemplate', registry, options);
|
|
3130
|
+
var extractedFilesInfo = react.useMemo(function () {
|
|
2991
3131
|
return Array.isArray(value) ? extractFileInfo(value) : extractFileInfo([value]);
|
|
2992
3132
|
}, [value]);
|
|
2993
|
-
var _useState =
|
|
3133
|
+
var _useState = react.useState(extractedFilesInfo),
|
|
2994
3134
|
filesInfo = _useState[0],
|
|
2995
3135
|
setFilesInfo = _useState[1];
|
|
2996
|
-
var handleChange =
|
|
3136
|
+
var handleChange = react.useCallback(function (event) {
|
|
2997
3137
|
if (!event.target.files) {
|
|
2998
3138
|
return;
|
|
2999
3139
|
}
|
|
@@ -3009,21 +3149,18 @@
|
|
|
3009
3149
|
}
|
|
3010
3150
|
});
|
|
3011
3151
|
}, [multiple, onChange]);
|
|
3012
|
-
return
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
})
|
|
3024
|
-
filesInfo: filesInfo,
|
|
3025
|
-
registry: registry
|
|
3026
|
-
}));
|
|
3152
|
+
return jsxRuntime.jsxs("div", {
|
|
3153
|
+
children: [jsxRuntime.jsx(BaseInputTemplate, _extends({}, props, {
|
|
3154
|
+
disabled: disabled || readonly,
|
|
3155
|
+
type: 'file',
|
|
3156
|
+
onChangeOverride: handleChange,
|
|
3157
|
+
value: '',
|
|
3158
|
+
accept: options.accept ? String(options.accept) : undefined
|
|
3159
|
+
})), jsxRuntime.jsx(FilesInfo, {
|
|
3160
|
+
filesInfo: filesInfo,
|
|
3161
|
+
registry: registry
|
|
3162
|
+
})]
|
|
3163
|
+
});
|
|
3027
3164
|
}
|
|
3028
3165
|
|
|
3029
3166
|
/** The `HiddenWidget` is a widget for rendering a hidden input field.
|
|
@@ -3034,11 +3171,11 @@
|
|
|
3034
3171
|
function HiddenWidget(_ref) {
|
|
3035
3172
|
var id = _ref.id,
|
|
3036
3173
|
value = _ref.value;
|
|
3037
|
-
return
|
|
3038
|
-
type:
|
|
3174
|
+
return jsxRuntime.jsx("input", {
|
|
3175
|
+
type: 'hidden',
|
|
3039
3176
|
id: id,
|
|
3040
3177
|
name: id,
|
|
3041
|
-
value: typeof value ===
|
|
3178
|
+
value: typeof value === 'undefined' ? '' : value
|
|
3042
3179
|
});
|
|
3043
3180
|
}
|
|
3044
3181
|
|
|
@@ -3049,9 +3186,9 @@
|
|
|
3049
3186
|
function PasswordWidget(props) {
|
|
3050
3187
|
var options = props.options,
|
|
3051
3188
|
registry = props.registry;
|
|
3052
|
-
var BaseInputTemplate = utils.getTemplate(
|
|
3053
|
-
return
|
|
3054
|
-
type:
|
|
3189
|
+
var BaseInputTemplate = utils.getTemplate('BaseInputTemplate', registry, options);
|
|
3190
|
+
return jsxRuntime.jsx(BaseInputTemplate, _extends({
|
|
3191
|
+
type: 'password'
|
|
3055
3192
|
}, props));
|
|
3056
3193
|
}
|
|
3057
3194
|
|
|
@@ -3078,46 +3215,53 @@
|
|
|
3078
3215
|
enumDisabled = options.enumDisabled,
|
|
3079
3216
|
inline = options.inline,
|
|
3080
3217
|
emptyValue = options.emptyValue;
|
|
3081
|
-
var handleBlur =
|
|
3218
|
+
var handleBlur = react.useCallback(function (_ref2) {
|
|
3082
3219
|
var value = _ref2.target.value;
|
|
3083
3220
|
return onBlur(id, utils.enumOptionsValueForIndex(value, enumOptions, emptyValue));
|
|
3084
3221
|
}, [onBlur, id]);
|
|
3085
|
-
var handleFocus =
|
|
3222
|
+
var handleFocus = react.useCallback(function (_ref3) {
|
|
3086
3223
|
var value = _ref3.target.value;
|
|
3087
3224
|
return onFocus(id, utils.enumOptionsValueForIndex(value, enumOptions, emptyValue));
|
|
3088
3225
|
}, [onFocus, id]);
|
|
3089
|
-
return
|
|
3090
|
-
className:
|
|
3091
|
-
id: id
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3226
|
+
return jsxRuntime.jsx("div", {
|
|
3227
|
+
className: 'field-radio-group',
|
|
3228
|
+
id: id,
|
|
3229
|
+
children: Array.isArray(enumOptions) && enumOptions.map(function (option, i) {
|
|
3230
|
+
var checked = utils.enumOptionsIsSelected(option.value, value);
|
|
3231
|
+
var itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
3232
|
+
var disabledCls = disabled || itemDisabled || readonly ? 'disabled' : '';
|
|
3233
|
+
var handleChange = function handleChange() {
|
|
3234
|
+
return onChange(option.value);
|
|
3235
|
+
};
|
|
3236
|
+
var radio = jsxRuntime.jsxs("span", {
|
|
3237
|
+
children: [jsxRuntime.jsx("input", {
|
|
3238
|
+
type: 'radio',
|
|
3239
|
+
id: utils.optionId(id, i),
|
|
3240
|
+
checked: checked,
|
|
3241
|
+
name: name,
|
|
3242
|
+
required: required,
|
|
3243
|
+
value: String(i),
|
|
3244
|
+
disabled: disabled || itemDisabled || readonly,
|
|
3245
|
+
autoFocus: autofocus && i === 0,
|
|
3246
|
+
onChange: handleChange,
|
|
3247
|
+
onBlur: handleBlur,
|
|
3248
|
+
onFocus: handleFocus,
|
|
3249
|
+
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
3250
|
+
}), jsxRuntime.jsx("span", {
|
|
3251
|
+
children: option.label
|
|
3252
|
+
})]
|
|
3253
|
+
});
|
|
3254
|
+
return inline ? jsxRuntime.jsx("label", {
|
|
3255
|
+
className: "radio-inline " + disabledCls,
|
|
3256
|
+
children: radio
|
|
3257
|
+
}, i) : jsxRuntime.jsx("div", {
|
|
3258
|
+
className: "radio " + disabledCls,
|
|
3259
|
+
children: jsxRuntime.jsx("label", {
|
|
3260
|
+
children: radio
|
|
3261
|
+
})
|
|
3262
|
+
}, i);
|
|
3263
|
+
})
|
|
3264
|
+
});
|
|
3121
3265
|
}
|
|
3122
3266
|
|
|
3123
3267
|
/** The `RangeWidget` component uses the `BaseInputTemplate` changing the type to `range` and wrapping the result
|
|
@@ -3128,13 +3272,15 @@
|
|
|
3128
3272
|
function RangeWidget(props) {
|
|
3129
3273
|
var value = props.value,
|
|
3130
3274
|
BaseInputTemplate = props.registry.templates.BaseInputTemplate;
|
|
3131
|
-
return
|
|
3132
|
-
className:
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3275
|
+
return jsxRuntime.jsxs("div", {
|
|
3276
|
+
className: 'field-range-wrapper',
|
|
3277
|
+
children: [jsxRuntime.jsx(BaseInputTemplate, _extends({
|
|
3278
|
+
type: 'range'
|
|
3279
|
+
}, props)), jsxRuntime.jsx("span", {
|
|
3280
|
+
className: 'range-view',
|
|
3281
|
+
children: value
|
|
3282
|
+
})]
|
|
3283
|
+
});
|
|
3138
3284
|
}
|
|
3139
3285
|
|
|
3140
3286
|
function getValue(event, multiple) {
|
|
@@ -3171,45 +3317,47 @@
|
|
|
3171
3317
|
var enumOptions = options.enumOptions,
|
|
3172
3318
|
enumDisabled = options.enumDisabled,
|
|
3173
3319
|
optEmptyVal = options.emptyValue;
|
|
3174
|
-
var emptyValue = multiple ? [] :
|
|
3175
|
-
var handleFocus =
|
|
3320
|
+
var emptyValue = multiple ? [] : '';
|
|
3321
|
+
var handleFocus = react.useCallback(function (event) {
|
|
3176
3322
|
var newValue = getValue(event, multiple);
|
|
3177
3323
|
return onFocus(id, utils.enumOptionsValueForIndex(newValue, enumOptions, optEmptyVal));
|
|
3178
3324
|
}, [onFocus, id, schema, multiple, options]);
|
|
3179
|
-
var handleBlur =
|
|
3325
|
+
var handleBlur = react.useCallback(function (event) {
|
|
3180
3326
|
var newValue = getValue(event, multiple);
|
|
3181
3327
|
return onBlur(id, utils.enumOptionsValueForIndex(newValue, enumOptions, optEmptyVal));
|
|
3182
3328
|
}, [onBlur, id, schema, multiple, options]);
|
|
3183
|
-
var handleChange =
|
|
3329
|
+
var handleChange = react.useCallback(function (event) {
|
|
3184
3330
|
var newValue = getValue(event, multiple);
|
|
3185
3331
|
return onChange(utils.enumOptionsValueForIndex(newValue, enumOptions, optEmptyVal));
|
|
3186
3332
|
}, [onChange, schema, multiple, options]);
|
|
3187
3333
|
var selectedIndexes = utils.enumOptionsIndexForValue(value, enumOptions, multiple);
|
|
3188
|
-
return
|
|
3334
|
+
return jsxRuntime.jsxs("select", {
|
|
3189
3335
|
id: id,
|
|
3190
3336
|
name: id,
|
|
3191
3337
|
multiple: multiple,
|
|
3192
|
-
className:
|
|
3193
|
-
value: typeof selectedIndexes ===
|
|
3338
|
+
className: 'form-control',
|
|
3339
|
+
value: typeof selectedIndexes === 'undefined' ? emptyValue : selectedIndexes,
|
|
3194
3340
|
required: required,
|
|
3195
3341
|
disabled: disabled || readonly,
|
|
3196
3342
|
autoFocus: autofocus,
|
|
3197
3343
|
onBlur: handleBlur,
|
|
3198
3344
|
onFocus: handleFocus,
|
|
3199
3345
|
onChange: handleChange,
|
|
3200
|
-
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3346
|
+
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
3347
|
+
children: [!multiple && schema["default"] === undefined && jsxRuntime.jsx("option", {
|
|
3348
|
+
value: '',
|
|
3349
|
+
children: placeholder
|
|
3350
|
+
}), Array.isArray(enumOptions) && enumOptions.map(function (_ref2, i) {
|
|
3351
|
+
var value = _ref2.value,
|
|
3352
|
+
label = _ref2.label;
|
|
3353
|
+
var disabled = enumDisabled && enumDisabled.indexOf(value) !== -1;
|
|
3354
|
+
return jsxRuntime.jsx("option", {
|
|
3355
|
+
value: String(i),
|
|
3356
|
+
disabled: disabled,
|
|
3357
|
+
children: label
|
|
3358
|
+
}, i);
|
|
3359
|
+
})]
|
|
3360
|
+
});
|
|
3213
3361
|
}
|
|
3214
3362
|
|
|
3215
3363
|
/** The `TextareaWidget` is a widget for rendering input fields as textarea.
|
|
@@ -3230,23 +3378,23 @@
|
|
|
3230
3378
|
onChange = _ref.onChange,
|
|
3231
3379
|
onBlur = _ref.onBlur,
|
|
3232
3380
|
onFocus = _ref.onFocus;
|
|
3233
|
-
var handleChange =
|
|
3381
|
+
var handleChange = react.useCallback(function (_ref2) {
|
|
3234
3382
|
var value = _ref2.target.value;
|
|
3235
|
-
return onChange(value ===
|
|
3383
|
+
return onChange(value === '' ? options.emptyValue : value);
|
|
3236
3384
|
}, [onChange, options.emptyValue]);
|
|
3237
|
-
var handleBlur =
|
|
3385
|
+
var handleBlur = react.useCallback(function (_ref3) {
|
|
3238
3386
|
var value = _ref3.target.value;
|
|
3239
3387
|
return onBlur(id, value);
|
|
3240
3388
|
}, [onBlur, id]);
|
|
3241
|
-
var handleFocus =
|
|
3389
|
+
var handleFocus = react.useCallback(function (_ref4) {
|
|
3242
3390
|
var value = _ref4.target.value;
|
|
3243
3391
|
return onFocus(id, value);
|
|
3244
3392
|
}, [id, onFocus]);
|
|
3245
|
-
return
|
|
3393
|
+
return jsxRuntime.jsx("textarea", {
|
|
3246
3394
|
id: id,
|
|
3247
3395
|
name: id,
|
|
3248
|
-
className:
|
|
3249
|
-
value: value ? value :
|
|
3396
|
+
className: 'form-control',
|
|
3397
|
+
value: value ? value : '',
|
|
3250
3398
|
placeholder: placeholder,
|
|
3251
3399
|
required: required,
|
|
3252
3400
|
disabled: disabled,
|
|
@@ -3271,8 +3419,28 @@
|
|
|
3271
3419
|
function TextWidget(props) {
|
|
3272
3420
|
var options = props.options,
|
|
3273
3421
|
registry = props.registry;
|
|
3274
|
-
var BaseInputTemplate = utils.getTemplate(
|
|
3275
|
-
return
|
|
3422
|
+
var BaseInputTemplate = utils.getTemplate('BaseInputTemplate', registry, options);
|
|
3423
|
+
return jsxRuntime.jsx(BaseInputTemplate, _extends({}, props));
|
|
3424
|
+
}
|
|
3425
|
+
|
|
3426
|
+
/** The `TimeWidget` component uses the `BaseInputTemplate` changing the type to `time` and transforms
|
|
3427
|
+
* the value to undefined when it is falsy during the `onChange` handling.
|
|
3428
|
+
*
|
|
3429
|
+
* @param props - The `WidgetProps` for this component
|
|
3430
|
+
*/
|
|
3431
|
+
function TimeWidget(props) {
|
|
3432
|
+
var onChange = props.onChange,
|
|
3433
|
+
options = props.options,
|
|
3434
|
+
registry = props.registry;
|
|
3435
|
+
var BaseInputTemplate = utils.getTemplate('BaseInputTemplate', registry, options);
|
|
3436
|
+
var handleChange = react.useCallback(function (value) {
|
|
3437
|
+
return onChange(value ? value + ":00" : undefined);
|
|
3438
|
+
}, [onChange]);
|
|
3439
|
+
return jsxRuntime.jsx(BaseInputTemplate, _extends({
|
|
3440
|
+
type: 'time'
|
|
3441
|
+
}, props, {
|
|
3442
|
+
onChange: handleChange
|
|
3443
|
+
}));
|
|
3276
3444
|
}
|
|
3277
3445
|
|
|
3278
3446
|
/** The `URLWidget` component uses the `BaseInputTemplate` changing the type to `url`.
|
|
@@ -3282,9 +3450,9 @@
|
|
|
3282
3450
|
function URLWidget(props) {
|
|
3283
3451
|
var options = props.options,
|
|
3284
3452
|
registry = props.registry;
|
|
3285
|
-
var BaseInputTemplate = utils.getTemplate(
|
|
3286
|
-
return
|
|
3287
|
-
type:
|
|
3453
|
+
var BaseInputTemplate = utils.getTemplate('BaseInputTemplate', registry, options);
|
|
3454
|
+
return jsxRuntime.jsx(BaseInputTemplate, _extends({
|
|
3455
|
+
type: 'url'
|
|
3288
3456
|
}, props));
|
|
3289
3457
|
}
|
|
3290
3458
|
|
|
@@ -3295,32 +3463,33 @@
|
|
|
3295
3463
|
function UpDownWidget(props) {
|
|
3296
3464
|
var options = props.options,
|
|
3297
3465
|
registry = props.registry;
|
|
3298
|
-
var BaseInputTemplate = utils.getTemplate(
|
|
3299
|
-
return
|
|
3300
|
-
type:
|
|
3466
|
+
var BaseInputTemplate = utils.getTemplate('BaseInputTemplate', registry, options);
|
|
3467
|
+
return jsxRuntime.jsx(BaseInputTemplate, _extends({
|
|
3468
|
+
type: 'number'
|
|
3301
3469
|
}, props));
|
|
3302
3470
|
}
|
|
3303
3471
|
|
|
3304
3472
|
function widgets() {
|
|
3305
3473
|
return {
|
|
3474
|
+
AltDateWidget: AltDateWidget,
|
|
3475
|
+
AltDateTimeWidget: AltDateTimeWidget,
|
|
3476
|
+
CheckboxWidget: CheckboxWidget,
|
|
3477
|
+
CheckboxesWidget: CheckboxesWidget,
|
|
3478
|
+
ColorWidget: ColorWidget,
|
|
3479
|
+
DateWidget: DateWidget,
|
|
3480
|
+
DateTimeWidget: DateTimeWidget,
|
|
3481
|
+
EmailWidget: EmailWidget,
|
|
3482
|
+
FileWidget: FileWidget,
|
|
3483
|
+
HiddenWidget: HiddenWidget,
|
|
3306
3484
|
PasswordWidget: PasswordWidget,
|
|
3307
3485
|
RadioWidget: RadioWidget,
|
|
3308
|
-
UpDownWidget: UpDownWidget,
|
|
3309
3486
|
RangeWidget: RangeWidget,
|
|
3310
3487
|
SelectWidget: SelectWidget,
|
|
3311
3488
|
TextWidget: TextWidget,
|
|
3312
|
-
DateWidget: DateWidget,
|
|
3313
|
-
DateTimeWidget: DateTimeWidget,
|
|
3314
|
-
AltDateWidget: AltDateWidget,
|
|
3315
|
-
AltDateTimeWidget: AltDateTimeWidget,
|
|
3316
|
-
EmailWidget: EmailWidget,
|
|
3317
|
-
URLWidget: URLWidget,
|
|
3318
3489
|
TextareaWidget: TextareaWidget,
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
CheckboxWidget: CheckboxWidget,
|
|
3323
|
-
CheckboxesWidget: CheckboxesWidget
|
|
3490
|
+
TimeWidget: TimeWidget,
|
|
3491
|
+
UpDownWidget: UpDownWidget,
|
|
3492
|
+
URLWidget: URLWidget
|
|
3324
3493
|
};
|
|
3325
3494
|
}
|
|
3326
3495
|
|
|
@@ -3358,7 +3527,7 @@
|
|
|
3358
3527
|
_this.formElement = void 0;
|
|
3359
3528
|
_this.getUsedFormData = function (formData, fields) {
|
|
3360
3529
|
// For the case of a single input form
|
|
3361
|
-
if (fields.length === 0 && typeof formData !==
|
|
3530
|
+
if (fields.length === 0 && typeof formData !== 'object') {
|
|
3362
3531
|
return formData;
|
|
3363
3532
|
}
|
|
3364
3533
|
// _pick has incorrect type definition, it works with string[][], because lodash/hasIn supports it
|
|
@@ -3379,22 +3548,22 @@
|
|
|
3379
3548
|
paths = [[]];
|
|
3380
3549
|
}
|
|
3381
3550
|
Object.keys(_obj).forEach(function (key) {
|
|
3382
|
-
if (typeof _obj[key] ===
|
|
3551
|
+
if (typeof _obj[key] === 'object') {
|
|
3383
3552
|
var newPaths = paths.map(function (path) {
|
|
3384
3553
|
return [].concat(path, [key]);
|
|
3385
3554
|
});
|
|
3386
3555
|
// If an object is marked with additionalProperties, all its keys are valid
|
|
3387
|
-
if (_obj[key][utils.RJSF_ADDITONAL_PROPERTIES_FLAG] && _obj[key][utils.NAME_KEY] !==
|
|
3556
|
+
if (_obj[key][utils.RJSF_ADDITONAL_PROPERTIES_FLAG] && _obj[key][utils.NAME_KEY] !== '') {
|
|
3388
3557
|
acc.push(_obj[key][utils.NAME_KEY]);
|
|
3389
3558
|
} else {
|
|
3390
3559
|
getAllPaths(_obj[key], acc, newPaths);
|
|
3391
3560
|
}
|
|
3392
|
-
} else if (key === utils.NAME_KEY && _obj[key] !==
|
|
3561
|
+
} else if (key === utils.NAME_KEY && _obj[key] !== '') {
|
|
3393
3562
|
paths.forEach(function (path) {
|
|
3394
3563
|
var formValue = get__default["default"](formData, path);
|
|
3395
3564
|
// adds path to fieldNames if it points to a value
|
|
3396
3565
|
// or an empty object/array
|
|
3397
|
-
if (typeof formValue !==
|
|
3566
|
+
if (typeof formValue !== 'object' || isEmpty__default["default"](formValue)) {
|
|
3398
3567
|
acc.push(path);
|
|
3399
3568
|
}
|
|
3400
3569
|
});
|
|
@@ -3427,7 +3596,7 @@
|
|
|
3427
3596
|
var newFormData = formData;
|
|
3428
3597
|
if (omitExtraData === true && liveOmit === true) {
|
|
3429
3598
|
var retrievedSchema = schemaUtils.retrieveSchema(schema, formData);
|
|
3430
|
-
var pathSchema = schemaUtils.toPathSchema(retrievedSchema,
|
|
3599
|
+
var pathSchema = schemaUtils.toPathSchema(retrievedSchema, '', formData);
|
|
3431
3600
|
var fieldNames = _this.getFieldNames(pathSchema, formData);
|
|
3432
3601
|
newFormData = _this.getUsedFormData(formData, fieldNames);
|
|
3433
3602
|
state = {
|
|
@@ -3453,7 +3622,7 @@
|
|
|
3453
3622
|
schemaValidationErrorSchema: schemaValidationErrorSchema
|
|
3454
3623
|
};
|
|
3455
3624
|
} else if (!noValidate && newErrorSchema) {
|
|
3456
|
-
var _errorSchema = extraErrors ? utils.mergeObjects(newErrorSchema, extraErrors,
|
|
3625
|
+
var _errorSchema = extraErrors ? utils.mergeObjects(newErrorSchema, extraErrors, 'preventDuplicates') : newErrorSchema;
|
|
3457
3626
|
state = {
|
|
3458
3627
|
formData: newFormData,
|
|
3459
3628
|
errorSchema: _errorSchema,
|
|
@@ -3464,6 +3633,21 @@
|
|
|
3464
3633
|
return onChange && onChange(_extends({}, _this.state, state), id);
|
|
3465
3634
|
});
|
|
3466
3635
|
};
|
|
3636
|
+
_this.reset = function () {
|
|
3637
|
+
var onChange = _this.props.onChange;
|
|
3638
|
+
var newState = _this.getStateFromProps(_this.props, undefined);
|
|
3639
|
+
var newFormData = newState.formData;
|
|
3640
|
+
var state = {
|
|
3641
|
+
formData: newFormData,
|
|
3642
|
+
errorSchema: {},
|
|
3643
|
+
errors: [],
|
|
3644
|
+
schemaValidationErrors: [],
|
|
3645
|
+
schemaValidationErrorSchema: {}
|
|
3646
|
+
};
|
|
3647
|
+
_this.setState(state, function () {
|
|
3648
|
+
return onChange && onChange(_extends({}, _this.state, state));
|
|
3649
|
+
});
|
|
3650
|
+
};
|
|
3467
3651
|
_this.onBlur = function (id, data) {
|
|
3468
3652
|
var onBlur = _this.props.onBlur;
|
|
3469
3653
|
if (onBlur) {
|
|
@@ -3493,7 +3677,7 @@
|
|
|
3493
3677
|
schemaUtils = _this$state2.schemaUtils;
|
|
3494
3678
|
if (omitExtraData === true) {
|
|
3495
3679
|
var retrievedSchema = schemaUtils.retrieveSchema(schema, newFormData);
|
|
3496
|
-
var pathSchema = schemaUtils.toPathSchema(retrievedSchema,
|
|
3680
|
+
var pathSchema = schemaUtils.toPathSchema(retrievedSchema, '', newFormData);
|
|
3497
3681
|
var fieldNames = _this.getFieldNames(pathSchema, newFormData);
|
|
3498
3682
|
newFormData = _this.getUsedFormData(newFormData, fieldNames);
|
|
3499
3683
|
}
|
|
@@ -3512,20 +3696,20 @@
|
|
|
3512
3696
|
if (onSubmit) {
|
|
3513
3697
|
onSubmit(_extends({}, _this.state, {
|
|
3514
3698
|
formData: newFormData,
|
|
3515
|
-
status:
|
|
3699
|
+
status: 'submitted'
|
|
3516
3700
|
}), event);
|
|
3517
3701
|
}
|
|
3518
3702
|
});
|
|
3519
3703
|
}
|
|
3520
3704
|
};
|
|
3521
3705
|
if (!props.validator) {
|
|
3522
|
-
throw new Error(
|
|
3706
|
+
throw new Error('A validator is required for Form functionality to work');
|
|
3523
3707
|
}
|
|
3524
3708
|
_this.state = _this.getStateFromProps(props, props.formData);
|
|
3525
3709
|
if (_this.props.onChange && !utils.deepEquals(_this.state.formData, _this.props.formData)) {
|
|
3526
3710
|
_this.props.onChange(_this.state);
|
|
3527
3711
|
}
|
|
3528
|
-
_this.formElement = /*#__PURE__*/
|
|
3712
|
+
_this.formElement = /*#__PURE__*/react.createRef();
|
|
3529
3713
|
return _this;
|
|
3530
3714
|
}
|
|
3531
3715
|
/** React lifecycle method that gets called before new props are provided, updates the state based on new props. It
|
|
@@ -3552,10 +3736,10 @@
|
|
|
3552
3736
|
*/;
|
|
3553
3737
|
_proto.getStateFromProps = function getStateFromProps(props, inputFormData) {
|
|
3554
3738
|
var state = this.state || {};
|
|
3555
|
-
var schema =
|
|
3556
|
-
var uiSchema = (
|
|
3557
|
-
var edit = typeof inputFormData !==
|
|
3558
|
-
var liveValidate =
|
|
3739
|
+
var schema = 'schema' in props ? props.schema : this.props.schema;
|
|
3740
|
+
var uiSchema = ('uiSchema' in props ? props.uiSchema : this.props.uiSchema) || {};
|
|
3741
|
+
var edit = typeof inputFormData !== 'undefined';
|
|
3742
|
+
var liveValidate = 'liveValidate' in props ? props.liveValidate : this.props.liveValidate;
|
|
3559
3743
|
var mustValidate = edit && !props.noValidate && liveValidate;
|
|
3560
3744
|
var rootSchema = schema;
|
|
3561
3745
|
var schemaUtils = state.schemaUtils;
|
|
@@ -3604,7 +3788,7 @@
|
|
|
3604
3788
|
errorSchema = merged.errorSchema;
|
|
3605
3789
|
errors = merged.errors;
|
|
3606
3790
|
}
|
|
3607
|
-
var idSchema = schemaUtils.toIdSchema(retrievedSchema, uiSchema[
|
|
3791
|
+
var idSchema = schemaUtils.toIdSchema(retrievedSchema, uiSchema['ui:rootFieldId'], formData, props.idPrefix, props.idSeparator);
|
|
3608
3792
|
var nextState = {
|
|
3609
3793
|
schemaUtils: schemaUtils,
|
|
3610
3794
|
schema: schema,
|
|
@@ -3656,9 +3840,9 @@
|
|
|
3656
3840
|
uiSchema = _this$state3.uiSchema;
|
|
3657
3841
|
var formContext = this.props.formContext;
|
|
3658
3842
|
var options = utils.getUiOptions(uiSchema);
|
|
3659
|
-
var ErrorListTemplate = utils.getTemplate(
|
|
3843
|
+
var ErrorListTemplate = utils.getTemplate('ErrorListTemplate', registry, options);
|
|
3660
3844
|
if (errors && errors.length) {
|
|
3661
|
-
return
|
|
3845
|
+
return jsxRuntime.jsx(ErrorListTemplate, {
|
|
3662
3846
|
errors: errors,
|
|
3663
3847
|
errorSchema: errorSchema || {},
|
|
3664
3848
|
schema: schema,
|
|
@@ -3677,7 +3861,10 @@
|
|
|
3677
3861
|
/** Returns the registry for the form */
|
|
3678
3862
|
_proto.getRegistry = function getRegistry() {
|
|
3679
3863
|
var _this$props$templates;
|
|
3680
|
-
var
|
|
3864
|
+
var _this$props4 = this.props,
|
|
3865
|
+
customTranslateString = _this$props4.translateString,
|
|
3866
|
+
_this$props4$uiSchema = _this$props4.uiSchema,
|
|
3867
|
+
uiSchema = _this$props4$uiSchema === void 0 ? {} : _this$props4$uiSchema;
|
|
3681
3868
|
var schemaUtils = this.state.schemaUtils;
|
|
3682
3869
|
var _getDefaultRegistry = getDefaultRegistry(),
|
|
3683
3870
|
fields = _getDefaultRegistry.fields,
|
|
@@ -3694,13 +3881,14 @@
|
|
|
3694
3881
|
rootSchema: this.props.schema,
|
|
3695
3882
|
formContext: this.props.formContext || formContext,
|
|
3696
3883
|
schemaUtils: schemaUtils,
|
|
3697
|
-
translateString: customTranslateString || translateString
|
|
3884
|
+
translateString: customTranslateString || translateString,
|
|
3885
|
+
globalUiOptions: uiSchema[utils.UI_GLOBAL_OPTIONS_KEY]
|
|
3698
3886
|
};
|
|
3699
3887
|
}
|
|
3700
3888
|
/** Provides a function that can be used to programmatically submit the `Form` */;
|
|
3701
3889
|
_proto.submit = function submit() {
|
|
3702
3890
|
if (this.formElement.current) {
|
|
3703
|
-
this.formElement.current.dispatchEvent(new CustomEvent(
|
|
3891
|
+
this.formElement.current.dispatchEvent(new CustomEvent('submit', {
|
|
3704
3892
|
cancelable: true
|
|
3705
3893
|
}));
|
|
3706
3894
|
this.formElement.current.requestSubmit();
|
|
@@ -3713,14 +3901,14 @@
|
|
|
3713
3901
|
* @param error - The error on which to focus
|
|
3714
3902
|
*/;
|
|
3715
3903
|
_proto.focusOnError = function focusOnError(error) {
|
|
3716
|
-
var _this$
|
|
3717
|
-
_this$
|
|
3718
|
-
idPrefix = _this$
|
|
3719
|
-
_this$
|
|
3720
|
-
idSeparator = _this$
|
|
3904
|
+
var _this$props5 = this.props,
|
|
3905
|
+
_this$props5$idPrefix = _this$props5.idPrefix,
|
|
3906
|
+
idPrefix = _this$props5$idPrefix === void 0 ? 'root' : _this$props5$idPrefix,
|
|
3907
|
+
_this$props5$idSepara = _this$props5.idSeparator,
|
|
3908
|
+
idSeparator = _this$props5$idSepara === void 0 ? '_' : _this$props5$idSepara;
|
|
3721
3909
|
var property = error.property;
|
|
3722
3910
|
var path = _toPath__default["default"](property);
|
|
3723
|
-
if (path[0] ===
|
|
3911
|
+
if (path[0] === '') {
|
|
3724
3912
|
// Most of the time the `.foo` property results in the first element being empty, so replace it with the idPrefix
|
|
3725
3913
|
path[0] = idPrefix;
|
|
3726
3914
|
} else {
|
|
@@ -3743,10 +3931,10 @@
|
|
|
3743
3931
|
* @returns - True if the form is valid, false otherwise.
|
|
3744
3932
|
*/;
|
|
3745
3933
|
_proto.validateForm = function validateForm() {
|
|
3746
|
-
var _this$
|
|
3747
|
-
extraErrors = _this$
|
|
3748
|
-
focusOnFirstError = _this$
|
|
3749
|
-
onError = _this$
|
|
3934
|
+
var _this$props6 = this.props,
|
|
3935
|
+
extraErrors = _this$props6.extraErrors,
|
|
3936
|
+
focusOnFirstError = _this$props6.focusOnFirstError,
|
|
3937
|
+
onError = _this$props6.onError;
|
|
3750
3938
|
var formData = this.state.formData;
|
|
3751
3939
|
var schemaUtils = this.state.schemaUtils;
|
|
3752
3940
|
var schemaValidation = this.validate(formData);
|
|
@@ -3772,7 +3960,7 @@
|
|
|
3772
3960
|
if (onError) {
|
|
3773
3961
|
onError(errors);
|
|
3774
3962
|
} else {
|
|
3775
|
-
console.error(
|
|
3963
|
+
console.error('Form validation failed', errors);
|
|
3776
3964
|
}
|
|
3777
3965
|
});
|
|
3778
3966
|
return false;
|
|
@@ -3783,31 +3971,31 @@
|
|
|
3783
3971
|
* needed along with the submit button or any children of the form.
|
|
3784
3972
|
*/;
|
|
3785
3973
|
_proto.render = function render() {
|
|
3786
|
-
var _this$
|
|
3787
|
-
children = _this$
|
|
3788
|
-
id = _this$
|
|
3789
|
-
idPrefix = _this$
|
|
3790
|
-
idSeparator = _this$
|
|
3791
|
-
_this$
|
|
3792
|
-
className = _this$
|
|
3793
|
-
tagName = _this$
|
|
3794
|
-
name = _this$
|
|
3795
|
-
method = _this$
|
|
3796
|
-
target = _this$
|
|
3797
|
-
action = _this$
|
|
3798
|
-
autoComplete = _this$
|
|
3799
|
-
enctype = _this$
|
|
3800
|
-
acceptcharset = _this$
|
|
3801
|
-
_this$
|
|
3802
|
-
noHtml5Validate = _this$
|
|
3803
|
-
_this$
|
|
3804
|
-
disabled = _this$
|
|
3805
|
-
_this$
|
|
3806
|
-
readonly = _this$
|
|
3807
|
-
formContext = _this$
|
|
3808
|
-
_this$
|
|
3809
|
-
showErrorList = _this$
|
|
3810
|
-
_internalFormWrapper = _this$
|
|
3974
|
+
var _this$props7 = this.props,
|
|
3975
|
+
children = _this$props7.children,
|
|
3976
|
+
id = _this$props7.id,
|
|
3977
|
+
idPrefix = _this$props7.idPrefix,
|
|
3978
|
+
idSeparator = _this$props7.idSeparator,
|
|
3979
|
+
_this$props7$classNam = _this$props7.className,
|
|
3980
|
+
className = _this$props7$classNam === void 0 ? '' : _this$props7$classNam,
|
|
3981
|
+
tagName = _this$props7.tagName,
|
|
3982
|
+
name = _this$props7.name,
|
|
3983
|
+
method = _this$props7.method,
|
|
3984
|
+
target = _this$props7.target,
|
|
3985
|
+
action = _this$props7.action,
|
|
3986
|
+
autoComplete = _this$props7.autoComplete,
|
|
3987
|
+
enctype = _this$props7.enctype,
|
|
3988
|
+
acceptcharset = _this$props7.acceptcharset,
|
|
3989
|
+
_this$props7$noHtml5V = _this$props7.noHtml5Validate,
|
|
3990
|
+
noHtml5Validate = _this$props7$noHtml5V === void 0 ? false : _this$props7$noHtml5V,
|
|
3991
|
+
_this$props7$disabled = _this$props7.disabled,
|
|
3992
|
+
disabled = _this$props7$disabled === void 0 ? false : _this$props7$disabled,
|
|
3993
|
+
_this$props7$readonly = _this$props7.readonly,
|
|
3994
|
+
readonly = _this$props7$readonly === void 0 ? false : _this$props7$readonly,
|
|
3995
|
+
formContext = _this$props7.formContext,
|
|
3996
|
+
_this$props7$showErro = _this$props7.showErrorList,
|
|
3997
|
+
showErrorList = _this$props7$showErro === void 0 ? 'top' : _this$props7$showErro,
|
|
3998
|
+
_internalFormWrapper = _this$props7._internalFormWrapper;
|
|
3811
3999
|
var _this$state4 = this.state,
|
|
3812
4000
|
schema = _this$state4.schema,
|
|
3813
4001
|
uiSchema = _this$state4.uiSchema,
|
|
@@ -3821,9 +4009,9 @@
|
|
|
3821
4009
|
// PropTypes.elementType to use for the inner tag, so we'll need to pass `tagName` along if it is provided.
|
|
3822
4010
|
// NOTE, the `as` prop is native to `semantic-ui` and is emulated in the `material-ui` theme
|
|
3823
4011
|
var as = _internalFormWrapper ? tagName : undefined;
|
|
3824
|
-
var FormTag = _internalFormWrapper || tagName ||
|
|
3825
|
-
return
|
|
3826
|
-
className: className ? className :
|
|
4012
|
+
var FormTag = _internalFormWrapper || tagName || 'form';
|
|
4013
|
+
return jsxRuntime.jsxs(FormTag, {
|
|
4014
|
+
className: className ? className : 'rjsf',
|
|
3827
4015
|
id: id,
|
|
3828
4016
|
name: name,
|
|
3829
4017
|
method: method,
|
|
@@ -3835,35 +4023,36 @@
|
|
|
3835
4023
|
noValidate: noHtml5Validate,
|
|
3836
4024
|
onSubmit: this.onSubmit,
|
|
3837
4025
|
as: as,
|
|
3838
|
-
ref: this.formElement
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
4026
|
+
ref: this.formElement,
|
|
4027
|
+
children: [showErrorList === 'top' && this.renderErrors(registry), jsxRuntime.jsx(_SchemaField, {
|
|
4028
|
+
name: '',
|
|
4029
|
+
schema: schema,
|
|
4030
|
+
uiSchema: uiSchema,
|
|
4031
|
+
errorSchema: errorSchema,
|
|
4032
|
+
idSchema: idSchema,
|
|
4033
|
+
idPrefix: idPrefix,
|
|
4034
|
+
idSeparator: idSeparator,
|
|
4035
|
+
formContext: formContext,
|
|
4036
|
+
formData: formData,
|
|
4037
|
+
onChange: this.onChange,
|
|
4038
|
+
onBlur: this.onBlur,
|
|
4039
|
+
onFocus: this.onFocus,
|
|
4040
|
+
registry: registry,
|
|
4041
|
+
disabled: disabled,
|
|
4042
|
+
readonly: readonly
|
|
4043
|
+
}), children ? children : jsxRuntime.jsx(SubmitButton, {
|
|
4044
|
+
uiSchema: uiSchema,
|
|
4045
|
+
registry: registry
|
|
4046
|
+
}), showErrorList === 'bottom' && this.renderErrors(registry)]
|
|
4047
|
+
});
|
|
3859
4048
|
};
|
|
3860
4049
|
return Form;
|
|
3861
|
-
}(
|
|
4050
|
+
}(react.Component);
|
|
3862
4051
|
|
|
3863
4052
|
var _excluded = ["fields", "widgets", "templates"];
|
|
3864
4053
|
/** A Higher-Order component that creates a wrapper around a `Form` with the overrides from the `WithThemeProps` */
|
|
3865
4054
|
function withTheme(themeProps) {
|
|
3866
|
-
return /*#__PURE__*/
|
|
4055
|
+
return /*#__PURE__*/react.forwardRef(function (_ref, ref) {
|
|
3867
4056
|
var _themeProps$templates, _templates;
|
|
3868
4057
|
var fields = _ref.fields,
|
|
3869
4058
|
widgets = _ref.widgets,
|
|
@@ -3874,7 +4063,7 @@
|
|
|
3874
4063
|
templates = _extends({}, themeProps === null || themeProps === void 0 ? void 0 : themeProps.templates, templates, {
|
|
3875
4064
|
ButtonTemplates: _extends({}, themeProps === null || themeProps === void 0 ? void 0 : (_themeProps$templates = themeProps.templates) === null || _themeProps$templates === void 0 ? void 0 : _themeProps$templates.ButtonTemplates, (_templates = templates) === null || _templates === void 0 ? void 0 : _templates.ButtonTemplates)
|
|
3876
4065
|
});
|
|
3877
|
-
return
|
|
4066
|
+
return jsxRuntime.jsx(Form, _extends({}, themeProps, directProps, {
|
|
3878
4067
|
fields: fields,
|
|
3879
4068
|
widgets: widgets,
|
|
3880
4069
|
templates: templates,
|