@rjsf/core 6.0.1 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/core.umd.js +139 -91
  2. package/dist/index.cjs +369 -312
  3. package/dist/index.cjs.map +4 -4
  4. package/dist/index.esm.js +248 -188
  5. package/dist/index.esm.js.map +4 -4
  6. package/lib/components/Form.d.ts.map +1 -1
  7. package/lib/components/Form.js +7 -3
  8. package/lib/components/RichHelp.d.ts +20 -0
  9. package/lib/components/RichHelp.d.ts.map +1 -0
  10. package/lib/components/RichHelp.js +17 -0
  11. package/lib/components/constants.d.ts +5 -0
  12. package/lib/components/constants.d.ts.map +1 -0
  13. package/lib/components/constants.js +4 -0
  14. package/lib/components/fields/ArrayField.d.ts.map +1 -1
  15. package/lib/components/fields/ArrayField.js +39 -17
  16. package/lib/components/fields/FallbackField.d.ts.map +1 -1
  17. package/lib/components/fields/FallbackField.js +11 -3
  18. package/lib/components/fields/ObjectField.d.ts.map +1 -1
  19. package/lib/components/fields/ObjectField.js +7 -9
  20. package/lib/components/fields/StringField.d.ts.map +1 -1
  21. package/lib/components/fields/StringField.js +3 -3
  22. package/lib/components/templates/ArrayFieldItemTemplate.d.ts.map +1 -1
  23. package/lib/components/templates/ArrayFieldItemTemplate.js +5 -5
  24. package/lib/components/templates/ButtonTemplates/AddButton.d.ts.map +1 -1
  25. package/lib/components/templates/ButtonTemplates/AddButton.js +1 -1
  26. package/lib/components/templates/FieldHelpTemplate.d.ts.map +1 -1
  27. package/lib/components/templates/FieldHelpTemplate.js +3 -6
  28. package/lib/components/templates/FieldTemplate/FieldTemplate.d.ts.map +1 -1
  29. package/lib/components/templates/FieldTemplate/FieldTemplate.js +2 -1
  30. package/lib/components/templates/WrapIfAdditionalTemplate.d.ts.map +1 -1
  31. package/lib/components/templates/WrapIfAdditionalTemplate.js +4 -2
  32. package/lib/components/widgets/CheckboxWidget.d.ts.map +1 -1
  33. package/lib/components/widgets/CheckboxWidget.js +4 -2
  34. package/lib/index.d.ts +3 -2
  35. package/lib/index.d.ts.map +1 -1
  36. package/lib/index.js +2 -1
  37. package/lib/tsconfig.tsbuildinfo +1 -1
  38. package/package.json +2 -2
  39. package/src/components/Form.tsx +6 -4
  40. package/src/components/RichHelp.tsx +46 -0
  41. package/src/components/constants.ts +5 -0
  42. package/src/components/fields/ArrayField.tsx +52 -29
  43. package/src/components/fields/FallbackField.tsx +18 -10
  44. package/src/components/fields/ObjectField.tsx +7 -12
  45. package/src/components/fields/StringField.tsx +3 -2
  46. package/src/components/templates/ArrayFieldItemTemplate.tsx +8 -11
  47. package/src/components/templates/ButtonTemplates/AddButton.tsx +3 -1
  48. package/src/components/templates/FieldHelpTemplate.tsx +5 -11
  49. package/src/components/templates/FieldTemplate/FieldTemplate.tsx +2 -1
  50. package/src/components/templates/WrapIfAdditionalTemplate.tsx +7 -3
  51. package/src/components/widgets/CheckboxWidget.tsx +4 -1
  52. package/src/index.ts +3 -2
package/dist/core.umd.js CHANGED
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@rjsf/utils'), require('lodash/cloneDeep'), require('lodash/get'), require('lodash/isEmpty'), require('lodash/pick'), require('lodash/set'), require('lodash/toPath'), require('lodash/isObject'), require('lodash/uniqueId'), require('react/jsx-runtime'), require('lodash/each'), require('lodash/flatten'), require('lodash/has'), require('lodash/includes'), require('lodash/intersection'), require('lodash/isFunction'), require('lodash/isEqual'), require('lodash/isPlainObject'), require('lodash/isString'), require('lodash/isUndefined'), require('lodash/last'), require('lodash/noop'), require('lodash/omit'), require('markdown-to-jsx'), require('lodash/unset'), require('@rjsf/validator-ajv8')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'react', '@rjsf/utils', 'lodash/cloneDeep', 'lodash/get', 'lodash/isEmpty', 'lodash/pick', 'lodash/set', 'lodash/toPath', 'lodash/isObject', 'lodash/uniqueId', 'react/jsx-runtime', 'lodash/each', 'lodash/flatten', 'lodash/has', 'lodash/includes', 'lodash/intersection', 'lodash/isFunction', 'lodash/isEqual', 'lodash/isPlainObject', 'lodash/isString', 'lodash/isUndefined', 'lodash/last', 'lodash/noop', 'lodash/omit', 'markdown-to-jsx', 'lodash/unset', '@rjsf/validator-ajv8'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.JSONSchemaForm = {}, global.react, global.utils, global.cloneDeep, global.get, global.isEmpty, global._pick, global.set, global._toPath, global.isObject, global.uniqueId, global.jsxRuntime, global.each, global.flatten, global.has, global.includes, global.intersection, global.isFunction, global.isEqual, global.isPlainObject, global.isString, global.isUndefined, global.last, global.noop, global.omit3, global.Markdown, global.unset, global.validator));
5
- })(this, (function (exports, react, utils, cloneDeep, get, isEmpty, _pick, set, _toPath, isObject, uniqueId, jsxRuntime, each, flatten, has, includes, intersection, isFunction, isEqual, isPlainObject, isString, isUndefined, last, noop, omit3, Markdown, unset, validator) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@rjsf/utils'), require('lodash/cloneDeep'), require('lodash/get'), require('lodash/isEmpty'), require('lodash/pick'), require('lodash/set'), require('lodash/toPath'), require('lodash/unset'), require('lodash/isObject'), require('lodash/uniqueId'), require('react/jsx-runtime'), require('lodash/each'), require('lodash/flatten'), require('lodash/has'), require('lodash/includes'), require('lodash/intersection'), require('lodash/isFunction'), require('lodash/isEqual'), require('lodash/isPlainObject'), require('lodash/isString'), require('lodash/isUndefined'), require('lodash/last'), require('lodash/noop'), require('lodash/omit'), require('markdown-to-jsx'), require('@rjsf/validator-ajv8')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'react', '@rjsf/utils', 'lodash/cloneDeep', 'lodash/get', 'lodash/isEmpty', 'lodash/pick', 'lodash/set', 'lodash/toPath', 'lodash/unset', 'lodash/isObject', 'lodash/uniqueId', 'react/jsx-runtime', 'lodash/each', 'lodash/flatten', 'lodash/has', 'lodash/includes', 'lodash/intersection', 'lodash/isFunction', 'lodash/isEqual', 'lodash/isPlainObject', 'lodash/isString', 'lodash/isUndefined', 'lodash/last', 'lodash/noop', 'lodash/omit', 'markdown-to-jsx', '@rjsf/validator-ajv8'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.JSONSchemaForm = {}, global.react, global.utils, global.cloneDeep, global.get, global.isEmpty, global._pick, global.set, global._toPath, global._unset, global.isObject, global.uniqueId, global.jsxRuntime, global.each, global.flatten, global.has, global.includes, global.intersection, global.isFunction, global.isEqual, global.isPlainObject, global.isString, global.isUndefined, global.last, global.noop, global.omit3, global.Markdown, global.validator));
5
+ })(this, (function (exports, react, utils, cloneDeep, get, isEmpty, _pick, set, _toPath, _unset, isObject, uniqueId, jsxRuntime, each, flatten, has, includes, intersection, isFunction, isEqual, isPlainObject, isString, isUndefined, last, noop, omit3, Markdown, validator) { 'use strict';
6
6
 
7
7
  // src/components/Form.tsx
8
8
  function generateRowId() {
@@ -53,9 +53,11 @@
53
53
  }
54
54
  }
55
55
  function getNewFormDataRow(registry, schema) {
56
- const { schemaUtils } = registry;
56
+ const { schemaUtils, globalFormOptions } = registry;
57
57
  let itemSchema = schema.items;
58
- if (utils.isFixedItems(schema) && utils.allowAdditionalItems(schema)) {
58
+ if (globalFormOptions.useFallbackUiForUnsupportedType && !itemSchema) {
59
+ itemSchema = {};
60
+ } else if (utils.isFixedItems(schema) && utils.allowAdditionalItems(schema)) {
59
61
  itemSchema = schema.additionalItems;
60
62
  }
61
63
  return schemaUtils.getDefaultFormState(itemSchema);
@@ -245,7 +247,9 @@
245
247
  handleReorderItems
246
248
  } = props;
247
249
  const {
248
- fields: { ArraySchemaField, SchemaField: SchemaField2 }
250
+ schemaUtils,
251
+ fields: { ArraySchemaField, SchemaField: SchemaField2 },
252
+ globalUiOptions
249
253
  } = registry;
250
254
  const fieldPathId = utils.useDeepCompareMemo(itemFieldPathId);
251
255
  const ItemSchemaField = ArraySchemaField || SchemaField2;
@@ -254,6 +258,9 @@
254
258
  registry,
255
259
  uiOptions
256
260
  );
261
+ const displayLabel = schemaUtils.getDisplayLabel(itemSchema, itemUiSchema, globalUiOptions);
262
+ const { description } = utils.getUiOptions(itemUiSchema);
263
+ const hasDescription = !!description || !!itemSchema.description;
257
264
  const { orderable = true, removable = true, copyable = false } = uiOptions;
258
265
  const has4 = {
259
266
  moveUp: orderable && canMoveUp,
@@ -347,7 +354,9 @@
347
354
  registry,
348
355
  schema: itemSchema,
349
356
  uiSchema: itemUiSchema,
350
- parentUiSchema
357
+ parentUiSchema,
358
+ displayLabel,
359
+ hasDescription
351
360
  };
352
361
  return /* @__PURE__ */ jsxRuntime.jsx(ArrayFieldItemTemplate2, { ...templateProps });
353
362
  }
@@ -590,7 +599,7 @@
590
599
  }
591
600
  function ArrayField(props) {
592
601
  const { schema, uiSchema, errorSchema, fieldPathId, registry, formData, onChange } = props;
593
- const { schemaUtils, translateString } = registry;
602
+ const { globalFormOptions, schemaUtils, translateString } = registry;
594
603
  const { keyedFormData, updateKeyedFormData } = useKeyedFormData(formData);
595
604
  const childFieldPathId = props.childFieldPathId ?? fieldPathId;
596
605
  const handleAddItem = react.useCallback(
@@ -727,24 +736,14 @@
727
736
  },
728
737
  [onChange, childFieldPathId]
729
738
  );
730
- if (!(utils.ITEMS_KEY in schema)) {
731
- const uiOptions = utils.getUiOptions(uiSchema);
732
- const UnsupportedFieldTemplate = utils.getTemplate(
733
- "UnsupportedFieldTemplate",
734
- registry,
735
- uiOptions
736
- );
737
- return /* @__PURE__ */ jsxRuntime.jsx(
738
- UnsupportedFieldTemplate,
739
- {
740
- schema,
741
- fieldPathId,
742
- reason: translateString(utils.TranslatableString.MissingItems),
743
- registry
744
- }
745
- );
746
- }
739
+ const arrayAsMultiProps = {
740
+ ...props,
741
+ formData,
742
+ fieldPathId: childFieldPathId,
743
+ onSelectChange
744
+ };
747
745
  const arrayProps = {
746
+ ...props,
748
747
  handleAddItem,
749
748
  handleCopyItem,
750
749
  handleRemoveItem,
@@ -752,19 +751,41 @@
752
751
  keyedFormData,
753
752
  onChange: handleChange
754
753
  };
755
- if (schemaUtils.isMultiSelect(schema)) {
756
- return /* @__PURE__ */ jsxRuntime.jsx(ArrayAsMultiSelect, { ...props, fieldPathId: childFieldPathId, onSelectChange });
754
+ if (!(utils.ITEMS_KEY in schema)) {
755
+ if (!globalFormOptions.useFallbackUiForUnsupportedType) {
756
+ const uiOptions = utils.getUiOptions(uiSchema);
757
+ const UnsupportedFieldTemplate = utils.getTemplate(
758
+ "UnsupportedFieldTemplate",
759
+ registry,
760
+ uiOptions
761
+ );
762
+ return /* @__PURE__ */ jsxRuntime.jsx(
763
+ UnsupportedFieldTemplate,
764
+ {
765
+ schema,
766
+ fieldPathId,
767
+ reason: translateString(utils.TranslatableString.MissingItems),
768
+ registry
769
+ }
770
+ );
771
+ }
772
+ const fallbackSchema = { ...schema, [utils.ITEMS_KEY]: { type: void 0 } };
773
+ arrayAsMultiProps.schema = fallbackSchema;
774
+ arrayProps.schema = fallbackSchema;
775
+ }
776
+ if (schemaUtils.isMultiSelect(arrayAsMultiProps.schema)) {
777
+ return /* @__PURE__ */ jsxRuntime.jsx(ArrayAsMultiSelect, { ...arrayAsMultiProps });
757
778
  }
758
779
  if (utils.isCustomWidget(uiSchema)) {
759
- return /* @__PURE__ */ jsxRuntime.jsx(ArrayAsCustomWidget, { ...props, fieldPathId: childFieldPathId, onSelectChange });
780
+ return /* @__PURE__ */ jsxRuntime.jsx(ArrayAsCustomWidget, { ...arrayAsMultiProps });
760
781
  }
761
- if (utils.isFixedItems(schema)) {
762
- return /* @__PURE__ */ jsxRuntime.jsx(FixedArray, { ...props, ...arrayProps });
782
+ if (utils.isFixedItems(arrayAsMultiProps.schema)) {
783
+ return /* @__PURE__ */ jsxRuntime.jsx(FixedArray, { ...arrayProps });
763
784
  }
764
- if (schemaUtils.isFilesArray(schema, uiSchema)) {
765
- return /* @__PURE__ */ jsxRuntime.jsx(ArrayAsFiles, { ...props, fieldPathId: childFieldPathId, onSelectChange });
785
+ if (schemaUtils.isFilesArray(arrayAsMultiProps.schema, uiSchema)) {
786
+ return /* @__PURE__ */ jsxRuntime.jsx(ArrayAsFiles, { ...arrayAsMultiProps });
766
787
  }
767
- return /* @__PURE__ */ jsxRuntime.jsx(NormalArray, { ...props, ...arrayProps });
788
+ return /* @__PURE__ */ jsxRuntime.jsx(NormalArray, { ...arrayProps });
768
789
  }
769
790
  function BooleanField(props) {
770
791
  const {
@@ -868,7 +889,7 @@
868
889
  function getFallbackTypeSelectionSchema(title) {
869
890
  return {
870
891
  type: "string",
871
- enum: ["string", "number", "boolean"],
892
+ enum: ["string", "number", "boolean", "object", "array"],
872
893
  default: "string",
873
894
  title
874
895
  };
@@ -878,6 +899,9 @@
878
899
  if (dataType === "string" || dataType === "number" || dataType === "boolean") {
879
900
  return dataType;
880
901
  }
902
+ if (dataType === "object") {
903
+ return Array.isArray(formData) ? "array" : "object";
904
+ }
881
905
  return "string";
882
906
  }
883
907
  function castToNewType(formData, newType) {
@@ -927,20 +951,13 @@
927
951
  }
928
952
  };
929
953
  if (!globalFormOptions.useFallbackUiForUnsupportedType) {
954
+ const { reason = translateString(utils.TranslatableString.UnknownFieldType, [String(schema.type)]) } = props;
930
955
  const UnsupportedFieldTemplate = utils.getTemplate(
931
956
  "UnsupportedFieldTemplate",
932
957
  registry,
933
958
  uiOptions
934
959
  );
935
- return /* @__PURE__ */ jsxRuntime.jsx(
936
- UnsupportedFieldTemplate,
937
- {
938
- schema,
939
- fieldPathId,
940
- reason: translateString(utils.TranslatableString.UnknownFieldType, [String(schema.type)]),
941
- registry
942
- }
943
- );
960
+ return /* @__PURE__ */ jsxRuntime.jsx(UnsupportedFieldTemplate, { schema, fieldPathId, reason, registry });
944
961
  }
945
962
  const FallbackFieldTemplate2 = utils.getTemplate(
946
963
  "FallbackFieldTemplate",
@@ -971,7 +988,17 @@
971
988
  },
972
989
  formData ? utils.hashObject(formData) : "__empty__"
973
990
  ),
974
- schemaField: /* @__PURE__ */ jsxRuntime.jsx(SchemaField2, { ...props, schema: { type, title: translateString(utils.TranslatableString.Value) } })
991
+ schemaField: /* @__PURE__ */ jsxRuntime.jsx(
992
+ SchemaField2,
993
+ {
994
+ ...props,
995
+ schema: {
996
+ type,
997
+ title: translateString(utils.TranslatableString.Value),
998
+ ...type === "object" && { additionalProperties: true }
999
+ }
1000
+ }
1001
+ )
975
1002
  }
976
1003
  );
977
1004
  }
@@ -1704,6 +1731,10 @@
1704
1731
  return /* @__PURE__ */ jsxRuntime.jsx(StringField2, { ...props, formData: value, onChange: handleChange });
1705
1732
  }
1706
1733
  var NumberField_default = NumberField;
1734
+
1735
+ // src/components/constants.ts
1736
+ var ADDITIONAL_PROPERTY_KEY_REMOVE = Symbol("remove-this-key");
1737
+ var IS_RESET = Symbol("reset");
1707
1738
  function isRequired(schema, name) {
1708
1739
  return Array.isArray(schema.required) && schema.required.indexOf(name) !== -1;
1709
1740
  }
@@ -1827,7 +1858,6 @@
1827
1858
  const schema = schemaUtils.retrieveSchema(rawSchema, formData, true);
1828
1859
  const uiOptions = utils.getUiOptions(uiSchema, globalUiOptions);
1829
1860
  const { properties: schemaProperties = {} } = schema;
1830
- const formDataHash = utils.hashObject(formData || {});
1831
1861
  const childFieldPathId = props.childFieldPathId ?? fieldPathId;
1832
1862
  const templateTitle = uiOptions.title ?? schema.title ?? title ?? name;
1833
1863
  const description = uiOptions.description ?? schema.description;
@@ -1900,11 +1930,9 @@
1900
1930
  );
1901
1931
  const handleRemoveProperty = react.useCallback(
1902
1932
  (key) => {
1903
- const copiedFormData = { ...formData };
1904
- unset(copiedFormData, key);
1905
- onChange(copiedFormData, childFieldPathId.path);
1933
+ onChange(ADDITIONAL_PROPERTY_KEY_REMOVE, [...childFieldPathId.path, key]);
1906
1934
  },
1907
- [onChange, childFieldPathId, formData]
1935
+ [onChange, childFieldPathId]
1908
1936
  );
1909
1937
  if (!renderOptionalField || hasFormData) {
1910
1938
  try {
@@ -1948,7 +1976,7 @@
1948
1976
  readonly,
1949
1977
  hideError
1950
1978
  },
1951
- addedByAdditionalProperties ? `${name2}-${formDataHash}` : name2
1979
+ name2
1952
1980
  );
1953
1981
  return {
1954
1982
  content,
@@ -2280,9 +2308,10 @@
2280
2308
  onFocus,
2281
2309
  registry,
2282
2310
  rawErrors,
2283
- hideError
2311
+ hideError,
2312
+ title
2284
2313
  } = props;
2285
- const { title, format } = schema;
2314
+ const { title: schemaTitle, format } = schema;
2286
2315
  const { widgets: widgets2, schemaUtils, globalUiOptions } = registry;
2287
2316
  const enumOptions = schemaUtils.isSelect(schema) ? utils.optionsList(schema, uiSchema) : void 0;
2288
2317
  let defaultWidget = enumOptions ? "select" : "text";
@@ -2291,7 +2320,7 @@
2291
2320
  }
2292
2321
  const { widget = defaultWidget, placeholder = "", title: uiTitle, ...options } = utils.getUiOptions(uiSchema);
2293
2322
  const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);
2294
- const label = uiTitle ?? title ?? name;
2323
+ const label = uiTitle ?? title ?? schemaTitle ?? name;
2295
2324
  const Widget = utils.getWidget(schema, widget, widgets2);
2296
2325
  const onWidgetChange = react.useCallback(
2297
2326
  (value, errorSchema, id) => {
@@ -2382,7 +2411,7 @@
2382
2411
  );
2383
2412
  }
2384
2413
  function ArrayFieldItemTemplate(props) {
2385
- const { children, className, buttonsProps, hasToolbar, registry, uiSchema } = props;
2414
+ const { children, className, buttonsProps, displayLabel, hasDescription, hasToolbar, registry, uiSchema } = props;
2386
2415
  const uiOptions = utils.getUiOptions(uiSchema);
2387
2416
  const ArrayFieldItemButtonsTemplate2 = utils.getTemplate(
2388
2417
  "ArrayFieldItemButtonsTemplate",
@@ -2395,19 +2424,12 @@
2395
2424
  paddingRight: 6,
2396
2425
  fontWeight: "bold"
2397
2426
  };
2398
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, children: [
2399
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: hasToolbar ? "col-xs-9" : "col-xs-12", children }),
2400
- hasToolbar && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-xs-3 array-item-toolbox", children: /* @__PURE__ */ jsxRuntime.jsx(
2401
- "div",
2402
- {
2403
- className: "btn-group",
2404
- style: {
2405
- display: "flex",
2406
- justifyContent: "space-around"
2407
- },
2408
- children: /* @__PURE__ */ jsxRuntime.jsx(ArrayFieldItemButtonsTemplate2, { ...buttonsProps, style: btnStyle })
2409
- }
2410
- ) })
2427
+ const margin = hasDescription ? 31 : 9;
2428
+ const containerStyle = { display: "flex", alignItems: displayLabel ? "center" : "baseline" };
2429
+ const toolbarStyle = { display: "flex", justifyContent: "flex-end", marginTop: displayLabel ? `${margin}px` : 0 };
2430
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, style: containerStyle, children: [
2431
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: hasToolbar ? "col-xs-9 col-md-10 col-xl-11" : "col-xs-12", children }),
2432
+ hasToolbar && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-xs-3 col-md-2 col-xl-1 array-item-toolbox", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "btn-group", style: toolbarStyle, children: /* @__PURE__ */ jsxRuntime.jsx(ArrayFieldItemButtonsTemplate2, { ...buttonsProps, style: btnStyle }) }) })
2411
2433
  ] });
2412
2434
  }
2413
2435
  function ArrayFieldItemButtonsTemplate(props) {
@@ -2687,19 +2709,25 @@
2687
2709
  registry
2688
2710
  }) {
2689
2711
  const { translateString } = registry;
2690
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "row", children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: `col-xs-3 col-xs-offset-9 text-right ${className}`, children: /* @__PURE__ */ jsxRuntime.jsx(
2691
- IconButton,
2712
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "row", children: /* @__PURE__ */ jsxRuntime.jsx(
2713
+ "p",
2692
2714
  {
2693
- id,
2694
- iconType: "info",
2695
- icon: "plus",
2696
- className: "btn-add col-xs-12",
2697
- title: translateString(utils.TranslatableString.AddButton),
2698
- onClick,
2699
- disabled,
2700
- registry
2715
+ className: `col-xs-4 col-sm-2 col-lg-1 col-xs-offset-8 col-sm-offset-10 col-lg-offset-11 text-right ${className}`,
2716
+ children: /* @__PURE__ */ jsxRuntime.jsx(
2717
+ IconButton,
2718
+ {
2719
+ id,
2720
+ iconType: "info",
2721
+ icon: "plus",
2722
+ className: "btn-add col-xs-12",
2723
+ title: translateString(utils.TranslatableString.AddButton),
2724
+ onClick,
2725
+ disabled,
2726
+ registry
2727
+ }
2728
+ )
2701
2729
  }
2702
- ) }) });
2730
+ ) });
2703
2731
  }
2704
2732
 
2705
2733
  // src/components/templates/ButtonTemplates/index.ts
@@ -2781,8 +2809,9 @@
2781
2809
  if (hidden) {
2782
2810
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "hidden", children });
2783
2811
  }
2812
+ const isCheckbox = uiOptions.widget === "checkbox";
2784
2813
  return /* @__PURE__ */ jsxRuntime.jsxs(WrapIfAdditionalTemplate2, { ...props, children: [
2785
- displayLabel && /* @__PURE__ */ jsxRuntime.jsx(Label, { label, required, id }),
2814
+ displayLabel && !isCheckbox && /* @__PURE__ */ jsxRuntime.jsx(Label, { label, required, id }),
2786
2815
  displayLabel && description ? description : null,
2787
2816
  children,
2788
2817
  errors,
@@ -2802,16 +2831,26 @@
2802
2831
  return /* @__PURE__ */ jsxRuntime.jsx("li", { className: "text-danger", children: error }, index);
2803
2832
  }) }) });
2804
2833
  }
2834
+ var TEST_IDS2 = utils.getTestIds();
2835
+ function RichHelp({
2836
+ help,
2837
+ registry,
2838
+ uiSchema = {}
2839
+ }) {
2840
+ const { globalUiOptions } = registry;
2841
+ const uiOptions = utils.getUiOptions(uiSchema, globalUiOptions);
2842
+ if (uiOptions.enableMarkdownInHelp && typeof help === "string") {
2843
+ return /* @__PURE__ */ jsxRuntime.jsx(Markdown, { options: { disableParsingRawHTML: true }, "data-testid": TEST_IDS2.markdown, children: help });
2844
+ }
2845
+ return help;
2846
+ }
2847
+ RichHelp.TEST_IDS = TEST_IDS2;
2805
2848
  function FieldHelpTemplate(props) {
2806
- const { fieldPathId, help } = props;
2849
+ const { fieldPathId, help, uiSchema, registry } = props;
2807
2850
  if (!help) {
2808
2851
  return null;
2809
2852
  }
2810
- const id = utils.helpId(fieldPathId);
2811
- if (typeof help === "string") {
2812
- return /* @__PURE__ */ jsxRuntime.jsx("p", { id, className: "help-block", children: help });
2813
- }
2814
- return /* @__PURE__ */ jsxRuntime.jsx("div", { id, className: "help-block", children: help });
2853
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { id: utils.helpId(fieldPathId), className: "help-block", children: /* @__PURE__ */ jsxRuntime.jsx(RichHelp, { help, registry, uiSchema }) });
2815
2854
  }
2816
2855
  function GridTemplate(props) {
2817
2856
  const { children, column, className, ...rest } = props;
@@ -2953,9 +2992,11 @@
2953
2992
  classNames,
2954
2993
  style,
2955
2994
  disabled,
2995
+ displayLabel,
2956
2996
  label,
2957
2997
  onKeyRenameBlur,
2958
2998
  onRemoveProperty,
2999
+ rawDescription,
2959
3000
  readonly,
2960
3001
  required,
2961
3002
  schema,
@@ -2969,6 +3010,7 @@
2969
3010
  const { RemoveButton: RemoveButton2 } = templates2.ButtonTemplates;
2970
3011
  const keyLabel = translateString(utils.TranslatableString.KeyLabel, [label]);
2971
3012
  const additional = utils.ADDITIONAL_PROPERTY_FLAG in schema;
3013
+ const hasDescription = !!rawDescription;
2972
3014
  const classNamesList = ["form-group", classNames];
2973
3015
  if (!hideError && rawErrors && rawErrors.length > 0) {
2974
3016
  classNamesList.push("has-error has-danger");
@@ -2977,9 +3019,11 @@
2977
3019
  if (!additional) {
2978
3020
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: uiClassNames, style, children });
2979
3021
  }
3022
+ const margin = hasDescription ? 46 : 26;
2980
3023
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: uiClassNames, style, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "row", children: [
2981
3024
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-xs-5 form-additional", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "form-group", children: [
2982
- /* @__PURE__ */ jsxRuntime.jsx(Label, { label: keyLabel, required, id: `${id}-key` }),
3025
+ displayLabel && /* @__PURE__ */ jsxRuntime.jsx(Label, { label: keyLabel, required, id: `${id}-key` }),
3026
+ displayLabel && rawDescription && /* @__PURE__ */ jsxRuntime.jsx("div", { children: "\xA0" }),
2983
3027
  /* @__PURE__ */ jsxRuntime.jsx(
2984
3028
  "input",
2985
3029
  {
@@ -2992,7 +3036,7 @@
2992
3036
  )
2993
3037
  ] }) }),
2994
3038
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "form-additional form-group col-xs-5", children }),
2995
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-xs-2", children: /* @__PURE__ */ jsxRuntime.jsx(
3039
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-xs-2", style: { marginTop: displayLabel ? `${margin}px` : void 0 }, children: /* @__PURE__ */ jsxRuntime.jsx(
2996
3040
  RemoveButton2,
2997
3041
  {
2998
3042
  id: utils.buttonId(id, "remove"),
@@ -3101,7 +3145,9 @@
3101
3145
  (event) => onFocus(id, event.target.checked),
3102
3146
  [onFocus, id]
3103
3147
  );
3104
- const description = options.description ?? schema.description;
3148
+ const uiOptions = utils.getUiOptions(uiSchema);
3149
+ const isCheckboxWidget = uiOptions.widget === "checkbox";
3150
+ const description = isCheckboxWidget ? void 0 : options.description ?? schema.description;
3105
3151
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `checkbox ${disabled || readonly ? "disabled" : ""}`, children: [
3106
3152
  !hideLabel && description && /* @__PURE__ */ jsxRuntime.jsx(
3107
3153
  DescriptionFieldTemplate,
@@ -3659,7 +3705,6 @@
3659
3705
  }
3660
3706
  };
3661
3707
  }
3662
- var IS_RESET = Symbol("reset");
3663
3708
  function toIChangeEvent(state, status) {
3664
3709
  return {
3665
3710
  ..._pick(state, ["schema", "uiSchema", "fieldPathId", "schemaUtils", "formData", "edit", "errors", "errorSchema"]),
@@ -4091,7 +4136,9 @@
4091
4136
  let retrievedSchema = this.state.retrievedSchema;
4092
4137
  let formData = isRootPath ? newValue : cloneDeep(oldFormData);
4093
4138
  if (utils.isObject(formData) || Array.isArray(formData)) {
4094
- if (!isRootPath) {
4139
+ if (newValue === ADDITIONAL_PROPERTY_KEY_REMOVE) {
4140
+ _unset(formData, path);
4141
+ } else if (!isRootPath) {
4095
4142
  set(formData, path, newValue);
4096
4143
  }
4097
4144
  const newState = this.getStateFromProps(this.props, formData, void 0, void 0, void 0, true);
@@ -4571,6 +4618,7 @@
4571
4618
  var index_default = Form;
4572
4619
 
4573
4620
  exports.RichDescription = RichDescription;
4621
+ exports.RichHelp = RichHelp;
4574
4622
  exports.default = index_default;
4575
4623
  exports.getDefaultRegistry = getDefaultRegistry;
4576
4624
  exports.getTestRegistry = getTestRegistry;