@rjsf/core 5.11.2 → 5.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core.umd.js +3464 -0
- package/dist/index.esm.js +3814 -0
- package/dist/index.esm.js.map +7 -0
- package/dist/index.js +3714 -5
- package/dist/index.js.map +7 -0
- package/{dist/index.d.ts → lib/components/Form.d.ts} +321 -337
- package/lib/components/Form.js +474 -0
- package/lib/components/Form.js.map +1 -0
- package/lib/components/fields/ArrayField.d.ts +179 -0
- package/lib/components/fields/ArrayField.js +568 -0
- package/lib/components/fields/ArrayField.js.map +1 -0
- package/lib/components/fields/BooleanField.d.ts +9 -0
- package/lib/components/fields/BooleanField.js +62 -0
- package/lib/components/fields/BooleanField.js.map +1 -0
- package/lib/components/fields/MultiSchemaField.d.ts +47 -0
- package/lib/components/fields/MultiSchemaField.js +129 -0
- package/lib/components/fields/MultiSchemaField.js.map +1 -0
- package/lib/components/fields/NullField.d.ts +8 -0
- package/lib/components/fields/NullField.js +17 -0
- package/lib/components/fields/NullField.js.map +1 -0
- package/lib/components/fields/NumberField.d.ts +21 -0
- package/lib/components/fields/NumberField.js +70 -0
- package/lib/components/fields/NumberField.js.map +1 -0
- package/lib/components/fields/ObjectField.d.ts +73 -0
- package/lib/components/fields/ObjectField.js +222 -0
- package/lib/components/fields/ObjectField.js.map +1 -0
- package/lib/components/fields/SchemaField.d.ts +10 -0
- package/lib/components/fields/SchemaField.js +172 -0
- package/lib/components/fields/SchemaField.js.map +1 -0
- package/lib/components/fields/StringField.d.ts +8 -0
- package/lib/components/fields/StringField.js +25 -0
- package/lib/components/fields/StringField.js.map +1 -0
- package/lib/components/fields/index.d.ts +3 -0
- package/lib/components/fields/index.js +24 -0
- package/lib/components/fields/index.js.map +1 -0
- package/lib/components/templates/ArrayFieldDescriptionTemplate.d.ts +8 -0
- package/lib/components/templates/ArrayFieldDescriptionTemplate.js +18 -0
- package/lib/components/templates/ArrayFieldDescriptionTemplate.js.map +1 -0
- package/lib/components/templates/ArrayFieldItemTemplate.d.ts +7 -0
- package/lib/components/templates/ArrayFieldItemTemplate.js +20 -0
- package/lib/components/templates/ArrayFieldItemTemplate.js.map +1 -0
- package/lib/components/templates/ArrayFieldTemplate.d.ts +7 -0
- package/lib/components/templates/ArrayFieldTemplate.js +22 -0
- package/lib/components/templates/ArrayFieldTemplate.js.map +1 -0
- package/lib/components/templates/ArrayFieldTitleTemplate.d.ts +8 -0
- package/lib/components/templates/ArrayFieldTitleTemplate.js +18 -0
- package/lib/components/templates/ArrayFieldTitleTemplate.js.map +1 -0
- package/lib/components/templates/BaseInputTemplate.d.ts +9 -0
- package/lib/components/templates/BaseInputTemplate.js +39 -0
- package/lib/components/templates/BaseInputTemplate.js.map +1 -0
- package/lib/components/templates/ButtonTemplates/AddButton.d.ts +5 -0
- package/lib/components/templates/ButtonTemplates/AddButton.js +10 -0
- package/lib/components/templates/ButtonTemplates/AddButton.js.map +1 -0
- package/lib/components/templates/ButtonTemplates/IconButton.d.ts +7 -0
- package/lib/components/templates/ButtonTemplates/IconButton.js +24 -0
- package/lib/components/templates/ButtonTemplates/IconButton.js.map +1 -0
- package/lib/components/templates/ButtonTemplates/SubmitButton.d.ts +5 -0
- package/lib/components/templates/ButtonTemplates/SubmitButton.js +12 -0
- package/lib/components/templates/ButtonTemplates/SubmitButton.js.map +1 -0
- package/lib/components/templates/ButtonTemplates/index.d.ts +3 -0
- package/lib/components/templates/ButtonTemplates/index.js +15 -0
- package/lib/components/templates/ButtonTemplates/index.js.map +1 -0
- package/lib/components/templates/DescriptionField.d.ts +7 -0
- package/lib/components/templates/DescriptionField.js +18 -0
- package/lib/components/templates/DescriptionField.js.map +1 -0
- package/lib/components/templates/ErrorList.d.ts +7 -0
- package/lib/components/templates/ErrorList.js +13 -0
- package/lib/components/templates/ErrorList.js.map +1 -0
- package/lib/components/templates/FieldErrorTemplate.d.ts +7 -0
- package/lib/components/templates/FieldErrorTemplate.js +19 -0
- package/lib/components/templates/FieldErrorTemplate.js.map +1 -0
- package/lib/components/templates/FieldHelpTemplate.d.ts +7 -0
- package/lib/components/templates/FieldHelpTemplate.js +18 -0
- package/lib/components/templates/FieldHelpTemplate.js.map +1 -0
- package/lib/components/templates/FieldTemplate/FieldTemplate.d.ts +8 -0
- package/lib/components/templates/FieldTemplate/FieldTemplate.js +18 -0
- package/lib/components/templates/FieldTemplate/FieldTemplate.js.map +1 -0
- package/lib/components/templates/FieldTemplate/Label.d.ts +14 -0
- package/lib/components/templates/FieldTemplate/Label.js +14 -0
- package/lib/components/templates/FieldTemplate/Label.js.map +1 -0
- package/lib/components/templates/FieldTemplate/index.d.ts +2 -0
- package/lib/components/templates/FieldTemplate/index.js +3 -0
- package/lib/components/templates/FieldTemplate/index.js.map +1 -0
- package/lib/components/templates/ObjectFieldTemplate.d.ts +9 -0
- package/lib/components/templates/ObjectFieldTemplate.js +18 -0
- package/lib/components/templates/ObjectFieldTemplate.js.map +1 -0
- package/lib/components/templates/TitleField.d.ts +7 -0
- package/lib/components/templates/TitleField.js +11 -0
- package/lib/components/templates/TitleField.js.map +1 -0
- package/lib/components/templates/UnsupportedField.d.ts +9 -0
- package/lib/components/templates/UnsupportedField.js +28 -0
- package/lib/components/templates/UnsupportedField.js.map +1 -0
- package/lib/components/templates/WrapIfAdditionalTemplate.d.ts +8 -0
- package/lib/components/templates/WrapIfAdditionalTemplate.js +21 -0
- package/lib/components/templates/WrapIfAdditionalTemplate.js.map +1 -0
- package/lib/components/templates/index.d.ts +3 -0
- package/lib/components/templates/index.js +36 -0
- package/lib/components/templates/index.js.map +1 -0
- package/lib/components/widgets/AltDateTimeWidget.d.ts +9 -0
- package/lib/components/widgets/AltDateTimeWidget.js +14 -0
- package/lib/components/widgets/AltDateTimeWidget.js.map +1 -0
- package/lib/components/widgets/AltDateWidget.d.ts +7 -0
- package/lib/components/widgets/AltDateWidget.js +77 -0
- package/lib/components/widgets/AltDateWidget.js.map +1 -0
- package/lib/components/widgets/CheckboxWidget.d.ts +9 -0
- package/lib/components/widgets/CheckboxWidget.js +23 -0
- package/lib/components/widgets/CheckboxWidget.js.map +1 -0
- package/lib/components/widgets/CheckboxesWidget.d.ts +9 -0
- package/lib/components/widgets/CheckboxesWidget.js +31 -0
- package/lib/components/widgets/CheckboxesWidget.js.map +1 -0
- package/lib/components/widgets/ColorWidget.d.ts +8 -0
- package/lib/components/widgets/ColorWidget.js +13 -0
- package/lib/components/widgets/ColorWidget.js.map +1 -0
- package/lib/components/widgets/DateTimeWidget.d.ts +8 -0
- package/lib/components/widgets/DateTimeWidget.js +13 -0
- package/lib/components/widgets/DateTimeWidget.js.map +1 -0
- package/lib/components/widgets/DateWidget.d.ts +8 -0
- package/lib/components/widgets/DateWidget.js +15 -0
- package/lib/components/widgets/DateWidget.js.map +1 -0
- package/lib/components/widgets/EmailWidget.d.ts +7 -0
- package/lib/components/widgets/EmailWidget.js +12 -0
- package/lib/components/widgets/EmailWidget.js.map +1 -0
- package/lib/components/widgets/FileWidget.d.ts +8 -0
- package/lib/components/widgets/FileWidget.js +105 -0
- package/lib/components/widgets/FileWidget.js.map +1 -0
- package/lib/components/widgets/HiddenWidget.d.ts +9 -0
- package/lib/components/widgets/HiddenWidget.js +11 -0
- package/lib/components/widgets/HiddenWidget.js.map +1 -0
- package/lib/components/widgets/PasswordWidget.d.ts +7 -0
- package/lib/components/widgets/PasswordWidget.js +12 -0
- package/lib/components/widgets/PasswordWidget.js.map +1 -0
- package/lib/components/widgets/RadioWidget.d.ts +9 -0
- package/lib/components/widgets/RadioWidget.js +24 -0
- package/lib/components/widgets/RadioWidget.js.map +1 -0
- package/lib/components/widgets/RangeWidget.d.ts +8 -0
- package/lib/components/widgets/RangeWidget.js +11 -0
- package/lib/components/widgets/RangeWidget.js.map +1 -0
- package/lib/components/widgets/SelectWidget.d.ts +9 -0
- package/lib/components/widgets/SelectWidget.js +41 -0
- package/lib/components/widgets/SelectWidget.js.map +1 -0
- package/lib/components/widgets/TextWidget.d.ts +7 -0
- package/lib/components/widgets/TextWidget.js +12 -0
- package/lib/components/widgets/TextWidget.js.map +1 -0
- package/lib/components/widgets/TextareaWidget.d.ts +14 -0
- package/lib/components/widgets/TextareaWidget.js +19 -0
- package/lib/components/widgets/TextareaWidget.js.map +1 -0
- package/lib/components/widgets/TimeWidget.d.ts +8 -0
- package/lib/components/widgets/TimeWidget.js +15 -0
- package/lib/components/widgets/TimeWidget.js.map +1 -0
- package/lib/components/widgets/URLWidget.d.ts +7 -0
- package/lib/components/widgets/URLWidget.js +12 -0
- package/lib/components/widgets/URLWidget.js.map +1 -0
- package/lib/components/widgets/UpDownWidget.d.ts +7 -0
- package/lib/components/widgets/UpDownWidget.js +12 -0
- package/lib/components/widgets/UpDownWidget.js.map +1 -0
- package/lib/components/widgets/index.d.ts +3 -0
- package/lib/components/widgets/index.js +44 -0
- package/lib/components/widgets/index.js.map +1 -0
- package/lib/getDefaultRegistry.d.ts +6 -0
- package/lib/getDefaultRegistry.js +19 -0
- package/lib/getDefaultRegistry.js.map +1 -0
- package/lib/index.d.ts +6 -0
- package/lib/index.js +6 -0
- package/lib/index.js.map +1 -0
- package/lib/withTheme.d.ts +9 -0
- package/lib/withTheme.js +16 -0
- package/lib/withTheme.js.map +1 -0
- package/package.json +23 -16
- package/src/components/Form.tsx +853 -0
- package/src/components/fields/ArrayField.tsx +875 -0
- package/src/components/fields/BooleanField.tsx +114 -0
- package/src/components/fields/MultiSchemaField.tsx +221 -0
- package/src/components/fields/NullField.tsx +22 -0
- package/src/components/fields/NumberField.tsx +86 -0
- package/src/components/fields/ObjectField.tsx +331 -0
- package/src/components/fields/SchemaField.tsx +360 -0
- package/src/components/fields/StringField.tsx +71 -0
- package/src/components/fields/index.ts +31 -0
- package/src/components/templates/ArrayFieldDescriptionTemplate.tsx +41 -0
- package/src/components/templates/ArrayFieldItemTemplate.tsx +90 -0
- package/src/components/templates/ArrayFieldTemplate.tsx +88 -0
- package/src/components/templates/ArrayFieldTitleTemplate.tsx +43 -0
- package/src/components/templates/BaseInputTemplate.tsx +102 -0
- package/src/components/templates/ButtonTemplates/AddButton.tsx +29 -0
- package/src/components/templates/ButtonTemplates/IconButton.tsx +77 -0
- package/src/components/templates/ButtonTemplates/SubmitButton.tsx +21 -0
- package/src/components/templates/ButtonTemplates/index.ts +22 -0
- package/src/components/templates/DescriptionField.tsx +29 -0
- package/src/components/templates/ErrorList.tsx +35 -0
- package/src/components/templates/FieldErrorTemplate.tsx +33 -0
- package/src/components/templates/FieldHelpTemplate.tsx +29 -0
- package/src/components/templates/FieldTemplate/FieldTemplate.tsx +41 -0
- package/src/components/templates/FieldTemplate/Label.tsx +27 -0
- package/src/components/templates/FieldTemplate/index.ts +3 -0
- package/src/components/templates/ObjectFieldTemplate.tsx +83 -0
- package/src/components/templates/TitleField.tsx +19 -0
- package/src/components/templates/UnsupportedField.tsx +37 -0
- package/src/components/templates/WrapIfAdditionalTemplate.tsx +80 -0
- package/src/components/templates/index.ts +43 -0
- package/src/components/widgets/AltDateTimeWidget.tsx +16 -0
- package/src/components/widgets/AltDateWidget.tsx +198 -0
- package/src/components/widgets/CheckboxWidget.tsx +92 -0
- package/src/components/widgets/CheckboxesWidget.tsx +92 -0
- package/src/components/widgets/ColorWidget.tsx +14 -0
- package/src/components/widgets/DateTimeWidget.tsx +31 -0
- package/src/components/widgets/DateWidget.tsx +17 -0
- package/src/components/widgets/EmailWidget.tsx +13 -0
- package/src/components/widgets/FileWidget.tsx +178 -0
- package/src/components/widgets/HiddenWidget.tsx +15 -0
- package/src/components/widgets/PasswordWidget.tsx +15 -0
- package/src/components/widgets/RadioWidget.tsx +88 -0
- package/src/components/widgets/RangeWidget.tsx +23 -0
- package/src/components/widgets/SelectWidget.tsx +100 -0
- package/src/components/widgets/TextWidget.tsx +13 -0
- package/src/components/widgets/TextareaWidget.tsx +61 -0
- package/src/components/widgets/TimeWidget.tsx +17 -0
- package/src/components/widgets/URLWidget.tsx +13 -0
- package/src/components/widgets/UpDownWidget.tsx +13 -0
- package/src/components/widgets/index.ts +51 -0
- package/src/getDefaultRegistry.ts +24 -0
- package/src/index.ts +8 -0
- package/src/withTheme.tsx +42 -0
- package/dist/core.cjs.development.js +0 -4403
- package/dist/core.cjs.development.js.map +0 -1
- package/dist/core.cjs.production.min.js +0 -2
- package/dist/core.cjs.production.min.js.map +0 -1
- package/dist/core.esm.js +0 -4383
- package/dist/core.esm.js.map +0 -1
- package/dist/core.umd.development.js +0 -4393
- package/dist/core.umd.development.js.map +0 -1
- package/dist/core.umd.production.min.js +0 -2
- package/dist/core.umd.production.min.js.map +0 -1
|
@@ -1,338 +1,322 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
*
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
*
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
*
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
*
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
*
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
extraErrors
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
*
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
*
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
formData
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
errors
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
*
|
|
224
|
-
*
|
|
225
|
-
*
|
|
226
|
-
* @param
|
|
227
|
-
* @
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
*
|
|
233
|
-
* @param
|
|
234
|
-
* @
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
*
|
|
240
|
-
*
|
|
241
|
-
* @param
|
|
242
|
-
* @param
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
*
|
|
250
|
-
* @param
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
*
|
|
256
|
-
* @param
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
* `
|
|
262
|
-
*
|
|
263
|
-
*
|
|
264
|
-
*
|
|
265
|
-
*
|
|
266
|
-
*
|
|
267
|
-
* @param
|
|
268
|
-
* @param
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
*
|
|
274
|
-
* - Reset
|
|
275
|
-
*
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
*
|
|
281
|
-
*
|
|
282
|
-
* @param
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
*
|
|
288
|
-
*
|
|
289
|
-
* @param
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
*
|
|
295
|
-
* `
|
|
296
|
-
*
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
*
|
|
308
|
-
*
|
|
309
|
-
*
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
*
|
|
315
|
-
*
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
render(): JSX.Element;
|
|
1
|
+
import { Component, ElementType, FormEvent, ReactNode, Ref, RefObject } from 'react';
|
|
2
|
+
import { CustomValidator, ErrorSchema, ErrorTransformer, FormContextType, IdSchema, PathSchema, StrictRJSFSchema, Registry, RegistryFieldsType, RegistryWidgetsType, RJSFSchema, RJSFValidationError, SchemaUtilsType, TemplatesType, UiSchema, ValidationData, ValidatorType, Experimental_DefaultFormStateBehavior } from '@rjsf/utils';
|
|
3
|
+
/** The properties that are passed to the `Form` */
|
|
4
|
+
export interface FormProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> {
|
|
5
|
+
/** The JSON schema object for the form */
|
|
6
|
+
schema: S;
|
|
7
|
+
/** An implementation of the `ValidatorType` interface that is needed for form validation to work */
|
|
8
|
+
validator: ValidatorType<T, S, F>;
|
|
9
|
+
/** The optional children for the form, if provided, it will replace the default `SubmitButton` */
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
/** The uiSchema for the form */
|
|
12
|
+
uiSchema?: UiSchema<T, S, F>;
|
|
13
|
+
/** The data for the form, used to prefill a form with existing data */
|
|
14
|
+
formData?: T;
|
|
15
|
+
/** You can provide a `formContext` object to the form, which is passed down to all fields and widgets. Useful for
|
|
16
|
+
* implementing context aware fields and widgets.
|
|
17
|
+
*
|
|
18
|
+
* NOTE: Setting `{readonlyAsDisabled: false}` on the formContext will make the antd theme treat readOnly fields as
|
|
19
|
+
* disabled.
|
|
20
|
+
*/
|
|
21
|
+
formContext?: F;
|
|
22
|
+
/** To avoid collisions with existing ids in the DOM, it is possible to change the prefix used for ids;
|
|
23
|
+
* Default is `root`
|
|
24
|
+
*/
|
|
25
|
+
idPrefix?: string;
|
|
26
|
+
/** To avoid using a path separator that is present in field names, it is possible to change the separator used for
|
|
27
|
+
* ids (Default is `_`)
|
|
28
|
+
*/
|
|
29
|
+
idSeparator?: string;
|
|
30
|
+
/** It's possible to disable the whole form by setting the `disabled` prop. The `disabled` prop is then forwarded down
|
|
31
|
+
* to each field of the form. If you just want to disable some fields, see the `ui:disabled` parameter in `uiSchema`
|
|
32
|
+
*/
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
/** It's possible to make the whole form read-only by setting the `readonly` prop. The `readonly` prop is then
|
|
35
|
+
* forwarded down to each field of the form. If you just want to make some fields read-only, see the `ui:readonly`
|
|
36
|
+
* parameter in `uiSchema`
|
|
37
|
+
*/
|
|
38
|
+
readonly?: boolean;
|
|
39
|
+
/** The dictionary of registered fields in the form */
|
|
40
|
+
fields?: RegistryFieldsType<T, S, F>;
|
|
41
|
+
/** The dictionary of registered templates in the form; Partial allows a subset to be provided beyond the defaults */
|
|
42
|
+
templates?: Partial<Omit<TemplatesType<T, S, F>, 'ButtonTemplates'>> & {
|
|
43
|
+
ButtonTemplates?: Partial<TemplatesType<T, S, F>['ButtonTemplates']>;
|
|
44
|
+
};
|
|
45
|
+
/** The dictionary of registered widgets in the form */
|
|
46
|
+
widgets?: RegistryWidgetsType<T, S, F>;
|
|
47
|
+
/** If you plan on being notified every time the form data are updated, you can pass an `onChange` handler, which will
|
|
48
|
+
* receive the same args as `onSubmit` any time a value is updated in the form. Can also return the `id` of the field
|
|
49
|
+
* that caused the change
|
|
50
|
+
*/
|
|
51
|
+
onChange?: (data: IChangeEvent<T, S, F>, id?: string) => void;
|
|
52
|
+
/** To react when submitted form data are invalid, pass an `onError` handler. It will be passed the list of
|
|
53
|
+
* encountered errors
|
|
54
|
+
*/
|
|
55
|
+
onError?: (errors: RJSFValidationError[]) => void;
|
|
56
|
+
/** You can pass a function as the `onSubmit` prop of your `Form` component to listen to when the form is submitted
|
|
57
|
+
* and its data are valid. It will be passed a result object having a `formData` attribute, which is the valid form
|
|
58
|
+
* data you're usually after. The original event will also be passed as a second parameter
|
|
59
|
+
*/
|
|
60
|
+
onSubmit?: (data: IChangeEvent<T, S, F>, event: FormEvent<any>) => void;
|
|
61
|
+
/** Sometimes you may want to trigger events or modify external state when a field has been touched, so you can pass
|
|
62
|
+
* an `onBlur` handler, which will receive the id of the input that was blurred and the field value
|
|
63
|
+
*/
|
|
64
|
+
onBlur?: (id: string, data: any) => void;
|
|
65
|
+
/** Sometimes you may want to trigger events or modify external state when a field has been focused, so you can pass
|
|
66
|
+
* an `onFocus` handler, which will receive the id of the input that is focused and the field value
|
|
67
|
+
*/
|
|
68
|
+
onFocus?: (id: string, data: any) => void;
|
|
69
|
+
/** The value of this prop will be passed to the `accept-charset` HTML attribute on the form */
|
|
70
|
+
acceptcharset?: string;
|
|
71
|
+
/** The value of this prop will be passed to the `action` HTML attribute on the form
|
|
72
|
+
*
|
|
73
|
+
* NOTE: this just renders the `action` attribute in the HTML markup. There is no real network request being sent to
|
|
74
|
+
* this `action` on submit. Instead, react-jsonschema-form catches the submit event with `event.preventDefault()`
|
|
75
|
+
* and then calls the `onSubmit` function, where you could send a request programmatically with `fetch` or similar.
|
|
76
|
+
*/
|
|
77
|
+
action?: string;
|
|
78
|
+
/** The value of this prop will be passed to the `autocomplete` HTML attribute on the form */
|
|
79
|
+
autoComplete?: string;
|
|
80
|
+
/** The value of this prop will be passed to the `class` HTML attribute on the form */
|
|
81
|
+
className?: string;
|
|
82
|
+
/** The value of this prop will be passed to the `enctype` HTML attribute on the form */
|
|
83
|
+
enctype?: string;
|
|
84
|
+
/** The value of this prop will be passed to the `id` HTML attribute on the form */
|
|
85
|
+
id?: string;
|
|
86
|
+
/** The value of this prop will be passed to the `name` HTML attribute on the form */
|
|
87
|
+
name?: string;
|
|
88
|
+
/** The value of this prop will be passed to the `method` HTML attribute on the form */
|
|
89
|
+
method?: string;
|
|
90
|
+
/** It's possible to change the default `form` tag name to a different HTML tag, which can be helpful if you are
|
|
91
|
+
* nesting forms. However, native browser form behaviour, such as submitting when the `Enter` key is pressed, may no
|
|
92
|
+
* longer work
|
|
93
|
+
*/
|
|
94
|
+
tagName?: ElementType;
|
|
95
|
+
/** The value of this prop will be passed to the `target` HTML attribute on the form */
|
|
96
|
+
target?: string;
|
|
97
|
+
/** Formerly the `validate` prop; Takes a function that specifies custom validation rules for the form */
|
|
98
|
+
customValidate?: CustomValidator<T, S, F>;
|
|
99
|
+
/** This prop allows passing in custom errors that are augmented with the existing JSON Schema errors on the form; it
|
|
100
|
+
* can be used to implement asynchronous validation. By default, these are non-blocking errors, meaning that you can
|
|
101
|
+
* still submit the form when these are the only errors displayed to the user.
|
|
102
|
+
*/
|
|
103
|
+
extraErrors?: ErrorSchema<T>;
|
|
104
|
+
/** If set to true, causes the `extraErrors` to become blocking when the form is submitted */
|
|
105
|
+
extraErrorsBlockSubmit?: boolean;
|
|
106
|
+
/** If set to true, turns off HTML5 validation on the form; Set to `false` by default */
|
|
107
|
+
noHtml5Validate?: boolean;
|
|
108
|
+
/** If set to true, turns off all validation. Set to `false` by default
|
|
109
|
+
*
|
|
110
|
+
* @deprecated - In a future release, this switch may be replaced by making `validator` prop optional
|
|
111
|
+
*/
|
|
112
|
+
noValidate?: boolean;
|
|
113
|
+
/** If set to true, the form will perform validation and show any validation errors whenever the form data is changed,
|
|
114
|
+
* rather than just on submit
|
|
115
|
+
*/
|
|
116
|
+
liveValidate?: boolean;
|
|
117
|
+
/** If `omitExtraData` and `liveOmit` are both set to true, then extra form data values that are not in any form field
|
|
118
|
+
* will be removed whenever `onChange` is called. Set to `false` by default
|
|
119
|
+
*/
|
|
120
|
+
liveOmit?: boolean;
|
|
121
|
+
/** If set to true, then extra form data values that are not in any form field will be removed whenever `onSubmit` is
|
|
122
|
+
* called. Set to `false` by default.
|
|
123
|
+
*/
|
|
124
|
+
omitExtraData?: boolean;
|
|
125
|
+
/** When this prop is set to `top` or 'bottom', a list of errors (or the custom error list defined in the `ErrorList`) will also
|
|
126
|
+
* show. When set to false, only inline input validation errors will be shown. Set to `top` by default
|
|
127
|
+
*/
|
|
128
|
+
showErrorList?: false | 'top' | 'bottom';
|
|
129
|
+
/** A function can be passed to this prop in order to make modifications to the default errors resulting from JSON
|
|
130
|
+
* Schema validation
|
|
131
|
+
*/
|
|
132
|
+
transformErrors?: ErrorTransformer<T, S, F>;
|
|
133
|
+
/** If set to true, then the first field with an error will receive the focus when the form is submitted with errors
|
|
134
|
+
*/
|
|
135
|
+
focusOnFirstError?: boolean | ((error: RJSFValidationError) => void);
|
|
136
|
+
/** Optional string translation function, if provided, allows users to change the translation of the RJSF internal
|
|
137
|
+
* strings. Some strings contain replaceable parameter values as indicated by `%1`, `%2`, etc. The number after the
|
|
138
|
+
* `%` indicates the order of the parameter. The ordering of parameters is important because some languages may choose
|
|
139
|
+
* to put the second parameter before the first in its translation.
|
|
140
|
+
*/
|
|
141
|
+
translateString?: Registry['translateString'];
|
|
142
|
+
/** Optional configuration object with flags, if provided, allows users to override default form state behavior
|
|
143
|
+
* Currently only affecting minItems on array fields and handling of setting defaults based on the value of
|
|
144
|
+
* `emptyObjectFields`
|
|
145
|
+
*/
|
|
146
|
+
experimental_defaultFormStateBehavior?: Experimental_DefaultFormStateBehavior;
|
|
147
|
+
/**
|
|
148
|
+
* _internalFormWrapper is currently used by the semantic-ui theme to provide a custom wrapper around `<Form />`
|
|
149
|
+
* that supports the proper rendering of those themes. To use this prop, one must pass a component that takes two
|
|
150
|
+
* props: `children` and `as`. That component, at minimum, should render the `children` inside of a <form /> tag
|
|
151
|
+
* unless `as` is provided, in which case, use the `as` prop in place of `<form />`.
|
|
152
|
+
* i.e.:
|
|
153
|
+
* ```
|
|
154
|
+
* export default function InternalForm({ children, as }) {
|
|
155
|
+
* const FormTag = as || 'form';
|
|
156
|
+
* return <FormTag>{children}</FormTag>;
|
|
157
|
+
* }
|
|
158
|
+
* ```
|
|
159
|
+
*
|
|
160
|
+
* Use at your own risk as this prop is private and may change at any time without notice.
|
|
161
|
+
*/
|
|
162
|
+
_internalFormWrapper?: ElementType;
|
|
163
|
+
/** Support receiving a React ref to the Form
|
|
164
|
+
*/
|
|
165
|
+
ref?: Ref<Form<T, S, F>>;
|
|
166
|
+
}
|
|
167
|
+
/** The data that is contained within the state for the `Form` */
|
|
168
|
+
export interface FormState<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> {
|
|
169
|
+
/** The JSON schema object for the form */
|
|
170
|
+
schema: S;
|
|
171
|
+
/** The uiSchema for the form */
|
|
172
|
+
uiSchema: UiSchema<T, S, F>;
|
|
173
|
+
/** The `IdSchema` for the form, computed from the `schema`, the `rootFieldId`, the `formData` and the `idPrefix` and
|
|
174
|
+
* `idSeparator` props.
|
|
175
|
+
*/
|
|
176
|
+
idSchema: IdSchema<T>;
|
|
177
|
+
/** The schemaUtils implementation used by the `Form`, created from the `validator` and the `schema` */
|
|
178
|
+
schemaUtils: SchemaUtilsType<T, S, F>;
|
|
179
|
+
/** The current data for the form, computed from the `formData` prop and the changes made by the user */
|
|
180
|
+
formData?: T;
|
|
181
|
+
/** Flag indicating whether the form is in edit mode, true when `formData` is passed to the form, otherwise false */
|
|
182
|
+
edit: boolean;
|
|
183
|
+
/** The current list of errors for the form, includes `extraErrors` */
|
|
184
|
+
errors: RJSFValidationError[];
|
|
185
|
+
/** The current errors, in `ErrorSchema` format, for the form, includes `extraErrors` */
|
|
186
|
+
errorSchema: ErrorSchema<T>;
|
|
187
|
+
/** The current list of errors for the form directly from schema validation, does NOT include `extraErrors` */
|
|
188
|
+
schemaValidationErrors: RJSFValidationError[];
|
|
189
|
+
/** The current errors, in `ErrorSchema` format, for the form directly from schema validation, does NOT include
|
|
190
|
+
* `extraErrors`
|
|
191
|
+
*/
|
|
192
|
+
schemaValidationErrorSchema: ErrorSchema<T>;
|
|
193
|
+
}
|
|
194
|
+
/** The event data passed when changes have been made to the form, includes everything from the `FormState` except
|
|
195
|
+
* the schema validation errors. An additional `status` is added when returned from `onSubmit`
|
|
196
|
+
*/
|
|
197
|
+
export interface IChangeEvent<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> extends Omit<FormState<T, S, F>, 'schemaValidationErrors' | 'schemaValidationErrorSchema'> {
|
|
198
|
+
/** The status of the form when submitted */
|
|
199
|
+
status?: 'submitted';
|
|
200
|
+
}
|
|
201
|
+
/** The `Form` component renders the outer form and all the fields defined in the `schema` */
|
|
202
|
+
export default class Form<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> extends Component<FormProps<T, S, F>, FormState<T, S, F>> {
|
|
203
|
+
/** The ref used to hold the `form` element, this needs to be `any` because `tagName` or `_internalFormWrapper` can
|
|
204
|
+
* provide any possible type here
|
|
205
|
+
*/
|
|
206
|
+
formElement: RefObject<any>;
|
|
207
|
+
/** Constructs the `Form` from the `props`. Will setup the initial state from the props. It will also call the
|
|
208
|
+
* `onChange` handler if the initially provided `formData` is modified to add missing default values as part of the
|
|
209
|
+
* state construction.
|
|
210
|
+
*
|
|
211
|
+
* @param props - The initial props for the `Form`
|
|
212
|
+
*/
|
|
213
|
+
constructor(props: FormProps<T, S, F>);
|
|
214
|
+
/** React lifecycle method that gets called before new props are provided, updates the state based on new props. It
|
|
215
|
+
* will also call the`onChange` handler if the `formData` is modified to add missing default values as part of the
|
|
216
|
+
* state construction.
|
|
217
|
+
*
|
|
218
|
+
* @param nextProps - The new set of props about to be applied to the `Form`
|
|
219
|
+
*/
|
|
220
|
+
UNSAFE_componentWillReceiveProps(nextProps: FormProps<T, S, F>): void;
|
|
221
|
+
/** Extracts the updated state from the given `props` and `inputFormData`. As part of this process, the
|
|
222
|
+
* `inputFormData` is first processed to add any missing required defaults. After that, the data is run through the
|
|
223
|
+
* validation process IF required by the `props`.
|
|
224
|
+
*
|
|
225
|
+
* @param props - The props passed to the `Form`
|
|
226
|
+
* @param inputFormData - The new or current data for the `Form`
|
|
227
|
+
* @returns - The new state for the `Form`
|
|
228
|
+
*/
|
|
229
|
+
getStateFromProps(props: FormProps<T, S, F>, inputFormData?: T): FormState<T, S, F>;
|
|
230
|
+
/** React lifecycle method that is used to determine whether component should be updated.
|
|
231
|
+
*
|
|
232
|
+
* @param nextProps - The next version of the props
|
|
233
|
+
* @param nextState - The next version of the state
|
|
234
|
+
* @returns - True if the component should be updated, false otherwise
|
|
235
|
+
*/
|
|
236
|
+
shouldComponentUpdate(nextProps: FormProps<T, S, F>, nextState: FormState<T, S, F>): boolean;
|
|
237
|
+
/** Validates the `formData` against the `schema` using the `altSchemaUtils` (if provided otherwise it uses the
|
|
238
|
+
* `schemaUtils` in the state), returning the results.
|
|
239
|
+
*
|
|
240
|
+
* @param formData - The new form data to validate
|
|
241
|
+
* @param schema - The schema used to validate against
|
|
242
|
+
* @param altSchemaUtils - The alternate schemaUtils to use for validation
|
|
243
|
+
*/
|
|
244
|
+
validate(formData: T | undefined, schema?: S, altSchemaUtils?: SchemaUtilsType<T, S, F>): ValidationData<T>;
|
|
245
|
+
/** Renders any errors contained in the `state` in using the `ErrorList`, if not disabled by `showErrorList`. */
|
|
246
|
+
renderErrors(registry: Registry<T, S, F>): JSX.Element | null;
|
|
247
|
+
/** Returns the `formData` with only the elements specified in the `fields` list
|
|
248
|
+
*
|
|
249
|
+
* @param formData - The data for the `Form`
|
|
250
|
+
* @param fields - The fields to keep while filtering
|
|
251
|
+
*/
|
|
252
|
+
getUsedFormData: (formData: T | undefined, fields: string[][]) => T | undefined;
|
|
253
|
+
/** Returns the list of field names from inspecting the `pathSchema` as well as using the `formData`
|
|
254
|
+
*
|
|
255
|
+
* @param pathSchema - The `PathSchema` object for the form
|
|
256
|
+
* @param [formData] - The form data to use while checking for empty objects/arrays
|
|
257
|
+
*/
|
|
258
|
+
getFieldNames: (pathSchema: PathSchema<T>, formData?: T) => string[][];
|
|
259
|
+
/** Function to handle changes made to a field in the `Form`. This handler receives an entirely new copy of the
|
|
260
|
+
* `formData` along with a new `ErrorSchema`. It will first update the `formData` with any missing default fields and
|
|
261
|
+
* then, if `omitExtraData` and `liveOmit` are turned on, the `formData` will be filterer to remove any extra data not
|
|
262
|
+
* in a form field. Then, the resulting formData will be validated if required. The state will be updated with the new
|
|
263
|
+
* updated (potentially filtered) `formData`, any errors that resulted from validation. Finally the `onChange`
|
|
264
|
+
* callback will be called if specified with the updated state.
|
|
265
|
+
*
|
|
266
|
+
* @param formData - The new form data from a change to a field
|
|
267
|
+
* @param newErrorSchema - The new `ErrorSchema` based on the field change
|
|
268
|
+
* @param id - The id of the field that caused the change
|
|
269
|
+
*/
|
|
270
|
+
onChange: (formData: T | undefined, newErrorSchema?: ErrorSchema<T>, id?: string) => void;
|
|
271
|
+
/**
|
|
272
|
+
* Callback function to handle reset form data.
|
|
273
|
+
* - Reset all fields with default values.
|
|
274
|
+
* - Reset validations and errors
|
|
275
|
+
*
|
|
276
|
+
*/
|
|
277
|
+
reset: () => void;
|
|
278
|
+
/** Callback function to handle when a field on the form is blurred. Calls the `onBlur` callback for the `Form` if it
|
|
279
|
+
* was provided.
|
|
280
|
+
*
|
|
281
|
+
* @param id - The unique `id` of the field that was blurred
|
|
282
|
+
* @param data - The data associated with the field that was blurred
|
|
283
|
+
*/
|
|
284
|
+
onBlur: (id: string, data: any) => void;
|
|
285
|
+
/** Callback function to handle when a field on the form is focused. Calls the `onFocus` callback for the `Form` if it
|
|
286
|
+
* was provided.
|
|
287
|
+
*
|
|
288
|
+
* @param id - The unique `id` of the field that was focused
|
|
289
|
+
* @param data - The data associated with the field that was focused
|
|
290
|
+
*/
|
|
291
|
+
onFocus: (id: string, data: any) => void;
|
|
292
|
+
/** Callback function to handle when the form is submitted. First, it prevents the default event behavior. Nothing
|
|
293
|
+
* happens if the target and currentTarget of the event are not the same. It will omit any extra data in the
|
|
294
|
+
* `formData` in the state if `omitExtraData` is true. It will validate the resulting `formData`, reporting errors
|
|
295
|
+
* via the `onError()` callback unless validation is disabled. Finally, it will add in any `extraErrors` and then call
|
|
296
|
+
* back the `onSubmit` callback if it was provided.
|
|
297
|
+
*
|
|
298
|
+
* @param event - The submit HTML form event
|
|
299
|
+
*/
|
|
300
|
+
onSubmit: (event: FormEvent<any>) => void;
|
|
301
|
+
/** Returns the registry for the form */
|
|
302
|
+
getRegistry(): Registry<T, S, F>;
|
|
303
|
+
/** Provides a function that can be used to programmatically submit the `Form` */
|
|
304
|
+
submit(): void;
|
|
305
|
+
/** Attempts to focus on the field associated with the `error`. Uses the `property` field to compute path of the error
|
|
306
|
+
* field, then, using the `idPrefix` and `idSeparator` converts that path into an id. Then the input element with that
|
|
307
|
+
* id is attempted to be found using the `formElement` ref. If it is located, then it is focused.
|
|
308
|
+
*
|
|
309
|
+
* @param error - The error on which to focus
|
|
310
|
+
*/
|
|
311
|
+
focusOnError(error: RJSFValidationError): void;
|
|
312
|
+
/** Programmatically validate the form. If `onError` is provided, then it will be called with the list of errors the
|
|
313
|
+
* same way as would happen on form submission.
|
|
314
|
+
*
|
|
315
|
+
* @returns - True if the form is valid, false otherwise.
|
|
316
|
+
*/
|
|
317
|
+
validateForm(): boolean;
|
|
318
|
+
/** Renders the `Form` fields inside the <form> | `tagName` or `_internalFormWrapper`, rendering any errors if
|
|
319
|
+
* needed along with the submit button or any children of the form.
|
|
320
|
+
*/
|
|
321
|
+
render(): JSX.Element;
|
|
323
322
|
}
|
|
324
|
-
|
|
325
|
-
/** The properties for the `withTheme` function, essentially a subset of properties from the `FormProps` that can be
|
|
326
|
-
* overridden while creating a theme
|
|
327
|
-
*/
|
|
328
|
-
type ThemeProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = Pick<FormProps<T, S, F>, 'fields' | 'templates' | 'widgets' | '_internalFormWrapper'>;
|
|
329
|
-
/** A Higher-Order component that creates a wrapper around a `Form` with the overrides from the `WithThemeProps` */
|
|
330
|
-
declare function withTheme<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(themeProps: ThemeProps<T, S, F>): ComponentType<FormProps<T, S, F>>;
|
|
331
|
-
|
|
332
|
-
/** The default registry consists of all the fields, templates and widgets provided in the core implementation,
|
|
333
|
-
* plus an empty `rootSchema` and `formContext. We omit schemaUtils here because it cannot be defaulted without a
|
|
334
|
-
* rootSchema and validator. It will be added into the computed registry later in the Form.
|
|
335
|
-
*/
|
|
336
|
-
declare function getDefaultRegistry<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(): Omit<Registry<T, S, F>, 'schemaUtils'>;
|
|
337
|
-
|
|
338
|
-
export { FormProps, FormState, IChangeEvent, ThemeProps, Form as default, getDefaultRegistry, withTheme };
|