@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
@@ -79,25 +79,12 @@ export interface KupDataNode extends KupDataRow {
79
79
  value: string;
80
80
  children?: KupDataNode[];
81
81
  disabled?: boolean;
82
+ expandable?: boolean;
82
83
  obj?: KupObj;
83
84
  icon?: string;
84
85
  isExpanded?: boolean;
85
86
  title?: string;
86
87
  }
87
- /**
88
- * Interface related to dataset operations.
89
- */
90
- export interface KupDataDatasetOperations {
91
- cell: KupDataCellOperations;
92
- column: KupDataColumnOperations;
93
- node: KupDataNodeOperations;
94
- row: KupDataRowOperations;
95
- distinct: (dataset: KupDataDataset, columns?: string[], valuesColumn?: KupDataColumn) => KupDataDataset;
96
- new: (dataset: KupDataDataset, newColumns: KupDataNewColumn[]) => KupDataDataset;
97
- rangedDistinct: (dataset: KupDataDataset, rangeColumns: KupDataNewColumn[], resultingColumn: KupDataColumn, valuesColumn?: KupDataColumn) => KupDataDataset;
98
- sort: (dataset: KupDataDataset, sortType: KupDataDatasetSort, headerColumn: string) => KupDataDataset;
99
- transpose: (dataset: KupDataDataset, headerColumn?: string) => KupDataDataset;
100
- }
101
88
  /**
102
89
  * Interface related to cells operations.
103
90
  */
@@ -129,15 +116,6 @@ export interface KupDataRowOperations {
129
116
  find: (dataset: KupDataDataset, filters?: KupDataFindCellFilters) => KupDataRow[];
130
117
  toNode: (dataset: KupDataDataset) => KupDataNode[];
131
118
  }
132
- /**
133
- * Interface related to the formulas factory function.
134
- */
135
- export interface KupDataFormulas {
136
- custom: (formula: string, row: {
137
- [index: string]: number;
138
- }) => number;
139
- normalDistribution: (average: number, variance: number, x: number) => number;
140
- }
141
119
  /**
142
120
  * Sets the filters for the cell finder method.
143
121
  */
@@ -165,7 +143,7 @@ export interface KupDataNewColumn {
165
143
  */
166
144
  export declare type KupDataDatasetSort = 'normalDistribution';
167
145
  /**
168
- * Interface containing the options related to column creation when invoking datasetOperations.column.new.
146
+ * Interface containing the options related to column creation when invoking column.new.
169
147
  */
170
148
  export interface KupDataNewColumnOptions {
171
149
  columns?: string[];
@@ -174,10 +152,11 @@ export interface KupDataNewColumnOptions {
174
152
  separator?: string;
175
153
  }
176
154
  /**
177
- * Types of column creation when invoking datasetOperations.column.new.
155
+ * Types of column creation when invoking column.new.
178
156
  */
179
157
  export declare enum KupDataNewColumnTypes {
180
158
  CONCATENATE = "concatenate",
159
+ DUPLICATE = "duplicate",
181
160
  MATH = "math",
182
161
  MERGE = "merge"
183
162
  }
@@ -7,7 +7,7 @@ import { KupDataNode } from './kup-data-declarations';
7
7
  */
8
8
  export declare function removeNode(nodes: KupDataNode[], node2remove: KupDataNode): KupDataNode;
9
9
  /**
10
- * Sets the values specified in the filters to every node of the input array.
10
+ * Sets the values specified in the properties to every node of the input array.
11
11
  * @param {KupDataNode[]} nodes - Input array of nodes.
12
12
  * @param {Partial<KupDataNode>} properties - New properties values to set.
13
13
  * @param {boolean} recursively - Sets values to every child node.
@@ -1,41 +1,77 @@
1
- import numeral from 'numeral';
2
- import 'numeral/locales/chs';
3
- import 'numeral/locales/es';
4
- import 'numeral/locales/fr';
5
- import 'numeral/locales/it';
6
- import 'numeral/locales/pl';
7
- import 'numeral/locales/ru';
8
- import { KupDataDatasetOperations, KupDataFormulas } from './kup-data-declarations';
1
+ import { KupDataCell, KupDataColumn, KupDataDataset, KupDataDatasetSort, KupDataFindCellFilters, KupDataNewColumn, KupDataNewColumnOptions, KupDataNewColumnTypes, KupDataNode, KupDataRow } from './kup-data-declarations';
9
2
  /**
10
3
  * Handles data operations.
11
4
  * @module KupData
12
5
  */
13
6
  export declare class KupData {
14
- datasetOperations: KupDataDatasetOperations;
15
- formulas: KupDataFormulas;
16
- numeral: typeof numeral;
7
+ cell: {
8
+ find(dataset: KupDataDataset, filters: KupDataFindCellFilters): KupDataCell[];
9
+ getValue(dataset: KupDataDataset, columns?: string[]): string[];
10
+ replace(dataset: KupDataDataset, cell: KupDataCell, columns?: string[]): KupDataCell[];
11
+ };
12
+ column: {
13
+ find(dataset: KupDataDataset | KupDataColumn[], filters: Partial<KupDataColumn>): KupDataColumn[];
14
+ hide(dataset: KupDataDataset | KupDataColumn[], columns2hide: string[]): KupDataColumn[];
15
+ new(dataset: KupDataDataset, type: KupDataNewColumnTypes, options: KupDataNewColumnOptions): string | KupDataColumn;
16
+ };
17
+ node: {
18
+ remove(nodes: KupDataNode[], node2remove: KupDataNode): KupDataNode;
19
+ setProperties(nodes: KupDataNode[], properties: Partial<KupDataNode>, recursively?: boolean, exclude?: KupDataNode[]): KupDataNode[];
20
+ toStream(nodes: KupDataNode[]): KupDataNode[];
21
+ };
22
+ row: {
23
+ find(dataset: KupDataDataset, filters: KupDataFindCellFilters): KupDataRow[];
24
+ toNode(dataset: KupDataDataset): KupDataNode[];
25
+ };
17
26
  /**
18
- * Initializes KupData.
27
+ * Utility used by findRow and findCell.
28
+ * @param {KupDataDataset} dataset - Input dataset.
29
+ * @param {KupDataFindCellFilters} filters - Filters of the research.
30
+ * @returns {{cells: KupDataCell[], rows: KupDataRow[]}} Object containing rows and cells.
19
31
  */
20
- constructor();
32
+ finder(dataset: KupDataDataset, filters: KupDataFindCellFilters): {
33
+ cells: KupDataCell[];
34
+ rows: KupDataRow[];
35
+ };
21
36
  /**
22
- * Calculates the normal distribution on a set of values.
23
- * @param {string[] | number[] | String[]} values - Array of values.
24
- * @param {number} precision - Number of iterations to run (points). When not specified, defaults to 201.
25
- * @returns {number[][]} Returns an array of arrays containing numbers, which are the representation of the calculated normal distribution.
37
+ * Creates a new dataset with an amount of cells equal to a distinct calculation applied to the given columns.
38
+ * The original value of cells will be stored in the title property of the new cells.
39
+ * @param {KupDataDataset} dataset - Input dataset.
40
+ * @param {string[]} columns - Column names to manage. When missing, defaults to all columns.
41
+ * @param {KupDataColumn} valuesColumn - When present, this column will be included in the final dataset containing the original values of the cells.
42
+ * @returns {KupDataDataset} New dataset with processed data.
26
43
  */
27
- normalDistribution(values: string[] | number[] | String[], precision?: number): number[][];
44
+ distinct(dataset: KupDataDataset, columns?: string[], valuesColumn?: KupDataColumn): KupDataDataset;
28
45
  /**
29
- * Returns a number from a non-specified input type between string, number, or String.
30
- * @param {string | String | number} input - Input value to numberify.
31
- * @returns {number} Resulting number or NaN (when not a number).
46
+ * Creates a new dataset from the input one.
47
+ * The new columns are to be specified in the columns argument along with their creation criteria.
48
+ * @param {KupDataDataset} dataset - Input dataset.
49
+ * @param {KupDataNewColumn[]} newColumns - Array containing the specifics of the new columns to be created.
50
+ * @returns {KupDataDataset} Resulting dataset.
32
51
  */
33
- numberify(input: string | String | number): number;
52
+ new(dataset: KupDataDataset, newColumns: KupDataNewColumn[]): KupDataDataset;
34
53
  /**
35
- * Formats the input number with the specified format of the currently set locale.
36
- * @param {string | String | number} input - Input number which will be automatically "numberified".
37
- * @param {string} format - Desired format. Defaults to '0,0.0' (i.e.: 2,000,000.51)
38
- * @returns {string} Formatted number.
54
+ * Performs a distinct/count after previously grouping columns by ranges.
55
+ * @param {KupDataDataset} dataset - Input dataset.
56
+ * @param {KupDataNewColumn[]} rangeColumns - A list of columns coupled with their criteria for creation. These are used to define ranges.
57
+ * @param {KupDataColumn} resultingColumn - The resulting column.
58
+ * @param {KupDataColumn} valuesColumn - When present, this column will be included in the final dataset containing the original values of the cells.
59
+ * @returns {KupDataDataset} New dataset with processed data.
39
60
  */
40
- format(input: string | String | number, format?: string): string;
61
+ rangedDistinct(dataset: KupDataDataset, rangeColumns: KupDataNewColumn[], resultingColumn: KupDataColumn, valuesColumn?: KupDataColumn): KupDataDataset;
62
+ /**
63
+ * Creates a new dataset with sorted elements.
64
+ * @param {KupDataDataset} dataset Input dataset.
65
+ * @param {KupDataDatasetSort} sortType Type of sort to apply.
66
+ * @param {string} headerColumn The column used for sorting.
67
+ * @returns {KupDataDataset} Sorted dataset.
68
+ */
69
+ sort(dataset: KupDataDataset, sortType: KupDataDatasetSort, headerColumn: string): KupDataDataset;
70
+ /**
71
+ * Creates a new dataset with transposed columns and rows.
72
+ * @param {KupDataDataset} dataset - Input dataset.
73
+ * @param {string} headerColumn - When specified, it will be the column used as header. When missing, the header will be a series of progressive numbers.
74
+ * @returns {KupDataDataset} Transposed dataset.
75
+ */
76
+ transpose(dataset: KupDataDataset, headerColumn?: string): KupDataDataset;
41
77
  }
@@ -9,6 +9,7 @@ import type { KupDynamicPosition } from '../kup-dynamic-position/kup-dynamic-pos
9
9
  import type { KupInteract } from '../kup-interact/kup-interact';
10
10
  import type { KupLanguage } from '../kup-language/kup-language';
11
11
  import type { KupLanguageJSON } from '../kup-language/kup-language-declarations';
12
+ import type { KupMath } from '../kup-math/kup-math';
12
13
  import type { KupObjects } from '../kup-objects/kup-objects';
13
14
  import type { KupObjectsJSON } from '../kup-objects/kup-objects-declarations';
14
15
  import type { KupScrollOnHover } from '../kup-scroll-on-hover/kup-scroll-on-hover';
@@ -17,6 +18,7 @@ import type { KupTheme } from '../kup-theme/kup-theme';
17
18
  import type { KupThemeJSON } from '../kup-theme/kup-theme-declarations';
18
19
  import type { KupToolbar } from '../kup-toolbar/kup-toolbar';
19
20
  import type { ResizeObserver } from 'resize-observer';
21
+ import { KupMathLocales } from '../kup-math/kup-math-declarations';
20
22
  /**
21
23
  * Interface used to define the HTML element with Ketchup specific properties.
22
24
  */
@@ -35,6 +37,7 @@ export interface KupManager {
35
37
  interact: KupInteract;
36
38
  language: KupLanguage;
37
39
  magicBox: HTMLKupMagicBoxElement;
40
+ math: KupMath;
38
41
  objects: KupObjects;
39
42
  overrides?: KupManagerInitialization;
40
43
  resize: ResizeObserver;
@@ -68,10 +71,12 @@ export interface KupManagerClickCb {
68
71
  * Interface for the KupManager override settings.
69
72
  */
70
73
  export interface KupManagerInitialization {
74
+ autoSetLocalization?: boolean;
71
75
  dates?: KupManagerDatesSettings;
72
76
  debug?: KupManagerDebugSettings;
73
77
  interact?: KupManagerInteractSettings;
74
78
  language?: KupManagerLanguageSettings;
79
+ math?: KupManagerMathSettings;
75
80
  objects?: KupManagerObjectsSettings;
76
81
  scrollOnHover?: KupManagerScrollOnHoverSettings;
77
82
  theme?: KupManagerThemeSettings;
@@ -108,6 +113,12 @@ export interface KupManagerLanguageSettings {
108
113
  list?: KupLanguageJSON;
109
114
  name?: string;
110
115
  }
116
+ /**
117
+ * KupMath initialization settings.
118
+ */
119
+ export interface KupManagerMathSettings {
120
+ locale?: KupMathLocales;
121
+ }
111
122
  /**
112
123
  * KupObjects initialization settings.
113
124
  */
@@ -12,6 +12,7 @@ import { KupData } from '../kup-data/kup-data';
12
12
  import { KupDates } from '../kup-dates/kup-dates';
13
13
  import { KupDatesLocales } from '../kup-dates/kup-dates-declarations';
14
14
  import { KupSearch } from '../kup-search/kup-search';
15
+ import { KupMath } from '../kup-math/kup-math';
15
16
  /**
16
17
  * This class controls every other Ketchup utility suite.
17
18
  * @module KupManager
@@ -24,6 +25,7 @@ export declare class KupManager {
24
25
  interact: KupInteract;
25
26
  language: KupLanguage;
26
27
  magicBox: HTMLKupMagicBoxElement;
28
+ math: KupMath;
27
29
  objects: KupObjects;
28
30
  overrides?: KupManagerInitialization;
29
31
  resize: ResizeObserver;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Interface related to the formulas factory function.
3
+ */
4
+ export interface KupMathFormulas {
5
+ custom: (formula: string, row: {
6
+ [index: string]: number;
7
+ }) => number;
8
+ normalDistribution: (average: number, variance: number, x: number) => number;
9
+ }
10
+ /**
11
+ * Locales available for KupMath.
12
+ */
13
+ export declare enum KupMathLocales {
14
+ cn = "chs",
15
+ en = "en",
16
+ es = "es",
17
+ it = "it",
18
+ fr = "fr",
19
+ pl = "pl",
20
+ ru = "ru"
21
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Takes a mathematical formula as string in input, with column names between brackets, and returns the result as a number.
3
+ * @param {string} formula - Mathematical operation (i.e.: ([COL1] - [COL2]) * 100 / [COL3]).
4
+ * @param {{ [index: string]: number }} row - Object containing column names as indexes and the related values as keys.
5
+ * @returns {number} Result of the formula.
6
+ */
7
+ export declare function customFormula(formula: string, row: {
8
+ [index: string]: number;
9
+ }): number;
10
+ /**
11
+ * Calculates a single Y point of a normal distribution.
12
+ * @param {number} average - Average.
13
+ * @param {number} variance - Variance.
14
+ * @param {number} x - X coordinate.
15
+ * @returns {number} Result.
16
+ */
17
+ export declare function normalDistributionFormula(average: number, variance: number, x: number): number;
@@ -0,0 +1,60 @@
1
+ import numeral from 'numeral';
2
+ import 'numeral/locales/chs';
3
+ import 'numeral/locales/es';
4
+ import 'numeral/locales/fr';
5
+ import 'numeral/locales/it';
6
+ import 'numeral/locales/pl';
7
+ import 'numeral/locales/ru';
8
+ import { KupComponent } from '../../types/GenericTypes';
9
+ import { KupMathFormulas, KupMathLocales } from './kup-math-declarations';
10
+ /**
11
+ * Handles mathematical operations and number formatting/conversion.
12
+ * @module KupMath
13
+ */
14
+ export declare class KupMath {
15
+ formulas: KupMathFormulas;
16
+ locale: KupMathLocales;
17
+ managedComponents: Set<KupComponent>;
18
+ numeral: typeof numeral;
19
+ /**
20
+ * Initializes KupMath.
21
+ */
22
+ constructor(locale?: KupMathLocales);
23
+ /**
24
+ * Sets the locale of the numeral instance. The locales available must be tied to the KupDates locales.
25
+ * @param {KupMathLocales} locale - Numeraljs locale string.
26
+ */
27
+ setLocale(locale: KupMathLocales): void;
28
+ /**
29
+ * Calculates the normal distribution on a set of values.
30
+ * @param {string[] | number[] | String[]} values - Array of values.
31
+ * @param {number} precision - Number of iterations to run (points). When not specified, defaults to 201.
32
+ * @returns {number[][]} Returns an array of arrays containing numbers, which are the representation of the calculated normal distribution.
33
+ */
34
+ normalDistribution(values: string[] | number[] | String[], precision?: number): number[][];
35
+ /**
36
+ * Formats the input number with the specified format of the currently set locale.
37
+ * @param {string | String | number} input - Input number which will be automatically "numberified".
38
+ * @param {string} format - Desired format. Defaults to '0,0.00' (i.e.: 2,000,000.51).
39
+ * @returns {string} Formatted number.
40
+ */
41
+ format(input: string | String | number, format?: string): string;
42
+ /**
43
+ * Returns a number from a non-specified input type between string, number, or String.
44
+ * @param {string | String | number} input - Input value to numberify.
45
+ * @param {boolean} inputIsLocalized - Numberifies assuming the input string is in the current KupMath locale's format.
46
+ * @returns {number} Resulting number or NaN (when not a number).
47
+ */
48
+ numberify(input: string | String | number, inputIsLocalized?: boolean): number;
49
+ /**
50
+ * Registers a KupComponent in KupMath, in order to be properly handled whenever the locale changes.
51
+ * @param {any} component - The Ketchup component to be registered.
52
+ */
53
+ register(component: any): void;
54
+ /**
55
+ * Unregisters a KupComponent, so it won't be refreshed when the locale changes.
56
+ *
57
+ * @param {any} component - The component calling this function.
58
+ */
59
+ unregister(component: any): void;
60
+ }
@@ -1,4 +1,5 @@
1
1
  import type { Dayjs } from 'dayjs';
2
+ import type { GenericObject } from '../../types/GenericTypes';
2
3
  import type { KupObj, KupObjectsJSON } from './kup-objects-declarations';
3
4
  /**
4
5
  * Handles objects definition and validation.
@@ -173,4 +174,25 @@ export declare class KupObjects {
173
174
  * @returns {Dayjs} Dayjs object.
174
175
  */
175
176
  parseDate(obj: KupObj): Dayjs;
177
+ /**
178
+ * Check whether two JS objects are deeply equal. When the arguments aren't objects, they are tested directly for equity.
179
+ * @param {GenericObject} object1 - First object to test.
180
+ * @param {GenericObject} object2 - Second object to test.
181
+ * @returns {boolean} True if the objects are equal.
182
+ * @see https://dmitripavlutin.com/how-to-compare-objects-in-javascript/#4-deep-equality
183
+ */
184
+ deepEqual(object1: any, object2: any): boolean;
185
+ /**
186
+ * Check whether the argument is a JavaScript object.
187
+ * @param {GenericObject} object - Object to test.
188
+ * @returns {boolean} True if the argument is a JavaScript object.
189
+ * @see https://dmitripavlutin.com/how-to-compare-objects-in-javascript/#4-deep-equality
190
+ */
191
+ isJsObject(object: any): boolean;
192
+ /**
193
+ * Check whether the object is empty or not.
194
+ * @param {GenericObject} object - Object to check.
195
+ * @returns {boolean} True if the object is empty.
196
+ */
197
+ isEmptyJsObject(obj: GenericObject): boolean;
176
198
  }
@@ -9,23 +9,7 @@ export declare enum DateTimeFormatOptionsMonth {
9
9
  NARROW = "narrow"
10
10
  }
11
11
  export declare function identify(array: Array<KupBoxRow | KupDataRow>): void;
12
- export declare function format(first: string, middle: string, last: string): string;
13
- export declare function generateUniqueId(field?: string): string;
14
- export declare function generateUuidv4(): string;
15
- export declare function eventFromElement(element: HTMLElement, eventSource: HTMLElement): boolean;
16
12
  export declare function getCurrentDateFormatFromBrowserLocale(): string;
17
- /**
18
- * Convert argument to boolean. Everything is false unless: true, "true", 1, "1", "on", "yes"
19
- * @param value the value to convert
20
- * @returns the boolean value of passed argument
21
- */
22
- export declare function getBoolean(value: any): boolean;
23
- /**
24
- * Check if an object is undefined, null or empty
25
- * @param obj the object to check
26
- * @returns true or false
27
- */
28
- export declare function isEmpty(obj: any): boolean;
29
13
  /**
30
14
  * @param value number as string, formatted by actual browser locale
31
15
  * @param type - type of number for calculate suffix
@@ -124,8 +108,6 @@ export declare function getMonthsAsStringByLocale(format?: DateTimeFormatOptions
124
108
  export declare function getDayAsStringByLocale(date: Date): string;
125
109
  export declare function getDaysOfWeekAsStringByLocale(firstDayIndex?: number): string[];
126
110
  export declare function fillString(stringIn: string, stringForFill: string, finalLen: number, addBefore: boolean): string;
127
- export declare function deepEqual(object1: any, object2: any): boolean;
128
- export declare function isObject(object: any): boolean;
129
111
  /**
130
112
  * Used to retrieve component's props values.
131
113
  * @param {any} comp - Component calling this function.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sme.up/ketchup",
3
- "version": "5.0.0",
3
+ "version": "5.1.1",
4
4
  "keywords": [
5
5
  "smeup",
6
6
  "KetchUP",
@@ -55,7 +55,7 @@
55
55
  "vanilla-picker": "^2.12.1"
56
56
  },
57
57
  "devDependencies": {
58
- "@stencil/core": "^2.14.0",
58
+ "@stencil/core": "^2.14.1",
59
59
  "@stencil/sass": "^1.4.1",
60
60
  "@types/d3-shape": "^2.1.0",
61
61
  "@types/geojson": "^7946.0.8",