@limetech/lime-elements 35.0.0-next.26 → 35.0.0-next.27

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.
@@ -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: "renderMultiSelect",
8960
- value: function renderMultiSelect() {
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 _getUiOptions$enumOpt = _objectSpread$g({}, getUiOptions$1(uiSchema), {
8986
- enumOptions: enumOptions
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: "renderFiles",
9015
- value: function renderFiles() {
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
- name = _this$props7.name,
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
- var title = schema.title || name;
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 _getUiOptions2 = getUiOptions$1(uiSchema),
9035
- _getUiOptions2$widget = _getUiOptions2.widget,
9036
- widget = _getUiOptions2$widget === void 0 ? "files" : _getUiOptions2$widget,
9037
- options = _objectWithoutProperties$g(_getUiOptions2, ["widget"]);
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
- title: title,
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: "renderFixedArray",
9059
- value: function renderFixedArray() {
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$props9 = this.props,
9164
- disabled = _this$props9.disabled,
9165
- readonly = _this$props9.readonly,
9166
- uiSchema = _this$props9.uiSchema,
9167
- _this$props9$registry = _this$props9.registry,
9168
- registry = _this$props9$registry === void 0 ? getDefaultRegistry$1() : _this$props9$registry;
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 + "_" + name;
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,
@@ -23208,6 +23277,15 @@ function (_Component) {
23208
23277
  });
23209
23278
  }
23210
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
+
23211
23289
  if (isFixedItems(schema)) {
23212
23290
  return this.renderFixedArray();
23213
23291
  }
@@ -23216,10 +23294,6 @@ function (_Component) {
23216
23294
  return this.renderFiles();
23217
23295
  }
23218
23296
 
23219
- if (isMultiSelect(schema, rootSchema)) {
23220
- return this.renderMultiSelect();
23221
- }
23222
-
23223
23297
  return this.renderNormalArray();
23224
23298
  }
23225
23299
  }, {
@@ -23242,6 +23316,7 @@ function (_Component) {
23242
23316
  onBlur = _this$props5.onBlur,
23243
23317
  onFocus = _this$props5.onFocus,
23244
23318
  idPrefix = _this$props5.idPrefix,
23319
+ idSeparator = _this$props5.idSeparator,
23245
23320
  rawErrors = _this$props5.rawErrors;
23246
23321
  var title = schema.title === undefined ? name : schema.title;
23247
23322
  var ArrayFieldTemplate = registry.ArrayFieldTemplate,
@@ -23260,7 +23335,7 @@ function (_Component) {
23260
23335
  var itemSchema = retrieveSchema(schema.items, rootSchema, item);
23261
23336
  var itemErrorSchema = errorSchema ? errorSchema[index] : undefined;
23262
23337
  var itemIdPrefix = idSchema.$id + "_" + index;
23263
- var itemIdSchema = toIdSchema(itemSchema, itemIdPrefix, rootSchema, item, idPrefix);
23338
+ var itemIdSchema = toIdSchema(itemSchema, itemIdPrefix, rootSchema, item, idPrefix, idSeparator);
23264
23339
  return _this2.renderArrayFieldItem({
23265
23340
  key: key,
23266
23341
  index: index,
@@ -23297,13 +23372,12 @@ function (_Component) {
23297
23372
  return react.createElement(Component, arrayProps);
23298
23373
  }
23299
23374
  }, {
23300
- key: "renderMultiSelect",
23301
- value: function renderMultiSelect() {
23375
+ key: "renderCustomWidget",
23376
+ value: function renderCustomWidget() {
23302
23377
  var _this$props6 = this.props,
23303
23378
  schema = _this$props6.schema,
23304
23379
  idSchema = _this$props6.idSchema,
23305
23380
  uiSchema = _this$props6.uiSchema,
23306
- formData = _this$props6.formData,
23307
23381
  disabled = _this$props6.disabled,
23308
23382
  readonly = _this$props6.readonly,
23309
23383
  required = _this$props6.required,
@@ -23311,24 +23385,18 @@ function (_Component) {
23311
23385
  autofocus = _this$props6.autofocus,
23312
23386
  onBlur = _this$props6.onBlur,
23313
23387
  onFocus = _this$props6.onFocus,
23388
+ items = _this$props6.formData,
23314
23389
  _this$props6$registry = _this$props6.registry,
23315
23390
  registry = _this$props6$registry === void 0 ? getDefaultRegistry() : _this$props6$registry,
23316
23391
  rawErrors = _this$props6.rawErrors,
23317
23392
  name = _this$props6.name;
23318
- var items = this.props.formData;
23319
23393
  var widgets = registry.widgets,
23320
- rootSchema = registry.rootSchema,
23321
23394
  formContext = registry.formContext;
23322
- var itemsSchema = retrieveSchema(schema.items, rootSchema, formData);
23323
23395
  var title = schema.title || name;
23324
- var enumOptions = optionsList(itemsSchema);
23325
23396
 
23326
- var _getUiOptions$enumOpt = _objectSpread$7({}, getUiOptions(uiSchema), {
23327
- enumOptions: enumOptions
23328
- }),
23329
- _getUiOptions$enumOpt2 = _getUiOptions$enumOpt.widget,
23330
- widget = _getUiOptions$enumOpt2 === void 0 ? "select" : _getUiOptions$enumOpt2,
23331
- options = _objectWithoutProperties$7(_getUiOptions$enumOpt, ["widget"]);
23397
+ var _getUiOptions2 = _objectSpread$7({}, getUiOptions(uiSchema)),
23398
+ widget = _getUiOptions2.widget,
23399
+ options = _objectWithoutProperties$7(_getUiOptions2, ["widget"]);
23332
23400
 
23333
23401
  var Widget = getWidget(schema, widget, widgets);
23334
23402
  return react.createElement(Widget, {
@@ -23352,73 +23420,129 @@ function (_Component) {
23352
23420
  });
23353
23421
  }
23354
23422
  }, {
23355
- key: "renderFiles",
23356
- value: function renderFiles() {
23423
+ key: "renderMultiSelect",
23424
+ value: function renderMultiSelect() {
23357
23425
  var _this$props7 = this.props,
23358
23426
  schema = _this$props7.schema,
23359
- uiSchema = _this$props7.uiSchema,
23360
23427
  idSchema = _this$props7.idSchema,
23361
- name = _this$props7.name,
23428
+ uiSchema = _this$props7.uiSchema,
23429
+ formData = _this$props7.formData,
23362
23430
  disabled = _this$props7.disabled,
23363
23431
  readonly = _this$props7.readonly,
23432
+ required = _this$props7.required,
23433
+ placeholder = _this$props7.placeholder,
23364
23434
  autofocus = _this$props7.autofocus,
23365
23435
  onBlur = _this$props7.onBlur,
23366
23436
  onFocus = _this$props7.onFocus,
23367
23437
  _this$props7$registry = _this$props7.registry,
23368
23438
  registry = _this$props7$registry === void 0 ? getDefaultRegistry() : _this$props7$registry,
23369
- rawErrors = _this$props7.rawErrors;
23370
- var title = schema.title || name;
23439
+ rawErrors = _this$props7.rawErrors,
23440
+ name = _this$props7.name;
23371
23441
  var items = this.props.formData;
23372
23442
  var widgets = registry.widgets,
23443
+ rootSchema = registry.rootSchema,
23373
23444
  formContext = registry.formContext;
23445
+ var itemsSchema = retrieveSchema(schema.items, rootSchema, formData);
23446
+ var title = schema.title || name;
23447
+ var enumOptions = optionsList(itemsSchema);
23374
23448
 
23375
- var _getUiOptions2 = getUiOptions(uiSchema),
23376
- _getUiOptions2$widget = _getUiOptions2.widget,
23377
- widget = _getUiOptions2$widget === void 0 ? "files" : _getUiOptions2$widget,
23378
- options = _objectWithoutProperties$7(_getUiOptions2, ["widget"]);
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"]);
23379
23455
 
23380
23456
  var Widget = getWidget(schema, widget, widgets);
23381
23457
  return react.createElement(Widget, {
23382
- options: options,
23383
23458
  id: idSchema && idSchema.$id,
23384
23459
  multiple: true,
23385
23460
  onChange: this.onSelectChange,
23386
23461
  onBlur: onBlur,
23387
23462
  onFocus: onFocus,
23463
+ options: options,
23388
23464
  schema: schema,
23389
- title: title,
23465
+ registry: registry,
23390
23466
  value: items,
23391
23467
  disabled: disabled,
23392
23468
  readonly: readonly,
23469
+ required: required,
23470
+ label: title,
23471
+ placeholder: placeholder,
23393
23472
  formContext: formContext,
23394
23473
  autofocus: autofocus,
23395
23474
  rawErrors: rawErrors
23396
23475
  });
23397
23476
  }
23398
23477
  }, {
23399
- key: "renderFixedArray",
23400
- value: function renderFixedArray() {
23401
- var _this3 = this;
23402
-
23478
+ key: "renderFiles",
23479
+ value: function renderFiles() {
23403
23480
  var _this$props8 = this.props,
23404
23481
  schema = _this$props8.schema,
23405
23482
  uiSchema = _this$props8.uiSchema,
23406
- formData = _this$props8.formData,
23407
- errorSchema = _this$props8.errorSchema,
23408
- idPrefix = _this$props8.idPrefix,
23409
23483
  idSchema = _this$props8.idSchema,
23410
23484
  name = _this$props8.name,
23411
- required = _this$props8.required,
23412
23485
  disabled = _this$props8.disabled,
23413
23486
  readonly = _this$props8.readonly,
23414
23487
  autofocus = _this$props8.autofocus,
23415
- _this$props8$registry = _this$props8.registry,
23416
- registry = _this$props8$registry === void 0 ? getDefaultRegistry() : _this$props8$registry,
23417
23488
  onBlur = _this$props8.onBlur,
23418
23489
  onFocus = _this$props8.onFocus,
23490
+ _this$props8$registry = _this$props8.registry,
23491
+ registry = _this$props8$registry === void 0 ? getDefaultRegistry() : _this$props8$registry,
23419
23492
  rawErrors = _this$props8.rawErrors;
23420
23493
  var title = schema.title || name;
23421
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;
23422
23546
  var ArrayFieldTemplate = registry.ArrayFieldTemplate,
23423
23547
  rootSchema = registry.rootSchema,
23424
23548
  fields = registry.fields,
@@ -23448,7 +23572,7 @@ function (_Component) {
23448
23572
  var additional = index >= itemSchemas.length;
23449
23573
  var itemSchema = additional ? retrieveSchema(schema.additionalItems, rootSchema, item) : itemSchemas[index];
23450
23574
  var itemIdPrefix = idSchema.$id + "_" + index;
23451
- var itemIdSchema = toIdSchema(itemSchema, itemIdPrefix, rootSchema, item, idPrefix);
23575
+ var itemIdSchema = toIdSchema(itemSchema, itemIdPrefix, rootSchema, item, idPrefix, idSeparator);
23452
23576
  var itemUiSchema = additional ? uiSchema.additionalItems || {} : Array.isArray(uiSchema.items) ? uiSchema.items[index] : uiSchema.items || {};
23453
23577
  var itemErrorSchema = errorSchema ? errorSchema[index] : undefined;
23454
23578
  return _this3.renderArrayFieldItem({
@@ -23501,12 +23625,12 @@ function (_Component) {
23501
23625
  onBlur = props.onBlur,
23502
23626
  onFocus = props.onFocus,
23503
23627
  rawErrors = props.rawErrors;
23504
- var _this$props9 = this.props,
23505
- disabled = _this$props9.disabled,
23506
- readonly = _this$props9.readonly,
23507
- uiSchema = _this$props9.uiSchema,
23508
- _this$props9$registry = _this$props9.registry,
23509
- registry = _this$props9$registry === void 0 ? getDefaultRegistry() : _this$props9$registry;
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;
23510
23634
  var SchemaField = registry.fields.SchemaField;
23511
23635
 
23512
23636
  var _orderable$removable$ = _objectSpread$7({
@@ -23846,6 +23970,7 @@ function (_Component) {
23846
23970
  errorSchema = _this$props3.errorSchema,
23847
23971
  formData = _this$props3.formData,
23848
23972
  idPrefix = _this$props3.idPrefix,
23973
+ idSeparator = _this$props3.idSeparator,
23849
23974
  idSchema = _this$props3.idSchema,
23850
23975
  onBlur = _this$props3.onBlur,
23851
23976
  onChange = _this$props3.onChange,
@@ -23906,6 +24031,7 @@ function (_Component) {
23906
24031
  errorSchema: errorSchema,
23907
24032
  idSchema: idSchema,
23908
24033
  idPrefix: idPrefix,
24034
+ idSeparator: idSeparator,
23909
24035
  formData: formData,
23910
24036
  onChange: onChange,
23911
24037
  onBlur: onBlur,
@@ -24276,6 +24402,7 @@ function (_Component) {
24276
24402
  disabled = _this$props2.disabled,
24277
24403
  readonly = _this$props2.readonly,
24278
24404
  idPrefix = _this$props2.idPrefix,
24405
+ idSeparator = _this$props2.idSeparator,
24279
24406
  onBlur = _this$props2.onBlur,
24280
24407
  onFocus = _this$props2.onFocus,
24281
24408
  _this$props2$registry = _this$props2.registry,
@@ -24323,6 +24450,7 @@ function (_Component) {
24323
24450
  errorSchema: errorSchema[name],
24324
24451
  idSchema: idSchema[name],
24325
24452
  idPrefix: idPrefix,
24453
+ idSeparator: idSeparator,
24326
24454
  formData: (formData || {})[name],
24327
24455
  wasPropertyKeyModified: _this2.state.wasPropertyKeyModified,
24328
24456
  onKeyChange: _this2.onKeyChange(name),
@@ -26219,7 +26347,7 @@ function getDisplayLabel(schema, uiSchema, rootSchema) {
26219
26347
  var schemaType = getSchemaType(schema);
26220
26348
 
26221
26349
  if (schemaType === "array") {
26222
- displayLabel = isMultiSelect(schema, rootSchema) || isFilesArray(schema, uiSchema, rootSchema);
26350
+ displayLabel = isMultiSelect(schema, rootSchema) || isFilesArray(schema, uiSchema, rootSchema) || isCustomWidget(uiSchema);
26223
26351
  }
26224
26352
 
26225
26353
  if (schemaType === "object") {
@@ -26396,6 +26524,12 @@ function isFixedItems(schema) {
26396
26524
  return isObject(item);
26397
26525
  });
26398
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
+ }
26399
26533
  function allowAdditionalItems(schema) {
26400
26534
  if (schema.additionalItems === true) {
26401
26535
  console.warn("additionalItems=true is currently not supported");
@@ -26798,6 +26932,7 @@ function shouldRender(comp, nextProps, nextState) {
26798
26932
  function toIdSchema(schema, id, rootSchema) {
26799
26933
  var formData = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
26800
26934
  var idPrefix = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : "root";
26935
+ var idSeparator = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : "_";
26801
26936
  var idSchema = {
26802
26937
  $id: id || idPrefix
26803
26938
  };
@@ -26805,11 +26940,11 @@ function toIdSchema(schema, id, rootSchema) {
26805
26940
  if ("$ref" in schema || "dependencies" in schema || "allOf" in schema) {
26806
26941
  var _schema = retrieveSchema(schema, rootSchema, formData);
26807
26942
 
26808
- return toIdSchema(_schema, id, rootSchema, formData, idPrefix);
26943
+ return toIdSchema(_schema, id, rootSchema, formData, idPrefix, idSeparator);
26809
26944
  }
26810
26945
 
26811
26946
  if ("items" in schema && !schema.items.$ref) {
26812
- return toIdSchema(schema.items, id, rootSchema, formData, idPrefix);
26947
+ return toIdSchema(schema.items, id, rootSchema, formData, idPrefix, idSeparator);
26813
26948
  }
26814
26949
 
26815
26950
  if (schema.type !== "object") {
@@ -26818,10 +26953,10 @@ function toIdSchema(schema, id, rootSchema) {
26818
26953
 
26819
26954
  for (var name in schema.properties || {}) {
26820
26955
  var field = schema.properties[name];
26821
- var fieldId = idSchema.$id + "_" + name;
26956
+ var fieldId = idSchema.$id + idSeparator + name;
26822
26957
  idSchema[name] = toIdSchema(isObject(field) ? field : {}, fieldId, rootSchema, // It's possible that formData is not an object -- this can happen if an
26823
26958
  // array item has just been added, but not populated with data yet
26824
- (formData || {})[name], idPrefix);
26959
+ (formData || {})[name], idPrefix, idSeparator);
26825
26960
  }
26826
26961
 
26827
26962
  return idSchema;
@@ -27276,6 +27411,7 @@ function SchemaFieldRender(props) {
27276
27411
  formData = props.formData,
27277
27412
  errorSchema = props.errorSchema,
27278
27413
  idPrefix = props.idPrefix,
27414
+ idSeparator = props.idSeparator,
27279
27415
  name = props.name,
27280
27416
  onChange = props.onChange,
27281
27417
  onKeyChange = props.onKeyChange,
@@ -27291,7 +27427,7 @@ function SchemaFieldRender(props) {
27291
27427
  var FieldTemplate = uiSchema["ui:FieldTemplate"] || registry.FieldTemplate || DefaultTemplate;
27292
27428
  var idSchema = props.idSchema;
27293
27429
  var schema = retrieveSchema(props.schema, rootSchema, formData);
27294
- idSchema = mergeObjects(toIdSchema(schema, null, rootSchema, formData, idPrefix), idSchema);
27430
+ idSchema = mergeObjects(toIdSchema(schema, null, rootSchema, formData, idPrefix, idSeparator), idSchema);
27295
27431
  var FieldComponent = getFieldComponent(schema, uiSchema, idSchema, fields);
27296
27432
  var DescriptionField = fields.DescriptionField;
27297
27433
  var disabled = Boolean(props.disabled || uiSchema["ui:disabled"]);