@sme.up/ketchup 5.0.0 → 5.1.1

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 (196) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/{cell-utils-720be0c8.js → cell-utils-5b16c180.js} +4 -4
  3. package/dist/cjs/{f-button-dbf3cd3a.js → f-button-3b9f32af.js} +2 -2
  4. package/dist/cjs/{f-cell-93d984ad.js → f-cell-c6ad973a.js} +6 -6
  5. package/dist/cjs/{f-chip-438213eb.js → f-chip-bed86c4a.js} +3 -3
  6. package/dist/cjs/{f-image-21865ab7.js → f-image-08a3d340.js} +2 -2
  7. package/dist/cjs/{index-ab119fad.js → index-8d7bb3be.js} +4 -1
  8. package/dist/cjs/ketchup.cjs.js +3 -3
  9. package/dist/cjs/kup-accordion.cjs.entry.js +5 -5
  10. package/dist/cjs/kup-autocomplete_27.cjs.entry.js +412 -353
  11. package/dist/cjs/kup-calendar.cjs.entry.js +8 -8
  12. package/dist/cjs/kup-cell.cjs.entry.js +8 -8
  13. package/dist/cjs/kup-dash-list.cjs.entry.js +5 -5
  14. package/dist/cjs/kup-dash_2.cjs.entry.js +5 -5
  15. package/dist/cjs/kup-drawer.cjs.entry.js +8 -5
  16. package/dist/cjs/kup-echart.cjs.entry.js +210 -60
  17. package/dist/cjs/kup-field.cjs.entry.js +3 -3
  18. package/dist/cjs/kup-iframe.cjs.entry.js +4 -4
  19. package/dist/cjs/kup-lazy.cjs.entry.js +4 -4
  20. package/dist/cjs/kup-magic-box.cjs.entry.js +7 -7
  21. package/dist/cjs/{kup-manager-09c0c1fc.js → kup-manager-4227f0a2.js} +2804 -2598
  22. package/dist/cjs/kup-nav-bar.cjs.entry.js +6 -6
  23. package/dist/cjs/kup-photo-frame.cjs.entry.js +179 -0
  24. package/dist/cjs/kup-probe.cjs.entry.js +3 -3
  25. package/dist/cjs/kup-qlik.cjs.entry.js +3 -3
  26. package/dist/cjs/kup-snackbar.cjs.entry.js +7 -7
  27. package/dist/cjs/loader.cjs.js +3 -3
  28. package/dist/cjs/{utils-a60ab5fa.js → utils-b9df398c.js} +4 -38
  29. package/dist/collection/assets/card.js +30 -30
  30. package/dist/collection/assets/data-table.js +24 -30
  31. package/dist/collection/assets/echart.js +481 -0
  32. package/dist/collection/assets/index.js +79 -79
  33. package/dist/collection/assets/kupdata.js +29 -41
  34. package/dist/collection/assets/list.js +6 -6
  35. package/dist/collection/assets/nav-bar.js +4 -4
  36. package/dist/collection/assets/probe.js +18 -18
  37. package/dist/collection/collection-manifest.json +2 -1
  38. package/dist/collection/components/kup-autocomplete/kup-autocomplete.js +5 -5
  39. package/dist/collection/components/kup-box/kup-box.js +9 -9
  40. package/dist/collection/components/kup-button-list/kup-button-list.js +4 -4
  41. package/dist/collection/components/kup-card/built-in/kup-card-clock.js +1 -1
  42. package/dist/collection/components/kup-card/built-in/kup-card-column-drop-menu.js +21 -22
  43. package/dist/collection/components/kup-card/kup-card.js +1 -2
  44. package/dist/collection/components/kup-chip/kup-chip.js +4 -4
  45. package/dist/collection/components/kup-combobox/kup-combobox.js +6 -6
  46. package/dist/collection/components/kup-data-table/kup-data-table-declarations.js +0 -2
  47. package/dist/collection/components/kup-data-table/kup-data-table-helper.js +31 -32
  48. package/dist/collection/components/kup-data-table/kup-data-table.js +124 -164
  49. package/dist/collection/components/kup-drawer/kup-drawer.js +4 -1
  50. package/dist/collection/components/kup-dropdown-button/kup-dropdown-button.css +3 -3
  51. package/dist/collection/components/kup-dropdown-button/kup-dropdown-button.js +14 -14
  52. package/dist/collection/components/kup-echart/kup-echart-declarations.js +3 -0
  53. package/dist/collection/components/kup-echart/kup-echart.js +246 -58
  54. package/dist/collection/components/kup-image/assets/svg/instagram.svg +1 -0
  55. package/dist/collection/components/kup-image/assets/svg/pinterest.svg +1 -0
  56. package/dist/collection/components/kup-image/assets/svg/reddit.svg +1 -0
  57. package/dist/collection/components/kup-list/kup-list-helper.js +26 -26
  58. package/dist/collection/components/kup-list/kup-list.css +35 -3
  59. package/dist/collection/components/kup-list/kup-list.js +52 -44
  60. package/dist/collection/components/kup-magic-box/kup-magic-box.js +3 -3
  61. package/dist/collection/components/kup-nav-bar/kup-nav-bar.js +2 -2
  62. package/dist/collection/components/kup-photo-frame/kup-photo-frame-declarations.js +10 -0
  63. package/dist/collection/components/kup-photo-frame/kup-photo-frame.css +70 -0
  64. package/dist/collection/components/kup-photo-frame/kup-photo-frame.js +382 -0
  65. package/dist/collection/components/kup-snackbar/kup-snackbar.css +4 -0
  66. package/dist/collection/components/kup-tab-bar/kup-tab-bar.css +1 -1
  67. package/dist/collection/components/kup-time-picker/kup-time-picker.js +10 -10
  68. package/dist/collection/components/kup-tree/kup-tree.js +100 -51
  69. package/dist/collection/f-components/f-paginator/f-paginator.js +6 -6
  70. package/dist/collection/managers/kup-data/kup-data-cell-helper.js +2 -2
  71. package/dist/collection/managers/kup-data/kup-data-column-helper.js +27 -3
  72. package/dist/collection/managers/kup-data/kup-data-declarations.js +2 -1
  73. package/dist/collection/managers/kup-data/kup-data-node-helper.js +1 -1
  74. package/dist/collection/managers/kup-data/kup-data-row-helper.js +2 -2
  75. package/dist/collection/managers/kup-data/kup-data.js +337 -155
  76. package/dist/collection/managers/kup-dates/kup-dates.js +2 -2
  77. package/dist/collection/managers/kup-debug/kup-debug.js +6 -6
  78. package/dist/collection/managers/kup-dynamic-position/kup-dynamic-position.js +1 -1
  79. package/dist/collection/managers/kup-language/kup-language.js +2 -2
  80. package/dist/collection/managers/kup-manager/kup-manager.js +13 -0
  81. package/dist/collection/managers/kup-math/kup-math-declarations.js +13 -0
  82. package/dist/collection/managers/kup-math/kup-math-helper.js +39 -0
  83. package/dist/collection/managers/kup-math/kup-math.js +151 -0
  84. package/dist/collection/managers/kup-objects/kup-objects.js +48 -1
  85. package/dist/collection/managers/kup-theme/kup-theme.js +2 -2
  86. package/dist/collection/utils/cell-utils.js +2 -3
  87. package/dist/collection/utils/kup-column-menu/kup-column-menu.js +1 -1
  88. package/dist/collection/utils/utils.js +3 -74
  89. package/dist/esm/{cell-utils-b80ccb8c.js → cell-utils-69f75e2e.js} +4 -4
  90. package/dist/esm/{f-button-9e835467.js → f-button-7e7607d8.js} +2 -2
  91. package/dist/esm/{f-cell-f8bb2e04.js → f-cell-e4d83c27.js} +6 -6
  92. package/dist/esm/{f-chip-953c6915.js → f-chip-51dfefaf.js} +3 -3
  93. package/dist/esm/{f-image-78c5265e.js → f-image-de331954.js} +2 -2
  94. package/dist/esm/{index-78f3699d.js → index-aeec9835.js} +4 -1
  95. package/dist/esm/ketchup.js +3 -3
  96. package/dist/esm/kup-accordion.entry.js +5 -5
  97. package/dist/esm/kup-autocomplete_27.entry.js +412 -353
  98. package/dist/esm/kup-calendar.entry.js +8 -8
  99. package/dist/esm/kup-cell.entry.js +8 -8
  100. package/dist/esm/kup-dash-list.entry.js +5 -5
  101. package/dist/esm/kup-dash_2.entry.js +5 -5
  102. package/dist/esm/kup-drawer.entry.js +8 -5
  103. package/dist/esm/kup-echart.entry.js +210 -60
  104. package/dist/esm/kup-field.entry.js +3 -3
  105. package/dist/esm/kup-iframe.entry.js +4 -4
  106. package/dist/esm/kup-lazy.entry.js +4 -4
  107. package/dist/esm/kup-magic-box.entry.js +7 -7
  108. package/dist/esm/{kup-manager-bba62291.js → kup-manager-0ab94726.js} +2805 -2598
  109. package/dist/esm/kup-nav-bar.entry.js +6 -6
  110. package/dist/esm/kup-photo-frame.entry.js +175 -0
  111. package/dist/esm/kup-probe.entry.js +3 -3
  112. package/dist/esm/kup-qlik.entry.js +3 -3
  113. package/dist/esm/kup-snackbar.entry.js +7 -7
  114. package/dist/esm/loader.js +3 -3
  115. package/dist/esm/{utils-d1569956.js → utils-35c7a90d.js} +5 -37
  116. package/dist/ketchup/assets/svg/instagram.svg +1 -0
  117. package/dist/ketchup/assets/svg/pinterest.svg +1 -0
  118. package/dist/ketchup/assets/svg/reddit.svg +1 -0
  119. package/dist/ketchup/ketchup.esm.js +1 -1
  120. package/dist/ketchup/p-0751aaf6.entry.js +1 -0
  121. package/dist/ketchup/p-10c8d755.js +1 -0
  122. package/dist/ketchup/{p-aa27f9f7.entry.js → p-24df4f29.entry.js} +2 -2
  123. package/dist/ketchup/{p-29800a2e.js → p-2d4f19f4.js} +1 -1
  124. package/dist/ketchup/p-33073f4a.js +1 -0
  125. package/dist/ketchup/p-3445be1e.entry.js +1 -0
  126. package/dist/ketchup/p-3813281b.entry.js +1 -0
  127. package/dist/ketchup/p-4081f5f7.entry.js +1 -0
  128. package/dist/ketchup/p-47b57d97.js +1 -0
  129. package/dist/ketchup/p-5186885c.entry.js +1 -0
  130. package/dist/ketchup/{p-f993f813.js → p-5d190cf5.js} +1 -1
  131. package/dist/ketchup/p-67c64257.entry.js +1 -0
  132. package/dist/ketchup/p-68fc1428.entry.js +1 -0
  133. package/dist/ketchup/p-8be1337b.js +1 -0
  134. package/dist/ketchup/p-8f735633.entry.js +1 -0
  135. package/dist/ketchup/p-96101f09.entry.js +39 -0
  136. package/dist/ketchup/p-9bcda66f.entry.js +1 -0
  137. package/dist/ketchup/p-b5e1dbfa.entry.js +1 -0
  138. package/dist/ketchup/{p-ebf4cf56.js → p-c314b1e6.js} +1 -1
  139. package/dist/ketchup/p-d7af8156.entry.js +1 -0
  140. package/dist/ketchup/p-dbe87a3f.entry.js +143 -0
  141. package/dist/ketchup/p-ee33cbe9.js +9 -0
  142. package/dist/ketchup/p-f250d42b.entry.js +1 -0
  143. package/dist/ketchup/p-f9c41e20.entry.js +1 -0
  144. package/dist/ketchup/p-fea316ab.entry.js +1 -0
  145. package/dist/types/components/kup-button-list/kup-button-list-declarations.d.ts +2 -1
  146. package/dist/types/components/kup-data-table/kup-data-table-declarations.d.ts +0 -2
  147. package/dist/types/components/kup-data-table/kup-data-table.d.ts +8 -15
  148. package/dist/types/components/kup-dropdown-button/kup-dropdown-button.d.ts +1 -1
  149. package/dist/types/components/kup-echart/kup-echart-declarations.d.ts +3 -0
  150. package/dist/types/components/kup-echart/kup-echart.d.ts +12 -1
  151. package/dist/types/components/kup-list/kup-list-declarations.d.ts +3 -7
  152. package/dist/types/components/kup-list/kup-list-helper.d.ts +6 -6
  153. package/dist/types/components/kup-list/kup-list.d.ts +2 -2
  154. package/dist/types/components/kup-photo-frame/kup-photo-frame-declarations.d.ts +9 -0
  155. package/dist/types/components/kup-photo-frame/kup-photo-frame.d.ts +61 -0
  156. package/dist/types/components/kup-tree/kup-tree-declarations.d.ts +1 -1
  157. package/dist/types/components/kup-tree/kup-tree.d.ts +1 -1
  158. package/dist/types/components.d.ts +110 -28
  159. package/dist/types/managers/kup-data/kup-data-column-helper.d.ts +9 -1
  160. package/dist/types/managers/kup-data/kup-data-declarations.d.ts +4 -25
  161. package/dist/types/managers/kup-data/kup-data-node-helper.d.ts +1 -1
  162. package/dist/types/managers/kup-data/kup-data.d.ts +63 -27
  163. package/dist/types/managers/kup-manager/kup-manager-declarations.d.ts +11 -0
  164. package/dist/types/managers/kup-manager/kup-manager.d.ts +2 -0
  165. package/dist/types/managers/kup-math/kup-math-declarations.d.ts +21 -0
  166. package/dist/types/managers/kup-math/kup-math-helper.d.ts +17 -0
  167. package/dist/types/managers/kup-math/kup-math.d.ts +60 -0
  168. package/dist/types/managers/kup-objects/kup-objects.d.ts +22 -0
  169. package/dist/types/utils/utils.d.ts +0 -18
  170. package/package.json +2 -2
  171. package/dist/collection/managers/kup-data/kup-data-dataset-helper.js +0 -262
  172. package/dist/collection/managers/kup-data/kup-data-helper.js +0 -61
  173. package/dist/collection/utils/state-utils.js +0 -9
  174. package/dist/ketchup/p-0032a782.entry.js +0 -1
  175. package/dist/ketchup/p-18c4d083.entry.js +0 -1
  176. package/dist/ketchup/p-199c972e.entry.js +0 -1
  177. package/dist/ketchup/p-34aa8d8a.entry.js +0 -1
  178. package/dist/ketchup/p-542279e9.entry.js +0 -1
  179. package/dist/ketchup/p-5b26a7a8.entry.js +0 -39
  180. package/dist/ketchup/p-5c97e7ab.js +0 -1
  181. package/dist/ketchup/p-6817ca85.entry.js +0 -1
  182. package/dist/ketchup/p-76e674ca.entry.js +0 -1
  183. package/dist/ketchup/p-78aa6f1b.js +0 -1
  184. package/dist/ketchup/p-842b66aa.entry.js +0 -1
  185. package/dist/ketchup/p-894981c0.entry.js +0 -143
  186. package/dist/ketchup/p-8ac2fa75.entry.js +0 -1
  187. package/dist/ketchup/p-907c9e11.entry.js +0 -1
  188. package/dist/ketchup/p-9ae9149b.entry.js +0 -1
  189. package/dist/ketchup/p-b0d1bdd8.js +0 -9
  190. package/dist/ketchup/p-e1e4c951.entry.js +0 -1
  191. package/dist/ketchup/p-eba369d9.entry.js +0 -1
  192. package/dist/ketchup/p-ed0b8666.js +0 -1
  193. package/dist/ketchup/p-fa540f82.js +0 -1
  194. package/dist/types/managers/kup-data/kup-data-dataset-helper.d.ts +0 -42
  195. package/dist/types/managers/kup-data/kup-data-helper.d.ts +0 -11
  196. package/dist/types/utils/state-utils.d.ts +0 -1
@@ -7,7 +7,7 @@ import { calcTotals, normalizeRows, } from '../kup-data-table/kup-data-table-hel
7
7
  import { KupTreeState } from './kup-tree-state';
8
8
  import { setTooltip, unsetTooltip } from '../../utils/helpers';
9
9
  import { getColumnByName } from '../../utils/cell-utils';
10
- import { deepEqual, getProps, numberToFormattedStringNumber, setProps, } from '../../utils/utils';
10
+ import { getProps, numberToFormattedStringNumber, setProps, } from '../../utils/utils';
11
11
  import { KupColumnMenu } from '../../utils/kup-column-menu/kup-column-menu';
12
12
  import { FiltersColumnMenu } from '../../utils/filters/filters-column-menu';
13
13
  import { KupGlobalFilterMode, } from '../../utils/filters/filters-declarations';
@@ -182,7 +182,6 @@ export class KupTree {
182
182
  * Reference to the column menu card.
183
183
  */
184
184
  this.columnMenuCard = null;
185
- this.selectedColumn = '';
186
185
  this.clickTimeout = [];
187
186
  this.sizedColumns = undefined;
188
187
  this.filtersColumnMenuInstance = new FiltersColumnMenu();
@@ -212,31 +211,31 @@ export class KupTree {
212
211
  persistState() {
213
212
  if (this.store && this.stateId) {
214
213
  let somethingChanged = false;
215
- if (!deepEqual(this.state.filters, this.filters)) {
214
+ if (!this.kupManager.objects.deepEqual(this.state.filters, this.filters)) {
216
215
  this.state.filters = Object.assign({}, this.filters);
217
216
  somethingChanged = true;
218
217
  }
219
- if (!deepEqual(this.state.density, this.density)) {
218
+ if (!this.kupManager.objects.deepEqual(this.state.density, this.density)) {
220
219
  this.state.density = this.density;
221
220
  somethingChanged = true;
222
221
  }
223
- if (!deepEqual(this.state.showFilters, this.showFilters)) {
222
+ if (!this.kupManager.objects.deepEqual(this.state.showFilters, this.showFilters)) {
224
223
  this.state.showFilters = this.showFilters;
225
224
  somethingChanged = true;
226
225
  }
227
- if (!deepEqual(this.state.showFooter, this.showFooter)) {
226
+ if (!this.kupManager.objects.deepEqual(this.state.showFooter, this.showFooter)) {
228
227
  this.state.showFooter = this.showFooter;
229
228
  somethingChanged = true;
230
229
  }
231
- if (!deepEqual(this.state.totals, this.totals)) {
230
+ if (!this.kupManager.objects.deepEqual(this.state.totals, this.totals)) {
232
231
  this.state.totals = Object.assign({}, this.totals);
233
232
  somethingChanged = true;
234
233
  }
235
- if (!deepEqual(this.state.globalFilter, this.globalFilter)) {
234
+ if (!this.kupManager.objects.deepEqual(this.state.globalFilter, this.globalFilter)) {
236
235
  this.state.globalFilter = this.globalFilter;
237
236
  somethingChanged = true;
238
237
  }
239
- if (!deepEqual(this.state.globalFilterValue, this.globalFilterValue)) {
238
+ if (!this.kupManager.objects.deepEqual(this.state.globalFilterValue, this.globalFilterValue)) {
240
239
  this.state.globalFilterValue = this.globalFilterValue;
241
240
  somethingChanged = true;
242
241
  }
@@ -348,9 +347,7 @@ export class KupTree {
348
347
  * @param {KupDataColumn} column - Column to hide.
349
348
  */
350
349
  async hideColumn(column) {
351
- this.kupManager.data.datasetOperations.column.hide(this.columns, [
352
- column.name,
353
- ]);
350
+ this.kupManager.data.column.hide(this.columns, [column.name]);
354
351
  this.kupColumnRemove.emit({
355
352
  comp: this,
356
353
  id: this.rootElement.id,
@@ -560,8 +557,48 @@ export class KupTree {
560
557
  this.closeTotalMenu();
561
558
  this.openTotalMenu(column);
562
559
  }
563
- getEventDetails(el) {
564
- const isHeader = !!el.closest('thead'), isBody = !!el.closest('tbody'), isFooter = !!el.closest('tfoot'), td = el.closest('td'), th = el.closest('th'), tr = el.closest('tr'), filterRemove = el.closest('th .filter-remove');
560
+ getEventDetails(path) {
561
+ let isHeader, isBody, isFooter, td, th, tr, filterRemove;
562
+ if (path) {
563
+ for (let i = path.length - 1; i >= 0; i--) {
564
+ let p = path[i];
565
+ if (!p.tagName) {
566
+ continue;
567
+ }
568
+ switch (p.tagName.toUpperCase()) {
569
+ case 'THEAD': {
570
+ isHeader = true;
571
+ break;
572
+ }
573
+ case 'TBODY': {
574
+ isBody = true;
575
+ break;
576
+ }
577
+ case 'TFOOT': {
578
+ isFooter = true;
579
+ break;
580
+ }
581
+ case 'TD': {
582
+ td = p;
583
+ break;
584
+ }
585
+ case 'TH': {
586
+ th = p;
587
+ break;
588
+ }
589
+ case 'TR': {
590
+ tr = p;
591
+ break;
592
+ }
593
+ default: {
594
+ if (p.classList.contains(KupThemeIconValues.FILTER_REMOVE.replace('--', ''))) {
595
+ filterRemove = p;
596
+ }
597
+ break;
598
+ }
599
+ }
600
+ }
601
+ }
565
602
  let cell = null, column = null, row = null;
566
603
  if (isBody) {
567
604
  if (td) {
@@ -600,7 +637,7 @@ export class KupTree {
600
637
  }
601
638
  contextMenuHandler(e) {
602
639
  e.preventDefault();
603
- const details = this.getEventDetails(e.target);
640
+ const details = this.getEventDetails(this.getEventPath(e.target));
604
641
  if (details.area === 'header') {
605
642
  if (details.th && details.column) {
606
643
  this.openColumnMenu(details.column.name);
@@ -623,6 +660,12 @@ export class KupTree {
623
660
  KupTreeExpansionMode.DROPDOWN ||
624
661
  (this.expansionMode.toLowerCase() === KupTreeExpansionMode.NODE &&
625
662
  !treeNodeData.expandable)) {
663
+ const td = e
664
+ ? this.getEventPath(e.target).find((el) => {
665
+ if (el.tagName === 'TD')
666
+ return el;
667
+ })
668
+ : null;
626
669
  // If this TreeNode is not disabled, then it can be selected and an event is emitted
627
670
  if (treeNodeData && !treeNodeData.disabled) {
628
671
  if (this.autoSelectionNodeMode)
@@ -636,11 +679,10 @@ export class KupTree {
636
679
  .split(',')
637
680
  .map((treeNodeIndex) => parseInt(treeNodeIndex)),
638
681
  treeNode: treeNodeData,
639
- columnName: this.selectedColumn,
682
+ columnName: td ? td.dataset.column : null,
640
683
  auto: auto,
641
684
  });
642
685
  }
643
- this.selectedColumn = '';
644
686
  }
645
687
  // If KupTreeExpansionMode.NODE then click is a collapse/expand click
646
688
  if (this.expansionMode.toLowerCase() === KupTreeExpansionMode.NODE) {
@@ -733,6 +775,18 @@ export class KupTree {
733
775
  }
734
776
  }
735
777
  }
778
+ getEventPath(currentEl) {
779
+ const path = [];
780
+ while (currentEl &&
781
+ currentEl !== this.rootElement &&
782
+ currentEl !== document.body) {
783
+ path.push(currentEl);
784
+ currentEl = currentEl.parentNode
785
+ ? currentEl.parentNode
786
+ : currentEl.host;
787
+ }
788
+ return path;
789
+ }
736
790
  hasTotals() {
737
791
  return this.totals && Object.keys(this.totals).length > 0;
738
792
  }
@@ -804,8 +858,7 @@ export class KupTree {
804
858
  this.kupManager.debug.logMessage(this, 'Detected KupDataDataset: setting up tree as grid.', KupDebugCategory.WARNING);
805
859
  const data = this.data;
806
860
  this.columns = data.columns;
807
- this.data =
808
- this.kupManager.data.datasetOperations.row.toNode(data);
861
+ this.data = this.kupManager.data.row.toNode(data);
809
862
  this.showColumns = true;
810
863
  this.showHeader = true;
811
864
  }
@@ -1016,13 +1069,20 @@ export class KupTree {
1016
1069
  }
1017
1070
  // When can be expanded OR selected
1018
1071
  if (!treeNodeData.disabled) {
1019
- treeNodeOptions['onClick'] = () => {
1020
- this.clickTimeout.push(setTimeout((e) => this.hdlTreeNodeClick(e, treeNodeData, treeNodePath, false), 300));
1072
+ treeNodeOptions['onClick'] = (e) => {
1073
+ // Note: event must be cloned
1074
+ // otherwise inside setTimeout will be exiting the Shadow DOM scope(causing loss of information, including target).
1075
+ const clone = {};
1076
+ for (const key in e) {
1077
+ clone[key] = e[key];
1078
+ }
1079
+ this.clickTimeout.push(setTimeout(() => this.hdlTreeNodeClick(clone, treeNodeData, treeNodePath, false), 300));
1021
1080
  };
1022
1081
  }
1023
1082
  // When a tree node is displayed as a table
1024
1083
  let treeNodeCells = null;
1025
1084
  let visibleCols = this.getVisibleColumns();
1085
+ const _hasTooltip = !this.kupManager.objects.isEmptyKupObj(treeNodeData.obj);
1026
1086
  if (this.showColumns && visibleCols && visibleCols.length) {
1027
1087
  treeNodeCells = [];
1028
1088
  // Renders all the cells
@@ -1042,7 +1102,7 @@ export class KupTree {
1042
1102
  row: treeNodeData,
1043
1103
  setSizes: true,
1044
1104
  };
1045
- treeNodeCells.push(h("td", { class: `grid-cell` },
1105
+ treeNodeCells.push(h("td", Object.assign({ class: `grid-cell`, "data-column": column.name, "data-cell": cell }, this.getToolTipEventHandlers(treeNodeData, cell, _hasTooltip)),
1046
1106
  h(FCell, Object.assign({}, cellProps))));
1047
1107
  }
1048
1108
  else {
@@ -1050,7 +1110,6 @@ export class KupTree {
1050
1110
  }
1051
1111
  }
1052
1112
  }
1053
- const _hasTooltip = !this.kupManager.objects.isEmptyKupObj(treeNodeData.obj);
1054
1113
  let title = undefined;
1055
1114
  if (_hasTooltip && this.kupManager.debug.isDebug()) {
1056
1115
  title =
@@ -1082,7 +1141,7 @@ export class KupTree {
1082
1141
  'is-obj': !this.kupManager.objects.isEmptyKupObj(treeNodeData.obj),
1083
1142
  }, style: treeNodeData.style || null, title: title, onDblClick: () => {
1084
1143
  this.onKupTreeNodeDblClick(treeNodeData, treeNodePath);
1085
- } }, this.getToolTipEventHandlers(treeNodeData, cell, _hasTooltip)), this.asAccordion && !treeNodeDepth
1144
+ } }, this.getToolTipEventHandlers(treeNodeData, cell, _hasTooltip), { "data-row": treeNodeData }), this.asAccordion && !treeNodeDepth
1086
1145
  ? [
1087
1146
  treeNodeIcon,
1088
1147
  content,
@@ -1097,7 +1156,7 @@ export class KupTree {
1097
1156
  'kup-tree__node--first': treeNodeDepth ? false : true,
1098
1157
  'kup-tree__node--selected': !treeNodeData.disabled &&
1099
1158
  treeNodePath === this.selectedNodeString,
1100
- }, "data-tree-path": treeNodePath }, treeNodeOptions),
1159
+ }, "data-tree-path": treeNodePath }, treeNodeOptions, { "data-row": treeNodeData }),
1101
1160
  treeNodeCell,
1102
1161
  treeNodeCells));
1103
1162
  }
@@ -1115,7 +1174,7 @@ export class KupTree {
1115
1174
  // must do this
1116
1175
  // otherwise does not fire the watcher
1117
1176
  const totalsCopy = Object.assign({}, this.totals);
1118
- const value = event.detail.selected.value;
1177
+ const value = event.detail.selected.id;
1119
1178
  if (value === TotalLabel.CANC) {
1120
1179
  if (this.totals && this.totals[column.name]) {
1121
1180
  delete totalsCopy[column.name];
@@ -1178,46 +1237,36 @@ export class KupTree {
1178
1237
  if (this.isOpenedTotalMenuForColumn(column.name)) {
1179
1238
  let listData = [
1180
1239
  {
1181
- text: translation[TotalLabel.COUNT],
1182
- value: TotalMode.COUNT,
1183
- selected: false,
1240
+ id: TotalMode.COUNT,
1241
+ value: translation[TotalLabel.COUNT],
1184
1242
  },
1185
1243
  {
1186
- text: translation[TotalLabel.DISTINCT],
1187
- value: TotalMode.DISTINCT,
1188
- selected: false,
1244
+ id: TotalMode.DISTINCT,
1245
+ value: translation[TotalLabel.DISTINCT],
1189
1246
  },
1190
1247
  ];
1191
1248
  if (this.kupManager.objects.isNumber(column.obj)) {
1192
- // TODO Move these objects in declarations
1193
1249
  listData.push({
1194
- text: translation[TotalLabel.SUM],
1195
- value: TotalMode.SUM,
1196
- selected: false,
1250
+ id: TotalMode.SUM,
1251
+ value: translation[TotalLabel.SUM],
1197
1252
  }, {
1198
- text: translation[TotalLabel.AVERAGE],
1199
- value: TotalMode.AVERAGE,
1200
- selected: false,
1253
+ id: TotalMode.AVERAGE,
1254
+ value: translation[TotalLabel.AVERAGE],
1201
1255
  }, {
1202
- text: translation[TotalLabel.MIN],
1203
- value: TotalMode.MIN,
1204
- selected: false,
1256
+ id: TotalMode.MIN,
1257
+ value: translation[TotalLabel.MIN],
1205
1258
  }, {
1206
- text: translation[TotalLabel.MAX],
1207
- value: TotalMode.MAX,
1208
- selected: false,
1259
+ id: TotalMode.MAX,
1260
+ value: translation[TotalLabel.MAX],
1209
1261
  });
1210
1262
  }
1211
- // TODO replace this with find which is a better approach
1212
- // Note that this is not supported in older IE
1213
- let selectedItem = listData.find((item) => item.text === menuLabel);
1263
+ let selectedItem = listData.find((item) => item.value === menuLabel);
1214
1264
  if (selectedItem) {
1215
1265
  selectedItem.selected = true;
1216
1266
  listData.push({
1217
- text: translation[TotalLabel.CANC],
1218
- value: TotalLabel.CANC,
1219
- selected: false,
1267
+ id: TotalLabel.CANC,
1220
1268
  separator: true,
1269
+ value: translation[TotalLabel.CANC],
1221
1270
  });
1222
1271
  }
1223
1272
  totalMenu = (h("kup-list", { class: `total-menu`, data: listData, id: "totals-menu", "is-menu": true, keyboardNavigation: true, "menu-visible": true, "onkup-list-click": (event) => this.onTotalsChange(event, column) }));
@@ -53,9 +53,9 @@ function getPageItems(props, maxNumberOfPage) {
53
53
  for (let i = 1; i <= maxNumberOfPage; i++) {
54
54
  const selected = i == props.currentPage;
55
55
  pageItems.push({
56
- text: i.toString(),
57
- value: i.toString(),
56
+ id: i.toString(),
58
57
  selected: selected,
58
+ value: i.toString(),
59
59
  });
60
60
  }
61
61
  return pageItems;
@@ -69,17 +69,17 @@ function getRowsItems(props) {
69
69
  while (i < props.max) {
70
70
  const selected = i == props.perPage;
71
71
  rowsPerPageItems.push({
72
- text: i.toString(),
73
- value: i.toString(),
72
+ id: i.toString(),
74
73
  selected: selected,
74
+ value: i.toString(),
75
75
  });
76
76
  i = i * 2;
77
77
  }
78
78
  const selected = props.max == props.perPage;
79
79
  rowsPerPageItems.push({
80
- text: props.max.toString(),
81
- value: props.max.toString(),
80
+ id: props.max.toString(),
82
81
  selected: selected,
82
+ value: props.max.toString(),
83
83
  });
84
84
  return rowsPerPageItems;
85
85
  }
@@ -1,4 +1,4 @@
1
- import { finder } from './kup-data-helper';
1
+ const dom = document.documentElement;
2
2
  /**
3
3
  * Finds all the cells matching the filters criteria in the input dataset.
4
4
  * @param {KupDataDataset} dataset - Input dataset.
@@ -6,7 +6,7 @@ import { finder } from './kup-data-helper';
6
6
  * @returns {KupDataCell[]} Array of cells fetched after applying the filters.
7
7
  */
8
8
  export function findCell(dataset, filters) {
9
- return finder(dataset, filters).cells;
9
+ return dom.ketchup.data.finder(dataset, filters).cells;
10
10
  }
11
11
  /**
12
12
  * Returns all the cells values of the specified columns.
@@ -20,6 +20,9 @@ export function findColumns(dataset, filters) {
20
20
  if (column[key] === filter) {
21
21
  result.push(column);
22
22
  }
23
+ else if (dom.ketchup.objects.deepEqual(column[key], filter)) {
24
+ result.push(column);
25
+ }
23
26
  }
24
27
  }
25
28
  return result;
@@ -55,6 +58,8 @@ export function newColumn(dataset, type, options) {
55
58
  switch (type) {
56
59
  case KupDataNewColumnTypes.CONCATENATE:
57
60
  return newColumnFromConcatenate(dataset, options.columns, options.separator);
61
+ case KupDataNewColumnTypes.DUPLICATE:
62
+ return newColumnFromDuplication(dataset, options.columns, options.newColumn);
58
63
  case KupDataNewColumnTypes.MATH:
59
64
  return newColumnFromMath(dataset, options.operation, options.columns);
60
65
  case KupDataNewColumnTypes.MERGE:
@@ -70,7 +75,7 @@ export function newColumn(dataset, type, options) {
70
75
  * @param {KupDataDataset} dataset - Input dataset.
71
76
  * @param {string[]} columns - Array of column names.
72
77
  * @param {string} separator - Characters used to separate values.
73
- * @returns {string|Column} Returns the new column created or a string containing the error message (if something went wrong).
78
+ * @returns {string|KupDataColumn} Returns the new column created or a string containing the error message (if something went wrong).
74
79
  */
75
80
  function newColumnFromConcatenate(dataset, columns, separator) {
76
81
  if (!columns || columns.length === 0) {
@@ -130,6 +135,25 @@ function newColumnFromConcatenate(dataset, columns, separator) {
130
135
  dataset.columns.splice(dataset.columns.indexOf(firstColumn) + 1, 0, newColumn);
131
136
  return newColumn;
132
137
  }
138
+ /**
139
+ * Creates a duplicate of the specified column.
140
+ * @param {KupDataDataset} dataset - Input dataset.
141
+ * @param {string[]} column2duplicate - Name of the column to duplicate (the first occurrence of the array will be used).
142
+ * @param {KupDataColumn} newColumn - Column created.
143
+ * @returns {KupDataColumn} Resulting column.
144
+ */
145
+ export function newColumnFromDuplication(dataset, column2duplicate, newColumn) {
146
+ const duplicatedName = column2duplicate[0];
147
+ for (let index = 0; index < dataset.rows.length; index++) {
148
+ const row = dataset.rows[index];
149
+ const cells = row.cells;
150
+ if (cells && cells[duplicatedName]) {
151
+ cells[newColumn.name] = Object.assign({}, cells[duplicatedName]);
152
+ }
153
+ }
154
+ dataset.columns.push(newColumn);
155
+ return newColumn;
156
+ }
133
157
  /**
134
158
  * This method is used to create a new column from a mathematical formula.
135
159
  * @param {KupDataDataset} dataset - Input dataset.
@@ -219,11 +243,11 @@ function newColumnFromMath(dataset, operation, columns) {
219
243
  if (!base) {
220
244
  base = cell;
221
245
  }
222
- formulaRow[column] = dom.ketchup.data.numberify(cell.value);
246
+ formulaRow[column] = dom.ketchup.math.numberify(cell.value);
223
247
  }
224
248
  }
225
249
  }
226
- const value = dom.ketchup.data.formulas
250
+ const value = dom.ketchup.math.formulas
227
251
  .custom(formula, formulaRow)
228
252
  .toString();
229
253
  cells[newName] = Object.assign(Object.assign({}, base), { displayedValue: null, obj: Object.assign(Object.assign({}, newObj), { k: value }), value: value });
@@ -1,9 +1,10 @@
1
1
  /**
2
- * Types of column creation when invoking datasetOperations.column.new.
2
+ * Types of column creation when invoking column.new.
3
3
  */
4
4
  export var KupDataNewColumnTypes;
5
5
  (function (KupDataNewColumnTypes) {
6
6
  KupDataNewColumnTypes["CONCATENATE"] = "concatenate";
7
+ KupDataNewColumnTypes["DUPLICATE"] = "duplicate";
7
8
  KupDataNewColumnTypes["MATH"] = "math";
8
9
  KupDataNewColumnTypes["MERGE"] = "merge";
9
10
  })(KupDataNewColumnTypes || (KupDataNewColumnTypes = {}));
@@ -25,7 +25,7 @@ export function removeNode(nodes, node2remove) {
25
25
  return removed;
26
26
  }
27
27
  /**
28
- * Sets the values specified in the filters to every node of the input array.
28
+ * Sets the values specified in the properties to every node of the input array.
29
29
  * @param {KupDataNode[]} nodes - Input array of nodes.
30
30
  * @param {Partial<KupDataNode>} properties - New properties values to set.
31
31
  * @param {boolean} recursively - Sets values to every child node.
@@ -1,4 +1,4 @@
1
- import { finder } from './kup-data-helper';
1
+ const dom = document.documentElement;
2
2
  /**
3
3
  * Finds all the rows containing cells matching the filters criteria in the input dataset.
4
4
  * @param {KupDataDataset} dataset - Input dataset.
@@ -6,7 +6,7 @@ import { finder } from './kup-data-helper';
6
6
  * @returns {KupDataRow[]} Array of rows fetched after applying the filters.
7
7
  */
8
8
  export function findRow(dataset, filters) {
9
- return finder(dataset, filters).rows;
9
+ return dom.ketchup.data.finder(dataset, filters).rows;
10
10
  }
11
11
  /**
12
12
  * Converts the rows of the input dataset to tree nodes.