@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.
@@ -8863,6 +8863,15 @@ function (_Component) {
8863
8863
  });
8864
8864
  }
8865
8865
 
8866
+ if (isMultiSelect$1(schema, rootSchema)) {
8867
+ // If array has enum or uniqueItems set to true, call renderMultiSelect() to render the default multiselect widget or a custom widget, if specified.
8868
+ return this.renderMultiSelect();
8869
+ }
8870
+
8871
+ if (isCustomWidget$1(uiSchema)) {
8872
+ return this.renderCustomWidget();
8873
+ }
8874
+
8866
8875
  if (isFixedItems$1(schema)) {
8867
8876
  return this.renderFixedArray();
8868
8877
  }
@@ -8871,10 +8880,6 @@ function (_Component) {
8871
8880
  return this.renderFiles();
8872
8881
  }
8873
8882
 
8874
- if (isMultiSelect$1(schema, rootSchema)) {
8875
- return this.renderMultiSelect();
8876
- }
8877
-
8878
8883
  return this.renderNormalArray();
8879
8884
  }
8880
8885
  }, {
@@ -8897,6 +8902,7 @@ function (_Component) {
8897
8902
  onBlur = _this$props5.onBlur,
8898
8903
  onFocus = _this$props5.onFocus,
8899
8904
  idPrefix = _this$props5.idPrefix,
8905
+ idSeparator = _this$props5.idSeparator,
8900
8906
  rawErrors = _this$props5.rawErrors;
8901
8907
  var title = schema.title === undefined ? name : schema.title;
8902
8908
  var ArrayFieldTemplate = registry.ArrayFieldTemplate,
@@ -8915,7 +8921,7 @@ function (_Component) {
8915
8921
  var itemSchema = retrieveSchema$1(schema.items, rootSchema, item);
8916
8922
  var itemErrorSchema = errorSchema ? errorSchema[index] : undefined;
8917
8923
  var itemIdPrefix = idSchema.$id + "_" + index;
8918
- var itemIdSchema = toIdSchema$1(itemSchema, itemIdPrefix, rootSchema, item, idPrefix);
8924
+ var itemIdSchema = toIdSchema$1(itemSchema, itemIdPrefix, rootSchema, item, idPrefix, idSeparator);
8919
8925
  return _this2.renderArrayFieldItem({
8920
8926
  key: key,
8921
8927
  index: index,
@@ -8952,13 +8958,12 @@ function (_Component) {
8952
8958
  return react.createElement(Component, arrayProps);
8953
8959
  }
8954
8960
  }, {
8955
- key: "renderMultiSelect",
8956
- value: function renderMultiSelect() {
8961
+ key: "renderCustomWidget",
8962
+ value: function renderCustomWidget() {
8957
8963
  var _this$props6 = this.props,
8958
8964
  schema = _this$props6.schema,
8959
8965
  idSchema = _this$props6.idSchema,
8960
8966
  uiSchema = _this$props6.uiSchema,
8961
- formData = _this$props6.formData,
8962
8967
  disabled = _this$props6.disabled,
8963
8968
  readonly = _this$props6.readonly,
8964
8969
  required = _this$props6.required,
@@ -8966,24 +8971,18 @@ function (_Component) {
8966
8971
  autofocus = _this$props6.autofocus,
8967
8972
  onBlur = _this$props6.onBlur,
8968
8973
  onFocus = _this$props6.onFocus,
8974
+ items = _this$props6.formData,
8969
8975
  _this$props6$registry = _this$props6.registry,
8970
8976
  registry = _this$props6$registry === void 0 ? getDefaultRegistry$1() : _this$props6$registry,
8971
8977
  rawErrors = _this$props6.rawErrors,
8972
8978
  name = _this$props6.name;
8973
- var items = this.props.formData;
8974
8979
  var widgets = registry.widgets,
8975
- rootSchema = registry.rootSchema,
8976
8980
  formContext = registry.formContext;
8977
- var itemsSchema = retrieveSchema$1(schema.items, rootSchema, formData);
8978
8981
  var title = schema.title || name;
8979
- var enumOptions = optionsList$1(itemsSchema);
8980
8982
 
8981
- var _getUiOptions$enumOpt = _objectSpread$g({}, getUiOptions$1(uiSchema), {
8982
- enumOptions: enumOptions
8983
- }),
8984
- _getUiOptions$enumOpt2 = _getUiOptions$enumOpt.widget,
8985
- widget = _getUiOptions$enumOpt2 === void 0 ? "select" : _getUiOptions$enumOpt2,
8986
- options = _objectWithoutProperties$g(_getUiOptions$enumOpt, ["widget"]);
8983
+ var _getUiOptions2 = _objectSpread$g({}, getUiOptions$1(uiSchema)),
8984
+ widget = _getUiOptions2.widget,
8985
+ options = _objectWithoutProperties$g(_getUiOptions2, ["widget"]);
8987
8986
 
8988
8987
  var Widget = getWidget$1(schema, widget, widgets);
8989
8988
  return react.createElement(Widget, {
@@ -9007,73 +9006,129 @@ function (_Component) {
9007
9006
  });
9008
9007
  }
9009
9008
  }, {
9010
- key: "renderFiles",
9011
- value: function renderFiles() {
9009
+ key: "renderMultiSelect",
9010
+ value: function renderMultiSelect() {
9012
9011
  var _this$props7 = this.props,
9013
9012
  schema = _this$props7.schema,
9014
- uiSchema = _this$props7.uiSchema,
9015
9013
  idSchema = _this$props7.idSchema,
9016
- name = _this$props7.name,
9014
+ uiSchema = _this$props7.uiSchema,
9015
+ formData = _this$props7.formData,
9017
9016
  disabled = _this$props7.disabled,
9018
9017
  readonly = _this$props7.readonly,
9018
+ required = _this$props7.required,
9019
+ placeholder = _this$props7.placeholder,
9019
9020
  autofocus = _this$props7.autofocus,
9020
9021
  onBlur = _this$props7.onBlur,
9021
9022
  onFocus = _this$props7.onFocus,
9022
9023
  _this$props7$registry = _this$props7.registry,
9023
9024
  registry = _this$props7$registry === void 0 ? getDefaultRegistry$1() : _this$props7$registry,
9024
- rawErrors = _this$props7.rawErrors;
9025
- var title = schema.title || name;
9025
+ rawErrors = _this$props7.rawErrors,
9026
+ name = _this$props7.name;
9026
9027
  var items = this.props.formData;
9027
9028
  var widgets = registry.widgets,
9029
+ rootSchema = registry.rootSchema,
9028
9030
  formContext = registry.formContext;
9031
+ var itemsSchema = retrieveSchema$1(schema.items, rootSchema, formData);
9032
+ var title = schema.title || name;
9033
+ var enumOptions = optionsList$1(itemsSchema);
9029
9034
 
9030
- var _getUiOptions2 = getUiOptions$1(uiSchema),
9031
- _getUiOptions2$widget = _getUiOptions2.widget,
9032
- widget = _getUiOptions2$widget === void 0 ? "files" : _getUiOptions2$widget,
9033
- options = _objectWithoutProperties$g(_getUiOptions2, ["widget"]);
9035
+ var _getUiOptions$enumOpt = _objectSpread$g({}, getUiOptions$1(uiSchema), {
9036
+ enumOptions: enumOptions
9037
+ }),
9038
+ _getUiOptions$enumOpt2 = _getUiOptions$enumOpt.widget,
9039
+ widget = _getUiOptions$enumOpt2 === void 0 ? "select" : _getUiOptions$enumOpt2,
9040
+ options = _objectWithoutProperties$g(_getUiOptions$enumOpt, ["widget"]);
9034
9041
 
9035
9042
  var Widget = getWidget$1(schema, widget, widgets);
9036
9043
  return react.createElement(Widget, {
9037
- options: options,
9038
9044
  id: idSchema && idSchema.$id,
9039
9045
  multiple: true,
9040
9046
  onChange: this.onSelectChange,
9041
9047
  onBlur: onBlur,
9042
9048
  onFocus: onFocus,
9049
+ options: options,
9043
9050
  schema: schema,
9044
- title: title,
9051
+ registry: registry,
9045
9052
  value: items,
9046
9053
  disabled: disabled,
9047
9054
  readonly: readonly,
9055
+ required: required,
9056
+ label: title,
9057
+ placeholder: placeholder,
9048
9058
  formContext: formContext,
9049
9059
  autofocus: autofocus,
9050
9060
  rawErrors: rawErrors
9051
9061
  });
9052
9062
  }
9053
9063
  }, {
9054
- key: "renderFixedArray",
9055
- value: function renderFixedArray() {
9056
- var _this3 = this;
9057
-
9064
+ key: "renderFiles",
9065
+ value: function renderFiles() {
9058
9066
  var _this$props8 = this.props,
9059
9067
  schema = _this$props8.schema,
9060
9068
  uiSchema = _this$props8.uiSchema,
9061
- formData = _this$props8.formData,
9062
- errorSchema = _this$props8.errorSchema,
9063
- idPrefix = _this$props8.idPrefix,
9064
9069
  idSchema = _this$props8.idSchema,
9065
9070
  name = _this$props8.name,
9066
- required = _this$props8.required,
9067
9071
  disabled = _this$props8.disabled,
9068
9072
  readonly = _this$props8.readonly,
9069
9073
  autofocus = _this$props8.autofocus,
9070
- _this$props8$registry = _this$props8.registry,
9071
- registry = _this$props8$registry === void 0 ? getDefaultRegistry$1() : _this$props8$registry,
9072
9074
  onBlur = _this$props8.onBlur,
9073
9075
  onFocus = _this$props8.onFocus,
9076
+ _this$props8$registry = _this$props8.registry,
9077
+ registry = _this$props8$registry === void 0 ? getDefaultRegistry$1() : _this$props8$registry,
9074
9078
  rawErrors = _this$props8.rawErrors;
9075
9079
  var title = schema.title || name;
9076
9080
  var items = this.props.formData;
9081
+ var widgets = registry.widgets,
9082
+ formContext = registry.formContext;
9083
+
9084
+ var _getUiOptions3 = getUiOptions$1(uiSchema),
9085
+ _getUiOptions3$widget = _getUiOptions3.widget,
9086
+ widget = _getUiOptions3$widget === void 0 ? "files" : _getUiOptions3$widget,
9087
+ options = _objectWithoutProperties$g(_getUiOptions3, ["widget"]);
9088
+
9089
+ var Widget = getWidget$1(schema, widget, widgets);
9090
+ return react.createElement(Widget, {
9091
+ options: options,
9092
+ id: idSchema && idSchema.$id,
9093
+ multiple: true,
9094
+ onChange: this.onSelectChange,
9095
+ onBlur: onBlur,
9096
+ onFocus: onFocus,
9097
+ schema: schema,
9098
+ title: title,
9099
+ value: items,
9100
+ disabled: disabled,
9101
+ readonly: readonly,
9102
+ formContext: formContext,
9103
+ autofocus: autofocus,
9104
+ rawErrors: rawErrors
9105
+ });
9106
+ }
9107
+ }, {
9108
+ key: "renderFixedArray",
9109
+ value: function renderFixedArray() {
9110
+ var _this3 = this;
9111
+
9112
+ var _this$props9 = this.props,
9113
+ schema = _this$props9.schema,
9114
+ uiSchema = _this$props9.uiSchema,
9115
+ formData = _this$props9.formData,
9116
+ errorSchema = _this$props9.errorSchema,
9117
+ idPrefix = _this$props9.idPrefix,
9118
+ idSeparator = _this$props9.idSeparator,
9119
+ idSchema = _this$props9.idSchema,
9120
+ name = _this$props9.name,
9121
+ required = _this$props9.required,
9122
+ disabled = _this$props9.disabled,
9123
+ readonly = _this$props9.readonly,
9124
+ autofocus = _this$props9.autofocus,
9125
+ _this$props9$registry = _this$props9.registry,
9126
+ registry = _this$props9$registry === void 0 ? getDefaultRegistry$1() : _this$props9$registry,
9127
+ onBlur = _this$props9.onBlur,
9128
+ onFocus = _this$props9.onFocus,
9129
+ rawErrors = _this$props9.rawErrors;
9130
+ var title = schema.title || name;
9131
+ var items = this.props.formData;
9077
9132
  var ArrayFieldTemplate = registry.ArrayFieldTemplate,
9078
9133
  rootSchema = registry.rootSchema,
9079
9134
  fields = registry.fields,
@@ -9103,7 +9158,7 @@ function (_Component) {
9103
9158
  var additional = index >= itemSchemas.length;
9104
9159
  var itemSchema = additional ? retrieveSchema$1(schema.additionalItems, rootSchema, item) : itemSchemas[index];
9105
9160
  var itemIdPrefix = idSchema.$id + "_" + index;
9106
- var itemIdSchema = toIdSchema$1(itemSchema, itemIdPrefix, rootSchema, item, idPrefix);
9161
+ var itemIdSchema = toIdSchema$1(itemSchema, itemIdPrefix, rootSchema, item, idPrefix, idSeparator);
9107
9162
  var itemUiSchema = additional ? uiSchema.additionalItems || {} : Array.isArray(uiSchema.items) ? uiSchema.items[index] : uiSchema.items || {};
9108
9163
  var itemErrorSchema = errorSchema ? errorSchema[index] : undefined;
9109
9164
  return _this3.renderArrayFieldItem({
@@ -9156,12 +9211,12 @@ function (_Component) {
9156
9211
  onBlur = props.onBlur,
9157
9212
  onFocus = props.onFocus,
9158
9213
  rawErrors = props.rawErrors;
9159
- var _this$props9 = this.props,
9160
- disabled = _this$props9.disabled,
9161
- readonly = _this$props9.readonly,
9162
- uiSchema = _this$props9.uiSchema,
9163
- _this$props9$registry = _this$props9.registry,
9164
- registry = _this$props9$registry === void 0 ? getDefaultRegistry$1() : _this$props9$registry;
9214
+ var _this$props10 = this.props,
9215
+ disabled = _this$props10.disabled,
9216
+ readonly = _this$props10.readonly,
9217
+ uiSchema = _this$props10.uiSchema,
9218
+ _this$props10$registr = _this$props10.registry,
9219
+ registry = _this$props10$registr === void 0 ? getDefaultRegistry$1() : _this$props10$registr;
9165
9220
  var SchemaField = registry.fields.SchemaField;
9166
9221
 
9167
9222
  var _orderable$removable$ = _objectSpread$g({
@@ -9501,6 +9556,7 @@ function (_Component) {
9501
9556
  errorSchema = _this$props3.errorSchema,
9502
9557
  formData = _this$props3.formData,
9503
9558
  idPrefix = _this$props3.idPrefix,
9559
+ idSeparator = _this$props3.idSeparator,
9504
9560
  idSchema = _this$props3.idSchema,
9505
9561
  onBlur = _this$props3.onBlur,
9506
9562
  onChange = _this$props3.onChange,
@@ -9561,6 +9617,7 @@ function (_Component) {
9561
9617
  errorSchema: errorSchema,
9562
9618
  idSchema: idSchema,
9563
9619
  idPrefix: idPrefix,
9620
+ idSeparator: idSeparator,
9564
9621
  formData: formData,
9565
9622
  onChange: onChange,
9566
9623
  onBlur: onBlur,
@@ -9931,6 +9988,7 @@ function (_Component) {
9931
9988
  disabled = _this$props2.disabled,
9932
9989
  readonly = _this$props2.readonly,
9933
9990
  idPrefix = _this$props2.idPrefix,
9991
+ idSeparator = _this$props2.idSeparator,
9934
9992
  onBlur = _this$props2.onBlur,
9935
9993
  onFocus = _this$props2.onFocus,
9936
9994
  _this$props2$registry = _this$props2.registry,
@@ -9978,6 +10036,7 @@ function (_Component) {
9978
10036
  errorSchema: errorSchema[name],
9979
10037
  idSchema: idSchema[name],
9980
10038
  idPrefix: idPrefix,
10039
+ idSeparator: idSeparator,
9981
10040
  formData: (formData || {})[name],
9982
10041
  wasPropertyKeyModified: _this2.state.wasPropertyKeyModified,
9983
10042
  onKeyChange: _this2.onKeyChange(name),
@@ -10256,6 +10315,7 @@ function SchemaFieldRender$1(props) {
10256
10315
  formData = props.formData,
10257
10316
  errorSchema = props.errorSchema,
10258
10317
  idPrefix = props.idPrefix,
10318
+ idSeparator = props.idSeparator,
10259
10319
  name = props.name,
10260
10320
  onChange = props.onChange,
10261
10321
  onKeyChange = props.onKeyChange,
@@ -10271,7 +10331,7 @@ function SchemaFieldRender$1(props) {
10271
10331
  var FieldTemplate = uiSchema["ui:FieldTemplate"] || registry.FieldTemplate || DefaultTemplate$1;
10272
10332
  var idSchema = props.idSchema;
10273
10333
  var schema = retrieveSchema$1(props.schema, rootSchema, formData);
10274
- idSchema = mergeObjects$1(toIdSchema$1(schema, null, rootSchema, formData, idPrefix), idSchema);
10334
+ idSchema = mergeObjects$1(toIdSchema$1(schema, null, rootSchema, formData, idPrefix, idSeparator), idSchema);
10275
10335
  var FieldComponent = getFieldComponent$1(schema, uiSchema, idSchema, fields);
10276
10336
  var DescriptionField = fields.DescriptionField;
10277
10337
  var disabled = Boolean(props.disabled || uiSchema["ui:disabled"]);
@@ -19393,7 +19453,7 @@ function getDisplayLabel$1(schema, uiSchema, rootSchema) {
19393
19453
  var schemaType = getSchemaType$1(schema);
19394
19454
 
19395
19455
  if (schemaType === "array") {
19396
- displayLabel = isMultiSelect$1(schema, rootSchema) || isFilesArray$1(schema, uiSchema, rootSchema);
19456
+ displayLabel = isMultiSelect$1(schema, rootSchema) || isFilesArray$1(schema, uiSchema, rootSchema) || isCustomWidget$1(uiSchema);
19397
19457
  }
19398
19458
 
19399
19459
  if (schemaType === "object") {
@@ -19570,6 +19630,12 @@ function isFixedItems$1(schema) {
19570
19630
  return isObject$1(item);
19571
19631
  });
19572
19632
  }
19633
+ function isCustomWidget$1(uiSchema) {
19634
+ return (// TODO: Remove the `&& uiSchema["ui:widget"] !== "hidden"` once we support hidden widgets for arrays.
19635
+ // https://react-jsonschema-form.readthedocs.io/en/latest/usage/widgets/#hidden-widgets
19636
+ "widget" in getUiOptions$1(uiSchema) && getUiOptions$1(uiSchema)["widget"] !== "hidden"
19637
+ );
19638
+ }
19573
19639
  function allowAdditionalItems$1(schema) {
19574
19640
  if (schema.additionalItems === true) {
19575
19641
  console.warn("additionalItems=true is currently not supported");
@@ -19972,6 +20038,7 @@ function shouldRender$1(comp, nextProps, nextState) {
19972
20038
  function toIdSchema$1(schema, id, rootSchema) {
19973
20039
  var formData = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
19974
20040
  var idPrefix = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : "root";
20041
+ var idSeparator = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : "_";
19975
20042
  var idSchema = {
19976
20043
  $id: id || idPrefix
19977
20044
  };
@@ -19979,11 +20046,11 @@ function toIdSchema$1(schema, id, rootSchema) {
19979
20046
  if ("$ref" in schema || "dependencies" in schema || "allOf" in schema) {
19980
20047
  var _schema = retrieveSchema$1(schema, rootSchema, formData);
19981
20048
 
19982
- return toIdSchema$1(_schema, id, rootSchema, formData, idPrefix);
20049
+ return toIdSchema$1(_schema, id, rootSchema, formData, idPrefix, idSeparator);
19983
20050
  }
19984
20051
 
19985
20052
  if ("items" in schema && !schema.items.$ref) {
19986
- return toIdSchema$1(schema.items, id, rootSchema, formData, idPrefix);
20053
+ return toIdSchema$1(schema.items, id, rootSchema, formData, idPrefix, idSeparator);
19987
20054
  }
19988
20055
 
19989
20056
  if (schema.type !== "object") {
@@ -19992,10 +20059,10 @@ function toIdSchema$1(schema, id, rootSchema) {
19992
20059
 
19993
20060
  for (var name in schema.properties || {}) {
19994
20061
  var field = schema.properties[name];
19995
- var fieldId = idSchema.$id + "_" + name;
20062
+ var fieldId = idSchema.$id + idSeparator + name;
19996
20063
  idSchema[name] = toIdSchema$1(isObject$1(field) ? field : {}, fieldId, rootSchema, // It's possible that formData is not an object -- this can happen if an
19997
20064
  // array item has just been added, but not populated with data yet
19998
- (formData || {})[name], idPrefix);
20065
+ (formData || {})[name], idPrefix, idSeparator);
19999
20066
  }
20000
20067
 
20001
20068
  return idSchema;
@@ -20568,7 +20635,7 @@ function (_Component) {
20568
20635
  errors = toErrorList$1(errorSchema);
20569
20636
  }
20570
20637
 
20571
- var idSchema = toIdSchema$1(retrievedSchema, uiSchema["ui:rootFieldId"], rootSchema, formData, props.idPrefix);
20638
+ var idSchema = toIdSchema$1(retrievedSchema, uiSchema["ui:rootFieldId"], rootSchema, formData, props.idPrefix, props.idSeparator);
20572
20639
  var nextState = {
20573
20640
  schema: schema,
20574
20641
  uiSchema: uiSchema,
@@ -20671,6 +20738,7 @@ function (_Component) {
20671
20738
  children = _this$props5.children,
20672
20739
  id = _this$props5.id,
20673
20740
  idPrefix = _this$props5.idPrefix,
20741
+ idSeparator = _this$props5.idSeparator,
20674
20742
  className = _this$props5.className,
20675
20743
  tagName = _this$props5.tagName,
20676
20744
  name = _this$props5.name,
@@ -20721,6 +20789,7 @@ function (_Component) {
20721
20789
  errorSchema: errorSchema,
20722
20790
  idSchema: idSchema,
20723
20791
  idPrefix: idPrefix,
20792
+ idSeparator: idSeparator,
20724
20793
  formContext: formContext,
20725
20794
  formData: formData,
20726
20795
  onChange: this.onChange,
@@ -23204,6 +23273,15 @@ function (_Component) {
23204
23273
  });
23205
23274
  }
23206
23275
 
23276
+ if (isMultiSelect(schema, rootSchema)) {
23277
+ // If array has enum or uniqueItems set to true, call renderMultiSelect() to render the default multiselect widget or a custom widget, if specified.
23278
+ return this.renderMultiSelect();
23279
+ }
23280
+
23281
+ if (isCustomWidget(uiSchema)) {
23282
+ return this.renderCustomWidget();
23283
+ }
23284
+
23207
23285
  if (isFixedItems(schema)) {
23208
23286
  return this.renderFixedArray();
23209
23287
  }
@@ -23212,10 +23290,6 @@ function (_Component) {
23212
23290
  return this.renderFiles();
23213
23291
  }
23214
23292
 
23215
- if (isMultiSelect(schema, rootSchema)) {
23216
- return this.renderMultiSelect();
23217
- }
23218
-
23219
23293
  return this.renderNormalArray();
23220
23294
  }
23221
23295
  }, {
@@ -23238,6 +23312,7 @@ function (_Component) {
23238
23312
  onBlur = _this$props5.onBlur,
23239
23313
  onFocus = _this$props5.onFocus,
23240
23314
  idPrefix = _this$props5.idPrefix,
23315
+ idSeparator = _this$props5.idSeparator,
23241
23316
  rawErrors = _this$props5.rawErrors;
23242
23317
  var title = schema.title === undefined ? name : schema.title;
23243
23318
  var ArrayFieldTemplate = registry.ArrayFieldTemplate,
@@ -23256,7 +23331,7 @@ function (_Component) {
23256
23331
  var itemSchema = retrieveSchema(schema.items, rootSchema, item);
23257
23332
  var itemErrorSchema = errorSchema ? errorSchema[index] : undefined;
23258
23333
  var itemIdPrefix = idSchema.$id + "_" + index;
23259
- var itemIdSchema = toIdSchema(itemSchema, itemIdPrefix, rootSchema, item, idPrefix);
23334
+ var itemIdSchema = toIdSchema(itemSchema, itemIdPrefix, rootSchema, item, idPrefix, idSeparator);
23260
23335
  return _this2.renderArrayFieldItem({
23261
23336
  key: key,
23262
23337
  index: index,
@@ -23293,13 +23368,12 @@ function (_Component) {
23293
23368
  return react.createElement(Component, arrayProps);
23294
23369
  }
23295
23370
  }, {
23296
- key: "renderMultiSelect",
23297
- value: function renderMultiSelect() {
23371
+ key: "renderCustomWidget",
23372
+ value: function renderCustomWidget() {
23298
23373
  var _this$props6 = this.props,
23299
23374
  schema = _this$props6.schema,
23300
23375
  idSchema = _this$props6.idSchema,
23301
23376
  uiSchema = _this$props6.uiSchema,
23302
- formData = _this$props6.formData,
23303
23377
  disabled = _this$props6.disabled,
23304
23378
  readonly = _this$props6.readonly,
23305
23379
  required = _this$props6.required,
@@ -23307,24 +23381,18 @@ function (_Component) {
23307
23381
  autofocus = _this$props6.autofocus,
23308
23382
  onBlur = _this$props6.onBlur,
23309
23383
  onFocus = _this$props6.onFocus,
23384
+ items = _this$props6.formData,
23310
23385
  _this$props6$registry = _this$props6.registry,
23311
23386
  registry = _this$props6$registry === void 0 ? getDefaultRegistry() : _this$props6$registry,
23312
23387
  rawErrors = _this$props6.rawErrors,
23313
23388
  name = _this$props6.name;
23314
- var items = this.props.formData;
23315
23389
  var widgets = registry.widgets,
23316
- rootSchema = registry.rootSchema,
23317
23390
  formContext = registry.formContext;
23318
- var itemsSchema = retrieveSchema(schema.items, rootSchema, formData);
23319
23391
  var title = schema.title || name;
23320
- var enumOptions = optionsList(itemsSchema);
23321
23392
 
23322
- var _getUiOptions$enumOpt = _objectSpread$7({}, getUiOptions(uiSchema), {
23323
- enumOptions: enumOptions
23324
- }),
23325
- _getUiOptions$enumOpt2 = _getUiOptions$enumOpt.widget,
23326
- widget = _getUiOptions$enumOpt2 === void 0 ? "select" : _getUiOptions$enumOpt2,
23327
- options = _objectWithoutProperties$7(_getUiOptions$enumOpt, ["widget"]);
23393
+ var _getUiOptions2 = _objectSpread$7({}, getUiOptions(uiSchema)),
23394
+ widget = _getUiOptions2.widget,
23395
+ options = _objectWithoutProperties$7(_getUiOptions2, ["widget"]);
23328
23396
 
23329
23397
  var Widget = getWidget(schema, widget, widgets);
23330
23398
  return react.createElement(Widget, {
@@ -23348,73 +23416,129 @@ function (_Component) {
23348
23416
  });
23349
23417
  }
23350
23418
  }, {
23351
- key: "renderFiles",
23352
- value: function renderFiles() {
23419
+ key: "renderMultiSelect",
23420
+ value: function renderMultiSelect() {
23353
23421
  var _this$props7 = this.props,
23354
23422
  schema = _this$props7.schema,
23355
- uiSchema = _this$props7.uiSchema,
23356
23423
  idSchema = _this$props7.idSchema,
23357
- name = _this$props7.name,
23424
+ uiSchema = _this$props7.uiSchema,
23425
+ formData = _this$props7.formData,
23358
23426
  disabled = _this$props7.disabled,
23359
23427
  readonly = _this$props7.readonly,
23428
+ required = _this$props7.required,
23429
+ placeholder = _this$props7.placeholder,
23360
23430
  autofocus = _this$props7.autofocus,
23361
23431
  onBlur = _this$props7.onBlur,
23362
23432
  onFocus = _this$props7.onFocus,
23363
23433
  _this$props7$registry = _this$props7.registry,
23364
23434
  registry = _this$props7$registry === void 0 ? getDefaultRegistry() : _this$props7$registry,
23365
- rawErrors = _this$props7.rawErrors;
23366
- var title = schema.title || name;
23435
+ rawErrors = _this$props7.rawErrors,
23436
+ name = _this$props7.name;
23367
23437
  var items = this.props.formData;
23368
23438
  var widgets = registry.widgets,
23439
+ rootSchema = registry.rootSchema,
23369
23440
  formContext = registry.formContext;
23441
+ var itemsSchema = retrieveSchema(schema.items, rootSchema, formData);
23442
+ var title = schema.title || name;
23443
+ var enumOptions = optionsList(itemsSchema);
23370
23444
 
23371
- var _getUiOptions2 = getUiOptions(uiSchema),
23372
- _getUiOptions2$widget = _getUiOptions2.widget,
23373
- widget = _getUiOptions2$widget === void 0 ? "files" : _getUiOptions2$widget,
23374
- options = _objectWithoutProperties$7(_getUiOptions2, ["widget"]);
23445
+ var _getUiOptions$enumOpt = _objectSpread$7({}, getUiOptions(uiSchema), {
23446
+ enumOptions: enumOptions
23447
+ }),
23448
+ _getUiOptions$enumOpt2 = _getUiOptions$enumOpt.widget,
23449
+ widget = _getUiOptions$enumOpt2 === void 0 ? "select" : _getUiOptions$enumOpt2,
23450
+ options = _objectWithoutProperties$7(_getUiOptions$enumOpt, ["widget"]);
23375
23451
 
23376
23452
  var Widget = getWidget(schema, widget, widgets);
23377
23453
  return react.createElement(Widget, {
23378
- options: options,
23379
23454
  id: idSchema && idSchema.$id,
23380
23455
  multiple: true,
23381
23456
  onChange: this.onSelectChange,
23382
23457
  onBlur: onBlur,
23383
23458
  onFocus: onFocus,
23459
+ options: options,
23384
23460
  schema: schema,
23385
- title: title,
23461
+ registry: registry,
23386
23462
  value: items,
23387
23463
  disabled: disabled,
23388
23464
  readonly: readonly,
23465
+ required: required,
23466
+ label: title,
23467
+ placeholder: placeholder,
23389
23468
  formContext: formContext,
23390
23469
  autofocus: autofocus,
23391
23470
  rawErrors: rawErrors
23392
23471
  });
23393
23472
  }
23394
23473
  }, {
23395
- key: "renderFixedArray",
23396
- value: function renderFixedArray() {
23397
- var _this3 = this;
23398
-
23474
+ key: "renderFiles",
23475
+ value: function renderFiles() {
23399
23476
  var _this$props8 = this.props,
23400
23477
  schema = _this$props8.schema,
23401
23478
  uiSchema = _this$props8.uiSchema,
23402
- formData = _this$props8.formData,
23403
- errorSchema = _this$props8.errorSchema,
23404
- idPrefix = _this$props8.idPrefix,
23405
23479
  idSchema = _this$props8.idSchema,
23406
23480
  name = _this$props8.name,
23407
- required = _this$props8.required,
23408
23481
  disabled = _this$props8.disabled,
23409
23482
  readonly = _this$props8.readonly,
23410
23483
  autofocus = _this$props8.autofocus,
23411
- _this$props8$registry = _this$props8.registry,
23412
- registry = _this$props8$registry === void 0 ? getDefaultRegistry() : _this$props8$registry,
23413
23484
  onBlur = _this$props8.onBlur,
23414
23485
  onFocus = _this$props8.onFocus,
23486
+ _this$props8$registry = _this$props8.registry,
23487
+ registry = _this$props8$registry === void 0 ? getDefaultRegistry() : _this$props8$registry,
23415
23488
  rawErrors = _this$props8.rawErrors;
23416
23489
  var title = schema.title || name;
23417
23490
  var items = this.props.formData;
23491
+ var widgets = registry.widgets,
23492
+ formContext = registry.formContext;
23493
+
23494
+ var _getUiOptions3 = getUiOptions(uiSchema),
23495
+ _getUiOptions3$widget = _getUiOptions3.widget,
23496
+ widget = _getUiOptions3$widget === void 0 ? "files" : _getUiOptions3$widget,
23497
+ options = _objectWithoutProperties$7(_getUiOptions3, ["widget"]);
23498
+
23499
+ var Widget = getWidget(schema, widget, widgets);
23500
+ return react.createElement(Widget, {
23501
+ options: options,
23502
+ id: idSchema && idSchema.$id,
23503
+ multiple: true,
23504
+ onChange: this.onSelectChange,
23505
+ onBlur: onBlur,
23506
+ onFocus: onFocus,
23507
+ schema: schema,
23508
+ title: title,
23509
+ value: items,
23510
+ disabled: disabled,
23511
+ readonly: readonly,
23512
+ formContext: formContext,
23513
+ autofocus: autofocus,
23514
+ rawErrors: rawErrors
23515
+ });
23516
+ }
23517
+ }, {
23518
+ key: "renderFixedArray",
23519
+ value: function renderFixedArray() {
23520
+ var _this3 = this;
23521
+
23522
+ var _this$props9 = this.props,
23523
+ schema = _this$props9.schema,
23524
+ uiSchema = _this$props9.uiSchema,
23525
+ formData = _this$props9.formData,
23526
+ errorSchema = _this$props9.errorSchema,
23527
+ idPrefix = _this$props9.idPrefix,
23528
+ idSeparator = _this$props9.idSeparator,
23529
+ idSchema = _this$props9.idSchema,
23530
+ name = _this$props9.name,
23531
+ required = _this$props9.required,
23532
+ disabled = _this$props9.disabled,
23533
+ readonly = _this$props9.readonly,
23534
+ autofocus = _this$props9.autofocus,
23535
+ _this$props9$registry = _this$props9.registry,
23536
+ registry = _this$props9$registry === void 0 ? getDefaultRegistry() : _this$props9$registry,
23537
+ onBlur = _this$props9.onBlur,
23538
+ onFocus = _this$props9.onFocus,
23539
+ rawErrors = _this$props9.rawErrors;
23540
+ var title = schema.title || name;
23541
+ var items = this.props.formData;
23418
23542
  var ArrayFieldTemplate = registry.ArrayFieldTemplate,
23419
23543
  rootSchema = registry.rootSchema,
23420
23544
  fields = registry.fields,
@@ -23444,7 +23568,7 @@ function (_Component) {
23444
23568
  var additional = index >= itemSchemas.length;
23445
23569
  var itemSchema = additional ? retrieveSchema(schema.additionalItems, rootSchema, item) : itemSchemas[index];
23446
23570
  var itemIdPrefix = idSchema.$id + "_" + index;
23447
- var itemIdSchema = toIdSchema(itemSchema, itemIdPrefix, rootSchema, item, idPrefix);
23571
+ var itemIdSchema = toIdSchema(itemSchema, itemIdPrefix, rootSchema, item, idPrefix, idSeparator);
23448
23572
  var itemUiSchema = additional ? uiSchema.additionalItems || {} : Array.isArray(uiSchema.items) ? uiSchema.items[index] : uiSchema.items || {};
23449
23573
  var itemErrorSchema = errorSchema ? errorSchema[index] : undefined;
23450
23574
  return _this3.renderArrayFieldItem({
@@ -23497,12 +23621,12 @@ function (_Component) {
23497
23621
  onBlur = props.onBlur,
23498
23622
  onFocus = props.onFocus,
23499
23623
  rawErrors = props.rawErrors;
23500
- var _this$props9 = this.props,
23501
- disabled = _this$props9.disabled,
23502
- readonly = _this$props9.readonly,
23503
- uiSchema = _this$props9.uiSchema,
23504
- _this$props9$registry = _this$props9.registry,
23505
- registry = _this$props9$registry === void 0 ? getDefaultRegistry() : _this$props9$registry;
23624
+ var _this$props10 = this.props,
23625
+ disabled = _this$props10.disabled,
23626
+ readonly = _this$props10.readonly,
23627
+ uiSchema = _this$props10.uiSchema,
23628
+ _this$props10$registr = _this$props10.registry,
23629
+ registry = _this$props10$registr === void 0 ? getDefaultRegistry() : _this$props10$registr;
23506
23630
  var SchemaField = registry.fields.SchemaField;
23507
23631
 
23508
23632
  var _orderable$removable$ = _objectSpread$7({
@@ -23842,6 +23966,7 @@ function (_Component) {
23842
23966
  errorSchema = _this$props3.errorSchema,
23843
23967
  formData = _this$props3.formData,
23844
23968
  idPrefix = _this$props3.idPrefix,
23969
+ idSeparator = _this$props3.idSeparator,
23845
23970
  idSchema = _this$props3.idSchema,
23846
23971
  onBlur = _this$props3.onBlur,
23847
23972
  onChange = _this$props3.onChange,
@@ -23902,6 +24027,7 @@ function (_Component) {
23902
24027
  errorSchema: errorSchema,
23903
24028
  idSchema: idSchema,
23904
24029
  idPrefix: idPrefix,
24030
+ idSeparator: idSeparator,
23905
24031
  formData: formData,
23906
24032
  onChange: onChange,
23907
24033
  onBlur: onBlur,
@@ -24272,6 +24398,7 @@ function (_Component) {
24272
24398
  disabled = _this$props2.disabled,
24273
24399
  readonly = _this$props2.readonly,
24274
24400
  idPrefix = _this$props2.idPrefix,
24401
+ idSeparator = _this$props2.idSeparator,
24275
24402
  onBlur = _this$props2.onBlur,
24276
24403
  onFocus = _this$props2.onFocus,
24277
24404
  _this$props2$registry = _this$props2.registry,
@@ -24319,6 +24446,7 @@ function (_Component) {
24319
24446
  errorSchema: errorSchema[name],
24320
24447
  idSchema: idSchema[name],
24321
24448
  idPrefix: idPrefix,
24449
+ idSeparator: idSeparator,
24322
24450
  formData: (formData || {})[name],
24323
24451
  wasPropertyKeyModified: _this2.state.wasPropertyKeyModified,
24324
24452
  onKeyChange: _this2.onKeyChange(name),
@@ -26215,7 +26343,7 @@ function getDisplayLabel(schema, uiSchema, rootSchema) {
26215
26343
  var schemaType = getSchemaType(schema);
26216
26344
 
26217
26345
  if (schemaType === "array") {
26218
- displayLabel = isMultiSelect(schema, rootSchema) || isFilesArray(schema, uiSchema, rootSchema);
26346
+ displayLabel = isMultiSelect(schema, rootSchema) || isFilesArray(schema, uiSchema, rootSchema) || isCustomWidget(uiSchema);
26219
26347
  }
26220
26348
 
26221
26349
  if (schemaType === "object") {
@@ -26392,6 +26520,12 @@ function isFixedItems(schema) {
26392
26520
  return isObject(item);
26393
26521
  });
26394
26522
  }
26523
+ function isCustomWidget(uiSchema) {
26524
+ return (// TODO: Remove the `&& uiSchema["ui:widget"] !== "hidden"` once we support hidden widgets for arrays.
26525
+ // https://react-jsonschema-form.readthedocs.io/en/latest/usage/widgets/#hidden-widgets
26526
+ "widget" in getUiOptions(uiSchema) && getUiOptions(uiSchema)["widget"] !== "hidden"
26527
+ );
26528
+ }
26395
26529
  function allowAdditionalItems(schema) {
26396
26530
  if (schema.additionalItems === true) {
26397
26531
  console.warn("additionalItems=true is currently not supported");
@@ -26794,6 +26928,7 @@ function shouldRender(comp, nextProps, nextState) {
26794
26928
  function toIdSchema(schema, id, rootSchema) {
26795
26929
  var formData = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
26796
26930
  var idPrefix = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : "root";
26931
+ var idSeparator = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : "_";
26797
26932
  var idSchema = {
26798
26933
  $id: id || idPrefix
26799
26934
  };
@@ -26801,11 +26936,11 @@ function toIdSchema(schema, id, rootSchema) {
26801
26936
  if ("$ref" in schema || "dependencies" in schema || "allOf" in schema) {
26802
26937
  var _schema = retrieveSchema(schema, rootSchema, formData);
26803
26938
 
26804
- return toIdSchema(_schema, id, rootSchema, formData, idPrefix);
26939
+ return toIdSchema(_schema, id, rootSchema, formData, idPrefix, idSeparator);
26805
26940
  }
26806
26941
 
26807
26942
  if ("items" in schema && !schema.items.$ref) {
26808
- return toIdSchema(schema.items, id, rootSchema, formData, idPrefix);
26943
+ return toIdSchema(schema.items, id, rootSchema, formData, idPrefix, idSeparator);
26809
26944
  }
26810
26945
 
26811
26946
  if (schema.type !== "object") {
@@ -26814,10 +26949,10 @@ function toIdSchema(schema, id, rootSchema) {
26814
26949
 
26815
26950
  for (var name in schema.properties || {}) {
26816
26951
  var field = schema.properties[name];
26817
- var fieldId = idSchema.$id + "_" + name;
26952
+ var fieldId = idSchema.$id + idSeparator + name;
26818
26953
  idSchema[name] = toIdSchema(isObject(field) ? field : {}, fieldId, rootSchema, // It's possible that formData is not an object -- this can happen if an
26819
26954
  // array item has just been added, but not populated with data yet
26820
- (formData || {})[name], idPrefix);
26955
+ (formData || {})[name], idPrefix, idSeparator);
26821
26956
  }
26822
26957
 
26823
26958
  return idSchema;
@@ -27272,6 +27407,7 @@ function SchemaFieldRender(props) {
27272
27407
  formData = props.formData,
27273
27408
  errorSchema = props.errorSchema,
27274
27409
  idPrefix = props.idPrefix,
27410
+ idSeparator = props.idSeparator,
27275
27411
  name = props.name,
27276
27412
  onChange = props.onChange,
27277
27413
  onKeyChange = props.onKeyChange,
@@ -27287,7 +27423,7 @@ function SchemaFieldRender(props) {
27287
27423
  var FieldTemplate = uiSchema["ui:FieldTemplate"] || registry.FieldTemplate || DefaultTemplate;
27288
27424
  var idSchema = props.idSchema;
27289
27425
  var schema = retrieveSchema(props.schema, rootSchema, formData);
27290
- idSchema = mergeObjects(toIdSchema(schema, null, rootSchema, formData, idPrefix), idSchema);
27426
+ idSchema = mergeObjects(toIdSchema(schema, null, rootSchema, formData, idPrefix, idSeparator), idSchema);
27291
27427
  var FieldComponent = getFieldComponent(schema, uiSchema, idSchema, fields);
27292
27428
  var DescriptionField = fields.DescriptionField;
27293
27429
  var disabled = Boolean(props.disabled || uiSchema["ui:disabled"]);