@sme.up/ketchup 5.2.1-SNAPSHOT → 6.2.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 (231) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/dist/cjs/{cell-utils-d96b2993.js → cell-utils-d894e802.js} +2 -2
  3. package/dist/cjs/{component-d1496215.js → component-72a5b626.js} +30 -0
  4. package/dist/cjs/{f-button-2b9b99b1.js → f-button-414b3bc3.js} +4 -4
  5. package/dist/cjs/f-cell-c8983ec7.js +418 -0
  6. package/dist/cjs/f-checkbox-57443ca3.js +29 -0
  7. package/dist/cjs/{f-chip-df59e1b0.js → f-chip-ef81bf51.js} +5 -4
  8. package/dist/cjs/{f-image-12bab3b5.js → f-image-0618c795.js} +2 -2
  9. package/dist/cjs/f-paginator-utils-c9dd5173.js +1898 -0
  10. package/dist/cjs/{f-text-field-e7c35b5b.js → f-text-field-7d31190f.js} +3 -3
  11. package/dist/cjs/{f-text-field-mdc-a67f5dfe.js → f-text-field-mdc-85997738.js} +23 -305
  12. package/dist/cjs/{index-eb556444.js → index-06b131ea.js} +6 -4
  13. package/dist/cjs/ketchup.cjs.js +3 -3
  14. package/dist/cjs/kup-accordion.cjs.entry.js +5 -5
  15. package/dist/cjs/{kup-autocomplete_27.cjs.entry.js → kup-autocomplete_25.cjs.entry.js} +1833 -5745
  16. package/dist/cjs/{kup-echart.cjs.entry.js → kup-box_2.cjs.entry.js} +17113 -14788
  17. package/dist/cjs/kup-calendar.cjs.entry.js +42 -34
  18. package/dist/cjs/kup-cell.cjs.entry.js +10 -9
  19. package/dist/cjs/kup-dash-list.cjs.entry.js +4 -4
  20. package/dist/cjs/kup-dash_2.cjs.entry.js +4 -7
  21. package/dist/cjs/kup-dashboard.cjs.entry.js +379 -0
  22. package/dist/cjs/kup-drawer.cjs.entry.js +12 -5
  23. package/dist/cjs/kup-field.cjs.entry.js +2 -2
  24. package/dist/cjs/kup-form.cjs.entry.js +469 -0
  25. package/dist/cjs/kup-iframe.cjs.entry.js +3 -3
  26. package/dist/cjs/kup-image-list.cjs.entry.js +229 -0
  27. package/dist/cjs/kup-lazy.cjs.entry.js +3 -3
  28. package/dist/cjs/kup-magic-box.cjs.entry.js +4 -4
  29. package/dist/cjs/kup-manager-2fee8cf3.js +17021 -0
  30. package/dist/cjs/kup-nav-bar.cjs.entry.js +3 -3
  31. package/dist/cjs/kup-numeric-picker.cjs.entry.js +5 -5
  32. package/dist/cjs/kup-photo-frame.cjs.entry.js +7 -9
  33. package/dist/cjs/kup-probe.cjs.entry.js +2 -2
  34. package/dist/cjs/kup-qlik.cjs.entry.js +2 -2
  35. package/dist/cjs/kup-snackbar.cjs.entry.js +6 -6
  36. package/dist/cjs/loader.cjs.js +3 -3
  37. package/dist/cjs/{utils-e99921c1.js → utils-8470184d.js} +1 -1
  38. package/dist/collection/assets/card.js +4 -5
  39. package/dist/collection/assets/dashboard.js +113 -0
  40. package/dist/collection/assets/data-table.js +15 -79
  41. package/dist/collection/assets/form.js +179 -0
  42. package/dist/collection/assets/grid.js +17 -0
  43. package/dist/collection/assets/image-list.js +624 -0
  44. package/dist/collection/assets/index.js +16 -4
  45. package/dist/collection/assets/kupdata.js +0 -3
  46. package/dist/collection/assets/kuptooltip.js +53 -7
  47. package/dist/collection/assets/tree.js +0 -128
  48. package/dist/collection/collection-manifest.json +8 -6
  49. package/dist/collection/components/kup-autocomplete/kup-autocomplete.js +136 -130
  50. package/dist/collection/components/kup-box/kup-box-declarations.js +0 -4
  51. package/dist/collection/components/kup-box/kup-box.js +20 -137
  52. package/dist/collection/components/kup-card/built-in/kup-card-clock.js +1 -1
  53. package/dist/collection/components/kup-card/built-in/kup-card-column-drop-menu.js +1 -2
  54. package/dist/collection/components/kup-card/kup-card.css +26 -8
  55. package/dist/collection/components/kup-card/kup-card.js +1 -2
  56. package/dist/collection/components/kup-card/standard/kup-card-standard.js +14 -6
  57. package/dist/collection/components/kup-combobox/kup-combobox.js +17 -14
  58. package/dist/collection/components/kup-dashboard/kup-dashboard-declarations.js +10 -0
  59. package/dist/collection/components/kup-dashboard/kup-dashboard.css +81 -0
  60. package/dist/collection/components/kup-dashboard/kup-dashboard.js +560 -0
  61. package/dist/collection/components/kup-data-table/kup-data-table-declarations.js +1 -3
  62. package/dist/collection/components/kup-data-table/kup-data-table.js +19 -136
  63. package/dist/collection/components/kup-drawer/kup-drawer.css +6 -8
  64. package/dist/collection/components/kup-drawer/kup-drawer.js +8 -1
  65. package/dist/collection/components/kup-form/kup-form-declarations.js +19 -0
  66. package/dist/collection/components/kup-form/kup-form.css +86 -0
  67. package/dist/collection/components/kup-form/kup-form.js +668 -0
  68. package/dist/collection/components/kup-grid/kup-grid.js +1 -4
  69. package/dist/collection/components/kup-image-list/kup-image-list-declarations.js +10 -0
  70. package/dist/collection/components/kup-image-list/kup-image-list.css +166 -0
  71. package/dist/collection/components/kup-image-list/kup-image-list.js +432 -0
  72. package/dist/collection/components/kup-list/kup-list-helper.js +9 -3
  73. package/dist/collection/components/kup-photo-frame/kup-photo-frame.css +2 -9
  74. package/dist/collection/components/kup-photo-frame/kup-photo-frame.js +3 -5
  75. package/dist/collection/components/kup-snackbar/kup-snackbar.css +4 -0
  76. package/dist/collection/components/kup-tab-bar/kup-tab-bar.js +18 -19
  77. package/dist/collection/components/kup-text-field/kup-text-field-declarations.js +3 -0
  78. package/dist/collection/components/kup-text-field/kup-text-field.js +27 -0
  79. package/dist/collection/components/kup-time-picker/kup-time-picker.js +2 -8
  80. package/dist/collection/components/kup-tree/kup-tree-declarations.js +0 -4
  81. package/dist/collection/components/kup-tree/kup-tree.css +10 -3
  82. package/dist/collection/components/kup-tree/kup-tree.js +73 -142
  83. package/dist/collection/f-components/f-button/f-button.js +2 -2
  84. package/dist/collection/f-components/f-cell/f-cell-declarations.js +5 -1
  85. package/dist/collection/f-components/f-cell/f-cell.js +41 -121
  86. package/dist/collection/f-components/f-chip/f-chip.js +2 -1
  87. package/dist/collection/f-components/f-text-field/f-text-field.js +1 -1
  88. package/dist/collection/managers/kup-data/kup-data-node-helper.js +24 -0
  89. package/dist/collection/managers/kup-data/kup-data.js +98 -1
  90. package/dist/collection/managers/kup-dynamic-position/kup-dynamic-position.js +4 -2
  91. package/dist/collection/managers/kup-interact/kup-interact.js +1 -22
  92. package/dist/collection/managers/kup-language/kup-language-declarations.js +13 -0
  93. package/dist/collection/managers/kup-manager/kup-manager.js +21 -2
  94. package/dist/collection/managers/kup-objects/kup-objects.js +10 -0
  95. package/dist/collection/managers/kup-theme/kup-theme-declarations.js +21 -1
  96. package/dist/collection/managers/kup-tooltip/kup-tooltip.js +53 -20
  97. package/dist/collection/types/GenericTypes.js +3 -0
  98. package/dist/collection/utils/kup-column-menu/kup-column-menu.js +7 -11
  99. package/dist/esm/{cell-utils-f4bdbbc8.js → cell-utils-7fc84d4e.js} +3 -3
  100. package/dist/esm/{component-c4eb6153.js → component-b1bedf1d.js} +27 -2
  101. package/dist/esm/{f-button-54a49fd8.js → f-button-2f6cc296.js} +4 -4
  102. package/dist/esm/f-cell-4428481c.js +415 -0
  103. package/dist/esm/f-checkbox-c51c4a75.js +27 -0
  104. package/dist/esm/{f-chip-a3035b4b.js → f-chip-b39eb49a.js} +6 -5
  105. package/dist/esm/{f-image-d32465e3.js → f-image-b08ebeb2.js} +2 -2
  106. package/dist/esm/f-paginator-utils-4fda6086.js +1884 -0
  107. package/dist/esm/{f-text-field-c25cc63f.js → f-text-field-184a5fb3.js} +3 -3
  108. package/dist/esm/{f-text-field-mdc-9fbbefc3.js → f-text-field-mdc-d42d3f9e.js} +2 -284
  109. package/dist/esm/{index-baeab1ac.js → index-ad6ab214.js} +6 -4
  110. package/dist/esm/ketchup.js +3 -3
  111. package/dist/esm/kup-accordion.entry.js +6 -6
  112. package/dist/esm/{kup-autocomplete_27.entry.js → kup-autocomplete_25.entry.js} +1775 -5685
  113. package/dist/esm/{kup-echart.entry.js → kup-box_2.entry.js} +17113 -14789
  114. package/dist/esm/kup-calendar.entry.js +43 -35
  115. package/dist/esm/kup-cell.entry.js +9 -8
  116. package/dist/esm/kup-dash-list.entry.js +4 -4
  117. package/dist/esm/kup-dash_2.entry.js +4 -7
  118. package/dist/esm/kup-dashboard.entry.js +375 -0
  119. package/dist/esm/kup-drawer.entry.js +12 -5
  120. package/dist/esm/kup-field.entry.js +2 -2
  121. package/dist/esm/kup-form.entry.js +465 -0
  122. package/dist/esm/kup-iframe.entry.js +3 -3
  123. package/dist/esm/kup-image-list.entry.js +225 -0
  124. package/dist/esm/kup-lazy.entry.js +3 -3
  125. package/dist/esm/kup-magic-box.entry.js +4 -4
  126. package/dist/esm/kup-manager-3325b2d8.js +17000 -0
  127. package/dist/esm/kup-nav-bar.entry.js +3 -3
  128. package/dist/esm/kup-numeric-picker.entry.js +6 -6
  129. package/dist/esm/kup-photo-frame.entry.js +7 -9
  130. package/dist/esm/kup-probe.entry.js +2 -2
  131. package/dist/esm/kup-qlik.entry.js +2 -2
  132. package/dist/esm/kup-snackbar.entry.js +6 -6
  133. package/dist/esm/loader.js +3 -3
  134. package/dist/esm/polyfills/css-shim.js +1 -1
  135. package/dist/esm/{tslib.es6-8f2d44b6.js → tslib.es6-3eea2234.js} +1 -1
  136. package/dist/esm/{utils-f24319a0.js → utils-6373a07e.js} +2 -2
  137. package/dist/ketchup/ketchup.esm.js +1 -1
  138. package/dist/ketchup/p-006bc4d0.entry.js +1 -0
  139. package/dist/ketchup/p-0741da57.js +1 -0
  140. package/dist/ketchup/{p-669bde31.js → p-13e08580.js} +1 -1
  141. package/dist/ketchup/p-153697fb.entry.js +1 -0
  142. package/dist/ketchup/{p-9a61d8dc.entry.js → p-175edb62.entry.js} +1 -1
  143. package/dist/ketchup/{p-11e72a8c.entry.js → p-1db1d42b.entry.js} +1 -1
  144. package/dist/ketchup/{p-67842f1e.entry.js → p-30820f8f.entry.js} +1 -1
  145. package/dist/ketchup/p-35325834.entry.js +9 -0
  146. package/dist/ketchup/p-359e8bec.entry.js +40 -0
  147. package/dist/ketchup/{p-09d708c4.entry.js → p-3c7c92c0.entry.js} +1 -1
  148. package/dist/ketchup/p-41cf8703.entry.js +1 -0
  149. package/dist/ketchup/{p-e6709c26.entry.js → p-6127fccf.entry.js} +1 -1
  150. package/dist/ketchup/{p-203d6295.entry.js → p-6b82e4e2.entry.js} +1 -1
  151. package/dist/ketchup/p-704e60eb.js +30 -0
  152. package/dist/ketchup/{p-4f56932b.js → p-70660fe2.js} +1 -1
  153. package/dist/ketchup/{p-44192f30.entry.js → p-762c0382.entry.js} +1 -1
  154. package/dist/ketchup/{p-c58a2a81.entry.js → p-76947316.entry.js} +1 -1
  155. package/dist/ketchup/{p-a0b1d769.js → p-79b0730b.js} +1 -1
  156. package/dist/ketchup/{p-bb8844bf.entry.js → p-8103b80a.entry.js} +1 -1
  157. package/dist/ketchup/{p-8c44c3b9.js → p-81605f08.js} +4 -5
  158. package/dist/ketchup/p-9fa457d4.entry.js +1 -0
  159. package/dist/ketchup/{p-e8e3c9da.entry.js → p-a0ce8075.entry.js} +1 -1
  160. package/dist/ketchup/p-a203f78b.js +45 -0
  161. package/dist/ketchup/p-a804fe83.entry.js +27 -0
  162. package/dist/ketchup/{p-34748c91.js → p-ca9fd099.js} +1 -1
  163. package/dist/ketchup/p-caabb9ab.entry.js +1 -0
  164. package/dist/ketchup/p-cc3abf84.entry.js +1 -0
  165. package/dist/ketchup/p-cd5cfa7c.js +1 -0
  166. package/dist/ketchup/p-d2e76960.entry.js +1 -0
  167. package/dist/ketchup/p-d3b542b3.js +2 -0
  168. package/dist/ketchup/p-d7004ae4.js +1 -0
  169. package/dist/ketchup/{p-40f97429.js → p-d95c904b.js} +1 -1
  170. package/dist/ketchup/p-ddce3430.js +1 -0
  171. package/dist/ketchup/p-ee580b3a.entry.js +1 -0
  172. package/dist/ketchup/p-f49cb68e.js +1 -0
  173. package/dist/types/components/kup-autocomplete/kup-autocomplete.d.ts +1 -16
  174. package/dist/types/components/kup-box/kup-box-declarations.d.ts +3 -5
  175. package/dist/types/components/kup-box/kup-box.d.ts +0 -22
  176. package/dist/types/components/kup-dashboard/kup-dashboard-declarations.d.ts +61 -0
  177. package/dist/types/components/kup-dashboard/kup-dashboard.d.ts +75 -0
  178. package/dist/types/components/kup-data-table/kup-data-table-declarations.d.ts +2 -4
  179. package/dist/types/components/kup-data-table/kup-data-table.d.ts +1 -19
  180. package/dist/types/components/kup-form/kup-form-declarations.d.ts +48 -0
  181. package/dist/types/components/kup-form/kup-form.d.ts +68 -0
  182. package/dist/types/components/kup-image-list/kup-image-list-declarations.d.ts +14 -0
  183. package/dist/types/components/kup-image-list/kup-image-list.d.ts +56 -0
  184. package/dist/types/components/kup-tab-bar/kup-tab-bar-declarations.d.ts +3 -9
  185. package/dist/types/components/kup-tab-bar/kup-tab-bar.d.ts +6 -6
  186. package/dist/types/components/kup-text-field/kup-text-field-declarations.d.ts +3 -0
  187. package/dist/types/components/kup-text-field/kup-text-field.d.ts +5 -0
  188. package/dist/types/components/kup-time-picker/kup-time-picker.d.ts +0 -6
  189. package/dist/types/components/kup-tree/kup-tree-declarations.d.ts +3 -5
  190. package/dist/types/components/kup-tree/kup-tree.d.ts +1 -24
  191. package/dist/types/components.d.ts +512 -369
  192. package/dist/types/f-components/f-cell/f-cell-declarations.d.ts +4 -1
  193. package/dist/types/f-components/f-text-field/f-text-field-declarations.d.ts +1 -0
  194. package/dist/types/managers/kup-data/kup-data-declarations.d.ts +1 -0
  195. package/dist/types/managers/kup-data/kup-data-node-helper.d.ts +7 -0
  196. package/dist/types/managers/kup-data/kup-data.d.ts +3 -0
  197. package/dist/types/managers/kup-language/kup-language-declarations.d.ts +13 -1
  198. package/dist/types/managers/kup-manager/kup-manager-declarations.d.ts +4 -0
  199. package/dist/types/managers/kup-manager/kup-manager.d.ts +12 -0
  200. package/dist/types/managers/kup-objects/kup-objects.d.ts +6 -0
  201. package/dist/types/managers/kup-tooltip/kup-tooltip-declarations.d.ts +3 -3
  202. package/dist/types/managers/kup-tooltip/kup-tooltip.d.ts +17 -6
  203. package/dist/types/types/GenericTypes.d.ts +3 -0
  204. package/dist/types/utils/kup-column-menu/kup-column-menu.d.ts +1 -3
  205. package/package.json +15 -14
  206. package/dist/cjs/f-cell-8351cb84.js +0 -653
  207. package/dist/cjs/kup-manager-5c03da64.js +0 -8795
  208. package/dist/collection/assets/tooltip.js +0 -73
  209. package/dist/collection/components/kup-tooltip/kup-tooltip-declarations.js +0 -20
  210. package/dist/collection/components/kup-tooltip/kup-tooltip.css +0 -149
  211. package/dist/collection/components/kup-tooltip/kup-tooltip.js +0 -1205
  212. package/dist/collection/utils/helpers.js +0 -38
  213. package/dist/esm/f-cell-d5dac50b.js +0 -650
  214. package/dist/esm/kup-manager-9316a184.js +0 -8778
  215. package/dist/ketchup/p-12773ca8.js +0 -9
  216. package/dist/ketchup/p-34b74425.js +0 -1
  217. package/dist/ketchup/p-4173422f.entry.js +0 -1
  218. package/dist/ketchup/p-41741c28.entry.js +0 -1
  219. package/dist/ketchup/p-44f8da2a.js +0 -1
  220. package/dist/ketchup/p-7a74ad17.js +0 -1
  221. package/dist/ketchup/p-7ba8fa4a.entry.js +0 -39
  222. package/dist/ketchup/p-7de0d7e1.js +0 -1
  223. package/dist/ketchup/p-8418e8fa.entry.js +0 -1
  224. package/dist/ketchup/p-96bf19aa.entry.js +0 -1
  225. package/dist/ketchup/p-b0ddcce9.entry.js +0 -9
  226. package/dist/ketchup/p-b6c21223.entry.js +0 -27
  227. package/dist/ketchup/p-ca3d585b.entry.js +0 -1
  228. package/dist/ketchup/p-ecb7069b.js +0 -135
  229. package/dist/types/components/kup-tooltip/kup-tooltip-declarations.d.ts +0 -93
  230. package/dist/types/components/kup-tooltip/kup-tooltip.d.ts +0 -142
  231. package/dist/types/utils/helpers.d.ts +0 -4
@@ -0,0 +1,668 @@
1
+ import { Component, Element, forceUpdate, h, Host, Method, Prop, Watch, } from '@stencil/core';
2
+ import { KupFormProps, KupFormLabelPlacement, } from './kup-form-declarations';
3
+ import { kupManagerInstance, } from '../../managers/kup-manager/kup-manager';
4
+ import { getProps, identify, setProps } from '../../utils/utils';
5
+ import { KupLanguageGeneric } from '../../managers/kup-language/kup-language-declarations';
6
+ import { componentWrapperId } from '../../variables/GenericVariables';
7
+ import { FCell } from '../../f-components/f-cell/f-cell';
8
+ import { FCellTypes, } from '../../f-components/f-cell/f-cell-declarations';
9
+ import { FTextFieldMDC } from '../../f-components/f-text-field/f-text-field-mdc';
10
+ const dom = document.documentElement;
11
+ export class KupForm {
12
+ constructor() {
13
+ /*-------------------------------------------------*/
14
+ /* P r o p s */
15
+ /*-------------------------------------------------*/
16
+ /**
17
+ * Custom style of the component.
18
+ * @default ""
19
+ * @see https://ketchup.smeup.com/ketchup-showcase/#/customization
20
+ */
21
+ this.customStyle = '';
22
+ /**
23
+ * Actual data of the form.
24
+ * @default null
25
+ */
26
+ this.data = null;
27
+ /**
28
+ * Placement of fields' labels.
29
+ * @default KupFormLabelPlacement.LEFT
30
+ */
31
+ this.labelPlacement = KupFormLabelPlacement.LEFT;
32
+ /**
33
+ * How the form will arrange its content.
34
+ * @default null
35
+ */
36
+ this.layout = null;
37
+ /*-------------------------------------------------*/
38
+ /* I n t e r n a l V a r i a b l e s */
39
+ /*-------------------------------------------------*/
40
+ this.kupManager = kupManagerInstance();
41
+ this.visibleColumns = [];
42
+ }
43
+ /*-------------------------------------------------*/
44
+ /* W a t c h e r s */
45
+ /*-------------------------------------------------*/
46
+ onDataChanged() {
47
+ identify(this.getRows());
48
+ this.initVisibleColumns();
49
+ this.checkLayout();
50
+ }
51
+ onLayoutChanged() {
52
+ this.checkLayout();
53
+ }
54
+ /*-------------------------------------------------*/
55
+ /* P u b l i c M e t h o d s */
56
+ /*-------------------------------------------------*/
57
+ /**
58
+ * Used to retrieve component's props values.
59
+ * @param {boolean} descriptions - When provided and true, the result will be the list of props with their description.
60
+ * @returns {Promise<GenericObject>} List of props as object, each key will be a prop.
61
+ */
62
+ async getProps(descriptions) {
63
+ return getProps(this, KupFormProps, descriptions);
64
+ }
65
+ /**
66
+ * This method is used to trigger a new render of the component.
67
+ */
68
+ async refresh() {
69
+ forceUpdate(this);
70
+ }
71
+ /**
72
+ * Sets the focus on an editable table cell.
73
+ * @param {string} column - Name of the column.
74
+ * @param {string} rowId - Id of the row.
75
+ */
76
+ async setFocus(column, rowId) {
77
+ const cells = this.rootElement.shadowRoot.querySelectorAll('td[data-column="' + column + '"]');
78
+ for (let index = 0; cells && index < cells.length; index++) {
79
+ const cell = cells[index];
80
+ if (cell['data-row'] && cell['data-row'].id == rowId) {
81
+ const input = cell.querySelector('input');
82
+ if (input) {
83
+ input.focus();
84
+ }
85
+ else {
86
+ const kupInput = cell.querySelector('.hydrated');
87
+ if (kupInput) {
88
+ try {
89
+ kupInput.setFocus();
90
+ }
91
+ catch (error) { }
92
+ }
93
+ }
94
+ }
95
+ }
96
+ }
97
+ /**
98
+ * Sets the props to the component.
99
+ * @param {GenericObject} props - Object containing props that will be set to the component.
100
+ */
101
+ async setProps(props) {
102
+ setProps(this, KupFormProps, props);
103
+ }
104
+ /*-------------------------------------------------*/
105
+ /* P r i v a t e M e t h o d s */
106
+ /*-------------------------------------------------*/
107
+ getColumns() {
108
+ return this.data && this.data.columns
109
+ ? this.data.columns
110
+ : [{ title: '', name: '', size: undefined }];
111
+ }
112
+ initVisibleColumns() {
113
+ this.visibleColumns = this.getColumns().filter((column) => {
114
+ if (column.hasOwnProperty('visible')) {
115
+ return column.visible;
116
+ }
117
+ return true;
118
+ });
119
+ }
120
+ getRows() {
121
+ return this.data && this.data.rows ? this.data.rows : [];
122
+ }
123
+ checkLayout() {
124
+ if (this.layout) {
125
+ this.formLayout = this.layout;
126
+ return;
127
+ }
128
+ const section = {
129
+ horizontal: false,
130
+ sections: [],
131
+ };
132
+ const visibleColumns = this.visibleColumns;
133
+ let size = visibleColumns.length;
134
+ const content = [];
135
+ let cnt = 0;
136
+ while (size-- > 0) {
137
+ content.push({
138
+ column: visibleColumns[cnt++].name,
139
+ });
140
+ }
141
+ section.content = content;
142
+ this.formLayout = {
143
+ sections: [section],
144
+ };
145
+ }
146
+ renderRow(row) {
147
+ const visibleColumns = [...this.visibleColumns];
148
+ let formContent = null;
149
+ let rowLayout = row.layout;
150
+ if (!rowLayout) {
151
+ rowLayout = this.formLayout;
152
+ }
153
+ let horizontal = false;
154
+ if (rowLayout) {
155
+ if (rowLayout.horizontal) {
156
+ horizontal = true;
157
+ }
158
+ const sections = rowLayout.sections;
159
+ let size = sections.length;
160
+ let cnt = 0;
161
+ if (size > 0) {
162
+ formContent = [];
163
+ }
164
+ const parent = {
165
+ horizontal: horizontal,
166
+ };
167
+ while (size-- > 0) {
168
+ formContent.push(this.renderSection(sections[cnt++], parent, row, visibleColumns));
169
+ }
170
+ }
171
+ const classObj = {
172
+ form: true,
173
+ 'form--column': !horizontal,
174
+ };
175
+ return h("form", { class: classObj }, formContent);
176
+ }
177
+ renderSection(section, parent, row, visibleColumns) {
178
+ let sectionContent = null;
179
+ if (section.sections && section.sections.length > 0) {
180
+ const sections = section.sections;
181
+ let size = sections.length;
182
+ let cnt = 0;
183
+ if (size > 0) {
184
+ sectionContent = [];
185
+ }
186
+ while (size-- > 0) {
187
+ sectionContent.push(this.renderSection(sections[cnt++], section, row, visibleColumns));
188
+ }
189
+ }
190
+ else if (section.content) {
191
+ const content = section.content;
192
+ let size = content.length;
193
+ let cnt = 0;
194
+ if (size > 0) {
195
+ sectionContent = [];
196
+ }
197
+ while (size-- > 0) {
198
+ const formField = this.renderFormField({
199
+ formField: content[cnt++],
200
+ row,
201
+ visibleColumns,
202
+ }, true);
203
+ let field = formField;
204
+ if (!section.horizontal) {
205
+ field = h("tr", null, formField);
206
+ }
207
+ sectionContent.push(field);
208
+ }
209
+ }
210
+ else if (visibleColumns.length > 0) {
211
+ const column = visibleColumns[0];
212
+ sectionContent = this.renderFormField({
213
+ formField: { column: column.name },
214
+ row,
215
+ visibleColumns,
216
+ });
217
+ }
218
+ const isGrid = !!section.columns;
219
+ const sectionClass = {
220
+ form__section: true,
221
+ 'form__section--column': !isGrid && !section.horizontal,
222
+ 'form__section--grid': isGrid,
223
+ 'form__section--titled': !!section.title,
224
+ 'form__section--last': !section.sections || section.sections.length === 0,
225
+ };
226
+ const sectionStyle = section.style || {};
227
+ if (section.dim && parent) {
228
+ sectionStyle.flex = `0 0 ${section.dim}`;
229
+ if (parent.horizontal) {
230
+ sectionStyle.maxWidth = section.dim;
231
+ }
232
+ else {
233
+ sectionStyle.maxHeight = section.dim;
234
+ }
235
+ }
236
+ if (isGrid) {
237
+ sectionStyle['grid-template-columns'] = `repeat(${section.columns}, 1fr)`;
238
+ }
239
+ return (h("div", { class: sectionClass, style: sectionStyle },
240
+ section.title ? h("h3", null, section.title) : null,
241
+ h("table", null,
242
+ h("tbody", null, section.horizontal ? (h("tr", null, sectionContent)) : (sectionContent)))));
243
+ }
244
+ renderFormField({ formField, row, visibleColumns, }, fromSection) {
245
+ const classObj = {
246
+ form__field: true,
247
+ };
248
+ const styleObj = {};
249
+ let column = null;
250
+ let index = -1;
251
+ for (let i = 0; i < visibleColumns.length; i++) {
252
+ const c = visibleColumns[i];
253
+ if (c.name === formField.column) {
254
+ index = i;
255
+ break;
256
+ }
257
+ }
258
+ if (index >= 0) {
259
+ column = visibleColumns[index];
260
+ visibleColumns.splice(index, 1);
261
+ }
262
+ else if (fromSection) {
263
+ column = this.data.columns.find((x) => x.name === formField.column);
264
+ }
265
+ const cell = row.cells[formField.column];
266
+ let title = undefined;
267
+ if (cell) {
268
+ cell.isEditable = true;
269
+ if (!this.kupManager.objects.isEmptyKupObj(cell.obj)) {
270
+ if (this.kupManager.debug.isDebug()) {
271
+ title =
272
+ cell.obj.t +
273
+ '; ' +
274
+ cell.obj.p +
275
+ '; ' +
276
+ cell.obj.k +
277
+ ';';
278
+ }
279
+ }
280
+ }
281
+ else {
282
+ return null;
283
+ }
284
+ const cellProps = {
285
+ cell: cell,
286
+ column: column,
287
+ component: this,
288
+ editable: true,
289
+ renderKup: true,
290
+ row: row,
291
+ setSizes: true,
292
+ shape: formField.shape,
293
+ };
294
+ resetLabel();
295
+ switch (this.labelPlacement) {
296
+ case KupFormLabelPlacement.BOTTOM:
297
+ return [h("tr", null, fieldCell()), h("tr", null, labelCell())];
298
+ case KupFormLabelPlacement.PLACEHOLDER:
299
+ setPlaceholderLabel();
300
+ case KupFormLabelPlacement.HIDDEN: {
301
+ if (fromSection) {
302
+ return [fieldCell()];
303
+ }
304
+ else {
305
+ return [h("tr", null, fieldCell())];
306
+ }
307
+ }
308
+ case KupFormLabelPlacement.RIGHT: {
309
+ if (fromSection) {
310
+ return [fieldCell(), labelCell()];
311
+ }
312
+ else {
313
+ return [
314
+ h("tr", null,
315
+ fieldCell(),
316
+ labelCell()),
317
+ ];
318
+ }
319
+ }
320
+ case KupFormLabelPlacement.TOP:
321
+ return [h("tr", null, labelCell()), h("tr", null, fieldCell())];
322
+ default: {
323
+ if (fromSection) {
324
+ return [labelCell(), fieldCell()];
325
+ }
326
+ else {
327
+ return [
328
+ h("tr", null,
329
+ labelCell(),
330
+ fieldCell()),
331
+ ];
332
+ }
333
+ }
334
+ }
335
+ function fieldCell() {
336
+ return (h("td", { "data-cell": cell, "data-row": row, "data-column": formField.column, class: classObj, style: styleObj, title: title }, cell && column ? (h(FCell, Object.assign({}, cellProps))) : (h("span", null, formField.value))));
337
+ }
338
+ function labelCell() {
339
+ return (h("td", { class: "form__label" },
340
+ h("span", null, column.title)));
341
+ }
342
+ function resetLabel() {
343
+ if (!cell.data) {
344
+ cell.data = {};
345
+ }
346
+ try {
347
+ delete cell.data.label;
348
+ }
349
+ catch (_a) { }
350
+ try {
351
+ delete cell.data.data['kup-text-field'].label;
352
+ }
353
+ catch (_b) { }
354
+ }
355
+ function setPlaceholderLabel() {
356
+ switch (dom.ketchup.data.cell.getType(cell, cell.shape || column.shape || null)) {
357
+ case FCellTypes.AUTOCOMPLETE:
358
+ case FCellTypes.COLOR_PICKER:
359
+ case FCellTypes.COMBOBOX:
360
+ case FCellTypes.DATE:
361
+ case FCellTypes.DATETIME:
362
+ case FCellTypes.TIME:
363
+ if (cell.data.data) {
364
+ if (cell.data.data['kup-text-field']) {
365
+ cell.data.data['kup-text-field'].label =
366
+ column.title;
367
+ }
368
+ else {
369
+ cell.data.data = {
370
+ 'kup-text-field': {
371
+ label: column.title,
372
+ },
373
+ };
374
+ }
375
+ }
376
+ else {
377
+ cell.data.data = {
378
+ 'kup-text-field': {
379
+ label: column.title,
380
+ },
381
+ };
382
+ }
383
+ break;
384
+ case FCellTypes.CHECKBOX:
385
+ case FCellTypes.NUMBER:
386
+ case FCellTypes.STRING:
387
+ case FCellTypes.SWITCH:
388
+ cell.data.label = column.title;
389
+ }
390
+ }
391
+ }
392
+ /*-------------------------------------------------*/
393
+ /* L i f e c y c l e H o o k s */
394
+ /*-------------------------------------------------*/
395
+ componentWillLoad() {
396
+ this.kupManager.debug.logLoad(this, false);
397
+ this.kupManager.language.register(this);
398
+ this.kupManager.theme.register(this);
399
+ this.onDataChanged();
400
+ }
401
+ componentDidLoad() {
402
+ this.kupManager.debug.logLoad(this, true);
403
+ }
404
+ componentWillRender() {
405
+ this.kupManager.debug.logRender(this, false);
406
+ }
407
+ componentDidRender() {
408
+ const root = this.rootElement.shadowRoot;
409
+ if (root) {
410
+ const fs = root.querySelectorAll('.f-text-field');
411
+ for (let index = 0; index < fs.length; index++) {
412
+ FTextFieldMDC(fs[index]);
413
+ }
414
+ }
415
+ this.kupManager.debug.logRender(this, true);
416
+ }
417
+ render() {
418
+ let formContent = null;
419
+ if (this.data.rows.length === 0) {
420
+ formContent = (h("p", null, this.kupManager.language.translate(KupLanguageGeneric.EMPTY_DATA)));
421
+ }
422
+ else {
423
+ const rows = this.data.rows;
424
+ let size = rows.length;
425
+ let cnt = 0;
426
+ formContent = [];
427
+ while (size-- > 0) {
428
+ formContent.push(this.renderRow(rows[cnt++]));
429
+ }
430
+ }
431
+ return (h(Host, null,
432
+ h("style", null, this.kupManager.theme.setKupStyle(this.rootElement)),
433
+ h("div", { id: componentWrapperId }, formContent)));
434
+ }
435
+ disconnectedCallback() {
436
+ this.kupManager.language.unregister(this);
437
+ this.kupManager.theme.unregister(this);
438
+ }
439
+ static get is() { return "kup-form"; }
440
+ static get encapsulation() { return "shadow"; }
441
+ static get originalStyleUrls() { return {
442
+ "$": ["kup-form.scss"]
443
+ }; }
444
+ static get styleUrls() { return {
445
+ "$": ["kup-form.css"]
446
+ }; }
447
+ static get properties() { return {
448
+ "customStyle": {
449
+ "type": "string",
450
+ "mutable": false,
451
+ "complexType": {
452
+ "original": "string",
453
+ "resolved": "string",
454
+ "references": {}
455
+ },
456
+ "required": false,
457
+ "optional": false,
458
+ "docs": {
459
+ "tags": [{
460
+ "name": "default",
461
+ "text": "\"\""
462
+ }, {
463
+ "name": "see",
464
+ "text": "https://ketchup.smeup.com/ketchup-showcase/#/customization"
465
+ }],
466
+ "text": "Custom style of the component."
467
+ },
468
+ "attribute": "custom-style",
469
+ "reflect": false,
470
+ "defaultValue": "''"
471
+ },
472
+ "data": {
473
+ "type": "unknown",
474
+ "mutable": false,
475
+ "complexType": {
476
+ "original": "KupFormData",
477
+ "resolved": "KupFormData",
478
+ "references": {
479
+ "KupFormData": {
480
+ "location": "import",
481
+ "path": "./kup-form-declarations"
482
+ }
483
+ }
484
+ },
485
+ "required": false,
486
+ "optional": false,
487
+ "docs": {
488
+ "tags": [{
489
+ "name": "default",
490
+ "text": "null"
491
+ }],
492
+ "text": "Actual data of the form."
493
+ },
494
+ "defaultValue": "null"
495
+ },
496
+ "labelPlacement": {
497
+ "type": "string",
498
+ "mutable": false,
499
+ "complexType": {
500
+ "original": "KupFormLabelPlacement",
501
+ "resolved": "KupFormLabelPlacement.BOTTOM | KupFormLabelPlacement.HIDDEN | KupFormLabelPlacement.LEFT | KupFormLabelPlacement.PLACEHOLDER | KupFormLabelPlacement.RIGHT | KupFormLabelPlacement.TOP",
502
+ "references": {
503
+ "KupFormLabelPlacement": {
504
+ "location": "import",
505
+ "path": "./kup-form-declarations"
506
+ }
507
+ }
508
+ },
509
+ "required": false,
510
+ "optional": false,
511
+ "docs": {
512
+ "tags": [{
513
+ "name": "default",
514
+ "text": "KupFormLabelPlacement.LEFT"
515
+ }],
516
+ "text": "Placement of fields' labels."
517
+ },
518
+ "attribute": "label-placement",
519
+ "reflect": true,
520
+ "defaultValue": "KupFormLabelPlacement.LEFT"
521
+ },
522
+ "layout": {
523
+ "type": "unknown",
524
+ "mutable": false,
525
+ "complexType": {
526
+ "original": "KupFormLayout",
527
+ "resolved": "KupFormLayout",
528
+ "references": {
529
+ "KupFormLayout": {
530
+ "location": "import",
531
+ "path": "./kup-form-declarations"
532
+ }
533
+ }
534
+ },
535
+ "required": false,
536
+ "optional": false,
537
+ "docs": {
538
+ "tags": [{
539
+ "name": "default",
540
+ "text": "null"
541
+ }],
542
+ "text": "How the form will arrange its content."
543
+ },
544
+ "defaultValue": "null"
545
+ }
546
+ }; }
547
+ static get methods() { return {
548
+ "getProps": {
549
+ "complexType": {
550
+ "signature": "(descriptions?: boolean) => Promise<GenericObject>",
551
+ "parameters": [{
552
+ "tags": [{
553
+ "name": "param",
554
+ "text": "descriptions - When provided and true, the result will be the list of props with their description."
555
+ }],
556
+ "text": "- When provided and true, the result will be the list of props with their description."
557
+ }],
558
+ "references": {
559
+ "Promise": {
560
+ "location": "global"
561
+ },
562
+ "GenericObject": {
563
+ "location": "import",
564
+ "path": "../../types/GenericTypes"
565
+ }
566
+ },
567
+ "return": "Promise<GenericObject>"
568
+ },
569
+ "docs": {
570
+ "text": "Used to retrieve component's props values.",
571
+ "tags": [{
572
+ "name": "param",
573
+ "text": "descriptions - When provided and true, the result will be the list of props with their description."
574
+ }, {
575
+ "name": "returns",
576
+ "text": "List of props as object, each key will be a prop."
577
+ }]
578
+ }
579
+ },
580
+ "refresh": {
581
+ "complexType": {
582
+ "signature": "() => Promise<void>",
583
+ "parameters": [],
584
+ "references": {
585
+ "Promise": {
586
+ "location": "global"
587
+ }
588
+ },
589
+ "return": "Promise<void>"
590
+ },
591
+ "docs": {
592
+ "text": "This method is used to trigger a new render of the component.",
593
+ "tags": []
594
+ }
595
+ },
596
+ "setFocus": {
597
+ "complexType": {
598
+ "signature": "(column: string, rowId: string) => Promise<void>",
599
+ "parameters": [{
600
+ "tags": [{
601
+ "name": "param",
602
+ "text": "column - Name of the column."
603
+ }],
604
+ "text": "- Name of the column."
605
+ }, {
606
+ "tags": [{
607
+ "name": "param",
608
+ "text": "rowId - Id of the row."
609
+ }],
610
+ "text": "- Id of the row."
611
+ }],
612
+ "references": {
613
+ "Promise": {
614
+ "location": "global"
615
+ }
616
+ },
617
+ "return": "Promise<void>"
618
+ },
619
+ "docs": {
620
+ "text": "Sets the focus on an editable table cell.",
621
+ "tags": [{
622
+ "name": "param",
623
+ "text": "column - Name of the column."
624
+ }, {
625
+ "name": "param",
626
+ "text": "rowId - Id of the row."
627
+ }]
628
+ }
629
+ },
630
+ "setProps": {
631
+ "complexType": {
632
+ "signature": "(props: GenericObject) => Promise<void>",
633
+ "parameters": [{
634
+ "tags": [{
635
+ "name": "param",
636
+ "text": "props - Object containing props that will be set to the component."
637
+ }],
638
+ "text": "- Object containing props that will be set to the component."
639
+ }],
640
+ "references": {
641
+ "Promise": {
642
+ "location": "global"
643
+ },
644
+ "GenericObject": {
645
+ "location": "import",
646
+ "path": "../../types/GenericTypes"
647
+ }
648
+ },
649
+ "return": "Promise<void>"
650
+ },
651
+ "docs": {
652
+ "text": "Sets the props to the component.",
653
+ "tags": [{
654
+ "name": "param",
655
+ "text": "props - Object containing props that will be set to the component."
656
+ }]
657
+ }
658
+ }
659
+ }; }
660
+ static get elementRef() { return "rootElement"; }
661
+ static get watchers() { return [{
662
+ "propName": "data",
663
+ "methodName": "onDataChanged"
664
+ }, {
665
+ "propName": "layout",
666
+ "methodName": "onLayoutChanged"
667
+ }]; }
668
+ }
@@ -86,10 +86,7 @@ export class KupGrid {
86
86
  el = h("slot", { name: `${i}` });
87
87
  }
88
88
  else {
89
- let span = 1;
90
- if (slots[i]['span']) {
91
- span = slots[i]['span'];
92
- }
89
+ const span = slots[i]['span'] || slots[i].getAttribute('span') || 1;
93
90
  el = (h("div", { class: `layout-grid__cell layout-grid__cell--span-${span}` },
94
91
  h("slot", { name: `${i}` })));
95
92
  }
@@ -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 = {}));