@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.
Files changed (114) hide show
  1. package/dist/core.umd.js +705 -471
  2. package/dist/{index.js → index.cjs} +1094 -844
  3. package/dist/index.cjs.map +7 -0
  4. package/dist/index.esm.js +1053 -774
  5. package/dist/index.esm.js.map +4 -4
  6. package/lib/components/Form.d.ts +88 -23
  7. package/lib/components/Form.d.ts.map +1 -1
  8. package/lib/components/Form.js +213 -151
  9. package/lib/components/fields/ArrayField.d.ts +17 -7
  10. package/lib/components/fields/ArrayField.d.ts.map +1 -1
  11. package/lib/components/fields/ArrayField.js +116 -70
  12. package/lib/components/fields/BooleanField.d.ts.map +1 -1
  13. package/lib/components/fields/BooleanField.js +7 -2
  14. package/lib/components/fields/LayoutGridField.d.ts +27 -25
  15. package/lib/components/fields/LayoutGridField.d.ts.map +1 -1
  16. package/lib/components/fields/LayoutGridField.js +83 -59
  17. package/lib/components/fields/LayoutHeaderField.d.ts +1 -1
  18. package/lib/components/fields/LayoutHeaderField.js +3 -3
  19. package/lib/components/fields/LayoutMultiSchemaField.js +6 -5
  20. package/lib/components/fields/MultiSchemaField.d.ts.map +1 -1
  21. package/lib/components/fields/MultiSchemaField.js +13 -9
  22. package/lib/components/fields/NullField.js +3 -3
  23. package/lib/components/fields/NumberField.d.ts.map +1 -1
  24. package/lib/components/fields/NumberField.js +3 -3
  25. package/lib/components/fields/ObjectField.d.ts +3 -3
  26. package/lib/components/fields/ObjectField.d.ts.map +1 -1
  27. package/lib/components/fields/ObjectField.js +34 -34
  28. package/lib/components/fields/OptionalDataControlsField.d.ts +8 -0
  29. package/lib/components/fields/OptionalDataControlsField.d.ts.map +1 -0
  30. package/lib/components/fields/OptionalDataControlsField.js +43 -0
  31. package/lib/components/fields/SchemaField.d.ts.map +1 -1
  32. package/lib/components/fields/SchemaField.js +17 -17
  33. package/lib/components/fields/StringField.d.ts.map +1 -1
  34. package/lib/components/fields/StringField.js +7 -2
  35. package/lib/components/fields/index.d.ts.map +1 -1
  36. package/lib/components/fields/index.js +2 -0
  37. package/lib/components/templates/ArrayFieldDescriptionTemplate.d.ts +1 -1
  38. package/lib/components/templates/ArrayFieldDescriptionTemplate.js +3 -3
  39. package/lib/components/templates/ArrayFieldItemButtonsTemplate.js +2 -2
  40. package/lib/components/templates/ArrayFieldTemplate.d.ts.map +1 -1
  41. package/lib/components/templates/ArrayFieldTemplate.js +4 -3
  42. package/lib/components/templates/ArrayFieldTitleTemplate.d.ts +1 -1
  43. package/lib/components/templates/ArrayFieldTitleTemplate.d.ts.map +1 -1
  44. package/lib/components/templates/ArrayFieldTitleTemplate.js +3 -3
  45. package/lib/components/templates/ButtonTemplates/AddButton.d.ts +1 -1
  46. package/lib/components/templates/ButtonTemplates/AddButton.d.ts.map +1 -1
  47. package/lib/components/templates/ButtonTemplates/AddButton.js +2 -2
  48. package/lib/components/templates/FieldErrorTemplate.js +2 -2
  49. package/lib/components/templates/FieldHelpTemplate.js +2 -2
  50. package/lib/components/templates/MultiSchemaFieldTemplate.d.ts +8 -0
  51. package/lib/components/templates/MultiSchemaFieldTemplate.d.ts.map +1 -0
  52. package/lib/components/templates/MultiSchemaFieldTemplate.js +10 -0
  53. package/lib/components/templates/ObjectFieldTemplate.d.ts.map +1 -1
  54. package/lib/components/templates/ObjectFieldTemplate.js +3 -2
  55. package/lib/components/templates/OptionalDataControlsTemplate.d.ts +11 -0
  56. package/lib/components/templates/OptionalDataControlsTemplate.d.ts.map +1 -0
  57. package/lib/components/templates/OptionalDataControlsTemplate.js +20 -0
  58. package/lib/components/templates/TitleField.d.ts.map +1 -1
  59. package/lib/components/templates/TitleField.js +2 -2
  60. package/lib/components/templates/UnsupportedField.js +3 -3
  61. package/lib/components/templates/index.d.ts.map +1 -1
  62. package/lib/components/templates/index.js +4 -0
  63. package/lib/components/widgets/AltDateWidget.d.ts.map +1 -1
  64. package/lib/components/widgets/AltDateWidget.js +15 -18
  65. package/lib/components/widgets/CheckboxesWidget.js +2 -2
  66. package/lib/getDefaultRegistry.d.ts.map +1 -1
  67. package/lib/getDefaultRegistry.js +2 -1
  68. package/lib/getTestRegistry.d.ts +5 -0
  69. package/lib/getTestRegistry.d.ts.map +1 -0
  70. package/lib/getTestRegistry.js +19 -0
  71. package/lib/index.d.ts +2 -1
  72. package/lib/index.d.ts.map +1 -1
  73. package/lib/index.js +2 -1
  74. package/lib/tsconfig.tsbuildinfo +1 -1
  75. package/package.json +18 -19
  76. package/src/components/Form.tsx +306 -177
  77. package/src/components/fields/ArrayField.tsx +127 -80
  78. package/src/components/fields/BooleanField.tsx +12 -3
  79. package/src/components/fields/LayoutGridField.tsx +95 -88
  80. package/src/components/fields/LayoutHeaderField.tsx +3 -3
  81. package/src/components/fields/LayoutMultiSchemaField.tsx +5 -5
  82. package/src/components/fields/MultiSchemaField.tsx +51 -35
  83. package/src/components/fields/NullField.tsx +3 -3
  84. package/src/components/fields/NumberField.tsx +11 -3
  85. package/src/components/fields/ObjectField.tsx +47 -53
  86. package/src/components/fields/OptionalDataControlsField.tsx +84 -0
  87. package/src/components/fields/SchemaField.tsx +24 -30
  88. package/src/components/fields/StringField.tsx +12 -3
  89. package/src/components/fields/index.ts +2 -0
  90. package/src/components/templates/ArrayFieldDescriptionTemplate.tsx +3 -3
  91. package/src/components/templates/ArrayFieldItemButtonsTemplate.tsx +5 -5
  92. package/src/components/templates/ArrayFieldTemplate.tsx +9 -5
  93. package/src/components/templates/ArrayFieldTitleTemplate.tsx +4 -3
  94. package/src/components/templates/BaseInputTemplate.tsx +3 -3
  95. package/src/components/templates/ButtonTemplates/AddButton.tsx +2 -0
  96. package/src/components/templates/FieldErrorTemplate.tsx +2 -2
  97. package/src/components/templates/FieldHelpTemplate.tsx +2 -2
  98. package/src/components/templates/MultiSchemaFieldTemplate.tsx +20 -0
  99. package/src/components/templates/ObjectFieldTemplate.tsx +10 -5
  100. package/src/components/templates/OptionalDataControlsTemplate.tsx +43 -0
  101. package/src/components/templates/TitleField.tsx +6 -1
  102. package/src/components/templates/UnsupportedField.tsx +3 -3
  103. package/src/components/templates/WrapIfAdditionalTemplate.tsx +1 -1
  104. package/src/components/templates/index.ts +4 -0
  105. package/src/components/widgets/AltDateWidget.tsx +21 -23
  106. package/src/components/widgets/CheckboxWidget.tsx +2 -2
  107. package/src/components/widgets/CheckboxesWidget.tsx +3 -3
  108. package/src/components/widgets/RadioWidget.tsx +1 -1
  109. package/src/components/widgets/SelectWidget.tsx +1 -1
  110. package/src/components/widgets/TextareaWidget.tsx +1 -1
  111. package/src/getDefaultRegistry.ts +10 -1
  112. package/src/getTestRegistry.tsx +34 -0
  113. package/src/index.ts +2 -1
  114. package/dist/index.js.map +0 -7
@@ -33,22 +33,23 @@ __export(index_exports, {
33
33
  RichDescription: () => RichDescription,
34
34
  default: () => index_default,
35
35
  getDefaultRegistry: () => getDefaultRegistry,
36
+ getTestRegistry: () => getTestRegistry,
36
37
  withTheme: () => withTheme
37
38
  });
38
39
  module.exports = __toCommonJS(index_exports);
39
40
 
40
41
  // src/components/Form.tsx
41
- var import_react22 = require("react");
42
- var import_utils45 = require("@rjsf/utils");
43
- var import_forEach = __toESM(require("lodash/forEach"), 1);
42
+ var import_react24 = require("react");
43
+ var import_utils46 = require("@rjsf/utils");
44
+ var import_cloneDeep2 = __toESM(require("lodash/cloneDeep"), 1);
44
45
  var import_get6 = __toESM(require("lodash/get"), 1);
45
46
  var import_isEmpty4 = __toESM(require("lodash/isEmpty"), 1);
46
- var import_isNil = __toESM(require("lodash/isNil"), 1);
47
47
  var import_pick = __toESM(require("lodash/pick"), 1);
48
+ var import_set5 = __toESM(require("lodash/set"), 1);
48
49
  var import_toPath = __toESM(require("lodash/toPath"), 1);
49
50
 
50
51
  // src/getDefaultRegistry.ts
51
- var import_utils44 = require("@rjsf/utils");
52
+ var import_utils45 = require("@rjsf/utils");
52
53
 
53
54
  // src/components/fields/ArrayField.tsx
54
55
  var import_react = require("react");
@@ -57,10 +58,10 @@ var import_cloneDeep = __toESM(require("lodash/cloneDeep"), 1);
57
58
  var import_get = __toESM(require("lodash/get"), 1);
58
59
  var import_isObject = __toESM(require("lodash/isObject"), 1);
59
60
  var import_set = __toESM(require("lodash/set"), 1);
60
- var import_nanoid = require("nanoid");
61
+ var import_uniqueId = __toESM(require("lodash/uniqueId"), 1);
61
62
  var import_jsx_runtime = require("react/jsx-runtime");
62
63
  function generateRowId() {
63
- return (0, import_nanoid.nanoid)();
64
+ return (0, import_uniqueId.default)("rjsf-array-item-");
64
65
  }
65
66
  function generateKeyedFormData(formData) {
66
67
  return !Array.isArray(formData) ? [] : formData.map((item) => {
@@ -83,7 +84,7 @@ var ArrayField = class extends import_react.Component {
83
84
  */
84
85
  constructor(props) {
85
86
  super(props);
86
- const { formData = [] } = props;
87
+ const { formData } = props;
87
88
  const keyedFormData = generateKeyedFormData(formData);
88
89
  this.state = {
89
90
  keyedFormData,
@@ -180,7 +181,7 @@ var ArrayField = class extends import_react.Component {
180
181
  if (event) {
181
182
  event.preventDefault();
182
183
  }
183
- const { onChange, errorSchema } = this.props;
184
+ const { onChange, errorSchema, fieldPathId } = this.props;
184
185
  const { keyedFormData } = this.state;
185
186
  let newErrorSchema;
186
187
  if (errorSchema) {
@@ -209,7 +210,8 @@ var ArrayField = class extends import_react.Component {
209
210
  keyedFormData: newKeyedFormData,
210
211
  updatedKeyedFormData: true
211
212
  },
212
- () => onChange(keyedToPlainFormData(newKeyedFormData), newErrorSchema)
213
+ // add click will pass the empty `path` array to the onChange which adds the appropriate path
214
+ () => onChange(keyedToPlainFormData(newKeyedFormData), fieldPathId.path, newErrorSchema)
213
215
  );
214
216
  }
215
217
  /** Callback handler for when the user clicks on the add button. Creates a new row of keyed form data at the end of
@@ -243,7 +245,7 @@ var ArrayField = class extends import_react.Component {
243
245
  if (event) {
244
246
  event.preventDefault();
245
247
  }
246
- const { onChange, errorSchema } = this.props;
248
+ const { onChange, errorSchema, fieldPathId } = this.props;
247
249
  const { keyedFormData } = this.state;
248
250
  let newErrorSchema;
249
251
  if (errorSchema) {
@@ -272,7 +274,7 @@ var ArrayField = class extends import_react.Component {
272
274
  keyedFormData: newKeyedFormData,
273
275
  updatedKeyedFormData: true
274
276
  },
275
- () => onChange(keyedToPlainFormData(newKeyedFormData), newErrorSchema)
277
+ () => onChange(keyedToPlainFormData(newKeyedFormData), fieldPathId.path, newErrorSchema)
276
278
  );
277
279
  };
278
280
  };
@@ -287,7 +289,7 @@ var ArrayField = class extends import_react.Component {
287
289
  if (event) {
288
290
  event.preventDefault();
289
291
  }
290
- const { onChange, errorSchema } = this.props;
292
+ const { onChange, errorSchema, fieldPathId } = this.props;
291
293
  const { keyedFormData } = this.state;
292
294
  let newErrorSchema;
293
295
  if (errorSchema) {
@@ -307,7 +309,7 @@ var ArrayField = class extends import_react.Component {
307
309
  keyedFormData: newKeyedFormData,
308
310
  updatedKeyedFormData: true
309
311
  },
310
- () => onChange(keyedToPlainFormData(newKeyedFormData), newErrorSchema)
312
+ () => onChange(keyedToPlainFormData(newKeyedFormData), fieldPathId.path, newErrorSchema)
311
313
  );
312
314
  };
313
315
  };
@@ -324,7 +326,7 @@ var ArrayField = class extends import_react.Component {
324
326
  event.preventDefault();
325
327
  event.currentTarget.blur();
326
328
  }
327
- const { onChange, errorSchema } = this.props;
329
+ const { onChange, errorSchema, fieldPathId } = this.props;
328
330
  let newErrorSchema;
329
331
  if (errorSchema) {
330
332
  newErrorSchema = {};
@@ -351,7 +353,7 @@ var ArrayField = class extends import_react.Component {
351
353
  {
352
354
  keyedFormData: newKeyedFormData
353
355
  },
354
- () => onChange(keyedToPlainFormData(newKeyedFormData), newErrorSchema)
356
+ () => onChange(keyedToPlainFormData(newKeyedFormData), fieldPathId.path, newErrorSchema)
355
357
  );
356
358
  };
357
359
  };
@@ -361,32 +363,49 @@ var ArrayField = class extends import_react.Component {
361
363
  * @param index - The index of the item being changed
362
364
  */
363
365
  onChangeForIndex = (index) => {
364
- return (value, newErrorSchema, id) => {
365
- const { formData, onChange, errorSchema } = this.props;
366
- const arrayData = Array.isArray(formData) ? formData : [];
367
- const newFormData = arrayData.map((item, i) => {
368
- const jsonValue = typeof value === "undefined" ? null : value;
369
- return index === i ? jsonValue : item;
370
- });
366
+ return (value, path, newErrorSchema, id) => {
367
+ const { onChange } = this.props;
371
368
  onChange(
372
- newFormData,
373
- errorSchema && errorSchema && {
374
- ...errorSchema,
375
- [index]: newErrorSchema
376
- },
369
+ // We need to treat undefined items as nulls to have validation.
370
+ // See https://github.com/tdegrunt/jsonschema/issues/206
371
+ value === void 0 ? null : value,
372
+ path,
373
+ newErrorSchema,
377
374
  id
378
375
  );
379
376
  };
380
377
  };
381
378
  /** Callback handler used to change the value for a checkbox */
382
379
  onSelectChange = (value) => {
383
- const { onChange, idSchema } = this.props;
384
- onChange(value, void 0, idSchema && idSchema.$id);
380
+ const { onChange, fieldPathId } = this.props;
381
+ onChange(value, fieldPathId.path, void 0, fieldPathId && fieldPathId.$id);
385
382
  };
383
+ /** Helper method to compute item UI schema for both normal and fixed arrays
384
+ * Handles both static object and dynamic function cases
385
+ *
386
+ * @param uiSchema - The parent UI schema containing items definition
387
+ * @param item - The item data
388
+ * @param index - The index of the item
389
+ * @param formContext - The form context
390
+ * @returns The computed UI schema for the item
391
+ */
392
+ computeItemUiSchema(uiSchema, item, index, formContext) {
393
+ if (typeof uiSchema.items === "function") {
394
+ try {
395
+ const result = uiSchema.items(item, index, formContext);
396
+ return result;
397
+ } catch (e) {
398
+ console.error(`Error executing dynamic uiSchema.items function for item at index ${index}:`, e);
399
+ return void 0;
400
+ }
401
+ } else {
402
+ return uiSchema.items;
403
+ }
404
+ }
386
405
  /** Renders the `ArrayField` depending on the specific needs of the schema and uischema elements
387
406
  */
388
407
  render() {
389
- const { schema, uiSchema, idSchema, registry } = this.props;
408
+ const { schema, uiSchema, fieldPathId, registry } = this.props;
390
409
  const { schemaUtils, translateString } = registry;
391
410
  if (!(import_utils.ITEMS_KEY in schema)) {
392
411
  const uiOptions = (0, import_utils.getUiOptions)(uiSchema);
@@ -399,7 +418,7 @@ var ArrayField = class extends import_react.Component {
399
418
  UnsupportedFieldTemplate,
400
419
  {
401
420
  schema,
402
- idSchema,
421
+ fieldPathId,
403
422
  reason: translateString(import_utils.TranslatableString.MissingItems),
404
423
  registry
405
424
  }
@@ -426,7 +445,7 @@ var ArrayField = class extends import_react.Component {
426
445
  schema,
427
446
  uiSchema = {},
428
447
  errorSchema,
429
- idSchema,
448
+ fieldPathId,
430
449
  name,
431
450
  title,
432
451
  disabled = false,
@@ -436,27 +455,31 @@ var ArrayField = class extends import_react.Component {
436
455
  registry,
437
456
  onBlur,
438
457
  onFocus,
439
- idPrefix,
440
- idSeparator = "_",
441
458
  rawErrors
442
459
  } = this.props;
443
460
  const { keyedFormData } = this.state;
444
461
  const fieldTitle = schema.title || title || name;
445
- const { schemaUtils, formContext } = registry;
462
+ const { schemaUtils, fields: fields2, formContext, globalFormOptions } = registry;
463
+ const { OptionalDataControlsField: OptionalDataControlsField2 } = fields2;
446
464
  const uiOptions = (0, import_utils.getUiOptions)(uiSchema);
447
465
  const _schemaItems = (0, import_isObject.default)(schema.items) ? schema.items : {};
448
466
  const itemsSchema = schemaUtils.retrieveSchema(_schemaItems);
449
467
  const formData = keyedToPlainFormData(this.state.keyedFormData);
450
- const canAdd = this.canAddItem(formData);
468
+ const renderOptionalField = (0, import_utils.shouldRenderOptionalField)(registry, schema, required, uiSchema);
469
+ const hasFormData = (0, import_utils.isFormDataAvailable)(this.props.formData);
470
+ const canAdd = this.canAddItem(formData) && (!renderOptionalField || hasFormData);
471
+ const actualFormData = hasFormData ? keyedFormData : [];
472
+ const extraClass = renderOptionalField ? " rjsf-optional-array-field" : "";
473
+ const optionalDataControl = renderOptionalField ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(OptionalDataControlsField2, { ...this.props }) : void 0;
451
474
  const arrayProps = {
452
475
  canAdd,
453
- items: keyedFormData.map((keyedItem, index) => {
476
+ items: actualFormData.map((keyedItem, index) => {
454
477
  const { key, item } = keyedItem;
455
478
  const itemCast = item;
456
479
  const itemSchema = schemaUtils.retrieveSchema(_schemaItems, itemCast);
457
480
  const itemErrorSchema = errorSchema ? errorSchema[index] : void 0;
458
- const itemIdPrefix = idSchema.$id + idSeparator + index;
459
- const itemIdSchema = schemaUtils.toIdSchema(itemSchema, itemIdPrefix, itemCast, idPrefix, idSeparator);
481
+ const itemFieldPathId = (0, import_utils.toFieldPathId)(index, globalFormOptions, fieldPathId);
482
+ const itemUiSchema = this.computeItemUiSchema(uiSchema, item, index, formContext);
460
483
  return this.renderArrayFieldItem({
461
484
  key,
462
485
  index,
@@ -466,10 +489,10 @@ var ArrayField = class extends import_react.Component {
466
489
  canMoveUp: index > 0,
467
490
  canMoveDown: index < formData.length - 1,
468
491
  itemSchema,
469
- itemIdSchema,
492
+ itemFieldPathId,
470
493
  itemErrorSchema,
471
494
  itemData: itemCast,
472
- itemUiSchema: uiSchema.items,
495
+ itemUiSchema,
473
496
  autofocus: autofocus && index === 0,
474
497
  onBlur,
475
498
  onFocus,
@@ -477,19 +500,19 @@ var ArrayField = class extends import_react.Component {
477
500
  totalItems: keyedFormData.length
478
501
  });
479
502
  }),
480
- className: `rjsf-field rjsf-field-array rjsf-field-array-of-${itemsSchema.type}`,
503
+ className: `rjsf-field rjsf-field-array rjsf-field-array-of-${itemsSchema.type}${extraClass}`,
481
504
  disabled,
482
- idSchema,
505
+ fieldPathId,
483
506
  uiSchema,
484
507
  onAddClick: this.onAddClick,
485
508
  readonly,
486
509
  required,
487
510
  schema,
488
511
  title: fieldTitle,
489
- formContext,
490
512
  formData,
491
513
  rawErrors,
492
- registry
514
+ registry,
515
+ optionalDataControl
493
516
  };
494
517
  const Template = (0, import_utils.getTemplate)("ArrayFieldTemplate", registry, uiOptions);
495
518
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Template, { ...arrayProps });
@@ -499,7 +522,7 @@ var ArrayField = class extends import_react.Component {
499
522
  renderCustomWidget() {
500
523
  const {
501
524
  schema,
502
- idSchema,
525
+ fieldPathId,
503
526
  uiSchema,
504
527
  disabled = false,
505
528
  readonly = false,
@@ -522,7 +545,7 @@ var ArrayField = class extends import_react.Component {
522
545
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
523
546
  Widget,
524
547
  {
525
- id: idSchema.$id,
548
+ id: fieldPathId.$id,
526
549
  name,
527
550
  multiple: true,
528
551
  onChange: this.onSelectChange,
@@ -551,7 +574,7 @@ var ArrayField = class extends import_react.Component {
551
574
  renderMultiSelect() {
552
575
  const {
553
576
  schema,
554
- idSchema,
577
+ fieldPathId,
555
578
  uiSchema,
556
579
  formData: items = [],
557
580
  disabled = false,
@@ -575,7 +598,7 @@ var ArrayField = class extends import_react.Component {
575
598
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
576
599
  Widget,
577
600
  {
578
- id: idSchema.$id,
601
+ id: fieldPathId.$id,
579
602
  name,
580
603
  multiple: true,
581
604
  onChange: this.onSelectChange,
@@ -604,7 +627,7 @@ var ArrayField = class extends import_react.Component {
604
627
  const {
605
628
  schema,
606
629
  uiSchema,
607
- idSchema,
630
+ fieldPathId,
608
631
  name,
609
632
  disabled = false,
610
633
  readonly = false,
@@ -625,7 +648,7 @@ var ArrayField = class extends import_react.Component {
625
648
  Widget,
626
649
  {
627
650
  options,
628
- id: idSchema.$id,
651
+ id: fieldPathId.$id,
629
652
  name,
630
653
  multiple: true,
631
654
  onChange: this.onSelectChange,
@@ -652,11 +675,9 @@ var ArrayField = class extends import_react.Component {
652
675
  const {
653
676
  schema,
654
677
  uiSchema = {},
655
- formData = [],
678
+ formData,
656
679
  errorSchema,
657
- idPrefix,
658
- idSeparator = "_",
659
- idSchema,
680
+ fieldPathId,
660
681
  name,
661
682
  title,
662
683
  disabled = false,
@@ -668,35 +689,48 @@ var ArrayField = class extends import_react.Component {
668
689
  onFocus,
669
690
  rawErrors
670
691
  } = this.props;
671
- const { keyedFormData } = this.state;
672
692
  let { formData: items = [] } = this.props;
693
+ const { keyedFormData } = this.state;
673
694
  const fieldTitle = schema.title || title || name;
674
695
  const uiOptions = (0, import_utils.getUiOptions)(uiSchema);
675
- const { schemaUtils, formContext } = registry;
696
+ const { schemaUtils, fields: fields2, formContext, globalFormOptions } = registry;
697
+ const { OptionalDataControlsField: OptionalDataControlsField2 } = fields2;
698
+ const renderOptionalField = (0, import_utils.shouldRenderOptionalField)(registry, schema, required, uiSchema);
699
+ const hasFormData = (0, import_utils.isFormDataAvailable)(formData);
676
700
  const _schemaItems = (0, import_isObject.default)(schema.items) ? schema.items : [];
677
701
  const itemSchemas = _schemaItems.map(
678
- (item, index) => schemaUtils.retrieveSchema(item, formData[index])
702
+ (item, index) => schemaUtils.retrieveSchema(item, items[index])
679
703
  );
680
704
  const additionalSchema = (0, import_isObject.default)(schema.additionalItems) ? schemaUtils.retrieveSchema(schema.additionalItems, formData) : null;
681
- if (!items || items.length < itemSchemas.length) {
682
- items = items || [];
705
+ if (items.length < itemSchemas.length) {
683
706
  items = items.concat(new Array(itemSchemas.length - items.length));
684
707
  }
685
- const canAdd = this.canAddItem(items) && !!additionalSchema;
708
+ const actualFormData = hasFormData ? keyedFormData : [];
709
+ const extraClass = renderOptionalField ? " rjsf-optional-array-field" : "";
710
+ const optionalDataControl = renderOptionalField ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(OptionalDataControlsField2, { ...this.props }) : void 0;
711
+ const canAdd = this.canAddItem(items) && !!additionalSchema && (!renderOptionalField || hasFormData);
686
712
  const arrayProps = {
687
713
  canAdd,
688
- className: "rjsf-field rjsf-field-array rjsf-field-array-fixed-items",
714
+ className: `rjsf-field rjsf-field-array rjsf-field-array-fixed-items${extraClass}`,
689
715
  disabled,
690
- idSchema,
716
+ fieldPathId,
691
717
  formData,
692
- items: keyedFormData.map((keyedItem, index) => {
718
+ items: actualFormData.map((keyedItem, index) => {
693
719
  const { key, item } = keyedItem;
694
720
  const itemCast = item;
695
721
  const additional = index >= itemSchemas.length;
696
722
  const itemSchema = (additional && (0, import_isObject.default)(schema.additionalItems) ? schemaUtils.retrieveSchema(schema.additionalItems, itemCast) : itemSchemas[index]) || {};
697
- const itemIdPrefix = idSchema.$id + idSeparator + index;
698
- const itemIdSchema = schemaUtils.toIdSchema(itemSchema, itemIdPrefix, itemCast, idPrefix, idSeparator);
699
- const itemUiSchema = additional ? uiSchema.additionalItems || {} : Array.isArray(uiSchema.items) ? uiSchema.items[index] : uiSchema.items || {};
723
+ const itemFieldPathId = (0, import_utils.toFieldPathId)(index, globalFormOptions, fieldPathId);
724
+ let itemUiSchema;
725
+ if (additional) {
726
+ itemUiSchema = uiSchema.additionalItems;
727
+ } else {
728
+ if (Array.isArray(uiSchema.items)) {
729
+ itemUiSchema = uiSchema.items[index];
730
+ } else {
731
+ itemUiSchema = this.computeItemUiSchema(uiSchema, item, index, formContext);
732
+ }
733
+ }
700
734
  const itemErrorSchema = errorSchema ? errorSchema[index] : void 0;
701
735
  return this.renderArrayFieldItem({
702
736
  key,
@@ -710,7 +744,7 @@ var ArrayField = class extends import_react.Component {
710
744
  itemSchema,
711
745
  itemData: itemCast,
712
746
  itemUiSchema,
713
- itemIdSchema,
747
+ itemFieldPathId,
714
748
  itemErrorSchema,
715
749
  autofocus: autofocus && index === 0,
716
750
  onBlur,
@@ -726,9 +760,9 @@ var ArrayField = class extends import_react.Component {
726
760
  schema,
727
761
  uiSchema,
728
762
  title: fieldTitle,
729
- formContext,
730
763
  errorSchema,
731
- rawErrors
764
+ rawErrors,
765
+ optionalDataControl
732
766
  };
733
767
  const Template = (0, import_utils.getTemplate)("ArrayFieldTemplate", registry, uiOptions);
734
768
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Template, { ...arrayProps });
@@ -750,7 +784,7 @@ var ArrayField = class extends import_react.Component {
750
784
  itemSchema,
751
785
  itemData,
752
786
  itemUiSchema,
753
- itemIdSchema,
787
+ itemFieldPathId,
754
788
  itemErrorSchema,
755
789
  autofocus,
756
790
  onBlur,
@@ -759,7 +793,7 @@ var ArrayField = class extends import_react.Component {
759
793
  totalItems,
760
794
  title
761
795
  } = props;
762
- const { disabled, hideError, idPrefix, idSeparator, readonly, uiSchema, registry, formContext } = this.props;
796
+ const { disabled, hideError, readonly, uiSchema, registry, formContext } = this.props;
763
797
  const {
764
798
  fields: { ArraySchemaField, SchemaField: SchemaField2 },
765
799
  globalUiOptions
@@ -786,9 +820,7 @@ var ArrayField = class extends import_react.Component {
786
820
  formData: itemData,
787
821
  formContext,
788
822
  errorSchema: itemErrorSchema,
789
- idPrefix,
790
- idSeparator,
791
- idSchema: itemIdSchema,
823
+ fieldPathId: itemFieldPathId,
792
824
  required: this.isItemRequired(itemSchema),
793
825
  onChange: this.onChangeForIndex(index),
794
826
  onBlur,
@@ -802,7 +834,7 @@ var ArrayField = class extends import_react.Component {
802
834
  }
803
835
  ),
804
836
  buttonsProps: {
805
- idSchema: itemIdSchema,
837
+ fieldPathId: itemFieldPathId,
806
838
  disabled,
807
839
  readonly,
808
840
  canAdd,
@@ -836,6 +868,7 @@ var ArrayField = class extends import_react.Component {
836
868
  var ArrayField_default = ArrayField;
837
869
 
838
870
  // src/components/fields/BooleanField.tsx
871
+ var import_react2 = require("react");
839
872
  var import_utils2 = require("@rjsf/utils");
840
873
  var import_isObject2 = __toESM(require("lodash/isObject"), 1);
841
874
  var import_jsx_runtime2 = require("react/jsx-runtime");
@@ -844,7 +877,7 @@ function BooleanField(props) {
844
877
  schema,
845
878
  name,
846
879
  uiSchema,
847
- idSchema,
880
+ fieldPathId,
848
881
  formData,
849
882
  registry,
850
883
  required,
@@ -906,15 +939,21 @@ function BooleanField(props) {
906
939
  enumOptions = (0, import_utils2.optionsList)({ enum: enums }, uiSchema);
907
940
  }
908
941
  }
942
+ const onWidgetChange = (0, import_react2.useCallback)(
943
+ (value, errorSchema, id) => {
944
+ return onChange(value, fieldPathId.path, errorSchema, id);
945
+ },
946
+ [onChange, fieldPathId]
947
+ );
909
948
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
910
949
  Widget,
911
950
  {
912
951
  options: { ...options, enumOptions },
913
952
  schema,
914
953
  uiSchema,
915
- id: idSchema.$id,
954
+ id: fieldPathId.$id,
916
955
  name,
917
- onChange,
956
+ onChange: onWidgetChange,
918
957
  onFocus,
919
958
  onBlur,
920
959
  label,
@@ -934,9 +973,8 @@ function BooleanField(props) {
934
973
  var BooleanField_default = BooleanField;
935
974
 
936
975
  // src/components/fields/LayoutGridField.tsx
937
- var import_react2 = require("react");
976
+ var import_react3 = require("react");
938
977
  var import_utils3 = require("@rjsf/utils");
939
- var import_cloneDeep2 = __toESM(require("lodash/cloneDeep"), 1);
940
978
  var import_each = __toESM(require("lodash/each"), 1);
941
979
  var import_flatten = __toESM(require("lodash/flatten"), 1);
942
980
  var import_get2 = __toESM(require("lodash/get"), 1);
@@ -950,17 +988,20 @@ var import_isObject3 = __toESM(require("lodash/isObject"), 1);
950
988
  var import_isPlainObject = __toESM(require("lodash/isPlainObject"), 1);
951
989
  var import_isString = __toESM(require("lodash/isString"), 1);
952
990
  var import_isUndefined = __toESM(require("lodash/isUndefined"), 1);
991
+ var import_last = __toESM(require("lodash/last"), 1);
953
992
  var import_set2 = __toESM(require("lodash/set"), 1);
954
993
  var import_jsx_runtime3 = require("react/jsx-runtime");
955
- var import_react3 = require("react");
994
+ var import_react4 = require("react");
956
995
  var LOOKUP_REGEX = /^\$lookup=(.+)/;
957
996
  var LAYOUT_GRID_UI_OPTION = "layoutGrid";
958
997
  var LAYOUT_GRID_OPTION = `ui:${LAYOUT_GRID_UI_OPTION}`;
959
- var UI_GLOBAL_OPTIONS = "ui:global_options";
960
998
  function getNonNullishValue(value, fallback) {
961
999
  return value ?? fallback;
962
1000
  }
963
- var LayoutGridField = class _LayoutGridField extends import_react2.PureComponent {
1001
+ function isNumericIndex(str) {
1002
+ return /^\d+?$/.test(str);
1003
+ }
1004
+ var LayoutGridField = class _LayoutGridField extends import_react3.PureComponent {
964
1005
  static defaultProps = {
965
1006
  layoutGridSchema: void 0
966
1007
  };
@@ -979,7 +1020,7 @@ var LayoutGridField = class _LayoutGridField extends import_react2.PureComponent
979
1020
  * @param [forceReadonly] - Optional flag indicating whether the Form itself is in readonly mode
980
1021
  */
981
1022
  static computeFieldUiSchema(field, uiProps, uiSchema, schemaReadonly, forceReadonly) {
982
- const globalUiOptions = (0, import_get2.default)(uiSchema, [UI_GLOBAL_OPTIONS], {});
1023
+ const globalUiOptions = (0, import_get2.default)(uiSchema, [import_utils3.UI_GLOBAL_OPTIONS_KEY], {});
983
1024
  const localUiSchema = (0, import_get2.default)(uiSchema, field);
984
1025
  const localUiOptions = { ...(0, import_get2.default)(localUiSchema, [import_utils3.UI_OPTIONS_KEY], {}), ...uiProps, ...globalUiOptions };
985
1026
  const fieldUiSchema = { ...localUiSchema };
@@ -987,7 +1028,7 @@ var LayoutGridField = class _LayoutGridField extends import_react2.PureComponent
987
1028
  (0, import_set2.default)(fieldUiSchema, [import_utils3.UI_OPTIONS_KEY], localUiOptions);
988
1029
  }
989
1030
  if (!(0, import_isEmpty.default)(globalUiOptions)) {
990
- (0, import_set2.default)(fieldUiSchema, [UI_GLOBAL_OPTIONS], globalUiOptions);
1031
+ (0, import_set2.default)(fieldUiSchema, [import_utils3.UI_GLOBAL_OPTIONS_KEY], globalUiOptions);
991
1032
  }
992
1033
  let { readonly: uiReadonly } = (0, import_utils3.getUiOptions)(fieldUiSchema);
993
1034
  if (forceReadonly === true || (0, import_isUndefined.default)(uiReadonly) && schemaReadonly === true) {
@@ -1059,60 +1100,74 @@ var LayoutGridField = class _LayoutGridField extends import_react2.PureComponent
1059
1100
  }
1060
1101
  return { children, gridProps };
1061
1102
  }
1062
- /** Generates an idSchema for the `schema` using `@rjsf`'s `toIdSchema` util, passing the `baseIdSchema`'s `$id` value
1063
- * as the id prefix.
1103
+ /** Computes the `rawSchema` and `fieldPathId` for a `schema` and a `potentialIndex`. If the `schema` is of type array,
1104
+ * has an `ITEMS_KEY` element and `potentialIndex` represents a numeric value, the element at `ITEMS_KEY` is checked
1105
+ * to see if it is an array. If it is AND the `potentialIndex`th element is available, it is used as the `rawSchema`,
1106
+ * otherwise the last value of the element is used. If it is not, then the element is used as the `rawSchema`. In
1107
+ * either case, an `fieldPathId` is computed for the array index. If the `schema` does not represent an array or the
1108
+ * `potentialIndex` is not a numeric value, then `rawSchema` is returned as undefined and given `fieldPathId` is returned
1109
+ * as is.
1064
1110
  *
1065
- * @param schemaUtils - The `SchemaUtilsType` used to call `toIdSchema`
1066
- * @param schema - The schema to generate the idSchema for
1067
- * @param baseIdSchema - The IdSchema for the base
1068
- * @param formData - The formData to pass the `toIdSchema`
1069
- * @param [idSeparator] - The param to pass into the `toIdSchema` util which will use it to join the `idSchema` paths
1070
- * @returns - The generated `idSchema` for the `schema`
1111
+ * @param schema - The schema to generate the fieldPathId for
1112
+ * @param fieldPathId - The FieldPathId for the schema
1113
+ * @param potentialIndex - A string containing a potential index
1114
+ * @returns - An object containing the `rawSchema` and `fieldPathId` of an array item, otherwise an undefined `rawSchema`
1071
1115
  */
1072
- static getIdSchema(schemaUtils, baseIdSchema, formData, schema = {}, idSeparator) {
1073
- const baseId = (0, import_get2.default)(baseIdSchema, import_utils3.ID_KEY);
1074
- return schemaUtils.toIdSchema(schema, baseId, formData, baseId, idSeparator);
1116
+ static computeArraySchemasIfPresent(schema, fieldPathId, potentialIndex) {
1117
+ let rawSchema;
1118
+ if (isNumericIndex(potentialIndex) && schema && schema?.type === "array" && (0, import_has.default)(schema, import_utils3.ITEMS_KEY)) {
1119
+ const index = Number(potentialIndex);
1120
+ const items = schema[import_utils3.ITEMS_KEY];
1121
+ if (Array.isArray(items)) {
1122
+ if (index > items.length) {
1123
+ rawSchema = (0, import_last.default)(items);
1124
+ } else {
1125
+ rawSchema = items[index];
1126
+ }
1127
+ } else {
1128
+ rawSchema = items;
1129
+ }
1130
+ fieldPathId = {
1131
+ [import_utils3.ID_KEY]: fieldPathId[import_utils3.ID_KEY],
1132
+ path: [...fieldPathId.path.slice(0, fieldPathId.path.length - 1), index]
1133
+ };
1134
+ }
1135
+ return { rawSchema, fieldPathId };
1075
1136
  }
1076
1137
  /** Given a `dottedPath` to a field in the `initialSchema`, iterate through each individual path in the schema until
1077
1138
  * the leaf path is found and returned (along with whether that leaf path `isRequired`) OR no schema exists for an
1078
1139
  * element in the path. If the leaf schema element happens to be a oneOf/anyOf then also return the oneOf/anyOf as
1079
1140
  * `options`.
1080
1141
  *
1081
- * @param schemaUtils - The `SchemaUtilsType` used to call `retrieveSchema`
1142
+ * @param registry - The registry
1082
1143
  * @param dottedPath - The dotted-path to the field for which to get the schema
1083
1144
  * @param initialSchema - The initial schema to start the search from
1084
1145
  * @param formData - The formData, useful for resolving a oneOf/anyOf selection in the path hierarchy
1085
- * @param initialIdSchema - The initial idSchema to start the search from
1086
- * @param [idSeparator] - The param to pass into the `toIdSchema` util which will use it to join the `idSchema` paths
1146
+ * @param initialFieldIdPath - The initial fieldPathId to start the search from
1087
1147
  * @returns - An object containing the destination schema, isRequired and isReadonly flags for the field and options
1088
1148
  * info if a oneOf/anyOf
1089
1149
  */
1090
- static getSchemaDetailsForField(schemaUtils, dottedPath, initialSchema, formData, initialIdSchema, idSeparator) {
1150
+ static getSchemaDetailsForField(registry, dottedPath, initialSchema, formData, initialFieldIdPath) {
1151
+ const { schemaUtils, globalFormOptions } = registry;
1091
1152
  let rawSchema = initialSchema;
1092
- let idSchema = initialIdSchema;
1153
+ let fieldPathId = initialFieldIdPath;
1093
1154
  const parts = dottedPath.split(".");
1094
1155
  const leafPath = parts.pop();
1095
1156
  let schema = schemaUtils.retrieveSchema(rawSchema, formData);
1096
1157
  let innerData = formData;
1097
1158
  let isReadonly = schema.readOnly;
1098
1159
  parts.forEach((part) => {
1160
+ fieldPathId = (0, import_utils3.toFieldPathId)(part, globalFormOptions, fieldPathId);
1099
1161
  if ((0, import_has.default)(schema, import_utils3.PROPERTIES_KEY)) {
1100
1162
  rawSchema = (0, import_get2.default)(schema, [import_utils3.PROPERTIES_KEY, part], {});
1101
- idSchema = (0, import_get2.default)(idSchema, part, {});
1102
1163
  } else if (schema && ((0, import_has.default)(schema, import_utils3.ONE_OF_KEY) || (0, import_has.default)(schema, import_utils3.ANY_OF_KEY))) {
1103
1164
  const xxx = (0, import_has.default)(schema, import_utils3.ONE_OF_KEY) ? import_utils3.ONE_OF_KEY : import_utils3.ANY_OF_KEY;
1104
1165
  const selectedSchema = schemaUtils.findSelectedOptionInXxxOf(schema, part, xxx, innerData);
1105
- const selectedIdSchema = _LayoutGridField.getIdSchema(
1106
- schemaUtils,
1107
- idSchema,
1108
- formData,
1109
- selectedSchema,
1110
- idSeparator
1111
- );
1112
1166
  rawSchema = (0, import_get2.default)(selectedSchema, [import_utils3.PROPERTIES_KEY, part], {});
1113
- idSchema = (0, import_get2.default)(selectedIdSchema, part, {});
1114
1167
  } else {
1115
- rawSchema = {};
1168
+ const result = _LayoutGridField.computeArraySchemasIfPresent(schema, fieldPathId, part);
1169
+ rawSchema = result.rawSchema ?? {};
1170
+ fieldPathId = result.fieldPathId;
1116
1171
  }
1117
1172
  innerData = (0, import_get2.default)(innerData, part, {});
1118
1173
  schema = schemaUtils.retrieveSchema(rawSchema, innerData);
@@ -1127,13 +1182,17 @@ var LayoutGridField = class _LayoutGridField extends import_react2.PureComponent
1127
1182
  if (schema && ((0, import_has.default)(schema, import_utils3.ONE_OF_KEY) || (0, import_has.default)(schema, import_utils3.ANY_OF_KEY))) {
1128
1183
  const xxx = (0, import_has.default)(schema, import_utils3.ONE_OF_KEY) ? import_utils3.ONE_OF_KEY : import_utils3.ANY_OF_KEY;
1129
1184
  schema = schemaUtils.findSelectedOptionInXxxOf(schema, leafPath, xxx, innerData);
1130
- const rawIdSchema = _LayoutGridField.getIdSchema(schemaUtils, idSchema, formData, schema, idSeparator);
1131
- idSchema = (0, import_utils3.mergeObjects)(rawIdSchema, idSchema);
1132
1185
  }
1186
+ fieldPathId = (0, import_utils3.toFieldPathId)(leafPath, globalFormOptions, fieldPathId);
1133
1187
  isRequired = schema !== void 0 && Array.isArray(schema.required) && (0, import_includes.default)(schema.required, leafPath);
1134
- schema = (0, import_get2.default)(schema, [import_utils3.PROPERTIES_KEY, leafPath]);
1135
- schema = schema ? schemaUtils.retrieveSchema(schema) : schema;
1136
- idSchema = (0, import_get2.default)(idSchema, leafPath, {});
1188
+ const result = _LayoutGridField.computeArraySchemasIfPresent(schema, fieldPathId, leafPath);
1189
+ if (result.rawSchema) {
1190
+ schema = result.rawSchema;
1191
+ fieldPathId = result.fieldPathId;
1192
+ } else {
1193
+ schema = (0, import_get2.default)(schema, [import_utils3.PROPERTIES_KEY, leafPath]);
1194
+ schema = schema ? schemaUtils.retrieveSchema(schema) : schema;
1195
+ }
1137
1196
  isReadonly = getNonNullishValue(schema?.readOnly, isReadonly);
1138
1197
  if (schema && ((0, import_has.default)(schema, import_utils3.ONE_OF_KEY) || (0, import_has.default)(schema, import_utils3.ANY_OF_KEY))) {
1139
1198
  const xxx = (0, import_has.default)(schema, import_utils3.ONE_OF_KEY) ? import_utils3.ONE_OF_KEY : import_utils3.ANY_OF_KEY;
@@ -1141,7 +1200,7 @@ var LayoutGridField = class _LayoutGridField extends import_react2.PureComponent
1141
1200
  optionsInfo = { options: schema[xxx], hasDiscriminator: !!discriminator };
1142
1201
  }
1143
1202
  }
1144
- return { schema, isRequired, isReadonly, optionsInfo, idSchema };
1203
+ return { schema, isRequired, isReadonly, optionsInfo, fieldPathId };
1145
1204
  }
1146
1205
  /** Gets the custom render component from the `render`, by either determining that it is either already a function or
1147
1206
  * it is a non-function value that can be used to look up the function in the registry. If no function can be found,
@@ -1177,7 +1236,7 @@ var LayoutGridField = class _LayoutGridField extends import_react2.PureComponent
1177
1236
  if ((0, import_isString.default)(gridSchema) || (0, import_isUndefined.default)(gridSchema)) {
1178
1237
  name = gridSchema ?? "";
1179
1238
  } else {
1180
- const { name: innerName, render, ...innerProps } = gridSchema;
1239
+ const { name: innerName = "", render, ...innerProps } = gridSchema;
1181
1240
  name = innerName;
1182
1241
  uiProps = innerProps;
1183
1242
  if (!(0, import_isEmpty.default)(uiProps)) {
@@ -1210,19 +1269,12 @@ var LayoutGridField = class _LayoutGridField extends import_react2.PureComponent
1210
1269
  * elements, they will then be passed on to the `onChange` handler of the `LayoutFieldGrid`.
1211
1270
  *
1212
1271
  * @param dottedPath - The dotted-path to the field for which to generate the onChange handler
1213
- * @returns - The `onChange` handling function for the `dottedPath` field
1272
+ * @returns - The `onChange` handling function for the `dottedPath` field of the `schemaType` type
1214
1273
  */
1215
1274
  onFieldChange = (dottedPath) => {
1216
- return (value, errSchema, id) => {
1217
- const { onChange, errorSchema, formData } = this.props;
1218
- const newFormData = (0, import_cloneDeep2.default)(formData || {});
1219
- let newErrorSchema = errorSchema;
1220
- if (errSchema && errorSchema) {
1221
- newErrorSchema = (0, import_cloneDeep2.default)(errorSchema);
1222
- (0, import_set2.default)(newErrorSchema, dottedPath, errSchema);
1223
- }
1224
- (0, import_set2.default)(newFormData, dottedPath, value);
1225
- onChange(newFormData, newErrorSchema, id);
1275
+ return (value, path, errSchema, id) => {
1276
+ const { onChange } = this.props;
1277
+ onChange(value, path, errSchema, id);
1226
1278
  };
1227
1279
  };
1228
1280
  /** Renders the `children` of the `GridType.CONDITION` if it passes. The `layoutGridSchema` for the
@@ -1310,20 +1362,20 @@ var LayoutGridField = class _LayoutGridField extends import_react2.PureComponent
1310
1362
  const GridTemplate2 = (0, import_utils3.getTemplate)("GridTemplate", registry, uiOptions);
1311
1363
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(GridTemplate2, { ...gridProps, "data-testid": _LayoutGridField.TEST_IDS.row, children: this.renderChildren(children) });
1312
1364
  }
1313
- /** Iterates through all the `childrenLayoutGridSchema`, rendering a nested `LayoutGridField` for each item in the
1365
+ /** Iterates through all the `childrenLayoutGrfieldPathId`, rendering a nested `LayoutGridField` for each item in the
1314
1366
  * list, passing all the props for the current `LayoutGridField` along, updating the `schema` by calling
1315
1367
  * `retrieveSchema()` on it to resolve any `$ref`s. In addition to the updated `schema`, each item in
1316
- * `childrenLayoutGridSchema` is passed as `layoutGridSchema`.
1368
+ * `childrenLayoutGrfieldPathId` is passed as `layoutGridSchema`.
1317
1369
  *
1318
- * @param childrenLayoutGridSchema - The list of strings or objects that represents the configurations for the
1370
+ * @param childrenLayoutGrfieldPathId - The list of strings or objects that represents the configurations for the
1319
1371
  * children fields
1320
1372
  * @returns - The nested `LayoutGridField`s
1321
1373
  */
1322
- renderChildren(childrenLayoutGridSchema) {
1374
+ renderChildren(childrenLayoutGrfieldPathId) {
1323
1375
  const { registry, schema: rawSchema, formData } = this.props;
1324
1376
  const { schemaUtils } = registry;
1325
1377
  const schema = schemaUtils.retrieveSchema(rawSchema, formData);
1326
- return childrenLayoutGridSchema.map((layoutGridSchema) => /* @__PURE__ */ (0, import_react3.createElement)(
1378
+ return childrenLayoutGrfieldPathId.map((layoutGridSchema) => /* @__PURE__ */ (0, import_react4.createElement)(
1327
1379
  _LayoutGridField,
1328
1380
  {
1329
1381
  ...this.props,
@@ -1339,7 +1391,7 @@ var LayoutGridField = class _LayoutGridField extends import_react2.PureComponent
1339
1391
  * specified props for that component. If `name` exists, we take the name, the initial & root schemas and the formData
1340
1392
  * and get the destination schema, is required state and optional oneOf/anyOf options for it. If the destination
1341
1393
  * schema was located along with oneOf/anyOf options then a `LayoutMultiSchemaField` will be rendered with the
1342
- * `uiSchema`, `errorSchema`, `idSchema` and `formData` drilled down to the dotted-path field, spreading any other
1394
+ * `uiSchema`, `errorSchema`, `fieldPathId` and `formData` drilled down to the dotted-path field, spreading any other
1343
1395
  * props from `gridSchema` into the `ui:options`. If the destination schema located without any oneOf/anyOf options,
1344
1396
  * then a `SchemaField` will be rendered with the same props as mentioned in the previous sentence. If no destination
1345
1397
  * schema was located, but a custom render component was found, then it will be rendered with many of the non-event
@@ -1353,18 +1405,17 @@ var LayoutGridField = class _LayoutGridField extends import_react2.PureComponent
1353
1405
  schema: initialSchema,
1354
1406
  uiSchema,
1355
1407
  errorSchema,
1356
- idSchema,
1408
+ fieldPathId,
1357
1409
  onBlur,
1358
1410
  onFocus,
1359
1411
  formData,
1360
1412
  readonly,
1361
1413
  registry,
1362
- idSeparator,
1363
1414
  layoutGridSchema,
1364
1415
  // Used to pull this out of otherProps since we don't want to pass it through
1365
1416
  ...otherProps
1366
1417
  } = this.props;
1367
- const { fields: fields2, schemaUtils } = registry;
1418
+ const { fields: fields2 } = registry;
1368
1419
  const { SchemaField: SchemaField2, LayoutMultiSchemaField: LayoutMultiSchemaField2 } = fields2;
1369
1420
  const uiComponentProps = _LayoutGridField.computeUIComponentPropsFromGridSchema(registry, gridSchema);
1370
1421
  if (uiComponentProps.rendered) {
@@ -1376,15 +1427,8 @@ var LayoutGridField = class _LayoutGridField extends import_react2.PureComponent
1376
1427
  isRequired,
1377
1428
  isReadonly,
1378
1429
  optionsInfo,
1379
- idSchema: fieldIdSchema
1380
- } = _LayoutGridField.getSchemaDetailsForField(
1381
- schemaUtils,
1382
- name,
1383
- initialSchema,
1384
- formData,
1385
- idSchema,
1386
- idSeparator
1387
- );
1430
+ fieldPathId: fieldIdSchema
1431
+ } = _LayoutGridField.getSchemaDetailsForField(registry, name, initialSchema, formData, fieldPathId);
1388
1432
  if (schema) {
1389
1433
  const Field = optionsInfo?.hasDiscriminator ? LayoutMultiSchemaField2 : SchemaField2;
1390
1434
  const { fieldUiSchema, uiReadonly } = _LayoutGridField.computeFieldUiSchema(
@@ -1405,8 +1449,7 @@ var LayoutGridField = class _LayoutGridField extends import_react2.PureComponent
1405
1449
  schema,
1406
1450
  uiSchema: fieldUiSchema,
1407
1451
  errorSchema: (0, import_get2.default)(errorSchema, name),
1408
- idSchema: fieldIdSchema,
1409
- idSeparator,
1452
+ fieldPathId: fieldIdSchema,
1410
1453
  formData: (0, import_get2.default)(formData, name),
1411
1454
  onChange: this.onFieldChange(name),
1412
1455
  onBlur,
@@ -1429,8 +1472,7 @@ var LayoutGridField = class _LayoutGridField extends import_react2.PureComponent
1429
1472
  errorSchema,
1430
1473
  uiSchema,
1431
1474
  schema: initialSchema,
1432
- idSchema,
1433
- idSeparator,
1475
+ fieldPathId,
1434
1476
  onBlur,
1435
1477
  onFocus,
1436
1478
  registry,
@@ -1476,7 +1518,7 @@ var LayoutGridField = class _LayoutGridField extends import_react2.PureComponent
1476
1518
  var import_utils4 = require("@rjsf/utils");
1477
1519
  var import_jsx_runtime4 = require("react/jsx-runtime");
1478
1520
  function LayoutHeaderField(props) {
1479
- const { idSchema, title, schema, uiSchema, required, registry, name } = props;
1521
+ const { fieldPathId, title, schema, uiSchema, required, registry, name } = props;
1480
1522
  const options = (0, import_utils4.getUiOptions)(uiSchema, registry.globalUiOptions);
1481
1523
  const { title: uiTitle } = options;
1482
1524
  const { title: schemaTitle } = schema;
@@ -1492,7 +1534,7 @@ function LayoutHeaderField(props) {
1492
1534
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1493
1535
  TitleFieldTemplate,
1494
1536
  {
1495
- id: (0, import_utils4.titleId)(idSchema),
1537
+ id: (0, import_utils4.titleId)(fieldPathId),
1496
1538
  title: fieldTitle,
1497
1539
  required,
1498
1540
  schema,
@@ -1503,7 +1545,7 @@ function LayoutHeaderField(props) {
1503
1545
  }
1504
1546
 
1505
1547
  // src/components/fields/LayoutMultiSchemaField.tsx
1506
- var import_react4 = require("react");
1548
+ var import_react5 = require("react");
1507
1549
  var import_utils5 = require("@rjsf/utils");
1508
1550
  var import_get3 = __toESM(require("lodash/get"), 1);
1509
1551
  var import_has2 = __toESM(require("lodash/has"), 1);
@@ -1541,7 +1583,7 @@ function LayoutMultiSchemaField(props) {
1541
1583
  baseType,
1542
1584
  disabled = false,
1543
1585
  formData,
1544
- idSchema,
1586
+ fieldPathId,
1545
1587
  onBlur,
1546
1588
  onChange,
1547
1589
  options,
@@ -1557,8 +1599,8 @@ function LayoutMultiSchemaField(props) {
1557
1599
  hideError = false
1558
1600
  } = props;
1559
1601
  const { widgets: widgets2, schemaUtils, globalUiOptions } = registry;
1560
- const [enumOptions, setEnumOptions] = (0, import_react4.useState)(computeEnumOptions(schema, options, schemaUtils, uiSchema, formData));
1561
- const id = (0, import_get3.default)(idSchema, import_utils5.ID_KEY);
1602
+ const [enumOptions, setEnumOptions] = (0, import_react5.useState)(computeEnumOptions(schema, options, schemaUtils, uiSchema, formData));
1603
+ const id = (0, import_get3.default)(fieldPathId, import_utils5.ID_KEY);
1562
1604
  const discriminator = (0, import_utils5.getDiscriminatorFieldFromSchema)(schema);
1563
1605
  const FieldErrorTemplate2 = (0, import_utils5.getTemplate)("FieldErrorTemplate", registry, options);
1564
1606
  const FieldTemplate2 = (0, import_utils5.getTemplate)("FieldTemplate", registry, options);
@@ -1566,7 +1608,7 @@ function LayoutMultiSchemaField(props) {
1566
1608
  const optionsHash = (0, import_utils5.hashObject)(options);
1567
1609
  const uiSchemaHash = uiSchema ? (0, import_utils5.hashObject)(uiSchema) : "";
1568
1610
  const formDataHash = formData ? (0, import_utils5.hashObject)(formData) : "";
1569
- (0, import_react4.useEffect)(() => {
1611
+ (0, import_react5.useEffect)(() => {
1570
1612
  setEnumOptions(computeEnumOptions(schema, options, schemaUtils, uiSchema, formData));
1571
1613
  }, [schemaHash, optionsHash, schemaUtils, uiSchemaHash, formDataHash]);
1572
1614
  const {
@@ -1599,10 +1641,10 @@ function LayoutMultiSchemaField(props) {
1599
1641
  if (newFormData) {
1600
1642
  (0, import_set3.default)(newFormData, selectorField, opt);
1601
1643
  }
1602
- onChange(newFormData, void 0, id);
1644
+ onChange(newFormData, fieldPathId.path, void 0, id);
1603
1645
  };
1604
1646
  const widgetOptions = { enumOptions, ...uiOptions };
1605
- const errors = !hideFieldError && rawErrors.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FieldErrorTemplate2, { idSchema, schema, errors: rawErrors, registry }) : void 0;
1647
+ const errors = !hideFieldError && rawErrors.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FieldErrorTemplate2, { fieldPathId, schema, errors: rawErrors, registry }) : void 0;
1606
1648
  const ignored = (value) => import_noop.default;
1607
1649
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1608
1650
  FieldTemplate2,
@@ -1612,7 +1654,6 @@ function LayoutMultiSchemaField(props) {
1612
1654
  label: (title || schema.title) ?? "",
1613
1655
  disabled: disabled || Array.isArray(enumOptions) && (0, import_isEmpty2.default)(enumOptions),
1614
1656
  uiSchema,
1615
- formContext,
1616
1657
  required,
1617
1658
  readonly: !!readonly,
1618
1659
  registry,
@@ -1653,13 +1694,13 @@ function LayoutMultiSchemaField(props) {
1653
1694
  }
1654
1695
 
1655
1696
  // src/components/fields/MultiSchemaField.tsx
1656
- var import_react5 = require("react");
1697
+ var import_react6 = require("react");
1657
1698
  var import_get4 = __toESM(require("lodash/get"), 1);
1658
1699
  var import_isEmpty3 = __toESM(require("lodash/isEmpty"), 1);
1659
1700
  var import_omit2 = __toESM(require("lodash/omit"), 1);
1660
1701
  var import_utils6 = require("@rjsf/utils");
1661
1702
  var import_jsx_runtime6 = require("react/jsx-runtime");
1662
- var AnyOfField = class extends import_react5.Component {
1703
+ var AnyOfField = class extends import_react6.Component {
1663
1704
  /** Constructs an `AnyOfField` with the given `props` to initialize the initially selected option in state
1664
1705
  *
1665
1706
  * @param props - The `FieldProps` for this template
@@ -1684,7 +1725,7 @@ var AnyOfField = class extends import_react5.Component {
1684
1725
  * @param prevState - The previous `AnyOfFieldState` for this template
1685
1726
  */
1686
1727
  componentDidUpdate(prevProps, prevState) {
1687
- const { formData, options, idSchema } = this.props;
1728
+ const { formData, options, fieldPathId } = this.props;
1688
1729
  const { selectedOption } = this.state;
1689
1730
  let newState = this.state;
1690
1731
  if (!(0, import_utils6.deepEquals)(prevProps.options, options)) {
@@ -1694,7 +1735,7 @@ var AnyOfField = class extends import_react5.Component {
1694
1735
  const retrievedOptions = options.map((opt) => schemaUtils.retrieveSchema(opt, formData));
1695
1736
  newState = { selectedOption, retrievedOptions };
1696
1737
  }
1697
- if (!(0, import_utils6.deepEquals)(formData, prevProps.formData) && idSchema.$id === prevProps.idSchema.$id) {
1738
+ if (!(0, import_utils6.deepEquals)(formData, prevProps.formData) && fieldPathId.$id === prevProps.fieldPathId.$id) {
1698
1739
  const { retrievedOptions } = newState;
1699
1740
  const matchingOption = this.getMatchingOption(selectedOption, formData, retrievedOptions);
1700
1741
  if (prevState && matchingOption !== selectedOption) {
@@ -1728,7 +1769,7 @@ var AnyOfField = class extends import_react5.Component {
1728
1769
  */
1729
1770
  onOptionChange = (option) => {
1730
1771
  const { selectedOption, retrievedOptions } = this.state;
1731
- const { formData, onChange, registry } = this.props;
1772
+ const { formData, onChange, registry, fieldPathId } = this.props;
1732
1773
  const { schemaUtils } = registry;
1733
1774
  const intOption = option !== void 0 ? parseInt(option, 10) : -1;
1734
1775
  if (intOption === selectedOption) {
@@ -1741,12 +1782,12 @@ var AnyOfField = class extends import_react5.Component {
1741
1782
  newFormData = schemaUtils.getDefaultFormState(newOption, newFormData, "excludeObjectChildren");
1742
1783
  }
1743
1784
  this.setState({ selectedOption: intOption }, () => {
1744
- onChange(newFormData, void 0, this.getFieldId());
1785
+ onChange(newFormData, fieldPathId.path, void 0, this.getFieldId());
1745
1786
  });
1746
1787
  };
1747
1788
  getFieldId() {
1748
- const { idSchema, schema } = this.props;
1749
- return `${idSchema.$id}${schema.oneOf ? "__oneof_select" : "__anyof_select"}`;
1789
+ const { fieldPathId, schema } = this.props;
1790
+ return `${fieldPathId.$id}${schema.oneOf ? "__oneof_select" : "__anyof_select"}`;
1750
1791
  }
1751
1792
  /** Renders the `AnyOfField` selector along with a `SchemaField` for the value of the `formData`
1752
1793
  */
@@ -1765,6 +1806,11 @@ var AnyOfField = class extends import_react5.Component {
1765
1806
  } = this.props;
1766
1807
  const { widgets: widgets2, fields: fields2, translateString, globalUiOptions, schemaUtils } = registry;
1767
1808
  const { SchemaField: _SchemaField } = fields2;
1809
+ const MultiSchemaFieldTemplate2 = (0, import_utils6.getTemplate)(
1810
+ "MultiSchemaFieldTemplate",
1811
+ registry,
1812
+ globalUiOptions
1813
+ );
1768
1814
  const { selectedOption, retrievedOptions } = this.state;
1769
1815
  const {
1770
1816
  widget = "select",
@@ -1811,57 +1857,65 @@ var AnyOfField = class extends import_react5.Component {
1811
1857
  value: index
1812
1858
  };
1813
1859
  });
1814
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "panel panel-default panel-body", children: [
1815
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "form-group", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1816
- Widget,
1817
- {
1818
- id: this.getFieldId(),
1819
- name: `${name}${schema.oneOf ? "__oneof_select" : "__anyof_select"}`,
1820
- schema: { type: "number", default: 0 },
1821
- onChange: this.onOptionChange,
1822
- onBlur,
1823
- onFocus,
1824
- disabled: disabled || (0, import_isEmpty3.default)(enumOptions),
1825
- multiple: false,
1826
- rawErrors,
1827
- errorSchema: fieldErrorSchema,
1828
- value: selectedOption >= 0 ? selectedOption : void 0,
1829
- options: { enumOptions, ...uiOptions },
1830
- registry,
1831
- formContext,
1832
- placeholder,
1833
- autocomplete,
1834
- autofocus,
1835
- label: title ?? name,
1836
- hideLabel: !displayLabel,
1837
- readonly
1838
- }
1839
- ) }),
1840
- optionSchema && optionSchema.type !== "null" && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(_SchemaField, { ...this.props, schema: optionSchema, uiSchema: optionUiSchema })
1841
- ] });
1860
+ const selector = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1861
+ Widget,
1862
+ {
1863
+ id: this.getFieldId(),
1864
+ name: `${name}${schema.oneOf ? "__oneof_select" : "__anyof_select"}`,
1865
+ schema: { type: "number", default: 0 },
1866
+ onChange: this.onOptionChange,
1867
+ onBlur,
1868
+ onFocus,
1869
+ disabled: disabled || (0, import_isEmpty3.default)(enumOptions),
1870
+ multiple: false,
1871
+ rawErrors,
1872
+ errorSchema: fieldErrorSchema,
1873
+ value: selectedOption >= 0 ? selectedOption : void 0,
1874
+ options: { enumOptions, ...uiOptions },
1875
+ registry,
1876
+ formContext,
1877
+ placeholder,
1878
+ autocomplete,
1879
+ autofocus,
1880
+ label: title ?? name,
1881
+ hideLabel: !displayLabel,
1882
+ readonly
1883
+ }
1884
+ );
1885
+ const optionsSchemaField = optionSchema && optionSchema.type !== "null" && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(_SchemaField, { ...this.props, schema: optionSchema, uiSchema: optionUiSchema }) || null;
1886
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1887
+ MultiSchemaFieldTemplate2,
1888
+ {
1889
+ schema,
1890
+ registry,
1891
+ uiSchema,
1892
+ selector,
1893
+ optionSchemaField: optionsSchemaField
1894
+ }
1895
+ );
1842
1896
  }
1843
1897
  };
1844
1898
  var MultiSchemaField_default = AnyOfField;
1845
1899
 
1846
1900
  // src/components/fields/NumberField.tsx
1847
- var import_react6 = require("react");
1901
+ var import_react7 = require("react");
1848
1902
  var import_utils7 = require("@rjsf/utils");
1849
1903
  var import_jsx_runtime7 = require("react/jsx-runtime");
1850
1904
  var trailingCharMatcherWithPrefix = /\.([0-9]*0)*$/;
1851
1905
  var trailingCharMatcher = /[0.]0*$/;
1852
1906
  function NumberField(props) {
1853
1907
  const { registry, onChange, formData, value: initialValue } = props;
1854
- const [lastValue, setLastValue] = (0, import_react6.useState)(initialValue);
1908
+ const [lastValue, setLastValue] = (0, import_react7.useState)(initialValue);
1855
1909
  const { StringField: StringField2 } = registry.fields;
1856
1910
  let value = formData;
1857
- const handleChange = (0, import_react6.useCallback)(
1858
- (value2, errorSchema, id) => {
1911
+ const handleChange = (0, import_react7.useCallback)(
1912
+ (value2, path, errorSchema, id) => {
1859
1913
  setLastValue(value2);
1860
1914
  if (`${value2}`.charAt(0) === ".") {
1861
1915
  value2 = `0${value2}`;
1862
1916
  }
1863
1917
  const processed = typeof value2 === "string" && value2.match(trailingCharMatcherWithPrefix) ? (0, import_utils7.asNumber)(value2.replace(trailingCharMatcher, "")) : (0, import_utils7.asNumber)(value2);
1864
- onChange(processed, errorSchema, id);
1918
+ onChange(processed, path, errorSchema, id);
1865
1919
  },
1866
1920
  [onChange]
1867
1921
  );
@@ -1876,7 +1930,7 @@ function NumberField(props) {
1876
1930
  var NumberField_default = NumberField;
1877
1931
 
1878
1932
  // src/components/fields/ObjectField.tsx
1879
- var import_react7 = require("react");
1933
+ var import_react8 = require("react");
1880
1934
  var import_utils8 = require("@rjsf/utils");
1881
1935
  var import_markdown_to_jsx = __toESM(require("markdown-to-jsx"), 1);
1882
1936
  var import_get5 = __toESM(require("lodash/get"), 1);
@@ -1885,7 +1939,7 @@ var import_isObject4 = __toESM(require("lodash/isObject"), 1);
1885
1939
  var import_set4 = __toESM(require("lodash/set"), 1);
1886
1940
  var import_unset = __toESM(require("lodash/unset"), 1);
1887
1941
  var import_jsx_runtime8 = require("react/jsx-runtime");
1888
- var ObjectField = class extends import_react7.Component {
1942
+ var ObjectField = class extends import_react8.Component {
1889
1943
  /** Set up the initial state */
1890
1944
  state = {
1891
1945
  wasPropertyKeyModified: false,
@@ -1909,20 +1963,12 @@ var ObjectField = class extends import_react7.Component {
1909
1963
  * @returns - The onPropertyChange callback for the `name` property
1910
1964
  */
1911
1965
  onPropertyChange = (name, addedByAdditionalProperties = false) => {
1912
- return (value, newErrorSchema, id) => {
1913
- const { formData, onChange, errorSchema } = this.props;
1966
+ return (value, path, newErrorSchema, id) => {
1967
+ const { onChange } = this.props;
1914
1968
  if (value === void 0 && addedByAdditionalProperties) {
1915
1969
  value = "";
1916
1970
  }
1917
- const newFormData = { ...formData, [name]: value };
1918
- onChange(
1919
- newFormData,
1920
- errorSchema && errorSchema && {
1921
- ...errorSchema,
1922
- [name]: newErrorSchema
1923
- },
1924
- id
1925
- );
1971
+ onChange(value, path, newErrorSchema, id);
1926
1972
  };
1927
1973
  };
1928
1974
  /** Returns a callback to handle the onDropPropertyClick event for the given `key` which removes the old `key` data
@@ -1934,10 +1980,10 @@ var ObjectField = class extends import_react7.Component {
1934
1980
  onDropPropertyClick = (key) => {
1935
1981
  return (event) => {
1936
1982
  event.preventDefault();
1937
- const { onChange, formData } = this.props;
1983
+ const { onChange, formData, fieldPathId } = this.props;
1938
1984
  const copiedFormData = { ...formData };
1939
1985
  (0, import_unset.default)(copiedFormData, key);
1940
- onChange(copiedFormData);
1986
+ onChange(copiedFormData, fieldPathId.path);
1941
1987
  };
1942
1988
  };
1943
1989
  /** Computes the next available key name from the `preferredKey`, indexing through the already existing keys until one
@@ -1964,11 +2010,11 @@ var ObjectField = class extends import_react7.Component {
1964
2010
  * @returns - The key change callback function
1965
2011
  */
1966
2012
  onKeyChange = (oldValue) => {
1967
- return (value, newErrorSchema) => {
2013
+ return (value) => {
1968
2014
  if (oldValue === value) {
1969
2015
  return;
1970
2016
  }
1971
- const { formData, onChange, errorSchema } = this.props;
2017
+ const { formData, onChange, fieldPathId } = this.props;
1972
2018
  value = this.getAvailableKey(value, formData);
1973
2019
  const newFormData = {
1974
2020
  ...formData
@@ -1980,13 +2026,7 @@ var ObjectField = class extends import_react7.Component {
1980
2026
  });
1981
2027
  const renamedObj = Object.assign({}, ...keyValues);
1982
2028
  this.setState({ wasPropertyKeyModified: true });
1983
- onChange(
1984
- renamedObj,
1985
- errorSchema && errorSchema && {
1986
- ...errorSchema,
1987
- [value]: newErrorSchema
1988
- }
1989
- );
2029
+ onChange(renamedObj, fieldPathId.path);
1990
2030
  };
1991
2031
  };
1992
2032
  /** Returns a default value to be used for a new additional schema property of the given `type`
@@ -2022,7 +2062,7 @@ var ObjectField = class extends import_react7.Component {
2022
2062
  if (!(schema.additionalProperties || schema.patternProperties)) {
2023
2063
  return;
2024
2064
  }
2025
- const { formData, onChange, registry } = this.props;
2065
+ const { formData, onChange, registry, fieldPathId } = this.props;
2026
2066
  const newFormData = { ...formData };
2027
2067
  const newKey = this.getAvailableKey("newKey", newFormData);
2028
2068
  if (schema.patternProperties) {
@@ -2050,7 +2090,7 @@ var ObjectField = class extends import_react7.Component {
2050
2090
  const newValue = constValue ?? defaultValue ?? this.getDefaultValue(type);
2051
2091
  (0, import_set4.default)(newFormData, newKey, newValue);
2052
2092
  }
2053
- onChange(newFormData);
2093
+ onChange(newFormData, fieldPathId.path);
2054
2094
  };
2055
2095
  /** Renders the `ObjectField` from the given props
2056
2096
  */
@@ -2060,37 +2100,40 @@ var ObjectField = class extends import_react7.Component {
2060
2100
  uiSchema = {},
2061
2101
  formData,
2062
2102
  errorSchema,
2063
- idSchema,
2103
+ fieldPathId,
2064
2104
  name,
2065
2105
  required = false,
2066
2106
  disabled,
2067
2107
  readonly,
2068
2108
  hideError,
2069
- idPrefix,
2070
- idSeparator,
2071
2109
  onBlur,
2072
2110
  onFocus,
2073
2111
  registry,
2074
2112
  title
2075
2113
  } = this.props;
2076
- const { fields: fields2, formContext, schemaUtils, translateString, globalUiOptions } = registry;
2077
- const { SchemaField: SchemaField2 } = fields2;
2078
- const schema = schemaUtils.retrieveSchema(rawSchema, formData);
2114
+ const { fields: fields2, formContext, schemaUtils, translateString, globalFormOptions, globalUiOptions } = registry;
2115
+ const { OptionalDataControlsField: OptionalDataControlsField2, SchemaField: SchemaField2 } = fields2;
2116
+ const schema = schemaUtils.retrieveSchema(rawSchema, formData, true);
2079
2117
  const uiOptions = (0, import_utils8.getUiOptions)(uiSchema, globalUiOptions);
2080
2118
  const { properties: schemaProperties = {} } = schema;
2081
2119
  const templateTitle = uiOptions.title ?? schema.title ?? title ?? name;
2082
2120
  const description = uiOptions.description ?? schema.description;
2083
- let orderedProperties;
2084
- try {
2085
- const properties = Object.keys(schemaProperties);
2086
- orderedProperties = (0, import_utils8.orderProperties)(properties, uiOptions.order);
2087
- } catch (err) {
2088
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { children: [
2089
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "rjsf-config-error", style: { color: "red" }, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_markdown_to_jsx.default, { options: { disableParsingRawHTML: true }, children: translateString(import_utils8.TranslatableString.InvalidObjectField, [name || "root", err.message]) }) }),
2090
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("pre", { children: JSON.stringify(schema) })
2091
- ] });
2121
+ const renderOptionalField = (0, import_utils8.shouldRenderOptionalField)(registry, schema, required, uiSchema);
2122
+ const hasFormData = (0, import_utils8.isFormDataAvailable)(formData);
2123
+ let orderedProperties = [];
2124
+ if (!renderOptionalField || hasFormData) {
2125
+ try {
2126
+ const properties = Object.keys(schemaProperties);
2127
+ orderedProperties = (0, import_utils8.orderProperties)(properties, uiOptions.order);
2128
+ } catch (err) {
2129
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { children: [
2130
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "rjsf-config-error", style: { color: "red" }, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_markdown_to_jsx.default, { options: { disableParsingRawHTML: true }, children: translateString(import_utils8.TranslatableString.InvalidObjectField, [name || "root", err.message]) }) }),
2131
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("pre", { children: JSON.stringify(schema) })
2132
+ ] });
2133
+ }
2092
2134
  }
2093
2135
  const Template = (0, import_utils8.getTemplate)("ObjectFieldTemplate", registry, uiOptions);
2136
+ const optionalDataControl = renderOptionalField ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(OptionalDataControlsField2, { ...this.props, schema }) : void 0;
2094
2137
  const templateProps = {
2095
2138
  // getDisplayLabel() always returns false for object types, so just check the `uiOptions.label`
2096
2139
  title: uiOptions.label === false ? "" : templateTitle,
@@ -2099,7 +2142,7 @@ var ObjectField = class extends import_react7.Component {
2099
2142
  const addedByAdditionalProperties = (0, import_has3.default)(schema, [import_utils8.PROPERTIES_KEY, name2, import_utils8.ADDITIONAL_PROPERTY_FLAG]);
2100
2143
  const fieldUiSchema = addedByAdditionalProperties ? uiSchema.additionalProperties : uiSchema[name2];
2101
2144
  const hidden = (0, import_utils8.getUiOptions)(fieldUiSchema).widget === "hidden";
2102
- const fieldIdSchema = (0, import_get5.default)(idSchema, [name2], {});
2145
+ const innerFieldIdPathId = (0, import_utils8.toFieldPathId)(name2, globalFormOptions, fieldPathId);
2103
2146
  return {
2104
2147
  content: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2105
2148
  SchemaField2,
@@ -2109,9 +2152,7 @@ var ObjectField = class extends import_react7.Component {
2109
2152
  schema: (0, import_get5.default)(schema, [import_utils8.PROPERTIES_KEY, name2], {}),
2110
2153
  uiSchema: fieldUiSchema,
2111
2154
  errorSchema: (0, import_get5.default)(errorSchema, name2),
2112
- idSchema: fieldIdSchema,
2113
- idPrefix,
2114
- idSeparator,
2155
+ fieldPathId: innerFieldIdPathId,
2115
2156
  formData: (0, import_get5.default)(formData, name2),
2116
2157
  formContext,
2117
2158
  wasPropertyKeyModified: this.state.wasPropertyKeyModified,
@@ -2137,25 +2178,88 @@ var ObjectField = class extends import_react7.Component {
2137
2178
  readonly,
2138
2179
  disabled,
2139
2180
  required,
2140
- idSchema,
2181
+ fieldPathId,
2141
2182
  uiSchema,
2142
2183
  errorSchema,
2143
2184
  schema,
2144
2185
  formData,
2145
2186
  formContext,
2146
- registry
2187
+ registry,
2188
+ optionalDataControl,
2189
+ className: renderOptionalField ? "rjsf-optional-object-field" : void 0
2147
2190
  };
2148
2191
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Template, { ...templateProps, onAddClick: this.handleAddClick });
2149
2192
  }
2150
2193
  };
2151
2194
  var ObjectField_default = ObjectField;
2152
2195
 
2153
- // src/components/fields/SchemaField.tsx
2154
- var import_react8 = require("react");
2196
+ // src/components/fields/OptionalDataControlsField.tsx
2155
2197
  var import_utils9 = require("@rjsf/utils");
2198
+ var import_jsx_runtime9 = require("react/jsx-runtime");
2199
+ function OptionalDataControlsField(props) {
2200
+ const {
2201
+ schema,
2202
+ uiSchema = {},
2203
+ formData,
2204
+ disabled = false,
2205
+ readonly = false,
2206
+ onChange,
2207
+ errorSchema,
2208
+ fieldPathId,
2209
+ registry
2210
+ } = props;
2211
+ const { globalUiOptions = {}, schemaUtils, translateString } = registry;
2212
+ const uiOptions = (0, import_utils9.getUiOptions)(uiSchema, globalUiOptions);
2213
+ const OptionalDataControlsTemplate2 = (0, import_utils9.getTemplate)(
2214
+ "OptionalDataControlsTemplate",
2215
+ registry,
2216
+ uiOptions
2217
+ );
2218
+ const hasFormData = (0, import_utils9.isFormDataAvailable)(formData);
2219
+ let id;
2220
+ let label;
2221
+ let onAddClick;
2222
+ let onRemoveClick;
2223
+ if (disabled || readonly) {
2224
+ id = (0, import_utils9.optionalControlsId)(fieldPathId, "Msg");
2225
+ label = hasFormData ? void 0 : translateString(import_utils9.TranslatableString.OptionalObjectEmptyMsg);
2226
+ } else {
2227
+ const labelEnum = hasFormData ? import_utils9.TranslatableString.OptionalObjectRemove : import_utils9.TranslatableString.OptionalObjectAdd;
2228
+ label = translateString(labelEnum);
2229
+ if (hasFormData) {
2230
+ id = (0, import_utils9.optionalControlsId)(fieldPathId, "Remove");
2231
+ onRemoveClick = () => onChange(void 0, fieldPathId.path, errorSchema);
2232
+ } else {
2233
+ id = (0, import_utils9.optionalControlsId)(fieldPathId, "Add");
2234
+ onAddClick = () => {
2235
+ let newFormData = schemaUtils.getDefaultFormState(schema, formData, "excludeObjectChildren");
2236
+ if (newFormData === void 0) {
2237
+ newFormData = (0, import_utils9.getSchemaType)(schema) === "array" ? [] : {};
2238
+ }
2239
+ onChange(newFormData, fieldPathId.path, errorSchema);
2240
+ };
2241
+ }
2242
+ }
2243
+ return label && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2244
+ OptionalDataControlsTemplate2,
2245
+ {
2246
+ id,
2247
+ registry,
2248
+ schema,
2249
+ uiSchema,
2250
+ label,
2251
+ onAddClick,
2252
+ onRemoveClick
2253
+ }
2254
+ );
2255
+ }
2256
+
2257
+ // src/components/fields/SchemaField.tsx
2258
+ var import_react9 = require("react");
2259
+ var import_utils10 = require("@rjsf/utils");
2156
2260
  var import_isObject5 = __toESM(require("lodash/isObject"), 1);
2157
2261
  var import_omit3 = __toESM(require("lodash/omit"), 1);
2158
- var import_jsx_runtime9 = require("react/jsx-runtime");
2262
+ var import_jsx_runtime10 = require("react/jsx-runtime");
2159
2263
  var COMPONENT_TYPES = {
2160
2264
  array: "ArrayField",
2161
2265
  boolean: "BooleanField",
@@ -2165,7 +2269,7 @@ var COMPONENT_TYPES = {
2165
2269
  string: "StringField",
2166
2270
  null: "NullField"
2167
2271
  };
2168
- function getFieldComponent(schema, uiOptions, idSchema, registry) {
2272
+ function getFieldComponent(schema, uiOptions, fieldPathId, registry) {
2169
2273
  const field = uiOptions.field;
2170
2274
  const { fields: fields2, translateString } = registry;
2171
2275
  if (typeof field === "function") {
@@ -2174,7 +2278,7 @@ function getFieldComponent(schema, uiOptions, idSchema, registry) {
2174
2278
  if (typeof field === "string" && field in fields2) {
2175
2279
  return fields2[field];
2176
2280
  }
2177
- const schemaType = (0, import_utils9.getSchemaType)(schema);
2281
+ const schemaType = (0, import_utils10.getSchemaType)(schema);
2178
2282
  const type = Array.isArray(schemaType) ? schemaType[0] : schemaType || "";
2179
2283
  const schemaId = schema.$id;
2180
2284
  let componentName = COMPONENT_TYPES[type];
@@ -2185,17 +2289,17 @@ function getFieldComponent(schema, uiOptions, idSchema, registry) {
2185
2289
  return () => null;
2186
2290
  }
2187
2291
  return componentName in fields2 ? fields2[componentName] : () => {
2188
- const UnsupportedFieldTemplate = (0, import_utils9.getTemplate)(
2292
+ const UnsupportedFieldTemplate = (0, import_utils10.getTemplate)(
2189
2293
  "UnsupportedFieldTemplate",
2190
2294
  registry,
2191
2295
  uiOptions
2192
2296
  );
2193
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2297
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2194
2298
  UnsupportedFieldTemplate,
2195
2299
  {
2196
2300
  schema,
2197
- idSchema,
2198
- reason: translateString(import_utils9.TranslatableString.UnknownFieldType, [String(schema.type)]),
2301
+ fieldPathId,
2302
+ reason: translateString(import_utils10.TranslatableString.UnknownFieldType, [String(schema.type)]),
2199
2303
  registry
2200
2304
  }
2201
2305
  );
@@ -2204,12 +2308,10 @@ function getFieldComponent(schema, uiOptions, idSchema, registry) {
2204
2308
  function SchemaFieldRender(props) {
2205
2309
  const {
2206
2310
  schema: _schema,
2207
- idSchema: _idSchema,
2311
+ fieldPathId,
2208
2312
  uiSchema,
2209
2313
  formData,
2210
2314
  errorSchema,
2211
- idPrefix,
2212
- idSeparator,
2213
2315
  name,
2214
2316
  onChange,
2215
2317
  onKeyChange,
@@ -2219,29 +2321,25 @@ function SchemaFieldRender(props) {
2219
2321
  wasPropertyKeyModified = false
2220
2322
  } = props;
2221
2323
  const { formContext, schemaUtils, globalUiOptions } = registry;
2222
- const uiOptions = (0, import_utils9.getUiOptions)(uiSchema, globalUiOptions);
2223
- const FieldTemplate2 = (0, import_utils9.getTemplate)("FieldTemplate", registry, uiOptions);
2224
- const DescriptionFieldTemplate = (0, import_utils9.getTemplate)(
2324
+ const uiOptions = (0, import_utils10.getUiOptions)(uiSchema, globalUiOptions);
2325
+ const FieldTemplate2 = (0, import_utils10.getTemplate)("FieldTemplate", registry, uiOptions);
2326
+ const DescriptionFieldTemplate = (0, import_utils10.getTemplate)(
2225
2327
  "DescriptionFieldTemplate",
2226
2328
  registry,
2227
2329
  uiOptions
2228
2330
  );
2229
- const FieldHelpTemplate2 = (0, import_utils9.getTemplate)("FieldHelpTemplate", registry, uiOptions);
2230
- const FieldErrorTemplate2 = (0, import_utils9.getTemplate)("FieldErrorTemplate", registry, uiOptions);
2331
+ const FieldHelpTemplate2 = (0, import_utils10.getTemplate)("FieldHelpTemplate", registry, uiOptions);
2332
+ const FieldErrorTemplate2 = (0, import_utils10.getTemplate)("FieldErrorTemplate", registry, uiOptions);
2231
2333
  const schema = schemaUtils.retrieveSchema(_schema, formData);
2232
- const fieldId = _idSchema[import_utils9.ID_KEY];
2233
- const idSchema = (0, import_utils9.mergeObjects)(
2234
- schemaUtils.toIdSchema(schema, fieldId, formData, idPrefix, idSeparator),
2235
- _idSchema
2236
- );
2237
- const handleFieldComponentChange = (0, import_react8.useCallback)(
2238
- (formData2, newErrorSchema, id2) => {
2334
+ const fieldId = fieldPathId[import_utils10.ID_KEY];
2335
+ const handleFieldComponentChange = (0, import_react9.useCallback)(
2336
+ (formData2, path, newErrorSchema, id2) => {
2239
2337
  const theId = id2 || fieldId;
2240
- return onChange(formData2, newErrorSchema, theId);
2338
+ return onChange(formData2, path, newErrorSchema, theId);
2241
2339
  },
2242
2340
  [fieldId, onChange]
2243
2341
  );
2244
- const FieldComponent = getFieldComponent(schema, uiOptions, idSchema, registry);
2342
+ const FieldComponent = getFieldComponent(schema, uiOptions, fieldPathId, registry);
2245
2343
  const disabled = Boolean(uiOptions.disabled ?? props.disabled);
2246
2344
  const readonly = Boolean(uiOptions.readonly ?? (props.readonly || props.schema.readOnly || schema.readOnly));
2247
2345
  const uiSchemaHideError = uiOptions.hideError;
@@ -2253,15 +2351,15 @@ function SchemaFieldRender(props) {
2253
2351
  const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);
2254
2352
  const { __errors, ...fieldErrorSchema } = errorSchema || {};
2255
2353
  const fieldUiSchema = (0, import_omit3.default)(uiSchema, ["ui:classNames", "classNames", "ui:style"]);
2256
- if (import_utils9.UI_OPTIONS_KEY in fieldUiSchema) {
2257
- fieldUiSchema[import_utils9.UI_OPTIONS_KEY] = (0, import_omit3.default)(fieldUiSchema[import_utils9.UI_OPTIONS_KEY], ["classNames", "style"]);
2354
+ if (import_utils10.UI_OPTIONS_KEY in fieldUiSchema) {
2355
+ fieldUiSchema[import_utils10.UI_OPTIONS_KEY] = (0, import_omit3.default)(fieldUiSchema[import_utils10.UI_OPTIONS_KEY], ["classNames", "style"]);
2258
2356
  }
2259
- const field = /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2357
+ const field = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2260
2358
  FieldComponent,
2261
2359
  {
2262
2360
  ...props,
2263
2361
  onChange: handleFieldComponentChange,
2264
- idSchema,
2362
+ fieldPathId,
2265
2363
  schema,
2266
2364
  uiSchema: fieldUiSchema,
2267
2365
  disabled,
@@ -2273,50 +2371,50 @@ function SchemaFieldRender(props) {
2273
2371
  rawErrors: __errors
2274
2372
  }
2275
2373
  );
2276
- const id = idSchema[import_utils9.ID_KEY];
2374
+ const id = fieldPathId[import_utils10.ID_KEY];
2277
2375
  let label;
2278
2376
  if (wasPropertyKeyModified) {
2279
2377
  label = name;
2280
2378
  } else {
2281
- label = import_utils9.ADDITIONAL_PROPERTY_FLAG in schema ? name : uiOptions.title || props.schema.title || schema.title || props.title || name;
2379
+ label = import_utils10.ADDITIONAL_PROPERTY_FLAG in schema ? name : uiOptions.title || props.schema.title || schema.title || props.title || name;
2282
2380
  }
2283
2381
  const description = uiOptions.description || props.schema.description || schema.description || "";
2284
2382
  const help = uiOptions.help;
2285
2383
  const hidden = uiOptions.widget === "hidden";
2286
- const classNames = ["rjsf-field", `rjsf-field-${(0, import_utils9.getSchemaType)(schema)}`];
2384
+ const classNames = ["rjsf-field", `rjsf-field-${(0, import_utils10.getSchemaType)(schema)}`];
2287
2385
  if (!hideError && __errors && __errors.length > 0) {
2288
2386
  classNames.push("rjsf-field-error");
2289
2387
  }
2290
2388
  if (uiOptions.classNames) {
2291
2389
  classNames.push(uiOptions.classNames);
2292
2390
  }
2293
- const helpComponent = /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2391
+ const helpComponent = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2294
2392
  FieldHelpTemplate2,
2295
2393
  {
2296
2394
  help,
2297
- idSchema,
2395
+ fieldPathId,
2298
2396
  schema,
2299
2397
  uiSchema,
2300
2398
  hasErrors: !hideError && __errors && __errors.length > 0,
2301
2399
  registry
2302
2400
  }
2303
2401
  );
2304
- const errorsComponent = hideError || (schema.anyOf || schema.oneOf) && !schemaUtils.isSelect(schema) ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2402
+ const errorsComponent = hideError || (schema.anyOf || schema.oneOf) && !schemaUtils.isSelect(schema) ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2305
2403
  FieldErrorTemplate2,
2306
2404
  {
2307
2405
  errors: __errors,
2308
2406
  errorSchema,
2309
- idSchema,
2407
+ fieldPathId,
2310
2408
  schema,
2311
2409
  uiSchema,
2312
2410
  registry
2313
2411
  }
2314
2412
  );
2315
2413
  const fieldProps = {
2316
- description: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2414
+ description: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2317
2415
  DescriptionFieldTemplate,
2318
2416
  {
2319
- id: (0, import_utils9.descriptionId)(id),
2417
+ id: (0, import_utils10.descriptionId)(id),
2320
2418
  description,
2321
2419
  schema,
2322
2420
  uiSchema,
@@ -2341,7 +2439,6 @@ function SchemaFieldRender(props) {
2341
2439
  displayLabel,
2342
2440
  classNames: classNames.join(" ").trim(),
2343
2441
  style: uiOptions.style,
2344
- formContext,
2345
2442
  formData,
2346
2443
  schema,
2347
2444
  uiSchema,
@@ -2350,9 +2447,9 @@ function SchemaFieldRender(props) {
2350
2447
  const _AnyOfField = registry.fields.AnyOfField;
2351
2448
  const _OneOfField = registry.fields.OneOfField;
2352
2449
  const isReplacingAnyOrOneOf = uiSchema?.["ui:field"] && uiSchema?.["ui:fieldReplacesAnyOrOneOf"] === true;
2353
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(FieldTemplate2, { ...fieldProps, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
2450
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FieldTemplate2, { ...fieldProps, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
2354
2451
  field,
2355
- schema.anyOf && !isReplacingAnyOrOneOf && !schemaUtils.isSelect(schema) && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2452
+ schema.anyOf && !isReplacingAnyOrOneOf && !schemaUtils.isSelect(schema) && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2356
2453
  _AnyOfField,
2357
2454
  {
2358
2455
  name,
@@ -2362,9 +2459,7 @@ function SchemaFieldRender(props) {
2362
2459
  errorSchema,
2363
2460
  formData,
2364
2461
  formContext,
2365
- idPrefix,
2366
- idSchema,
2367
- idSeparator,
2462
+ fieldPathId,
2368
2463
  onBlur: props.onBlur,
2369
2464
  onChange: props.onChange,
2370
2465
  onFocus: props.onFocus,
@@ -2377,7 +2472,7 @@ function SchemaFieldRender(props) {
2377
2472
  uiSchema
2378
2473
  }
2379
2474
  ),
2380
- schema.oneOf && !isReplacingAnyOrOneOf && !schemaUtils.isSelect(schema) && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2475
+ schema.oneOf && !isReplacingAnyOrOneOf && !schemaUtils.isSelect(schema) && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2381
2476
  _OneOfField,
2382
2477
  {
2383
2478
  name,
@@ -2387,9 +2482,7 @@ function SchemaFieldRender(props) {
2387
2482
  errorSchema,
2388
2483
  formData,
2389
2484
  formContext,
2390
- idPrefix,
2391
- idSchema,
2392
- idSeparator,
2485
+ fieldPathId,
2393
2486
  onBlur: props.onBlur,
2394
2487
  onChange: props.onChange,
2395
2488
  onFocus: props.onFocus,
@@ -2404,25 +2497,30 @@ function SchemaFieldRender(props) {
2404
2497
  )
2405
2498
  ] }) });
2406
2499
  }
2407
- var SchemaField = class extends import_react8.Component {
2500
+ var SchemaField = class extends import_react9.Component {
2408
2501
  shouldComponentUpdate(nextProps) {
2409
- return !(0, import_utils9.deepEquals)(this.props, nextProps);
2502
+ const {
2503
+ registry: { globalFormOptions }
2504
+ } = this.props;
2505
+ const { experimental_componentUpdateStrategy = "customDeep" } = globalFormOptions;
2506
+ return (0, import_utils10.shouldRender)(this, nextProps, this.state, experimental_componentUpdateStrategy);
2410
2507
  }
2411
2508
  render() {
2412
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SchemaFieldRender, { ...this.props });
2509
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SchemaFieldRender, { ...this.props });
2413
2510
  }
2414
2511
  };
2415
2512
  var SchemaField_default = SchemaField;
2416
2513
 
2417
2514
  // src/components/fields/StringField.tsx
2418
- var import_utils10 = require("@rjsf/utils");
2419
- var import_jsx_runtime10 = require("react/jsx-runtime");
2515
+ var import_react10 = require("react");
2516
+ var import_utils11 = require("@rjsf/utils");
2517
+ var import_jsx_runtime11 = require("react/jsx-runtime");
2420
2518
  function StringField(props) {
2421
2519
  const {
2422
2520
  schema,
2423
2521
  name,
2424
2522
  uiSchema,
2425
- idSchema,
2523
+ fieldPathId,
2426
2524
  formData,
2427
2525
  required,
2428
2526
  disabled = false,
@@ -2437,28 +2535,34 @@ function StringField(props) {
2437
2535
  } = props;
2438
2536
  const { title, format } = schema;
2439
2537
  const { widgets: widgets2, formContext, schemaUtils, globalUiOptions } = registry;
2440
- const enumOptions = schemaUtils.isSelect(schema) ? (0, import_utils10.optionsList)(schema, uiSchema) : void 0;
2538
+ const enumOptions = schemaUtils.isSelect(schema) ? (0, import_utils11.optionsList)(schema, uiSchema) : void 0;
2441
2539
  let defaultWidget = enumOptions ? "select" : "text";
2442
- if (format && (0, import_utils10.hasWidget)(schema, format, widgets2)) {
2540
+ if (format && (0, import_utils11.hasWidget)(schema, format, widgets2)) {
2443
2541
  defaultWidget = format;
2444
2542
  }
2445
- const { widget = defaultWidget, placeholder = "", title: uiTitle, ...options } = (0, import_utils10.getUiOptions)(uiSchema);
2543
+ const { widget = defaultWidget, placeholder = "", title: uiTitle, ...options } = (0, import_utils11.getUiOptions)(uiSchema);
2446
2544
  const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);
2447
2545
  const label = uiTitle ?? title ?? name;
2448
- const Widget = (0, import_utils10.getWidget)(schema, widget, widgets2);
2449
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2546
+ const Widget = (0, import_utils11.getWidget)(schema, widget, widgets2);
2547
+ const onWidgetChange = (0, import_react10.useCallback)(
2548
+ (value, errorSchema, id) => {
2549
+ return onChange(value, fieldPathId.path, errorSchema, id);
2550
+ },
2551
+ [onChange, fieldPathId]
2552
+ );
2553
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2450
2554
  Widget,
2451
2555
  {
2452
2556
  options: { ...options, enumOptions },
2453
2557
  schema,
2454
2558
  uiSchema,
2455
- id: idSchema.$id,
2559
+ id: fieldPathId.$id,
2456
2560
  name,
2457
2561
  label,
2458
2562
  hideLabel: !displayLabel,
2459
2563
  hideError,
2460
2564
  value: formData,
2461
- onChange,
2565
+ onChange: onWidgetChange,
2462
2566
  onBlur,
2463
2567
  onFocus,
2464
2568
  required,
@@ -2475,14 +2579,14 @@ function StringField(props) {
2475
2579
  var StringField_default = StringField;
2476
2580
 
2477
2581
  // src/components/fields/NullField.tsx
2478
- var import_react9 = require("react");
2582
+ var import_react11 = require("react");
2479
2583
  function NullField(props) {
2480
- const { formData, onChange } = props;
2481
- (0, import_react9.useEffect)(() => {
2584
+ const { formData, onChange, fieldPathId } = props;
2585
+ (0, import_react11.useEffect)(() => {
2482
2586
  if (formData === void 0) {
2483
- onChange(null);
2587
+ onChange(null, fieldPathId.path);
2484
2588
  }
2485
- }, [formData, onChange]);
2589
+ }, [fieldPathId, formData, onChange]);
2486
2590
  return null;
2487
2591
  }
2488
2592
  var NullField_default = NullField;
@@ -2500,6 +2604,7 @@ function fields() {
2500
2604
  NumberField: NumberField_default,
2501
2605
  ObjectField: ObjectField_default,
2502
2606
  OneOfField: MultiSchemaField_default,
2607
+ OptionalDataControlsField,
2503
2608
  SchemaField: SchemaField_default,
2504
2609
  StringField: StringField_default,
2505
2610
  NullField: NullField_default
@@ -2508,24 +2613,24 @@ function fields() {
2508
2613
  var fields_default = fields;
2509
2614
 
2510
2615
  // src/components/templates/ArrayFieldDescriptionTemplate.tsx
2511
- var import_utils11 = require("@rjsf/utils");
2512
- var import_jsx_runtime11 = require("react/jsx-runtime");
2616
+ var import_utils12 = require("@rjsf/utils");
2617
+ var import_jsx_runtime12 = require("react/jsx-runtime");
2513
2618
  function ArrayFieldDescriptionTemplate(props) {
2514
- const { idSchema, description, registry, schema, uiSchema } = props;
2515
- const options = (0, import_utils11.getUiOptions)(uiSchema, registry.globalUiOptions);
2619
+ const { fieldPathId, description, registry, schema, uiSchema } = props;
2620
+ const options = (0, import_utils12.getUiOptions)(uiSchema, registry.globalUiOptions);
2516
2621
  const { label: displayLabel = true } = options;
2517
2622
  if (!description || !displayLabel) {
2518
2623
  return null;
2519
2624
  }
2520
- const DescriptionFieldTemplate = (0, import_utils11.getTemplate)(
2625
+ const DescriptionFieldTemplate = (0, import_utils12.getTemplate)(
2521
2626
  "DescriptionFieldTemplate",
2522
2627
  registry,
2523
2628
  options
2524
2629
  );
2525
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2630
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2526
2631
  DescriptionFieldTemplate,
2527
2632
  {
2528
- id: (0, import_utils11.descriptionId)(idSchema),
2633
+ id: (0, import_utils12.descriptionId)(fieldPathId),
2529
2634
  description,
2530
2635
  schema,
2531
2636
  uiSchema,
@@ -2535,12 +2640,12 @@ function ArrayFieldDescriptionTemplate(props) {
2535
2640
  }
2536
2641
 
2537
2642
  // src/components/templates/ArrayFieldItemTemplate.tsx
2538
- var import_utils12 = require("@rjsf/utils");
2539
- var import_jsx_runtime12 = require("react/jsx-runtime");
2643
+ var import_utils13 = require("@rjsf/utils");
2644
+ var import_jsx_runtime13 = require("react/jsx-runtime");
2540
2645
  function ArrayFieldItemTemplate(props) {
2541
2646
  const { children, className, buttonsProps, hasToolbar, registry, uiSchema } = props;
2542
- const uiOptions = (0, import_utils12.getUiOptions)(uiSchema);
2543
- const ArrayFieldItemButtonsTemplate2 = (0, import_utils12.getTemplate)(
2647
+ const uiOptions = (0, import_utils13.getUiOptions)(uiSchema);
2648
+ const ArrayFieldItemButtonsTemplate2 = (0, import_utils13.getTemplate)(
2544
2649
  "ArrayFieldItemButtonsTemplate",
2545
2650
  registry,
2546
2651
  uiOptions
@@ -2551,9 +2656,9 @@ function ArrayFieldItemTemplate(props) {
2551
2656
  paddingRight: 6,
2552
2657
  fontWeight: "bold"
2553
2658
  };
2554
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className, children: [
2555
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: hasToolbar ? "col-xs-9" : "col-xs-12", children }),
2556
- hasToolbar && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "col-xs-3 array-item-toolbox", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2659
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className, children: [
2660
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: hasToolbar ? "col-xs-9" : "col-xs-12", children }),
2661
+ hasToolbar && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "col-xs-3 array-item-toolbox", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2557
2662
  "div",
2558
2663
  {
2559
2664
  className: "btn-group",
@@ -2561,16 +2666,16 @@ function ArrayFieldItemTemplate(props) {
2561
2666
  display: "flex",
2562
2667
  justifyContent: "space-around"
2563
2668
  },
2564
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ArrayFieldItemButtonsTemplate2, { ...buttonsProps, style: btnStyle })
2669
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ArrayFieldItemButtonsTemplate2, { ...buttonsProps, style: btnStyle })
2565
2670
  }
2566
2671
  ) })
2567
2672
  ] });
2568
2673
  }
2569
2674
 
2570
2675
  // src/components/templates/ArrayFieldItemButtonsTemplate.tsx
2571
- var import_react10 = require("react");
2572
- var import_utils13 = require("@rjsf/utils");
2573
- var import_jsx_runtime13 = require("react/jsx-runtime");
2676
+ var import_react12 = require("react");
2677
+ var import_utils14 = require("@rjsf/utils");
2678
+ var import_jsx_runtime14 = require("react/jsx-runtime");
2574
2679
  function ArrayFieldItemButtonsTemplate(props) {
2575
2680
  const {
2576
2681
  disabled,
@@ -2578,7 +2683,7 @@ function ArrayFieldItemButtonsTemplate(props) {
2578
2683
  hasMoveDown,
2579
2684
  hasMoveUp,
2580
2685
  hasRemove,
2581
- idSchema,
2686
+ fieldPathId,
2582
2687
  index,
2583
2688
  onCopyIndexClick,
2584
2689
  onDropIndexClick,
@@ -2588,15 +2693,15 @@ function ArrayFieldItemButtonsTemplate(props) {
2588
2693
  uiSchema
2589
2694
  } = props;
2590
2695
  const { CopyButton: CopyButton2, MoveDownButton: MoveDownButton2, MoveUpButton: MoveUpButton2, RemoveButton: RemoveButton2 } = registry.templates.ButtonTemplates;
2591
- const onCopyClick = (0, import_react10.useMemo)(() => onCopyIndexClick(index), [index, onCopyIndexClick]);
2592
- const onRemoveClick = (0, import_react10.useMemo)(() => onDropIndexClick(index), [index, onDropIndexClick]);
2593
- const onArrowUpClick = (0, import_react10.useMemo)(() => onReorderClick(index, index - 1), [index, onReorderClick]);
2594
- const onArrowDownClick = (0, import_react10.useMemo)(() => onReorderClick(index, index + 1), [index, onReorderClick]);
2595
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
2596
- (hasMoveUp || hasMoveDown) && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2696
+ const onCopyClick = (0, import_react12.useMemo)(() => onCopyIndexClick(index), [index, onCopyIndexClick]);
2697
+ const onRemoveClick = (0, import_react12.useMemo)(() => onDropIndexClick(index), [index, onDropIndexClick]);
2698
+ const onArrowUpClick = (0, import_react12.useMemo)(() => onReorderClick(index, index - 1), [index, onReorderClick]);
2699
+ const onArrowDownClick = (0, import_react12.useMemo)(() => onReorderClick(index, index + 1), [index, onReorderClick]);
2700
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
2701
+ (hasMoveUp || hasMoveDown) && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2597
2702
  MoveUpButton2,
2598
2703
  {
2599
- id: (0, import_utils13.buttonId)(idSchema, "moveUp"),
2704
+ id: (0, import_utils14.buttonId)(fieldPathId, "moveUp"),
2600
2705
  className: "rjsf-array-item-move-up",
2601
2706
  disabled: disabled || readonly || !hasMoveUp,
2602
2707
  onClick: onArrowUpClick,
@@ -2604,10 +2709,10 @@ function ArrayFieldItemButtonsTemplate(props) {
2604
2709
  registry
2605
2710
  }
2606
2711
  ),
2607
- (hasMoveUp || hasMoveDown) && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2712
+ (hasMoveUp || hasMoveDown) && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2608
2713
  MoveDownButton2,
2609
2714
  {
2610
- id: (0, import_utils13.buttonId)(idSchema, "moveDown"),
2715
+ id: (0, import_utils14.buttonId)(fieldPathId, "moveDown"),
2611
2716
  className: "rjsf-array-item-move-down",
2612
2717
  disabled: disabled || readonly || !hasMoveDown,
2613
2718
  onClick: onArrowDownClick,
@@ -2615,10 +2720,10 @@ function ArrayFieldItemButtonsTemplate(props) {
2615
2720
  registry
2616
2721
  }
2617
2722
  ),
2618
- hasCopy && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2723
+ hasCopy && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2619
2724
  CopyButton2,
2620
2725
  {
2621
- id: (0, import_utils13.buttonId)(idSchema, "copy"),
2726
+ id: (0, import_utils14.buttonId)(fieldPathId, "copy"),
2622
2727
  className: "rjsf-array-item-copy",
2623
2728
  disabled: disabled || readonly,
2624
2729
  onClick: onCopyClick,
@@ -2626,10 +2731,10 @@ function ArrayFieldItemButtonsTemplate(props) {
2626
2731
  registry
2627
2732
  }
2628
2733
  ),
2629
- hasRemove && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2734
+ hasRemove && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2630
2735
  RemoveButton2,
2631
2736
  {
2632
- id: (0, import_utils13.buttonId)(idSchema, "remove"),
2737
+ id: (0, import_utils14.buttonId)(fieldPathId, "remove"),
2633
2738
  className: "rjsf-array-item-remove",
2634
2739
  disabled: disabled || readonly,
2635
2740
  onClick: onRemoveClick,
@@ -2641,16 +2746,17 @@ function ArrayFieldItemButtonsTemplate(props) {
2641
2746
  }
2642
2747
 
2643
2748
  // src/components/templates/ArrayFieldTemplate.tsx
2644
- var import_utils14 = require("@rjsf/utils");
2645
- var import_jsx_runtime14 = require("react/jsx-runtime");
2749
+ var import_utils15 = require("@rjsf/utils");
2750
+ var import_jsx_runtime15 = require("react/jsx-runtime");
2646
2751
  function ArrayFieldTemplate(props) {
2647
2752
  const {
2648
2753
  canAdd,
2649
2754
  className,
2650
2755
  disabled,
2651
- idSchema,
2756
+ fieldPathId,
2652
2757
  uiSchema,
2653
2758
  items,
2759
+ optionalDataControl,
2654
2760
  onAddClick,
2655
2761
  readonly,
2656
2762
  registry,
@@ -2658,52 +2764,55 @@ function ArrayFieldTemplate(props) {
2658
2764
  schema,
2659
2765
  title
2660
2766
  } = props;
2661
- const uiOptions = (0, import_utils14.getUiOptions)(uiSchema);
2662
- const ArrayFieldDescriptionTemplate2 = (0, import_utils14.getTemplate)(
2767
+ const uiOptions = (0, import_utils15.getUiOptions)(uiSchema);
2768
+ const ArrayFieldDescriptionTemplate2 = (0, import_utils15.getTemplate)(
2663
2769
  "ArrayFieldDescriptionTemplate",
2664
2770
  registry,
2665
2771
  uiOptions
2666
2772
  );
2667
- const ArrayFieldItemTemplate2 = (0, import_utils14.getTemplate)(
2773
+ const ArrayFieldItemTemplate2 = (0, import_utils15.getTemplate)(
2668
2774
  "ArrayFieldItemTemplate",
2669
2775
  registry,
2670
2776
  uiOptions
2671
2777
  );
2672
- const ArrayFieldTitleTemplate2 = (0, import_utils14.getTemplate)(
2778
+ const ArrayFieldTitleTemplate2 = (0, import_utils15.getTemplate)(
2673
2779
  "ArrayFieldTitleTemplate",
2674
2780
  registry,
2675
2781
  uiOptions
2676
2782
  );
2783
+ const showOptionalDataControlInTitle = !readonly && !disabled;
2677
2784
  const {
2678
2785
  ButtonTemplates: { AddButton: AddButton2 }
2679
2786
  } = registry.templates;
2680
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("fieldset", { className, id: idSchema.$id, children: [
2681
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2787
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("fieldset", { className, id: fieldPathId.$id, children: [
2788
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2682
2789
  ArrayFieldTitleTemplate2,
2683
2790
  {
2684
- idSchema,
2791
+ fieldPathId,
2685
2792
  title: uiOptions.title || title,
2686
2793
  required,
2687
2794
  schema,
2688
2795
  uiSchema,
2689
- registry
2796
+ registry,
2797
+ optionalDataControl: showOptionalDataControlInTitle ? optionalDataControl : void 0
2690
2798
  }
2691
2799
  ),
2692
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2800
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2693
2801
  ArrayFieldDescriptionTemplate2,
2694
2802
  {
2695
- idSchema,
2803
+ fieldPathId,
2696
2804
  description: uiOptions.description || schema.description,
2697
2805
  schema,
2698
2806
  uiSchema,
2699
2807
  registry
2700
2808
  }
2701
2809
  ),
2702
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "row array-item-list", children: items && items.map(({ key, ...itemProps }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ArrayFieldItemTemplate2, { ...itemProps }, key)) }),
2703
- canAdd && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2810
+ !showOptionalDataControlInTitle ? optionalDataControl : void 0,
2811
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "row array-item-list", children: items && items.map(({ key, ...itemProps }) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ArrayFieldItemTemplate2, { ...itemProps }, key)) }),
2812
+ canAdd && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2704
2813
  AddButton2,
2705
2814
  {
2706
- id: (0, import_utils14.buttonId)(idSchema, "add"),
2815
+ id: (0, import_utils15.buttonId)(fieldPathId, "add"),
2707
2816
  className: "rjsf-array-item-add",
2708
2817
  onClick: onAddClick,
2709
2818
  disabled: disabled || readonly,
@@ -2715,37 +2824,38 @@ function ArrayFieldTemplate(props) {
2715
2824
  }
2716
2825
 
2717
2826
  // src/components/templates/ArrayFieldTitleTemplate.tsx
2718
- var import_utils15 = require("@rjsf/utils");
2719
- var import_jsx_runtime15 = require("react/jsx-runtime");
2827
+ var import_utils16 = require("@rjsf/utils");
2828
+ var import_jsx_runtime16 = require("react/jsx-runtime");
2720
2829
  function ArrayFieldTitleTemplate(props) {
2721
- const { idSchema, title, schema, uiSchema, required, registry } = props;
2722
- const options = (0, import_utils15.getUiOptions)(uiSchema, registry.globalUiOptions);
2830
+ const { fieldPathId, title, schema, uiSchema, required, registry, optionalDataControl } = props;
2831
+ const options = (0, import_utils16.getUiOptions)(uiSchema, registry.globalUiOptions);
2723
2832
  const { label: displayLabel = true } = options;
2724
2833
  if (!title || !displayLabel) {
2725
2834
  return null;
2726
2835
  }
2727
- const TitleFieldTemplate = (0, import_utils15.getTemplate)(
2836
+ const TitleFieldTemplate = (0, import_utils16.getTemplate)(
2728
2837
  "TitleFieldTemplate",
2729
2838
  registry,
2730
2839
  options
2731
2840
  );
2732
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2841
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2733
2842
  TitleFieldTemplate,
2734
2843
  {
2735
- id: (0, import_utils15.titleId)(idSchema),
2844
+ id: (0, import_utils16.titleId)(fieldPathId),
2736
2845
  title,
2737
2846
  required,
2738
2847
  schema,
2739
2848
  uiSchema,
2740
- registry
2849
+ registry,
2850
+ optionalDataControl
2741
2851
  }
2742
2852
  );
2743
2853
  }
2744
2854
 
2745
2855
  // src/components/templates/BaseInputTemplate.tsx
2746
- var import_react11 = require("react");
2747
- var import_utils16 = require("@rjsf/utils");
2748
- var import_jsx_runtime16 = require("react/jsx-runtime");
2856
+ var import_react13 = require("react");
2857
+ var import_utils17 = require("@rjsf/utils");
2858
+ var import_jsx_runtime17 = require("react/jsx-runtime");
2749
2859
  function BaseInputTemplate(props) {
2750
2860
  const {
2751
2861
  id,
@@ -2778,7 +2888,7 @@ function BaseInputTemplate(props) {
2778
2888
  }
2779
2889
  const inputProps = {
2780
2890
  ...rest,
2781
- ...(0, import_utils16.getInputProps)(schema, type, options)
2891
+ ...(0, import_utils17.getInputProps)(schema, type, options)
2782
2892
  };
2783
2893
  let inputValue;
2784
2894
  if (inputProps.type === "number" || inputProps.type === "integer") {
@@ -2786,20 +2896,20 @@ function BaseInputTemplate(props) {
2786
2896
  } else {
2787
2897
  inputValue = value == null ? "" : value;
2788
2898
  }
2789
- const _onChange = (0, import_react11.useCallback)(
2899
+ const _onChange = (0, import_react13.useCallback)(
2790
2900
  ({ target: { value: value2 } }) => onChange(value2 === "" ? options.emptyValue : value2),
2791
2901
  [onChange, options]
2792
2902
  );
2793
- const _onBlur = (0, import_react11.useCallback)(
2903
+ const _onBlur = (0, import_react13.useCallback)(
2794
2904
  ({ target }) => onBlur(id, target && target.value),
2795
2905
  [onBlur, id]
2796
2906
  );
2797
- const _onFocus = (0, import_react11.useCallback)(
2907
+ const _onFocus = (0, import_react13.useCallback)(
2798
2908
  ({ target }) => onFocus(id, target && target.value),
2799
2909
  [onFocus, id]
2800
2910
  );
2801
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
2802
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2911
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
2912
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2803
2913
  "input",
2804
2914
  {
2805
2915
  id,
@@ -2810,81 +2920,83 @@ function BaseInputTemplate(props) {
2810
2920
  autoFocus: autofocus,
2811
2921
  value: inputValue,
2812
2922
  ...inputProps,
2813
- list: schema.examples ? (0, import_utils16.examplesId)(id) : void 0,
2923
+ list: schema.examples ? (0, import_utils17.examplesId)(id) : void 0,
2814
2924
  onChange: onChangeOverride || _onChange,
2815
2925
  onBlur: _onBlur,
2816
2926
  onFocus: _onFocus,
2817
- "aria-describedby": (0, import_utils16.ariaDescribedByIds)(id, !!schema.examples)
2927
+ "aria-describedby": (0, import_utils17.ariaDescribedByIds)(id, !!schema.examples)
2818
2928
  }
2819
2929
  ),
2820
- Array.isArray(schema.examples) && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("datalist", { id: (0, import_utils16.examplesId)(id), children: schema.examples.concat(schema.default && !schema.examples.includes(schema.default) ? [schema.default] : []).map((example) => {
2821
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: example }, example);
2930
+ Array.isArray(schema.examples) && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("datalist", { id: (0, import_utils17.examplesId)(id), children: schema.examples.concat(schema.default && !schema.examples.includes(schema.default) ? [schema.default] : []).map((example) => {
2931
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: example }, example);
2822
2932
  }) }, `datalist_${id}`)
2823
2933
  ] });
2824
2934
  }
2825
2935
 
2826
2936
  // src/components/templates/ButtonTemplates/SubmitButton.tsx
2827
- var import_utils17 = require("@rjsf/utils");
2828
- var import_jsx_runtime17 = require("react/jsx-runtime");
2937
+ var import_utils18 = require("@rjsf/utils");
2938
+ var import_jsx_runtime18 = require("react/jsx-runtime");
2829
2939
  function SubmitButton({ uiSchema }) {
2830
- const { submitText, norender, props: submitButtonProps = {} } = (0, import_utils17.getSubmitButtonOptions)(uiSchema);
2940
+ const { submitText, norender, props: submitButtonProps = {} } = (0, import_utils18.getSubmitButtonOptions)(uiSchema);
2831
2941
  if (norender) {
2832
2942
  return null;
2833
2943
  }
2834
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "submit", ...submitButtonProps, className: `btn btn-info ${submitButtonProps.className || ""}`, children: submitText }) });
2944
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "submit", ...submitButtonProps, className: `btn btn-info ${submitButtonProps.className || ""}`, children: submitText }) });
2835
2945
  }
2836
2946
 
2837
2947
  // src/components/templates/ButtonTemplates/AddButton.tsx
2838
- var import_utils19 = require("@rjsf/utils");
2948
+ var import_utils20 = require("@rjsf/utils");
2839
2949
 
2840
2950
  // src/components/templates/ButtonTemplates/IconButton.tsx
2841
- var import_utils18 = require("@rjsf/utils");
2842
- var import_jsx_runtime18 = require("react/jsx-runtime");
2951
+ var import_utils19 = require("@rjsf/utils");
2952
+ var import_jsx_runtime19 = require("react/jsx-runtime");
2843
2953
  function IconButton(props) {
2844
2954
  const { iconType = "default", icon, className, uiSchema, registry, ...otherProps } = props;
2845
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: `btn btn-${iconType} ${className}`, ...otherProps, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("i", { className: `glyphicon glyphicon-${icon}` }) });
2955
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: `btn btn-${iconType} ${className}`, ...otherProps, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("i", { className: `glyphicon glyphicon-${icon}` }) });
2846
2956
  }
2847
2957
  function CopyButton(props) {
2848
2958
  const {
2849
2959
  registry: { translateString }
2850
2960
  } = props;
2851
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(IconButton, { title: translateString(import_utils18.TranslatableString.CopyButton), ...props, icon: "copy" });
2961
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(IconButton, { title: translateString(import_utils19.TranslatableString.CopyButton), ...props, icon: "copy" });
2852
2962
  }
2853
2963
  function MoveDownButton(props) {
2854
2964
  const {
2855
2965
  registry: { translateString }
2856
2966
  } = props;
2857
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(IconButton, { title: translateString(import_utils18.TranslatableString.MoveDownButton), ...props, icon: "arrow-down" });
2967
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(IconButton, { title: translateString(import_utils19.TranslatableString.MoveDownButton), ...props, icon: "arrow-down" });
2858
2968
  }
2859
2969
  function MoveUpButton(props) {
2860
2970
  const {
2861
2971
  registry: { translateString }
2862
2972
  } = props;
2863
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(IconButton, { title: translateString(import_utils18.TranslatableString.MoveUpButton), ...props, icon: "arrow-up" });
2973
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(IconButton, { title: translateString(import_utils19.TranslatableString.MoveUpButton), ...props, icon: "arrow-up" });
2864
2974
  }
2865
2975
  function RemoveButton(props) {
2866
2976
  const {
2867
2977
  registry: { translateString }
2868
2978
  } = props;
2869
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(IconButton, { title: translateString(import_utils18.TranslatableString.RemoveButton), ...props, iconType: "danger", icon: "remove" });
2979
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(IconButton, { title: translateString(import_utils19.TranslatableString.RemoveButton), ...props, iconType: "danger", icon: "remove" });
2870
2980
  }
2871
2981
 
2872
2982
  // src/components/templates/ButtonTemplates/AddButton.tsx
2873
- var import_jsx_runtime19 = require("react/jsx-runtime");
2983
+ var import_jsx_runtime20 = require("react/jsx-runtime");
2874
2984
  function AddButton({
2985
+ id,
2875
2986
  className,
2876
2987
  onClick,
2877
2988
  disabled,
2878
2989
  registry
2879
2990
  }) {
2880
2991
  const { translateString } = registry;
2881
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: `col-xs-3 col-xs-offset-9 text-right ${className}`, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2992
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: `col-xs-3 col-xs-offset-9 text-right ${className}`, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2882
2993
  IconButton,
2883
2994
  {
2995
+ id,
2884
2996
  iconType: "info",
2885
2997
  icon: "plus",
2886
2998
  className: "btn-add col-xs-12",
2887
- title: translateString(import_utils19.TranslatableString.AddButton),
2999
+ title: translateString(import_utils20.TranslatableString.AddButton),
2888
3000
  onClick,
2889
3001
  disabled,
2890
3002
  registry
@@ -2906,78 +3018,78 @@ function buttonTemplates() {
2906
3018
  var ButtonTemplates_default = buttonTemplates;
2907
3019
 
2908
3020
  // src/components/RichDescription.tsx
2909
- var import_utils20 = require("@rjsf/utils");
3021
+ var import_utils21 = require("@rjsf/utils");
2910
3022
  var import_markdown_to_jsx2 = __toESM(require("markdown-to-jsx"), 1);
2911
- var import_jsx_runtime20 = require("react/jsx-runtime");
2912
- var TEST_IDS = (0, import_utils20.getTestIds)();
3023
+ var import_jsx_runtime21 = require("react/jsx-runtime");
3024
+ var TEST_IDS = (0, import_utils21.getTestIds)();
2913
3025
  function RichDescription({ description, registry, uiSchema = {} }) {
2914
3026
  const { globalUiOptions } = registry;
2915
- const uiOptions = (0, import_utils20.getUiOptions)(uiSchema, globalUiOptions);
3027
+ const uiOptions = (0, import_utils21.getUiOptions)(uiSchema, globalUiOptions);
2916
3028
  if (uiOptions.enableMarkdownInDescription && typeof description === "string") {
2917
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_markdown_to_jsx2.default, { options: { disableParsingRawHTML: true }, "data-testid": TEST_IDS.markdown, children: description });
3029
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_markdown_to_jsx2.default, { options: { disableParsingRawHTML: true }, "data-testid": TEST_IDS.markdown, children: description });
2918
3030
  }
2919
3031
  return description;
2920
3032
  }
2921
3033
  RichDescription.TEST_IDS = TEST_IDS;
2922
3034
 
2923
3035
  // src/components/templates/DescriptionField.tsx
2924
- var import_jsx_runtime21 = require("react/jsx-runtime");
3036
+ var import_jsx_runtime22 = require("react/jsx-runtime");
2925
3037
  function DescriptionField(props) {
2926
3038
  const { id, description, registry, uiSchema } = props;
2927
3039
  if (!description) {
2928
3040
  return null;
2929
3041
  }
2930
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { id, className: "field-description", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(RichDescription, { description, registry, uiSchema }) });
3042
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { id, className: "field-description", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(RichDescription, { description, registry, uiSchema }) });
2931
3043
  }
2932
3044
 
2933
3045
  // src/components/templates/ErrorList.tsx
2934
- var import_utils21 = require("@rjsf/utils");
2935
- var import_jsx_runtime22 = require("react/jsx-runtime");
3046
+ var import_utils22 = require("@rjsf/utils");
3047
+ var import_jsx_runtime23 = require("react/jsx-runtime");
2936
3048
  function ErrorList({
2937
3049
  errors,
2938
3050
  registry
2939
3051
  }) {
2940
3052
  const { translateString } = registry;
2941
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "panel panel-danger errors", children: [
2942
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "panel-heading", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("h3", { className: "panel-title", children: translateString(import_utils21.TranslatableString.ErrorsLabel) }) }),
2943
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("ul", { className: "list-group", children: errors.map((error, i) => {
2944
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("li", { className: "list-group-item text-danger", children: error.stack }, i);
3053
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "panel panel-danger errors", children: [
3054
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "panel-heading", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("h3", { className: "panel-title", children: translateString(import_utils22.TranslatableString.ErrorsLabel) }) }),
3055
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("ul", { className: "list-group", children: errors.map((error, i) => {
3056
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("li", { className: "list-group-item text-danger", children: error.stack }, i);
2945
3057
  }) })
2946
3058
  ] });
2947
3059
  }
2948
3060
 
2949
3061
  // src/components/templates/FieldTemplate/FieldTemplate.tsx
2950
- var import_utils22 = require("@rjsf/utils");
3062
+ var import_utils23 = require("@rjsf/utils");
2951
3063
 
2952
3064
  // src/components/templates/FieldTemplate/Label.tsx
2953
- var import_jsx_runtime23 = require("react/jsx-runtime");
3065
+ var import_jsx_runtime24 = require("react/jsx-runtime");
2954
3066
  var REQUIRED_FIELD_SYMBOL = "*";
2955
3067
  function Label(props) {
2956
3068
  const { label, required, id } = props;
2957
3069
  if (!label) {
2958
3070
  return null;
2959
3071
  }
2960
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "control-label", htmlFor: id, children: [
3072
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "control-label", htmlFor: id, children: [
2961
3073
  label,
2962
- required && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "required", children: REQUIRED_FIELD_SYMBOL })
3074
+ required && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "required", children: REQUIRED_FIELD_SYMBOL })
2963
3075
  ] });
2964
3076
  }
2965
3077
 
2966
3078
  // src/components/templates/FieldTemplate/FieldTemplate.tsx
2967
- var import_jsx_runtime24 = require("react/jsx-runtime");
3079
+ var import_jsx_runtime25 = require("react/jsx-runtime");
2968
3080
  function FieldTemplate(props) {
2969
3081
  const { id, label, children, errors, help, description, hidden, required, displayLabel, registry, uiSchema } = props;
2970
- const uiOptions = (0, import_utils22.getUiOptions)(uiSchema);
2971
- const WrapIfAdditionalTemplate2 = (0, import_utils22.getTemplate)(
3082
+ const uiOptions = (0, import_utils23.getUiOptions)(uiSchema);
3083
+ const WrapIfAdditionalTemplate2 = (0, import_utils23.getTemplate)(
2972
3084
  "WrapIfAdditionalTemplate",
2973
3085
  registry,
2974
3086
  uiOptions
2975
3087
  );
2976
3088
  if (hidden) {
2977
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "hidden", children });
3089
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "hidden", children });
2978
3090
  }
2979
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(WrapIfAdditionalTemplate2, { ...props, children: [
2980
- displayLabel && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Label, { label, required, id }),
3091
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(WrapIfAdditionalTemplate2, { ...props, children: [
3092
+ displayLabel && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Label, { label, required, id }),
2981
3093
  displayLabel && description ? description : null,
2982
3094
  children,
2983
3095
  errors,
@@ -2989,51 +3101,63 @@ function FieldTemplate(props) {
2989
3101
  var FieldTemplate_default = FieldTemplate;
2990
3102
 
2991
3103
  // src/components/templates/FieldErrorTemplate.tsx
2992
- var import_utils23 = require("@rjsf/utils");
2993
- var import_jsx_runtime25 = require("react/jsx-runtime");
3104
+ var import_utils24 = require("@rjsf/utils");
3105
+ var import_jsx_runtime26 = require("react/jsx-runtime");
2994
3106
  function FieldErrorTemplate(props) {
2995
- const { errors = [], idSchema } = props;
3107
+ const { errors = [], fieldPathId } = props;
2996
3108
  if (errors.length === 0) {
2997
3109
  return null;
2998
3110
  }
2999
- const id = (0, import_utils23.errorId)(idSchema);
3000
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("ul", { id, className: "error-detail bs-callout bs-callout-info", children: errors.filter((elem) => !!elem).map((error, index) => {
3001
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("li", { className: "text-danger", children: error }, index);
3111
+ const id = (0, import_utils24.errorId)(fieldPathId);
3112
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("ul", { id, className: "error-detail bs-callout bs-callout-info", children: errors.filter((elem) => !!elem).map((error, index) => {
3113
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("li", { className: "text-danger", children: error }, index);
3002
3114
  }) }) });
3003
3115
  }
3004
3116
 
3005
3117
  // src/components/templates/FieldHelpTemplate.tsx
3006
- var import_utils24 = require("@rjsf/utils");
3007
- var import_jsx_runtime26 = require("react/jsx-runtime");
3118
+ var import_utils25 = require("@rjsf/utils");
3119
+ var import_jsx_runtime27 = require("react/jsx-runtime");
3008
3120
  function FieldHelpTemplate(props) {
3009
- const { idSchema, help } = props;
3121
+ const { fieldPathId, help } = props;
3010
3122
  if (!help) {
3011
3123
  return null;
3012
3124
  }
3013
- const id = (0, import_utils24.helpId)(idSchema);
3125
+ const id = (0, import_utils25.helpId)(fieldPathId);
3014
3126
  if (typeof help === "string") {
3015
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { id, className: "help-block", children: help });
3127
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { id, className: "help-block", children: help });
3016
3128
  }
3017
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { id, className: "help-block", children: help });
3129
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { id, className: "help-block", children: help });
3018
3130
  }
3019
3131
 
3020
3132
  // src/components/templates/GridTemplate.tsx
3021
- var import_jsx_runtime27 = require("react/jsx-runtime");
3133
+ var import_jsx_runtime28 = require("react/jsx-runtime");
3022
3134
  function GridTemplate(props) {
3023
3135
  const { children, column, className, ...rest } = props;
3024
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className, ...rest, children });
3136
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className, ...rest, children });
3137
+ }
3138
+
3139
+ // src/components/templates/MultiSchemaFieldTemplate.tsx
3140
+ var import_jsx_runtime29 = require("react/jsx-runtime");
3141
+ function MultiSchemaFieldTemplate(props) {
3142
+ const { selector, optionSchemaField } = props;
3143
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "panel panel-default panel-body", children: [
3144
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "form-group", children: selector }),
3145
+ optionSchemaField
3146
+ ] });
3025
3147
  }
3026
3148
 
3027
3149
  // src/components/templates/ObjectFieldTemplate.tsx
3028
- var import_utils25 = require("@rjsf/utils");
3029
- var import_jsx_runtime28 = require("react/jsx-runtime");
3150
+ var import_utils26 = require("@rjsf/utils");
3151
+ var import_jsx_runtime30 = require("react/jsx-runtime");
3030
3152
  function ObjectFieldTemplate(props) {
3031
3153
  const {
3154
+ className,
3032
3155
  description,
3033
3156
  disabled,
3034
3157
  formData,
3035
- idSchema,
3158
+ fieldPathId,
3036
3159
  onAddClick,
3160
+ optionalDataControl,
3037
3161
  properties,
3038
3162
  readonly,
3039
3163
  registry,
@@ -3042,43 +3166,46 @@ function ObjectFieldTemplate(props) {
3042
3166
  title,
3043
3167
  uiSchema
3044
3168
  } = props;
3045
- const options = (0, import_utils25.getUiOptions)(uiSchema);
3046
- const TitleFieldTemplate = (0, import_utils25.getTemplate)("TitleFieldTemplate", registry, options);
3047
- const DescriptionFieldTemplate = (0, import_utils25.getTemplate)(
3169
+ const options = (0, import_utils26.getUiOptions)(uiSchema);
3170
+ const TitleFieldTemplate = (0, import_utils26.getTemplate)("TitleFieldTemplate", registry, options);
3171
+ const DescriptionFieldTemplate = (0, import_utils26.getTemplate)(
3048
3172
  "DescriptionFieldTemplate",
3049
3173
  registry,
3050
3174
  options
3051
3175
  );
3176
+ const showOptionalDataControlInTitle = !readonly && !disabled;
3052
3177
  const {
3053
3178
  ButtonTemplates: { AddButton: AddButton2 }
3054
3179
  } = registry.templates;
3055
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("fieldset", { id: idSchema.$id, children: [
3056
- title && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3180
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("fieldset", { className, id: fieldPathId.$id, children: [
3181
+ title && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
3057
3182
  TitleFieldTemplate,
3058
3183
  {
3059
- id: (0, import_utils25.titleId)(idSchema),
3184
+ id: (0, import_utils26.titleId)(fieldPathId),
3060
3185
  title,
3061
3186
  required,
3062
3187
  schema,
3063
3188
  uiSchema,
3064
- registry
3189
+ registry,
3190
+ optionalDataControl: showOptionalDataControlInTitle ? optionalDataControl : void 0
3065
3191
  }
3066
3192
  ),
3067
- description && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3193
+ description && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
3068
3194
  DescriptionFieldTemplate,
3069
3195
  {
3070
- id: (0, import_utils25.descriptionId)(idSchema),
3196
+ id: (0, import_utils26.descriptionId)(fieldPathId),
3071
3197
  description,
3072
3198
  schema,
3073
3199
  uiSchema,
3074
3200
  registry
3075
3201
  }
3076
3202
  ),
3203
+ !showOptionalDataControlInTitle ? optionalDataControl : void 0,
3077
3204
  properties.map((prop) => prop.content),
3078
- (0, import_utils25.canExpand)(schema, uiSchema, formData) && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3205
+ (0, import_utils26.canExpand)(schema, uiSchema, formData) && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
3079
3206
  AddButton2,
3080
3207
  {
3081
- id: (0, import_utils25.buttonId)(idSchema, "add"),
3208
+ id: (0, import_utils26.buttonId)(fieldPathId, "add"),
3082
3209
  className: "rjsf-object-property-expand",
3083
3210
  onClick: onAddClick(schema),
3084
3211
  disabled: disabled || readonly,
@@ -3089,44 +3216,77 @@ function ObjectFieldTemplate(props) {
3089
3216
  ] });
3090
3217
  }
3091
3218
 
3219
+ // src/components/templates/OptionalDataControlsTemplate.tsx
3220
+ var import_jsx_runtime31 = require("react/jsx-runtime");
3221
+ function OptionalDataControlsTemplate(props) {
3222
+ const { id, registry, label, onAddClick, onRemoveClick } = props;
3223
+ if (onAddClick) {
3224
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
3225
+ IconButton,
3226
+ {
3227
+ id,
3228
+ registry,
3229
+ icon: "plus",
3230
+ className: "rjsf-add-optional-data btn-sm",
3231
+ onClick: onAddClick,
3232
+ title: label
3233
+ }
3234
+ );
3235
+ } else if (onRemoveClick) {
3236
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
3237
+ IconButton,
3238
+ {
3239
+ id,
3240
+ registry,
3241
+ icon: "remove",
3242
+ className: "rjsf-remove-optional-data btn-sm",
3243
+ onClick: onRemoveClick,
3244
+ title: label
3245
+ }
3246
+ );
3247
+ }
3248
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("em", { id, children: label });
3249
+ }
3250
+
3092
3251
  // src/components/templates/TitleField.tsx
3093
- var import_jsx_runtime29 = require("react/jsx-runtime");
3252
+ var import_jsx_runtime32 = require("react/jsx-runtime");
3094
3253
  var REQUIRED_FIELD_SYMBOL2 = "*";
3095
3254
  function TitleField(props) {
3096
- const { id, title, required } = props;
3097
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("legend", { id, children: [
3255
+ const { id, title, required, optionalDataControl } = props;
3256
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("legend", { id, children: [
3098
3257
  title,
3099
- required && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "required", children: REQUIRED_FIELD_SYMBOL2 })
3258
+ required && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "required", children: REQUIRED_FIELD_SYMBOL2 }),
3259
+ optionalDataControl && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "pull-right", style: { marginBottom: "2px" }, children: optionalDataControl })
3100
3260
  ] });
3101
3261
  }
3102
3262
 
3103
3263
  // src/components/templates/UnsupportedField.tsx
3104
- var import_utils26 = require("@rjsf/utils");
3264
+ var import_utils27 = require("@rjsf/utils");
3105
3265
  var import_markdown_to_jsx3 = __toESM(require("markdown-to-jsx"), 1);
3106
- var import_jsx_runtime30 = require("react/jsx-runtime");
3266
+ var import_jsx_runtime33 = require("react/jsx-runtime");
3107
3267
  function UnsupportedField(props) {
3108
- const { schema, idSchema, reason, registry } = props;
3268
+ const { schema, fieldPathId, reason, registry } = props;
3109
3269
  const { translateString } = registry;
3110
- let translateEnum = import_utils26.TranslatableString.UnsupportedField;
3270
+ let translateEnum = import_utils27.TranslatableString.UnsupportedField;
3111
3271
  const translateParams = [];
3112
- if (idSchema && idSchema.$id) {
3113
- translateEnum = import_utils26.TranslatableString.UnsupportedFieldWithId;
3114
- translateParams.push(idSchema.$id);
3272
+ if (fieldPathId && fieldPathId.$id) {
3273
+ translateEnum = import_utils27.TranslatableString.UnsupportedFieldWithId;
3274
+ translateParams.push(fieldPathId.$id);
3115
3275
  }
3116
3276
  if (reason) {
3117
- translateEnum = translateEnum === import_utils26.TranslatableString.UnsupportedField ? import_utils26.TranslatableString.UnsupportedFieldWithReason : import_utils26.TranslatableString.UnsupportedFieldWithIdAndReason;
3277
+ translateEnum = translateEnum === import_utils27.TranslatableString.UnsupportedField ? import_utils27.TranslatableString.UnsupportedFieldWithReason : import_utils27.TranslatableString.UnsupportedFieldWithIdAndReason;
3118
3278
  translateParams.push(reason);
3119
3279
  }
3120
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "unsupported-field", children: [
3121
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_markdown_to_jsx3.default, { options: { disableParsingRawHTML: true }, children: translateString(translateEnum, translateParams) }) }),
3122
- schema && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("pre", { children: JSON.stringify(schema, null, 2) })
3280
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "unsupported-field", children: [
3281
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_markdown_to_jsx3.default, { options: { disableParsingRawHTML: true }, children: translateString(translateEnum, translateParams) }) }),
3282
+ schema && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("pre", { children: JSON.stringify(schema, null, 2) })
3123
3283
  ] });
3124
3284
  }
3125
3285
  var UnsupportedField_default = UnsupportedField;
3126
3286
 
3127
3287
  // src/components/templates/WrapIfAdditionalTemplate.tsx
3128
- var import_utils27 = require("@rjsf/utils");
3129
- var import_jsx_runtime31 = require("react/jsx-runtime");
3288
+ var import_utils28 = require("@rjsf/utils");
3289
+ var import_jsx_runtime34 = require("react/jsx-runtime");
3130
3290
  function WrapIfAdditionalTemplate(props) {
3131
3291
  const {
3132
3292
  id,
@@ -3147,20 +3307,20 @@ function WrapIfAdditionalTemplate(props) {
3147
3307
  } = props;
3148
3308
  const { templates: templates2, translateString } = registry;
3149
3309
  const { RemoveButton: RemoveButton2 } = templates2.ButtonTemplates;
3150
- const keyLabel = translateString(import_utils27.TranslatableString.KeyLabel, [label]);
3151
- const additional = import_utils27.ADDITIONAL_PROPERTY_FLAG in schema;
3310
+ const keyLabel = translateString(import_utils28.TranslatableString.KeyLabel, [label]);
3311
+ const additional = import_utils28.ADDITIONAL_PROPERTY_FLAG in schema;
3152
3312
  const classNamesList = ["form-group", classNames];
3153
3313
  if (!hideError && rawErrors && rawErrors.length > 0) {
3154
3314
  classNamesList.push("has-error has-danger");
3155
3315
  }
3156
3316
  const uiClassNames = classNamesList.join(" ").trim();
3157
3317
  if (!additional) {
3158
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: uiClassNames, style, children });
3318
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: uiClassNames, style, children });
3159
3319
  }
3160
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: uiClassNames, style, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "row", children: [
3161
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "col-xs-5 form-additional", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "form-group", children: [
3162
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Label, { label: keyLabel, required, id: `${id}-key` }),
3163
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
3320
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: uiClassNames, style, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "row", children: [
3321
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "col-xs-5 form-additional", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "form-group", children: [
3322
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Label, { label: keyLabel, required, id: `${id}-key` }),
3323
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
3164
3324
  "input",
3165
3325
  {
3166
3326
  className: "form-control",
@@ -3171,11 +3331,11 @@ function WrapIfAdditionalTemplate(props) {
3171
3331
  }
3172
3332
  )
3173
3333
  ] }) }),
3174
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "form-additional form-group col-xs-5", children }),
3175
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "col-xs-2", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
3334
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "form-additional form-group col-xs-5", children }),
3335
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "col-xs-2", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
3176
3336
  RemoveButton2,
3177
3337
  {
3178
- id: (0, import_utils27.buttonId)(id, "remove"),
3338
+ id: (0, import_utils28.buttonId)(id, "remove"),
3179
3339
  className: "rjsf-object-property-remove btn-block",
3180
3340
  style: { border: "0" },
3181
3341
  disabled: disabled || readonly,
@@ -3203,7 +3363,9 @@ function templates() {
3203
3363
  FieldErrorTemplate,
3204
3364
  FieldHelpTemplate,
3205
3365
  GridTemplate,
3366
+ MultiSchemaFieldTemplate,
3206
3367
  ObjectFieldTemplate,
3368
+ OptionalDataControlsTemplate,
3207
3369
  TitleFieldTemplate: TitleField,
3208
3370
  UnsupportedFieldTemplate: UnsupportedField_default,
3209
3371
  WrapIfAdditionalTemplate
@@ -3212,9 +3374,9 @@ function templates() {
3212
3374
  var templates_default = templates;
3213
3375
 
3214
3376
  // src/components/widgets/AltDateWidget.tsx
3215
- var import_react12 = require("react");
3216
- var import_utils28 = require("@rjsf/utils");
3217
- var import_jsx_runtime32 = require("react/jsx-runtime");
3377
+ var import_react14 = require("react");
3378
+ var import_utils29 = require("@rjsf/utils");
3379
+ var import_jsx_runtime35 = require("react/jsx-runtime");
3218
3380
  function readyForChange(state) {
3219
3381
  return Object.values(state).every((value) => value !== -1);
3220
3382
  }
@@ -3234,14 +3396,14 @@ function DateElement({
3234
3396
  }) {
3235
3397
  const id = rootId + "_" + type;
3236
3398
  const { SelectWidget: SelectWidget2 } = registry.widgets;
3237
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
3399
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3238
3400
  SelectWidget2,
3239
3401
  {
3240
3402
  schema: { type: "integer" },
3241
3403
  id,
3242
3404
  name,
3243
3405
  className: "form-control",
3244
- options: { enumOptions: (0, import_utils28.dateRangeOptions)(range[0], range[1]) },
3406
+ options: { enumOptions: (0, import_utils29.dateRangeOptions)(range[0], range[1]) },
3245
3407
  placeholder: type,
3246
3408
  value,
3247
3409
  disabled,
@@ -3252,7 +3414,7 @@ function DateElement({
3252
3414
  onFocus,
3253
3415
  registry,
3254
3416
  label: "",
3255
- "aria-describedby": (0, import_utils28.ariaDescribedByIds)(rootId)
3417
+ "aria-describedby": (0, import_utils29.ariaDescribedByIds)(rootId)
3256
3418
  }
3257
3419
  );
3258
3420
  }
@@ -3271,37 +3433,36 @@ function AltDateWidget({
3271
3433
  value
3272
3434
  }) {
3273
3435
  const { translateString } = registry;
3274
- const [lastValue, setLastValue] = (0, import_react12.useState)(value);
3275
- const [state, setState] = (0, import_react12.useReducer)(
3276
- (state2, action) => {
3277
- return { ...state2, ...action };
3436
+ const [state, setState] = (0, import_react14.useState)((0, import_utils29.parseDateString)(value, time));
3437
+ (0, import_react14.useEffect)(() => {
3438
+ setState((0, import_utils29.parseDateString)(value, time));
3439
+ }, [time, value]);
3440
+ const handleChange = (0, import_react14.useCallback)(
3441
+ (property, value2) => {
3442
+ const nextState = {
3443
+ ...state,
3444
+ [property]: typeof value2 === "undefined" ? -1 : value2
3445
+ };
3446
+ if (readyForChange(nextState)) {
3447
+ onChange((0, import_utils29.toDateString)(nextState, time));
3448
+ } else {
3449
+ setState(nextState);
3450
+ }
3278
3451
  },
3279
- (0, import_utils28.parseDateString)(value, time)
3452
+ [state, onChange, time]
3280
3453
  );
3281
- (0, import_react12.useEffect)(() => {
3282
- const stateValue = (0, import_utils28.toDateString)(state, time);
3283
- if (readyForChange(state) && stateValue !== value) {
3284
- onChange(stateValue);
3285
- } else if (lastValue !== value) {
3286
- setLastValue(value);
3287
- setState((0, import_utils28.parseDateString)(value, time));
3288
- }
3289
- }, [time, value, onChange, state, lastValue]);
3290
- const handleChange = (0, import_react12.useCallback)((property, value2) => {
3291
- setState({ [property]: value2 });
3292
- }, []);
3293
- const handleSetNow = (0, import_react12.useCallback)(
3454
+ const handleSetNow = (0, import_react14.useCallback)(
3294
3455
  (event) => {
3295
3456
  event.preventDefault();
3296
3457
  if (disabled || readonly) {
3297
3458
  return;
3298
3459
  }
3299
- const nextState = (0, import_utils28.parseDateString)((/* @__PURE__ */ new Date()).toJSON(), time);
3300
- onChange((0, import_utils28.toDateString)(nextState, time));
3460
+ const nextState = (0, import_utils29.parseDateString)((/* @__PURE__ */ new Date()).toJSON(), time);
3461
+ onChange((0, import_utils29.toDateString)(nextState, time));
3301
3462
  },
3302
- [disabled, readonly, time]
3463
+ [disabled, readonly, time, onChange]
3303
3464
  );
3304
- const handleClear = (0, import_react12.useCallback)(
3465
+ const handleClear = (0, import_react14.useCallback)(
3305
3466
  (event) => {
3306
3467
  event.preventDefault();
3307
3468
  if (disabled || readonly) {
@@ -3311,13 +3472,13 @@ function AltDateWidget({
3311
3472
  },
3312
3473
  [disabled, readonly, onChange]
3313
3474
  );
3314
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("ul", { className: "list-inline", children: [
3315
- (0, import_utils28.getDateElementProps)(
3475
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("ul", { className: "list-inline", children: [
3476
+ (0, import_utils29.getDateElementProps)(
3316
3477
  state,
3317
3478
  time,
3318
3479
  options.yearsRange,
3319
3480
  options.format
3320
- ).map((elemProps, i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("li", { className: "list-inline-item", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
3481
+ ).map((elemProps, i) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("li", { className: "list-inline-item", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3321
3482
  DateElement,
3322
3483
  {
3323
3484
  rootId: id,
@@ -3332,27 +3493,27 @@ function AltDateWidget({
3332
3493
  autofocus: autofocus && i === 0
3333
3494
  }
3334
3495
  ) }, i)),
3335
- (options.hideNowButton !== "undefined" ? !options.hideNowButton : true) && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("li", { className: "list-inline-item", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("a", { href: "#", className: "btn btn-info btn-now", onClick: handleSetNow, children: translateString(import_utils28.TranslatableString.NowLabel) }) }),
3336
- (options.hideClearButton !== "undefined" ? !options.hideClearButton : true) && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("li", { className: "list-inline-item", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("a", { href: "#", className: "btn btn-warning btn-clear", onClick: handleClear, children: translateString(import_utils28.TranslatableString.ClearLabel) }) })
3496
+ (options.hideNowButton !== "undefined" ? !options.hideNowButton : true) && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("li", { className: "list-inline-item", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("a", { href: "#", className: "btn btn-info btn-now", onClick: handleSetNow, children: translateString(import_utils29.TranslatableString.NowLabel) }) }),
3497
+ (options.hideClearButton !== "undefined" ? !options.hideClearButton : true) && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("li", { className: "list-inline-item", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("a", { href: "#", className: "btn btn-warning btn-clear", onClick: handleClear, children: translateString(import_utils29.TranslatableString.ClearLabel) }) })
3337
3498
  ] });
3338
3499
  }
3339
3500
  var AltDateWidget_default = AltDateWidget;
3340
3501
 
3341
3502
  // src/components/widgets/AltDateTimeWidget.tsx
3342
- var import_jsx_runtime33 = require("react/jsx-runtime");
3503
+ var import_jsx_runtime36 = require("react/jsx-runtime");
3343
3504
  function AltDateTimeWidget({
3344
3505
  time = true,
3345
3506
  ...props
3346
3507
  }) {
3347
3508
  const { AltDateWidget: AltDateWidget2 } = props.registry.widgets;
3348
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(AltDateWidget2, { time, ...props });
3509
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(AltDateWidget2, { time, ...props });
3349
3510
  }
3350
3511
  var AltDateTimeWidget_default = AltDateTimeWidget;
3351
3512
 
3352
3513
  // src/components/widgets/CheckboxWidget.tsx
3353
- var import_react13 = require("react");
3354
- var import_utils29 = require("@rjsf/utils");
3355
- var import_jsx_runtime34 = require("react/jsx-runtime");
3514
+ var import_react15 = require("react");
3515
+ var import_utils30 = require("@rjsf/utils");
3516
+ var import_jsx_runtime37 = require("react/jsx-runtime");
3356
3517
  function CheckboxWidget({
3357
3518
  schema,
3358
3519
  uiSchema,
@@ -3369,38 +3530,38 @@ function CheckboxWidget({
3369
3530
  onChange,
3370
3531
  registry
3371
3532
  }) {
3372
- const DescriptionFieldTemplate = (0, import_utils29.getTemplate)(
3533
+ const DescriptionFieldTemplate = (0, import_utils30.getTemplate)(
3373
3534
  "DescriptionFieldTemplate",
3374
3535
  registry,
3375
3536
  options
3376
3537
  );
3377
- const required = (0, import_utils29.schemaRequiresTrueValue)(schema);
3378
- const handleChange = (0, import_react13.useCallback)(
3538
+ const required = (0, import_utils30.schemaRequiresTrueValue)(schema);
3539
+ const handleChange = (0, import_react15.useCallback)(
3379
3540
  (event) => onChange(event.target.checked),
3380
3541
  [onChange]
3381
3542
  );
3382
- const handleBlur = (0, import_react13.useCallback)(
3543
+ const handleBlur = (0, import_react15.useCallback)(
3383
3544
  (event) => onBlur(id, event.target.checked),
3384
3545
  [onBlur, id]
3385
3546
  );
3386
- const handleFocus = (0, import_react13.useCallback)(
3547
+ const handleFocus = (0, import_react15.useCallback)(
3387
3548
  (event) => onFocus(id, event.target.checked),
3388
3549
  [onFocus, id]
3389
3550
  );
3390
3551
  const description = options.description ?? schema.description;
3391
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: `checkbox ${disabled || readonly ? "disabled" : ""}`, children: [
3392
- !hideLabel && description && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
3552
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: `checkbox ${disabled || readonly ? "disabled" : ""}`, children: [
3553
+ !hideLabel && description && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
3393
3554
  DescriptionFieldTemplate,
3394
3555
  {
3395
- id: (0, import_utils29.descriptionId)(id),
3556
+ id: (0, import_utils30.descriptionId)(id),
3396
3557
  description,
3397
3558
  schema,
3398
3559
  uiSchema,
3399
3560
  registry
3400
3561
  }
3401
3562
  ),
3402
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { children: [
3403
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
3563
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("label", { children: [
3564
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
3404
3565
  "input",
3405
3566
  {
3406
3567
  type: "checkbox",
@@ -3413,19 +3574,19 @@ function CheckboxWidget({
3413
3574
  onChange: handleChange,
3414
3575
  onBlur: handleBlur,
3415
3576
  onFocus: handleFocus,
3416
- "aria-describedby": (0, import_utils29.ariaDescribedByIds)(id)
3577
+ "aria-describedby": (0, import_utils30.ariaDescribedByIds)(id)
3417
3578
  }
3418
3579
  ),
3419
- (0, import_utils29.labelValue)(/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: label }), hideLabel)
3580
+ (0, import_utils30.labelValue)(/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: label }), hideLabel)
3420
3581
  ] })
3421
3582
  ] });
3422
3583
  }
3423
3584
  var CheckboxWidget_default = CheckboxWidget;
3424
3585
 
3425
3586
  // src/components/widgets/CheckboxesWidget.tsx
3426
- var import_react14 = require("react");
3427
- var import_utils30 = require("@rjsf/utils");
3428
- var import_jsx_runtime35 = require("react/jsx-runtime");
3587
+ var import_react16 = require("react");
3588
+ var import_utils31 = require("@rjsf/utils");
3589
+ var import_jsx_runtime38 = require("react/jsx-runtime");
3429
3590
  function CheckboxesWidget({
3430
3591
  id,
3431
3592
  disabled,
@@ -3438,31 +3599,31 @@ function CheckboxesWidget({
3438
3599
  onFocus
3439
3600
  }) {
3440
3601
  const checkboxesValues = Array.isArray(value) ? value : [value];
3441
- const handleBlur = (0, import_react14.useCallback)(
3442
- ({ target }) => onBlur(id, (0, import_utils30.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue)),
3443
- [onBlur, id]
3602
+ const handleBlur = (0, import_react16.useCallback)(
3603
+ ({ target }) => onBlur(id, (0, import_utils31.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue)),
3604
+ [onBlur, id, enumOptions, emptyValue]
3444
3605
  );
3445
- const handleFocus = (0, import_react14.useCallback)(
3446
- ({ target }) => onFocus(id, (0, import_utils30.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue)),
3447
- [onFocus, id]
3606
+ const handleFocus = (0, import_react16.useCallback)(
3607
+ ({ target }) => onFocus(id, (0, import_utils31.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue)),
3608
+ [onFocus, id, enumOptions, emptyValue]
3448
3609
  );
3449
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "checkboxes", id, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
3450
- const checked = (0, import_utils30.enumOptionsIsSelected)(option.value, checkboxesValues);
3610
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "checkboxes", id, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
3611
+ const checked = (0, import_utils31.enumOptionsIsSelected)(option.value, checkboxesValues);
3451
3612
  const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
3452
3613
  const disabledCls = disabled || itemDisabled || readonly ? "disabled" : "";
3453
3614
  const handleChange = (event) => {
3454
3615
  if (event.target.checked) {
3455
- onChange((0, import_utils30.enumOptionsSelectValue)(index, checkboxesValues, enumOptions));
3616
+ onChange((0, import_utils31.enumOptionsSelectValue)(index, checkboxesValues, enumOptions));
3456
3617
  } else {
3457
- onChange((0, import_utils30.enumOptionsDeselectValue)(index, checkboxesValues, enumOptions));
3618
+ onChange((0, import_utils31.enumOptionsDeselectValue)(index, checkboxesValues, enumOptions));
3458
3619
  }
3459
3620
  };
3460
- const checkbox = /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { children: [
3461
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3621
+ const checkbox = /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("span", { children: [
3622
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
3462
3623
  "input",
3463
3624
  {
3464
3625
  type: "checkbox",
3465
- id: (0, import_utils30.optionId)(id, index),
3626
+ id: (0, import_utils31.optionId)(id, index),
3466
3627
  name: id,
3467
3628
  checked,
3468
3629
  value: String(index),
@@ -3471,67 +3632,67 @@ function CheckboxesWidget({
3471
3632
  onChange: handleChange,
3472
3633
  onBlur: handleBlur,
3473
3634
  onFocus: handleFocus,
3474
- "aria-describedby": (0, import_utils30.ariaDescribedByIds)(id)
3635
+ "aria-describedby": (0, import_utils31.ariaDescribedByIds)(id)
3475
3636
  }
3476
3637
  ),
3477
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: option.label })
3638
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: option.label })
3478
3639
  ] });
3479
- return inline ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("label", { className: `checkbox-inline ${disabledCls}`, children: checkbox }, index) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: `checkbox ${disabledCls}`, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("label", { children: checkbox }) }, index);
3640
+ return inline ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("label", { className: `checkbox-inline ${disabledCls}`, children: checkbox }, index) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: `checkbox ${disabledCls}`, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("label", { children: checkbox }) }, index);
3480
3641
  }) });
3481
3642
  }
3482
3643
  var CheckboxesWidget_default = CheckboxesWidget;
3483
3644
 
3484
3645
  // src/components/widgets/ColorWidget.tsx
3485
- var import_utils31 = require("@rjsf/utils");
3486
- var import_jsx_runtime36 = require("react/jsx-runtime");
3646
+ var import_utils32 = require("@rjsf/utils");
3647
+ var import_jsx_runtime39 = require("react/jsx-runtime");
3487
3648
  function ColorWidget(props) {
3488
3649
  const { disabled, readonly, options, registry } = props;
3489
- const BaseInputTemplate2 = (0, import_utils31.getTemplate)("BaseInputTemplate", registry, options);
3490
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(BaseInputTemplate2, { type: "color", ...props, disabled: disabled || readonly });
3650
+ const BaseInputTemplate2 = (0, import_utils32.getTemplate)("BaseInputTemplate", registry, options);
3651
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(BaseInputTemplate2, { type: "color", ...props, disabled: disabled || readonly });
3491
3652
  }
3492
3653
 
3493
3654
  // src/components/widgets/DateWidget.tsx
3494
- var import_react15 = require("react");
3495
- var import_utils32 = require("@rjsf/utils");
3496
- var import_jsx_runtime37 = require("react/jsx-runtime");
3655
+ var import_react17 = require("react");
3656
+ var import_utils33 = require("@rjsf/utils");
3657
+ var import_jsx_runtime40 = require("react/jsx-runtime");
3497
3658
  function DateWidget(props) {
3498
3659
  const { onChange, options, registry } = props;
3499
- const BaseInputTemplate2 = (0, import_utils32.getTemplate)("BaseInputTemplate", registry, options);
3500
- const handleChange = (0, import_react15.useCallback)((value) => onChange(value || void 0), [onChange]);
3501
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(BaseInputTemplate2, { type: "date", ...props, onChange: handleChange });
3660
+ const BaseInputTemplate2 = (0, import_utils33.getTemplate)("BaseInputTemplate", registry, options);
3661
+ const handleChange = (0, import_react17.useCallback)((value) => onChange(value || void 0), [onChange]);
3662
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(BaseInputTemplate2, { type: "date", ...props, onChange: handleChange });
3502
3663
  }
3503
3664
 
3504
3665
  // src/components/widgets/DateTimeWidget.tsx
3505
- var import_utils33 = require("@rjsf/utils");
3506
- var import_jsx_runtime38 = require("react/jsx-runtime");
3666
+ var import_utils34 = require("@rjsf/utils");
3667
+ var import_jsx_runtime41 = require("react/jsx-runtime");
3507
3668
  function DateTimeWidget(props) {
3508
3669
  const { onChange, value, options, registry } = props;
3509
- const BaseInputTemplate2 = (0, import_utils33.getTemplate)("BaseInputTemplate", registry, options);
3510
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
3670
+ const BaseInputTemplate2 = (0, import_utils34.getTemplate)("BaseInputTemplate", registry, options);
3671
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
3511
3672
  BaseInputTemplate2,
3512
3673
  {
3513
3674
  type: "datetime-local",
3514
3675
  ...props,
3515
- value: (0, import_utils33.utcToLocal)(value),
3516
- onChange: (value2) => onChange((0, import_utils33.localToUTC)(value2))
3676
+ value: (0, import_utils34.utcToLocal)(value),
3677
+ onChange: (value2) => onChange((0, import_utils34.localToUTC)(value2))
3517
3678
  }
3518
3679
  );
3519
3680
  }
3520
3681
 
3521
3682
  // src/components/widgets/EmailWidget.tsx
3522
- var import_utils34 = require("@rjsf/utils");
3523
- var import_jsx_runtime39 = require("react/jsx-runtime");
3683
+ var import_utils35 = require("@rjsf/utils");
3684
+ var import_jsx_runtime42 = require("react/jsx-runtime");
3524
3685
  function EmailWidget(props) {
3525
3686
  const { options, registry } = props;
3526
- const BaseInputTemplate2 = (0, import_utils34.getTemplate)("BaseInputTemplate", registry, options);
3527
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(BaseInputTemplate2, { type: "email", ...props });
3687
+ const BaseInputTemplate2 = (0, import_utils35.getTemplate)("BaseInputTemplate", registry, options);
3688
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(BaseInputTemplate2, { type: "email", ...props });
3528
3689
  }
3529
3690
 
3530
3691
  // src/components/widgets/FileWidget.tsx
3531
- var import_react16 = require("react");
3532
- var import_utils35 = require("@rjsf/utils");
3692
+ var import_react18 = require("react");
3693
+ var import_utils36 = require("@rjsf/utils");
3533
3694
  var import_markdown_to_jsx4 = __toESM(require("markdown-to-jsx"), 1);
3534
- var import_jsx_runtime40 = require("react/jsx-runtime");
3695
+ var import_jsx_runtime43 = require("react/jsx-runtime");
3535
3696
  function addNameToDataURL(dataURL, name) {
3536
3697
  if (dataURL === null) {
3537
3698
  return null;
@@ -3576,11 +3737,11 @@ function FileInfoPreview({
3576
3737
  return null;
3577
3738
  }
3578
3739
  if (["image/jpeg", "image/png"].includes(type)) {
3579
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("img", { src: dataURL, style: { maxWidth: "100%" }, className: "file-preview" });
3740
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("img", { src: dataURL, style: { maxWidth: "100%" }, className: "file-preview" });
3580
3741
  }
3581
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
3742
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
3582
3743
  " ",
3583
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("a", { download: `preview-${name}`, href: dataURL, className: "file-download", children: translateString(import_utils35.TranslatableString.PreviewLabel) })
3744
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("a", { download: `preview-${name}`, href: dataURL, className: "file-download", children: translateString(import_utils36.TranslatableString.PreviewLabel) })
3584
3745
  ] });
3585
3746
  }
3586
3747
  function FilesInfo({
@@ -3594,14 +3755,14 @@ function FilesInfo({
3594
3755
  return null;
3595
3756
  }
3596
3757
  const { translateString } = registry;
3597
- const { RemoveButton: RemoveButton2 } = (0, import_utils35.getTemplate)("ButtonTemplates", registry, options);
3598
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("ul", { className: "file-info", children: filesInfo.map((fileInfo, key) => {
3758
+ const { RemoveButton: RemoveButton2 } = (0, import_utils36.getTemplate)("ButtonTemplates", registry, options);
3759
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("ul", { className: "file-info", children: filesInfo.map((fileInfo, key) => {
3599
3760
  const { name, size, type } = fileInfo;
3600
3761
  const handleRemove = () => onRemove(key);
3601
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("li", { children: [
3602
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_markdown_to_jsx4.default, { children: translateString(import_utils35.TranslatableString.FilesInfo, [name, type, String(size)]) }),
3603
- preview && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(FileInfoPreview, { fileInfo, registry }),
3604
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(RemoveButton2, { onClick: handleRemove, registry })
3762
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("li", { children: [
3763
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_markdown_to_jsx4.default, { children: translateString(import_utils36.TranslatableString.FilesInfo, [name, type, String(size)]) }),
3764
+ preview && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(FileInfoPreview, { fileInfo, registry }),
3765
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(RemoveButton2, { onClick: handleRemove, registry })
3605
3766
  ] }, key);
3606
3767
  }) });
3607
3768
  }
@@ -3611,7 +3772,7 @@ function extractFileInfo(dataURLs) {
3611
3772
  return acc;
3612
3773
  }
3613
3774
  try {
3614
- const { blob, name } = (0, import_utils35.dataURItoBlob)(dataURL);
3775
+ const { blob, name } = (0, import_utils36.dataURItoBlob)(dataURL);
3615
3776
  return [
3616
3777
  ...acc,
3617
3778
  {
@@ -3628,8 +3789,8 @@ function extractFileInfo(dataURLs) {
3628
3789
  }
3629
3790
  function FileWidget(props) {
3630
3791
  const { disabled, readonly, required, multiple, onChange, value, options, registry } = props;
3631
- const BaseInputTemplate2 = (0, import_utils35.getTemplate)("BaseInputTemplate", registry, options);
3632
- const handleChange = (0, import_react16.useCallback)(
3792
+ const BaseInputTemplate2 = (0, import_utils36.getTemplate)("BaseInputTemplate", registry, options);
3793
+ const handleChange = (0, import_react18.useCallback)(
3633
3794
  (event) => {
3634
3795
  if (!event.target.files) {
3635
3796
  return;
@@ -3645,8 +3806,8 @@ function FileWidget(props) {
3645
3806
  },
3646
3807
  [multiple, value, onChange]
3647
3808
  );
3648
- const filesInfo = (0, import_react16.useMemo)(() => extractFileInfo(Array.isArray(value) ? value : [value]), [value]);
3649
- const rmFile = (0, import_react16.useCallback)(
3809
+ const filesInfo = (0, import_react18.useMemo)(() => extractFileInfo(Array.isArray(value) ? value : [value]), [value]);
3810
+ const rmFile = (0, import_react18.useCallback)(
3650
3811
  (index) => {
3651
3812
  if (multiple) {
3652
3813
  const newValue = value.filter((_, i) => i !== index);
@@ -3657,8 +3818,8 @@ function FileWidget(props) {
3657
3818
  },
3658
3819
  [multiple, value, onChange]
3659
3820
  );
3660
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { children: [
3661
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
3821
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { children: [
3822
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
3662
3823
  BaseInputTemplate2,
3663
3824
  {
3664
3825
  ...props,
@@ -3670,7 +3831,7 @@ function FileWidget(props) {
3670
3831
  accept: options.accept ? String(options.accept) : void 0
3671
3832
  }
3672
3833
  ),
3673
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
3834
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
3674
3835
  FilesInfo,
3675
3836
  {
3676
3837
  filesInfo,
@@ -3685,28 +3846,28 @@ function FileWidget(props) {
3685
3846
  var FileWidget_default = FileWidget;
3686
3847
 
3687
3848
  // src/components/widgets/HiddenWidget.tsx
3688
- var import_jsx_runtime41 = require("react/jsx-runtime");
3849
+ var import_jsx_runtime44 = require("react/jsx-runtime");
3689
3850
  function HiddenWidget({
3690
3851
  id,
3691
3852
  value
3692
3853
  }) {
3693
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("input", { type: "hidden", id, name: id, value: typeof value === "undefined" ? "" : value });
3854
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("input", { type: "hidden", id, name: id, value: typeof value === "undefined" ? "" : value });
3694
3855
  }
3695
3856
  var HiddenWidget_default = HiddenWidget;
3696
3857
 
3697
3858
  // src/components/widgets/PasswordWidget.tsx
3698
- var import_utils36 = require("@rjsf/utils");
3699
- var import_jsx_runtime42 = require("react/jsx-runtime");
3859
+ var import_utils37 = require("@rjsf/utils");
3860
+ var import_jsx_runtime45 = require("react/jsx-runtime");
3700
3861
  function PasswordWidget(props) {
3701
3862
  const { options, registry } = props;
3702
- const BaseInputTemplate2 = (0, import_utils36.getTemplate)("BaseInputTemplate", registry, options);
3703
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(BaseInputTemplate2, { type: "password", ...props });
3863
+ const BaseInputTemplate2 = (0, import_utils37.getTemplate)("BaseInputTemplate", registry, options);
3864
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(BaseInputTemplate2, { type: "password", ...props });
3704
3865
  }
3705
3866
 
3706
3867
  // src/components/widgets/RadioWidget.tsx
3707
- var import_react17 = require("react");
3708
- var import_utils37 = require("@rjsf/utils");
3709
- var import_jsx_runtime43 = require("react/jsx-runtime");
3868
+ var import_react19 = require("react");
3869
+ var import_utils38 = require("@rjsf/utils");
3870
+ var import_jsx_runtime46 = require("react/jsx-runtime");
3710
3871
  function RadioWidget({
3711
3872
  options,
3712
3873
  value,
@@ -3720,25 +3881,25 @@ function RadioWidget({
3720
3881
  id
3721
3882
  }) {
3722
3883
  const { enumOptions, enumDisabled, inline, emptyValue } = options;
3723
- const handleBlur = (0, import_react17.useCallback)(
3724
- ({ target }) => onBlur(id, (0, import_utils37.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue)),
3884
+ const handleBlur = (0, import_react19.useCallback)(
3885
+ ({ target }) => onBlur(id, (0, import_utils38.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue)),
3725
3886
  [onBlur, enumOptions, emptyValue, id]
3726
3887
  );
3727
- const handleFocus = (0, import_react17.useCallback)(
3728
- ({ target }) => onFocus(id, (0, import_utils37.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue)),
3888
+ const handleFocus = (0, import_react19.useCallback)(
3889
+ ({ target }) => onFocus(id, (0, import_utils38.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue)),
3729
3890
  [onFocus, enumOptions, emptyValue, id]
3730
3891
  );
3731
- return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "field-radio-group", id, role: "radiogroup", children: Array.isArray(enumOptions) && enumOptions.map((option, i) => {
3732
- const checked = (0, import_utils37.enumOptionsIsSelected)(option.value, value);
3892
+ return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "field-radio-group", id, role: "radiogroup", children: Array.isArray(enumOptions) && enumOptions.map((option, i) => {
3893
+ const checked = (0, import_utils38.enumOptionsIsSelected)(option.value, value);
3733
3894
  const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
3734
3895
  const disabledCls = disabled || itemDisabled || readonly ? "disabled" : "";
3735
3896
  const handleChange = () => onChange(option.value);
3736
- const radio = /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { children: [
3737
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
3897
+ const radio = /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("span", { children: [
3898
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
3738
3899
  "input",
3739
3900
  {
3740
3901
  type: "radio",
3741
- id: (0, import_utils37.optionId)(id, i),
3902
+ id: (0, import_utils38.optionId)(id, i),
3742
3903
  checked,
3743
3904
  name: id,
3744
3905
  required,
@@ -3748,18 +3909,18 @@ function RadioWidget({
3748
3909
  onChange: handleChange,
3749
3910
  onBlur: handleBlur,
3750
3911
  onFocus: handleFocus,
3751
- "aria-describedby": (0, import_utils37.ariaDescribedByIds)(id)
3912
+ "aria-describedby": (0, import_utils38.ariaDescribedByIds)(id)
3752
3913
  }
3753
3914
  ),
3754
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: option.label })
3915
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { children: option.label })
3755
3916
  ] });
3756
- return inline ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("label", { className: `radio-inline ${disabledCls}`, children: radio }, i) : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: `radio ${disabledCls}`, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("label", { children: radio }) }, i);
3917
+ return inline ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("label", { className: `radio-inline ${disabledCls}`, children: radio }, i) : /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: `radio ${disabledCls}`, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("label", { children: radio }) }, i);
3757
3918
  }) });
3758
3919
  }
3759
3920
  var RadioWidget_default = RadioWidget;
3760
3921
 
3761
3922
  // src/components/widgets/RangeWidget.tsx
3762
- var import_jsx_runtime44 = require("react/jsx-runtime");
3923
+ var import_jsx_runtime47 = require("react/jsx-runtime");
3763
3924
  function RangeWidget(props) {
3764
3925
  const {
3765
3926
  value,
@@ -3767,15 +3928,15 @@ function RangeWidget(props) {
3767
3928
  templates: { BaseInputTemplate: BaseInputTemplate2 }
3768
3929
  }
3769
3930
  } = props;
3770
- return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "field-range-wrapper", children: [
3771
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(BaseInputTemplate2, { type: "range", ...props }),
3772
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "range-view", children: value })
3931
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "field-range-wrapper", children: [
3932
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(BaseInputTemplate2, { type: "range", ...props }),
3933
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "range-view", children: value })
3773
3934
  ] });
3774
3935
  }
3775
3936
 
3776
3937
  // src/components/widgets/RatingWidget.tsx
3777
- var import_react18 = require("react");
3778
- var import_jsx_runtime45 = require("react/jsx-runtime");
3938
+ var import_react20 = require("react");
3939
+ var import_jsx_runtime48 = require("react/jsx-runtime");
3779
3940
  function RatingWidget({
3780
3941
  id,
3781
3942
  value,
@@ -3792,7 +3953,7 @@ function RatingWidget({
3792
3953
  const { stars = 5, shape = "star" } = options;
3793
3954
  const numStars = schema.maximum ? Math.min(schema.maximum, 5) : Math.min(Math.max(stars, 1), 5);
3794
3955
  const min = schema.minimum || 0;
3795
- const handleStarClick = (0, import_react18.useCallback)(
3956
+ const handleStarClick = (0, import_react20.useCallback)(
3796
3957
  (starValue) => {
3797
3958
  if (!disabled && !readonly) {
3798
3959
  onChange(starValue);
@@ -3800,7 +3961,7 @@ function RatingWidget({
3800
3961
  },
3801
3962
  [onChange, disabled, readonly]
3802
3963
  );
3803
- const handleFocus = (0, import_react18.useCallback)(
3964
+ const handleFocus = (0, import_react20.useCallback)(
3804
3965
  (event) => {
3805
3966
  if (onFocus) {
3806
3967
  const starValue = Number(event.target.dataset.value);
@@ -3809,7 +3970,7 @@ function RatingWidget({
3809
3970
  },
3810
3971
  [onFocus, id]
3811
3972
  );
3812
- const handleBlur = (0, import_react18.useCallback)(
3973
+ const handleBlur = (0, import_react20.useCallback)(
3813
3974
  (event) => {
3814
3975
  if (onBlur) {
3815
3976
  const starValue = Number(event.target.dataset.value);
@@ -3824,7 +3985,7 @@ function RatingWidget({
3824
3985
  }
3825
3986
  return isFilled ? "\u2605" : "\u2606";
3826
3987
  };
3827
- return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_jsx_runtime45.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
3988
+ return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_jsx_runtime48.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
3828
3989
  "div",
3829
3990
  {
3830
3991
  className: "rating-widget",
@@ -3837,7 +3998,7 @@ function RatingWidget({
3837
3998
  [...Array(numStars)].map((_, index) => {
3838
3999
  const starValue = min + index;
3839
4000
  const isFilled = starValue <= value;
3840
- return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
4001
+ return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
3841
4002
  "span",
3842
4003
  {
3843
4004
  onClick: () => handleStarClick(starValue),
@@ -3859,7 +4020,7 @@ function RatingWidget({
3859
4020
  index
3860
4021
  );
3861
4022
  }),
3862
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
4023
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
3863
4024
  "input",
3864
4025
  {
3865
4026
  type: "hidden",
@@ -3877,9 +4038,9 @@ function RatingWidget({
3877
4038
  }
3878
4039
 
3879
4040
  // src/components/widgets/SelectWidget.tsx
3880
- var import_react19 = require("react");
3881
- var import_utils38 = require("@rjsf/utils");
3882
- var import_jsx_runtime46 = require("react/jsx-runtime");
4041
+ var import_react21 = require("react");
4042
+ var import_utils39 = require("@rjsf/utils");
4043
+ var import_jsx_runtime49 = require("react/jsx-runtime");
3883
4044
  function getValue(event, multiple) {
3884
4045
  if (multiple) {
3885
4046
  return Array.from(event.target.options).slice().filter((o) => o.selected).map((o) => o.value);
@@ -3903,30 +4064,30 @@ function SelectWidget({
3903
4064
  }) {
3904
4065
  const { enumOptions, enumDisabled, emptyValue: optEmptyVal } = options;
3905
4066
  const emptyValue = multiple ? [] : "";
3906
- const handleFocus = (0, import_react19.useCallback)(
4067
+ const handleFocus = (0, import_react21.useCallback)(
3907
4068
  (event) => {
3908
4069
  const newValue = getValue(event, multiple);
3909
- return onFocus(id, (0, import_utils38.enumOptionsValueForIndex)(newValue, enumOptions, optEmptyVal));
4070
+ return onFocus(id, (0, import_utils39.enumOptionsValueForIndex)(newValue, enumOptions, optEmptyVal));
3910
4071
  },
3911
4072
  [onFocus, id, multiple, enumOptions, optEmptyVal]
3912
4073
  );
3913
- const handleBlur = (0, import_react19.useCallback)(
4074
+ const handleBlur = (0, import_react21.useCallback)(
3914
4075
  (event) => {
3915
4076
  const newValue = getValue(event, multiple);
3916
- return onBlur(id, (0, import_utils38.enumOptionsValueForIndex)(newValue, enumOptions, optEmptyVal));
4077
+ return onBlur(id, (0, import_utils39.enumOptionsValueForIndex)(newValue, enumOptions, optEmptyVal));
3917
4078
  },
3918
4079
  [onBlur, id, multiple, enumOptions, optEmptyVal]
3919
4080
  );
3920
- const handleChange = (0, import_react19.useCallback)(
4081
+ const handleChange = (0, import_react21.useCallback)(
3921
4082
  (event) => {
3922
4083
  const newValue = getValue(event, multiple);
3923
- return onChange((0, import_utils38.enumOptionsValueForIndex)(newValue, enumOptions, optEmptyVal));
4084
+ return onChange((0, import_utils39.enumOptionsValueForIndex)(newValue, enumOptions, optEmptyVal));
3924
4085
  },
3925
4086
  [onChange, multiple, enumOptions, optEmptyVal]
3926
4087
  );
3927
- const selectedIndexes = (0, import_utils38.enumOptionsIndexForValue)(value, enumOptions, multiple);
4088
+ const selectedIndexes = (0, import_utils39.enumOptionsIndexForValue)(value, enumOptions, multiple);
3928
4089
  const showPlaceholderOption = !multiple && schema.default === void 0;
3929
- return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
4090
+ return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
3930
4091
  "select",
3931
4092
  {
3932
4093
  id,
@@ -3941,12 +4102,12 @@ function SelectWidget({
3941
4102
  onBlur: handleBlur,
3942
4103
  onFocus: handleFocus,
3943
4104
  onChange: handleChange,
3944
- "aria-describedby": (0, import_utils38.ariaDescribedByIds)(id),
4105
+ "aria-describedby": (0, import_utils39.ariaDescribedByIds)(id),
3945
4106
  children: [
3946
- showPlaceholderOption && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("option", { value: "", children: placeholder }),
4107
+ showPlaceholderOption && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("option", { value: "", children: placeholder }),
3947
4108
  Array.isArray(enumOptions) && enumOptions.map(({ value: value2, label }, i) => {
3948
4109
  const disabled2 = enumDisabled && enumDisabled.indexOf(value2) !== -1;
3949
- return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("option", { value: String(i), disabled: disabled2, children: label }, i);
4110
+ return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("option", { value: String(i), disabled: disabled2, children: label }, i);
3950
4111
  })
3951
4112
  ]
3952
4113
  }
@@ -3955,9 +4116,9 @@ function SelectWidget({
3955
4116
  var SelectWidget_default = SelectWidget;
3956
4117
 
3957
4118
  // src/components/widgets/TextareaWidget.tsx
3958
- var import_react20 = require("react");
3959
- var import_utils39 = require("@rjsf/utils");
3960
- var import_jsx_runtime47 = require("react/jsx-runtime");
4119
+ var import_react22 = require("react");
4120
+ var import_utils40 = require("@rjsf/utils");
4121
+ var import_jsx_runtime50 = require("react/jsx-runtime");
3961
4122
  function TextareaWidget({
3962
4123
  id,
3963
4124
  options = {},
@@ -3971,19 +4132,19 @@ function TextareaWidget({
3971
4132
  onBlur,
3972
4133
  onFocus
3973
4134
  }) {
3974
- const handleChange = (0, import_react20.useCallback)(
4135
+ const handleChange = (0, import_react22.useCallback)(
3975
4136
  ({ target: { value: value2 } }) => onChange(value2 === "" ? options.emptyValue : value2),
3976
4137
  [onChange, options.emptyValue]
3977
4138
  );
3978
- const handleBlur = (0, import_react20.useCallback)(
4139
+ const handleBlur = (0, import_react22.useCallback)(
3979
4140
  ({ target }) => onBlur(id, target && target.value),
3980
4141
  [onBlur, id]
3981
4142
  );
3982
- const handleFocus = (0, import_react20.useCallback)(
4143
+ const handleFocus = (0, import_react22.useCallback)(
3983
4144
  ({ target }) => onFocus(id, target && target.value),
3984
4145
  [id, onFocus]
3985
4146
  );
3986
- return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
4147
+ return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
3987
4148
  "textarea",
3988
4149
  {
3989
4150
  id,
@@ -3999,7 +4160,7 @@ function TextareaWidget({
3999
4160
  onBlur: handleBlur,
4000
4161
  onFocus: handleFocus,
4001
4162
  onChange: handleChange,
4002
- "aria-describedby": (0, import_utils39.ariaDescribedByIds)(id)
4163
+ "aria-describedby": (0, import_utils40.ariaDescribedByIds)(id)
4003
4164
  }
4004
4165
  );
4005
4166
  }
@@ -4010,41 +4171,41 @@ TextareaWidget.defaultProps = {
4010
4171
  var TextareaWidget_default = TextareaWidget;
4011
4172
 
4012
4173
  // src/components/widgets/TextWidget.tsx
4013
- var import_utils40 = require("@rjsf/utils");
4014
- var import_jsx_runtime48 = require("react/jsx-runtime");
4174
+ var import_utils41 = require("@rjsf/utils");
4175
+ var import_jsx_runtime51 = require("react/jsx-runtime");
4015
4176
  function TextWidget(props) {
4016
4177
  const { options, registry } = props;
4017
- const BaseInputTemplate2 = (0, import_utils40.getTemplate)("BaseInputTemplate", registry, options);
4018
- return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(BaseInputTemplate2, { ...props });
4178
+ const BaseInputTemplate2 = (0, import_utils41.getTemplate)("BaseInputTemplate", registry, options);
4179
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(BaseInputTemplate2, { ...props });
4019
4180
  }
4020
4181
 
4021
4182
  // src/components/widgets/TimeWidget.tsx
4022
- var import_react21 = require("react");
4023
- var import_utils41 = require("@rjsf/utils");
4024
- var import_jsx_runtime49 = require("react/jsx-runtime");
4183
+ var import_react23 = require("react");
4184
+ var import_utils42 = require("@rjsf/utils");
4185
+ var import_jsx_runtime52 = require("react/jsx-runtime");
4025
4186
  function TimeWidget(props) {
4026
4187
  const { onChange, options, registry } = props;
4027
- const BaseInputTemplate2 = (0, import_utils41.getTemplate)("BaseInputTemplate", registry, options);
4028
- const handleChange = (0, import_react21.useCallback)((value) => onChange(value ? `${value}:00` : void 0), [onChange]);
4029
- return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(BaseInputTemplate2, { type: "time", ...props, onChange: handleChange });
4188
+ const BaseInputTemplate2 = (0, import_utils42.getTemplate)("BaseInputTemplate", registry, options);
4189
+ const handleChange = (0, import_react23.useCallback)((value) => onChange(value ? `${value}:00` : void 0), [onChange]);
4190
+ return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(BaseInputTemplate2, { type: "time", ...props, onChange: handleChange });
4030
4191
  }
4031
4192
 
4032
4193
  // src/components/widgets/URLWidget.tsx
4033
- var import_utils42 = require("@rjsf/utils");
4034
- var import_jsx_runtime50 = require("react/jsx-runtime");
4194
+ var import_utils43 = require("@rjsf/utils");
4195
+ var import_jsx_runtime53 = require("react/jsx-runtime");
4035
4196
  function URLWidget(props) {
4036
4197
  const { options, registry } = props;
4037
- const BaseInputTemplate2 = (0, import_utils42.getTemplate)("BaseInputTemplate", registry, options);
4038
- return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(BaseInputTemplate2, { type: "url", ...props });
4198
+ const BaseInputTemplate2 = (0, import_utils43.getTemplate)("BaseInputTemplate", registry, options);
4199
+ return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(BaseInputTemplate2, { type: "url", ...props });
4039
4200
  }
4040
4201
 
4041
4202
  // src/components/widgets/UpDownWidget.tsx
4042
- var import_utils43 = require("@rjsf/utils");
4043
- var import_jsx_runtime51 = require("react/jsx-runtime");
4203
+ var import_utils44 = require("@rjsf/utils");
4204
+ var import_jsx_runtime54 = require("react/jsx-runtime");
4044
4205
  function UpDownWidget(props) {
4045
4206
  const { options, registry } = props;
4046
- const BaseInputTemplate2 = (0, import_utils43.getTemplate)("BaseInputTemplate", registry, options);
4047
- return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(BaseInputTemplate2, { type: "number", ...props });
4207
+ const BaseInputTemplate2 = (0, import_utils44.getTemplate)("BaseInputTemplate", registry, options);
4208
+ return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(BaseInputTemplate2, { type: "number", ...props });
4048
4209
  }
4049
4210
 
4050
4211
  // src/components/widgets/index.ts
@@ -4082,17 +4243,21 @@ function getDefaultRegistry() {
4082
4243
  widgets: widgets_default(),
4083
4244
  rootSchema: {},
4084
4245
  formContext: {},
4085
- translateString: import_utils44.englishStringTranslator
4246
+ translateString: import_utils45.englishStringTranslator,
4247
+ globalFormOptions: { idPrefix: import_utils45.DEFAULT_ID_PREFIX, idSeparator: import_utils45.DEFAULT_ID_SEPARATOR }
4086
4248
  };
4087
4249
  }
4088
4250
 
4089
4251
  // src/components/Form.tsx
4090
- var import_jsx_runtime52 = require("react/jsx-runtime");
4091
- var Form = class extends import_react22.Component {
4252
+ var import_jsx_runtime55 = require("react/jsx-runtime");
4253
+ var Form = class extends import_react24.Component {
4092
4254
  /** The ref used to hold the `form` element, this needs to be `any` because `tagName` or `_internalFormWrapper` can
4093
4255
  * provide any possible type here
4094
4256
  */
4095
4257
  formElement;
4258
+ /** The list of pending changes
4259
+ */
4260
+ pendingChanges = [];
4096
4261
  /** Constructs the `Form` from the `props`. Will setup the initial state from the props. It will also call the
4097
4262
  * `onChange` handler if the initially provided `formData` is modified to add missing default values as part of the
4098
4263
  * state construction.
@@ -4105,10 +4270,10 @@ var Form = class extends import_react22.Component {
4105
4270
  throw new Error("A validator is required for Form functionality to work");
4106
4271
  }
4107
4272
  this.state = this.getStateFromProps(props, props.formData);
4108
- if (this.props.onChange && !(0, import_utils45.deepEquals)(this.state.formData, this.props.formData)) {
4273
+ if (this.props.onChange && !(0, import_utils46.deepEquals)(this.state.formData, this.props.formData)) {
4109
4274
  this.props.onChange(this.state);
4110
4275
  }
4111
- this.formElement = (0, import_react22.createRef)();
4276
+ this.formElement = (0, import_react24.createRef)();
4112
4277
  }
4113
4278
  /**
4114
4279
  * `getSnapshotBeforeUpdate` is a React lifecycle method that is invoked right before the most recently rendered
@@ -4129,10 +4294,12 @@ var Form = class extends import_react22.Component {
4129
4294
  * with a flag indicating that an update is not necessary.
4130
4295
  */
4131
4296
  getSnapshotBeforeUpdate(prevProps, prevState) {
4132
- if (!(0, import_utils45.deepEquals)(this.props, prevProps)) {
4133
- const formDataChangedFields = (0, import_utils45.getChangedFields)(this.props.formData, prevProps.formData);
4134
- const isSchemaChanged = !(0, import_utils45.deepEquals)(prevProps.schema, this.props.schema);
4135
- const isFormDataChanged = formDataChangedFields.length > 0 || !(0, import_utils45.deepEquals)(prevProps.formData, this.props.formData);
4297
+ if (!(0, import_utils46.deepEquals)(this.props, prevProps)) {
4298
+ const formDataChangedFields = (0, import_utils46.getChangedFields)(this.props.formData, prevProps.formData);
4299
+ const stateDataChangedFields = (0, import_utils46.getChangedFields)(this.props.formData, this.state.formData);
4300
+ const isSchemaChanged = !(0, import_utils46.deepEquals)(prevProps.schema, this.props.schema);
4301
+ const isFormDataChanged = formDataChangedFields.length > 0 || !(0, import_utils46.deepEquals)(prevProps.formData, this.props.formData);
4302
+ const isStateDataChanged = stateDataChangedFields.length > 0 || !(0, import_utils46.deepEquals)(this.state.formData, this.props.formData);
4136
4303
  const nextState = this.getStateFromProps(
4137
4304
  this.props,
4138
4305
  this.props.formData,
@@ -4141,9 +4308,11 @@ var Form = class extends import_react22.Component {
4141
4308
  // match one of the subSchemas, the retrieved schema must be updated.
4142
4309
  isSchemaChanged || isFormDataChanged ? void 0 : this.state.retrievedSchema,
4143
4310
  isSchemaChanged,
4144
- formDataChangedFields
4311
+ formDataChangedFields,
4312
+ // Skip live validation for this request if no form data has changed from the last state
4313
+ !isStateDataChanged
4145
4314
  );
4146
- const shouldUpdate = !(0, import_utils45.deepEquals)(nextState, prevState);
4315
+ const shouldUpdate = !(0, import_utils46.deepEquals)(nextState, prevState);
4147
4316
  return { nextState, shouldUpdate };
4148
4317
  }
4149
4318
  return { shouldUpdate: false };
@@ -4163,7 +4332,7 @@ var Form = class extends import_react22.Component {
4163
4332
  componentDidUpdate(_, prevState, snapshot) {
4164
4333
  if (snapshot.shouldUpdate) {
4165
4334
  const { nextState } = snapshot;
4166
- if (!(0, import_utils45.deepEquals)(nextState.formData, this.props.formData) && !(0, import_utils45.deepEquals)(nextState.formData, prevState.formData) && this.props.onChange) {
4335
+ if (!(0, import_utils46.deepEquals)(nextState.formData, this.props.formData) && !(0, import_utils46.deepEquals)(nextState.formData, prevState.formData) && this.props.onChange) {
4167
4336
  this.props.onChange(nextState);
4168
4337
  }
4169
4338
  this.setState(nextState);
@@ -4178,35 +4347,42 @@ var Form = class extends import_react22.Component {
4178
4347
  * @param retrievedSchema - An expanded schema, if not provided, it will be retrieved from the `schema` and `formData`.
4179
4348
  * @param isSchemaChanged - A flag indicating whether the schema has changed.
4180
4349
  * @param formDataChangedFields - The changed fields of `formData`
4350
+ * @param skipLiveValidate - Optional flag, if true, means that we are not running live validation
4181
4351
  * @returns - The new state for the `Form`
4182
4352
  */
4183
- getStateFromProps(props, inputFormData, retrievedSchema, isSchemaChanged = false, formDataChangedFields = []) {
4353
+ getStateFromProps(props, inputFormData, retrievedSchema, isSchemaChanged = false, formDataChangedFields = [], skipLiveValidate = false) {
4184
4354
  const state = this.state || {};
4185
4355
  const schema = "schema" in props ? props.schema : this.props.schema;
4356
+ const validator2 = "validator" in props ? props.validator : this.props.validator;
4186
4357
  const uiSchema = ("uiSchema" in props ? props.uiSchema : this.props.uiSchema) || {};
4187
4358
  const edit = typeof inputFormData !== "undefined";
4188
4359
  const liveValidate = "liveValidate" in props ? props.liveValidate : this.props.liveValidate;
4189
4360
  const mustValidate = edit && !props.noValidate && liveValidate;
4190
- const rootSchema = schema;
4191
4361
  const experimental_defaultFormStateBehavior = "experimental_defaultFormStateBehavior" in props ? props.experimental_defaultFormStateBehavior : this.props.experimental_defaultFormStateBehavior;
4192
4362
  const experimental_customMergeAllOf = "experimental_customMergeAllOf" in props ? props.experimental_customMergeAllOf : this.props.experimental_customMergeAllOf;
4193
4363
  let schemaUtils = state.schemaUtils;
4194
4364
  if (!schemaUtils || schemaUtils.doesSchemaUtilsDiffer(
4195
- props.validator,
4196
- rootSchema,
4365
+ validator2,
4366
+ schema,
4197
4367
  experimental_defaultFormStateBehavior,
4198
4368
  experimental_customMergeAllOf
4199
4369
  )) {
4200
- schemaUtils = (0, import_utils45.createSchemaUtils)(
4201
- props.validator,
4202
- rootSchema,
4370
+ schemaUtils = (0, import_utils46.createSchemaUtils)(
4371
+ validator2,
4372
+ schema,
4203
4373
  experimental_defaultFormStateBehavior,
4204
4374
  experimental_customMergeAllOf
4205
4375
  );
4206
4376
  }
4207
- const formData = schemaUtils.getDefaultFormState(schema, inputFormData);
4377
+ const rootSchema = schemaUtils.getRootSchema();
4378
+ const formData = schemaUtils.getDefaultFormState(
4379
+ rootSchema,
4380
+ inputFormData,
4381
+ false,
4382
+ state.initialDefaultsGenerated
4383
+ );
4208
4384
  const _retrievedSchema = this.updateRetrievedSchema(
4209
- retrievedSchema ?? schemaUtils.retrieveSchema(schema, formData)
4385
+ retrievedSchema ?? schemaUtils.retrieveSchema(rootSchema, formData)
4210
4386
  );
4211
4387
  const getCurrentErrors = () => {
4212
4388
  if (props.noValidate || isSchemaChanged) {
@@ -4226,25 +4402,28 @@ var Form = class extends import_react22.Component {
4226
4402
  let errorSchema;
4227
4403
  let schemaValidationErrors = state.schemaValidationErrors;
4228
4404
  let schemaValidationErrorSchema = state.schemaValidationErrorSchema;
4229
- if (mustValidate) {
4230
- const schemaValidation = this.validate(formData, schema, schemaUtils, _retrievedSchema);
4231
- errors = schemaValidation.errors;
4232
- if (retrievedSchema === void 0) {
4233
- errorSchema = schemaValidation.errorSchema;
4234
- } else {
4235
- errorSchema = (0, import_utils45.mergeObjects)(
4236
- this.state?.errorSchema,
4237
- schemaValidation.errorSchema,
4238
- "preventDuplicates"
4239
- );
4240
- }
4241
- schemaValidationErrors = errors;
4242
- schemaValidationErrorSchema = errorSchema;
4405
+ if (mustValidate && !skipLiveValidate) {
4406
+ const liveValidation = this.liveValidate(
4407
+ rootSchema,
4408
+ schemaUtils,
4409
+ state.errorSchema,
4410
+ formData,
4411
+ void 0,
4412
+ state.customErrors,
4413
+ retrievedSchema,
4414
+ // If retrievedSchema is undefined which means the schema or formData has changed, we do not merge state.
4415
+ // Else in the case where it hasn't changed,
4416
+ retrievedSchema !== void 0
4417
+ );
4418
+ errors = liveValidation.errors;
4419
+ errorSchema = liveValidation.errorSchema;
4420
+ schemaValidationErrors = liveValidation.schemaValidationErrors;
4421
+ schemaValidationErrorSchema = liveValidation.schemaValidationErrorSchema;
4243
4422
  } else {
4244
4423
  const currentErrors = getCurrentErrors();
4245
4424
  errors = currentErrors.errors;
4246
4425
  errorSchema = currentErrors.errorSchema;
4247
- if (formDataChangedFields.length > 0) {
4426
+ if (formDataChangedFields.length > 0 && !mustValidate) {
4248
4427
  const newErrorSchema = formDataChangedFields.reduce(
4249
4428
  (acc, key) => {
4250
4429
  acc[key] = void 0;
@@ -4252,37 +4431,30 @@ var Form = class extends import_react22.Component {
4252
4431
  },
4253
4432
  {}
4254
4433
  );
4255
- errorSchema = schemaValidationErrorSchema = (0, import_utils45.mergeObjects)(
4434
+ errorSchema = schemaValidationErrorSchema = (0, import_utils46.mergeObjects)(
4256
4435
  currentErrors.errorSchema,
4257
4436
  newErrorSchema,
4258
4437
  "preventDuplicates"
4259
4438
  );
4260
4439
  }
4440
+ const mergedErrors = this.mergeErrors({ errorSchema, errors }, props.extraErrors, state.customErrors);
4441
+ errors = mergedErrors.errors;
4442
+ errorSchema = mergedErrors.errorSchema;
4261
4443
  }
4262
- if (props.extraErrors) {
4263
- const merged = (0, import_utils45.validationDataMerge)({ errorSchema, errors }, props.extraErrors);
4264
- errorSchema = merged.errorSchema;
4265
- errors = merged.errors;
4266
- }
4267
- const idSchema = schemaUtils.toIdSchema(
4268
- _retrievedSchema,
4269
- uiSchema["ui:rootFieldId"],
4270
- formData,
4271
- props.idPrefix,
4272
- props.idSeparator
4273
- );
4444
+ const fieldPathId = (0, import_utils46.toFieldPathId)("", this.getGlobalFormOptions(this.props));
4274
4445
  const nextState = {
4275
4446
  schemaUtils,
4276
- schema,
4447
+ schema: rootSchema,
4277
4448
  uiSchema,
4278
- idSchema,
4449
+ fieldPathId,
4279
4450
  formData,
4280
4451
  edit,
4281
4452
  errors,
4282
4453
  errorSchema,
4283
4454
  schemaValidationErrors,
4284
4455
  schemaValidationErrorSchema,
4285
- retrievedSchema: _retrievedSchema
4456
+ retrievedSchema: _retrievedSchema,
4457
+ initialDefaultsGenerated: true
4286
4458
  };
4287
4459
  return nextState;
4288
4460
  }
@@ -4293,31 +4465,18 @@ var Form = class extends import_react22.Component {
4293
4465
  * @returns - True if the component should be updated, false otherwise
4294
4466
  */
4295
4467
  shouldComponentUpdate(nextProps, nextState) {
4296
- return (0, import_utils45.shouldRender)(this, nextProps, nextState);
4297
- }
4298
- /** Gets the previously raised customValidate errors.
4299
- *
4300
- * @returns the previous customValidate errors
4301
- */
4302
- getPreviousCustomValidateErrors() {
4303
- const { customValidate, uiSchema } = this.props;
4304
- const prevFormData = this.state.formData;
4305
- let customValidateErrors = {};
4306
- if (typeof customValidate === "function") {
4307
- const errorHandler = customValidate(prevFormData, (0, import_utils45.createErrorHandler)(prevFormData), uiSchema);
4308
- const userErrorSchema = (0, import_utils45.unwrapErrorHandler)(errorHandler);
4309
- customValidateErrors = userErrorSchema;
4310
- }
4311
- return customValidateErrors;
4468
+ const { experimental_componentUpdateStrategy = "customDeep" } = this.props;
4469
+ return (0, import_utils46.shouldRender)(this, nextProps, nextState, experimental_componentUpdateStrategy);
4312
4470
  }
4313
4471
  /** Validates the `formData` against the `schema` using the `altSchemaUtils` (if provided otherwise it uses the
4314
4472
  * `schemaUtils` in the state), returning the results.
4315
4473
  *
4316
4474
  * @param formData - The new form data to validate
4317
4475
  * @param schema - The schema used to validate against
4318
- * @param altSchemaUtils - The alternate schemaUtils to use for validation
4476
+ * @param [altSchemaUtils] - The alternate schemaUtils to use for validation
4477
+ * @param [retrievedSchema] - An optionally retrieved schema for per
4319
4478
  */
4320
- validate(formData, schema = this.props.schema, altSchemaUtils, retrievedSchema) {
4479
+ validate(formData, schema = this.state.schema, altSchemaUtils, retrievedSchema) {
4321
4480
  const schemaUtils = altSchemaUtils ? altSchemaUtils : this.state.schemaUtils;
4322
4481
  const { customValidate, transformErrors, uiSchema } = this.props;
4323
4482
  const resolvedSchema = retrievedSchema ?? schemaUtils.retrieveSchema(schema, formData);
@@ -4326,24 +4485,75 @@ var Form = class extends import_react22.Component {
4326
4485
  /** Renders any errors contained in the `state` in using the `ErrorList`, if not disabled by `showErrorList`. */
4327
4486
  renderErrors(registry) {
4328
4487
  const { errors, errorSchema, schema, uiSchema } = this.state;
4329
- const { formContext } = this.props;
4330
- const options = (0, import_utils45.getUiOptions)(uiSchema);
4331
- const ErrorListTemplate = (0, import_utils45.getTemplate)("ErrorListTemplate", registry, options);
4488
+ const options = (0, import_utils46.getUiOptions)(uiSchema);
4489
+ const ErrorListTemplate = (0, import_utils46.getTemplate)("ErrorListTemplate", registry, options);
4332
4490
  if (errors && errors.length) {
4333
- return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
4491
+ return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
4334
4492
  ErrorListTemplate,
4335
4493
  {
4336
4494
  errors,
4337
4495
  errorSchema: errorSchema || {},
4338
4496
  schema,
4339
4497
  uiSchema,
4340
- formContext,
4341
4498
  registry
4342
4499
  }
4343
4500
  );
4344
4501
  }
4345
4502
  return null;
4346
4503
  }
4504
+ /** Merges any `extraErrors` or `customErrors` into the given `schemaValidation` object, returning the result
4505
+ *
4506
+ * @param schemaValidation - The `ValidationData` object into which additional errors are merged
4507
+ * @param [extraErrors] - The extra errors from the props
4508
+ * @param [customErrors] - The customErrors from custom components
4509
+ * @return - The `extraErrors` and `customErrors` merged into the `schemaValidation`
4510
+ * @private
4511
+ */
4512
+ mergeErrors(schemaValidation, extraErrors, customErrors) {
4513
+ let errorSchema = schemaValidation.errorSchema;
4514
+ let errors = schemaValidation.errors;
4515
+ if (extraErrors) {
4516
+ const merged = (0, import_utils46.validationDataMerge)(schemaValidation, extraErrors);
4517
+ errorSchema = merged.errorSchema;
4518
+ errors = merged.errors;
4519
+ }
4520
+ if (customErrors) {
4521
+ const merged = (0, import_utils46.validationDataMerge)(schemaValidation, customErrors.ErrorSchema, true);
4522
+ errorSchema = merged.errorSchema;
4523
+ errors = merged.errors;
4524
+ }
4525
+ return { errors, errorSchema };
4526
+ }
4527
+ /** Performs live validation and then updates and returns the errors and error schemas by potentially merging in
4528
+ * `extraErrors` and `customErrors`.
4529
+ *
4530
+ * @param rootSchema - The `rootSchema` from the state
4531
+ * @param schemaUtils - The `SchemaUtilsType` from the state
4532
+ * @param originalErrorSchema - The original `ErrorSchema` from the state
4533
+ * @param [formData] - The new form data to validate
4534
+ * @param [extraErrors] - The extra errors from the props
4535
+ * @param [customErrors] - The customErrors from custom components
4536
+ * @param [retrievedSchema] - An expanded schema, if not provided, it will be retrieved from the `schema` and `formData`
4537
+ * @param [mergeIntoOriginalErrorSchema=false] - Optional flag indicating whether we merge into original schema
4538
+ * @returns - An object containing `errorSchema`, `errors`, `schemaValidationErrors` and `schemaValidationErrorSchema`
4539
+ * @private
4540
+ */
4541
+ liveValidate(rootSchema, schemaUtils, originalErrorSchema, formData, extraErrors, customErrors, retrievedSchema, mergeIntoOriginalErrorSchema = false) {
4542
+ const schemaValidation = this.validate(formData, rootSchema, schemaUtils, retrievedSchema);
4543
+ const errors = schemaValidation.errors;
4544
+ let errorSchema = schemaValidation.errorSchema;
4545
+ if (mergeIntoOriginalErrorSchema) {
4546
+ errorSchema = (0, import_utils46.mergeObjects)(
4547
+ originalErrorSchema,
4548
+ schemaValidation.errorSchema,
4549
+ "preventDuplicates"
4550
+ );
4551
+ }
4552
+ const schemaValidationErrors = errors;
4553
+ const schemaValidationErrorSchema = errorSchema;
4554
+ const mergedErrors = this.mergeErrors({ errorSchema, errors }, extraErrors, customErrors);
4555
+ return { ...mergedErrors, schemaValidationErrors, schemaValidationErrorSchema };
4556
+ }
4347
4557
  /** Returns the `formData` with only the elements specified in the `fields` list
4348
4558
  *
4349
4559
  * @param formData - The data for the `Form`
@@ -4365,19 +4575,23 @@ var Form = class extends import_react22.Component {
4365
4575
  * @param [formData] - The form data to use while checking for empty objects/arrays
4366
4576
  */
4367
4577
  getFieldNames = (pathSchema, formData) => {
4578
+ const formValueHasData = (value, isLeaf) => typeof value !== "object" || (0, import_isEmpty4.default)(value) || isLeaf && !(0, import_isEmpty4.default)(value);
4368
4579
  const getAllPaths = (_obj, acc = [], paths = [[]]) => {
4369
- Object.keys(_obj).forEach((key) => {
4370
- if (typeof _obj[key] === "object") {
4580
+ const objKeys = Object.keys(_obj);
4581
+ objKeys.forEach((key) => {
4582
+ const data = _obj[key];
4583
+ if (typeof data === "object") {
4371
4584
  const newPaths = paths.map((path) => [...path, key]);
4372
- if (_obj[key][import_utils45.RJSF_ADDITIONAL_PROPERTIES_FLAG] && _obj[key][import_utils45.NAME_KEY] !== "") {
4373
- acc.push(_obj[key][import_utils45.NAME_KEY]);
4585
+ if (data[import_utils46.RJSF_ADDITIONAL_PROPERTIES_FLAG] && data[import_utils46.NAME_KEY] !== "") {
4586
+ acc.push(data[import_utils46.NAME_KEY]);
4374
4587
  } else {
4375
- getAllPaths(_obj[key], acc, newPaths);
4588
+ getAllPaths(data, acc, newPaths);
4376
4589
  }
4377
- } else if (key === import_utils45.NAME_KEY && _obj[key] !== "") {
4590
+ } else if (key === import_utils46.NAME_KEY && data !== "") {
4378
4591
  paths.forEach((path) => {
4379
4592
  const formValue = (0, import_get6.default)(formData, path);
4380
- if (typeof formValue !== "object" || (0, import_isEmpty4.default)(formValue) || Array.isArray(formValue) && formValue.every((val) => typeof val !== "object")) {
4593
+ const isLeaf = objKeys.length === 1;
4594
+ if (formValueHasData(formValue, isLeaf) || Array.isArray(formValue) && formValue.every((val) => formValueHasData(val, isLeaf))) {
4381
4595
  acc.push(path);
4382
4596
  }
4383
4597
  });
@@ -4397,60 +4611,49 @@ var Form = class extends import_react22.Component {
4397
4611
  const retrievedSchema = schemaUtils.retrieveSchema(schema, formData);
4398
4612
  const pathSchema = schemaUtils.toPathSchema(retrievedSchema, "", formData);
4399
4613
  const fieldNames = this.getFieldNames(pathSchema, formData);
4400
- const newFormData = this.getUsedFormData(formData, fieldNames);
4401
- return newFormData;
4614
+ return this.getUsedFormData(formData, fieldNames);
4402
4615
  };
4403
- // Filtering errors based on your retrieved schema to only show errors for properties in the selected branch.
4404
- filterErrorsBasedOnSchema(schemaErrors, resolvedSchema, formData) {
4405
- const { retrievedSchema, schemaUtils } = this.state;
4406
- const _retrievedSchema = resolvedSchema ?? retrievedSchema;
4407
- const pathSchema = schemaUtils.toPathSchema(_retrievedSchema, "", formData);
4408
- const fieldNames = this.getFieldNames(pathSchema, formData);
4409
- const filteredErrors = (0, import_pick.default)(schemaErrors, fieldNames);
4410
- if (resolvedSchema?.type !== "object" && resolvedSchema?.type !== "array") {
4411
- filteredErrors.__errors = schemaErrors.__errors;
4412
- }
4413
- const prevCustomValidateErrors = this.getPreviousCustomValidateErrors();
4414
- const filterPreviousCustomErrors = (errors = [], prevCustomErrors) => {
4415
- if (errors.length === 0) {
4416
- return errors;
4417
- }
4418
- return errors.filter((error) => {
4419
- return !prevCustomErrors.includes(error);
4420
- });
4421
- };
4422
- const filterNilOrEmptyErrors = (errors, previousCustomValidateErrors = {}) => {
4423
- (0, import_forEach.default)(errors, (errorAtKey, errorKey) => {
4424
- const prevCustomValidateErrorAtKey = previousCustomValidateErrors[errorKey];
4425
- if ((0, import_isNil.default)(errorAtKey) || Array.isArray(errorAtKey) && errorAtKey.length === 0) {
4426
- delete errors[errorKey];
4427
- } else if ((0, import_utils45.isObject)(errorAtKey) && (0, import_utils45.isObject)(prevCustomValidateErrorAtKey) && Array.isArray(prevCustomValidateErrorAtKey?.__errors)) {
4428
- errors[errorKey] = filterPreviousCustomErrors(errorAtKey.__errors, prevCustomValidateErrorAtKey.__errors);
4429
- } else if (typeof errorAtKey === "object" && !Array.isArray(errorAtKey.__errors)) {
4430
- filterNilOrEmptyErrors(errorAtKey, previousCustomValidateErrors[errorKey]);
4431
- }
4432
- });
4433
- return errors;
4434
- };
4435
- return filterNilOrEmptyErrors(filteredErrors, prevCustomValidateErrors);
4436
- }
4437
- /** Function to handle changes made to a field in the `Form`. This handler receives an entirely new copy of the
4438
- * `formData` along with a new `ErrorSchema`. It will first update the `formData` with any missing default fields and
4439
- * then, if `omitExtraData` and `liveOmit` are turned on, the `formData` will be filtered to remove any extra data not
4440
- * in a form field. Then, the resulting formData will be validated if required. The state will be updated with the new
4441
- * updated (potentially filtered) `formData`, any errors that resulted from validation. Finally the `onChange`
4442
- * callback will be called if specified with the updated state.
4616
+ /** Pushes the given change information into the `pendingChanges` array and then calls `processPendingChanges()` if
4617
+ * the array only contains a single pending change.
4443
4618
  *
4444
- * @param formData - The new form data from a change to a field
4445
- * @param newErrorSchema - The new `ErrorSchema` based on the field change
4446
- * @param id - The id of the field that caused the change
4619
+ * @param newValue - The new form data from a change to a field
4620
+ * @param path - The path to the change into which to set the formData
4621
+ * @param [newErrorSchema] - The new `ErrorSchema` based on the field change
4622
+ * @param [id] - The id of the field that caused the change
4623
+ */
4624
+ onChange = (newValue, path, newErrorSchema, id) => {
4625
+ this.pendingChanges.push({ newValue, path, newErrorSchema, id });
4626
+ if (this.pendingChanges.length === 1) {
4627
+ this.processPendingChange();
4628
+ }
4629
+ };
4630
+ /** Function to handle changes made to a field in the `Form`. This handler gets the first change from the
4631
+ * `pendingChanges` list, containing the `newValue` for the `formData` and the `path` at which the `newValue` is to be
4632
+ * updated, along with a new, optional `ErrorSchema` for that same `path` and potentially the `id` of the field being
4633
+ * changed. It will first update the `formData` with any missing default fields and then, if `omitExtraData` and
4634
+ * `liveOmit` are turned on, the `formData` will be filtered to remove any extra data not in a form field. Then, the
4635
+ * resulting `formData` will be validated if required. The state will be updated with the new updated (potentially
4636
+ * filtered) `formData`, any errors that resulted from validation. Finally the `onChange` callback will be called, if
4637
+ * specified, with the updated state and the `processPendingChange()` function is called again.
4447
4638
  */
4448
- onChange = (formData, newErrorSchema, id) => {
4639
+ processPendingChange() {
4640
+ if (this.pendingChanges.length === 0) {
4641
+ return;
4642
+ }
4643
+ const { newValue, path, id } = this.pendingChanges[0];
4644
+ const { newErrorSchema } = this.pendingChanges[0];
4449
4645
  const { extraErrors, omitExtraData, liveOmit, noValidate, liveValidate, onChange } = this.props;
4450
- const { schemaUtils, schema } = this.state;
4646
+ const { formData: oldFormData, schemaUtils, schema, fieldPathId, schemaValidationErrorSchema, errors } = this.state;
4647
+ let { customErrors, errorSchema: originalErrorSchema } = this.state;
4648
+ const rootPathId = fieldPathId.path[0] || "";
4649
+ const isRootPath = !path || path.length === 0 || path.length === 1 && path[0] === rootPathId;
4451
4650
  let retrievedSchema = this.state.retrievedSchema;
4452
- if ((0, import_utils45.isObject)(formData) || Array.isArray(formData)) {
4453
- const newState = this.getStateFromProps(this.props, formData);
4651
+ let formData = isRootPath ? newValue : (0, import_cloneDeep2.default)(oldFormData);
4652
+ if ((0, import_utils46.isObject)(formData) || Array.isArray(formData)) {
4653
+ if (!isRootPath) {
4654
+ (0, import_set5.default)(formData, path, newValue);
4655
+ }
4656
+ const newState = this.getStateFromProps(this.props, formData, void 0, void 0, void 0, true);
4454
4657
  formData = newState.formData;
4455
4658
  retrievedSchema = newState.retrievedSchema;
4456
4659
  }
@@ -4463,38 +4666,54 @@ var Form = class extends import_react22.Component {
4463
4666
  formData: newFormData
4464
4667
  };
4465
4668
  }
4466
- if (mustValidate) {
4467
- const schemaValidation = this.validate(newFormData, schema, schemaUtils, retrievedSchema);
4468
- let errors = schemaValidation.errors;
4469
- let errorSchema = schemaValidation.errorSchema;
4470
- const schemaValidationErrors = errors;
4471
- const schemaValidationErrorSchema = errorSchema;
4472
- if (extraErrors) {
4473
- const merged = (0, import_utils45.validationDataMerge)(schemaValidation, extraErrors);
4474
- errorSchema = merged.errorSchema;
4475
- errors = merged.errors;
4476
- }
4477
- if (newErrorSchema) {
4478
- const filteredErrors = this.filterErrorsBasedOnSchema(newErrorSchema, retrievedSchema, newFormData);
4479
- errorSchema = (0, import_utils45.mergeObjects)(errorSchema, filteredErrors, "preventDuplicates");
4669
+ if (newErrorSchema) {
4670
+ const oldValidationError = !isRootPath ? (0, import_get6.default)(schemaValidationErrorSchema, path) : schemaValidationErrorSchema;
4671
+ if (!(0, import_isEmpty4.default)(oldValidationError)) {
4672
+ if (!isRootPath) {
4673
+ (0, import_set5.default)(originalErrorSchema, path, newErrorSchema);
4674
+ } else {
4675
+ originalErrorSchema = newErrorSchema;
4676
+ }
4677
+ } else {
4678
+ if (!customErrors) {
4679
+ customErrors = new import_utils46.ErrorSchemaBuilder();
4680
+ }
4681
+ if (isRootPath) {
4682
+ customErrors.setErrors((0, import_get6.default)(newErrorSchema, import_utils46.ERRORS_KEY, ""));
4683
+ } else {
4684
+ (0, import_set5.default)(customErrors.ErrorSchema, path, newErrorSchema);
4685
+ }
4480
4686
  }
4481
- state = {
4482
- formData: newFormData,
4483
- errors,
4484
- errorSchema,
4485
- schemaValidationErrors,
4486
- schemaValidationErrorSchema
4487
- };
4687
+ } else if (customErrors && (0, import_get6.default)(customErrors.ErrorSchema, [...path, import_utils46.ERRORS_KEY])) {
4688
+ customErrors.clearErrors(path);
4689
+ }
4690
+ if (mustValidate && this.pendingChanges.length === 1) {
4691
+ const liveValidation = this.liveValidate(
4692
+ schema,
4693
+ schemaUtils,
4694
+ originalErrorSchema,
4695
+ newFormData,
4696
+ extraErrors,
4697
+ customErrors,
4698
+ retrievedSchema
4699
+ );
4700
+ state = { formData: newFormData, ...liveValidation, customErrors };
4488
4701
  } else if (!noValidate && newErrorSchema) {
4489
- const errorSchema = extraErrors ? (0, import_utils45.mergeObjects)(newErrorSchema, extraErrors, "preventDuplicates") : newErrorSchema;
4702
+ const mergedErrors = this.mergeErrors({ errorSchema: originalErrorSchema, errors }, extraErrors, customErrors);
4490
4703
  state = {
4491
4704
  formData: newFormData,
4492
- errorSchema,
4493
- errors: (0, import_utils45.toErrorList)(errorSchema)
4705
+ ...mergedErrors,
4706
+ customErrors
4494
4707
  };
4495
4708
  }
4496
- this.setState(state, () => onChange && onChange({ ...this.state, ...state }, id));
4497
- };
4709
+ this.setState(state, () => {
4710
+ if (onChange) {
4711
+ onChange({ ...this.state, ...state }, id);
4712
+ }
4713
+ this.pendingChanges.shift();
4714
+ this.processPendingChange();
4715
+ });
4716
+ }
4498
4717
  /**
4499
4718
  * If the retrievedSchema has changed the new retrievedSchema is returned.
4500
4719
  * Otherwise, the old retrievedSchema is returned to persist reference.
@@ -4505,7 +4724,7 @@ var Form = class extends import_react22.Component {
4505
4724
  * @returns The new retrieved schema if it has changed, else the old retrieved schema.
4506
4725
  */
4507
4726
  updateRetrievedSchema(retrievedSchema) {
4508
- const isTheSame = (0, import_utils45.deepEquals)(retrievedSchema, this.state?.retrievedSchema);
4727
+ const isTheSame = (0, import_utils46.deepEquals)(retrievedSchema, this.state?.retrievedSchema);
4509
4728
  return isTheSame ? this.state.retrievedSchema : retrievedSchema;
4510
4729
  }
4511
4730
  /**
@@ -4523,7 +4742,9 @@ var Form = class extends import_react22.Component {
4523
4742
  errorSchema: {},
4524
4743
  errors: [],
4525
4744
  schemaValidationErrors: [],
4526
- schemaValidationErrorSchema: {}
4745
+ schemaValidationErrorSchema: {},
4746
+ initialDefaultsGenerated: false,
4747
+ customErrors: void 0
4527
4748
  };
4528
4749
  this.setState(state, () => onChange && onChange({ ...this.state, ...state }));
4529
4750
  };
@@ -4572,7 +4793,7 @@ var Form = class extends import_react22.Component {
4572
4793
  }
4573
4794
  if (noValidate || this.validateFormWithFormData(newFormData)) {
4574
4795
  const errorSchema = extraErrors || {};
4575
- const errors = extraErrors ? (0, import_utils45.toErrorList)(extraErrors) : [];
4796
+ const errors = extraErrors ? (0, import_utils46.toErrorList)(extraErrors) : [];
4576
4797
  this.setState(
4577
4798
  {
4578
4799
  formData: newFormData,
@@ -4589,10 +4810,26 @@ var Form = class extends import_react22.Component {
4589
4810
  );
4590
4811
  }
4591
4812
  };
4813
+ /** Extracts the `GlobalFormOptions` from the given Form `props`
4814
+ *
4815
+ * @param props - The form props to extract the global form options from
4816
+ * @returns - The `GlobalFormOptions` from the props
4817
+ * @private
4818
+ */
4819
+ getGlobalFormOptions(props) {
4820
+ const {
4821
+ uiSchema = {},
4822
+ experimental_componentUpdateStrategy,
4823
+ idSeparator = import_utils46.DEFAULT_ID_SEPARATOR,
4824
+ idPrefix = import_utils46.DEFAULT_ID_PREFIX
4825
+ } = props;
4826
+ const rootFieldId = uiSchema["ui:rootFieldId"];
4827
+ return { idPrefix: rootFieldId || idPrefix, idSeparator, experimental_componentUpdateStrategy };
4828
+ }
4592
4829
  /** Returns the registry for the form */
4593
4830
  getRegistry() {
4594
4831
  const { translateString: customTranslateString, uiSchema = {} } = this.props;
4595
- const { schemaUtils } = this.state;
4832
+ const { schema, schemaUtils } = this.state;
4596
4833
  const { fields: fields2, templates: templates2, widgets: widgets2, formContext, translateString } = getDefaultRegistry();
4597
4834
  return {
4598
4835
  fields: { ...fields2, ...this.props.fields },
@@ -4605,11 +4842,12 @@ var Form = class extends import_react22.Component {
4605
4842
  }
4606
4843
  },
4607
4844
  widgets: { ...widgets2, ...this.props.widgets },
4608
- rootSchema: this.props.schema,
4845
+ rootSchema: schema,
4609
4846
  formContext: this.props.formContext || formContext,
4610
4847
  schemaUtils,
4611
4848
  translateString: customTranslateString || translateString,
4612
- globalUiOptions: uiSchema[import_utils45.UI_GLOBAL_OPTIONS_KEY]
4849
+ globalUiOptions: uiSchema[import_utils46.UI_GLOBAL_OPTIONS_KEY],
4850
+ globalFormOptions: this.getGlobalFormOptions(this.props)
4613
4851
  };
4614
4852
  }
4615
4853
  /** Provides a function that can be used to programmatically submit the `Form` */
@@ -4667,7 +4905,7 @@ var Form = class extends import_react22.Component {
4667
4905
  const hasError = errors.length > 0 || extraErrors && extraErrorsBlockSubmit;
4668
4906
  if (hasError) {
4669
4907
  if (extraErrors) {
4670
- const merged = (0, import_utils45.validationDataMerge)(schemaValidation, extraErrors);
4908
+ const merged = (0, import_utils46.validationDataMerge)(schemaValidation, extraErrors);
4671
4909
  errorSchema = merged.errorSchema;
4672
4910
  errors = merged.errors;
4673
4911
  }
@@ -4724,8 +4962,6 @@ var Form = class extends import_react22.Component {
4724
4962
  const {
4725
4963
  children,
4726
4964
  id,
4727
- idPrefix,
4728
- idSeparator,
4729
4965
  className = "",
4730
4966
  tagName,
4731
4967
  name,
@@ -4738,22 +4974,21 @@ var Form = class extends import_react22.Component {
4738
4974
  noHtml5Validate = false,
4739
4975
  disabled,
4740
4976
  readonly,
4741
- formContext,
4742
4977
  showErrorList = "top",
4743
4978
  _internalFormWrapper
4744
4979
  } = this.props;
4745
- const { schema, uiSchema, formData, errorSchema, idSchema } = this.state;
4980
+ const { schema, uiSchema, formData, errorSchema, fieldPathId } = this.state;
4746
4981
  const registry = this.getRegistry();
4747
4982
  const { SchemaField: _SchemaField } = registry.fields;
4748
4983
  const { SubmitButton: SubmitButton2 } = registry.templates.ButtonTemplates;
4749
4984
  const as = _internalFormWrapper ? tagName : void 0;
4750
4985
  const FormTag = _internalFormWrapper || tagName || "form";
4751
- let { [import_utils45.SUBMIT_BTN_OPTIONS_KEY]: submitOptions = {} } = (0, import_utils45.getUiOptions)(uiSchema);
4986
+ let { [import_utils46.SUBMIT_BTN_OPTIONS_KEY]: submitOptions = {} } = (0, import_utils46.getUiOptions)(uiSchema);
4752
4987
  if (disabled) {
4753
4988
  submitOptions = { ...submitOptions, props: { ...submitOptions.props, disabled: true } };
4754
4989
  }
4755
- const submitUiSchema = { [import_utils45.UI_OPTIONS_KEY]: { [import_utils45.SUBMIT_BTN_OPTIONS_KEY]: submitOptions } };
4756
- return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
4990
+ const submitUiSchema = { [import_utils46.UI_OPTIONS_KEY]: { [import_utils46.SUBMIT_BTN_OPTIONS_KEY]: submitOptions } };
4991
+ return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
4757
4992
  FormTag,
4758
4993
  {
4759
4994
  className: className ? className : "rjsf",
@@ -4771,17 +5006,14 @@ var Form = class extends import_react22.Component {
4771
5006
  ref: this.formElement,
4772
5007
  children: [
4773
5008
  showErrorList === "top" && this.renderErrors(registry),
4774
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
5009
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
4775
5010
  _SchemaField,
4776
5011
  {
4777
5012
  name: "",
4778
5013
  schema,
4779
5014
  uiSchema,
4780
5015
  errorSchema,
4781
- idSchema,
4782
- idPrefix,
4783
- idSeparator,
4784
- formContext,
5016
+ fieldPathId,
4785
5017
  formData,
4786
5018
  onChange: this.onChange,
4787
5019
  onBlur: this.onBlur,
@@ -4791,7 +5023,7 @@ var Form = class extends import_react22.Component {
4791
5023
  readonly
4792
5024
  }
4793
5025
  ),
4794
- children ? children : /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(SubmitButton2, { uiSchema: submitUiSchema, registry }),
5026
+ children ? children : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(SubmitButton2, { uiSchema: submitUiSchema, registry }),
4795
5027
  showErrorList === "bottom" && this.renderErrors(registry)
4796
5028
  ]
4797
5029
  }
@@ -4800,10 +5032,10 @@ var Form = class extends import_react22.Component {
4800
5032
  };
4801
5033
 
4802
5034
  // src/withTheme.tsx
4803
- var import_react23 = require("react");
4804
- var import_jsx_runtime53 = require("react/jsx-runtime");
5035
+ var import_react25 = require("react");
5036
+ var import_jsx_runtime56 = require("react/jsx-runtime");
4805
5037
  function withTheme(themeProps) {
4806
- return (0, import_react23.forwardRef)(
5038
+ return (0, import_react25.forwardRef)(
4807
5039
  ({ fields: fields2, widgets: widgets2, templates: templates2, ...directProps }, ref) => {
4808
5040
  fields2 = { ...themeProps?.fields, ...fields2 };
4809
5041
  widgets2 = { ...themeProps?.widgets, ...widgets2 };
@@ -4815,7 +5047,7 @@ function withTheme(themeProps) {
4815
5047
  ...templates2?.ButtonTemplates
4816
5048
  }
4817
5049
  };
4818
- return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
5050
+ return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
4819
5051
  Form,
4820
5052
  {
4821
5053
  ...themeProps,
@@ -4830,6 +5062,24 @@ function withTheme(themeProps) {
4830
5062
  );
4831
5063
  }
4832
5064
 
5065
+ // src/getTestRegistry.tsx
5066
+ var import_utils47 = require("@rjsf/utils");
5067
+ var import_validator_ajv8 = __toESM(require("@rjsf/validator-ajv8"), 1);
5068
+ function getTestRegistry(rootSchema, fields2 = {}, templates2 = {}, widgets2 = {}, formContext = {}, globalFormOptions = { idPrefix: import_utils47.DEFAULT_ID_PREFIX, idSeparator: import_utils47.DEFAULT_ID_SEPARATOR }) {
5069
+ const defaults = getDefaultRegistry();
5070
+ const schemaUtils = (0, import_utils47.createSchemaUtils)(import_validator_ajv8.default, rootSchema);
5071
+ return {
5072
+ fields: { ...defaults.fields, ...fields2 },
5073
+ templates: { ...defaults.templates, ...templates2 },
5074
+ widgets: { ...defaults.widgets, ...widgets2 },
5075
+ formContext,
5076
+ rootSchema,
5077
+ schemaUtils,
5078
+ translateString: import_utils47.englishStringTranslator,
5079
+ globalFormOptions
5080
+ };
5081
+ }
5082
+
4833
5083
  // src/index.ts
4834
5084
  var index_default = Form;
4835
- //# sourceMappingURL=index.js.map
5085
+ //# sourceMappingURL=index.cjs.map