@sme.up/ketchup 5.2.0-SNAPSHOT → 6.1.0-SNAPSHOT

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 (212) hide show
  1. package/dist/cjs/{cell-utils-5b16c180.js → cell-utils-a78d6fac.js} +2 -2
  2. package/dist/cjs/{component-d1496215.js → component-72a5b626.js} +30 -0
  3. package/dist/cjs/{f-button-3b9f32af.js → f-button-ac179257.js} +2 -2
  4. package/dist/cjs/{f-cell-c6ad973a.js → f-cell-69294bca.js} +33 -121
  5. package/dist/cjs/{f-chip-bed86c4a.js → f-chip-b00897d7.js} +5 -4
  6. package/dist/cjs/{f-image-08a3d340.js → f-image-89f25556.js} +2 -2
  7. package/dist/cjs/f-paginator-utils-8fa501b3.js +1898 -0
  8. package/dist/cjs/f-text-field-e1e45ade.js +94 -0
  9. package/dist/cjs/f-text-field-mdc-85997738.js +2570 -0
  10. package/dist/cjs/{index-8d7bb3be.js → index-eb556444.js} +2 -0
  11. package/dist/cjs/ketchup.cjs.js +3 -3
  12. package/dist/cjs/kup-accordion.cjs.entry.js +5 -5
  13. package/dist/cjs/{kup-autocomplete_27.cjs.entry.js → kup-autocomplete_25.cjs.entry.js} +1766 -8367
  14. package/dist/cjs/{kup-echart.cjs.entry.js → kup-box_2.cjs.entry.js} +17102 -14788
  15. package/dist/cjs/kup-calendar.cjs.entry.js +42 -34
  16. package/dist/cjs/kup-cell.cjs.entry.js +8 -7
  17. package/dist/cjs/kup-dash-list.cjs.entry.js +4 -4
  18. package/dist/cjs/kup-dash_2.cjs.entry.js +3 -3
  19. package/dist/cjs/kup-drawer.cjs.entry.js +12 -5
  20. package/dist/cjs/kup-field.cjs.entry.js +2 -2
  21. package/dist/cjs/kup-form-editor.cjs.entry.js +404 -0
  22. package/dist/cjs/kup-iframe.cjs.entry.js +3 -3
  23. package/dist/cjs/kup-image-list.cjs.entry.js +228 -0
  24. package/dist/cjs/kup-lazy.cjs.entry.js +3 -3
  25. package/dist/cjs/kup-magic-box.cjs.entry.js +4 -4
  26. package/dist/cjs/kup-manager-7a941909.js +16703 -0
  27. package/dist/cjs/kup-nav-bar.cjs.entry.js +3 -3
  28. package/dist/cjs/kup-numeric-picker.cjs.entry.js +423 -0
  29. package/dist/cjs/kup-photo-frame.cjs.entry.js +5 -5
  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 -6
  33. package/dist/cjs/loader.cjs.js +3 -3
  34. package/dist/cjs/{utils-b9df398c.js → utils-6287d878.js} +1 -1
  35. package/dist/collection/assets/card.js +4 -5
  36. package/dist/collection/assets/data-table.js +0 -79
  37. package/dist/collection/assets/form-editor.js +338 -0
  38. package/dist/collection/assets/image-list.js +624 -0
  39. package/dist/collection/assets/index.js +16 -0
  40. package/dist/collection/assets/kupdata.js +0 -3
  41. package/dist/collection/assets/kuptooltip.js +654 -0
  42. package/dist/collection/assets/tree.js +0 -128
  43. package/dist/collection/collection-manifest.json +8 -6
  44. package/dist/collection/components/kup-autocomplete/kup-autocomplete.js +1 -1
  45. package/dist/collection/components/kup-box/kup-box-declarations.js +0 -4
  46. package/dist/collection/components/kup-box/kup-box.js +7 -135
  47. package/dist/collection/components/kup-card/built-in/kup-card-built-in.js +10 -0
  48. package/dist/collection/components/kup-card/built-in/kup-card-clock.js +1 -1
  49. package/dist/collection/components/kup-card/built-in/kup-card-column-drop-menu.js +1 -2
  50. package/dist/collection/components/kup-card/built-in/kup-card-numeric.js +153 -0
  51. package/dist/collection/components/kup-card/kup-card.css +61 -8
  52. package/dist/collection/components/kup-card/kup-card.js +2 -2
  53. package/dist/collection/components/kup-card/standard/kup-card-standard.js +14 -6
  54. package/dist/collection/components/kup-combobox/kup-combobox.js +1 -1
  55. package/dist/collection/components/kup-data-table/kup-data-table-declarations.js +1 -3
  56. package/dist/collection/components/kup-data-table/kup-data-table.js +50 -138
  57. package/dist/collection/components/kup-date-picker/kup-date-picker.js +1 -1
  58. package/dist/collection/components/kup-drawer/kup-drawer.css +1 -0
  59. package/dist/collection/components/kup-drawer/kup-drawer.js +8 -1
  60. package/dist/collection/components/kup-form-editor/kup-form-editor-declarations.js +23 -0
  61. package/dist/collection/components/kup-form-editor/kup-form-editor.css +80 -0
  62. package/dist/collection/components/kup-form-editor/kup-form-editor.js +561 -0
  63. package/dist/collection/components/kup-image-list/kup-image-list-declarations.js +10 -0
  64. package/dist/collection/components/kup-image-list/kup-image-list.css +166 -0
  65. package/dist/collection/components/kup-image-list/kup-image-list.js +432 -0
  66. package/dist/collection/components/kup-numeric-picker/kup-numeric-picker-declarations.js +16 -0
  67. package/dist/collection/components/kup-numeric-picker/kup-numeric-picker.css +50 -0
  68. package/dist/collection/components/kup-numeric-picker/kup-numeric-picker.js +895 -0
  69. package/dist/collection/components/kup-photo-frame/kup-photo-frame.css +3 -13
  70. package/dist/collection/components/kup-photo-frame/kup-photo-frame.js +1 -1
  71. package/dist/collection/components/kup-snackbar/kup-snackbar.css +4 -0
  72. package/dist/collection/components/kup-tab-bar/kup-tab-bar.js +18 -19
  73. package/dist/collection/components/kup-time-picker/kup-time-picker.js +2 -2
  74. package/dist/collection/components/kup-tree/kup-tree-declarations.js +0 -4
  75. package/dist/collection/components/kup-tree/kup-tree.css +10 -3
  76. package/dist/collection/components/kup-tree/kup-tree.js +65 -140
  77. package/dist/collection/f-components/f-cell/f-cell.js +7 -7
  78. package/dist/collection/f-components/f-chip/f-chip.js +2 -1
  79. package/dist/collection/managers/kup-data/kup-data-node-helper.js +24 -0
  80. package/dist/collection/managers/kup-data/kup-data.js +4 -1
  81. package/dist/collection/managers/kup-debug/kup-debug.js +1 -0
  82. package/dist/collection/managers/kup-dynamic-position/kup-dynamic-position.js +4 -2
  83. package/dist/collection/managers/kup-interact/kup-interact.js +1 -22
  84. package/dist/collection/managers/kup-language/kup-language-declarations.js +2 -0
  85. package/dist/collection/managers/kup-manager/kup-manager.js +31 -1
  86. package/dist/collection/managers/kup-math/kup-math.js +11 -1
  87. package/dist/collection/managers/kup-theme/kup-theme-declarations.js +6 -0
  88. package/dist/collection/managers/kup-tooltip/kup-tooltip-declarations.js +1 -0
  89. package/dist/collection/managers/kup-tooltip/kup-tooltip.js +224 -0
  90. package/dist/collection/types/GenericTypes.js +3 -0
  91. package/dist/collection/utils/kup-column-menu/kup-column-menu.js +8 -12
  92. package/dist/esm/{cell-utils-69f75e2e.js → cell-utils-964da6b5.js} +3 -3
  93. package/dist/esm/{component-c4eb6153.js → component-b1bedf1d.js} +27 -2
  94. package/dist/esm/{f-button-7e7607d8.js → f-button-871a544b.js} +2 -2
  95. package/dist/esm/{f-cell-e4d83c27.js → f-cell-521ef17a.js} +33 -120
  96. package/dist/esm/{f-chip-51dfefaf.js → f-chip-1dda722f.js} +6 -5
  97. package/dist/esm/{f-image-de331954.js → f-image-c468d8ae.js} +2 -2
  98. package/dist/esm/f-paginator-utils-7dff8ff0.js +1884 -0
  99. package/dist/esm/f-text-field-d6c61c73.js +92 -0
  100. package/dist/esm/f-text-field-mdc-d42d3f9e.js +2568 -0
  101. package/dist/esm/{index-aeec9835.js → index-baeab1ac.js} +2 -1
  102. package/dist/esm/ketchup.js +3 -3
  103. package/dist/esm/kup-accordion.entry.js +6 -6
  104. package/dist/esm/{kup-autocomplete_27.entry.js → kup-autocomplete_25.entry.js} +1711 -8310
  105. package/dist/esm/{kup-echart.entry.js → kup-box_2.entry.js} +17102 -14789
  106. package/dist/esm/kup-calendar.entry.js +43 -35
  107. package/dist/esm/kup-cell.entry.js +8 -7
  108. package/dist/esm/kup-dash-list.entry.js +4 -4
  109. package/dist/esm/kup-dash_2.entry.js +3 -3
  110. package/dist/esm/kup-drawer.entry.js +12 -5
  111. package/dist/esm/kup-field.entry.js +2 -2
  112. package/dist/esm/kup-form-editor.entry.js +400 -0
  113. package/dist/esm/kup-iframe.entry.js +3 -3
  114. package/dist/esm/kup-image-list.entry.js +224 -0
  115. package/dist/esm/kup-lazy.entry.js +3 -3
  116. package/dist/esm/kup-magic-box.entry.js +4 -4
  117. package/dist/esm/kup-manager-58b075b4.js +16686 -0
  118. package/dist/esm/kup-nav-bar.entry.js +3 -3
  119. package/dist/esm/kup-numeric-picker.entry.js +419 -0
  120. package/dist/esm/kup-photo-frame.entry.js +5 -5
  121. package/dist/esm/kup-probe.entry.js +2 -2
  122. package/dist/esm/kup-qlik.entry.js +2 -2
  123. package/dist/esm/kup-snackbar.entry.js +6 -6
  124. package/dist/esm/loader.js +3 -3
  125. package/dist/esm/polyfills/css-shim.js +1 -1
  126. package/dist/esm/{tslib.es6-8f2d44b6.js → tslib.es6-3eea2234.js} +1 -1
  127. package/dist/esm/{utils-35c7a90d.js → utils-d7e4b3c2.js} +2 -2
  128. package/dist/ketchup/ketchup.esm.js +1 -1
  129. package/dist/ketchup/{p-5d190cf5.js → p-1ae66cc5.js} +1 -1
  130. package/dist/ketchup/{p-8be1337b.js → p-34b74425.js} +1 -1
  131. package/dist/ketchup/{p-fea316ab.entry.js → p-3c11e615.entry.js} +1 -1
  132. package/dist/ketchup/p-44ec4f03.js +1 -0
  133. package/dist/ketchup/p-4ffbc3ff.js +1 -0
  134. package/dist/ketchup/p-5264a3e6.entry.js +1 -0
  135. package/dist/ketchup/{p-d7af8156.entry.js → p-65974e48.entry.js} +1 -1
  136. package/dist/ketchup/p-65b46587.entry.js +40 -0
  137. package/dist/ketchup/{p-3813281b.entry.js → p-6dff70f8.entry.js} +1 -1
  138. package/dist/ketchup/{p-33073f4a.js → p-7454cb92.js} +1 -1
  139. package/dist/ketchup/{p-a0b1d769.js → p-79b0730b.js} +1 -1
  140. package/dist/ketchup/p-7eff4eee.js +1 -0
  141. package/dist/ketchup/p-80968627.entry.js +1 -0
  142. package/dist/ketchup/{p-8c44c3b9.js → p-81605f08.js} +4 -5
  143. package/dist/ketchup/p-8cdf61a4.js +1 -0
  144. package/dist/ketchup/{p-f9c41e20.entry.js → p-954cc340.entry.js} +1 -1
  145. package/dist/ketchup/p-976244f9.entry.js +9 -0
  146. package/dist/ketchup/p-99e0d768.entry.js +1 -0
  147. package/dist/ketchup/{p-8f735633.entry.js → p-a0f6e25c.entry.js} +1 -1
  148. package/dist/ketchup/p-a203f78b.js +45 -0
  149. package/dist/ketchup/{p-9bcda66f.entry.js → p-a615a92b.entry.js} +1 -1
  150. package/dist/ketchup/p-aca0e54b.js +30 -0
  151. package/dist/ketchup/p-b8939a8b.entry.js +1 -0
  152. package/dist/ketchup/p-bfc3bac7.js +1 -0
  153. package/dist/ketchup/{p-67c64257.entry.js → p-c5ce8951.entry.js} +1 -1
  154. package/dist/ketchup/{p-68fc1428.entry.js → p-d2ee56dd.entry.js} +1 -1
  155. package/dist/ketchup/p-db71436b.entry.js +27 -0
  156. package/dist/ketchup/{p-10c8d755.js → p-e0035c58.js} +1 -1
  157. package/dist/ketchup/p-e1039cf2.entry.js +1 -0
  158. package/dist/ketchup/{p-b5e1dbfa.entry.js → p-ea10176c.entry.js} +1 -1
  159. package/dist/ketchup/p-f09f2f98.entry.js +1 -0
  160. package/dist/ketchup/{p-0751aaf6.entry.js → p-f71a1675.entry.js} +1 -1
  161. package/dist/ketchup/{p-4081f5f7.entry.js → p-fac1a08b.entry.js} +1 -1
  162. package/dist/types/components/kup-box/kup-box-declarations.d.ts +3 -5
  163. package/dist/types/components/kup-box/kup-box.d.ts +0 -22
  164. package/dist/types/components/kup-card/built-in/kup-card-built-in.d.ts +7 -0
  165. package/dist/types/components/kup-card/built-in/kup-card-numeric.d.ts +2 -0
  166. package/dist/types/components/kup-card/kup-card-declarations.d.ts +26 -1
  167. package/dist/types/components/kup-data-table/kup-data-table-declarations.d.ts +4 -4
  168. package/dist/types/components/kup-data-table/kup-data-table.d.ts +5 -19
  169. package/dist/types/components/kup-form-editor/kup-form-editor-declarations.d.ts +79 -0
  170. package/dist/types/components/kup-form-editor/kup-form-editor.d.ts +72 -0
  171. package/dist/types/components/kup-image-list/kup-image-list-declarations.d.ts +14 -0
  172. package/dist/types/components/kup-image-list/kup-image-list.d.ts +56 -0
  173. package/dist/types/components/kup-numeric-picker/kup-numeric-picker-declarations.d.ts +19 -0
  174. package/dist/types/components/kup-numeric-picker/kup-numeric-picker.d.ts +121 -0
  175. package/dist/types/components/kup-tab-bar/kup-tab-bar-declarations.d.ts +3 -9
  176. package/dist/types/components/kup-tab-bar/kup-tab-bar.d.ts +6 -6
  177. package/dist/types/components/kup-tree/kup-tree-declarations.d.ts +1 -5
  178. package/dist/types/components/kup-tree/kup-tree.d.ts +1 -24
  179. package/dist/types/components.d.ts +265 -232
  180. package/dist/types/managers/kup-data/kup-data-declarations.d.ts +1 -0
  181. package/dist/types/managers/kup-data/kup-data-node-helper.d.ts +7 -0
  182. package/dist/types/managers/kup-data/kup-data.d.ts +1 -0
  183. package/dist/types/managers/kup-language/kup-language-declarations.d.ts +2 -0
  184. package/dist/types/managers/kup-manager/kup-manager-declarations.d.ts +14 -0
  185. package/dist/types/managers/kup-manager/kup-manager.d.ts +14 -0
  186. package/dist/types/managers/kup-math/kup-math-declarations.d.ts +6 -0
  187. package/dist/types/managers/kup-math/kup-math.d.ts +2 -1
  188. package/dist/types/managers/kup-tooltip/kup-tooltip-declarations.d.ts +8 -0
  189. package/dist/types/managers/kup-tooltip/kup-tooltip.d.ts +51 -0
  190. package/dist/types/types/GenericTypes.d.ts +3 -0
  191. package/dist/types/utils/kup-column-menu/kup-column-menu.d.ts +1 -3
  192. package/package.json +16 -15
  193. package/dist/cjs/kup-manager-4227f0a2.js +0 -8582
  194. package/dist/collection/assets/tooltip.js +0 -73
  195. package/dist/collection/components/kup-tooltip/kup-tooltip-declarations.js +0 -20
  196. package/dist/collection/components/kup-tooltip/kup-tooltip.css +0 -149
  197. package/dist/collection/components/kup-tooltip/kup-tooltip.js +0 -1205
  198. package/dist/collection/utils/helpers.js +0 -38
  199. package/dist/esm/kup-manager-0ab94726.js +0 -8565
  200. package/dist/ketchup/p-24df4f29.entry.js +0 -27
  201. package/dist/ketchup/p-2d4f19f4.js +0 -1
  202. package/dist/ketchup/p-3445be1e.entry.js +0 -1
  203. package/dist/ketchup/p-3aab1f0d.entry.js +0 -1
  204. package/dist/ketchup/p-47b57d97.js +0 -1
  205. package/dist/ketchup/p-5186885c.entry.js +0 -1
  206. package/dist/ketchup/p-78223dc0.entry.js +0 -143
  207. package/dist/ketchup/p-96101f09.entry.js +0 -39
  208. package/dist/ketchup/p-c314b1e6.js +0 -1
  209. package/dist/ketchup/p-ee33cbe9.js +0 -9
  210. package/dist/types/components/kup-tooltip/kup-tooltip-declarations.d.ts +0 -93
  211. package/dist/types/components/kup-tooltip/kup-tooltip.d.ts +0 -142
  212. package/dist/types/utils/helpers.d.ts +0 -4
@@ -0,0 +1,80 @@
1
+ :host {
2
+ width: 100%;
3
+ height: 100%;
4
+ }
5
+
6
+ .header {
7
+ display: flex;
8
+ flex-direction: row;
9
+ justify-content: center;
10
+ }
11
+ .header > * {
12
+ margin-left: 0.5em;
13
+ }
14
+
15
+ .form {
16
+ display: grid;
17
+ grid-gap: 0.5em;
18
+ }
19
+
20
+ .form-dropzone {
21
+ padding: 1em;
22
+ border: 1px solid var(--kup-primary-color);
23
+ }
24
+
25
+ .section {
26
+ display: flex;
27
+ flex-direction: column;
28
+ }
29
+
30
+ .section-header {
31
+ display: flex;
32
+ flex-direction: column;
33
+ }
34
+ .section-header > * {
35
+ width: 100%;
36
+ display: flex;
37
+ flex-direction: row;
38
+ }
39
+ .section-header > * > .section-header-actions {
40
+ display: flex;
41
+ justify-content: end;
42
+ }
43
+ .section-header > * > .section-header-actions > * {
44
+ margin-top: auto;
45
+ margin-bottom: auto;
46
+ }
47
+
48
+ .section-body {
49
+ display: grid;
50
+ }
51
+
52
+ .section-dropzone {
53
+ border: 1px solid var(--kup-primary-color);
54
+ min-height: 100px;
55
+ }
56
+
57
+ .section-draggable {
58
+ border: 1px solid var(--kup-secondary-color);
59
+ padding: 1em;
60
+ }
61
+
62
+ .component {
63
+ height: fit-content;
64
+ padding: 1em;
65
+ margin: 0.5em;
66
+ }
67
+
68
+ .component-draggable {
69
+ border: 1px solid var(--kup-secondary-color);
70
+ }
71
+
72
+ .layout-row {
73
+ grid-auto-flow: column;
74
+ grid-template-columns: min-content;
75
+ }
76
+
77
+ .layout-column {
78
+ grid-auto-flow: row;
79
+ grid-template-rows: min-content;
80
+ }
@@ -0,0 +1,561 @@
1
+ import { Component, Element, forceUpdate, h, Host, Method, Prop, State, Event, Watch, } from '@stencil/core';
2
+ import { FButton } from '../../f-components/f-button/f-button';
3
+ import { KupDebugCategory } from '../../managers/kup-debug/kup-debug-declarations';
4
+ import { KupDragEffect } from '../../managers/kup-interact/kup-interact-declarations';
5
+ import { KupLanguageGeneric } from '../../managers/kup-language/kup-language-declarations';
6
+ import { kupManagerInstance, } from '../../managers/kup-manager/kup-manager';
7
+ import { getProps, setProps } from '../../utils/utils';
8
+ import { componentWrapperId } from '../../variables/GenericVariables';
9
+ import { KupFormEditorDragTypes, KupFormEditorLabels, KupFormEditorProps, } from './kup-form-editor-declarations';
10
+ export class KupFormEditor {
11
+ constructor() {
12
+ /*-------------------------------------------------*/
13
+ /* S t a t e s */
14
+ /*-------------------------------------------------*/
15
+ /**
16
+ * Force render component by internal event.
17
+ */
18
+ this.resetInternalData = false;
19
+ /*-------------------------------------------------*/
20
+ /* P r o p s */
21
+ /*-------------------------------------------------*/
22
+ /**
23
+ * Custom style of the component.
24
+ * @default ""
25
+ * @see https://ketchup.smeup.com/ketchup-showcase/#/customization
26
+ */
27
+ this.customStyle = '';
28
+ /**
29
+ * The data of the component.
30
+ * @default false
31
+ */
32
+ this.data = null;
33
+ /*-------------------------------------------------*/
34
+ /* I n t e r n a l V a r i a b l e s */
35
+ /*-------------------------------------------------*/
36
+ /**
37
+ * Instance of the KupManager class.
38
+ */
39
+ this.kupManager = kupManagerInstance();
40
+ /**
41
+ * Draggable type of Form (Components or Sections).
42
+ */
43
+ this.dragType = KupFormEditorDragTypes.Components;
44
+ /**
45
+ * Internal data of the component.
46
+ */
47
+ this.internalData = null;
48
+ /**
49
+ * Internal data backup of the component for refresh when changed content by drag&drop.
50
+ */
51
+ this.internalDataBackup = null;
52
+ }
53
+ onKupSave() {
54
+ this.kupSave.emit({
55
+ comp: this,
56
+ id: this.rootElement.id,
57
+ data: this.internalData,
58
+ });
59
+ }
60
+ /*-------------------------------------------------*/
61
+ /* W a t c h e r s */
62
+ /*-------------------------------------------------*/
63
+ dataChanged() {
64
+ this.resetData();
65
+ }
66
+ /*-------------------------------------------------*/
67
+ /* P u b l i c M e t h o d s */
68
+ /*-------------------------------------------------*/
69
+ /**
70
+ * Used to retrieve component's props values.
71
+ * @param {boolean} descriptions - When provided and true, the result will be the list of props with their description.
72
+ * @returns {Promise<GenericObject>} List of props as object, each key will be a prop.
73
+ */
74
+ async getProps(descriptions) {
75
+ return getProps(this, KupFormEditorProps, descriptions);
76
+ }
77
+ /**
78
+ * This method is used to trigger a new render of the component.
79
+ */
80
+ async refresh() {
81
+ forceUpdate(this);
82
+ }
83
+ /**
84
+ * Sets the props to the component.
85
+ * @param {GenericObject} props - Object containing props that will be set to the component.
86
+ */
87
+ async setProps(props) {
88
+ setProps(this, KupFormEditorProps, props);
89
+ }
90
+ /*-------------------------------------------------*/
91
+ /* P r i v a t e M e t h o d s */
92
+ /*-------------------------------------------------*/
93
+ buildHeader() {
94
+ const clearButtonProp = {
95
+ icon: 'cancel',
96
+ label: KupFormEditorLabels.Reset,
97
+ secondary: true,
98
+ onClick: () => {
99
+ this.resetData();
100
+ },
101
+ };
102
+ const saveButtonProp = {
103
+ icon: 'save',
104
+ label: KupFormEditorLabels.Save,
105
+ onClick: () => this.onKupSave(),
106
+ };
107
+ const selRadioProp = [
108
+ {
109
+ label: KupFormEditorLabels.Components,
110
+ value: KupFormEditorDragTypes.Components,
111
+ checked: this.dragType == KupFormEditorDragTypes.Components,
112
+ },
113
+ {
114
+ label: KupFormEditorLabels.Sections,
115
+ value: KupFormEditorDragTypes.Sections,
116
+ checked: this.dragType == KupFormEditorDragTypes.Sections,
117
+ },
118
+ ];
119
+ return (h("div", { class: "header" },
120
+ h("kup-radio", { data: selRadioProp, "onKup-radio-change": (ev) => {
121
+ this.dragType = ev.detail
122
+ .value;
123
+ this.resetData(this.internalData);
124
+ } }),
125
+ h(FButton, Object.assign({}, clearButtonProp)),
126
+ h(FButton, Object.assign({}, saveButtonProp))));
127
+ }
128
+ buildForm(form, parent) {
129
+ const classes = {
130
+ form: true,
131
+ 'layout-column': form && form.layout == 'column',
132
+ 'layout-row': form && form.layout == 'row',
133
+ 'form-dropzone': form &&
134
+ this.dragType == KupFormEditorDragTypes.Sections &&
135
+ form.sections != null &&
136
+ form.sections.length > 0,
137
+ };
138
+ return form ? (h("div", { class: classes, ref: (el) => {
139
+ if (!el)
140
+ return;
141
+ const kel = el;
142
+ kel.kupData = { parent: parent, form: form };
143
+ } }, form.sections.map((section) => this.buildSection(section, form)))) : (h("div", null, this.kupManager.language.translate(KupLanguageGeneric.EMPTY_DATA)));
144
+ }
145
+ buildSectionHeader(section, parent) {
146
+ const addButtonProp = {
147
+ icon: 'add',
148
+ slim: true,
149
+ onClick: () => {
150
+ if (!section.sections) {
151
+ section.sections = [];
152
+ }
153
+ const newSec = {
154
+ id: section.id + (section.sections.length + 1),
155
+ loaded: section.loaded,
156
+ layout: section.layout,
157
+ components: [],
158
+ };
159
+ if (section.components) {
160
+ section.components.forEach((x) => newSec.components.push(x));
161
+ section.components.splice(0);
162
+ }
163
+ section.sections.push(newSec);
164
+ this.resetData(this.internalData);
165
+ },
166
+ };
167
+ const removeButtonProp = {
168
+ icon: 'remove',
169
+ slim: true,
170
+ secondary: true,
171
+ onClick: () => {
172
+ const idx = parent.sections.indexOf(section);
173
+ parent.sections.splice(idx, 1);
174
+ this.resetData(this.internalData);
175
+ },
176
+ };
177
+ return (h("div", { class: "section-header" },
178
+ h("div", null,
179
+ section.id,
180
+ ' ',
181
+ section.dim ? '(' + section.dim + ')' : undefined,
182
+ " -",
183
+ ' ',
184
+ section.layout),
185
+ h("div", null,
186
+ h("div", { class: "section-header-actions" },
187
+ h("kup-switch", { checked: section.loaded, label: KupFormEditorLabels.Loaded, "onKup-switch-change": (ev) => {
188
+ section.loaded = ev.detail.value == 'on';
189
+ } }),
190
+ h("kup-switch", { checked: section.layout == 'column', label: KupFormEditorLabels.Column, "onKup-switch-change": (ev) => {
191
+ section.layout =
192
+ ev.detail.value == 'on' ? 'column' : 'row';
193
+ this.resetData(this.internalData);
194
+ } }),
195
+ h(FButton, Object.assign({}, addButtonProp)),
196
+ h(FButton, Object.assign({}, removeButtonProp)),
197
+ section.components && section.components.length > 0 ? (h("kup-image", { resource: "widgets", sizeX: "24px", sizeY: "24px" })) : undefined))));
198
+ }
199
+ buildSection(section, parent) {
200
+ const classes = {
201
+ section: true,
202
+ 'section-draggable': this.dragType == KupFormEditorDragTypes.Sections,
203
+ 'section-dropzone': !section.sections ||
204
+ section.sections.length == 0 ||
205
+ this.dragType == KupFormEditorDragTypes.Sections,
206
+ };
207
+ const bodyClasses = {
208
+ 'section-body': true,
209
+ 'layout-column': section && section.layout == 'column',
210
+ 'layout-row': section && section.layout == 'row',
211
+ };
212
+ let bodyStyles = {};
213
+ if (section.sections) {
214
+ let gridTemplate = '';
215
+ section.sections.forEach((childSection) => {
216
+ if (!childSection.dim)
217
+ gridTemplate += ' 1fr';
218
+ else
219
+ gridTemplate +=
220
+ childSection.dim.indexOf('%') < 0
221
+ ? ' ' + childSection.dim + 'px'
222
+ : ' ' + childSection.dim;
223
+ });
224
+ if (section.layout == 'column')
225
+ bodyStyles['gridTemplateRows'] = gridTemplate;
226
+ if (section.layout == 'row')
227
+ bodyStyles['gridTemplateColumns'] = gridTemplate;
228
+ }
229
+ return (h("div", { class: classes, ref: (el) => {
230
+ if (!el)
231
+ return;
232
+ const kel = el;
233
+ kel.kupData = { parent: parent, section: section };
234
+ } },
235
+ this.dragType == KupFormEditorDragTypes.Sections
236
+ ? this.buildSectionHeader(section, parent)
237
+ : undefined,
238
+ h("div", { class: bodyClasses, style: bodyStyles },
239
+ this.dragType == KupFormEditorDragTypes.Components &&
240
+ section.components
241
+ ? section.components.map((component) => component.type == 'SCH' ? (this.buildForm(component, section)) : (h("div", { class: "component component-draggable", ref: (el) => {
242
+ if (!el)
243
+ return;
244
+ const kel = el;
245
+ kel.kupData = {
246
+ section: section,
247
+ componnent: component,
248
+ };
249
+ } },
250
+ component.id,
251
+ " - ",
252
+ component.type,
253
+ h("kup-switch", { checked: component.loaded, label: KupFormEditorLabels.Loaded, "onKup-switch-change": (ev) => {
254
+ component.loaded =
255
+ ev.detail.value == 'on';
256
+ } }))))
257
+ : undefined,
258
+ section.sections
259
+ ? section.sections.map((childSection) => this.buildSection(childSection, section))
260
+ : undefined)));
261
+ }
262
+ didRenderInteractables() {
263
+ try {
264
+ const items = [];
265
+ this.rootElement.shadowRoot
266
+ .querySelectorAll('.component-draggable')
267
+ .forEach((x) => items.push(x));
268
+ this.rootElement.shadowRoot
269
+ .querySelectorAll('.section-draggable')
270
+ .forEach((x) => items.push(x));
271
+ items.forEach((item) => {
272
+ this.kupManager.interact.draggable(item, null, null, KupDragEffect.CLONE);
273
+ });
274
+ }
275
+ catch (error) {
276
+ this.kupManager.debug.logMessage(this, error, KupDebugCategory.ERROR);
277
+ }
278
+ try {
279
+ const items = [];
280
+ this.rootElement.shadowRoot
281
+ .querySelectorAll('.section-dropzone')
282
+ .forEach((x) => items.push(x));
283
+ this.rootElement.shadowRoot
284
+ .querySelectorAll('.form-dropzone')
285
+ .forEach((x) => items.push(x));
286
+ items.forEach((item) => {
287
+ this.kupManager.interact.dropzone(item, null, null, {
288
+ drop: (ev) => {
289
+ ev.currentTarget.appendChild(ev.relatedTarget);
290
+ this.dropped(ev.currentTarget, ev.relatedTarget);
291
+ },
292
+ });
293
+ });
294
+ }
295
+ catch (error) {
296
+ this.kupManager.debug.logMessage(this, error, KupDebugCategory.ERROR);
297
+ }
298
+ }
299
+ dropped(parent, child) {
300
+ if (this.dragType == KupFormEditorDragTypes.Components) {
301
+ const idx = child.kupData.section.components.indexOf(child.kupData.componnent);
302
+ child.kupData.section.components.splice(idx, 1);
303
+ parent.kupData.section.components.push(child.kupData.componnent);
304
+ child.kupData.section = parent.kupData.section;
305
+ }
306
+ else if (this.dragType == KupFormEditorDragTypes.Sections) {
307
+ const idx = child.kupData.parent.sections.indexOf(child.kupData.section);
308
+ child.kupData.parent.sections.splice(idx, 1);
309
+ if (parent.kupData.form) {
310
+ // il nuovo target è la form.
311
+ if (!parent.kupData.form.sections)
312
+ parent.kupData.form.sections = [];
313
+ parent.kupData.form.sections.push(child.kupData.section);
314
+ child.kupData.parent = parent.kupData.form;
315
+ }
316
+ else if (parent.kupData.section) {
317
+ // il nuovo target è la section.
318
+ if (!parent.kupData.section.sections)
319
+ parent.kupData.section.sections = [];
320
+ if (parent.kupData.section.components &&
321
+ parent.kupData.section.components.length > 0) {
322
+ // devo creare una section contenitore e sposare i components
323
+ const newSec = {
324
+ id: parent.kupData.section.id + '1',
325
+ loaded: parent.kupData.section.loaded,
326
+ layout: parent.kupData.section.layout,
327
+ components: [],
328
+ };
329
+ parent.kupData.section.components.forEach((x) => newSec.components.push(x));
330
+ parent.kupData.section.components.splice(0);
331
+ parent.kupData.section.sections.push(newSec);
332
+ }
333
+ parent.kupData.section.sections.push(child.kupData.section);
334
+ child.kupData.parent = parent.kupData.section;
335
+ }
336
+ this.resetData(this.internalData);
337
+ }
338
+ }
339
+ resetData(form = null) {
340
+ if (form)
341
+ this.internalDataBackup = form;
342
+ this.resetInternalData = true;
343
+ setTimeout(() => {
344
+ if (this.internalDataBackup) {
345
+ this.internalData = this.internalDataBackup;
346
+ this.internalDataBackup = null;
347
+ }
348
+ this.resetInternalData = false;
349
+ }, 250);
350
+ }
351
+ unregisterInteractables() {
352
+ this.kupManager.interact.unregister(Array.from(this.rootElement.shadowRoot.querySelectorAll('.component-draggable')));
353
+ this.kupManager.interact.unregister(Array.from(this.rootElement.shadowRoot.querySelectorAll('.section-dropzone')));
354
+ this.kupManager.interact.unregister(Array.from(this.rootElement.shadowRoot.querySelectorAll('.section-draggable')));
355
+ this.kupManager.interact.unregister(Array.from(this.rootElement.shadowRoot.querySelectorAll('.form-dropzone')));
356
+ }
357
+ /*-------------------------------------------------*/
358
+ /* L i f e c y c l e H o o k s */
359
+ /*-------------------------------------------------*/
360
+ componentWillLoad() {
361
+ this.kupManager.dates.register(this);
362
+ this.kupManager.debug.logLoad(this, false);
363
+ this.kupManager.language.register(this);
364
+ this.kupManager.theme.register(this);
365
+ }
366
+ componentDidLoad() {
367
+ this.kupManager.debug.logLoad(this, true);
368
+ }
369
+ componentWillRender() {
370
+ this.kupManager.debug.logRender(this, false);
371
+ if (this.resetInternalData) {
372
+ this.internalData = null;
373
+ this.unregisterInteractables();
374
+ }
375
+ else if (!this.internalData)
376
+ this.internalData = JSON.parse(JSON.stringify(this.data));
377
+ }
378
+ componentDidRender() {
379
+ this.kupManager.debug.logRender(this, true);
380
+ this.didRenderInteractables();
381
+ }
382
+ render() {
383
+ return (h(Host, null,
384
+ h("style", null, this.kupManager.theme.setKupStyle(this.rootElement)),
385
+ h("div", { id: componentWrapperId },
386
+ this.buildHeader(),
387
+ this.buildForm(this.internalData, null))));
388
+ }
389
+ disconnectedCallback() {
390
+ this.unregisterInteractables();
391
+ this.kupManager.dates.unregister(this);
392
+ this.kupManager.language.unregister(this);
393
+ this.kupManager.theme.unregister(this);
394
+ }
395
+ static get is() { return "kup-form-editor"; }
396
+ static get encapsulation() { return "shadow"; }
397
+ static get originalStyleUrls() { return {
398
+ "$": ["kup-form-editor.scss"]
399
+ }; }
400
+ static get styleUrls() { return {
401
+ "$": ["kup-form-editor.css"]
402
+ }; }
403
+ static get properties() { return {
404
+ "customStyle": {
405
+ "type": "string",
406
+ "mutable": false,
407
+ "complexType": {
408
+ "original": "string",
409
+ "resolved": "string",
410
+ "references": {}
411
+ },
412
+ "required": false,
413
+ "optional": false,
414
+ "docs": {
415
+ "tags": [{
416
+ "name": "default",
417
+ "text": "\"\""
418
+ }, {
419
+ "name": "see",
420
+ "text": "https://ketchup.smeup.com/ketchup-showcase/#/customization"
421
+ }],
422
+ "text": "Custom style of the component."
423
+ },
424
+ "attribute": "custom-style",
425
+ "reflect": false,
426
+ "defaultValue": "''"
427
+ },
428
+ "data": {
429
+ "type": "unknown",
430
+ "mutable": false,
431
+ "complexType": {
432
+ "original": "KupForm",
433
+ "resolved": "KupForm",
434
+ "references": {
435
+ "KupForm": {
436
+ "location": "import",
437
+ "path": "./kup-form-editor-declarations"
438
+ }
439
+ }
440
+ },
441
+ "required": false,
442
+ "optional": false,
443
+ "docs": {
444
+ "tags": [{
445
+ "name": "default",
446
+ "text": "false"
447
+ }],
448
+ "text": "The data of the component."
449
+ },
450
+ "defaultValue": "null"
451
+ }
452
+ }; }
453
+ static get states() { return {
454
+ "resetInternalData": {}
455
+ }; }
456
+ static get events() { return [{
457
+ "method": "kupSave",
458
+ "name": "kup-formeditor-save",
459
+ "bubbles": true,
460
+ "cancelable": false,
461
+ "composed": true,
462
+ "docs": {
463
+ "tags": [],
464
+ "text": ""
465
+ },
466
+ "complexType": {
467
+ "original": "KupFormEditorEventPayload",
468
+ "resolved": "KupFormEditorEventPayload",
469
+ "references": {
470
+ "KupFormEditorEventPayload": {
471
+ "location": "import",
472
+ "path": "./kup-form-editor-declarations"
473
+ }
474
+ }
475
+ }
476
+ }]; }
477
+ static get methods() { return {
478
+ "getProps": {
479
+ "complexType": {
480
+ "signature": "(descriptions?: boolean) => Promise<GenericObject>",
481
+ "parameters": [{
482
+ "tags": [{
483
+ "name": "param",
484
+ "text": "descriptions - When provided and true, the result will be the list of props with their description."
485
+ }],
486
+ "text": "- When provided and true, the result will be the list of props with their description."
487
+ }],
488
+ "references": {
489
+ "Promise": {
490
+ "location": "global"
491
+ },
492
+ "GenericObject": {
493
+ "location": "import",
494
+ "path": "../../types/GenericTypes"
495
+ }
496
+ },
497
+ "return": "Promise<GenericObject>"
498
+ },
499
+ "docs": {
500
+ "text": "Used to retrieve component's props values.",
501
+ "tags": [{
502
+ "name": "param",
503
+ "text": "descriptions - When provided and true, the result will be the list of props with their description."
504
+ }, {
505
+ "name": "returns",
506
+ "text": "List of props as object, each key will be a prop."
507
+ }]
508
+ }
509
+ },
510
+ "refresh": {
511
+ "complexType": {
512
+ "signature": "() => Promise<void>",
513
+ "parameters": [],
514
+ "references": {
515
+ "Promise": {
516
+ "location": "global"
517
+ }
518
+ },
519
+ "return": "Promise<void>"
520
+ },
521
+ "docs": {
522
+ "text": "This method is used to trigger a new render of the component.",
523
+ "tags": []
524
+ }
525
+ },
526
+ "setProps": {
527
+ "complexType": {
528
+ "signature": "(props: GenericObject) => Promise<void>",
529
+ "parameters": [{
530
+ "tags": [{
531
+ "name": "param",
532
+ "text": "props - Object containing props that will be set to the component."
533
+ }],
534
+ "text": "- Object containing props that will be set to the component."
535
+ }],
536
+ "references": {
537
+ "Promise": {
538
+ "location": "global"
539
+ },
540
+ "GenericObject": {
541
+ "location": "import",
542
+ "path": "../../types/GenericTypes"
543
+ }
544
+ },
545
+ "return": "Promise<void>"
546
+ },
547
+ "docs": {
548
+ "text": "Sets the props to the component.",
549
+ "tags": [{
550
+ "name": "param",
551
+ "text": "props - Object containing props that will be set to the component."
552
+ }]
553
+ }
554
+ }
555
+ }; }
556
+ static get elementRef() { return "rootElement"; }
557
+ static get watchers() { return [{
558
+ "propName": "data",
559
+ "methodName": "dataChanged"
560
+ }]; }
561
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Props of the kup-image-list component.
3
+ * Used to export every prop in an object.
4
+ */
5
+ export var KupImageListProps;
6
+ (function (KupImageListProps) {
7
+ KupImageListProps["customStyle"] = "Custom style of the component.";
8
+ KupImageListProps["data"] = "Actual data of the component";
9
+ KupImageListProps["ripple"] = "When enabled displays Material's ripple effect on clicked items.";
10
+ })(KupImageListProps || (KupImageListProps = {}));