@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
@@ -124,10 +124,10 @@
124
124
  .limel-form-row--layout .main-information {
125
125
  position: relative;
126
126
  }
127
- .limel-form-row--layout .main-information > .form-group.field {
127
+ .limel-form-row--layout .main-information > .rjsf-field {
128
128
  position: unset;
129
129
  }
130
- .limel-form-row--layout .main-information > .form-group.field limel-help {
130
+ .limel-form-row--layout .main-information > .rjsf-field limel-help {
131
131
  top: 0;
132
132
  }
133
133
  .limel-form-row--layout limel-icon {
@@ -155,12 +155,12 @@
155
155
  .limel-form-row--layout .has-icon .description {
156
156
  padding-left: calc(var(--limel-form-row-icon-size) + var(--limel-form-row-main-information-gap));
157
157
  }
158
- .limel-form-row--layout .form-group.field {
158
+ .limel-form-row--layout .rjsf-field {
159
159
  flex-shrink: 0;
160
160
  display: flex;
161
161
  align-content: center;
162
162
  }
163
- .limel-form-row--layout .form-group.field limel-slider {
163
+ .limel-form-row--layout .rjsf-field limel-slider {
164
164
  min-width: 8rem;
165
165
  display: block;
166
166
  }
@@ -185,7 +185,7 @@
185
185
  box-sizing: border-box;
186
186
  }
187
187
 
188
- .form-group {
188
+ .rjsf-field {
189
189
  min-width: 0;
190
190
  }
191
191
 
@@ -368,26 +368,26 @@ limel-markdown {
368
368
  margin-bottom: 0.5rem;
369
369
  }
370
370
 
371
- .form-group {
371
+ .rjsf-field {
372
372
  position: relative;
373
373
  }
374
- .form-group limel-help {
374
+ .rjsf-field limel-help {
375
375
  position: absolute;
376
376
  top: calc(var(--form-row-gap, 1rem) * -0.5);
377
377
  left: calc(var(--form-column-gap, 1rem) * -0.5);
378
378
  }
379
- .form-group h1 {
379
+ .rjsf-field h1 {
380
380
  color: rgb(var(--contrast-1400), 0.8);
381
381
  }
382
- .form-group h1 {
382
+ .rjsf-field h1 {
383
383
  --limel-form-h1-font-size: 1.476rem;
384
384
  font-weight: 800;
385
385
  }
386
- .form-group .form-group h1 {
386
+ .rjsf-field .rjsf-field h1 {
387
387
  --limel-form-h1-font-size: 1.383rem;
388
388
  font-weight: 700;
389
389
  }
390
- .form-group .form-group h1:before {
390
+ .rjsf-field .rjsf-field h1:before {
391
391
  content: "";
392
392
  display: block;
393
393
  position: absolute;
@@ -401,28 +401,28 @@ limel-markdown {
401
401
  border-radius: 0.125rem;
402
402
  opacity: 0.6;
403
403
  }
404
- .form-group .form-group .form-group h1 {
404
+ .rjsf-field .rjsf-field .rjsf-field h1 {
405
405
  --limel-form-h1-font-size: 1.296rem;
406
406
  font-weight: 600;
407
407
  }
408
- .form-group .form-group .form-group h1:before {
408
+ .rjsf-field .rjsf-field .rjsf-field h1:before {
409
409
  display: none;
410
410
  }
411
- .form-group .form-group .form-group .form-group h1 {
411
+ .rjsf-field .rjsf-field .rjsf-field .rjsf-field h1 {
412
412
  --limel-form-h1-font-size: 1.215rem;
413
413
  }
414
- .form-group .form-group .form-group .form-group h1:before {
414
+ .rjsf-field .rjsf-field .rjsf-field .rjsf-field h1:before {
415
415
  display: none;
416
416
  }
417
- .form-group .form-group .form-group .form-group .form-group h1 {
417
+ .rjsf-field .rjsf-field .rjsf-field .rjsf-field .rjsf-field h1 {
418
418
  --limel-form-h1-font-size: 1.138rem;
419
419
  }
420
- .form-group .form-group .form-group .form-group .form-group h1:before {
420
+ .rjsf-field .rjsf-field .rjsf-field .rjsf-field .rjsf-field h1:before {
421
421
  display: none;
422
422
  }
423
- .form-group .form-group .form-group .form-group .form-group .form-group h1 {
423
+ .rjsf-field .rjsf-field .rjsf-field .rjsf-field .rjsf-field .rjsf-field h1 {
424
424
  --limel-form-h1-font-size: 1.067rem;
425
425
  }
426
- .form-group .form-group .form-group .form-group .form-group .form-group h1:before {
426
+ .rjsf-field .rjsf-field .rjsf-field .rjsf-field .rjsf-field .rjsf-field h1:before {
427
427
  display: none;
428
428
  }
@@ -2,12 +2,12 @@ import { h, } from "@stencil/core";
2
2
  import React from "react";
3
3
  import { createRoot } from "react-dom/client";
4
4
  import JSONSchemaForm from "@rjsf/core";
5
- import { ArrayFieldTemplate, FieldTemplate, ObjectFieldTemplate, } from "./templates";
5
+ import { ArrayFieldTemplate, ArrayFieldItemTemplate, FieldTemplate, ObjectFieldTemplate, } from "./templates";
6
6
  import { SchemaField as CustomSchemaField } from "./fields/schema-field";
7
7
  import { ArrayField as CustomArrayField } from "./fields/array-field";
8
8
  import { ObjectField as CustomObjectField } from "./fields/object-field";
9
9
  import { widgets } from "./widgets";
10
- import { getValidator, getSchemaId } from "./schema-cache";
10
+ import { rjsfValidator } from "./validator";
11
11
  import { mapValues } from "lodash-es";
12
12
  /**
13
13
  * @exampleComponent limel-example-form
@@ -44,10 +44,6 @@ export class Form {
44
44
  connectedCallback() {
45
45
  this.initialize();
46
46
  }
47
- componentWillLoad() {
48
- this.setSchemaId();
49
- this.createValidator();
50
- }
51
47
  componentDidLoad() {
52
48
  this.initialize();
53
49
  }
@@ -60,11 +56,11 @@ export class Form {
60
56
  }
61
57
  this.initialized = true;
62
58
  this.reactRender();
63
- this.validateForm(this.value);
59
+ this.validateFormData();
64
60
  }
65
61
  componentDidUpdate() {
66
62
  this.reactRender();
67
- this.validateForm(this.value);
63
+ this.validateFormData();
68
64
  }
69
65
  disconnectedCallback() {
70
66
  if (this.root) {
@@ -74,7 +70,7 @@ export class Form {
74
70
  this.initialized = false;
75
71
  }
76
72
  render() {
77
- return h("div", { key: '8e03d70f44885de2f18b20e649cd419e030208fd', class: "root" });
73
+ return h("div", { key: '56c9180ab3e5b4ee3282db2c38b5eaf522e8c60f', class: "root" });
78
74
  }
79
75
  reactRender() {
80
76
  if (!this.root) {
@@ -82,20 +78,24 @@ export class Form {
82
78
  this.root = createRoot(rootElement);
83
79
  }
84
80
  this.root.render(React.createElement(JSONSchemaForm, {
85
- schema: this.modifiedSchema,
81
+ schema: this.schema,
86
82
  formData: this.value,
87
83
  onChange: this.handleChange,
88
84
  widgets: widgets,
89
- liveValidate: true,
85
+ validator: rjsfValidator,
86
+ liveValidate: 'onChange',
90
87
  showErrorList: false,
91
88
  extraErrors: this.getExtraErrors(this.errors),
92
- FieldTemplate: FieldTemplate,
93
- ArrayFieldTemplate: ArrayFieldTemplate,
94
- ObjectFieldTemplate: ObjectFieldTemplate,
89
+ templates: {
90
+ FieldTemplate: FieldTemplate,
91
+ ArrayFieldTemplate: ArrayFieldTemplate,
92
+ ArrayFieldItemTemplate: ArrayFieldItemTemplate,
93
+ ObjectFieldTemplate: ObjectFieldTemplate,
94
+ },
95
95
  disabled: this.disabled,
96
96
  transformErrors: this.getCustomErrorMessages,
97
97
  formContext: {
98
- schema: this.modifiedSchema,
98
+ schema: this.schema,
99
99
  rootValue: this.value,
100
100
  propsFactory: this.propsFactory,
101
101
  },
@@ -109,46 +109,31 @@ export class Form {
109
109
  handleChange(event) {
110
110
  this.change.emit(event.formData);
111
111
  }
112
- validateForm(value) {
113
- const isValid = this.validator(value) === true;
114
- const errors = this.getValidationErrors();
115
- const status = {
116
- valid: isValid,
117
- errors: errors,
118
- };
119
- if (this.isValid !== status.valid || !status.valid) {
120
- this.validate.emit(status);
121
- }
122
- this.isValid = status.valid;
123
- }
124
- setSchema() {
125
- this.setSchemaId();
126
- this.createValidator();
112
+ validateFormData() {
113
+ var _a;
114
+ const { errors } = rjsfValidator.validateFormData((_a = this.value) !== null && _a !== void 0 ? _a : {}, this.schema);
115
+ this.emitValidationStatus(errors);
127
116
  }
128
- setSchemaId() {
129
- // RJSF v2 requires a unique $id per distinct schema to avoid
130
- // validation cache collisions.
131
- // https://github.com/rjsf-team/react-jsonschema-form/issues/1563
132
- const id = getSchemaId(this.schema);
133
- this.modifiedSchema = Object.assign(Object.assign({}, this.schema), { id: id, $id: id });
117
+ hasExtraErrors() {
118
+ return !!this.errors && Object.keys(this.errors).length > 0;
134
119
  }
135
- createValidator() {
136
- this.validator = getValidator(this.schema);
120
+ emitValidationStatus(errors) {
121
+ const valid = (!errors || errors.length === 0) && !this.hasExtraErrors();
122
+ const formErrors = this.mapErrors(errors !== null && errors !== void 0 ? errors : []);
123
+ const status = { valid: valid, errors: formErrors };
124
+ if (this.isValid !== valid || !valid) {
125
+ this.validate.emit(status);
126
+ }
127
+ this.isValid = valid;
137
128
  }
138
- getValidationErrors() {
139
- const errors = [...(this.validator.errors || [])];
140
- return errors.map((error) => {
141
- let property = error.dataPath;
142
- if (error.keyword === 'required') {
143
- property = error.params.missingProperty;
144
- }
145
- return {
146
- name: error.keyword,
147
- property: property,
148
- message: error.message,
149
- schemaPath: error.schemaPath,
150
- };
151
- });
129
+ mapErrors(errors) {
130
+ return errors.map((error) => ({
131
+ name: error.name,
132
+ property: error.property,
133
+ message: error.message,
134
+ schemaPath: error.schemaPath,
135
+ params: error.params,
136
+ }));
152
137
  }
153
138
  getExtraErrors(errors) {
154
139
  if (!errors) {
@@ -165,20 +150,9 @@ export class Form {
165
150
  if (!this.transformErrors) {
166
151
  return originalErrors;
167
152
  }
168
- const errors = originalErrors.map((error) => {
169
- return {
170
- name: error.name,
171
- params: error.params,
172
- property: error.property,
173
- message: error.message,
174
- // For some reason 'schemaPath' is missing from the AjvError type definition:
175
- // https://github.com/rjsf-team/react-jsonschema-form/issues/2140
176
- schemaPath: error['schemaPath'],
177
- };
178
- });
179
- // Use `.call({}, …)` here to bind `this` to an empty object to prevent
180
- // the consumer submitted `transformErrors` from getting access to our
181
- // component's internals. /Ads
153
+ const errors = this.mapErrors(originalErrors);
154
+ // Use `.call({}, …)` to prevent the consumer's `transformErrors`
155
+ // from getting access to our component's internals. /Ads
182
156
  return this.transformErrors
183
157
  .call({}, errors)
184
158
  .map((transformedError) => {
@@ -383,10 +357,4 @@ export class Form {
383
357
  }];
384
358
  }
385
359
  static get elementRef() { return "host"; }
386
- static get watchers() {
387
- return [{
388
- "propName": "schema",
389
- "methodName": "setSchema"
390
- }];
391
- }
392
360
  }
@@ -0,0 +1,308 @@
1
+ export const stringSchema = {
2
+ type: 'object',
3
+ properties: {
4
+ name: { type: 'string', title: 'Name' },
5
+ },
6
+ };
7
+ export const numberSchema = {
8
+ type: 'object',
9
+ properties: {
10
+ age: { type: 'number', title: 'Age' },
11
+ },
12
+ };
13
+ export const booleanSchema = {
14
+ type: 'object',
15
+ properties: {
16
+ active: { type: 'boolean', title: 'Active' },
17
+ },
18
+ };
19
+ export const enumSchema = {
20
+ type: 'object',
21
+ properties: {
22
+ color: {
23
+ type: 'string',
24
+ title: 'Color',
25
+ enum: ['red', 'green', 'blue'],
26
+ },
27
+ },
28
+ };
29
+ export const requiredFieldSchema = {
30
+ type: 'object',
31
+ properties: {
32
+ name: { type: 'string', title: 'Name' },
33
+ },
34
+ required: ['name'],
35
+ };
36
+ export const emailFormatSchema = {
37
+ type: 'object',
38
+ properties: {
39
+ email: { type: 'string', title: 'Email', format: 'email' },
40
+ },
41
+ required: ['email'],
42
+ };
43
+ export const arraySchema = {
44
+ type: 'object',
45
+ properties: {
46
+ tags: {
47
+ type: 'array',
48
+ title: 'Tags',
49
+ items: { type: 'string' },
50
+ },
51
+ },
52
+ };
53
+ export const nestedObjectSchema = {
54
+ type: 'object',
55
+ properties: {
56
+ address: {
57
+ type: 'object',
58
+ title: 'Address',
59
+ properties: {
60
+ street: { type: 'string', title: 'Street' },
61
+ city: { type: 'string', title: 'City' },
62
+ },
63
+ },
64
+ },
65
+ };
66
+ export const arrayOfObjectsSchema = {
67
+ type: 'object',
68
+ properties: {
69
+ heroes: {
70
+ type: 'array',
71
+ title: 'Heroes',
72
+ items: {
73
+ type: 'object',
74
+ title: 'Hero',
75
+ properties: {
76
+ name: { type: 'string', title: 'Name' },
77
+ },
78
+ },
79
+ },
80
+ },
81
+ };
82
+ export const dynamicSchema = {
83
+ type: 'object',
84
+ properties: {
85
+ name: { type: 'string', title: 'Name' },
86
+ },
87
+ };
88
+ export const dynamicSchemaUpdated = {
89
+ type: 'object',
90
+ properties: {
91
+ name: { type: 'string', title: 'Name' },
92
+ email: { type: 'string', title: 'Email' },
93
+ },
94
+ };
95
+ export const helpSchema = {
96
+ type: 'object',
97
+ properties: {
98
+ name: {
99
+ type: 'string',
100
+ title: 'Name',
101
+ lime: {
102
+ help: {
103
+ value: 'Enter your full name',
104
+ },
105
+ },
106
+ },
107
+ },
108
+ };
109
+ export const gridLayoutSchema = {
110
+ type: 'object',
111
+ properties: {
112
+ first: { type: 'string', title: 'First' },
113
+ second: { type: 'string', title: 'Second' },
114
+ },
115
+ lime: {
116
+ layout: {
117
+ type: 'grid',
118
+ columns: 2,
119
+ },
120
+ },
121
+ };
122
+ export const collapsibleSchema = {
123
+ type: 'object',
124
+ properties: {
125
+ details: {
126
+ type: 'object',
127
+ title: 'Details',
128
+ properties: {
129
+ info: { type: 'string', title: 'Info' },
130
+ },
131
+ lime: {
132
+ collapsible: true,
133
+ },
134
+ },
135
+ },
136
+ };
137
+ export const dateSchema = {
138
+ type: 'object',
139
+ properties: {
140
+ birthday: { type: 'string', title: 'Birthday', format: 'date' },
141
+ },
142
+ };
143
+ export const integerSchema = {
144
+ type: 'object',
145
+ properties: {
146
+ count: { type: 'integer', title: 'Count' },
147
+ },
148
+ };
149
+ export const serverErrorsSchema = {
150
+ type: 'object',
151
+ properties: {
152
+ name: { type: 'string', title: 'Name' },
153
+ },
154
+ };
155
+ export const transformErrorsSchema = {
156
+ type: 'object',
157
+ properties: {
158
+ code: { type: 'string', title: 'Code', pattern: '^[A-Z]{3}$' },
159
+ },
160
+ required: ['code'],
161
+ };
162
+ export const customComponentSchema = {
163
+ type: 'object',
164
+ properties: {
165
+ enabled: {
166
+ type: 'boolean',
167
+ title: 'Enabled',
168
+ lime: {
169
+ component: {
170
+ name: 'limel-switch',
171
+ },
172
+ },
173
+ },
174
+ },
175
+ };
176
+ export const undefinedComponentSchema = {
177
+ type: 'object',
178
+ properties: {
179
+ field: {
180
+ type: 'string',
181
+ title: 'Field',
182
+ lime: {
183
+ component: {
184
+ name: 'limel-does-not-exist',
185
+ },
186
+ },
187
+ },
188
+ },
189
+ };
190
+ export const emptySchema = {
191
+ type: 'object',
192
+ properties: {},
193
+ };
194
+ export const hiddenFieldSchema = {
195
+ type: 'object',
196
+ properties: {
197
+ visible: { type: 'string', title: 'Visible' },
198
+ secret: {
199
+ type: 'string',
200
+ title: 'Secret',
201
+ lime: { hidden: true },
202
+ },
203
+ },
204
+ };
205
+ export const readOnlyFieldSchema = {
206
+ type: 'object',
207
+ properties: {
208
+ locked: {
209
+ type: 'string',
210
+ title: 'Locked',
211
+ readOnly: true,
212
+ },
213
+ },
214
+ };
215
+ export const arrayMaxItemsSchema = {
216
+ type: 'object',
217
+ properties: {
218
+ tags: {
219
+ type: 'array',
220
+ title: 'Tags',
221
+ items: { type: 'string' },
222
+ maxItems: 2,
223
+ },
224
+ },
225
+ };
226
+ export const arrayItemControlsSchema = {
227
+ type: 'object',
228
+ properties: {
229
+ items: {
230
+ type: 'array',
231
+ title: 'Items',
232
+ items: { type: 'string' },
233
+ lime: {
234
+ allowItemReorder: false,
235
+ allowItemRemoval: false,
236
+ },
237
+ },
238
+ },
239
+ };
240
+ export const rowLayoutSchema = {
241
+ type: 'object',
242
+ properties: {
243
+ first: {
244
+ type: 'string',
245
+ title: 'First',
246
+ description: 'First field description',
247
+ },
248
+ second: {
249
+ type: 'string',
250
+ title: 'Second',
251
+ description: 'Second field description',
252
+ },
253
+ },
254
+ lime: {
255
+ layout: {
256
+ type: 'row',
257
+ },
258
+ },
259
+ };
260
+ export const rowLayoutWithCustomComponentSchema = {
261
+ type: 'object',
262
+ properties: {
263
+ name: {
264
+ type: 'string',
265
+ title: 'Name',
266
+ description: 'Name description',
267
+ },
268
+ active: {
269
+ type: 'boolean',
270
+ title: 'Active',
271
+ description: 'Active description',
272
+ lime: {
273
+ component: {
274
+ name: 'limel-switch',
275
+ },
276
+ },
277
+ },
278
+ },
279
+ lime: {
280
+ layout: {
281
+ type: 'row',
282
+ },
283
+ },
284
+ };
285
+ export const nestedArrayObjectSchema = {
286
+ type: 'object',
287
+ properties: {
288
+ people: {
289
+ type: 'array',
290
+ title: 'People',
291
+ items: {
292
+ type: 'object',
293
+ title: 'Person',
294
+ properties: {
295
+ name: { type: 'string', title: 'Name' },
296
+ address: {
297
+ type: 'object',
298
+ title: 'Address',
299
+ properties: {
300
+ street: { type: 'string', title: 'Street' },
301
+ city: { type: 'string', title: 'City' },
302
+ },
303
+ },
304
+ },
305
+ },
306
+ },
307
+ },
308
+ };
@@ -0,0 +1,2 @@
1
+ import { createContext } from "react";
2
+ export const RowLayoutContext = createContext(false);
@@ -1,4 +1,5 @@
1
1
  import React from "react";
2
+ import { RowLayoutContext } from "./row-context";
2
3
  export class Row extends React.Component {
3
4
  constructor(props) {
4
5
  super(props);
@@ -37,8 +38,7 @@ export class Row extends React.Component {
37
38
  }
38
39
  }
39
40
  renderChildren() {
40
- const children = this.props.children;
41
- return Object.assign(Object.assign({}, children), { props: Object.assign(Object.assign({}, children.props), { schema: Object.assign(Object.assign({}, children.props.schema), { title: null, description: null }) }) });
41
+ return React.createElement(RowLayoutContext.Provider, { value: true }, this.props.children);
42
42
  }
43
43
  get schema() {
44
44
  return this.props.children.props.schema;
@@ -0,0 +1,2 @@
1
+ import { createContext } from "react";
2
+ export const ArrayFieldContext = createContext(null);
@@ -37,7 +37,7 @@ export class CollapsibleItemTemplate extends React.Component {
37
37
  const { data, schema, formSchema } = this.props;
38
38
  let children;
39
39
  if (this.state.isOpen) {
40
- children = this.props.item.children;
40
+ children = this.props.children;
41
41
  }
42
42
  const dragHandle = this.props.allowItemReorder
43
43
  ? React.createElement('limel-drag-handle', {
@@ -59,14 +59,14 @@ export class CollapsibleItemTemplate extends React.Component {
59
59
  }, dragHandle, children);
60
60
  }
61
61
  setActions(element) {
62
- const { item, index, allowItemRemoval } = this.props;
62
+ const { buttonsProps, allowItemRemoval } = this.props;
63
63
  const actions = [];
64
64
  if (allowItemRemoval) {
65
65
  actions.push({
66
66
  id: 'remove',
67
67
  icon: 'trash',
68
- disabled: !item.hasRemove,
69
- run: item.onDropIndexClick(index),
68
+ disabled: !buttonsProps.hasRemove,
69
+ run: buttonsProps.onRemoveItem,
70
70
  });
71
71
  }
72
72
  element.actions = actions;