@rjsf/core 6.6.0 → 6.6.2

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.
Files changed (251) hide show
  1. package/dist/core.umd.js +454 -373
  2. package/dist/index.cjs +416 -334
  3. package/dist/index.cjs.map +3 -3
  4. package/dist/index.esm.js +418 -415
  5. package/dist/index.esm.js.map +3 -3
  6. package/lib/components/Form.d.ts +14 -11
  7. package/lib/components/Form.d.ts.map +1 -1
  8. package/lib/components/Form.js +97 -62
  9. package/lib/components/RichDescription.d.ts +2 -2
  10. package/lib/components/RichDescription.d.ts.map +1 -1
  11. package/lib/components/RichDescription.js +1 -1
  12. package/lib/components/RichHelp.d.ts +2 -2
  13. package/lib/components/RichHelp.d.ts.map +1 -1
  14. package/lib/components/RichHelp.js +1 -1
  15. package/lib/components/SchemaExamples.d.ts +1 -1
  16. package/lib/components/SchemaExamples.d.ts.map +1 -1
  17. package/lib/components/SchemaExamples.js +1 -3
  18. package/lib/components/fields/ArrayField.d.ts +1 -1
  19. package/lib/components/fields/ArrayField.d.ts.map +1 -1
  20. package/lib/components/fields/ArrayField.js +87 -88
  21. package/lib/components/fields/BooleanField.d.ts +1 -1
  22. package/lib/components/fields/BooleanField.d.ts.map +1 -1
  23. package/lib/components/fields/BooleanField.js +2 -5
  24. package/lib/components/fields/FallbackField.d.ts +1 -1
  25. package/lib/components/fields/FallbackField.d.ts.map +1 -1
  26. package/lib/components/fields/FallbackField.js +2 -2
  27. package/lib/components/fields/LayoutGridField.d.ts +7 -9
  28. package/lib/components/fields/LayoutGridField.d.ts.map +1 -1
  29. package/lib/components/fields/LayoutGridField.js +5 -4
  30. package/lib/components/fields/LayoutHeaderField.d.ts +1 -1
  31. package/lib/components/fields/LayoutHeaderField.d.ts.map +1 -1
  32. package/lib/components/fields/LayoutHeaderField.js +1 -1
  33. package/lib/components/fields/LayoutMultiSchemaField.d.ts +1 -1
  34. package/lib/components/fields/LayoutMultiSchemaField.d.ts.map +1 -1
  35. package/lib/components/fields/LayoutMultiSchemaField.js +4 -1
  36. package/lib/components/fields/MultiSchemaField.d.ts +9 -3
  37. package/lib/components/fields/MultiSchemaField.d.ts.map +1 -1
  38. package/lib/components/fields/MultiSchemaField.js +27 -9
  39. package/lib/components/fields/NullField.d.ts +1 -1
  40. package/lib/components/fields/NullField.d.ts.map +1 -1
  41. package/lib/components/fields/NumberField.d.ts +1 -1
  42. package/lib/components/fields/NumberField.d.ts.map +1 -1
  43. package/lib/components/fields/NumberField.js +7 -9
  44. package/lib/components/fields/ObjectField.d.ts +1 -1
  45. package/lib/components/fields/ObjectField.d.ts.map +1 -1
  46. package/lib/components/fields/ObjectField.js +27 -25
  47. package/lib/components/fields/OptionalDataControlsField.d.ts +1 -1
  48. package/lib/components/fields/OptionalDataControlsField.d.ts.map +1 -1
  49. package/lib/components/fields/SchemaField.d.ts +1 -1
  50. package/lib/components/fields/SchemaField.d.ts.map +1 -1
  51. package/lib/components/fields/SchemaField.js +7 -7
  52. package/lib/components/fields/StringField.d.ts +1 -1
  53. package/lib/components/fields/StringField.d.ts.map +1 -1
  54. package/lib/components/fields/StringField.js +2 -5
  55. package/lib/components/fields/index.d.ts +1 -1
  56. package/lib/components/fields/index.d.ts.map +1 -1
  57. package/lib/components/templates/ArrayFieldDescriptionTemplate.d.ts +1 -1
  58. package/lib/components/templates/ArrayFieldDescriptionTemplate.d.ts.map +1 -1
  59. package/lib/components/templates/ArrayFieldDescriptionTemplate.js +1 -1
  60. package/lib/components/templates/ArrayFieldItemButtonsTemplate.d.ts +1 -1
  61. package/lib/components/templates/ArrayFieldItemButtonsTemplate.d.ts.map +1 -1
  62. package/lib/components/templates/ArrayFieldItemButtonsTemplate.js +1 -1
  63. package/lib/components/templates/ArrayFieldItemTemplate.d.ts +1 -1
  64. package/lib/components/templates/ArrayFieldItemTemplate.d.ts.map +1 -1
  65. package/lib/components/templates/ArrayFieldItemTemplate.js +1 -1
  66. package/lib/components/templates/ArrayFieldTemplate.d.ts +1 -1
  67. package/lib/components/templates/ArrayFieldTemplate.d.ts.map +1 -1
  68. package/lib/components/templates/ArrayFieldTemplate.js +1 -1
  69. package/lib/components/templates/ArrayFieldTitleTemplate.d.ts +1 -1
  70. package/lib/components/templates/ArrayFieldTitleTemplate.d.ts.map +1 -1
  71. package/lib/components/templates/ArrayFieldTitleTemplate.js +1 -1
  72. package/lib/components/templates/BaseInputTemplate.d.ts +1 -1
  73. package/lib/components/templates/BaseInputTemplate.d.ts.map +1 -1
  74. package/lib/components/templates/BaseInputTemplate.js +7 -6
  75. package/lib/components/templates/ButtonTemplates/AddButton.d.ts +1 -1
  76. package/lib/components/templates/ButtonTemplates/AddButton.d.ts.map +1 -1
  77. package/lib/components/templates/ButtonTemplates/IconButton.d.ts +14 -7
  78. package/lib/components/templates/ButtonTemplates/IconButton.d.ts.map +1 -1
  79. package/lib/components/templates/ButtonTemplates/IconButton.js +14 -6
  80. package/lib/components/templates/ButtonTemplates/SubmitButton.d.ts +1 -1
  81. package/lib/components/templates/ButtonTemplates/SubmitButton.d.ts.map +1 -1
  82. package/lib/components/templates/ButtonTemplates/index.d.ts +1 -1
  83. package/lib/components/templates/ButtonTemplates/index.d.ts.map +1 -1
  84. package/lib/components/templates/DescriptionField.d.ts +1 -1
  85. package/lib/components/templates/DescriptionField.d.ts.map +1 -1
  86. package/lib/components/templates/ErrorList.d.ts +1 -1
  87. package/lib/components/templates/ErrorList.d.ts.map +1 -1
  88. package/lib/components/templates/ErrorList.js +2 -4
  89. package/lib/components/templates/FallbackFieldTemplate.d.ts +1 -1
  90. package/lib/components/templates/FallbackFieldTemplate.d.ts.map +1 -1
  91. package/lib/components/templates/FieldErrorTemplate.d.ts +1 -1
  92. package/lib/components/templates/FieldErrorTemplate.d.ts.map +1 -1
  93. package/lib/components/templates/FieldErrorTemplate.js +1 -3
  94. package/lib/components/templates/FieldHelpTemplate.d.ts +1 -1
  95. package/lib/components/templates/FieldHelpTemplate.d.ts.map +1 -1
  96. package/lib/components/templates/FieldTemplate/FieldTemplate.d.ts +1 -1
  97. package/lib/components/templates/FieldTemplate/FieldTemplate.d.ts.map +1 -1
  98. package/lib/components/templates/FieldTemplate/FieldTemplate.js +1 -1
  99. package/lib/components/templates/FieldTemplate/Label.d.ts +2 -2
  100. package/lib/components/templates/FieldTemplate/Label.d.ts.map +1 -1
  101. package/lib/components/templates/GridTemplate.d.ts +1 -1
  102. package/lib/components/templates/GridTemplate.d.ts.map +1 -1
  103. package/lib/components/templates/MultiSchemaFieldTemplate.d.ts +1 -1
  104. package/lib/components/templates/MultiSchemaFieldTemplate.d.ts.map +1 -1
  105. package/lib/components/templates/ObjectFieldTemplate.d.ts +1 -1
  106. package/lib/components/templates/ObjectFieldTemplate.d.ts.map +1 -1
  107. package/lib/components/templates/ObjectFieldTemplate.js +1 -1
  108. package/lib/components/templates/OptionalDataControlsTemplate.d.ts +1 -1
  109. package/lib/components/templates/OptionalDataControlsTemplate.d.ts.map +1 -1
  110. package/lib/components/templates/OptionalDataControlsTemplate.js +1 -1
  111. package/lib/components/templates/TitleField.d.ts +1 -1
  112. package/lib/components/templates/TitleField.d.ts.map +1 -1
  113. package/lib/components/templates/UnsupportedField.d.ts +1 -1
  114. package/lib/components/templates/UnsupportedField.d.ts.map +1 -1
  115. package/lib/components/templates/UnsupportedField.js +1 -1
  116. package/lib/components/templates/WrapIfAdditionalTemplate.d.ts +1 -1
  117. package/lib/components/templates/WrapIfAdditionalTemplate.d.ts.map +1 -1
  118. package/lib/components/templates/WrapIfAdditionalTemplate.js +1 -1
  119. package/lib/components/templates/index.d.ts +1 -1
  120. package/lib/components/templates/index.d.ts.map +1 -1
  121. package/lib/components/widgets/AltDateTimeWidget.d.ts +1 -1
  122. package/lib/components/widgets/AltDateTimeWidget.d.ts.map +1 -1
  123. package/lib/components/widgets/AltDateWidget.d.ts +1 -1
  124. package/lib/components/widgets/AltDateWidget.d.ts.map +1 -1
  125. package/lib/components/widgets/AltDateWidget.js +2 -2
  126. package/lib/components/widgets/CheckboxWidget.d.ts +1 -1
  127. package/lib/components/widgets/CheckboxWidget.d.ts.map +1 -1
  128. package/lib/components/widgets/CheckboxesWidget.d.ts +1 -1
  129. package/lib/components/widgets/CheckboxesWidget.d.ts.map +1 -1
  130. package/lib/components/widgets/CheckboxesWidget.js +2 -2
  131. package/lib/components/widgets/ColorWidget.d.ts +1 -1
  132. package/lib/components/widgets/ColorWidget.d.ts.map +1 -1
  133. package/lib/components/widgets/DateTimeWidget.d.ts +1 -1
  134. package/lib/components/widgets/DateTimeWidget.d.ts.map +1 -1
  135. package/lib/components/widgets/DateTimeWidget.js +2 -2
  136. package/lib/components/widgets/DateWidget.d.ts +1 -1
  137. package/lib/components/widgets/DateWidget.d.ts.map +1 -1
  138. package/lib/components/widgets/EmailWidget.d.ts +1 -1
  139. package/lib/components/widgets/EmailWidget.d.ts.map +1 -1
  140. package/lib/components/widgets/FileWidget.d.ts +1 -1
  141. package/lib/components/widgets/FileWidget.d.ts.map +1 -1
  142. package/lib/components/widgets/FileWidget.js +6 -4
  143. package/lib/components/widgets/HiddenWidget.d.ts +1 -1
  144. package/lib/components/widgets/HiddenWidget.d.ts.map +1 -1
  145. package/lib/components/widgets/PasswordWidget.d.ts +1 -1
  146. package/lib/components/widgets/PasswordWidget.d.ts.map +1 -1
  147. package/lib/components/widgets/RadioWidget.d.ts +1 -1
  148. package/lib/components/widgets/RadioWidget.d.ts.map +1 -1
  149. package/lib/components/widgets/RadioWidget.js +2 -2
  150. package/lib/components/widgets/RangeWidget.d.ts +1 -1
  151. package/lib/components/widgets/RangeWidget.d.ts.map +1 -1
  152. package/lib/components/widgets/RatingWidget.d.ts +1 -1
  153. package/lib/components/widgets/RatingWidget.d.ts.map +1 -1
  154. package/lib/components/widgets/RatingWidget.js +15 -15
  155. package/lib/components/widgets/SelectWidget.d.ts +1 -1
  156. package/lib/components/widgets/SelectWidget.d.ts.map +1 -1
  157. package/lib/components/widgets/SelectWidget.js +4 -4
  158. package/lib/components/widgets/TextWidget.d.ts +1 -1
  159. package/lib/components/widgets/TextWidget.d.ts.map +1 -1
  160. package/lib/components/widgets/TextareaWidget.d.ts +1 -1
  161. package/lib/components/widgets/TextareaWidget.d.ts.map +1 -1
  162. package/lib/components/widgets/TextareaWidget.js +2 -2
  163. package/lib/components/widgets/TimeWidget.d.ts +1 -1
  164. package/lib/components/widgets/TimeWidget.d.ts.map +1 -1
  165. package/lib/components/widgets/URLWidget.d.ts +1 -1
  166. package/lib/components/widgets/URLWidget.d.ts.map +1 -1
  167. package/lib/components/widgets/UpDownWidget.d.ts +1 -1
  168. package/lib/components/widgets/UpDownWidget.d.ts.map +1 -1
  169. package/lib/components/widgets/index.d.ts +1 -1
  170. package/lib/components/widgets/index.d.ts.map +1 -1
  171. package/lib/getDefaultRegistry.d.ts +1 -1
  172. package/lib/getDefaultRegistry.d.ts.map +1 -1
  173. package/lib/getDefaultRegistry.js +1 -1
  174. package/lib/getTestRegistry.d.ts +1 -1
  175. package/lib/getTestRegistry.d.ts.map +1 -1
  176. package/lib/getTestRegistry.js +1 -1
  177. package/lib/index.d.ts +10 -5
  178. package/lib/index.d.ts.map +1 -1
  179. package/lib/tsconfig.tsbuildinfo +1 -1
  180. package/lib/withTheme.d.ts +3 -3
  181. package/lib/withTheme.d.ts.map +1 -1
  182. package/lib/withTheme.js +6 -6
  183. package/package.json +6 -7
  184. package/src/components/Form.tsx +164 -97
  185. package/src/components/RichDescription.tsx +3 -10
  186. package/src/components/RichHelp.tsx +3 -10
  187. package/src/components/SchemaExamples.tsx +6 -4
  188. package/src/components/fields/ArrayField.tsx +122 -108
  189. package/src/components/fields/BooleanField.tsx +4 -9
  190. package/src/components/fields/FallbackField.tsx +4 -8
  191. package/src/components/fields/LayoutGridField.tsx +21 -19
  192. package/src/components/fields/LayoutHeaderField.tsx +2 -10
  193. package/src/components/fields/LayoutMultiSchemaField.tsx +15 -10
  194. package/src/components/fields/MultiSchemaField.tsx +29 -16
  195. package/src/components/fields/NullField.tsx +1 -1
  196. package/src/components/fields/NumberField.tsx +8 -10
  197. package/src/components/fields/ObjectField.tsx +48 -39
  198. package/src/components/fields/OptionalDataControlsField.tsx +6 -4
  199. package/src/components/fields/SchemaField.tsx +22 -19
  200. package/src/components/fields/StringField.tsx +4 -15
  201. package/src/components/fields/index.ts +1 -1
  202. package/src/components/templates/ArrayFieldDescriptionTemplate.tsx +2 -9
  203. package/src/components/templates/ArrayFieldItemButtonsTemplate.tsx +2 -7
  204. package/src/components/templates/ArrayFieldItemTemplate.tsx +3 -9
  205. package/src/components/templates/ArrayFieldTemplate.tsx +2 -9
  206. package/src/components/templates/ArrayFieldTitleTemplate.tsx +2 -10
  207. package/src/components/templates/BaseInputTemplate.tsx +15 -19
  208. package/src/components/templates/ButtonTemplates/AddButton.tsx +2 -1
  209. package/src/components/templates/ButtonTemplates/IconButton.tsx +16 -7
  210. package/src/components/templates/ButtonTemplates/SubmitButton.tsx +2 -1
  211. package/src/components/templates/ButtonTemplates/index.ts +1 -1
  212. package/src/components/templates/DescriptionField.tsx +1 -1
  213. package/src/components/templates/ErrorList.tsx +8 -15
  214. package/src/components/templates/FallbackFieldTemplate.tsx +2 -1
  215. package/src/components/templates/FieldErrorTemplate.tsx +8 -8
  216. package/src/components/templates/FieldHelpTemplate.tsx +2 -1
  217. package/src/components/templates/FieldTemplate/FieldTemplate.tsx +2 -8
  218. package/src/components/templates/FieldTemplate/Label.tsx +2 -2
  219. package/src/components/templates/GridTemplate.tsx +1 -1
  220. package/src/components/templates/MultiSchemaFieldTemplate.tsx +1 -1
  221. package/src/components/templates/ObjectFieldTemplate.tsx +2 -7
  222. package/src/components/templates/OptionalDataControlsTemplate.tsx +3 -2
  223. package/src/components/templates/TitleField.tsx +1 -1
  224. package/src/components/templates/UnsupportedField.tsx +3 -2
  225. package/src/components/templates/WrapIfAdditionalTemplate.tsx +2 -9
  226. package/src/components/templates/index.ts +1 -1
  227. package/src/components/widgets/AltDateTimeWidget.tsx +1 -1
  228. package/src/components/widgets/AltDateWidget.tsx +7 -13
  229. package/src/components/widgets/CheckboxWidget.tsx +3 -5
  230. package/src/components/widgets/CheckboxesWidget.tsx +6 -8
  231. package/src/components/widgets/ColorWidget.tsx +2 -1
  232. package/src/components/widgets/DateTimeWidget.tsx +3 -10
  233. package/src/components/widgets/DateWidget.tsx +2 -1
  234. package/src/components/widgets/EmailWidget.tsx +2 -1
  235. package/src/components/widgets/FileWidget.tsx +9 -8
  236. package/src/components/widgets/HiddenWidget.tsx +1 -1
  237. package/src/components/widgets/PasswordWidget.tsx +2 -1
  238. package/src/components/widgets/RadioWidget.tsx +6 -8
  239. package/src/components/widgets/RangeWidget.tsx +1 -1
  240. package/src/components/widgets/RatingWidget.tsx +48 -47
  241. package/src/components/widgets/SelectWidget.tsx +12 -10
  242. package/src/components/widgets/TextWidget.tsx +2 -1
  243. package/src/components/widgets/TextareaWidget.tsx +7 -4
  244. package/src/components/widgets/TimeWidget.tsx +2 -1
  245. package/src/components/widgets/URLWidget.tsx +2 -1
  246. package/src/components/widgets/UpDownWidget.tsx +2 -1
  247. package/src/components/widgets/index.ts +1 -1
  248. package/src/getDefaultRegistry.ts +2 -9
  249. package/src/getTestRegistry.tsx +2 -7
  250. package/src/index.ts +10 -5
  251. package/src/withTheme.tsx +14 -9
@@ -1,10 +1,16 @@
1
- import { ComponentType, ReactNode } from 'react';
2
- import {
3
- ANY_OF_KEY,
1
+ import type { ComponentType, ReactNode } from 'react';
2
+ import type {
4
3
  FieldProps,
5
4
  FieldPathId,
6
5
  FormContextType,
7
6
  GenericObjectType,
7
+ RJSFSchema,
8
+ Registry,
9
+ StrictRJSFSchema,
10
+ UiSchema,
11
+ } from '@rjsf/utils';
12
+ import {
13
+ ANY_OF_KEY,
8
14
  getDiscriminatorFieldFromSchema,
9
15
  getTemplate,
10
16
  getTestIds,
@@ -15,13 +21,9 @@ import {
15
21
  ONE_OF_KEY,
16
22
  PROPERTIES_KEY,
17
23
  READONLY_KEY,
18
- RJSFSchema,
19
- Registry,
20
- StrictRJSFSchema,
21
24
  toFieldPathId,
22
25
  UI_OPTIONS_KEY,
23
26
  UI_GLOBAL_OPTIONS_KEY,
24
- UiSchema,
25
27
  ITEMS_KEY,
26
28
  useDeepCompareMemo,
27
29
  } from '@rjsf/utils';
@@ -73,11 +75,7 @@ export interface GridProps extends GenericObjectType {
73
75
  value?: unknown;
74
76
  }
75
77
 
76
- export type GridSchemaType = {
77
- /** The limited set of props which are keyed using the `GridType` enumeration and return an object
78
- */
79
- [gridType in GridType]?: object;
80
- };
78
+ export type GridSchemaType = Partial<Record<GridType, object>>;
81
79
 
82
80
  /** The types which comprise the possibilities for the `layoutGridSchema` prop
83
81
  */
@@ -106,13 +104,16 @@ export const LAYOUT_GRID_UI_OPTION = 'layoutGrid';
106
104
  export const LAYOUT_GRID_OPTION = `ui:${LAYOUT_GRID_UI_OPTION}`;
107
105
 
108
106
  /** Type used to return options list and whether it has a discriminator */
109
- type OneOfOptionsInfoType<S extends StrictRJSFSchema = RJSFSchema> = { options: S[]; hasDiscriminator: boolean };
107
+ interface OneOfOptionsInfoType<S extends StrictRJSFSchema = RJSFSchema> {
108
+ options: S[];
109
+ hasDiscriminator: boolean;
110
+ }
110
111
 
111
112
  /** Type used to represent a React-based rendering component */
112
113
  type RenderComponent = ComponentType<any>;
113
114
 
114
115
  /** Type used to determine what are the UIComponent and props from the grid schema */
115
- type UIComponentPropsType = {
116
+ interface UIComponentPropsType {
116
117
  /** The name of the component */
117
118
  name: string;
118
119
  /** The render component if specified */
@@ -121,7 +122,7 @@ type UIComponentPropsType = {
121
122
  uiProps: ConfigObject;
122
123
  /** The special case where the component is immediately rendered */
123
124
  rendered: ReactNode;
124
- };
125
+ }
125
126
 
126
127
  /** Returns either the `value` if it is non-nullish or the fallback
127
128
  *
@@ -282,6 +283,7 @@ export function computeArraySchemasIfPresent<S extends StrictRJSFSchema = RJSFSc
282
283
  fieldPathId: FieldPathId;
283
284
  } {
284
285
  let rawSchema: S | undefined;
286
+ let resultPathId = fieldPathId;
285
287
  if (isNumericIndex(potentialIndex) && schema && schema?.type === 'array' && has(schema, ITEMS_KEY)) {
286
288
  const index = Number(potentialIndex);
287
289
  const items = schema[ITEMS_KEY];
@@ -294,12 +296,12 @@ export function computeArraySchemasIfPresent<S extends StrictRJSFSchema = RJSFSc
294
296
  } else {
295
297
  rawSchema = items as S;
296
298
  }
297
- fieldPathId = {
299
+ resultPathId = {
298
300
  [ID_KEY]: fieldPathId[ID_KEY],
299
301
  path: [...fieldPathId.path.slice(0, fieldPathId.path.length - 1), index],
300
302
  };
301
303
  }
302
- return { rawSchema, fieldPathId };
304
+ return { rawSchema, fieldPathId: resultPathId };
303
305
  }
304
306
 
305
307
  /** Given a `dottedPath` to a field in the `initialSchema`, iterate through each individual path in the schema until
@@ -453,8 +455,8 @@ export function computeUIComponentPropsFromGridSchema<
453
455
  if (isString(prop)) {
454
456
  const match: string[] | null = LOOKUP_REGEX.exec(prop);
455
457
  if (Array.isArray(match) && match.length > 1) {
456
- const name = match[1];
457
- uiProps[key] = lookupFromFormContext(registry, name, name);
458
+ const lookupName = match[1];
459
+ uiProps[key] = lookupFromFormContext(registry, lookupName, lookupName);
458
460
  }
459
461
  }
460
462
  });
@@ -1,13 +1,5 @@
1
- import {
2
- getTemplate,
3
- getUiOptions,
4
- titleId,
5
- FieldProps,
6
- FormContextType,
7
- RJSFSchema,
8
- StrictRJSFSchema,
9
- TemplatesType,
10
- } from '@rjsf/utils';
1
+ import type { FieldProps, FormContextType, RJSFSchema, StrictRJSFSchema, TemplatesType } from '@rjsf/utils';
2
+ import { getTemplate, getUiOptions, titleId } from '@rjsf/utils';
11
3
 
12
4
  /** The `LayoutHeaderField` component renders a `TitleFieldTemplate` with an `id` derived from the `fieldPathId`
13
5
  * and whether it is `required` from the props. The `title` is derived from the props as follows:
@@ -1,25 +1,27 @@
1
1
  import { useState, useEffect } from 'react';
2
+ import type {
3
+ EnumOptionsType,
4
+ FieldProps,
5
+ FormContextType,
6
+ RJSFSchema,
7
+ SchemaUtilsType,
8
+ StrictRJSFSchema,
9
+ UiSchema,
10
+ } from '@rjsf/utils';
2
11
  import {
3
12
  ANY_OF_KEY,
4
13
  CONST_KEY,
5
14
  DEFAULT_KEY,
6
- EnumOptionsType,
7
15
  ERRORS_KEY,
8
- FieldProps,
9
- FormContextType,
10
16
  getDiscriminatorFieldFromSchema,
11
17
  hashObject,
12
18
  ID_KEY,
13
19
  ONE_OF_KEY,
14
20
  optionsList,
15
21
  PROPERTIES_KEY,
16
- RJSFSchema,
17
22
  getTemplate,
18
23
  getUiOptions,
19
24
  getWidget,
20
- SchemaUtilsType,
21
- StrictRJSFSchema,
22
- UiSchema,
23
25
  } from '@rjsf/utils';
24
26
  import get from 'lodash/get';
25
27
  import has from 'lodash/has';
@@ -111,7 +113,7 @@ export default function LayoutMultiSchemaField<
111
113
  hideError = false,
112
114
  } = props;
113
115
  const { widgets, schemaUtils, globalUiOptions } = registry;
114
- const [enumOptions, setEnumOptions] = useState(computeEnumOptions(schema, options, schemaUtils, uiSchema, formData)!);
116
+ const [enumOptions, setEnumOptions] = useState(computeEnumOptions(schema, options, schemaUtils, uiSchema, formData));
115
117
  const id = get(fieldPathId, ID_KEY);
116
118
  const discriminator = getDiscriminatorFieldFromSchema(schema);
117
119
  const FieldErrorTemplate = getTemplate<'FieldErrorTemplate', T, S, F>('FieldErrorTemplate', registry, options);
@@ -124,7 +126,7 @@ export default function LayoutMultiSchemaField<
124
126
  useEffect(() => {
125
127
  setEnumOptions(computeEnumOptions(schema, options, schemaUtils, uiSchema, formData));
126
128
  // We are using hashes in place of the dependencies
127
- // eslint-disable-next-line react-hooks/exhaustive-deps
129
+ // oxlint-disable-next-line react-hooks/exhaustive-deps
128
130
  }, [schemaHash, optionsHash, schemaUtils, uiSchemaHash, formDataHash]);
129
131
  const {
130
132
  widget = discriminator ? 'radio' : 'select',
@@ -142,7 +144,7 @@ export default function LayoutMultiSchemaField<
142
144
  const option = getSelectedOption<S>(enumOptions, selectorField, selectedOption);
143
145
  // If the subschema doesn't declare a type, infer the type from the parent schema
144
146
  optionSchema = optionSchema?.type ? optionSchema : ({ ...optionSchema, type: option?.type || baseType } as S);
145
- const Widget = getWidget<T, S, F>(optionSchema!, widget, widgets);
147
+ const Widget = getWidget<T, S, F>(optionSchema, widget, widgets);
146
148
 
147
149
  // The following code was copied from `@rjsf`'s `SchemaField`
148
150
  // Set hideError to the value provided in the uiSchema, otherwise stick with the prop to propagate to children
@@ -159,6 +161,9 @@ export default function LayoutMultiSchemaField<
159
161
  * will use it as the index of the new option to select
160
162
  */
161
163
  const onOptionChange = (opt?: unknown) => {
164
+ if (disabled || readonly) {
165
+ return;
166
+ }
162
167
  const newOption = getSelectedOption<S>(enumOptions, selectorField, opt);
163
168
  const oldOption = getSelectedOption<S>(enumOptions, selectorField, selectedOption);
164
169
 
@@ -1,10 +1,9 @@
1
1
  import { Component } from 'react';
2
+ import type { FieldProps, FormContextType, RJSFSchema, StrictRJSFSchema, UiSchema } from '@rjsf/utils';
2
3
  import {
3
4
  ANY_OF_KEY,
4
5
  deepEquals,
5
6
  ERRORS_KEY,
6
- FieldProps,
7
- FormContextType,
8
7
  getDiscriminatorFieldFromSchema,
9
8
  getTemplate,
10
9
  getUiOptions,
@@ -12,23 +11,20 @@ import {
12
11
  isFormDataAvailable,
13
12
  mergeSchemas,
14
13
  ONE_OF_KEY,
15
- RJSFSchema,
16
14
  shouldRenderOptionalField,
17
- StrictRJSFSchema,
18
15
  TranslatableString,
19
- UiSchema,
20
16
  } from '@rjsf/utils';
21
17
  import get from 'lodash/get';
22
18
  import isEmpty from 'lodash/isEmpty';
23
19
  import omit from 'lodash/omit';
24
20
 
25
21
  /** Type used for the state of the `AnyOfField` component */
26
- type AnyOfFieldState<S extends StrictRJSFSchema = RJSFSchema> = {
22
+ interface AnyOfFieldState<S extends StrictRJSFSchema = RJSFSchema> {
27
23
  /** The currently selected option */
28
24
  selectedOption: number;
29
25
  /** The option schemas after retrieving all $refs */
30
26
  retrievedOptions: S[];
31
- };
27
+ }
32
28
 
33
29
  /** The `AnyOfField` component is used to render a field in the schema that is an `anyOf`, `allOf` or `oneOf`. It tracks
34
30
  * the currently selected option and cleans up any irrelevant data in `formData`.
@@ -39,6 +35,12 @@ class AnyOfField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends For
39
35
  FieldProps<T, S, F>,
40
36
  AnyOfFieldState<S>
41
37
  > {
38
+ /** Flag to skip the formData-change-driven option recalculation when the user just selected an option.
39
+ * Set to true in the setState callback of onOptionChange (after onChange is called), consumed and reset in
40
+ * componentDidUpdate. This prevents the matching-option recalculation from overriding a user's explicit choice
41
+ * when getDefaultFormState populates undefined properties that make deepEquals see a false formData change.
42
+ */
43
+ private skipNextOptionRecalculation = false;
42
44
  /** Constructs an `AnyOfField` with the given `props` to initialize the initially selected option in state
43
45
  *
44
46
  * @param props - The `FieldProps` for this template
@@ -79,14 +81,19 @@ class AnyOfField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends For
79
81
  newState = { selectedOption, retrievedOptions };
80
82
  }
81
83
  if (!deepEquals(formData, prevProps.formData) && fieldPathId.$id === prevProps.fieldPathId.$id) {
82
- const { retrievedOptions } = newState;
83
- const matchingOption = this.getMatchingOption(selectedOption, formData, retrievedOptions);
84
+ if (this.skipNextOptionRecalculation) {
85
+ this.skipNextOptionRecalculation = false;
86
+ } else {
87
+ const { retrievedOptions } = newState;
88
+ const matchingOption = this.getMatchingOption(selectedOption, formData, retrievedOptions);
84
89
 
85
- if (prevState && matchingOption !== selectedOption) {
86
- newState = { selectedOption: matchingOption, retrievedOptions };
90
+ if (prevState && matchingOption !== selectedOption) {
91
+ newState = { selectedOption: matchingOption, retrievedOptions };
92
+ }
87
93
  }
88
94
  }
89
95
  if (newState !== this.state) {
96
+ // oxlint-disable-next-line react/no-did-update-set-state -- guarded to prevent infinite loop
90
97
  this.setState(newState);
91
98
  }
92
99
  }
@@ -116,7 +123,10 @@ class AnyOfField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends For
116
123
  */
117
124
  onOptionChange = (option?: string) => {
118
125
  const { selectedOption, retrievedOptions } = this.state;
119
- const { formData, onChange, registry, fieldPathId } = this.props;
126
+ const { disabled = false, formData, onChange, readonly = false, registry, fieldPathId } = this.props;
127
+ if (disabled || readonly) {
128
+ return;
129
+ }
120
130
  const { schemaUtils } = registry;
121
131
  const intOption = option !== undefined ? parseInt(option, 10) : -1;
122
132
  if (intOption === selectedOption) {
@@ -133,6 +143,7 @@ class AnyOfField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends For
133
143
  }
134
144
 
135
145
  this.setState({ selectedOption: intOption }, () => {
146
+ this.skipNextOptionRecalculation = true;
136
147
  onChange(newFormData, fieldPathId.path, undefined, this.getFieldId());
137
148
  });
138
149
  };
@@ -160,7 +171,7 @@ class AnyOfField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends For
160
171
  } = this.props;
161
172
 
162
173
  const { widgets, fields, translateString, globalUiOptions, schemaUtils } = registry;
163
- const { SchemaField: _SchemaField } = fields;
174
+ const { SchemaField: SchemaFieldComponent } = fields;
164
175
  const MultiSchemaFieldTemplate = getTemplate<'MultiSchemaFieldTemplate', T, S, F>(
165
176
  'MultiSchemaFieldTemplate',
166
177
  registry,
@@ -188,9 +199,9 @@ class AnyOfField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends For
188
199
 
189
200
  if (option) {
190
201
  // merge top level required field
191
- const { required } = schema;
202
+ const { required: schemaRequired } = schema;
192
203
  // Merge in all the non-oneOf/anyOf properties and also skip the special ADDITIONAL_PROPERTY_FLAG property
193
- optionSchema = required ? (mergeSchemas({ required }, option) as S) : option;
204
+ optionSchema = schemaRequired ? (mergeSchemas({ required: schemaRequired }, option) as S) : option;
194
205
  }
195
206
 
196
207
  // First we will check to see if there is an anyOf/oneOf override for the UI schema
@@ -199,12 +210,14 @@ class AnyOfField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends For
199
210
  if (Array.isArray(uiSchema[ONE_OF_KEY])) {
200
211
  optionsUiSchema = uiSchema[ONE_OF_KEY];
201
212
  } else {
213
+ // oxlint-disable-next-line no-console
202
214
  console.warn(`uiSchema.oneOf is not an array for "${title || name}"`);
203
215
  }
204
216
  } else if (ANY_OF_KEY in schema && uiSchema && ANY_OF_KEY in uiSchema) {
205
217
  if (Array.isArray(uiSchema[ANY_OF_KEY])) {
206
218
  optionsUiSchema = uiSchema[ANY_OF_KEY];
207
219
  } else {
220
+ // oxlint-disable-next-line no-console
208
221
  console.warn(`uiSchema.anyOf is not an array for "${title || name}"`);
209
222
  }
210
223
  }
@@ -254,7 +267,7 @@ class AnyOfField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends For
254
267
 
255
268
  const optionsSchemaField =
256
269
  (optionSchema && optionSchema.type !== 'null' && (
257
- <_SchemaField {...this.props} schema={optionSchema} uiSchema={optionUiSchema} />
270
+ <SchemaFieldComponent {...this.props} schema={optionSchema} uiSchema={optionUiSchema} />
258
271
  )) ||
259
272
  null;
260
273
 
@@ -1,5 +1,5 @@
1
1
  import { useEffect } from 'react';
2
- import { FieldProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
2
+ import type { FieldProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
3
3
 
4
4
  /** The `NullField` component is used to render a field in the schema is null. It also ensures that the `formData` is
5
5
  * also set to null if it has no value.
@@ -1,6 +1,5 @@
1
1
  import { useState, useCallback } from 'react';
2
- import {
3
- asNumber,
2
+ import type {
4
3
  ErrorSchema,
5
4
  FieldPathList,
6
5
  FieldProps,
@@ -8,6 +7,7 @@ import {
8
7
  RJSFSchema,
9
8
  StrictRJSFSchema,
10
9
  } from '@rjsf/utils';
10
+ import { asNumber } from '@rjsf/utils';
11
11
 
12
12
  // Matches a string that ends in a . character, optionally followed by a sequence of
13
13
  // digits followed by any number of 0 characters up until the end of the line.
@@ -52,23 +52,21 @@ function NumberField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends
52
52
  * @param value - The current value for the change occurring
53
53
  */
54
54
  const handleChange = useCallback(
55
- (value: FieldProps<T, S, F>['value'], path: FieldPathList, errorSchema?: ErrorSchema<T>, id?: string) => {
55
+ (newValue: FieldProps<T, S, F>['value'], path: FieldPathList, errorSchema?: ErrorSchema<T>, id?: string) => {
56
56
  // Cache the original value in component state
57
- setLastValue(value);
57
+ setLastValue(newValue);
58
58
 
59
59
  // Normalize decimals that don't start with a zero character in advance so
60
60
  // that the rest of the normalization logic is simpler
61
- if (`${value}`.charAt(0) === '.') {
62
- value = `0${value}`;
63
- }
61
+ const normalizedValue = `${newValue}`.startsWith('.') ? `0${newValue}` : newValue;
64
62
 
65
63
  // Check that the value is a string (this can happen if the widget used is a
66
64
  // <select>, due to an enum declaration etc) then, if the value ends in a
67
65
  // trailing decimal point or multiple zeroes, strip the trailing values
68
66
  const processed =
69
- typeof value === 'string' && value.match(trailingCharMatcherWithPrefix)
70
- ? asNumber(value.replace(trailingCharMatcher, ''))
71
- : asNumber(value);
67
+ typeof normalizedValue === 'string' && normalizedValue.match(trailingCharMatcherWithPrefix)
68
+ ? asNumber(normalizedValue.replace(trailingCharMatcher, ''))
69
+ : asNumber(normalizedValue);
72
70
 
73
71
  onChange(processed as unknown as T, path, errorSchema, id);
74
72
  },
@@ -1,4 +1,16 @@
1
- import { FocusEvent, useCallback, useRef, useState } from 'react';
1
+ import type { FocusEvent } from 'react';
2
+ import { memo, useCallback, useMemo, useRef, useState } from 'react';
3
+ import type {
4
+ ErrorSchema,
5
+ FieldPathId,
6
+ FieldPathList,
7
+ FieldProps,
8
+ FormContextType,
9
+ GenericObjectType,
10
+ Registry,
11
+ RJSFSchema,
12
+ StrictRJSFSchema,
13
+ } from '@rjsf/utils';
2
14
  import {
3
15
  ADDITIONAL_PROPERTY_FLAG,
4
16
  ANY_OF_KEY,
@@ -9,25 +21,16 @@ import {
9
21
  shouldRenderOptionalField,
10
22
  toFieldPathId,
11
23
  useDeepCompareMemo,
12
- ErrorSchema,
13
- FieldPathId,
14
- FieldPathList,
15
- FieldProps,
16
- FormContextType,
17
- GenericObjectType,
18
24
  ONE_OF_KEY,
19
25
  PROPERTIES_KEY,
20
26
  REF_KEY,
21
- Registry,
22
- RJSFSchema,
23
- StrictRJSFSchema,
24
27
  TranslatableString,
25
28
  } from '@rjsf/utils';
26
29
  import get from 'lodash/get';
27
30
  import has from 'lodash/has';
28
31
  import isObject from 'lodash/isObject';
29
32
  import set from 'lodash/set';
30
- import { Markdown } from 'markdown-to-jsx';
33
+ import { Markdown } from 'markdown-to-jsx/react';
31
34
 
32
35
  import { ADDITIONAL_PROPERTY_KEY_REMOVE } from '../constants';
33
36
 
@@ -38,7 +41,7 @@ import { ADDITIONAL_PROPERTY_KEY_REMOVE } from '../constants';
38
41
  * @returns - True if the field `name` is required, false otherwise
39
42
  */
40
43
  function isRequired<S extends StrictRJSFSchema = RJSFSchema>(schema: S, name: string) {
41
- return Array.isArray(schema.required) && schema.required.indexOf(name) !== -1;
44
+ return Array.isArray(schema.required) && schema.required.includes(name);
42
45
  }
43
46
 
44
47
  /** Returns a default value to be used for a new additional schema property of the given `type`
@@ -86,7 +89,7 @@ interface ObjectFieldPropertyProps<
86
89
 
87
90
  /** The `ObjectFieldProperty` component is used to render the `SchemaField` for a child property of an object
88
91
  */
89
- function ObjectFieldProperty<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
92
+ function ObjectFieldPropertyFn<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
90
93
  props: ObjectFieldPropertyProps<T, S, F>,
91
94
  ) {
92
95
  const {
@@ -125,14 +128,15 @@ function ObjectFieldProperty<T = any, S extends StrictRJSFSchema = RJSFSchema, F
125
128
  */
126
129
  const onPropertyChange = useCallback(
127
130
  (value: T | undefined, path: FieldPathList, newErrorSchema?: ErrorSchema<T>, id?: string) => {
131
+ // Don't set value = undefined for fields added by additionalProperties. Doing so removes them from the
132
+ // formData, which causes them to completely disappear (including the input field for the property name). Unlike
133
+ // fields which are "mandated" by the schema, these fields can be set to undefined by clicking a "delete field"
134
+ // button, so set empty values to the empty string.
135
+ let normalizedValue = value;
128
136
  if (value === undefined && addedByAdditionalProperties) {
129
- // Don't set value = undefined for fields added by additionalProperties. Doing so removes them from the
130
- // formData, which causes them to completely disappear (including the input field for the property name). Unlike
131
- // fields which are "mandated" by the schema, these fields can be set to undefined by clicking a "delete field"
132
- // button, so set empty values to the empty string.
133
- value = '' as unknown as T;
137
+ normalizedValue = '' as unknown as T;
134
138
  }
135
- onChange(value, path, newErrorSchema, id);
139
+ onChange(normalizedValue, path, newErrorSchema, id);
136
140
  },
137
141
  [onChange, addedByAdditionalProperties],
138
142
  );
@@ -193,6 +197,8 @@ function ObjectFieldProperty<T = any, S extends StrictRJSFSchema = RJSFSchema, F
193
197
  );
194
198
  }
195
199
 
200
+ const ObjectFieldProperty = memo(ObjectFieldPropertyFn) as typeof ObjectFieldPropertyFn;
201
+
196
202
  /** The `ObjectField` component is used to render a field in the schema that is of type `object`. It tracks whether an
197
203
  * additional property key was modified and what it was modified to
198
204
  *
@@ -222,8 +228,11 @@ export default function ObjectField<T = any, S extends StrictRJSFSchema = RJSFSc
222
228
  const { OptionalDataControlsField } = fields;
223
229
  const formDataRef = useRef(formData);
224
230
  formDataRef.current = formData;
225
- const schema: S = schemaUtils.retrieveSchema(rawSchema, formData, true);
226
- const uiOptions = getUiOptions<T, S, F>(uiSchema, globalUiOptions);
231
+ const schema: S = useMemo(
232
+ () => schemaUtils.retrieveSchema(rawSchema, formData, true),
233
+ [schemaUtils, rawSchema, formData],
234
+ );
235
+ const uiOptions = useMemo(() => getUiOptions<T, S, F>(uiSchema, globalUiOptions), [uiSchema, globalUiOptions]);
227
236
  const { properties: schemaProperties = {} } = schema;
228
237
  // All the children will use childFieldPathId if present in the props, falling back to the fieldPathId
229
238
  const childFieldPathId = props.childFieldPathId ?? fieldPathId;
@@ -243,13 +252,14 @@ export default function ObjectField<T = any, S extends StrictRJSFSchema = RJSFSc
243
252
  * @returns - The name of the next available key from `preferredKey`
244
253
  */
245
254
  const getAvailableKey = useCallback(
246
- (preferredKey: string, formData?: T) => {
255
+ (preferredKey: string, existingFormData?: T) => {
247
256
  const { duplicateKeySuffixSeparator = '-' } = getUiOptions<T, S, F>(uiSchema, globalUiOptions);
248
257
 
249
258
  let index = 0;
250
259
  let newKey = preferredKey;
251
- while (has(formData, newKey)) {
252
- newKey = `${preferredKey}${duplicateKeySuffixSeparator}${++index}`;
260
+ while (has(existingFormData, newKey)) {
261
+ index += 1;
262
+ newKey = `${preferredKey}${duplicateKeySuffixSeparator}${index}`;
253
263
  }
254
264
  return newKey;
255
265
  },
@@ -263,7 +273,6 @@ export default function ObjectField<T = any, S extends StrictRJSFSchema = RJSFSc
263
273
  if (!(schema.additionalProperties || schema.patternProperties)) {
264
274
  return;
265
275
  }
266
- const { translateString } = registry;
267
276
  const newFormData = { ...formData } as T;
268
277
  const newKey = getAvailableKey('newKey', newFormData);
269
278
  if (schema.patternProperties) {
@@ -279,7 +288,6 @@ export default function ObjectField<T = any, S extends StrictRJSFSchema = RJSFSc
279
288
  defaultValue = schema.additionalProperties.default;
280
289
  let apSchema = schema.additionalProperties;
281
290
  if (REF_KEY in apSchema) {
282
- const { schemaUtils } = registry;
283
291
  apSchema = schemaUtils.retrieveSchema({ [REF_KEY]: apSchema[REF_KEY] } as S, formData);
284
292
  type = apSchema.type;
285
293
  constValue = apSchema.const;
@@ -300,7 +308,7 @@ export default function ObjectField<T = any, S extends StrictRJSFSchema = RJSFSc
300
308
  lastRenamedProperty.current.previousKey = getAvailableKey(newKey, newFormData);
301
309
  }
302
310
  onChange(newFormData, childFieldPathId.path);
303
- }, [formData, onChange, registry, childFieldPathId, getAvailableKey, schema]);
311
+ }, [formData, onChange, translateString, schemaUtils, childFieldPathId, getAvailableKey, schema]);
304
312
 
305
313
  /** Returns a callback function that deals with the rename of a key for an additional property for a schema. That
306
314
  * callback will attempt to rename the key and move the existing data to that key, calling `onChange` when it does.
@@ -319,8 +327,9 @@ export default function ObjectField<T = any, S extends StrictRJSFSchema = RJSFSc
319
327
  };
320
328
  const newKeys: GenericObjectType = { [oldKey]: actualNewKey };
321
329
  const keyValues = Object.keys(newFormData).map((key) => {
322
- const newKey = newKeys[key] || key;
323
- return { [newKey]: newFormData[key] };
330
+ // `Object.hasOwn` so a falsy rename target (e.g. `""`) isn't dropped.
331
+ const mappedKey = Object.hasOwn(newKeys, key) ? newKeys[key] : key;
332
+ return { [mappedKey]: newFormData[key] };
324
333
  });
325
334
  const renamedObj = Object.assign({}, ...keyValues);
326
335
 
@@ -384,20 +393,20 @@ export default function ObjectField<T = any, S extends StrictRJSFSchema = RJSFSc
384
393
  // getDisplayLabel() always returns false for object types, so just check the `uiOptions.label`
385
394
  title: uiOptions.label === false ? '' : templateTitle,
386
395
  description: uiOptions.label === false ? undefined : description,
387
- properties: orderedProperties.map((name) => {
388
- const addedByAdditionalProperties = has(schema, [PROPERTIES_KEY, name, ADDITIONAL_PROPERTY_FLAG]);
389
- const fieldUiSchema = addedByAdditionalProperties ? uiSchema.additionalProperties : uiSchema[name];
396
+ properties: orderedProperties.map((propertyName) => {
397
+ const addedByAdditionalProperties = has(schema, [PROPERTIES_KEY, propertyName, ADDITIONAL_PROPERTY_FLAG]);
398
+ const fieldUiSchema = addedByAdditionalProperties ? uiSchema.additionalProperties : uiSchema[propertyName];
390
399
  const hidden = getUiOptions<T, S, F>(fieldUiSchema).widget === 'hidden';
391
400
  const content = (
392
401
  <ObjectFieldProperty<T, S, F>
393
- key={getStableKey(name)}
394
- propertyName={name}
395
- required={isRequired<S>(schema, name)}
396
- schema={get(schema, [PROPERTIES_KEY, name], {}) as S}
402
+ key={getStableKey(propertyName)}
403
+ propertyName={propertyName}
404
+ required={isRequired<S>(schema, propertyName)}
405
+ schema={get(schema, [PROPERTIES_KEY, propertyName], {}) as S}
397
406
  uiSchema={fieldUiSchema}
398
- errorSchema={get(errorSchema, [name])}
407
+ errorSchema={get(errorSchema, [propertyName])}
399
408
  fieldPathId={childFieldPathId}
400
- formData={get(formData, [name])}
409
+ formData={get(formData, [propertyName])}
401
410
  handleKeyRename={handleKeyRename}
402
411
  handleRemoveProperty={handleRemoveProperty}
403
412
  addedByAdditionalProperties={addedByAdditionalProperties}
@@ -412,7 +421,7 @@ export default function ObjectField<T = any, S extends StrictRJSFSchema = RJSFSc
412
421
  );
413
422
  return {
414
423
  content,
415
- name,
424
+ name: propertyName,
416
425
  readonly,
417
426
  disabled,
418
427
  required,
@@ -1,14 +1,16 @@
1
- import {
1
+ import type {
2
2
  FieldProps,
3
3
  FormContextType,
4
+ OptionalDataControlsTemplateProps,
5
+ RJSFSchema,
6
+ StrictRJSFSchema,
7
+ } from '@rjsf/utils';
8
+ import {
4
9
  getSchemaType,
5
10
  getTemplate,
6
11
  getUiOptions,
7
12
  isFormDataAvailable,
8
13
  optionalControlsId,
9
- OptionalDataControlsTemplateProps,
10
- RJSFSchema,
11
- StrictRJSFSchema,
12
14
  TranslatableString,
13
15
  } from '@rjsf/utils';
14
16