@sme.up/ketchup 8.0.1 → 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 (558) 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-c0ede055.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-1c17dbac.js → f-cell-ca9e4352.js} +472 -470
  6. package/dist/cjs/{f-checkbox-1148e791.js → f-checkbox-e2c6ecef.js} +23 -23
  7. package/dist/cjs/{f-chip-bace36bb.js → f-chip-e941fa19.js} +125 -125
  8. package/dist/cjs/{f-image-22174590.js → f-image-466b724f.js} +107 -107
  9. package/dist/cjs/{f-paginator-utils-e21e1f06.js → f-paginator-utils-f775ce67.js} +1548 -1547
  10. package/dist/cjs/{f-text-field-503f2bb0.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 -17563
  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-b994cf71.js → kup-manager-16b684bd.js} +7273 -7126
  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/data-table.js +0 -44
  40. package/dist/collection/assets/index.js +4 -0
  41. package/dist/collection/assets/planner.js +8189 -0
  42. package/dist/collection/collection-manifest.json +2 -2
  43. package/dist/collection/components/kup-accordion/kup-accordion-declarations.js +10 -10
  44. package/dist/collection/components/kup-accordion/kup-accordion.js +445 -445
  45. package/dist/collection/components/kup-autocomplete/kup-autocomplete-declarations.js +27 -27
  46. package/dist/collection/components/kup-autocomplete/kup-autocomplete.js +908 -908
  47. package/dist/collection/components/kup-badge/kup-badge-declarations.js +10 -10
  48. package/dist/collection/components/kup-badge/kup-badge.js +276 -276
  49. package/dist/collection/components/kup-box/kup-box-declarations.js +34 -33
  50. package/dist/collection/components/kup-box/kup-box-state.js +15 -15
  51. package/dist/collection/components/kup-box/kup-box.js +2159 -2079
  52. package/dist/collection/components/kup-button/kup-button-declarations.js +18 -18
  53. package/dist/collection/components/kup-button/kup-button.js +580 -580
  54. package/dist/collection/components/kup-button-list/kup-button-list-declarations.js +13 -13
  55. package/dist/collection/components/kup-button-list/kup-button-list.e2e.js +144 -0
  56. package/dist/collection/components/kup-button-list/kup-button-list.js +527 -527
  57. package/dist/collection/components/kup-calendar/kup-calendar-declarations.js +35 -35
  58. package/dist/collection/components/kup-calendar/kup-calendar.css +0 -4
  59. package/dist/collection/components/kup-calendar/kup-calendar.js +690 -690
  60. package/dist/collection/components/kup-card/box/kup-card-box.js +227 -227
  61. package/dist/collection/components/kup-card/built-in/kup-card-built-in.js +56 -56
  62. package/dist/collection/components/kup-card/built-in/kup-card-calendar.js +393 -449
  63. package/dist/collection/components/kup-card/built-in/kup-card-clock.js +308 -308
  64. package/dist/collection/components/kup-card/built-in/kup-card-column-drop-menu.js +165 -165
  65. package/dist/collection/components/kup-card/built-in/kup-card-message-box.js +10 -10
  66. package/dist/collection/components/kup-card/built-in/kup-card-numeric.js +118 -118
  67. package/dist/collection/components/kup-card/collapsible/kup-card-collapsible.js +64 -64
  68. package/dist/collection/components/kup-card/dialog/kup-card-dialog.js +217 -217
  69. package/dist/collection/components/kup-card/free/kup-card-free.js +22 -22
  70. package/dist/collection/components/kup-card/kup-card-declarations.js +98 -98
  71. package/dist/collection/components/kup-card/kup-card-helper.js +196 -196
  72. package/dist/collection/components/kup-card/kup-card.js +809 -809
  73. package/dist/collection/components/kup-card/scalable/kup-card-scalable.js +251 -251
  74. package/dist/collection/components/kup-card/standard/kup-card-standard.js +593 -593
  75. package/dist/collection/components/kup-cell/kup-cell-declarations.js +11 -11
  76. package/dist/collection/components/kup-cell/kup-cell.js +401 -401
  77. package/dist/collection/components/kup-chart/kup-chart-builder.js +93 -93
  78. package/dist/collection/components/kup-chart/kup-chart-declarations.js +49 -49
  79. package/dist/collection/components/kup-chart/kup-chart.js +1080 -1080
  80. package/dist/collection/components/kup-checkbox/kup-checkbox-declarations.js +13 -13
  81. package/dist/collection/components/kup-checkbox/kup-checkbox.js +433 -433
  82. package/dist/collection/components/kup-chip/kup-chip-declarations.js +12 -12
  83. package/dist/collection/components/kup-chip/kup-chip.js +558 -558
  84. package/dist/collection/components/kup-color-picker/kup-color-picker-declarations.js +12 -12
  85. package/dist/collection/components/kup-color-picker/kup-color-picker.js +546 -546
  86. package/dist/collection/components/kup-combobox/kup-combobox-declarations.js +15 -15
  87. package/dist/collection/components/kup-combobox/kup-combobox.js +821 -821
  88. package/dist/collection/components/kup-dash/kup-dash.js +171 -171
  89. package/dist/collection/components/kup-dash-list/kup-dash-list.js +327 -327
  90. package/dist/collection/components/kup-dashboard/kup-dashboard-declarations.js +10 -10
  91. package/dist/collection/components/kup-dashboard/kup-dashboard.js +588 -588
  92. package/dist/collection/components/kup-data-table/kup-data-table-declarations.js +156 -156
  93. package/dist/collection/components/kup-data-table/kup-data-table-helper.js +808 -809
  94. package/dist/collection/components/kup-data-table/kup-data-table-state.js +36 -36
  95. package/dist/collection/components/kup-data-table/kup-data-table.js +5527 -5526
  96. package/dist/collection/components/kup-date-picker/kup-date-picker-declarations.js +18 -18
  97. package/dist/collection/components/kup-date-picker/kup-date-picker.js +816 -816
  98. package/dist/collection/components/kup-dialog/kup-dialog-declarations.js +14 -14
  99. package/dist/collection/components/kup-dialog/kup-dialog.js +467 -467
  100. package/dist/collection/components/kup-drawer/kup-drawer-declarations.js +10 -10
  101. package/dist/collection/components/kup-drawer/kup-drawer.e2e.js +9 -0
  102. package/dist/collection/components/kup-drawer/kup-drawer.js +383 -383
  103. package/dist/collection/components/kup-dropdown-button/kup-dropdown-button-declarations.js +18 -18
  104. package/dist/collection/components/kup-dropdown-button/kup-dropdown-button.js +800 -800
  105. package/dist/collection/components/kup-echart/kup-echart-declarations.js +52 -52
  106. package/dist/collection/components/kup-echart/kup-echart.js +1437 -1437
  107. package/dist/collection/components/kup-family-tree/kup-family-tree-declarations.js +15 -15
  108. package/dist/collection/components/kup-family-tree/kup-family-tree.js +829 -829
  109. package/dist/collection/components/kup-form/kup-form-declarations.js +29 -29
  110. package/dist/collection/components/kup-form/kup-form.js +731 -731
  111. package/dist/collection/components/kup-gauge/kup-gauge-declarations.js +26 -26
  112. package/dist/collection/components/kup-gauge/kup-gauge.js +764 -764
  113. package/dist/collection/components/kup-grid/kup-grid-declarations.js +10 -10
  114. package/dist/collection/components/kup-grid/kup-grid.js +253 -253
  115. package/dist/collection/components/kup-iframe/kup-iframe-declarations.js +10 -10
  116. package/dist/collection/components/kup-iframe/kup-iframe.js +281 -281
  117. package/dist/collection/components/kup-image/canvas/kup-image-canvas-declarations.js +184 -184
  118. package/dist/collection/components/kup-image/canvas/kup-image-canvas-helper.js +19 -19
  119. package/dist/collection/components/kup-image/canvas/kup-image-canvas.js +225 -225
  120. package/dist/collection/components/kup-image/kup-image-declarations.js +16 -16
  121. package/dist/collection/components/kup-image/kup-image.js +491 -491
  122. package/dist/collection/components/kup-image-list/kup-image-list-declarations.js +10 -10
  123. package/dist/collection/components/kup-image-list/kup-image-list-state.js +9 -9
  124. package/dist/collection/components/kup-image-list/kup-image-list.js +533 -533
  125. package/dist/collection/components/kup-lazy/kup-lazy-declarations.js +20 -20
  126. package/dist/collection/components/kup-lazy/kup-lazy.js +430 -430
  127. package/dist/collection/components/kup-list/kup-list-declarations.js +34 -34
  128. package/dist/collection/components/kup-list/kup-list-helper.js +121 -121
  129. package/dist/collection/components/kup-list/kup-list.js +949 -949
  130. package/dist/collection/components/kup-magic-box/kup-magic-box-declarations.js +23 -23
  131. package/dist/collection/components/kup-magic-box/kup-magic-box.js +431 -431
  132. package/dist/collection/components/kup-nav-bar/kup-nav-bar-declarations.js +21 -21
  133. package/dist/collection/components/kup-nav-bar/kup-nav-bar.js +315 -315
  134. package/dist/collection/components/kup-numeric-picker/kup-numeric-picker-declarations.js +16 -16
  135. package/dist/collection/components/kup-numeric-picker/kup-numeric-picker.js +864 -864
  136. package/dist/collection/components/kup-photo-frame/kup-photo-frame-declarations.js +10 -10
  137. package/dist/collection/components/kup-photo-frame/kup-photo-frame.js +372 -372
  138. package/dist/collection/components/kup-planner/kup-planner-declarations.js +83 -76
  139. package/dist/collection/components/kup-planner/kup-planner-helper.js +54 -54
  140. package/dist/collection/components/kup-planner/kup-planner-state.js +16 -0
  141. package/dist/collection/components/kup-planner/kup-planner.js +1725 -1352
  142. package/dist/collection/components/kup-probe/kup-probe.js +358 -358
  143. package/dist/collection/components/kup-progress-bar/kup-progress-bar-declarations.js +14 -14
  144. package/dist/collection/components/kup-progress-bar/kup-progress-bar.js +405 -405
  145. package/dist/collection/components/kup-qlik/kup-qlik-declarations.js +1 -1
  146. package/dist/collection/components/kup-qlik/kup-qlik.js +326 -326
  147. package/dist/collection/components/kup-radio/kup-radio-declarations.js +12 -12
  148. package/dist/collection/components/kup-radio/kup-radio.js +398 -398
  149. package/dist/collection/components/kup-rating/kup-rating-declarations.js +11 -11
  150. package/dist/collection/components/kup-rating/kup-rating.js +332 -332
  151. package/dist/collection/components/kup-snackbar/kup-snackbar-declarations.js +13 -13
  152. package/dist/collection/components/kup-snackbar/kup-snackbar.js +389 -389
  153. package/dist/collection/components/kup-spinner/kup-spinner-declarations.js +15 -15
  154. package/dist/collection/components/kup-spinner/kup-spinner.js +468 -468
  155. package/dist/collection/components/kup-state/kup-state.js +1 -1
  156. package/dist/collection/components/kup-state/kup-store.js +1 -1
  157. package/dist/collection/components/kup-state/mock-store.js +13 -13
  158. package/dist/collection/components/kup-switch/kup-switch-declarations.js +12 -12
  159. package/dist/collection/components/kup-switch/kup-switch.js +402 -402
  160. package/dist/collection/components/kup-tab-bar/kup-tab-bar-declarations.js +10 -10
  161. package/dist/collection/components/kup-tab-bar/kup-tab-bar.js +443 -443
  162. package/dist/collection/components/kup-text-field/kup-text-field-declarations.js +35 -35
  163. package/dist/collection/components/kup-text-field/kup-text-field.js +1193 -1190
  164. package/dist/collection/components/kup-time-picker/kup-time-picker-declarations.js +14 -14
  165. package/dist/collection/components/kup-time-picker/kup-time-picker.js +921 -921
  166. package/dist/collection/components/kup-tree/kup-tree-declarations.js +43 -43
  167. package/dist/collection/components/kup-tree/kup-tree-faker.js +305 -305
  168. package/dist/collection/components/kup-tree/kup-tree-state.js +15 -15
  169. package/dist/collection/components/kup-tree/kup-tree.js +2479 -2479
  170. package/dist/collection/f-components/f-button/f-button-declarations.js +17 -17
  171. package/dist/collection/f-components/f-button/f-button.js +91 -91
  172. package/dist/collection/f-components/f-cell/f-cell-declarations.js +158 -158
  173. package/dist/collection/f-components/f-cell/f-cell.js +429 -428
  174. package/dist/collection/f-components/f-checkbox/f-checkbox-declarations.js +1 -1
  175. package/dist/collection/f-components/f-checkbox/f-checkbox.js +16 -16
  176. package/dist/collection/f-components/f-chip/f-chip-declarations.js +15 -15
  177. package/dist/collection/f-components/f-chip/f-chip.js +101 -101
  178. package/dist/collection/f-components/f-image/f-image-declarations.js +8 -8
  179. package/dist/collection/f-components/f-image/f-image.js +100 -100
  180. package/dist/collection/f-components/f-paginator/f-paginator-declarations.js +5 -5
  181. package/dist/collection/f-components/f-paginator/f-paginator-utils.js +28 -28
  182. package/dist/collection/f-components/f-paginator/f-paginator.js +86 -86
  183. package/dist/collection/f-components/f-switch/f-switch-declarations.js +1 -1
  184. package/dist/collection/f-components/f-switch/f-switch.js +12 -12
  185. package/dist/collection/f-components/f-text-field/f-text-field-declarations.js +1 -1
  186. package/dist/collection/f-components/f-text-field/f-text-field-mdc.js +29 -29
  187. package/dist/collection/f-components/f-text-field/f-text-field.js +151 -151
  188. package/dist/collection/managers/kup-data/kup-data-cell-helper.js +86 -86
  189. package/dist/collection/managers/kup-data/kup-data-column-helper.js +300 -300
  190. package/dist/collection/managers/kup-data/kup-data-declarations.js +10 -10
  191. package/dist/collection/managers/kup-data/kup-data-node-helper.js +165 -165
  192. package/dist/collection/managers/kup-data/kup-data-row-helper.js +28 -28
  193. package/dist/collection/managers/kup-data/kup-data.js +499 -497
  194. package/dist/collection/managers/kup-dates/kup-dates-declarations.js +43 -32
  195. package/dist/collection/managers/kup-dates/kup-dates.js +654 -343
  196. package/dist/collection/managers/kup-debug/kup-debug-declarations.js +20 -20
  197. package/dist/collection/managers/kup-debug/kup-debug.js +670 -670
  198. package/dist/collection/managers/kup-dynamic-position/kup-dynamic-position-declarations.js +27 -27
  199. package/dist/collection/managers/kup-dynamic-position/kup-dynamic-position.js +244 -244
  200. package/dist/collection/managers/kup-interact/kup-interact-declarations.js +49 -49
  201. package/dist/collection/managers/kup-interact/kup-interact.js +397 -397
  202. package/dist/collection/managers/kup-language/kup-language-declarations.js +211 -211
  203. package/dist/collection/managers/kup-language/kup-language.js +151 -151
  204. package/dist/collection/managers/kup-manager/kup-manager-declarations.js +1 -1
  205. package/dist/collection/managers/kup-manager/kup-manager.js +303 -303
  206. package/dist/collection/managers/kup-math/kup-math-declarations.js +13 -13
  207. package/dist/collection/managers/kup-math/kup-math-helper.js +39 -39
  208. package/dist/collection/managers/kup-math/kup-math.js +413 -242
  209. package/dist/collection/managers/kup-objects/kup-objects-declarations.js +1 -1
  210. package/dist/collection/managers/kup-objects/kup-objects.js +387 -387
  211. package/dist/collection/managers/kup-scroll-on-hover/kup-scroll-on-hover-declarations.js +10 -10
  212. package/dist/collection/managers/kup-scroll-on-hover/kup-scroll-on-hover.js +334 -334
  213. package/dist/collection/managers/kup-search/kup-search-declarations.js +1 -1
  214. package/dist/collection/managers/kup-search/kup-search.js +75 -75
  215. package/dist/collection/managers/kup-theme/kup-theme-declarations.js +177 -177
  216. package/dist/collection/managers/kup-theme/kup-theme.js +715 -715
  217. package/dist/collection/managers/kup-toolbar/kup-toolbar-declarations.js +9 -9
  218. package/dist/collection/managers/kup-toolbar/kup-toolbar.js +111 -111
  219. package/dist/collection/managers/kup-tooltip/kup-tooltip-declarations.js +1 -1
  220. package/dist/collection/managers/kup-tooltip/kup-tooltip.js +229 -229
  221. package/dist/collection/types/GenericTypes.js +54 -54
  222. package/dist/collection/utils/cell-utils.js +156 -157
  223. package/dist/collection/utils/filters/filters-column-menu.js +360 -360
  224. package/dist/collection/utils/filters/filters-declarations.js +25 -25
  225. package/dist/collection/utils/filters/filters-rows.js +238 -238
  226. package/dist/collection/utils/filters/filters-tree-items.js +117 -117
  227. package/dist/collection/utils/filters/filters.js +287 -289
  228. package/dist/collection/utils/kup-column-menu/kup-column-menu-declarations.js +20 -20
  229. package/dist/collection/utils/kup-column-menu/kup-column-menu.js +751 -751
  230. package/dist/collection/utils/utils.js +84 -497
  231. package/dist/collection/variables/GenericVariables.js +4 -4
  232. package/dist/components/kup-accordion.js +355 -355
  233. package/dist/components/kup-autocomplete2.js +31828 -31684
  234. package/dist/components/kup-box2.js +1470 -1406
  235. package/dist/components/kup-calendar.js +9788 -10280
  236. package/dist/components/kup-card.js +1 -1
  237. package/dist/components/kup-cell.js +325 -325
  238. package/dist/components/kup-chart.js +1 -1
  239. package/dist/components/kup-checkbox.js +1 -1
  240. package/dist/components/kup-chip.js +1 -1
  241. package/dist/components/kup-color-picker.js +1 -1
  242. package/dist/components/kup-combobox.js +1 -1
  243. package/dist/components/kup-dash-list.js +276 -276
  244. package/dist/components/kup-dash2.js +220 -220
  245. package/dist/components/kup-dashboard.js +549 -549
  246. package/dist/components/kup-data-table.js +1 -1
  247. package/dist/components/kup-date-picker.js +1 -1
  248. package/dist/components/kup-dialog.js +1 -1
  249. package/dist/components/kup-drawer.js +295 -295
  250. package/dist/components/kup-dropdown-button.js +1 -1
  251. package/dist/components/kup-echart2.js +7312 -6765
  252. package/dist/components/kup-family-tree.js +604 -604
  253. package/dist/components/kup-form.js +1 -1
  254. package/dist/components/kup-gauge.js +1 -1
  255. package/dist/components/kup-grid2.js +252 -252
  256. package/dist/components/kup-iframe.js +250 -250
  257. package/dist/components/kup-image-list.js +407 -407
  258. package/dist/components/kup-image.js +1 -1
  259. package/dist/components/kup-lazy.js +344 -344
  260. package/dist/components/kup-list.js +1 -1
  261. package/dist/components/kup-magic-box.js +461 -461
  262. package/dist/components/kup-nav-bar.js +284 -284
  263. package/dist/components/kup-numeric-picker.js +529 -529
  264. package/dist/components/kup-photo-frame.js +300 -300
  265. package/dist/components/kup-planner.js +1342 -1189
  266. package/dist/components/kup-probe.js +399 -399
  267. package/dist/components/kup-progress-bar.js +1 -1
  268. package/dist/components/kup-qlik.js +296 -296
  269. package/dist/components/kup-radio.js +1 -1
  270. package/dist/components/kup-rating.js +1 -1
  271. package/dist/components/kup-snackbar.js +273 -273
  272. package/dist/components/kup-spinner.js +1 -1
  273. package/dist/components/kup-switch.js +1 -1
  274. package/dist/components/kup-tab-bar.js +1 -1
  275. package/dist/components/kup-text-field.js +1 -1
  276. package/dist/components/kup-time-picker.js +1 -1
  277. package/dist/components/kup-tree.js +1 -1
  278. package/dist/esm/{GenericVariables-665de00a.js → GenericVariables-6dfdd433.js} +3 -3
  279. package/dist/esm/{component-120651a0.js → component-e86c51ea.js} +81 -2
  280. package/dist/esm/{f-button-c377973d.js → f-button-c6a69f75.js} +99 -99
  281. package/dist/esm/{f-button-declarations-b1b4cac4.js → f-button-declarations-fd4965d1.js} +16 -16
  282. package/dist/esm/{f-cell-e5a98bc8.js → f-cell-5822ea68.js} +472 -470
  283. package/dist/esm/{f-checkbox-9b3f5f5b.js → f-checkbox-c15911de.js} +23 -23
  284. package/dist/esm/{f-chip-c8a18c48.js → f-chip-f46a03f5.js} +125 -125
  285. package/dist/esm/{f-image-5cbdf39d.js → f-image-f57832fa.js} +107 -107
  286. package/dist/esm/{f-paginator-utils-a1dab059.js → f-paginator-utils-bafc463d.js} +1548 -1547
  287. package/dist/esm/{f-text-field-dafb7c8b.js → f-text-field-15850e05.js} +172 -172
  288. package/dist/esm/{f-text-field-mdc-cee583ea.js → f-text-field-mdc-a1b4a919.js} +27 -28
  289. package/dist/esm/{index-8bd38435.js → index-238342f2.js} +78 -24
  290. package/dist/esm/ketchup.js +4 -4
  291. package/dist/esm/kup-accordion.entry.js +199 -200
  292. package/dist/esm/kup-autocomplete_27.entry.js +17546 -17563
  293. package/dist/esm/kup-box.entry.js +1294 -1232
  294. package/dist/esm/kup-calendar.entry.js +9557 -10050
  295. package/dist/esm/kup-cell.entry.js +172 -172
  296. package/dist/esm/kup-dash-list.entry.js +106 -106
  297. package/dist/esm/kup-dash_2.entry.js +162 -162
  298. package/dist/esm/kup-dashboard.entry.js +400 -401
  299. package/dist/esm/kup-drawer.entry.js +138 -138
  300. package/dist/esm/kup-echart.entry.js +7145 -6598
  301. package/dist/esm/kup-family-tree.entry.js +439 -439
  302. package/dist/esm/kup-iframe.entry.js +94 -94
  303. package/dist/esm/kup-image-list.entry.js +255 -256
  304. package/dist/esm/kup-lazy.entry.js +186 -186
  305. package/dist/esm/kup-magic-box.entry.js +298 -298
  306. package/dist/esm/{kup-manager-3594cde8.js → kup-manager-89dd9137.js} +7273 -7116
  307. package/dist/esm/kup-nav-bar.entry.js +130 -130
  308. package/dist/esm/kup-numeric-picker.entry.js +367 -368
  309. package/dist/esm/kup-photo-frame.entry.js +144 -144
  310. package/dist/esm/kup-planner.entry.js +1151 -1009
  311. package/dist/esm/kup-probe.entry.js +246 -246
  312. package/dist/esm/kup-qlik.entry.js +138 -138
  313. package/dist/esm/kup-snackbar.entry.js +116 -116
  314. package/dist/esm/loader.js +4 -4
  315. package/dist/ketchup/ketchup.esm.js +1 -1
  316. package/dist/ketchup/{p-d1164680.entry.js → p-01d44efe.entry.js} +1 -1
  317. package/dist/ketchup/{p-6762d447.js → p-1a8a06de.js} +1 -1
  318. package/dist/ketchup/p-206245c0.js +1 -0
  319. package/dist/ketchup/p-4bd63e97.entry.js +25 -0
  320. package/dist/ketchup/{p-cf322853.entry.js → p-4da77173.entry.js} +1 -1
  321. package/dist/ketchup/{p-7be5ef32.entry.js → p-514dcb7d.entry.js} +1 -1
  322. package/dist/ketchup/{p-22e72f06.entry.js → p-51573263.entry.js} +1 -1
  323. package/dist/ketchup/{p-9f9b6656.js → p-54248440.js} +1 -1
  324. package/dist/ketchup/{p-37ada0f0.entry.js → p-5dfa5c49.entry.js} +1 -1
  325. package/dist/ketchup/{p-10d84b1b.js → p-6507e9eb.js} +7 -6
  326. package/dist/ketchup/p-673bb93e.js +1 -0
  327. package/dist/ketchup/{p-31abf4b6.entry.js → p-688478e9.entry.js} +1 -1
  328. package/dist/ketchup/p-6a5d95df.entry.js +1 -0
  329. package/dist/ketchup/p-6ec8629e.js +30 -0
  330. package/dist/ketchup/p-785e8d74.entry.js +1 -0
  331. package/dist/ketchup/{p-d76be079.entry.js → p-78cc5a2d.entry.js} +1 -1
  332. package/dist/ketchup/{p-ce5b6ce7.entry.js → p-799f7f10.entry.js} +1 -1
  333. package/dist/ketchup/p-7e757c27.entry.js +1 -0
  334. package/dist/ketchup/p-843253dd.entry.js +1 -0
  335. package/dist/ketchup/{p-473d2bea.entry.js → p-84d3f676.entry.js} +1 -1
  336. package/dist/ketchup/p-8c1edebd.js +2 -0
  337. package/dist/ketchup/{p-2d32e3cd.js → p-a5f15864.js} +1 -1
  338. package/dist/ketchup/p-af7202ff.entry.js +1 -0
  339. package/dist/ketchup/{p-7f4f5f0f.entry.js → p-ba959bb5.entry.js} +1 -1
  340. package/dist/ketchup/p-c1931214.js +1 -0
  341. package/dist/ketchup/{p-8b248655.js → p-c354c5d0.js} +1 -1
  342. package/dist/ketchup/p-cd8512d9.entry.js +39 -0
  343. package/dist/ketchup/p-d4f86197.entry.js +9 -0
  344. package/dist/ketchup/{p-b718af72.entry.js → p-e59c2bc0.entry.js} +1 -1
  345. package/dist/ketchup/{p-afff7a6e.entry.js → p-f2fda43b.entry.js} +1 -1
  346. package/dist/ketchup/p-f4b6aa3f.entry.js +1 -0
  347. package/dist/ketchup/p-f4f5170c.entry.js +1 -0
  348. package/dist/ketchup/{p-27a56c87.js → p-fb03f2f5.js} +2 -2
  349. package/dist/loader/index.d.ts +1 -1
  350. package/dist/types/components/kup-accordion/kup-accordion-declarations.d.ts +20 -20
  351. package/dist/types/components/kup-accordion/kup-accordion.d.ts +80 -80
  352. package/dist/types/components/kup-autocomplete/kup-autocomplete-declarations.d.ts +35 -35
  353. package/dist/types/components/kup-autocomplete/kup-autocomplete.d.ts +119 -119
  354. package/dist/types/components/kup-badge/kup-badge-declarations.d.ts +9 -9
  355. package/dist/types/components/kup-badge/kup-badge.d.ts +51 -51
  356. package/dist/types/components/kup-box/kup-box-declarations.d.ts +114 -113
  357. package/dist/types/components/kup-box/kup-box-state.d.ts +10 -10
  358. package/dist/types/components/kup-box/kup-box.d.ts +275 -270
  359. package/dist/types/components/kup-button/kup-button-declarations.d.ts +24 -24
  360. package/dist/types/components/kup-button/kup-button.d.ts +111 -111
  361. package/dist/types/components/kup-button-list/kup-button-list-declarations.d.ts +24 -24
  362. package/dist/types/components/kup-button-list/kup-button-list.d.ts +82 -82
  363. package/dist/types/components/kup-calendar/kup-calendar-declarations.d.ts +70 -70
  364. package/dist/types/components/kup-calendar/kup-calendar.d.ts +100 -100
  365. package/dist/types/components/kup-card/box/kup-card-box.d.ts +50 -50
  366. package/dist/types/components/kup-card/built-in/kup-card-built-in.d.ts +39 -39
  367. package/dist/types/components/kup-card/built-in/kup-card-calendar.d.ts +2 -2
  368. package/dist/types/components/kup-card/built-in/kup-card-clock.d.ts +2 -2
  369. package/dist/types/components/kup-card/built-in/kup-card-column-drop-menu.d.ts +3 -3
  370. package/dist/types/components/kup-card/built-in/kup-card-message-box.d.ts +3 -3
  371. package/dist/types/components/kup-card/built-in/kup-card-numeric.d.ts +2 -2
  372. package/dist/types/components/kup-card/collapsible/kup-card-collapsible.d.ts +14 -14
  373. package/dist/types/components/kup-card/dialog/kup-card-dialog.d.ts +44 -44
  374. package/dist/types/components/kup-card/free/kup-card-free.d.ts +14 -14
  375. package/dist/types/components/kup-card/kup-card-declarations.d.ts +236 -236
  376. package/dist/types/components/kup-card/kup-card-helper.d.ts +27 -27
  377. package/dist/types/components/kup-card/kup-card.d.ts +159 -159
  378. package/dist/types/components/kup-card/scalable/kup-card-scalable.d.ts +56 -56
  379. package/dist/types/components/kup-card/standard/kup-card-standard.d.ts +92 -92
  380. package/dist/types/components/kup-cell/kup-cell-declarations.d.ts +10 -10
  381. package/dist/types/components/kup-cell/kup-cell.d.ts +67 -67
  382. package/dist/types/components/kup-chart/kup-chart-builder.d.ts +7 -7
  383. package/dist/types/components/kup-chart/kup-chart-declarations.d.ts +135 -135
  384. package/dist/types/components/kup-chart/kup-chart.d.ts +170 -170
  385. package/dist/types/components/kup-checkbox/kup-checkbox-declarations.d.ts +17 -17
  386. package/dist/types/components/kup-checkbox/kup-checkbox.d.ts +85 -85
  387. package/dist/types/components/kup-chip/kup-chip-declarations.d.ts +22 -22
  388. package/dist/types/components/kup-chip/kup-chip.d.ts +89 -89
  389. package/dist/types/components/kup-color-picker/kup-color-picker-declarations.d.ts +15 -15
  390. package/dist/types/components/kup-color-picker/kup-color-picker.d.ts +89 -89
  391. package/dist/types/components/kup-combobox/kup-combobox-declarations.d.ts +24 -24
  392. package/dist/types/components/kup-combobox/kup-combobox.d.ts +95 -95
  393. package/dist/types/components/kup-dash/kup-dash.d.ts +33 -33
  394. package/dist/types/components/kup-dash-list/kup-dash-list.d.ts +22 -22
  395. package/dist/types/components/kup-dashboard/kup-dashboard-declarations.d.ts +61 -61
  396. package/dist/types/components/kup-dashboard/kup-dashboard.d.ts +80 -80
  397. package/dist/types/components/kup-data-table/kup-data-table-declarations.d.ts +254 -254
  398. package/dist/types/components/kup-data-table/kup-data-table-helper.d.ts +25 -25
  399. package/dist/types/components/kup-data-table/kup-data-table-state.d.ts +36 -36
  400. package/dist/types/components/kup-data-table/kup-data-table.d.ts +444 -444
  401. package/dist/types/components/kup-date-picker/kup-date-picker-declarations.d.ts +20 -20
  402. package/dist/types/components/kup-date-picker/kup-date-picker.d.ts +110 -110
  403. package/dist/types/components/kup-dialog/kup-dialog-declarations.d.ts +26 -26
  404. package/dist/types/components/kup-dialog/kup-dialog.d.ts +77 -77
  405. package/dist/types/components/kup-drawer/kup-drawer-declarations.d.ts +9 -9
  406. package/dist/types/components/kup-drawer/kup-drawer.d.ts +74 -74
  407. package/dist/types/components/kup-dropdown-button/kup-dropdown-button-declarations.d.ts +21 -21
  408. package/dist/types/components/kup-dropdown-button/kup-dropdown-button.d.ts +161 -161
  409. package/dist/types/components/kup-echart/kup-echart-declarations.d.ts +62 -62
  410. package/dist/types/components/kup-echart/kup-echart.d.ts +111 -111
  411. package/dist/types/components/kup-family-tree/kup-family-tree-declarations.d.ts +38 -38
  412. package/dist/types/components/kup-family-tree/kup-family-tree.d.ts +87 -87
  413. package/dist/types/components/kup-form/kup-form-declarations.d.ts +64 -64
  414. package/dist/types/components/kup-form/kup-form.d.ts +83 -83
  415. package/dist/types/components/kup-gauge/kup-gauge-declarations.d.ts +25 -25
  416. package/dist/types/components/kup-gauge/kup-gauge.d.ts +147 -147
  417. package/dist/types/components/kup-grid/kup-grid-declarations.d.ts +9 -9
  418. package/dist/types/components/kup-grid/kup-grid.d.ts +48 -48
  419. package/dist/types/components/kup-iframe/kup-iframe-declarations.d.ts +9 -9
  420. package/dist/types/components/kup-iframe/kup-iframe.d.ts +49 -49
  421. package/dist/types/components/kup-image/canvas/kup-image-canvas-declarations.d.ts +23 -23
  422. package/dist/types/components/kup-image/canvas/kup-image-canvas-helper.d.ts +2 -2
  423. package/dist/types/components/kup-image/canvas/kup-image-canvas.d.ts +28 -28
  424. package/dist/types/components/kup-image/kup-image-declarations.d.ts +19 -19
  425. package/dist/types/components/kup-image/kup-image.d.ts +103 -103
  426. package/dist/types/components/kup-image-list/kup-image-list-declarations.d.ts +14 -14
  427. package/dist/types/components/kup-image-list/kup-image-list-state.d.ts +6 -6
  428. package/dist/types/components/kup-image-list/kup-image-list.d.ts +73 -73
  429. package/dist/types/components/kup-lazy/kup-lazy-declarations.d.ts +18 -18
  430. package/dist/types/components/kup-lazy/kup-lazy.d.ts +78 -78
  431. package/dist/types/components/kup-list/kup-list-declarations.d.ts +48 -48
  432. package/dist/types/components/kup-list/kup-list-helper.d.ts +6 -6
  433. package/dist/types/components/kup-list/kup-list.d.ts +128 -128
  434. package/dist/types/components/kup-magic-box/kup-magic-box-declarations.d.ts +21 -21
  435. package/dist/types/components/kup-magic-box/kup-magic-box.d.ts +65 -65
  436. package/dist/types/components/kup-nav-bar/kup-nav-bar-declarations.d.ts +19 -19
  437. package/dist/types/components/kup-nav-bar/kup-nav-bar.d.ts +65 -65
  438. package/dist/types/components/kup-numeric-picker/kup-numeric-picker-declarations.d.ts +19 -19
  439. package/dist/types/components/kup-numeric-picker/kup-numeric-picker.d.ts +121 -121
  440. package/dist/types/components/kup-photo-frame/kup-photo-frame-declarations.d.ts +9 -9
  441. package/dist/types/components/kup-photo-frame/kup-photo-frame.d.ts +61 -61
  442. package/dist/types/components/kup-planner/kup-planner-declarations.d.ts +127 -106
  443. package/dist/types/components/kup-planner/kup-planner-helper.d.ts +6 -6
  444. package/dist/types/components/kup-planner/kup-planner-state.d.ts +13 -0
  445. package/dist/types/components/kup-planner/kup-planner.d.ts +266 -212
  446. package/dist/types/components/kup-probe/kup-probe.d.ts +72 -72
  447. package/dist/types/components/kup-progress-bar/kup-progress-bar-declarations.d.ts +13 -13
  448. package/dist/types/components/kup-progress-bar/kup-progress-bar.d.ts +69 -69
  449. package/dist/types/components/kup-qlik/kup-qlik-declarations.d.ts +19 -19
  450. package/dist/types/components/kup-qlik/kup-qlik.d.ts +100 -100
  451. package/dist/types/components/kup-radio/kup-radio-declarations.d.ts +23 -23
  452. package/dist/types/components/kup-radio/kup-radio.d.ts +80 -80
  453. package/dist/types/components/kup-rating/kup-rating-declarations.d.ts +14 -14
  454. package/dist/types/components/kup-rating/kup-rating.d.ts +62 -62
  455. package/dist/types/components/kup-snackbar/kup-snackbar-declarations.d.ts +12 -12
  456. package/dist/types/components/kup-snackbar/kup-snackbar.d.ts +84 -84
  457. package/dist/types/components/kup-spinner/kup-spinner-declarations.d.ts +14 -14
  458. package/dist/types/components/kup-spinner/kup-spinner.d.ts +79 -79
  459. package/dist/types/components/kup-state/kup-state.d.ts +3 -3
  460. package/dist/types/components/kup-state/kup-store.d.ts +4 -4
  461. package/dist/types/components/kup-state/mock-store.d.ts +8 -8
  462. package/dist/types/components/kup-switch/kup-switch-declarations.d.ts +15 -15
  463. package/dist/types/components/kup-switch/kup-switch.d.ts +80 -80
  464. package/dist/types/components/kup-tab-bar/kup-tab-bar-declarations.d.ts +21 -21
  465. package/dist/types/components/kup-tab-bar/kup-tab-bar.d.ts +77 -77
  466. package/dist/types/components/kup-text-field/kup-text-field-declarations.d.ts +38 -38
  467. package/dist/types/components/kup-text-field/kup-text-field.d.ts +253 -253
  468. package/dist/types/components/kup-time-picker/kup-time-picker-declarations.d.ts +17 -17
  469. package/dist/types/components/kup-time-picker/kup-time-picker.d.ts +125 -125
  470. package/dist/types/components/kup-tree/kup-tree-declarations.d.ts +97 -97
  471. package/dist/types/components/kup-tree/kup-tree-faker.d.ts +54 -54
  472. package/dist/types/components/kup-tree/kup-tree-state.d.ts +14 -14
  473. package/dist/types/components/kup-tree/kup-tree.d.ts +362 -362
  474. package/dist/types/components.d.ts +98 -2
  475. package/dist/types/f-components/f-button/f-button-declarations.d.ts +41 -41
  476. package/dist/types/f-components/f-button/f-button.d.ts +3 -3
  477. package/dist/types/f-components/f-cell/f-cell-declarations.d.ts +162 -162
  478. package/dist/types/f-components/f-cell/f-cell.d.ts +3 -3
  479. package/dist/types/f-components/f-checkbox/f-checkbox-declarations.d.ts +15 -15
  480. package/dist/types/f-components/f-checkbox/f-checkbox.d.ts +3 -3
  481. package/dist/types/f-components/f-chip/f-chip-declarations.d.ts +29 -29
  482. package/dist/types/f-components/f-chip/f-chip.d.ts +3 -3
  483. package/dist/types/f-components/f-image/f-image-declarations.d.ts +36 -36
  484. package/dist/types/f-components/f-image/f-image.d.ts +3 -3
  485. package/dist/types/f-components/f-paginator/f-paginator-declarations.d.ts +22 -22
  486. package/dist/types/f-components/f-paginator/f-paginator-utils.d.ts +2 -2
  487. package/dist/types/f-components/f-paginator/f-paginator.d.ts +3 -3
  488. package/dist/types/f-components/f-switch/f-switch-declarations.d.ts +14 -14
  489. package/dist/types/f-components/f-switch/f-switch.d.ts +3 -3
  490. package/dist/types/f-components/f-text-field/f-text-field-declarations.d.ts +42 -42
  491. package/dist/types/f-components/f-text-field/f-text-field-mdc.d.ts +6 -6
  492. package/dist/types/f-components/f-text-field/f-text-field.d.ts +3 -3
  493. package/dist/types/managers/kup-data/kup-data-cell-helper.d.ts +31 -31
  494. package/dist/types/managers/kup-data/kup-data-column-helper.d.ts +39 -39
  495. package/dist/types/managers/kup-data/kup-data-declarations.d.ts +173 -173
  496. package/dist/types/managers/kup-data/kup-data-node-helper.d.ts +44 -44
  497. package/dist/types/managers/kup-data/kup-data-row-helper.d.ts +14 -14
  498. package/dist/types/managers/kup-data/kup-data.d.ts +86 -86
  499. package/dist/types/managers/kup-dates/kup-dates-declarations.d.ts +39 -29
  500. package/dist/types/managers/kup-dates/kup-dates.d.ts +207 -114
  501. package/dist/types/managers/kup-debug/kup-debug-declarations.d.ts +38 -38
  502. package/dist/types/managers/kup-debug/kup-debug.d.ts +95 -95
  503. package/dist/types/managers/kup-dynamic-position/kup-dynamic-position-declarations.d.ts +50 -50
  504. package/dist/types/managers/kup-dynamic-position/kup-dynamic-position.d.ts +61 -61
  505. package/dist/types/managers/kup-interact/kup-interact-declarations.d.ts +128 -128
  506. package/dist/types/managers/kup-interact/kup-interact.d.ts +105 -105
  507. package/dist/types/managers/kup-language/kup-language-declarations.d.ts +225 -225
  508. package/dist/types/managers/kup-language/kup-language.d.ts +52 -52
  509. package/dist/types/managers/kup-manager/kup-manager-declarations.d.ts +162 -162
  510. package/dist/types/managers/kup-manager/kup-manager.d.ts +95 -95
  511. package/dist/types/managers/kup-math/kup-math-declarations.d.ts +33 -33
  512. package/dist/types/managers/kup-math/kup-math-helper.d.ts +17 -17
  513. package/dist/types/managers/kup-math/kup-math.d.ts +147 -85
  514. package/dist/types/managers/kup-objects/kup-objects-declarations.d.ts +15 -15
  515. package/dist/types/managers/kup-objects/kup-objects.d.ts +210 -210
  516. package/dist/types/managers/kup-scroll-on-hover/kup-scroll-on-hover-declarations.d.ts +28 -28
  517. package/dist/types/managers/kup-scroll-on-hover/kup-scroll-on-hover.d.ts +62 -62
  518. package/dist/types/managers/kup-search/kup-search-declarations.d.ts +7 -7
  519. package/dist/types/managers/kup-search/kup-search.d.ts +20 -20
  520. package/dist/types/managers/kup-theme/kup-theme-declarations.d.ts +185 -185
  521. package/dist/types/managers/kup-theme/kup-theme.d.ts +127 -127
  522. package/dist/types/managers/kup-toolbar/kup-toolbar-declarations.d.ts +8 -8
  523. package/dist/types/managers/kup-toolbar/kup-toolbar.d.ts +39 -39
  524. package/dist/types/managers/kup-tooltip/kup-tooltip-declarations.d.ts +8 -8
  525. package/dist/types/managers/kup-tooltip/kup-tooltip.d.ts +51 -51
  526. package/dist/types/stencil-public-runtime.d.ts +1 -0
  527. package/dist/types/types/GenericTypes.d.ts +110 -110
  528. package/dist/types/utils/cell-utils.d.ts +10 -10
  529. package/dist/types/utils/filters/filters-column-menu.d.ts +96 -96
  530. package/dist/types/utils/filters/filters-declarations.d.ts +39 -39
  531. package/dist/types/utils/filters/filters-rows.d.ts +30 -30
  532. package/dist/types/utils/filters/filters-tree-items.d.ts +19 -19
  533. package/dist/types/utils/filters/filters.d.ts +72 -72
  534. package/dist/types/utils/kup-column-menu/kup-column-menu-declarations.d.ts +19 -19
  535. package/dist/types/utils/kup-column-menu/kup-column-menu.d.ts +142 -142
  536. package/dist/types/utils/utils.d.ts +37 -124
  537. package/dist/types/variables/GenericVariables.d.ts +4 -4
  538. package/package.json +21 -16
  539. package/dist/cjs/tslib.es6-386654de.js +0 -87
  540. package/dist/esm/tslib.es6-8c2af864.js +0 -82
  541. package/dist/ketchup/p-017418e7.entry.js +0 -27
  542. package/dist/ketchup/p-38f16697.entry.js +0 -9
  543. package/dist/ketchup/p-4638fbff.js +0 -1
  544. package/dist/ketchup/p-4c56e199.entry.js +0 -1
  545. package/dist/ketchup/p-5205286a.entry.js +0 -25
  546. package/dist/ketchup/p-61319cfa.js +0 -1
  547. package/dist/ketchup/p-6c726886.entry.js +0 -1
  548. package/dist/ketchup/p-7f59211b.js +0 -1
  549. package/dist/ketchup/p-80815edf.entry.js +0 -1
  550. package/dist/ketchup/p-9dcfbb1e.js +0 -2
  551. package/dist/ketchup/p-9fc6a9a8.entry.js +0 -1
  552. package/dist/ketchup/p-acaa171f.js +0 -30
  553. package/dist/ketchup/p-bf4a881b.js +0 -1
  554. package/dist/ketchup/p-d4eb9a76.entry.js +0 -1
  555. package/dist/ketchup/p-ed7e118e.entry.js +0 -1
  556. package/dist/ketchup/p-ef0b4f19.entry.js +0 -39
  557. /package/dist/ketchup/{p-6c77a36c.js → p-0fd98ab4.js} +0 -0
  558. /package/dist/ketchup/{p-97e8ea42.js → p-ad2e21d2.js} +0 -0
@@ -1,1565 +1,1566 @@
1
1
  'use strict';
2
2
 
3
- const kupManager = require('./kup-manager-b994cf71.js');
4
- const index = require('./index-1f177abc.js');
5
- const fButton = require('./f-button-c0ede055.js');
6
- const fButtonDeclarations = require('./f-button-declarations-b611587f.js');
3
+ const kupManager = require('./kup-manager-16b684bd.js');
4
+ const index = require('./index-26fb8571.js');
5
+ const fButton = require('./f-button-a5f661f2.js');
6
+ const fButtonDeclarations = require('./f-button-declarations-76b4fb4c.js');
7
7
 
8
- /**
9
- * Filtering algorithms related to column menus.
10
- * @module FiltersColumnMenu
11
- * @todo Should contain EVERY column-specific filtering method.
12
- */
13
- class FiltersColumnMenu extends kupManager.Filters {
14
- /**
15
- * Gets the value of the filter prop.
16
- * @param {GenericFilter} filters - Filters of the component.
17
- * @param {string} column - Name of the column.
18
- * @returns {string} Value of the filter.
19
- */
20
- getTextFilterValue(filters = {}, column) {
21
- return this._getTextFilterValue(filters, column, false);
22
- }
23
- /**
24
- * Gets the value of the filter prop, set temporarly.
25
- * @param {GenericFilter} filters - Filters of the component.
26
- * @param {string} column - Name of the column.
27
- * @returns {string} Value of the filter.
28
- */
29
- getTextFilterValueTmp(filters = {}, column) {
30
- return this._getTextFilterValue(filters, column, true);
31
- }
32
- _getTextFilterValue(filters = {}, column, tmp) {
33
- let value = '';
34
- if (filters == null) {
35
- return value;
36
- }
37
- let filter = filters[column];
38
- if (filter == null) {
39
- return value;
40
- }
41
- value = tmp ? filter.textFieldTmp : filter.textField;
42
- return value;
43
- }
44
- /**
45
- * Returns whether a column has filters or not.
46
- * @param {GenericFilter} filters - Filters of the component.
47
- * @param {KupDataColumn} column - Name of the column.
48
- * @returns {boolean} True when a given column has filters.
49
- */
50
- hasFiltersForColumn(filters = {}, column) {
51
- return this._hasFiltersForColumn(filters, column, false);
52
- }
53
- /**
54
- * Returns whether a column has filters or not.
55
- * @param {GenericFilter} filters - Filters of the component.
56
- * @param {KupDataColumn} column - Name of the column.
57
- * @returns {boolean} True when a given column has filters.
58
- */
59
- hasFiltersForColumnTmp(filters = {}, column) {
60
- return this._hasFiltersForColumn(filters, column, true);
61
- }
62
- /**
63
- * Returns whether a column has filters or not.
64
- * @param {GenericFilter} filters - Filters of the component.
65
- * @param {KupDataColumn} column - Name of the column.
66
- * @returns {boolean} True when a given column has filters.
67
- */
68
- _hasFiltersForColumn(filters = {}, column, tmp) {
69
- if (!column) {
70
- return false;
71
- }
72
- let textfield = this._getTextFilterValue(filters, column.name, tmp);
73
- if (textfield != null && textfield.trim() != '') {
74
- return true;
75
- }
76
- if (this._hasIntervalTextFieldFilterValues(filters, column, tmp)) {
77
- return true;
78
- }
79
- let checkboxes = this.getCheckBoxFilterValues(filters, column.name);
80
- if (checkboxes == null || checkboxes.length < 1) {
81
- return false;
82
- }
83
- return true;
84
- }
85
- /**
86
- * Returns the values of column menu's checkboxes.
87
- * @param {GenericFilter} filters - Filters of the component.
88
- * @param {string} column - Name of the column.
89
- * @returns {Array<string>} Array of checkboxes values.
90
- */
91
- getCheckBoxFilterValues(filters = {}, column) {
92
- let values = [];
93
- if (filters == null) {
94
- return values;
95
- }
96
- let filter = filters[column];
97
- if (filter == null) {
98
- return values;
99
- }
100
- if (filter.checkBoxes == null) {
101
- return values;
102
- }
103
- values = filter.checkBoxes;
104
- return values;
105
- }
106
- /**
107
- * Returns whether a text field should be a date or time picker.
108
- * @param {GenericFilter} filters - Filters of the component.
109
- * @param {KupDataColumn} column - Name of the column.
110
- * @returns {boolean} True when the text field is a date or time picker.
111
- */
112
- hasIntervalTextFieldFilterValues(filters = {}, column) {
113
- return this._hasIntervalTextFieldFilterValues(filters, column, false);
114
- }
115
- hasIntervalTextFieldFilterValuesTmp(filters = {}, column) {
116
- return this._hasIntervalTextFieldFilterValues(filters, column, true);
117
- }
118
- _hasIntervalTextFieldFilterValues(filters = {}, column, tmp) {
119
- if (column == null) {
120
- return false;
121
- }
122
- if (!this.isColumnFiltrableByInterval(column)) {
123
- return false;
124
- }
125
- let intervalFrom = this._getIntervalTextFieldFilterValue(filters, column.name, kupManager.FilterInterval.FROM, tmp);
126
- if (intervalFrom != null && intervalFrom.trim() != '') {
127
- return true;
128
- }
129
- let intervalTo = this._getIntervalTextFieldFilterValue(filters, column.name, kupManager.FilterInterval.TO, tmp);
130
- if (intervalTo != null && intervalTo.trim() != '') {
131
- return true;
132
- }
133
- return false;
134
- }
135
- /**
136
- * Triggers when a new filter checkbox becomes checked.
137
- * @param {GenericFilter} filters - Filters of the component.
138
- * @param {string} column - Name of the column.
139
- * @param {ValueDisplayedValue} newFilter - Added filter.
140
- */
141
- addCheckboxFilter(filters = {}, column, newFilterItem) {
142
- if (filters == null) {
143
- return;
144
- }
145
- let filter = filters[column];
146
- if (filter == null) {
147
- filter = {
148
- textField: '',
149
- textFieldTmp: '',
150
- checkBoxes: [],
151
- interval: null,
152
- intervalTmp: null,
153
- };
154
- filters[column] = filter;
155
- }
156
- if (filter.checkBoxes == null) {
157
- filter.checkBoxes = [];
158
- }
159
- if (newFilterItem == null || newFilterItem.value == null) {
160
- filter.checkBoxes = [];
161
- }
162
- else {
163
- if (!kupManager.Filters.valuesArrayContainsValue(filter.checkBoxes, newFilterItem.value)) {
164
- filter.checkBoxes[filter.checkBoxes.length] = newFilterItem;
165
- }
166
- }
167
- }
168
- /**
169
- * Triggers when a filter checkbox becomes unchecked.
170
- * @param {GenericFilter} filters - Filters of the component.
171
- * @param {string} column - Name of the column.
172
- * @param {string} remFilter - Removed filter.
173
- */
174
- removeCheckboxFilter(filters = {}, column, remFilter) {
175
- if (filters == null || remFilter == null) {
176
- return;
177
- }
178
- let filter = filters[column];
179
- if (filter == null) {
180
- return;
181
- }
182
- if (filter.checkBoxes == null) {
183
- filter.checkBoxes = [];
184
- }
185
- let index = kupManager.Filters.indexOfValueInValuesArray(filter.checkBoxes, remFilter);
186
- if (index >= 0) {
187
- let chs = [];
188
- for (let i = 0; i < filter.checkBoxes.length; i++) {
189
- if (i != index) {
190
- chs[chs.length] = filter.checkBoxes[i];
191
- }
192
- }
193
- filter.checkBoxes = [...chs];
194
- }
195
- }
196
- isColumnFiltrableByInterval(column) {
197
- return this.isObjFiltrableByInterval(column.obj);
198
- }
199
- getIntervalTextFieldFilterValues(filters = {}, column) {
200
- return this._getIntervalTextFieldFilterValues(filters, column, false);
201
- }
202
- getIntervalTextFieldFilterValuesTmp(filters = {}, column) {
203
- return this._getIntervalTextFieldFilterValues(filters, column, true);
204
- }
205
- _getIntervalTextFieldFilterValues(filters = {}, column, tmp) {
206
- if (!this._hasIntervalTextFieldFilterValues(filters, column, tmp)) {
207
- return ['', ''];
208
- }
209
- let values = [
210
- this._getIntervalTextFieldFilterValue(filters, column.name, kupManager.FilterInterval.FROM, tmp),
211
- this._getIntervalTextFieldFilterValue(filters, column.name, kupManager.FilterInterval.TO, tmp),
212
- ];
213
- return values;
214
- }
215
- getIntervalTextFieldFilterValue(filters = {}, column, index) {
216
- return this._getIntervalTextFieldFilterValue(filters, column, index, false);
217
- }
218
- getIntervalTextFieldFilterValueTmp(filters = {}, column, index) {
219
- return this._getIntervalTextFieldFilterValue(filters, column, index, true);
220
- }
221
- _getIntervalTextFieldFilterValue(filters = {}, column, index, tmp) {
222
- let value = '';
223
- if (filters == null) {
224
- return value;
225
- }
226
- let filter = filters[column];
227
- if (filter == null) {
228
- return value;
229
- }
230
- if (tmp && filter.intervalTmp == null) {
231
- return value;
232
- }
233
- if (!tmp && filter.interval == null) {
234
- return value;
235
- }
236
- value = tmp ? filter.intervalTmp[index] : filter.interval[index];
237
- return value;
238
- }
239
- setTextFieldFilterValue(filters = {}, column, newFilter) {
240
- this._setTextFieldFilterValue(filters, column, newFilter, true);
241
- }
242
- _setTextFieldFilterValue(filters = {}, column, newFilter, tmp) {
243
- if (filters == null) {
244
- return;
245
- }
246
- let filter = filters[column];
247
- if (filter == null) {
248
- filter = {
249
- textField: '',
250
- textFieldTmp: '',
251
- checkBoxes: [],
252
- interval: null,
253
- intervalTmp: null,
254
- };
255
- filters[column] = filter;
256
- }
257
- if (tmp) {
258
- filter.textFieldTmp =
259
- newFilter != null ? newFilter.trim() : newFilter;
260
- }
261
- else {
262
- filter.textField = newFilter != null ? newFilter.trim() : newFilter;
263
- }
264
- }
265
- setIntervalTextFieldFilterValue(filters = {}, column, newFilter, index) {
266
- this._setIntervalTextFieldFilterValue(filters, column, newFilter, index, true);
267
- }
268
- _setIntervalTextFieldFilterValue(filters = {}, column, newFilter, index, tmp) {
269
- if (filters == null) {
270
- return;
271
- }
272
- let filter = filters[column];
273
- if (filter == null) {
274
- filter = {
275
- textField: '',
276
- textFieldTmp: '',
277
- checkBoxes: [],
278
- interval: null,
279
- intervalTmp: null,
280
- };
281
- filters[column] = filter;
282
- }
283
- if (filter.interval == null) {
284
- filter.interval = [];
285
- filter.interval.push('', '');
286
- }
287
- if (filter.intervalTmp == null) {
288
- filter.intervalTmp = [];
289
- filter.intervalTmp.push('', '');
290
- }
291
- if (tmp) {
292
- filter.intervalTmp[index] =
293
- newFilter != null ? newFilter.trim() : newFilter;
294
- }
295
- else {
296
- filter.interval[index] =
297
- newFilter != null ? newFilter.trim() : newFilter;
298
- }
299
- }
300
- saveTextualFilters(filters = {}, column) {
301
- this._setTextFieldFilterValue(filters, column, this.getTextFilterValueTmp(filters, column), false);
302
- this._setIntervalTextFieldFilterValue(filters, column, this.getIntervalTextFieldFilterValueTmp(filters, column, kupManager.FilterInterval.FROM), kupManager.FilterInterval.FROM, false);
303
- this._setIntervalTextFieldFilterValue(filters, column, this.getIntervalTextFieldFilterValueTmp(filters, column, kupManager.FilterInterval.TO), kupManager.FilterInterval.TO, false);
304
- }
305
- resetTextualFilters(filters = {}, column) {
306
- this._setTextFieldFilterValue(filters, column, this.getTextFilterValue(filters, column), true);
307
- this._setIntervalTextFieldFilterValue(filters, column, this.getIntervalTextFieldFilterValue(filters, column, kupManager.FilterInterval.FROM), kupManager.FilterInterval.FROM, true);
308
- this._setIntervalTextFieldFilterValue(filters, column, this.getIntervalTextFieldFilterValue(filters, column, kupManager.FilterInterval.TO), kupManager.FilterInterval.TO, true);
309
- }
310
- getFilterValueForTooltip(filters = {}, column) {
311
- let txtFilter = this.getTextFilterValue(filters, column.name);
312
- let interval = this.getIntervalTextFieldFilterValues(filters, column);
313
- let chkFilters = this.getCheckBoxFilterValues(filters, column.name);
314
- let separator = '';
315
- let txtFiterRis = kupManager.getValueForDisplay(txtFilter, column.obj, column.decimals);
316
- if (txtFilter != '') {
317
- separator = ' AND ';
318
- }
319
- if (interval[kupManager.FilterInterval.FROM] != '') {
320
- txtFiterRis +=
321
- separator +
322
- '(>= ' +
323
- kupManager.getValueForDisplay(interval[kupManager.FilterInterval.FROM], column.obj, column.decimals) +
324
- ')';
325
- separator = ' AND ';
326
- }
327
- if (interval[kupManager.FilterInterval.TO] != '') {
328
- txtFiterRis +=
329
- separator +
330
- '(<= ' +
331
- kupManager.getValueForDisplay(interval[kupManager.FilterInterval.TO], column.obj, column.decimals) +
332
- ')';
333
- separator = ' AND ';
334
- }
335
- separator = '';
336
- let ris = '';
337
- chkFilters.forEach((f) => {
338
- ris += separator + kupManager.getValueForDisplay2(f, column);
339
- separator = ' OR ';
340
- });
341
- if (ris != '') {
342
- ris = '(' + ris + ')';
343
- if (txtFiterRis != '') {
344
- ris = ' AND ' + ris;
345
- }
346
- }
347
- ris = txtFiterRis + ris;
348
- return ris;
349
- }
350
- /**
351
- * Triggers when a filter must be removed, for column.
352
- * @param {GenericFilter} filters - Filters of the component.
353
- * @param {string} column - Name of the column.
354
- */
355
- removeFilter(filters = {}, column) {
356
- filters[column] = {
357
- textField: '',
358
- textFieldTmp: '',
359
- checkBoxes: [],
360
- interval: null,
361
- intervalTmp: null,
362
- };
363
- }
8
+ /**
9
+ * Filtering algorithms related to column menus.
10
+ * @module FiltersColumnMenu
11
+ * @todo Should contain EVERY column-specific filtering method.
12
+ */
13
+ class FiltersColumnMenu extends kupManager.Filters {
14
+ /**
15
+ * Gets the value of the filter prop.
16
+ * @param {GenericFilter} filters - Filters of the component.
17
+ * @param {string} column - Name of the column.
18
+ * @returns {string} Value of the filter.
19
+ */
20
+ getTextFilterValue(filters = {}, column) {
21
+ return this._getTextFilterValue(filters, column, false);
22
+ }
23
+ /**
24
+ * Gets the value of the filter prop, set temporarly.
25
+ * @param {GenericFilter} filters - Filters of the component.
26
+ * @param {string} column - Name of the column.
27
+ * @returns {string} Value of the filter.
28
+ */
29
+ getTextFilterValueTmp(filters = {}, column) {
30
+ return this._getTextFilterValue(filters, column, true);
31
+ }
32
+ _getTextFilterValue(filters = {}, column, tmp) {
33
+ let value = '';
34
+ if (filters == null) {
35
+ return value;
36
+ }
37
+ let filter = filters[column];
38
+ if (filter == null) {
39
+ return value;
40
+ }
41
+ value = tmp ? filter.textFieldTmp : filter.textField;
42
+ return value;
43
+ }
44
+ /**
45
+ * Returns whether a column has filters or not.
46
+ * @param {GenericFilter} filters - Filters of the component.
47
+ * @param {KupDataColumn} column - Name of the column.
48
+ * @returns {boolean} True when a given column has filters.
49
+ */
50
+ hasFiltersForColumn(filters = {}, column) {
51
+ return this._hasFiltersForColumn(filters, column, false);
52
+ }
53
+ /**
54
+ * Returns whether a column has filters or not.
55
+ * @param {GenericFilter} filters - Filters of the component.
56
+ * @param {KupDataColumn} column - Name of the column.
57
+ * @returns {boolean} True when a given column has filters.
58
+ */
59
+ hasFiltersForColumnTmp(filters = {}, column) {
60
+ return this._hasFiltersForColumn(filters, column, true);
61
+ }
62
+ /**
63
+ * Returns whether a column has filters or not.
64
+ * @param {GenericFilter} filters - Filters of the component.
65
+ * @param {KupDataColumn} column - Name of the column.
66
+ * @returns {boolean} True when a given column has filters.
67
+ */
68
+ _hasFiltersForColumn(filters = {}, column, tmp) {
69
+ if (!column) {
70
+ return false;
71
+ }
72
+ let textfield = this._getTextFilterValue(filters, column.name, tmp);
73
+ if (textfield != null && textfield.trim() != '') {
74
+ return true;
75
+ }
76
+ if (this._hasIntervalTextFieldFilterValues(filters, column, tmp)) {
77
+ return true;
78
+ }
79
+ let checkboxes = this.getCheckBoxFilterValues(filters, column.name);
80
+ if (checkboxes == null || checkboxes.length < 1) {
81
+ return false;
82
+ }
83
+ return true;
84
+ }
85
+ /**
86
+ * Returns the values of column menu's checkboxes.
87
+ * @param {GenericFilter} filters - Filters of the component.
88
+ * @param {string} column - Name of the column.
89
+ * @returns {Array<string>} Array of checkboxes values.
90
+ */
91
+ getCheckBoxFilterValues(filters = {}, column) {
92
+ let values = [];
93
+ if (filters == null) {
94
+ return values;
95
+ }
96
+ let filter = filters[column];
97
+ if (filter == null) {
98
+ return values;
99
+ }
100
+ if (filter.checkBoxes == null) {
101
+ return values;
102
+ }
103
+ values = filter.checkBoxes;
104
+ return values;
105
+ }
106
+ /**
107
+ * Returns whether a text field should be a date or time picker.
108
+ * @param {GenericFilter} filters - Filters of the component.
109
+ * @param {KupDataColumn} column - Name of the column.
110
+ * @returns {boolean} True when the text field is a date or time picker.
111
+ */
112
+ hasIntervalTextFieldFilterValues(filters = {}, column) {
113
+ return this._hasIntervalTextFieldFilterValues(filters, column, false);
114
+ }
115
+ hasIntervalTextFieldFilterValuesTmp(filters = {}, column) {
116
+ return this._hasIntervalTextFieldFilterValues(filters, column, true);
117
+ }
118
+ _hasIntervalTextFieldFilterValues(filters = {}, column, tmp) {
119
+ if (column == null) {
120
+ return false;
121
+ }
122
+ if (!this.isColumnFiltrableByInterval(column)) {
123
+ return false;
124
+ }
125
+ let intervalFrom = this._getIntervalTextFieldFilterValue(filters, column.name, kupManager.FilterInterval.FROM, tmp);
126
+ if (intervalFrom != null && intervalFrom.trim() != '') {
127
+ return true;
128
+ }
129
+ let intervalTo = this._getIntervalTextFieldFilterValue(filters, column.name, kupManager.FilterInterval.TO, tmp);
130
+ if (intervalTo != null && intervalTo.trim() != '') {
131
+ return true;
132
+ }
133
+ return false;
134
+ }
135
+ /**
136
+ * Triggers when a new filter checkbox becomes checked.
137
+ * @param {GenericFilter} filters - Filters of the component.
138
+ * @param {string} column - Name of the column.
139
+ * @param {ValueDisplayedValue} newFilter - Added filter.
140
+ */
141
+ addCheckboxFilter(filters = {}, column, newFilterItem) {
142
+ if (filters == null) {
143
+ return;
144
+ }
145
+ let filter = filters[column];
146
+ if (filter == null) {
147
+ filter = {
148
+ textField: '',
149
+ textFieldTmp: '',
150
+ checkBoxes: [],
151
+ interval: null,
152
+ intervalTmp: null,
153
+ };
154
+ filters[column] = filter;
155
+ }
156
+ if (filter.checkBoxes == null) {
157
+ filter.checkBoxes = [];
158
+ }
159
+ if (newFilterItem == null || newFilterItem.value == null) {
160
+ filter.checkBoxes = [];
161
+ }
162
+ else {
163
+ if (!kupManager.Filters.valuesArrayContainsValue(filter.checkBoxes, newFilterItem.value)) {
164
+ filter.checkBoxes[filter.checkBoxes.length] = newFilterItem;
165
+ }
166
+ }
167
+ }
168
+ /**
169
+ * Triggers when a filter checkbox becomes unchecked.
170
+ * @param {GenericFilter} filters - Filters of the component.
171
+ * @param {string} column - Name of the column.
172
+ * @param {string} remFilter - Removed filter.
173
+ */
174
+ removeCheckboxFilter(filters = {}, column, remFilter) {
175
+ if (filters == null || remFilter == null) {
176
+ return;
177
+ }
178
+ let filter = filters[column];
179
+ if (filter == null) {
180
+ return;
181
+ }
182
+ if (filter.checkBoxes == null) {
183
+ filter.checkBoxes = [];
184
+ }
185
+ let index = kupManager.Filters.indexOfValueInValuesArray(filter.checkBoxes, remFilter);
186
+ if (index >= 0) {
187
+ let chs = [];
188
+ for (let i = 0; i < filter.checkBoxes.length; i++) {
189
+ if (i != index) {
190
+ chs[chs.length] = filter.checkBoxes[i];
191
+ }
192
+ }
193
+ filter.checkBoxes = [...chs];
194
+ }
195
+ }
196
+ isColumnFiltrableByInterval(column) {
197
+ return this.isObjFiltrableByInterval(column.obj);
198
+ }
199
+ getIntervalTextFieldFilterValues(filters = {}, column) {
200
+ return this._getIntervalTextFieldFilterValues(filters, column, false);
201
+ }
202
+ getIntervalTextFieldFilterValuesTmp(filters = {}, column) {
203
+ return this._getIntervalTextFieldFilterValues(filters, column, true);
204
+ }
205
+ _getIntervalTextFieldFilterValues(filters = {}, column, tmp) {
206
+ if (!this._hasIntervalTextFieldFilterValues(filters, column, tmp)) {
207
+ return ['', ''];
208
+ }
209
+ let values = [
210
+ this._getIntervalTextFieldFilterValue(filters, column.name, kupManager.FilterInterval.FROM, tmp),
211
+ this._getIntervalTextFieldFilterValue(filters, column.name, kupManager.FilterInterval.TO, tmp),
212
+ ];
213
+ return values;
214
+ }
215
+ getIntervalTextFieldFilterValue(filters = {}, column, index) {
216
+ return this._getIntervalTextFieldFilterValue(filters, column, index, false);
217
+ }
218
+ getIntervalTextFieldFilterValueTmp(filters = {}, column, index) {
219
+ return this._getIntervalTextFieldFilterValue(filters, column, index, true);
220
+ }
221
+ _getIntervalTextFieldFilterValue(filters = {}, column, index, tmp) {
222
+ let value = '';
223
+ if (filters == null) {
224
+ return value;
225
+ }
226
+ let filter = filters[column];
227
+ if (filter == null) {
228
+ return value;
229
+ }
230
+ if (tmp && filter.intervalTmp == null) {
231
+ return value;
232
+ }
233
+ if (!tmp && filter.interval == null) {
234
+ return value;
235
+ }
236
+ value = tmp ? filter.intervalTmp[index] : filter.interval[index];
237
+ return value;
238
+ }
239
+ setTextFieldFilterValue(filters = {}, column, newFilter) {
240
+ this._setTextFieldFilterValue(filters, column, newFilter, true);
241
+ }
242
+ _setTextFieldFilterValue(filters = {}, column, newFilter, tmp) {
243
+ if (filters == null) {
244
+ return;
245
+ }
246
+ let filter = filters[column];
247
+ if (filter == null) {
248
+ filter = {
249
+ textField: '',
250
+ textFieldTmp: '',
251
+ checkBoxes: [],
252
+ interval: null,
253
+ intervalTmp: null,
254
+ };
255
+ filters[column] = filter;
256
+ }
257
+ if (tmp) {
258
+ filter.textFieldTmp =
259
+ newFilter != null ? newFilter.trim() : newFilter;
260
+ }
261
+ else {
262
+ filter.textField = newFilter != null ? newFilter.trim() : newFilter;
263
+ }
264
+ }
265
+ setIntervalTextFieldFilterValue(filters = {}, column, newFilter, index) {
266
+ this._setIntervalTextFieldFilterValue(filters, column, newFilter, index, true);
267
+ }
268
+ _setIntervalTextFieldFilterValue(filters = {}, column, newFilter, index, tmp) {
269
+ if (filters == null) {
270
+ return;
271
+ }
272
+ let filter = filters[column];
273
+ if (filter == null) {
274
+ filter = {
275
+ textField: '',
276
+ textFieldTmp: '',
277
+ checkBoxes: [],
278
+ interval: null,
279
+ intervalTmp: null,
280
+ };
281
+ filters[column] = filter;
282
+ }
283
+ if (filter.interval == null) {
284
+ filter.interval = [];
285
+ filter.interval.push('', '');
286
+ }
287
+ if (filter.intervalTmp == null) {
288
+ filter.intervalTmp = [];
289
+ filter.intervalTmp.push('', '');
290
+ }
291
+ if (tmp) {
292
+ filter.intervalTmp[index] =
293
+ newFilter != null ? newFilter.trim() : newFilter;
294
+ }
295
+ else {
296
+ filter.interval[index] =
297
+ newFilter != null ? newFilter.trim() : newFilter;
298
+ }
299
+ }
300
+ saveTextualFilters(filters = {}, column) {
301
+ this._setTextFieldFilterValue(filters, column, this.getTextFilterValueTmp(filters, column), false);
302
+ this._setIntervalTextFieldFilterValue(filters, column, this.getIntervalTextFieldFilterValueTmp(filters, column, kupManager.FilterInterval.FROM), kupManager.FilterInterval.FROM, false);
303
+ this._setIntervalTextFieldFilterValue(filters, column, this.getIntervalTextFieldFilterValueTmp(filters, column, kupManager.FilterInterval.TO), kupManager.FilterInterval.TO, false);
304
+ }
305
+ resetTextualFilters(filters = {}, column) {
306
+ this._setTextFieldFilterValue(filters, column, this.getTextFilterValue(filters, column), true);
307
+ this._setIntervalTextFieldFilterValue(filters, column, this.getIntervalTextFieldFilterValue(filters, column, kupManager.FilterInterval.FROM), kupManager.FilterInterval.FROM, true);
308
+ this._setIntervalTextFieldFilterValue(filters, column, this.getIntervalTextFieldFilterValue(filters, column, kupManager.FilterInterval.TO), kupManager.FilterInterval.TO, true);
309
+ }
310
+ getFilterValueForTooltip(filters = {}, column) {
311
+ let txtFilter = this.getTextFilterValue(filters, column.name);
312
+ let interval = this.getIntervalTextFieldFilterValues(filters, column);
313
+ let chkFilters = this.getCheckBoxFilterValues(filters, column.name);
314
+ let separator = '';
315
+ let txtFiterRis = kupManager.getValueForDisplay(txtFilter, column.obj, column.decimals);
316
+ if (txtFilter != '') {
317
+ separator = ' AND ';
318
+ }
319
+ if (interval[kupManager.FilterInterval.FROM] != '') {
320
+ txtFiterRis +=
321
+ separator +
322
+ '(>= ' +
323
+ kupManager.getValueForDisplay(interval[kupManager.FilterInterval.FROM], column.obj, column.decimals) +
324
+ ')';
325
+ separator = ' AND ';
326
+ }
327
+ if (interval[kupManager.FilterInterval.TO] != '') {
328
+ txtFiterRis +=
329
+ separator +
330
+ '(<= ' +
331
+ kupManager.getValueForDisplay(interval[kupManager.FilterInterval.TO], column.obj, column.decimals) +
332
+ ')';
333
+ separator = ' AND ';
334
+ }
335
+ separator = '';
336
+ let ris = '';
337
+ chkFilters.forEach((f) => {
338
+ ris += separator + kupManager.getValueForDisplay2(f, column);
339
+ separator = ' OR ';
340
+ });
341
+ if (ris != '') {
342
+ ris = '(' + ris + ')';
343
+ if (txtFiterRis != '') {
344
+ ris = ' AND ' + ris;
345
+ }
346
+ }
347
+ ris = txtFiterRis + ris;
348
+ return ris;
349
+ }
350
+ /**
351
+ * Triggers when a filter must be removed, for column.
352
+ * @param {GenericFilter} filters - Filters of the component.
353
+ * @param {string} column - Name of the column.
354
+ */
355
+ removeFilter(filters = {}, column) {
356
+ filters[column] = {
357
+ textField: '',
358
+ textFieldTmp: '',
359
+ checkBoxes: [],
360
+ interval: null,
361
+ intervalTmp: null,
362
+ };
363
+ }
364
364
  }
365
365
 
366
- /**
367
- * Props of the kup-tree component.
368
- * Used to export every prop in an object.
369
- */
370
- exports.KupTreeProps = void 0;
371
- (function (KupTreeProps) {
372
- KupTreeProps["asAccordion"] = "When enabled, the first level of depth will give an accordion look to nodes.";
373
- KupTreeProps["columns"] = "The columns of the tree when tree visualization is active.";
374
- KupTreeProps["customStyle"] = "Custom style of the component.";
375
- KupTreeProps["data"] = "The json data used to populate the tree view: the basic, always visible tree nodes.";
376
- KupTreeProps["density"] = "The density of the rows, defaults at 'medium' and can also be set to 'dense' or 'wide'.";
377
- KupTreeProps["dynamicExpansionCallback"] = "Function that gets invoked when a new set of nodes must be loaded as children of a node. When useDynamicExpansion is set, the tree component will have two different behaviors depending on the value of this prop. If this prop is set to null, no callback to download data is available: the component will emit an event requiring the parent to load the children of the given node. If this prop is set to have a callback, then the component will automatically make requests to load children of a given node. After the load has been completed, a different event will be fired to alert the parent of the change.";
378
- KupTreeProps["enableExtraColumns"] = "Enables adding extra columns.";
379
- KupTreeProps["expanded"] = "Flag: the nodes of the whole tree must be already expanded upon loading. Disabled nodes do NOT get expanded.";
380
- KupTreeProps["expansionMode"] = "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.";
381
- KupTreeProps["filters"] = "List of filters set by the user.";
382
- KupTreeProps["globalFilter"] = "When set to true it activates the global filter.";
383
- KupTreeProps["globalFilterValue"] = "The value of the global filter.";
384
- KupTreeProps["globalFilterMode"] = "The mode of the global filter.";
385
- KupTreeProps["removableColumns"] = "Sets the possibility to remove the selected column.";
386
- KupTreeProps["preventXScroll"] = "Experimental feature: when active, the tree will try to prevent horizontal overflowing elements by setting a width on the content of the table cells. It works only on cells of the main column.";
387
- KupTreeProps["ripple"] = "When enabled displays Material's ripple effect on nodes (only when no columns are displayed).";
388
- KupTreeProps["scrollOnHover"] = "Activates the scroll on hover function.";
389
- KupTreeProps["showColumns"] = "Shows the tree data as a table.";
390
- KupTreeProps["showFilters"] = "When set to true enables the column filters.";
391
- KupTreeProps["showFooter"] = "When set to true shows the footer.";
392
- KupTreeProps["showHeader"] = "Flag: shows the header of the tree when the tree is displayed as a table.";
393
- KupTreeProps["showIcons"] = "Shows the icons of the nodes.";
394
- KupTreeProps["stateId"] = "";
395
- KupTreeProps["store"] = "";
396
- KupTreeProps["totals"] = "Defines the current totals options.";
397
- KupTreeProps["useDynamicExpansion"] = "When the component must use the dynamic expansion feature to open its nodes, it means that not all the nodes of the tree have been passed inside the data property. Therefore, when expanding a node, the tree must emit an event (or run a given callback) and wait for the child nodes to be downloaded from the server.";
398
- })(exports.KupTreeProps || (exports.KupTreeProps = {}));
399
- /**
400
- * The name of the constant used by the tree component to identify the main tree in column menu
401
- * @constant
402
- */
403
- const treeMainColumnName = 'TREE_COLUMN';
404
- exports.KupTreeExpansionMode = void 0;
405
- (function (KupTreeExpansionMode) {
406
- KupTreeExpansionMode["DROPDOWN"] = "dropdown";
407
- KupTreeExpansionMode["NODE"] = "node";
366
+ /**
367
+ * Props of the kup-tree component.
368
+ * Used to export every prop in an object.
369
+ */
370
+ exports.KupTreeProps = void 0;
371
+ (function (KupTreeProps) {
372
+ KupTreeProps["asAccordion"] = "When enabled, the first level of depth will give an accordion look to nodes.";
373
+ KupTreeProps["columns"] = "The columns of the tree when tree visualization is active.";
374
+ KupTreeProps["customStyle"] = "Custom style of the component.";
375
+ KupTreeProps["data"] = "The json data used to populate the tree view: the basic, always visible tree nodes.";
376
+ KupTreeProps["density"] = "The density of the rows, defaults at 'medium' and can also be set to 'dense' or 'wide'.";
377
+ KupTreeProps["dynamicExpansionCallback"] = "Function that gets invoked when a new set of nodes must be loaded as children of a node. When useDynamicExpansion is set, the tree component will have two different behaviors depending on the value of this prop. If this prop is set to null, no callback to download data is available: the component will emit an event requiring the parent to load the children of the given node. If this prop is set to have a callback, then the component will automatically make requests to load children of a given node. After the load has been completed, a different event will be fired to alert the parent of the change.";
378
+ KupTreeProps["enableExtraColumns"] = "Enables adding extra columns.";
379
+ KupTreeProps["expanded"] = "Flag: the nodes of the whole tree must be already expanded upon loading. Disabled nodes do NOT get expanded.";
380
+ KupTreeProps["expansionMode"] = "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.";
381
+ KupTreeProps["filters"] = "List of filters set by the user.";
382
+ KupTreeProps["globalFilter"] = "When set to true it activates the global filter.";
383
+ KupTreeProps["globalFilterValue"] = "The value of the global filter.";
384
+ KupTreeProps["globalFilterMode"] = "The mode of the global filter.";
385
+ KupTreeProps["removableColumns"] = "Sets the possibility to remove the selected column.";
386
+ KupTreeProps["preventXScroll"] = "Experimental feature: when active, the tree will try to prevent horizontal overflowing elements by setting a width on the content of the table cells. It works only on cells of the main column.";
387
+ KupTreeProps["ripple"] = "When enabled displays Material's ripple effect on nodes (only when no columns are displayed).";
388
+ KupTreeProps["scrollOnHover"] = "Activates the scroll on hover function.";
389
+ KupTreeProps["showColumns"] = "Shows the tree data as a table.";
390
+ KupTreeProps["showFilters"] = "When set to true enables the column filters.";
391
+ KupTreeProps["showFooter"] = "When set to true shows the footer.";
392
+ KupTreeProps["showHeader"] = "Flag: shows the header of the tree when the tree is displayed as a table.";
393
+ KupTreeProps["showIcons"] = "Shows the icons of the nodes.";
394
+ KupTreeProps["stateId"] = "";
395
+ KupTreeProps["store"] = "";
396
+ KupTreeProps["totals"] = "Defines the current totals options.";
397
+ KupTreeProps["useDynamicExpansion"] = "When the component must use the dynamic expansion feature to open its nodes, it means that not all the nodes of the tree have been passed inside the data property. Therefore, when expanding a node, the tree must emit an event (or run a given callback) and wait for the child nodes to be downloaded from the server.";
398
+ })(exports.KupTreeProps || (exports.KupTreeProps = {}));
399
+ /**
400
+ * The name of the constant used by the tree component to identify the main tree in column menu
401
+ * @constant
402
+ */
403
+ const treeMainColumnName = 'TREE_COLUMN';
404
+ exports.KupTreeExpansionMode = void 0;
405
+ (function (KupTreeExpansionMode) {
406
+ KupTreeExpansionMode["DROPDOWN"] = "dropdown";
407
+ KupTreeExpansionMode["NODE"] = "node";
408
408
  })(exports.KupTreeExpansionMode || (exports.KupTreeExpansionMode = {}));
409
409
 
410
- const dom$2 = document.documentElement;
411
- const kupObjects = dom$2.ketchup
412
- ? dom$2.ketchup.objects
413
- : new kupManager.KupObjects();
414
- const kupData = dom$2.ketchup ? dom$2.ketchup.data : new kupManager.KupData();
415
- /**
416
- * Filtering algorithms related to data-table rows.
417
- * @module FiltersRows
418
- * @todo Should contain EVERY row-specific filtering method.
419
- */
420
- class FiltersRows extends kupManager.Filters {
421
- isFilterCompliantForCell(cellValue, filterValue, interval) {
422
- if (!cellValue) {
423
- return false;
424
- }
425
- return this.isFilterCompliantForSimpleValue(cellValue.value, cellValue.obj, filterValue, interval);
426
- }
427
- isFilterCompliantForCellObj(cellValue, filterValue, interval) {
428
- if (!cellValue) {
429
- return false;
430
- }
431
- if (!cellValue.obj) {
432
- return false;
433
- }
434
- return this.isFilterCompliantForSimpleValue(cellValue.obj.k, cellValue.obj, filterValue, interval);
435
- }
436
- isRowCompliant(r, filters = {}, globalFilter = '', isUsingGlobalFilter = false, columns = [], columnFilters) {
437
- return this.areCellsCompliant(r.cells, filters, globalFilter, isUsingGlobalFilter, columns, columnFilters);
438
- }
439
- areCellsCompliant(cells, filters = {}, globalFilter = '', isUsingGlobalFilter = false, columns = [], columnFilters) {
440
- if (isUsingGlobalFilter) {
441
- let retValue = true;
442
- // There are no columns -> display element
443
- if (columns && columns != null && columns.length > 0) {
444
- retValue = false;
445
- let _filterIsNegative = this.filterIsNegative(globalFilter);
446
- // Search among all visible columns for the global filter
447
- for (let i = 0; i < columns.length; i++) {
448
- if (columns[i].visible == false) {
449
- continue;
450
- }
451
- const cell = cells[columns[i].name];
452
- if (cell == null) {
453
- continue;
454
- }
455
- retValue = this.isFilterCompliantForValue(cell.value, globalFilter);
456
- let displayedValue = kupManager.getCellValueForDisplay(columns[i], cell);
457
- if (displayedValue != cell.value) {
458
- retValue =
459
- retValue ||
460
- this.isFilterCompliantForValue(displayedValue, globalFilter);
461
- }
462
- if (retValue == true && !_filterIsNegative) {
463
- break;
464
- }
465
- if (retValue == false && _filterIsNegative) {
466
- break;
467
- }
468
- }
469
- }
470
- if (!retValue) {
471
- return false;
472
- }
473
- }
474
- if (columnFilters == null) {
475
- columnFilters = new FiltersColumnMenu();
476
- }
477
- // There are no filters to check -> the element is valid
478
- if (!this.hasFilters(filters, columns, columnFilters)) {
479
- return true;
480
- }
481
- let keys = Object.keys(filters);
482
- // Filters
483
- for (let i = 0; i < keys.length; i++) {
484
- let key = keys[i];
485
- const cell = cells[key];
486
- if (!cell) {
487
- return false;
488
- }
489
- let filterValue = columnFilters.getTextFilterValue(filters, key);
490
- let interval = columnFilters.getIntervalTextFieldFilterValues(filters, kupManager.getColumnByName(columns, key));
491
- const _filterIsNegative = this.filterIsNegative(filterValue);
492
- let b1 = this.isFilterCompliantForCell(cell, filterValue, interval);
493
- let b2 = _filterIsNegative;
494
- if (!kupObjects.isNumber(cell.obj) &&
495
- !kupObjects.isDate(cell.obj) &&
496
- !kupObjects.isTime(cell.obj) &&
497
- !kupObjects.isTimestamp(cell.obj)) {
498
- b2 = this.isFilterCompliantForCellObj(cell, filterValue, interval);
499
- }
500
- if (_filterIsNegative) {
501
- if (!b1 || !b2) {
502
- return false;
503
- }
504
- }
505
- else {
506
- if (!b1 && !b2) {
507
- return false;
508
- }
509
- }
510
- let filterValues = columnFilters.getCheckBoxFilterValues(filters, key);
511
- if (filterValues.length == 0) {
512
- continue;
513
- }
514
- let retValue = false;
515
- for (let i = 0; i < filterValues.length; i++) {
516
- let fv = filterValues[i];
517
- if (fv == null || fv.value == null) {
518
- continue;
519
- }
520
- if (cell.value != null) {
521
- if (cell.value.toLowerCase().trim() ==
522
- fv.value.toLowerCase().trim()) {
523
- retValue = true;
524
- break;
525
- }
526
- }
527
- if (cell.obj != null) {
528
- if (cell.obj.k.toLowerCase().trim() ==
529
- fv.value.toLowerCase().trim()) {
530
- retValue = true;
531
- break;
532
- }
533
- }
534
- }
535
- if (!retValue) {
536
- return false;
537
- }
538
- }
539
- return true;
540
- }
541
- hasFilters(filters = {}, columns, columnFilters) {
542
- if (filters == null) {
543
- return false;
544
- }
545
- let keys = Object.keys(filters);
546
- if (keys == null || keys.length < 1) {
547
- return false;
548
- }
549
- if (columnFilters == null) {
550
- columnFilters = new FiltersColumnMenu();
551
- }
552
- for (let i = 0; i < keys.length; i++) {
553
- let key = keys[i];
554
- let col = null;
555
- if (key === treeMainColumnName) {
556
- col = {
557
- name: treeMainColumnName,
558
- title: '',
559
- };
560
- }
561
- else {
562
- col = kupManager.getColumnByName(columns, key);
563
- }
564
- if (columnFilters.hasFiltersForColumn(filters, col)) {
565
- return true;
566
- }
567
- }
568
- return false;
569
- }
570
- /**
571
- * Filters the rows data of a data-table component according to the parameters
572
- *
573
- * @param rows - The data of the rows to filter.
574
- * @param filters - The the filters for each column.
575
- * @param globalFilter - A global filter applied to all columns.
576
- * @param columns - The colmns on which the filter will take effect.
577
- * @todo This function can be improved in its speed by a refactor in which from two different cycles of execution for
578
- * single filters and global filter, all controls on a single column are done in a single cycle.
579
- */
580
- filterRows(rows = [], filters = {}, globalFilter = '', columns = [], columnFilters) {
581
- if (!rows || rows == null) {
582
- return [];
583
- }
584
- // There are rows to filter
585
- let filteredRows = [];
586
- const isUsingGlobalFilter = !!(globalFilter && columns);
587
- if (this.hasFilters(filters, columns, columnFilters) ||
588
- isUsingGlobalFilter) {
589
- for (let i = 0; i < rows.length; i++) {
590
- let r = rows[i];
591
- if ((r.id && r.id.indexOf('insert_') > -1) ||
592
- this.isRowCompliant(r, filters, globalFilter, isUsingGlobalFilter, columns, columnFilters)) {
593
- filteredRows[filteredRows.length] = r;
594
- }
595
- }
596
- }
597
- else {
598
- filteredRows = [...rows];
599
- }
600
- return filteredRows;
601
- }
602
- getColumnValues(comp, column, globalFilterValue, columnFilters) {
603
- let values = new Array();
604
- if (columnFilters == null) {
605
- columnFilters = new FiltersColumnMenu();
606
- }
607
- let value = columnFilters.getTextFilterValueTmp(comp.filters, column.name);
608
- let interval = columnFilters.getIntervalTextFieldFilterValuesTmp(comp.filters, column);
609
- let checkboxes = columnFilters.getCheckBoxFilterValues(comp.filters, column.name);
610
- if (column.valuesForFilter != null &&
611
- column.valuesForFilter.length > 0) {
612
- column.valuesForFilter.forEach((element) => {
613
- let v = element;
614
- if (kupManager.Filters.valuesArrayContainsValue(checkboxes, v) ||
615
- value == '' ||
616
- columnFilters.isFilterCompliantForSimpleValue(v, column.obj, value, interval)) {
617
- values.push({
618
- value: v,
619
- displayedValue: kupManager.getValueForDisplay(v, column.obj, column.decimals),
620
- });
621
- }
622
- });
623
- return values;
624
- }
625
- /** è necessario estrarre i valori della colonna di tutte le righe
626
- * filtrate SENZA il filtro della colonna stessa corrente */
627
- let tmpFilters = Object.assign({}, comp.filters);
628
- tmpFilters[column.name] = {
629
- textField: value,
630
- textFieldTmp: value,
631
- checkBoxes: [],
632
- interval: interval,
633
- intervalTmp: interval,
634
- };
635
- let tmpRows = this.filterRows(comp.getRows(), tmpFilters, globalFilterValue, comp.getVisibleColumns(), columnFilters);
636
- for (let i = 0; i < checkboxes.length; i++) {
637
- values.push(checkboxes[i]);
638
- }
639
- return kupData.cell.getUnivocalValue({ rows: tmpRows }, column, true);
640
- }
410
+ const dom$3 = document.documentElement;
411
+ const kupObjects = dom$3.ketchup
412
+ ? dom$3.ketchup.objects
413
+ : new kupManager.KupObjects();
414
+ const kupData = dom$3.ketchup ? dom$3.ketchup.data : new kupManager.KupData();
415
+ /**
416
+ * Filtering algorithms related to data-table rows.
417
+ * @module FiltersRows
418
+ * @todo Should contain EVERY row-specific filtering method.
419
+ */
420
+ class FiltersRows extends kupManager.Filters {
421
+ isFilterCompliantForCell(cellValue, filterValue, interval) {
422
+ if (!cellValue) {
423
+ return false;
424
+ }
425
+ return this.isFilterCompliantForSimpleValue(cellValue.value, cellValue.obj, filterValue, interval);
426
+ }
427
+ isFilterCompliantForCellObj(cellValue, filterValue, interval) {
428
+ if (!cellValue) {
429
+ return false;
430
+ }
431
+ if (!cellValue.obj) {
432
+ return false;
433
+ }
434
+ return this.isFilterCompliantForSimpleValue(cellValue.obj.k, cellValue.obj, filterValue, interval);
435
+ }
436
+ isRowCompliant(r, filters = {}, globalFilter = '', isUsingGlobalFilter = false, columns = [], columnFilters) {
437
+ return this.areCellsCompliant(r.cells, filters, globalFilter, isUsingGlobalFilter, columns, columnFilters);
438
+ }
439
+ areCellsCompliant(cells, filters = {}, globalFilter = '', isUsingGlobalFilter = false, columns = [], columnFilters) {
440
+ if (isUsingGlobalFilter) {
441
+ let retValue = true;
442
+ // There are no columns -> display element
443
+ if (columns && columns != null && columns.length > 0) {
444
+ retValue = false;
445
+ let _filterIsNegative = this.filterIsNegative(globalFilter);
446
+ // Search among all visible columns for the global filter
447
+ for (let i = 0; i < columns.length; i++) {
448
+ if (columns[i].visible == false) {
449
+ continue;
450
+ }
451
+ const cell = cells[columns[i].name];
452
+ if (cell == null) {
453
+ continue;
454
+ }
455
+ retValue = this.isFilterCompliantForValue(cell.value, globalFilter);
456
+ let displayedValue = kupManager.getCellValueForDisplay(columns[i], cell);
457
+ if (displayedValue != cell.value) {
458
+ retValue =
459
+ retValue ||
460
+ this.isFilterCompliantForValue(displayedValue, globalFilter);
461
+ }
462
+ if (retValue == true && !_filterIsNegative) {
463
+ break;
464
+ }
465
+ if (retValue == false && _filterIsNegative) {
466
+ break;
467
+ }
468
+ }
469
+ }
470
+ if (!retValue) {
471
+ return false;
472
+ }
473
+ }
474
+ if (columnFilters == null) {
475
+ columnFilters = new FiltersColumnMenu();
476
+ }
477
+ // There are no filters to check -> the element is valid
478
+ if (!this.hasFilters(filters, columns, columnFilters)) {
479
+ return true;
480
+ }
481
+ let keys = Object.keys(filters);
482
+ // Filters
483
+ for (let i = 0; i < keys.length; i++) {
484
+ let key = keys[i];
485
+ const cell = cells[key];
486
+ if (!cell) {
487
+ return false;
488
+ }
489
+ let filterValue = columnFilters.getTextFilterValue(filters, key);
490
+ let interval = columnFilters.getIntervalTextFieldFilterValues(filters, kupManager.getColumnByName(columns, key));
491
+ const _filterIsNegative = this.filterIsNegative(filterValue);
492
+ let b1 = this.isFilterCompliantForCell(cell, filterValue, interval);
493
+ let b2 = _filterIsNegative;
494
+ if (!kupObjects.isNumber(cell.obj) &&
495
+ !kupObjects.isDate(cell.obj) &&
496
+ !kupObjects.isTime(cell.obj) &&
497
+ !kupObjects.isTimestamp(cell.obj)) {
498
+ b2 = this.isFilterCompliantForCellObj(cell, filterValue, interval);
499
+ }
500
+ if (_filterIsNegative) {
501
+ if (!b1 || !b2) {
502
+ return false;
503
+ }
504
+ }
505
+ else {
506
+ if (!b1 && !b2) {
507
+ return false;
508
+ }
509
+ }
510
+ let filterValues = columnFilters.getCheckBoxFilterValues(filters, key);
511
+ if (filterValues.length == 0) {
512
+ continue;
513
+ }
514
+ let retValue = false;
515
+ for (let i = 0; i < filterValues.length; i++) {
516
+ let fv = filterValues[i];
517
+ if (fv == null || fv.value == null) {
518
+ continue;
519
+ }
520
+ if (cell.value != null) {
521
+ if (cell.value.toLowerCase().trim() ==
522
+ fv.value.toLowerCase().trim()) {
523
+ retValue = true;
524
+ break;
525
+ }
526
+ }
527
+ if (cell.obj != null) {
528
+ if (cell.obj.k.toLowerCase().trim() ==
529
+ fv.value.toLowerCase().trim()) {
530
+ retValue = true;
531
+ break;
532
+ }
533
+ }
534
+ }
535
+ if (!retValue) {
536
+ return false;
537
+ }
538
+ }
539
+ return true;
540
+ }
541
+ hasFilters(filters = {}, columns, columnFilters) {
542
+ if (filters == null) {
543
+ return false;
544
+ }
545
+ let keys = Object.keys(filters);
546
+ if (keys == null || keys.length < 1) {
547
+ return false;
548
+ }
549
+ if (columnFilters == null) {
550
+ columnFilters = new FiltersColumnMenu();
551
+ }
552
+ for (let i = 0; i < keys.length; i++) {
553
+ let key = keys[i];
554
+ let col = null;
555
+ if (key === treeMainColumnName) {
556
+ col = {
557
+ name: treeMainColumnName,
558
+ title: '',
559
+ };
560
+ }
561
+ else {
562
+ col = kupManager.getColumnByName(columns, key);
563
+ }
564
+ if (columnFilters.hasFiltersForColumn(filters, col)) {
565
+ return true;
566
+ }
567
+ }
568
+ return false;
569
+ }
570
+ /**
571
+ * Filters the rows data of a data-table component according to the parameters
572
+ *
573
+ * @param rows - The data of the rows to filter.
574
+ * @param filters - The the filters for each column.
575
+ * @param globalFilter - A global filter applied to all columns.
576
+ * @param columns - The colmns on which the filter will take effect.
577
+ * @todo This function can be improved in its speed by a refactor in which from two different cycles of execution for
578
+ * single filters and global filter, all controls on a single column are done in a single cycle.
579
+ */
580
+ filterRows(rows = [], filters = {}, globalFilter = '', columns = [], columnFilters) {
581
+ if (!rows || rows == null) {
582
+ return [];
583
+ }
584
+ // There are rows to filter
585
+ let filteredRows = [];
586
+ const isUsingGlobalFilter = !!(globalFilter && columns);
587
+ if (this.hasFilters(filters, columns, columnFilters) ||
588
+ isUsingGlobalFilter) {
589
+ for (let i = 0; i < rows.length; i++) {
590
+ let r = rows[i];
591
+ if ((r.id && r.id.indexOf('insert_') > -1) ||
592
+ this.isRowCompliant(r, filters, globalFilter, isUsingGlobalFilter, columns, columnFilters)) {
593
+ filteredRows[filteredRows.length] = r;
594
+ }
595
+ }
596
+ }
597
+ else {
598
+ filteredRows = [...rows];
599
+ }
600
+ return filteredRows;
601
+ }
602
+ getColumnValues(comp, column, globalFilterValue, columnFilters) {
603
+ let values = new Array();
604
+ if (columnFilters == null) {
605
+ columnFilters = new FiltersColumnMenu();
606
+ }
607
+ let value = columnFilters.getTextFilterValueTmp(comp.filters, column.name);
608
+ let interval = columnFilters.getIntervalTextFieldFilterValuesTmp(comp.filters, column);
609
+ let checkboxes = columnFilters.getCheckBoxFilterValues(comp.filters, column.name);
610
+ if (column.valuesForFilter != null &&
611
+ column.valuesForFilter.length > 0) {
612
+ column.valuesForFilter.forEach((element) => {
613
+ let v = element;
614
+ if (kupManager.Filters.valuesArrayContainsValue(checkboxes, v) ||
615
+ value == '' ||
616
+ columnFilters.isFilterCompliantForSimpleValue(v, column.obj, value, interval)) {
617
+ values.push({
618
+ value: v,
619
+ displayedValue: kupManager.getValueForDisplay(v, column.obj, column.decimals),
620
+ });
621
+ }
622
+ });
623
+ return values;
624
+ }
625
+ /** è necessario estrarre i valori della colonna di tutte le righe
626
+ * filtrate SENZA il filtro della colonna stessa corrente */
627
+ let tmpFilters = Object.assign({}, comp.filters);
628
+ tmpFilters[column.name] = {
629
+ textField: value,
630
+ textFieldTmp: value,
631
+ checkBoxes: [],
632
+ interval: interval,
633
+ intervalTmp: interval,
634
+ };
635
+ let tmpRows = this.filterRows(comp.getRows(), tmpFilters, globalFilterValue, comp.getVisibleColumns(), columnFilters);
636
+ for (let i = 0; i < checkboxes.length; i++) {
637
+ values.push(checkboxes[i]);
638
+ }
639
+ return kupData.cell.getUnivocalValue({ rows: tmpRows }, column, true);
640
+ }
641
641
  }
642
642
 
643
- const dom$1 = document.documentElement;
644
- function sortRows(rows = [], sort = []) {
645
- if (!rows || rows.length === 0) {
646
- return [];
647
- }
648
- // check if row is group
649
- if (rows[0].group) {
650
- return sortGroupRows(rows, sort);
651
- }
652
- // sorting rows
653
- if (!sort || sort.length === 0) {
654
- // no sort -> return rows as they are
655
- return rows;
656
- }
657
- // check multiple sort
658
- const isMultiSort = sort.length > 1;
659
- // sorting rows
660
- return rows.slice(0).sort((r1, r2) => {
661
- if (isMultiSort) {
662
- for (let i = 0; i < sort.length; i++) {
663
- const compare = compareRows(r1, r2, sort[i]);
664
- if (compare !== 0) {
665
- // not same row
666
- return compare;
667
- }
668
- }
669
- // same row
670
- return 0;
671
- }
672
- else {
673
- return compareRows(r1, r2, sort[0]);
674
- }
675
- });
676
- }
677
- function sortGroupRows(rows = [], sort = []) {
678
- if (!rows || rows.length === 0) {
679
- return [];
680
- }
681
- // getting columm group
682
- const groupColumn = rows[0].group.column;
683
- // check if column is in sort
684
- let sortObject = getSortOnColumn(groupColumn, sort);
685
- if (!sortObject) {
686
- sortObject = {
687
- column: groupColumn,
688
- sortMode: kupManager.SortMode.A,
689
- };
690
- }
691
- // sorting rows
692
- rows.sort((r1, r2) => {
693
- // creating fake cells
694
- const cell1 = {
695
- obj: r1.group.obj,
696
- value: r1.group.id,
697
- };
698
- const cell2 = {
699
- obj: r2.group.obj,
700
- value: r2.group.id,
701
- };
702
- return kupManager.compareCell(cell1, cell2, sortObject.sortMode);
703
- });
704
- // sorting children
705
- rows.forEach((row) => {
706
- row.group.children = sortRows(row.group.children, sort);
707
- });
708
- return rows;
709
- }
710
- function getSortOnColumn(column = '', sort = []) {
711
- if (!column || !sort || sort.length === 0) {
712
- return null;
713
- }
714
- for (let sortObject of sort) {
715
- if (sortObject.column === column) {
716
- return sortObject;
717
- }
718
- }
719
- return null;
720
- }
721
- function compareRows(r1, r2, sortObj) {
722
- const cell1 = r1.cells[sortObj.column];
723
- const cell2 = r2.cells[sortObj.column];
724
- if (!cell1 && !cell2) {
725
- return 0;
726
- }
727
- if (!cell1) {
728
- return 1;
729
- }
730
- if (!cell2) {
731
- return -1;
732
- }
733
- return kupManager.compareCell(cell1, cell2, sortObj.sortMode);
734
- }
735
- //-------- FILTER FUNCTIONS --------
736
- /**
737
- * Filters the rows data of a data-table component according to the parameters
738
- *
739
- * @param rows - The data of the rows to filter.
740
- * @param filters - The the filters for each column.
741
- * @param globalFilter - A global filter applied to all columns.
742
- * @param columns - The colmns on which the filter will take effect.
743
- * @todo This function can be improved in its speed by a refactor in which from two different cycles of execution for
744
- * single filters and global filter, all controls on a single column are done in a single cycle.
745
- */
746
- function filterRows(rows = [], filters = {}, globalFilter = '', columns = [], columnFilters, filtersRows) {
747
- if (filtersRows == null) {
748
- filtersRows = new FiltersRows();
749
- }
750
- return filtersRows.filterRows(rows, filters, globalFilter, columns, columnFilters);
751
- }
752
- function groupRows(columns = [], rows = [], groups = [], totals = {}) {
753
- if (!rows) {
754
- return [];
755
- }
756
- if (!groups || groups.length === 0 || !columns || columns.length === 0) {
757
- return rows;
758
- }
759
- // Keeps label of the valid columns
760
- const columnLabels = {};
761
- // remove invalid groups and store column labels
762
- const validGroups = groups.filter(({ column }) => {
763
- for (let { name, title } of columns) {
764
- if (name === column) {
765
- // Store label of the columns
766
- columnLabels[name] = title;
767
- return true;
768
- }
769
- }
770
- return false;
771
- });
772
- if (validGroups.length === 0) {
773
- // no valid groups
774
- return rows;
775
- }
776
- // creating root
777
- const groupRows = [];
778
- // obj used to calculate the group distinct value
779
- let distinctObj = {};
780
- rows.forEach((row) => {
781
- // getting column name from first group
782
- const columnName = validGroups[0].column;
783
- // getting row value
784
- const cell = row.cells[columnName];
785
- if (cell) {
786
- const column = kupManager.getColumnByName(columns, columnName);
787
- const cellValueForDisplay = kupManager.getCellValueForDisplay(column, cell);
788
- const cellValue = cell.value;
789
- let groupRow = null;
790
- // check in already in groupedRow
791
- for (let currentGroupRow of groupRows) {
792
- if (currentGroupRow.group.label === cellValueForDisplay) {
793
- groupRow = currentGroupRow;
794
- break;
795
- }
796
- }
797
- if (groupRow === null) {
798
- // create group row
799
- groupRow = {
800
- group: {
801
- id: cellValue,
802
- parent: null,
803
- column: columnName,
804
- columnLabel: columnLabels[columnName],
805
- expanded: false,
806
- label: cellValueForDisplay,
807
- children: [],
808
- obj: cell.obj,
809
- totals: {},
810
- },
811
- cells: {},
812
- };
813
- // add group to list
814
- groupRows.push(groupRow);
815
- }
816
- for (let i = 1; i < validGroups.length; i++) {
817
- const group = validGroups[i];
818
- // getting cell value
819
- const tempCell = row.cells[group.column];
820
- if (tempCell) {
821
- const column = kupManager.getColumnByName(columns, group.column);
822
- const tempCellValueForDisplay = kupManager.getCellValueForDisplay(column, tempCell);
823
- const tempCellValue = tempCell.value;
824
- // check if group already exists
825
- let tempGroupingRow = null;
826
- for (let j = 0; j < groupRow.group.children.length; j++) {
827
- const childGroup = groupRow.group.children[j];
828
- const groupLabel = childGroup.group.label;
829
- if (groupLabel === tempCellValueForDisplay) {
830
- tempGroupingRow = childGroup;
831
- break;
832
- }
833
- }
834
- if (!tempGroupingRow) {
835
- tempGroupingRow = {
836
- cells: {},
837
- group: {
838
- id: tempCellValue,
839
- parent: groupRow,
840
- column: group.column,
841
- columnLabel: columnLabels[group.column],
842
- children: [],
843
- expanded: false,
844
- label: tempCellValueForDisplay,
845
- totals: {},
846
- obj: tempCell.obj,
847
- },
848
- };
849
- adjustGroupId(tempGroupingRow);
850
- groupRow.group.children.push(tempGroupingRow);
851
- }
852
- groupRow = tempGroupingRow;
853
- }
854
- }
855
- // adding row
856
- groupRow.group.children.push(row);
857
- updateGroupTotal(groupRow, totals, row, distinctObj);
858
- }
859
- });
860
- adjustGroupsDistinct(groupRows, totals, distinctObj);
861
- adjustGroupsAverageOrFormula(groupRows, kupManager.TotalMode.AVERAGE, totals);
862
- adjustGroupsAverageOrFormula(groupRows, kupManager.TotalMode.MATH, totals);
863
- return groupRows;
864
- }
865
- function updateGroupTotal(groupRow, totals, addedRow, distinctObj) {
866
- if (!groupRow || !totals) {
867
- return;
868
- }
869
- const keys = Object.keys(totals);
870
- if (keys.length === 0) {
871
- return;
872
- }
873
- keys.forEach((key) => {
874
- const currentTotalValue = dom$1.ketchup.math.numberify(groupRow.group.totals[key] || 0);
875
- const cell = addedRow.cells[key];
876
- if (cell) {
877
- let _isNumber = dom$1.ketchup.objects.isNumber(cell.obj);
878
- const totalMode = totals[key];
879
- switch (totalMode) {
880
- case kupManager.TotalMode.COUNT:
881
- groupRow.group.totals[key] = currentTotalValue + 1;
882
- // updating parents
883
- let parent = groupRow.group.parent;
884
- while (parent != null) {
885
- const currentParentCount = parent.group.totals[key] || 0;
886
- parent.group.totals[key] = currentParentCount + 1;
887
- parent = parent.group.parent;
888
- }
889
- break;
890
- case kupManager.TotalMode.DISTINCT:
891
- let cellValue;
892
- if (_isNumber) {
893
- cellValue = dom$1.ketchup.math.numberify(kupManager.stringToNumber(cell.value));
894
- }
895
- else {
896
- cellValue = cell.value;
897
- }
898
- let distinctGroup = distinctObj[groupRow.group.id];
899
- if (!distinctGroup) {
900
- distinctObj[groupRow.group.id] = {};
901
- distinctObj[groupRow.group.id][key] = [];
902
- distinctObj[groupRow.group.id][key].push(cellValue);
903
- }
904
- else {
905
- let distinctList = distinctObj[groupRow.group.id][key];
906
- if (!distinctList) {
907
- // first round
908
- distinctObj[groupRow.group.id][key] = [];
909
- distinctObj[groupRow.group.id][key].push(cellValue);
910
- }
911
- else {
912
- // update the list
913
- distinctList.push(cellValue);
914
- }
915
- }
916
- // updating parents
917
- let distinctParent = groupRow.group.parent;
918
- while (distinctParent != null) {
919
- // get parent value
920
- let distinctGroupParent = distinctObj[distinctParent.group.id];
921
- if (!distinctGroupParent) {
922
- distinctObj[distinctParent.group.id] = {};
923
- distinctObj[distinctParent.group.id][key] = [];
924
- distinctObj[distinctParent.group.id][key].push(cellValue);
925
- }
926
- else {
927
- let distinctParentList = distinctObj[distinctParent.group.id][key];
928
- if (!distinctParentList) {
929
- // first round
930
- distinctObj[distinctParent.group.id][key] = [];
931
- distinctObj[distinctParent.group.id][key].push(cellValue);
932
- }
933
- else {
934
- // update the list
935
- distinctParentList.push(cellValue);
936
- }
937
- }
938
- // continue
939
- distinctParent = distinctParent.group.parent;
940
- }
941
- break;
942
- case kupManager.TotalMode.SUM:
943
- case kupManager.TotalMode.AVERAGE:
944
- if (_isNumber) {
945
- const cellValue = dom$1.ketchup.math.numberify(kupManager.stringToNumber(cell.value));
946
- groupRow.group.totals[key] =
947
- cellValue + currentTotalValue;
948
- // updating parents
949
- let parent = groupRow.group.parent;
950
- while (parent != null) {
951
- const currentParentSum = dom$1.ketchup.math.numberify(parent.group.totals[key] || 0);
952
- parent.group.totals[key] =
953
- cellValue + currentParentSum;
954
- parent = parent.group.parent;
955
- }
956
- }
957
- break;
958
- // TODO DRY the MIN and MAX functions
959
- case kupManager.TotalMode.MIN:
960
- if (_isNumber) {
961
- const currentTotalValue = groupRow.group.totals[key];
962
- const cellValue = dom$1.ketchup.math.numberify(kupManager.stringToNumber(cell.value));
963
- if (currentTotalValue) {
964
- groupRow.group.totals[key] = Math.min(currentTotalValue, cellValue);
965
- }
966
- else {
967
- // first round
968
- groupRow.group.totals[key] = cellValue;
969
- }
970
- // updating parents
971
- let parent = groupRow.group.parent;
972
- while (parent != null) {
973
- const currentParentMin = parent.group.totals[key];
974
- if (currentParentMin) {
975
- parent.group.totals[key] = Math.min(currentParentMin, cellValue);
976
- }
977
- else {
978
- // first round
979
- parent.group.totals[key] = cellValue;
980
- }
981
- parent = parent.group.parent;
982
- }
983
- }
984
- else if (dom$1.ketchup.objects.isDate(cell.obj)) {
985
- const momentValue = cell.obj
986
- ? dom$1.ketchup.objects.parseDate(cell.obj)
987
- : dom$1.ketchup.dates.toDayjs(cell.value);
988
- if (dom$1.ketchup.dates.isValid(momentValue)) {
989
- const cellValue = dom$1.ketchup.dates.toDate(momentValue);
990
- const currentTotalValue = groupRow.group.totals[key];
991
- if (currentTotalValue) {
992
- let moments = [];
993
- moments.push(cellValue);
994
- moments.push(dom$1.ketchup.dates.format(currentTotalValue));
995
- groupRow.group.totals[key] =
996
- dom$1.ketchup.dates.format(dom$1.ketchup.dates.min(moments));
997
- }
998
- else {
999
- groupRow.group.totals[key] = cellValue;
1000
- }
1001
- // updating parents
1002
- let parent = groupRow.group.parent;
1003
- while (parent != null) {
1004
- const currentParentMin = parent.group.totals[key];
1005
- if (currentParentMin) {
1006
- let moments = [];
1007
- moments.push(cellValue);
1008
- moments.push(dom$1.ketchup.dates.format(currentParentMin));
1009
- parent.group.totals[key] =
1010
- dom$1.ketchup.dates.format(dom$1.ketchup.dates.min(moments));
1011
- }
1012
- else {
1013
- // first round
1014
- parent.group.totals[key] = cellValue;
1015
- }
1016
- parent = parent.group.parent;
1017
- }
1018
- }
1019
- }
1020
- break;
1021
- // TODO DRY the MIN and MAX functions
1022
- case kupManager.TotalMode.MAX:
1023
- if (_isNumber) {
1024
- const currentTotalValue = groupRow.group.totals[key];
1025
- const cellValue = dom$1.ketchup.math.numberify(kupManager.stringToNumber(cell.value));
1026
- if (currentTotalValue) {
1027
- groupRow.group.totals[key] = Math.max(currentTotalValue, cellValue);
1028
- }
1029
- else {
1030
- // first round
1031
- groupRow.group.totals[key] = cellValue;
1032
- }
1033
- // updating parents
1034
- let parent = groupRow.group.parent;
1035
- while (parent != null) {
1036
- const currentParentMax = parent.group.totals[key];
1037
- if (currentParentMax) {
1038
- parent.group.totals[key] = Math.max(currentParentMax, cellValue);
1039
- }
1040
- else {
1041
- // first round
1042
- parent.group.totals[key] = cellValue;
1043
- }
1044
- parent = parent.group.parent;
1045
- }
1046
- }
1047
- else if (dom$1.ketchup.objects.isDate(cell.obj)) {
1048
- const momentValue = cell.obj
1049
- ? dom$1.ketchup.objects.parseDate(cell.obj)
1050
- : dom$1.ketchup.dates.toDayjs(cell.value);
1051
- if (dom$1.ketchup.dates.isValid(momentValue)) {
1052
- const cellValue = dom$1.ketchup.dates.toDate(momentValue);
1053
- const currentTotalValue = groupRow.group.totals[key];
1054
- if (currentTotalValue) {
1055
- let moments = [];
1056
- moments.push(cellValue);
1057
- moments.push(dom$1.ketchup.dates.format(currentTotalValue));
1058
- groupRow.group.totals[key] =
1059
- dom$1.ketchup.dates.format(dom$1.ketchup.dates.max(moments));
1060
- }
1061
- else {
1062
- groupRow.group.totals[key] = cellValue;
1063
- }
1064
- // updating parents
1065
- let parent = groupRow.group.parent;
1066
- while (parent != null) {
1067
- const currentParentMin = parent.group.totals[key];
1068
- if (currentParentMin) {
1069
- let moments = [];
1070
- moments.push(cellValue);
1071
- moments.push(dom$1.ketchup.dates.format(currentParentMin));
1072
- parent.group.totals[key] =
1073
- dom$1.ketchup.dates.format(dom$1.ketchup.dates.max(moments));
1074
- }
1075
- else {
1076
- // first round
1077
- parent.group.totals[key] = cellValue;
1078
- }
1079
- parent = parent.group.parent;
1080
- }
1081
- }
1082
- }
1083
- break;
1084
- default: {
1085
- if (totalMode.indexOf(kupManager.TotalMode.MATH) != 0) {
1086
- console.warn(`invalid total mode: ${totalMode}`);
1087
- }
1088
- break;
1089
- }
1090
- }
1091
- }
1092
- });
1093
- }
1094
- function adjustGroupsDistinct(groupRows, totals, distinctObj) {
1095
- if (!groupRows || !totals) {
1096
- return;
1097
- }
1098
- const keys = Object.keys(totals);
1099
- if (groupRows.length === 0 || !groupRows[0].group || keys.length === 0) {
1100
- return;
1101
- }
1102
- let toAdjustKeys = keys.filter((key) => kupManager.TotalMode.DISTINCT === totals[key]);
1103
- if (toAdjustKeys.length > 0) {
1104
- groupRows
1105
- .filter((groupRow) => groupRow.group.children.length > 0)
1106
- .forEach((groupRow) => adjustGroupDistinct(groupRow, toAdjustKeys, distinctObj));
1107
- }
1108
- }
1109
- function adjustGroupsAverageOrFormula(groupRows, type, totals) {
1110
- if (!groupRows || !totals) {
1111
- return;
1112
- }
1113
- const keys = Object.keys(totals);
1114
- if (groupRows.length === 0 || !groupRows[0].group || keys.length === 0) {
1115
- return;
1116
- }
1117
- let toAdjustKeys;
1118
- if (type == kupManager.TotalMode.AVERAGE) {
1119
- toAdjustKeys = keys.filter((key) => kupManager.TotalMode.AVERAGE === totals[key]);
1120
- }
1121
- if (type == kupManager.TotalMode.MATH) {
1122
- toAdjustKeys = keys.filter((key) => totals[key].indexOf(kupManager.TotalMode.MATH) == 0);
1123
- }
1124
- if (toAdjustKeys.length > 0) {
1125
- groupRows
1126
- .filter((groupRow) => groupRow.group.children.length > 0)
1127
- .forEach((groupRow) => adjustGroupAverageOrFormula(groupRow, type, toAdjustKeys, totals));
1128
- }
1129
- }
1130
- function adjustGroupDistinct(groupRow, toAdjustKeys, distinctObj) {
1131
- const children = groupRow.group.children;
1132
- if (children.length === 0) {
1133
- return;
1134
- }
1135
- if (children[0].group) {
1136
- children.forEach((child) => {
1137
- adjustGroupDistinct(child, toAdjustKeys, distinctObj);
1138
- });
1139
- }
1140
- toAdjustKeys.forEach((key) => {
1141
- const distinctList = distinctObj[groupRow.group.id][key];
1142
- groupRow.group.totals[key] = new Set(distinctList).size;
1143
- });
1144
- }
1145
- /**
1146
- * @returns number of 'leaf' of group
1147
- */
1148
- function adjustGroupAverageOrFormula(row, type, toAdjustKeys, totals) {
1149
- const children = row.group.children;
1150
- if (children.length === 0) {
1151
- return 0;
1152
- }
1153
- let numberOfLeaf = 0;
1154
- // check if child is a grouping row
1155
- if (children[0].group) {
1156
- children.forEach((child) => {
1157
- numberOfLeaf += adjustGroupAverageOrFormula(child, type, toAdjustKeys, totals);
1158
- });
1159
- }
1160
- else {
1161
- numberOfLeaf = children.length;
1162
- }
1163
- // adjust average/formulas
1164
- toAdjustKeys.forEach((key) => {
1165
- if (type == kupManager.TotalMode.AVERAGE) {
1166
- row.group.totals[key] =
1167
- dom$1.ketchup.math.numberify(row.group.totals[key]) /
1168
- numberOfLeaf;
1169
- }
1170
- if (type == kupManager.TotalMode.MATH) {
1171
- let formula = totals[key].substring(kupManager.TotalMode.MATH.length);
1172
- row.group.totals[key] = dom$1.ketchup.math.formulas.custom(formula, row.group.totals);
1173
- }
1174
- });
1175
- return numberOfLeaf;
1176
- }
1177
- function normalizeRows(columns, rows) {
1178
- if (rows) {
1179
- const normalizedrows = Object.assign(rows);
1180
- rows.forEach((row) => {
1181
- columns.forEach((column) => {
1182
- if (row.cells) {
1183
- const cell = row.cells[column.name];
1184
- if (cell && column.obj && !cell.obj) {
1185
- // cell.obj = Object.assign(column.obj);
1186
- cell.obj = {
1187
- t: column.obj.t,
1188
- p: column.obj.p,
1189
- k: cell.value,
1190
- };
1191
- }
1192
- }
1193
- });
1194
- });
1195
- return normalizedrows;
1196
- }
1197
- else {
1198
- return undefined;
1199
- }
1200
- }
1201
- function calcTotals(rows = [], totals = {}) {
1202
- if (dom$1.ketchup.objects.isEmptyJsObject(rows) ||
1203
- dom$1.ketchup.objects.isEmptyJsObject(totals)) {
1204
- return {};
1205
- }
1206
- const keys = Object.keys(totals);
1207
- const footerRow = {};
1208
- const dateColumns = new Array();
1209
- // if there are only COUNT, no need to loop on rows
1210
- let onlyCount = keys.length === 0 ||
1211
- keys.every((key) => totals[key] === kupManager.TotalMode.COUNT);
1212
- if (onlyCount) {
1213
- keys.forEach((columnName) => (footerRow[columnName] = rows.length));
1214
- }
1215
- else {
1216
- let distinctObj = {};
1217
- rows.forEach((r, index, array) => {
1218
- keys.filter((key) => kupManager.TotalMode.COUNT !== totals[key] &&
1219
- totals[key].indexOf(kupManager.TotalMode.MATH) != 0).forEach((key) => {
1220
- // getting cell
1221
- const cell = r.cells[key];
1222
- if (cell) {
1223
- if (totals[key] === kupManager.TotalMode.DISTINCT) {
1224
- let cellValue;
1225
- if (dom$1.ketchup.objects.isNumber(cell.obj)) {
1226
- cellValue = dom$1.ketchup.math.numberify(kupManager.stringToNumber(cell.value));
1227
- }
1228
- else {
1229
- cellValue = cell.value;
1230
- }
1231
- let distinctList = distinctObj[key];
1232
- if (!distinctList) {
1233
- // first round
1234
- distinctObj[key] = [];
1235
- distinctObj[key].push(cellValue);
1236
- }
1237
- else {
1238
- // update the list
1239
- distinctList.push(cellValue);
1240
- }
1241
- }
1242
- else if (dom$1.ketchup.objects.isNumber(cell.obj)) {
1243
- const cellValue = dom$1.ketchup.math.numberify(kupManager.stringToNumber(cell.value));
1244
- let currentFooterValue = footerRow[key];
1245
- switch (true) {
1246
- // TODO DRY the MIN and MAX functions
1247
- case totals[key] === kupManager.TotalMode.MIN:
1248
- if (currentFooterValue) {
1249
- footerRow[key] = Math.min(currentFooterValue, cellValue);
1250
- }
1251
- else {
1252
- footerRow[key] = cellValue;
1253
- }
1254
- break;
1255
- case totals[key] === kupManager.TotalMode.MAX:
1256
- if (currentFooterValue) {
1257
- footerRow[key] = Math.max(currentFooterValue, cellValue);
1258
- }
1259
- else {
1260
- footerRow[key] = cellValue;
1261
- }
1262
- break;
1263
- default:
1264
- // SUM
1265
- currentFooterValue = footerRow[key] || 0;
1266
- footerRow[key] =
1267
- cellValue +
1268
- dom$1.ketchup.math.numberify(currentFooterValue);
1269
- }
1270
- // TODO DRY the MIN and MAX functions
1271
- }
1272
- else if (dom$1.ketchup.objects.isDate(cell.obj)) {
1273
- if (dateColumns.indexOf(key) == -1) {
1274
- dateColumns.push(key);
1275
- }
1276
- const momentValue = dom$1.ketchup.dates.toDayjs(cell.value);
1277
- if (dom$1.ketchup.dates.isValid(momentValue)) {
1278
- const cellValue = dom$1.ketchup.dates.toDate(momentValue);
1279
- const currentFooterValue = footerRow[key]
1280
- ? dom$1.ketchup.dates.toDate(dom$1.ketchup.dates.toDayjs(footerRow[key]))
1281
- : null;
1282
- switch (true) {
1283
- case totals[key] === kupManager.TotalMode.MIN:
1284
- if (currentFooterValue) {
1285
- let moments = [];
1286
- moments.push(cellValue);
1287
- moments.push(currentFooterValue);
1288
- footerRow[key] =
1289
- dom$1.ketchup.dates.format(dom$1.ketchup.dates.min(moments), kupManager.KupDatesFormats.ISO_DATE);
1290
- }
1291
- else {
1292
- footerRow[key] =
1293
- dom$1.ketchup.dates.format(cellValue, kupManager.KupDatesFormats.ISO_DATE);
1294
- }
1295
- break;
1296
- case totals[key] === kupManager.TotalMode.MAX:
1297
- if (currentFooterValue) {
1298
- let moments = [];
1299
- moments.push(cellValue);
1300
- moments.push(currentFooterValue);
1301
- footerRow[key] =
1302
- dom$1.ketchup.dates.format(dom$1.ketchup.dates.max(moments), kupManager.KupDatesFormats.ISO_DATE);
1303
- }
1304
- else {
1305
- footerRow[key] =
1306
- dom$1.ketchup.dates.format(cellValue, kupManager.KupDatesFormats.ISO_DATE);
1307
- }
1308
- break;
1309
- }
1310
- }
1311
- }
1312
- }
1313
- if (index === array.length - 1 &&
1314
- totals[key] === kupManager.TotalMode.DISTINCT) {
1315
- // last round
1316
- footerRow[key] = new Set(distinctObj[key]).size;
1317
- distinctObj[key] = [];
1318
- }
1319
- });
1320
- });
1321
- }
1322
- // fixing MATH, AVERAGE and COUNT
1323
- for (let key of keys) {
1324
- switch (true) {
1325
- case totals[key] === kupManager.TotalMode.AVERAGE:
1326
- const sum = footerRow[key];
1327
- if (sum && rows.length > 0) {
1328
- footerRow[key] = sum / rows.length;
1329
- }
1330
- break;
1331
- case totals[key] === kupManager.TotalMode.COUNT:
1332
- footerRow[key] = rows.length;
1333
- break;
1334
- case totals[key].indexOf(kupManager.TotalMode.MATH) == 0:
1335
- footerRow[key] = dom$1.ketchup.math.formulas.custom(totals[key].substring(kupManager.TotalMode.MATH.length), footerRow);
1336
- break;
1337
- }
1338
- if (footerRow[key]) {
1339
- if (dateColumns.indexOf(key) != -1) {
1340
- footerRow[key] = dom$1.ketchup.dates.format(footerRow[key]);
1341
- }
1342
- else if (kupManager.isNumber(footerRow[key])) {
1343
- footerRow[key] = +footerRow[key].toFixed(2);
1344
- }
1345
- }
1346
- }
1347
- return footerRow;
1348
- }
1349
- function adjustGroupId(row) {
1350
- if (!row.group) {
1351
- return;
1352
- }
1353
- let groupID = row.group.id;
1354
- let parentRow = row.group.parent;
1355
- while (parentRow !== null) {
1356
- groupID = `${parentRow.group.id};${groupID}`;
1357
- parentRow = parentRow.group.parent;
1358
- }
1359
- row.group.id = groupID;
1360
- }
1361
- function paginateRows(rows, currentPage, rowsPerPage, areGrouped) {
1362
- const start = currentPage * rowsPerPage - rowsPerPage;
1363
- const end = start + Number(rowsPerPage);
1364
- if (areGrouped == false) {
1365
- return rows.slice(start, end);
1366
- }
1367
- let pagRows = [];
1368
- _paginateRows(rows, pagRows, start, Number(rowsPerPage), 0);
1369
- return pagRows;
1370
- }
1371
- function _paginateRows(rows, pagRows, start, rowsPerPage, ci) {
1372
- let added = false;
1373
- for (let i = 0; i < rows.length; i++) {
1374
- let originalRow = rows[i];
1375
- let row = cloneRow(rows[i]);
1376
- if (originalRow.group != null &&
1377
- originalRow.group.children != null &&
1378
- originalRow.group.children.length > 0) {
1379
- row.group.children = [];
1380
- let retValue = _paginateRows(originalRow.group.children, row.group.children, start, rowsPerPage, ci);
1381
- ci = retValue.ci;
1382
- added = retValue.added;
1383
- if (added == true) {
1384
- pagRows[pagRows.length] = row;
1385
- }
1386
- }
1387
- else {
1388
- if (ci >= start) {
1389
- pagRows[pagRows.length] = row;
1390
- added = true;
1391
- }
1392
- ci++;
1393
- }
1394
- if (ci >= start + rowsPerPage) {
1395
- break;
1396
- }
1397
- }
1398
- return { ci: ci, added: added };
1399
- }
1400
- function cloneRow(row) {
1401
- if (row == null) {
1402
- return null;
1403
- }
1404
- else {
1405
- return {
1406
- id: row.id,
1407
- cells: Object.assign({}, row.cells),
1408
- actions: row.actions ? [...row.actions] : null,
1409
- group: cloneRowGroup(row.group),
1410
- clonedFrom: row,
1411
- readOnly: row.readOnly,
1412
- cssClass: row.cssClass,
1413
- };
1414
- }
1415
- }
1416
- function cloneRows(rows) {
1417
- if (rows == null) {
1418
- return null;
1419
- }
1420
- let cloned = [];
1421
- for (let i = 0; i < rows.length; i++) {
1422
- cloned[cloned.length] = cloneRow(rows[i]);
1423
- }
1424
- return cloned;
1425
- }
1426
- function cloneRowGroup(group) {
1427
- if (group == null) {
1428
- return null;
1429
- }
1430
- let cloned = {
1431
- id: group.id,
1432
- parent: Object.assign({}, group.parent),
1433
- column: group.column,
1434
- columnLabel: group.columnLabel,
1435
- expanded: group.expanded,
1436
- label: group.label,
1437
- children: cloneRows(group.children),
1438
- obj: Object.assign({}, group.obj),
1439
- totals: Object.assign({}, group.totals),
1440
- };
1441
- return cloned;
643
+ const dom$2 = document.documentElement;
644
+ function sortRows(rows = [], sort = []) {
645
+ if (!rows || rows.length === 0) {
646
+ return [];
647
+ }
648
+ // check if row is group
649
+ if (rows[0].group) {
650
+ return sortGroupRows(rows, sort);
651
+ }
652
+ // sorting rows
653
+ if (!sort || sort.length === 0) {
654
+ // no sort -> return rows as they are
655
+ return rows;
656
+ }
657
+ // check multiple sort
658
+ const isMultiSort = sort.length > 1;
659
+ // sorting rows
660
+ return rows.slice(0).sort((r1, r2) => {
661
+ if (isMultiSort) {
662
+ for (let i = 0; i < sort.length; i++) {
663
+ const compare = compareRows(r1, r2, sort[i]);
664
+ if (compare !== 0) {
665
+ // not same row
666
+ return compare;
667
+ }
668
+ }
669
+ // same row
670
+ return 0;
671
+ }
672
+ else {
673
+ return compareRows(r1, r2, sort[0]);
674
+ }
675
+ });
676
+ }
677
+ function sortGroupRows(rows = [], sort = []) {
678
+ if (!rows || rows.length === 0) {
679
+ return [];
680
+ }
681
+ // getting columm group
682
+ const groupColumn = rows[0].group.column;
683
+ // check if column is in sort
684
+ let sortObject = getSortOnColumn(groupColumn, sort);
685
+ if (!sortObject) {
686
+ sortObject = {
687
+ column: groupColumn,
688
+ sortMode: kupManager.SortMode.A,
689
+ };
690
+ }
691
+ // sorting rows
692
+ rows.sort((r1, r2) => {
693
+ // creating fake cells
694
+ const cell1 = {
695
+ obj: r1.group.obj,
696
+ value: r1.group.id,
697
+ };
698
+ const cell2 = {
699
+ obj: r2.group.obj,
700
+ value: r2.group.id,
701
+ };
702
+ return kupManager.compareCell(cell1, cell2, sortObject.sortMode);
703
+ });
704
+ // sorting children
705
+ rows.forEach((row) => {
706
+ row.group.children = sortRows(row.group.children, sort);
707
+ });
708
+ return rows;
709
+ }
710
+ function getSortOnColumn(column = '', sort = []) {
711
+ if (!column || !sort || sort.length === 0) {
712
+ return null;
713
+ }
714
+ for (let sortObject of sort) {
715
+ if (sortObject.column === column) {
716
+ return sortObject;
717
+ }
718
+ }
719
+ return null;
720
+ }
721
+ function compareRows(r1, r2, sortObj) {
722
+ const cell1 = r1.cells[sortObj.column];
723
+ const cell2 = r2.cells[sortObj.column];
724
+ if (!cell1 && !cell2) {
725
+ return 0;
726
+ }
727
+ if (!cell1) {
728
+ return 1;
729
+ }
730
+ if (!cell2) {
731
+ return -1;
732
+ }
733
+ return kupManager.compareCell(cell1, cell2, sortObj.sortMode);
734
+ }
735
+ //-------- FILTER FUNCTIONS --------
736
+ /**
737
+ * Filters the rows data of a data-table component according to the parameters
738
+ *
739
+ * @param rows - The data of the rows to filter.
740
+ * @param filters - The the filters for each column.
741
+ * @param globalFilter - A global filter applied to all columns.
742
+ * @param columns - The colmns on which the filter will take effect.
743
+ * @todo This function can be improved in its speed by a refactor in which from two different cycles of execution for
744
+ * single filters and global filter, all controls on a single column are done in a single cycle.
745
+ */
746
+ function filterRows(rows = [], filters = {}, globalFilter = '', columns = [], columnFilters, filtersRows) {
747
+ if (filtersRows == null) {
748
+ filtersRows = new FiltersRows();
749
+ }
750
+ return filtersRows.filterRows(rows, filters, globalFilter, columns, columnFilters);
751
+ }
752
+ function groupRows(columns = [], rows = [], groups = [], totals = {}) {
753
+ if (!rows) {
754
+ return [];
755
+ }
756
+ if (!groups || groups.length === 0 || !columns || columns.length === 0) {
757
+ return rows;
758
+ }
759
+ // Keeps label of the valid columns
760
+ const columnLabels = {};
761
+ // remove invalid groups and store column labels
762
+ const validGroups = groups.filter(({ column }) => {
763
+ for (let { name, title } of columns) {
764
+ if (name === column) {
765
+ // Store label of the columns
766
+ columnLabels[name] = title;
767
+ return true;
768
+ }
769
+ }
770
+ return false;
771
+ });
772
+ if (validGroups.length === 0) {
773
+ // no valid groups
774
+ return rows;
775
+ }
776
+ // creating root
777
+ const groupRows = [];
778
+ // obj used to calculate the group distinct value
779
+ let distinctObj = {};
780
+ rows.forEach((row) => {
781
+ // getting column name from first group
782
+ const columnName = validGroups[0].column;
783
+ // getting row value
784
+ const cell = row.cells[columnName];
785
+ if (cell) {
786
+ const column = kupManager.getColumnByName(columns, columnName);
787
+ const cellValueForDisplay = kupManager.getCellValueForDisplay(column, cell);
788
+ const cellValue = cell.value;
789
+ let groupRow = null;
790
+ // check in already in groupedRow
791
+ for (let currentGroupRow of groupRows) {
792
+ if (currentGroupRow.group.label === cellValueForDisplay) {
793
+ groupRow = currentGroupRow;
794
+ break;
795
+ }
796
+ }
797
+ if (groupRow === null) {
798
+ // create group row
799
+ groupRow = {
800
+ group: {
801
+ id: cellValue,
802
+ parent: null,
803
+ column: columnName,
804
+ columnLabel: columnLabels[columnName],
805
+ expanded: false,
806
+ label: cellValueForDisplay,
807
+ children: [],
808
+ obj: cell.obj,
809
+ totals: {},
810
+ },
811
+ cells: {},
812
+ };
813
+ // add group to list
814
+ groupRows.push(groupRow);
815
+ }
816
+ for (let i = 1; i < validGroups.length; i++) {
817
+ const group = validGroups[i];
818
+ // getting cell value
819
+ const tempCell = row.cells[group.column];
820
+ if (tempCell) {
821
+ const column = kupManager.getColumnByName(columns, group.column);
822
+ const tempCellValueForDisplay = kupManager.getCellValueForDisplay(column, tempCell);
823
+ const tempCellValue = tempCell.value;
824
+ // check if group already exists
825
+ let tempGroupingRow = null;
826
+ for (let j = 0; j < groupRow.group.children.length; j++) {
827
+ const childGroup = groupRow.group.children[j];
828
+ const groupLabel = childGroup.group.label;
829
+ if (groupLabel === tempCellValueForDisplay) {
830
+ tempGroupingRow = childGroup;
831
+ break;
832
+ }
833
+ }
834
+ if (!tempGroupingRow) {
835
+ tempGroupingRow = {
836
+ cells: {},
837
+ group: {
838
+ id: tempCellValue,
839
+ parent: groupRow,
840
+ column: group.column,
841
+ columnLabel: columnLabels[group.column],
842
+ children: [],
843
+ expanded: false,
844
+ label: tempCellValueForDisplay,
845
+ totals: {},
846
+ obj: tempCell.obj,
847
+ },
848
+ };
849
+ adjustGroupId(tempGroupingRow);
850
+ groupRow.group.children.push(tempGroupingRow);
851
+ }
852
+ groupRow = tempGroupingRow;
853
+ }
854
+ }
855
+ // adding row
856
+ groupRow.group.children.push(row);
857
+ updateGroupTotal(groupRow, totals, row, distinctObj);
858
+ }
859
+ });
860
+ adjustGroupsDistinct(groupRows, totals, distinctObj);
861
+ adjustGroupsAverageOrFormula(groupRows, kupManager.TotalMode.AVERAGE, totals);
862
+ adjustGroupsAverageOrFormula(groupRows, kupManager.TotalMode.MATH, totals);
863
+ return groupRows;
864
+ }
865
+ function updateGroupTotal(groupRow, totals, addedRow, distinctObj) {
866
+ if (!groupRow || !totals) {
867
+ return;
868
+ }
869
+ const keys = Object.keys(totals);
870
+ if (keys.length === 0) {
871
+ return;
872
+ }
873
+ keys.forEach((key) => {
874
+ const currentTotalValue = dom$2.ketchup.math.numberify(groupRow.group.totals[key] || 0);
875
+ const cell = addedRow.cells[key];
876
+ if (cell) {
877
+ let _isNumber = dom$2.ketchup.objects.isNumber(cell.obj);
878
+ const totalMode = totals[key];
879
+ switch (totalMode) {
880
+ case kupManager.TotalMode.COUNT:
881
+ groupRow.group.totals[key] = currentTotalValue + 1;
882
+ // updating parents
883
+ let parent = groupRow.group.parent;
884
+ while (parent != null) {
885
+ const currentParentCount = parent.group.totals[key] || 0;
886
+ parent.group.totals[key] = currentParentCount + 1;
887
+ parent = parent.group.parent;
888
+ }
889
+ break;
890
+ case kupManager.TotalMode.DISTINCT:
891
+ let cellValue;
892
+ if (_isNumber) {
893
+ cellValue = dom$2.ketchup.math.numberify(dom$2.ketchup.math.numberifySafe(cell.value));
894
+ }
895
+ else {
896
+ cellValue = cell.value;
897
+ }
898
+ let distinctGroup = distinctObj[groupRow.group.id];
899
+ if (!distinctGroup) {
900
+ distinctObj[groupRow.group.id] = {};
901
+ distinctObj[groupRow.group.id][key] = [];
902
+ distinctObj[groupRow.group.id][key].push(cellValue);
903
+ }
904
+ else {
905
+ let distinctList = distinctObj[groupRow.group.id][key];
906
+ if (!distinctList) {
907
+ // first round
908
+ distinctObj[groupRow.group.id][key] = [];
909
+ distinctObj[groupRow.group.id][key].push(cellValue);
910
+ }
911
+ else {
912
+ // update the list
913
+ distinctList.push(cellValue);
914
+ }
915
+ }
916
+ // updating parents
917
+ let distinctParent = groupRow.group.parent;
918
+ while (distinctParent != null) {
919
+ // get parent value
920
+ let distinctGroupParent = distinctObj[distinctParent.group.id];
921
+ if (!distinctGroupParent) {
922
+ distinctObj[distinctParent.group.id] = {};
923
+ distinctObj[distinctParent.group.id][key] = [];
924
+ distinctObj[distinctParent.group.id][key].push(cellValue);
925
+ }
926
+ else {
927
+ let distinctParentList = distinctObj[distinctParent.group.id][key];
928
+ if (!distinctParentList) {
929
+ // first round
930
+ distinctObj[distinctParent.group.id][key] = [];
931
+ distinctObj[distinctParent.group.id][key].push(cellValue);
932
+ }
933
+ else {
934
+ // update the list
935
+ distinctParentList.push(cellValue);
936
+ }
937
+ }
938
+ // continue
939
+ distinctParent = distinctParent.group.parent;
940
+ }
941
+ break;
942
+ case kupManager.TotalMode.SUM:
943
+ case kupManager.TotalMode.AVERAGE:
944
+ if (_isNumber) {
945
+ const cellValue = dom$2.ketchup.math.numberify(dom$2.ketchup.math.numberifySafe(cell.value));
946
+ groupRow.group.totals[key] =
947
+ cellValue + currentTotalValue;
948
+ // updating parents
949
+ let parent = groupRow.group.parent;
950
+ while (parent != null) {
951
+ const currentParentSum = dom$2.ketchup.math.numberify(parent.group.totals[key] || 0);
952
+ parent.group.totals[key] =
953
+ cellValue + currentParentSum;
954
+ parent = parent.group.parent;
955
+ }
956
+ }
957
+ break;
958
+ // TODO DRY the MIN and MAX functions
959
+ case kupManager.TotalMode.MIN:
960
+ if (_isNumber) {
961
+ const currentTotalValue = groupRow.group.totals[key];
962
+ const cellValue = dom$2.ketchup.math.numberify(dom$2.ketchup.math.numberifySafe(cell.value));
963
+ if (currentTotalValue) {
964
+ groupRow.group.totals[key] = Math.min(currentTotalValue, cellValue);
965
+ }
966
+ else {
967
+ // first round
968
+ groupRow.group.totals[key] = cellValue;
969
+ }
970
+ // updating parents
971
+ let parent = groupRow.group.parent;
972
+ while (parent != null) {
973
+ const currentParentMin = parent.group.totals[key];
974
+ if (currentParentMin) {
975
+ parent.group.totals[key] = Math.min(currentParentMin, cellValue);
976
+ }
977
+ else {
978
+ // first round
979
+ parent.group.totals[key] = cellValue;
980
+ }
981
+ parent = parent.group.parent;
982
+ }
983
+ }
984
+ else if (dom$2.ketchup.objects.isDate(cell.obj)) {
985
+ const momentValue = cell.obj
986
+ ? dom$2.ketchup.objects.parseDate(cell.obj)
987
+ : dom$2.ketchup.dates.toDayjs(cell.value);
988
+ if (dom$2.ketchup.dates.isValid(momentValue)) {
989
+ const cellValue = dom$2.ketchup.dates.toDate(momentValue);
990
+ const currentTotalValue = groupRow.group.totals[key];
991
+ if (currentTotalValue) {
992
+ let moments = [];
993
+ moments.push(cellValue);
994
+ moments.push(dom$2.ketchup.dates.format(currentTotalValue));
995
+ groupRow.group.totals[key] =
996
+ dom$2.ketchup.dates.format(dom$2.ketchup.dates.min(moments));
997
+ }
998
+ else {
999
+ groupRow.group.totals[key] = cellValue;
1000
+ }
1001
+ // updating parents
1002
+ let parent = groupRow.group.parent;
1003
+ while (parent != null) {
1004
+ const currentParentMin = parent.group.totals[key];
1005
+ if (currentParentMin) {
1006
+ let moments = [];
1007
+ moments.push(cellValue);
1008
+ moments.push(dom$2.ketchup.dates.format(currentParentMin));
1009
+ parent.group.totals[key] =
1010
+ dom$2.ketchup.dates.format(dom$2.ketchup.dates.min(moments));
1011
+ }
1012
+ else {
1013
+ // first round
1014
+ parent.group.totals[key] = cellValue;
1015
+ }
1016
+ parent = parent.group.parent;
1017
+ }
1018
+ }
1019
+ }
1020
+ break;
1021
+ // TODO DRY the MIN and MAX functions
1022
+ case kupManager.TotalMode.MAX:
1023
+ if (_isNumber) {
1024
+ const currentTotalValue = groupRow.group.totals[key];
1025
+ const cellValue = dom$2.ketchup.math.numberify(dom$2.ketchup.math.numberifySafe(cell.value));
1026
+ if (currentTotalValue) {
1027
+ groupRow.group.totals[key] = Math.max(currentTotalValue, cellValue);
1028
+ }
1029
+ else {
1030
+ // first round
1031
+ groupRow.group.totals[key] = cellValue;
1032
+ }
1033
+ // updating parents
1034
+ let parent = groupRow.group.parent;
1035
+ while (parent != null) {
1036
+ const currentParentMax = parent.group.totals[key];
1037
+ if (currentParentMax) {
1038
+ parent.group.totals[key] = Math.max(currentParentMax, cellValue);
1039
+ }
1040
+ else {
1041
+ // first round
1042
+ parent.group.totals[key] = cellValue;
1043
+ }
1044
+ parent = parent.group.parent;
1045
+ }
1046
+ }
1047
+ else if (dom$2.ketchup.objects.isDate(cell.obj)) {
1048
+ const momentValue = cell.obj
1049
+ ? dom$2.ketchup.objects.parseDate(cell.obj)
1050
+ : dom$2.ketchup.dates.toDayjs(cell.value);
1051
+ if (dom$2.ketchup.dates.isValid(momentValue)) {
1052
+ const cellValue = dom$2.ketchup.dates.toDate(momentValue);
1053
+ const currentTotalValue = groupRow.group.totals[key];
1054
+ if (currentTotalValue) {
1055
+ let moments = [];
1056
+ moments.push(cellValue);
1057
+ moments.push(dom$2.ketchup.dates.format(currentTotalValue));
1058
+ groupRow.group.totals[key] =
1059
+ dom$2.ketchup.dates.format(dom$2.ketchup.dates.max(moments));
1060
+ }
1061
+ else {
1062
+ groupRow.group.totals[key] = cellValue;
1063
+ }
1064
+ // updating parents
1065
+ let parent = groupRow.group.parent;
1066
+ while (parent != null) {
1067
+ const currentParentMin = parent.group.totals[key];
1068
+ if (currentParentMin) {
1069
+ let moments = [];
1070
+ moments.push(cellValue);
1071
+ moments.push(dom$2.ketchup.dates.format(currentParentMin));
1072
+ parent.group.totals[key] =
1073
+ dom$2.ketchup.dates.format(dom$2.ketchup.dates.max(moments));
1074
+ }
1075
+ else {
1076
+ // first round
1077
+ parent.group.totals[key] = cellValue;
1078
+ }
1079
+ parent = parent.group.parent;
1080
+ }
1081
+ }
1082
+ }
1083
+ break;
1084
+ default: {
1085
+ if (totalMode.indexOf(kupManager.TotalMode.MATH) != 0) {
1086
+ console.warn(`invalid total mode: ${totalMode}`);
1087
+ }
1088
+ break;
1089
+ }
1090
+ }
1091
+ }
1092
+ });
1093
+ }
1094
+ function adjustGroupsDistinct(groupRows, totals, distinctObj) {
1095
+ if (!groupRows || !totals) {
1096
+ return;
1097
+ }
1098
+ const keys = Object.keys(totals);
1099
+ if (groupRows.length === 0 || !groupRows[0].group || keys.length === 0) {
1100
+ return;
1101
+ }
1102
+ let toAdjustKeys = keys.filter((key) => kupManager.TotalMode.DISTINCT === totals[key]);
1103
+ if (toAdjustKeys.length > 0) {
1104
+ groupRows
1105
+ .filter((groupRow) => groupRow.group.children.length > 0)
1106
+ .forEach((groupRow) => adjustGroupDistinct(groupRow, toAdjustKeys, distinctObj));
1107
+ }
1108
+ }
1109
+ function adjustGroupsAverageOrFormula(groupRows, type, totals) {
1110
+ if (!groupRows || !totals) {
1111
+ return;
1112
+ }
1113
+ const keys = Object.keys(totals);
1114
+ if (groupRows.length === 0 || !groupRows[0].group || keys.length === 0) {
1115
+ return;
1116
+ }
1117
+ let toAdjustKeys;
1118
+ if (type == kupManager.TotalMode.AVERAGE) {
1119
+ toAdjustKeys = keys.filter((key) => kupManager.TotalMode.AVERAGE === totals[key]);
1120
+ }
1121
+ if (type == kupManager.TotalMode.MATH) {
1122
+ toAdjustKeys = keys.filter((key) => totals[key].indexOf(kupManager.TotalMode.MATH) == 0);
1123
+ }
1124
+ if (toAdjustKeys.length > 0) {
1125
+ groupRows
1126
+ .filter((groupRow) => groupRow.group.children.length > 0)
1127
+ .forEach((groupRow) => adjustGroupAverageOrFormula(groupRow, type, toAdjustKeys, totals));
1128
+ }
1129
+ }
1130
+ function adjustGroupDistinct(groupRow, toAdjustKeys, distinctObj) {
1131
+ const children = groupRow.group.children;
1132
+ if (children.length === 0) {
1133
+ return;
1134
+ }
1135
+ if (children[0].group) {
1136
+ children.forEach((child) => {
1137
+ adjustGroupDistinct(child, toAdjustKeys, distinctObj);
1138
+ });
1139
+ }
1140
+ toAdjustKeys.forEach((key) => {
1141
+ const distinctList = distinctObj[groupRow.group.id][key];
1142
+ groupRow.group.totals[key] = new Set(distinctList).size;
1143
+ });
1144
+ }
1145
+ /**
1146
+ * @returns number of 'leaf' of group
1147
+ */
1148
+ function adjustGroupAverageOrFormula(row, type, toAdjustKeys, totals) {
1149
+ const children = row.group.children;
1150
+ if (children.length === 0) {
1151
+ return 0;
1152
+ }
1153
+ let numberOfLeaf = 0;
1154
+ // check if child is a grouping row
1155
+ if (children[0].group) {
1156
+ children.forEach((child) => {
1157
+ numberOfLeaf += adjustGroupAverageOrFormula(child, type, toAdjustKeys, totals);
1158
+ });
1159
+ }
1160
+ else {
1161
+ numberOfLeaf = children.length;
1162
+ }
1163
+ // adjust average/formulas
1164
+ toAdjustKeys.forEach((key) => {
1165
+ if (type == kupManager.TotalMode.AVERAGE) {
1166
+ row.group.totals[key] =
1167
+ dom$2.ketchup.math.numberify(row.group.totals[key]) /
1168
+ numberOfLeaf;
1169
+ }
1170
+ if (type == kupManager.TotalMode.MATH) {
1171
+ let formula = totals[key].substring(kupManager.TotalMode.MATH.length);
1172
+ row.group.totals[key] = dom$2.ketchup.math.formulas.custom(formula, row.group.totals);
1173
+ }
1174
+ });
1175
+ return numberOfLeaf;
1176
+ }
1177
+ function normalizeRows(columns, rows) {
1178
+ if (rows) {
1179
+ const normalizedrows = Object.assign(rows);
1180
+ rows.forEach((row) => {
1181
+ columns.forEach((column) => {
1182
+ if (row.cells) {
1183
+ const cell = row.cells[column.name];
1184
+ if (cell && column.obj && !cell.obj) {
1185
+ // cell.obj = Object.assign(column.obj);
1186
+ cell.obj = {
1187
+ t: column.obj.t,
1188
+ p: column.obj.p,
1189
+ k: cell.value,
1190
+ };
1191
+ }
1192
+ }
1193
+ });
1194
+ });
1195
+ return normalizedrows;
1196
+ }
1197
+ else {
1198
+ return undefined;
1199
+ }
1200
+ }
1201
+ function calcTotals(rows = [], totals = {}) {
1202
+ if (dom$2.ketchup.objects.isEmptyJsObject(rows) ||
1203
+ dom$2.ketchup.objects.isEmptyJsObject(totals)) {
1204
+ return {};
1205
+ }
1206
+ const keys = Object.keys(totals);
1207
+ const footerRow = {};
1208
+ const dateColumns = new Array();
1209
+ // if there are only COUNT, no need to loop on rows
1210
+ let onlyCount = keys.length === 0 ||
1211
+ keys.every((key) => totals[key] === kupManager.TotalMode.COUNT);
1212
+ if (onlyCount) {
1213
+ keys.forEach((columnName) => (footerRow[columnName] = rows.length));
1214
+ }
1215
+ else {
1216
+ let distinctObj = {};
1217
+ rows.forEach((r, index, array) => {
1218
+ keys.filter((key) => kupManager.TotalMode.COUNT !== totals[key] &&
1219
+ totals[key].indexOf(kupManager.TotalMode.MATH) != 0).forEach((key) => {
1220
+ // getting cell
1221
+ const cell = r.cells[key];
1222
+ if (cell) {
1223
+ if (totals[key] === kupManager.TotalMode.DISTINCT) {
1224
+ let cellValue;
1225
+ if (dom$2.ketchup.objects.isNumber(cell.obj)) {
1226
+ cellValue = dom$2.ketchup.math.numberify(dom$2.ketchup.math.numberifySafe(cell.value));
1227
+ }
1228
+ else {
1229
+ cellValue = cell.value;
1230
+ }
1231
+ let distinctList = distinctObj[key];
1232
+ if (!distinctList) {
1233
+ // first round
1234
+ distinctObj[key] = [];
1235
+ distinctObj[key].push(cellValue);
1236
+ }
1237
+ else {
1238
+ // update the list
1239
+ distinctList.push(cellValue);
1240
+ }
1241
+ }
1242
+ else if (dom$2.ketchup.objects.isNumber(cell.obj)) {
1243
+ const cellValue = dom$2.ketchup.math.numberify(dom$2.ketchup.math.numberifySafe(cell.value));
1244
+ let currentFooterValue = footerRow[key];
1245
+ switch (true) {
1246
+ // TODO DRY the MIN and MAX functions
1247
+ case totals[key] === kupManager.TotalMode.MIN:
1248
+ if (currentFooterValue) {
1249
+ footerRow[key] = Math.min(currentFooterValue, cellValue);
1250
+ }
1251
+ else {
1252
+ footerRow[key] = cellValue;
1253
+ }
1254
+ break;
1255
+ case totals[key] === kupManager.TotalMode.MAX:
1256
+ if (currentFooterValue) {
1257
+ footerRow[key] = Math.max(currentFooterValue, cellValue);
1258
+ }
1259
+ else {
1260
+ footerRow[key] = cellValue;
1261
+ }
1262
+ break;
1263
+ default:
1264
+ // SUM
1265
+ currentFooterValue = footerRow[key] || 0;
1266
+ footerRow[key] =
1267
+ cellValue +
1268
+ dom$2.ketchup.math.numberify(currentFooterValue);
1269
+ }
1270
+ // TODO DRY the MIN and MAX functions
1271
+ }
1272
+ else if (dom$2.ketchup.objects.isDate(cell.obj)) {
1273
+ if (dateColumns.indexOf(key) == -1) {
1274
+ dateColumns.push(key);
1275
+ }
1276
+ const momentValue = dom$2.ketchup.dates.toDayjs(cell.value);
1277
+ if (dom$2.ketchup.dates.isValid(momentValue)) {
1278
+ const cellValue = dom$2.ketchup.dates.toDate(momentValue);
1279
+ const currentFooterValue = footerRow[key]
1280
+ ? dom$2.ketchup.dates.toDate(dom$2.ketchup.dates.toDayjs(footerRow[key]))
1281
+ : null;
1282
+ switch (true) {
1283
+ case totals[key] === kupManager.TotalMode.MIN:
1284
+ if (currentFooterValue) {
1285
+ let moments = [];
1286
+ moments.push(cellValue);
1287
+ moments.push(currentFooterValue);
1288
+ footerRow[key] =
1289
+ dom$2.ketchup.dates.format(dom$2.ketchup.dates.min(moments), kupManager.KupDatesFormats.ISO_DATE);
1290
+ }
1291
+ else {
1292
+ footerRow[key] =
1293
+ dom$2.ketchup.dates.format(cellValue, kupManager.KupDatesFormats.ISO_DATE);
1294
+ }
1295
+ break;
1296
+ case totals[key] === kupManager.TotalMode.MAX:
1297
+ if (currentFooterValue) {
1298
+ let moments = [];
1299
+ moments.push(cellValue);
1300
+ moments.push(currentFooterValue);
1301
+ footerRow[key] =
1302
+ dom$2.ketchup.dates.format(dom$2.ketchup.dates.max(moments), kupManager.KupDatesFormats.ISO_DATE);
1303
+ }
1304
+ else {
1305
+ footerRow[key] =
1306
+ dom$2.ketchup.dates.format(cellValue, kupManager.KupDatesFormats.ISO_DATE);
1307
+ }
1308
+ break;
1309
+ }
1310
+ }
1311
+ }
1312
+ }
1313
+ if (index === array.length - 1 &&
1314
+ totals[key] === kupManager.TotalMode.DISTINCT) {
1315
+ // last round
1316
+ footerRow[key] = new Set(distinctObj[key]).size;
1317
+ distinctObj[key] = [];
1318
+ }
1319
+ });
1320
+ });
1321
+ }
1322
+ // fixing MATH, AVERAGE and COUNT
1323
+ for (let key of keys) {
1324
+ switch (true) {
1325
+ case totals[key] === kupManager.TotalMode.AVERAGE:
1326
+ const sum = footerRow[key];
1327
+ if (sum && rows.length > 0) {
1328
+ footerRow[key] = sum / rows.length;
1329
+ }
1330
+ break;
1331
+ case totals[key] === kupManager.TotalMode.COUNT:
1332
+ footerRow[key] = rows.length;
1333
+ break;
1334
+ case totals[key].indexOf(kupManager.TotalMode.MATH) == 0:
1335
+ footerRow[key] = dom$2.ketchup.math.formulas.custom(totals[key].substring(kupManager.TotalMode.MATH.length), footerRow);
1336
+ break;
1337
+ }
1338
+ if (footerRow[key]) {
1339
+ if (dateColumns.indexOf(key) != -1) {
1340
+ footerRow[key] = dom$2.ketchup.dates.format(footerRow[key]);
1341
+ }
1342
+ else if (dom$2.ketchup.math.isNumber(footerRow[key])) {
1343
+ footerRow[key] = +footerRow[key].toFixed(2);
1344
+ }
1345
+ }
1346
+ }
1347
+ return footerRow;
1348
+ }
1349
+ function adjustGroupId(row) {
1350
+ if (!row.group) {
1351
+ return;
1352
+ }
1353
+ let groupID = row.group.id;
1354
+ let parentRow = row.group.parent;
1355
+ while (parentRow !== null) {
1356
+ groupID = `${parentRow.group.id};${groupID}`;
1357
+ parentRow = parentRow.group.parent;
1358
+ }
1359
+ row.group.id = groupID;
1360
+ }
1361
+ function paginateRows(rows, currentPage, rowsPerPage, areGrouped) {
1362
+ const start = currentPage * rowsPerPage - rowsPerPage;
1363
+ const end = start + Number(rowsPerPage);
1364
+ if (areGrouped == false) {
1365
+ return rows.slice(start, end);
1366
+ }
1367
+ let pagRows = [];
1368
+ _paginateRows(rows, pagRows, start, Number(rowsPerPage), 0);
1369
+ return pagRows;
1370
+ }
1371
+ function _paginateRows(rows, pagRows, start, rowsPerPage, ci) {
1372
+ let added = false;
1373
+ for (let i = 0; i < rows.length; i++) {
1374
+ let originalRow = rows[i];
1375
+ let row = cloneRow(rows[i]);
1376
+ if (originalRow.group != null &&
1377
+ originalRow.group.children != null &&
1378
+ originalRow.group.children.length > 0) {
1379
+ row.group.children = [];
1380
+ let retValue = _paginateRows(originalRow.group.children, row.group.children, start, rowsPerPage, ci);
1381
+ ci = retValue.ci;
1382
+ added = retValue.added;
1383
+ if (added == true) {
1384
+ pagRows[pagRows.length] = row;
1385
+ }
1386
+ }
1387
+ else {
1388
+ if (ci >= start) {
1389
+ pagRows[pagRows.length] = row;
1390
+ added = true;
1391
+ }
1392
+ ci++;
1393
+ }
1394
+ if (ci >= start + rowsPerPage) {
1395
+ break;
1396
+ }
1397
+ }
1398
+ return { ci: ci, added: added };
1399
+ }
1400
+ function cloneRow(row) {
1401
+ if (row == null) {
1402
+ return null;
1403
+ }
1404
+ else {
1405
+ return {
1406
+ id: row.id,
1407
+ cells: Object.assign({}, row.cells),
1408
+ actions: row.actions ? [...row.actions] : null,
1409
+ group: cloneRowGroup(row.group),
1410
+ clonedFrom: row,
1411
+ readOnly: row.readOnly,
1412
+ cssClass: row.cssClass,
1413
+ };
1414
+ }
1415
+ }
1416
+ function cloneRows(rows) {
1417
+ if (rows == null) {
1418
+ return null;
1419
+ }
1420
+ let cloned = [];
1421
+ for (let i = 0; i < rows.length; i++) {
1422
+ cloned[cloned.length] = cloneRow(rows[i]);
1423
+ }
1424
+ return cloned;
1425
+ }
1426
+ function cloneRowGroup(group) {
1427
+ if (group == null) {
1428
+ return null;
1429
+ }
1430
+ let cloned = {
1431
+ id: group.id,
1432
+ parent: Object.assign({}, group.parent),
1433
+ column: group.column,
1434
+ columnLabel: group.columnLabel,
1435
+ expanded: group.expanded,
1436
+ label: group.label,
1437
+ children: cloneRows(group.children),
1438
+ obj: Object.assign({}, group.obj),
1439
+ totals: Object.assign({}, group.totals),
1440
+ };
1441
+ return cloned;
1442
1442
  }
1443
1443
 
1444
- exports.FPaginatorMode = void 0;
1445
- (function (FPaginatorMode) {
1446
- FPaginatorMode["SIMPLE"] = "simple";
1447
- FPaginatorMode["FULL"] = "full";
1444
+ exports.FPaginatorMode = void 0;
1445
+ (function (FPaginatorMode) {
1446
+ FPaginatorMode["SIMPLE"] = "simple";
1447
+ FPaginatorMode["FULL"] = "full";
1448
1448
  })(exports.FPaginatorMode || (exports.FPaginatorMode = {}));
1449
1449
 
1450
- const dom = document.documentElement;
1451
- /*-------------------------------------------------*/
1452
- /* C o m p o n e n t */
1453
- /*-------------------------------------------------*/
1454
- const FPaginator = (props) => {
1455
- const maxNumberOfPage = Math.ceil(props.max / props.perPage);
1456
- const pageItems = getPageItems(props, maxNumberOfPage);
1457
- const rowsPerPageItems = getRowsItems(props);
1458
- const dataPageSelector = {
1459
- 'kup-list': {
1460
- data: pageItems,
1461
- },
1462
- 'kup-text-field': {
1463
- label: dom.ketchup.language.translate(kupManager.KupLanguagePage.PAGE),
1464
- helper: dom.ketchup.language.translate(kupManager.KupLanguagePage.TOTAL) +
1465
- `: ${maxNumberOfPage}`,
1466
- helperWhenFocused: true,
1467
- inputType: 'number',
1468
- max: maxNumberOfPage,
1469
- min: 1,
1470
- },
1471
- };
1472
- const dataRowsSelector = {
1473
- 'kup-list': {
1474
- data: rowsPerPageItems,
1475
- },
1476
- 'kup-text-field': {
1477
- label: dom.ketchup.language.translate(kupManager.KupLanguageRow.ROWS) +
1478
- ' / ' +
1479
- dom.ketchup.language.translate(kupManager.KupLanguagePage.PAGE),
1480
- helper: dom.ketchup.language.translate(kupManager.KupLanguageRow.TOTAL) +
1481
- `: ${props.max}`,
1482
- helperWhenFocused: true,
1483
- inputType: 'number',
1484
- max: props.max,
1485
- min: 1,
1486
- },
1487
- };
1488
- return (index.h("div", Object.assign({ class: `f-paginator ${props.mode ? props.mode : ''} ${props.wrapperClass ? props.wrapperClass : ''}` }, props.dataSet, { id: props.id, title: props.title }),
1489
- props.mode !== exports.FPaginatorMode.SIMPLE ? (index.h(fButton.FButton, { icon: "chevron_left", disabled: isPrevPageDisabled(props), onClick: props.onPrevPage, wrapperClass: "prev-page" })) : null,
1490
- index.h("kup-combobox", { class: "page-selector", data: dataPageSelector, initialValue: props.currentPage.toString(), "onkup-combobox-change": props.onPageChange }),
1491
- props.mode !== exports.FPaginatorMode.SIMPLE ? (index.h(fButton.FButton, { icon: "chevron_right", disabled: isNextPageDisabled(props), onClick: props.onNextPage, wrapperClass: "next-page" })) : null,
1492
- index.h("kup-combobox", { class: "rows-selector", data: dataRowsSelector, initialValue: props.perPage.toString(), "onkup-combobox-change": props.onRowsChange }),
1493
- props.onLoadMore ? (index.h(fButton.FButton, { icon: "plus", onClick: props.onLoadMore, label: dom.ketchup.language.translate(kupManager.KupLanguageGeneric.LOAD_MORE), styling: fButtonDeclarations.FButtonStyling.FLAT, wrapperClass: "load-more-button" })) : null));
1494
- };
1495
- function getPageItems(props, maxNumberOfPage) {
1496
- const pageItems = [];
1497
- for (let i = 1; i <= maxNumberOfPage; i++) {
1498
- const selected = i == props.currentPage;
1499
- pageItems.push({
1500
- id: i.toString(),
1501
- selected: selected,
1502
- value: i.toString(),
1503
- });
1504
- }
1505
- return pageItems;
1506
- }
1507
- function getRowsItems(props) {
1508
- const rowsPerPageItems = [];
1509
- let i = props.perPage;
1510
- if (i === 0) {
1511
- return rowsPerPageItems;
1512
- }
1513
- while (i < props.max) {
1514
- const selected = i == props.perPage;
1515
- rowsPerPageItems.push({
1516
- id: i.toString(),
1517
- selected: selected,
1518
- value: i.toString(),
1519
- });
1520
- i = i * 2;
1521
- }
1522
- const selected = props.max == props.perPage;
1523
- rowsPerPageItems.push({
1524
- id: props.max.toString(),
1525
- selected: selected,
1526
- value: props.max.toString(),
1527
- });
1528
- return rowsPerPageItems;
1529
- }
1530
- function isNextPageDisabled(props) {
1531
- return props.currentPage * props.perPage >= props.max;
1532
- }
1533
- function isPrevPageDisabled(props) {
1534
- return props.currentPage == 1;
1450
+ const dom$1 = document.documentElement;
1451
+ /*-------------------------------------------------*/
1452
+ /* C o m p o n e n t */
1453
+ /*-------------------------------------------------*/
1454
+ const FPaginator = (props) => {
1455
+ const maxNumberOfPage = Math.ceil(props.max / props.perPage);
1456
+ const pageItems = getPageItems(props, maxNumberOfPage);
1457
+ const rowsPerPageItems = getRowsItems(props);
1458
+ const dataPageSelector = {
1459
+ 'kup-list': {
1460
+ data: pageItems,
1461
+ },
1462
+ 'kup-text-field': {
1463
+ label: dom$1.ketchup.language.translate(kupManager.KupLanguagePage.PAGE),
1464
+ helper: dom$1.ketchup.language.translate(kupManager.KupLanguagePage.TOTAL) +
1465
+ `: ${maxNumberOfPage}`,
1466
+ helperWhenFocused: true,
1467
+ inputType: 'number',
1468
+ max: maxNumberOfPage,
1469
+ min: 1,
1470
+ },
1471
+ };
1472
+ const dataRowsSelector = {
1473
+ 'kup-list': {
1474
+ data: rowsPerPageItems,
1475
+ },
1476
+ 'kup-text-field': {
1477
+ label: dom$1.ketchup.language.translate(kupManager.KupLanguageRow.ROWS) +
1478
+ ' / ' +
1479
+ dom$1.ketchup.language.translate(kupManager.KupLanguagePage.PAGE),
1480
+ helper: dom$1.ketchup.language.translate(kupManager.KupLanguageRow.TOTAL) +
1481
+ `: ${props.max}`,
1482
+ helperWhenFocused: true,
1483
+ inputType: 'number',
1484
+ max: props.max,
1485
+ min: 1,
1486
+ },
1487
+ };
1488
+ return (index.h("div", Object.assign({ class: `f-paginator ${props.mode ? props.mode : ''} ${props.wrapperClass ? props.wrapperClass : ''}` }, props.dataSet, { id: props.id, title: props.title }),
1489
+ props.mode !== exports.FPaginatorMode.SIMPLE ? (index.h(fButton.FButton, { icon: "chevron_left", disabled: isPrevPageDisabled(props), onClick: props.onPrevPage, wrapperClass: "prev-page" })) : null,
1490
+ index.h("kup-combobox", { class: "page-selector", data: dataPageSelector, initialValue: props.currentPage.toString(), "onkup-combobox-change": props.onPageChange }),
1491
+ props.mode !== exports.FPaginatorMode.SIMPLE ? (index.h(fButton.FButton, { icon: "chevron_right", disabled: isNextPageDisabled(props), onClick: props.onNextPage, wrapperClass: "next-page" })) : null,
1492
+ index.h("kup-combobox", { class: "rows-selector", data: dataRowsSelector, initialValue: props.perPage.toString(), "onkup-combobox-change": props.onRowsChange }),
1493
+ props.onLoadMore ? (index.h(fButton.FButton, { icon: "plus", onClick: props.onLoadMore, label: dom$1.ketchup.language.translate(kupManager.KupLanguageGeneric.LOAD_MORE), styling: fButtonDeclarations.FButtonStyling.FLAT, wrapperClass: "load-more-button" })) : null));
1494
+ };
1495
+ function getPageItems(props, maxNumberOfPage) {
1496
+ const pageItems = [];
1497
+ for (let i = 1; i <= maxNumberOfPage; i++) {
1498
+ const selected = i == props.currentPage;
1499
+ pageItems.push({
1500
+ id: i.toString(),
1501
+ selected: selected,
1502
+ value: i.toString(),
1503
+ });
1504
+ }
1505
+ return pageItems;
1506
+ }
1507
+ function getRowsItems(props) {
1508
+ const rowsPerPageItems = [];
1509
+ let i = props.perPage;
1510
+ if (i === 0) {
1511
+ return rowsPerPageItems;
1512
+ }
1513
+ while (i < props.max) {
1514
+ const selected = i == props.perPage;
1515
+ rowsPerPageItems.push({
1516
+ id: i.toString(),
1517
+ selected: selected,
1518
+ value: i.toString(),
1519
+ });
1520
+ i = i * 2;
1521
+ }
1522
+ const selected = props.max == props.perPage;
1523
+ rowsPerPageItems.push({
1524
+ id: props.max.toString(),
1525
+ selected: selected,
1526
+ value: props.max.toString(),
1527
+ });
1528
+ return rowsPerPageItems;
1529
+ }
1530
+ function isNextPageDisabled(props) {
1531
+ return props.currentPage * props.perPage >= props.max;
1532
+ }
1533
+ function isPrevPageDisabled(props) {
1534
+ return props.currentPage == 1;
1535
1535
  }
1536
1536
 
1537
- function pageChange(pageNumber, max, perPage) {
1538
- if (kupManager.isNumber(pageNumber)) {
1539
- const numberOfPages = Math.ceil(max / perPage);
1540
- let tmpNewPage = pageNumber;
1541
- if (tmpNewPage > numberOfPages) {
1542
- tmpNewPage = numberOfPages;
1543
- }
1544
- if (tmpNewPage < 1) {
1545
- tmpNewPage = 1;
1546
- }
1547
- return tmpNewPage;
1548
- }
1549
- return null;
1550
- }
1551
- function rowsPerPageChange(rowsNumber, max) {
1552
- if (kupManager.isNumber(rowsNumber)) {
1553
- let tmpRowsPerPage = rowsNumber;
1554
- if (tmpRowsPerPage > max) {
1555
- tmpRowsPerPage = max;
1556
- }
1557
- if (tmpRowsPerPage < 1) {
1558
- tmpRowsPerPage = 1;
1559
- }
1560
- return tmpRowsPerPage;
1561
- }
1562
- return null;
1537
+ const dom = document.documentElement;
1538
+ function pageChange(pageNumber, max, perPage) {
1539
+ if (dom.ketchup.math.isNumber(pageNumber)) {
1540
+ const numberOfPages = Math.ceil(max / perPage);
1541
+ let tmpNewPage = pageNumber;
1542
+ if (tmpNewPage > numberOfPages) {
1543
+ tmpNewPage = numberOfPages;
1544
+ }
1545
+ if (tmpNewPage < 1) {
1546
+ tmpNewPage = 1;
1547
+ }
1548
+ return tmpNewPage;
1549
+ }
1550
+ return null;
1551
+ }
1552
+ function rowsPerPageChange(rowsNumber, max) {
1553
+ if (dom.ketchup.math.isNumber(rowsNumber)) {
1554
+ let tmpRowsPerPage = rowsNumber;
1555
+ if (tmpRowsPerPage > max) {
1556
+ tmpRowsPerPage = max;
1557
+ }
1558
+ if (tmpRowsPerPage < 1) {
1559
+ tmpRowsPerPage = 1;
1560
+ }
1561
+ return tmpRowsPerPage;
1562
+ }
1563
+ return null;
1563
1564
  }
1564
1565
 
1565
1566
  exports.FPaginator = FPaginator;