@rjsf/core 5.8.2 → 5.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react/jsx-runtime'), require('react'), require('@rjsf/utils'), require('lodash-es/get'), require('lodash-es/isEmpty'), require('lodash-es/pick'), require('lodash-es/toPath'), require('lodash-es/cloneDeep'), require('lodash-es/isObject'), require('lodash-es/set'), require('nanoid'), require('lodash-es/omit'), require('markdown-to-jsx'), require('lodash-es/has'), require('lodash-es/unset')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'react/jsx-runtime', 'react', '@rjsf/utils', 'lodash-es/get', 'lodash-es/isEmpty', 'lodash-es/pick', 'lodash-es/toPath', 'lodash-es/cloneDeep', 'lodash-es/isObject', 'lodash-es/set', 'nanoid', 'lodash-es/omit', 'markdown-to-jsx', 'lodash-es/has', 'lodash-es/unset'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.JSONSchemaForm = {}, global.jsxRuntime, global.React, global.utils, global.get, global.isEmpty, global._pick, global._toPath, global.cloneDeep, global.isObject, global.set, global.nanoid, global.omit, global.Markdown, global.has, global.unset));
5
- })(this, (function (exports, jsxRuntime, react, utils, get, isEmpty, _pick, _toPath, cloneDeep, isObject, set, nanoid, omit, Markdown, has, unset) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react/jsx-runtime'), require('react'), require('@rjsf/utils'), require('lodash-es/get'), require('lodash-es/isEmpty'), require('lodash-es/pick'), require('lodash-es/toPath'), require('lodash-es/cloneDeep'), require('lodash-es/isObject'), require('lodash-es/set'), require('nanoid'), require('lodash-es/omit'), require('lodash-es/unset'), require('markdown-to-jsx'), require('lodash-es/has')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'react/jsx-runtime', 'react', '@rjsf/utils', 'lodash-es/get', 'lodash-es/isEmpty', 'lodash-es/pick', 'lodash-es/toPath', 'lodash-es/cloneDeep', 'lodash-es/isObject', 'lodash-es/set', 'nanoid', 'lodash-es/omit', 'lodash-es/unset', 'markdown-to-jsx', 'lodash-es/has'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.JSONSchemaForm = {}, global.jsxRuntime, global.React, global.utils, global.get, global.isEmpty, global._pick, global._toPath, global.cloneDeep, global.isObject, global.set, global.nanoid, global.omit, global.unset, global.Markdown, global.has));
5
+ })(this, (function (exports, jsxRuntime, react, utils, get, isEmpty, _pick, _toPath, cloneDeep, isObject, set, nanoid, omit, unset, Markdown, has) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -14,9 +14,9 @@
14
14
  var isObject__default = /*#__PURE__*/_interopDefaultLegacy(isObject);
15
15
  var set__default = /*#__PURE__*/_interopDefaultLegacy(set);
16
16
  var omit__default = /*#__PURE__*/_interopDefaultLegacy(omit);
17
+ var unset__default = /*#__PURE__*/_interopDefaultLegacy(unset);
17
18
  var Markdown__default = /*#__PURE__*/_interopDefaultLegacy(Markdown);
18
19
  var has__default = /*#__PURE__*/_interopDefaultLegacy(has);
19
- var unset__default = /*#__PURE__*/_interopDefaultLegacy(unset);
20
20
 
21
21
  function _defineProperties(target, props) {
22
22
  for (var i = 0; i < props.length; i++) {
@@ -89,7 +89,7 @@
89
89
  }
90
90
 
91
91
  var _excluded$9 = ["widget", "title"],
92
- _excluded2 = ["widget", "title"],
92
+ _excluded2$1 = ["widget", "title"],
93
93
  _excluded3 = ["widget", "title"];
94
94
  /** Used to generate a unique ID for an element in a row */
95
95
  function generateRowId() {
@@ -633,7 +633,7 @@
633
633
  _getUiOptions3$widget = _getUiOptions3.widget,
634
634
  widget = _getUiOptions3$widget === void 0 ? 'select' : _getUiOptions3$widget,
635
635
  uiTitle = _getUiOptions3.title,
636
- options = _objectWithoutPropertiesLoose(_getUiOptions3, _excluded2);
636
+ options = _objectWithoutPropertiesLoose(_getUiOptions3, _excluded2$1);
637
637
  var Widget = utils.getWidget(schema, widget, widgets);
638
638
  var label = (_ref2 = uiTitle != null ? uiTitle : schema.title) != null ? _ref2 : name;
639
639
  var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);
@@ -1027,7 +1027,8 @@
1027
1027
  });
1028
1028
  }
1029
1029
 
1030
- var _excluded$7 = ["widget", "placeholder", "autofocus", "autocomplete", "title"];
1030
+ var _excluded$7 = ["widget", "placeholder", "autofocus", "autocomplete", "title"],
1031
+ _excluded2 = ["oneOf", "anyOf"];
1031
1032
  /** The `AnyOfField` component is used to render a field in the schema that is an `anyOf`, `allOf` or `oneOf`. It tracks
1032
1033
  * the currently selected option and cleans up any irrelevant data in `formData`.
1033
1034
  *
@@ -1153,7 +1154,6 @@
1153
1154
  _proto.render = function render() {
1154
1155
  var _this$props6 = this.props,
1155
1156
  name = _this$props6.name,
1156
- baseType = _this$props6.baseType,
1157
1157
  _this$props6$disabled = _this$props6.disabled,
1158
1158
  disabled = _this$props6$disabled === void 0 ? false : _this$props6$disabled,
1159
1159
  _this$props6$errorSch = _this$props6.errorSchema,
@@ -1191,11 +1191,10 @@
1191
1191
  var option = selectedOption >= 0 ? retrievedOptions[selectedOption] || null : null;
1192
1192
  var optionSchema;
1193
1193
  if (option) {
1194
- // If the subschema doesn't declare a type, infer the type from the
1195
- // parent schema
1196
- optionSchema = option.type ? option : Object.assign({}, option, {
1197
- type: baseType
1198
- });
1194
+ var remaining = _objectWithoutPropertiesLoose(schema, _excluded2);
1195
+ // Merge in all the non-oneOf/anyOf properties and also skip the special ADDITIONAL_PROPERTY_FLAG property
1196
+ unset__default["default"](remaining, utils.ADDITIONAL_PROPERTY_FLAG);
1197
+ optionSchema = !isEmpty__default["default"](remaining) ? _extends({}, remaining, option) : option;
1199
1198
  }
1200
1199
  var translateEnum = title ? utils.TranslatableString.TitleOptionPrefix : utils.TranslatableString.OptionPrefix;
1201
1200
  var translateParams = title ? [title] : [];
@@ -1654,7 +1653,11 @@
1654
1653
  }
1655
1654
  var schemaType = utils.getSchemaType(schema);
1656
1655
  var type = Array.isArray(schemaType) ? schemaType[0] : schemaType || '';
1656
+ var schemaId = schema.$id;
1657
1657
  var componentName = COMPONENT_TYPES[type];
1658
+ if (schemaId && schemaId in fields) {
1659
+ componentName = schemaId;
1660
+ }
1658
1661
  // If the type is not defined and the schema uses 'anyOf' or 'oneOf', don't
1659
1662
  // render a field and let the MultiSchemaField component handle the form display
1660
1663
  if (!componentName && (schema.anyOf || schema.oneOf)) {
@@ -1841,7 +1844,6 @@
1841
1844
  options: schema.anyOf.map(function (_schema) {
1842
1845
  return schemaUtils.retrieveSchema(isObject__default["default"](_schema) ? _schema : {}, formData);
1843
1846
  }),
1844
- baseType: schema.type,
1845
1847
  registry: registry,
1846
1848
  schema: schema,
1847
1849
  uiSchema: uiSchema
@@ -1862,7 +1864,6 @@
1862
1864
  options: schema.oneOf.map(function (_schema) {
1863
1865
  return schemaUtils.retrieveSchema(isObject__default["default"](_schema) ? _schema : {}, formData);
1864
1866
  }),
1865
- baseType: schema.type,
1866
1867
  registry: registry,
1867
1868
  schema: schema,
1868
1869
  uiSchema: uiSchema