@limetech/lime-elements 39.13.2 → 39.14.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 (186) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/{_assignValue-D2D1zedG.js → _assignValue-DpsLUlF4.js} +25 -2
  3. package/dist/cjs/{_baseForOwn-QM0kHQT5.js → _baseEach-C570gT5Y.js} +43 -1
  4. package/dist/cjs/{_baseIsEqual-D6hrjmx4.js → _baseIsEqual-aOPReRWl.js} +1 -0
  5. package/dist/cjs/{_baseIteratee-iGEZ9pZY.js → _baseIteratee-DggA4e7a.js} +3 -1
  6. package/dist/cjs/_commonjsHelpers-CFO10eej.js +7 -0
  7. package/dist/cjs/_getAllKeysIn-BQIV8aw7.js +118 -0
  8. package/dist/cjs/_isIterateeCall-CPWXFS_s.js +72 -0
  9. package/dist/cjs/cloneDeep-CxFNKF1Y.js +619 -0
  10. package/dist/cjs/{isArrayLikeObject-CTP6Ak01.js → difference-Bfsq4sXB.js} +93 -5
  11. package/dist/cjs/{focus-trigger-element-NnpJ5nTp.js → focus-trigger-element-Brw8VubX.js} +1 -1
  12. package/dist/cjs/{format-D04vDIBj.js → format-D4jZb7Ls.js} +1 -1
  13. package/dist/cjs/{index-mbfaT7TB.js → index-BgFEL6FF.js} +1 -1
  14. package/dist/cjs/{isEmpty-DCC_l2Xp.js → isEmpty-EBCFxX1S.js} +1 -1
  15. package/dist/cjs/{isEqual-BsHLqE-x.js → isEqual-bXyw7kXo.js} +1 -1
  16. package/dist/cjs/lime-elements.cjs.js +1 -1
  17. package/dist/cjs/limel-badge.cjs.entry.js +2 -2
  18. package/dist/cjs/limel-breadcrumbs_7.cjs.entry.js +2 -3
  19. package/dist/cjs/limel-chip_2.cjs.entry.js +3 -3
  20. package/dist/cjs/limel-circular-progress.cjs.entry.js +2 -2
  21. package/dist/cjs/limel-code-editor.cjs.entry.js +1 -1
  22. package/dist/cjs/limel-date-picker.cjs.entry.js +3 -3
  23. package/dist/cjs/limel-dialog.cjs.entry.js +2 -2
  24. package/dist/cjs/limel-file-dropzone_2.cjs.entry.js +5 -44
  25. package/dist/cjs/limel-file-viewer.cjs.entry.js +2 -2
  26. package/dist/cjs/limel-flatpickr-adapter.cjs.entry.js +12 -74
  27. package/dist/cjs/limel-form.cjs.entry.js +38541 -50295
  28. package/dist/cjs/limel-markdown.cjs.entry.js +3 -3
  29. package/dist/cjs/limel-picker.cjs.entry.js +1 -0
  30. package/dist/cjs/limel-popover_2.cjs.entry.js +2 -3
  31. package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js +13 -478
  32. package/dist/cjs/limel-tab-bar.cjs.entry.js +4 -83
  33. package/dist/cjs/limel-table.cjs.entry.js +17 -272
  34. package/dist/cjs/loader.cjs.js +1 -1
  35. package/dist/cjs/{markdown-parser-DCnW9yak.js → markdown-parser-BIa99LAc.js} +2 -2
  36. package/dist/cjs/{moment-DCqC7BZP.js → moment-CqRdiK10.js} +1 -1
  37. package/dist/cjs/pickBy-kLjYLoam.js +201 -0
  38. package/dist/cjs/{sv-jO-ewmqh.js → sv-BSR4W58y.js} +1 -1
  39. package/dist/collection/components/form/adapters/widget-adapter.js +23 -30
  40. package/dist/collection/components/form/fields/array-field.js +39 -6
  41. package/dist/collection/components/form/fields/field-helpers.js +4 -4
  42. package/dist/collection/components/form/fields/object-field.js +4 -2
  43. package/dist/collection/components/form/fields/schema-field.js +33 -70
  44. package/dist/collection/components/form/form.css +19 -19
  45. package/dist/collection/components/form/form.js +40 -72
  46. package/dist/collection/components/form/form.test-schemas.js +308 -0
  47. package/dist/collection/components/form/row/row-context.js +2 -0
  48. package/dist/collection/components/form/row/row.js +2 -2
  49. package/dist/collection/components/form/templates/array-context.js +2 -0
  50. package/dist/collection/components/form/templates/array-field-collapsible-item.js +4 -4
  51. package/dist/collection/components/form/templates/array-field-item.js +47 -0
  52. package/dist/collection/components/form/templates/array-field-simple-item.js +6 -7
  53. package/dist/collection/components/form/templates/array-field.js +38 -94
  54. package/dist/collection/components/form/templates/index.js +1 -0
  55. package/dist/collection/components/form/templates/object-field.js +15 -11
  56. package/dist/collection/components/form/validation-display.js +75 -0
  57. package/dist/collection/components/form/validator.js +10 -0
  58. package/dist/collection/components/form/widgets/code-editor.js +1 -1
  59. package/dist/collection/components/form/widgets/select.js +2 -1
  60. package/dist/collection/components/picker/picker.js +1 -0
  61. package/dist/collection/components/table/table.js +12 -12
  62. package/dist/esm/{_assignValue-DkGAX8ec.js → _assignValue-DOEO9byf.js} +24 -2
  63. package/dist/esm/{_baseForOwn-CfpQNnvA.js → _baseEach-CL_-rBMy.js} +42 -2
  64. package/dist/esm/{_baseIsEqual-BvHnKRmD.js → _baseIsEqual-BfXMsuGh.js} +2 -2
  65. package/dist/esm/{_baseIteratee-DFBCJcMA.js → _baseIteratee-kS1-0_xD.js} +3 -3
  66. package/dist/esm/_commonjsHelpers-B85MJLTf.js +5 -0
  67. package/dist/esm/_getAllKeysIn-BKpeslPJ.js +113 -0
  68. package/dist/esm/_isIterateeCall-CTcCv8Mb.js +69 -0
  69. package/dist/esm/cloneDeep-BXAw5H-1.js +609 -0
  70. package/dist/esm/{isArrayLikeObject-D7yRwRv4.js → difference-DMAjHh-t.js} +91 -7
  71. package/dist/esm/{focus-trigger-element-6aEStEKM.js → focus-trigger-element-DubROLkE.js} +1 -1
  72. package/dist/esm/{format-BMPGHLQ8.js → format-hTrthuPP.js} +1 -1
  73. package/dist/esm/{index-DJJymEnS.js → index-t4DgGbWS.js} +1 -1
  74. package/dist/esm/{isArrayLike-bWHU4ebg.js → isArrayLike-D1QkaJU2.js} +1 -1
  75. package/dist/esm/{isEmpty-tfwtR2ai.js → isEmpty-DrFXbHWO.js} +2 -2
  76. package/dist/esm/{isEqual-BkQ4Z_9r.js → isEqual-CpaoJ_AF.js} +1 -1
  77. package/dist/esm/lime-elements.js +1 -1
  78. package/dist/esm/limel-badge.entry.js +2 -2
  79. package/dist/esm/limel-breadcrumbs_7.entry.js +2 -3
  80. package/dist/esm/limel-chip_2.entry.js +4 -4
  81. package/dist/esm/limel-circular-progress.entry.js +2 -2
  82. package/dist/esm/limel-code-editor.entry.js +1 -1
  83. package/dist/esm/limel-date-picker.entry.js +3 -3
  84. package/dist/esm/limel-dialog.entry.js +3 -3
  85. package/dist/esm/limel-file-dropzone_2.entry.js +4 -43
  86. package/dist/esm/limel-file-viewer.entry.js +2 -2
  87. package/dist/esm/limel-flatpickr-adapter.entry.js +8 -70
  88. package/dist/esm/limel-form.entry.js +38553 -50307
  89. package/dist/esm/limel-markdown.entry.js +3 -3
  90. package/dist/esm/limel-picker.entry.js +1 -0
  91. package/dist/esm/limel-popover_2.entry.js +2 -3
  92. package/dist/esm/limel-prosemirror-adapter.entry.js +12 -477
  93. package/dist/esm/limel-tab-bar.entry.js +4 -83
  94. package/dist/esm/limel-table.entry.js +14 -269
  95. package/dist/esm/loader.js +1 -1
  96. package/dist/esm/{markdown-parser-CXYHPPe2.js → markdown-parser-D7vLKElE.js} +2 -2
  97. package/dist/esm/{moment-DhvPC9Jt.js → moment-DQRNe8qq.js} +1 -1
  98. package/dist/esm/pickBy-BEA90LIZ.js +195 -0
  99. package/dist/esm/{sv-84mf7Xsv.js → sv-CY-6-yEp.js} +1 -1
  100. package/dist/lime-elements/lime-elements.esm.js +1 -1
  101. package/dist/lime-elements/p-1cb2d781.entry.js +13 -0
  102. package/dist/lime-elements/{p-bd77c457.entry.js → p-2160ff6e.entry.js} +1 -1
  103. package/dist/lime-elements/{p-00d6ccd6.entry.js → p-25ae3a55.entry.js} +5 -5
  104. package/dist/lime-elements/{p-be0cbddb.entry.js → p-374ec191.entry.js} +1 -1
  105. package/dist/lime-elements/p-3a662d7e.entry.js +1 -0
  106. package/dist/lime-elements/{p-f0f5eda1.entry.js → p-41be4893.entry.js} +1 -1
  107. package/dist/lime-elements/{p-c84911e6.entry.js → p-4ad193a2.entry.js} +1 -1
  108. package/dist/lime-elements/{p-dd7a2361.entry.js → p-4ce682cf.entry.js} +3 -3
  109. package/dist/lime-elements/{p-eeae0ef6.entry.js → p-5ee484a7.entry.js} +4 -4
  110. package/dist/lime-elements/{p-b1d6553c.entry.js → p-77abb595.entry.js} +1 -1
  111. package/dist/lime-elements/p-8065425a.entry.js +1 -0
  112. package/dist/lime-elements/{p-77ba0f66.entry.js → p-8299af78.entry.js} +1 -1
  113. package/dist/lime-elements/{p-87c5e951.entry.js → p-8c7a7003.entry.js} +1 -1
  114. package/dist/lime-elements/{p-ce20d720.entry.js → p-97c401f1.entry.js} +1 -1
  115. package/dist/lime-elements/p-9a378cf0.entry.js +1 -0
  116. package/dist/lime-elements/p-B3zCFNAw.js +1 -0
  117. package/dist/lime-elements/p-B6bNnxRu.js +1 -0
  118. package/dist/lime-elements/p-B85MJLTf.js +1 -0
  119. package/dist/lime-elements/p-BCMRfUKp.js +1 -0
  120. package/dist/lime-elements/p-BbU4FGNT.js +1 -0
  121. package/dist/lime-elements/p-Bp0tNo1s.js +1 -0
  122. package/dist/lime-elements/{p-DpyWBa_Z.js → p-Bt64o80S.js} +1 -1
  123. package/dist/lime-elements/{p-BqiDn_Sf.js → p-BvDmWgCs.js} +1 -1
  124. package/dist/lime-elements/p-CMjGNANG.js +1 -0
  125. package/dist/lime-elements/p-DFWcgJ_i.js +1 -0
  126. package/dist/lime-elements/{p-B4YDb6f3.js → p-DJvGLFul.js} +1 -1
  127. package/dist/lime-elements/p-DTXIk0fN.js +1 -0
  128. package/dist/lime-elements/{p-BgPHaiMH.js → p-D_uMnX5g.js} +1 -1
  129. package/dist/lime-elements/{p-g3InYy9F.js → p-DdYOzHlg.js} +1 -1
  130. package/dist/lime-elements/{p-ndpPJpml.js → p-DsDkl4Sy.js} +1 -1
  131. package/dist/lime-elements/p-UGKt6Ywx.js +1 -0
  132. package/dist/lime-elements/p-afcf580c.entry.js +16 -0
  133. package/dist/lime-elements/p-b57b08b6.entry.js +1 -0
  134. package/dist/lime-elements/p-v6b303K5.js +1 -0
  135. package/dist/lime-elements/p-xQsJdKrq.js +1 -0
  136. package/dist/lime-elements/{p-BYx8mudw.js → p-zo6O9LC9.js} +2 -2
  137. package/dist/types/components/form/adapters/widget-adapter.d.ts +3 -2
  138. package/dist/types/components/form/fields/array-field.d.ts +11 -19
  139. package/dist/types/components/form/fields/object-field.d.ts +2 -2
  140. package/dist/types/components/form/fields/schema-field.d.ts +5 -18
  141. package/dist/types/components/form/form.d.ts +4 -8
  142. package/dist/types/components/form/form.test-schemas.d.ts +30 -0
  143. package/dist/types/components/form/row/row-context.d.ts +2 -0
  144. package/dist/types/components/form/templates/array-context.d.ts +7 -0
  145. package/dist/types/components/form/templates/array-field-collapsible-item.d.ts +7 -11
  146. package/dist/types/components/form/templates/array-field-item.d.ts +6 -0
  147. package/dist/types/components/form/templates/array-field-simple-item.d.ts +7 -9
  148. package/dist/types/components/form/templates/array-field.d.ts +7 -8
  149. package/dist/types/components/form/templates/index.d.ts +1 -0
  150. package/dist/types/components/form/templates/object-field.d.ts +6 -1
  151. package/dist/types/components/form/templates/types.d.ts +2 -4
  152. package/dist/types/components/form/validation-display.d.ts +60 -0
  153. package/dist/types/components/form/validator.d.ts +6 -0
  154. package/dist/types/components/form/widgets/code-editor.d.ts +1 -1
  155. package/dist/types/components/form/widgets/types.d.ts +1 -1
  156. package/dist/types/components/table/table.d.ts +8 -8
  157. package/package.json +4 -2
  158. package/dist/cjs/_baseAssignValue-BJgt6T7z.js +0 -27
  159. package/dist/cjs/_commonjsHelpers-BJu3ubxk.js +0 -10
  160. package/dist/cjs/_getPrototype-BK9cL-57.js +0 -8
  161. package/dist/cjs/negate-Bg3SqQh6.js +0 -42
  162. package/dist/collection/components/form/fields/types.js +0 -1
  163. package/dist/collection/components/form/schema-cache.js +0 -66
  164. package/dist/esm/_baseAssignValue-C8Uwn8zr.js +0 -25
  165. package/dist/esm/_commonjsHelpers-BFTU3MAI.js +0 -7
  166. package/dist/esm/_getPrototype-jV9gkkJy.js +0 -6
  167. package/dist/esm/negate-ooVD-6_a.js +0 -40
  168. package/dist/lime-elements/p-45dfcaf3.entry.js +0 -1
  169. package/dist/lime-elements/p-5db2d069.entry.js +0 -1
  170. package/dist/lime-elements/p-9728aa4a.entry.js +0 -1
  171. package/dist/lime-elements/p-BFTU3MAI.js +0 -1
  172. package/dist/lime-elements/p-BlJd1RC5.js +0 -1
  173. package/dist/lime-elements/p-C6SEjICu.js +0 -1
  174. package/dist/lime-elements/p-CqEHNkif.js +0 -1
  175. package/dist/lime-elements/p-Cs5T63LB.js +0 -1
  176. package/dist/lime-elements/p-Cw1B5fXE.js +0 -1
  177. package/dist/lime-elements/p-DKxusNKT.js +0 -1
  178. package/dist/lime-elements/p-DrjUjEz3.js +0 -1
  179. package/dist/lime-elements/p-DzlmgobW.js +0 -1
  180. package/dist/lime-elements/p-ZcW3uvZL.js +0 -1
  181. package/dist/lime-elements/p-a4a09ce9.entry.js +0 -7
  182. package/dist/lime-elements/p-ad9cb573.entry.js +0 -1
  183. package/dist/lime-elements/p-c4e2885d.entry.js +0 -16
  184. package/dist/lime-elements/p-ooVD-6_a.js +0 -1
  185. package/dist/types/components/form/fields/types.d.ts +0 -41
  186. package/dist/types/components/form/schema-cache.d.ts +0 -17
@@ -0,0 +1,47 @@
1
+ import React, { useContext } from "react";
2
+ import { isObjectType } from "../schema";
3
+ import { CollapsibleItemTemplate } from "./array-field-collapsible-item";
4
+ import { SimpleItemTemplate } from "./array-field-simple-item";
5
+ import { ArrayFieldContext } from "./array-context";
6
+ export const ArrayFieldItemTemplate = (props) => {
7
+ const arrayContext = useContext(ArrayFieldContext);
8
+ const schema = arrayContext === null || arrayContext === void 0 ? void 0 : arrayContext.arraySchema;
9
+ const formData = arrayContext === null || arrayContext === void 0 ? void 0 : arrayContext.formData;
10
+ const formContext = props.registry.formContext;
11
+ const allowItemReorder = canItemReorder(props, schema);
12
+ const allowItemRemoval = canRemoveItems(schema);
13
+ if (schema && isObjectType(schema.items)) {
14
+ const itemData = Array.isArray(formData)
15
+ ? formData[props.index]
16
+ : undefined;
17
+ return React.createElement(CollapsibleItemTemplate, {
18
+ key: props.itemKey,
19
+ buttonsProps: props.buttonsProps,
20
+ index: props.index,
21
+ data: itemData,
22
+ schema: schema,
23
+ formSchema: formContext === null || formContext === void 0 ? void 0 : formContext.schema,
24
+ allowItemRemoval: allowItemRemoval,
25
+ allowItemReorder: allowItemReorder,
26
+ }, props.children);
27
+ }
28
+ return React.createElement(SimpleItemTemplate, {
29
+ key: props.itemKey,
30
+ buttonsProps: props.buttonsProps,
31
+ index: props.index,
32
+ allowItemRemoval: allowItemRemoval,
33
+ allowItemReorder: allowItemReorder,
34
+ }, props.children);
35
+ };
36
+ function canRemoveItems(schema) {
37
+ const limeOptions = (schema === null || schema === void 0 ? void 0 : schema.lime) || {};
38
+ return limeOptions.allowItemRemoval !== false;
39
+ }
40
+ function canItemReorder(props, schema) {
41
+ const limeOptions = (schema === null || schema === void 0 ? void 0 : schema.lime) || {};
42
+ if (limeOptions.allowItemReorder === false) {
43
+ return false;
44
+ }
45
+ const { buttonsProps } = props;
46
+ return Boolean((buttonsProps === null || buttonsProps === void 0 ? void 0 : buttonsProps.hasMoveDown) || (buttonsProps === null || buttonsProps === void 0 ? void 0 : buttonsProps.hasMoveUp));
47
+ }
@@ -5,8 +5,7 @@ export class SimpleItemTemplate extends React.Component {
5
5
  super(props);
6
6
  this.props = props;
7
7
  this.handleRemove = (event) => {
8
- const { item, index } = this.props;
9
- item.onDropIndexClick(index)(event);
8
+ this.props.buttonsProps.onRemoveItem(event);
10
9
  };
11
10
  this.setRemoveButton = (button) => {
12
11
  if (this.removeButton) {
@@ -22,12 +21,12 @@ export class SimpleItemTemplate extends React.Component {
22
21
  this.setRemoveButton(undefined);
23
22
  }
24
23
  render() {
25
- const { item, allowItemReorder } = this.props;
24
+ const { allowItemReorder } = this.props;
26
25
  return React.createElement('div', {
27
26
  className: 'array-item limel-form-array-item--simple',
28
- 'data-reorder-id': String(this.props.dataIndex),
27
+ 'data-reorder-id': String(this.props.index),
29
28
  'data-reorderable': allowItemReorder ? 'true' : 'false',
30
- }, this.props.item.children, this.renderRemoveButton(item), this.renderDragHandle());
29
+ }, this.props.children, this.renderRemoveButton(), this.renderDragHandle());
31
30
  }
32
31
  renderDragHandle() {
33
32
  if (!this.props.allowItemReorder) {
@@ -37,13 +36,13 @@ export class SimpleItemTemplate extends React.Component {
37
36
  class: 'drag-handle',
38
37
  });
39
38
  }
40
- renderRemoveButton(item) {
39
+ renderRemoveButton() {
41
40
  if (!this.props.allowItemRemoval) {
42
41
  return;
43
42
  }
44
43
  const props = {
45
44
  icon: 'trash',
46
- disabled: !item.hasRemove,
45
+ disabled: !this.props.buttonsProps.hasRemove,
47
46
  ref: this.setRemoveButton,
48
47
  };
49
48
  return React.createElement(LIMEL_ICON_BUTTON, props);
@@ -1,9 +1,8 @@
1
1
  import React from "react";
2
- import { isObjectType } from "../schema";
3
- import { CollapsibleItemTemplate } from "./array-field-collapsible-item";
4
- import { SimpleItemTemplate } from "./array-field-simple-item";
5
2
  import { renderDescription, renderTitle } from "./common";
6
3
  import Sortable from "sortablejs";
4
+ import { ArrayFieldContext } from "./array-context";
5
+ export const ARRAY_REORDER_EVENT = 'arrayReorder';
7
6
  const DRAG_HANDLE_SELECTOR = '[data-drag-handle]';
8
7
  const DRAGGABLE_ITEM_SELECTOR = '.array-item[data-reorderable="true"]';
9
8
  const DEFAULT_CONTAINER_CLASS = 'has-an-item-which-is-being-dragged';
@@ -13,7 +12,7 @@ const TOUCH_DRAG_DELAY_MS = 200; // Adds a short hold on touch (long-press) so s
13
12
  export class ArrayFieldTemplate extends React.Component {
14
13
  constructor(props) {
15
14
  super(props);
16
- this.itemByIndex = new Map();
15
+ this.cachedContextValue = null;
17
16
  this.handleAddClick = (event) => {
18
17
  event.stopPropagation();
19
18
  this.props.onAddClick(event);
@@ -72,20 +71,10 @@ export class ArrayFieldTemplate extends React.Component {
72
71
  this.scheduleDropElevationRemoval();
73
72
  return;
74
73
  }
75
- const targetItem = ((_a = this.props.items) !== null && _a !== void 0 ? _a : []).find((entry) => {
76
- var _a;
77
- return ((_a = entry.index) !== null && _a !== void 0 ? _a : -1) === draggedItemIndex;
78
- });
79
- if (!targetItem || typeof targetItem.onReorderClick !== 'function') {
80
- this.scheduleDropElevationRemoval();
81
- return;
82
- }
83
- requestAnimationFrame(() => {
84
- const reorder = targetItem.onReorderClick(draggedItemIndex, toPosition);
85
- if (typeof reorder === 'function') {
86
- reorder();
87
- }
88
- });
74
+ (_a = this.container) === null || _a === void 0 ? void 0 : _a.dispatchEvent(new CustomEvent(ARRAY_REORDER_EVENT, {
75
+ bubbles: true,
76
+ detail: { fromIndex: fromPosition, toIndex: toPosition },
77
+ }));
89
78
  this.scheduleDropElevationRemoval();
90
79
  };
91
80
  this.state = {
@@ -118,13 +107,12 @@ export class ArrayFieldTemplate extends React.Component {
118
107
  }
119
108
  }
120
109
  render() {
121
- const controls = this.getItemControls();
122
- const { ordered: orderedItems, byIndex } = this.getOrderedItems();
123
- this.itemByIndex = byIndex;
124
- return React.createElement('div', {}, renderTitle(this.props.title), renderDescription(this.props.schema.description), React.createElement('div', {
110
+ const orderedItems = this.getOrderedItems();
111
+ const contextValue = this.getContextValue();
112
+ return React.createElement(ArrayFieldContext.Provider, { value: contextValue }, React.createElement('div', {}, renderTitle(this.props.title), renderDescription(this.props.schema.description), React.createElement('div', {
125
113
  className: 'array-items',
126
114
  ref: this.setContainer,
127
- }, orderedItems.map((item, index) => this.renderItem(item, index, controls))), this.renderAddButton());
115
+ }, orderedItems), this.renderAddButton()));
128
116
  }
129
117
  renderAddButton() {
130
118
  if (!this.props.canAdd) {
@@ -137,73 +125,40 @@ export class ArrayFieldTemplate extends React.Component {
137
125
  class: 'button-add-new',
138
126
  });
139
127
  }
140
- getItemControls() {
141
- return {
142
- allowItemRemoval: this.canRemoveItems(),
143
- };
144
- }
145
- renderItem(item, index, controls) {
146
- var _a;
147
- const { schema, formData, formContext } = this.props;
148
- const itemIndex = (_a = item.index) !== null && _a !== void 0 ? _a : index;
149
- const allowItemReorder = this.isItemReorderable(item);
150
- if (isObjectType(schema.items)) {
151
- return React.createElement(CollapsibleItemTemplate, {
152
- key: item.key,
153
- item: item,
154
- data: Array.isArray(formData) ? formData[itemIndex] : undefined,
155
- schema: schema,
156
- formSchema: formContext.schema,
157
- index: itemIndex,
158
- allowItemRemoval: controls.allowItemRemoval,
159
- allowItemReorder: allowItemReorder,
160
- });
161
- }
162
- return React.createElement(SimpleItemTemplate, {
163
- key: item.key,
164
- item: item,
165
- index: itemIndex,
166
- dataIndex: itemIndex,
167
- allowItemRemoval: controls.allowItemRemoval,
168
- allowItemReorder: allowItemReorder,
169
- });
170
- }
171
128
  getOrderedItems() {
172
- var _a, _b;
129
+ var _a;
173
130
  const items = (_a = this.props.items) !== null && _a !== void 0 ? _a : [];
174
- const byIndex = new Map();
175
- let entryIndex = 0;
176
- for (const entry of items) {
177
- byIndex.set((_b = entry.index) !== null && _b !== void 0 ? _b : entryIndex, entry);
178
- entryIndex += 1;
131
+ if (items.length === 0) {
132
+ return [];
133
+ }
134
+ const byKey = new Map();
135
+ for (const [index, item] of items.entries()) {
136
+ byKey.set(index, item);
179
137
  }
180
138
  const ordered = [];
181
139
  const used = new Set();
182
140
  for (const index of this.state.order) {
183
- const entry = byIndex.get(index);
141
+ const entry = byKey.get(index);
184
142
  if (!entry) {
185
143
  continue;
186
144
  }
187
145
  ordered.push(entry);
188
146
  used.add(index);
189
147
  }
190
- for (const [index, entry] of byIndex.entries()) {
148
+ for (const [index, entry] of byKey.entries()) {
191
149
  if (!used.has(index)) {
192
150
  ordered.push(entry);
193
151
  }
194
152
  }
195
- return {
196
- ordered,
197
- byIndex,
198
- };
153
+ return ordered;
199
154
  }
200
155
  setupDragController() {
201
156
  if (!this.container || !this.canReorderItems()) {
202
157
  this.teardownDragController();
203
158
  return;
204
159
  }
205
- const reorderableCount = this.getReorderableOrder().length;
206
- if (reorderableCount < 2) {
160
+ const reorderableItems = this.container.querySelectorAll(`:scope > ${DRAGGABLE_ITEM_SELECTOR}`);
161
+ if (reorderableItems.length < 2) {
207
162
  this.teardownDragController();
208
163
  return;
209
164
  }
@@ -249,31 +204,6 @@ export class ArrayFieldTemplate extends React.Component {
249
204
  const limeOptions = (schema === null || schema === void 0 ? void 0 : schema.lime) || {};
250
205
  return limeOptions.allowItemReorder !== false;
251
206
  }
252
- canRemoveItems() {
253
- const schema = this.props.schema;
254
- const limeOptions = (schema === null || schema === void 0 ? void 0 : schema.lime) || {};
255
- return limeOptions.allowItemRemoval !== false;
256
- }
257
- isItemReorderable(item) {
258
- return (this.canReorderItems() &&
259
- Boolean((item === null || item === void 0 ? void 0 : item.hasMoveDown) || (item === null || item === void 0 ? void 0 : item.hasMoveUp)));
260
- }
261
- isIndexReorderable(index) {
262
- const item = this.itemByIndex.get(index);
263
- if (!item) {
264
- return false;
265
- }
266
- return this.isItemReorderable(item);
267
- }
268
- getReorderableOrder(order = this.state.order) {
269
- const result = [];
270
- for (const index of order) {
271
- if (this.isIndexReorderable(index)) {
272
- result.push(index);
273
- }
274
- }
275
- return result;
276
- }
277
207
  readOrderFromDom() {
278
208
  if (!this.container) {
279
209
  return [];
@@ -348,6 +278,20 @@ export class ArrayFieldTemplate extends React.Component {
348
278
  return true;
349
279
  }
350
280
  extractIndices(items = []) {
351
- return (items !== null && items !== void 0 ? items : []).map((item, index) => { var _a; return (_a = item.index) !== null && _a !== void 0 ? _a : index; });
281
+ return (items !== null && items !== void 0 ? items : []).map((_, index) => index);
282
+ }
283
+ getContextValue() {
284
+ var _a;
285
+ const schema = this.props.schema;
286
+ const formData = ((_a = this.props.formData) !== null && _a !== void 0 ? _a : []);
287
+ if (this.cachedContextValue &&
288
+ this.cachedSchema === schema &&
289
+ this.cachedFormData === formData) {
290
+ return this.cachedContextValue;
291
+ }
292
+ this.cachedSchema = schema;
293
+ this.cachedFormData = formData;
294
+ this.cachedContextValue = { arraySchema: schema, formData };
295
+ return this.cachedContextValue;
352
296
  }
353
297
  }
@@ -1,3 +1,4 @@
1
1
  export * from './field';
2
2
  export * from './array-field';
3
+ export * from './array-field-item';
3
4
  export * from './object-field';
@@ -1,17 +1,19 @@
1
- import React from "react";
1
+ import React, { useContext } from "react";
2
2
  import { renderDescription, renderTitle } from "./common";
3
3
  import { GridLayout } from "./grid-layout";
4
4
  import { RowLayout } from "./row-layout";
5
5
  import { getHelpComponent } from "../help";
6
+ import { ArrayFieldContext } from "./array-context";
6
7
  export const ObjectFieldTemplate = (props) => {
7
- const id = props.idSchema.$id;
8
+ const arrayContext = useContext(ArrayFieldContext);
9
+ const id = props.fieldPathId.$id;
10
+ if (arrayContext && id !== 'root') {
11
+ return React.createElement(ArrayFieldContext.Provider, { value: null }, renderProperties(props.properties, props.schema));
12
+ }
8
13
  if (id === 'root' || !isCollapsible(props.schema)) {
9
14
  return renderFieldWithTitle(props);
10
15
  }
11
- if (isCollapsible(props.schema)) {
12
- return renderCollapsibleField(props);
13
- }
14
- return renderProperties(props.properties, props.schema);
16
+ return renderCollapsibleField(props);
15
17
  };
16
18
  function renderFieldWithTitle(props) {
17
19
  return React.createElement(React.Fragment, {}, renderSectionHeader(props), renderDescription(props.description), renderProperties(props.properties, props.schema));
@@ -30,17 +32,19 @@ function renderCollapsibleField(props) {
30
32
  });
31
33
  return React.createElement('limel-collapsible-section', {
32
34
  header: props.title,
33
- id: getSchemaObjectPropertyPath(props.formContext.schema, props.idSchema),
35
+ id: getSchemaObjectPropertyPath(props.registry.formContext.schema, props.fieldPathId),
34
36
  'is-open': defaultOpen,
35
37
  }, helpElement, renderDescription(props.description), renderProperties(props.properties, props.schema));
36
38
  }
37
- function getSchemaObjectPropertyPath(schema, subSchema) {
39
+ function getSchemaObjectPropertyPath(schema, fieldPathId) {
38
40
  var _a, _b;
39
41
  const refPrefixLength = 2;
40
42
  const matchAllForwardSlashes = /\//g;
41
- const rootPath = (_a = schema.$ref) === null || _a === void 0 ? void 0 : _a.replace(matchAllForwardSlashes, '.').slice(refPrefixLength);
42
- const subSchemaPath = (_b = subSchema.$id) === null || _b === void 0 ? void 0 : _b.replace('_', '.properties.');
43
- return subSchemaPath.replace('root', rootPath);
43
+ const rootPath = (_b = (_a = schema.$ref) === null || _a === void 0 ? void 0 : _a.replace(matchAllForwardSlashes, '.').slice(refPrefixLength)) !== null && _b !== void 0 ? _b : '';
44
+ const subSchemaPath = fieldPathId.path
45
+ .map((segment) => `.properties.${segment}`)
46
+ .join('');
47
+ return `${rootPath}${subSchemaPath}`;
44
48
  }
45
49
  function renderProperties(properties, schema) {
46
50
  var _a;
@@ -0,0 +1,75 @@
1
+ import { isEmpty, capitalize } from "lodash-es";
2
+ /**
3
+ * Check whether a form field value is non-empty.
4
+ * Treats `null`, `undefined`, `''`, empty arrays,
5
+ * and empty plain objects as "no value".
6
+ *
7
+ * @param value - the current field value
8
+ * @returns `true` when the field holds meaningful data
9
+ */
10
+ export function hasValue(value) {
11
+ if (value === null || value === undefined || value === '') {
12
+ return false;
13
+ }
14
+ if (Array.isArray(value)) {
15
+ return value.length > 0;
16
+ }
17
+ if (value instanceof Date) {
18
+ return true;
19
+ }
20
+ if (typeof value === 'object') {
21
+ return !isEmpty(value);
22
+ }
23
+ return true;
24
+ }
25
+ /**
26
+ * Determine whether a field should be displayed as invalid.
27
+ *
28
+ * A field with errors is shown as invalid only when the user has
29
+ * interacted with it, it already contains a value, or it is optional.
30
+ * This avoids showing errors on untouched required fields before the
31
+ * user has had a chance to fill them in.
32
+ *
33
+ * @param field - the current field state
34
+ * @param field.hasErrors - whether the field currently has validation errors
35
+ * @param field.modified - whether the user has interacted with the field
36
+ * @param field.hasValue - whether the field holds a non-empty value
37
+ * @param field.required - whether the field is required
38
+ * @returns `true` when the field should render in an invalid state
39
+ */
40
+ export function isFieldInvalid(field) {
41
+ return (field.hasErrors && (field.modified || field.hasValue || !field.required));
42
+ }
43
+ /**
44
+ * Check whether a field should be marked as required.
45
+ *
46
+ * A field is required when the schema marks it as `required` or
47
+ * when it specifies a positive `minItems` constraint.
48
+ *
49
+ * @param field - the current field state
50
+ * @param field.required - the `required` flag from the schema/props
51
+ * @param field.minItems - the `minItems` value from the schema (0 if unset)
52
+ * @returns `true` when the field is required
53
+ */
54
+ export function isFieldRequired(field) {
55
+ return field.required || field.minItems > 0;
56
+ }
57
+ /**
58
+ * Return the helper text to display beneath a field.
59
+ *
60
+ * When validation errors exist the first error message is returned
61
+ * (capitalized). Otherwise falls back to `fallbackText` if provided,
62
+ * then to `description`.
63
+ *
64
+ * @param errors - array of validation error strings (may be `null`)
65
+ * @param description - the schema description for the field
66
+ * @param fallbackText - optional text that takes priority over `description`
67
+ * when there are no errors (e.g. a custom `helperText` prop)
68
+ * @returns the string to show as helper text
69
+ */
70
+ export function getErrorText(errors, description, fallbackText) {
71
+ if ((errors === null || errors === void 0 ? void 0 : errors.length) > 0) {
72
+ return capitalize(errors[0]);
73
+ }
74
+ return fallbackText || description;
75
+ }
@@ -0,0 +1,10 @@
1
+ import { customizeValidator } from "@rjsf/validator-ajv8";
2
+ import { isInteger } from "./validators";
3
+ /**
4
+ * Shared RJSF validator configured with custom formats and ajv options.
5
+ * Use this single instance wherever the RJSF v6 API requires a validator.
6
+ */
7
+ export const rjsfValidator = customizeValidator({
8
+ customFormats: { integer: isInteger },
9
+ ajvOptionsOverrides: { allErrors: true, multipleOfPrecision: 2 },
10
+ });
@@ -62,7 +62,7 @@ export class CodeEditor extends React.Component {
62
62
  this.setState({ validationError, modified: true });
63
63
  return;
64
64
  }
65
- props.onChange(value);
65
+ props.onChange(value, props.fieldPathId.path);
66
66
  this.setState({ validationError: '', modified: true });
67
67
  }
68
68
  }
@@ -48,10 +48,11 @@ export class Select extends React.Component {
48
48
  }
49
49
  }
50
50
  function createOption(item) {
51
+ var _a;
51
52
  return {
52
53
  text: item.label,
53
54
  value: item.value,
54
- disabled: !!item.schema.readOnly,
55
+ disabled: !!((_a = item.schema) === null || _a === void 0 ? void 0 : _a.readOnly),
55
56
  };
56
57
  }
57
58
  function findValue(value, options) {
@@ -383,6 +383,7 @@ export class Picker {
383
383
  }
384
384
  handleChange(event) {
385
385
  event.stopPropagation();
386
+ this.textValue = '';
386
387
  let newValue = null;
387
388
  if (this.multiple) {
388
389
  const chips = event.detail;
@@ -612,16 +612,16 @@ export class Table {
612
612
  render() {
613
613
  var _a, _b;
614
614
  const totalRows = (_a = this.totalRows) !== null && _a !== void 0 ? _a : this.data.length;
615
- return (h(Host, { key: 'e615540df33a213dcdcdecfbaf4a62add8a56343', class: {
615
+ return (h(Host, { key: '68ff4552c148835bc927f9ce5587e8073c2cbf3d', class: {
616
616
  'has-low-density': this.layout === 'lowDensity',
617
617
  'has-pagination-on-top': this.paginationLocation === 'top',
618
- } }, h("div", { key: '912374e7d1308708945dde7e94366a9e20ce8236', id: "tabulator-container", class: {
618
+ } }, h("div", { key: '3a7cf6c12e83db4b17f2bffdad17c113c7c7ca45', id: "tabulator-container", class: {
619
619
  'has-pagination': totalRows > this.pageSize,
620
620
  'has-aggregation': this.hasAggregation(this.columns),
621
621
  'has-movable-columns': this.movableColumns,
622
622
  'has-rowselector': this.selectable,
623
623
  'has-selection': (_b = this.tableSelection) === null || _b === void 0 ? void 0 : _b.hasSelection,
624
- } }, h("div", { key: 'ccfead61db80a9d54631daecb950c352cf41bbc8', id: "tabulator-loader", style: { display: this.loading ? 'flex' : 'none' } }, h("limel-spinner", { key: '2f095d05a6d972e008467d54e71520e2848b6d2e', size: "large" })), this.renderEmptyMessage(), this.renderSelectAll(), h("div", { key: '1c200d356c582e35bce4b0f02bfc187e42a072ec', id: "tabulator-table" }))));
624
+ } }, h("div", { key: '1aeea14d08105a4fbc95d238122ce9f4574a296b', id: "tabulator-loader", style: { display: this.loading ? 'flex' : 'none' } }, h("limel-spinner", { key: '496c560a362f469616a23801902d9a748b1293ad', size: "large" })), this.renderEmptyMessage(), this.renderSelectAll(), h("div", { key: '1b9e129b2e30b6c8c9256f612dc4cd9fa53b3afc', id: "tabulator-table" }))));
625
625
  }
626
626
  renderSelectAll() {
627
627
  var _a, _b, _c;
@@ -709,7 +709,7 @@ export class Table {
709
709
  },
710
710
  "getter": false,
711
711
  "setter": false,
712
- "reflect": false,
712
+ "reflect": true,
713
713
  "attribute": "mode",
714
714
  "defaultValue": "'local'"
715
715
  },
@@ -736,7 +736,7 @@ export class Table {
736
736
  },
737
737
  "getter": false,
738
738
  "setter": false,
739
- "reflect": false,
739
+ "reflect": true,
740
740
  "attribute": "layout"
741
741
  },
742
742
  "pageSize": {
@@ -755,7 +755,7 @@ export class Table {
755
755
  },
756
756
  "getter": false,
757
757
  "setter": false,
758
- "reflect": false,
758
+ "reflect": true,
759
759
  "attribute": "page-size"
760
760
  },
761
761
  "totalRows": {
@@ -774,7 +774,7 @@ export class Table {
774
774
  },
775
775
  "getter": false,
776
776
  "setter": false,
777
- "reflect": false,
777
+ "reflect": true,
778
778
  "attribute": "total-rows"
779
779
  },
780
780
  "sorting": {
@@ -842,7 +842,7 @@ export class Table {
842
842
  },
843
843
  "getter": false,
844
844
  "setter": false,
845
- "reflect": false,
845
+ "reflect": true,
846
846
  "attribute": "movable-columns"
847
847
  },
848
848
  "sortableColumns": {
@@ -861,7 +861,7 @@ export class Table {
861
861
  },
862
862
  "getter": false,
863
863
  "setter": false,
864
- "reflect": false,
864
+ "reflect": true,
865
865
  "attribute": "sortable-columns",
866
866
  "defaultValue": "true"
867
867
  },
@@ -881,7 +881,7 @@ export class Table {
881
881
  },
882
882
  "getter": false,
883
883
  "setter": false,
884
- "reflect": false,
884
+ "reflect": true,
885
885
  "attribute": "loading",
886
886
  "defaultValue": "false"
887
887
  },
@@ -901,7 +901,7 @@ export class Table {
901
901
  },
902
902
  "getter": false,
903
903
  "setter": false,
904
- "reflect": false,
904
+ "reflect": true,
905
905
  "attribute": "page",
906
906
  "defaultValue": "FIRST_PAGE"
907
907
  },
@@ -964,7 +964,7 @@ export class Table {
964
964
  },
965
965
  "getter": false,
966
966
  "setter": false,
967
- "reflect": false,
967
+ "reflect": true,
968
968
  "attribute": "selectable"
969
969
  },
970
970
  "selection": {
@@ -1,6 +1,28 @@
1
- import { b as baseAssignValue } from './_baseAssignValue-C8Uwn8zr.js';
1
+ import { d as defineProperty } from './_defineProperty-yVdnnt__.js';
2
2
  import { e as eq } from './eq-D7VMHFyO.js';
3
3
 
4
+ /**
5
+ * The base implementation of `assignValue` and `assignMergeValue` without
6
+ * value checks.
7
+ *
8
+ * @private
9
+ * @param {Object} object The object to modify.
10
+ * @param {string} key The key of the property to assign.
11
+ * @param {*} value The value to assign.
12
+ */
13
+ function baseAssignValue(object, key, value) {
14
+ if (key == '__proto__' && defineProperty) {
15
+ defineProperty(object, key, {
16
+ 'configurable': true,
17
+ 'enumerable': true,
18
+ 'value': value,
19
+ 'writable': true
20
+ });
21
+ } else {
22
+ object[key] = value;
23
+ }
24
+ }
25
+
4
26
  /** Used for built-in method references. */
5
27
  var objectProto = Object.prototype;
6
28
 
@@ -25,4 +47,4 @@ function assignValue(object, key, value) {
25
47
  }
26
48
  }
27
49
 
28
- export { assignValue as a };
50
+ export { assignValue as a, baseAssignValue as b };
@@ -1,4 +1,5 @@
1
- import { k as keys } from './_baseIsEqual-BvHnKRmD.js';
1
+ import { k as keys } from './_baseIsEqual-BfXMsuGh.js';
2
+ import { i as isArrayLike } from './isArrayLike-D1QkaJU2.js';
2
3
 
3
4
  /**
4
5
  * Creates a base function for methods like `_.forIn` and `_.forOwn`.
@@ -49,4 +50,43 @@ function baseForOwn(object, iteratee) {
49
50
  return object && baseFor(object, iteratee, keys);
50
51
  }
51
52
 
52
- export { baseForOwn as b };
53
+ /**
54
+ * Creates a `baseEach` or `baseEachRight` function.
55
+ *
56
+ * @private
57
+ * @param {Function} eachFunc The function to iterate over a collection.
58
+ * @param {boolean} [fromRight] Specify iterating from right to left.
59
+ * @returns {Function} Returns the new base function.
60
+ */
61
+ function createBaseEach(eachFunc, fromRight) {
62
+ return function(collection, iteratee) {
63
+ if (collection == null) {
64
+ return collection;
65
+ }
66
+ if (!isArrayLike(collection)) {
67
+ return eachFunc(collection, iteratee);
68
+ }
69
+ var length = collection.length,
70
+ index = -1,
71
+ iterable = Object(collection);
72
+
73
+ while ((++index < length)) {
74
+ if (iteratee(iterable[index], index, iterable) === false) {
75
+ break;
76
+ }
77
+ }
78
+ return collection;
79
+ };
80
+ }
81
+
82
+ /**
83
+ * The base implementation of `_.forEach` without support for iteratee shorthands.
84
+ *
85
+ * @private
86
+ * @param {Array|Object} collection The collection to iterate over.
87
+ * @param {Function} iteratee The function invoked per iteration.
88
+ * @returns {Array|Object} Returns `collection`.
89
+ */
90
+ var baseEach = createBaseEach(baseForOwn);
91
+
92
+ export { baseEach as a, baseFor as b, baseForOwn as c };