@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
@@ -0,0 +1,1300 @@
1
+ import { r as registerInstance, c as createEvent, f as forceUpdate, h, H as Host, g as getElement } from './index-e41330a5.js';
2
+ import { k as kupManagerInstance, y as identify, g as getProps, s as setProps, t as getColumnByName, j as KupLanguageGeneric, K as KupThemeIconValues, c as KupDebugCategory, N as KupPointerEventTypes, R as KupDragEffect, U as kupDraggableCellAttr, V as KupDropEventTypes, E as KupLanguageSearch, _ as SortMode } from './kup-manager-86f440c7.js';
3
+ import { f as filterRows, p as paginateRows, s as sortRows, d as pageChange, r as rowsPerPageChange, h as FPaginatorMode, b as FPaginator } from './f-paginator-utils-a4a52732.js';
4
+ import { F as FImage } from './f-image-914a03ef.js';
5
+ import { a as FChip } from './f-chip-d6f2eb94.js';
6
+ import { c as componentWrapperId } from './GenericVariables-665de00a.js';
7
+ import { F as FCell } from './f-cell-474dd282.js';
8
+ import { F as FTextFieldMDC } from './f-text-field-mdc-d42d3f9e.js';
9
+ import './f-button-cd948e50.js';
10
+ import './f-button-declarations-b1b4cac4.js';
11
+ import './f-checkbox-e06cf07b.js';
12
+ import './f-text-field-76341fe3.js';
13
+ import './tslib.es6-3eea2234.js';
14
+ import './component-b1bedf1d.js';
15
+
16
+ /**
17
+ * Props of the kup-box component.
18
+ * Used to export every prop in an object.
19
+ */
20
+ var KupBoxProps;
21
+ (function (KupBoxProps) {
22
+ KupBoxProps["cardData"] = "Data of the card linked to the box when the latter's layout must be a premade template.";
23
+ KupBoxProps["columns"] = "Number of columns.";
24
+ KupBoxProps["customStyle"] = "Custom style of the component.";
25
+ KupBoxProps["data"] = "Actual data of the box.";
26
+ KupBoxProps["dragEnabled"] = "Enable dragging.";
27
+ KupBoxProps["dropEnabled"] = "Enable dropping.";
28
+ KupBoxProps["dropOnSection"] = "Drop can be done in section.";
29
+ KupBoxProps["enableRowActions"] = "If enabled, a button to load / display the row actions will be displayed on the right of every box.";
30
+ KupBoxProps["globalFilter"] = "When set to true it activates the global filter.";
31
+ KupBoxProps["globalFilterValue"] = "The value of the global filter.";
32
+ KupBoxProps["kanban"] = "Displays the boxlist as a Kanban.";
33
+ KupBoxProps["layout"] = "How the field will be displayed. If not present, a default one will be created.";
34
+ KupBoxProps["multiSelection"] = "Enable multi selection.";
35
+ KupBoxProps["pageSelected"] = "Current page number.";
36
+ KupBoxProps["pageSize"] = "Number of boxes per page.";
37
+ KupBoxProps["pagination"] = "Enables pagination.";
38
+ KupBoxProps["rowsPerPage"] = "Number of current rows per page.";
39
+ KupBoxProps["scrollOnHover"] = "Activates the scroll on hover function.";
40
+ KupBoxProps["selectBox"] = "Automatically selects the box at the specified index.";
41
+ KupBoxProps["selectedRowsState"] = "Multiple selection.";
42
+ KupBoxProps["showSelection"] = "If enabled, highlights the selected box/boxes.";
43
+ KupBoxProps["sortBy"] = "If sorting is enabled, specifies which column to sort.";
44
+ KupBoxProps["sortEnabled"] = "Enable sorting.";
45
+ KupBoxProps["stateId"] = "";
46
+ KupBoxProps["store"] = "";
47
+ KupBoxProps["swipeDisabled"] = "Disable swipe.";
48
+ })(KupBoxProps || (KupBoxProps = {}));
49
+
50
+ class KupBoxState {
51
+ constructor() {
52
+ this.globalFilterValue = '';
53
+ this.sortBy = '';
54
+ this.selectedRowsState = '';
55
+ this.pageSelected = 1;
56
+ this.rowsPerPage = 0;
57
+ this.load = false;
58
+ }
59
+ /*Add attribute*/
60
+ toDebugString() {
61
+ // TODO
62
+ return 'box state';
63
+ }
64
+ }
65
+
66
+ const kupBoxCss = ":host{--kup_box_background_color:var(\n --kup-box-background-color,\n var(--kup-background-color)\n );--kup_box_color:var(--kup-box-color, var(--kup-text-color));--kup_box_font_family:var(--kup-box-font-family, var(--kup-font-family));--kup_box_font_size:var(--kup-box-font-size, var(--kup-font-size));--kup_box_grid_gap:var(--kup-box-grid-gap, 1em);--kup_box_hover_box_shadow:var(\n --kup-box-hover-box-shadow,\n 0px 0px 7.5px 0px rgba(128, 128, 128, 0.5)\n );--kup_box_primary_color_rgb:var(\n --kup-box-primary-color-rgb,\n var(--kup-primary-color-rgb)\n );--kup_box_transition:var(--kup-box-transition, 0.25s);display:block;font-family:var(--kup_box_font_family);font-size:var(--kup_box_font_size)}.box-component{background:var(--kup_box_background_color);transition:border var(--kup_box_transition) ease}.box-component[kup-drag-over]{position:relative;border:3px dashed var(--kup-border-color)}#box-container{display:grid;grid-gap:var(--kup_box_grid_gap);color:var(--kup_box_color);overflow:auto}#box-container.is-kanban .kanban-section{overflow:auto}#box-container.is-kanban .box-wrapper{padding-top:1em}#box-container.is-kanban .box-wrapper .box{overflow:auto}#box-container *{box-sizing:border-box}#box-container .box-wrapper{display:flex;align-items:center}#box-container .box-wrapper .box{flex-grow:1;cursor:pointer;position:relative;display:flex;transition:background-color var(--kup_box_transition) ease, box-shadow var(--kup_box_transition) ease, border var(--kup_box_transition) ease}#box-container .box-wrapper .box.draggable{touch-action:none;user-select:none}#box-container .box-wrapper .box.column{flex-direction:column}#box-container .box-wrapper .box:hover{box-shadow:var(--kup_box_hover_box_shadow)}#box-container .box-wrapper .box.selected{background-color:rgba(var(--kup_box_primary_color_rgb), 0.175)}#box-container .box-wrapper .box.selected .box-section.titled>h3{background-color:transparent}#box-container .box-wrapper .box[kup-draggable]{opacity:0.5}#box-container .box-wrapper .box[kup-drag-over]{border:3px dashed var(--kup-border-color);position:relative;z-index:2}#box-container .box-wrapper .box .box-section{display:flex;flex-direction:row;flex:1 1 1%;flex-wrap:wrap}#box-container .box-wrapper .box .box-section.column{flex-direction:column;justify-content:center;flex-wrap:unset}#box-container .box-wrapper .box .box-section.column>.box-section{flex:0 0 auto}#box-container .box-wrapper .box .box-section.grid{display:grid}#box-container .box-wrapper .box .box-section .box-object{min-height:16px}#box-container .box-wrapper .box .box-section .box-object img{height:auto}#box-container .box-wrapper .box .box-section.collapse-section .header{border-top:1px solid var(--kup-border-color);color:rgba(var(--kup-text-color-rgb), 0.75);display:flex;justify-content:space-around;width:100%}#box-container .box-wrapper .box .box-section.collapse-section .header .header-content{margin:0.5em;display:flex;align-items:center}#box-container .box-wrapper .box .box-section.collapse-section .header .header-content .f-image{transition:transform 0.15s}#box-container .box-wrapper .box .box-section.collapse-section .header .header-content .f-image.toggled{transform:rotate(-180deg)}#box-container .box-wrapper .box .box-section.collapse-section .header .header-content .kup-icon.kup-dropdown-icon{margin:0;-webkit-mask:var(--kup-dropdown-icon);mask:var(--kup-dropdown-icon)}#box-container .box-wrapper .box .box-section.collapse-section .content{display:none;width:100%}#box-container .box-wrapper .box .box-section.collapse-section.open .content{display:block}#box-container .box-wrapper .box .box-section.titled{border:1px solid var(--kup-border-color);padding-top:5px;position:relative;margin:10px}#box-container .box-wrapper .box .box-section.titled>h3{background:var(--kup-background-color);font-size:calc(var(--kup-font-size) * 1.15);position:absolute;margin:0px;padding:0 8px;top:-11px;left:5px;transition:background-color 0.25s ease}#box-container .box-wrapper .box .box-selection{position:absolute;top:0.5em;right:0.5em;z-index:1}#box-container .box-wrapper .row-actions-wrapper .row-actions-toggler{position:relative;width:24px;height:24px;margin-left:3px}#box-container .box-wrapper .row-actions-wrapper .row-actions-toggler svg{cursor:pointer;opacity:0;fill:var(--kup-text-color);transition:opacity 500ms ease-out}#box-container .box-wrapper .row-actions-wrapper .row-actions-toggler .row-action-menu{background:var(--kup-background-color);border:1px solid var(--kup-border-color);box-shadow:0px 0px 7.5px 0px rgba(128, 128, 128, 0.5);position:absolute;top:0;right:24px;display:none;z-index:10}#box-container .box-wrapper .row-actions-wrapper .row-actions-toggler .row-action-menu ul{list-style-type:none;margin:0;padding:0}#box-container .box-wrapper .row-actions-wrapper .row-actions-toggler .row-action-menu ul>li{cursor:pointer;white-space:nowrap;padding:0 12px;display:flex;align-items:center;line-height:30px}#box-container .box-wrapper .row-actions-wrapper .row-actions-toggler .row-action-menu ul>li:not(:last-child){border-bottom:1px solid var(--kup-border-color)}#box-container .box-wrapper .row-actions-wrapper .row-actions-toggler .row-action-menu.open{display:block}#box-container .box-wrapper:hover .row-actions-wrapper .row-actions-toggler svg{opacity:1}#sort-panel,#global-filter{margin-bottom:1em}:host(.kup-center-aligned) #kup-component .box-section{text-align:center}:host(.kup-center-aligned) #kup-component .box-section .f-cell{justify-content:center;margin:auto;text-align:center}:host(.kup-center-aligned) #kup-component .box-section .f-cell .f-cell__content{justify-content:center;margin:auto;text-align:center}:host(.kup-center-aligned) #kup-component .box-section .f-cell img{margin:auto}:host(.kup-right-aligned) #kup-component .box-section{text-align:right}:host(.kup-right-aligned) #kup-component .box-section .f-cell{justify-content:flex-end;margin-left:auto;margin-right:0;text-align:right}:host(.kup-right-aligned) #kup-component .box-section .f-cell .f-cell__content{justify-content:flex-end;margin-left:auto;margin-right:0;text-align:right}:host(.kup-right-aligned) #kup-component .box-section .f-cell img{margin-left:auto;margin-right:0}:host(.kup-top-aligned) #box-container .box-wrapper .box .box-section .column{justify-content:flex-start}:host(.kup-bottom-aligned) #box-container .box-wrapper .box .box-section .column{justify-content:flex-end}:host(:not(.kup-borderless)) .box{border:1px solid var(--kup-border-color)}:host(.kup-flat-on-hover) #box-container .box-wrapper .box:hover{box-shadow:none}:host(.kup-shaped) .box{border-radius:10px}:host(.kup-round) .box{border-radius:25px}:host(.kup-dashed-sections) .box-section{border:2px dashed var(--kup-text-color)}:host(:not(.kup-paddingless)) #box-container .box{padding:3px}:host(:not(.kup-paddingless)) #box-container .box .box-section .box-object{padding:1px 4px}:host(:not(.kup-paddingless)) #box-container .box .box-section.last-child{margin:3px 4px}:host(.kup-danger){--kup-box-primary-color-rgb:var(--kup-danger-color-rgb)}:host(.kup-info){--kup-box-primary-color-rgb:var(--kup-info-color-rgb)}:host(.kup-secondary){--kup-box-primary-color-rgb:var(--kup-secondary-color-rgb)}:host(.kup-success){--kup-box-primary-color-rgb:var(--kup-success-color-rgb)}:host(.kup-warning){--kup-box-primary-color-rgb:var(--kup-warning-color-rgb)}";
67
+
68
+ const KupBox = class {
69
+ constructor(hostRef) {
70
+ registerInstance(this, hostRef);
71
+ this.kupBoxClick = createEvent(this, "kup-box-click", 6);
72
+ this.kupBoxSelected = createEvent(this, "kup-box-selected", 6);
73
+ this.kupAutoBoxSelect = createEvent(this, "kup-box-autoselect", 6);
74
+ this.kupRowActionMenuClick = createEvent(this, "kup-box-rowactionmenuclick", 6);
75
+ this.kupRowActionClick = createEvent(this, "kup-box-rowactionclick", 6);
76
+ this.kupDidLoad = createEvent(this, "kup-box-didload", 6);
77
+ this.kupDidUnload = createEvent(this, "kup-box-didunload", 6);
78
+ this.kupBoxContextMenu = createEvent(this, "kup-box-contextmenu", 6);
79
+ /*-------------------------------------------------*/
80
+ /* S t a t e s */
81
+ /*-------------------------------------------------*/
82
+ this.collapsedSection = {};
83
+ this.selectedRows = [];
84
+ this.currentPage = 1;
85
+ this.currentRowsPerPage = 10;
86
+ this.state = new KupBoxState();
87
+ /*-------------------------------------------------*/
88
+ /* P r o p s */
89
+ /*-------------------------------------------------*/
90
+ /**
91
+ * Data of the card linked to the box when the latter's layout must be a premade template.
92
+ * @default null
93
+ */
94
+ this.cardData = null;
95
+ /**
96
+ * Number of columns
97
+ * @default 1
98
+ */
99
+ this.columns = 1;
100
+ /**
101
+ * Custom style of the component.
102
+ * @default ""
103
+ * @see https://ketchup.smeup.com/ketchup-showcase/#/customization
104
+ */
105
+ this.customStyle = '';
106
+ /**
107
+ * Actual data of the box.
108
+ * @default null
109
+ */
110
+ this.data = null;
111
+ /**
112
+ * Enable dragging
113
+ * @default false
114
+ */
115
+ this.dragEnabled = false;
116
+ /**
117
+ * Enable dropping
118
+ * @default false
119
+ */
120
+ this.dropEnabled = false;
121
+ /**
122
+ * Drop can be done in section
123
+ * @default false
124
+ */
125
+ this.dropOnSection = false;
126
+ /**
127
+ * When set to true, editable cells will be rendered using input components.
128
+ * @default false
129
+ */
130
+ this.editableData = false;
131
+ /**
132
+ * If enabled, a button to load / display the row actions
133
+ * will be displayed on the right of every box
134
+ * @default false
135
+ */
136
+ this.enableRowActions = false;
137
+ /**
138
+ * When set to true it activates the global filter.
139
+ * @default false
140
+ */
141
+ this.globalFilter = false;
142
+ /**
143
+ * The value of the global filter.
144
+ * @default ""
145
+ */
146
+ this.globalFilterValue = '';
147
+ /**
148
+ * Displays the boxlist as a Kanban.
149
+ * @default null
150
+ */
151
+ this.kanban = null;
152
+ /**
153
+ * Enable multi selection
154
+ * @default false
155
+ */
156
+ this.multiSelection = false;
157
+ /**
158
+ * Current page number
159
+ * @default 1
160
+ */
161
+ this.pageSelected = 1;
162
+ /**
163
+ * Number of boxes per page
164
+ * @default 10
165
+ */
166
+ this.pageSize = 10;
167
+ /**
168
+ * Enables pagination
169
+ * @default false
170
+ */
171
+ this.pagination = false;
172
+ /**
173
+ * Activates the scroll on hover function.
174
+ * @default false
175
+ */
176
+ this.scrollOnHover = false;
177
+ /**
178
+ * If enabled, highlights the selected box/boxes
179
+ * @default true
180
+ */
181
+ this.showSelection = true;
182
+ /**
183
+ * Enable sorting
184
+ * @default false
185
+ */
186
+ this.sortEnabled = false;
187
+ this.stateId = '';
188
+ /**
189
+ * Disable swipe
190
+ * @default false
191
+ */
192
+ this.swipeDisabled = false;
193
+ /*-------------------------------------------------*/
194
+ /* I n t e r n a l V a r i a b l e s */
195
+ /*-------------------------------------------------*/
196
+ /**
197
+ * Instance of the KupManager class.
198
+ */
199
+ this.kupManager = kupManagerInstance();
200
+ this.visibleColumns = [];
201
+ this.rows = [];
202
+ this.filteredRows = [];
203
+ this.sectionRef = null;
204
+ this.rowsRefs = [];
205
+ this.hold = false;
206
+ this.interactableDrag = [];
207
+ this.interactableDrop = [];
208
+ this.interactableTouch = [];
209
+ }
210
+ initWithPersistedState() {
211
+ if (this.store && this.stateId) {
212
+ const state = this.store.getState(this.stateId);
213
+ if (state != null) {
214
+ this.kupManager.debug.logMessage(this, 'Initialize with state for stateId ' +
215
+ this.stateId +
216
+ ': ' +
217
+ state);
218
+ // *** PROPS ***
219
+ this.sortBy = this.state.sortBy;
220
+ this.globalFilterValue = this.state.globalFilterValue;
221
+ this.selectedRowsState = this.state.selectedRowsState;
222
+ this.pageSelected = this.state.pageSelected;
223
+ this.rowsPerPage = this.state.rowsPerPage;
224
+ }
225
+ }
226
+ }
227
+ persistState() {
228
+ if (this.store && this.stateId) {
229
+ let somethingChanged = false;
230
+ if (!this.kupManager.objects.deepEqual(this.state.sortBy, this.sortBy)) {
231
+ this.state.sortBy = this.sortBy;
232
+ somethingChanged = true;
233
+ }
234
+ if (!this.kupManager.objects.deepEqual(this.state.globalFilterValue, this.globalFilterValue)) {
235
+ this.state.globalFilterValue = this.globalFilterValue;
236
+ somethingChanged = true;
237
+ }
238
+ if (!this.kupManager.objects.deepEqual(this.state.pageSelected, this.currentPage)) {
239
+ this.state.pageSelected = this.currentPage;
240
+ somethingChanged = true;
241
+ }
242
+ if (!this.kupManager.objects.deepEqual(this.state.rowsPerPage, this.currentRowsPerPage)) {
243
+ this.state.rowsPerPage = this.currentRowsPerPage;
244
+ somethingChanged = true;
245
+ }
246
+ const selectedRowsState = this.selectedRows.reduce((accumulator, row, currentIndex) => {
247
+ const prefix = currentIndex > 0 ? ';' : '';
248
+ return accumulator + prefix + row.id;
249
+ }, '');
250
+ if (!this.kupManager.objects.deepEqual(this.state.selectedRowsState, selectedRowsState)) {
251
+ this.state.selectedRowsState = selectedRowsState;
252
+ somethingChanged = true;
253
+ }
254
+ if (!this.state.load) {
255
+ this.state.load = true;
256
+ return;
257
+ }
258
+ if (somethingChanged) {
259
+ this.kupManager.debug.logMessage(this, 'Persisting state for stateId ' +
260
+ this.stateId +
261
+ ': ' +
262
+ this.state);
263
+ this.store.persistState(this.stateId, this.state);
264
+ }
265
+ }
266
+ }
267
+ /*-------------------------------------------------*/
268
+ /* W a t c h e r s */
269
+ /*-------------------------------------------------*/
270
+ rowsPerPageHandler(newValue) {
271
+ this.currentRowsPerPage = newValue;
272
+ }
273
+ recalculateRows() {
274
+ this.initRows();
275
+ }
276
+ onDataChanged() {
277
+ identify(this.getRows());
278
+ this.initVisibleColumns();
279
+ this.initRows();
280
+ this.checkLayout();
281
+ }
282
+ onLayoutChanged() {
283
+ this.checkLayout();
284
+ }
285
+ onSelectBoxChanged() {
286
+ this.handleAutomaticBoxSelection();
287
+ }
288
+ /*-------------------------------------------------*/
289
+ /* P u b l i c M e t h o d s */
290
+ /*-------------------------------------------------*/
291
+ /**
292
+ * Used to retrieve component's props values.
293
+ * @param {boolean} descriptions - When provided and true, the result will be the list of props with their description.
294
+ * @returns {Promise<GenericObject>} List of props as object, each key will be a prop.
295
+ */
296
+ async getProps(descriptions) {
297
+ return getProps(this, KupBoxProps, descriptions);
298
+ }
299
+ async loadRowActions(row, actions) {
300
+ row.actions = actions;
301
+ // show menu
302
+ this.rowActionMenuOpened = row;
303
+ }
304
+ /**
305
+ * This method is used to trigger a new render of the component.
306
+ */
307
+ async refresh() {
308
+ forceUpdate(this);
309
+ }
310
+ /**
311
+ * Sets the props to the component.
312
+ * @param {GenericObject} props - Object containing props that will be set to the component.
313
+ */
314
+ async setProps(props) {
315
+ setProps(this, KupBoxProps, props);
316
+ }
317
+ /*-------------------------------------------------*/
318
+ /* P r i v a t e M e t h o d s */
319
+ /*-------------------------------------------------*/
320
+ getColumns() {
321
+ return this.data && this.data.columns
322
+ ? this.data.columns
323
+ : [{ title: '', name: '', size: undefined }];
324
+ }
325
+ initVisibleColumns() {
326
+ this.visibleColumns = this.getColumns().filter((column) => {
327
+ if (column.hasOwnProperty('visible')) {
328
+ return column.visible;
329
+ }
330
+ return true;
331
+ });
332
+ }
333
+ getRows() {
334
+ return this.data && this.data.rows ? this.data.rows : [];
335
+ }
336
+ initRows() {
337
+ this.filteredRows = this.getRows();
338
+ if (this.globalFilter && this.globalFilterValue) {
339
+ // filtering rows
340
+ this.filteredRows = filterRows(this.filteredRows, null, this.globalFilterValue, this.visibleColumns);
341
+ }
342
+ this.rows = this.sortRows(this.filteredRows);
343
+ if (this.pagination) {
344
+ this.rows = paginateRows(this.rows, this.currentPage, this.currentRowsPerPage, false);
345
+ }
346
+ }
347
+ sortRows(rows) {
348
+ let sortedRows = rows;
349
+ if (this.sortBy) {
350
+ // create 'fake' sortObject
351
+ const sortObject = {
352
+ column: this.sortBy,
353
+ sortMode: SortMode.A,
354
+ };
355
+ sortedRows = sortRows(sortedRows, [sortObject]);
356
+ }
357
+ return sortedRows;
358
+ }
359
+ checkScrollOnHover() {
360
+ if (!this.kupManager.scrollOnHover.isRegistered(this.boxContainer)) {
361
+ if (this.scrollOnHover) {
362
+ this.kupManager.scrollOnHover.register(this.boxContainer);
363
+ }
364
+ }
365
+ else {
366
+ if (!this.scrollOnHover) {
367
+ this.kupManager.scrollOnHover.unregister(this.boxContainer);
368
+ }
369
+ }
370
+ }
371
+ checkLayout() {
372
+ // check if there is a layout.
373
+ // if not, create a default layout
374
+ if (this.layout) {
375
+ this.boxLayout = this.layout;
376
+ return;
377
+ }
378
+ // only one section, containing all visible fields
379
+ const section = {
380
+ horizontal: false,
381
+ sections: [],
382
+ };
383
+ // adding box objects to section
384
+ const visibleColumns = this.visibleColumns;
385
+ let size = visibleColumns.length;
386
+ let content = [];
387
+ let cnt = 0;
388
+ while (size-- > 0) {
389
+ content.push({
390
+ column: visibleColumns[cnt++].name,
391
+ });
392
+ }
393
+ section.content = content;
394
+ // creating a new layout
395
+ this.boxLayout = {
396
+ sections: [section],
397
+ };
398
+ }
399
+ onSortChange(e) {
400
+ let column = getColumnByName(this.visibleColumns, e.detail.value);
401
+ this.sortBy = column.name;
402
+ }
403
+ onGlobalFilterChange({ detail }) {
404
+ let value = '';
405
+ if (detail && detail.value) {
406
+ value = detail.value;
407
+ }
408
+ this.globalFilterValue = value;
409
+ }
410
+ isSectionExpanded(row, section) {
411
+ if (!row.id || !section.id) {
412
+ return false;
413
+ }
414
+ return (this.collapsedSection[section.id] &&
415
+ this.collapsedSection[section.id][row.id]);
416
+ }
417
+ handleAutomaticBoxSelection() {
418
+ if (this.selectBox &&
419
+ this.selectBox > 0 &&
420
+ this.selectBox <= this.data.rows.length) {
421
+ this.selectedRows = [];
422
+ for (let boxRow of this.data.rows) {
423
+ if (boxRow.id === (this.selectBox - 1).toString()) {
424
+ this.selectedRows.push(boxRow);
425
+ break;
426
+ }
427
+ }
428
+ this.kupAutoBoxSelect.emit({
429
+ comp: this,
430
+ id: this.rootElement.id,
431
+ row: this.selectedRows[0],
432
+ });
433
+ }
434
+ }
435
+ getEventDetails(el, e) {
436
+ let boxObject = null;
437
+ let cell = null;
438
+ let row = null;
439
+ let column = null;
440
+ if (el) {
441
+ boxObject =
442
+ el.closest('.box-object') || el.querySelector('.box-object');
443
+ }
444
+ if (boxObject) {
445
+ cell = boxObject['data-cell'];
446
+ row = boxObject['data-row'];
447
+ column = getColumnByName(this.visibleColumns, boxObject.dataset.column);
448
+ }
449
+ return {
450
+ boxObject: boxObject ? boxObject : null,
451
+ column: column ? column : null,
452
+ cell: cell ? cell : null,
453
+ originalEvent: e,
454
+ row: row ? row : null,
455
+ };
456
+ }
457
+ contextMenuHandler(e) {
458
+ const details = this.getEventDetails(e.target, e);
459
+ return details;
460
+ }
461
+ /**
462
+ * Checks if the element is the svg that opens the "row actions menu"
463
+ * @param element the element to check
464
+ */
465
+ checkIfElementIsActionMenuIcon(element) {
466
+ if (element.tagName && element.parentElement) {
467
+ return (element.tagName === 'svg' &&
468
+ element.parentElement.classList.contains('row-actions-toggler'));
469
+ }
470
+ return false;
471
+ }
472
+ // event listeners
473
+ onBoxClick({ target }, row) {
474
+ if (!(target instanceof HTMLElement)) {
475
+ return;
476
+ }
477
+ // searching parent
478
+ let element = target;
479
+ let classList = element.classList;
480
+ while (!classList.contains('box-object') &&
481
+ !classList.contains('box-section') &&
482
+ !classList.contains('box')) {
483
+ element = element.parentElement;
484
+ if (element === null) {
485
+ break;
486
+ }
487
+ classList = element.classList;
488
+ }
489
+ // evaluating column
490
+ let column = null;
491
+ if (classList.contains('box-object')) {
492
+ column = element.dataset.column;
493
+ }
494
+ this.kupBoxClick.emit({
495
+ comp: this,
496
+ id: this.rootElement.id,
497
+ row,
498
+ column,
499
+ });
500
+ // selecting box
501
+ if (this.multiSelection) {
502
+ // triggering multi selection
503
+ this.onSelectionCheckChange(row);
504
+ }
505
+ else {
506
+ this.selectedRows = [row];
507
+ }
508
+ }
509
+ onSelectionCheckChange(row) {
510
+ var index = -1;
511
+ for (let i = 0; i < this.selectedRows.length; i++) {
512
+ const select = this.selectedRows[i];
513
+ if (select.id === row.id) {
514
+ index = i;
515
+ break;
516
+ }
517
+ }
518
+ if (index >= 0) {
519
+ // remove row
520
+ this.selectedRows.splice(index, 1);
521
+ this.selectedRows = [...this.selectedRows];
522
+ }
523
+ else {
524
+ // add row
525
+ this.selectedRows = [...this.selectedRows, row];
526
+ }
527
+ this.kupBoxSelected.emit({
528
+ comp: this,
529
+ id: this.rootElement.id,
530
+ rows: this.selectedRows,
531
+ });
532
+ }
533
+ toggleSectionExpand(row, section) {
534
+ // check if section / row has id
535
+ if (!section.id) {
536
+ // error
537
+ console.error('cannot expand / collapse a section withoun an ID');
538
+ return;
539
+ }
540
+ if (!row.id) {
541
+ // error
542
+ console.error('cannot expand / collapse a section of a row without ad id');
543
+ return;
544
+ }
545
+ // check if section already in collapsedSection
546
+ if (!this.collapsedSection[section.id]) {
547
+ // adding element and row, setting it to expanded
548
+ this.collapsedSection[section.id] = {};
549
+ this.collapsedSection[section.id][row.id] = true;
550
+ }
551
+ else {
552
+ const s = this.collapsedSection[section.id];
553
+ if (!s[row.id]) {
554
+ s[row.id] = true;
555
+ }
556
+ else {
557
+ s[row.id] = !s[row.id];
558
+ }
559
+ }
560
+ // triggering rendering
561
+ this.collapsedSection = Object.assign({}, this.collapsedSection);
562
+ }
563
+ onRowAction(row) {
564
+ if (!row) {
565
+ return;
566
+ }
567
+ if (row === this.rowActionMenuOpened) {
568
+ // closing menu
569
+ this.rowActionMenuOpened = null;
570
+ return;
571
+ }
572
+ if (row.actions) {
573
+ // actions already loaded -> show menu
574
+ this.rowActionMenuOpened = row;
575
+ }
576
+ else {
577
+ // no actions -> triggering event
578
+ this.kupRowActionMenuClick.emit({
579
+ comp: this,
580
+ id: this.rootElement.id,
581
+ row,
582
+ });
583
+ }
584
+ }
585
+ onRowActionClick(row, action, index) {
586
+ this.kupRowActionClick.emit({
587
+ comp: this,
588
+ id: this.rootElement.id,
589
+ row,
590
+ action,
591
+ index,
592
+ });
593
+ }
594
+ /**
595
+ * see onDocumentClick in kup-combo
596
+ */
597
+ clickFunction(event) {
598
+ try {
599
+ const targets = event.composedPath();
600
+ for (let target of targets) {
601
+ if (this.checkIfElementIsActionMenuIcon(target)) {
602
+ return;
603
+ }
604
+ }
605
+ }
606
+ catch (err) {
607
+ if (this.checkIfElementIsActionMenuIcon(event.target)) {
608
+ return;
609
+ }
610
+ }
611
+ this.rowActionMenuOpened = null;
612
+ }
613
+ handlePageChange(pageNumber) {
614
+ const newPage = pageChange(pageNumber, this.filteredRows.length, this.currentRowsPerPage);
615
+ if (newPage) {
616
+ this.currentPage = newPage;
617
+ }
618
+ }
619
+ handleRowsPerPageChange(rowsNumber) {
620
+ const newRows = rowsPerPageChange(rowsNumber, this.filteredRows.length);
621
+ if (newRows) {
622
+ this.currentRowsPerPage = newRows;
623
+ this.adjustPaginator();
624
+ }
625
+ }
626
+ adjustPaginator() {
627
+ const numberOfRows = this.rows.length;
628
+ // check if current page is valid
629
+ const numberOfPages = Math.ceil(numberOfRows / this.currentRowsPerPage);
630
+ if (this.currentPage > numberOfPages) {
631
+ // reset page
632
+ this.currentPage = 1;
633
+ }
634
+ }
635
+ // render methods
636
+ renderSectionAsCard(row) {
637
+ let skipPush = false;
638
+ let cardData = {
639
+ button: [],
640
+ image: [],
641
+ progressbar: [],
642
+ text: [],
643
+ };
644
+ //First cycle sets specific binds between cardIDs and cells
645
+ for (var key in row.cells) {
646
+ if (row.cells.hasOwnProperty(key)) {
647
+ var cell = row.cells[key];
648
+ if (cell.cardID !== undefined) {
649
+ switch (cell.obj.p) {
650
+ case 'BTN':
651
+ do {
652
+ cardData.button.push({});
653
+ } while (cardData.button.length < cell.cardID);
654
+ cardData.button[cell.cardID] = {
655
+ label: cell.value,
656
+ };
657
+ break;
658
+ case 'IMG':
659
+ do {
660
+ cardData.image.push({});
661
+ } while (cardData.image.length < cell.cardID);
662
+ cardData.image[cell.cardID] = {
663
+ resource: cell.value,
664
+ };
665
+ break;
666
+ case 'PGB':
667
+ do {
668
+ cardData.progressbar.push({});
669
+ } while (cardData.progressbar.length < cell.cardID);
670
+ cardData.progressbar[cell.cardID] = {
671
+ value: cell.value,
672
+ };
673
+ break;
674
+ default:
675
+ do {
676
+ cardData.text.push('');
677
+ } while (cardData.text.length < cell.cardID);
678
+ cardData.text[cell.cardID] = cell.value;
679
+ break;
680
+ }
681
+ }
682
+ }
683
+ }
684
+ //Second cycle sets leftover binds automatically
685
+ for (var key in row.cells) {
686
+ if (row.cells.hasOwnProperty(key)) {
687
+ var cell = row.cells[key];
688
+ if (cell.cardID === undefined) {
689
+ skipPush = false;
690
+ switch (cell.obj.p) {
691
+ case 'BTN':
692
+ for (let index = 0; index < cardData.button.length; index++) {
693
+ //If there are empty elements, the first one will be used
694
+ if (cardData.button[index] === {}) {
695
+ cardData.button[index] = {
696
+ label: cell.value,
697
+ };
698
+ skipPush = true;
699
+ break;
700
+ }
701
+ }
702
+ //Otherwise a new element will be pushed
703
+ if (!skipPush) {
704
+ cardData.button.push({
705
+ label: cell.value,
706
+ });
707
+ }
708
+ break;
709
+ case 'IMG':
710
+ for (let index = 0; index < cardData.image.length; index++) {
711
+ //If there are empty elements, the first one will be used
712
+ if (cardData.image[index] === {}) {
713
+ cardData.image[index] = {
714
+ resource: cell.value,
715
+ };
716
+ skipPush = true;
717
+ break;
718
+ }
719
+ }
720
+ //Otherwise a new element will be pushed
721
+ if (!skipPush) {
722
+ cardData.image.push({
723
+ resource: cell.value,
724
+ });
725
+ }
726
+ break;
727
+ case 'PGB':
728
+ for (let index = 0; index < cardData.progressbar.length; index++) {
729
+ //If there are empty elements, the first one will be used
730
+ if (cardData.progressbar[index] === {}) {
731
+ cardData.progressbar[index] = {
732
+ value: cell.value,
733
+ };
734
+ skipPush = true;
735
+ break;
736
+ }
737
+ }
738
+ //Otherwise a new element will be pushed
739
+ if (!skipPush) {
740
+ cardData.progressbar.push({
741
+ value: cell.value,
742
+ });
743
+ }
744
+ break;
745
+ default:
746
+ for (let index = 0; index < cardData.text.length; index++) {
747
+ //If there are empty elements, the first one will be used
748
+ if (cardData.text[index] === '') {
749
+ cardData.text[index] = cell.value;
750
+ skipPush = true;
751
+ break;
752
+ }
753
+ }
754
+ //Otherwise a new element will be pushed
755
+ if (!skipPush) {
756
+ cardData.text.push(cell.value);
757
+ }
758
+ break;
759
+ }
760
+ }
761
+ }
762
+ }
763
+ return h("kup-card", Object.assign({ data: cardData }, this.cardData));
764
+ }
765
+ renderRow(row) {
766
+ const visibleColumns = [...this.visibleColumns];
767
+ let boxContent = null;
768
+ // if layout in row, use that one
769
+ let rowLayout = row.layout;
770
+ if (!rowLayout) {
771
+ // otherwise, use 'default' layout
772
+ rowLayout = this.boxLayout;
773
+ }
774
+ let horizontal = false;
775
+ if (rowLayout) {
776
+ if (rowLayout.horizontal) {
777
+ horizontal = true;
778
+ }
779
+ const sections = rowLayout.sections;
780
+ let size = sections.length;
781
+ let cnt = 0;
782
+ if (size > 0) {
783
+ boxContent = [];
784
+ }
785
+ // create fake parent section
786
+ const parent = {
787
+ horizontal: horizontal,
788
+ };
789
+ while (size-- > 0) {
790
+ if (this.cardData !== null &&
791
+ this.cardData !== undefined &&
792
+ typeof this.cardData === 'object') {
793
+ boxContent.push(this.renderSectionAsCard(row));
794
+ }
795
+ else {
796
+ boxContent.push(this.renderSection(sections[cnt++], parent, row, visibleColumns));
797
+ }
798
+ }
799
+ }
800
+ var isSelected = false;
801
+ for (let select of this.selectedRows) {
802
+ if (select.id === row.id) {
803
+ isSelected = true;
804
+ }
805
+ }
806
+ let multiSel = null;
807
+ if (this.multiSelection) {
808
+ multiSel = (h("div", { class: "box-selection" }, h("kup-checkbox", { checked: isSelected })));
809
+ }
810
+ let rowObject = null;
811
+ if (this.enableRowActions && !this.swipeDisabled) {
812
+ const menuClass = {
813
+ 'row-action-menu': true,
814
+ open: row === this.rowActionMenuOpened,
815
+ };
816
+ let rowActionMenuContent = null;
817
+ if (row.actions) {
818
+ const actionItems = row.actions.map((item, index) => {
819
+ const iconClass = `icon ${item.icon}`;
820
+ return (h("li", { tabindex: "0", onClick: () => this.onRowActionClick(row, item, index) }, h("div", { class: iconClass }), h("div", { class: "text" }, item.text)));
821
+ });
822
+ rowActionMenuContent = h("ul", null, actionItems);
823
+ }
824
+ rowObject = (h("div", { class: "row-actions-wrapper" }, h("div", { class: "row-actions-toggler" }, h("svg", { version: "1.1", width: "24", height: "24", viewBox: "0 0 24 24", onClick: () => this.onRowAction(row) }, h("path", { d: "M12,16A2,2 0 0,1 14,18A2,2 0 0,1 12,20A2,2 0 0,1 10,18A2,2 0 0,1 12,16M12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12A2,2 0 0,1 12,10M12,4A2,2 0 0,1 14,6A2,2 0 0,1 12,8A2,2 0 0,1 10,6A2,2 0 0,1 12,4Z" })), h("div", { class: menuClass }, rowActionMenuContent))));
825
+ }
826
+ let badges = null;
827
+ if (row.badgeData && row.badgeData.length > 0) {
828
+ badges = row.badgeData.map((badge) => (h("kup-badge", { text: badge.text, class: badge['className']
829
+ ? `centered ${badge['className']}`
830
+ : 'centered', imageData: badge.imageData })));
831
+ }
832
+ const boxClass = {
833
+ box: true,
834
+ draggable: this.dragEnabled,
835
+ selected: this.showSelection && isSelected,
836
+ column: !horizontal,
837
+ };
838
+ return (h("div", { class: "box-wrapper" }, h("div", { class: boxClass, onClick: (e) => this.onBoxClick(e, row), ref: (el) => this.rowsRefs.push(el) }, multiSel, boxContent, badges), rowObject));
839
+ }
840
+ renderSection(section, parent, row, visibleColumns) {
841
+ let sectionContent = null;
842
+ if (section.sections && section.sections.length > 0) {
843
+ // rendering child
844
+ const sections = section.sections;
845
+ let size = sections.length;
846
+ let cnt = 0;
847
+ if (size > 0) {
848
+ sectionContent = [];
849
+ }
850
+ while (size-- > 0) {
851
+ sectionContent.push(this.renderSection(sections[cnt++], section, row, visibleColumns));
852
+ }
853
+ }
854
+ else if (section.content) {
855
+ // rendering box objects
856
+ const content = section.content;
857
+ let size = content.length;
858
+ let cnt = 0;
859
+ if (size > 0) {
860
+ sectionContent = [];
861
+ }
862
+ while (size-- > 0) {
863
+ sectionContent.push(this.renderBoxObject({
864
+ boxObject: content[cnt++],
865
+ row,
866
+ visibleColumns,
867
+ }, true));
868
+ }
869
+ }
870
+ else if (visibleColumns.length > 0) {
871
+ const column = visibleColumns[0];
872
+ sectionContent = this.renderBoxObject({
873
+ boxObject: { column: column.name },
874
+ row,
875
+ visibleColumns,
876
+ });
877
+ }
878
+ const sectionExpanded = this.isSectionExpanded(row, section);
879
+ const isGrid = !!section.columns;
880
+ const sectionClass = {
881
+ 'box-section': true,
882
+ open: sectionExpanded,
883
+ column: !isGrid && !section.horizontal,
884
+ grid: isGrid,
885
+ titled: !!section.title,
886
+ 'last-child': !section.sections || section.sections.length === 0,
887
+ };
888
+ const sectionStyle = section.style || {};
889
+ if (section.dim && parent) {
890
+ sectionStyle.flex = `0 0 ${section.dim}`;
891
+ if (parent.horizontal) {
892
+ sectionStyle.maxWidth = section.dim;
893
+ }
894
+ else {
895
+ sectionStyle.maxHeight = section.dim;
896
+ }
897
+ }
898
+ if (isGrid) {
899
+ sectionStyle['grid-template-columns'] = `repeat(${section.columns}, 1fr)`;
900
+ }
901
+ let sectionContainer = null;
902
+ if (section.collapsible) {
903
+ sectionClass['collapse-section'] = true;
904
+ const contentClass = {
905
+ content: true,
906
+ };
907
+ // TODO I18N
908
+ let headerTitle = '';
909
+ if (section.title) {
910
+ headerTitle = section.title;
911
+ }
912
+ else if (sectionExpanded) {
913
+ headerTitle = this.kupManager.language.translate(KupLanguageGeneric.COLLAPSE);
914
+ }
915
+ else {
916
+ headerTitle = this.kupManager.language.translate(KupLanguageGeneric.EXPAND);
917
+ }
918
+ sectionContainer = (h("div", { class: sectionClass, style: sectionStyle }, h("div", { class: contentClass }, sectionContent), h("div", { class: "header", role: "button", onClick: (e) => {
919
+ e.stopPropagation();
920
+ this.toggleSectionExpand(row, section);
921
+ } }, h("div", { class: "header-content" }, h("span", null, headerTitle), h(FImage, { resource: `${KupThemeIconValues.DROPDOWN}`, sizeX: "1.25em", sizeY: "1.25em", wrapperClass: sectionExpanded ? 'toggled' : '' })))));
922
+ }
923
+ else {
924
+ const title = section.title ? h("h3", null, section.title) : null;
925
+ sectionContainer = (h("div", { class: sectionClass, style: sectionStyle }, title, sectionContent));
926
+ }
927
+ return sectionContainer;
928
+ }
929
+ renderBoxObject({ boxObject, row, visibleColumns, }, fromSection) {
930
+ const classObj = {
931
+ 'box-object': true,
932
+ };
933
+ const boStyle = {};
934
+ let column = null;
935
+ let index = -1;
936
+ for (let i = 0; i < visibleColumns.length; i++) {
937
+ const c = visibleColumns[i];
938
+ if (c.name === boxObject.column) {
939
+ index = i;
940
+ break;
941
+ }
942
+ }
943
+ if (index >= 0) {
944
+ column = visibleColumns[index];
945
+ visibleColumns.splice(index, 1);
946
+ }
947
+ else if (fromSection) {
948
+ column = this.data.columns.find((x) => x.name === boxObject.column);
949
+ }
950
+ const cell = row.cells[boxObject.column];
951
+ let title = undefined;
952
+ if (cell && !this.kupManager.objects.isEmptyKupObj(cell.obj)) {
953
+ classObj['is-obj'] = true;
954
+ if (this.kupManager.debug.isDebug()) {
955
+ title =
956
+ cell.obj.t + '; ' + cell.obj.p + '; ' + cell.obj.k + ';';
957
+ }
958
+ }
959
+ const cellProps = {
960
+ cell: cell,
961
+ column: column,
962
+ component: this,
963
+ editable: this.editableData,
964
+ renderKup: true,
965
+ row: row,
966
+ setSizes: true,
967
+ shape: boxObject.shape,
968
+ };
969
+ return (h("div", { "data-cell": cell, "data-row": row, "data-column": boxObject.column, class: classObj, style: boStyle, title: title }, cell && column ? (h(FCell, Object.assign({}, cellProps))) : (h("span", null, boxObject.value))));
970
+ }
971
+ /**
972
+ * Prepares the kanban sections by sorting the boxlist's data.
973
+ * @returns {{jsx: VNode[], style: { [index: string]: string }}} jsx contains the virtual nodes of the Kanban sections, style contains the grid CSS settings.
974
+ */
975
+ kanbanMode() {
976
+ // Testing whether there are columns to group by
977
+ if (!this.kanban.columns || this.kanban.columns.length === 0) {
978
+ this.kupManager.debug.logMessage(this, 'No columns to group by detected.', KupDebugCategory.ERROR);
979
+ return {
980
+ jsx: (h("div", { id: "empty-data-message", class: "box-wrapper" }, h("div", { ref: (el) => this.rowsRefs.push(el) }), this.kupManager.language.translate(KupLanguageGeneric.EMPTY_DATA))),
981
+ style: { 'grid-template-columns': `repeat(1, 1fr)` },
982
+ };
983
+ }
984
+ const kanbanSections = [];
985
+ // Creating empty sections from prop-defined labels
986
+ if (this.kanban.labels) {
987
+ for (let index = 0; index < this.kanban.labels.length; index++) {
988
+ const key = this.kanban.labels[index];
989
+ kanbanSections.push({ labels: key, nodes: [] });
990
+ }
991
+ }
992
+ // Browsing all rows
993
+ for (let index = 0; index < this.rows.length; index++) {
994
+ let key = [];
995
+ // Creating the key for the current row
996
+ for (let j = 0; j < this.kanban.columns.length; j++) {
997
+ try {
998
+ key.push(this.rows[index].cells[this.kanban.columns[j]].value);
999
+ }
1000
+ catch (error) {
1001
+ this.kupManager.debug.logMessage(this, error, KupDebugCategory.WARNING);
1002
+ }
1003
+ }
1004
+ const check = {
1005
+ found: false,
1006
+ index: null,
1007
+ };
1008
+ // Browsing key array to search whether the current key exists or not
1009
+ for (let j = 0; j < kanbanSections.length; j++) {
1010
+ let sortingKey = kanbanSections[j].labels;
1011
+ let found = true;
1012
+ for (let i = 0; i < sortingKey.length; i++) {
1013
+ if (key[i] !== sortingKey[i]) {
1014
+ found = false;
1015
+ break;
1016
+ }
1017
+ }
1018
+ if (found) {
1019
+ check.found = true;
1020
+ check.index = j;
1021
+ break;
1022
+ }
1023
+ }
1024
+ // If current key exists, box will be pushed into the existing array of virtual nodes
1025
+ if (check.found) {
1026
+ kanbanSections[check.index].nodes.push(this.renderRow(this.rows[index]));
1027
+ }
1028
+ else {
1029
+ // Otherwise, a new section will be defined starting with just the current virtal node
1030
+ kanbanSections.push({
1031
+ labels: key,
1032
+ nodes: [this.renderRow(this.rows[index])],
1033
+ });
1034
+ }
1035
+ }
1036
+ // Once the arrays are set, they need to be emptied into columns
1037
+ const kanbanJSX = [];
1038
+ for (let index = 0; index < kanbanSections.length; index++) {
1039
+ const sortingKey = kanbanSections[index].labels;
1040
+ const props = {
1041
+ data: [],
1042
+ };
1043
+ for (let index = 0; index < sortingKey.length; index++) {
1044
+ props.data.push({
1045
+ value: sortingKey[index],
1046
+ id: sortingKey[index],
1047
+ });
1048
+ }
1049
+ kanbanJSX.push(h("div", { class: "kanban-section" }, h(FChip, Object.assign({}, props)), kanbanSections[index].nodes));
1050
+ }
1051
+ return {
1052
+ jsx: kanbanJSX,
1053
+ style: {
1054
+ 'grid-template-columns': this.kanban.size
1055
+ ? `repeat(${Object.keys(kanbanSections).length}, ${this.kanban.size})`
1056
+ : `repeat(${Object.keys(kanbanSections).length}, 1fr)`,
1057
+ },
1058
+ };
1059
+ }
1060
+ didLoadInteractables() {
1061
+ this.interactableTouch.push(this.boxContainer);
1062
+ const tapCb = (e) => {
1063
+ if (this.hold) {
1064
+ this.hold = false;
1065
+ return;
1066
+ }
1067
+ switch (e.button) {
1068
+ case 2:
1069
+ this.kupBoxContextMenu.emit({
1070
+ comp: this,
1071
+ id: this.rootElement.id,
1072
+ details: this.contextMenuHandler(e),
1073
+ });
1074
+ break;
1075
+ }
1076
+ };
1077
+ const holdCb = (e) => {
1078
+ if (e.pointerType === 'pen' || e.pointerType === 'touch') {
1079
+ this.hold = true;
1080
+ this.kupBoxContextMenu.emit({
1081
+ comp: this,
1082
+ id: this.rootElement.id,
1083
+ details: this.contextMenuHandler(e),
1084
+ });
1085
+ }
1086
+ };
1087
+ this.kupManager.interact.on(this.boxContainer, KupPointerEventTypes.TAP, tapCb);
1088
+ this.kupManager.interact.on(this.boxContainer, KupPointerEventTypes.HOLD, holdCb);
1089
+ }
1090
+ didRenderInteractables() {
1091
+ if (this.dragEnabled) {
1092
+ for (let index = 0; index < this.rowsRefs.length; index++) {
1093
+ const row = this.rowsRefs[index];
1094
+ const dataCb = () => {
1095
+ const cellEl = this.rootElement.shadowRoot.querySelector('.box-object:hover');
1096
+ return {
1097
+ cell: cellEl['data-cell'],
1098
+ column: getColumnByName(this.visibleColumns, cellEl.dataset.column),
1099
+ id: this.rootElement.id,
1100
+ multiple: this.multiSelection,
1101
+ row: cellEl['data-row'],
1102
+ selectedRows: this.selectedRows,
1103
+ };
1104
+ };
1105
+ if (row && !this.interactableDrag.includes(row)) {
1106
+ this.interactableDrag.push(row);
1107
+ this.kupManager.interact.draggable(row, {
1108
+ allowFrom: '.box-object',
1109
+ cursorChecker() {
1110
+ return null;
1111
+ },
1112
+ }, {
1113
+ callback: dataCb,
1114
+ }, KupDragEffect.BADGE);
1115
+ }
1116
+ }
1117
+ }
1118
+ if (this.dropEnabled) {
1119
+ const dataCb = () => {
1120
+ const receivingDetails = this.getEventDetails(this.rootElement.shadowRoot.querySelector('.box:hover'));
1121
+ return {
1122
+ cell: receivingDetails.cell,
1123
+ column: receivingDetails.column,
1124
+ id: this.rootElement.id,
1125
+ row: receivingDetails.row,
1126
+ };
1127
+ };
1128
+ if (!this.interactableDrop.includes(this.sectionRef)) {
1129
+ this.interactableDrop.push(this.sectionRef);
1130
+ this.kupManager.interact.dropzone(this.sectionRef, {
1131
+ accept: `[${kupDraggableCellAttr}]`,
1132
+ }, {
1133
+ dispatcher: this.rootElement,
1134
+ type: KupDropEventTypes.BOX,
1135
+ });
1136
+ }
1137
+ for (let index = 0; index < this.rowsRefs.length; index++) {
1138
+ const row = this.rowsRefs[index];
1139
+ if (row && !this.interactableDrop.includes(row)) {
1140
+ this.interactableDrop.push(row);
1141
+ this.kupManager.interact.dropzone(row, {
1142
+ accept: `[${kupDraggableCellAttr}]`,
1143
+ }, {
1144
+ callback: dataCb,
1145
+ dispatcher: this.rootElement,
1146
+ type: KupDropEventTypes.BOX,
1147
+ });
1148
+ }
1149
+ }
1150
+ }
1151
+ }
1152
+ /*-------------------------------------------------*/
1153
+ /* L i f e c y c l e H o o k s */
1154
+ /*-------------------------------------------------*/
1155
+ componentWillLoad() {
1156
+ this.kupManager.debug.logLoad(this, false);
1157
+ if (this.rowsPerPage) {
1158
+ this.currentRowsPerPage = this.rowsPerPage;
1159
+ }
1160
+ else if (this.pageSize) {
1161
+ this.currentRowsPerPage = this.pageSize;
1162
+ }
1163
+ if (this.data &&
1164
+ this.data.rows &&
1165
+ this.currentRowsPerPage > this.data.rows.length) {
1166
+ this.currentRowsPerPage = this.data.rows.length;
1167
+ }
1168
+ this.kupManager.language.register(this);
1169
+ this.kupManager.theme.register(this);
1170
+ this.onDataChanged();
1171
+ this.adjustPaginator();
1172
+ }
1173
+ componentDidLoad() {
1174
+ this.handleAutomaticBoxSelection();
1175
+ // When component is created, then the listener is set. @See clickFunction for more details
1176
+ document.addEventListener('click', this.clickFunction.bind(this));
1177
+ this.currentPage = this.pageSelected;
1178
+ if (this.multiSelection && this.selectedRowsState) {
1179
+ this.selectedRows = [];
1180
+ let selectedIds = this.selectedRowsState.split(';');
1181
+ this.selectedRows = this.data.rows.filter((r) => {
1182
+ return selectedIds.indexOf(r.id) >= 0;
1183
+ });
1184
+ }
1185
+ this.didLoadInteractables();
1186
+ this.kupDidLoad.emit({ comp: this, id: this.rootElement.id });
1187
+ this.kupManager.debug.logLoad(this, true);
1188
+ }
1189
+ componentWillRender() {
1190
+ this.kupManager.debug.logRender(this, false);
1191
+ }
1192
+ componentDidRender() {
1193
+ const root = this.rootElement.shadowRoot;
1194
+ if (root) {
1195
+ const fs = root.querySelectorAll('.f-text-field');
1196
+ for (let index = 0; index < fs.length; index++) {
1197
+ FTextFieldMDC(fs[index]);
1198
+ }
1199
+ }
1200
+ this.checkScrollOnHover();
1201
+ this.persistState();
1202
+ this.didRenderInteractables();
1203
+ this.kupManager.debug.logRender(this, true);
1204
+ }
1205
+ render() {
1206
+ const isKanban = !!(typeof this.kanban === 'object' && this.kanban !== null);
1207
+ let sortPanel = null;
1208
+ if (this.sortEnabled) {
1209
+ // creating items
1210
+ const visibleColumnsItems = this.visibleColumns.map((column) => {
1211
+ const item = {
1212
+ value: column.title,
1213
+ id: column.name,
1214
+ selected: column.name === this.sortBy,
1215
+ };
1216
+ return item;
1217
+ });
1218
+ const items = [{ value: '', id: '' }, ...visibleColumnsItems];
1219
+ let textfieldData = {
1220
+ label: this.kupManager.language.translate(KupLanguageGeneric.SORT_BY),
1221
+ trailingIcon: true,
1222
+ };
1223
+ let listData = {
1224
+ data: items,
1225
+ selectable: true,
1226
+ };
1227
+ let data = {
1228
+ 'kup-text-field': textfieldData,
1229
+ 'kup-list': listData,
1230
+ };
1231
+ sortPanel = (h("div", { id: "sort-panel" }, h("kup-combobox", { data: data, initialValue: this.sortBy, "onkup-combobox-itemclick": (e) => this.onSortChange(e) })));
1232
+ }
1233
+ let filterPanel = null;
1234
+ if (this.globalFilter) {
1235
+ filterPanel = (h("div", { id: "global-filter" }, h("kup-text-field", { fullWidth: true, label: this.kupManager.language.translate(KupLanguageSearch.SEARCH), icon: KupThemeIconValues.SEARCH, initialValue: this.globalFilterValue, "onkup-textfield-input": (event) => {
1236
+ window.clearTimeout(this.globalFilterTimeout);
1237
+ this.globalFilterTimeout = window.setTimeout(() => this.onGlobalFilterChange(event), 600);
1238
+ } })));
1239
+ }
1240
+ let paginator = null;
1241
+ if (this.pagination) {
1242
+ paginator = (h(FPaginator, { id: top ? 'top-paginator' : 'bottom-paginator', currentPage: this.currentPage, max: this.filteredRows.length, mode: FPaginatorMode.SIMPLE, perPage: this.currentRowsPerPage
1243
+ ? this.currentRowsPerPage
1244
+ : this.pageSize, onPageChange: (e) => this.handlePageChange(e.detail.value), onRowsChange: (e) => this.handleRowsPerPageChange(e.detail.value) }));
1245
+ }
1246
+ let boxContent = null;
1247
+ let containerStyle = {};
1248
+ if (this.rows.length === 0) {
1249
+ boxContent = (h("div", { id: "empty-data-message", class: "box-wrapper" }, h("div", { class: "box", ref: (el) => this.rowsRefs.push(el) }, this.kupManager.language.translate(KupLanguageGeneric.EMPTY_DATA))));
1250
+ containerStyle = { 'grid-template-columns': `repeat(1, 1fr)` };
1251
+ }
1252
+ else if (isKanban) {
1253
+ const kanban = this.kanbanMode();
1254
+ boxContent = kanban.jsx;
1255
+ containerStyle = kanban.style;
1256
+ }
1257
+ else {
1258
+ containerStyle = {
1259
+ 'grid-template-columns': `repeat(${this.columns}, 1fr)`,
1260
+ };
1261
+ const rows = this.rows;
1262
+ let size = rows.length;
1263
+ let cnt = 0;
1264
+ boxContent = [];
1265
+ while (size-- > 0) {
1266
+ boxContent.push(this.renderRow(rows[cnt++]));
1267
+ }
1268
+ }
1269
+ return (h(Host, null, h("style", null, this.kupManager.theme.setKupStyle(this.rootElement)), h("div", { id: componentWrapperId }, h("div", { class: 'box-component', ref: (el) => (this.sectionRef = el) }, sortPanel, filterPanel, paginator, h("div", { class: isKanban ? 'is-kanban' : '', id: 'box-container', style: containerStyle, onContextMenu: (e) => {
1270
+ e.preventDefault();
1271
+ }, ref: (el) => (this.boxContainer =
1272
+ el) }, boxContent)))));
1273
+ }
1274
+ disconnectedCallback() {
1275
+ this.kupManager.interact.unregister(this.interactableDrag.concat(this.interactableDrop));
1276
+ this.kupManager.language.unregister(this);
1277
+ this.kupManager.theme.unregister(this);
1278
+ if (this.scrollOnHover) {
1279
+ this.kupManager.scrollOnHover.unregister(this.boxContainer);
1280
+ }
1281
+ // When component is destroyed, then the listener is removed. @See clickFunction for more details
1282
+ document.removeEventListener('click', this.clickFunction.bind(this));
1283
+ this.kupDidUnload.emit({ comp: this, id: this.rootElement.id });
1284
+ }
1285
+ get rootElement() { return getElement(this); }
1286
+ static get watchers() { return {
1287
+ "pageSize": ["rowsPerPageHandler", "recalculateRows"],
1288
+ "globalFilterValue": ["recalculateRows"],
1289
+ "sortBy": ["recalculateRows"],
1290
+ "pagination": ["recalculateRows"],
1291
+ "currentPage": ["recalculateRows"],
1292
+ "currentRowsPerPage": ["recalculateRows"],
1293
+ "data": ["onDataChanged"],
1294
+ "layout": ["onLayoutChanged"],
1295
+ "selectBox": ["onSelectBoxChanged"]
1296
+ }; }
1297
+ };
1298
+ KupBox.style = kupBoxCss;
1299
+
1300
+ export { KupBox as kup_box };