@sme.up/ketchup 8.0.2 → 8.1.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 (552) hide show
  1. package/dist/cjs/{GenericVariables-a9ed17ee.js → GenericVariables-9cd88034.js} +3 -3
  2. package/dist/cjs/{component-85c2bd4d.js → component-2c7ddef7.js} +91 -10
  3. package/dist/cjs/{f-button-9524bbf7.js → f-button-a5f661f2.js} +99 -99
  4. package/dist/cjs/{f-button-declarations-b611587f.js → f-button-declarations-76b4fb4c.js} +16 -16
  5. package/dist/cjs/{f-cell-bcb75ade.js → f-cell-ca9e4352.js} +472 -472
  6. package/dist/cjs/{f-checkbox-1148e791.js → f-checkbox-e2c6ecef.js} +23 -23
  7. package/dist/cjs/{f-chip-2249b386.js → f-chip-e941fa19.js} +125 -125
  8. package/dist/cjs/{f-image-47d74999.js → f-image-466b724f.js} +107 -107
  9. package/dist/cjs/{f-paginator-utils-b0a9ae5f.js → f-paginator-utils-f775ce67.js} +1548 -1548
  10. package/dist/cjs/{f-text-field-579c0fc0.js → f-text-field-ddb47dda.js} +172 -172
  11. package/dist/cjs/{f-text-field-mdc-0e22f3e3.js → f-text-field-mdc-d38d80b5.js} +59 -60
  12. package/dist/cjs/{index-1f177abc.js → index-26fb8571.js} +78 -24
  13. package/dist/cjs/ketchup.cjs.js +3 -3
  14. package/dist/cjs/kup-accordion.cjs.entry.js +199 -200
  15. package/dist/cjs/kup-autocomplete_27.cjs.entry.js +17546 -17508
  16. package/dist/cjs/kup-box.cjs.entry.js +1294 -1232
  17. package/dist/cjs/kup-calendar.cjs.entry.js +9542 -10035
  18. package/dist/cjs/kup-cell.cjs.entry.js +172 -172
  19. package/dist/cjs/kup-dash-list.cjs.entry.js +106 -106
  20. package/dist/cjs/kup-dash_2.cjs.entry.js +162 -162
  21. package/dist/cjs/kup-dashboard.cjs.entry.js +400 -401
  22. package/dist/cjs/kup-drawer.cjs.entry.js +138 -138
  23. package/dist/cjs/kup-echart.cjs.entry.js +7145 -6598
  24. package/dist/cjs/kup-family-tree.cjs.entry.js +439 -439
  25. package/dist/cjs/kup-iframe.cjs.entry.js +94 -94
  26. package/dist/cjs/kup-image-list.cjs.entry.js +255 -256
  27. package/dist/cjs/kup-lazy.cjs.entry.js +186 -186
  28. package/dist/cjs/kup-magic-box.cjs.entry.js +298 -298
  29. package/dist/cjs/{kup-manager-85b2a756.js → kup-manager-16b684bd.js} +7286 -7287
  30. package/dist/cjs/kup-nav-bar.cjs.entry.js +130 -130
  31. package/dist/cjs/kup-numeric-picker.cjs.entry.js +367 -368
  32. package/dist/cjs/kup-photo-frame.cjs.entry.js +144 -144
  33. package/dist/cjs/kup-planner.cjs.entry.js +1151 -1009
  34. package/dist/cjs/kup-probe.cjs.entry.js +246 -246
  35. package/dist/cjs/kup-qlik.cjs.entry.js +138 -138
  36. package/dist/cjs/kup-snackbar.cjs.entry.js +116 -116
  37. package/dist/cjs/loader.cjs.js +3 -3
  38. package/dist/collection/assets/dash-list.js +466 -293
  39. package/dist/collection/assets/index.js +4 -0
  40. package/dist/collection/assets/planner.js +8189 -0
  41. package/dist/collection/collection-manifest.json +2 -2
  42. package/dist/collection/components/kup-accordion/kup-accordion-declarations.js +10 -10
  43. package/dist/collection/components/kup-accordion/kup-accordion.js +445 -445
  44. package/dist/collection/components/kup-autocomplete/kup-autocomplete-declarations.js +27 -27
  45. package/dist/collection/components/kup-autocomplete/kup-autocomplete.js +908 -908
  46. package/dist/collection/components/kup-badge/kup-badge-declarations.js +10 -10
  47. package/dist/collection/components/kup-badge/kup-badge.js +276 -276
  48. package/dist/collection/components/kup-box/kup-box-declarations.js +34 -33
  49. package/dist/collection/components/kup-box/kup-box-state.js +15 -15
  50. package/dist/collection/components/kup-box/kup-box.js +2159 -2079
  51. package/dist/collection/components/kup-button/kup-button-declarations.js +18 -18
  52. package/dist/collection/components/kup-button/kup-button.js +580 -580
  53. package/dist/collection/components/kup-button-list/kup-button-list-declarations.js +13 -13
  54. package/dist/collection/components/kup-button-list/kup-button-list.e2e.js +144 -0
  55. package/dist/collection/components/kup-button-list/kup-button-list.js +527 -527
  56. package/dist/collection/components/kup-calendar/kup-calendar-declarations.js +35 -35
  57. package/dist/collection/components/kup-calendar/kup-calendar.css +0 -4
  58. package/dist/collection/components/kup-calendar/kup-calendar.js +690 -690
  59. package/dist/collection/components/kup-card/box/kup-card-box.js +227 -227
  60. package/dist/collection/components/kup-card/built-in/kup-card-built-in.js +56 -56
  61. package/dist/collection/components/kup-card/built-in/kup-card-calendar.js +393 -393
  62. package/dist/collection/components/kup-card/built-in/kup-card-clock.js +308 -308
  63. package/dist/collection/components/kup-card/built-in/kup-card-column-drop-menu.js +165 -165
  64. package/dist/collection/components/kup-card/built-in/kup-card-message-box.js +10 -10
  65. package/dist/collection/components/kup-card/built-in/kup-card-numeric.js +118 -118
  66. package/dist/collection/components/kup-card/collapsible/kup-card-collapsible.js +64 -64
  67. package/dist/collection/components/kup-card/dialog/kup-card-dialog.js +217 -217
  68. package/dist/collection/components/kup-card/free/kup-card-free.js +22 -22
  69. package/dist/collection/components/kup-card/kup-card-declarations.js +98 -98
  70. package/dist/collection/components/kup-card/kup-card-helper.js +196 -196
  71. package/dist/collection/components/kup-card/kup-card.js +809 -809
  72. package/dist/collection/components/kup-card/scalable/kup-card-scalable.js +251 -251
  73. package/dist/collection/components/kup-card/standard/kup-card-standard.js +593 -593
  74. package/dist/collection/components/kup-cell/kup-cell-declarations.js +11 -11
  75. package/dist/collection/components/kup-cell/kup-cell.js +401 -401
  76. package/dist/collection/components/kup-chart/kup-chart-builder.js +93 -93
  77. package/dist/collection/components/kup-chart/kup-chart-declarations.js +49 -49
  78. package/dist/collection/components/kup-chart/kup-chart.js +1080 -1080
  79. package/dist/collection/components/kup-checkbox/kup-checkbox-declarations.js +13 -13
  80. package/dist/collection/components/kup-checkbox/kup-checkbox.js +433 -433
  81. package/dist/collection/components/kup-chip/kup-chip-declarations.js +12 -12
  82. package/dist/collection/components/kup-chip/kup-chip.js +558 -558
  83. package/dist/collection/components/kup-color-picker/kup-color-picker-declarations.js +12 -12
  84. package/dist/collection/components/kup-color-picker/kup-color-picker.js +546 -546
  85. package/dist/collection/components/kup-combobox/kup-combobox-declarations.js +15 -15
  86. package/dist/collection/components/kup-combobox/kup-combobox.js +821 -821
  87. package/dist/collection/components/kup-dash/kup-dash.js +171 -171
  88. package/dist/collection/components/kup-dash-list/kup-dash-list.js +327 -327
  89. package/dist/collection/components/kup-dashboard/kup-dashboard-declarations.js +10 -10
  90. package/dist/collection/components/kup-dashboard/kup-dashboard.js +588 -588
  91. package/dist/collection/components/kup-data-table/kup-data-table-declarations.js +156 -156
  92. package/dist/collection/components/kup-data-table/kup-data-table-helper.js +808 -808
  93. package/dist/collection/components/kup-data-table/kup-data-table-state.js +36 -36
  94. package/dist/collection/components/kup-data-table/kup-data-table.js +5527 -5527
  95. package/dist/collection/components/kup-date-picker/kup-date-picker-declarations.js +18 -18
  96. package/dist/collection/components/kup-date-picker/kup-date-picker.js +816 -816
  97. package/dist/collection/components/kup-dialog/kup-dialog-declarations.js +14 -14
  98. package/dist/collection/components/kup-dialog/kup-dialog.js +467 -467
  99. package/dist/collection/components/kup-drawer/kup-drawer-declarations.js +10 -10
  100. package/dist/collection/components/kup-drawer/kup-drawer.e2e.js +9 -0
  101. package/dist/collection/components/kup-drawer/kup-drawer.js +383 -383
  102. package/dist/collection/components/kup-dropdown-button/kup-dropdown-button-declarations.js +18 -18
  103. package/dist/collection/components/kup-dropdown-button/kup-dropdown-button.js +800 -800
  104. package/dist/collection/components/kup-echart/kup-echart-declarations.js +52 -52
  105. package/dist/collection/components/kup-echart/kup-echart.js +1437 -1437
  106. package/dist/collection/components/kup-family-tree/kup-family-tree-declarations.js +15 -15
  107. package/dist/collection/components/kup-family-tree/kup-family-tree.js +829 -829
  108. package/dist/collection/components/kup-form/kup-form-declarations.js +29 -29
  109. package/dist/collection/components/kup-form/kup-form.js +731 -731
  110. package/dist/collection/components/kup-gauge/kup-gauge-declarations.js +26 -26
  111. package/dist/collection/components/kup-gauge/kup-gauge.js +764 -764
  112. package/dist/collection/components/kup-grid/kup-grid-declarations.js +10 -10
  113. package/dist/collection/components/kup-grid/kup-grid.js +253 -253
  114. package/dist/collection/components/kup-iframe/kup-iframe-declarations.js +10 -10
  115. package/dist/collection/components/kup-iframe/kup-iframe.js +281 -281
  116. package/dist/collection/components/kup-image/canvas/kup-image-canvas-declarations.js +184 -184
  117. package/dist/collection/components/kup-image/canvas/kup-image-canvas-helper.js +19 -19
  118. package/dist/collection/components/kup-image/canvas/kup-image-canvas.js +225 -225
  119. package/dist/collection/components/kup-image/kup-image-declarations.js +16 -16
  120. package/dist/collection/components/kup-image/kup-image.js +491 -491
  121. package/dist/collection/components/kup-image-list/kup-image-list-declarations.js +10 -10
  122. package/dist/collection/components/kup-image-list/kup-image-list-state.js +9 -9
  123. package/dist/collection/components/kup-image-list/kup-image-list.js +533 -533
  124. package/dist/collection/components/kup-lazy/kup-lazy-declarations.js +20 -20
  125. package/dist/collection/components/kup-lazy/kup-lazy.js +430 -430
  126. package/dist/collection/components/kup-list/kup-list-declarations.js +34 -34
  127. package/dist/collection/components/kup-list/kup-list-helper.js +121 -121
  128. package/dist/collection/components/kup-list/kup-list.js +949 -949
  129. package/dist/collection/components/kup-magic-box/kup-magic-box-declarations.js +23 -23
  130. package/dist/collection/components/kup-magic-box/kup-magic-box.js +431 -431
  131. package/dist/collection/components/kup-nav-bar/kup-nav-bar-declarations.js +21 -21
  132. package/dist/collection/components/kup-nav-bar/kup-nav-bar.js +315 -315
  133. package/dist/collection/components/kup-numeric-picker/kup-numeric-picker-declarations.js +16 -16
  134. package/dist/collection/components/kup-numeric-picker/kup-numeric-picker.js +864 -864
  135. package/dist/collection/components/kup-photo-frame/kup-photo-frame-declarations.js +10 -10
  136. package/dist/collection/components/kup-photo-frame/kup-photo-frame.js +372 -372
  137. package/dist/collection/components/kup-planner/kup-planner-declarations.js +83 -76
  138. package/dist/collection/components/kup-planner/kup-planner-helper.js +54 -54
  139. package/dist/collection/components/kup-planner/kup-planner-state.js +16 -0
  140. package/dist/collection/components/kup-planner/kup-planner.js +1725 -1352
  141. package/dist/collection/components/kup-probe/kup-probe.js +358 -358
  142. package/dist/collection/components/kup-progress-bar/kup-progress-bar-declarations.js +14 -14
  143. package/dist/collection/components/kup-progress-bar/kup-progress-bar.js +405 -405
  144. package/dist/collection/components/kup-qlik/kup-qlik-declarations.js +1 -1
  145. package/dist/collection/components/kup-qlik/kup-qlik.js +326 -326
  146. package/dist/collection/components/kup-radio/kup-radio-declarations.js +12 -12
  147. package/dist/collection/components/kup-radio/kup-radio.js +398 -398
  148. package/dist/collection/components/kup-rating/kup-rating-declarations.js +11 -11
  149. package/dist/collection/components/kup-rating/kup-rating.js +332 -332
  150. package/dist/collection/components/kup-snackbar/kup-snackbar-declarations.js +13 -13
  151. package/dist/collection/components/kup-snackbar/kup-snackbar.js +389 -389
  152. package/dist/collection/components/kup-spinner/kup-spinner-declarations.js +15 -15
  153. package/dist/collection/components/kup-spinner/kup-spinner.js +468 -468
  154. package/dist/collection/components/kup-state/kup-state.js +1 -1
  155. package/dist/collection/components/kup-state/kup-store.js +1 -1
  156. package/dist/collection/components/kup-state/mock-store.js +13 -13
  157. package/dist/collection/components/kup-switch/kup-switch-declarations.js +12 -12
  158. package/dist/collection/components/kup-switch/kup-switch.js +402 -402
  159. package/dist/collection/components/kup-tab-bar/kup-tab-bar-declarations.js +10 -10
  160. package/dist/collection/components/kup-tab-bar/kup-tab-bar.js +443 -443
  161. package/dist/collection/components/kup-text-field/kup-text-field-declarations.js +35 -35
  162. package/dist/collection/components/kup-text-field/kup-text-field.js +1193 -1189
  163. package/dist/collection/components/kup-time-picker/kup-time-picker-declarations.js +14 -14
  164. package/dist/collection/components/kup-time-picker/kup-time-picker.js +921 -921
  165. package/dist/collection/components/kup-tree/kup-tree-declarations.js +43 -43
  166. package/dist/collection/components/kup-tree/kup-tree-faker.js +305 -305
  167. package/dist/collection/components/kup-tree/kup-tree-state.js +15 -15
  168. package/dist/collection/components/kup-tree/kup-tree.js +2479 -2479
  169. package/dist/collection/f-components/f-button/f-button-declarations.js +17 -17
  170. package/dist/collection/f-components/f-button/f-button.js +91 -91
  171. package/dist/collection/f-components/f-cell/f-cell-declarations.js +158 -158
  172. package/dist/collection/f-components/f-cell/f-cell.js +429 -429
  173. package/dist/collection/f-components/f-checkbox/f-checkbox-declarations.js +1 -1
  174. package/dist/collection/f-components/f-checkbox/f-checkbox.js +16 -16
  175. package/dist/collection/f-components/f-chip/f-chip-declarations.js +15 -15
  176. package/dist/collection/f-components/f-chip/f-chip.js +101 -101
  177. package/dist/collection/f-components/f-image/f-image-declarations.js +8 -8
  178. package/dist/collection/f-components/f-image/f-image.js +100 -100
  179. package/dist/collection/f-components/f-paginator/f-paginator-declarations.js +5 -5
  180. package/dist/collection/f-components/f-paginator/f-paginator-utils.js +28 -28
  181. package/dist/collection/f-components/f-paginator/f-paginator.js +86 -86
  182. package/dist/collection/f-components/f-switch/f-switch-declarations.js +1 -1
  183. package/dist/collection/f-components/f-switch/f-switch.js +12 -12
  184. package/dist/collection/f-components/f-text-field/f-text-field-declarations.js +1 -1
  185. package/dist/collection/f-components/f-text-field/f-text-field-mdc.js +29 -29
  186. package/dist/collection/f-components/f-text-field/f-text-field.js +151 -151
  187. package/dist/collection/managers/kup-data/kup-data-cell-helper.js +86 -86
  188. package/dist/collection/managers/kup-data/kup-data-column-helper.js +300 -300
  189. package/dist/collection/managers/kup-data/kup-data-declarations.js +10 -10
  190. package/dist/collection/managers/kup-data/kup-data-node-helper.js +165 -165
  191. package/dist/collection/managers/kup-data/kup-data-row-helper.js +28 -28
  192. package/dist/collection/managers/kup-data/kup-data.js +499 -499
  193. package/dist/collection/managers/kup-dates/kup-dates-declarations.js +43 -43
  194. package/dist/collection/managers/kup-dates/kup-dates.js +654 -654
  195. package/dist/collection/managers/kup-debug/kup-debug-declarations.js +20 -20
  196. package/dist/collection/managers/kup-debug/kup-debug.js +670 -670
  197. package/dist/collection/managers/kup-dynamic-position/kup-dynamic-position-declarations.js +27 -27
  198. package/dist/collection/managers/kup-dynamic-position/kup-dynamic-position.js +244 -244
  199. package/dist/collection/managers/kup-interact/kup-interact-declarations.js +49 -49
  200. package/dist/collection/managers/kup-interact/kup-interact.js +397 -397
  201. package/dist/collection/managers/kup-language/kup-language-declarations.js +211 -211
  202. package/dist/collection/managers/kup-language/kup-language.js +151 -151
  203. package/dist/collection/managers/kup-manager/kup-manager-declarations.js +1 -1
  204. package/dist/collection/managers/kup-manager/kup-manager.js +303 -303
  205. package/dist/collection/managers/kup-math/kup-math-declarations.js +13 -13
  206. package/dist/collection/managers/kup-math/kup-math-helper.js +39 -39
  207. package/dist/collection/managers/kup-math/kup-math.js +413 -413
  208. package/dist/collection/managers/kup-objects/kup-objects-declarations.js +1 -1
  209. package/dist/collection/managers/kup-objects/kup-objects.js +387 -387
  210. package/dist/collection/managers/kup-scroll-on-hover/kup-scroll-on-hover-declarations.js +10 -10
  211. package/dist/collection/managers/kup-scroll-on-hover/kup-scroll-on-hover.js +334 -334
  212. package/dist/collection/managers/kup-search/kup-search-declarations.js +1 -1
  213. package/dist/collection/managers/kup-search/kup-search.js +75 -75
  214. package/dist/collection/managers/kup-theme/kup-theme-declarations.js +177 -177
  215. package/dist/collection/managers/kup-theme/kup-theme.js +715 -715
  216. package/dist/collection/managers/kup-toolbar/kup-toolbar-declarations.js +9 -9
  217. package/dist/collection/managers/kup-toolbar/kup-toolbar.js +111 -111
  218. package/dist/collection/managers/kup-tooltip/kup-tooltip-declarations.js +1 -1
  219. package/dist/collection/managers/kup-tooltip/kup-tooltip.js +229 -229
  220. package/dist/collection/types/GenericTypes.js +54 -54
  221. package/dist/collection/utils/cell-utils.js +156 -156
  222. package/dist/collection/utils/filters/filters-column-menu.js +360 -360
  223. package/dist/collection/utils/filters/filters-declarations.js +25 -25
  224. package/dist/collection/utils/filters/filters-rows.js +238 -238
  225. package/dist/collection/utils/filters/filters-tree-items.js +117 -117
  226. package/dist/collection/utils/filters/filters.js +287 -287
  227. package/dist/collection/utils/kup-column-menu/kup-column-menu-declarations.js +20 -20
  228. package/dist/collection/utils/kup-column-menu/kup-column-menu.js +751 -751
  229. package/dist/collection/utils/utils.js +84 -80
  230. package/dist/collection/variables/GenericVariables.js +4 -4
  231. package/dist/components/kup-accordion.js +355 -355
  232. package/dist/components/kup-autocomplete2.js +31799 -31760
  233. package/dist/components/kup-box2.js +1469 -1405
  234. package/dist/components/kup-calendar.js +9788 -10280
  235. package/dist/components/kup-card.js +1 -1
  236. package/dist/components/kup-cell.js +325 -325
  237. package/dist/components/kup-chart.js +1 -1
  238. package/dist/components/kup-checkbox.js +1 -1
  239. package/dist/components/kup-chip.js +1 -1
  240. package/dist/components/kup-color-picker.js +1 -1
  241. package/dist/components/kup-combobox.js +1 -1
  242. package/dist/components/kup-dash-list.js +276 -276
  243. package/dist/components/kup-dash2.js +220 -220
  244. package/dist/components/kup-dashboard.js +549 -549
  245. package/dist/components/kup-data-table.js +1 -1
  246. package/dist/components/kup-date-picker.js +1 -1
  247. package/dist/components/kup-dialog.js +1 -1
  248. package/dist/components/kup-drawer.js +295 -295
  249. package/dist/components/kup-dropdown-button.js +1 -1
  250. package/dist/components/kup-echart2.js +7312 -6765
  251. package/dist/components/kup-family-tree.js +604 -604
  252. package/dist/components/kup-form.js +1 -1
  253. package/dist/components/kup-gauge.js +1 -1
  254. package/dist/components/kup-grid2.js +251 -251
  255. package/dist/components/kup-iframe.js +249 -249
  256. package/dist/components/kup-image-list.js +407 -407
  257. package/dist/components/kup-image.js +1 -1
  258. package/dist/components/kup-lazy.js +344 -344
  259. package/dist/components/kup-list.js +1 -1
  260. package/dist/components/kup-magic-box.js +461 -461
  261. package/dist/components/kup-nav-bar.js +284 -284
  262. package/dist/components/kup-numeric-picker.js +529 -529
  263. package/dist/components/kup-photo-frame.js +300 -300
  264. package/dist/components/kup-planner.js +1342 -1189
  265. package/dist/components/kup-probe.js +399 -399
  266. package/dist/components/kup-progress-bar.js +1 -1
  267. package/dist/components/kup-qlik.js +296 -296
  268. package/dist/components/kup-radio.js +1 -1
  269. package/dist/components/kup-rating.js +1 -1
  270. package/dist/components/kup-snackbar.js +273 -273
  271. package/dist/components/kup-spinner.js +1 -1
  272. package/dist/components/kup-switch.js +1 -1
  273. package/dist/components/kup-tab-bar.js +1 -1
  274. package/dist/components/kup-text-field.js +1 -1
  275. package/dist/components/kup-time-picker.js +1 -1
  276. package/dist/components/kup-tree.js +1 -1
  277. package/dist/esm/{GenericVariables-665de00a.js → GenericVariables-6dfdd433.js} +3 -3
  278. package/dist/esm/{component-120651a0.js → component-e86c51ea.js} +81 -2
  279. package/dist/esm/{f-button-024f0cfe.js → f-button-c6a69f75.js} +99 -99
  280. package/dist/esm/{f-button-declarations-b1b4cac4.js → f-button-declarations-fd4965d1.js} +16 -16
  281. package/dist/esm/{f-cell-90240a8c.js → f-cell-5822ea68.js} +472 -472
  282. package/dist/esm/{f-checkbox-9b3f5f5b.js → f-checkbox-c15911de.js} +23 -23
  283. package/dist/esm/{f-chip-2238ad43.js → f-chip-f46a03f5.js} +125 -125
  284. package/dist/esm/{f-image-f2e9bf79.js → f-image-f57832fa.js} +107 -107
  285. package/dist/esm/{f-paginator-utils-8cb3c023.js → f-paginator-utils-bafc463d.js} +1548 -1548
  286. package/dist/esm/{f-text-field-d231982c.js → f-text-field-15850e05.js} +172 -172
  287. package/dist/esm/{f-text-field-mdc-cee583ea.js → f-text-field-mdc-a1b4a919.js} +27 -28
  288. package/dist/esm/{index-8bd38435.js → index-238342f2.js} +78 -24
  289. package/dist/esm/ketchup.js +4 -4
  290. package/dist/esm/kup-accordion.entry.js +199 -200
  291. package/dist/esm/kup-autocomplete_27.entry.js +17546 -17508
  292. package/dist/esm/kup-box.entry.js +1294 -1232
  293. package/dist/esm/kup-calendar.entry.js +9557 -10050
  294. package/dist/esm/kup-cell.entry.js +172 -172
  295. package/dist/esm/kup-dash-list.entry.js +106 -106
  296. package/dist/esm/kup-dash_2.entry.js +162 -162
  297. package/dist/esm/kup-dashboard.entry.js +400 -401
  298. package/dist/esm/kup-drawer.entry.js +138 -138
  299. package/dist/esm/kup-echart.entry.js +7145 -6598
  300. package/dist/esm/kup-family-tree.entry.js +439 -439
  301. package/dist/esm/kup-iframe.entry.js +94 -94
  302. package/dist/esm/kup-image-list.entry.js +255 -256
  303. package/dist/esm/kup-lazy.entry.js +186 -186
  304. package/dist/esm/kup-magic-box.entry.js +298 -298
  305. package/dist/esm/{kup-manager-d1da769e.js → kup-manager-89dd9137.js} +7287 -7287
  306. package/dist/esm/kup-nav-bar.entry.js +130 -130
  307. package/dist/esm/kup-numeric-picker.entry.js +367 -368
  308. package/dist/esm/kup-photo-frame.entry.js +144 -144
  309. package/dist/esm/kup-planner.entry.js +1151 -1009
  310. package/dist/esm/kup-probe.entry.js +246 -246
  311. package/dist/esm/kup-qlik.entry.js +138 -138
  312. package/dist/esm/kup-snackbar.entry.js +116 -116
  313. package/dist/esm/loader.js +4 -4
  314. package/dist/ketchup/ketchup.esm.js +1 -1
  315. package/dist/ketchup/{p-83435e6c.entry.js → p-01d44efe.entry.js} +1 -1
  316. package/dist/ketchup/{p-8b46e7ce.js → p-1a8a06de.js} +1 -1
  317. package/dist/ketchup/{p-eda7f130.js → p-206245c0.js} +1 -1
  318. package/dist/ketchup/p-4bd63e97.entry.js +25 -0
  319. package/dist/ketchup/{p-651d89c8.entry.js → p-4da77173.entry.js} +1 -1
  320. package/dist/ketchup/{p-e1f1e661.entry.js → p-514dcb7d.entry.js} +1 -1
  321. package/dist/ketchup/{p-37067ee6.entry.js → p-51573263.entry.js} +1 -1
  322. package/dist/ketchup/{p-9f9b6656.js → p-54248440.js} +1 -1
  323. package/dist/ketchup/{p-1ad628fb.entry.js → p-5dfa5c49.entry.js} +1 -1
  324. package/dist/ketchup/{p-10d84b1b.js → p-6507e9eb.js} +7 -6
  325. package/dist/ketchup/{p-410c102a.js → p-673bb93e.js} +1 -1
  326. package/dist/ketchup/{p-063d4c27.entry.js → p-688478e9.entry.js} +1 -1
  327. package/dist/ketchup/p-6a5d95df.entry.js +1 -0
  328. package/dist/ketchup/p-6ec8629e.js +30 -0
  329. package/dist/ketchup/{p-a84f1d24.entry.js → p-785e8d74.entry.js} +1 -1
  330. package/dist/ketchup/{p-43b67de4.entry.js → p-78cc5a2d.entry.js} +1 -1
  331. package/dist/ketchup/{p-c42b80c1.entry.js → p-799f7f10.entry.js} +1 -1
  332. package/dist/ketchup/p-7e757c27.entry.js +1 -0
  333. package/dist/ketchup/p-843253dd.entry.js +1 -0
  334. package/dist/ketchup/{p-0d7d59c7.entry.js → p-84d3f676.entry.js} +1 -1
  335. package/dist/ketchup/p-8c1edebd.js +2 -0
  336. package/dist/ketchup/{p-5f3680f2.js → p-a5f15864.js} +1 -1
  337. package/dist/ketchup/p-af7202ff.entry.js +1 -0
  338. package/dist/ketchup/{p-89743989.entry.js → p-ba959bb5.entry.js} +1 -1
  339. package/dist/ketchup/{p-39a55c47.js → p-c1931214.js} +1 -1
  340. package/dist/ketchup/{p-3cf64473.js → p-c354c5d0.js} +1 -1
  341. package/dist/ketchup/p-cd8512d9.entry.js +39 -0
  342. package/dist/ketchup/{p-3432ebaf.entry.js → p-d4f86197.entry.js} +2 -2
  343. package/dist/ketchup/{p-163b18b9.entry.js → p-e59c2bc0.entry.js} +1 -1
  344. package/dist/ketchup/{p-f876125d.entry.js → p-f2fda43b.entry.js} +1 -1
  345. package/dist/ketchup/p-f4b6aa3f.entry.js +1 -0
  346. package/dist/ketchup/p-f4f5170c.entry.js +1 -0
  347. package/dist/ketchup/{p-27a56c87.js → p-fb03f2f5.js} +2 -2
  348. package/dist/loader/index.d.ts +1 -1
  349. package/dist/types/components/kup-accordion/kup-accordion-declarations.d.ts +20 -20
  350. package/dist/types/components/kup-accordion/kup-accordion.d.ts +80 -80
  351. package/dist/types/components/kup-autocomplete/kup-autocomplete-declarations.d.ts +35 -35
  352. package/dist/types/components/kup-autocomplete/kup-autocomplete.d.ts +119 -119
  353. package/dist/types/components/kup-badge/kup-badge-declarations.d.ts +9 -9
  354. package/dist/types/components/kup-badge/kup-badge.d.ts +51 -51
  355. package/dist/types/components/kup-box/kup-box-declarations.d.ts +114 -113
  356. package/dist/types/components/kup-box/kup-box-state.d.ts +10 -10
  357. package/dist/types/components/kup-box/kup-box.d.ts +275 -270
  358. package/dist/types/components/kup-button/kup-button-declarations.d.ts +24 -24
  359. package/dist/types/components/kup-button/kup-button.d.ts +111 -111
  360. package/dist/types/components/kup-button-list/kup-button-list-declarations.d.ts +24 -24
  361. package/dist/types/components/kup-button-list/kup-button-list.d.ts +82 -82
  362. package/dist/types/components/kup-calendar/kup-calendar-declarations.d.ts +70 -70
  363. package/dist/types/components/kup-calendar/kup-calendar.d.ts +100 -100
  364. package/dist/types/components/kup-card/box/kup-card-box.d.ts +50 -50
  365. package/dist/types/components/kup-card/built-in/kup-card-built-in.d.ts +39 -39
  366. package/dist/types/components/kup-card/built-in/kup-card-calendar.d.ts +2 -2
  367. package/dist/types/components/kup-card/built-in/kup-card-clock.d.ts +2 -2
  368. package/dist/types/components/kup-card/built-in/kup-card-column-drop-menu.d.ts +3 -3
  369. package/dist/types/components/kup-card/built-in/kup-card-message-box.d.ts +3 -3
  370. package/dist/types/components/kup-card/built-in/kup-card-numeric.d.ts +2 -2
  371. package/dist/types/components/kup-card/collapsible/kup-card-collapsible.d.ts +14 -14
  372. package/dist/types/components/kup-card/dialog/kup-card-dialog.d.ts +44 -44
  373. package/dist/types/components/kup-card/free/kup-card-free.d.ts +14 -14
  374. package/dist/types/components/kup-card/kup-card-declarations.d.ts +236 -236
  375. package/dist/types/components/kup-card/kup-card-helper.d.ts +27 -27
  376. package/dist/types/components/kup-card/kup-card.d.ts +159 -159
  377. package/dist/types/components/kup-card/scalable/kup-card-scalable.d.ts +56 -56
  378. package/dist/types/components/kup-card/standard/kup-card-standard.d.ts +92 -92
  379. package/dist/types/components/kup-cell/kup-cell-declarations.d.ts +10 -10
  380. package/dist/types/components/kup-cell/kup-cell.d.ts +67 -67
  381. package/dist/types/components/kup-chart/kup-chart-builder.d.ts +7 -7
  382. package/dist/types/components/kup-chart/kup-chart-declarations.d.ts +135 -135
  383. package/dist/types/components/kup-chart/kup-chart.d.ts +170 -170
  384. package/dist/types/components/kup-checkbox/kup-checkbox-declarations.d.ts +17 -17
  385. package/dist/types/components/kup-checkbox/kup-checkbox.d.ts +85 -85
  386. package/dist/types/components/kup-chip/kup-chip-declarations.d.ts +22 -22
  387. package/dist/types/components/kup-chip/kup-chip.d.ts +89 -89
  388. package/dist/types/components/kup-color-picker/kup-color-picker-declarations.d.ts +15 -15
  389. package/dist/types/components/kup-color-picker/kup-color-picker.d.ts +89 -89
  390. package/dist/types/components/kup-combobox/kup-combobox-declarations.d.ts +24 -24
  391. package/dist/types/components/kup-combobox/kup-combobox.d.ts +95 -95
  392. package/dist/types/components/kup-dash/kup-dash.d.ts +33 -33
  393. package/dist/types/components/kup-dash-list/kup-dash-list.d.ts +22 -22
  394. package/dist/types/components/kup-dashboard/kup-dashboard-declarations.d.ts +61 -61
  395. package/dist/types/components/kup-dashboard/kup-dashboard.d.ts +80 -80
  396. package/dist/types/components/kup-data-table/kup-data-table-declarations.d.ts +254 -254
  397. package/dist/types/components/kup-data-table/kup-data-table-helper.d.ts +25 -25
  398. package/dist/types/components/kup-data-table/kup-data-table-state.d.ts +36 -36
  399. package/dist/types/components/kup-data-table/kup-data-table.d.ts +444 -444
  400. package/dist/types/components/kup-date-picker/kup-date-picker-declarations.d.ts +20 -20
  401. package/dist/types/components/kup-date-picker/kup-date-picker.d.ts +110 -110
  402. package/dist/types/components/kup-dialog/kup-dialog-declarations.d.ts +26 -26
  403. package/dist/types/components/kup-dialog/kup-dialog.d.ts +77 -77
  404. package/dist/types/components/kup-drawer/kup-drawer-declarations.d.ts +9 -9
  405. package/dist/types/components/kup-drawer/kup-drawer.d.ts +74 -74
  406. package/dist/types/components/kup-dropdown-button/kup-dropdown-button-declarations.d.ts +21 -21
  407. package/dist/types/components/kup-dropdown-button/kup-dropdown-button.d.ts +161 -161
  408. package/dist/types/components/kup-echart/kup-echart-declarations.d.ts +62 -62
  409. package/dist/types/components/kup-echart/kup-echart.d.ts +111 -111
  410. package/dist/types/components/kup-family-tree/kup-family-tree-declarations.d.ts +38 -38
  411. package/dist/types/components/kup-family-tree/kup-family-tree.d.ts +87 -87
  412. package/dist/types/components/kup-form/kup-form-declarations.d.ts +64 -64
  413. package/dist/types/components/kup-form/kup-form.d.ts +83 -83
  414. package/dist/types/components/kup-gauge/kup-gauge-declarations.d.ts +25 -25
  415. package/dist/types/components/kup-gauge/kup-gauge.d.ts +147 -147
  416. package/dist/types/components/kup-grid/kup-grid-declarations.d.ts +9 -9
  417. package/dist/types/components/kup-grid/kup-grid.d.ts +48 -48
  418. package/dist/types/components/kup-iframe/kup-iframe-declarations.d.ts +9 -9
  419. package/dist/types/components/kup-iframe/kup-iframe.d.ts +49 -49
  420. package/dist/types/components/kup-image/canvas/kup-image-canvas-declarations.d.ts +23 -23
  421. package/dist/types/components/kup-image/canvas/kup-image-canvas-helper.d.ts +2 -2
  422. package/dist/types/components/kup-image/canvas/kup-image-canvas.d.ts +28 -28
  423. package/dist/types/components/kup-image/kup-image-declarations.d.ts +19 -19
  424. package/dist/types/components/kup-image/kup-image.d.ts +103 -103
  425. package/dist/types/components/kup-image-list/kup-image-list-declarations.d.ts +14 -14
  426. package/dist/types/components/kup-image-list/kup-image-list-state.d.ts +6 -6
  427. package/dist/types/components/kup-image-list/kup-image-list.d.ts +73 -73
  428. package/dist/types/components/kup-lazy/kup-lazy-declarations.d.ts +18 -18
  429. package/dist/types/components/kup-lazy/kup-lazy.d.ts +78 -78
  430. package/dist/types/components/kup-list/kup-list-declarations.d.ts +48 -48
  431. package/dist/types/components/kup-list/kup-list-helper.d.ts +6 -6
  432. package/dist/types/components/kup-list/kup-list.d.ts +128 -128
  433. package/dist/types/components/kup-magic-box/kup-magic-box-declarations.d.ts +21 -21
  434. package/dist/types/components/kup-magic-box/kup-magic-box.d.ts +65 -65
  435. package/dist/types/components/kup-nav-bar/kup-nav-bar-declarations.d.ts +19 -19
  436. package/dist/types/components/kup-nav-bar/kup-nav-bar.d.ts +65 -65
  437. package/dist/types/components/kup-numeric-picker/kup-numeric-picker-declarations.d.ts +19 -19
  438. package/dist/types/components/kup-numeric-picker/kup-numeric-picker.d.ts +121 -121
  439. package/dist/types/components/kup-photo-frame/kup-photo-frame-declarations.d.ts +9 -9
  440. package/dist/types/components/kup-photo-frame/kup-photo-frame.d.ts +61 -61
  441. package/dist/types/components/kup-planner/kup-planner-declarations.d.ts +127 -106
  442. package/dist/types/components/kup-planner/kup-planner-helper.d.ts +6 -6
  443. package/dist/types/components/kup-planner/kup-planner-state.d.ts +13 -0
  444. package/dist/types/components/kup-planner/kup-planner.d.ts +266 -212
  445. package/dist/types/components/kup-probe/kup-probe.d.ts +72 -72
  446. package/dist/types/components/kup-progress-bar/kup-progress-bar-declarations.d.ts +13 -13
  447. package/dist/types/components/kup-progress-bar/kup-progress-bar.d.ts +69 -69
  448. package/dist/types/components/kup-qlik/kup-qlik-declarations.d.ts +19 -19
  449. package/dist/types/components/kup-qlik/kup-qlik.d.ts +100 -100
  450. package/dist/types/components/kup-radio/kup-radio-declarations.d.ts +23 -23
  451. package/dist/types/components/kup-radio/kup-radio.d.ts +80 -80
  452. package/dist/types/components/kup-rating/kup-rating-declarations.d.ts +14 -14
  453. package/dist/types/components/kup-rating/kup-rating.d.ts +62 -62
  454. package/dist/types/components/kup-snackbar/kup-snackbar-declarations.d.ts +12 -12
  455. package/dist/types/components/kup-snackbar/kup-snackbar.d.ts +84 -84
  456. package/dist/types/components/kup-spinner/kup-spinner-declarations.d.ts +14 -14
  457. package/dist/types/components/kup-spinner/kup-spinner.d.ts +79 -79
  458. package/dist/types/components/kup-state/kup-state.d.ts +3 -3
  459. package/dist/types/components/kup-state/kup-store.d.ts +4 -4
  460. package/dist/types/components/kup-state/mock-store.d.ts +8 -8
  461. package/dist/types/components/kup-switch/kup-switch-declarations.d.ts +15 -15
  462. package/dist/types/components/kup-switch/kup-switch.d.ts +80 -80
  463. package/dist/types/components/kup-tab-bar/kup-tab-bar-declarations.d.ts +21 -21
  464. package/dist/types/components/kup-tab-bar/kup-tab-bar.d.ts +77 -77
  465. package/dist/types/components/kup-text-field/kup-text-field-declarations.d.ts +38 -38
  466. package/dist/types/components/kup-text-field/kup-text-field.d.ts +253 -253
  467. package/dist/types/components/kup-time-picker/kup-time-picker-declarations.d.ts +17 -17
  468. package/dist/types/components/kup-time-picker/kup-time-picker.d.ts +125 -125
  469. package/dist/types/components/kup-tree/kup-tree-declarations.d.ts +97 -97
  470. package/dist/types/components/kup-tree/kup-tree-faker.d.ts +54 -54
  471. package/dist/types/components/kup-tree/kup-tree-state.d.ts +14 -14
  472. package/dist/types/components/kup-tree/kup-tree.d.ts +362 -362
  473. package/dist/types/components.d.ts +98 -2
  474. package/dist/types/f-components/f-button/f-button-declarations.d.ts +41 -41
  475. package/dist/types/f-components/f-button/f-button.d.ts +3 -3
  476. package/dist/types/f-components/f-cell/f-cell-declarations.d.ts +162 -162
  477. package/dist/types/f-components/f-cell/f-cell.d.ts +3 -3
  478. package/dist/types/f-components/f-checkbox/f-checkbox-declarations.d.ts +15 -15
  479. package/dist/types/f-components/f-checkbox/f-checkbox.d.ts +3 -3
  480. package/dist/types/f-components/f-chip/f-chip-declarations.d.ts +29 -29
  481. package/dist/types/f-components/f-chip/f-chip.d.ts +3 -3
  482. package/dist/types/f-components/f-image/f-image-declarations.d.ts +36 -36
  483. package/dist/types/f-components/f-image/f-image.d.ts +3 -3
  484. package/dist/types/f-components/f-paginator/f-paginator-declarations.d.ts +22 -22
  485. package/dist/types/f-components/f-paginator/f-paginator-utils.d.ts +2 -2
  486. package/dist/types/f-components/f-paginator/f-paginator.d.ts +3 -3
  487. package/dist/types/f-components/f-switch/f-switch-declarations.d.ts +14 -14
  488. package/dist/types/f-components/f-switch/f-switch.d.ts +3 -3
  489. package/dist/types/f-components/f-text-field/f-text-field-declarations.d.ts +42 -42
  490. package/dist/types/f-components/f-text-field/f-text-field-mdc.d.ts +6 -6
  491. package/dist/types/f-components/f-text-field/f-text-field.d.ts +3 -3
  492. package/dist/types/managers/kup-data/kup-data-cell-helper.d.ts +31 -31
  493. package/dist/types/managers/kup-data/kup-data-column-helper.d.ts +39 -39
  494. package/dist/types/managers/kup-data/kup-data-declarations.d.ts +173 -173
  495. package/dist/types/managers/kup-data/kup-data-node-helper.d.ts +44 -44
  496. package/dist/types/managers/kup-data/kup-data-row-helper.d.ts +14 -14
  497. package/dist/types/managers/kup-data/kup-data.d.ts +86 -86
  498. package/dist/types/managers/kup-dates/kup-dates-declarations.d.ts +39 -39
  499. package/dist/types/managers/kup-dates/kup-dates.d.ts +207 -207
  500. package/dist/types/managers/kup-debug/kup-debug-declarations.d.ts +38 -38
  501. package/dist/types/managers/kup-debug/kup-debug.d.ts +95 -95
  502. package/dist/types/managers/kup-dynamic-position/kup-dynamic-position-declarations.d.ts +50 -50
  503. package/dist/types/managers/kup-dynamic-position/kup-dynamic-position.d.ts +61 -61
  504. package/dist/types/managers/kup-interact/kup-interact-declarations.d.ts +128 -128
  505. package/dist/types/managers/kup-interact/kup-interact.d.ts +105 -105
  506. package/dist/types/managers/kup-language/kup-language-declarations.d.ts +225 -225
  507. package/dist/types/managers/kup-language/kup-language.d.ts +52 -52
  508. package/dist/types/managers/kup-manager/kup-manager-declarations.d.ts +162 -162
  509. package/dist/types/managers/kup-manager/kup-manager.d.ts +95 -95
  510. package/dist/types/managers/kup-math/kup-math-declarations.d.ts +33 -33
  511. package/dist/types/managers/kup-math/kup-math-helper.d.ts +17 -17
  512. package/dist/types/managers/kup-math/kup-math.d.ts +147 -146
  513. package/dist/types/managers/kup-objects/kup-objects-declarations.d.ts +15 -15
  514. package/dist/types/managers/kup-objects/kup-objects.d.ts +210 -210
  515. package/dist/types/managers/kup-scroll-on-hover/kup-scroll-on-hover-declarations.d.ts +28 -28
  516. package/dist/types/managers/kup-scroll-on-hover/kup-scroll-on-hover.d.ts +62 -62
  517. package/dist/types/managers/kup-search/kup-search-declarations.d.ts +7 -7
  518. package/dist/types/managers/kup-search/kup-search.d.ts +20 -20
  519. package/dist/types/managers/kup-theme/kup-theme-declarations.d.ts +185 -185
  520. package/dist/types/managers/kup-theme/kup-theme.d.ts +127 -127
  521. package/dist/types/managers/kup-toolbar/kup-toolbar-declarations.d.ts +8 -8
  522. package/dist/types/managers/kup-toolbar/kup-toolbar.d.ts +39 -39
  523. package/dist/types/managers/kup-tooltip/kup-tooltip-declarations.d.ts +8 -8
  524. package/dist/types/managers/kup-tooltip/kup-tooltip.d.ts +51 -51
  525. package/dist/types/stencil-public-runtime.d.ts +1 -0
  526. package/dist/types/types/GenericTypes.d.ts +110 -110
  527. package/dist/types/utils/cell-utils.d.ts +10 -10
  528. package/dist/types/utils/filters/filters-column-menu.d.ts +96 -96
  529. package/dist/types/utils/filters/filters-declarations.d.ts +39 -39
  530. package/dist/types/utils/filters/filters-rows.d.ts +30 -30
  531. package/dist/types/utils/filters/filters-tree-items.d.ts +19 -19
  532. package/dist/types/utils/filters/filters.d.ts +72 -72
  533. package/dist/types/utils/kup-column-menu/kup-column-menu-declarations.d.ts +19 -19
  534. package/dist/types/utils/kup-column-menu/kup-column-menu.d.ts +142 -142
  535. package/dist/types/utils/utils.d.ts +37 -35
  536. package/dist/types/variables/GenericVariables.d.ts +4 -4
  537. package/package.json +21 -16
  538. package/dist/cjs/tslib.es6-386654de.js +0 -87
  539. package/dist/esm/tslib.es6-8c2af864.js +0 -82
  540. package/dist/ketchup/p-0bcda0e2.entry.js +0 -1
  541. package/dist/ketchup/p-33aff1ca.entry.js +0 -25
  542. package/dist/ketchup/p-35b29b22.entry.js +0 -1
  543. package/dist/ketchup/p-36dac88e.js +0 -30
  544. package/dist/ketchup/p-489d55ff.entry.js +0 -39
  545. package/dist/ketchup/p-73c8d651.entry.js +0 -1
  546. package/dist/ketchup/p-7f59211b.js +0 -1
  547. package/dist/ketchup/p-9dcfbb1e.js +0 -2
  548. package/dist/ketchup/p-b2fd2dbf.entry.js +0 -1
  549. package/dist/ketchup/p-d1b050d0.entry.js +0 -27
  550. package/dist/ketchup/p-d6ea709e.entry.js +0 -1
  551. /package/dist/ketchup/{p-6c77a36c.js → p-0fd98ab4.js} +0 -0
  552. /package/dist/ketchup/{p-97e8ea42.js → p-ad2e21d2.js} +0 -0
@@ -1,2479 +1,2479 @@
1
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
- if (kind === "a" && !f)
3
- throw new TypeError("Private accessor was defined without a getter");
4
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
5
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
6
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
7
- };
8
- var _KupTree_kupManager;
9
- import { forceUpdate, getAssetPath, h, Host, } from '@stencil/core';
10
- import { TotalLabel, TotalMode, } from './../kup-data-table/kup-data-table-declarations';
11
- import { KupTreeProps, treeMainColumnName, KupTreeExpansionMode, } from './kup-tree-declarations';
12
- import { MDCRipple } from '@material/ripple';
13
- import { kupManagerInstance, } from '../../managers/kup-manager/kup-manager';
14
- import { calcTotals, normalizeRows, } from '../kup-data-table/kup-data-table-helper';
15
- import { KupTreeState } from './kup-tree-state';
16
- import { getColumnByName } from '../../utils/cell-utils';
17
- import { getProps, setProps } from '../../utils/utils';
18
- import { KupColumnMenu } from '../../utils/kup-column-menu/kup-column-menu';
19
- import { FiltersColumnMenu } from '../../utils/filters/filters-column-menu';
20
- import { KupGlobalFilterMode, } from '../../utils/filters/filters-declarations';
21
- import { FiltersTreeItems } from '../../utils/filters/filters-tree-items';
22
- import { kupDynamicPositionAttribute, } from '../../managers/kup-dynamic-position/kup-dynamic-position-declarations';
23
- import { KupLanguageGeneric, KupLanguageSearch, KupLanguageTotals, } from '../../managers/kup-language/kup-language-declarations';
24
- import { componentWrapperId } from '../../variables/GenericVariables';
25
- import { KupThemeIconValues } from '../../managers/kup-theme/kup-theme-declarations';
26
- import { KupPointerEventTypes } from '../../managers/kup-interact/kup-interact-declarations';
27
- import { FCellPadding, } from '../../f-components/f-cell/f-cell-declarations';
28
- import { FCell } from '../../f-components/f-cell/f-cell';
29
- import { KupDebugCategory } from '../../managers/kup-debug/kup-debug-declarations';
30
- import { FTextFieldMDC } from '../../f-components/f-text-field/f-text-field-mdc';
31
- export class KupTree {
32
- constructor() {
33
- /*-------------------------------------------------*/
34
- /* S t a t e s */
35
- /*-------------------------------------------------*/
36
- this.state = new KupTreeState();
37
- /*-------------------------------------------------*/
38
- /* I n t e r n a l V a r i a b l e s */
39
- /*-------------------------------------------------*/
40
- /**
41
- * Instance of the KupManager class.
42
- */
43
- _KupTree_kupManager.set(this, kupManagerInstance());
44
- /**
45
- * Reference to the column menu card.
46
- */
47
- this.columnMenuCard = null;
48
- this.clickTimeout = [];
49
- this.sizedColumns = undefined;
50
- this.filtersColumnMenuInstance = new FiltersColumnMenu();
51
- this.filtersTreeItemsInstance = new FiltersTreeItems();
52
- this.totalMenuCoords = null;
53
- this.contentRefs = [];
54
- this.oldWidth = null;
55
- this.hold = false;
56
- this.interactableTouch = [];
57
- this.clickCb = null;
58
- this.treeColumnVisible = true;
59
- this.openedTotalMenu = null;
60
- this.columnMenuAnchor = null;
61
- this.stateSwitcher = false;
62
- this.selectedNode = [];
63
- this.asAccordion = false;
64
- this.columns = undefined;
65
- this.customStyle = '';
66
- this.data = [];
67
- this.density = FCellPadding.MEDIUM;
68
- this.dynamicExpansionCallback = undefined;
69
- this.editableData = false;
70
- this.enableExtraColumns = true;
71
- this.expanded = false;
72
- this.expansionMode = KupTreeExpansionMode.DROPDOWN;
73
- this.filters = {};
74
- this.globalFilter = false;
75
- this.globalFilterValue = '';
76
- this.globalFilterMode = KupGlobalFilterMode.SIMPLE;
77
- this.preventXScroll = false;
78
- this.removableColumns = true;
79
- this.ripple = true;
80
- this.scrollOnHover = false;
81
- this.showColumns = false;
82
- this.showFilters = true;
83
- this.showFooter = false;
84
- this.showHeader = false;
85
- this.showIcons = true;
86
- this.stateId = '';
87
- this.store = undefined;
88
- this.useDynamicExpansion = false;
89
- this.totals = undefined;
90
- }
91
- initWithPersistedState() {
92
- if (this.store && this.stateId) {
93
- const state = this.store.getState(this.stateId);
94
- if (state != null) {
95
- this.density = state.density;
96
- this.showFilters = state.showFilters;
97
- this.showFooter = state.showFooter;
98
- this.globalFilter = state.globalFilter;
99
- this.globalFilterValue = state.globalFilterValue;
100
- this.filters = Object.assign({}, state.filters);
101
- this.totals = Object.assign({}, state.totals);
102
- }
103
- }
104
- }
105
- persistState() {
106
- if (this.store && this.stateId) {
107
- let somethingChanged = false;
108
- if (!__classPrivateFieldGet(this, _KupTree_kupManager, "f").objects.deepEqual(this.state.filters, this.filters)) {
109
- this.state.filters = Object.assign({}, this.filters);
110
- somethingChanged = true;
111
- }
112
- if (!__classPrivateFieldGet(this, _KupTree_kupManager, "f").objects.deepEqual(this.state.density, this.density)) {
113
- this.state.density = this.density;
114
- somethingChanged = true;
115
- }
116
- if (!__classPrivateFieldGet(this, _KupTree_kupManager, "f").objects.deepEqual(this.state.showFilters, this.showFilters)) {
117
- this.state.showFilters = this.showFilters;
118
- somethingChanged = true;
119
- }
120
- if (!__classPrivateFieldGet(this, _KupTree_kupManager, "f").objects.deepEqual(this.state.showFooter, this.showFooter)) {
121
- this.state.showFooter = this.showFooter;
122
- somethingChanged = true;
123
- }
124
- if (!__classPrivateFieldGet(this, _KupTree_kupManager, "f").objects.deepEqual(this.state.totals, this.totals)) {
125
- this.state.totals = Object.assign({}, this.totals);
126
- somethingChanged = true;
127
- }
128
- if (!__classPrivateFieldGet(this, _KupTree_kupManager, "f").objects.deepEqual(this.state.globalFilter, this.globalFilter)) {
129
- this.state.globalFilter = this.globalFilter;
130
- somethingChanged = true;
131
- }
132
- if (!__classPrivateFieldGet(this, _KupTree_kupManager, "f").objects.deepEqual(this.state.globalFilterValue, this.globalFilterValue)) {
133
- this.state.globalFilterValue = this.globalFilterValue;
134
- somethingChanged = true;
135
- }
136
- if (!this.state.load) {
137
- this.state.load = true;
138
- return;
139
- }
140
- if (somethingChanged) {
141
- this.store.persistState(this.stateId, this.state);
142
- }
143
- }
144
- }
145
- /**
146
- * This method will get the selected nodes of the component.
147
- */
148
- async getSelectedNode() {
149
- return this.selectedNode;
150
- }
151
- /**
152
- * This method will set the selected rows of the component.
153
- * @param {string|number[]} rowsIdentifiers - Array of ids (dataset) or indexes (rendered rows).
154
- * @param {boolean} emitEvent - The event will always be emitted unless emitEvent is set to false.
155
- */
156
- async setSelectedNode(treeNodePath, emitEvent) {
157
- this.selectedNode = treeNodePath
158
- .split(',')
159
- .map((treeNodeIndex) => parseInt(treeNodeIndex));
160
- if (emitEvent !== false) {
161
- this.kupTreeNodeSelected.emit({
162
- comp: this,
163
- id: this.rootElement.id,
164
- treeNodePath: this.selectedNode,
165
- treeNode: this.getTreeNode(this.selectedNode),
166
- columnName: null,
167
- });
168
- }
169
- }
170
- /*-------------------------------------------------*/
171
- /* W a t c h e r s */
172
- /*-------------------------------------------------*/
173
- enrichDataWhenChanged(newData, oldData) {
174
- if (!newData) {
175
- newData = [];
176
- }
177
- if (newData !== oldData) {
178
- this.refreshStructureState();
179
- }
180
- }
181
- enrichStructureStateWhenChanged(newValue, oldValue) {
182
- if (newValue !== oldValue) {
183
- this.refreshStructureState();
184
- }
185
- }
186
- /*-------------------------------------------------*/
187
- /* P u b l i c M e t h o d s */
188
- /*-------------------------------------------------*/
189
- /**
190
- * True if there aren't visible nodes
191
- */
192
- async isEmpty() {
193
- return this.visibleNodes == 0;
194
- }
195
- /**
196
- * Closes any opened column menu.
197
- */
198
- async closeColumnMenu() {
199
- this.columnMenuAnchor = null;
200
- if (this.columnMenuCard) {
201
- this.columnMenuCard.data = null;
202
- }
203
- this.columnMenuInstance.close(this.columnMenuCard);
204
- this.kupTreeColumnMenu.emit({
205
- comp: this,
206
- id: this.rootElement.id,
207
- card: this.columnMenuCard,
208
- event: null,
209
- open: false,
210
- });
211
- }
212
- /**
213
- * Collapses all nodes.
214
- */
215
- async collapseAll() {
216
- if (!this.useDynamicExpansion) {
217
- for (let index = 0; index < this.data.length; index++) {
218
- this.data[index].isExpanded = false;
219
- this.handleChildren(this.data[index], false);
220
- }
221
- }
222
- else {
223
- this.kupTreeDynamicMassExpansion.emit({
224
- comp: this,
225
- id: this.rootElement.id,
226
- expandAll: false,
227
- });
228
- }
229
- this.refresh();
230
- }
231
- /**
232
- * Expands all nodes.
233
- */
234
- async expandAll() {
235
- if (!this.useDynamicExpansion) {
236
- for (let index = 0; index < this.data.length; index++) {
237
- this.data[index].isExpanded = true;
238
- this.handleChildren(this.data[index], true);
239
- }
240
- }
241
- else {
242
- this.kupTreeDynamicMassExpansion.emit({
243
- comp: this,
244
- id: this.rootElement.id,
245
- expandAll: true,
246
- });
247
- }
248
- this.refresh();
249
- }
250
- /**
251
- * Used to retrieve component's props values.
252
- * @param {boolean} descriptions - When provided and true, the result will be the list of props with their description.
253
- * @returns {Promise<GenericObject>} List of props as object, each key will be a prop.
254
- */
255
- async getProps(descriptions) {
256
- return getProps(this, KupTreeProps, descriptions);
257
- }
258
- /**
259
- * Hides the given column.
260
- * @param {KupDataColumn} column - Column to hide.
261
- */
262
- async hideColumn(column) {
263
- __classPrivateFieldGet(this, _KupTree_kupManager, "f").data.column.hide(this.columns, [column.name]);
264
- this.kupColumnRemove.emit({
265
- comp: this,
266
- id: this.rootElement.id,
267
- column: column,
268
- });
269
- this.refresh();
270
- }
271
- /**
272
- * Opens the column menu of the given column.
273
- * @param {string} column - Name of the column.
274
- */
275
- async openColumnMenu(column) {
276
- this.columnMenuAnchor = column;
277
- if (!this.columnMenuCard) {
278
- this.columnMenuCard = document.createElement('kup-card');
279
- this.columnMenuCard.isMenu = true;
280
- this.columnMenuCard.layoutNumber = 12;
281
- this.columnMenuCard.sizeX = 'auto';
282
- this.columnMenuCard.sizeY = 'auto';
283
- this.columnMenuCard.addEventListener('kup-card-click', (e) => {
284
- this.kupTreeColumnMenu.emit({
285
- comp: this,
286
- id: this.rootElement.id,
287
- card: this.columnMenuCard,
288
- event: e,
289
- open: this.columnMenuCard.menuVisible,
290
- });
291
- });
292
- this.columnMenuCard.addEventListener('kup-card-event', (e) => {
293
- this.columnMenuInstance.eventHandlers(e, this);
294
- this.kupTreeColumnMenu.emit({
295
- comp: this,
296
- id: this.rootElement.id,
297
- card: this.columnMenuCard,
298
- event: e,
299
- open: this.columnMenuCard.menuVisible,
300
- });
301
- });
302
- }
303
- this.columnMenuCard.setAttribute('data-column', column);
304
- this.columnMenuCard.data = this.columnMenuInstance.prepData(this, getColumnByName(this.getVisibleColumns(), column));
305
- this.columnMenuInstance.open(this, column);
306
- this.columnMenuInstance.reposition(this, this.columnMenuCard);
307
- this.kupTreeColumnMenu.emit({
308
- comp: this,
309
- id: this.rootElement.id,
310
- card: this.columnMenuCard,
311
- event: null,
312
- open: true,
313
- });
314
- }
315
- /**
316
- * This method is used to trigger a new render of the component.
317
- */
318
- async refresh() {
319
- forceUpdate(this);
320
- }
321
- /**
322
- * This method is invoked by KupManager whenever the component changes size.
323
- */
324
- async resizeCallback() {
325
- if (this.rootElement.clientWidth !== this.oldWidth) {
326
- window.clearTimeout(this.resizeTimeout);
327
- this.resizeTimeout = window.setTimeout(() => this.refresh(), 300);
328
- }
329
- }
330
- /**
331
- * Sets the props to the component.
332
- * @param {GenericObject} props - Object containing props that will be set to the component.
333
- */
334
- async setProps(props) {
335
- setProps(this, KupTreeProps, props);
336
- }
337
- /*-------------------------------------------------*/
338
- /* P r i v a t e M e t h o d s */
339
- /*-------------------------------------------------*/
340
- setTreeColumnVisibility(value) {
341
- this.treeColumnVisible = value;
342
- }
343
- isTreeColumnVisible() {
344
- return this.treeColumnVisible;
345
- }
346
- checkScrollOnHover() {
347
- if (!__classPrivateFieldGet(this, _KupTree_kupManager, "f").scrollOnHover.isRegistered(this.treeWrapperRef)) {
348
- if (this.scrollOnHover) {
349
- __classPrivateFieldGet(this, _KupTree_kupManager, "f").scrollOnHover.register(this.treeWrapperRef);
350
- }
351
- }
352
- else {
353
- if (!this.scrollOnHover) {
354
- __classPrivateFieldGet(this, _KupTree_kupManager, "f").scrollOnHover.unregister(this.treeWrapperRef);
355
- }
356
- }
357
- }
358
- onKupTreeNodeDblClick(treeNodeData, treeNodePath) {
359
- for (let index = 0; index < this.clickTimeout.length; index++) {
360
- clearTimeout(this.clickTimeout[index]);
361
- __classPrivateFieldGet(this, _KupTree_kupManager, "f").debug.logMessage(this, 'Cleared hdlTreeNodeClick timeout(' +
362
- this.clickTimeout[index] +
363
- ').');
364
- }
365
- this.clickTimeout = [];
366
- this.kupTreeNodeDblClick.emit({
367
- comp: this,
368
- id: this.rootElement.id,
369
- treeNodePath: treeNodePath
370
- .split(',')
371
- .map((treeNodeIndex) => parseInt(treeNodeIndex)),
372
- treeNode: treeNodeData,
373
- });
374
- }
375
- nodesToRows() {
376
- function children(TreeNode) {
377
- for (let index = 0; index < TreeNode.children.length; index++) {
378
- const node = TreeNode.children[index];
379
- rows.push({
380
- cells: TreeNode.children[index].cells,
381
- });
382
- if (node.children) {
383
- children(node);
384
- }
385
- }
386
- }
387
- let rows = [];
388
- for (let index = 0; index < this.data.length; index++) {
389
- const node = this.data[index];
390
- rows.push({
391
- cells: this.data[index].cells,
392
- });
393
- if (node.children) {
394
- children(this.data[index]);
395
- }
396
- }
397
- return rows;
398
- }
399
- setDynPosElements() {
400
- // Column menu
401
- if (this.columnMenuCard && this.columnMenuCard.data) {
402
- this.columnMenuCard.data = this.columnMenuInstance.prepData(this, getColumnByName(this.getVisibleColumns(), this.columnMenuAnchor), this.columnMenuCard.data);
403
- }
404
- }
405
- expandCollapseNode(treeNode, expandNode = false) {
406
- this.filtersTreeItemsInstance.expandCollapseNode(treeNode, expandNode);
407
- }
408
- expandCollapseAllNodes(treeNode, expandNode = false) {
409
- this.filtersTreeItemsInstance.expandCollapseAllNodes(treeNode, expandNode);
410
- }
411
- getColumns() {
412
- return this.columns ? this.columns : [{ title: '', name: '' }];
413
- }
414
- getSizedColumns() {
415
- let columns = this.getColumns();
416
- let sizedColumns = [];
417
- for (let j = 0; j < columns.length; j++) {
418
- if (columns[j].size !== null &&
419
- columns[j].size !== undefined &&
420
- columns[j].size !== '') {
421
- sizedColumns.push(columns[j]);
422
- }
423
- }
424
- if (sizedColumns.length > 0) {
425
- return sizedColumns;
426
- }
427
- else {
428
- return undefined;
429
- }
430
- }
431
- getVisibleColumns() {
432
- return this.getColumns().filter((column) => column.hasOwnProperty('visible') ? column.visible : true);
433
- }
434
- getHeadingColumns() {
435
- const firstColum = {
436
- name: treeMainColumnName,
437
- title: '',
438
- };
439
- const visibleColumns = this.getVisibleColumns();
440
- return [firstColum, ...visibleColumns];
441
- }
442
- /*
443
- *For launch the event when selected node
444
- */
445
- launchNodeEvent(treeNodePath, treeNode) {
446
- if (treeNodePath && treeNodePath.length > 0) {
447
- if (treeNodePath[0] != -1) {
448
- var tn = treeNode.children[treeNodePath[0]];
449
- if (!tn) {
450
- tn = treeNode;
451
- }
452
- if (treeNodePath.length > 1) {
453
- treeNodePath = treeNodePath.slice(1);
454
- this.launchNodeEvent(treeNodePath, tn);
455
- }
456
- else {
457
- this.hdlTreeNodeClick(null, tn, this.selectedNodeToString(this.selectedNode));
458
- }
459
- }
460
- }
461
- }
462
- openTotalMenu(column) {
463
- this.openedTotalMenu = column.name;
464
- }
465
- onTotalMenuOpen(column) {
466
- this.closeTotalMenu();
467
- this.openTotalMenu(column);
468
- }
469
- getEventDetails(path, e) {
470
- let isHeader, isBody, isFooter, td, th, tr, filterRemove;
471
- if (path) {
472
- for (let i = path.length - 1; i >= 0; i--) {
473
- let p = path[i];
474
- if (!p.tagName) {
475
- continue;
476
- }
477
- switch (p.tagName.toUpperCase()) {
478
- case 'THEAD': {
479
- isHeader = true;
480
- break;
481
- }
482
- case 'TBODY': {
483
- isBody = true;
484
- break;
485
- }
486
- case 'TFOOT': {
487
- isFooter = true;
488
- break;
489
- }
490
- case 'TD': {
491
- td = p;
492
- break;
493
- }
494
- case 'TH': {
495
- th = p;
496
- break;
497
- }
498
- case 'TR': {
499
- tr = p;
500
- break;
501
- }
502
- default: {
503
- if (p.classList.contains(KupThemeIconValues.FILTER_REMOVE.replace('--', ''))) {
504
- filterRemove = p;
505
- }
506
- break;
507
- }
508
- }
509
- }
510
- }
511
- let cell = null, column = null, row = null;
512
- if (isBody) {
513
- if (td) {
514
- cell = td['data-cell'];
515
- }
516
- if (tr) {
517
- row = tr['data-row'];
518
- }
519
- }
520
- if (isHeader || isBody || isFooter) {
521
- const columnName = td
522
- ? td.dataset.column
523
- : th
524
- ? th.dataset.column
525
- : null;
526
- if (columnName) {
527
- column = getColumnByName(this.getColumns(), columnName);
528
- }
529
- }
530
- return {
531
- area: isHeader
532
- ? 'header'
533
- : isBody
534
- ? 'body'
535
- : isFooter
536
- ? 'footer'
537
- : null,
538
- cell: cell ? cell : null,
539
- column: column ? column : null,
540
- filterRemove: filterRemove ? filterRemove : null,
541
- originalEvent: e,
542
- row: row ? row : null,
543
- td: td ? td : null,
544
- th: th ? th : null,
545
- tr: tr ? tr : null,
546
- };
547
- }
548
- contextMenuHandler(e) {
549
- e.preventDefault();
550
- const details = this.getEventDetails(__classPrivateFieldGet(this, _KupTree_kupManager, "f").getEventPath(e.target, this.rootElement), e);
551
- if (details.area === 'header') {
552
- if (details.th && details.column) {
553
- this.openColumnMenu(details.column.name);
554
- return details;
555
- }
556
- }
557
- else if (details.area === 'footer') {
558
- if (details.td && details.column) {
559
- this.totalMenuCoords = { x: e.clientX, y: e.clientY };
560
- this.onTotalMenuOpen(details.column);
561
- return details;
562
- }
563
- }
564
- return details;
565
- }
566
- // When a TreeNode can be selected
567
- hdlTreeNodeClick(e, treeNodeData, treeNodePath) {
568
- if (this.expansionMode.toLowerCase() ===
569
- KupTreeExpansionMode.DROPDOWN ||
570
- (this.expansionMode.toLowerCase() === KupTreeExpansionMode.NODE &&
571
- !treeNodeData.expandable)) {
572
- const td = e
573
- ? __classPrivateFieldGet(this, _KupTree_kupManager, "f")
574
- .getEventPath(e.target, this.rootElement)
575
- .find((el) => {
576
- if (el.tagName === 'TD')
577
- return el;
578
- })
579
- : null;
580
- // If this TreeNode is not disabled, then it can be selected and an event is emitted
581
- if (treeNodeData && !treeNodeData.disabled) {
582
- this.selectedNode = treeNodePath
583
- .split(',')
584
- .map((treeNodeIndex) => parseInt(treeNodeIndex));
585
- this.kupTreeNodeSelected.emit({
586
- comp: this,
587
- id: this.rootElement.id,
588
- treeNodePath: this.selectedNode,
589
- treeNode: treeNodeData,
590
- columnName: td ? td.dataset.column : null,
591
- });
592
- }
593
- }
594
- // If KupTreeExpansionMode.NODE then click is a collapse/expand click
595
- if (this.expansionMode.toLowerCase() === KupTreeExpansionMode.NODE) {
596
- this.hdlTreeNodeExpanderClick(treeNodeData, treeNodePath, e ? e.ctrlKey : false);
597
- }
598
- }
599
- // When a TreeNode must be expanded or closed.
600
- hdlTreeNodeExpanderClick(treeNodeData, treeNodePath, ctrlKey) {
601
- // If the node is expandable
602
- if (treeNodeData.expandable) {
603
- // Always composes the tree node path as an array
604
- const arrayTreeNodePath = treeNodePath
605
- .split(',')
606
- .map((index) => parseInt(index));
607
- // There are already children set in this TreeNode -> expand or collapse node and emit appropriate event
608
- if (treeNodeData.children && treeNodeData.children.length) {
609
- // Updates expanded state and force rerender
610
- treeNodeData.isExpanded = !treeNodeData.isExpanded;
611
- if (ctrlKey) {
612
- this.handleChildren(treeNodeData, treeNodeData.isExpanded);
613
- }
614
- this.refresh();
615
- if (treeNodeData.isExpanded) {
616
- // TreeNode is now expanded -> Fires expanded event
617
- this.kupTreeNodeExpand.emit({
618
- comp: this,
619
- id: this.rootElement.id,
620
- treeNodePath: arrayTreeNodePath,
621
- treeNode: treeNodeData,
622
- usesDynamicExpansion: this.useDynamicExpansion,
623
- });
624
- }
625
- else {
626
- // TreeNode is now collapsed -> Fires collapsed event
627
- this.kupTreeNodeCollapse.emit({
628
- comp: this,
629
- id: this.rootElement.id,
630
- treeNodePath: arrayTreeNodePath,
631
- treeNode: treeNodeData,
632
- });
633
- }
634
- }
635
- else if (this.useDynamicExpansion) {
636
- if (ctrlKey) {
637
- this.kupTreeDynamicMassExpansion.emit({
638
- comp: this,
639
- id: this.rootElement.id,
640
- treeNodePath: arrayTreeNodePath,
641
- treeNode: treeNodeData,
642
- });
643
- }
644
- // When the component must use the dynamic expansion feature
645
- // Currently it does not support the expanded prop
646
- // Checks if we have a dynamicExpansionCallback or not
647
- if (this.dynamicExpansionCallback) {
648
- // We have a callback: invokes it and after the result is returned updates the tree
649
- this.dynamicExpansionCallback(treeNodeData, arrayTreeNodePath)
650
- .then((childrenTreeNodes) => {
651
- // Children returned successfully
652
- treeNodeData.children = childrenTreeNodes;
653
- treeNodeData.isExpanded = !treeNodeData.isExpanded;
654
- this.refresh();
655
- // TreeNode is now expanded -> Fires expanded event
656
- this.kupTreeNodeExpand.emit({
657
- comp: this,
658
- id: this.rootElement.id,
659
- treeNodePath: arrayTreeNodePath,
660
- treeNode: treeNodeData,
661
- usesDynamicExpansion: true,
662
- });
663
- })
664
- .catch((err) => {
665
- console.error('KupTree: An error occurred when trying to fetch dynamicExpansion nodes data', err, treeNodeData);
666
- });
667
- }
668
- else {
669
- // we do NOT have a callback set.
670
- // Fires the expand request for the given TreeNode and set the appropriate flag
671
- this.kupTreeNodeExpand.emit({
672
- comp: this,
673
- id: this.rootElement.id,
674
- treeNode: treeNodeData,
675
- treeNodePath: arrayTreeNodePath,
676
- usesDynamicExpansion: true,
677
- dynamicExpansionRequireChildren: true,
678
- });
679
- treeNodeData.isExpanded = !treeNodeData.isExpanded;
680
- }
681
- }
682
- }
683
- }
684
- hasTotals() {
685
- return this.totals && Object.keys(this.totals).length > 0;
686
- }
687
- handleChildren(treeNode, expand) {
688
- for (let index = 0; index < treeNode.children.length; index++) {
689
- let node = treeNode.children[index];
690
- if (!node.disabled) {
691
- node.isExpanded = expand;
692
- if (node.children) {
693
- this.handleChildren(node, expand);
694
- }
695
- }
696
- }
697
- }
698
- /**
699
- * Given a nodePath, transform that array into
700
- * @param nodePath
701
- */
702
- selectedNodeToString(nodePath) {
703
- let strToRet = '';
704
- if (nodePath && nodePath.length) {
705
- strToRet = nodePath[0].toString();
706
- for (let i = 1; i < nodePath.length; i++) {
707
- strToRet += `,${nodePath[i]}`;
708
- }
709
- }
710
- return strToRet;
711
- }
712
- getFilterValueForTooltip(column) {
713
- return this.filtersColumnMenuInstance.getFilterValueForTooltip(this.filters, column);
714
- }
715
- getTreeNode(nodePath) {
716
- if (!nodePath || nodePath.length == 0) {
717
- return null;
718
- }
719
- let father = this.data;
720
- let node = null;
721
- for (let index = 0; index < nodePath.length; index++) {
722
- if (node) {
723
- father = node.children;
724
- }
725
- const nodeIndex = nodePath[index];
726
- node = father[nodeIndex];
727
- }
728
- return node;
729
- }
730
- onRemoveFilter(column) {
731
- const newFilters = Object.assign({}, this.filters);
732
- this.filtersColumnMenuInstance.removeFilter(newFilters, column.name);
733
- this.filters = newFilters;
734
- }
735
- onGlobalFilterChange({ detail }) {
736
- let value = '';
737
- if (detail && detail.value) {
738
- value = detail.value;
739
- }
740
- this.globalFilterValue = value;
741
- }
742
- getColumnValues(column) {
743
- return this.filtersTreeItemsInstance.getColumnValues(this, column, this.globalFilterValue, this.filtersColumnMenuInstance);
744
- }
745
- getRows() {
746
- return this.data ? this.data : [];
747
- }
748
- filterNodes() {
749
- let items = this.filtersTreeItemsInstance.filterRows(this.getRows(), this.filters, this.globalFilterValue, this.getColumns(), this.filtersColumnMenuInstance);
750
- this.visibleNodes = this.calculateVisibleNodes(items);
751
- }
752
- calculateVisibleNodes(items) {
753
- let count = 0;
754
- if (items) {
755
- items.forEach((element) => {
756
- if (element.visible) {
757
- count++;
758
- }
759
- count += this.calculateVisibleNodes(element.children);
760
- });
761
- }
762
- return count;
763
- }
764
- refreshStructureState() {
765
- if (this.data) {
766
- if (this.data.columns) {
767
- __classPrivateFieldGet(this, _KupTree_kupManager, "f").debug.logMessage(this, 'Detected KupDataDataset: setting up tree as grid.', KupDebugCategory.WARNING);
768
- const data = this.data;
769
- this.columns = data.columns;
770
- this.data = __classPrivateFieldGet(this, _KupTree_kupManager, "f").data.row.toNode(data);
771
- this.showColumns = true;
772
- this.showHeader = true;
773
- }
774
- // When the nodes must be expanded upon loading and the tree is not using a dynamicExpansion (and the current TreeNode is not disabled)
775
- // the default value of the treeExpandedPropName is set to true
776
- this.data.forEach((rootNode) => {
777
- this.expandCollapseAllNodes(rootNode, this.expanded && !this.useDynamicExpansion);
778
- });
779
- this.selectedNode = [];
780
- }
781
- }
782
- createIconElement(CSSClass, icon, iconColor) {
783
- if (icon.indexOf('.') > -1 ||
784
- icon.indexOf('/') > -1 ||
785
- icon.indexOf('\\') > -1) {
786
- CSSClass += ' is-image';
787
- return (h("span", { class: CSSClass }, h("img", { src: icon })));
788
- }
789
- else {
790
- let svg = `url('${getAssetPath(`./assets/svg/${icon}.svg`)}') no-repeat center`;
791
- CSSClass += ' kup-icon';
792
- let iconStyle = Object.assign(Object.assign({}, (iconColor ? { background: iconColor } : {})), { mask: svg, webkitMask: svg });
793
- return h("span", { style: iconStyle, class: CSSClass });
794
- }
795
- }
796
- getCellStyle(colName, cellStyle) {
797
- // Controls if there are columns with a specified width
798
- if (this.sizedColumns) {
799
- let colWidth = '';
800
- // Search if this column has a specified width
801
- for (let j = 0; j < this.sizedColumns.length; j++) {
802
- if (colName === this.sizedColumns[j].name) {
803
- colWidth = this.sizedColumns[j].size;
804
- break;
805
- }
806
- }
807
- // Specific width has been found
808
- if (colWidth) {
809
- if (!cellStyle) {
810
- cellStyle = {};
811
- }
812
- // Sets the width.
813
- cellStyle['max-width'] = colWidth;
814
- cellStyle['min-width'] = colWidth;
815
- cellStyle['width'] = colWidth;
816
- cellStyle['overflow'] = 'hidden';
817
- }
818
- }
819
- return cellStyle;
820
- }
821
- /**
822
- * Renders the header of the tree when it must be displayed as a table.
823
- * @returns An array of table header cells.
824
- */
825
- renderHeader() {
826
- return this.getHeadingColumns().map((column) => {
827
- if (!this.isTreeColumnVisible() &&
828
- column.name === treeMainColumnName)
829
- return;
830
- //---- Filter ----
831
- let filter = null;
832
- if (this.filtersColumnMenuInstance.hasFiltersForColumn(this.filters, column)) {
833
- const svgLabel = __classPrivateFieldGet(this, _KupTree_kupManager, "f").language.translate(KupLanguageGeneric.REMOVE_FILTERS) + `: '${this.getFilterValueForTooltip(column)}'`;
834
- /**
835
- * When column has a filter but filters must not be displayed, shows an icon to remove the filter.
836
- * Upon click, the filter gets removed.
837
- */
838
- filter = (h("span", { title: svgLabel, class: `kup-icon ${KupThemeIconValues.FILTER_REMOVE.replace('--', '')}`, onClick: (e) => {
839
- e.stopPropagation();
840
- this.onRemoveFilter(column);
841
- } }));
842
- }
843
- return (h("th", { "data-column": column.name, style: this.getCellStyle(column.name, null) }, h("span", { class: "column-title" }, column.title), filter));
844
- });
845
- }
846
- /**
847
- * Renders a content with a part highlighted.
848
- * NOTE: same in kup-accordion and in kup-tree
849
- */
850
- renderHighlightedContent(content, highlight, styleClass) {
851
- let contentSlices = [];
852
- if (highlight && content) {
853
- let contentPart = content;
854
- let end = contentPart
855
- .toLowerCase()
856
- .indexOf(highlight.toLowerCase());
857
- while (end > -1) {
858
- contentSlices.push(contentPart.substring(0, end));
859
- contentSlices.push(h("span", { class: styleClass + '--highlighted' }, contentPart.substring(end, end + highlight.length)));
860
- contentPart = contentPart.substring(end + highlight.length, contentPart.length);
861
- end = contentPart
862
- .toLowerCase()
863
- .indexOf(highlight.toLowerCase());
864
- }
865
- if (end < contentPart.length) {
866
- contentSlices.push(contentPart.substring(end, contentPart.length));
867
- }
868
- }
869
- else {
870
- contentSlices.push(content);
871
- }
872
- return (h("span", { class: styleClass, ref: (el) => this.contentRefs.push(el), title: this.preventXScroll ? content : null }, contentSlices));
873
- }
874
- /**
875
- * Given a KupTreeNode, reads through its data then composes and returns its JSX object.
876
- * @param treeNodeData - The KupTreeNode object to parse.
877
- * @param treeNodePath - A string containing the comma(,) separated indexes of the KupTreeNodes to use,
878
- * sorted from left to right, to access the current KupTreeNode starting from the data prop children object.
879
- * @param treeNodeDepth - An integer to keep track of the depth level of the current KupTreeNode. Used for indentation.
880
- * @returns The the JSX created from the current tree node.
881
- */
882
- renderTreeNode(treeNodeData, treeNodePath, treeNodeDepth = 0) {
883
- // Creates the indentation of the current element. Use a css variable to specify padding.
884
- let indent = treeNodeDepth ? (h("span", { class: "kup-tree__indent", style: {
885
- ['--kup_tree_node_depth']: this.asAccordion
886
- ? (treeNodeDepth - 1).toString()
887
- : treeNodeDepth.toString(),
888
- } })) : null;
889
- // If the tree node is expandable, adds the icon to show the expansion.
890
- // If expandable, also add the callback on the click action.
891
- // If it is not expandable, we simply add a placeholder with no icons.
892
- const hasExpandIcon = !!(treeNodeData.expandable &&
893
- ((treeNodeData.children && treeNodeData.children.length) ||
894
- this.useDynamicExpansion));
895
- let expandClass = 'expand-icon kup-tree__icon kup-tree__node__expander';
896
- if (hasExpandIcon) {
897
- expandClass += ' kup-icon';
898
- if (this.asAccordion && treeNodeDepth === 0) {
899
- expandClass += ` ${KupThemeIconValues.DROPDOWN.replace('--', '')}`;
900
- }
901
- else if (treeNodeData.isExpanded) {
902
- expandClass += ` ${KupThemeIconValues.EXPANDED.replace('--', '')}`;
903
- }
904
- else {
905
- expandClass += ` ${KupThemeIconValues.COLLAPSED.replace('--', '')}`;
906
- }
907
- }
908
- let treeExpandIcon = (h("span", { title: __classPrivateFieldGet(this, _KupTree_kupManager, "f").language.translate(KupLanguageGeneric.EXPAND) +
909
- '/' +
910
- __classPrivateFieldGet(this, _KupTree_kupManager, "f").language.translate(KupLanguageGeneric.COLLAPSE) +
911
- ' (CTRL + Click)', class: expandClass, onClick: this.expansionMode.toLowerCase() ===
912
- KupTreeExpansionMode.DROPDOWN && !treeNodeData.disabled
913
- ? (event) => {
914
- event.stopPropagation();
915
- this.hdlTreeNodeExpanderClick(treeNodeData, treeNodePath, event.ctrlKey);
916
- }
917
- : null }));
918
- // When TreeNode icons are visible, creates the icon if one is specified
919
- let treeNodeIcon = null;
920
- if (this.showIcons) {
921
- if (treeNodeData.icon) {
922
- if (treeNodeData.icon === '') {
923
- treeNodeIcon = h("span", { class: "kup-tree__icon" });
924
- }
925
- else {
926
- treeNodeIcon = this.createIconElement('kup-tree__icon', treeNodeData.icon, treeNodeData.iconColor);
927
- }
928
- }
929
- else {
930
- treeNodeIcon = null;
931
- }
932
- }
933
- // Composes additional options for the tree node element
934
- let treeNodeOptions = {};
935
- if (treeNodeData.hasOwnProperty('isExpanded') &&
936
- treeNodeData.isExpanded &&
937
- hasExpandIcon) {
938
- // If the node is expanded it has this attribute set to if this node is expanded or not.
939
- treeNodeOptions['data-is-expanded'] = treeNodeData.isExpanded;
940
- }
941
- // When can be expanded OR selected
942
- if (!treeNodeData.disabled) {
943
- treeNodeOptions['onClick'] = (e) => {
944
- // Note: event must be cloned
945
- // otherwise inside setTimeout will be exiting the Shadow DOM scope(causing loss of information, including target).
946
- const clone = {};
947
- for (const key in e) {
948
- clone[key] = e[key];
949
- }
950
- this.clickTimeout.push(setTimeout(() => this.hdlTreeNodeClick(clone, treeNodeData, treeNodePath), 300));
951
- };
952
- }
953
- // When a tree node is displayed as a table
954
- let treeNodeCells = null;
955
- let visibleCols = this.getVisibleColumns();
956
- if (this.showColumns && visibleCols && visibleCols.length) {
957
- treeNodeCells = [];
958
- // Renders all the cells
959
- for (let j = 0; j < visibleCols.length; j++) {
960
- const column = visibleCols[j];
961
- if (treeNodeData.cells && treeNodeData.cells[column.name]) {
962
- const cell = treeNodeData.cells[column.name]
963
- ? treeNodeData.cells[column.name]
964
- : null;
965
- const cellProps = {
966
- cell: cell,
967
- column: column,
968
- component: this,
969
- density: this.density,
970
- editable: this.editableData,
971
- renderKup: true,
972
- row: treeNodeData,
973
- setSizes: true,
974
- };
975
- treeNodeCells.push(h("td", { class: `grid-cell`, "data-cell": cell, "data-column": column.name }, h(FCell, Object.assign({}, cellProps))));
976
- }
977
- else {
978
- treeNodeCells.push(h("td", { class: `grid-cell` }));
979
- }
980
- }
981
- }
982
- let title = undefined;
983
- if (!__classPrivateFieldGet(this, _KupTree_kupManager, "f").objects.isEmptyKupObj(treeNodeData.obj) &&
984
- __classPrivateFieldGet(this, _KupTree_kupManager, "f").debug.isDebug()) {
985
- title =
986
- treeNodeData.obj.t +
987
- '; ' +
988
- treeNodeData.obj.p +
989
- '; ' +
990
- treeNodeData.obj.k +
991
- ';';
992
- }
993
- let treeNodeCell = null;
994
- if (this.isTreeColumnVisible()) {
995
- let content = '';
996
- if (KupGlobalFilterMode.HIGHLIGHT === this.globalFilterMode) {
997
- content = this.renderHighlightedContent(treeNodeData.value, this.globalFilterValue, 'cell-content');
998
- }
999
- else {
1000
- content = (h("span", { ref: (el) => this.contentRefs.push(el), class: "cell-content", title: this.preventXScroll ? treeNodeData.value : null }, treeNodeData.value));
1001
- }
1002
- treeNodeCell = (h("td", { class: {
1003
- 'first-node': treeNodeDepth === 0 ? true : false,
1004
- 'mdc-ripple-surface': this.ripple &&
1005
- !this.showColumns &&
1006
- !treeNodeData.disabled,
1007
- 'is-obj': !__classPrivateFieldGet(this, _KupTree_kupManager, "f").objects.isEmptyKupObj(treeNodeData.obj),
1008
- }, style: treeNodeData.style || null, title: title, onDblClick: () => {
1009
- this.onKupTreeNodeDblClick(treeNodeData, treeNodePath);
1010
- } }, this.asAccordion && !treeNodeDepth
1011
- ? [
1012
- treeNodeIcon,
1013
- content,
1014
- hasExpandIcon ? treeExpandIcon : null,
1015
- ]
1016
- : [indent, treeExpandIcon, treeNodeIcon, content]));
1017
- }
1018
- return (h("tr", Object.assign({ class: {
1019
- 'kup-tree__node': true,
1020
- 'with-dyn': !treeNodeData.disabled,
1021
- 'kup-tree__node--disabled': treeNodeData.disabled,
1022
- 'kup-tree__node--first': treeNodeDepth ? false : true,
1023
- 'kup-tree__node--selected': !treeNodeData.disabled &&
1024
- treeNodePath ===
1025
- this.selectedNodeToString(this.selectedNode),
1026
- }, "data-row": treeNodeData, "data-tree-path": treeNodePath }, treeNodeOptions), treeNodeCell, treeNodeCells));
1027
- }
1028
- closeTotalMenu() {
1029
- this.openedTotalMenu = null;
1030
- __classPrivateFieldGet(this, _KupTree_kupManager, "f").removeClickCallback(this.clickCb);
1031
- }
1032
- isOpenedTotalMenuForColumn(column) {
1033
- return this.openedTotalMenu === column;
1034
- }
1035
- onTotalsChange(event, column) {
1036
- // close menu
1037
- this.closeTotalMenu();
1038
- if (column) {
1039
- // must do this
1040
- // otherwise does not fire the watcher
1041
- const totalsCopy = Object.assign({}, this.totals);
1042
- const value = event.detail.selected.id;
1043
- if (value === TotalLabel.CANC) {
1044
- if (this.totals && this.totals[column.name]) {
1045
- delete totalsCopy[column.name];
1046
- }
1047
- }
1048
- else {
1049
- totalsCopy[column.name] = value;
1050
- }
1051
- this.totals = totalsCopy;
1052
- }
1053
- }
1054
- renderFooter() {
1055
- const nodesCell = h("td", null);
1056
- const footerCells = this.getVisibleColumns().map((column) => {
1057
- let totalMenu = undefined;
1058
- let menuLabel = TotalLabel.CALC;
1059
- const translation = {
1060
- [TotalLabel.AVERAGE]: __classPrivateFieldGet(this, _KupTree_kupManager, "f").language.translate(KupLanguageTotals.AVERAGE),
1061
- [TotalLabel.CALC]: __classPrivateFieldGet(this, _KupTree_kupManager, "f").language.translate(KupLanguageTotals.CALCULATE),
1062
- [TotalLabel.CANC]: __classPrivateFieldGet(this, _KupTree_kupManager, "f").language.translate(KupLanguageTotals.CANCEL),
1063
- [TotalLabel.COUNT]: __classPrivateFieldGet(this, _KupTree_kupManager, "f").language.translate(KupLanguageTotals.COUNT),
1064
- [TotalLabel.DISTINCT]: __classPrivateFieldGet(this, _KupTree_kupManager, "f").language.translate(KupLanguageTotals.DISTINCT),
1065
- [TotalLabel.MATH]: __classPrivateFieldGet(this, _KupTree_kupManager, "f").language.translate(KupLanguageTotals.FORMULA),
1066
- [TotalLabel.MAX]: __classPrivateFieldGet(this, _KupTree_kupManager, "f").language.translate(KupLanguageTotals.MAXIMUM),
1067
- [TotalLabel.MIN]: __classPrivateFieldGet(this, _KupTree_kupManager, "f").language.translate(KupLanguageTotals.MINIMUM),
1068
- [TotalLabel.SUM]: __classPrivateFieldGet(this, _KupTree_kupManager, "f").language.translate(KupLanguageTotals.SUM),
1069
- };
1070
- if (this.totals) {
1071
- const totalValue = this.totals[column.name];
1072
- if (totalValue) {
1073
- if (totalValue.startsWith(TotalMode.MATH)) {
1074
- menuLabel = TotalLabel.MATH;
1075
- }
1076
- else {
1077
- switch (totalValue) {
1078
- case TotalMode.COUNT:
1079
- menuLabel = TotalLabel.COUNT;
1080
- break;
1081
- case TotalMode.DISTINCT:
1082
- menuLabel = TotalLabel.DISTINCT;
1083
- break;
1084
- case TotalMode.SUM:
1085
- menuLabel = TotalLabel.SUM;
1086
- break;
1087
- case TotalMode.AVERAGE:
1088
- menuLabel = TotalLabel.AVERAGE;
1089
- break;
1090
- case TotalMode.MIN:
1091
- menuLabel = TotalLabel.MIN;
1092
- break;
1093
- case TotalMode.MAX:
1094
- menuLabel = TotalLabel.MAX;
1095
- break;
1096
- default:
1097
- break;
1098
- }
1099
- }
1100
- }
1101
- }
1102
- if (this.isOpenedTotalMenuForColumn(column.name)) {
1103
- let listData = [
1104
- {
1105
- id: TotalMode.COUNT,
1106
- value: translation[TotalLabel.COUNT],
1107
- },
1108
- {
1109
- id: TotalMode.DISTINCT,
1110
- value: translation[TotalLabel.DISTINCT],
1111
- },
1112
- ];
1113
- if (__classPrivateFieldGet(this, _KupTree_kupManager, "f").objects.isNumber(column.obj)) {
1114
- listData.push({
1115
- id: TotalMode.SUM,
1116
- value: translation[TotalLabel.SUM],
1117
- }, {
1118
- id: TotalMode.AVERAGE,
1119
- value: translation[TotalLabel.AVERAGE],
1120
- }, {
1121
- id: TotalMode.MIN,
1122
- value: translation[TotalLabel.MIN],
1123
- }, {
1124
- id: TotalMode.MAX,
1125
- value: translation[TotalLabel.MAX],
1126
- });
1127
- }
1128
- let selectedItem = listData.find((item) => item.value === menuLabel);
1129
- if (selectedItem) {
1130
- selectedItem.selected = true;
1131
- listData.push({
1132
- id: TotalLabel.CANC,
1133
- separator: true,
1134
- value: translation[TotalLabel.CANC],
1135
- });
1136
- }
1137
- totalMenu = (h("kup-list", { class: `total-menu`, data: listData, id: "totals-menu", "is-menu": true, keyboardNavigation: true, "menu-visible": true, "onkup-list-click": (event) => this.onTotalsChange(event, column) }));
1138
- }
1139
- let value;
1140
- if (menuLabel === TotalLabel.COUNT ||
1141
- menuLabel === TotalLabel.DISTINCT) {
1142
- value = this.footer[column.name];
1143
- }
1144
- else {
1145
- value = __classPrivateFieldGet(this, _KupTree_kupManager, "f").math.numberToFormattedString(this.footer[column.name], column.decimals, column.obj ? column.obj.p : '');
1146
- }
1147
- return (h("td", { "data-column": column.name }, totalMenu, h("span", { class: "totals-value", title: translation[menuLabel] }, value)));
1148
- });
1149
- return (h("tfoot", null, h("tr", null, nodesCell, footerCells)));
1150
- }
1151
- didLoadInteractables() {
1152
- this.interactableTouch.push(this.treeWrapperRef);
1153
- const tapCb = (e) => {
1154
- if (this.hold) {
1155
- this.hold = false;
1156
- return;
1157
- }
1158
- switch (e.button) {
1159
- // right click
1160
- case 2:
1161
- this.kupTreeContextMenu.emit({
1162
- comp: this,
1163
- id: this.rootElement.id,
1164
- details: this.contextMenuHandler(e),
1165
- });
1166
- break;
1167
- }
1168
- };
1169
- const holdCb = (e) => {
1170
- if (e.pointerType === 'pen' || e.pointerType === 'touch') {
1171
- this.hold = true;
1172
- this.kupTreeContextMenu.emit({
1173
- comp: this,
1174
- id: this.rootElement.id,
1175
- details: this.contextMenuHandler(e),
1176
- });
1177
- }
1178
- };
1179
- __classPrivateFieldGet(this, _KupTree_kupManager, "f").interact.on(this.treeWrapperRef, KupPointerEventTypes.TAP, tapCb);
1180
- __classPrivateFieldGet(this, _KupTree_kupManager, "f").interact.on(this.treeWrapperRef, KupPointerEventTypes.HOLD, holdCb);
1181
- }
1182
- totalMenuPosition() {
1183
- if (this.rootElement.shadowRoot) {
1184
- const menu = this.rootElement.shadowRoot.querySelector('#totals-menu');
1185
- if (menu) {
1186
- __classPrivateFieldGet(this, _KupTree_kupManager, "f").dynamicPosition.register(menu, this.totalMenuCoords);
1187
- if (!this.clickCb) {
1188
- this.clickCb = {
1189
- cb: () => {
1190
- this.closeTotalMenu();
1191
- __classPrivateFieldGet(this, _KupTree_kupManager, "f").dynamicPosition.stop(menu);
1192
- },
1193
- el: menu,
1194
- };
1195
- }
1196
- __classPrivateFieldGet(this, _KupTree_kupManager, "f").addClickCallback(this.clickCb, true);
1197
- __classPrivateFieldGet(this, _KupTree_kupManager, "f").dynamicPosition.start(menu);
1198
- menu.menuVisible = true;
1199
- }
1200
- }
1201
- }
1202
- /**
1203
- * Given a KupTreeNode, reads through its data to compose and return the KupTreeNodes of the root of this KupTreeNode
1204
- * and its children nodes, composing an array of JSX KupTreeNodes.
1205
- * @param treeNodeData - The KupTreeNode object to parse.
1206
- * @param treeNodePath - A string containing the comma(,) separated indexes of the KupTreeNodes to use,
1207
- * sorted from left to right, to access the current KupTreeNode starting from the data prop children object.
1208
- * @param treeNodeDepth - An integer to keep track of the depth level of the current KupTreeNode. Used for indentation.
1209
- * @returns An array of JSX KupTreeNodes created from the given treeNodeData.
1210
- */
1211
- renderTree(treeNodeData, treeNodePath, treeNodeDepth = 0) {
1212
- let treeNodes = [];
1213
- if (treeNodeData && treeNodeData.visible == true) {
1214
- // Creates and adds the root of the current tree
1215
- treeNodes.push(this.renderTreeNode(treeNodeData, treeNodePath, treeNodeDepth));
1216
- // Checks if the current node can be expanded, has children object, has children and is expanded
1217
- if (treeNodeData.expandable &&
1218
- treeNodeData.children &&
1219
- treeNodeData.children.length &&
1220
- treeNodeData.isExpanded) {
1221
- for (let i = 0; i < treeNodeData.children.length; i++) {
1222
- treeNodes = treeNodes.concat(this.renderTree(treeNodeData.children[i], treeNodePath + ',' + i, treeNodeDepth + 1));
1223
- }
1224
- }
1225
- }
1226
- return treeNodes;
1227
- }
1228
- setEllipsis() {
1229
- const treeRect = this.rootElement.getBoundingClientRect();
1230
- for (let index = 0; index < this.contentRefs.length; index++) {
1231
- const content = this.contentRefs[index];
1232
- if (content) {
1233
- const cell = content.parentNode;
1234
- if (this.asAccordion && cell.classList.contains('first-node')) {
1235
- cell.style.width = treeRect.width + 'px';
1236
- }
1237
- else {
1238
- content.classList.remove('cell-content--ellipsis');
1239
- content.style.setProperty('--kup_tree_content_width', ``);
1240
- const rect = content.getBoundingClientRect();
1241
- if (rect.right > treeRect.right) {
1242
- const failsafeOffset = 5;
1243
- const delta = rect.right - treeRect.right;
1244
- content.classList.add('cell-content--ellipsis');
1245
- content.style.setProperty('--kup_tree_content_width', `${rect.width - delta - failsafeOffset}px`);
1246
- }
1247
- }
1248
- }
1249
- }
1250
- }
1251
- /*-------------------------------------------------*/
1252
- /* L i f e c y c l e H o o k s */
1253
- /*-------------------------------------------------*/
1254
- componentWillLoad() {
1255
- __classPrivateFieldGet(this, _KupTree_kupManager, "f").debug.logLoad(this, false);
1256
- __classPrivateFieldGet(this, _KupTree_kupManager, "f").language.register(this);
1257
- __classPrivateFieldGet(this, _KupTree_kupManager, "f").theme.register(this);
1258
- this.columnMenuInstance = new KupColumnMenu();
1259
- this.refreshStructureState();
1260
- }
1261
- componentDidLoad() {
1262
- this.didLoadInteractables();
1263
- this.kupDidLoad.emit({ comp: this, id: this.rootElement.id });
1264
- __classPrivateFieldGet(this, _KupTree_kupManager, "f").resize.observe(this.rootElement);
1265
- __classPrivateFieldGet(this, _KupTree_kupManager, "f").debug.logLoad(this, true);
1266
- }
1267
- componentWillRender() {
1268
- __classPrivateFieldGet(this, _KupTree_kupManager, "f").debug.logRender(this, false);
1269
- if (this.showFooter && this.columns) {
1270
- this.footer = calcTotals(normalizeRows(this.getColumns(), this.nodesToRows()), this.totals);
1271
- }
1272
- this.filterNodes();
1273
- }
1274
- componentDidRender() {
1275
- const root = this.rootElement.shadowRoot;
1276
- if (root && this.ripple) {
1277
- const rippleCells = root.querySelectorAll('.mdc-ripple-surface:not(.mdc-ripple-upgraded)');
1278
- if (rippleCells) {
1279
- for (let i = 0; i < rippleCells.length; i++) {
1280
- MDCRipple.attachTo(rippleCells[i]);
1281
- }
1282
- }
1283
- }
1284
- if (root) {
1285
- const fs = root.querySelectorAll('.f-text-field');
1286
- for (let index = 0; index < fs.length; index++) {
1287
- FTextFieldMDC(fs[index]);
1288
- }
1289
- }
1290
- if (this.preventXScroll) {
1291
- this.setEllipsis();
1292
- }
1293
- this.totalMenuPosition();
1294
- this.checkScrollOnHover();
1295
- this.setDynPosElements();
1296
- // *** Store
1297
- this.persistState();
1298
- // ***
1299
- this.oldWidth = this.rootElement.clientWidth;
1300
- __classPrivateFieldGet(this, _KupTree_kupManager, "f").debug.logRender(this, true);
1301
- }
1302
- render() {
1303
- this.contentRefs = [];
1304
- this.sizedColumns = this.getSizedColumns();
1305
- let wrapperClass = 'density-medium';
1306
- switch (this.density) {
1307
- case FCellPadding.DENSE:
1308
- wrapperClass = 'density-dense';
1309
- break;
1310
- case FCellPadding.WIDE:
1311
- wrapperClass = 'density-wide';
1312
- break;
1313
- }
1314
- // Composes TreeNodes
1315
- let treeNodes = [];
1316
- if (this.data && this.data.length) {
1317
- this.data.forEach((zeroDepthNode, index) => {
1318
- treeNodes = treeNodes.concat(this.renderTree(zeroDepthNode, index.toString()));
1319
- });
1320
- }
1321
- else {
1322
- // There are no TreeNodes, so we print a single cell with a caption
1323
- treeNodes.push(h("tr", null, h("td", null, __classPrivateFieldGet(this, _KupTree_kupManager, "f").language.translate(KupLanguageGeneric.EMPTY_DATA))));
1324
- }
1325
- // Calculates if header must be shown or not
1326
- const visibleHeader = this.showHeader && this.showColumns;
1327
- let filterField = null;
1328
- if (this.globalFilter &&
1329
- this.data &&
1330
- this.data.length &&
1331
- this.data.length > 0) {
1332
- filterField = (h("div", { id: "global-filter" }, h("kup-text-field", { fullWidth: true, label: __classPrivateFieldGet(this, _KupTree_kupManager, "f").language.translate(KupLanguageSearch.SEARCH), icon: KupThemeIconValues.SEARCH, initialValue: this.globalFilterValue, "onkup-textfield-input": (event) => {
1333
- window.clearTimeout(this.globalFilterTimeout);
1334
- this.globalFilterTimeout = window.setTimeout(() => this.onGlobalFilterChange(event), 600);
1335
- } })));
1336
- }
1337
- return (h(Host, null, h("style", null, __classPrivateFieldGet(this, _KupTree_kupManager, "f").theme.setKupStyle(this.rootElement)), h("div", { id: componentWrapperId, class: wrapperClass }, filterField, h("div", { class: "wrapper", ref: (el) => (this.treeWrapperRef =
1338
- el) }, h("table", { class: "kup-tree", "data-show-columns": this.showColumns, onContextMenu: (e) => {
1339
- e.preventDefault();
1340
- } }, h("thead", { class: {
1341
- 'header--is-visible': visibleHeader,
1342
- } }, h("tr", null, visibleHeader ? this.renderHeader() : null)), h("tbody", null, treeNodes), (this.showFooter || this.hasTotals()) &&
1343
- this.columns
1344
- ? this.renderFooter()
1345
- : null)))));
1346
- }
1347
- disconnectedCallback() {
1348
- __classPrivateFieldGet(this, _KupTree_kupManager, "f").language.register(this);
1349
- __classPrivateFieldGet(this, _KupTree_kupManager, "f").resize.unobserve(this.rootElement);
1350
- __classPrivateFieldGet(this, _KupTree_kupManager, "f").theme.unregister(this);
1351
- const dynamicPositionElements = this.rootElement.shadowRoot.querySelectorAll('[' + kupDynamicPositionAttribute + ']');
1352
- if (dynamicPositionElements.length > 0) {
1353
- __classPrivateFieldGet(this, _KupTree_kupManager, "f").dynamicPosition.unregister(Array.prototype.slice.call(dynamicPositionElements));
1354
- }
1355
- if (this.columnMenuCard) {
1356
- this.columnMenuCard.remove();
1357
- }
1358
- if (this.scrollOnHover) {
1359
- __classPrivateFieldGet(this, _KupTree_kupManager, "f").scrollOnHover.unregister(this.treeWrapperRef);
1360
- }
1361
- this.kupDidUnload.emit({ comp: this, id: this.rootElement.id });
1362
- }
1363
- static get is() { return "kup-tree"; }
1364
- static get encapsulation() { return "shadow"; }
1365
- static get originalStyleUrls() {
1366
- return {
1367
- "$": ["kup-tree.scss"]
1368
- };
1369
- }
1370
- static get styleUrls() {
1371
- return {
1372
- "$": ["kup-tree.css"]
1373
- };
1374
- }
1375
- static get properties() {
1376
- return {
1377
- "asAccordion": {
1378
- "type": "boolean",
1379
- "mutable": false,
1380
- "complexType": {
1381
- "original": "boolean",
1382
- "resolved": "boolean",
1383
- "references": {}
1384
- },
1385
- "required": false,
1386
- "optional": false,
1387
- "docs": {
1388
- "tags": [{
1389
- "name": "default",
1390
- "text": "false"
1391
- }],
1392
- "text": "When enabled, the first level of depth will give an accordion look to nodes."
1393
- },
1394
- "attribute": "as-accordion",
1395
- "reflect": true,
1396
- "defaultValue": "false"
1397
- },
1398
- "columns": {
1399
- "type": "unknown",
1400
- "mutable": true,
1401
- "complexType": {
1402
- "original": "KupDataColumn[]",
1403
- "resolved": "KupDataColumn[]",
1404
- "references": {
1405
- "KupDataColumn": {
1406
- "location": "import",
1407
- "path": "../../managers/kup-data/kup-data-declarations"
1408
- }
1409
- }
1410
- },
1411
- "required": false,
1412
- "optional": true,
1413
- "docs": {
1414
- "tags": [],
1415
- "text": "The columns of the tree when tree visualization is active."
1416
- }
1417
- },
1418
- "customStyle": {
1419
- "type": "string",
1420
- "mutable": false,
1421
- "complexType": {
1422
- "original": "string",
1423
- "resolved": "string",
1424
- "references": {}
1425
- },
1426
- "required": false,
1427
- "optional": false,
1428
- "docs": {
1429
- "tags": [{
1430
- "name": "default",
1431
- "text": "\"\""
1432
- }, {
1433
- "name": "see",
1434
- "text": "https://ketchup.smeup.com/ketchup-showcase/#/customization"
1435
- }],
1436
- "text": "Custom style of the component."
1437
- },
1438
- "attribute": "custom-style",
1439
- "reflect": false,
1440
- "defaultValue": "''"
1441
- },
1442
- "data": {
1443
- "type": "unknown",
1444
- "mutable": true,
1445
- "complexType": {
1446
- "original": "KupTreeNode[]",
1447
- "resolved": "KupTreeNode[]",
1448
- "references": {
1449
- "KupTreeNode": {
1450
- "location": "import",
1451
- "path": "./kup-tree-declarations"
1452
- }
1453
- }
1454
- },
1455
- "required": false,
1456
- "optional": false,
1457
- "docs": {
1458
- "tags": [],
1459
- "text": "The json data used to populate the tree view: the basic, always visible tree nodes."
1460
- },
1461
- "defaultValue": "[]"
1462
- },
1463
- "density": {
1464
- "type": "string",
1465
- "mutable": false,
1466
- "complexType": {
1467
- "original": "FCellPadding",
1468
- "resolved": "FCellPadding.DENSE | FCellPadding.MEDIUM | FCellPadding.NONE | FCellPadding.WIDE",
1469
- "references": {
1470
- "FCellPadding": {
1471
- "location": "import",
1472
- "path": "../../f-components/f-cell/f-cell-declarations"
1473
- }
1474
- }
1475
- },
1476
- "required": false,
1477
- "optional": false,
1478
- "docs": {
1479
- "tags": [],
1480
- "text": "The density of the rows, defaults at 'medium' and can also be set to 'dense' or 'wide'."
1481
- },
1482
- "attribute": "density",
1483
- "reflect": false,
1484
- "defaultValue": "FCellPadding.MEDIUM"
1485
- },
1486
- "dynamicExpansionCallback": {
1487
- "type": "unknown",
1488
- "mutable": false,
1489
- "complexType": {
1490
- "original": "(\r\n treeNodeToExpand: KupTreeNode,\r\n treeNodePath: TreeNodePath\r\n ) => Promise<KupTreeNode[]> | undefined",
1491
- "resolved": "(treeNodeToExpand: KupTreeNode, treeNodePath: TreeNodePath) => Promise<KupTreeNode[]>",
1492
- "references": {
1493
- "KupTreeNode": {
1494
- "location": "import",
1495
- "path": "./kup-tree-declarations"
1496
- },
1497
- "TreeNodePath": {
1498
- "location": "import",
1499
- "path": "./kup-tree-declarations"
1500
- },
1501
- "Promise": {
1502
- "location": "global"
1503
- }
1504
- }
1505
- },
1506
- "required": false,
1507
- "optional": false,
1508
- "docs": {
1509
- "tags": [{
1510
- "name": "see",
1511
- "text": "useDynamicExpansion"
1512
- }],
1513
- "text": "Function that gets invoked when a new set of nodes must be loaded as children of a node.\r\n\r\nWhen useDynamicExpansion is set, the tree component will have two different behaviors depending on the value of this prop.\r\n1 - If this prop is set to null, no callback to download data is available:\r\n the component will emit an event requiring the parent to load the children of the given node.\r\n2 - If this prop is set to have a callback, then the component will automatically make requests to load children of\r\n a given node. After the load has been completed, a different event will be fired to alert the parent of the change."
1514
- },
1515
- "defaultValue": "undefined"
1516
- },
1517
- "editableData": {
1518
- "type": "boolean",
1519
- "mutable": false,
1520
- "complexType": {
1521
- "original": "boolean",
1522
- "resolved": "boolean",
1523
- "references": {}
1524
- },
1525
- "required": false,
1526
- "optional": false,
1527
- "docs": {
1528
- "tags": [{
1529
- "name": "default",
1530
- "text": "false"
1531
- }],
1532
- "text": "When set to true, editable cells will be rendered using input components."
1533
- },
1534
- "attribute": "editable-data",
1535
- "reflect": false,
1536
- "defaultValue": "false"
1537
- },
1538
- "enableExtraColumns": {
1539
- "type": "boolean",
1540
- "mutable": false,
1541
- "complexType": {
1542
- "original": "boolean",
1543
- "resolved": "boolean",
1544
- "references": {}
1545
- },
1546
- "required": false,
1547
- "optional": false,
1548
- "docs": {
1549
- "tags": [],
1550
- "text": "Enables the extracolumns add buttons."
1551
- },
1552
- "attribute": "enable-extra-columns",
1553
- "reflect": false,
1554
- "defaultValue": "true"
1555
- },
1556
- "expanded": {
1557
- "type": "boolean",
1558
- "mutable": false,
1559
- "complexType": {
1560
- "original": "boolean",
1561
- "resolved": "boolean",
1562
- "references": {}
1563
- },
1564
- "required": false,
1565
- "optional": false,
1566
- "docs": {
1567
- "tags": [],
1568
- "text": "Flag: the nodes of the whole tree must be already expanded upon loading. Disabled nodes do NOT get expanded."
1569
- },
1570
- "attribute": "expanded",
1571
- "reflect": false,
1572
- "defaultValue": "false"
1573
- },
1574
- "expansionMode": {
1575
- "type": "string",
1576
- "mutable": false,
1577
- "complexType": {
1578
- "original": "KupTreeExpansionMode",
1579
- "resolved": "KupTreeExpansionMode.DROPDOWN | KupTreeExpansionMode.NODE",
1580
- "references": {
1581
- "KupTreeExpansionMode": {
1582
- "location": "import",
1583
- "path": "./kup-tree-declarations"
1584
- }
1585
- }
1586
- },
1587
- "required": false,
1588
- "optional": false,
1589
- "docs": {
1590
- "tags": [{
1591
- "name": "default",
1592
- "text": "KupTreeExpansionMode.DROPDOWN"
1593
- }],
1594
- "text": "Behavior of nodes' expansion: it can be chosen between expanding a node by clicking on the dropdown icon, or by clicking on the whole node."
1595
- },
1596
- "attribute": "expansion-mode",
1597
- "reflect": false,
1598
- "defaultValue": "KupTreeExpansionMode.DROPDOWN"
1599
- },
1600
- "filters": {
1601
- "type": "unknown",
1602
- "mutable": true,
1603
- "complexType": {
1604
- "original": "GenericFilter",
1605
- "resolved": "GenericFilter",
1606
- "references": {
1607
- "GenericFilter": {
1608
- "location": "import",
1609
- "path": "../../utils/filters/filters-declarations"
1610
- }
1611
- }
1612
- },
1613
- "required": false,
1614
- "optional": false,
1615
- "docs": {
1616
- "tags": [],
1617
- "text": "List of filters set by the user."
1618
- },
1619
- "defaultValue": "{}"
1620
- },
1621
- "globalFilter": {
1622
- "type": "boolean",
1623
- "mutable": false,
1624
- "complexType": {
1625
- "original": "boolean",
1626
- "resolved": "boolean",
1627
- "references": {}
1628
- },
1629
- "required": false,
1630
- "optional": false,
1631
- "docs": {
1632
- "tags": [],
1633
- "text": "When set to true it activates the global filter."
1634
- },
1635
- "attribute": "global-filter",
1636
- "reflect": false,
1637
- "defaultValue": "false"
1638
- },
1639
- "globalFilterValue": {
1640
- "type": "string",
1641
- "mutable": true,
1642
- "complexType": {
1643
- "original": "string",
1644
- "resolved": "string",
1645
- "references": {}
1646
- },
1647
- "required": false,
1648
- "optional": false,
1649
- "docs": {
1650
- "tags": [],
1651
- "text": "The value of the global filter."
1652
- },
1653
- "attribute": "global-filter-value",
1654
- "reflect": true,
1655
- "defaultValue": "''"
1656
- },
1657
- "globalFilterMode": {
1658
- "type": "string",
1659
- "mutable": false,
1660
- "complexType": {
1661
- "original": "KupGlobalFilterMode",
1662
- "resolved": "KupGlobalFilterMode.HIGHLIGHT | KupGlobalFilterMode.SIMPLE",
1663
- "references": {
1664
- "KupGlobalFilterMode": {
1665
- "location": "import",
1666
- "path": "../../utils/filters/filters-declarations"
1667
- }
1668
- }
1669
- },
1670
- "required": false,
1671
- "optional": false,
1672
- "docs": {
1673
- "tags": [],
1674
- "text": "The mode of the global filter (default SIMPLE)"
1675
- },
1676
- "attribute": "global-filter-mode",
1677
- "reflect": false,
1678
- "defaultValue": "KupGlobalFilterMode.SIMPLE"
1679
- },
1680
- "preventXScroll": {
1681
- "type": "boolean",
1682
- "mutable": false,
1683
- "complexType": {
1684
- "original": "boolean",
1685
- "resolved": "boolean",
1686
- "references": {}
1687
- },
1688
- "required": false,
1689
- "optional": false,
1690
- "docs": {
1691
- "tags": [{
1692
- "name": "default",
1693
- "text": "false;"
1694
- }],
1695
- "text": "Experimental feature: when active, the tree will try to prevent horizontal overflowing elements by setting a width on the content of the table cells.\r\nIt works only on cells of the main column."
1696
- },
1697
- "attribute": "prevent-x-scroll",
1698
- "reflect": true,
1699
- "defaultValue": "false"
1700
- },
1701
- "removableColumns": {
1702
- "type": "boolean",
1703
- "mutable": false,
1704
- "complexType": {
1705
- "original": "boolean",
1706
- "resolved": "boolean",
1707
- "references": {}
1708
- },
1709
- "required": false,
1710
- "optional": false,
1711
- "docs": {
1712
- "tags": [],
1713
- "text": "Sets the possibility to remove the selected column."
1714
- },
1715
- "attribute": "removable-columns",
1716
- "reflect": false,
1717
- "defaultValue": "true"
1718
- },
1719
- "ripple": {
1720
- "type": "boolean",
1721
- "mutable": false,
1722
- "complexType": {
1723
- "original": "boolean",
1724
- "resolved": "boolean",
1725
- "references": {}
1726
- },
1727
- "required": false,
1728
- "optional": false,
1729
- "docs": {
1730
- "tags": [{
1731
- "name": "default",
1732
- "text": "true"
1733
- }],
1734
- "text": "When enabled displays Material's ripple effect on nodes (only when no columns are displayed)."
1735
- },
1736
- "attribute": "ripple",
1737
- "reflect": false,
1738
- "defaultValue": "true"
1739
- },
1740
- "scrollOnHover": {
1741
- "type": "boolean",
1742
- "mutable": false,
1743
- "complexType": {
1744
- "original": "boolean",
1745
- "resolved": "boolean",
1746
- "references": {}
1747
- },
1748
- "required": false,
1749
- "optional": false,
1750
- "docs": {
1751
- "tags": [],
1752
- "text": "Activates the scroll on hover function."
1753
- },
1754
- "attribute": "scroll-on-hover",
1755
- "reflect": false,
1756
- "defaultValue": "false"
1757
- },
1758
- "showColumns": {
1759
- "type": "boolean",
1760
- "mutable": true,
1761
- "complexType": {
1762
- "original": "boolean",
1763
- "resolved": "boolean",
1764
- "references": {}
1765
- },
1766
- "required": false,
1767
- "optional": false,
1768
- "docs": {
1769
- "tags": [],
1770
- "text": "Shows the tree data as a table."
1771
- },
1772
- "attribute": "show-columns",
1773
- "reflect": false,
1774
- "defaultValue": "false"
1775
- },
1776
- "showFilters": {
1777
- "type": "boolean",
1778
- "mutable": false,
1779
- "complexType": {
1780
- "original": "boolean",
1781
- "resolved": "boolean",
1782
- "references": {}
1783
- },
1784
- "required": false,
1785
- "optional": false,
1786
- "docs": {
1787
- "tags": [],
1788
- "text": "When set to true enables the column filters."
1789
- },
1790
- "attribute": "show-filters",
1791
- "reflect": false,
1792
- "defaultValue": "true"
1793
- },
1794
- "showFooter": {
1795
- "type": "boolean",
1796
- "mutable": false,
1797
- "complexType": {
1798
- "original": "boolean",
1799
- "resolved": "boolean",
1800
- "references": {}
1801
- },
1802
- "required": false,
1803
- "optional": false,
1804
- "docs": {
1805
- "tags": [],
1806
- "text": "When set to true shows the footer."
1807
- },
1808
- "attribute": "show-footer",
1809
- "reflect": false,
1810
- "defaultValue": "false"
1811
- },
1812
- "showHeader": {
1813
- "type": "boolean",
1814
- "mutable": true,
1815
- "complexType": {
1816
- "original": "boolean",
1817
- "resolved": "boolean",
1818
- "references": {}
1819
- },
1820
- "required": false,
1821
- "optional": false,
1822
- "docs": {
1823
- "tags": [{
1824
- "name": "see",
1825
- "text": "showColumns"
1826
- }],
1827
- "text": "Flag: shows the header of the tree when the tree is displayed as a table."
1828
- },
1829
- "attribute": "show-header",
1830
- "reflect": false,
1831
- "defaultValue": "false"
1832
- },
1833
- "showIcons": {
1834
- "type": "boolean",
1835
- "mutable": false,
1836
- "complexType": {
1837
- "original": "boolean",
1838
- "resolved": "boolean",
1839
- "references": {}
1840
- },
1841
- "required": false,
1842
- "optional": false,
1843
- "docs": {
1844
- "tags": [],
1845
- "text": "Shows the icons of the nodes."
1846
- },
1847
- "attribute": "show-icons",
1848
- "reflect": false,
1849
- "defaultValue": "true"
1850
- },
1851
- "stateId": {
1852
- "type": "string",
1853
- "mutable": false,
1854
- "complexType": {
1855
- "original": "string",
1856
- "resolved": "string",
1857
- "references": {}
1858
- },
1859
- "required": false,
1860
- "optional": false,
1861
- "docs": {
1862
- "tags": [],
1863
- "text": ""
1864
- },
1865
- "attribute": "state-id",
1866
- "reflect": false,
1867
- "defaultValue": "''"
1868
- },
1869
- "store": {
1870
- "type": "unknown",
1871
- "mutable": false,
1872
- "complexType": {
1873
- "original": "KupStore",
1874
- "resolved": "KupStore",
1875
- "references": {
1876
- "KupStore": {
1877
- "location": "import",
1878
- "path": "../kup-state/kup-store"
1879
- }
1880
- }
1881
- },
1882
- "required": false,
1883
- "optional": false,
1884
- "docs": {
1885
- "tags": [],
1886
- "text": ""
1887
- }
1888
- },
1889
- "useDynamicExpansion": {
1890
- "type": "boolean",
1891
- "mutable": false,
1892
- "complexType": {
1893
- "original": "boolean",
1894
- "resolved": "boolean",
1895
- "references": {}
1896
- },
1897
- "required": false,
1898
- "optional": false,
1899
- "docs": {
1900
- "tags": [{
1901
- "name": "see",
1902
- "text": "dynamicExpansionCallback"
1903
- }],
1904
- "text": "When the component must use the dynamic expansion feature to open its nodes, it means that not all the nodes of the\r\ntree have been passed inside the data property.\r\n\r\nTherefore, when expanding a node, the tree must emit an event (or run a given callback)\r\nand wait for the child nodes to be downloaded from the server.\r\n\r\nFor more information:"
1905
- },
1906
- "attribute": "use-dynamic-expansion",
1907
- "reflect": false,
1908
- "defaultValue": "false"
1909
- },
1910
- "totals": {
1911
- "type": "unknown",
1912
- "mutable": true,
1913
- "complexType": {
1914
- "original": "TotalsMap",
1915
- "resolved": "TotalsMap",
1916
- "references": {
1917
- "TotalsMap": {
1918
- "location": "import",
1919
- "path": "./../kup-data-table/kup-data-table-declarations"
1920
- }
1921
- }
1922
- },
1923
- "required": false,
1924
- "optional": false,
1925
- "docs": {
1926
- "tags": [],
1927
- "text": "Defines the current totals options."
1928
- }
1929
- }
1930
- };
1931
- }
1932
- static get states() {
1933
- return {
1934
- "treeColumnVisible": {},
1935
- "openedTotalMenu": {},
1936
- "columnMenuAnchor": {},
1937
- "stateSwitcher": {},
1938
- "selectedNode": {}
1939
- };
1940
- }
1941
- static get events() {
1942
- return [{
1943
- "method": "kupTreeNodeCollapse",
1944
- "name": "kup-tree-nodecollapse",
1945
- "bubbles": true,
1946
- "cancelable": false,
1947
- "composed": true,
1948
- "docs": {
1949
- "tags": [],
1950
- "text": "Fired when a KupTreeNode gets collapsed (closed)."
1951
- },
1952
- "complexType": {
1953
- "original": "KupTreeNodeCollapseEventPayload",
1954
- "resolved": "KupTreeNodeCollapseEventPayload",
1955
- "references": {
1956
- "KupTreeNodeCollapseEventPayload": {
1957
- "location": "import",
1958
- "path": "./kup-tree-declarations"
1959
- }
1960
- }
1961
- }
1962
- }, {
1963
- "method": "kupTreeNodeExpand",
1964
- "name": "kup-tree-nodeexpand",
1965
- "bubbles": true,
1966
- "cancelable": false,
1967
- "composed": true,
1968
- "docs": {
1969
- "tags": [{
1970
- "name": "event",
1971
- "text": "kup-tree-nodeexpand"
1972
- }, {
1973
- "name": "type",
1974
- "text": "{object}"
1975
- }, {
1976
- "name": "property",
1977
- "text": "{TreeNodePath} treeNodePath - The array of indexes to retrieve the current treeNode inside the data prop."
1978
- }, {
1979
- "name": "property",
1980
- "text": "{KupTreeNode} treeNode - Reference to the KupTreeNode data object which is being expanded (passed through the data prop)."
1981
- }, {
1982
- "name": "property",
1983
- "text": "{boolean} usesDynamicExpansion - Flag to notify that the component is running in dynamicExpansion mode."
1984
- }, {
1985
- "name": "property",
1986
- "text": "{boolean} dynamicExpansionRequireChildren - Flag to notify that the current dynamicExpansion event\r\nrequires the parent component to add KupTreeNode children to the given KupTreeNode."
1987
- }, {
1988
- "name": "see",
1989
- "text": "useDynamicExpansion *"
1990
- }, {
1991
- "name": "see",
1992
- "text": "dynamicExpansionCallback *"
1993
- }, {
1994
- "name": "since",
1995
- "text": "1.0.0"
1996
- }],
1997
- "text": "Fired when a node expansion ion has been triggered.\r\nContains additional data when the tree is using the dynamicExpansion feature."
1998
- },
1999
- "complexType": {
2000
- "original": "KupTreeNodeExpandEventPayload",
2001
- "resolved": "KupTreeNodeExpandEventPayload",
2002
- "references": {
2003
- "KupTreeNodeExpandEventPayload": {
2004
- "location": "import",
2005
- "path": "./kup-tree-declarations"
2006
- }
2007
- }
2008
- }
2009
- }, {
2010
- "method": "kupTreeNodeSelected",
2011
- "name": "kup-tree-nodeselected",
2012
- "bubbles": true,
2013
- "cancelable": false,
2014
- "composed": true,
2015
- "docs": {
2016
- "tags": [],
2017
- "text": "Fired when a node of the tree has been selected"
2018
- },
2019
- "complexType": {
2020
- "original": "KupTreeNodeSelectedEventPayload",
2021
- "resolved": "KupTreeNodeSelectedEventPayload",
2022
- "references": {
2023
- "KupTreeNodeSelectedEventPayload": {
2024
- "location": "import",
2025
- "path": "./kup-tree-declarations"
2026
- }
2027
- }
2028
- }
2029
- }, {
2030
- "method": "kupTreeNodeButtonClick",
2031
- "name": "kup-tree-buttonclick",
2032
- "bubbles": true,
2033
- "cancelable": false,
2034
- "composed": true,
2035
- "docs": {
2036
- "tags": [],
2037
- "text": ""
2038
- },
2039
- "complexType": {
2040
- "original": "KupTreeNodeButtonClickEventPayload",
2041
- "resolved": "KupTreeNodeButtonClickEventPayload",
2042
- "references": {
2043
- "KupTreeNodeButtonClickEventPayload": {
2044
- "location": "import",
2045
- "path": "./kup-tree-declarations"
2046
- }
2047
- }
2048
- }
2049
- }, {
2050
- "method": "kupTreeContextMenu",
2051
- "name": "kup-tree-contextmenu",
2052
- "bubbles": true,
2053
- "cancelable": false,
2054
- "composed": true,
2055
- "docs": {
2056
- "tags": [],
2057
- "text": "Generic right click event on tree."
2058
- },
2059
- "complexType": {
2060
- "original": "KupTreeContextMenuEventPayload",
2061
- "resolved": "KupTreeContextMenuEventPayload",
2062
- "references": {
2063
- "KupTreeContextMenuEventPayload": {
2064
- "location": "import",
2065
- "path": "./kup-tree-declarations"
2066
- }
2067
- }
2068
- }
2069
- }, {
2070
- "method": "kupTreeColumnMenu",
2071
- "name": "kup-tree-columnmenu",
2072
- "bubbles": true,
2073
- "cancelable": false,
2074
- "composed": true,
2075
- "docs": {
2076
- "tags": [],
2077
- "text": "When the column menu is being opened/closed."
2078
- },
2079
- "complexType": {
2080
- "original": "KupTreeColumnMenuEventPayload",
2081
- "resolved": "KupTreeColumnMenuEventPayload",
2082
- "references": {
2083
- "KupTreeColumnMenuEventPayload": {
2084
- "location": "import",
2085
- "path": "./kup-tree-declarations"
2086
- }
2087
- }
2088
- }
2089
- }, {
2090
- "method": "kupDidLoad",
2091
- "name": "kup-tree-didload",
2092
- "bubbles": true,
2093
- "cancelable": false,
2094
- "composed": true,
2095
- "docs": {
2096
- "tags": [],
2097
- "text": ""
2098
- },
2099
- "complexType": {
2100
- "original": "KupEventPayload",
2101
- "resolved": "KupEventPayload",
2102
- "references": {
2103
- "KupEventPayload": {
2104
- "location": "import",
2105
- "path": "../../types/GenericTypes"
2106
- }
2107
- }
2108
- }
2109
- }, {
2110
- "method": "kupDidUnload",
2111
- "name": "kup-tree-didunload",
2112
- "bubbles": true,
2113
- "cancelable": false,
2114
- "composed": true,
2115
- "docs": {
2116
- "tags": [],
2117
- "text": "Triggered when stop propagation event"
2118
- },
2119
- "complexType": {
2120
- "original": "KupEventPayload",
2121
- "resolved": "KupEventPayload",
2122
- "references": {
2123
- "KupEventPayload": {
2124
- "location": "import",
2125
- "path": "../../types/GenericTypes"
2126
- }
2127
- }
2128
- }
2129
- }, {
2130
- "method": "kupTreeNodeDblClick",
2131
- "name": "kup-tree-nodedblclick",
2132
- "bubbles": true,
2133
- "cancelable": false,
2134
- "composed": true,
2135
- "docs": {
2136
- "tags": [],
2137
- "text": ""
2138
- },
2139
- "complexType": {
2140
- "original": "KupTreeNodeCollapseEventPayload",
2141
- "resolved": "KupTreeNodeCollapseEventPayload",
2142
- "references": {
2143
- "KupTreeNodeCollapseEventPayload": {
2144
- "location": "import",
2145
- "path": "./kup-tree-declarations"
2146
- }
2147
- }
2148
- }
2149
- }, {
2150
- "method": "kupTreeDynamicMassExpansion",
2151
- "name": "kup-tree-dynamicmassexpansion",
2152
- "bubbles": true,
2153
- "cancelable": false,
2154
- "composed": true,
2155
- "docs": {
2156
- "tags": [],
2157
- "text": ""
2158
- },
2159
- "complexType": {
2160
- "original": "KupTreeDynamicMassExpansionEventPayload",
2161
- "resolved": "KupTreeDynamicMassExpansionEventPayload",
2162
- "references": {
2163
- "KupTreeDynamicMassExpansionEventPayload": {
2164
- "location": "import",
2165
- "path": "./kup-tree-declarations"
2166
- }
2167
- }
2168
- }
2169
- }, {
2170
- "method": "kupColumnRemove",
2171
- "name": "kup-tree-columnremove",
2172
- "bubbles": true,
2173
- "cancelable": false,
2174
- "composed": true,
2175
- "docs": {
2176
- "tags": [],
2177
- "text": "Event fired when columns are removed (set to hidden)."
2178
- },
2179
- "complexType": {
2180
- "original": "KupTreeColumnRemoveEventPayload",
2181
- "resolved": "KupTreeColumnRemoveEventPayload",
2182
- "references": {
2183
- "KupTreeColumnRemoveEventPayload": {
2184
- "location": "import",
2185
- "path": "./kup-tree-declarations"
2186
- }
2187
- }
2188
- }
2189
- }];
2190
- }
2191
- static get methods() {
2192
- return {
2193
- "getSelectedNode": {
2194
- "complexType": {
2195
- "signature": "() => Promise<TreeNodePath>",
2196
- "parameters": [],
2197
- "references": {
2198
- "Promise": {
2199
- "location": "global"
2200
- },
2201
- "TreeNodePath": {
2202
- "location": "import",
2203
- "path": "./kup-tree-declarations"
2204
- }
2205
- },
2206
- "return": "Promise<TreeNodePath>"
2207
- },
2208
- "docs": {
2209
- "text": "This method will get the selected nodes of the component.",
2210
- "tags": []
2211
- }
2212
- },
2213
- "setSelectedNode": {
2214
- "complexType": {
2215
- "signature": "(treeNodePath: string, emitEvent?: boolean) => Promise<void>",
2216
- "parameters": [{
2217
- "tags": [],
2218
- "text": ""
2219
- }, {
2220
- "tags": [{
2221
- "name": "param",
2222
- "text": "emitEvent - The event will always be emitted unless emitEvent is set to false."
2223
- }],
2224
- "text": "- The event will always be emitted unless emitEvent is set to false."
2225
- }],
2226
- "references": {
2227
- "Promise": {
2228
- "location": "global"
2229
- }
2230
- },
2231
- "return": "Promise<void>"
2232
- },
2233
- "docs": {
2234
- "text": "This method will set the selected rows of the component.",
2235
- "tags": [{
2236
- "name": "param",
2237
- "text": "rowsIdentifiers - Array of ids (dataset) or indexes (rendered rows)."
2238
- }, {
2239
- "name": "param",
2240
- "text": "emitEvent - The event will always be emitted unless emitEvent is set to false."
2241
- }]
2242
- }
2243
- },
2244
- "isEmpty": {
2245
- "complexType": {
2246
- "signature": "() => Promise<boolean>",
2247
- "parameters": [],
2248
- "references": {
2249
- "Promise": {
2250
- "location": "global"
2251
- }
2252
- },
2253
- "return": "Promise<boolean>"
2254
- },
2255
- "docs": {
2256
- "text": "True if there aren't visible nodes",
2257
- "tags": []
2258
- }
2259
- },
2260
- "closeColumnMenu": {
2261
- "complexType": {
2262
- "signature": "() => Promise<void>",
2263
- "parameters": [],
2264
- "references": {
2265
- "Promise": {
2266
- "location": "global"
2267
- }
2268
- },
2269
- "return": "Promise<void>"
2270
- },
2271
- "docs": {
2272
- "text": "Closes any opened column menu.",
2273
- "tags": []
2274
- }
2275
- },
2276
- "collapseAll": {
2277
- "complexType": {
2278
- "signature": "() => Promise<void>",
2279
- "parameters": [],
2280
- "references": {
2281
- "Promise": {
2282
- "location": "global"
2283
- }
2284
- },
2285
- "return": "Promise<void>"
2286
- },
2287
- "docs": {
2288
- "text": "Collapses all nodes.",
2289
- "tags": []
2290
- }
2291
- },
2292
- "expandAll": {
2293
- "complexType": {
2294
- "signature": "() => Promise<void>",
2295
- "parameters": [],
2296
- "references": {
2297
- "Promise": {
2298
- "location": "global"
2299
- }
2300
- },
2301
- "return": "Promise<void>"
2302
- },
2303
- "docs": {
2304
- "text": "Expands all nodes.",
2305
- "tags": []
2306
- }
2307
- },
2308
- "getProps": {
2309
- "complexType": {
2310
- "signature": "(descriptions?: boolean) => Promise<GenericObject>",
2311
- "parameters": [{
2312
- "tags": [{
2313
- "name": "param",
2314
- "text": "descriptions - When provided and true, the result will be the list of props with their description."
2315
- }],
2316
- "text": "- When provided and true, the result will be the list of props with their description."
2317
- }],
2318
- "references": {
2319
- "Promise": {
2320
- "location": "global"
2321
- },
2322
- "GenericObject": {
2323
- "location": "import",
2324
- "path": "../../types/GenericTypes"
2325
- }
2326
- },
2327
- "return": "Promise<GenericObject>"
2328
- },
2329
- "docs": {
2330
- "text": "Used to retrieve component's props values.",
2331
- "tags": [{
2332
- "name": "param",
2333
- "text": "descriptions - When provided and true, the result will be the list of props with their description."
2334
- }, {
2335
- "name": "returns",
2336
- "text": "List of props as object, each key will be a prop."
2337
- }]
2338
- }
2339
- },
2340
- "hideColumn": {
2341
- "complexType": {
2342
- "signature": "(column: KupDataColumn) => Promise<void>",
2343
- "parameters": [{
2344
- "tags": [{
2345
- "name": "param",
2346
- "text": "column - Column to hide."
2347
- }],
2348
- "text": "- Column to hide."
2349
- }],
2350
- "references": {
2351
- "Promise": {
2352
- "location": "global"
2353
- },
2354
- "KupDataColumn": {
2355
- "location": "import",
2356
- "path": "../../managers/kup-data/kup-data-declarations"
2357
- }
2358
- },
2359
- "return": "Promise<void>"
2360
- },
2361
- "docs": {
2362
- "text": "Hides the given column.",
2363
- "tags": [{
2364
- "name": "param",
2365
- "text": "column - Column to hide."
2366
- }]
2367
- }
2368
- },
2369
- "openColumnMenu": {
2370
- "complexType": {
2371
- "signature": "(column: string) => Promise<void>",
2372
- "parameters": [{
2373
- "tags": [{
2374
- "name": "param",
2375
- "text": "column - Name of the column."
2376
- }],
2377
- "text": "- Name of the column."
2378
- }],
2379
- "references": {
2380
- "Promise": {
2381
- "location": "global"
2382
- },
2383
- "CustomEvent": {
2384
- "location": "global"
2385
- },
2386
- "KupEventPayload": {
2387
- "location": "import",
2388
- "path": "../../types/GenericTypes"
2389
- },
2390
- "KupCardEventPayload": {
2391
- "location": "import",
2392
- "path": "../kup-card/kup-card-declarations"
2393
- }
2394
- },
2395
- "return": "Promise<void>"
2396
- },
2397
- "docs": {
2398
- "text": "Opens the column menu of the given column.",
2399
- "tags": [{
2400
- "name": "param",
2401
- "text": "column - Name of the column."
2402
- }]
2403
- }
2404
- },
2405
- "refresh": {
2406
- "complexType": {
2407
- "signature": "() => Promise<void>",
2408
- "parameters": [],
2409
- "references": {
2410
- "Promise": {
2411
- "location": "global"
2412
- }
2413
- },
2414
- "return": "Promise<void>"
2415
- },
2416
- "docs": {
2417
- "text": "This method is used to trigger a new render of the component.",
2418
- "tags": []
2419
- }
2420
- },
2421
- "resizeCallback": {
2422
- "complexType": {
2423
- "signature": "() => Promise<void>",
2424
- "parameters": [],
2425
- "references": {
2426
- "Promise": {
2427
- "location": "global"
2428
- }
2429
- },
2430
- "return": "Promise<void>"
2431
- },
2432
- "docs": {
2433
- "text": "This method is invoked by KupManager whenever the component changes size.",
2434
- "tags": []
2435
- }
2436
- },
2437
- "setProps": {
2438
- "complexType": {
2439
- "signature": "(props: GenericObject) => Promise<void>",
2440
- "parameters": [{
2441
- "tags": [{
2442
- "name": "param",
2443
- "text": "props - Object containing props that will be set to the component."
2444
- }],
2445
- "text": "- Object containing props that will be set to the component."
2446
- }],
2447
- "references": {
2448
- "Promise": {
2449
- "location": "global"
2450
- },
2451
- "GenericObject": {
2452
- "location": "import",
2453
- "path": "../../types/GenericTypes"
2454
- }
2455
- },
2456
- "return": "Promise<void>"
2457
- },
2458
- "docs": {
2459
- "text": "Sets the props to the component.",
2460
- "tags": [{
2461
- "name": "param",
2462
- "text": "props - Object containing props that will be set to the component."
2463
- }]
2464
- }
2465
- }
2466
- };
2467
- }
2468
- static get elementRef() { return "rootElement"; }
2469
- static get watchers() {
2470
- return [{
2471
- "propName": "data",
2472
- "methodName": "enrichDataWhenChanged"
2473
- }, {
2474
- "propName": "expanded",
2475
- "methodName": "enrichStructureStateWhenChanged"
2476
- }];
2477
- }
2478
- }
2479
- _KupTree_kupManager = new WeakMap();
1
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
+ if (kind === "a" && !f)
3
+ throw new TypeError("Private accessor was defined without a getter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
5
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
6
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
7
+ };
8
+ var _KupTree_kupManager;
9
+ import { forceUpdate, getAssetPath, h, Host, } from '@stencil/core';
10
+ import { TotalLabel, TotalMode, } from './../kup-data-table/kup-data-table-declarations';
11
+ import { KupTreeProps, treeMainColumnName, KupTreeExpansionMode, } from './kup-tree-declarations';
12
+ import { MDCRipple } from '@material/ripple';
13
+ import { kupManagerInstance, } from '../../managers/kup-manager/kup-manager';
14
+ import { calcTotals, normalizeRows, } from '../kup-data-table/kup-data-table-helper';
15
+ import { KupTreeState } from './kup-tree-state';
16
+ import { getColumnByName } from '../../utils/cell-utils';
17
+ import { getProps, setProps } from '../../utils/utils';
18
+ import { KupColumnMenu } from '../../utils/kup-column-menu/kup-column-menu';
19
+ import { FiltersColumnMenu } from '../../utils/filters/filters-column-menu';
20
+ import { KupGlobalFilterMode, } from '../../utils/filters/filters-declarations';
21
+ import { FiltersTreeItems } from '../../utils/filters/filters-tree-items';
22
+ import { kupDynamicPositionAttribute, } from '../../managers/kup-dynamic-position/kup-dynamic-position-declarations';
23
+ import { KupLanguageGeneric, KupLanguageSearch, KupLanguageTotals, } from '../../managers/kup-language/kup-language-declarations';
24
+ import { componentWrapperId } from '../../variables/GenericVariables';
25
+ import { KupThemeIconValues } from '../../managers/kup-theme/kup-theme-declarations';
26
+ import { KupPointerEventTypes } from '../../managers/kup-interact/kup-interact-declarations';
27
+ import { FCellPadding, } from '../../f-components/f-cell/f-cell-declarations';
28
+ import { FCell } from '../../f-components/f-cell/f-cell';
29
+ import { KupDebugCategory } from '../../managers/kup-debug/kup-debug-declarations';
30
+ import { FTextFieldMDC } from '../../f-components/f-text-field/f-text-field-mdc';
31
+ export class KupTree {
32
+ constructor() {
33
+ /*-------------------------------------------------*/
34
+ /* S t a t e s */
35
+ /*-------------------------------------------------*/
36
+ this.state = new KupTreeState();
37
+ /*-------------------------------------------------*/
38
+ /* I n t e r n a l V a r i a b l e s */
39
+ /*-------------------------------------------------*/
40
+ /**
41
+ * Instance of the KupManager class.
42
+ */
43
+ _KupTree_kupManager.set(this, kupManagerInstance());
44
+ /**
45
+ * Reference to the column menu card.
46
+ */
47
+ this.columnMenuCard = null;
48
+ this.clickTimeout = [];
49
+ this.sizedColumns = undefined;
50
+ this.filtersColumnMenuInstance = new FiltersColumnMenu();
51
+ this.filtersTreeItemsInstance = new FiltersTreeItems();
52
+ this.totalMenuCoords = null;
53
+ this.contentRefs = [];
54
+ this.oldWidth = null;
55
+ this.hold = false;
56
+ this.interactableTouch = [];
57
+ this.clickCb = null;
58
+ this.treeColumnVisible = true;
59
+ this.openedTotalMenu = null;
60
+ this.columnMenuAnchor = null;
61
+ this.stateSwitcher = false;
62
+ this.selectedNode = [];
63
+ this.asAccordion = false;
64
+ this.columns = undefined;
65
+ this.customStyle = '';
66
+ this.data = [];
67
+ this.density = FCellPadding.MEDIUM;
68
+ this.dynamicExpansionCallback = undefined;
69
+ this.editableData = false;
70
+ this.enableExtraColumns = true;
71
+ this.expanded = false;
72
+ this.expansionMode = KupTreeExpansionMode.DROPDOWN;
73
+ this.filters = {};
74
+ this.globalFilter = false;
75
+ this.globalFilterValue = '';
76
+ this.globalFilterMode = KupGlobalFilterMode.SIMPLE;
77
+ this.preventXScroll = false;
78
+ this.removableColumns = true;
79
+ this.ripple = true;
80
+ this.scrollOnHover = false;
81
+ this.showColumns = false;
82
+ this.showFilters = true;
83
+ this.showFooter = false;
84
+ this.showHeader = false;
85
+ this.showIcons = true;
86
+ this.stateId = '';
87
+ this.store = undefined;
88
+ this.useDynamicExpansion = false;
89
+ this.totals = undefined;
90
+ }
91
+ initWithPersistedState() {
92
+ if (this.store && this.stateId) {
93
+ const state = this.store.getState(this.stateId);
94
+ if (state != null) {
95
+ this.density = state.density;
96
+ this.showFilters = state.showFilters;
97
+ this.showFooter = state.showFooter;
98
+ this.globalFilter = state.globalFilter;
99
+ this.globalFilterValue = state.globalFilterValue;
100
+ this.filters = Object.assign({}, state.filters);
101
+ this.totals = Object.assign({}, state.totals);
102
+ }
103
+ }
104
+ }
105
+ persistState() {
106
+ if (this.store && this.stateId) {
107
+ let somethingChanged = false;
108
+ if (!__classPrivateFieldGet(this, _KupTree_kupManager, "f").objects.deepEqual(this.state.filters, this.filters)) {
109
+ this.state.filters = Object.assign({}, this.filters);
110
+ somethingChanged = true;
111
+ }
112
+ if (!__classPrivateFieldGet(this, _KupTree_kupManager, "f").objects.deepEqual(this.state.density, this.density)) {
113
+ this.state.density = this.density;
114
+ somethingChanged = true;
115
+ }
116
+ if (!__classPrivateFieldGet(this, _KupTree_kupManager, "f").objects.deepEqual(this.state.showFilters, this.showFilters)) {
117
+ this.state.showFilters = this.showFilters;
118
+ somethingChanged = true;
119
+ }
120
+ if (!__classPrivateFieldGet(this, _KupTree_kupManager, "f").objects.deepEqual(this.state.showFooter, this.showFooter)) {
121
+ this.state.showFooter = this.showFooter;
122
+ somethingChanged = true;
123
+ }
124
+ if (!__classPrivateFieldGet(this, _KupTree_kupManager, "f").objects.deepEqual(this.state.totals, this.totals)) {
125
+ this.state.totals = Object.assign({}, this.totals);
126
+ somethingChanged = true;
127
+ }
128
+ if (!__classPrivateFieldGet(this, _KupTree_kupManager, "f").objects.deepEqual(this.state.globalFilter, this.globalFilter)) {
129
+ this.state.globalFilter = this.globalFilter;
130
+ somethingChanged = true;
131
+ }
132
+ if (!__classPrivateFieldGet(this, _KupTree_kupManager, "f").objects.deepEqual(this.state.globalFilterValue, this.globalFilterValue)) {
133
+ this.state.globalFilterValue = this.globalFilterValue;
134
+ somethingChanged = true;
135
+ }
136
+ if (!this.state.load) {
137
+ this.state.load = true;
138
+ return;
139
+ }
140
+ if (somethingChanged) {
141
+ this.store.persistState(this.stateId, this.state);
142
+ }
143
+ }
144
+ }
145
+ /**
146
+ * This method will get the selected nodes of the component.
147
+ */
148
+ async getSelectedNode() {
149
+ return this.selectedNode;
150
+ }
151
+ /**
152
+ * This method will set the selected rows of the component.
153
+ * @param {string|number[]} rowsIdentifiers - Array of ids (dataset) or indexes (rendered rows).
154
+ * @param {boolean} emitEvent - The event will always be emitted unless emitEvent is set to false.
155
+ */
156
+ async setSelectedNode(treeNodePath, emitEvent) {
157
+ this.selectedNode = treeNodePath
158
+ .split(',')
159
+ .map((treeNodeIndex) => parseInt(treeNodeIndex));
160
+ if (emitEvent !== false) {
161
+ this.kupTreeNodeSelected.emit({
162
+ comp: this,
163
+ id: this.rootElement.id,
164
+ treeNodePath: this.selectedNode,
165
+ treeNode: this.getTreeNode(this.selectedNode),
166
+ columnName: null,
167
+ });
168
+ }
169
+ }
170
+ /*-------------------------------------------------*/
171
+ /* W a t c h e r s */
172
+ /*-------------------------------------------------*/
173
+ enrichDataWhenChanged(newData, oldData) {
174
+ if (!newData) {
175
+ newData = [];
176
+ }
177
+ if (newData !== oldData) {
178
+ this.refreshStructureState();
179
+ }
180
+ }
181
+ enrichStructureStateWhenChanged(newValue, oldValue) {
182
+ if (newValue !== oldValue) {
183
+ this.refreshStructureState();
184
+ }
185
+ }
186
+ /*-------------------------------------------------*/
187
+ /* P u b l i c M e t h o d s */
188
+ /*-------------------------------------------------*/
189
+ /**
190
+ * True if there aren't visible nodes
191
+ */
192
+ async isEmpty() {
193
+ return this.visibleNodes == 0;
194
+ }
195
+ /**
196
+ * Closes any opened column menu.
197
+ */
198
+ async closeColumnMenu() {
199
+ this.columnMenuAnchor = null;
200
+ if (this.columnMenuCard) {
201
+ this.columnMenuCard.data = null;
202
+ }
203
+ this.columnMenuInstance.close(this.columnMenuCard);
204
+ this.kupTreeColumnMenu.emit({
205
+ comp: this,
206
+ id: this.rootElement.id,
207
+ card: this.columnMenuCard,
208
+ event: null,
209
+ open: false,
210
+ });
211
+ }
212
+ /**
213
+ * Collapses all nodes.
214
+ */
215
+ async collapseAll() {
216
+ if (!this.useDynamicExpansion) {
217
+ for (let index = 0; index < this.data.length; index++) {
218
+ this.data[index].isExpanded = false;
219
+ this.handleChildren(this.data[index], false);
220
+ }
221
+ }
222
+ else {
223
+ this.kupTreeDynamicMassExpansion.emit({
224
+ comp: this,
225
+ id: this.rootElement.id,
226
+ expandAll: false,
227
+ });
228
+ }
229
+ this.refresh();
230
+ }
231
+ /**
232
+ * Expands all nodes.
233
+ */
234
+ async expandAll() {
235
+ if (!this.useDynamicExpansion) {
236
+ for (let index = 0; index < this.data.length; index++) {
237
+ this.data[index].isExpanded = true;
238
+ this.handleChildren(this.data[index], true);
239
+ }
240
+ }
241
+ else {
242
+ this.kupTreeDynamicMassExpansion.emit({
243
+ comp: this,
244
+ id: this.rootElement.id,
245
+ expandAll: true,
246
+ });
247
+ }
248
+ this.refresh();
249
+ }
250
+ /**
251
+ * Used to retrieve component's props values.
252
+ * @param {boolean} descriptions - When provided and true, the result will be the list of props with their description.
253
+ * @returns {Promise<GenericObject>} List of props as object, each key will be a prop.
254
+ */
255
+ async getProps(descriptions) {
256
+ return getProps(this, KupTreeProps, descriptions);
257
+ }
258
+ /**
259
+ * Hides the given column.
260
+ * @param {KupDataColumn} column - Column to hide.
261
+ */
262
+ async hideColumn(column) {
263
+ __classPrivateFieldGet(this, _KupTree_kupManager, "f").data.column.hide(this.columns, [column.name]);
264
+ this.kupColumnRemove.emit({
265
+ comp: this,
266
+ id: this.rootElement.id,
267
+ column: column,
268
+ });
269
+ this.refresh();
270
+ }
271
+ /**
272
+ * Opens the column menu of the given column.
273
+ * @param {string} column - Name of the column.
274
+ */
275
+ async openColumnMenu(column) {
276
+ this.columnMenuAnchor = column;
277
+ if (!this.columnMenuCard) {
278
+ this.columnMenuCard = document.createElement('kup-card');
279
+ this.columnMenuCard.isMenu = true;
280
+ this.columnMenuCard.layoutNumber = 12;
281
+ this.columnMenuCard.sizeX = 'auto';
282
+ this.columnMenuCard.sizeY = 'auto';
283
+ this.columnMenuCard.addEventListener('kup-card-click', (e) => {
284
+ this.kupTreeColumnMenu.emit({
285
+ comp: this,
286
+ id: this.rootElement.id,
287
+ card: this.columnMenuCard,
288
+ event: e,
289
+ open: this.columnMenuCard.menuVisible,
290
+ });
291
+ });
292
+ this.columnMenuCard.addEventListener('kup-card-event', (e) => {
293
+ this.columnMenuInstance.eventHandlers(e, this);
294
+ this.kupTreeColumnMenu.emit({
295
+ comp: this,
296
+ id: this.rootElement.id,
297
+ card: this.columnMenuCard,
298
+ event: e,
299
+ open: this.columnMenuCard.menuVisible,
300
+ });
301
+ });
302
+ }
303
+ this.columnMenuCard.setAttribute('data-column', column);
304
+ this.columnMenuCard.data = this.columnMenuInstance.prepData(this, getColumnByName(this.getVisibleColumns(), column));
305
+ this.columnMenuInstance.open(this, column);
306
+ this.columnMenuInstance.reposition(this, this.columnMenuCard);
307
+ this.kupTreeColumnMenu.emit({
308
+ comp: this,
309
+ id: this.rootElement.id,
310
+ card: this.columnMenuCard,
311
+ event: null,
312
+ open: true,
313
+ });
314
+ }
315
+ /**
316
+ * This method is used to trigger a new render of the component.
317
+ */
318
+ async refresh() {
319
+ forceUpdate(this);
320
+ }
321
+ /**
322
+ * This method is invoked by KupManager whenever the component changes size.
323
+ */
324
+ async resizeCallback() {
325
+ if (this.rootElement.clientWidth !== this.oldWidth) {
326
+ window.clearTimeout(this.resizeTimeout);
327
+ this.resizeTimeout = window.setTimeout(() => this.refresh(), 300);
328
+ }
329
+ }
330
+ /**
331
+ * Sets the props to the component.
332
+ * @param {GenericObject} props - Object containing props that will be set to the component.
333
+ */
334
+ async setProps(props) {
335
+ setProps(this, KupTreeProps, props);
336
+ }
337
+ /*-------------------------------------------------*/
338
+ /* P r i v a t e M e t h o d s */
339
+ /*-------------------------------------------------*/
340
+ setTreeColumnVisibility(value) {
341
+ this.treeColumnVisible = value;
342
+ }
343
+ isTreeColumnVisible() {
344
+ return this.treeColumnVisible;
345
+ }
346
+ checkScrollOnHover() {
347
+ if (!__classPrivateFieldGet(this, _KupTree_kupManager, "f").scrollOnHover.isRegistered(this.treeWrapperRef)) {
348
+ if (this.scrollOnHover) {
349
+ __classPrivateFieldGet(this, _KupTree_kupManager, "f").scrollOnHover.register(this.treeWrapperRef);
350
+ }
351
+ }
352
+ else {
353
+ if (!this.scrollOnHover) {
354
+ __classPrivateFieldGet(this, _KupTree_kupManager, "f").scrollOnHover.unregister(this.treeWrapperRef);
355
+ }
356
+ }
357
+ }
358
+ onKupTreeNodeDblClick(treeNodeData, treeNodePath) {
359
+ for (let index = 0; index < this.clickTimeout.length; index++) {
360
+ clearTimeout(this.clickTimeout[index]);
361
+ __classPrivateFieldGet(this, _KupTree_kupManager, "f").debug.logMessage(this, 'Cleared hdlTreeNodeClick timeout(' +
362
+ this.clickTimeout[index] +
363
+ ').');
364
+ }
365
+ this.clickTimeout = [];
366
+ this.kupTreeNodeDblClick.emit({
367
+ comp: this,
368
+ id: this.rootElement.id,
369
+ treeNodePath: treeNodePath
370
+ .split(',')
371
+ .map((treeNodeIndex) => parseInt(treeNodeIndex)),
372
+ treeNode: treeNodeData,
373
+ });
374
+ }
375
+ nodesToRows() {
376
+ function children(TreeNode) {
377
+ for (let index = 0; index < TreeNode.children.length; index++) {
378
+ const node = TreeNode.children[index];
379
+ rows.push({
380
+ cells: TreeNode.children[index].cells,
381
+ });
382
+ if (node.children) {
383
+ children(node);
384
+ }
385
+ }
386
+ }
387
+ let rows = [];
388
+ for (let index = 0; index < this.data.length; index++) {
389
+ const node = this.data[index];
390
+ rows.push({
391
+ cells: this.data[index].cells,
392
+ });
393
+ if (node.children) {
394
+ children(this.data[index]);
395
+ }
396
+ }
397
+ return rows;
398
+ }
399
+ setDynPosElements() {
400
+ // Column menu
401
+ if (this.columnMenuCard && this.columnMenuCard.data) {
402
+ this.columnMenuCard.data = this.columnMenuInstance.prepData(this, getColumnByName(this.getVisibleColumns(), this.columnMenuAnchor), this.columnMenuCard.data);
403
+ }
404
+ }
405
+ expandCollapseNode(treeNode, expandNode = false) {
406
+ this.filtersTreeItemsInstance.expandCollapseNode(treeNode, expandNode);
407
+ }
408
+ expandCollapseAllNodes(treeNode, expandNode = false) {
409
+ this.filtersTreeItemsInstance.expandCollapseAllNodes(treeNode, expandNode);
410
+ }
411
+ getColumns() {
412
+ return this.columns ? this.columns : [{ title: '', name: '' }];
413
+ }
414
+ getSizedColumns() {
415
+ let columns = this.getColumns();
416
+ let sizedColumns = [];
417
+ for (let j = 0; j < columns.length; j++) {
418
+ if (columns[j].size !== null &&
419
+ columns[j].size !== undefined &&
420
+ columns[j].size !== '') {
421
+ sizedColumns.push(columns[j]);
422
+ }
423
+ }
424
+ if (sizedColumns.length > 0) {
425
+ return sizedColumns;
426
+ }
427
+ else {
428
+ return undefined;
429
+ }
430
+ }
431
+ getVisibleColumns() {
432
+ return this.getColumns().filter((column) => column.hasOwnProperty('visible') ? column.visible : true);
433
+ }
434
+ getHeadingColumns() {
435
+ const firstColum = {
436
+ name: treeMainColumnName,
437
+ title: '',
438
+ };
439
+ const visibleColumns = this.getVisibleColumns();
440
+ return [firstColum, ...visibleColumns];
441
+ }
442
+ /*
443
+ *For launch the event when selected node
444
+ */
445
+ launchNodeEvent(treeNodePath, treeNode) {
446
+ if (treeNodePath && treeNodePath.length > 0) {
447
+ if (treeNodePath[0] != -1) {
448
+ var tn = treeNode.children[treeNodePath[0]];
449
+ if (!tn) {
450
+ tn = treeNode;
451
+ }
452
+ if (treeNodePath.length > 1) {
453
+ treeNodePath = treeNodePath.slice(1);
454
+ this.launchNodeEvent(treeNodePath, tn);
455
+ }
456
+ else {
457
+ this.hdlTreeNodeClick(null, tn, this.selectedNodeToString(this.selectedNode));
458
+ }
459
+ }
460
+ }
461
+ }
462
+ openTotalMenu(column) {
463
+ this.openedTotalMenu = column.name;
464
+ }
465
+ onTotalMenuOpen(column) {
466
+ this.closeTotalMenu();
467
+ this.openTotalMenu(column);
468
+ }
469
+ getEventDetails(path, e) {
470
+ let isHeader, isBody, isFooter, td, th, tr, filterRemove;
471
+ if (path) {
472
+ for (let i = path.length - 1; i >= 0; i--) {
473
+ let p = path[i];
474
+ if (!p.tagName) {
475
+ continue;
476
+ }
477
+ switch (p.tagName.toUpperCase()) {
478
+ case 'THEAD': {
479
+ isHeader = true;
480
+ break;
481
+ }
482
+ case 'TBODY': {
483
+ isBody = true;
484
+ break;
485
+ }
486
+ case 'TFOOT': {
487
+ isFooter = true;
488
+ break;
489
+ }
490
+ case 'TD': {
491
+ td = p;
492
+ break;
493
+ }
494
+ case 'TH': {
495
+ th = p;
496
+ break;
497
+ }
498
+ case 'TR': {
499
+ tr = p;
500
+ break;
501
+ }
502
+ default: {
503
+ if (p.classList.contains(KupThemeIconValues.FILTER_REMOVE.replace('--', ''))) {
504
+ filterRemove = p;
505
+ }
506
+ break;
507
+ }
508
+ }
509
+ }
510
+ }
511
+ let cell = null, column = null, row = null;
512
+ if (isBody) {
513
+ if (td) {
514
+ cell = td['data-cell'];
515
+ }
516
+ if (tr) {
517
+ row = tr['data-row'];
518
+ }
519
+ }
520
+ if (isHeader || isBody || isFooter) {
521
+ const columnName = td
522
+ ? td.dataset.column
523
+ : th
524
+ ? th.dataset.column
525
+ : null;
526
+ if (columnName) {
527
+ column = getColumnByName(this.getColumns(), columnName);
528
+ }
529
+ }
530
+ return {
531
+ area: isHeader
532
+ ? 'header'
533
+ : isBody
534
+ ? 'body'
535
+ : isFooter
536
+ ? 'footer'
537
+ : null,
538
+ cell: cell ? cell : null,
539
+ column: column ? column : null,
540
+ filterRemove: filterRemove ? filterRemove : null,
541
+ originalEvent: e,
542
+ row: row ? row : null,
543
+ td: td ? td : null,
544
+ th: th ? th : null,
545
+ tr: tr ? tr : null,
546
+ };
547
+ }
548
+ contextMenuHandler(e) {
549
+ e.preventDefault();
550
+ const details = this.getEventDetails(__classPrivateFieldGet(this, _KupTree_kupManager, "f").getEventPath(e.target, this.rootElement), e);
551
+ if (details.area === 'header') {
552
+ if (details.th && details.column) {
553
+ this.openColumnMenu(details.column.name);
554
+ return details;
555
+ }
556
+ }
557
+ else if (details.area === 'footer') {
558
+ if (details.td && details.column) {
559
+ this.totalMenuCoords = { x: e.clientX, y: e.clientY };
560
+ this.onTotalMenuOpen(details.column);
561
+ return details;
562
+ }
563
+ }
564
+ return details;
565
+ }
566
+ // When a TreeNode can be selected
567
+ hdlTreeNodeClick(e, treeNodeData, treeNodePath) {
568
+ if (this.expansionMode.toLowerCase() ===
569
+ KupTreeExpansionMode.DROPDOWN ||
570
+ (this.expansionMode.toLowerCase() === KupTreeExpansionMode.NODE &&
571
+ !treeNodeData.expandable)) {
572
+ const td = e
573
+ ? __classPrivateFieldGet(this, _KupTree_kupManager, "f")
574
+ .getEventPath(e.target, this.rootElement)
575
+ .find((el) => {
576
+ if (el.tagName === 'TD')
577
+ return el;
578
+ })
579
+ : null;
580
+ // If this TreeNode is not disabled, then it can be selected and an event is emitted
581
+ if (treeNodeData && !treeNodeData.disabled) {
582
+ this.selectedNode = treeNodePath
583
+ .split(',')
584
+ .map((treeNodeIndex) => parseInt(treeNodeIndex));
585
+ this.kupTreeNodeSelected.emit({
586
+ comp: this,
587
+ id: this.rootElement.id,
588
+ treeNodePath: this.selectedNode,
589
+ treeNode: treeNodeData,
590
+ columnName: td ? td.dataset.column : null,
591
+ });
592
+ }
593
+ }
594
+ // If KupTreeExpansionMode.NODE then click is a collapse/expand click
595
+ if (this.expansionMode.toLowerCase() === KupTreeExpansionMode.NODE) {
596
+ this.hdlTreeNodeExpanderClick(treeNodeData, treeNodePath, e ? e.ctrlKey : false);
597
+ }
598
+ }
599
+ // When a TreeNode must be expanded or closed.
600
+ hdlTreeNodeExpanderClick(treeNodeData, treeNodePath, ctrlKey) {
601
+ // If the node is expandable
602
+ if (treeNodeData.expandable) {
603
+ // Always composes the tree node path as an array
604
+ const arrayTreeNodePath = treeNodePath
605
+ .split(',')
606
+ .map((index) => parseInt(index));
607
+ // There are already children set in this TreeNode -> expand or collapse node and emit appropriate event
608
+ if (treeNodeData.children && treeNodeData.children.length) {
609
+ // Updates expanded state and force rerender
610
+ treeNodeData.isExpanded = !treeNodeData.isExpanded;
611
+ if (ctrlKey) {
612
+ this.handleChildren(treeNodeData, treeNodeData.isExpanded);
613
+ }
614
+ this.refresh();
615
+ if (treeNodeData.isExpanded) {
616
+ // TreeNode is now expanded -> Fires expanded event
617
+ this.kupTreeNodeExpand.emit({
618
+ comp: this,
619
+ id: this.rootElement.id,
620
+ treeNodePath: arrayTreeNodePath,
621
+ treeNode: treeNodeData,
622
+ usesDynamicExpansion: this.useDynamicExpansion,
623
+ });
624
+ }
625
+ else {
626
+ // TreeNode is now collapsed -> Fires collapsed event
627
+ this.kupTreeNodeCollapse.emit({
628
+ comp: this,
629
+ id: this.rootElement.id,
630
+ treeNodePath: arrayTreeNodePath,
631
+ treeNode: treeNodeData,
632
+ });
633
+ }
634
+ }
635
+ else if (this.useDynamicExpansion) {
636
+ if (ctrlKey) {
637
+ this.kupTreeDynamicMassExpansion.emit({
638
+ comp: this,
639
+ id: this.rootElement.id,
640
+ treeNodePath: arrayTreeNodePath,
641
+ treeNode: treeNodeData,
642
+ });
643
+ }
644
+ // When the component must use the dynamic expansion feature
645
+ // Currently it does not support the expanded prop
646
+ // Checks if we have a dynamicExpansionCallback or not
647
+ if (this.dynamicExpansionCallback) {
648
+ // We have a callback: invokes it and after the result is returned updates the tree
649
+ this.dynamicExpansionCallback(treeNodeData, arrayTreeNodePath)
650
+ .then((childrenTreeNodes) => {
651
+ // Children returned successfully
652
+ treeNodeData.children = childrenTreeNodes;
653
+ treeNodeData.isExpanded = !treeNodeData.isExpanded;
654
+ this.refresh();
655
+ // TreeNode is now expanded -> Fires expanded event
656
+ this.kupTreeNodeExpand.emit({
657
+ comp: this,
658
+ id: this.rootElement.id,
659
+ treeNodePath: arrayTreeNodePath,
660
+ treeNode: treeNodeData,
661
+ usesDynamicExpansion: true,
662
+ });
663
+ })
664
+ .catch((err) => {
665
+ console.error('KupTree: An error occurred when trying to fetch dynamicExpansion nodes data', err, treeNodeData);
666
+ });
667
+ }
668
+ else {
669
+ // we do NOT have a callback set.
670
+ // Fires the expand request for the given TreeNode and set the appropriate flag
671
+ this.kupTreeNodeExpand.emit({
672
+ comp: this,
673
+ id: this.rootElement.id,
674
+ treeNode: treeNodeData,
675
+ treeNodePath: arrayTreeNodePath,
676
+ usesDynamicExpansion: true,
677
+ dynamicExpansionRequireChildren: true,
678
+ });
679
+ treeNodeData.isExpanded = !treeNodeData.isExpanded;
680
+ }
681
+ }
682
+ }
683
+ }
684
+ hasTotals() {
685
+ return this.totals && Object.keys(this.totals).length > 0;
686
+ }
687
+ handleChildren(treeNode, expand) {
688
+ for (let index = 0; index < treeNode.children.length; index++) {
689
+ let node = treeNode.children[index];
690
+ if (!node.disabled) {
691
+ node.isExpanded = expand;
692
+ if (node.children) {
693
+ this.handleChildren(node, expand);
694
+ }
695
+ }
696
+ }
697
+ }
698
+ /**
699
+ * Given a nodePath, transform that array into
700
+ * @param nodePath
701
+ */
702
+ selectedNodeToString(nodePath) {
703
+ let strToRet = '';
704
+ if (nodePath && nodePath.length) {
705
+ strToRet = nodePath[0].toString();
706
+ for (let i = 1; i < nodePath.length; i++) {
707
+ strToRet += `,${nodePath[i]}`;
708
+ }
709
+ }
710
+ return strToRet;
711
+ }
712
+ getFilterValueForTooltip(column) {
713
+ return this.filtersColumnMenuInstance.getFilterValueForTooltip(this.filters, column);
714
+ }
715
+ getTreeNode(nodePath) {
716
+ if (!nodePath || nodePath.length == 0) {
717
+ return null;
718
+ }
719
+ let father = this.data;
720
+ let node = null;
721
+ for (let index = 0; index < nodePath.length; index++) {
722
+ if (node) {
723
+ father = node.children;
724
+ }
725
+ const nodeIndex = nodePath[index];
726
+ node = father[nodeIndex];
727
+ }
728
+ return node;
729
+ }
730
+ onRemoveFilter(column) {
731
+ const newFilters = Object.assign({}, this.filters);
732
+ this.filtersColumnMenuInstance.removeFilter(newFilters, column.name);
733
+ this.filters = newFilters;
734
+ }
735
+ onGlobalFilterChange({ detail }) {
736
+ let value = '';
737
+ if (detail && detail.value) {
738
+ value = detail.value;
739
+ }
740
+ this.globalFilterValue = value;
741
+ }
742
+ getColumnValues(column) {
743
+ return this.filtersTreeItemsInstance.getColumnValues(this, column, this.globalFilterValue, this.filtersColumnMenuInstance);
744
+ }
745
+ getRows() {
746
+ return this.data ? this.data : [];
747
+ }
748
+ filterNodes() {
749
+ let items = this.filtersTreeItemsInstance.filterRows(this.getRows(), this.filters, this.globalFilterValue, this.getColumns(), this.filtersColumnMenuInstance);
750
+ this.visibleNodes = this.calculateVisibleNodes(items);
751
+ }
752
+ calculateVisibleNodes(items) {
753
+ let count = 0;
754
+ if (items) {
755
+ items.forEach((element) => {
756
+ if (element.visible) {
757
+ count++;
758
+ }
759
+ count += this.calculateVisibleNodes(element.children);
760
+ });
761
+ }
762
+ return count;
763
+ }
764
+ refreshStructureState() {
765
+ if (this.data) {
766
+ if (this.data.columns) {
767
+ __classPrivateFieldGet(this, _KupTree_kupManager, "f").debug.logMessage(this, 'Detected KupDataDataset: setting up tree as grid.', KupDebugCategory.WARNING);
768
+ const data = this.data;
769
+ this.columns = data.columns;
770
+ this.data = __classPrivateFieldGet(this, _KupTree_kupManager, "f").data.row.toNode(data);
771
+ this.showColumns = true;
772
+ this.showHeader = true;
773
+ }
774
+ // When the nodes must be expanded upon loading and the tree is not using a dynamicExpansion (and the current TreeNode is not disabled)
775
+ // the default value of the treeExpandedPropName is set to true
776
+ this.data.forEach((rootNode) => {
777
+ this.expandCollapseAllNodes(rootNode, this.expanded && !this.useDynamicExpansion);
778
+ });
779
+ this.selectedNode = [];
780
+ }
781
+ }
782
+ createIconElement(CSSClass, icon, iconColor) {
783
+ if (icon.indexOf('.') > -1 ||
784
+ icon.indexOf('/') > -1 ||
785
+ icon.indexOf('\\') > -1) {
786
+ CSSClass += ' is-image';
787
+ return (h("span", { class: CSSClass }, h("img", { src: icon })));
788
+ }
789
+ else {
790
+ let svg = `url('${getAssetPath(`./assets/svg/${icon}.svg`)}') no-repeat center`;
791
+ CSSClass += ' kup-icon';
792
+ let iconStyle = Object.assign(Object.assign({}, (iconColor ? { background: iconColor } : {})), { mask: svg, webkitMask: svg });
793
+ return h("span", { style: iconStyle, class: CSSClass });
794
+ }
795
+ }
796
+ getCellStyle(colName, cellStyle) {
797
+ // Controls if there are columns with a specified width
798
+ if (this.sizedColumns) {
799
+ let colWidth = '';
800
+ // Search if this column has a specified width
801
+ for (let j = 0; j < this.sizedColumns.length; j++) {
802
+ if (colName === this.sizedColumns[j].name) {
803
+ colWidth = this.sizedColumns[j].size;
804
+ break;
805
+ }
806
+ }
807
+ // Specific width has been found
808
+ if (colWidth) {
809
+ if (!cellStyle) {
810
+ cellStyle = {};
811
+ }
812
+ // Sets the width.
813
+ cellStyle['max-width'] = colWidth;
814
+ cellStyle['min-width'] = colWidth;
815
+ cellStyle['width'] = colWidth;
816
+ cellStyle['overflow'] = 'hidden';
817
+ }
818
+ }
819
+ return cellStyle;
820
+ }
821
+ /**
822
+ * Renders the header of the tree when it must be displayed as a table.
823
+ * @returns An array of table header cells.
824
+ */
825
+ renderHeader() {
826
+ return this.getHeadingColumns().map((column) => {
827
+ if (!this.isTreeColumnVisible() &&
828
+ column.name === treeMainColumnName)
829
+ return;
830
+ //---- Filter ----
831
+ let filter = null;
832
+ if (this.filtersColumnMenuInstance.hasFiltersForColumn(this.filters, column)) {
833
+ const svgLabel = __classPrivateFieldGet(this, _KupTree_kupManager, "f").language.translate(KupLanguageGeneric.REMOVE_FILTERS) + `: '${this.getFilterValueForTooltip(column)}'`;
834
+ /**
835
+ * When column has a filter but filters must not be displayed, shows an icon to remove the filter.
836
+ * Upon click, the filter gets removed.
837
+ */
838
+ filter = (h("span", { title: svgLabel, class: `kup-icon ${KupThemeIconValues.FILTER_REMOVE.replace('--', '')}`, onClick: (e) => {
839
+ e.stopPropagation();
840
+ this.onRemoveFilter(column);
841
+ } }));
842
+ }
843
+ return (h("th", { "data-column": column.name, style: this.getCellStyle(column.name, null) }, h("span", { class: "column-title" }, column.title), filter));
844
+ });
845
+ }
846
+ /**
847
+ * Renders a content with a part highlighted.
848
+ * NOTE: same in kup-accordion and in kup-tree
849
+ */
850
+ renderHighlightedContent(content, highlight, styleClass) {
851
+ let contentSlices = [];
852
+ if (highlight && content) {
853
+ let contentPart = content;
854
+ let end = contentPart
855
+ .toLowerCase()
856
+ .indexOf(highlight.toLowerCase());
857
+ while (end > -1) {
858
+ contentSlices.push(contentPart.substring(0, end));
859
+ contentSlices.push(h("span", { class: styleClass + '--highlighted' }, contentPart.substring(end, end + highlight.length)));
860
+ contentPart = contentPart.substring(end + highlight.length, contentPart.length);
861
+ end = contentPart
862
+ .toLowerCase()
863
+ .indexOf(highlight.toLowerCase());
864
+ }
865
+ if (end < contentPart.length) {
866
+ contentSlices.push(contentPart.substring(end, contentPart.length));
867
+ }
868
+ }
869
+ else {
870
+ contentSlices.push(content);
871
+ }
872
+ return (h("span", { class: styleClass, ref: (el) => this.contentRefs.push(el), title: this.preventXScroll ? content : null }, contentSlices));
873
+ }
874
+ /**
875
+ * Given a KupTreeNode, reads through its data then composes and returns its JSX object.
876
+ * @param treeNodeData - The KupTreeNode object to parse.
877
+ * @param treeNodePath - A string containing the comma(,) separated indexes of the KupTreeNodes to use,
878
+ * sorted from left to right, to access the current KupTreeNode starting from the data prop children object.
879
+ * @param treeNodeDepth - An integer to keep track of the depth level of the current KupTreeNode. Used for indentation.
880
+ * @returns The the JSX created from the current tree node.
881
+ */
882
+ renderTreeNode(treeNodeData, treeNodePath, treeNodeDepth = 0) {
883
+ // Creates the indentation of the current element. Use a css variable to specify padding.
884
+ let indent = treeNodeDepth ? (h("span", { class: "kup-tree__indent", style: {
885
+ ['--kup_tree_node_depth']: this.asAccordion
886
+ ? (treeNodeDepth - 1).toString()
887
+ : treeNodeDepth.toString(),
888
+ } })) : null;
889
+ // If the tree node is expandable, adds the icon to show the expansion.
890
+ // If expandable, also add the callback on the click action.
891
+ // If it is not expandable, we simply add a placeholder with no icons.
892
+ const hasExpandIcon = !!(treeNodeData.expandable &&
893
+ ((treeNodeData.children && treeNodeData.children.length) ||
894
+ this.useDynamicExpansion));
895
+ let expandClass = 'expand-icon kup-tree__icon kup-tree__node__expander';
896
+ if (hasExpandIcon) {
897
+ expandClass += ' kup-icon';
898
+ if (this.asAccordion && treeNodeDepth === 0) {
899
+ expandClass += ` ${KupThemeIconValues.DROPDOWN.replace('--', '')}`;
900
+ }
901
+ else if (treeNodeData.isExpanded) {
902
+ expandClass += ` ${KupThemeIconValues.EXPANDED.replace('--', '')}`;
903
+ }
904
+ else {
905
+ expandClass += ` ${KupThemeIconValues.COLLAPSED.replace('--', '')}`;
906
+ }
907
+ }
908
+ let treeExpandIcon = (h("span", { title: __classPrivateFieldGet(this, _KupTree_kupManager, "f").language.translate(KupLanguageGeneric.EXPAND) +
909
+ '/' +
910
+ __classPrivateFieldGet(this, _KupTree_kupManager, "f").language.translate(KupLanguageGeneric.COLLAPSE) +
911
+ ' (CTRL + Click)', class: expandClass, onClick: this.expansionMode.toLowerCase() ===
912
+ KupTreeExpansionMode.DROPDOWN && !treeNodeData.disabled
913
+ ? (event) => {
914
+ event.stopPropagation();
915
+ this.hdlTreeNodeExpanderClick(treeNodeData, treeNodePath, event.ctrlKey);
916
+ }
917
+ : null }));
918
+ // When TreeNode icons are visible, creates the icon if one is specified
919
+ let treeNodeIcon = null;
920
+ if (this.showIcons) {
921
+ if (treeNodeData.icon) {
922
+ if (treeNodeData.icon === '') {
923
+ treeNodeIcon = h("span", { class: "kup-tree__icon" });
924
+ }
925
+ else {
926
+ treeNodeIcon = this.createIconElement('kup-tree__icon', treeNodeData.icon, treeNodeData.iconColor);
927
+ }
928
+ }
929
+ else {
930
+ treeNodeIcon = null;
931
+ }
932
+ }
933
+ // Composes additional options for the tree node element
934
+ let treeNodeOptions = {};
935
+ if (treeNodeData.hasOwnProperty('isExpanded') &&
936
+ treeNodeData.isExpanded &&
937
+ hasExpandIcon) {
938
+ // If the node is expanded it has this attribute set to if this node is expanded or not.
939
+ treeNodeOptions['data-is-expanded'] = treeNodeData.isExpanded;
940
+ }
941
+ // When can be expanded OR selected
942
+ if (!treeNodeData.disabled) {
943
+ treeNodeOptions['onClick'] = (e) => {
944
+ // Note: event must be cloned
945
+ // otherwise inside setTimeout will be exiting the Shadow DOM scope(causing loss of information, including target).
946
+ const clone = {};
947
+ for (const key in e) {
948
+ clone[key] = e[key];
949
+ }
950
+ this.clickTimeout.push(setTimeout(() => this.hdlTreeNodeClick(clone, treeNodeData, treeNodePath), 300));
951
+ };
952
+ }
953
+ // When a tree node is displayed as a table
954
+ let treeNodeCells = null;
955
+ let visibleCols = this.getVisibleColumns();
956
+ if (this.showColumns && visibleCols && visibleCols.length) {
957
+ treeNodeCells = [];
958
+ // Renders all the cells
959
+ for (let j = 0; j < visibleCols.length; j++) {
960
+ const column = visibleCols[j];
961
+ if (treeNodeData.cells && treeNodeData.cells[column.name]) {
962
+ const cell = treeNodeData.cells[column.name]
963
+ ? treeNodeData.cells[column.name]
964
+ : null;
965
+ const cellProps = {
966
+ cell: cell,
967
+ column: column,
968
+ component: this,
969
+ density: this.density,
970
+ editable: this.editableData,
971
+ renderKup: true,
972
+ row: treeNodeData,
973
+ setSizes: true,
974
+ };
975
+ treeNodeCells.push(h("td", { class: `grid-cell`, "data-cell": cell, "data-column": column.name }, h(FCell, Object.assign({}, cellProps))));
976
+ }
977
+ else {
978
+ treeNodeCells.push(h("td", { class: `grid-cell` }));
979
+ }
980
+ }
981
+ }
982
+ let title = undefined;
983
+ if (!__classPrivateFieldGet(this, _KupTree_kupManager, "f").objects.isEmptyKupObj(treeNodeData.obj) &&
984
+ __classPrivateFieldGet(this, _KupTree_kupManager, "f").debug.isDebug()) {
985
+ title =
986
+ treeNodeData.obj.t +
987
+ '; ' +
988
+ treeNodeData.obj.p +
989
+ '; ' +
990
+ treeNodeData.obj.k +
991
+ ';';
992
+ }
993
+ let treeNodeCell = null;
994
+ if (this.isTreeColumnVisible()) {
995
+ let content = '';
996
+ if (KupGlobalFilterMode.HIGHLIGHT === this.globalFilterMode) {
997
+ content = this.renderHighlightedContent(treeNodeData.value, this.globalFilterValue, 'cell-content');
998
+ }
999
+ else {
1000
+ content = (h("span", { ref: (el) => this.contentRefs.push(el), class: "cell-content", title: this.preventXScroll ? treeNodeData.value : null }, treeNodeData.value));
1001
+ }
1002
+ treeNodeCell = (h("td", { class: {
1003
+ 'first-node': treeNodeDepth === 0 ? true : false,
1004
+ 'mdc-ripple-surface': this.ripple &&
1005
+ !this.showColumns &&
1006
+ !treeNodeData.disabled,
1007
+ 'is-obj': !__classPrivateFieldGet(this, _KupTree_kupManager, "f").objects.isEmptyKupObj(treeNodeData.obj),
1008
+ }, style: treeNodeData.style || null, title: title, onDblClick: () => {
1009
+ this.onKupTreeNodeDblClick(treeNodeData, treeNodePath);
1010
+ } }, this.asAccordion && !treeNodeDepth
1011
+ ? [
1012
+ treeNodeIcon,
1013
+ content,
1014
+ hasExpandIcon ? treeExpandIcon : null,
1015
+ ]
1016
+ : [indent, treeExpandIcon, treeNodeIcon, content]));
1017
+ }
1018
+ return (h("tr", Object.assign({ class: {
1019
+ 'kup-tree__node': true,
1020
+ 'with-dyn': !treeNodeData.disabled,
1021
+ 'kup-tree__node--disabled': treeNodeData.disabled,
1022
+ 'kup-tree__node--first': treeNodeDepth ? false : true,
1023
+ 'kup-tree__node--selected': !treeNodeData.disabled &&
1024
+ treeNodePath ===
1025
+ this.selectedNodeToString(this.selectedNode),
1026
+ }, "data-row": treeNodeData, "data-tree-path": treeNodePath }, treeNodeOptions), treeNodeCell, treeNodeCells));
1027
+ }
1028
+ closeTotalMenu() {
1029
+ this.openedTotalMenu = null;
1030
+ __classPrivateFieldGet(this, _KupTree_kupManager, "f").removeClickCallback(this.clickCb);
1031
+ }
1032
+ isOpenedTotalMenuForColumn(column) {
1033
+ return this.openedTotalMenu === column;
1034
+ }
1035
+ onTotalsChange(event, column) {
1036
+ // close menu
1037
+ this.closeTotalMenu();
1038
+ if (column) {
1039
+ // must do this
1040
+ // otherwise does not fire the watcher
1041
+ const totalsCopy = Object.assign({}, this.totals);
1042
+ const value = event.detail.selected.id;
1043
+ if (value === TotalLabel.CANC) {
1044
+ if (this.totals && this.totals[column.name]) {
1045
+ delete totalsCopy[column.name];
1046
+ }
1047
+ }
1048
+ else {
1049
+ totalsCopy[column.name] = value;
1050
+ }
1051
+ this.totals = totalsCopy;
1052
+ }
1053
+ }
1054
+ renderFooter() {
1055
+ const nodesCell = h("td", null);
1056
+ const footerCells = this.getVisibleColumns().map((column) => {
1057
+ let totalMenu = undefined;
1058
+ let menuLabel = TotalLabel.CALC;
1059
+ const translation = {
1060
+ [TotalLabel.AVERAGE]: __classPrivateFieldGet(this, _KupTree_kupManager, "f").language.translate(KupLanguageTotals.AVERAGE),
1061
+ [TotalLabel.CALC]: __classPrivateFieldGet(this, _KupTree_kupManager, "f").language.translate(KupLanguageTotals.CALCULATE),
1062
+ [TotalLabel.CANC]: __classPrivateFieldGet(this, _KupTree_kupManager, "f").language.translate(KupLanguageTotals.CANCEL),
1063
+ [TotalLabel.COUNT]: __classPrivateFieldGet(this, _KupTree_kupManager, "f").language.translate(KupLanguageTotals.COUNT),
1064
+ [TotalLabel.DISTINCT]: __classPrivateFieldGet(this, _KupTree_kupManager, "f").language.translate(KupLanguageTotals.DISTINCT),
1065
+ [TotalLabel.MATH]: __classPrivateFieldGet(this, _KupTree_kupManager, "f").language.translate(KupLanguageTotals.FORMULA),
1066
+ [TotalLabel.MAX]: __classPrivateFieldGet(this, _KupTree_kupManager, "f").language.translate(KupLanguageTotals.MAXIMUM),
1067
+ [TotalLabel.MIN]: __classPrivateFieldGet(this, _KupTree_kupManager, "f").language.translate(KupLanguageTotals.MINIMUM),
1068
+ [TotalLabel.SUM]: __classPrivateFieldGet(this, _KupTree_kupManager, "f").language.translate(KupLanguageTotals.SUM),
1069
+ };
1070
+ if (this.totals) {
1071
+ const totalValue = this.totals[column.name];
1072
+ if (totalValue) {
1073
+ if (totalValue.startsWith(TotalMode.MATH)) {
1074
+ menuLabel = TotalLabel.MATH;
1075
+ }
1076
+ else {
1077
+ switch (totalValue) {
1078
+ case TotalMode.COUNT:
1079
+ menuLabel = TotalLabel.COUNT;
1080
+ break;
1081
+ case TotalMode.DISTINCT:
1082
+ menuLabel = TotalLabel.DISTINCT;
1083
+ break;
1084
+ case TotalMode.SUM:
1085
+ menuLabel = TotalLabel.SUM;
1086
+ break;
1087
+ case TotalMode.AVERAGE:
1088
+ menuLabel = TotalLabel.AVERAGE;
1089
+ break;
1090
+ case TotalMode.MIN:
1091
+ menuLabel = TotalLabel.MIN;
1092
+ break;
1093
+ case TotalMode.MAX:
1094
+ menuLabel = TotalLabel.MAX;
1095
+ break;
1096
+ default:
1097
+ break;
1098
+ }
1099
+ }
1100
+ }
1101
+ }
1102
+ if (this.isOpenedTotalMenuForColumn(column.name)) {
1103
+ let listData = [
1104
+ {
1105
+ id: TotalMode.COUNT,
1106
+ value: translation[TotalLabel.COUNT],
1107
+ },
1108
+ {
1109
+ id: TotalMode.DISTINCT,
1110
+ value: translation[TotalLabel.DISTINCT],
1111
+ },
1112
+ ];
1113
+ if (__classPrivateFieldGet(this, _KupTree_kupManager, "f").objects.isNumber(column.obj)) {
1114
+ listData.push({
1115
+ id: TotalMode.SUM,
1116
+ value: translation[TotalLabel.SUM],
1117
+ }, {
1118
+ id: TotalMode.AVERAGE,
1119
+ value: translation[TotalLabel.AVERAGE],
1120
+ }, {
1121
+ id: TotalMode.MIN,
1122
+ value: translation[TotalLabel.MIN],
1123
+ }, {
1124
+ id: TotalMode.MAX,
1125
+ value: translation[TotalLabel.MAX],
1126
+ });
1127
+ }
1128
+ let selectedItem = listData.find((item) => item.value === menuLabel);
1129
+ if (selectedItem) {
1130
+ selectedItem.selected = true;
1131
+ listData.push({
1132
+ id: TotalLabel.CANC,
1133
+ separator: true,
1134
+ value: translation[TotalLabel.CANC],
1135
+ });
1136
+ }
1137
+ totalMenu = (h("kup-list", { class: `total-menu`, data: listData, id: "totals-menu", "is-menu": true, keyboardNavigation: true, "menu-visible": true, "onkup-list-click": (event) => this.onTotalsChange(event, column) }));
1138
+ }
1139
+ let value;
1140
+ if (menuLabel === TotalLabel.COUNT ||
1141
+ menuLabel === TotalLabel.DISTINCT) {
1142
+ value = this.footer[column.name];
1143
+ }
1144
+ else {
1145
+ value = __classPrivateFieldGet(this, _KupTree_kupManager, "f").math.numberToFormattedString(this.footer[column.name], column.decimals, column.obj ? column.obj.p : '');
1146
+ }
1147
+ return (h("td", { "data-column": column.name }, totalMenu, h("span", { class: "totals-value", title: translation[menuLabel] }, value)));
1148
+ });
1149
+ return (h("tfoot", null, h("tr", null, nodesCell, footerCells)));
1150
+ }
1151
+ didLoadInteractables() {
1152
+ this.interactableTouch.push(this.treeWrapperRef);
1153
+ const tapCb = (e) => {
1154
+ if (this.hold) {
1155
+ this.hold = false;
1156
+ return;
1157
+ }
1158
+ switch (e.button) {
1159
+ // right click
1160
+ case 2:
1161
+ this.kupTreeContextMenu.emit({
1162
+ comp: this,
1163
+ id: this.rootElement.id,
1164
+ details: this.contextMenuHandler(e),
1165
+ });
1166
+ break;
1167
+ }
1168
+ };
1169
+ const holdCb = (e) => {
1170
+ if (e.pointerType === 'pen' || e.pointerType === 'touch') {
1171
+ this.hold = true;
1172
+ this.kupTreeContextMenu.emit({
1173
+ comp: this,
1174
+ id: this.rootElement.id,
1175
+ details: this.contextMenuHandler(e),
1176
+ });
1177
+ }
1178
+ };
1179
+ __classPrivateFieldGet(this, _KupTree_kupManager, "f").interact.on(this.treeWrapperRef, KupPointerEventTypes.TAP, tapCb);
1180
+ __classPrivateFieldGet(this, _KupTree_kupManager, "f").interact.on(this.treeWrapperRef, KupPointerEventTypes.HOLD, holdCb);
1181
+ }
1182
+ totalMenuPosition() {
1183
+ if (this.rootElement.shadowRoot) {
1184
+ const menu = this.rootElement.shadowRoot.querySelector('#totals-menu');
1185
+ if (menu) {
1186
+ __classPrivateFieldGet(this, _KupTree_kupManager, "f").dynamicPosition.register(menu, this.totalMenuCoords);
1187
+ if (!this.clickCb) {
1188
+ this.clickCb = {
1189
+ cb: () => {
1190
+ this.closeTotalMenu();
1191
+ __classPrivateFieldGet(this, _KupTree_kupManager, "f").dynamicPosition.stop(menu);
1192
+ },
1193
+ el: menu,
1194
+ };
1195
+ }
1196
+ __classPrivateFieldGet(this, _KupTree_kupManager, "f").addClickCallback(this.clickCb, true);
1197
+ __classPrivateFieldGet(this, _KupTree_kupManager, "f").dynamicPosition.start(menu);
1198
+ menu.menuVisible = true;
1199
+ }
1200
+ }
1201
+ }
1202
+ /**
1203
+ * Given a KupTreeNode, reads through its data to compose and return the KupTreeNodes of the root of this KupTreeNode
1204
+ * and its children nodes, composing an array of JSX KupTreeNodes.
1205
+ * @param treeNodeData - The KupTreeNode object to parse.
1206
+ * @param treeNodePath - A string containing the comma(,) separated indexes of the KupTreeNodes to use,
1207
+ * sorted from left to right, to access the current KupTreeNode starting from the data prop children object.
1208
+ * @param treeNodeDepth - An integer to keep track of the depth level of the current KupTreeNode. Used for indentation.
1209
+ * @returns An array of JSX KupTreeNodes created from the given treeNodeData.
1210
+ */
1211
+ renderTree(treeNodeData, treeNodePath, treeNodeDepth = 0) {
1212
+ let treeNodes = [];
1213
+ if (treeNodeData && treeNodeData.visible == true) {
1214
+ // Creates and adds the root of the current tree
1215
+ treeNodes.push(this.renderTreeNode(treeNodeData, treeNodePath, treeNodeDepth));
1216
+ // Checks if the current node can be expanded, has children object, has children and is expanded
1217
+ if (treeNodeData.expandable &&
1218
+ treeNodeData.children &&
1219
+ treeNodeData.children.length &&
1220
+ treeNodeData.isExpanded) {
1221
+ for (let i = 0; i < treeNodeData.children.length; i++) {
1222
+ treeNodes = treeNodes.concat(this.renderTree(treeNodeData.children[i], treeNodePath + ',' + i, treeNodeDepth + 1));
1223
+ }
1224
+ }
1225
+ }
1226
+ return treeNodes;
1227
+ }
1228
+ setEllipsis() {
1229
+ const treeRect = this.rootElement.getBoundingClientRect();
1230
+ for (let index = 0; index < this.contentRefs.length; index++) {
1231
+ const content = this.contentRefs[index];
1232
+ if (content) {
1233
+ const cell = content.parentNode;
1234
+ if (this.asAccordion && cell.classList.contains('first-node')) {
1235
+ cell.style.width = treeRect.width + 'px';
1236
+ }
1237
+ else {
1238
+ content.classList.remove('cell-content--ellipsis');
1239
+ content.style.setProperty('--kup_tree_content_width', ``);
1240
+ const rect = content.getBoundingClientRect();
1241
+ if (rect.right > treeRect.right) {
1242
+ const failsafeOffset = 5;
1243
+ const delta = rect.right - treeRect.right;
1244
+ content.classList.add('cell-content--ellipsis');
1245
+ content.style.setProperty('--kup_tree_content_width', `${rect.width - delta - failsafeOffset}px`);
1246
+ }
1247
+ }
1248
+ }
1249
+ }
1250
+ }
1251
+ /*-------------------------------------------------*/
1252
+ /* L i f e c y c l e H o o k s */
1253
+ /*-------------------------------------------------*/
1254
+ componentWillLoad() {
1255
+ __classPrivateFieldGet(this, _KupTree_kupManager, "f").debug.logLoad(this, false);
1256
+ __classPrivateFieldGet(this, _KupTree_kupManager, "f").language.register(this);
1257
+ __classPrivateFieldGet(this, _KupTree_kupManager, "f").theme.register(this);
1258
+ this.columnMenuInstance = new KupColumnMenu();
1259
+ this.refreshStructureState();
1260
+ }
1261
+ componentDidLoad() {
1262
+ this.didLoadInteractables();
1263
+ this.kupDidLoad.emit({ comp: this, id: this.rootElement.id });
1264
+ __classPrivateFieldGet(this, _KupTree_kupManager, "f").resize.observe(this.rootElement);
1265
+ __classPrivateFieldGet(this, _KupTree_kupManager, "f").debug.logLoad(this, true);
1266
+ }
1267
+ componentWillRender() {
1268
+ __classPrivateFieldGet(this, _KupTree_kupManager, "f").debug.logRender(this, false);
1269
+ if (this.showFooter && this.columns) {
1270
+ this.footer = calcTotals(normalizeRows(this.getColumns(), this.nodesToRows()), this.totals);
1271
+ }
1272
+ this.filterNodes();
1273
+ }
1274
+ componentDidRender() {
1275
+ const root = this.rootElement.shadowRoot;
1276
+ if (root && this.ripple) {
1277
+ const rippleCells = root.querySelectorAll('.mdc-ripple-surface:not(.mdc-ripple-upgraded)');
1278
+ if (rippleCells) {
1279
+ for (let i = 0; i < rippleCells.length; i++) {
1280
+ MDCRipple.attachTo(rippleCells[i]);
1281
+ }
1282
+ }
1283
+ }
1284
+ if (root) {
1285
+ const fs = root.querySelectorAll('.f-text-field');
1286
+ for (let index = 0; index < fs.length; index++) {
1287
+ FTextFieldMDC(fs[index]);
1288
+ }
1289
+ }
1290
+ if (this.preventXScroll) {
1291
+ this.setEllipsis();
1292
+ }
1293
+ this.totalMenuPosition();
1294
+ this.checkScrollOnHover();
1295
+ this.setDynPosElements();
1296
+ // *** Store
1297
+ this.persistState();
1298
+ // ***
1299
+ this.oldWidth = this.rootElement.clientWidth;
1300
+ __classPrivateFieldGet(this, _KupTree_kupManager, "f").debug.logRender(this, true);
1301
+ }
1302
+ render() {
1303
+ this.contentRefs = [];
1304
+ this.sizedColumns = this.getSizedColumns();
1305
+ let wrapperClass = 'density-medium';
1306
+ switch (this.density) {
1307
+ case FCellPadding.DENSE:
1308
+ wrapperClass = 'density-dense';
1309
+ break;
1310
+ case FCellPadding.WIDE:
1311
+ wrapperClass = 'density-wide';
1312
+ break;
1313
+ }
1314
+ // Composes TreeNodes
1315
+ let treeNodes = [];
1316
+ if (this.data && this.data.length) {
1317
+ this.data.forEach((zeroDepthNode, index) => {
1318
+ treeNodes = treeNodes.concat(this.renderTree(zeroDepthNode, index.toString()));
1319
+ });
1320
+ }
1321
+ else {
1322
+ // There are no TreeNodes, so we print a single cell with a caption
1323
+ treeNodes.push(h("tr", null, h("td", null, __classPrivateFieldGet(this, _KupTree_kupManager, "f").language.translate(KupLanguageGeneric.EMPTY_DATA))));
1324
+ }
1325
+ // Calculates if header must be shown or not
1326
+ const visibleHeader = this.showHeader && this.showColumns;
1327
+ let filterField = null;
1328
+ if (this.globalFilter &&
1329
+ this.data &&
1330
+ this.data.length &&
1331
+ this.data.length > 0) {
1332
+ filterField = (h("div", { id: "global-filter" }, h("kup-text-field", { fullWidth: true, label: __classPrivateFieldGet(this, _KupTree_kupManager, "f").language.translate(KupLanguageSearch.SEARCH), icon: KupThemeIconValues.SEARCH, initialValue: this.globalFilterValue, "onkup-textfield-input": (event) => {
1333
+ window.clearTimeout(this.globalFilterTimeout);
1334
+ this.globalFilterTimeout = window.setTimeout(() => this.onGlobalFilterChange(event), 600);
1335
+ } })));
1336
+ }
1337
+ return (h(Host, null, h("style", null, __classPrivateFieldGet(this, _KupTree_kupManager, "f").theme.setKupStyle(this.rootElement)), h("div", { id: componentWrapperId, class: wrapperClass }, filterField, h("div", { class: "wrapper", ref: (el) => (this.treeWrapperRef =
1338
+ el) }, h("table", { class: "kup-tree", "data-show-columns": this.showColumns, onContextMenu: (e) => {
1339
+ e.preventDefault();
1340
+ } }, h("thead", { class: {
1341
+ 'header--is-visible': visibleHeader,
1342
+ } }, h("tr", null, visibleHeader ? this.renderHeader() : null)), h("tbody", null, treeNodes), (this.showFooter || this.hasTotals()) &&
1343
+ this.columns
1344
+ ? this.renderFooter()
1345
+ : null)))));
1346
+ }
1347
+ disconnectedCallback() {
1348
+ __classPrivateFieldGet(this, _KupTree_kupManager, "f").language.register(this);
1349
+ __classPrivateFieldGet(this, _KupTree_kupManager, "f").resize.unobserve(this.rootElement);
1350
+ __classPrivateFieldGet(this, _KupTree_kupManager, "f").theme.unregister(this);
1351
+ const dynamicPositionElements = this.rootElement.shadowRoot.querySelectorAll('[' + kupDynamicPositionAttribute + ']');
1352
+ if (dynamicPositionElements.length > 0) {
1353
+ __classPrivateFieldGet(this, _KupTree_kupManager, "f").dynamicPosition.unregister(Array.prototype.slice.call(dynamicPositionElements));
1354
+ }
1355
+ if (this.columnMenuCard) {
1356
+ this.columnMenuCard.remove();
1357
+ }
1358
+ if (this.scrollOnHover) {
1359
+ __classPrivateFieldGet(this, _KupTree_kupManager, "f").scrollOnHover.unregister(this.treeWrapperRef);
1360
+ }
1361
+ this.kupDidUnload.emit({ comp: this, id: this.rootElement.id });
1362
+ }
1363
+ static get is() { return "kup-tree"; }
1364
+ static get encapsulation() { return "shadow"; }
1365
+ static get originalStyleUrls() {
1366
+ return {
1367
+ "$": ["kup-tree.scss"]
1368
+ };
1369
+ }
1370
+ static get styleUrls() {
1371
+ return {
1372
+ "$": ["kup-tree.css"]
1373
+ };
1374
+ }
1375
+ static get properties() {
1376
+ return {
1377
+ "asAccordion": {
1378
+ "type": "boolean",
1379
+ "mutable": false,
1380
+ "complexType": {
1381
+ "original": "boolean",
1382
+ "resolved": "boolean",
1383
+ "references": {}
1384
+ },
1385
+ "required": false,
1386
+ "optional": false,
1387
+ "docs": {
1388
+ "tags": [{
1389
+ "name": "default",
1390
+ "text": "false"
1391
+ }],
1392
+ "text": "When enabled, the first level of depth will give an accordion look to nodes."
1393
+ },
1394
+ "attribute": "as-accordion",
1395
+ "reflect": true,
1396
+ "defaultValue": "false"
1397
+ },
1398
+ "columns": {
1399
+ "type": "unknown",
1400
+ "mutable": true,
1401
+ "complexType": {
1402
+ "original": "KupDataColumn[]",
1403
+ "resolved": "KupDataColumn[]",
1404
+ "references": {
1405
+ "KupDataColumn": {
1406
+ "location": "import",
1407
+ "path": "../../managers/kup-data/kup-data-declarations"
1408
+ }
1409
+ }
1410
+ },
1411
+ "required": false,
1412
+ "optional": true,
1413
+ "docs": {
1414
+ "tags": [],
1415
+ "text": "The columns of the tree when tree visualization is active."
1416
+ }
1417
+ },
1418
+ "customStyle": {
1419
+ "type": "string",
1420
+ "mutable": false,
1421
+ "complexType": {
1422
+ "original": "string",
1423
+ "resolved": "string",
1424
+ "references": {}
1425
+ },
1426
+ "required": false,
1427
+ "optional": false,
1428
+ "docs": {
1429
+ "tags": [{
1430
+ "name": "default",
1431
+ "text": "\"\""
1432
+ }, {
1433
+ "name": "see",
1434
+ "text": "https://ketchup.smeup.com/ketchup-showcase/#/customization"
1435
+ }],
1436
+ "text": "Custom style of the component."
1437
+ },
1438
+ "attribute": "custom-style",
1439
+ "reflect": false,
1440
+ "defaultValue": "''"
1441
+ },
1442
+ "data": {
1443
+ "type": "unknown",
1444
+ "mutable": true,
1445
+ "complexType": {
1446
+ "original": "KupTreeNode[]",
1447
+ "resolved": "KupTreeNode[]",
1448
+ "references": {
1449
+ "KupTreeNode": {
1450
+ "location": "import",
1451
+ "path": "./kup-tree-declarations"
1452
+ }
1453
+ }
1454
+ },
1455
+ "required": false,
1456
+ "optional": false,
1457
+ "docs": {
1458
+ "tags": [],
1459
+ "text": "The json data used to populate the tree view: the basic, always visible tree nodes."
1460
+ },
1461
+ "defaultValue": "[]"
1462
+ },
1463
+ "density": {
1464
+ "type": "string",
1465
+ "mutable": false,
1466
+ "complexType": {
1467
+ "original": "FCellPadding",
1468
+ "resolved": "FCellPadding.DENSE | FCellPadding.MEDIUM | FCellPadding.NONE | FCellPadding.WIDE",
1469
+ "references": {
1470
+ "FCellPadding": {
1471
+ "location": "import",
1472
+ "path": "../../f-components/f-cell/f-cell-declarations"
1473
+ }
1474
+ }
1475
+ },
1476
+ "required": false,
1477
+ "optional": false,
1478
+ "docs": {
1479
+ "tags": [],
1480
+ "text": "The density of the rows, defaults at 'medium' and can also be set to 'dense' or 'wide'."
1481
+ },
1482
+ "attribute": "density",
1483
+ "reflect": false,
1484
+ "defaultValue": "FCellPadding.MEDIUM"
1485
+ },
1486
+ "dynamicExpansionCallback": {
1487
+ "type": "unknown",
1488
+ "mutable": false,
1489
+ "complexType": {
1490
+ "original": "(\r\n treeNodeToExpand: KupTreeNode,\r\n treeNodePath: TreeNodePath\r\n ) => Promise<KupTreeNode[]> | undefined",
1491
+ "resolved": "(treeNodeToExpand: KupTreeNode, treeNodePath: TreeNodePath) => Promise<KupTreeNode[]>",
1492
+ "references": {
1493
+ "KupTreeNode": {
1494
+ "location": "import",
1495
+ "path": "./kup-tree-declarations"
1496
+ },
1497
+ "TreeNodePath": {
1498
+ "location": "import",
1499
+ "path": "./kup-tree-declarations"
1500
+ },
1501
+ "Promise": {
1502
+ "location": "global"
1503
+ }
1504
+ }
1505
+ },
1506
+ "required": false,
1507
+ "optional": false,
1508
+ "docs": {
1509
+ "tags": [{
1510
+ "name": "see",
1511
+ "text": "useDynamicExpansion"
1512
+ }],
1513
+ "text": "Function that gets invoked when a new set of nodes must be loaded as children of a node.\r\n\r\nWhen useDynamicExpansion is set, the tree component will have two different behaviors depending on the value of this prop.\r\n1 - If this prop is set to null, no callback to download data is available:\r\n the component will emit an event requiring the parent to load the children of the given node.\r\n2 - If this prop is set to have a callback, then the component will automatically make requests to load children of\r\n a given node. After the load has been completed, a different event will be fired to alert the parent of the change."
1514
+ },
1515
+ "defaultValue": "undefined"
1516
+ },
1517
+ "editableData": {
1518
+ "type": "boolean",
1519
+ "mutable": false,
1520
+ "complexType": {
1521
+ "original": "boolean",
1522
+ "resolved": "boolean",
1523
+ "references": {}
1524
+ },
1525
+ "required": false,
1526
+ "optional": false,
1527
+ "docs": {
1528
+ "tags": [{
1529
+ "name": "default",
1530
+ "text": "false"
1531
+ }],
1532
+ "text": "When set to true, editable cells will be rendered using input components."
1533
+ },
1534
+ "attribute": "editable-data",
1535
+ "reflect": false,
1536
+ "defaultValue": "false"
1537
+ },
1538
+ "enableExtraColumns": {
1539
+ "type": "boolean",
1540
+ "mutable": false,
1541
+ "complexType": {
1542
+ "original": "boolean",
1543
+ "resolved": "boolean",
1544
+ "references": {}
1545
+ },
1546
+ "required": false,
1547
+ "optional": false,
1548
+ "docs": {
1549
+ "tags": [],
1550
+ "text": "Enables the extracolumns add buttons."
1551
+ },
1552
+ "attribute": "enable-extra-columns",
1553
+ "reflect": false,
1554
+ "defaultValue": "true"
1555
+ },
1556
+ "expanded": {
1557
+ "type": "boolean",
1558
+ "mutable": false,
1559
+ "complexType": {
1560
+ "original": "boolean",
1561
+ "resolved": "boolean",
1562
+ "references": {}
1563
+ },
1564
+ "required": false,
1565
+ "optional": false,
1566
+ "docs": {
1567
+ "tags": [],
1568
+ "text": "Flag: the nodes of the whole tree must be already expanded upon loading. Disabled nodes do NOT get expanded."
1569
+ },
1570
+ "attribute": "expanded",
1571
+ "reflect": false,
1572
+ "defaultValue": "false"
1573
+ },
1574
+ "expansionMode": {
1575
+ "type": "string",
1576
+ "mutable": false,
1577
+ "complexType": {
1578
+ "original": "KupTreeExpansionMode",
1579
+ "resolved": "KupTreeExpansionMode.DROPDOWN | KupTreeExpansionMode.NODE",
1580
+ "references": {
1581
+ "KupTreeExpansionMode": {
1582
+ "location": "import",
1583
+ "path": "./kup-tree-declarations"
1584
+ }
1585
+ }
1586
+ },
1587
+ "required": false,
1588
+ "optional": false,
1589
+ "docs": {
1590
+ "tags": [{
1591
+ "name": "default",
1592
+ "text": "KupTreeExpansionMode.DROPDOWN"
1593
+ }],
1594
+ "text": "Behavior of nodes' expansion: it can be chosen between expanding a node by clicking on the dropdown icon, or by clicking on the whole node."
1595
+ },
1596
+ "attribute": "expansion-mode",
1597
+ "reflect": false,
1598
+ "defaultValue": "KupTreeExpansionMode.DROPDOWN"
1599
+ },
1600
+ "filters": {
1601
+ "type": "unknown",
1602
+ "mutable": true,
1603
+ "complexType": {
1604
+ "original": "GenericFilter",
1605
+ "resolved": "GenericFilter",
1606
+ "references": {
1607
+ "GenericFilter": {
1608
+ "location": "import",
1609
+ "path": "../../utils/filters/filters-declarations"
1610
+ }
1611
+ }
1612
+ },
1613
+ "required": false,
1614
+ "optional": false,
1615
+ "docs": {
1616
+ "tags": [],
1617
+ "text": "List of filters set by the user."
1618
+ },
1619
+ "defaultValue": "{}"
1620
+ },
1621
+ "globalFilter": {
1622
+ "type": "boolean",
1623
+ "mutable": false,
1624
+ "complexType": {
1625
+ "original": "boolean",
1626
+ "resolved": "boolean",
1627
+ "references": {}
1628
+ },
1629
+ "required": false,
1630
+ "optional": false,
1631
+ "docs": {
1632
+ "tags": [],
1633
+ "text": "When set to true it activates the global filter."
1634
+ },
1635
+ "attribute": "global-filter",
1636
+ "reflect": false,
1637
+ "defaultValue": "false"
1638
+ },
1639
+ "globalFilterValue": {
1640
+ "type": "string",
1641
+ "mutable": true,
1642
+ "complexType": {
1643
+ "original": "string",
1644
+ "resolved": "string",
1645
+ "references": {}
1646
+ },
1647
+ "required": false,
1648
+ "optional": false,
1649
+ "docs": {
1650
+ "tags": [],
1651
+ "text": "The value of the global filter."
1652
+ },
1653
+ "attribute": "global-filter-value",
1654
+ "reflect": true,
1655
+ "defaultValue": "''"
1656
+ },
1657
+ "globalFilterMode": {
1658
+ "type": "string",
1659
+ "mutable": false,
1660
+ "complexType": {
1661
+ "original": "KupGlobalFilterMode",
1662
+ "resolved": "KupGlobalFilterMode.HIGHLIGHT | KupGlobalFilterMode.SIMPLE",
1663
+ "references": {
1664
+ "KupGlobalFilterMode": {
1665
+ "location": "import",
1666
+ "path": "../../utils/filters/filters-declarations"
1667
+ }
1668
+ }
1669
+ },
1670
+ "required": false,
1671
+ "optional": false,
1672
+ "docs": {
1673
+ "tags": [],
1674
+ "text": "The mode of the global filter (default SIMPLE)"
1675
+ },
1676
+ "attribute": "global-filter-mode",
1677
+ "reflect": false,
1678
+ "defaultValue": "KupGlobalFilterMode.SIMPLE"
1679
+ },
1680
+ "preventXScroll": {
1681
+ "type": "boolean",
1682
+ "mutable": false,
1683
+ "complexType": {
1684
+ "original": "boolean",
1685
+ "resolved": "boolean",
1686
+ "references": {}
1687
+ },
1688
+ "required": false,
1689
+ "optional": false,
1690
+ "docs": {
1691
+ "tags": [{
1692
+ "name": "default",
1693
+ "text": "false;"
1694
+ }],
1695
+ "text": "Experimental feature: when active, the tree will try to prevent horizontal overflowing elements by setting a width on the content of the table cells.\r\nIt works only on cells of the main column."
1696
+ },
1697
+ "attribute": "prevent-x-scroll",
1698
+ "reflect": true,
1699
+ "defaultValue": "false"
1700
+ },
1701
+ "removableColumns": {
1702
+ "type": "boolean",
1703
+ "mutable": false,
1704
+ "complexType": {
1705
+ "original": "boolean",
1706
+ "resolved": "boolean",
1707
+ "references": {}
1708
+ },
1709
+ "required": false,
1710
+ "optional": false,
1711
+ "docs": {
1712
+ "tags": [],
1713
+ "text": "Sets the possibility to remove the selected column."
1714
+ },
1715
+ "attribute": "removable-columns",
1716
+ "reflect": false,
1717
+ "defaultValue": "true"
1718
+ },
1719
+ "ripple": {
1720
+ "type": "boolean",
1721
+ "mutable": false,
1722
+ "complexType": {
1723
+ "original": "boolean",
1724
+ "resolved": "boolean",
1725
+ "references": {}
1726
+ },
1727
+ "required": false,
1728
+ "optional": false,
1729
+ "docs": {
1730
+ "tags": [{
1731
+ "name": "default",
1732
+ "text": "true"
1733
+ }],
1734
+ "text": "When enabled displays Material's ripple effect on nodes (only when no columns are displayed)."
1735
+ },
1736
+ "attribute": "ripple",
1737
+ "reflect": false,
1738
+ "defaultValue": "true"
1739
+ },
1740
+ "scrollOnHover": {
1741
+ "type": "boolean",
1742
+ "mutable": false,
1743
+ "complexType": {
1744
+ "original": "boolean",
1745
+ "resolved": "boolean",
1746
+ "references": {}
1747
+ },
1748
+ "required": false,
1749
+ "optional": false,
1750
+ "docs": {
1751
+ "tags": [],
1752
+ "text": "Activates the scroll on hover function."
1753
+ },
1754
+ "attribute": "scroll-on-hover",
1755
+ "reflect": false,
1756
+ "defaultValue": "false"
1757
+ },
1758
+ "showColumns": {
1759
+ "type": "boolean",
1760
+ "mutable": true,
1761
+ "complexType": {
1762
+ "original": "boolean",
1763
+ "resolved": "boolean",
1764
+ "references": {}
1765
+ },
1766
+ "required": false,
1767
+ "optional": false,
1768
+ "docs": {
1769
+ "tags": [],
1770
+ "text": "Shows the tree data as a table."
1771
+ },
1772
+ "attribute": "show-columns",
1773
+ "reflect": false,
1774
+ "defaultValue": "false"
1775
+ },
1776
+ "showFilters": {
1777
+ "type": "boolean",
1778
+ "mutable": false,
1779
+ "complexType": {
1780
+ "original": "boolean",
1781
+ "resolved": "boolean",
1782
+ "references": {}
1783
+ },
1784
+ "required": false,
1785
+ "optional": false,
1786
+ "docs": {
1787
+ "tags": [],
1788
+ "text": "When set to true enables the column filters."
1789
+ },
1790
+ "attribute": "show-filters",
1791
+ "reflect": false,
1792
+ "defaultValue": "true"
1793
+ },
1794
+ "showFooter": {
1795
+ "type": "boolean",
1796
+ "mutable": false,
1797
+ "complexType": {
1798
+ "original": "boolean",
1799
+ "resolved": "boolean",
1800
+ "references": {}
1801
+ },
1802
+ "required": false,
1803
+ "optional": false,
1804
+ "docs": {
1805
+ "tags": [],
1806
+ "text": "When set to true shows the footer."
1807
+ },
1808
+ "attribute": "show-footer",
1809
+ "reflect": false,
1810
+ "defaultValue": "false"
1811
+ },
1812
+ "showHeader": {
1813
+ "type": "boolean",
1814
+ "mutable": true,
1815
+ "complexType": {
1816
+ "original": "boolean",
1817
+ "resolved": "boolean",
1818
+ "references": {}
1819
+ },
1820
+ "required": false,
1821
+ "optional": false,
1822
+ "docs": {
1823
+ "tags": [{
1824
+ "name": "see",
1825
+ "text": "showColumns"
1826
+ }],
1827
+ "text": "Flag: shows the header of the tree when the tree is displayed as a table."
1828
+ },
1829
+ "attribute": "show-header",
1830
+ "reflect": false,
1831
+ "defaultValue": "false"
1832
+ },
1833
+ "showIcons": {
1834
+ "type": "boolean",
1835
+ "mutable": false,
1836
+ "complexType": {
1837
+ "original": "boolean",
1838
+ "resolved": "boolean",
1839
+ "references": {}
1840
+ },
1841
+ "required": false,
1842
+ "optional": false,
1843
+ "docs": {
1844
+ "tags": [],
1845
+ "text": "Shows the icons of the nodes."
1846
+ },
1847
+ "attribute": "show-icons",
1848
+ "reflect": false,
1849
+ "defaultValue": "true"
1850
+ },
1851
+ "stateId": {
1852
+ "type": "string",
1853
+ "mutable": false,
1854
+ "complexType": {
1855
+ "original": "string",
1856
+ "resolved": "string",
1857
+ "references": {}
1858
+ },
1859
+ "required": false,
1860
+ "optional": false,
1861
+ "docs": {
1862
+ "tags": [],
1863
+ "text": ""
1864
+ },
1865
+ "attribute": "state-id",
1866
+ "reflect": false,
1867
+ "defaultValue": "''"
1868
+ },
1869
+ "store": {
1870
+ "type": "unknown",
1871
+ "mutable": false,
1872
+ "complexType": {
1873
+ "original": "KupStore",
1874
+ "resolved": "KupStore",
1875
+ "references": {
1876
+ "KupStore": {
1877
+ "location": "import",
1878
+ "path": "../kup-state/kup-store"
1879
+ }
1880
+ }
1881
+ },
1882
+ "required": false,
1883
+ "optional": false,
1884
+ "docs": {
1885
+ "tags": [],
1886
+ "text": ""
1887
+ }
1888
+ },
1889
+ "useDynamicExpansion": {
1890
+ "type": "boolean",
1891
+ "mutable": false,
1892
+ "complexType": {
1893
+ "original": "boolean",
1894
+ "resolved": "boolean",
1895
+ "references": {}
1896
+ },
1897
+ "required": false,
1898
+ "optional": false,
1899
+ "docs": {
1900
+ "tags": [{
1901
+ "name": "see",
1902
+ "text": "dynamicExpansionCallback"
1903
+ }],
1904
+ "text": "When the component must use the dynamic expansion feature to open its nodes, it means that not all the nodes of the\r\ntree have been passed inside the data property.\r\n\r\nTherefore, when expanding a node, the tree must emit an event (or run a given callback)\r\nand wait for the child nodes to be downloaded from the server.\r\n\r\nFor more information:"
1905
+ },
1906
+ "attribute": "use-dynamic-expansion",
1907
+ "reflect": false,
1908
+ "defaultValue": "false"
1909
+ },
1910
+ "totals": {
1911
+ "type": "unknown",
1912
+ "mutable": true,
1913
+ "complexType": {
1914
+ "original": "TotalsMap",
1915
+ "resolved": "TotalsMap",
1916
+ "references": {
1917
+ "TotalsMap": {
1918
+ "location": "import",
1919
+ "path": "./../kup-data-table/kup-data-table-declarations"
1920
+ }
1921
+ }
1922
+ },
1923
+ "required": false,
1924
+ "optional": false,
1925
+ "docs": {
1926
+ "tags": [],
1927
+ "text": "Defines the current totals options."
1928
+ }
1929
+ }
1930
+ };
1931
+ }
1932
+ static get states() {
1933
+ return {
1934
+ "treeColumnVisible": {},
1935
+ "openedTotalMenu": {},
1936
+ "columnMenuAnchor": {},
1937
+ "stateSwitcher": {},
1938
+ "selectedNode": {}
1939
+ };
1940
+ }
1941
+ static get events() {
1942
+ return [{
1943
+ "method": "kupTreeNodeCollapse",
1944
+ "name": "kup-tree-nodecollapse",
1945
+ "bubbles": true,
1946
+ "cancelable": false,
1947
+ "composed": true,
1948
+ "docs": {
1949
+ "tags": [],
1950
+ "text": "Fired when a KupTreeNode gets collapsed (closed)."
1951
+ },
1952
+ "complexType": {
1953
+ "original": "KupTreeNodeCollapseEventPayload",
1954
+ "resolved": "KupTreeNodeCollapseEventPayload",
1955
+ "references": {
1956
+ "KupTreeNodeCollapseEventPayload": {
1957
+ "location": "import",
1958
+ "path": "./kup-tree-declarations"
1959
+ }
1960
+ }
1961
+ }
1962
+ }, {
1963
+ "method": "kupTreeNodeExpand",
1964
+ "name": "kup-tree-nodeexpand",
1965
+ "bubbles": true,
1966
+ "cancelable": false,
1967
+ "composed": true,
1968
+ "docs": {
1969
+ "tags": [{
1970
+ "name": "event",
1971
+ "text": "kup-tree-nodeexpand"
1972
+ }, {
1973
+ "name": "type",
1974
+ "text": "{object}"
1975
+ }, {
1976
+ "name": "property",
1977
+ "text": "{TreeNodePath} treeNodePath - The array of indexes to retrieve the current treeNode inside the data prop."
1978
+ }, {
1979
+ "name": "property",
1980
+ "text": "{KupTreeNode} treeNode - Reference to the KupTreeNode data object which is being expanded (passed through the data prop)."
1981
+ }, {
1982
+ "name": "property",
1983
+ "text": "{boolean} usesDynamicExpansion - Flag to notify that the component is running in dynamicExpansion mode."
1984
+ }, {
1985
+ "name": "property",
1986
+ "text": "{boolean} dynamicExpansionRequireChildren - Flag to notify that the current dynamicExpansion event\r\nrequires the parent component to add KupTreeNode children to the given KupTreeNode."
1987
+ }, {
1988
+ "name": "see",
1989
+ "text": "useDynamicExpansion *"
1990
+ }, {
1991
+ "name": "see",
1992
+ "text": "dynamicExpansionCallback *"
1993
+ }, {
1994
+ "name": "since",
1995
+ "text": "1.0.0"
1996
+ }],
1997
+ "text": "Fired when a node expansion ion has been triggered.\r\nContains additional data when the tree is using the dynamicExpansion feature."
1998
+ },
1999
+ "complexType": {
2000
+ "original": "KupTreeNodeExpandEventPayload",
2001
+ "resolved": "KupTreeNodeExpandEventPayload",
2002
+ "references": {
2003
+ "KupTreeNodeExpandEventPayload": {
2004
+ "location": "import",
2005
+ "path": "./kup-tree-declarations"
2006
+ }
2007
+ }
2008
+ }
2009
+ }, {
2010
+ "method": "kupTreeNodeSelected",
2011
+ "name": "kup-tree-nodeselected",
2012
+ "bubbles": true,
2013
+ "cancelable": false,
2014
+ "composed": true,
2015
+ "docs": {
2016
+ "tags": [],
2017
+ "text": "Fired when a node of the tree has been selected"
2018
+ },
2019
+ "complexType": {
2020
+ "original": "KupTreeNodeSelectedEventPayload",
2021
+ "resolved": "KupTreeNodeSelectedEventPayload",
2022
+ "references": {
2023
+ "KupTreeNodeSelectedEventPayload": {
2024
+ "location": "import",
2025
+ "path": "./kup-tree-declarations"
2026
+ }
2027
+ }
2028
+ }
2029
+ }, {
2030
+ "method": "kupTreeNodeButtonClick",
2031
+ "name": "kup-tree-buttonclick",
2032
+ "bubbles": true,
2033
+ "cancelable": false,
2034
+ "composed": true,
2035
+ "docs": {
2036
+ "tags": [],
2037
+ "text": ""
2038
+ },
2039
+ "complexType": {
2040
+ "original": "KupTreeNodeButtonClickEventPayload",
2041
+ "resolved": "KupTreeNodeButtonClickEventPayload",
2042
+ "references": {
2043
+ "KupTreeNodeButtonClickEventPayload": {
2044
+ "location": "import",
2045
+ "path": "./kup-tree-declarations"
2046
+ }
2047
+ }
2048
+ }
2049
+ }, {
2050
+ "method": "kupTreeContextMenu",
2051
+ "name": "kup-tree-contextmenu",
2052
+ "bubbles": true,
2053
+ "cancelable": false,
2054
+ "composed": true,
2055
+ "docs": {
2056
+ "tags": [],
2057
+ "text": "Generic right click event on tree."
2058
+ },
2059
+ "complexType": {
2060
+ "original": "KupTreeContextMenuEventPayload",
2061
+ "resolved": "KupTreeContextMenuEventPayload",
2062
+ "references": {
2063
+ "KupTreeContextMenuEventPayload": {
2064
+ "location": "import",
2065
+ "path": "./kup-tree-declarations"
2066
+ }
2067
+ }
2068
+ }
2069
+ }, {
2070
+ "method": "kupTreeColumnMenu",
2071
+ "name": "kup-tree-columnmenu",
2072
+ "bubbles": true,
2073
+ "cancelable": false,
2074
+ "composed": true,
2075
+ "docs": {
2076
+ "tags": [],
2077
+ "text": "When the column menu is being opened/closed."
2078
+ },
2079
+ "complexType": {
2080
+ "original": "KupTreeColumnMenuEventPayload",
2081
+ "resolved": "KupTreeColumnMenuEventPayload",
2082
+ "references": {
2083
+ "KupTreeColumnMenuEventPayload": {
2084
+ "location": "import",
2085
+ "path": "./kup-tree-declarations"
2086
+ }
2087
+ }
2088
+ }
2089
+ }, {
2090
+ "method": "kupDidLoad",
2091
+ "name": "kup-tree-didload",
2092
+ "bubbles": true,
2093
+ "cancelable": false,
2094
+ "composed": true,
2095
+ "docs": {
2096
+ "tags": [],
2097
+ "text": ""
2098
+ },
2099
+ "complexType": {
2100
+ "original": "KupEventPayload",
2101
+ "resolved": "KupEventPayload",
2102
+ "references": {
2103
+ "KupEventPayload": {
2104
+ "location": "import",
2105
+ "path": "../../types/GenericTypes"
2106
+ }
2107
+ }
2108
+ }
2109
+ }, {
2110
+ "method": "kupDidUnload",
2111
+ "name": "kup-tree-didunload",
2112
+ "bubbles": true,
2113
+ "cancelable": false,
2114
+ "composed": true,
2115
+ "docs": {
2116
+ "tags": [],
2117
+ "text": "Triggered when stop propagation event"
2118
+ },
2119
+ "complexType": {
2120
+ "original": "KupEventPayload",
2121
+ "resolved": "KupEventPayload",
2122
+ "references": {
2123
+ "KupEventPayload": {
2124
+ "location": "import",
2125
+ "path": "../../types/GenericTypes"
2126
+ }
2127
+ }
2128
+ }
2129
+ }, {
2130
+ "method": "kupTreeNodeDblClick",
2131
+ "name": "kup-tree-nodedblclick",
2132
+ "bubbles": true,
2133
+ "cancelable": false,
2134
+ "composed": true,
2135
+ "docs": {
2136
+ "tags": [],
2137
+ "text": ""
2138
+ },
2139
+ "complexType": {
2140
+ "original": "KupTreeNodeCollapseEventPayload",
2141
+ "resolved": "KupTreeNodeCollapseEventPayload",
2142
+ "references": {
2143
+ "KupTreeNodeCollapseEventPayload": {
2144
+ "location": "import",
2145
+ "path": "./kup-tree-declarations"
2146
+ }
2147
+ }
2148
+ }
2149
+ }, {
2150
+ "method": "kupTreeDynamicMassExpansion",
2151
+ "name": "kup-tree-dynamicmassexpansion",
2152
+ "bubbles": true,
2153
+ "cancelable": false,
2154
+ "composed": true,
2155
+ "docs": {
2156
+ "tags": [],
2157
+ "text": ""
2158
+ },
2159
+ "complexType": {
2160
+ "original": "KupTreeDynamicMassExpansionEventPayload",
2161
+ "resolved": "KupTreeDynamicMassExpansionEventPayload",
2162
+ "references": {
2163
+ "KupTreeDynamicMassExpansionEventPayload": {
2164
+ "location": "import",
2165
+ "path": "./kup-tree-declarations"
2166
+ }
2167
+ }
2168
+ }
2169
+ }, {
2170
+ "method": "kupColumnRemove",
2171
+ "name": "kup-tree-columnremove",
2172
+ "bubbles": true,
2173
+ "cancelable": false,
2174
+ "composed": true,
2175
+ "docs": {
2176
+ "tags": [],
2177
+ "text": "Event fired when columns are removed (set to hidden)."
2178
+ },
2179
+ "complexType": {
2180
+ "original": "KupTreeColumnRemoveEventPayload",
2181
+ "resolved": "KupTreeColumnRemoveEventPayload",
2182
+ "references": {
2183
+ "KupTreeColumnRemoveEventPayload": {
2184
+ "location": "import",
2185
+ "path": "./kup-tree-declarations"
2186
+ }
2187
+ }
2188
+ }
2189
+ }];
2190
+ }
2191
+ static get methods() {
2192
+ return {
2193
+ "getSelectedNode": {
2194
+ "complexType": {
2195
+ "signature": "() => Promise<TreeNodePath>",
2196
+ "parameters": [],
2197
+ "references": {
2198
+ "Promise": {
2199
+ "location": "global"
2200
+ },
2201
+ "TreeNodePath": {
2202
+ "location": "import",
2203
+ "path": "./kup-tree-declarations"
2204
+ }
2205
+ },
2206
+ "return": "Promise<TreeNodePath>"
2207
+ },
2208
+ "docs": {
2209
+ "text": "This method will get the selected nodes of the component.",
2210
+ "tags": []
2211
+ }
2212
+ },
2213
+ "setSelectedNode": {
2214
+ "complexType": {
2215
+ "signature": "(treeNodePath: string, emitEvent?: boolean) => Promise<void>",
2216
+ "parameters": [{
2217
+ "tags": [],
2218
+ "text": ""
2219
+ }, {
2220
+ "tags": [{
2221
+ "name": "param",
2222
+ "text": "emitEvent - The event will always be emitted unless emitEvent is set to false."
2223
+ }],
2224
+ "text": "- The event will always be emitted unless emitEvent is set to false."
2225
+ }],
2226
+ "references": {
2227
+ "Promise": {
2228
+ "location": "global"
2229
+ }
2230
+ },
2231
+ "return": "Promise<void>"
2232
+ },
2233
+ "docs": {
2234
+ "text": "This method will set the selected rows of the component.",
2235
+ "tags": [{
2236
+ "name": "param",
2237
+ "text": "rowsIdentifiers - Array of ids (dataset) or indexes (rendered rows)."
2238
+ }, {
2239
+ "name": "param",
2240
+ "text": "emitEvent - The event will always be emitted unless emitEvent is set to false."
2241
+ }]
2242
+ }
2243
+ },
2244
+ "isEmpty": {
2245
+ "complexType": {
2246
+ "signature": "() => Promise<boolean>",
2247
+ "parameters": [],
2248
+ "references": {
2249
+ "Promise": {
2250
+ "location": "global"
2251
+ }
2252
+ },
2253
+ "return": "Promise<boolean>"
2254
+ },
2255
+ "docs": {
2256
+ "text": "True if there aren't visible nodes",
2257
+ "tags": []
2258
+ }
2259
+ },
2260
+ "closeColumnMenu": {
2261
+ "complexType": {
2262
+ "signature": "() => Promise<void>",
2263
+ "parameters": [],
2264
+ "references": {
2265
+ "Promise": {
2266
+ "location": "global"
2267
+ }
2268
+ },
2269
+ "return": "Promise<void>"
2270
+ },
2271
+ "docs": {
2272
+ "text": "Closes any opened column menu.",
2273
+ "tags": []
2274
+ }
2275
+ },
2276
+ "collapseAll": {
2277
+ "complexType": {
2278
+ "signature": "() => Promise<void>",
2279
+ "parameters": [],
2280
+ "references": {
2281
+ "Promise": {
2282
+ "location": "global"
2283
+ }
2284
+ },
2285
+ "return": "Promise<void>"
2286
+ },
2287
+ "docs": {
2288
+ "text": "Collapses all nodes.",
2289
+ "tags": []
2290
+ }
2291
+ },
2292
+ "expandAll": {
2293
+ "complexType": {
2294
+ "signature": "() => Promise<void>",
2295
+ "parameters": [],
2296
+ "references": {
2297
+ "Promise": {
2298
+ "location": "global"
2299
+ }
2300
+ },
2301
+ "return": "Promise<void>"
2302
+ },
2303
+ "docs": {
2304
+ "text": "Expands all nodes.",
2305
+ "tags": []
2306
+ }
2307
+ },
2308
+ "getProps": {
2309
+ "complexType": {
2310
+ "signature": "(descriptions?: boolean) => Promise<GenericObject>",
2311
+ "parameters": [{
2312
+ "tags": [{
2313
+ "name": "param",
2314
+ "text": "descriptions - When provided and true, the result will be the list of props with their description."
2315
+ }],
2316
+ "text": "- When provided and true, the result will be the list of props with their description."
2317
+ }],
2318
+ "references": {
2319
+ "Promise": {
2320
+ "location": "global"
2321
+ },
2322
+ "GenericObject": {
2323
+ "location": "import",
2324
+ "path": "../../types/GenericTypes"
2325
+ }
2326
+ },
2327
+ "return": "Promise<GenericObject>"
2328
+ },
2329
+ "docs": {
2330
+ "text": "Used to retrieve component's props values.",
2331
+ "tags": [{
2332
+ "name": "param",
2333
+ "text": "descriptions - When provided and true, the result will be the list of props with their description."
2334
+ }, {
2335
+ "name": "returns",
2336
+ "text": "List of props as object, each key will be a prop."
2337
+ }]
2338
+ }
2339
+ },
2340
+ "hideColumn": {
2341
+ "complexType": {
2342
+ "signature": "(column: KupDataColumn) => Promise<void>",
2343
+ "parameters": [{
2344
+ "tags": [{
2345
+ "name": "param",
2346
+ "text": "column - Column to hide."
2347
+ }],
2348
+ "text": "- Column to hide."
2349
+ }],
2350
+ "references": {
2351
+ "Promise": {
2352
+ "location": "global"
2353
+ },
2354
+ "KupDataColumn": {
2355
+ "location": "import",
2356
+ "path": "../../managers/kup-data/kup-data-declarations"
2357
+ }
2358
+ },
2359
+ "return": "Promise<void>"
2360
+ },
2361
+ "docs": {
2362
+ "text": "Hides the given column.",
2363
+ "tags": [{
2364
+ "name": "param",
2365
+ "text": "column - Column to hide."
2366
+ }]
2367
+ }
2368
+ },
2369
+ "openColumnMenu": {
2370
+ "complexType": {
2371
+ "signature": "(column: string) => Promise<void>",
2372
+ "parameters": [{
2373
+ "tags": [{
2374
+ "name": "param",
2375
+ "text": "column - Name of the column."
2376
+ }],
2377
+ "text": "- Name of the column."
2378
+ }],
2379
+ "references": {
2380
+ "Promise": {
2381
+ "location": "global"
2382
+ },
2383
+ "CustomEvent": {
2384
+ "location": "global"
2385
+ },
2386
+ "KupEventPayload": {
2387
+ "location": "import",
2388
+ "path": "../../types/GenericTypes"
2389
+ },
2390
+ "KupCardEventPayload": {
2391
+ "location": "import",
2392
+ "path": "../kup-card/kup-card-declarations"
2393
+ }
2394
+ },
2395
+ "return": "Promise<void>"
2396
+ },
2397
+ "docs": {
2398
+ "text": "Opens the column menu of the given column.",
2399
+ "tags": [{
2400
+ "name": "param",
2401
+ "text": "column - Name of the column."
2402
+ }]
2403
+ }
2404
+ },
2405
+ "refresh": {
2406
+ "complexType": {
2407
+ "signature": "() => Promise<void>",
2408
+ "parameters": [],
2409
+ "references": {
2410
+ "Promise": {
2411
+ "location": "global"
2412
+ }
2413
+ },
2414
+ "return": "Promise<void>"
2415
+ },
2416
+ "docs": {
2417
+ "text": "This method is used to trigger a new render of the component.",
2418
+ "tags": []
2419
+ }
2420
+ },
2421
+ "resizeCallback": {
2422
+ "complexType": {
2423
+ "signature": "() => Promise<void>",
2424
+ "parameters": [],
2425
+ "references": {
2426
+ "Promise": {
2427
+ "location": "global"
2428
+ }
2429
+ },
2430
+ "return": "Promise<void>"
2431
+ },
2432
+ "docs": {
2433
+ "text": "This method is invoked by KupManager whenever the component changes size.",
2434
+ "tags": []
2435
+ }
2436
+ },
2437
+ "setProps": {
2438
+ "complexType": {
2439
+ "signature": "(props: GenericObject) => Promise<void>",
2440
+ "parameters": [{
2441
+ "tags": [{
2442
+ "name": "param",
2443
+ "text": "props - Object containing props that will be set to the component."
2444
+ }],
2445
+ "text": "- Object containing props that will be set to the component."
2446
+ }],
2447
+ "references": {
2448
+ "Promise": {
2449
+ "location": "global"
2450
+ },
2451
+ "GenericObject": {
2452
+ "location": "import",
2453
+ "path": "../../types/GenericTypes"
2454
+ }
2455
+ },
2456
+ "return": "Promise<void>"
2457
+ },
2458
+ "docs": {
2459
+ "text": "Sets the props to the component.",
2460
+ "tags": [{
2461
+ "name": "param",
2462
+ "text": "props - Object containing props that will be set to the component."
2463
+ }]
2464
+ }
2465
+ }
2466
+ };
2467
+ }
2468
+ static get elementRef() { return "rootElement"; }
2469
+ static get watchers() {
2470
+ return [{
2471
+ "propName": "data",
2472
+ "methodName": "enrichDataWhenChanged"
2473
+ }, {
2474
+ "propName": "expanded",
2475
+ "methodName": "enrichStructureStateWhenChanged"
2476
+ }];
2477
+ }
2478
+ }
2479
+ _KupTree_kupManager = new WeakMap();