@rjsf/core 6.0.0-alpha.0 → 6.0.0-beta.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 (301) hide show
  1. package/dist/core.umd.js +1680 -809
  2. package/dist/index.esm.js +2166 -1198
  3. package/dist/index.esm.js.map +4 -4
  4. package/dist/index.js +2221 -1299
  5. package/dist/index.js.map +4 -4
  6. package/lib/components/Form.d.ts +22 -9
  7. package/lib/components/Form.d.ts.map +1 -0
  8. package/lib/components/Form.js +368 -312
  9. package/lib/components/RichDescription.d.ts +20 -0
  10. package/lib/components/RichDescription.d.ts.map +1 -0
  11. package/lib/components/RichDescription.js +17 -0
  12. package/lib/components/fields/ArrayField.d.ts +20 -9
  13. package/lib/components/fields/ArrayField.d.ts.map +1 -0
  14. package/lib/components/fields/ArrayField.js +212 -206
  15. package/lib/components/fields/BooleanField.d.ts +1 -0
  16. package/lib/components/fields/BooleanField.d.ts.map +1 -0
  17. package/lib/components/fields/BooleanField.js +6 -14
  18. package/lib/components/fields/LayoutGridField.d.ts +480 -0
  19. package/lib/components/fields/LayoutGridField.d.ts.map +1 -0
  20. package/lib/components/fields/LayoutGridField.js +711 -0
  21. package/lib/components/fields/LayoutHeaderField.d.ts +12 -0
  22. package/lib/components/fields/LayoutHeaderField.d.ts.map +1 -0
  23. package/lib/components/fields/LayoutHeaderField.js +23 -0
  24. package/lib/components/fields/LayoutMultiSchemaField.d.ts +28 -0
  25. package/lib/components/fields/LayoutMultiSchemaField.d.ts.map +1 -0
  26. package/lib/components/fields/LayoutMultiSchemaField.js +114 -0
  27. package/lib/components/fields/MultiSchemaField.d.ts +1 -0
  28. package/lib/components/fields/MultiSchemaField.d.ts.map +1 -0
  29. package/lib/components/fields/MultiSchemaField.js +31 -31
  30. package/lib/components/fields/NullField.d.ts +1 -0
  31. package/lib/components/fields/NullField.d.ts.map +1 -0
  32. package/lib/components/fields/NullField.js +0 -1
  33. package/lib/components/fields/NumberField.d.ts +1 -0
  34. package/lib/components/fields/NumberField.d.ts.map +1 -0
  35. package/lib/components/fields/NumberField.js +2 -3
  36. package/lib/components/fields/ObjectField.d.ts +1 -0
  37. package/lib/components/fields/ObjectField.d.ts.map +1 -0
  38. package/lib/components/fields/ObjectField.js +146 -141
  39. package/lib/components/fields/SchemaField.d.ts +1 -0
  40. package/lib/components/fields/SchemaField.d.ts.map +1 -0
  41. package/lib/components/fields/SchemaField.js +10 -20
  42. package/lib/components/fields/StringField.d.ts +1 -0
  43. package/lib/components/fields/StringField.d.ts.map +1 -0
  44. package/lib/components/fields/StringField.js +1 -3
  45. package/lib/components/fields/index.d.ts +1 -0
  46. package/lib/components/fields/index.d.ts.map +1 -0
  47. package/lib/components/fields/index.js +14 -9
  48. package/lib/components/templates/ArrayFieldDescriptionTemplate.d.ts +1 -0
  49. package/lib/components/templates/ArrayFieldDescriptionTemplate.d.ts.map +1 -0
  50. package/lib/components/templates/ArrayFieldDescriptionTemplate.js +0 -1
  51. package/lib/components/templates/ArrayFieldItemButtonsTemplate.d.ts +8 -0
  52. package/lib/components/templates/ArrayFieldItemButtonsTemplate.d.ts.map +1 -0
  53. package/lib/components/templates/ArrayFieldItemButtonsTemplate.js +17 -0
  54. package/lib/components/templates/ArrayFieldItemTemplate.d.ts +4 -3
  55. package/lib/components/templates/ArrayFieldItemTemplate.d.ts.map +1 -0
  56. package/lib/components/templates/ArrayFieldItemTemplate.js +7 -6
  57. package/lib/components/templates/ArrayFieldTemplate.d.ts +2 -1
  58. package/lib/components/templates/ArrayFieldTemplate.d.ts.map +1 -0
  59. package/lib/components/templates/ArrayFieldTemplate.js +3 -4
  60. package/lib/components/templates/ArrayFieldTitleTemplate.d.ts +1 -0
  61. package/lib/components/templates/ArrayFieldTitleTemplate.d.ts.map +1 -0
  62. package/lib/components/templates/ArrayFieldTitleTemplate.js +0 -1
  63. package/lib/components/templates/BaseInputTemplate.d.ts +1 -0
  64. package/lib/components/templates/BaseInputTemplate.d.ts.map +1 -0
  65. package/lib/components/templates/BaseInputTemplate.js +0 -1
  66. package/lib/components/templates/ButtonTemplates/AddButton.d.ts +1 -0
  67. package/lib/components/templates/ButtonTemplates/AddButton.d.ts.map +1 -0
  68. package/lib/components/templates/ButtonTemplates/AddButton.js +1 -2
  69. package/lib/components/templates/ButtonTemplates/IconButton.d.ts +1 -0
  70. package/lib/components/templates/ButtonTemplates/IconButton.d.ts.map +1 -0
  71. package/lib/components/templates/ButtonTemplates/IconButton.js +4 -5
  72. package/lib/components/templates/ButtonTemplates/SubmitButton.d.ts +1 -0
  73. package/lib/components/templates/ButtonTemplates/SubmitButton.d.ts.map +1 -0
  74. package/lib/components/templates/ButtonTemplates/SubmitButton.js +0 -1
  75. package/lib/components/templates/ButtonTemplates/index.d.ts +1 -0
  76. package/lib/components/templates/ButtonTemplates/index.d.ts.map +1 -0
  77. package/lib/components/templates/ButtonTemplates/index.js +3 -4
  78. package/lib/components/templates/DescriptionField.d.ts +1 -0
  79. package/lib/components/templates/DescriptionField.d.ts.map +1 -0
  80. package/lib/components/templates/DescriptionField.js +3 -8
  81. package/lib/components/templates/ErrorList.d.ts +1 -0
  82. package/lib/components/templates/ErrorList.d.ts.map +1 -0
  83. package/lib/components/templates/ErrorList.js +0 -1
  84. package/lib/components/templates/FieldErrorTemplate.d.ts +1 -0
  85. package/lib/components/templates/FieldErrorTemplate.d.ts.map +1 -0
  86. package/lib/components/templates/FieldErrorTemplate.js +0 -1
  87. package/lib/components/templates/FieldHelpTemplate.d.ts +1 -0
  88. package/lib/components/templates/FieldHelpTemplate.d.ts.map +1 -0
  89. package/lib/components/templates/FieldHelpTemplate.js +0 -1
  90. package/lib/components/templates/FieldTemplate/FieldTemplate.d.ts +1 -0
  91. package/lib/components/templates/FieldTemplate/FieldTemplate.d.ts.map +1 -0
  92. package/lib/components/templates/FieldTemplate/FieldTemplate.js +1 -2
  93. package/lib/components/templates/FieldTemplate/Label.d.ts +1 -0
  94. package/lib/components/templates/FieldTemplate/Label.d.ts.map +1 -0
  95. package/lib/components/templates/FieldTemplate/Label.js +0 -1
  96. package/lib/components/templates/FieldTemplate/index.d.ts +2 -1
  97. package/lib/components/templates/FieldTemplate/index.d.ts.map +1 -0
  98. package/lib/components/templates/FieldTemplate/index.js +1 -2
  99. package/lib/components/templates/GridTemplate.d.ts +8 -0
  100. package/lib/components/templates/GridTemplate.d.ts.map +1 -0
  101. package/lib/components/templates/GridTemplate.js +10 -0
  102. package/lib/components/templates/ObjectFieldTemplate.d.ts +1 -0
  103. package/lib/components/templates/ObjectFieldTemplate.d.ts.map +1 -0
  104. package/lib/components/templates/ObjectFieldTemplate.js +2 -3
  105. package/lib/components/templates/TitleField.d.ts +1 -0
  106. package/lib/components/templates/TitleField.d.ts.map +1 -0
  107. package/lib/components/templates/TitleField.js +0 -1
  108. package/lib/components/templates/UnsupportedField.d.ts +1 -0
  109. package/lib/components/templates/UnsupportedField.d.ts.map +1 -0
  110. package/lib/components/templates/UnsupportedField.js +0 -1
  111. package/lib/components/templates/WrapIfAdditionalTemplate.d.ts +1 -0
  112. package/lib/components/templates/WrapIfAdditionalTemplate.d.ts.map +1 -0
  113. package/lib/components/templates/WrapIfAdditionalTemplate.js +10 -6
  114. package/lib/components/templates/index.d.ts +1 -0
  115. package/lib/components/templates/index.d.ts.map +1 -0
  116. package/lib/components/templates/index.js +19 -16
  117. package/lib/components/widgets/AltDateTimeWidget.d.ts +1 -0
  118. package/lib/components/widgets/AltDateTimeWidget.d.ts.map +1 -0
  119. package/lib/components/widgets/AltDateTimeWidget.js +0 -1
  120. package/lib/components/widgets/AltDateWidget.d.ts +1 -0
  121. package/lib/components/widgets/AltDateWidget.d.ts.map +1 -0
  122. package/lib/components/widgets/AltDateWidget.js +0 -1
  123. package/lib/components/widgets/CheckboxWidget.d.ts +1 -0
  124. package/lib/components/widgets/CheckboxWidget.d.ts.map +1 -0
  125. package/lib/components/widgets/CheckboxWidget.js +2 -4
  126. package/lib/components/widgets/CheckboxesWidget.d.ts +1 -0
  127. package/lib/components/widgets/CheckboxesWidget.d.ts.map +1 -0
  128. package/lib/components/widgets/CheckboxesWidget.js +0 -1
  129. package/lib/components/widgets/ColorWidget.d.ts +1 -0
  130. package/lib/components/widgets/ColorWidget.d.ts.map +1 -0
  131. package/lib/components/widgets/ColorWidget.js +0 -1
  132. package/lib/components/widgets/DateTimeWidget.d.ts +1 -0
  133. package/lib/components/widgets/DateTimeWidget.d.ts.map +1 -0
  134. package/lib/components/widgets/DateTimeWidget.js +0 -1
  135. package/lib/components/widgets/DateWidget.d.ts +1 -0
  136. package/lib/components/widgets/DateWidget.d.ts.map +1 -0
  137. package/lib/components/widgets/DateWidget.js +0 -1
  138. package/lib/components/widgets/EmailWidget.d.ts +1 -0
  139. package/lib/components/widgets/EmailWidget.d.ts.map +1 -0
  140. package/lib/components/widgets/EmailWidget.js +0 -1
  141. package/lib/components/widgets/FileWidget.d.ts +1 -0
  142. package/lib/components/widgets/FileWidget.d.ts.map +1 -0
  143. package/lib/components/widgets/FileWidget.js +3 -5
  144. package/lib/components/widgets/HiddenWidget.d.ts +1 -0
  145. package/lib/components/widgets/HiddenWidget.d.ts.map +1 -0
  146. package/lib/components/widgets/HiddenWidget.js +0 -1
  147. package/lib/components/widgets/PasswordWidget.d.ts +1 -0
  148. package/lib/components/widgets/PasswordWidget.d.ts.map +1 -0
  149. package/lib/components/widgets/PasswordWidget.js +0 -1
  150. package/lib/components/widgets/RadioWidget.d.ts +1 -0
  151. package/lib/components/widgets/RadioWidget.d.ts.map +1 -0
  152. package/lib/components/widgets/RadioWidget.js +3 -4
  153. package/lib/components/widgets/RangeWidget.d.ts +1 -0
  154. package/lib/components/widgets/RangeWidget.d.ts.map +1 -0
  155. package/lib/components/widgets/RangeWidget.js +0 -1
  156. package/lib/components/widgets/RatingWidget.d.ts +15 -0
  157. package/lib/components/widgets/RatingWidget.d.ts.map +1 -0
  158. package/lib/components/widgets/RatingWidget.js +63 -0
  159. package/lib/components/widgets/SelectWidget.d.ts +1 -0
  160. package/lib/components/widgets/SelectWidget.d.ts.map +1 -0
  161. package/lib/components/widgets/SelectWidget.js +4 -5
  162. package/lib/components/widgets/TextWidget.d.ts +1 -0
  163. package/lib/components/widgets/TextWidget.d.ts.map +1 -0
  164. package/lib/components/widgets/TextWidget.js +0 -1
  165. package/lib/components/widgets/TextareaWidget.d.ts +1 -0
  166. package/lib/components/widgets/TextareaWidget.d.ts.map +1 -0
  167. package/lib/components/widgets/TextareaWidget.js +0 -1
  168. package/lib/components/widgets/TimeWidget.d.ts +1 -0
  169. package/lib/components/widgets/TimeWidget.d.ts.map +1 -0
  170. package/lib/components/widgets/TimeWidget.js +0 -1
  171. package/lib/components/widgets/URLWidget.d.ts +1 -0
  172. package/lib/components/widgets/URLWidget.d.ts.map +1 -0
  173. package/lib/components/widgets/URLWidget.js +0 -1
  174. package/lib/components/widgets/UpDownWidget.d.ts +1 -0
  175. package/lib/components/widgets/UpDownWidget.d.ts.map +1 -0
  176. package/lib/components/widgets/UpDownWidget.js +0 -1
  177. package/lib/components/widgets/index.d.ts +1 -0
  178. package/lib/components/widgets/index.d.ts.map +1 -0
  179. package/lib/components/widgets/index.js +21 -20
  180. package/lib/getDefaultRegistry.d.ts +1 -0
  181. package/lib/getDefaultRegistry.d.ts.map +1 -0
  182. package/lib/getDefaultRegistry.js +3 -4
  183. package/lib/index.d.ts +7 -5
  184. package/lib/index.d.ts.map +1 -0
  185. package/lib/index.js +5 -5
  186. package/lib/tsconfig.tsbuildinfo +1 -1
  187. package/lib/withTheme.d.ts +2 -1
  188. package/lib/withTheme.d.ts.map +1 -0
  189. package/lib/withTheme.js +7 -8
  190. package/package.json +46 -37
  191. package/src/components/Form.tsx +127 -41
  192. package/src/components/RichDescription.tsx +50 -0
  193. package/src/components/fields/ArrayField.tsx +34 -24
  194. package/src/components/fields/BooleanField.tsx +6 -14
  195. package/src/components/fields/LayoutGridField.tsx +967 -0
  196. package/src/components/fields/LayoutHeaderField.tsx +49 -0
  197. package/src/components/fields/LayoutMultiSchemaField.tsx +228 -0
  198. package/src/components/fields/MultiSchemaField.tsx +9 -4
  199. package/src/components/fields/NullField.tsx +1 -1
  200. package/src/components/fields/NumberField.tsx +5 -5
  201. package/src/components/fields/ObjectField.tsx +32 -24
  202. package/src/components/fields/SchemaField.tsx +17 -30
  203. package/src/components/fields/StringField.tsx +2 -2
  204. package/src/components/fields/index.ts +7 -1
  205. package/src/components/templates/ArrayFieldDescriptionTemplate.tsx +2 -2
  206. package/src/components/templates/ArrayFieldItemButtonsTemplate.tsx +85 -0
  207. package/src/components/templates/ArrayFieldItemTemplate.tsx +18 -57
  208. package/src/components/templates/ArrayFieldTemplate.tsx +10 -8
  209. package/src/components/templates/ArrayFieldTitleTemplate.tsx +2 -2
  210. package/src/components/templates/BaseInputTemplate.tsx +4 -4
  211. package/src/components/templates/ButtonTemplates/IconButton.tsx +9 -36
  212. package/src/components/templates/ButtonTemplates/SubmitButton.tsx +1 -1
  213. package/src/components/templates/ButtonTemplates/index.ts +1 -1
  214. package/src/components/templates/DescriptionField.tsx +9 -15
  215. package/src/components/templates/FieldErrorTemplate.tsx +1 -1
  216. package/src/components/templates/FieldHelpTemplate.tsx +1 -1
  217. package/src/components/templates/FieldTemplate/FieldTemplate.tsx +2 -2
  218. package/src/components/templates/GridTemplate.tsx +15 -0
  219. package/src/components/templates/ObjectFieldTemplate.tsx +5 -3
  220. package/src/components/templates/TitleField.tsx +1 -1
  221. package/src/components/templates/UnsupportedField.tsx +1 -1
  222. package/src/components/templates/WrapIfAdditionalTemplate.tsx +14 -4
  223. package/src/components/templates/index.ts +4 -0
  224. package/src/components/widgets/AltDateWidget.tsx +9 -6
  225. package/src/components/widgets/CheckboxWidget.tsx +5 -5
  226. package/src/components/widgets/CheckboxesWidget.tsx +2 -2
  227. package/src/components/widgets/ColorWidget.tsx +1 -1
  228. package/src/components/widgets/DateTimeWidget.tsx +1 -1
  229. package/src/components/widgets/DateWidget.tsx +1 -1
  230. package/src/components/widgets/EmailWidget.tsx +1 -1
  231. package/src/components/widgets/FileWidget.tsx +5 -5
  232. package/src/components/widgets/PasswordWidget.tsx +1 -1
  233. package/src/components/widgets/RadioWidget.tsx +3 -3
  234. package/src/components/widgets/RangeWidget.tsx +1 -1
  235. package/src/components/widgets/RatingWidget.tsx +129 -0
  236. package/src/components/widgets/SelectWidget.tsx +4 -3
  237. package/src/components/widgets/TextWidget.tsx +1 -1
  238. package/src/components/widgets/TextareaWidget.tsx +3 -3
  239. package/src/components/widgets/TimeWidget.tsx +1 -1
  240. package/src/components/widgets/URLWidget.tsx +1 -1
  241. package/src/components/widgets/UpDownWidget.tsx +1 -1
  242. package/src/components/widgets/index.ts +3 -1
  243. package/src/getDefaultRegistry.ts +1 -1
  244. package/src/index.ts +3 -2
  245. package/src/tsconfig.json +14 -6
  246. package/src/withTheme.tsx +4 -3
  247. package/LICENSE.md +0 -201
  248. package/lib/components/Form.js.map +0 -1
  249. package/lib/components/fields/ArrayField.js.map +0 -1
  250. package/lib/components/fields/BooleanField.js.map +0 -1
  251. package/lib/components/fields/MultiSchemaField.js.map +0 -1
  252. package/lib/components/fields/NullField.js.map +0 -1
  253. package/lib/components/fields/NumberField.js.map +0 -1
  254. package/lib/components/fields/ObjectField.js.map +0 -1
  255. package/lib/components/fields/SchemaField.js.map +0 -1
  256. package/lib/components/fields/StringField.js.map +0 -1
  257. package/lib/components/fields/index.js.map +0 -1
  258. package/lib/components/templates/ArrayFieldDescriptionTemplate.js.map +0 -1
  259. package/lib/components/templates/ArrayFieldItemTemplate.js.map +0 -1
  260. package/lib/components/templates/ArrayFieldTemplate.js.map +0 -1
  261. package/lib/components/templates/ArrayFieldTitleTemplate.js.map +0 -1
  262. package/lib/components/templates/BaseInputTemplate.js.map +0 -1
  263. package/lib/components/templates/ButtonTemplates/AddButton.js.map +0 -1
  264. package/lib/components/templates/ButtonTemplates/IconButton.js.map +0 -1
  265. package/lib/components/templates/ButtonTemplates/SubmitButton.js.map +0 -1
  266. package/lib/components/templates/ButtonTemplates/index.js.map +0 -1
  267. package/lib/components/templates/DescriptionField.js.map +0 -1
  268. package/lib/components/templates/ErrorList.js.map +0 -1
  269. package/lib/components/templates/FieldErrorTemplate.js.map +0 -1
  270. package/lib/components/templates/FieldHelpTemplate.js.map +0 -1
  271. package/lib/components/templates/FieldTemplate/FieldTemplate.js.map +0 -1
  272. package/lib/components/templates/FieldTemplate/Label.js.map +0 -1
  273. package/lib/components/templates/FieldTemplate/index.js.map +0 -1
  274. package/lib/components/templates/ObjectFieldTemplate.js.map +0 -1
  275. package/lib/components/templates/TitleField.js.map +0 -1
  276. package/lib/components/templates/UnsupportedField.js.map +0 -1
  277. package/lib/components/templates/WrapIfAdditionalTemplate.js.map +0 -1
  278. package/lib/components/templates/index.js.map +0 -1
  279. package/lib/components/widgets/AltDateTimeWidget.js.map +0 -1
  280. package/lib/components/widgets/AltDateWidget.js.map +0 -1
  281. package/lib/components/widgets/CheckboxWidget.js.map +0 -1
  282. package/lib/components/widgets/CheckboxesWidget.js.map +0 -1
  283. package/lib/components/widgets/ColorWidget.js.map +0 -1
  284. package/lib/components/widgets/DateTimeWidget.js.map +0 -1
  285. package/lib/components/widgets/DateWidget.js.map +0 -1
  286. package/lib/components/widgets/EmailWidget.js.map +0 -1
  287. package/lib/components/widgets/FileWidget.js.map +0 -1
  288. package/lib/components/widgets/HiddenWidget.js.map +0 -1
  289. package/lib/components/widgets/PasswordWidget.js.map +0 -1
  290. package/lib/components/widgets/RadioWidget.js.map +0 -1
  291. package/lib/components/widgets/RangeWidget.js.map +0 -1
  292. package/lib/components/widgets/SelectWidget.js.map +0 -1
  293. package/lib/components/widgets/TextWidget.js.map +0 -1
  294. package/lib/components/widgets/TextareaWidget.js.map +0 -1
  295. package/lib/components/widgets/TimeWidget.js.map +0 -1
  296. package/lib/components/widgets/URLWidget.js.map +0 -1
  297. package/lib/components/widgets/UpDownWidget.js.map +0 -1
  298. package/lib/components/widgets/index.js.map +0 -1
  299. package/lib/getDefaultRegistry.js.map +0 -1
  300. package/lib/index.js.map +0 -1
  301. package/lib/withTheme.js.map +0 -1
@@ -2,148 +2,22 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Component } from 'react';
3
3
  import { getTemplate, getUiOptions, orderProperties, TranslatableString, ADDITIONAL_PROPERTY_FLAG, PROPERTIES_KEY, REF_KEY, ANY_OF_KEY, ONE_OF_KEY, } from '@rjsf/utils';
4
4
  import Markdown from 'markdown-to-jsx';
5
- import get from 'lodash/get';
6
- import has from 'lodash/has';
7
- import isObject from 'lodash/isObject';
8
- import set from 'lodash/set';
9
- import unset from 'lodash/unset';
5
+ import get from 'lodash-es/get.js';
6
+ import has from 'lodash-es/has.js';
7
+ import isObject from 'lodash-es/isObject.js';
8
+ import set from 'lodash-es/set.js';
9
+ import unset from 'lodash-es/unset.js';
10
10
  /** The `ObjectField` component is used to render a field in the schema that is of type `object`. It tracks whether an
11
11
  * additional property key was modified and what it was modified to
12
12
  *
13
13
  * @param props - The `FieldProps` for this template
14
14
  */
15
15
  class ObjectField extends Component {
16
- constructor() {
17
- super(...arguments);
18
- /** Set up the initial state */
19
- this.state = {
20
- wasPropertyKeyModified: false,
21
- additionalProperties: {},
22
- };
23
- /** Returns the `onPropertyChange` handler for the `name` field. Handles the special case where a user is attempting
24
- * to clear the data for a field added as an additional property. Calls the `onChange()` handler with the updated
25
- * formData.
26
- *
27
- * @param name - The name of the property
28
- * @param addedByAdditionalProperties - Flag indicating whether this property is an additional property
29
- * @returns - The onPropertyChange callback for the `name` property
30
- */
31
- this.onPropertyChange = (name, addedByAdditionalProperties = false) => {
32
- return (value, newErrorSchema, id) => {
33
- const { formData, onChange, errorSchema } = this.props;
34
- if (value === undefined && addedByAdditionalProperties) {
35
- // Don't set value = undefined for fields added by
36
- // additionalProperties. Doing so removes them from the
37
- // formData, which causes them to completely disappear
38
- // (including the input field for the property name). Unlike
39
- // fields which are "mandated" by the schema, these fields can
40
- // be set to undefined by clicking a "delete field" button, so
41
- // set empty values to the empty string.
42
- value = '';
43
- }
44
- const newFormData = { ...formData, [name]: value };
45
- onChange(newFormData, errorSchema &&
46
- errorSchema && {
47
- ...errorSchema,
48
- [name]: newErrorSchema,
49
- }, id);
50
- };
51
- };
52
- /** Returns a callback to handle the onDropPropertyClick event for the given `key` which removes the old `key` data
53
- * and calls the `onChange` callback with it
54
- *
55
- * @param key - The key for which the drop callback is desired
56
- * @returns - The drop property click callback
57
- */
58
- this.onDropPropertyClick = (key) => {
59
- return (event) => {
60
- event.preventDefault();
61
- const { onChange, formData } = this.props;
62
- const copiedFormData = { ...formData };
63
- unset(copiedFormData, key);
64
- onChange(copiedFormData);
65
- };
66
- };
67
- /** Computes the next available key name from the `preferredKey`, indexing through the already existing keys until one
68
- * that is already not assigned is found.
69
- *
70
- * @param preferredKey - The preferred name of a new key
71
- * @param [formData] - The form data in which to check if the desired key already exists
72
- * @returns - The name of the next available key from `preferredKey`
73
- */
74
- this.getAvailableKey = (preferredKey, formData) => {
75
- const { uiSchema, registry } = this.props;
76
- const { duplicateKeySuffixSeparator = '-' } = getUiOptions(uiSchema, registry.globalUiOptions);
77
- let index = 0;
78
- let newKey = preferredKey;
79
- while (has(formData, newKey)) {
80
- newKey = `${preferredKey}${duplicateKeySuffixSeparator}${++index}`;
81
- }
82
- return newKey;
83
- };
84
- /** Returns a callback function that deals with the rename of a key for an additional property for a schema. That
85
- * callback will attempt to rename the key and move the existing data to that key, calling `onChange` when it does.
86
- *
87
- * @param oldValue - The old value of a field
88
- * @returns - The key change callback function
89
- */
90
- this.onKeyChange = (oldValue) => {
91
- return (value, newErrorSchema) => {
92
- if (oldValue === value) {
93
- return;
94
- }
95
- const { formData, onChange, errorSchema } = this.props;
96
- value = this.getAvailableKey(value, formData);
97
- const newFormData = {
98
- ...formData,
99
- };
100
- const newKeys = { [oldValue]: value };
101
- const keyValues = Object.keys(newFormData).map((key) => {
102
- const newKey = newKeys[key] || key;
103
- return { [newKey]: newFormData[key] };
104
- });
105
- const renamedObj = Object.assign({}, ...keyValues);
106
- this.setState({ wasPropertyKeyModified: true });
107
- onChange(renamedObj, errorSchema &&
108
- errorSchema && {
109
- ...errorSchema,
110
- [value]: newErrorSchema,
111
- });
112
- };
113
- };
114
- /** Handles the adding of a new additional property on the given `schema`. Calls the `onChange` callback once the new
115
- * default data for that field has been added to the formData.
116
- *
117
- * @param schema - The schema element to which the new property is being added
118
- */
119
- this.handleAddClick = (schema) => () => {
120
- if (!schema.additionalProperties) {
121
- return;
122
- }
123
- const { formData, onChange, registry } = this.props;
124
- const newFormData = { ...formData };
125
- let type = undefined;
126
- let defaultValue = undefined;
127
- if (isObject(schema.additionalProperties)) {
128
- type = schema.additionalProperties.type;
129
- defaultValue = schema.additionalProperties.default;
130
- let apSchema = schema.additionalProperties;
131
- if (REF_KEY in apSchema) {
132
- const { schemaUtils } = registry;
133
- apSchema = schemaUtils.retrieveSchema({ $ref: apSchema[REF_KEY] }, formData);
134
- type = apSchema.type;
135
- defaultValue = apSchema.default;
136
- }
137
- if (!type && (ANY_OF_KEY in apSchema || ONE_OF_KEY in apSchema)) {
138
- type = 'object';
139
- }
140
- }
141
- const newKey = this.getAvailableKey('newKey', newFormData);
142
- // Cast this to make the `set` work properly
143
- set(newFormData, newKey, defaultValue !== null && defaultValue !== void 0 ? defaultValue : this.getDefaultValue(type));
144
- onChange(newFormData);
145
- };
146
- }
16
+ /** Set up the initial state */
17
+ state = {
18
+ wasPropertyKeyModified: false,
19
+ additionalProperties: {},
20
+ };
147
21
  /** Returns a flag indicating whether the `name` field is required in the object schema
148
22
  *
149
23
  * @param name - The name of the field to check for required-ness
@@ -153,6 +27,97 @@ class ObjectField extends Component {
153
27
  const { schema } = this.props;
154
28
  return Array.isArray(schema.required) && schema.required.indexOf(name) !== -1;
155
29
  }
30
+ /** Returns the `onPropertyChange` handler for the `name` field. Handles the special case where a user is attempting
31
+ * to clear the data for a field added as an additional property. Calls the `onChange()` handler with the updated
32
+ * formData.
33
+ *
34
+ * @param name - The name of the property
35
+ * @param addedByAdditionalProperties - Flag indicating whether this property is an additional property
36
+ * @returns - The onPropertyChange callback for the `name` property
37
+ */
38
+ onPropertyChange = (name, addedByAdditionalProperties = false) => {
39
+ return (value, newErrorSchema, id) => {
40
+ const { formData, onChange, errorSchema } = this.props;
41
+ if (value === undefined && addedByAdditionalProperties) {
42
+ // Don't set value = undefined for fields added by
43
+ // additionalProperties. Doing so removes them from the
44
+ // formData, which causes them to completely disappear
45
+ // (including the input field for the property name). Unlike
46
+ // fields which are "mandated" by the schema, these fields can
47
+ // be set to undefined by clicking a "delete field" button, so
48
+ // set empty values to the empty string.
49
+ value = '';
50
+ }
51
+ const newFormData = { ...formData, [name]: value };
52
+ onChange(newFormData, errorSchema &&
53
+ errorSchema && {
54
+ ...errorSchema,
55
+ [name]: newErrorSchema,
56
+ }, id);
57
+ };
58
+ };
59
+ /** Returns a callback to handle the onDropPropertyClick event for the given `key` which removes the old `key` data
60
+ * and calls the `onChange` callback with it
61
+ *
62
+ * @param key - The key for which the drop callback is desired
63
+ * @returns - The drop property click callback
64
+ */
65
+ onDropPropertyClick = (key) => {
66
+ return (event) => {
67
+ event.preventDefault();
68
+ const { onChange, formData } = this.props;
69
+ const copiedFormData = { ...formData };
70
+ unset(copiedFormData, key);
71
+ onChange(copiedFormData);
72
+ };
73
+ };
74
+ /** Computes the next available key name from the `preferredKey`, indexing through the already existing keys until one
75
+ * that is already not assigned is found.
76
+ *
77
+ * @param preferredKey - The preferred name of a new key
78
+ * @param [formData] - The form data in which to check if the desired key already exists
79
+ * @returns - The name of the next available key from `preferredKey`
80
+ */
81
+ getAvailableKey = (preferredKey, formData) => {
82
+ const { uiSchema, registry } = this.props;
83
+ const { duplicateKeySuffixSeparator = '-' } = getUiOptions(uiSchema, registry.globalUiOptions);
84
+ let index = 0;
85
+ let newKey = preferredKey;
86
+ while (has(formData, newKey)) {
87
+ newKey = `${preferredKey}${duplicateKeySuffixSeparator}${++index}`;
88
+ }
89
+ return newKey;
90
+ };
91
+ /** Returns a callback function that deals with the rename of a key for an additional property for a schema. That
92
+ * callback will attempt to rename the key and move the existing data to that key, calling `onChange` when it does.
93
+ *
94
+ * @param oldValue - The old value of a field
95
+ * @returns - The key change callback function
96
+ */
97
+ onKeyChange = (oldValue) => {
98
+ return (value, newErrorSchema) => {
99
+ if (oldValue === value) {
100
+ return;
101
+ }
102
+ const { formData, onChange, errorSchema } = this.props;
103
+ value = this.getAvailableKey(value, formData);
104
+ const newFormData = {
105
+ ...formData,
106
+ };
107
+ const newKeys = { [oldValue]: value };
108
+ const keyValues = Object.keys(newFormData).map((key) => {
109
+ const newKey = newKeys[key] || key;
110
+ return { [newKey]: newFormData[key] };
111
+ });
112
+ const renamedObj = Object.assign({}, ...keyValues);
113
+ this.setState({ wasPropertyKeyModified: true });
114
+ onChange(renamedObj, errorSchema &&
115
+ errorSchema && {
116
+ ...errorSchema,
117
+ [value]: newErrorSchema,
118
+ });
119
+ };
120
+ };
156
121
  /** Returns a default value to be used for a new additional schema property of the given `type`
157
122
  *
158
123
  * @param type - The type of the new additional schema property
@@ -176,25 +141,66 @@ class ObjectField extends Component {
176
141
  return translateString(TranslatableString.NewStringDefault);
177
142
  }
178
143
  }
144
+ /** Handles the adding of a new additional property on the given `schema`. Calls the `onChange` callback once the new
145
+ * default data for that field has been added to the formData.
146
+ *
147
+ * @param schema - The schema element to which the new property is being added
148
+ */
149
+ handleAddClick = (schema) => () => {
150
+ if (!(schema.additionalProperties || schema.patternProperties)) {
151
+ return;
152
+ }
153
+ const { formData, onChange, registry } = this.props;
154
+ const newFormData = { ...formData };
155
+ const newKey = this.getAvailableKey('newKey', newFormData);
156
+ if (schema.patternProperties) {
157
+ // Cast this to make the `set` work properly
158
+ set(newFormData, newKey, null);
159
+ }
160
+ else {
161
+ let type = undefined;
162
+ let constValue = undefined;
163
+ let defaultValue = undefined;
164
+ if (isObject(schema.additionalProperties)) {
165
+ type = schema.additionalProperties.type;
166
+ constValue = schema.additionalProperties.const;
167
+ defaultValue = schema.additionalProperties.default;
168
+ let apSchema = schema.additionalProperties;
169
+ if (REF_KEY in apSchema) {
170
+ const { schemaUtils } = registry;
171
+ apSchema = schemaUtils.retrieveSchema({ $ref: apSchema[REF_KEY] }, formData);
172
+ type = apSchema.type;
173
+ constValue = apSchema.const;
174
+ defaultValue = apSchema.default;
175
+ }
176
+ if (!type && (ANY_OF_KEY in apSchema || ONE_OF_KEY in apSchema)) {
177
+ type = 'object';
178
+ }
179
+ }
180
+ const newValue = constValue ?? defaultValue ?? this.getDefaultValue(type);
181
+ // Cast this to make the `set` work properly
182
+ set(newFormData, newKey, newValue);
183
+ }
184
+ onChange(newFormData);
185
+ };
179
186
  /** Renders the `ObjectField` from the given props
180
187
  */
181
188
  render() {
182
- var _a, _b, _c, _d;
183
189
  const { schema: rawSchema, uiSchema = {}, formData, errorSchema, idSchema, name, required = false, disabled, readonly, hideError, idPrefix, idSeparator, onBlur, onFocus, registry, title, } = this.props;
184
190
  const { fields, formContext, schemaUtils, translateString, globalUiOptions } = registry;
185
191
  const { SchemaField } = fields;
186
192
  const schema = schemaUtils.retrieveSchema(rawSchema, formData);
187
193
  const uiOptions = getUiOptions(uiSchema, globalUiOptions);
188
194
  const { properties: schemaProperties = {} } = schema;
189
- const templateTitle = (_c = (_b = (_a = uiOptions.title) !== null && _a !== void 0 ? _a : schema.title) !== null && _b !== void 0 ? _b : title) !== null && _c !== void 0 ? _c : name;
190
- const description = (_d = uiOptions.description) !== null && _d !== void 0 ? _d : schema.description;
195
+ const templateTitle = uiOptions.title ?? schema.title ?? title ?? name;
196
+ const description = uiOptions.description ?? schema.description;
191
197
  let orderedProperties;
192
198
  try {
193
199
  const properties = Object.keys(schemaProperties);
194
200
  orderedProperties = orderProperties(properties, uiOptions.order);
195
201
  }
196
202
  catch (err) {
197
- return (_jsxs("div", { children: [_jsx("p", { className: 'config-error', style: { color: 'red' }, children: _jsx(Markdown, { options: { disableParsingRawHTML: true }, children: translateString(TranslatableString.InvalidObjectField, [name || 'root', err.message]) }) }), _jsx("pre", { children: JSON.stringify(schema) })] }));
203
+ return (_jsxs("div", { children: [_jsx("p", { className: 'rjsf-config-error', style: { color: 'red' }, children: _jsx(Markdown, { options: { disableParsingRawHTML: true }, children: translateString(TranslatableString.InvalidObjectField, [name || 'root', err.message]) }) }), _jsx("pre", { children: JSON.stringify(schema) })] }));
198
204
  }
199
205
  const Template = getTemplate('ObjectFieldTemplate', registry, uiOptions);
200
206
  const templateProps = {
@@ -230,4 +236,3 @@ class ObjectField extends Component {
230
236
  }
231
237
  }
232
238
  export default ObjectField;
233
- //# sourceMappingURL=ObjectField.js.map
@@ -8,3 +8,4 @@ declare class SchemaField<T = any, S extends StrictRJSFSchema = RJSFSchema, F ex
8
8
  render(): import("react/jsx-runtime").JSX.Element;
9
9
  }
10
10
  export default SchemaField;
11
+ //# sourceMappingURL=SchemaField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SchemaField.d.ts","sourceRoot":"","sources":["../../../src/components/fields/SchemaField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,SAAS,EAAiB,MAAM,OAAO,CAAC;AAC9D,OAAO,EAKL,UAAU,EAEV,eAAe,EAQf,UAAU,EACV,gBAAgB,EAIjB,MAAM,aAAa,CAAC;AA6TrB;;GAEG;AACH,cAAM,WAAW,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,SAAS,gBAAgB,GAAG,UAAU,EAAE,CAAC,SAAS,eAAe,GAAG,GAAG,CAAE,SAAQ,SAAS,CACpH,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CACpB;IACC,qBAAqB,CAAC,SAAS,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAI9D,MAAM;CAGP;AAED,eAAe,WAAW,CAAC"}
@@ -1,9 +1,8 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useCallback, Component } from 'react';
3
3
  import { ADDITIONAL_PROPERTY_FLAG, deepEquals, descriptionId, getSchemaType, getTemplate, getUiOptions, ID_KEY, mergeObjects, TranslatableString, UI_OPTIONS_KEY, } from '@rjsf/utils';
4
- import isObject from 'lodash/isObject';
5
- import omit from 'lodash/omit';
6
- import Markdown from 'markdown-to-jsx';
4
+ import isObject from 'lodash-es/isObject.js';
5
+ import omit from 'lodash-es/omit.js';
7
6
  /** The map of component type to FieldName */
8
7
  const COMPONENT_TYPES = {
9
8
  array: 'ArrayField',
@@ -59,7 +58,6 @@ function getFieldComponent(schema, uiOptions, idSchema, registry) {
59
58
  * @param props - The `FieldProps` for this component
60
59
  */
61
60
  function SchemaFieldRender(props) {
62
- var _a, _b, _c;
63
61
  const { schema: _schema, idSchema: _idSchema, uiSchema, formData, errorSchema, idPrefix, idSeparator, name, onChange, onKeyChange, onDropPropertyClick, required, registry, wasPropertyKeyModified = false, } = props;
64
62
  const { formContext, schemaUtils, globalUiOptions } = registry;
65
63
  const uiOptions = getUiOptions(uiSchema, globalUiOptions);
@@ -78,12 +76,12 @@ function SchemaFieldRender(props) {
78
76
  return onChange(formData, newErrorSchema, theId);
79
77
  }, [fieldId, onChange]);
80
78
  const FieldComponent = getFieldComponent(schema, uiOptions, idSchema, registry);
81
- const disabled = Boolean((_a = uiOptions.disabled) !== null && _a !== void 0 ? _a : props.disabled);
82
- const readonly = Boolean((_b = uiOptions.readonly) !== null && _b !== void 0 ? _b : (props.readonly || props.schema.readOnly || schema.readOnly));
79
+ const disabled = Boolean(uiOptions.disabled ?? props.disabled);
80
+ const readonly = Boolean(uiOptions.readonly ?? (props.readonly || props.schema.readOnly || schema.readOnly));
83
81
  const uiSchemaHideError = uiOptions.hideError;
84
82
  // Set hideError to the value provided in the uiSchema, otherwise stick with the prop to propagate to children
85
83
  const hideError = uiSchemaHideError === undefined ? props.hideError : Boolean(uiSchemaHideError);
86
- const autofocus = Boolean((_c = uiOptions.autofocus) !== null && _c !== void 0 ? _c : props.autofocus);
84
+ const autofocus = Boolean(uiOptions.autofocus ?? props.autofocus);
87
85
  if (Object.keys(schema).length === 0) {
88
86
  return null;
89
87
  }
@@ -108,18 +106,11 @@ function SchemaFieldRender(props) {
108
106
  : uiOptions.title || props.schema.title || schema.title || props.title || name;
109
107
  }
110
108
  const description = uiOptions.description || props.schema.description || schema.description || '';
111
- const richDescription = uiOptions.enableMarkdownInDescription ? (_jsx(Markdown, { options: { disableParsingRawHTML: true }, children: description })) : (description);
112
109
  const help = uiOptions.help;
113
110
  const hidden = uiOptions.widget === 'hidden';
114
- const classNames = ['form-group', 'field', `field-${getSchemaType(schema)}`];
111
+ const classNames = ['rjsf-field', `rjsf-field-${getSchemaType(schema)}`];
115
112
  if (!hideError && __errors && __errors.length > 0) {
116
- classNames.push('field-error has-error has-danger');
117
- }
118
- if (uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema.classNames) {
119
- if (process.env.NODE_ENV !== 'production') {
120
- console.warn("'uiSchema.classNames' is deprecated and may be removed in a major release; Use 'ui:classNames' instead.");
121
- }
122
- classNames.push(uiSchema.classNames);
113
+ classNames.push('rjsf-field-error');
123
114
  }
124
115
  if (uiOptions.classNames) {
125
116
  classNames.push(uiOptions.classNames);
@@ -131,7 +122,7 @@ function SchemaFieldRender(props) {
131
122
  */
132
123
  const errorsComponent = hideError || ((schema.anyOf || schema.oneOf) && !schemaUtils.isSelect(schema)) ? undefined : (_jsx(FieldErrorTemplate, { errors: __errors, errorSchema: errorSchema, idSchema: idSchema, schema: schema, uiSchema: uiSchema, registry: registry }));
133
124
  const fieldProps = {
134
- description: (_jsx(DescriptionFieldTemplate, { id: descriptionId(id), description: richDescription, schema: schema, uiSchema: uiSchema, registry: registry })),
125
+ description: (_jsx(DescriptionFieldTemplate, { id: descriptionId(id), description: description, schema: schema, uiSchema: uiSchema, registry: registry })),
135
126
  rawDescription: description,
136
127
  help: helpComponent,
137
128
  rawHelp: typeof help === 'string' ? help : undefined,
@@ -158,8 +149,8 @@ function SchemaFieldRender(props) {
158
149
  };
159
150
  const _AnyOfField = registry.fields.AnyOfField;
160
151
  const _OneOfField = registry.fields.OneOfField;
161
- const isReplacingAnyOrOneOf = (uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema['ui:field']) && (uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema['ui:fieldReplacesAnyOrOneOf']) === true;
162
- return (_jsx(FieldTemplate, { ...fieldProps, children: _jsxs(_Fragment, { children: [field, schema.anyOf && !isReplacingAnyOrOneOf && !schemaUtils.isSelect(schema) && (_jsx(_AnyOfField, { name: name, disabled: disabled, readonly: readonly, hideError: hideError, errorSchema: errorSchema, formData: formData, formContext: formContext, idPrefix: idPrefix, idSchema: idSchema, idSeparator: idSeparator, onBlur: props.onBlur, onChange: props.onChange, onFocus: props.onFocus, options: schema.anyOf.map((_schema) => schemaUtils.retrieveSchema(isObject(_schema) ? _schema : {}, formData)), registry: registry, schema: schema, uiSchema: uiSchema })), schema.oneOf && !isReplacingAnyOrOneOf && !schemaUtils.isSelect(schema) && (_jsx(_OneOfField, { name: name, disabled: disabled, readonly: readonly, hideError: hideError, errorSchema: errorSchema, formData: formData, formContext: formContext, idPrefix: idPrefix, idSchema: idSchema, idSeparator: idSeparator, onBlur: props.onBlur, onChange: props.onChange, onFocus: props.onFocus, options: schema.oneOf.map((_schema) => schemaUtils.retrieveSchema(isObject(_schema) ? _schema : {}, formData)), registry: registry, schema: schema, uiSchema: uiSchema }))] }) }));
152
+ const isReplacingAnyOrOneOf = uiSchema?.['ui:field'] && uiSchema?.['ui:fieldReplacesAnyOrOneOf'] === true;
153
+ return (_jsx(FieldTemplate, { ...fieldProps, children: _jsxs(_Fragment, { children: [field, schema.anyOf && !isReplacingAnyOrOneOf && !schemaUtils.isSelect(schema) && (_jsx(_AnyOfField, { name: name, disabled: disabled, readonly: readonly, hideError: hideError, errorSchema: errorSchema, formData: formData, formContext: formContext, idPrefix: idPrefix, idSchema: idSchema, idSeparator: idSeparator, onBlur: props.onBlur, onChange: props.onChange, onFocus: props.onFocus, options: schema.anyOf.map((_schema) => schemaUtils.retrieveSchema(isObject(_schema) ? _schema : {}, formData)), registry: registry, required: required, schema: schema, uiSchema: uiSchema })), schema.oneOf && !isReplacingAnyOrOneOf && !schemaUtils.isSelect(schema) && (_jsx(_OneOfField, { name: name, disabled: disabled, readonly: readonly, hideError: hideError, errorSchema: errorSchema, formData: formData, formContext: formContext, idPrefix: idPrefix, idSchema: idSchema, idSeparator: idSeparator, onBlur: props.onBlur, onChange: props.onChange, onFocus: props.onFocus, options: schema.oneOf.map((_schema) => schemaUtils.retrieveSchema(isObject(_schema) ? _schema : {}, formData)), registry: registry, required: required, schema: schema, uiSchema: uiSchema }))] }) }));
163
154
  }
164
155
  /** The `SchemaField` component determines whether it is necessary to rerender the component based on any props changes
165
156
  * and if so, calls the `SchemaFieldRender` component with the props.
@@ -173,4 +164,3 @@ class SchemaField extends Component {
173
164
  }
174
165
  }
175
166
  export default SchemaField;
176
- //# sourceMappingURL=SchemaField.js.map
@@ -5,3 +5,4 @@ import { FieldProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf
5
5
  */
6
6
  declare function StringField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: FieldProps<T, S, F>): import("react/jsx-runtime").JSX.Element;
7
7
  export default StringField;
8
+ //# sourceMappingURL=StringField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StringField.d.ts","sourceRoot":"","sources":["../../../src/components/fields/StringField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,UAAU,EACV,eAAe,EACf,UAAU,EACV,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAErB;;;GAGG;AACH,iBAAS,WAAW,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,SAAS,gBAAgB,GAAG,UAAU,EAAE,CAAC,SAAS,eAAe,GAAG,GAAG,EACpG,KAAK,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,2CAsD3B;AAED,eAAe,WAAW,CAAC"}
@@ -5,7 +5,6 @@ import { getWidget, getUiOptions, optionsList, hasWidget, } from '@rjsf/utils';
5
5
  * @param props - The `FieldProps` for this template
6
6
  */
7
7
  function StringField(props) {
8
- var _a;
9
8
  const { schema, name, uiSchema, idSchema, formData, required, disabled = false, readonly = false, autofocus = false, onChange, onBlur, onFocus, registry, rawErrors, hideError, } = props;
10
9
  const { title, format } = schema;
11
10
  const { widgets, formContext, schemaUtils, globalUiOptions } = registry;
@@ -16,9 +15,8 @@ function StringField(props) {
16
15
  }
17
16
  const { widget = defaultWidget, placeholder = '', title: uiTitle, ...options } = getUiOptions(uiSchema);
18
17
  const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);
19
- const label = (_a = uiTitle !== null && uiTitle !== void 0 ? uiTitle : title) !== null && _a !== void 0 ? _a : name;
18
+ const label = uiTitle ?? title ?? name;
20
19
  const Widget = getWidget(schema, widget, widgets);
21
20
  return (_jsx(Widget, { options: { ...options, enumOptions }, schema: schema, uiSchema: uiSchema, id: idSchema.$id, name: name, label: label, hideLabel: !displayLabel, hideError: hideError, value: formData, onChange: onChange, onBlur: onBlur, onFocus: onFocus, required: required, disabled: disabled, readonly: readonly, formContext: formContext, autofocus: autofocus, registry: registry, placeholder: placeholder, rawErrors: rawErrors }));
22
21
  }
23
22
  export default StringField;
24
- //# sourceMappingURL=StringField.js.map
@@ -1,3 +1,4 @@
1
1
  import { FormContextType, RegistryFieldsType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
2
2
  declare function fields<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(): RegistryFieldsType<T, S, F>;
3
3
  export default fields;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/fields/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,eAAe,EAAE,kBAAkB,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAcvG,iBAAS,MAAM,CACb,CAAC,GAAG,GAAG,EACP,CAAC,SAAS,gBAAgB,GAAG,UAAU,EACvC,CAAC,SAAS,eAAe,GAAG,GAAG,KAC5B,kBAAkB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAgB/B;AAED,eAAe,MAAM,CAAC"}
@@ -1,17 +1,23 @@
1
- import ArrayField from './ArrayField';
2
- import BooleanField from './BooleanField';
3
- import MultiSchemaField from './MultiSchemaField';
4
- import NumberField from './NumberField';
5
- import ObjectField from './ObjectField';
6
- import SchemaField from './SchemaField';
7
- import StringField from './StringField';
8
- import NullField from './NullField';
1
+ import ArrayField from './ArrayField.js';
2
+ import BooleanField from './BooleanField.js';
3
+ import LayoutGridField from './LayoutGridField.js';
4
+ import LayoutHeaderField from './LayoutHeaderField.js';
5
+ import LayoutMultiSchemaField from './LayoutMultiSchemaField.js';
6
+ import MultiSchemaField from './MultiSchemaField.js';
7
+ import NumberField from './NumberField.js';
8
+ import ObjectField from './ObjectField.js';
9
+ import SchemaField from './SchemaField.js';
10
+ import StringField from './StringField.js';
11
+ import NullField from './NullField.js';
9
12
  function fields() {
10
13
  return {
11
14
  AnyOfField: MultiSchemaField,
12
15
  ArrayField: ArrayField,
13
16
  // ArrayField falls back to SchemaField if ArraySchemaField is not defined, which it isn't by default
14
17
  BooleanField,
18
+ LayoutGridField,
19
+ LayoutHeaderField,
20
+ LayoutMultiSchemaField,
15
21
  NumberField,
16
22
  ObjectField,
17
23
  OneOfField: MultiSchemaField,
@@ -21,4 +27,3 @@ function fields() {
21
27
  };
22
28
  }
23
29
  export default fields;
24
- //# sourceMappingURL=index.js.map
@@ -5,3 +5,4 @@ import { ArrayFieldDescriptionProps, FormContextType, RJSFSchema, StrictRJSFSche
5
5
  * @param props - The `ArrayFieldDescriptionProps` for the component
6
6
  */
7
7
  export default function ArrayFieldDescriptionTemplate<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: ArrayFieldDescriptionProps<T, S, F>): import("react/jsx-runtime").JSX.Element | null;
8
+ //# sourceMappingURL=ArrayFieldDescriptionTemplate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ArrayFieldDescriptionTemplate.d.ts","sourceRoot":"","sources":["../../../src/components/templates/ArrayFieldDescriptionTemplate.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,0BAA0B,EAC1B,eAAe,EACf,UAAU,EACV,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAErB;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,6BAA6B,CACnD,CAAC,GAAG,GAAG,EACP,CAAC,SAAS,gBAAgB,GAAG,UAAU,EACvC,CAAC,SAAS,eAAe,GAAG,GAAG,EAC/B,KAAK,EAAE,0BAA0B,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,kDAqB3C"}
@@ -15,4 +15,3 @@ export default function ArrayFieldDescriptionTemplate(props) {
15
15
  const DescriptionFieldTemplate = getTemplate('DescriptionFieldTemplate', registry, options);
16
16
  return (_jsx(DescriptionFieldTemplate, { id: descriptionId(idSchema), description: description, schema: schema, uiSchema: uiSchema, registry: registry }));
17
17
  }
18
- //# sourceMappingURL=ArrayFieldDescriptionTemplate.js.map
@@ -0,0 +1,8 @@
1
+ import { ArrayFieldItemButtonsTemplateType, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
2
+ /** The `ArrayFieldTemplateItemButtons` component is the template used to render the buttons associate3d with items of
3
+ * an array.
4
+ *
5
+ * @param props - The `ArrayFieldItemButtonsTemplateType` props for the component
6
+ */
7
+ export default function ArrayFieldItemButtonsTemplate<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: ArrayFieldItemButtonsTemplateType<T, S, F>): import("react/jsx-runtime").JSX.Element;
8
+ //# sourceMappingURL=ArrayFieldItemButtonsTemplate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ArrayFieldItemButtonsTemplate.d.ts","sourceRoot":"","sources":["../../../src/components/templates/ArrayFieldItemButtonsTemplate.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,iCAAiC,EAEjC,eAAe,EACf,UAAU,EACV,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAErB;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,6BAA6B,CACnD,CAAC,GAAG,GAAG,EACP,CAAC,SAAS,gBAAgB,GAAG,UAAU,EACvC,CAAC,SAAS,eAAe,GAAG,GAAG,EAC/B,KAAK,EAAE,iCAAiC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,2CAkElD"}
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useMemo } from 'react';
3
+ import { buttonId, } from '@rjsf/utils';
4
+ /** The `ArrayFieldTemplateItemButtons` component is the template used to render the buttons associate3d with items of
5
+ * an array.
6
+ *
7
+ * @param props - The `ArrayFieldItemButtonsTemplateType` props for the component
8
+ */
9
+ export default function ArrayFieldItemButtonsTemplate(props) {
10
+ const { disabled, hasCopy, hasMoveDown, hasMoveUp, hasRemove, idSchema, index, onCopyIndexClick, onDropIndexClick, onReorderClick, readonly, registry, uiSchema, } = props;
11
+ const { CopyButton, MoveDownButton, MoveUpButton, RemoveButton } = registry.templates.ButtonTemplates;
12
+ const onCopyClick = useMemo(() => onCopyIndexClick(index), [index, onCopyIndexClick]);
13
+ const onRemoveClick = useMemo(() => onDropIndexClick(index), [index, onDropIndexClick]);
14
+ const onArrowUpClick = useMemo(() => onReorderClick(index, index - 1), [index, onReorderClick]);
15
+ const onArrowDownClick = useMemo(() => onReorderClick(index, index + 1), [index, onReorderClick]);
16
+ return (_jsxs(_Fragment, { children: [(hasMoveUp || hasMoveDown) && (_jsx(MoveUpButton, { id: buttonId(idSchema, 'moveUp'), className: 'rjsf-array-item-move-up', disabled: disabled || readonly || !hasMoveUp, onClick: onArrowUpClick, uiSchema: uiSchema, registry: registry })), (hasMoveUp || hasMoveDown) && (_jsx(MoveDownButton, { id: buttonId(idSchema, 'moveDown'), className: 'rjsf-array-item-move-down', disabled: disabled || readonly || !hasMoveDown, onClick: onArrowDownClick, uiSchema: uiSchema, registry: registry })), hasCopy && (_jsx(CopyButton, { id: buttonId(idSchema, 'copy'), className: 'rjsf-array-item-copy', disabled: disabled || readonly, onClick: onCopyClick, uiSchema: uiSchema, registry: registry })), hasRemove && (_jsx(RemoveButton, { id: buttonId(idSchema, 'remove'), className: 'rjsf-array-item-remove', disabled: disabled || readonly, onClick: onRemoveClick, uiSchema: uiSchema, registry: registry }))] }));
17
+ }
@@ -1,6 +1,7 @@
1
- import { ArrayFieldTemplateItemType, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
1
+ import { ArrayFieldItemTemplateType, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
2
2
  /** The `ArrayFieldItemTemplate` component is the template used to render an items of an array.
3
3
  *
4
- * @param props - The `ArrayFieldTemplateItemType` props for the component
4
+ * @param props - The `ArrayFieldItemTemplateType` props for the component
5
5
  */
6
- export default function ArrayFieldItemTemplate<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: ArrayFieldTemplateItemType<T, S, F>): import("react/jsx-runtime").JSX.Element;
6
+ export default function ArrayFieldItemTemplate<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: ArrayFieldItemTemplateType<T, S, F>): import("react/jsx-runtime").JSX.Element;
7
+ //# sourceMappingURL=ArrayFieldItemTemplate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ArrayFieldItemTemplate.d.ts","sourceRoot":"","sources":["../../../src/components/templates/ArrayFieldItemTemplate.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,0BAA0B,EAC1B,eAAe,EAGf,UAAU,EACV,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAErB;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAC5C,CAAC,GAAG,GAAG,EACP,CAAC,SAAS,gBAAgB,GAAG,UAAU,EACvC,CAAC,SAAS,eAAe,GAAG,GAAG,EAC/B,KAAK,EAAE,0BAA0B,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,2CAgC3C"}
@@ -1,20 +1,21 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { getTemplate, getUiOptions, } from '@rjsf/utils';
2
3
  /** The `ArrayFieldItemTemplate` component is the template used to render an items of an array.
3
4
  *
4
- * @param props - The `ArrayFieldTemplateItemType` props for the component
5
+ * @param props - The `ArrayFieldItemTemplateType` props for the component
5
6
  */
6
7
  export default function ArrayFieldItemTemplate(props) {
7
- const { children, className, disabled, hasToolbar, hasMoveDown, hasMoveUp, hasRemove, hasCopy, index, onCopyIndexClick, onDropIndexClick, onReorderClick, readonly, registry, uiSchema, } = props;
8
- const { CopyButton, MoveDownButton, MoveUpButton, RemoveButton } = registry.templates.ButtonTemplates;
8
+ const { children, className, buttonsProps, hasToolbar, registry, uiSchema } = props;
9
+ const uiOptions = getUiOptions(uiSchema);
10
+ const ArrayFieldItemButtonsTemplate = getTemplate('ArrayFieldItemButtonsTemplate', registry, uiOptions);
9
11
  const btnStyle = {
10
12
  flex: 1,
11
13
  paddingLeft: 6,
12
14
  paddingRight: 6,
13
15
  fontWeight: 'bold',
14
16
  };
15
- return (_jsxs("div", { className: className, children: [_jsx("div", { className: hasToolbar ? 'col-xs-9' : 'col-xs-12', children: children }), hasToolbar && (_jsx("div", { className: 'col-xs-3 array-item-toolbox', children: _jsxs("div", { className: 'btn-group', style: {
17
+ return (_jsxs("div", { className: className, children: [_jsx("div", { className: hasToolbar ? 'col-xs-9' : 'col-xs-12', children: children }), hasToolbar && (_jsx("div", { className: 'col-xs-3 array-item-toolbox', children: _jsx("div", { className: 'btn-group', style: {
16
18
  display: 'flex',
17
19
  justifyContent: 'space-around',
18
- }, children: [(hasMoveUp || hasMoveDown) && (_jsx(MoveUpButton, { style: btnStyle, disabled: disabled || readonly || !hasMoveUp, onClick: onReorderClick(index, index - 1), uiSchema: uiSchema, registry: registry })), (hasMoveUp || hasMoveDown) && (_jsx(MoveDownButton, { style: btnStyle, disabled: disabled || readonly || !hasMoveDown, onClick: onReorderClick(index, index + 1), uiSchema: uiSchema, registry: registry })), hasCopy && (_jsx(CopyButton, { style: btnStyle, disabled: disabled || readonly, onClick: onCopyIndexClick(index), uiSchema: uiSchema, registry: registry })), hasRemove && (_jsx(RemoveButton, { style: btnStyle, disabled: disabled || readonly, onClick: onDropIndexClick(index), uiSchema: uiSchema, registry: registry }))] }) }))] }));
20
+ }, children: _jsx(ArrayFieldItemButtonsTemplate, { ...buttonsProps, style: btnStyle }) }) }))] }));
19
21
  }
20
- //# sourceMappingURL=ArrayFieldItemTemplate.js.map
@@ -1,6 +1,7 @@
1
1
  import { ArrayFieldTemplateProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
2
2
  /** The `ArrayFieldTemplate` component is the template used to render all items in an array.
3
3
  *
4
- * @param props - The `ArrayFieldTemplateItemType` props for the component
4
+ * @param props - The `ArrayFieldItemTemplateType` props for the component
5
5
  */
6
6
  export default function ArrayFieldTemplate<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: ArrayFieldTemplateProps<T, S, F>): import("react/jsx-runtime").JSX.Element;
7
+ //# sourceMappingURL=ArrayFieldTemplate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ArrayFieldTemplate.d.ts","sourceRoot":"","sources":["../../../src/components/templates/ArrayFieldTemplate.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,uBAAuB,EAEvB,eAAe,EACf,UAAU,EACV,gBAAgB,EAEjB,MAAM,aAAa,CAAC;AAErB;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CACxC,CAAC,GAAG,GAAG,EACP,CAAC,SAAS,gBAAgB,GAAG,UAAU,EACvC,CAAC,SAAS,eAAe,GAAG,GAAG,EAC/B,KAAK,EAAE,uBAAuB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,2CAsExC"}