@limetech/lime-elements 35.0.0-next.24 → 35.0.0-next.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{checkbox.template-7f83d0b4.js → checkbox.template-7e3fd86a.js} +3 -1
- package/dist/cjs/lime-elements.cjs.js +1 -1
- package/dist/cjs/limel-checkbox.cjs.entry.js +6 -5
- package/dist/cjs/limel-form.cjs.entry.js +293 -107
- package/dist/cjs/limel-list_3.cjs.entry.js +2 -2
- package/dist/cjs/limel-menu-list.cjs.entry.js +1 -1
- package/dist/cjs/limel-table.cjs.entry.js +17 -6
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/checkbox/checkbox.css +24 -1
- package/dist/collection/components/checkbox/checkbox.js +5 -4
- package/dist/collection/components/checkbox/checkbox.template.js +3 -1
- package/dist/collection/components/form/form.js +34 -0
- package/dist/collection/components/list/list.css +25 -1
- package/dist/collection/components/menu-list/menu-list.css +25 -1
- package/dist/collection/components/table/table.js +18 -5
- package/dist/esm/{checkbox.template-f429c5b6.js → checkbox.template-e68ade4d.js} +3 -1
- package/dist/esm/lime-elements.js +1 -1
- package/dist/esm/limel-checkbox.entry.js +6 -5
- package/dist/esm/limel-form.entry.js +294 -108
- package/dist/esm/limel-list_3.entry.js +2 -2
- package/dist/esm/limel-menu-list.entry.js +1 -1
- package/dist/esm/limel-table.entry.js +17 -6
- package/dist/esm/loader.js +1 -1
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/p-0c5655e2.js +1 -0
- package/dist/lime-elements/p-1bacecd5.entry.js +73 -0
- package/dist/lime-elements/{p-0f6ca408.entry.js → p-2542b5a3.entry.js} +1 -1
- package/dist/lime-elements/p-2a7c3c07.entry.js +1 -0
- package/dist/lime-elements/{p-68c4e708.entry.js → p-8487c3c9.entry.js} +3 -3
- package/dist/lime-elements/p-e66816a4.entry.js +82 -0
- package/dist/types/components/checkbox/checkbox.d.ts +3 -2
- package/dist/types/components/checkbox/checkbox.template.d.ts +1 -0
- package/dist/types/components/form/form.d.ts +8 -1
- package/dist/types/components/form/form.types.d.ts +6 -0
- package/dist/types/components/table/table.d.ts +2 -0
- package/dist/types/components.d.ts +11 -3
- package/package.json +2 -2
- package/dist/lime-elements/p-3f5ba6f4.entry.js +0 -1
- package/dist/lime-elements/p-555f774c.entry.js +0 -82
- package/dist/lime-elements/p-6acee2e5.entry.js +0 -73
- package/dist/lime-elements/p-be2bd743.js +0 -1
|
@@ -8867,6 +8867,15 @@ function (_Component) {
|
|
|
8867
8867
|
});
|
|
8868
8868
|
}
|
|
8869
8869
|
|
|
8870
|
+
if (isMultiSelect$1(schema, rootSchema)) {
|
|
8871
|
+
// If array has enum or uniqueItems set to true, call renderMultiSelect() to render the default multiselect widget or a custom widget, if specified.
|
|
8872
|
+
return this.renderMultiSelect();
|
|
8873
|
+
}
|
|
8874
|
+
|
|
8875
|
+
if (isCustomWidget$1(uiSchema)) {
|
|
8876
|
+
return this.renderCustomWidget();
|
|
8877
|
+
}
|
|
8878
|
+
|
|
8870
8879
|
if (isFixedItems$1(schema)) {
|
|
8871
8880
|
return this.renderFixedArray();
|
|
8872
8881
|
}
|
|
@@ -8875,10 +8884,6 @@ function (_Component) {
|
|
|
8875
8884
|
return this.renderFiles();
|
|
8876
8885
|
}
|
|
8877
8886
|
|
|
8878
|
-
if (isMultiSelect$1(schema, rootSchema)) {
|
|
8879
|
-
return this.renderMultiSelect();
|
|
8880
|
-
}
|
|
8881
|
-
|
|
8882
8887
|
return this.renderNormalArray();
|
|
8883
8888
|
}
|
|
8884
8889
|
}, {
|
|
@@ -8901,6 +8906,7 @@ function (_Component) {
|
|
|
8901
8906
|
onBlur = _this$props5.onBlur,
|
|
8902
8907
|
onFocus = _this$props5.onFocus,
|
|
8903
8908
|
idPrefix = _this$props5.idPrefix,
|
|
8909
|
+
idSeparator = _this$props5.idSeparator,
|
|
8904
8910
|
rawErrors = _this$props5.rawErrors;
|
|
8905
8911
|
var title = schema.title === undefined ? name : schema.title;
|
|
8906
8912
|
var ArrayFieldTemplate = registry.ArrayFieldTemplate,
|
|
@@ -8919,7 +8925,7 @@ function (_Component) {
|
|
|
8919
8925
|
var itemSchema = retrieveSchema$1(schema.items, rootSchema, item);
|
|
8920
8926
|
var itemErrorSchema = errorSchema ? errorSchema[index] : undefined;
|
|
8921
8927
|
var itemIdPrefix = idSchema.$id + "_" + index;
|
|
8922
|
-
var itemIdSchema = toIdSchema$1(itemSchema, itemIdPrefix, rootSchema, item, idPrefix);
|
|
8928
|
+
var itemIdSchema = toIdSchema$1(itemSchema, itemIdPrefix, rootSchema, item, idPrefix, idSeparator);
|
|
8923
8929
|
return _this2.renderArrayFieldItem({
|
|
8924
8930
|
key: key,
|
|
8925
8931
|
index: index,
|
|
@@ -8956,13 +8962,12 @@ function (_Component) {
|
|
|
8956
8962
|
return react.createElement(Component, arrayProps);
|
|
8957
8963
|
}
|
|
8958
8964
|
}, {
|
|
8959
|
-
key: "
|
|
8960
|
-
value: function
|
|
8965
|
+
key: "renderCustomWidget",
|
|
8966
|
+
value: function renderCustomWidget() {
|
|
8961
8967
|
var _this$props6 = this.props,
|
|
8962
8968
|
schema = _this$props6.schema,
|
|
8963
8969
|
idSchema = _this$props6.idSchema,
|
|
8964
8970
|
uiSchema = _this$props6.uiSchema,
|
|
8965
|
-
formData = _this$props6.formData,
|
|
8966
8971
|
disabled = _this$props6.disabled,
|
|
8967
8972
|
readonly = _this$props6.readonly,
|
|
8968
8973
|
required = _this$props6.required,
|
|
@@ -8970,24 +8975,18 @@ function (_Component) {
|
|
|
8970
8975
|
autofocus = _this$props6.autofocus,
|
|
8971
8976
|
onBlur = _this$props6.onBlur,
|
|
8972
8977
|
onFocus = _this$props6.onFocus,
|
|
8978
|
+
items = _this$props6.formData,
|
|
8973
8979
|
_this$props6$registry = _this$props6.registry,
|
|
8974
8980
|
registry = _this$props6$registry === void 0 ? getDefaultRegistry$1() : _this$props6$registry,
|
|
8975
8981
|
rawErrors = _this$props6.rawErrors,
|
|
8976
8982
|
name = _this$props6.name;
|
|
8977
|
-
var items = this.props.formData;
|
|
8978
8983
|
var widgets = registry.widgets,
|
|
8979
|
-
rootSchema = registry.rootSchema,
|
|
8980
8984
|
formContext = registry.formContext;
|
|
8981
|
-
var itemsSchema = retrieveSchema$1(schema.items, rootSchema, formData);
|
|
8982
8985
|
var title = schema.title || name;
|
|
8983
|
-
var enumOptions = optionsList$1(itemsSchema);
|
|
8984
8986
|
|
|
8985
|
-
var
|
|
8986
|
-
|
|
8987
|
-
|
|
8988
|
-
_getUiOptions$enumOpt2 = _getUiOptions$enumOpt.widget,
|
|
8989
|
-
widget = _getUiOptions$enumOpt2 === void 0 ? "select" : _getUiOptions$enumOpt2,
|
|
8990
|
-
options = _objectWithoutProperties$g(_getUiOptions$enumOpt, ["widget"]);
|
|
8987
|
+
var _getUiOptions2 = _objectSpread$g({}, getUiOptions$1(uiSchema)),
|
|
8988
|
+
widget = _getUiOptions2.widget,
|
|
8989
|
+
options = _objectWithoutProperties$g(_getUiOptions2, ["widget"]);
|
|
8991
8990
|
|
|
8992
8991
|
var Widget = getWidget$1(schema, widget, widgets);
|
|
8993
8992
|
return react.createElement(Widget, {
|
|
@@ -9011,73 +9010,129 @@ function (_Component) {
|
|
|
9011
9010
|
});
|
|
9012
9011
|
}
|
|
9013
9012
|
}, {
|
|
9014
|
-
key: "
|
|
9015
|
-
value: function
|
|
9013
|
+
key: "renderMultiSelect",
|
|
9014
|
+
value: function renderMultiSelect() {
|
|
9016
9015
|
var _this$props7 = this.props,
|
|
9017
9016
|
schema = _this$props7.schema,
|
|
9018
|
-
uiSchema = _this$props7.uiSchema,
|
|
9019
9017
|
idSchema = _this$props7.idSchema,
|
|
9020
|
-
|
|
9018
|
+
uiSchema = _this$props7.uiSchema,
|
|
9019
|
+
formData = _this$props7.formData,
|
|
9021
9020
|
disabled = _this$props7.disabled,
|
|
9022
9021
|
readonly = _this$props7.readonly,
|
|
9022
|
+
required = _this$props7.required,
|
|
9023
|
+
placeholder = _this$props7.placeholder,
|
|
9023
9024
|
autofocus = _this$props7.autofocus,
|
|
9024
9025
|
onBlur = _this$props7.onBlur,
|
|
9025
9026
|
onFocus = _this$props7.onFocus,
|
|
9026
9027
|
_this$props7$registry = _this$props7.registry,
|
|
9027
9028
|
registry = _this$props7$registry === void 0 ? getDefaultRegistry$1() : _this$props7$registry,
|
|
9028
|
-
rawErrors = _this$props7.rawErrors
|
|
9029
|
-
|
|
9029
|
+
rawErrors = _this$props7.rawErrors,
|
|
9030
|
+
name = _this$props7.name;
|
|
9030
9031
|
var items = this.props.formData;
|
|
9031
9032
|
var widgets = registry.widgets,
|
|
9033
|
+
rootSchema = registry.rootSchema,
|
|
9032
9034
|
formContext = registry.formContext;
|
|
9035
|
+
var itemsSchema = retrieveSchema$1(schema.items, rootSchema, formData);
|
|
9036
|
+
var title = schema.title || name;
|
|
9037
|
+
var enumOptions = optionsList$1(itemsSchema);
|
|
9033
9038
|
|
|
9034
|
-
var
|
|
9035
|
-
|
|
9036
|
-
|
|
9037
|
-
|
|
9039
|
+
var _getUiOptions$enumOpt = _objectSpread$g({}, getUiOptions$1(uiSchema), {
|
|
9040
|
+
enumOptions: enumOptions
|
|
9041
|
+
}),
|
|
9042
|
+
_getUiOptions$enumOpt2 = _getUiOptions$enumOpt.widget,
|
|
9043
|
+
widget = _getUiOptions$enumOpt2 === void 0 ? "select" : _getUiOptions$enumOpt2,
|
|
9044
|
+
options = _objectWithoutProperties$g(_getUiOptions$enumOpt, ["widget"]);
|
|
9038
9045
|
|
|
9039
9046
|
var Widget = getWidget$1(schema, widget, widgets);
|
|
9040
9047
|
return react.createElement(Widget, {
|
|
9041
|
-
options: options,
|
|
9042
9048
|
id: idSchema && idSchema.$id,
|
|
9043
9049
|
multiple: true,
|
|
9044
9050
|
onChange: this.onSelectChange,
|
|
9045
9051
|
onBlur: onBlur,
|
|
9046
9052
|
onFocus: onFocus,
|
|
9053
|
+
options: options,
|
|
9047
9054
|
schema: schema,
|
|
9048
|
-
|
|
9055
|
+
registry: registry,
|
|
9049
9056
|
value: items,
|
|
9050
9057
|
disabled: disabled,
|
|
9051
9058
|
readonly: readonly,
|
|
9059
|
+
required: required,
|
|
9060
|
+
label: title,
|
|
9061
|
+
placeholder: placeholder,
|
|
9052
9062
|
formContext: formContext,
|
|
9053
9063
|
autofocus: autofocus,
|
|
9054
9064
|
rawErrors: rawErrors
|
|
9055
9065
|
});
|
|
9056
9066
|
}
|
|
9057
9067
|
}, {
|
|
9058
|
-
key: "
|
|
9059
|
-
value: function
|
|
9060
|
-
var _this3 = this;
|
|
9061
|
-
|
|
9068
|
+
key: "renderFiles",
|
|
9069
|
+
value: function renderFiles() {
|
|
9062
9070
|
var _this$props8 = this.props,
|
|
9063
9071
|
schema = _this$props8.schema,
|
|
9064
9072
|
uiSchema = _this$props8.uiSchema,
|
|
9065
|
-
formData = _this$props8.formData,
|
|
9066
|
-
errorSchema = _this$props8.errorSchema,
|
|
9067
|
-
idPrefix = _this$props8.idPrefix,
|
|
9068
9073
|
idSchema = _this$props8.idSchema,
|
|
9069
9074
|
name = _this$props8.name,
|
|
9070
|
-
required = _this$props8.required,
|
|
9071
9075
|
disabled = _this$props8.disabled,
|
|
9072
9076
|
readonly = _this$props8.readonly,
|
|
9073
9077
|
autofocus = _this$props8.autofocus,
|
|
9074
|
-
_this$props8$registry = _this$props8.registry,
|
|
9075
|
-
registry = _this$props8$registry === void 0 ? getDefaultRegistry$1() : _this$props8$registry,
|
|
9076
9078
|
onBlur = _this$props8.onBlur,
|
|
9077
9079
|
onFocus = _this$props8.onFocus,
|
|
9080
|
+
_this$props8$registry = _this$props8.registry,
|
|
9081
|
+
registry = _this$props8$registry === void 0 ? getDefaultRegistry$1() : _this$props8$registry,
|
|
9078
9082
|
rawErrors = _this$props8.rawErrors;
|
|
9079
9083
|
var title = schema.title || name;
|
|
9080
9084
|
var items = this.props.formData;
|
|
9085
|
+
var widgets = registry.widgets,
|
|
9086
|
+
formContext = registry.formContext;
|
|
9087
|
+
|
|
9088
|
+
var _getUiOptions3 = getUiOptions$1(uiSchema),
|
|
9089
|
+
_getUiOptions3$widget = _getUiOptions3.widget,
|
|
9090
|
+
widget = _getUiOptions3$widget === void 0 ? "files" : _getUiOptions3$widget,
|
|
9091
|
+
options = _objectWithoutProperties$g(_getUiOptions3, ["widget"]);
|
|
9092
|
+
|
|
9093
|
+
var Widget = getWidget$1(schema, widget, widgets);
|
|
9094
|
+
return react.createElement(Widget, {
|
|
9095
|
+
options: options,
|
|
9096
|
+
id: idSchema && idSchema.$id,
|
|
9097
|
+
multiple: true,
|
|
9098
|
+
onChange: this.onSelectChange,
|
|
9099
|
+
onBlur: onBlur,
|
|
9100
|
+
onFocus: onFocus,
|
|
9101
|
+
schema: schema,
|
|
9102
|
+
title: title,
|
|
9103
|
+
value: items,
|
|
9104
|
+
disabled: disabled,
|
|
9105
|
+
readonly: readonly,
|
|
9106
|
+
formContext: formContext,
|
|
9107
|
+
autofocus: autofocus,
|
|
9108
|
+
rawErrors: rawErrors
|
|
9109
|
+
});
|
|
9110
|
+
}
|
|
9111
|
+
}, {
|
|
9112
|
+
key: "renderFixedArray",
|
|
9113
|
+
value: function renderFixedArray() {
|
|
9114
|
+
var _this3 = this;
|
|
9115
|
+
|
|
9116
|
+
var _this$props9 = this.props,
|
|
9117
|
+
schema = _this$props9.schema,
|
|
9118
|
+
uiSchema = _this$props9.uiSchema,
|
|
9119
|
+
formData = _this$props9.formData,
|
|
9120
|
+
errorSchema = _this$props9.errorSchema,
|
|
9121
|
+
idPrefix = _this$props9.idPrefix,
|
|
9122
|
+
idSeparator = _this$props9.idSeparator,
|
|
9123
|
+
idSchema = _this$props9.idSchema,
|
|
9124
|
+
name = _this$props9.name,
|
|
9125
|
+
required = _this$props9.required,
|
|
9126
|
+
disabled = _this$props9.disabled,
|
|
9127
|
+
readonly = _this$props9.readonly,
|
|
9128
|
+
autofocus = _this$props9.autofocus,
|
|
9129
|
+
_this$props9$registry = _this$props9.registry,
|
|
9130
|
+
registry = _this$props9$registry === void 0 ? getDefaultRegistry$1() : _this$props9$registry,
|
|
9131
|
+
onBlur = _this$props9.onBlur,
|
|
9132
|
+
onFocus = _this$props9.onFocus,
|
|
9133
|
+
rawErrors = _this$props9.rawErrors;
|
|
9134
|
+
var title = schema.title || name;
|
|
9135
|
+
var items = this.props.formData;
|
|
9081
9136
|
var ArrayFieldTemplate = registry.ArrayFieldTemplate,
|
|
9082
9137
|
rootSchema = registry.rootSchema,
|
|
9083
9138
|
fields = registry.fields,
|
|
@@ -9107,7 +9162,7 @@ function (_Component) {
|
|
|
9107
9162
|
var additional = index >= itemSchemas.length;
|
|
9108
9163
|
var itemSchema = additional ? retrieveSchema$1(schema.additionalItems, rootSchema, item) : itemSchemas[index];
|
|
9109
9164
|
var itemIdPrefix = idSchema.$id + "_" + index;
|
|
9110
|
-
var itemIdSchema = toIdSchema$1(itemSchema, itemIdPrefix, rootSchema, item, idPrefix);
|
|
9165
|
+
var itemIdSchema = toIdSchema$1(itemSchema, itemIdPrefix, rootSchema, item, idPrefix, idSeparator);
|
|
9111
9166
|
var itemUiSchema = additional ? uiSchema.additionalItems || {} : Array.isArray(uiSchema.items) ? uiSchema.items[index] : uiSchema.items || {};
|
|
9112
9167
|
var itemErrorSchema = errorSchema ? errorSchema[index] : undefined;
|
|
9113
9168
|
return _this3.renderArrayFieldItem({
|
|
@@ -9160,12 +9215,12 @@ function (_Component) {
|
|
|
9160
9215
|
onBlur = props.onBlur,
|
|
9161
9216
|
onFocus = props.onFocus,
|
|
9162
9217
|
rawErrors = props.rawErrors;
|
|
9163
|
-
var _this$
|
|
9164
|
-
disabled = _this$
|
|
9165
|
-
readonly = _this$
|
|
9166
|
-
uiSchema = _this$
|
|
9167
|
-
_this$
|
|
9168
|
-
registry = _this$
|
|
9218
|
+
var _this$props10 = this.props,
|
|
9219
|
+
disabled = _this$props10.disabled,
|
|
9220
|
+
readonly = _this$props10.readonly,
|
|
9221
|
+
uiSchema = _this$props10.uiSchema,
|
|
9222
|
+
_this$props10$registr = _this$props10.registry,
|
|
9223
|
+
registry = _this$props10$registr === void 0 ? getDefaultRegistry$1() : _this$props10$registr;
|
|
9169
9224
|
var SchemaField = registry.fields.SchemaField;
|
|
9170
9225
|
|
|
9171
9226
|
var _orderable$removable$ = _objectSpread$g({
|
|
@@ -9505,6 +9560,7 @@ function (_Component) {
|
|
|
9505
9560
|
errorSchema = _this$props3.errorSchema,
|
|
9506
9561
|
formData = _this$props3.formData,
|
|
9507
9562
|
idPrefix = _this$props3.idPrefix,
|
|
9563
|
+
idSeparator = _this$props3.idSeparator,
|
|
9508
9564
|
idSchema = _this$props3.idSchema,
|
|
9509
9565
|
onBlur = _this$props3.onBlur,
|
|
9510
9566
|
onChange = _this$props3.onChange,
|
|
@@ -9565,6 +9621,7 @@ function (_Component) {
|
|
|
9565
9621
|
errorSchema: errorSchema,
|
|
9566
9622
|
idSchema: idSchema,
|
|
9567
9623
|
idPrefix: idPrefix,
|
|
9624
|
+
idSeparator: idSeparator,
|
|
9568
9625
|
formData: formData,
|
|
9569
9626
|
onChange: onChange,
|
|
9570
9627
|
onBlur: onBlur,
|
|
@@ -9935,6 +9992,7 @@ function (_Component) {
|
|
|
9935
9992
|
disabled = _this$props2.disabled,
|
|
9936
9993
|
readonly = _this$props2.readonly,
|
|
9937
9994
|
idPrefix = _this$props2.idPrefix,
|
|
9995
|
+
idSeparator = _this$props2.idSeparator,
|
|
9938
9996
|
onBlur = _this$props2.onBlur,
|
|
9939
9997
|
onFocus = _this$props2.onFocus,
|
|
9940
9998
|
_this$props2$registry = _this$props2.registry,
|
|
@@ -9982,6 +10040,7 @@ function (_Component) {
|
|
|
9982
10040
|
errorSchema: errorSchema[name],
|
|
9983
10041
|
idSchema: idSchema[name],
|
|
9984
10042
|
idPrefix: idPrefix,
|
|
10043
|
+
idSeparator: idSeparator,
|
|
9985
10044
|
formData: (formData || {})[name],
|
|
9986
10045
|
wasPropertyKeyModified: _this2.state.wasPropertyKeyModified,
|
|
9987
10046
|
onKeyChange: _this2.onKeyChange(name),
|
|
@@ -10260,6 +10319,7 @@ function SchemaFieldRender$1(props) {
|
|
|
10260
10319
|
formData = props.formData,
|
|
10261
10320
|
errorSchema = props.errorSchema,
|
|
10262
10321
|
idPrefix = props.idPrefix,
|
|
10322
|
+
idSeparator = props.idSeparator,
|
|
10263
10323
|
name = props.name,
|
|
10264
10324
|
onChange = props.onChange,
|
|
10265
10325
|
onKeyChange = props.onKeyChange,
|
|
@@ -10275,7 +10335,7 @@ function SchemaFieldRender$1(props) {
|
|
|
10275
10335
|
var FieldTemplate = uiSchema["ui:FieldTemplate"] || registry.FieldTemplate || DefaultTemplate$1;
|
|
10276
10336
|
var idSchema = props.idSchema;
|
|
10277
10337
|
var schema = retrieveSchema$1(props.schema, rootSchema, formData);
|
|
10278
|
-
idSchema = mergeObjects$1(toIdSchema$1(schema, null, rootSchema, formData, idPrefix), idSchema);
|
|
10338
|
+
idSchema = mergeObjects$1(toIdSchema$1(schema, null, rootSchema, formData, idPrefix, idSeparator), idSchema);
|
|
10279
10339
|
var FieldComponent = getFieldComponent$1(schema, uiSchema, idSchema, fields);
|
|
10280
10340
|
var DescriptionField = fields.DescriptionField;
|
|
10281
10341
|
var disabled = Boolean(props.disabled || uiSchema["ui:disabled"]);
|
|
@@ -19397,7 +19457,7 @@ function getDisplayLabel$1(schema, uiSchema, rootSchema) {
|
|
|
19397
19457
|
var schemaType = getSchemaType$1(schema);
|
|
19398
19458
|
|
|
19399
19459
|
if (schemaType === "array") {
|
|
19400
|
-
displayLabel = isMultiSelect$1(schema, rootSchema) || isFilesArray$1(schema, uiSchema, rootSchema);
|
|
19460
|
+
displayLabel = isMultiSelect$1(schema, rootSchema) || isFilesArray$1(schema, uiSchema, rootSchema) || isCustomWidget$1(uiSchema);
|
|
19401
19461
|
}
|
|
19402
19462
|
|
|
19403
19463
|
if (schemaType === "object") {
|
|
@@ -19574,6 +19634,12 @@ function isFixedItems$1(schema) {
|
|
|
19574
19634
|
return isObject$1(item);
|
|
19575
19635
|
});
|
|
19576
19636
|
}
|
|
19637
|
+
function isCustomWidget$1(uiSchema) {
|
|
19638
|
+
return (// TODO: Remove the `&& uiSchema["ui:widget"] !== "hidden"` once we support hidden widgets for arrays.
|
|
19639
|
+
// https://react-jsonschema-form.readthedocs.io/en/latest/usage/widgets/#hidden-widgets
|
|
19640
|
+
"widget" in getUiOptions$1(uiSchema) && getUiOptions$1(uiSchema)["widget"] !== "hidden"
|
|
19641
|
+
);
|
|
19642
|
+
}
|
|
19577
19643
|
function allowAdditionalItems$1(schema) {
|
|
19578
19644
|
if (schema.additionalItems === true) {
|
|
19579
19645
|
console.warn("additionalItems=true is currently not supported");
|
|
@@ -19976,6 +20042,7 @@ function shouldRender$1(comp, nextProps, nextState) {
|
|
|
19976
20042
|
function toIdSchema$1(schema, id, rootSchema) {
|
|
19977
20043
|
var formData = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
19978
20044
|
var idPrefix = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : "root";
|
|
20045
|
+
var idSeparator = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : "_";
|
|
19979
20046
|
var idSchema = {
|
|
19980
20047
|
$id: id || idPrefix
|
|
19981
20048
|
};
|
|
@@ -19983,11 +20050,11 @@ function toIdSchema$1(schema, id, rootSchema) {
|
|
|
19983
20050
|
if ("$ref" in schema || "dependencies" in schema || "allOf" in schema) {
|
|
19984
20051
|
var _schema = retrieveSchema$1(schema, rootSchema, formData);
|
|
19985
20052
|
|
|
19986
|
-
return toIdSchema$1(_schema, id, rootSchema, formData, idPrefix);
|
|
20053
|
+
return toIdSchema$1(_schema, id, rootSchema, formData, idPrefix, idSeparator);
|
|
19987
20054
|
}
|
|
19988
20055
|
|
|
19989
20056
|
if ("items" in schema && !schema.items.$ref) {
|
|
19990
|
-
return toIdSchema$1(schema.items, id, rootSchema, formData, idPrefix);
|
|
20057
|
+
return toIdSchema$1(schema.items, id, rootSchema, formData, idPrefix, idSeparator);
|
|
19991
20058
|
}
|
|
19992
20059
|
|
|
19993
20060
|
if (schema.type !== "object") {
|
|
@@ -19996,10 +20063,10 @@ function toIdSchema$1(schema, id, rootSchema) {
|
|
|
19996
20063
|
|
|
19997
20064
|
for (var name in schema.properties || {}) {
|
|
19998
20065
|
var field = schema.properties[name];
|
|
19999
|
-
var fieldId = idSchema.$id +
|
|
20066
|
+
var fieldId = idSchema.$id + idSeparator + name;
|
|
20000
20067
|
idSchema[name] = toIdSchema$1(isObject$1(field) ? field : {}, fieldId, rootSchema, // It's possible that formData is not an object -- this can happen if an
|
|
20001
20068
|
// array item has just been added, but not populated with data yet
|
|
20002
|
-
(formData || {})[name], idPrefix);
|
|
20069
|
+
(formData || {})[name], idPrefix, idSeparator);
|
|
20003
20070
|
}
|
|
20004
20071
|
|
|
20005
20072
|
return idSchema;
|
|
@@ -20572,7 +20639,7 @@ function (_Component) {
|
|
|
20572
20639
|
errors = toErrorList$1(errorSchema);
|
|
20573
20640
|
}
|
|
20574
20641
|
|
|
20575
|
-
var idSchema = toIdSchema$1(retrievedSchema, uiSchema["ui:rootFieldId"], rootSchema, formData, props.idPrefix);
|
|
20642
|
+
var idSchema = toIdSchema$1(retrievedSchema, uiSchema["ui:rootFieldId"], rootSchema, formData, props.idPrefix, props.idSeparator);
|
|
20576
20643
|
var nextState = {
|
|
20577
20644
|
schema: schema,
|
|
20578
20645
|
uiSchema: uiSchema,
|
|
@@ -20675,6 +20742,7 @@ function (_Component) {
|
|
|
20675
20742
|
children = _this$props5.children,
|
|
20676
20743
|
id = _this$props5.id,
|
|
20677
20744
|
idPrefix = _this$props5.idPrefix,
|
|
20745
|
+
idSeparator = _this$props5.idSeparator,
|
|
20678
20746
|
className = _this$props5.className,
|
|
20679
20747
|
tagName = _this$props5.tagName,
|
|
20680
20748
|
name = _this$props5.name,
|
|
@@ -20725,6 +20793,7 @@ function (_Component) {
|
|
|
20725
20793
|
errorSchema: errorSchema,
|
|
20726
20794
|
idSchema: idSchema,
|
|
20727
20795
|
idPrefix: idPrefix,
|
|
20796
|
+
idSeparator: idSeparator,
|
|
20728
20797
|
formContext: formContext,
|
|
20729
20798
|
formData: formData,
|
|
20730
20799
|
onChange: this.onChange,
|
|
@@ -21859,6 +21928,44 @@ function mapKeys(object, iteratee) {
|
|
|
21859
21928
|
return result;
|
|
21860
21929
|
}
|
|
21861
21930
|
|
|
21931
|
+
/**
|
|
21932
|
+
* Creates an object with the same keys as `object` and values generated
|
|
21933
|
+
* by running each own enumerable string keyed property of `object` thru
|
|
21934
|
+
* `iteratee`. The iteratee is invoked with three arguments:
|
|
21935
|
+
* (value, key, object).
|
|
21936
|
+
*
|
|
21937
|
+
* @static
|
|
21938
|
+
* @memberOf _
|
|
21939
|
+
* @since 2.4.0
|
|
21940
|
+
* @category Object
|
|
21941
|
+
* @param {Object} object The object to iterate over.
|
|
21942
|
+
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
|
21943
|
+
* @returns {Object} Returns the new mapped object.
|
|
21944
|
+
* @see _.mapKeys
|
|
21945
|
+
* @example
|
|
21946
|
+
*
|
|
21947
|
+
* var users = {
|
|
21948
|
+
* 'fred': { 'user': 'fred', 'age': 40 },
|
|
21949
|
+
* 'pebbles': { 'user': 'pebbles', 'age': 1 }
|
|
21950
|
+
* };
|
|
21951
|
+
*
|
|
21952
|
+
* _.mapValues(users, function(o) { return o.age; });
|
|
21953
|
+
* // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
|
|
21954
|
+
*
|
|
21955
|
+
* // The `_.property` iteratee shorthand.
|
|
21956
|
+
* _.mapValues(users, 'age');
|
|
21957
|
+
* // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
|
|
21958
|
+
*/
|
|
21959
|
+
function mapValues(object, iteratee) {
|
|
21960
|
+
var result = {};
|
|
21961
|
+
iteratee = pickBy.baseIteratee(iteratee);
|
|
21962
|
+
|
|
21963
|
+
baseForOwn(object, function(value, key, object) {
|
|
21964
|
+
_assignValue$1.baseAssignValue(result, key, iteratee(value, key, object));
|
|
21965
|
+
});
|
|
21966
|
+
return result;
|
|
21967
|
+
}
|
|
21968
|
+
|
|
21862
21969
|
/** Used as references for various `Number` constants. */
|
|
21863
21970
|
var INFINITY = 1 / 0;
|
|
21864
21971
|
|
|
@@ -23170,6 +23277,15 @@ function (_Component) {
|
|
|
23170
23277
|
});
|
|
23171
23278
|
}
|
|
23172
23279
|
|
|
23280
|
+
if (isMultiSelect(schema, rootSchema)) {
|
|
23281
|
+
// If array has enum or uniqueItems set to true, call renderMultiSelect() to render the default multiselect widget or a custom widget, if specified.
|
|
23282
|
+
return this.renderMultiSelect();
|
|
23283
|
+
}
|
|
23284
|
+
|
|
23285
|
+
if (isCustomWidget(uiSchema)) {
|
|
23286
|
+
return this.renderCustomWidget();
|
|
23287
|
+
}
|
|
23288
|
+
|
|
23173
23289
|
if (isFixedItems(schema)) {
|
|
23174
23290
|
return this.renderFixedArray();
|
|
23175
23291
|
}
|
|
@@ -23178,10 +23294,6 @@ function (_Component) {
|
|
|
23178
23294
|
return this.renderFiles();
|
|
23179
23295
|
}
|
|
23180
23296
|
|
|
23181
|
-
if (isMultiSelect(schema, rootSchema)) {
|
|
23182
|
-
return this.renderMultiSelect();
|
|
23183
|
-
}
|
|
23184
|
-
|
|
23185
23297
|
return this.renderNormalArray();
|
|
23186
23298
|
}
|
|
23187
23299
|
}, {
|
|
@@ -23204,6 +23316,7 @@ function (_Component) {
|
|
|
23204
23316
|
onBlur = _this$props5.onBlur,
|
|
23205
23317
|
onFocus = _this$props5.onFocus,
|
|
23206
23318
|
idPrefix = _this$props5.idPrefix,
|
|
23319
|
+
idSeparator = _this$props5.idSeparator,
|
|
23207
23320
|
rawErrors = _this$props5.rawErrors;
|
|
23208
23321
|
var title = schema.title === undefined ? name : schema.title;
|
|
23209
23322
|
var ArrayFieldTemplate = registry.ArrayFieldTemplate,
|
|
@@ -23222,7 +23335,7 @@ function (_Component) {
|
|
|
23222
23335
|
var itemSchema = retrieveSchema(schema.items, rootSchema, item);
|
|
23223
23336
|
var itemErrorSchema = errorSchema ? errorSchema[index] : undefined;
|
|
23224
23337
|
var itemIdPrefix = idSchema.$id + "_" + index;
|
|
23225
|
-
var itemIdSchema = toIdSchema(itemSchema, itemIdPrefix, rootSchema, item, idPrefix);
|
|
23338
|
+
var itemIdSchema = toIdSchema(itemSchema, itemIdPrefix, rootSchema, item, idPrefix, idSeparator);
|
|
23226
23339
|
return _this2.renderArrayFieldItem({
|
|
23227
23340
|
key: key,
|
|
23228
23341
|
index: index,
|
|
@@ -23259,13 +23372,12 @@ function (_Component) {
|
|
|
23259
23372
|
return react.createElement(Component, arrayProps);
|
|
23260
23373
|
}
|
|
23261
23374
|
}, {
|
|
23262
|
-
key: "
|
|
23263
|
-
value: function
|
|
23375
|
+
key: "renderCustomWidget",
|
|
23376
|
+
value: function renderCustomWidget() {
|
|
23264
23377
|
var _this$props6 = this.props,
|
|
23265
23378
|
schema = _this$props6.schema,
|
|
23266
23379
|
idSchema = _this$props6.idSchema,
|
|
23267
23380
|
uiSchema = _this$props6.uiSchema,
|
|
23268
|
-
formData = _this$props6.formData,
|
|
23269
23381
|
disabled = _this$props6.disabled,
|
|
23270
23382
|
readonly = _this$props6.readonly,
|
|
23271
23383
|
required = _this$props6.required,
|
|
@@ -23273,24 +23385,18 @@ function (_Component) {
|
|
|
23273
23385
|
autofocus = _this$props6.autofocus,
|
|
23274
23386
|
onBlur = _this$props6.onBlur,
|
|
23275
23387
|
onFocus = _this$props6.onFocus,
|
|
23388
|
+
items = _this$props6.formData,
|
|
23276
23389
|
_this$props6$registry = _this$props6.registry,
|
|
23277
23390
|
registry = _this$props6$registry === void 0 ? getDefaultRegistry() : _this$props6$registry,
|
|
23278
23391
|
rawErrors = _this$props6.rawErrors,
|
|
23279
23392
|
name = _this$props6.name;
|
|
23280
|
-
var items = this.props.formData;
|
|
23281
23393
|
var widgets = registry.widgets,
|
|
23282
|
-
rootSchema = registry.rootSchema,
|
|
23283
23394
|
formContext = registry.formContext;
|
|
23284
|
-
var itemsSchema = retrieveSchema(schema.items, rootSchema, formData);
|
|
23285
23395
|
var title = schema.title || name;
|
|
23286
|
-
var enumOptions = optionsList(itemsSchema);
|
|
23287
23396
|
|
|
23288
|
-
var
|
|
23289
|
-
|
|
23290
|
-
|
|
23291
|
-
_getUiOptions$enumOpt2 = _getUiOptions$enumOpt.widget,
|
|
23292
|
-
widget = _getUiOptions$enumOpt2 === void 0 ? "select" : _getUiOptions$enumOpt2,
|
|
23293
|
-
options = _objectWithoutProperties$7(_getUiOptions$enumOpt, ["widget"]);
|
|
23397
|
+
var _getUiOptions2 = _objectSpread$7({}, getUiOptions(uiSchema)),
|
|
23398
|
+
widget = _getUiOptions2.widget,
|
|
23399
|
+
options = _objectWithoutProperties$7(_getUiOptions2, ["widget"]);
|
|
23294
23400
|
|
|
23295
23401
|
var Widget = getWidget(schema, widget, widgets);
|
|
23296
23402
|
return react.createElement(Widget, {
|
|
@@ -23314,73 +23420,129 @@ function (_Component) {
|
|
|
23314
23420
|
});
|
|
23315
23421
|
}
|
|
23316
23422
|
}, {
|
|
23317
|
-
key: "
|
|
23318
|
-
value: function
|
|
23423
|
+
key: "renderMultiSelect",
|
|
23424
|
+
value: function renderMultiSelect() {
|
|
23319
23425
|
var _this$props7 = this.props,
|
|
23320
23426
|
schema = _this$props7.schema,
|
|
23321
|
-
uiSchema = _this$props7.uiSchema,
|
|
23322
23427
|
idSchema = _this$props7.idSchema,
|
|
23323
|
-
|
|
23428
|
+
uiSchema = _this$props7.uiSchema,
|
|
23429
|
+
formData = _this$props7.formData,
|
|
23324
23430
|
disabled = _this$props7.disabled,
|
|
23325
23431
|
readonly = _this$props7.readonly,
|
|
23432
|
+
required = _this$props7.required,
|
|
23433
|
+
placeholder = _this$props7.placeholder,
|
|
23326
23434
|
autofocus = _this$props7.autofocus,
|
|
23327
23435
|
onBlur = _this$props7.onBlur,
|
|
23328
23436
|
onFocus = _this$props7.onFocus,
|
|
23329
23437
|
_this$props7$registry = _this$props7.registry,
|
|
23330
23438
|
registry = _this$props7$registry === void 0 ? getDefaultRegistry() : _this$props7$registry,
|
|
23331
|
-
rawErrors = _this$props7.rawErrors
|
|
23332
|
-
|
|
23439
|
+
rawErrors = _this$props7.rawErrors,
|
|
23440
|
+
name = _this$props7.name;
|
|
23333
23441
|
var items = this.props.formData;
|
|
23334
23442
|
var widgets = registry.widgets,
|
|
23443
|
+
rootSchema = registry.rootSchema,
|
|
23335
23444
|
formContext = registry.formContext;
|
|
23445
|
+
var itemsSchema = retrieveSchema(schema.items, rootSchema, formData);
|
|
23446
|
+
var title = schema.title || name;
|
|
23447
|
+
var enumOptions = optionsList(itemsSchema);
|
|
23336
23448
|
|
|
23337
|
-
var
|
|
23338
|
-
|
|
23339
|
-
|
|
23340
|
-
|
|
23449
|
+
var _getUiOptions$enumOpt = _objectSpread$7({}, getUiOptions(uiSchema), {
|
|
23450
|
+
enumOptions: enumOptions
|
|
23451
|
+
}),
|
|
23452
|
+
_getUiOptions$enumOpt2 = _getUiOptions$enumOpt.widget,
|
|
23453
|
+
widget = _getUiOptions$enumOpt2 === void 0 ? "select" : _getUiOptions$enumOpt2,
|
|
23454
|
+
options = _objectWithoutProperties$7(_getUiOptions$enumOpt, ["widget"]);
|
|
23341
23455
|
|
|
23342
23456
|
var Widget = getWidget(schema, widget, widgets);
|
|
23343
23457
|
return react.createElement(Widget, {
|
|
23344
|
-
options: options,
|
|
23345
23458
|
id: idSchema && idSchema.$id,
|
|
23346
23459
|
multiple: true,
|
|
23347
23460
|
onChange: this.onSelectChange,
|
|
23348
23461
|
onBlur: onBlur,
|
|
23349
23462
|
onFocus: onFocus,
|
|
23463
|
+
options: options,
|
|
23350
23464
|
schema: schema,
|
|
23351
|
-
|
|
23465
|
+
registry: registry,
|
|
23352
23466
|
value: items,
|
|
23353
23467
|
disabled: disabled,
|
|
23354
23468
|
readonly: readonly,
|
|
23469
|
+
required: required,
|
|
23470
|
+
label: title,
|
|
23471
|
+
placeholder: placeholder,
|
|
23355
23472
|
formContext: formContext,
|
|
23356
23473
|
autofocus: autofocus,
|
|
23357
23474
|
rawErrors: rawErrors
|
|
23358
23475
|
});
|
|
23359
23476
|
}
|
|
23360
23477
|
}, {
|
|
23361
|
-
key: "
|
|
23362
|
-
value: function
|
|
23363
|
-
var _this3 = this;
|
|
23364
|
-
|
|
23478
|
+
key: "renderFiles",
|
|
23479
|
+
value: function renderFiles() {
|
|
23365
23480
|
var _this$props8 = this.props,
|
|
23366
23481
|
schema = _this$props8.schema,
|
|
23367
23482
|
uiSchema = _this$props8.uiSchema,
|
|
23368
|
-
formData = _this$props8.formData,
|
|
23369
|
-
errorSchema = _this$props8.errorSchema,
|
|
23370
|
-
idPrefix = _this$props8.idPrefix,
|
|
23371
23483
|
idSchema = _this$props8.idSchema,
|
|
23372
23484
|
name = _this$props8.name,
|
|
23373
|
-
required = _this$props8.required,
|
|
23374
23485
|
disabled = _this$props8.disabled,
|
|
23375
23486
|
readonly = _this$props8.readonly,
|
|
23376
23487
|
autofocus = _this$props8.autofocus,
|
|
23377
|
-
_this$props8$registry = _this$props8.registry,
|
|
23378
|
-
registry = _this$props8$registry === void 0 ? getDefaultRegistry() : _this$props8$registry,
|
|
23379
23488
|
onBlur = _this$props8.onBlur,
|
|
23380
23489
|
onFocus = _this$props8.onFocus,
|
|
23490
|
+
_this$props8$registry = _this$props8.registry,
|
|
23491
|
+
registry = _this$props8$registry === void 0 ? getDefaultRegistry() : _this$props8$registry,
|
|
23381
23492
|
rawErrors = _this$props8.rawErrors;
|
|
23382
23493
|
var title = schema.title || name;
|
|
23383
23494
|
var items = this.props.formData;
|
|
23495
|
+
var widgets = registry.widgets,
|
|
23496
|
+
formContext = registry.formContext;
|
|
23497
|
+
|
|
23498
|
+
var _getUiOptions3 = getUiOptions(uiSchema),
|
|
23499
|
+
_getUiOptions3$widget = _getUiOptions3.widget,
|
|
23500
|
+
widget = _getUiOptions3$widget === void 0 ? "files" : _getUiOptions3$widget,
|
|
23501
|
+
options = _objectWithoutProperties$7(_getUiOptions3, ["widget"]);
|
|
23502
|
+
|
|
23503
|
+
var Widget = getWidget(schema, widget, widgets);
|
|
23504
|
+
return react.createElement(Widget, {
|
|
23505
|
+
options: options,
|
|
23506
|
+
id: idSchema && idSchema.$id,
|
|
23507
|
+
multiple: true,
|
|
23508
|
+
onChange: this.onSelectChange,
|
|
23509
|
+
onBlur: onBlur,
|
|
23510
|
+
onFocus: onFocus,
|
|
23511
|
+
schema: schema,
|
|
23512
|
+
title: title,
|
|
23513
|
+
value: items,
|
|
23514
|
+
disabled: disabled,
|
|
23515
|
+
readonly: readonly,
|
|
23516
|
+
formContext: formContext,
|
|
23517
|
+
autofocus: autofocus,
|
|
23518
|
+
rawErrors: rawErrors
|
|
23519
|
+
});
|
|
23520
|
+
}
|
|
23521
|
+
}, {
|
|
23522
|
+
key: "renderFixedArray",
|
|
23523
|
+
value: function renderFixedArray() {
|
|
23524
|
+
var _this3 = this;
|
|
23525
|
+
|
|
23526
|
+
var _this$props9 = this.props,
|
|
23527
|
+
schema = _this$props9.schema,
|
|
23528
|
+
uiSchema = _this$props9.uiSchema,
|
|
23529
|
+
formData = _this$props9.formData,
|
|
23530
|
+
errorSchema = _this$props9.errorSchema,
|
|
23531
|
+
idPrefix = _this$props9.idPrefix,
|
|
23532
|
+
idSeparator = _this$props9.idSeparator,
|
|
23533
|
+
idSchema = _this$props9.idSchema,
|
|
23534
|
+
name = _this$props9.name,
|
|
23535
|
+
required = _this$props9.required,
|
|
23536
|
+
disabled = _this$props9.disabled,
|
|
23537
|
+
readonly = _this$props9.readonly,
|
|
23538
|
+
autofocus = _this$props9.autofocus,
|
|
23539
|
+
_this$props9$registry = _this$props9.registry,
|
|
23540
|
+
registry = _this$props9$registry === void 0 ? getDefaultRegistry() : _this$props9$registry,
|
|
23541
|
+
onBlur = _this$props9.onBlur,
|
|
23542
|
+
onFocus = _this$props9.onFocus,
|
|
23543
|
+
rawErrors = _this$props9.rawErrors;
|
|
23544
|
+
var title = schema.title || name;
|
|
23545
|
+
var items = this.props.formData;
|
|
23384
23546
|
var ArrayFieldTemplate = registry.ArrayFieldTemplate,
|
|
23385
23547
|
rootSchema = registry.rootSchema,
|
|
23386
23548
|
fields = registry.fields,
|
|
@@ -23410,7 +23572,7 @@ function (_Component) {
|
|
|
23410
23572
|
var additional = index >= itemSchemas.length;
|
|
23411
23573
|
var itemSchema = additional ? retrieveSchema(schema.additionalItems, rootSchema, item) : itemSchemas[index];
|
|
23412
23574
|
var itemIdPrefix = idSchema.$id + "_" + index;
|
|
23413
|
-
var itemIdSchema = toIdSchema(itemSchema, itemIdPrefix, rootSchema, item, idPrefix);
|
|
23575
|
+
var itemIdSchema = toIdSchema(itemSchema, itemIdPrefix, rootSchema, item, idPrefix, idSeparator);
|
|
23414
23576
|
var itemUiSchema = additional ? uiSchema.additionalItems || {} : Array.isArray(uiSchema.items) ? uiSchema.items[index] : uiSchema.items || {};
|
|
23415
23577
|
var itemErrorSchema = errorSchema ? errorSchema[index] : undefined;
|
|
23416
23578
|
return _this3.renderArrayFieldItem({
|
|
@@ -23463,12 +23625,12 @@ function (_Component) {
|
|
|
23463
23625
|
onBlur = props.onBlur,
|
|
23464
23626
|
onFocus = props.onFocus,
|
|
23465
23627
|
rawErrors = props.rawErrors;
|
|
23466
|
-
var _this$
|
|
23467
|
-
disabled = _this$
|
|
23468
|
-
readonly = _this$
|
|
23469
|
-
uiSchema = _this$
|
|
23470
|
-
_this$
|
|
23471
|
-
registry = _this$
|
|
23628
|
+
var _this$props10 = this.props,
|
|
23629
|
+
disabled = _this$props10.disabled,
|
|
23630
|
+
readonly = _this$props10.readonly,
|
|
23631
|
+
uiSchema = _this$props10.uiSchema,
|
|
23632
|
+
_this$props10$registr = _this$props10.registry,
|
|
23633
|
+
registry = _this$props10$registr === void 0 ? getDefaultRegistry() : _this$props10$registr;
|
|
23472
23634
|
var SchemaField = registry.fields.SchemaField;
|
|
23473
23635
|
|
|
23474
23636
|
var _orderable$removable$ = _objectSpread$7({
|
|
@@ -23808,6 +23970,7 @@ function (_Component) {
|
|
|
23808
23970
|
errorSchema = _this$props3.errorSchema,
|
|
23809
23971
|
formData = _this$props3.formData,
|
|
23810
23972
|
idPrefix = _this$props3.idPrefix,
|
|
23973
|
+
idSeparator = _this$props3.idSeparator,
|
|
23811
23974
|
idSchema = _this$props3.idSchema,
|
|
23812
23975
|
onBlur = _this$props3.onBlur,
|
|
23813
23976
|
onChange = _this$props3.onChange,
|
|
@@ -23868,6 +24031,7 @@ function (_Component) {
|
|
|
23868
24031
|
errorSchema: errorSchema,
|
|
23869
24032
|
idSchema: idSchema,
|
|
23870
24033
|
idPrefix: idPrefix,
|
|
24034
|
+
idSeparator: idSeparator,
|
|
23871
24035
|
formData: formData,
|
|
23872
24036
|
onChange: onChange,
|
|
23873
24037
|
onBlur: onBlur,
|
|
@@ -24238,6 +24402,7 @@ function (_Component) {
|
|
|
24238
24402
|
disabled = _this$props2.disabled,
|
|
24239
24403
|
readonly = _this$props2.readonly,
|
|
24240
24404
|
idPrefix = _this$props2.idPrefix,
|
|
24405
|
+
idSeparator = _this$props2.idSeparator,
|
|
24241
24406
|
onBlur = _this$props2.onBlur,
|
|
24242
24407
|
onFocus = _this$props2.onFocus,
|
|
24243
24408
|
_this$props2$registry = _this$props2.registry,
|
|
@@ -24285,6 +24450,7 @@ function (_Component) {
|
|
|
24285
24450
|
errorSchema: errorSchema[name],
|
|
24286
24451
|
idSchema: idSchema[name],
|
|
24287
24452
|
idPrefix: idPrefix,
|
|
24453
|
+
idSeparator: idSeparator,
|
|
24288
24454
|
formData: (formData || {})[name],
|
|
24289
24455
|
wasPropertyKeyModified: _this2.state.wasPropertyKeyModified,
|
|
24290
24456
|
onKeyChange: _this2.onKeyChange(name),
|
|
@@ -26181,7 +26347,7 @@ function getDisplayLabel(schema, uiSchema, rootSchema) {
|
|
|
26181
26347
|
var schemaType = getSchemaType(schema);
|
|
26182
26348
|
|
|
26183
26349
|
if (schemaType === "array") {
|
|
26184
|
-
displayLabel = isMultiSelect(schema, rootSchema) || isFilesArray(schema, uiSchema, rootSchema);
|
|
26350
|
+
displayLabel = isMultiSelect(schema, rootSchema) || isFilesArray(schema, uiSchema, rootSchema) || isCustomWidget(uiSchema);
|
|
26185
26351
|
}
|
|
26186
26352
|
|
|
26187
26353
|
if (schemaType === "object") {
|
|
@@ -26358,6 +26524,12 @@ function isFixedItems(schema) {
|
|
|
26358
26524
|
return isObject(item);
|
|
26359
26525
|
});
|
|
26360
26526
|
}
|
|
26527
|
+
function isCustomWidget(uiSchema) {
|
|
26528
|
+
return (// TODO: Remove the `&& uiSchema["ui:widget"] !== "hidden"` once we support hidden widgets for arrays.
|
|
26529
|
+
// https://react-jsonschema-form.readthedocs.io/en/latest/usage/widgets/#hidden-widgets
|
|
26530
|
+
"widget" in getUiOptions(uiSchema) && getUiOptions(uiSchema)["widget"] !== "hidden"
|
|
26531
|
+
);
|
|
26532
|
+
}
|
|
26361
26533
|
function allowAdditionalItems(schema) {
|
|
26362
26534
|
if (schema.additionalItems === true) {
|
|
26363
26535
|
console.warn("additionalItems=true is currently not supported");
|
|
@@ -26760,6 +26932,7 @@ function shouldRender(comp, nextProps, nextState) {
|
|
|
26760
26932
|
function toIdSchema(schema, id, rootSchema) {
|
|
26761
26933
|
var formData = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
26762
26934
|
var idPrefix = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : "root";
|
|
26935
|
+
var idSeparator = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : "_";
|
|
26763
26936
|
var idSchema = {
|
|
26764
26937
|
$id: id || idPrefix
|
|
26765
26938
|
};
|
|
@@ -26767,11 +26940,11 @@ function toIdSchema(schema, id, rootSchema) {
|
|
|
26767
26940
|
if ("$ref" in schema || "dependencies" in schema || "allOf" in schema) {
|
|
26768
26941
|
var _schema = retrieveSchema(schema, rootSchema, formData);
|
|
26769
26942
|
|
|
26770
|
-
return toIdSchema(_schema, id, rootSchema, formData, idPrefix);
|
|
26943
|
+
return toIdSchema(_schema, id, rootSchema, formData, idPrefix, idSeparator);
|
|
26771
26944
|
}
|
|
26772
26945
|
|
|
26773
26946
|
if ("items" in schema && !schema.items.$ref) {
|
|
26774
|
-
return toIdSchema(schema.items, id, rootSchema, formData, idPrefix);
|
|
26947
|
+
return toIdSchema(schema.items, id, rootSchema, formData, idPrefix, idSeparator);
|
|
26775
26948
|
}
|
|
26776
26949
|
|
|
26777
26950
|
if (schema.type !== "object") {
|
|
@@ -26780,10 +26953,10 @@ function toIdSchema(schema, id, rootSchema) {
|
|
|
26780
26953
|
|
|
26781
26954
|
for (var name in schema.properties || {}) {
|
|
26782
26955
|
var field = schema.properties[name];
|
|
26783
|
-
var fieldId = idSchema.$id +
|
|
26956
|
+
var fieldId = idSchema.$id + idSeparator + name;
|
|
26784
26957
|
idSchema[name] = toIdSchema(isObject(field) ? field : {}, fieldId, rootSchema, // It's possible that formData is not an object -- this can happen if an
|
|
26785
26958
|
// array item has just been added, but not populated with data yet
|
|
26786
|
-
(formData || {})[name], idPrefix);
|
|
26959
|
+
(formData || {})[name], idPrefix, idSeparator);
|
|
26787
26960
|
}
|
|
26788
26961
|
|
|
26789
26962
|
return idSchema;
|
|
@@ -27238,6 +27411,7 @@ function SchemaFieldRender(props) {
|
|
|
27238
27411
|
formData = props.formData,
|
|
27239
27412
|
errorSchema = props.errorSchema,
|
|
27240
27413
|
idPrefix = props.idPrefix,
|
|
27414
|
+
idSeparator = props.idSeparator,
|
|
27241
27415
|
name = props.name,
|
|
27242
27416
|
onChange = props.onChange,
|
|
27243
27417
|
onKeyChange = props.onKeyChange,
|
|
@@ -27253,7 +27427,7 @@ function SchemaFieldRender(props) {
|
|
|
27253
27427
|
var FieldTemplate = uiSchema["ui:FieldTemplate"] || registry.FieldTemplate || DefaultTemplate;
|
|
27254
27428
|
var idSchema = props.idSchema;
|
|
27255
27429
|
var schema = retrieveSchema(props.schema, rootSchema, formData);
|
|
27256
|
-
idSchema = mergeObjects(toIdSchema(schema, null, rootSchema, formData, idPrefix), idSchema);
|
|
27430
|
+
idSchema = mergeObjects(toIdSchema(schema, null, rootSchema, formData, idPrefix, idSeparator), idSchema);
|
|
27257
27431
|
var FieldComponent = getFieldComponent(schema, uiSchema, idSchema, fields);
|
|
27258
27432
|
var DescriptionField = fields.DescriptionField;
|
|
27259
27433
|
var disabled = Boolean(props.disabled || uiSchema["ui:disabled"]);
|
|
@@ -28147,6 +28321,7 @@ let Form = class {
|
|
|
28147
28321
|
widgets: widgets,
|
|
28148
28322
|
liveValidate: true,
|
|
28149
28323
|
showErrorList: false,
|
|
28324
|
+
extraErrors: this.getExtraErrors(this.errors),
|
|
28150
28325
|
FieldTemplate: FieldTemplate,
|
|
28151
28326
|
ArrayFieldTemplate: ArrayFieldTemplate,
|
|
28152
28327
|
ObjectFieldTemplate: ObjectFieldTemplate,
|
|
@@ -28213,6 +28388,17 @@ let Form = class {
|
|
|
28213
28388
|
};
|
|
28214
28389
|
});
|
|
28215
28390
|
}
|
|
28391
|
+
getExtraErrors(errors) {
|
|
28392
|
+
if (!errors) {
|
|
28393
|
+
return;
|
|
28394
|
+
}
|
|
28395
|
+
return mapValues(errors, (error) => {
|
|
28396
|
+
if (Array.isArray(error)) {
|
|
28397
|
+
return { __errors: error };
|
|
28398
|
+
}
|
|
28399
|
+
return this.getExtraErrors(error);
|
|
28400
|
+
});
|
|
28401
|
+
}
|
|
28216
28402
|
getCustomErrorMessages(originalErrors) {
|
|
28217
28403
|
if (!this.transformErrors) {
|
|
28218
28404
|
return originalErrors;
|