@rjsf/utils 6.0.2 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/utils.umd.js CHANGED
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('lodash/isPlainObject'), require('lodash/isEqualWith'), require('lodash/get'), require('lodash/has'), require('lodash/isEqual'), require('lodash/set'), require('lodash/times'), require('lodash/transform'), require('lodash/merge'), require('lodash/flattenDeep'), require('lodash/uniq'), require('json-schema-merge-allof'), require('jsonpointer'), require('lodash/omit'), require('lodash/isObject'), require('lodash/isEmpty'), require('fast-uri'), require('lodash/isString'), require('lodash/union'), require('lodash/isNumber'), require('lodash/reduce'), require('lodash/isNil'), require('lodash/cloneDeep'), require('lodash/setWith'), require('lodash/keys'), require('lodash/pickBy'), require('lodash/difference'), require('lodash/uniqueId'), require('react'), require('react-is'), require('react/jsx-runtime'), require('lodash/toPath'), require('lodash/forEach')) :
3
3
  typeof define === 'function' && define.amd ? define(['exports', 'lodash/isPlainObject', 'lodash/isEqualWith', 'lodash/get', 'lodash/has', 'lodash/isEqual', 'lodash/set', 'lodash/times', 'lodash/transform', 'lodash/merge', 'lodash/flattenDeep', 'lodash/uniq', 'json-schema-merge-allof', 'jsonpointer', 'lodash/omit', 'lodash/isObject', 'lodash/isEmpty', 'fast-uri', 'lodash/isString', 'lodash/union', 'lodash/isNumber', 'lodash/reduce', 'lodash/isNil', 'lodash/cloneDeep', 'lodash/setWith', 'lodash/keys', 'lodash/pickBy', 'lodash/difference', 'lodash/uniqueId', 'react', 'react-is', 'react/jsx-runtime', 'lodash/toPath', 'lodash/forEach'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@rjsf/utils"] = {}, global.isPlainObject2, global.isEqualWith, global.get13, global.has5, global.isEqual2, global.set, global.times, global.transform, global.merge, global.flattenDeep, global.uniq, global.mergeAllOf, global.jsonpointer, global.omit, global.isObject2, global.isEmpty4, global.UriResolver, global.isString, global.union, global.isNumber, global.reduce, global.isNil, global.cloneDeep, global.setWith, global.keys, global.pickBy, global.difference, global.uniqueId, global.react, global.ReactIs, global.jsxRuntime, global.toPath, global.forEach));
5
- })(this, (function (exports, isPlainObject2, isEqualWith, get13, has5, isEqual2, set, times, transform, merge, flattenDeep, uniq, mergeAllOf, jsonpointer, omit, isObject2, isEmpty4, UriResolver, isString, union, isNumber, reduce, isNil, cloneDeep, setWith, keys, pickBy, difference, uniqueId, react, ReactIs, jsxRuntime, toPath, forEach) { 'use strict';
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@rjsf/utils"] = {}, global.isPlainObject2, global.isEqualWith, global.get14, global.has5, global.isEqual2, global.set, global.times, global.transform, global.merge, global.flattenDeep, global.uniq, global.mergeAllOf, global.jsonpointer, global.omit, global.isObject2, global.isEmpty4, global.UriResolver, global.isString, global.union, global.isNumber, global.reduce, global.isNil, global.cloneDeep, global.setWith, global.keys, global.pickBy, global.difference, global.uniqueId, global.react, global.ReactIs, global.jsxRuntime, global.toPath, global.forEach));
5
+ })(this, (function (exports, isPlainObject2, isEqualWith, get14, has5, isEqual2, set, times, transform, merge, flattenDeep, uniq, mergeAllOf, jsonpointer, omit, isObject2, isEmpty4, UriResolver, isString, union, isNumber, reduce, isNil, cloneDeep, setWith, keys, pickBy, difference, uniqueId, react, ReactIs, jsxRuntime, toPath, forEach) { 'use strict';
6
6
 
7
7
  // src/isObject.ts
8
8
  function isObject(thing) {
@@ -176,7 +176,7 @@
176
176
  return void 0;
177
177
  }
178
178
  function makeAllReferencesAbsolute(schema, baseURI) {
179
- const currentURI = get13(schema, ID_KEY, baseURI);
179
+ const currentURI = get14(schema, ID_KEY, baseURI);
180
180
  if (REF_KEY in schema) {
181
181
  schema = { ...schema, [REF_KEY]: UriResolver.resolve(currentURI, schema[REF_KEY]) };
182
182
  }
@@ -197,7 +197,7 @@
197
197
  const remaining = omit(object, [key]);
198
198
  return [remaining, value];
199
199
  }
200
- function findSchemaDefinitionRecursive($ref, rootSchema = {}, recurseList = [], baseURI = get13(rootSchema, [ID_KEY])) {
200
+ function findSchemaDefinitionRecursive($ref, rootSchema = {}, recurseList = [], baseURI = get14(rootSchema, [ID_KEY])) {
201
201
  const ref = $ref || "";
202
202
  let current = void 0;
203
203
  if (ref.startsWith("#")) {
@@ -247,13 +247,13 @@
247
247
  }
248
248
  return current;
249
249
  }
250
- function findSchemaDefinition($ref, rootSchema = {}, baseURI = get13(rootSchema, [ID_KEY])) {
250
+ function findSchemaDefinition($ref, rootSchema = {}, baseURI = get14(rootSchema, [ID_KEY])) {
251
251
  const recurseList = [];
252
252
  return findSchemaDefinitionRecursive($ref, rootSchema, recurseList, baseURI);
253
253
  }
254
254
  function getDiscriminatorFieldFromSchema(schema) {
255
255
  let discriminator;
256
- const maybeString = get13(schema, DISCRIMINATOR_PATH);
256
+ const maybeString = get14(schema, DISCRIMINATOR_PATH);
257
257
  if (isString(maybeString)) {
258
258
  discriminator = maybeString;
259
259
  } else if (maybeString !== void 0) {
@@ -324,13 +324,13 @@
324
324
  }
325
325
  function getOptionMatchingSimpleDiscriminator(formData, options, discriminatorField) {
326
326
  if (formData && discriminatorField) {
327
- const value = get13(formData, discriminatorField);
327
+ const value = get14(formData, discriminatorField);
328
328
  if (value === void 0) {
329
329
  return;
330
330
  }
331
331
  for (let i = 0; i < options.length; i++) {
332
332
  const option = options[i];
333
- const discriminator = get13(option, [PROPERTIES_KEY, discriminatorField], {});
333
+ const discriminator = get14(option, [PROPERTIES_KEY, discriminatorField], {});
334
334
  if (discriminator.type === "object" || discriminator.type === "array") {
335
335
  continue;
336
336
  }
@@ -357,8 +357,8 @@
357
357
  for (let i = 0; i < options.length; i++) {
358
358
  const option = options[i];
359
359
  if (discriminatorField && has5(option, [PROPERTIES_KEY, discriminatorField])) {
360
- const value = get13(formData, discriminatorField);
361
- const discriminator = get13(option, [PROPERTIES_KEY, discriminatorField], {});
360
+ const value = get14(formData, discriminatorField);
361
+ const discriminator = get14(option, [PROPERTIES_KEY, discriminatorField], {});
362
362
  if (validator.isValid(discriminator, value, rootSchema)) {
363
363
  return i;
364
364
  }
@@ -636,7 +636,7 @@
636
636
  validator,
637
637
  { [ALL_OF_KEY]: Object.values(matchingProperties) },
638
638
  rootSchema,
639
- get13(formData, [key]),
639
+ get14(formData, [key]),
640
640
  experimental_customMergeAllOf
641
641
  );
642
642
  set(schema.properties, [key, ADDITIONAL_PROPERTY_FLAG], true);
@@ -649,7 +649,7 @@
649
649
  if (REF_KEY in schema.additionalProperties) {
650
650
  additionalProperties = retrieveSchema(
651
651
  validator,
652
- { [REF_KEY]: get13(schema.additionalProperties, [REF_KEY]) },
652
+ { [REF_KEY]: get14(schema.additionalProperties, [REF_KEY]) },
653
653
  rootSchema,
654
654
  formData,
655
655
  experimental_customMergeAllOf
@@ -662,10 +662,10 @@
662
662
  ...schema.additionalProperties
663
663
  };
664
664
  } else {
665
- additionalProperties = { type: guessType(get13(formData, [key])) };
665
+ additionalProperties = { type: guessType(get14(formData, [key])) };
666
666
  }
667
667
  } else {
668
- additionalProperties = { type: guessType(get13(formData, [key])) };
668
+ additionalProperties = { type: guessType(get14(formData, [key])) };
669
669
  }
670
670
  schema.properties[key] = additionalProperties;
671
671
  set(schema.properties, [key, ADDITIONAL_PROPERTY_FLAG], true);
@@ -745,7 +745,7 @@
745
745
  validator,
746
746
  { allOf: [schema2.properties[key], ...Object.values(matchingProperties)] },
747
747
  rootSchema,
748
- get13(rawFormData, [key]),
748
+ get14(rawFormData, [key]),
749
749
  experimental_customMergeAllOf
750
750
  );
751
751
  }
@@ -817,7 +817,7 @@
817
817
  function processDependencies(validator, dependencies, resolvedSchema, rootSchema, expandAllBranches, recurseList, formData, experimental_customMergeAllOf) {
818
818
  let schemas = [resolvedSchema];
819
819
  for (const dependencyKey in dependencies) {
820
- if (!expandAllBranches && get13(formData, [dependencyKey]) === void 0) {
820
+ if (!expandAllBranches && get14(formData, [dependencyKey]) === void 0) {
821
821
  continue;
822
822
  }
823
823
  if (resolvedSchema.properties && !(dependencyKey in resolvedSchema.properties)) {
@@ -948,11 +948,11 @@
948
948
  const xxxOfs = schema[xxx].map(
949
949
  (xxxOf) => retrieveSchema(validator, xxxOf, rootSchema, formData, experimental_customMergeAllOf)
950
950
  );
951
- const data = get13(formData, selectorField);
951
+ const data = get14(formData, selectorField);
952
952
  if (data !== void 0) {
953
953
  return xxxOfs.find((xxx2) => {
954
954
  return isEqual2(
955
- get13(xxx2, [PROPERTIES_KEY, selectorField, DEFAULT_KEY], get13(xxx2, [PROPERTIES_KEY, selectorField, CONST_KEY])),
955
+ get14(xxx2, [PROPERTIES_KEY, selectorField, DEFAULT_KEY], get14(xxx2, [PROPERTIES_KEY, selectorField, CONST_KEY])),
956
956
  data
957
957
  );
958
958
  });
@@ -971,7 +971,7 @@
971
971
  const pathList = Array.isArray(path) ? path : path.split(".");
972
972
  const [part, ...nestedPath] = pathList;
973
973
  if (part && has5(fieldSchema, part)) {
974
- fieldSchema = get13(fieldSchema, part);
974
+ fieldSchema = get14(fieldSchema, part);
975
975
  return getFromSchemaInternal(
976
976
  validator,
977
977
  rootSchema,
@@ -1013,7 +1013,7 @@
1013
1013
  parentField,
1014
1014
  fieldName,
1015
1015
  ONE_OF_KEY,
1016
- get13(formData, subPath),
1016
+ get14(formData, subPath),
1017
1017
  experimental_customMergeAllOf
1018
1018
  );
1019
1019
  } else if (has5(parentField, ANY_OF_KEY)) {
@@ -1023,7 +1023,7 @@
1023
1023
  parentField,
1024
1024
  fieldName,
1025
1025
  ANY_OF_KEY,
1026
- get13(formData, subPath),
1026
+ get14(formData, subPath),
1027
1027
  experimental_customMergeAllOf
1028
1028
  );
1029
1029
  }
@@ -1091,7 +1091,7 @@
1091
1091
  totalScore += reduce(
1092
1092
  schema.properties,
1093
1093
  (score, value, key) => {
1094
- const formValue = get13(formData, key);
1094
+ const formValue = get14(formData, key);
1095
1095
  if (typeof value === "boolean") {
1096
1096
  return score;
1097
1097
  }
@@ -1118,7 +1118,7 @@
1118
1118
  validator,
1119
1119
  rootSchema,
1120
1120
  formValue,
1121
- get13(value, key2),
1121
+ get14(value, key2),
1122
1122
  -1,
1123
1123
  discriminator,
1124
1124
  experimental_customMergeAllOf
@@ -1220,22 +1220,22 @@
1220
1220
  if (isObject(formData)) {
1221
1221
  const acc = Object.assign({}, defaults);
1222
1222
  return Object.keys(formData).reduce((acc2, key) => {
1223
- const keyValue = get13(formData, key);
1223
+ const keyValue = get14(formData, key);
1224
1224
  const keyExistsInDefaults = isObject(defaults) && key in defaults;
1225
1225
  const keyExistsInFormData = key in formData;
1226
- const keyDefault = get13(defaults, key) ?? {};
1226
+ const keyDefault = get14(defaults, key) ?? {};
1227
1227
  const defaultValueIsNestedObject = keyExistsInDefaults && Object.entries(keyDefault).some(([, v]) => isObject(v));
1228
- const keyDefaultIsObject = keyExistsInDefaults && isObject(get13(defaults, key));
1228
+ const keyDefaultIsObject = keyExistsInDefaults && isObject(get14(defaults, key));
1229
1229
  const keyHasFormDataObject = keyExistsInFormData && isObject(keyValue);
1230
1230
  if (keyDefaultIsObject && keyHasFormDataObject && !defaultValueIsNestedObject) {
1231
1231
  acc2[key] = {
1232
- ...get13(defaults, key),
1232
+ ...get14(defaults, key),
1233
1233
  ...keyValue
1234
1234
  };
1235
1235
  return acc2;
1236
1236
  }
1237
1237
  acc2[key] = mergeDefaultsWithFormData(
1238
- get13(defaults, key),
1238
+ get14(defaults, key),
1239
1239
  keyValue,
1240
1240
  mergeExtraArrayDefaults,
1241
1241
  defaultSupercedesUndefined,
@@ -1354,8 +1354,8 @@
1354
1354
  let value;
1355
1355
  let label = title;
1356
1356
  if (selectorField) {
1357
- const innerSchema = get13(aSchema, [PROPERTIES_KEY, selectorField], {});
1358
- value = get13(innerSchema, DEFAULT_KEY, get13(innerSchema, CONST_KEY));
1357
+ const innerSchema = get14(aSchema, [PROPERTIES_KEY, selectorField], {});
1358
+ value = get14(innerSchema, DEFAULT_KEY, get14(innerSchema, CONST_KEY));
1359
1359
  label = label || innerSchema?.title || aSchema.title || String(value);
1360
1360
  } else {
1361
1361
  value = toConstant(aSchema);
@@ -1600,7 +1600,7 @@
1600
1600
  const parentConst = retrievedSchema[CONST_KEY];
1601
1601
  const objectDefaults = Object.keys(retrievedSchema.properties || {}).reduce(
1602
1602
  (acc, key) => {
1603
- const propertySchema = get13(retrievedSchema, [PROPERTIES_KEY, key], {});
1603
+ const propertySchema = get14(retrievedSchema, [PROPERTIES_KEY, key], {});
1604
1604
  const hasParentConst = isObject(parentConst) && parentConst[key] !== void 0;
1605
1605
  const hasConst = (isObject(propertySchema) && CONST_KEY in propertySchema || hasParentConst) && experimental_defaultFormStateBehavior?.constAsDefaults !== "never" && !constIsAjvDataReference(propertySchema);
1606
1606
  const computedDefault = computeDefaults(validator, propertySchema, {
@@ -1609,8 +1609,8 @@
1609
1609
  experimental_defaultFormStateBehavior,
1610
1610
  experimental_customMergeAllOf,
1611
1611
  includeUndefinedValues: includeUndefinedValues === true,
1612
- parentDefaults: get13(defaults, [key]),
1613
- rawFormData: get13(formData, [key]),
1612
+ parentDefaults: get14(defaults, [key]),
1613
+ rawFormData: get14(formData, [key]),
1614
1614
  required: retrievedSchema.required?.includes(key),
1615
1615
  shouldMergeDefaultsIntoFormData,
1616
1616
  initialDefaultsGenerated
@@ -1648,8 +1648,8 @@
1648
1648
  experimental_defaultFormStateBehavior,
1649
1649
  experimental_customMergeAllOf,
1650
1650
  includeUndefinedValues: includeUndefinedValues === true,
1651
- parentDefaults: get13(defaults, [key]),
1652
- rawFormData: get13(formData, [key]),
1651
+ parentDefaults: get14(defaults, [key]),
1652
+ rawFormData: get14(formData, [key]),
1653
1653
  required: retrievedSchema.required?.includes(key),
1654
1654
  shouldMergeDefaultsIntoFormData,
1655
1655
  initialDefaultsGenerated
@@ -1714,7 +1714,7 @@
1714
1714
  experimental_defaultFormStateBehavior,
1715
1715
  experimental_customMergeAllOf,
1716
1716
  rawFormData: item,
1717
- parentDefaults: get13(defaults, [idx]),
1717
+ parentDefaults: get14(defaults, [idx]),
1718
1718
  required,
1719
1719
  shouldMergeDefaultsIntoFormData,
1720
1720
  initialDefaultsGenerated
@@ -1837,19 +1837,22 @@
1837
1837
  function getDisplayLabel(validator, schema, uiSchema = {}, rootSchema, globalOptions, experimental_customMergeAllOf) {
1838
1838
  const uiOptions = getUiOptions(uiSchema, globalOptions);
1839
1839
  const { label = true } = uiOptions;
1840
- let displayLabel = !!label;
1841
- const schemaType = getSchemaType(schema);
1842
- if (schemaType === "array") {
1843
- displayLabel = isMultiSelect(validator, schema, rootSchema, experimental_customMergeAllOf) || isFilesArray(validator, schema, uiSchema, rootSchema, experimental_customMergeAllOf) || isCustomWidget(uiSchema);
1844
- }
1845
- if (schemaType === "object") {
1846
- displayLabel = false;
1847
- }
1848
- if (schemaType === "boolean" && uiSchema && !uiSchema[UI_WIDGET_KEY]) {
1849
- displayLabel = false;
1850
- }
1851
- if (uiSchema && uiSchema[UI_FIELD_KEY]) {
1852
- displayLabel = false;
1840
+ let displayLabel = Boolean(label);
1841
+ if (displayLabel) {
1842
+ const schemaType = getSchemaType(schema);
1843
+ const addedByAdditionalProperty = get14(schema, ADDITIONAL_PROPERTY_FLAG, false);
1844
+ if (schemaType === "array") {
1845
+ displayLabel = addedByAdditionalProperty || isMultiSelect(validator, schema, rootSchema, experimental_customMergeAllOf) || isFilesArray(validator, schema, uiSchema, rootSchema, experimental_customMergeAllOf) || isCustomWidget(uiSchema);
1846
+ }
1847
+ if (schemaType === "object") {
1848
+ displayLabel = addedByAdditionalProperty;
1849
+ }
1850
+ if (schemaType === "boolean" && uiSchema && !uiSchema[UI_WIDGET_KEY]) {
1851
+ displayLabel = false;
1852
+ }
1853
+ if (uiSchema && uiSchema[UI_FIELD_KEY]) {
1854
+ displayLabel = false;
1855
+ }
1853
1856
  }
1854
1857
  return displayLabel;
1855
1858
  }
@@ -1859,19 +1862,19 @@
1859
1862
  if (has5(newSchema, PROPERTIES_KEY)) {
1860
1863
  const removeOldSchemaData = {};
1861
1864
  if (has5(oldSchema, PROPERTIES_KEY)) {
1862
- const properties = get13(oldSchema, PROPERTIES_KEY, {});
1865
+ const properties = get14(oldSchema, PROPERTIES_KEY, {});
1863
1866
  Object.keys(properties).forEach((key) => {
1864
1867
  if (has5(data, key)) {
1865
1868
  removeOldSchemaData[key] = void 0;
1866
1869
  }
1867
1870
  });
1868
1871
  }
1869
- const keys2 = Object.keys(get13(newSchema, PROPERTIES_KEY, {}));
1872
+ const keys2 = Object.keys(get14(newSchema, PROPERTIES_KEY, {}));
1870
1873
  const nestedData = {};
1871
1874
  keys2.forEach((key) => {
1872
- const formValue = get13(data, key);
1873
- let oldKeyedSchema = get13(oldSchema, [PROPERTIES_KEY, key], {});
1874
- let newKeyedSchema = get13(newSchema, [PROPERTIES_KEY, key], {});
1875
+ const formValue = get14(data, key);
1876
+ let oldKeyedSchema = get14(oldSchema, [PROPERTIES_KEY, key], {});
1877
+ let newKeyedSchema = get14(newSchema, [PROPERTIES_KEY, key], {});
1875
1878
  if (has5(oldKeyedSchema, REF_KEY)) {
1876
1879
  oldKeyedSchema = retrieveSchema(
1877
1880
  validator,
@@ -1890,8 +1893,8 @@
1890
1893
  experimental_customMergeAllOf
1891
1894
  );
1892
1895
  }
1893
- const oldSchemaTypeForKey = get13(oldKeyedSchema, "type");
1894
- const newSchemaTypeForKey = get13(newKeyedSchema, "type");
1896
+ const oldSchemaTypeForKey = get14(oldKeyedSchema, "type");
1897
+ const newSchemaTypeForKey = get14(newKeyedSchema, "type");
1895
1898
  if (!oldSchemaTypeForKey || oldSchemaTypeForKey === newSchemaTypeForKey) {
1896
1899
  if (has5(removeOldSchemaData, key)) {
1897
1900
  delete removeOldSchemaData[key];
@@ -1909,17 +1912,17 @@
1909
1912
  nestedData[key] = itemData;
1910
1913
  }
1911
1914
  } else {
1912
- const newOptionDefault = get13(newKeyedSchema, "default", NO_VALUE);
1913
- const oldOptionDefault = get13(oldKeyedSchema, "default", NO_VALUE);
1915
+ const newOptionDefault = get14(newKeyedSchema, "default", NO_VALUE);
1916
+ const oldOptionDefault = get14(oldKeyedSchema, "default", NO_VALUE);
1914
1917
  if (newOptionDefault !== NO_VALUE && newOptionDefault !== formValue) {
1915
1918
  if (oldOptionDefault === formValue) {
1916
1919
  removeOldSchemaData[key] = newOptionDefault;
1917
- } else if (get13(newKeyedSchema, "readOnly") === true) {
1920
+ } else if (get14(newKeyedSchema, "readOnly") === true) {
1918
1921
  removeOldSchemaData[key] = void 0;
1919
1922
  }
1920
1923
  }
1921
- const newOptionConst = get13(newKeyedSchema, "const", NO_VALUE);
1922
- const oldOptionConst = get13(oldKeyedSchema, "const", NO_VALUE);
1924
+ const newOptionConst = get14(newKeyedSchema, "const", NO_VALUE);
1925
+ const oldOptionConst = get14(oldKeyedSchema, "const", NO_VALUE);
1923
1926
  if (newOptionConst !== NO_VALUE && newOptionConst !== formValue) {
1924
1927
  removeOldSchemaData[key] = oldOptionConst === formValue ? newOptionConst : void 0;
1925
1928
  }
@@ -1931,9 +1934,9 @@
1931
1934
  ...removeOldSchemaData,
1932
1935
  ...nestedData
1933
1936
  };
1934
- } else if (get13(oldSchema, "type") === "array" && get13(newSchema, "type") === "array" && Array.isArray(data)) {
1935
- let oldSchemaItems = get13(oldSchema, "items");
1936
- let newSchemaItems = get13(newSchema, "items");
1937
+ } else if (get14(oldSchema, "type") === "array" && get14(newSchema, "type") === "array" && Array.isArray(data)) {
1938
+ let oldSchemaItems = get14(oldSchema, "items");
1939
+ let newSchemaItems = get14(newSchema, "items");
1937
1940
  if (typeof oldSchemaItems === "object" && typeof newSchemaItems === "object" && !Array.isArray(oldSchemaItems) && !Array.isArray(newSchemaItems)) {
1938
1941
  if (has5(oldSchemaItems, REF_KEY)) {
1939
1942
  oldSchemaItems = retrieveSchema(
@@ -1953,10 +1956,10 @@
1953
1956
  experimental_customMergeAllOf
1954
1957
  );
1955
1958
  }
1956
- const oldSchemaType = get13(oldSchemaItems, "type");
1957
- const newSchemaType = get13(newSchemaItems, "type");
1959
+ const oldSchemaType = get14(oldSchemaItems, "type");
1960
+ const newSchemaType = get14(newSchemaItems, "type");
1958
1961
  if (!oldSchemaType || oldSchemaType === newSchemaType) {
1959
- const maxItems = get13(newSchema, "maxItems", -1);
1962
+ const maxItems = get14(newSchema, "maxItems", -1);
1960
1963
  if (newSchemaType === "object") {
1961
1964
  newFormData = data.reduce((newValue, aValue) => {
1962
1965
  const itemValue = sanitizeDataForNewSchema(
@@ -2073,7 +2076,7 @@
2073
2076
  }
2074
2077
  } else if (PROPERTIES_KEY in schema) {
2075
2078
  for (const property in schema.properties) {
2076
- const field = get13(schema, [PROPERTIES_KEY, property], {});
2079
+ const field = get14(schema, [PROPERTIES_KEY, property], {});
2077
2080
  pathSchema[property] = toPathSchemaInternal(
2078
2081
  validator,
2079
2082
  field,
@@ -2081,7 +2084,7 @@
2081
2084
  rootSchema,
2082
2085
  // It's possible that formData is not an object -- this can happen if an
2083
2086
  // array item has just been added, but not populated with data yet
2084
- get13(formData, [property]),
2087
+ get14(formData, [property]),
2085
2088
  _recurseList,
2086
2089
  experimental_customMergeAllOf
2087
2090
  );
@@ -2102,7 +2105,7 @@
2102
2105
  */
2103
2106
  constructor(validator, rootSchema, experimental_defaultFormStateBehavior, experimental_customMergeAllOf) {
2104
2107
  if (rootSchema && rootSchema[SCHEMA_KEY] === JSON_SCHEMA_DRAFT_2020_12) {
2105
- this.rootSchema = makeAllReferencesAbsolute(rootSchema, get13(rootSchema, ID_KEY, "#"));
2108
+ this.rootSchema = makeAllReferencesAbsolute(rootSchema, get14(rootSchema, ID_KEY, "#"));
2106
2109
  } else {
2107
2110
  this.rootSchema = rootSchema;
2108
2111
  }
@@ -2536,7 +2539,7 @@
2536
2539
  */
2537
2540
  getOrCreateErrorBlock(pathOfError) {
2538
2541
  const hasPath = Array.isArray(pathOfError) && pathOfError.length > 0 || typeof pathOfError === "string";
2539
- let errorBlock = hasPath ? get13(this.errorSchema, pathOfError) : this.errorSchema;
2542
+ let errorBlock = hasPath ? get14(this.errorSchema, pathOfError) : this.errorSchema;
2540
2543
  if (!errorBlock && pathOfError) {
2541
2544
  errorBlock = {};
2542
2545
  setWith(this.errorSchema, pathOfError, errorBlock, Object);
@@ -2562,7 +2565,7 @@
2562
2565
  */
2563
2566
  addErrors(errorOrList, pathOfError) {
2564
2567
  const errorBlock = this.getOrCreateErrorBlock(pathOfError);
2565
- let errorsList = get13(errorBlock, ERRORS_KEY);
2568
+ let errorsList = get14(errorBlock, ERRORS_KEY);
2566
2569
  if (!Array.isArray(errorsList)) {
2567
2570
  errorsList = [];
2568
2571
  errorBlock[ERRORS_KEY] = errorsList;
@@ -2612,7 +2615,7 @@
2612
2615
  } else if (!aIsPlainObject && bIsPlainObject) {
2613
2616
  return keys(b);
2614
2617
  } else {
2615
- const unequalFields = keys(pickBy(a, (value, key) => !deepEquals(value, get13(b, key))));
2618
+ const unequalFields = keys(pickBy(a, (value, key) => !deepEquals(value, get14(b, key))));
2616
2619
  const diffFields = difference(keys(b), keys(a));
2617
2620
  return [...unequalFields, ...diffFields];
2618
2621
  }
@@ -2725,7 +2728,7 @@
2725
2728
  );
2726
2729
  }
2727
2730
  function getTestIds() {
2728
- if (typeof process === "undefined" || get13(process, "env.NODE_ENV") !== "test") {
2731
+ if (typeof process === "undefined" || get14(process, "env.NODE_ENV") !== "test") {
2729
2732
  return {};
2730
2733
  }
2731
2734
  const ids = /* @__PURE__ */ new Map();
@@ -2794,7 +2797,7 @@
2794
2797
  }
2795
2798
  };
2796
2799
  function mergeWidgetOptions(AWidget) {
2797
- let MergedWidget = get13(AWidget, "MergedWidget");
2800
+ let MergedWidget = get14(AWidget, "MergedWidget");
2798
2801
  if (!MergedWidget) {
2799
2802
  const defaultOptions = AWidget.defaultProps && AWidget.defaultProps.options || {};
2800
2803
  MergedWidget = ({ options, ...props }) => {
@@ -2924,7 +2927,7 @@
2924
2927
  if (has5(regOrFc, FORM_CONTEXT_NAME)) {
2925
2928
  lookupPath.unshift(FORM_CONTEXT_NAME);
2926
2929
  }
2927
- return get13(regOrFc, [...lookupPath, toLookup], fallback);
2930
+ return get14(regOrFc, [...lookupPath, toLookup], fallback);
2928
2931
  }
2929
2932
 
2930
2933
  // src/orderProperties.ts
@@ -3451,7 +3454,7 @@
3451
3454
  * @param hash - The hash value at which to map the schema
3452
3455
  */
3453
3456
  addSchema(schema, hash) {
3454
- const key = get13(schema, ID_KEY, hash);
3457
+ const key = get14(schema, ID_KEY, hash);
3455
3458
  const identifiedSchema = { ...schema, [ID_KEY]: key };
3456
3459
  const existing = this.schemaMap[key];
3457
3460
  if (!existing) {
@@ -1,4 +1,5 @@
1
- import { UI_FIELD_KEY, UI_WIDGET_KEY } from '../constants.js';
1
+ import get from 'lodash-es/get.js';
2
+ import { ADDITIONAL_PROPERTY_FLAG, UI_FIELD_KEY, UI_WIDGET_KEY } from '../constants.js';
2
3
  import getSchemaType from '../getSchemaType.js';
3
4
  import getUiOptions from '../getUiOptions.js';
4
5
  import isCustomWidget from '../isCustomWidget.js';
@@ -18,22 +19,26 @@ import isMultiSelect from './isMultiSelect.js';
18
19
  export default function getDisplayLabel(validator, schema, uiSchema = {}, rootSchema, globalOptions, experimental_customMergeAllOf) {
19
20
  const uiOptions = getUiOptions(uiSchema, globalOptions);
20
21
  const { label = true } = uiOptions;
21
- let displayLabel = !!label;
22
- const schemaType = getSchemaType(schema);
23
- if (schemaType === 'array') {
24
- displayLabel =
25
- isMultiSelect(validator, schema, rootSchema, experimental_customMergeAllOf) ||
26
- isFilesArray(validator, schema, uiSchema, rootSchema, experimental_customMergeAllOf) ||
27
- isCustomWidget(uiSchema);
28
- }
29
- if (schemaType === 'object') {
30
- displayLabel = false;
31
- }
32
- if (schemaType === 'boolean' && uiSchema && !uiSchema[UI_WIDGET_KEY]) {
33
- displayLabel = false;
34
- }
35
- if (uiSchema && uiSchema[UI_FIELD_KEY]) {
36
- displayLabel = false;
22
+ let displayLabel = Boolean(label);
23
+ if (displayLabel) {
24
+ const schemaType = getSchemaType(schema);
25
+ const addedByAdditionalProperty = get(schema, ADDITIONAL_PROPERTY_FLAG, false);
26
+ if (schemaType === 'array') {
27
+ displayLabel =
28
+ addedByAdditionalProperty ||
29
+ isMultiSelect(validator, schema, rootSchema, experimental_customMergeAllOf) ||
30
+ isFilesArray(validator, schema, uiSchema, rootSchema, experimental_customMergeAllOf) ||
31
+ isCustomWidget(uiSchema);
32
+ }
33
+ if (schemaType === 'object') {
34
+ displayLabel = addedByAdditionalProperty;
35
+ }
36
+ if (schemaType === 'boolean' && uiSchema && !uiSchema[UI_WIDGET_KEY]) {
37
+ displayLabel = false;
38
+ }
39
+ if (uiSchema && uiSchema[UI_FIELD_KEY]) {
40
+ displayLabel = false;
41
+ }
37
42
  }
38
43
  return displayLabel;
39
44
  }
@@ -1 +1 @@
1
- {"version":3,"file":"getDisplayLabel.js","sourceRoot":"","sources":["../../src/schema/getDisplayLabel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAC7C,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAC3C,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAU/C,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAE5C;;;;;;;;;;GAUG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAKrC,SAAiC,EACjC,MAAS,EACT,WAA8B,EAAE,EAChC,UAAc,EACd,aAAqC,EACrC,6BAAgE;IAEhE,MAAM,SAAS,GAAG,YAAY,CAAU,QAAQ,EAAE,aAAa,CAAC,CAAC;IACjE,MAAM,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,SAAS,CAAC;IACnC,IAAI,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC;IAC3B,MAAM,UAAU,GAAG,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