@sme.up/ketchup 6.2.0 → 6.4.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 (183) hide show
  1. package/dist/cjs/{f-button-5b69d882.js → f-button-826a470e.js} +4 -4
  2. package/dist/cjs/{f-cell-3a740c48.js → f-cell-2d5bcf0c.js} +13 -15
  3. package/dist/cjs/{f-checkbox-57443ca3.js → f-checkbox-cd977193.js} +1 -1
  4. package/dist/cjs/{f-chip-02e83f82.js → f-chip-2fd3363e.js} +3 -3
  5. package/dist/cjs/{f-image-2a61ece2.js → f-image-0f17d599.js} +2 -2
  6. package/dist/cjs/{f-paginator-utils-09126bdd.js → f-paginator-utils-946b579d.js} +80 -403
  7. package/dist/cjs/{f-text-field-9ee20a67.js → f-text-field-d243e4d8.js} +13 -3
  8. package/dist/cjs/{index-06b131ea.js → index-31125378.js} +9 -4
  9. package/dist/cjs/ketchup.cjs.js +3 -3
  10. package/dist/cjs/kup-accordion.cjs.entry.js +5 -6
  11. package/dist/cjs/kup-autocomplete_25.cjs.entry.js +129 -115
  12. package/dist/cjs/kup-box.cjs.entry.js +20 -20
  13. package/dist/cjs/kup-calendar.cjs.entry.js +9 -11
  14. package/dist/cjs/kup-cell.cjs.entry.js +9 -11
  15. package/dist/cjs/kup-dash-list.cjs.entry.js +5 -7
  16. package/dist/cjs/kup-dash_2.cjs.entry.js +4 -5
  17. package/dist/cjs/kup-dashboard.cjs.entry.js +76 -17
  18. package/dist/cjs/kup-drawer.cjs.entry.js +4 -5
  19. package/dist/cjs/kup-echart.cjs.entry.js +42 -34
  20. package/dist/cjs/kup-family-tree.cjs.entry.js +140 -64
  21. package/dist/cjs/kup-form.cjs.entry.js +21 -15
  22. package/dist/cjs/kup-iframe.cjs.entry.js +4 -5
  23. package/dist/cjs/kup-image-list.cjs.entry.js +10 -12
  24. package/dist/cjs/kup-lazy.cjs.entry.js +5 -6
  25. package/dist/cjs/kup-magic-box.cjs.entry.js +5 -6
  26. package/dist/cjs/{kup-manager-02acbb37.js → kup-manager-a8eecc60.js} +1419 -375
  27. package/dist/cjs/kup-nav-bar.cjs.entry.js +4 -5
  28. package/dist/cjs/kup-numeric-picker.cjs.entry.js +3 -3
  29. package/dist/cjs/kup-photo-frame.cjs.entry.js +4 -5
  30. package/dist/cjs/kup-probe.cjs.entry.js +2 -2
  31. package/dist/cjs/kup-qlik.cjs.entry.js +2 -2
  32. package/dist/cjs/kup-snackbar.cjs.entry.js +6 -7
  33. package/dist/cjs/loader.cjs.js +3 -3
  34. package/dist/collection/assets/dashboard.js +48 -0
  35. package/dist/collection/assets/family-tree.js +236 -19
  36. package/dist/collection/assets/form.js +41 -0
  37. package/dist/collection/assets/index.js +4 -0
  38. package/dist/collection/assets/kupinteract.js +68 -0
  39. package/dist/collection/collection-manifest.json +5 -5
  40. package/dist/collection/components/kup-box/kup-box.js +5 -3
  41. package/dist/collection/components/kup-button/kup-button-declarations.js +1 -0
  42. package/dist/collection/components/kup-button/kup-button.js +27 -0
  43. package/dist/collection/components/kup-dashboard/kup-dashboard.css +7 -0
  44. package/dist/collection/components/kup-dashboard/kup-dashboard.js +67 -7
  45. package/dist/collection/components/kup-data-table/kup-data-table-helper.js +42 -30
  46. package/dist/collection/components/kup-data-table/kup-data-table.js +3 -1
  47. package/dist/collection/components/kup-echart/kup-echart.js +34 -24
  48. package/dist/collection/components/kup-family-tree/kup-family-tree-declarations.js +3 -1
  49. package/dist/collection/components/kup-family-tree/kup-family-tree.css +79 -9
  50. package/dist/collection/components/kup-family-tree/kup-family-tree.js +253 -65
  51. package/dist/collection/components/kup-form/kup-form-declarations.js +1 -0
  52. package/dist/collection/components/kup-form/kup-form.css +8 -0
  53. package/dist/collection/components/kup-form/kup-form.js +31 -2
  54. package/dist/collection/components/kup-image/assets/svg/azure.svg +1 -0
  55. package/dist/collection/components/kup-lazy/kup-lazy.css +8 -2
  56. package/dist/collection/components/kup-progress-bar/kup-progress-bar.css +1 -0
  57. package/dist/collection/components/kup-text-field/kup-text-field-declarations.js +1 -0
  58. package/dist/collection/components/kup-text-field/kup-text-field.js +27 -0
  59. package/dist/collection/f-components/f-button/f-button.js +2 -2
  60. package/dist/collection/f-components/f-cell/f-cell.js +1 -1
  61. package/dist/collection/f-components/f-text-field/f-text-field.js +11 -1
  62. package/dist/collection/managers/kup-data/kup-data-cell-helper.js +49 -15
  63. package/dist/collection/managers/kup-data/kup-data.js +9 -11
  64. package/dist/collection/managers/kup-dates/kup-dates.js +14 -0
  65. package/dist/collection/managers/kup-interact/kup-interact.js +3 -5
  66. package/dist/collection/managers/kup-scroll-on-hover/kup-scroll-on-hover-declarations.js +2 -0
  67. package/dist/collection/managers/kup-scroll-on-hover/kup-scroll-on-hover.js +131 -45
  68. package/dist/collection/utils/filters/filters-rows.js +4 -23
  69. package/dist/collection/utils/filters/filters-tree-items.js +4 -3
  70. package/dist/esm/{f-button-fd44ef70.js → f-button-2d0a5f21.js} +4 -4
  71. package/dist/esm/{f-cell-7b159a22.js → f-cell-ee7d7b5c.js} +7 -9
  72. package/dist/esm/{f-checkbox-c51c4a75.js → f-checkbox-e06cf07b.js} +1 -1
  73. package/dist/esm/{f-chip-c2e4c522.js → f-chip-0d29f91f.js} +3 -3
  74. package/dist/esm/{f-image-2ab4b9aa.js → f-image-ab131d59.js} +2 -2
  75. package/dist/esm/{f-paginator-utils-ef537d82.js → f-paginator-utils-aa52af0f.js} +44 -366
  76. package/dist/esm/{f-text-field-41c575eb.js → f-text-field-0729b19f.js} +13 -3
  77. package/dist/esm/{index-ad6ab214.js → index-e41330a5.js} +9 -4
  78. package/dist/esm/ketchup.js +3 -3
  79. package/dist/esm/kup-accordion.entry.js +3 -4
  80. package/dist/esm/kup-autocomplete_25.entry.js +30 -16
  81. package/dist/esm/kup-box.entry.js +14 -14
  82. package/dist/esm/kup-calendar.entry.js +5 -7
  83. package/dist/esm/kup-cell.entry.js +7 -9
  84. package/dist/esm/kup-dash-list.entry.js +2 -4
  85. package/dist/esm/kup-dash_2.entry.js +2 -3
  86. package/dist/esm/kup-dashboard.entry.js +74 -15
  87. package/dist/esm/kup-drawer.entry.js +2 -3
  88. package/dist/esm/kup-echart.entry.js +36 -28
  89. package/dist/esm/kup-family-tree.entry.js +138 -62
  90. package/dist/esm/kup-form.entry.js +18 -12
  91. package/dist/esm/kup-iframe.entry.js +2 -3
  92. package/dist/esm/kup-image-list.entry.js +8 -10
  93. package/dist/esm/kup-lazy.entry.js +3 -4
  94. package/dist/esm/kup-magic-box.entry.js +3 -4
  95. package/dist/esm/{kup-manager-22a475e6.js → kup-manager-13b4f989.js} +1398 -376
  96. package/dist/esm/kup-nav-bar.entry.js +2 -3
  97. package/dist/esm/kup-numeric-picker.entry.js +3 -3
  98. package/dist/esm/kup-photo-frame.entry.js +2 -3
  99. package/dist/esm/kup-probe.entry.js +2 -2
  100. package/dist/esm/kup-qlik.entry.js +2 -2
  101. package/dist/esm/kup-snackbar.entry.js +4 -5
  102. package/dist/esm/loader.js +3 -3
  103. package/dist/ketchup/assets/svg/azure.svg +1 -0
  104. package/dist/ketchup/ketchup.esm.js +1 -1
  105. package/dist/ketchup/p-0986ad5d.js +1 -0
  106. package/dist/ketchup/{p-38d7584e.js → p-0cf10db0.js} +1 -1
  107. package/dist/ketchup/p-13666119.entry.js +27 -0
  108. package/dist/ketchup/p-18b68e86.entry.js +1 -0
  109. package/dist/ketchup/{p-1959f835.entry.js → p-28d514d0.entry.js} +1 -1
  110. package/dist/ketchup/p-2ffdbee1.entry.js +1 -0
  111. package/dist/ketchup/p-3dcfffbe.entry.js +1 -0
  112. package/dist/ketchup/p-3fe35411.entry.js +1 -0
  113. package/dist/ketchup/{p-cd5cfa7c.js → p-5552f156.js} +1 -1
  114. package/dist/ketchup/p-5f51009b.entry.js +1 -0
  115. package/dist/ketchup/{p-264b1b19.entry.js → p-816f0938.entry.js} +1 -1
  116. package/dist/ketchup/p-83c214d7.entry.js +1 -0
  117. package/dist/ketchup/p-84957bbf.entry.js +1 -0
  118. package/dist/ketchup/p-86795579.entry.js +1 -0
  119. package/dist/ketchup/p-8f85b8bb.entry.js +9 -0
  120. package/dist/ketchup/p-982d3e3a.entry.js +1 -0
  121. package/dist/ketchup/{p-e9366aaf.entry.js → p-adcfcd4f.entry.js} +4 -4
  122. package/dist/ketchup/p-b0b3989b.js +2 -0
  123. package/dist/ketchup/{p-dc62a30f.js → p-b705be3b.js} +1 -1
  124. package/dist/ketchup/{p-fc2b1229.js → p-b8c921ee.js} +3 -3
  125. package/dist/ketchup/{p-edae3076.js → p-bfe88b03.js} +1 -1
  126. package/dist/ketchup/p-d7091875.entry.js +1 -0
  127. package/dist/ketchup/p-d8656956.entry.js +1 -0
  128. package/dist/ketchup/p-dc69549c.entry.js +1 -0
  129. package/dist/ketchup/p-e01fa411.entry.js +1 -0
  130. package/dist/ketchup/p-e0f659c9.entry.js +1 -0
  131. package/dist/ketchup/p-e1d82570.entry.js +1 -0
  132. package/dist/ketchup/p-e21c744a.js +1 -0
  133. package/dist/ketchup/p-e5a9d60a.entry.js +1 -0
  134. package/dist/ketchup/p-f50cbed9.js +1 -0
  135. package/dist/ketchup/{p-42080355.entry.js → p-fa9f161a.entry.js} +1 -1
  136. package/dist/types/components/kup-box/kup-box-declarations.d.ts +1 -0
  137. package/dist/types/components/kup-button/kup-button-declarations.d.ts +1 -0
  138. package/dist/types/components/kup-button/kup-button.d.ts +5 -0
  139. package/dist/types/components/kup-dashboard/kup-dashboard.d.ts +6 -1
  140. package/dist/types/components/kup-family-tree/kup-family-tree-declarations.d.ts +7 -3
  141. package/dist/types/components/kup-family-tree/kup-family-tree.d.ts +26 -5
  142. package/dist/types/components/kup-form/kup-form-declarations.d.ts +1 -0
  143. package/dist/types/components/kup-form/kup-form.d.ts +5 -0
  144. package/dist/types/components/kup-text-field/kup-text-field-declarations.d.ts +1 -0
  145. package/dist/types/components/kup-text-field/kup-text-field.d.ts +5 -0
  146. package/dist/types/components.d.ts +69 -7
  147. package/dist/types/f-components/f-button/f-button-declarations.d.ts +1 -0
  148. package/dist/types/f-components/f-text-field/f-text-field-declarations.d.ts +1 -0
  149. package/dist/types/managers/kup-data/kup-data-cell-helper.d.ts +13 -6
  150. package/dist/types/managers/kup-data/kup-data.d.ts +3 -1
  151. package/dist/types/managers/kup-scroll-on-hover/kup-scroll-on-hover-declarations.d.ts +9 -1
  152. package/dist/types/managers/kup-scroll-on-hover/kup-scroll-on-hover.d.ts +7 -5
  153. package/dist/types/utils/filters/filters-rows.d.ts +0 -2
  154. package/dist/types/utils/filters/filters-tree-items.d.ts +1 -1
  155. package/package.json +2 -2
  156. package/dist/cjs/cell-utils-fe64a28c.js +0 -168
  157. package/dist/cjs/utils-4b208b48.js +0 -447
  158. package/dist/esm/cell-utils-cb5d4149.js +0 -160
  159. package/dist/esm/utils-2c1f4122.js +0 -428
  160. package/dist/ketchup/p-06c6cc68.js +0 -1
  161. package/dist/ketchup/p-0dacd4bc.entry.js +0 -1
  162. package/dist/ketchup/p-1c44dc62.entry.js +0 -1
  163. package/dist/ketchup/p-4bc9f98b.entry.js +0 -1
  164. package/dist/ketchup/p-578583db.entry.js +0 -1
  165. package/dist/ketchup/p-5866d507.entry.js +0 -1
  166. package/dist/ketchup/p-61059e9d.entry.js +0 -9
  167. package/dist/ketchup/p-664be494.entry.js +0 -1
  168. package/dist/ketchup/p-67cd575d.entry.js +0 -1
  169. package/dist/ketchup/p-682a367a.js +0 -1
  170. package/dist/ketchup/p-6ccf7eb2.entry.js +0 -1
  171. package/dist/ketchup/p-7230ab97.entry.js +0 -1
  172. package/dist/ketchup/p-752b4cef.entry.js +0 -1
  173. package/dist/ketchup/p-7de3e7ac.entry.js +0 -1
  174. package/dist/ketchup/p-928c5c36.js +0 -1
  175. package/dist/ketchup/p-9b36497d.entry.js +0 -1
  176. package/dist/ketchup/p-b982d137.entry.js +0 -1
  177. package/dist/ketchup/p-c0219e5e.js +0 -1
  178. package/dist/ketchup/p-c55fd0a7.entry.js +0 -1
  179. package/dist/ketchup/p-d154b3a0.entry.js +0 -1
  180. package/dist/ketchup/p-d2affb6f.entry.js +0 -27
  181. package/dist/ketchup/p-d3b542b3.js +0 -2
  182. package/dist/ketchup/p-d6c12c6c.js +0 -1
  183. package/dist/ketchup/p-da0eab60.entry.js +0 -1
@@ -1,4 +1,6 @@
1
- import { KupDataCell, KupDataDataset, KupDataFindCellFilters } from './kup-data-declarations';
1
+ import { ValueDisplayedValue } from '../../utils/filters/filters-declarations';
2
+ import { KupObj } from '../kup-objects/kup-objects-declarations';
3
+ import { KupDataCell, KupDataColumn, KupDataDataset, KupDataFindCellFilters } from './kup-data-declarations';
2
4
  /**
3
5
  * Finds all the cells matching the filters criteria in the input dataset.
4
6
  * @param {KupDataDataset} dataset - Input dataset.
@@ -7,12 +9,17 @@ import { KupDataCell, KupDataDataset, KupDataFindCellFilters } from './kup-data-
7
9
  */
8
10
  export declare function findCell(dataset: KupDataDataset, filters: KupDataFindCellFilters): KupDataCell[];
9
11
  /**
10
- * Returns all the cells values of the specified columns.
11
- * @param {KupDataDataset} dataset - Input dataset.
12
- * @param {string[]} columns - Columns included in the search. When missing, searches all columns.
13
- * @returns {string[]} Values of the cells.
12
+ * Returns all the cells values of the specified column, sorted if required.
13
+ * @param {Array<KupDataRow>} dataset - Input dataset.
14
+ * @param {KupDataColumn} column - Column included in the search. When missing, returns empty array.
15
+ * @returns {ValueDisplayedValue[]} Values of the cells, sorted.
14
16
  */
15
- export declare function getCellValue(dataset: KupDataDataset, columns?: string[]): string[];
17
+ export declare function getCellValue(dataset: KupDataDataset, column: KupDataColumn, sorted?: boolean, univocal?: boolean): ValueDisplayedValue[];
18
+ export declare function addColumnValueFromRow(values: {
19
+ value: string;
20
+ displayedValue?: string;
21
+ obj?: KupObj;
22
+ }[], column: KupDataColumn, cell: KupDataCell, univocal?: boolean): void;
16
23
  /**
17
24
  * Overrides the given cell attributes for the specified columns.
18
25
  * If no columns are provided, the value will be applied to every column of the dataset.
@@ -1,6 +1,7 @@
1
1
  import { KupDataCell, KupDataColumn, KupDataDataset, KupDataDatasetSort, KupDataFindCellFilters, KupDataNewColumn, KupDataNewColumnOptions, KupDataNewColumnTypes, KupDataNode, KupDataNodeDrilldownInfo, KupDataRow } from './kup-data-declarations';
2
2
  import { FCellShapes, FCellTypes } from '../../f-components/f-cell/f-cell-declarations';
3
3
  import { TreeNodePath } from '../../components/kup-tree/kup-tree-declarations';
4
+ import { ValueDisplayedValue } from '../../utils/filters/filters-declarations';
4
5
  /**
5
6
  * Handles data operations.
6
7
  * @module KupData
@@ -8,7 +9,8 @@ import { TreeNodePath } from '../../components/kup-tree/kup-tree-declarations';
8
9
  export declare class KupData {
9
10
  cell: {
10
11
  find(dataset: KupDataDataset, filters: KupDataFindCellFilters): KupDataCell[];
11
- getValue(dataset: KupDataDataset, columns?: string[]): string[];
12
+ getValue(dataset: KupDataDataset, column: KupDataColumn, sorted?: boolean): ValueDisplayedValue[];
13
+ getUnivocalValue(dataset: KupDataDataset, column: KupDataColumn, sorted?: boolean): ValueDisplayedValue[];
12
14
  replace(dataset: KupDataDataset, cell: KupDataCell, columns?: string[]): KupDataCell[];
13
15
  getType(cell: KupDataCell, shape?: FCellShapes): FCellTypes;
14
16
  };
@@ -5,15 +5,23 @@ export interface KupScrollOnHoverElement extends HTMLElement {
5
5
  scrollOnHover: {
6
6
  active: boolean;
7
7
  children: NodeListOf<HTMLElement>;
8
+ percentages: KupScrollOnHoverPercentages;
8
9
  rect: DOMRect;
10
+ vertical: boolean;
9
11
  x: number;
10
12
  y: number;
11
13
  };
12
14
  }
15
+ export interface KupScrollOnHoverPercentages {
16
+ back: number;
17
+ forward: number;
18
+ }
13
19
  /**
14
20
  * The direction to which ScollableElement can be scrolled.
15
21
  */
16
22
  export declare enum ScrollOnHoverDirection {
23
+ BOTTOM = "bottom",
17
24
  LEFT = "left",
18
- RIGHT = "right"
25
+ RIGHT = "right",
26
+ TOP = "top"
19
27
  }
@@ -1,4 +1,4 @@
1
- import { KupScrollOnHoverElement, ScrollOnHoverDirection } from './kup-scroll-on-hover-declarations';
1
+ import { KupScrollOnHoverElement, KupScrollOnHoverPercentages, ScrollOnHoverDirection } from './kup-scroll-on-hover-declarations';
2
2
  /**
3
3
  * Lets the user scroll an element's overflow by hovering with the mouse on its left/right edge.
4
4
  * @module KupScrollOnHover
@@ -19,8 +19,10 @@ export declare class KupScrollOnHover {
19
19
  * Watches the given element in order to trigger the scroll on hover when conditions are met.
20
20
  * Children nodes with the "hover-scrolling-child" will be watched and scrolled when el scrolls.
21
21
  * @param {KupScrollOnHoverElement} el - Element to watch.
22
+ * @param {boolean} vertical - Enables vertical scroll.
23
+ * @param {KupScrollOnHoverPercentages} percentages - Sets how big is the area in which the scroll is enabled.
22
24
  */
23
- register(el: KupScrollOnHoverElement): void;
25
+ register(el: KupScrollOnHoverElement, vertical?: boolean, percentages?: KupScrollOnHoverPercentages): void;
24
26
  /**
25
27
  * Removes the given element from ScrollOnHover watchlist.
26
28
  * @param {KupScrollOnHoverElement} el - Element to unregister.
@@ -46,11 +48,11 @@ export declare class KupScrollOnHover {
46
48
  * The actual recursive scroll function.
47
49
  * @param {KupScrollOnHoverElement} el - The scrolled element.
48
50
  * @param {number} maxScrollLeft - Left coordinates to which the recursiveness must be stopped.
49
- * @param {number} percRight - Range of the right scrollable area.
50
- * @param {number} percLeft - Range of the left scrollable area.
51
+ * @param {number} percForward - Range of the right (or bottom) area.
52
+ * @param {number} percBack - Range of the left (or top) scrollable area.
51
53
  * @param {ScrollOnHoverDirection} direction - Direction of the scroll.
52
54
  */
53
- run(el: KupScrollOnHoverElement, maxScrollLeft: number, percRight: number, percLeft: number, direction: ScrollOnHoverDirection): void;
55
+ run(el: KupScrollOnHoverElement, maxScrollLeft: number, percForward: number, percBack: number, direction: ScrollOnHoverDirection): void;
54
56
  /**
55
57
  * Scrolls children of the element having the "hover-scrolling-child" class
56
58
  * @param {KupScrollOnHoverElement} el - The scrolled element.
@@ -27,6 +27,4 @@ export declare class FiltersRows extends Filters {
27
27
  */
28
28
  filterRows(rows?: Array<KupDataRow>, filters?: GenericFilter, globalFilter?: string, columns?: KupDataColumn[], columnFilters?: FiltersColumnMenu): Array<KupDataRow>;
29
29
  getColumnValues(comp: KupDataTable | KupTree, column: KupDataColumn, globalFilterValue: string, columnFilters?: FiltersColumnMenu): ValueDisplayedValue[];
30
- extractColumnValues(rows: Array<KupDataRow>, column: KupDataColumn, values: ValueDisplayedValue[]): ValueDisplayedValue[];
31
- addColumnValueFromRow(values: ValueDisplayedValue[], column: KupDataColumn, cell: KupDataCell): void;
32
30
  }
@@ -13,7 +13,7 @@ export declare class FiltersTreeItems extends FiltersRows {
13
13
  isNodeCompliant(node: KupTreeNode, filters?: GenericFilter, globalFilter?: string, isUsingGlobalFilter?: boolean, columns?: KupDataColumn[], columnFilters?: FiltersColumnMenu): boolean;
14
14
  private setNodeVisibility;
15
15
  private setAllVisible;
16
- extractColumnValues(rows: Array<KupTreeNode>, column: KupDataColumn, values: ValueDisplayedValue[]): ValueDisplayedValue[];
16
+ extractColumnValues(rows: Array<KupTreeNode>, column: KupDataColumn, values: ValueDisplayedValue[], univocal?: boolean): ValueDisplayedValue[];
17
17
  expandCollapseNode(treeNode: KupTreeNode, expandNode?: boolean): void;
18
18
  expandCollapseAllNodes(treeNode: KupTreeNode, expandNode?: boolean): void;
19
19
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sme.up/ketchup",
3
- "version": "6.2.0",
3
+ "version": "6.4.0",
4
4
  "keywords": [
5
5
  "smeup",
6
6
  "KetchUP",
@@ -56,7 +56,7 @@
56
56
  "vanilla-picker": "^2.12.1"
57
57
  },
58
58
  "devDependencies": {
59
- "@stencil/core": "^2.17.0",
59
+ "@stencil/core": "^2.17.3",
60
60
  "@stencil/sass": "^1.4.1",
61
61
  "@types/d3-shape": "^3.0.2",
62
62
  "@types/geojson": "^7946.0.8",
@@ -1,168 +0,0 @@
1
- 'use strict';
2
-
3
- const utils = require('./utils-4b208b48.js');
4
- const kupManager = require('./kup-manager-02acbb37.js');
5
-
6
- const dom = document.documentElement;
7
- // -------------
8
- // COMMONS
9
- // -------------
10
- function getCellValueForDisplay(column, cell) {
11
- if (cell != null) {
12
- if (cell.displayedValue != null) {
13
- return cell.displayedValue;
14
- }
15
- }
16
- let formattedValue = _getCellValueForDisplay(cell.value, column, cell);
17
- if (cell != null) {
18
- cell.displayedValue = formattedValue;
19
- }
20
- return formattedValue;
21
- }
22
- function getValueForDisplay2(values, column) {
23
- if (values == null) {
24
- return '';
25
- }
26
- if (values.displayedValue == null || values.displayedValue.trim() == '') {
27
- values.displayedValue = _getCellValueForDisplay(values.value, column, null);
28
- }
29
- return values.displayedValue;
30
- }
31
- function formatToNumber(cell) {
32
- if (cell.obj) {
33
- return dom.ketchup.math.numberify(cell.obj.k);
34
- }
35
- return dom.ketchup.math.numberify(cell.value);
36
- }
37
- function _getCellValueForDisplay(value, column, cell) {
38
- let obj = column != null ? column.obj : null;
39
- if (cell != null) {
40
- obj = cell.obj ? cell.obj : obj;
41
- }
42
- return getValueForDisplay(value, obj, column != null ? column.decimals : null);
43
- }
44
- function getValueForDisplay(value, obj, decimals) {
45
- if (value == null || value.trim() == '') {
46
- return value;
47
- }
48
- if (dom.ketchup.objects.isNumber(obj)) {
49
- return utils.unformattedStringToFormattedStringNumber(value, decimals ? decimals : -1, obj ? obj.p : '');
50
- }
51
- if (dom.ketchup.objects.isDate(obj) &&
52
- dom.ketchup.dates.isValid(value, kupManager.KupDatesFormats.ISO_DATE)) {
53
- return dom.ketchup.dates.format(value);
54
- }
55
- if (dom.ketchup.objects.isTime(obj)) {
56
- return utils.unformattedStringToFormattedStringTime(value, dom.ketchup.objects.isTimeWithSeconds(obj), obj.t + obj.p);
57
- }
58
- if (dom.ketchup.objects.isTimestamp(obj)) {
59
- return utils.unformattedStringToFormattedStringTimestamp(value);
60
- }
61
- return value;
62
- }
63
- function getColumnByName(columns, name) {
64
- if (columns == null) {
65
- return null;
66
- }
67
- for (let column of columns) {
68
- if (column.name === name) {
69
- return column;
70
- }
71
- }
72
- return null;
73
- }
74
- function compareCell(cell1, cell2, sortMode) {
75
- return compareValues(cell1.obj, cell1.value, cell2.obj, cell2.value, sortMode);
76
- }
77
- function compareValues(obj1, value1, obj2, value2, sortMode) {
78
- const sm = sortMode === 'A' ? 1 : -1;
79
- if (obj1 == null || obj2 == null) {
80
- return sm * localCompareAsInJava(value1, value2);
81
- }
82
- // If either the type or the parameter of the current object are not equal.
83
- if (!(obj1.t === obj2.t && obj1.p === obj2.p)) {
84
- let compare = localCompareAsInJava(obj1.t, obj2.t);
85
- if (compare === 0) {
86
- compare = localCompareAsInJava(obj1.p, obj2.p);
87
- }
88
- return compare * sm;
89
- }
90
- let s1 = value1;
91
- let s2 = value2;
92
- if (s1 == s2) {
93
- return 0;
94
- }
95
- if (s1 == '') {
96
- return sm * -1;
97
- }
98
- if (s2 == '') {
99
- return sm * 1;
100
- }
101
- let v1 = s1;
102
- let v2 = s2;
103
- if (dom.ketchup.objects.isNumber(obj1)) {
104
- v1 = utils.stringToNumber(s1);
105
- v2 = utils.stringToNumber(s2);
106
- }
107
- else if (dom.ketchup.objects.isDate(obj1)) {
108
- v1 = dom.ketchup.dates.toDate(dom.ketchup.dates.format(s1, kupManager.KupDatesFormats.ISO_DATE));
109
- v2 = dom.ketchup.dates.toDate(dom.ketchup.dates.format(s2, kupManager.KupDatesFormats.ISO_DATE));
110
- }
111
- else if (dom.ketchup.objects.isTime(obj1)) {
112
- let manageSeconds = dom.ketchup.objects.isTimeWithSeconds(obj1);
113
- v1 = dom.ketchup.dates.toDate(dom.ketchup.dates.format(s1, manageSeconds
114
- ? kupManager.KupDatesFormats.ISO_TIME
115
- : kupManager.KupDatesFormats.ISO_TIME_WITHOUT_SECONDS));
116
- v2 = dom.ketchup.dates.toDate(dom.ketchup.dates.format(s2, manageSeconds
117
- ? kupManager.KupDatesFormats.ISO_TIME
118
- : kupManager.KupDatesFormats.ISO_TIME_WITHOUT_SECONDS));
119
- }
120
- else if (dom.ketchup.objects.isTimestamp(obj1)) {
121
- v1 = dom.ketchup.dates.toDate(dom.ketchup.dates.format(s1, kupManager.KupDatesFormats.ISO_DATE_TIME));
122
- v2 = dom.ketchup.dates.toDate(dom.ketchup.dates.format(s2, kupManager.KupDatesFormats.ISO_DATE_TIME));
123
- }
124
- if (v1 > v2) {
125
- return sm * 1;
126
- }
127
- if (v1 < v2) {
128
- return sm * -1;
129
- }
130
- return 0;
131
- }
132
- /**
133
- * Given two strings to compare, the functions decides which string comes before the other or if they are equal.
134
- * This is meant as a replacement for the JavaScript function localCompare() which produces a slightly different result from
135
- * the Java version of compareTo().
136
- *
137
- * Re-implemented from java source method compareTo() of java.lang.String
138
- * @param t1 firstString the first string to be compared
139
- * @param t2 anotherString the another string to be compared to the first one
140
- * @returns the value 0 if the anotherString is equal to
141
- * firstString; a value less than 0 if firstString
142
- * is lexicographically less than the anotherString; and a
143
- * value greater than 0 if firstString is
144
- * lexicographically greater than the anotherString.
145
- */
146
- function localCompareAsInJava(t1, t2) {
147
- let t1Length = t1 == null ? 0 : t1.length;
148
- let t2Length = t2 == null ? 0 : t2.length;
149
- const lim = Math.min(t1Length, t2Length);
150
- let k = 0;
151
- while (k < lim) {
152
- const c1 = t1[k];
153
- const c2 = t2[k];
154
- if (c1 !== c2) {
155
- return c1.charCodeAt(0) - c2.charCodeAt(0);
156
- }
157
- k++;
158
- }
159
- return t1Length - t2Length;
160
- }
161
-
162
- exports.compareCell = compareCell;
163
- exports.compareValues = compareValues;
164
- exports.formatToNumber = formatToNumber;
165
- exports.getCellValueForDisplay = getCellValueForDisplay;
166
- exports.getColumnByName = getColumnByName;
167
- exports.getValueForDisplay = getValueForDisplay;
168
- exports.getValueForDisplay2 = getValueForDisplay2;