@sme.up/ketchup 6.1.0-SNAPSHOT → 6.3.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 (223) hide show
  1. package/dist/cjs/{f-button-ac179257.js → f-button-94cb5f35.js} +4 -4
  2. package/dist/cjs/f-cell-76830a0d.js +416 -0
  3. package/dist/cjs/f-checkbox-cd977193.js +29 -0
  4. package/dist/cjs/{f-chip-b00897d7.js → f-chip-68d45fd3.js} +3 -3
  5. package/dist/cjs/{f-image-89f25556.js → f-image-0e71df7e.js} +2 -2
  6. package/dist/cjs/{f-paginator-utils-8fa501b3.js → f-paginator-utils-46689c0a.js} +80 -403
  7. package/dist/cjs/{f-text-field-e1e45ade.js → f-text-field-b4229cef.js} +11 -3
  8. package/dist/cjs/{index-eb556444.js → index-31125378.js} +15 -8
  9. package/dist/cjs/ketchup.cjs.js +3 -3
  10. package/dist/cjs/kup-accordion.cjs.entry.js +5 -6
  11. package/dist/cjs/kup-autocomplete_25.cjs.entry.js +331 -299
  12. package/dist/cjs/kup-box.cjs.entry.js +1304 -0
  13. package/dist/cjs/kup-calendar.cjs.entry.js +9 -11
  14. package/dist/cjs/kup-cell.cjs.entry.js +10 -11
  15. package/dist/cjs/kup-dash-list.cjs.entry.js +5 -7
  16. package/dist/cjs/kup-dash_2.cjs.entry.js +5 -9
  17. package/dist/cjs/kup-dashboard.cjs.entry.js +438 -0
  18. package/dist/cjs/kup-drawer.cjs.entry.js +5 -6
  19. package/dist/cjs/{kup-box_2.cjs.entry.js → kup-echart.cjs.entry.js} +66 -1353
  20. package/dist/cjs/kup-family-tree.cjs.entry.js +486 -0
  21. package/dist/cjs/kup-form.cjs.entry.js +478 -0
  22. package/dist/cjs/kup-iframe.cjs.entry.js +4 -5
  23. package/dist/cjs/kup-image-list.cjs.entry.js +73 -13
  24. package/dist/cjs/kup-lazy.cjs.entry.js +5 -6
  25. package/dist/cjs/kup-magic-box.cjs.entry.js +5 -6
  26. package/dist/cjs/{kup-manager-7a941909.js → kup-manager-7c514a30.js} +1787 -356
  27. package/dist/cjs/kup-nav-bar.cjs.entry.js +4 -5
  28. package/dist/cjs/kup-numeric-picker.cjs.entry.js +3 -3
  29. package/dist/cjs/kup-photo-frame.cjs.entry.js +6 -7
  30. package/dist/cjs/kup-probe.cjs.entry.js +2 -2
  31. package/dist/cjs/kup-qlik.cjs.entry.js +2 -2
  32. package/dist/cjs/kup-snackbar.cjs.entry.js +6 -7
  33. package/dist/cjs/loader.cjs.js +3 -3
  34. package/dist/collection/assets/dashboard.js +161 -0
  35. package/dist/collection/assets/data-table.js +59 -0
  36. package/dist/collection/assets/family-tree.js +2654 -0
  37. package/dist/collection/assets/form.js +433 -0
  38. package/dist/collection/assets/grid.js +17 -0
  39. package/dist/collection/assets/index.js +18 -6
  40. package/dist/collection/assets/kupinteract.js +68 -0
  41. package/dist/collection/collection-manifest.json +8 -7
  42. package/dist/collection/components/kup-autocomplete/kup-autocomplete.js +135 -129
  43. package/dist/collection/components/kup-box/kup-box.js +13 -2
  44. package/dist/collection/components/kup-button/kup-button.js +1 -0
  45. package/dist/collection/components/kup-combobox/kup-combobox.js +16 -13
  46. package/dist/collection/components/kup-dashboard/kup-dashboard-declarations.js +10 -0
  47. package/dist/collection/components/{kup-form-editor/kup-form-editor.css → kup-dashboard/kup-dashboard.css} +14 -6
  48. package/dist/collection/components/{kup-form-editor/kup-form-editor.js → kup-dashboard/kup-dashboard.js} +211 -152
  49. package/dist/collection/components/kup-data-table/kup-data-table-helper.js +42 -30
  50. package/dist/collection/components/kup-data-table/kup-data-table-state.js +1 -1
  51. package/dist/collection/components/kup-data-table/kup-data-table.js +7 -6
  52. package/dist/collection/components/kup-drawer/kup-drawer.css +5 -8
  53. package/dist/collection/components/kup-dropdown-button/kup-dropdown-button.js +1 -0
  54. package/dist/collection/components/kup-echart/kup-echart.js +9 -9
  55. package/dist/collection/components/kup-family-tree/kup-family-tree-declarations.js +14 -0
  56. package/dist/collection/components/kup-family-tree/kup-family-tree.css +171 -0
  57. package/dist/collection/components/kup-family-tree/kup-family-tree.js +854 -0
  58. package/dist/collection/components/kup-form/kup-form-declarations.js +25 -0
  59. package/dist/collection/components/kup-form/kup-form.css +99 -0
  60. package/dist/collection/components/kup-form/kup-form.js +647 -0
  61. package/dist/collection/components/kup-grid/kup-grid.js +1 -4
  62. package/dist/collection/components/kup-image-list/kup-image-list-state.js +9 -0
  63. package/dist/collection/components/kup-image-list/kup-image-list.css +0 -6
  64. package/dist/collection/components/kup-image-list/kup-image-list.js +113 -1
  65. package/dist/collection/components/kup-lazy/kup-lazy.css +13 -6
  66. package/dist/collection/components/kup-list/kup-list-helper.js +9 -3
  67. package/dist/collection/components/kup-photo-frame/kup-photo-frame.css +13 -3
  68. package/dist/collection/components/kup-photo-frame/kup-photo-frame.js +1 -1
  69. package/dist/collection/components/kup-text-field/kup-text-field-declarations.js +4 -0
  70. package/dist/collection/components/kup-text-field/kup-text-field.js +54 -0
  71. package/dist/collection/components/kup-time-picker/kup-time-picker.js +0 -6
  72. package/dist/collection/components/kup-tree/kup-tree.js +26 -9
  73. package/dist/collection/f-components/f-button/f-button.js +2 -2
  74. package/dist/collection/f-components/f-cell/f-cell-declarations.js +5 -1
  75. package/dist/collection/f-components/f-cell/f-cell.js +34 -114
  76. package/dist/collection/f-components/f-text-field/f-text-field.js +9 -1
  77. package/dist/collection/managers/kup-data/kup-data-cell-helper.js +48 -15
  78. package/dist/collection/managers/kup-data/kup-data-node-helper.js +69 -0
  79. package/dist/collection/managers/kup-data/kup-data.js +114 -6
  80. package/dist/collection/managers/kup-interact/kup-interact.js +3 -5
  81. package/dist/collection/managers/kup-language/kup-language-declarations.js +11 -0
  82. package/dist/collection/managers/kup-objects/kup-objects.js +10 -0
  83. package/dist/collection/managers/kup-scroll-on-hover/kup-scroll-on-hover-declarations.js +2 -0
  84. package/dist/collection/managers/kup-scroll-on-hover/kup-scroll-on-hover.js +131 -45
  85. package/dist/collection/managers/kup-theme/kup-theme-declarations.js +20 -3
  86. package/dist/collection/types/GenericTypes.js +3 -2
  87. package/dist/collection/utils/filters/filters-rows.js +4 -23
  88. package/dist/collection/utils/filters/filters-tree-items.js +2 -1
  89. package/dist/esm/{f-button-871a544b.js → f-button-cd948e50.js} +4 -4
  90. package/dist/esm/{f-cell-521ef17a.js → f-cell-474dd282.js} +46 -283
  91. package/dist/esm/f-checkbox-e06cf07b.js +27 -0
  92. package/dist/esm/{f-chip-1dda722f.js → f-chip-d6f2eb94.js} +3 -3
  93. package/dist/esm/{f-image-c468d8ae.js → f-image-914a03ef.js} +2 -2
  94. package/dist/esm/{f-paginator-utils-7dff8ff0.js → f-paginator-utils-a4a52732.js} +44 -366
  95. package/dist/esm/{f-text-field-d6c61c73.js → f-text-field-76341fe3.js} +11 -3
  96. package/dist/esm/{index-baeab1ac.js → index-e41330a5.js} +15 -8
  97. package/dist/esm/ketchup.js +3 -3
  98. package/dist/esm/kup-accordion.entry.js +3 -4
  99. package/dist/esm/kup-autocomplete_25.entry.js +222 -190
  100. package/dist/esm/kup-box.entry.js +1300 -0
  101. package/dist/esm/kup-calendar.entry.js +5 -7
  102. package/dist/esm/kup-cell.entry.js +7 -8
  103. package/dist/esm/kup-dash-list.entry.js +2 -4
  104. package/dist/esm/kup-dash_2.entry.js +3 -7
  105. package/dist/esm/kup-dashboard.entry.js +434 -0
  106. package/dist/esm/kup-drawer.entry.js +3 -4
  107. package/dist/esm/{kup-box_2.entry.js → kup-echart.entry.js} +61 -1347
  108. package/dist/esm/kup-family-tree.entry.js +482 -0
  109. package/dist/esm/kup-form.entry.js +474 -0
  110. package/dist/esm/kup-iframe.entry.js +2 -3
  111. package/dist/esm/kup-image-list.entry.js +70 -10
  112. package/dist/esm/kup-lazy.entry.js +3 -4
  113. package/dist/esm/kup-magic-box.entry.js +3 -4
  114. package/dist/esm/{kup-manager-58b075b4.js → kup-manager-86f440c7.js} +1762 -357
  115. package/dist/esm/kup-nav-bar.entry.js +2 -3
  116. package/dist/esm/kup-numeric-picker.entry.js +3 -3
  117. package/dist/esm/kup-photo-frame.entry.js +4 -5
  118. package/dist/esm/kup-probe.entry.js +2 -2
  119. package/dist/esm/kup-qlik.entry.js +2 -2
  120. package/dist/esm/kup-snackbar.entry.js +4 -5
  121. package/dist/esm/loader.js +3 -3
  122. package/dist/ketchup/ketchup.esm.js +1 -1
  123. package/dist/ketchup/p-00e1133d.entry.js +9 -0
  124. package/dist/ketchup/p-066f344a.entry.js +1 -0
  125. package/dist/ketchup/p-0c6e0647.entry.js +1 -0
  126. package/dist/ketchup/p-151f7c17.entry.js +27 -0
  127. package/dist/ketchup/p-1e9c03b0.entry.js +1 -0
  128. package/dist/ketchup/p-21ea11cb.js +30 -0
  129. package/dist/ketchup/{p-fac1a08b.entry.js → p-2f4e6c50.entry.js} +1 -1
  130. package/dist/ketchup/p-3586f59c.js +1 -0
  131. package/dist/ketchup/p-359fd90d.entry.js +1 -0
  132. package/dist/ketchup/p-389fd0bf.js +1 -0
  133. package/dist/ketchup/p-5552f156.js +1 -0
  134. package/dist/ketchup/{p-f09f2f98.entry.js → p-77aff9c1.entry.js} +1 -1
  135. package/dist/ketchup/p-7cfdf53c.entry.js +39 -0
  136. package/dist/ketchup/p-853a5178.entry.js +1 -0
  137. package/dist/ketchup/{p-44ec4f03.js → p-8673bd4e.js} +1 -1
  138. package/dist/ketchup/p-8b55b786.entry.js +1 -0
  139. package/dist/ketchup/p-95f5834b.entry.js +1 -0
  140. package/dist/ketchup/p-a2c595c4.js +1 -0
  141. package/dist/ketchup/p-ae91f27e.entry.js +1 -0
  142. package/dist/ketchup/p-af664379.js +1 -0
  143. package/dist/ketchup/p-b0b3989b.js +2 -0
  144. package/dist/ketchup/p-b3b65a61.entry.js +1 -0
  145. package/dist/ketchup/p-bc306a53.entry.js +1 -0
  146. package/dist/ketchup/{p-f71a1675.entry.js → p-c3783b77.entry.js} +1 -1
  147. package/dist/ketchup/{p-7eff4eee.js → p-cd4fc3fb.js} +1 -1
  148. package/dist/ketchup/p-cee76b14.entry.js +1 -0
  149. package/dist/ketchup/p-cfaea29b.entry.js +1 -0
  150. package/dist/ketchup/p-d2f51e7b.entry.js +1 -0
  151. package/dist/ketchup/p-df8e6a4d.entry.js +1 -0
  152. package/dist/ketchup/p-e60a1170.entry.js +1 -0
  153. package/dist/ketchup/p-e9a1ba04.entry.js +1 -0
  154. package/dist/types/components/kup-autocomplete/kup-autocomplete.d.ts +1 -16
  155. package/dist/types/components/{kup-form-editor/kup-form-editor-declarations.d.ts → kup-dashboard/kup-dashboard-declarations.d.ts} +9 -27
  156. package/dist/types/components/{kup-form-editor/kup-form-editor.d.ts → kup-dashboard/kup-dashboard.d.ts} +17 -9
  157. package/dist/types/components/kup-data-table/kup-data-table-state.d.ts +1 -1
  158. package/dist/types/components/kup-family-tree/kup-family-tree-declarations.d.ts +37 -0
  159. package/dist/types/components/kup-family-tree/kup-family-tree.d.ts +82 -0
  160. package/dist/types/components/kup-form/kup-form-declarations.d.ts +60 -0
  161. package/dist/types/components/kup-form/kup-form.d.ts +63 -0
  162. package/dist/types/components/kup-image-list/kup-image-list-state.d.ts +6 -0
  163. package/dist/types/components/kup-image-list/kup-image-list.d.ts +17 -0
  164. package/dist/types/components/kup-text-field/kup-text-field-declarations.d.ts +4 -0
  165. package/dist/types/components/kup-text-field/kup-text-field.d.ts +10 -0
  166. package/dist/types/components/kup-time-picker/kup-time-picker.d.ts +0 -6
  167. package/dist/types/components/kup-tree/kup-tree-declarations.d.ts +2 -0
  168. package/dist/types/components/kup-tree/kup-tree.d.ts +0 -1
  169. package/dist/types/components.d.ts +492 -231
  170. package/dist/types/f-components/f-cell/f-cell-declarations.d.ts +4 -1
  171. package/dist/types/f-components/f-text-field/f-text-field-declarations.d.ts +2 -0
  172. package/dist/types/managers/kup-data/kup-data-cell-helper.d.ts +13 -6
  173. package/dist/types/managers/kup-data/kup-data-declarations.d.ts +8 -0
  174. package/dist/types/managers/kup-data/kup-data-node-helper.d.ts +15 -1
  175. package/dist/types/managers/kup-data/kup-data.d.ts +9 -2
  176. package/dist/types/managers/kup-language/kup-language-declarations.d.ts +11 -1
  177. package/dist/types/managers/kup-objects/kup-objects.d.ts +6 -0
  178. package/dist/types/managers/kup-scroll-on-hover/kup-scroll-on-hover-declarations.d.ts +9 -1
  179. package/dist/types/managers/kup-scroll-on-hover/kup-scroll-on-hover.d.ts +7 -5
  180. package/dist/types/types/GenericTypes.d.ts +3 -2
  181. package/dist/types/utils/filters/filters-rows.d.ts +0 -2
  182. package/package.json +2 -2
  183. package/dist/cjs/cell-utils-a78d6fac.js +0 -168
  184. package/dist/cjs/f-cell-69294bca.js +0 -653
  185. package/dist/cjs/kup-field.cjs.entry.js +0 -241
  186. package/dist/cjs/kup-form-editor.cjs.entry.js +0 -404
  187. package/dist/cjs/utils-6287d878.js +0 -447
  188. package/dist/collection/assets/form-editor.js +0 -338
  189. package/dist/collection/components/kup-field/kup-field-declarations.js +0 -15
  190. package/dist/collection/components/kup-field/kup-field.css +0 -48
  191. package/dist/collection/components/kup-field/kup-field.js +0 -514
  192. package/dist/collection/components/kup-form-editor/kup-form-editor-declarations.js +0 -23
  193. package/dist/esm/cell-utils-964da6b5.js +0 -160
  194. package/dist/esm/kup-field.entry.js +0 -237
  195. package/dist/esm/kup-form-editor.entry.js +0 -400
  196. package/dist/esm/utils-d7e4b3c2.js +0 -428
  197. package/dist/ketchup/p-1ae66cc5.js +0 -1
  198. package/dist/ketchup/p-34b74425.js +0 -1
  199. package/dist/ketchup/p-3c11e615.entry.js +0 -1
  200. package/dist/ketchup/p-4ffbc3ff.js +0 -1
  201. package/dist/ketchup/p-5264a3e6.entry.js +0 -1
  202. package/dist/ketchup/p-65974e48.entry.js +0 -1
  203. package/dist/ketchup/p-65b46587.entry.js +0 -40
  204. package/dist/ketchup/p-6dff70f8.entry.js +0 -1
  205. package/dist/ketchup/p-7454cb92.js +0 -1
  206. package/dist/ketchup/p-80968627.entry.js +0 -1
  207. package/dist/ketchup/p-8cdf61a4.js +0 -1
  208. package/dist/ketchup/p-954cc340.entry.js +0 -1
  209. package/dist/ketchup/p-976244f9.entry.js +0 -9
  210. package/dist/ketchup/p-99e0d768.entry.js +0 -1
  211. package/dist/ketchup/p-a0f6e25c.entry.js +0 -1
  212. package/dist/ketchup/p-a615a92b.entry.js +0 -1
  213. package/dist/ketchup/p-aca0e54b.js +0 -30
  214. package/dist/ketchup/p-b8939a8b.entry.js +0 -1
  215. package/dist/ketchup/p-bfc3bac7.js +0 -1
  216. package/dist/ketchup/p-c5ce8951.entry.js +0 -1
  217. package/dist/ketchup/p-d2ee56dd.entry.js +0 -1
  218. package/dist/ketchup/p-db71436b.entry.js +0 -27
  219. package/dist/ketchup/p-e0035c58.js +0 -1
  220. package/dist/ketchup/p-e1039cf2.entry.js +0 -1
  221. package/dist/ketchup/p-ea10176c.entry.js +0 -1
  222. package/dist/types/components/kup-field/kup-field-declarations.d.ts +0 -25
  223. package/dist/types/components/kup-field/kup-field.d.ts +0 -90
@@ -1,237 +0,0 @@
1
- import { r as registerInstance, c as createEvent, f as forceUpdate, h, H as Host, g as getElement } from './index-baeab1ac.js';
2
- import { k as kupManagerInstance, c as KupDebugCategory } from './kup-manager-58b075b4.js';
3
- import { c as componentWrapperId } from './GenericVariables-665de00a.js';
4
-
5
- /**
6
- * Props of the kup-field component.
7
- * Used to export every prop in an object.
8
- */
9
- var KupFieldProps;
10
- (function (KupFieldProps) {
11
- KupFieldProps["customStyle"] = "Custom style of the component.";
12
- KupFieldProps["data"] = "Effective data to pass to the component.";
13
- KupFieldProps["label"] = "The text of the label. If set to empty or has only white space chars, the label will be removed.";
14
- KupFieldProps["labelPos"] = "Sets the label's position, left right or top.";
15
- KupFieldProps["showSubmit"] = "Sets whether the submit button must be displayed or not.";
16
- KupFieldProps["submitLabel"] = "Sets the submit button's label.";
17
- KupFieldProps["submitPos"] = "Sets the submit button's position, top right bottom or left.";
18
- KupFieldProps["type"] = "The type of the FLD";
19
- })(KupFieldProps || (KupFieldProps = {}));
20
-
21
- const kupFieldCss = ":host{display:block;font-size:var(--kup-font-size)}label{color:var(--kup-text-color);font-family:var(--kup-font-family);font-size:1em}.kup-field__component{display:inline-block}.label-top.submit-top label{float:left;margin:auto auto 1em auto}.label-top.submit-top kup-button{float:right;margin:auto auto 1em auto}.label-right label{display:inline-block;margin:auto auto auto 1em}.submit-right kup-button{display:inline-block;margin:auto auto auto 1em}.label-left label{display:inline-block;margin:auto 1em auto auto}.submit-left kup-button{display:inline-block;margin:auto 1em auto auto}.submit-bottom kup-button{display:block;margin:1em auto auto auto}";
22
-
23
- const KupField = class {
24
- constructor(hostRef) {
25
- registerInstance(this, hostRef);
26
- this.kupChange = createEvent(this, "kup-field-change", 6);
27
- this.kupSubmit = createEvent(this, "kup-field-submit", 6);
28
- /*-------------------------------------------------*/
29
- /* P r o p s */
30
- /*-------------------------------------------------*/
31
- /**
32
- * Custom style of the component.
33
- * @default ""
34
- * @see https://ketchup.smeup.com/ketchup-showcase/#/customization
35
- */
36
- this.customStyle = '';
37
- /**
38
- * Effective data to pass to the component.
39
- * @default {}
40
- */
41
- this.data = {};
42
- /**
43
- * The text of the label. If set to empty or has only white space chars, the label will be removed.
44
- * @default ""
45
- */
46
- this.label = '';
47
- /**
48
- * Sets the label's position, left right or top.
49
- * @default "left"
50
- */
51
- this.labelPos = 'left';
52
- /**
53
- * Sets whether the submit button must be displayed or not.
54
- * @default false
55
- */
56
- this.showSubmit = false;
57
- /**
58
- * Sets the submit button's label.
59
- * @default ""
60
- */
61
- this.submitLabel = '';
62
- /**
63
- * Sets the submit button's position, top right bottom or left.
64
- * @default "right"
65
- */
66
- this.submitPos = 'right';
67
- /**
68
- * The type of the FLD
69
- * @default undefined
70
- */
71
- this.type = undefined;
72
- /*-------------------------------------------------*/
73
- /* I n t e r n a l V a r i a b l e s */
74
- /*-------------------------------------------------*/
75
- /**
76
- * Instance of the KupManager class.
77
- */
78
- this.kupManager = kupManagerInstance();
79
- this.currentValue = null;
80
- this.previousValue = null;
81
- // Generates an instance of the event handler while binding the current component as its this value
82
- // This is done once per component to improve performance speed
83
- this.onChangeInstance = this.onChange.bind(this);
84
- this.onSubmitInstance = this.onSubmit.bind(this);
85
- }
86
- // When a change or update event must be launched as if it's coming from the FLD itself
87
- onChange(event) {
88
- const { value, info } = event.detail;
89
- this.kupChange.emit({
90
- originalEvent: event,
91
- oldValue: this.currentValue,
92
- value,
93
- info,
94
- });
95
- this.previousValue = this.currentValue;
96
- this.currentValue = value;
97
- }
98
- // When a submit event must be launched as if it's coming from the FLD itself
99
- onSubmit(event) {
100
- this.kupSubmit.emit({
101
- originalEvent: event,
102
- oldValue: this.previousValue,
103
- value: this.currentValue,
104
- info: {
105
- obj: event.detail.info && event.detail.info.obj
106
- ? event.detail.info.obj
107
- : undefined,
108
- },
109
- });
110
- }
111
- /*-------------------------------------------------*/
112
- /* P u b l i c M e t h o d s */
113
- /*-------------------------------------------------*/
114
- /**
115
- * Provides an interface to get the current value programmatically
116
- * @method getCurrentValue
117
- * @returns {any}
118
- */
119
- async getCurrentValue() {
120
- return this.currentValue;
121
- }
122
- /**
123
- * Used to retrieve component's props values.
124
- * @param {boolean} descriptions - When provided and true, the result will be the list of props with their description.
125
- * @returns {Promise<GenericObject>} List of props as object, each key will be a prop.
126
- */
127
- async getProps(descriptions) {
128
- let props = {};
129
- if (descriptions) {
130
- props = KupFieldProps;
131
- }
132
- else {
133
- for (const key in KupFieldProps) {
134
- if (Object.prototype.hasOwnProperty.call(KupFieldProps, key)) {
135
- props[key] = this[key];
136
- }
137
- }
138
- }
139
- return props;
140
- }
141
- /**
142
- * This method is used to trigger a new render of the component.
143
- */
144
- async refresh() {
145
- forceUpdate(this);
146
- }
147
- /*-------------------------------------------------*/
148
- /* L i f e c y c l e H o o k s */
149
- /*-------------------------------------------------*/
150
- componentWillLoad() {
151
- this.kupManager.debug.logLoad(this, false);
152
- this.kupManager.theme.register(this);
153
- }
154
- componentDidLoad() {
155
- this.kupManager.debug.logLoad(this, true);
156
- }
157
- componentWillRender() {
158
- this.kupManager.debug.logRender(this, false);
159
- }
160
- componentDidRender() {
161
- this.kupManager.debug.logRender(this, true);
162
- }
163
- render() {
164
- let toRender = [];
165
- const baseClass = 'kup-field';
166
- let label = null;
167
- let submit = null;
168
- let wrapperClass = '';
169
- let propList = Object.assign({}, this.data);
170
- if (this.label.trim().length) {
171
- wrapperClass += ' label-' + this.labelPos;
172
- label = (h("label", { class: baseClass +
173
- '__label' +
174
- ' ' +
175
- baseClass +
176
- '--' +
177
- this.labelPos }, this.label));
178
- }
179
- if (this.showSubmit) {
180
- wrapperClass += ' submit-' + this.submitPos;
181
- submit = (h("kup-button", { class: baseClass + '__submit', label: this.submitLabel, "onkup-button-click": this.onSubmitInstance }));
182
- }
183
- //-- If a component must be positioned on top of the dynamic one --
184
- const labelIsTop = this.labelPos === 'top';
185
- const labelIsLeft = this.labelPos === 'left';
186
- const labelIsRight = this.labelPos === 'right';
187
- const submitIsTop = this.submitPos === 'top';
188
- const submitIsLeft = this.submitPos === 'left';
189
- const submitIsRight = this.submitPos === 'right';
190
- const submitIsBottom = this.submitPos === 'bottom';
191
- if (labelIsTop || submitIsTop) {
192
- toRender.push(h("div", { class: baseClass + '__top-container' }, labelIsTop && label ? label : null, submitIsTop && submit ? submit : null));
193
- }
194
- if (labelIsLeft && label) {
195
- toRender.push(label);
196
- }
197
- if (submitIsLeft && submit) {
198
- toRender.push(submit);
199
- }
200
- let comp = undefined;
201
- if (this.type === undefined) {
202
- this.kupManager.debug.logMessage(this, 'Type (state) is undefined!', KupDebugCategory.WARNING);
203
- }
204
- else {
205
- switch (this.type.toLowerCase()) {
206
- case 'cmb':
207
- comp = 'kup-combobox';
208
- propList.onKupComboboxChange = this.onChangeInstance;
209
- break;
210
- case 'itx':
211
- comp = 'kup-text-field';
212
- propList.onkupTextFieldChange = this.onChangeInstance;
213
- break;
214
- case 'rad':
215
- comp = 'kup-radio';
216
- propList.onkupRadioChange = this.onChangeInstance;
217
- break;
218
- }
219
- }
220
- const $DynamicComponent = comp; // TODO check if there is a better typing
221
- toRender.push(h($DynamicComponent, Object.assign({ class: baseClass + '__component' }, propList)));
222
- if (labelIsRight && label) {
223
- toRender.push(label);
224
- }
225
- if ((submitIsRight || submitIsBottom) && submit) {
226
- toRender.push(submit);
227
- }
228
- return (h(Host, null, h("style", null, this.kupManager.theme.setKupStyle(this.rootElement)), h("div", { id: componentWrapperId, class: wrapperClass }, toRender)));
229
- }
230
- disconnectedCallback() {
231
- this.kupManager.theme.unregister(this);
232
- }
233
- get rootElement() { return getElement(this); }
234
- };
235
- KupField.style = kupFieldCss;
236
-
237
- export { KupField as kup_field };
@@ -1,400 +0,0 @@
1
- import { r as registerInstance, c as createEvent, f as forceUpdate, h, H as Host, g as getElement } from './index-baeab1ac.js';
2
- import { F as FButton } from './f-button-871a544b.js';
3
- import { k as kupManagerInstance, h as KupLanguageGeneric, B as KupDragEffect, c as KupDebugCategory } from './kup-manager-58b075b4.js';
4
- import { g as getProps, s as setProps } from './utils-d7e4b3c2.js';
5
- import { c as componentWrapperId } from './GenericVariables-665de00a.js';
6
- import './f-button-declarations-b1b4cac4.js';
7
- import './f-image-c468d8ae.js';
8
-
9
- /**
10
- * Props of the kup-form-editor component.
11
- * Used to export every prop in an object.
12
- */
13
- var KupFormEditorProps;
14
- (function (KupFormEditorProps) {
15
- KupFormEditorProps["customStyle"] = "Custom style of the component.";
16
- KupFormEditorProps["data"] = "The data of the component.";
17
- })(KupFormEditorProps || (KupFormEditorProps = {}));
18
- var KupFormEditorDragTypes;
19
- (function (KupFormEditorDragTypes) {
20
- KupFormEditorDragTypes["Components"] = "1";
21
- KupFormEditorDragTypes["Sections"] = "2";
22
- })(KupFormEditorDragTypes || (KupFormEditorDragTypes = {}));
23
- var KupFormEditorLabels;
24
- (function (KupFormEditorLabels) {
25
- KupFormEditorLabels["Loaded"] = "Loaded";
26
- KupFormEditorLabels["Reset"] = "Reset";
27
- KupFormEditorLabels["Save"] = "Save";
28
- KupFormEditorLabels["Components"] = "Components";
29
- KupFormEditorLabels["Sections"] = "Sections";
30
- KupFormEditorLabels["Column"] = "Column";
31
- })(KupFormEditorLabels || (KupFormEditorLabels = {}));
32
-
33
- const kupFormEditorCss = ":host{width:100%;height:100%}.header{display:flex;flex-direction:row;justify-content:center}.header>*{margin-left:0.5em}.form{display:grid;grid-gap:0.5em}.form-dropzone{padding:1em;border:1px solid var(--kup-primary-color)}.section{display:flex;flex-direction:column}.section-header{display:flex;flex-direction:column}.section-header>*{width:100%;display:flex;flex-direction:row}.section-header>*>.section-header-actions{display:flex;justify-content:end}.section-header>*>.section-header-actions>*{margin-top:auto;margin-bottom:auto}.section-body{display:grid}.section-dropzone{border:1px solid var(--kup-primary-color);min-height:100px}.section-draggable{border:1px solid var(--kup-secondary-color);padding:1em}.component{height:fit-content;padding:1em;margin:0.5em}.component-draggable{border:1px solid var(--kup-secondary-color)}.layout-row{grid-auto-flow:column;grid-template-columns:min-content}.layout-column{grid-auto-flow:row;grid-template-rows:min-content}";
34
-
35
- const KupFormEditor = class {
36
- constructor(hostRef) {
37
- registerInstance(this, hostRef);
38
- this.kupSave = createEvent(this, "kup-formeditor-save", 6);
39
- /*-------------------------------------------------*/
40
- /* S t a t e s */
41
- /*-------------------------------------------------*/
42
- /**
43
- * Force render component by internal event.
44
- */
45
- this.resetInternalData = false;
46
- /*-------------------------------------------------*/
47
- /* P r o p s */
48
- /*-------------------------------------------------*/
49
- /**
50
- * Custom style of the component.
51
- * @default ""
52
- * @see https://ketchup.smeup.com/ketchup-showcase/#/customization
53
- */
54
- this.customStyle = '';
55
- /**
56
- * The data of the component.
57
- * @default false
58
- */
59
- this.data = null;
60
- /*-------------------------------------------------*/
61
- /* I n t e r n a l V a r i a b l e s */
62
- /*-------------------------------------------------*/
63
- /**
64
- * Instance of the KupManager class.
65
- */
66
- this.kupManager = kupManagerInstance();
67
- /**
68
- * Draggable type of Form (Components or Sections).
69
- */
70
- this.dragType = KupFormEditorDragTypes.Components;
71
- /**
72
- * Internal data of the component.
73
- */
74
- this.internalData = null;
75
- /**
76
- * Internal data backup of the component for refresh when changed content by drag&drop.
77
- */
78
- this.internalDataBackup = null;
79
- }
80
- onKupSave() {
81
- this.kupSave.emit({
82
- comp: this,
83
- id: this.rootElement.id,
84
- data: this.internalData,
85
- });
86
- }
87
- /*-------------------------------------------------*/
88
- /* W a t c h e r s */
89
- /*-------------------------------------------------*/
90
- dataChanged() {
91
- this.resetData();
92
- }
93
- /*-------------------------------------------------*/
94
- /* P u b l i c M e t h o d s */
95
- /*-------------------------------------------------*/
96
- /**
97
- * Used to retrieve component's props values.
98
- * @param {boolean} descriptions - When provided and true, the result will be the list of props with their description.
99
- * @returns {Promise<GenericObject>} List of props as object, each key will be a prop.
100
- */
101
- async getProps(descriptions) {
102
- return getProps(this, KupFormEditorProps, descriptions);
103
- }
104
- /**
105
- * This method is used to trigger a new render of the component.
106
- */
107
- async refresh() {
108
- forceUpdate(this);
109
- }
110
- /**
111
- * Sets the props to the component.
112
- * @param {GenericObject} props - Object containing props that will be set to the component.
113
- */
114
- async setProps(props) {
115
- setProps(this, KupFormEditorProps, props);
116
- }
117
- /*-------------------------------------------------*/
118
- /* P r i v a t e M e t h o d s */
119
- /*-------------------------------------------------*/
120
- buildHeader() {
121
- const clearButtonProp = {
122
- icon: 'cancel',
123
- label: KupFormEditorLabels.Reset,
124
- secondary: true,
125
- onClick: () => {
126
- this.resetData();
127
- },
128
- };
129
- const saveButtonProp = {
130
- icon: 'save',
131
- label: KupFormEditorLabels.Save,
132
- onClick: () => this.onKupSave(),
133
- };
134
- const selRadioProp = [
135
- {
136
- label: KupFormEditorLabels.Components,
137
- value: KupFormEditorDragTypes.Components,
138
- checked: this.dragType == KupFormEditorDragTypes.Components,
139
- },
140
- {
141
- label: KupFormEditorLabels.Sections,
142
- value: KupFormEditorDragTypes.Sections,
143
- checked: this.dragType == KupFormEditorDragTypes.Sections,
144
- },
145
- ];
146
- return (h("div", { class: "header" }, h("kup-radio", { data: selRadioProp, "onKup-radio-change": (ev) => {
147
- this.dragType = ev.detail
148
- .value;
149
- this.resetData(this.internalData);
150
- } }), h(FButton, Object.assign({}, clearButtonProp)), h(FButton, Object.assign({}, saveButtonProp))));
151
- }
152
- buildForm(form, parent) {
153
- const classes = {
154
- form: true,
155
- 'layout-column': form && form.layout == 'column',
156
- 'layout-row': form && form.layout == 'row',
157
- 'form-dropzone': form &&
158
- this.dragType == KupFormEditorDragTypes.Sections &&
159
- form.sections != null &&
160
- form.sections.length > 0,
161
- };
162
- return form ? (h("div", { class: classes, ref: (el) => {
163
- if (!el)
164
- return;
165
- const kel = el;
166
- kel.kupData = { parent: parent, form: form };
167
- } }, form.sections.map((section) => this.buildSection(section, form)))) : (h("div", null, this.kupManager.language.translate(KupLanguageGeneric.EMPTY_DATA)));
168
- }
169
- buildSectionHeader(section, parent) {
170
- const addButtonProp = {
171
- icon: 'add',
172
- slim: true,
173
- onClick: () => {
174
- if (!section.sections) {
175
- section.sections = [];
176
- }
177
- const newSec = {
178
- id: section.id + (section.sections.length + 1),
179
- loaded: section.loaded,
180
- layout: section.layout,
181
- components: [],
182
- };
183
- if (section.components) {
184
- section.components.forEach((x) => newSec.components.push(x));
185
- section.components.splice(0);
186
- }
187
- section.sections.push(newSec);
188
- this.resetData(this.internalData);
189
- },
190
- };
191
- const removeButtonProp = {
192
- icon: 'remove',
193
- slim: true,
194
- secondary: true,
195
- onClick: () => {
196
- const idx = parent.sections.indexOf(section);
197
- parent.sections.splice(idx, 1);
198
- this.resetData(this.internalData);
199
- },
200
- };
201
- return (h("div", { class: "section-header" }, h("div", null, section.id, ' ', section.dim ? '(' + section.dim + ')' : undefined, " -", ' ', section.layout), h("div", null, h("div", { class: "section-header-actions" }, h("kup-switch", { checked: section.loaded, label: KupFormEditorLabels.Loaded, "onKup-switch-change": (ev) => {
202
- section.loaded = ev.detail.value == 'on';
203
- } }), h("kup-switch", { checked: section.layout == 'column', label: KupFormEditorLabels.Column, "onKup-switch-change": (ev) => {
204
- section.layout =
205
- ev.detail.value == 'on' ? 'column' : 'row';
206
- this.resetData(this.internalData);
207
- } }), h(FButton, Object.assign({}, addButtonProp)), h(FButton, Object.assign({}, removeButtonProp)), section.components && section.components.length > 0 ? (h("kup-image", { resource: "widgets", sizeX: "24px", sizeY: "24px" })) : undefined))));
208
- }
209
- buildSection(section, parent) {
210
- const classes = {
211
- section: true,
212
- 'section-draggable': this.dragType == KupFormEditorDragTypes.Sections,
213
- 'section-dropzone': !section.sections ||
214
- section.sections.length == 0 ||
215
- this.dragType == KupFormEditorDragTypes.Sections,
216
- };
217
- const bodyClasses = {
218
- 'section-body': true,
219
- 'layout-column': section && section.layout == 'column',
220
- 'layout-row': section && section.layout == 'row',
221
- };
222
- let bodyStyles = {};
223
- if (section.sections) {
224
- let gridTemplate = '';
225
- section.sections.forEach((childSection) => {
226
- if (!childSection.dim)
227
- gridTemplate += ' 1fr';
228
- else
229
- gridTemplate +=
230
- childSection.dim.indexOf('%') < 0
231
- ? ' ' + childSection.dim + 'px'
232
- : ' ' + childSection.dim;
233
- });
234
- if (section.layout == 'column')
235
- bodyStyles['gridTemplateRows'] = gridTemplate;
236
- if (section.layout == 'row')
237
- bodyStyles['gridTemplateColumns'] = gridTemplate;
238
- }
239
- return (h("div", { class: classes, ref: (el) => {
240
- if (!el)
241
- return;
242
- const kel = el;
243
- kel.kupData = { parent: parent, section: section };
244
- } }, this.dragType == KupFormEditorDragTypes.Sections
245
- ? this.buildSectionHeader(section, parent)
246
- : undefined, h("div", { class: bodyClasses, style: bodyStyles }, this.dragType == KupFormEditorDragTypes.Components &&
247
- section.components
248
- ? section.components.map((component) => component.type == 'SCH' ? (this.buildForm(component, section)) : (h("div", { class: "component component-draggable", ref: (el) => {
249
- if (!el)
250
- return;
251
- const kel = el;
252
- kel.kupData = {
253
- section: section,
254
- componnent: component,
255
- };
256
- } }, component.id, " - ", component.type, h("kup-switch", { checked: component.loaded, label: KupFormEditorLabels.Loaded, "onKup-switch-change": (ev) => {
257
- component.loaded =
258
- ev.detail.value == 'on';
259
- } }))))
260
- : undefined, section.sections
261
- ? section.sections.map((childSection) => this.buildSection(childSection, section))
262
- : undefined)));
263
- }
264
- didRenderInteractables() {
265
- try {
266
- const items = [];
267
- this.rootElement.shadowRoot
268
- .querySelectorAll('.component-draggable')
269
- .forEach((x) => items.push(x));
270
- this.rootElement.shadowRoot
271
- .querySelectorAll('.section-draggable')
272
- .forEach((x) => items.push(x));
273
- items.forEach((item) => {
274
- this.kupManager.interact.draggable(item, null, null, KupDragEffect.CLONE);
275
- });
276
- }
277
- catch (error) {
278
- this.kupManager.debug.logMessage(this, error, KupDebugCategory.ERROR);
279
- }
280
- try {
281
- const items = [];
282
- this.rootElement.shadowRoot
283
- .querySelectorAll('.section-dropzone')
284
- .forEach((x) => items.push(x));
285
- this.rootElement.shadowRoot
286
- .querySelectorAll('.form-dropzone')
287
- .forEach((x) => items.push(x));
288
- items.forEach((item) => {
289
- this.kupManager.interact.dropzone(item, null, null, {
290
- drop: (ev) => {
291
- ev.currentTarget.appendChild(ev.relatedTarget);
292
- this.dropped(ev.currentTarget, ev.relatedTarget);
293
- },
294
- });
295
- });
296
- }
297
- catch (error) {
298
- this.kupManager.debug.logMessage(this, error, KupDebugCategory.ERROR);
299
- }
300
- }
301
- dropped(parent, child) {
302
- if (this.dragType == KupFormEditorDragTypes.Components) {
303
- const idx = child.kupData.section.components.indexOf(child.kupData.componnent);
304
- child.kupData.section.components.splice(idx, 1);
305
- parent.kupData.section.components.push(child.kupData.componnent);
306
- child.kupData.section = parent.kupData.section;
307
- }
308
- else if (this.dragType == KupFormEditorDragTypes.Sections) {
309
- const idx = child.kupData.parent.sections.indexOf(child.kupData.section);
310
- child.kupData.parent.sections.splice(idx, 1);
311
- if (parent.kupData.form) {
312
- // il nuovo target è la form.
313
- if (!parent.kupData.form.sections)
314
- parent.kupData.form.sections = [];
315
- parent.kupData.form.sections.push(child.kupData.section);
316
- child.kupData.parent = parent.kupData.form;
317
- }
318
- else if (parent.kupData.section) {
319
- // il nuovo target è la section.
320
- if (!parent.kupData.section.sections)
321
- parent.kupData.section.sections = [];
322
- if (parent.kupData.section.components &&
323
- parent.kupData.section.components.length > 0) {
324
- // devo creare una section contenitore e sposare i components
325
- const newSec = {
326
- id: parent.kupData.section.id + '1',
327
- loaded: parent.kupData.section.loaded,
328
- layout: parent.kupData.section.layout,
329
- components: [],
330
- };
331
- parent.kupData.section.components.forEach((x) => newSec.components.push(x));
332
- parent.kupData.section.components.splice(0);
333
- parent.kupData.section.sections.push(newSec);
334
- }
335
- parent.kupData.section.sections.push(child.kupData.section);
336
- child.kupData.parent = parent.kupData.section;
337
- }
338
- this.resetData(this.internalData);
339
- }
340
- }
341
- resetData(form = null) {
342
- if (form)
343
- this.internalDataBackup = form;
344
- this.resetInternalData = true;
345
- setTimeout(() => {
346
- if (this.internalDataBackup) {
347
- this.internalData = this.internalDataBackup;
348
- this.internalDataBackup = null;
349
- }
350
- this.resetInternalData = false;
351
- }, 250);
352
- }
353
- unregisterInteractables() {
354
- this.kupManager.interact.unregister(Array.from(this.rootElement.shadowRoot.querySelectorAll('.component-draggable')));
355
- this.kupManager.interact.unregister(Array.from(this.rootElement.shadowRoot.querySelectorAll('.section-dropzone')));
356
- this.kupManager.interact.unregister(Array.from(this.rootElement.shadowRoot.querySelectorAll('.section-draggable')));
357
- this.kupManager.interact.unregister(Array.from(this.rootElement.shadowRoot.querySelectorAll('.form-dropzone')));
358
- }
359
- /*-------------------------------------------------*/
360
- /* L i f e c y c l e H o o k s */
361
- /*-------------------------------------------------*/
362
- componentWillLoad() {
363
- this.kupManager.dates.register(this);
364
- this.kupManager.debug.logLoad(this, false);
365
- this.kupManager.language.register(this);
366
- this.kupManager.theme.register(this);
367
- }
368
- componentDidLoad() {
369
- this.kupManager.debug.logLoad(this, true);
370
- }
371
- componentWillRender() {
372
- this.kupManager.debug.logRender(this, false);
373
- if (this.resetInternalData) {
374
- this.internalData = null;
375
- this.unregisterInteractables();
376
- }
377
- else if (!this.internalData)
378
- this.internalData = JSON.parse(JSON.stringify(this.data));
379
- }
380
- componentDidRender() {
381
- this.kupManager.debug.logRender(this, true);
382
- this.didRenderInteractables();
383
- }
384
- render() {
385
- return (h(Host, null, h("style", null, this.kupManager.theme.setKupStyle(this.rootElement)), h("div", { id: componentWrapperId }, this.buildHeader(), this.buildForm(this.internalData, null))));
386
- }
387
- disconnectedCallback() {
388
- this.unregisterInteractables();
389
- this.kupManager.dates.unregister(this);
390
- this.kupManager.language.unregister(this);
391
- this.kupManager.theme.unregister(this);
392
- }
393
- get rootElement() { return getElement(this); }
394
- static get watchers() { return {
395
- "data": ["dataChanged"]
396
- }; }
397
- };
398
- KupFormEditor.style = kupFormEditorCss;
399
-
400
- export { KupFormEditor as kup_form_editor };