@rjsf/core 6.0.0-beta.2 → 6.0.0-beta.21
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 +705 -471
- package/dist/{index.js → index.cjs} +1094 -844
- package/dist/index.cjs.map +7 -0
- package/dist/index.esm.js +1053 -774
- package/dist/index.esm.js.map +4 -4
- package/lib/components/Form.d.ts +88 -23
- package/lib/components/Form.d.ts.map +1 -1
- package/lib/components/Form.js +213 -151
- package/lib/components/fields/ArrayField.d.ts +17 -7
- package/lib/components/fields/ArrayField.d.ts.map +1 -1
- package/lib/components/fields/ArrayField.js +116 -70
- package/lib/components/fields/BooleanField.d.ts.map +1 -1
- package/lib/components/fields/BooleanField.js +7 -2
- package/lib/components/fields/LayoutGridField.d.ts +27 -25
- package/lib/components/fields/LayoutGridField.d.ts.map +1 -1
- package/lib/components/fields/LayoutGridField.js +83 -59
- package/lib/components/fields/LayoutHeaderField.d.ts +1 -1
- package/lib/components/fields/LayoutHeaderField.js +3 -3
- package/lib/components/fields/LayoutMultiSchemaField.js +6 -5
- package/lib/components/fields/MultiSchemaField.d.ts.map +1 -1
- package/lib/components/fields/MultiSchemaField.js +13 -9
- package/lib/components/fields/NullField.js +3 -3
- package/lib/components/fields/NumberField.d.ts.map +1 -1
- package/lib/components/fields/NumberField.js +3 -3
- package/lib/components/fields/ObjectField.d.ts +3 -3
- package/lib/components/fields/ObjectField.d.ts.map +1 -1
- package/lib/components/fields/ObjectField.js +34 -34
- package/lib/components/fields/OptionalDataControlsField.d.ts +8 -0
- package/lib/components/fields/OptionalDataControlsField.d.ts.map +1 -0
- package/lib/components/fields/OptionalDataControlsField.js +43 -0
- package/lib/components/fields/SchemaField.d.ts.map +1 -1
- package/lib/components/fields/SchemaField.js +17 -17
- package/lib/components/fields/StringField.d.ts.map +1 -1
- package/lib/components/fields/StringField.js +7 -2
- package/lib/components/fields/index.d.ts.map +1 -1
- package/lib/components/fields/index.js +2 -0
- package/lib/components/templates/ArrayFieldDescriptionTemplate.d.ts +1 -1
- package/lib/components/templates/ArrayFieldDescriptionTemplate.js +3 -3
- package/lib/components/templates/ArrayFieldItemButtonsTemplate.js +2 -2
- package/lib/components/templates/ArrayFieldTemplate.d.ts.map +1 -1
- package/lib/components/templates/ArrayFieldTemplate.js +4 -3
- package/lib/components/templates/ArrayFieldTitleTemplate.d.ts +1 -1
- package/lib/components/templates/ArrayFieldTitleTemplate.d.ts.map +1 -1
- package/lib/components/templates/ArrayFieldTitleTemplate.js +3 -3
- package/lib/components/templates/ButtonTemplates/AddButton.d.ts +1 -1
- package/lib/components/templates/ButtonTemplates/AddButton.d.ts.map +1 -1
- package/lib/components/templates/ButtonTemplates/AddButton.js +2 -2
- package/lib/components/templates/FieldErrorTemplate.js +2 -2
- package/lib/components/templates/FieldHelpTemplate.js +2 -2
- package/lib/components/templates/MultiSchemaFieldTemplate.d.ts +8 -0
- package/lib/components/templates/MultiSchemaFieldTemplate.d.ts.map +1 -0
- package/lib/components/templates/MultiSchemaFieldTemplate.js +10 -0
- package/lib/components/templates/ObjectFieldTemplate.d.ts.map +1 -1
- package/lib/components/templates/ObjectFieldTemplate.js +3 -2
- package/lib/components/templates/OptionalDataControlsTemplate.d.ts +11 -0
- package/lib/components/templates/OptionalDataControlsTemplate.d.ts.map +1 -0
- package/lib/components/templates/OptionalDataControlsTemplate.js +20 -0
- package/lib/components/templates/TitleField.d.ts.map +1 -1
- package/lib/components/templates/TitleField.js +2 -2
- package/lib/components/templates/UnsupportedField.js +3 -3
- package/lib/components/templates/index.d.ts.map +1 -1
- package/lib/components/templates/index.js +4 -0
- package/lib/components/widgets/AltDateWidget.d.ts.map +1 -1
- package/lib/components/widgets/AltDateWidget.js +15 -18
- package/lib/components/widgets/CheckboxesWidget.js +2 -2
- package/lib/getDefaultRegistry.d.ts.map +1 -1
- package/lib/getDefaultRegistry.js +2 -1
- package/lib/getTestRegistry.d.ts +5 -0
- package/lib/getTestRegistry.d.ts.map +1 -0
- package/lib/getTestRegistry.js +19 -0
- package/lib/index.d.ts +2 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +18 -19
- package/src/components/Form.tsx +306 -177
- package/src/components/fields/ArrayField.tsx +127 -80
- package/src/components/fields/BooleanField.tsx +12 -3
- package/src/components/fields/LayoutGridField.tsx +95 -88
- package/src/components/fields/LayoutHeaderField.tsx +3 -3
- package/src/components/fields/LayoutMultiSchemaField.tsx +5 -5
- package/src/components/fields/MultiSchemaField.tsx +51 -35
- package/src/components/fields/NullField.tsx +3 -3
- package/src/components/fields/NumberField.tsx +11 -3
- package/src/components/fields/ObjectField.tsx +47 -53
- package/src/components/fields/OptionalDataControlsField.tsx +84 -0
- package/src/components/fields/SchemaField.tsx +24 -30
- package/src/components/fields/StringField.tsx +12 -3
- package/src/components/fields/index.ts +2 -0
- package/src/components/templates/ArrayFieldDescriptionTemplate.tsx +3 -3
- package/src/components/templates/ArrayFieldItemButtonsTemplate.tsx +5 -5
- package/src/components/templates/ArrayFieldTemplate.tsx +9 -5
- package/src/components/templates/ArrayFieldTitleTemplate.tsx +4 -3
- package/src/components/templates/BaseInputTemplate.tsx +3 -3
- package/src/components/templates/ButtonTemplates/AddButton.tsx +2 -0
- package/src/components/templates/FieldErrorTemplate.tsx +2 -2
- package/src/components/templates/FieldHelpTemplate.tsx +2 -2
- package/src/components/templates/MultiSchemaFieldTemplate.tsx +20 -0
- package/src/components/templates/ObjectFieldTemplate.tsx +10 -5
- package/src/components/templates/OptionalDataControlsTemplate.tsx +43 -0
- package/src/components/templates/TitleField.tsx +6 -1
- package/src/components/templates/UnsupportedField.tsx +3 -3
- package/src/components/templates/WrapIfAdditionalTemplate.tsx +1 -1
- package/src/components/templates/index.ts +4 -0
- package/src/components/widgets/AltDateWidget.tsx +21 -23
- package/src/components/widgets/CheckboxWidget.tsx +2 -2
- package/src/components/widgets/CheckboxesWidget.tsx +3 -3
- package/src/components/widgets/RadioWidget.tsx +1 -1
- package/src/components/widgets/SelectWidget.tsx +1 -1
- package/src/components/widgets/TextareaWidget.tsx +1 -1
- package/src/getDefaultRegistry.ts +10 -1
- package/src/getTestRegistry.tsx +34 -0
- package/src/index.ts +2 -1
- package/dist/index.js.map +0 -7
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Component } from 'react';
|
|
3
|
-
import { getTemplate, getWidget, getUiOptions, isFixedItems, allowAdditionalItems, isCustomWidget, optionsList, TranslatableString, ITEMS_KEY, } from '@rjsf/utils';
|
|
3
|
+
import { getTemplate, getWidget, getUiOptions, isFixedItems, allowAdditionalItems, isCustomWidget, isFormDataAvailable, optionsList, shouldRenderOptionalField, toFieldPathId, TranslatableString, ITEMS_KEY, } from '@rjsf/utils';
|
|
4
4
|
import cloneDeep from 'lodash-es/cloneDeep.js';
|
|
5
5
|
import get from 'lodash-es/get.js';
|
|
6
6
|
import isObject from 'lodash-es/isObject.js';
|
|
7
7
|
import set from 'lodash-es/set.js';
|
|
8
|
-
import
|
|
8
|
+
import uniqueId from 'lodash-es/uniqueId.js';
|
|
9
9
|
/** Used to generate a unique ID for an element in a row */
|
|
10
10
|
function generateRowId() {
|
|
11
|
-
return
|
|
11
|
+
return uniqueId('rjsf-array-item-');
|
|
12
12
|
}
|
|
13
13
|
/** Converts the `formData` into `KeyedFormDataType` data, using the `generateRowId()` function to create the key
|
|
14
14
|
*
|
|
@@ -46,7 +46,7 @@ class ArrayField extends Component {
|
|
|
46
46
|
*/
|
|
47
47
|
constructor(props) {
|
|
48
48
|
super(props);
|
|
49
|
-
const { formData
|
|
49
|
+
const { formData } = props;
|
|
50
50
|
const keyedFormData = generateKeyedFormData(formData);
|
|
51
51
|
this.state = {
|
|
52
52
|
keyedFormData,
|
|
@@ -149,7 +149,7 @@ class ArrayField extends Component {
|
|
|
149
149
|
if (event) {
|
|
150
150
|
event.preventDefault();
|
|
151
151
|
}
|
|
152
|
-
const { onChange, errorSchema } = this.props;
|
|
152
|
+
const { onChange, errorSchema, fieldPathId } = this.props;
|
|
153
153
|
const { keyedFormData } = this.state;
|
|
154
154
|
// refs #195: revalidate to ensure properly reindexing errors
|
|
155
155
|
let newErrorSchema;
|
|
@@ -179,7 +179,9 @@ class ArrayField extends Component {
|
|
|
179
179
|
this.setState({
|
|
180
180
|
keyedFormData: newKeyedFormData,
|
|
181
181
|
updatedKeyedFormData: true,
|
|
182
|
-
},
|
|
182
|
+
},
|
|
183
|
+
// add click will pass the empty `path` array to the onChange which adds the appropriate path
|
|
184
|
+
() => onChange(keyedToPlainFormData(newKeyedFormData), fieldPathId.path, newErrorSchema));
|
|
183
185
|
}
|
|
184
186
|
/** Callback handler for when the user clicks on the add button. Creates a new row of keyed form data at the end of
|
|
185
187
|
* the list, adding it into the state, and then returning `onChange()` with the plain form data converted from the
|
|
@@ -212,7 +214,7 @@ class ArrayField extends Component {
|
|
|
212
214
|
if (event) {
|
|
213
215
|
event.preventDefault();
|
|
214
216
|
}
|
|
215
|
-
const { onChange, errorSchema } = this.props;
|
|
217
|
+
const { onChange, errorSchema, fieldPathId } = this.props;
|
|
216
218
|
const { keyedFormData } = this.state;
|
|
217
219
|
// refs #195: revalidate to ensure properly reindexing errors
|
|
218
220
|
let newErrorSchema;
|
|
@@ -242,7 +244,7 @@ class ArrayField extends Component {
|
|
|
242
244
|
this.setState({
|
|
243
245
|
keyedFormData: newKeyedFormData,
|
|
244
246
|
updatedKeyedFormData: true,
|
|
245
|
-
}, () => onChange(keyedToPlainFormData(newKeyedFormData), newErrorSchema));
|
|
247
|
+
}, () => onChange(keyedToPlainFormData(newKeyedFormData), fieldPathId.path, newErrorSchema));
|
|
246
248
|
};
|
|
247
249
|
};
|
|
248
250
|
/** Callback handler for when the user clicks on the remove button on an existing array element. Removes the row of
|
|
@@ -256,7 +258,7 @@ class ArrayField extends Component {
|
|
|
256
258
|
if (event) {
|
|
257
259
|
event.preventDefault();
|
|
258
260
|
}
|
|
259
|
-
const { onChange, errorSchema } = this.props;
|
|
261
|
+
const { onChange, errorSchema, fieldPathId } = this.props;
|
|
260
262
|
const { keyedFormData } = this.state;
|
|
261
263
|
// refs #195: revalidate to ensure properly reindexing errors
|
|
262
264
|
let newErrorSchema;
|
|
@@ -276,7 +278,7 @@ class ArrayField extends Component {
|
|
|
276
278
|
this.setState({
|
|
277
279
|
keyedFormData: newKeyedFormData,
|
|
278
280
|
updatedKeyedFormData: true,
|
|
279
|
-
}, () => onChange(keyedToPlainFormData(newKeyedFormData), newErrorSchema));
|
|
281
|
+
}, () => onChange(keyedToPlainFormData(newKeyedFormData), fieldPathId.path, newErrorSchema));
|
|
280
282
|
};
|
|
281
283
|
};
|
|
282
284
|
/** Callback handler for when the user clicks on one of the move item buttons on an existing array element. Moves the
|
|
@@ -292,7 +294,7 @@ class ArrayField extends Component {
|
|
|
292
294
|
event.preventDefault();
|
|
293
295
|
event.currentTarget.blur();
|
|
294
296
|
}
|
|
295
|
-
const { onChange, errorSchema } = this.props;
|
|
297
|
+
const { onChange, errorSchema, fieldPathId } = this.props;
|
|
296
298
|
let newErrorSchema;
|
|
297
299
|
if (errorSchema) {
|
|
298
300
|
newErrorSchema = {};
|
|
@@ -321,7 +323,7 @@ class ArrayField extends Component {
|
|
|
321
323
|
const newKeyedFormData = reOrderArray();
|
|
322
324
|
this.setState({
|
|
323
325
|
keyedFormData: newKeyedFormData,
|
|
324
|
-
}, () => onChange(keyedToPlainFormData(newKeyedFormData), newErrorSchema));
|
|
326
|
+
}, () => onChange(keyedToPlainFormData(newKeyedFormData), fieldPathId.path, newErrorSchema));
|
|
325
327
|
};
|
|
326
328
|
};
|
|
327
329
|
/** Callback handler used to deal with changing the value of the data in the array at the `index`. Calls the
|
|
@@ -330,36 +332,58 @@ class ArrayField extends Component {
|
|
|
330
332
|
* @param index - The index of the item being changed
|
|
331
333
|
*/
|
|
332
334
|
onChangeForIndex = (index) => {
|
|
333
|
-
return (value, newErrorSchema, id) => {
|
|
334
|
-
const {
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
const jsonValue = typeof value === 'undefined' ? null : value;
|
|
340
|
-
return index === i ? jsonValue : item;
|
|
341
|
-
});
|
|
342
|
-
onChange(newFormData, errorSchema &&
|
|
343
|
-
errorSchema && {
|
|
344
|
-
...errorSchema,
|
|
345
|
-
[index]: newErrorSchema,
|
|
346
|
-
}, id);
|
|
335
|
+
return (value, path, newErrorSchema, id) => {
|
|
336
|
+
const { onChange } = this.props;
|
|
337
|
+
onChange(
|
|
338
|
+
// We need to treat undefined items as nulls to have validation.
|
|
339
|
+
// See https://github.com/tdegrunt/jsonschema/issues/206
|
|
340
|
+
value === undefined ? null : value, path, newErrorSchema, id);
|
|
347
341
|
};
|
|
348
342
|
};
|
|
349
343
|
/** Callback handler used to change the value for a checkbox */
|
|
350
344
|
onSelectChange = (value) => {
|
|
351
|
-
const { onChange,
|
|
352
|
-
|
|
345
|
+
const { onChange, fieldPathId } = this.props;
|
|
346
|
+
// select change will pass an empty `path` array since the `ObjectField` will add the path value automatically
|
|
347
|
+
onChange(value, fieldPathId.path, undefined, fieldPathId && fieldPathId.$id);
|
|
353
348
|
};
|
|
349
|
+
/** Helper method to compute item UI schema for both normal and fixed arrays
|
|
350
|
+
* Handles both static object and dynamic function cases
|
|
351
|
+
*
|
|
352
|
+
* @param uiSchema - The parent UI schema containing items definition
|
|
353
|
+
* @param item - The item data
|
|
354
|
+
* @param index - The index of the item
|
|
355
|
+
* @param formContext - The form context
|
|
356
|
+
* @returns The computed UI schema for the item
|
|
357
|
+
*/
|
|
358
|
+
computeItemUiSchema(uiSchema, item, index, formContext) {
|
|
359
|
+
if (typeof uiSchema.items === 'function') {
|
|
360
|
+
try {
|
|
361
|
+
// Call the function with item data, index, and form context
|
|
362
|
+
// TypeScript now correctly infers the types thanks to the ArrayElement type in UiSchema
|
|
363
|
+
const result = uiSchema.items(item, index, formContext);
|
|
364
|
+
// Only use the result if it's truthy
|
|
365
|
+
return result;
|
|
366
|
+
}
|
|
367
|
+
catch (e) {
|
|
368
|
+
console.error(`Error executing dynamic uiSchema.items function for item at index ${index}:`, e);
|
|
369
|
+
// Fall back to undefined to allow the field to still render
|
|
370
|
+
return undefined;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
else {
|
|
374
|
+
// Static object case - preserve undefined to maintain backward compatibility
|
|
375
|
+
return uiSchema.items;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
354
378
|
/** Renders the `ArrayField` depending on the specific needs of the schema and uischema elements
|
|
355
379
|
*/
|
|
356
380
|
render() {
|
|
357
|
-
const { schema, uiSchema,
|
|
381
|
+
const { schema, uiSchema, fieldPathId, registry } = this.props;
|
|
358
382
|
const { schemaUtils, translateString } = registry;
|
|
359
383
|
if (!(ITEMS_KEY in schema)) {
|
|
360
384
|
const uiOptions = getUiOptions(uiSchema);
|
|
361
385
|
const UnsupportedFieldTemplate = getTemplate('UnsupportedFieldTemplate', registry, uiOptions);
|
|
362
|
-
return (_jsx(UnsupportedFieldTemplate, { schema: schema,
|
|
386
|
+
return (_jsx(UnsupportedFieldTemplate, { schema: schema, fieldPathId: fieldPathId, reason: translateString(TranslatableString.MissingItems), registry: registry }));
|
|
363
387
|
}
|
|
364
388
|
if (schemaUtils.isMultiSelect(schema)) {
|
|
365
389
|
// If array has enum or uniqueItems set to true, call renderMultiSelect() to render the default multiselect widget or a custom widget, if specified.
|
|
@@ -379,25 +403,32 @@ class ArrayField extends Component {
|
|
|
379
403
|
/** Renders a normal array without any limitations of length
|
|
380
404
|
*/
|
|
381
405
|
renderNormalArray() {
|
|
382
|
-
const { schema, uiSchema = {}, errorSchema,
|
|
406
|
+
const { schema, uiSchema = {}, errorSchema, fieldPathId, name, title, disabled = false, readonly = false, autofocus = false, required = false, registry, onBlur, onFocus, rawErrors, } = this.props;
|
|
383
407
|
const { keyedFormData } = this.state;
|
|
384
408
|
const fieldTitle = schema.title || title || name;
|
|
385
|
-
const { schemaUtils, formContext } = registry;
|
|
409
|
+
const { schemaUtils, fields, formContext, globalFormOptions } = registry;
|
|
410
|
+
const { OptionalDataControlsField } = fields;
|
|
386
411
|
const uiOptions = getUiOptions(uiSchema);
|
|
387
412
|
const _schemaItems = isObject(schema.items) ? schema.items : {};
|
|
388
413
|
const itemsSchema = schemaUtils.retrieveSchema(_schemaItems);
|
|
389
414
|
const formData = keyedToPlainFormData(this.state.keyedFormData);
|
|
390
|
-
const
|
|
415
|
+
const renderOptionalField = shouldRenderOptionalField(registry, schema, required, uiSchema);
|
|
416
|
+
const hasFormData = isFormDataAvailable(this.props.formData);
|
|
417
|
+
const canAdd = this.canAddItem(formData) && (!renderOptionalField || hasFormData);
|
|
418
|
+
const actualFormData = hasFormData ? keyedFormData : [];
|
|
419
|
+
const extraClass = renderOptionalField ? ' rjsf-optional-array-field' : '';
|
|
420
|
+
const optionalDataControl = renderOptionalField ? _jsx(OptionalDataControlsField, { ...this.props }) : undefined;
|
|
391
421
|
const arrayProps = {
|
|
392
422
|
canAdd,
|
|
393
|
-
items:
|
|
423
|
+
items: actualFormData.map((keyedItem, index) => {
|
|
394
424
|
const { key, item } = keyedItem;
|
|
395
425
|
// While we are actually dealing with a single item of type T, the types require a T[], so cast
|
|
396
426
|
const itemCast = item;
|
|
397
427
|
const itemSchema = schemaUtils.retrieveSchema(_schemaItems, itemCast);
|
|
398
428
|
const itemErrorSchema = errorSchema ? errorSchema[index] : undefined;
|
|
399
|
-
const
|
|
400
|
-
|
|
429
|
+
const itemFieldPathId = toFieldPathId(index, globalFormOptions, fieldPathId);
|
|
430
|
+
// Compute the item UI schema using the helper method
|
|
431
|
+
const itemUiSchema = this.computeItemUiSchema(uiSchema, item, index, formContext);
|
|
401
432
|
return this.renderArrayFieldItem({
|
|
402
433
|
key,
|
|
403
434
|
index,
|
|
@@ -407,10 +438,10 @@ class ArrayField extends Component {
|
|
|
407
438
|
canMoveUp: index > 0,
|
|
408
439
|
canMoveDown: index < formData.length - 1,
|
|
409
440
|
itemSchema,
|
|
410
|
-
|
|
441
|
+
itemFieldPathId,
|
|
411
442
|
itemErrorSchema,
|
|
412
443
|
itemData: itemCast,
|
|
413
|
-
itemUiSchema
|
|
444
|
+
itemUiSchema,
|
|
414
445
|
autofocus: autofocus && index === 0,
|
|
415
446
|
onBlur,
|
|
416
447
|
onFocus,
|
|
@@ -418,19 +449,19 @@ class ArrayField extends Component {
|
|
|
418
449
|
totalItems: keyedFormData.length,
|
|
419
450
|
});
|
|
420
451
|
}),
|
|
421
|
-
className: `rjsf-field rjsf-field-array rjsf-field-array-of-${itemsSchema.type}`,
|
|
452
|
+
className: `rjsf-field rjsf-field-array rjsf-field-array-of-${itemsSchema.type}${extraClass}`,
|
|
422
453
|
disabled,
|
|
423
|
-
|
|
454
|
+
fieldPathId,
|
|
424
455
|
uiSchema,
|
|
425
456
|
onAddClick: this.onAddClick,
|
|
426
457
|
readonly,
|
|
427
458
|
required,
|
|
428
459
|
schema,
|
|
429
460
|
title: fieldTitle,
|
|
430
|
-
formContext,
|
|
431
461
|
formData,
|
|
432
462
|
rawErrors,
|
|
433
463
|
registry,
|
|
464
|
+
optionalDataControl,
|
|
434
465
|
};
|
|
435
466
|
const Template = getTemplate('ArrayFieldTemplate', registry, uiOptions);
|
|
436
467
|
return _jsx(Template, { ...arrayProps });
|
|
@@ -438,18 +469,18 @@ class ArrayField extends Component {
|
|
|
438
469
|
/** Renders an array using the custom widget provided by the user in the `uiSchema`
|
|
439
470
|
*/
|
|
440
471
|
renderCustomWidget() {
|
|
441
|
-
const { schema,
|
|
472
|
+
const { schema, fieldPathId, uiSchema, disabled = false, readonly = false, autofocus = false, required = false, hideError, placeholder, onBlur, onFocus, formData: items = [], registry, rawErrors, name, } = this.props;
|
|
442
473
|
const { widgets, formContext, globalUiOptions, schemaUtils } = registry;
|
|
443
474
|
const { widget, title: uiTitle, ...options } = getUiOptions(uiSchema, globalUiOptions);
|
|
444
475
|
const Widget = getWidget(schema, widget, widgets);
|
|
445
476
|
const label = uiTitle ?? schema.title ?? name;
|
|
446
477
|
const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);
|
|
447
|
-
return (_jsx(Widget, { id:
|
|
478
|
+
return (_jsx(Widget, { id: fieldPathId.$id, name: name, multiple: true, onChange: this.onSelectChange, onBlur: onBlur, onFocus: onFocus, options: options, schema: schema, uiSchema: uiSchema, registry: registry, value: items, disabled: disabled, readonly: readonly, hideError: hideError, required: required, label: label, hideLabel: !displayLabel, placeholder: placeholder, formContext: formContext, autofocus: autofocus, rawErrors: rawErrors }));
|
|
448
479
|
}
|
|
449
480
|
/** Renders an array as a set of checkboxes
|
|
450
481
|
*/
|
|
451
482
|
renderMultiSelect() {
|
|
452
|
-
const { schema,
|
|
483
|
+
const { schema, fieldPathId, uiSchema, formData: items = [], disabled = false, readonly = false, autofocus = false, required = false, placeholder, onBlur, onFocus, registry, rawErrors, name, } = this.props;
|
|
453
484
|
const { widgets, schemaUtils, formContext, globalUiOptions } = registry;
|
|
454
485
|
const itemsSchema = schemaUtils.retrieveSchema(schema.items, items);
|
|
455
486
|
const enumOptions = optionsList(itemsSchema, uiSchema);
|
|
@@ -457,47 +488,52 @@ class ArrayField extends Component {
|
|
|
457
488
|
const Widget = getWidget(schema, widget, widgets);
|
|
458
489
|
const label = uiTitle ?? schema.title ?? name;
|
|
459
490
|
const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);
|
|
460
|
-
return (_jsx(Widget, { id:
|
|
491
|
+
return (_jsx(Widget, { id: fieldPathId.$id, name: name, multiple: true, onChange: this.onSelectChange, onBlur: onBlur, onFocus: onFocus, options: { ...options, enumOptions }, schema: schema, uiSchema: uiSchema, registry: registry, value: items, disabled: disabled, readonly: readonly, required: required, label: label, hideLabel: !displayLabel, placeholder: placeholder, formContext: formContext, autofocus: autofocus, rawErrors: rawErrors }));
|
|
461
492
|
}
|
|
462
493
|
/** Renders an array of files using the `FileWidget`
|
|
463
494
|
*/
|
|
464
495
|
renderFiles() {
|
|
465
|
-
const { schema, uiSchema,
|
|
496
|
+
const { schema, uiSchema, fieldPathId, name, disabled = false, readonly = false, autofocus = false, required = false, onBlur, onFocus, registry, formData: items = [], rawErrors, } = this.props;
|
|
466
497
|
const { widgets, formContext, globalUiOptions, schemaUtils } = registry;
|
|
467
498
|
const { widget = 'files', title: uiTitle, ...options } = getUiOptions(uiSchema, globalUiOptions);
|
|
468
499
|
const Widget = getWidget(schema, widget, widgets);
|
|
469
500
|
const label = uiTitle ?? schema.title ?? name;
|
|
470
501
|
const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);
|
|
471
|
-
return (_jsx(Widget, { options: options, id:
|
|
502
|
+
return (_jsx(Widget, { options: options, id: fieldPathId.$id, name: name, multiple: true, onChange: this.onSelectChange, onBlur: onBlur, onFocus: onFocus, schema: schema, uiSchema: uiSchema, value: items, disabled: disabled, readonly: readonly, required: required, registry: registry, formContext: formContext, autofocus: autofocus, rawErrors: rawErrors, label: label, hideLabel: !displayLabel }));
|
|
472
503
|
}
|
|
473
504
|
/** Renders an array that has a maximum limit of items
|
|
474
505
|
*/
|
|
475
506
|
renderFixedArray() {
|
|
476
|
-
const { schema, uiSchema = {}, formData
|
|
477
|
-
const { keyedFormData } = this.state;
|
|
507
|
+
const { schema, uiSchema = {}, formData, errorSchema, fieldPathId, name, title, disabled = false, readonly = false, autofocus = false, required = false, registry, onBlur, onFocus, rawErrors, } = this.props;
|
|
478
508
|
let { formData: items = [] } = this.props;
|
|
509
|
+
const { keyedFormData } = this.state;
|
|
479
510
|
const fieldTitle = schema.title || title || name;
|
|
480
511
|
const uiOptions = getUiOptions(uiSchema);
|
|
481
|
-
const { schemaUtils, formContext } = registry;
|
|
512
|
+
const { schemaUtils, fields, formContext, globalFormOptions } = registry;
|
|
513
|
+
const { OptionalDataControlsField } = fields;
|
|
514
|
+
const renderOptionalField = shouldRenderOptionalField(registry, schema, required, uiSchema);
|
|
515
|
+
const hasFormData = isFormDataAvailable(formData);
|
|
482
516
|
const _schemaItems = isObject(schema.items) ? schema.items : [];
|
|
483
|
-
const itemSchemas = _schemaItems.map((item, index) => schemaUtils.retrieveSchema(item,
|
|
517
|
+
const itemSchemas = _schemaItems.map((item, index) => schemaUtils.retrieveSchema(item, items[index]));
|
|
484
518
|
const additionalSchema = isObject(schema.additionalItems)
|
|
485
519
|
? schemaUtils.retrieveSchema(schema.additionalItems, formData)
|
|
486
520
|
: null;
|
|
487
|
-
if (
|
|
521
|
+
if (items.length < itemSchemas.length) {
|
|
488
522
|
// to make sure at least all fixed items are generated
|
|
489
|
-
items = items || [];
|
|
490
523
|
items = items.concat(new Array(itemSchemas.length - items.length));
|
|
491
524
|
}
|
|
525
|
+
const actualFormData = hasFormData ? keyedFormData : [];
|
|
526
|
+
const extraClass = renderOptionalField ? ' rjsf-optional-array-field' : '';
|
|
527
|
+
const optionalDataControl = renderOptionalField ? _jsx(OptionalDataControlsField, { ...this.props }) : undefined;
|
|
492
528
|
// These are the props passed into the render function
|
|
493
|
-
const canAdd = this.canAddItem(items) && !!additionalSchema;
|
|
529
|
+
const canAdd = this.canAddItem(items) && !!additionalSchema && (!renderOptionalField || hasFormData);
|
|
494
530
|
const arrayProps = {
|
|
495
531
|
canAdd,
|
|
496
|
-
className:
|
|
532
|
+
className: `rjsf-field rjsf-field-array rjsf-field-array-fixed-items${extraClass}`,
|
|
497
533
|
disabled,
|
|
498
|
-
|
|
534
|
+
fieldPathId,
|
|
499
535
|
formData,
|
|
500
|
-
items:
|
|
536
|
+
items: actualFormData.map((keyedItem, index) => {
|
|
501
537
|
const { key, item } = keyedItem;
|
|
502
538
|
// While we are actually dealing with a single item of type T, the types require a T[], so cast
|
|
503
539
|
const itemCast = item;
|
|
@@ -505,13 +541,23 @@ class ArrayField extends Component {
|
|
|
505
541
|
const itemSchema = (additional && isObject(schema.additionalItems)
|
|
506
542
|
? schemaUtils.retrieveSchema(schema.additionalItems, itemCast)
|
|
507
543
|
: itemSchemas[index]) || {};
|
|
508
|
-
const
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
544
|
+
const itemFieldPathId = toFieldPathId(index, globalFormOptions, fieldPathId);
|
|
545
|
+
// Compute the item UI schema - handle both static and dynamic cases
|
|
546
|
+
let itemUiSchema;
|
|
547
|
+
if (additional) {
|
|
548
|
+
// For additional items, use additionalItems uiSchema
|
|
549
|
+
itemUiSchema = uiSchema.additionalItems;
|
|
550
|
+
}
|
|
551
|
+
else {
|
|
552
|
+
// For fixed items, uiSchema.items can be an array, a function, or a single object
|
|
553
|
+
if (Array.isArray(uiSchema.items)) {
|
|
554
|
+
itemUiSchema = uiSchema.items[index];
|
|
555
|
+
}
|
|
556
|
+
else {
|
|
557
|
+
// Use the helper method for function or static object cases
|
|
558
|
+
itemUiSchema = this.computeItemUiSchema(uiSchema, item, index, formContext);
|
|
559
|
+
}
|
|
560
|
+
}
|
|
515
561
|
const itemErrorSchema = errorSchema ? errorSchema[index] : undefined;
|
|
516
562
|
return this.renderArrayFieldItem({
|
|
517
563
|
key,
|
|
@@ -525,7 +571,7 @@ class ArrayField extends Component {
|
|
|
525
571
|
itemSchema,
|
|
526
572
|
itemData: itemCast,
|
|
527
573
|
itemUiSchema,
|
|
528
|
-
|
|
574
|
+
itemFieldPathId,
|
|
529
575
|
itemErrorSchema,
|
|
530
576
|
autofocus: autofocus && index === 0,
|
|
531
577
|
onBlur,
|
|
@@ -541,9 +587,9 @@ class ArrayField extends Component {
|
|
|
541
587
|
schema,
|
|
542
588
|
uiSchema,
|
|
543
589
|
title: fieldTitle,
|
|
544
|
-
formContext,
|
|
545
590
|
errorSchema,
|
|
546
591
|
rawErrors,
|
|
592
|
+
optionalDataControl,
|
|
547
593
|
};
|
|
548
594
|
const Template = getTemplate('ArrayFieldTemplate', registry, uiOptions);
|
|
549
595
|
return _jsx(Template, { ...arrayProps });
|
|
@@ -554,8 +600,8 @@ class ArrayField extends Component {
|
|
|
554
600
|
* @param props - The props for the individual array item to be rendered
|
|
555
601
|
*/
|
|
556
602
|
renderArrayFieldItem(props) {
|
|
557
|
-
const { key, index, name, canAdd, canRemove = true, canMoveUp, canMoveDown, itemSchema, itemData, itemUiSchema,
|
|
558
|
-
const { disabled, hideError,
|
|
603
|
+
const { key, index, name, canAdd, canRemove = true, canMoveUp, canMoveDown, itemSchema, itemData, itemUiSchema, itemFieldPathId, itemErrorSchema, autofocus, onBlur, onFocus, rawErrors, totalItems, title, } = props;
|
|
604
|
+
const { disabled, hideError, readonly, uiSchema, registry, formContext } = this.props;
|
|
559
605
|
const { fields: { ArraySchemaField, SchemaField }, globalUiOptions, } = registry;
|
|
560
606
|
const ItemSchemaField = ArraySchemaField || SchemaField;
|
|
561
607
|
const { orderable = true, removable = true, copyable = false } = getUiOptions(uiSchema, globalUiOptions);
|
|
@@ -568,9 +614,9 @@ class ArrayField extends Component {
|
|
|
568
614
|
};
|
|
569
615
|
has.toolbar = Object.keys(has).some((key) => has[key]);
|
|
570
616
|
return {
|
|
571
|
-
children: (_jsx(ItemSchemaField, { name: name, title: title, index: index, schema: itemSchema, uiSchema: itemUiSchema, formData: itemData, formContext: formContext, errorSchema: itemErrorSchema,
|
|
617
|
+
children: (_jsx(ItemSchemaField, { name: name, title: title, index: index, schema: itemSchema, uiSchema: itemUiSchema, formData: itemData, formContext: formContext, errorSchema: itemErrorSchema, fieldPathId: itemFieldPathId, required: this.isItemRequired(itemSchema), onChange: this.onChangeForIndex(index), onBlur: onBlur, onFocus: onFocus, registry: registry, disabled: disabled, readonly: readonly, hideError: hideError, autofocus: autofocus, rawErrors: rawErrors })),
|
|
572
618
|
buttonsProps: {
|
|
573
|
-
|
|
619
|
+
fieldPathId: itemFieldPathId,
|
|
574
620
|
disabled: disabled,
|
|
575
621
|
readonly: readonly,
|
|
576
622
|
canAdd,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BooleanField.d.ts","sourceRoot":"","sources":["../../../src/components/fields/BooleanField.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BooleanField.d.ts","sourceRoot":"","sources":["../../../src/components/fields/BooleanField.tsx"],"names":[],"mappings":"AACA,OAAO,EAIL,UAAU,EACV,eAAe,EAGf,UAAU,EACV,gBAAgB,EAEjB,MAAM,aAAa,CAAC;AAGrB;;;;GAIG;AACH,iBAAS,YAAY,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,SAAS,gBAAgB,GAAG,UAAU,EAAE,CAAC,SAAS,eAAe,GAAG,GAAG,EACrG,KAAK,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,2CAoG3B;AAED,eAAe,YAAY,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback } from 'react';
|
|
2
3
|
import { getWidget, getUiOptions, optionsList, TranslatableString, } from '@rjsf/utils';
|
|
3
4
|
import isObject from 'lodash-es/isObject.js';
|
|
4
5
|
/** The `BooleanField` component is used to render a field in the schema is boolean. It constructs `enumOptions` for the
|
|
@@ -7,7 +8,7 @@ import isObject from 'lodash-es/isObject.js';
|
|
|
7
8
|
* @param props - The `FieldProps` for this template
|
|
8
9
|
*/
|
|
9
10
|
function BooleanField(props) {
|
|
10
|
-
const { schema, name, uiSchema,
|
|
11
|
+
const { schema, name, uiSchema, fieldPathId, formData, registry, required, disabled, readonly, hideError, autofocus, title, onChange, onFocus, onBlur, rawErrors, } = props;
|
|
11
12
|
const { title: schemaTitle } = schema;
|
|
12
13
|
const { widgets, formContext, translateString, globalUiOptions } = registry;
|
|
13
14
|
const { widget = 'checkbox', title: uiTitle,
|
|
@@ -51,6 +52,10 @@ function BooleanField(props) {
|
|
|
51
52
|
enumOptions = optionsList({ enum: enums }, uiSchema);
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
|
-
|
|
55
|
+
const onWidgetChange = useCallback((value, errorSchema, id) => {
|
|
56
|
+
// Boolean field change passes an empty path array to the parent field which adds the appropriate path
|
|
57
|
+
return onChange(value, fieldPathId.path, errorSchema, id);
|
|
58
|
+
}, [onChange, fieldPathId]);
|
|
59
|
+
return (_jsx(Widget, { options: { ...options, enumOptions }, schema: schema, uiSchema: uiSchema, id: fieldPathId.$id, name: name, onChange: onWidgetChange, onFocus: onFocus, onBlur: onBlur, label: label, hideLabel: !displayLabel, value: formData, required: required, disabled: disabled, readonly: readonly, hideError: hideError, registry: registry, formContext: formContext, autofocus: autofocus, rawErrors: rawErrors }));
|
|
55
60
|
}
|
|
56
61
|
export default BooleanField;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentType, PureComponent, ReactNode } from 'react';
|
|
2
|
-
import { ErrorSchema, FieldProps, FormContextType, GenericObjectType,
|
|
2
|
+
import { ErrorSchema, FieldProps, FieldPathId, FieldPathList, FormContextType, GenericObjectType, RJSFSchema, Registry, StrictRJSFSchema, UiSchema } from '@rjsf/utils';
|
|
3
3
|
/** The enumeration of the three different Layout GridTemplate type values
|
|
4
4
|
*/
|
|
5
5
|
export declare enum GridType {
|
|
@@ -48,9 +48,6 @@ export declare const LAYOUT_GRID_UI_OPTION = "layoutGrid";
|
|
|
48
48
|
/** The constant representing the main layout grid schema option name in the `uiSchema`
|
|
49
49
|
*/
|
|
50
50
|
export declare const LAYOUT_GRID_OPTION = "ui:layoutGrid";
|
|
51
|
-
/** The constant representing the global UI Options object potentially contained within the `uiSchema`
|
|
52
|
-
*/
|
|
53
|
-
export declare const UI_GLOBAL_OPTIONS = "ui:global_options";
|
|
54
51
|
/** Type used to return options list and whether it has a discriminator */
|
|
55
52
|
type OneOfOptionsInfoType<S extends StrictRJSFSchema = RJSFSchema> = {
|
|
56
53
|
options: S[];
|
|
@@ -345,37 +342,42 @@ export default class LayoutGridField<T = any, S extends StrictRJSFSchema = RJSFS
|
|
|
345
342
|
children: LayoutGridSchemaType[];
|
|
346
343
|
gridProps: GridProps;
|
|
347
344
|
};
|
|
348
|
-
/**
|
|
349
|
-
*
|
|
345
|
+
/** Computes the `rawSchema` and `fieldPathId` for a `schema` and a `potentialIndex`. If the `schema` is of type array,
|
|
346
|
+
* has an `ITEMS_KEY` element and `potentialIndex` represents a numeric value, the element at `ITEMS_KEY` is checked
|
|
347
|
+
* to see if it is an array. If it is AND the `potentialIndex`th element is available, it is used as the `rawSchema`,
|
|
348
|
+
* otherwise the last value of the element is used. If it is not, then the element is used as the `rawSchema`. In
|
|
349
|
+
* either case, an `fieldPathId` is computed for the array index. If the `schema` does not represent an array or the
|
|
350
|
+
* `potentialIndex` is not a numeric value, then `rawSchema` is returned as undefined and given `fieldPathId` is returned
|
|
351
|
+
* as is.
|
|
350
352
|
*
|
|
351
|
-
* @param
|
|
352
|
-
* @param
|
|
353
|
-
* @param
|
|
354
|
-
* @
|
|
355
|
-
* @param [idSeparator] - The param to pass into the `toIdSchema` util which will use it to join the `idSchema` paths
|
|
356
|
-
* @returns - The generated `idSchema` for the `schema`
|
|
353
|
+
* @param schema - The schema to generate the fieldPathId for
|
|
354
|
+
* @param fieldPathId - The FieldPathId for the schema
|
|
355
|
+
* @param potentialIndex - A string containing a potential index
|
|
356
|
+
* @returns - An object containing the `rawSchema` and `fieldPathId` of an array item, otherwise an undefined `rawSchema`
|
|
357
357
|
*/
|
|
358
|
-
static
|
|
358
|
+
static computeArraySchemasIfPresent<S extends StrictRJSFSchema = RJSFSchema>(schema: S | undefined, fieldPathId: FieldPathId, potentialIndex: string): {
|
|
359
|
+
rawSchema?: S;
|
|
360
|
+
fieldPathId: FieldPathId;
|
|
361
|
+
};
|
|
359
362
|
/** Given a `dottedPath` to a field in the `initialSchema`, iterate through each individual path in the schema until
|
|
360
363
|
* the leaf path is found and returned (along with whether that leaf path `isRequired`) OR no schema exists for an
|
|
361
364
|
* element in the path. If the leaf schema element happens to be a oneOf/anyOf then also return the oneOf/anyOf as
|
|
362
365
|
* `options`.
|
|
363
366
|
*
|
|
364
|
-
* @param
|
|
367
|
+
* @param registry - The registry
|
|
365
368
|
* @param dottedPath - The dotted-path to the field for which to get the schema
|
|
366
369
|
* @param initialSchema - The initial schema to start the search from
|
|
367
370
|
* @param formData - The formData, useful for resolving a oneOf/anyOf selection in the path hierarchy
|
|
368
|
-
* @param
|
|
369
|
-
* @param [idSeparator] - The param to pass into the `toIdSchema` util which will use it to join the `idSchema` paths
|
|
371
|
+
* @param initialFieldIdPath - The initial fieldPathId to start the search from
|
|
370
372
|
* @returns - An object containing the destination schema, isRequired and isReadonly flags for the field and options
|
|
371
373
|
* info if a oneOf/anyOf
|
|
372
374
|
*/
|
|
373
|
-
static getSchemaDetailsForField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
|
|
375
|
+
static getSchemaDetailsForField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(registry: Registry<T, S, F>, dottedPath: string, initialSchema: S, formData: FieldProps<T, S, F>['formData'], initialFieldIdPath: FieldPathId): {
|
|
374
376
|
schema?: S;
|
|
375
377
|
isRequired: boolean;
|
|
376
378
|
isReadonly?: boolean;
|
|
377
379
|
optionsInfo?: OneOfOptionsInfoType<S>;
|
|
378
|
-
|
|
380
|
+
fieldPathId: FieldPathId;
|
|
379
381
|
};
|
|
380
382
|
/** Gets the custom render component from the `render`, by either determining that it is either already a function or
|
|
381
383
|
* it is a non-function value that can be used to look up the function in the registry. If no function can be found,
|
|
@@ -405,9 +407,9 @@ export default class LayoutGridField<T = any, S extends StrictRJSFSchema = RJSFS
|
|
|
405
407
|
* elements, they will then be passed on to the `onChange` handler of the `LayoutFieldGrid`.
|
|
406
408
|
*
|
|
407
409
|
* @param dottedPath - The dotted-path to the field for which to generate the onChange handler
|
|
408
|
-
* @returns - The `onChange` handling function for the `dottedPath` field
|
|
410
|
+
* @returns - The `onChange` handling function for the `dottedPath` field of the `schemaType` type
|
|
409
411
|
*/
|
|
410
|
-
onFieldChange: (dottedPath: string) => (value:
|
|
412
|
+
onFieldChange: (dottedPath: string) => (value: T | undefined, path: FieldPathList, errSchema?: ErrorSchema<T>, id?: string) => void;
|
|
411
413
|
/** Renders the `children` of the `GridType.CONDITION` if it passes. The `layoutGridSchema` for the
|
|
412
414
|
* `GridType.CONDITION` is separated into the `children` and other `gridProps`. The `gridProps` are used to extract
|
|
413
415
|
* the `operator`, `field` and `value` of the condition. If the condition matches, then all of the `children` are
|
|
@@ -441,23 +443,23 @@ export default class LayoutGridField<T = any, S extends StrictRJSFSchema = RJSFS
|
|
|
441
443
|
* @returns - The rendered `GridTemplate` containing the children for the `GridType.ROW`
|
|
442
444
|
*/
|
|
443
445
|
renderRow(layoutGridSchema: GridSchemaType): import("react/jsx-runtime").JSX.Element;
|
|
444
|
-
/** Iterates through all the `
|
|
446
|
+
/** Iterates through all the `childrenLayoutGrfieldPathId`, rendering a nested `LayoutGridField` for each item in the
|
|
445
447
|
* list, passing all the props for the current `LayoutGridField` along, updating the `schema` by calling
|
|
446
448
|
* `retrieveSchema()` on it to resolve any `$ref`s. In addition to the updated `schema`, each item in
|
|
447
|
-
* `
|
|
449
|
+
* `childrenLayoutGrfieldPathId` is passed as `layoutGridSchema`.
|
|
448
450
|
*
|
|
449
|
-
* @param
|
|
451
|
+
* @param childrenLayoutGrfieldPathId - The list of strings or objects that represents the configurations for the
|
|
450
452
|
* children fields
|
|
451
453
|
* @returns - The nested `LayoutGridField`s
|
|
452
454
|
*/
|
|
453
|
-
renderChildren(
|
|
455
|
+
renderChildren(childrenLayoutGrfieldPathId: LayoutGridSchemaType[]): import("react/jsx-runtime").JSX.Element[];
|
|
454
456
|
/** Renders the field described by `gridSchema`. If `gridSchema` is not an object, then is will be assumed
|
|
455
457
|
* to be the dotted-path to the field in the schema. Otherwise, we extract the `name`, and optional `render` and all
|
|
456
458
|
* other props. If `name` does not exist and there is an optional `render`, we return the `render` component with only
|
|
457
459
|
* specified props for that component. If `name` exists, we take the name, the initial & root schemas and the formData
|
|
458
460
|
* and get the destination schema, is required state and optional oneOf/anyOf options for it. If the destination
|
|
459
461
|
* schema was located along with oneOf/anyOf options then a `LayoutMultiSchemaField` will be rendered with the
|
|
460
|
-
* `uiSchema`, `errorSchema`, `
|
|
462
|
+
* `uiSchema`, `errorSchema`, `fieldPathId` and `formData` drilled down to the dotted-path field, spreading any other
|
|
461
463
|
* props from `gridSchema` into the `ui:options`. If the destination schema located without any oneOf/anyOf options,
|
|
462
464
|
* then a `SchemaField` will be rendered with the same props as mentioned in the previous sentence. If no destination
|
|
463
465
|
* schema was located, but a custom render component was found, then it will be rendered with many of the non-event
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LayoutGridField.d.ts","sourceRoot":"","sources":["../../../src/components/fields/LayoutGridField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,EAEL,WAAW,EACX,UAAU,EACV,eAAe,EACf,iBAAiB,
|
|
1
|
+
{"version":3,"file":"LayoutGridField.d.ts","sourceRoot":"","sources":["../../../src/components/fields/LayoutGridField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,EAEL,WAAW,EACX,UAAU,EACV,WAAW,EACX,aAAa,EACb,eAAe,EACf,iBAAiB,EAWjB,UAAU,EACV,QAAQ,EACR,gBAAgB,EAIhB,QAAQ,EAET,MAAM,aAAa,CAAC;AAiBrB;GACG;AACH,oBAAY,QAAQ;IAClB,GAAG,WAAW;IACd,MAAM,WAAW;IACjB,OAAO,eAAe;IACtB,SAAS,iBAAiB;CAC3B;AAED;GACG;AACH,oBAAY,SAAS;IACnB,GAAG,QAAQ;IACX,IAAI,SAAS;IACb,IAAI,SAAS;CACd;AAED,8DAA8D;AAC9D,KAAK,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAExC,MAA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