@sme.up/ketchup 5.0.0 → 5.2.1-SNAPSHOT
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.
- package/README.md +1 -1
- package/dist/cjs/{cell-utils-720be0c8.js → cell-utils-d96b2993.js} +4 -4
- package/dist/cjs/{f-button-dbf3cd3a.js → f-button-2b9b99b1.js} +2 -2
- package/dist/cjs/{f-cell-93d984ad.js → f-cell-8351cb84.js} +8 -96
- package/dist/cjs/{f-chip-438213eb.js → f-chip-df59e1b0.js} +3 -3
- package/dist/cjs/{f-image-21865ab7.js → f-image-12bab3b5.js} +2 -2
- package/dist/cjs/f-text-field-e7c35b5b.js +94 -0
- package/dist/cjs/f-text-field-mdc-a67f5dfe.js +2852 -0
- package/dist/cjs/{index-ab119fad.js → index-eb556444.js} +6 -1
- package/dist/cjs/ketchup.cjs.js +3 -3
- package/dist/cjs/kup-accordion.cjs.entry.js +5 -5
- package/dist/cjs/kup-autocomplete_27.cjs.entry.js +641 -3331
- package/dist/cjs/kup-calendar.cjs.entry.js +8 -8
- package/dist/cjs/kup-cell.cjs.entry.js +9 -8
- package/dist/cjs/kup-dash-list.cjs.entry.js +5 -5
- package/dist/cjs/kup-dash_2.cjs.entry.js +5 -5
- package/dist/cjs/kup-drawer.cjs.entry.js +8 -5
- package/dist/cjs/kup-echart.cjs.entry.js +210 -60
- package/dist/cjs/kup-field.cjs.entry.js +3 -3
- package/dist/cjs/kup-iframe.cjs.entry.js +4 -4
- package/dist/cjs/kup-lazy.cjs.entry.js +4 -4
- package/dist/cjs/kup-magic-box.cjs.entry.js +7 -7
- package/dist/cjs/{kup-manager-09c0c1fc.js → kup-manager-5c03da64.js} +3061 -2642
- package/dist/cjs/kup-nav-bar.cjs.entry.js +6 -6
- package/dist/cjs/kup-numeric-picker.cjs.entry.js +423 -0
- package/dist/cjs/kup-photo-frame.cjs.entry.js +179 -0
- package/dist/cjs/kup-probe.cjs.entry.js +3 -3
- package/dist/cjs/kup-qlik.cjs.entry.js +3 -3
- package/dist/cjs/kup-snackbar.cjs.entry.js +6 -6
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/{utils-a60ab5fa.js → utils-e99921c1.js} +4 -38
- package/dist/collection/assets/card.js +30 -30
- package/dist/collection/assets/data-table.js +24 -74
- package/dist/collection/assets/echart.js +481 -0
- package/dist/collection/assets/index.js +87 -79
- package/dist/collection/assets/kupdata.js +29 -41
- package/dist/collection/assets/kuptooltip.js +608 -0
- package/dist/collection/assets/list.js +6 -6
- package/dist/collection/assets/nav-bar.js +4 -4
- package/dist/collection/assets/probe.js +18 -18
- package/dist/collection/collection-manifest.json +3 -1
- package/dist/collection/components/kup-autocomplete/kup-autocomplete.js +4 -4
- package/dist/collection/components/kup-box/kup-box.js +9 -9
- package/dist/collection/components/kup-button-list/kup-button-list.js +4 -4
- package/dist/collection/components/kup-card/built-in/kup-card-built-in.js +10 -0
- package/dist/collection/components/kup-card/built-in/kup-card-column-drop-menu.js +20 -20
- package/dist/collection/components/kup-card/built-in/kup-card-numeric.js +153 -0
- package/dist/collection/components/kup-card/kup-card.css +35 -0
- package/dist/collection/components/kup-card/kup-card.js +1 -0
- package/dist/collection/components/kup-chip/kup-chip.js +4 -4
- package/dist/collection/components/kup-combobox/kup-combobox.js +5 -5
- package/dist/collection/components/kup-data-table/kup-data-table-declarations.js +0 -2
- package/dist/collection/components/kup-data-table/kup-data-table-helper.js +31 -32
- package/dist/collection/components/kup-data-table/kup-data-table-state.js +1 -1
- package/dist/collection/components/kup-data-table/kup-data-table.js +112 -159
- package/dist/collection/components/kup-date-picker/kup-date-picker.js +1 -1
- package/dist/collection/components/kup-drawer/kup-drawer.js +4 -1
- package/dist/collection/components/kup-dropdown-button/kup-dropdown-button.css +3 -3
- package/dist/collection/components/kup-dropdown-button/kup-dropdown-button.js +14 -14
- package/dist/collection/components/kup-echart/kup-echart-declarations.js +3 -0
- package/dist/collection/components/kup-echart/kup-echart.js +246 -58
- package/dist/collection/components/kup-image/assets/svg/instagram.svg +1 -0
- package/dist/collection/components/kup-image/assets/svg/pinterest.svg +1 -0
- package/dist/collection/components/kup-image/assets/svg/reddit.svg +1 -0
- package/dist/collection/components/kup-list/kup-list-helper.js +26 -26
- package/dist/collection/components/kup-list/kup-list.css +35 -3
- package/dist/collection/components/kup-list/kup-list.js +52 -44
- package/dist/collection/components/kup-magic-box/kup-magic-box.js +3 -3
- package/dist/collection/components/kup-nav-bar/kup-nav-bar.js +2 -2
- package/dist/collection/components/kup-numeric-picker/kup-numeric-picker-declarations.js +16 -0
- package/dist/collection/components/kup-numeric-picker/kup-numeric-picker.css +50 -0
- package/dist/collection/components/kup-numeric-picker/kup-numeric-picker.js +895 -0
- package/dist/collection/components/kup-photo-frame/kup-photo-frame-declarations.js +10 -0
- package/dist/collection/components/kup-photo-frame/kup-photo-frame.css +70 -0
- package/dist/collection/components/kup-photo-frame/kup-photo-frame.js +382 -0
- package/dist/collection/components/kup-tab-bar/kup-tab-bar.css +1 -1
- package/dist/collection/components/kup-time-picker/kup-time-picker.js +8 -8
- package/dist/collection/components/kup-tree/kup-tree.js +25 -38
- package/dist/collection/f-components/f-paginator/f-paginator.js +6 -6
- package/dist/collection/managers/kup-data/kup-data-cell-helper.js +2 -2
- package/dist/collection/managers/kup-data/kup-data-column-helper.js +27 -3
- package/dist/collection/managers/kup-data/kup-data-declarations.js +2 -1
- package/dist/collection/managers/kup-data/kup-data-node-helper.js +1 -1
- package/dist/collection/managers/kup-data/kup-data-row-helper.js +2 -2
- package/dist/collection/managers/kup-data/kup-data.js +337 -155
- package/dist/collection/managers/kup-dates/kup-dates.js +2 -2
- package/dist/collection/managers/kup-debug/kup-debug.js +7 -6
- package/dist/collection/managers/kup-dynamic-position/kup-dynamic-position.js +1 -1
- package/dist/collection/managers/kup-language/kup-language.js +2 -2
- package/dist/collection/managers/kup-manager/kup-manager.js +25 -1
- package/dist/collection/managers/kup-math/kup-math-declarations.js +13 -0
- package/dist/collection/managers/kup-math/kup-math-helper.js +39 -0
- package/dist/collection/managers/kup-math/kup-math.js +161 -0
- package/dist/collection/managers/kup-objects/kup-objects.js +48 -1
- package/dist/collection/managers/kup-theme/kup-theme-declarations.js +1 -0
- package/dist/collection/managers/kup-theme/kup-theme.js +2 -2
- package/dist/collection/managers/kup-tooltip/kup-tooltip-declarations.js +1 -0
- package/dist/collection/managers/kup-tooltip/kup-tooltip.js +191 -0
- package/dist/collection/types/GenericTypes.js +1 -0
- package/dist/collection/utils/cell-utils.js +2 -3
- package/dist/collection/utils/kup-column-menu/kup-column-menu.js +1 -1
- package/dist/collection/utils/utils.js +3 -74
- package/dist/esm/{cell-utils-b80ccb8c.js → cell-utils-f4bdbbc8.js} +4 -4
- package/dist/esm/{f-button-9e835467.js → f-button-54a49fd8.js} +2 -2
- package/dist/esm/{f-cell-f8bb2e04.js → f-cell-d5dac50b.js} +8 -95
- package/dist/esm/{f-chip-953c6915.js → f-chip-a3035b4b.js} +3 -3
- package/dist/esm/{f-image-78c5265e.js → f-image-d32465e3.js} +2 -2
- package/dist/esm/f-text-field-c25cc63f.js +92 -0
- package/dist/esm/f-text-field-mdc-9fbbefc3.js +2850 -0
- package/dist/esm/{index-78f3699d.js → index-baeab1ac.js} +6 -2
- package/dist/esm/ketchup.js +3 -3
- package/dist/esm/kup-accordion.entry.js +5 -5
- package/dist/esm/kup-autocomplete_27.entry.js +625 -3315
- package/dist/esm/kup-calendar.entry.js +8 -8
- package/dist/esm/kup-cell.entry.js +9 -8
- package/dist/esm/kup-dash-list.entry.js +5 -5
- package/dist/esm/kup-dash_2.entry.js +5 -5
- package/dist/esm/kup-drawer.entry.js +8 -5
- package/dist/esm/kup-echart.entry.js +210 -60
- package/dist/esm/kup-field.entry.js +3 -3
- package/dist/esm/kup-iframe.entry.js +4 -4
- package/dist/esm/kup-lazy.entry.js +4 -4
- package/dist/esm/kup-magic-box.entry.js +7 -7
- package/dist/esm/{kup-manager-bba62291.js → kup-manager-9316a184.js} +3062 -2642
- package/dist/esm/kup-nav-bar.entry.js +6 -6
- package/dist/esm/kup-numeric-picker.entry.js +419 -0
- package/dist/esm/kup-photo-frame.entry.js +175 -0
- package/dist/esm/kup-probe.entry.js +3 -3
- package/dist/esm/kup-qlik.entry.js +3 -3
- package/dist/esm/kup-snackbar.entry.js +6 -6
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{utils-d1569956.js → utils-f24319a0.js} +5 -37
- package/dist/ketchup/assets/svg/instagram.svg +1 -0
- package/dist/ketchup/assets/svg/pinterest.svg +1 -0
- package/dist/ketchup/assets/svg/reddit.svg +1 -0
- package/dist/ketchup/ketchup.esm.js +1 -1
- package/dist/ketchup/p-09d708c4.entry.js +1 -0
- package/dist/ketchup/p-11e72a8c.entry.js +1 -0
- package/dist/ketchup/p-12773ca8.js +9 -0
- package/dist/ketchup/p-203d6295.entry.js +1 -0
- package/dist/ketchup/p-34748c91.js +1 -0
- package/dist/ketchup/p-34b74425.js +1 -0
- package/dist/ketchup/p-40f97429.js +1 -0
- package/dist/ketchup/p-4173422f.entry.js +1 -0
- package/dist/ketchup/p-41741c28.entry.js +1 -0
- package/dist/ketchup/p-44192f30.entry.js +1 -0
- package/dist/ketchup/{p-ebf4cf56.js → p-44f8da2a.js} +1 -1
- package/dist/ketchup/{p-fa540f82.js → p-4f56932b.js} +1 -1
- package/dist/ketchup/p-669bde31.js +1 -0
- package/dist/ketchup/p-67842f1e.entry.js +1 -0
- package/dist/ketchup/{p-f993f813.js → p-7a74ad17.js} +1 -1
- package/dist/ketchup/p-7ba8fa4a.entry.js +39 -0
- package/dist/ketchup/p-7de0d7e1.js +1 -0
- package/dist/ketchup/p-8418e8fa.entry.js +1 -0
- package/dist/ketchup/p-96bf19aa.entry.js +1 -0
- package/dist/ketchup/p-9a61d8dc.entry.js +1 -0
- package/dist/ketchup/p-b0ddcce9.entry.js +9 -0
- package/dist/ketchup/{p-aa27f9f7.entry.js → p-b6c21223.entry.js} +2 -2
- package/dist/ketchup/p-bb8844bf.entry.js +1 -0
- package/dist/ketchup/p-c58a2a81.entry.js +1 -0
- package/dist/ketchup/p-ca3d585b.entry.js +1 -0
- package/dist/ketchup/p-e6709c26.entry.js +1 -0
- package/dist/ketchup/p-e8e3c9da.entry.js +1 -0
- package/dist/ketchup/p-ecb7069b.js +135 -0
- package/dist/types/components/kup-button-list/kup-button-list-declarations.d.ts +2 -1
- package/dist/types/components/kup-card/built-in/kup-card-built-in.d.ts +7 -0
- package/dist/types/components/kup-card/built-in/kup-card-numeric.d.ts +2 -0
- package/dist/types/components/kup-card/kup-card-declarations.d.ts +26 -1
- package/dist/types/components/kup-data-table/kup-data-table-declarations.d.ts +2 -2
- package/dist/types/components/kup-data-table/kup-data-table-state.d.ts +1 -1
- package/dist/types/components/kup-data-table/kup-data-table.d.ts +7 -15
- package/dist/types/components/kup-dropdown-button/kup-dropdown-button.d.ts +1 -1
- package/dist/types/components/kup-echart/kup-echart-declarations.d.ts +3 -0
- package/dist/types/components/kup-echart/kup-echart.d.ts +12 -1
- package/dist/types/components/kup-list/kup-list-declarations.d.ts +3 -7
- package/dist/types/components/kup-list/kup-list-helper.d.ts +6 -6
- package/dist/types/components/kup-list/kup-list.d.ts +2 -2
- package/dist/types/components/kup-numeric-picker/kup-numeric-picker-declarations.d.ts +19 -0
- package/dist/types/components/kup-numeric-picker/kup-numeric-picker.d.ts +121 -0
- package/dist/types/components/kup-photo-frame/kup-photo-frame-declarations.d.ts +9 -0
- package/dist/types/components/kup-photo-frame/kup-photo-frame.d.ts +61 -0
- package/dist/types/components.d.ts +249 -28
- package/dist/types/managers/kup-data/kup-data-column-helper.d.ts +9 -1
- package/dist/types/managers/kup-data/kup-data-declarations.d.ts +4 -25
- package/dist/types/managers/kup-data/kup-data-node-helper.d.ts +1 -1
- package/dist/types/managers/kup-data/kup-data.d.ts +63 -27
- package/dist/types/managers/kup-manager/kup-manager-declarations.d.ts +21 -0
- package/dist/types/managers/kup-manager/kup-manager.d.ts +4 -0
- package/dist/types/managers/kup-math/kup-math-declarations.d.ts +27 -0
- package/dist/types/managers/kup-math/kup-math-helper.d.ts +17 -0
- package/dist/types/managers/kup-math/kup-math.d.ts +61 -0
- package/dist/types/managers/kup-objects/kup-objects.d.ts +22 -0
- package/dist/types/managers/kup-tooltip/kup-tooltip-declarations.d.ts +8 -0
- package/dist/types/managers/kup-tooltip/kup-tooltip.d.ts +40 -0
- package/dist/types/types/GenericTypes.d.ts +1 -0
- package/dist/types/utils/utils.d.ts +0 -18
- package/package.json +3 -3
- package/CHANGELOG.md +0 -5
- package/dist/collection/managers/kup-data/kup-data-dataset-helper.js +0 -262
- package/dist/collection/managers/kup-data/kup-data-helper.js +0 -61
- package/dist/collection/utils/state-utils.js +0 -9
- package/dist/ketchup/p-0032a782.entry.js +0 -1
- package/dist/ketchup/p-18c4d083.entry.js +0 -1
- package/dist/ketchup/p-199c972e.entry.js +0 -1
- package/dist/ketchup/p-29800a2e.js +0 -1
- package/dist/ketchup/p-34aa8d8a.entry.js +0 -1
- package/dist/ketchup/p-542279e9.entry.js +0 -1
- package/dist/ketchup/p-5b26a7a8.entry.js +0 -39
- package/dist/ketchup/p-5c97e7ab.js +0 -1
- package/dist/ketchup/p-6817ca85.entry.js +0 -1
- package/dist/ketchup/p-76e674ca.entry.js +0 -1
- package/dist/ketchup/p-78aa6f1b.js +0 -1
- package/dist/ketchup/p-842b66aa.entry.js +0 -1
- package/dist/ketchup/p-894981c0.entry.js +0 -143
- package/dist/ketchup/p-8ac2fa75.entry.js +0 -1
- package/dist/ketchup/p-907c9e11.entry.js +0 -1
- package/dist/ketchup/p-9ae9149b.entry.js +0 -1
- package/dist/ketchup/p-b0d1bdd8.js +0 -9
- package/dist/ketchup/p-e1e4c951.entry.js +0 -1
- package/dist/ketchup/p-eba369d9.entry.js +0 -1
- package/dist/ketchup/p-ed0b8666.js +0 -1
- package/dist/types/managers/kup-data/kup-data-dataset-helper.d.ts +0 -42
- package/dist/types/managers/kup-data/kup-data-helper.d.ts +0 -11
- package/dist/types/utils/state-utils.d.ts +0 -1
|
@@ -64,29 +64,29 @@ export class KupDebug {
|
|
|
64
64
|
const languagesListData = [];
|
|
65
65
|
for (let index = 0; index < languages.length; index++) {
|
|
66
66
|
languagesListData.push({
|
|
67
|
-
|
|
68
|
-
value: languages[index],
|
|
67
|
+
id: languages[index],
|
|
69
68
|
selected: languages[index] === dom.ketchup.language.name
|
|
70
69
|
? true
|
|
71
70
|
: false,
|
|
71
|
+
value: languages[index],
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
74
|
const themes = dom.ketchup.theme.getThemes();
|
|
75
75
|
const themesListData = [];
|
|
76
76
|
for (let index = 0; index < themes.length; index++) {
|
|
77
77
|
themesListData.push({
|
|
78
|
-
|
|
79
|
-
value: themes[index],
|
|
78
|
+
id: themes[index],
|
|
80
79
|
selected: themes[index] === dom.ketchup.theme.name ? true : false,
|
|
80
|
+
value: themes[index],
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
83
|
const locales = dom.ketchup.dates.getLocales();
|
|
84
84
|
const localesListData = [];
|
|
85
85
|
for (let index = 0; index < locales.length; index++) {
|
|
86
86
|
localesListData.push({
|
|
87
|
-
|
|
88
|
-
value: locales[index],
|
|
87
|
+
id: locales[index],
|
|
89
88
|
selected: locales[index] === dom.ketchup.dates.locale ? true : false,
|
|
89
|
+
value: locales[index],
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
92
|
debugWidget.data = {
|
|
@@ -279,6 +279,7 @@ export class KupDebug {
|
|
|
279
279
|
break;
|
|
280
280
|
case 'kup-debug-locale-changer':
|
|
281
281
|
dom.ketchup.dates.setLocale(compEvent.detail.value);
|
|
282
|
+
dom.ketchup.math.setLocale(compEvent.detail.value);
|
|
282
283
|
break;
|
|
283
284
|
case 'kup-debug-theme-changer':
|
|
284
285
|
dom.ketchup.theme.set(compEvent.detail.value);
|
|
@@ -40,7 +40,7 @@ export class KupDynamicPosition {
|
|
|
40
40
|
if (this.anchorIsHTMLElement(anchorEl)) {
|
|
41
41
|
anchorEl.setAttribute(kupDynamicPositionAnchorAttribute, '');
|
|
42
42
|
}
|
|
43
|
-
el.style.zIndex = `calc(var(--kup-navbar-zindex)
|
|
43
|
+
el.style.zIndex = `calc(var(--kup-navbar-zindex) + 1)`;
|
|
44
44
|
const originalPath = [];
|
|
45
45
|
if (detach) {
|
|
46
46
|
let currentEl = el;
|
|
@@ -136,7 +136,7 @@ export class KupLanguage {
|
|
|
136
136
|
* @param {any} component - The component calling this function.
|
|
137
137
|
*/
|
|
138
138
|
register(component) {
|
|
139
|
-
this.managedComponents.add(component.rootElement);
|
|
139
|
+
this.managedComponents.add(component.rootElement ? component.rootElement : component);
|
|
140
140
|
}
|
|
141
141
|
/**
|
|
142
142
|
* Unregisters a KupComponent, so it won't be refreshed when the language changes.
|
|
@@ -145,7 +145,7 @@ export class KupLanguage {
|
|
|
145
145
|
*/
|
|
146
146
|
unregister(component) {
|
|
147
147
|
if (this.managedComponents) {
|
|
148
|
-
this.managedComponents.delete(component.rootElement);
|
|
148
|
+
this.managedComponents.delete(component.rootElement ? component.rootElement : component);
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
}
|
|
@@ -13,6 +13,10 @@ import { KupDates } from '../kup-dates/kup-dates';
|
|
|
13
13
|
import { KupDatesLocales } from '../kup-dates/kup-dates-declarations';
|
|
14
14
|
import { KupDebugCategory } from '../kup-debug/kup-debug-declarations';
|
|
15
15
|
import { KupSearch } from '../kup-search/kup-search';
|
|
16
|
+
import { KupMathLocales } from '../kup-math/kup-math-declarations';
|
|
17
|
+
import { KupMath } from '../kup-math/kup-math';
|
|
18
|
+
import { KupTooltip } from '../kup-tooltip/kup-tooltip';
|
|
19
|
+
import { setAssetPath } from '@stencil/core';
|
|
16
20
|
const dom = document.documentElement;
|
|
17
21
|
/**
|
|
18
22
|
* This class controls every other Ketchup utility suite.
|
|
@@ -23,8 +27,9 @@ export class KupManager {
|
|
|
23
27
|
* Initializes KupManager.
|
|
24
28
|
*/
|
|
25
29
|
constructor(overrides) {
|
|
26
|
-
let datesLocale = null, debugActive = null, debugAutoprint = null, debugLogLimit = null, dialogRestrictContainer = null, dialogZIndex = null, languageList = null, languageName = null, objectsList = null, scrollOnHoverDelay = null, scrollOnHoverStep = null, themeList = null, themeName = null;
|
|
30
|
+
let datesLocale = null, debugActive = null, debugAutoprint = null, debugLogLimit = null, dialogRestrictContainer = null, dialogZIndex = null, languageList = null, languageName = null, objectsList = null, scrollOnHoverDelay = null, scrollOnHoverStep = null, themeList = null, themeName = null, tooltipDelay = null;
|
|
27
31
|
if (overrides) {
|
|
32
|
+
const assetsPath = overrides.assetsPath;
|
|
28
33
|
const dates = overrides.dates;
|
|
29
34
|
const debug = overrides.debug;
|
|
30
35
|
const interact = overrides.interact;
|
|
@@ -32,6 +37,10 @@ export class KupManager {
|
|
|
32
37
|
const objects = overrides.objects;
|
|
33
38
|
const scrollOnHover = overrides.scrollOnHover;
|
|
34
39
|
const theme = overrides.theme;
|
|
40
|
+
const tooltip = overrides.tooltip;
|
|
41
|
+
if (assetsPath) {
|
|
42
|
+
setAssetPath(assetsPath);
|
|
43
|
+
}
|
|
35
44
|
if (dates) {
|
|
36
45
|
datesLocale = dates.locale ? dates.locale : null;
|
|
37
46
|
}
|
|
@@ -65,6 +74,9 @@ export class KupManager {
|
|
|
65
74
|
themeList = theme.list ? theme.list : null;
|
|
66
75
|
themeName = theme.name ? theme.name : null;
|
|
67
76
|
}
|
|
77
|
+
if (tooltip) {
|
|
78
|
+
tooltipDelay = tooltip.delay ? tooltip.delay : null;
|
|
79
|
+
}
|
|
68
80
|
}
|
|
69
81
|
this.data = new KupData();
|
|
70
82
|
this.dates = new KupDates(datesLocale);
|
|
@@ -73,6 +85,7 @@ export class KupManager {
|
|
|
73
85
|
this.interact = new KupInteract(dialogZIndex, dialogRestrictContainer);
|
|
74
86
|
this.language = new KupLanguage(languageList, languageName);
|
|
75
87
|
this.magicBox = null;
|
|
88
|
+
this.math = new KupMath();
|
|
76
89
|
this.overrides = overrides ? overrides : null;
|
|
77
90
|
this.objects = new KupObjects(objectsList);
|
|
78
91
|
this.resize = new ResizeObserver((entries) => {
|
|
@@ -99,6 +112,7 @@ export class KupManager {
|
|
|
99
112
|
};
|
|
100
113
|
this.theme = new KupTheme(themeList, themeName);
|
|
101
114
|
this.toolbar = new KupToolbar();
|
|
115
|
+
this.tooltip = new KupTooltip(tooltipDelay);
|
|
102
116
|
document.addEventListener('pointerdown', (e) => {
|
|
103
117
|
const paths = e.composedPath();
|
|
104
118
|
const lastString = paths[0].innerText || paths[0].value;
|
|
@@ -198,6 +212,7 @@ export class KupManager {
|
|
|
198
212
|
}
|
|
199
213
|
this.dates.setLocale(locale);
|
|
200
214
|
this.language.set(KupLanguageDefaults[locale]);
|
|
215
|
+
this.math.setLocale(KupMathLocales[locale]);
|
|
201
216
|
}
|
|
202
217
|
/**
|
|
203
218
|
* Adds a new click callback.
|
|
@@ -237,6 +252,15 @@ export function kupManagerInstance() {
|
|
|
237
252
|
dom.ketchup.debug.toggle(dom.ketchup.debug.active);
|
|
238
253
|
}
|
|
239
254
|
globalThis.kupManager = dom.ketchup;
|
|
255
|
+
if (overrides && overrides.autoSetLocalization) {
|
|
256
|
+
const locale = dom.ketchup.dates.locale;
|
|
257
|
+
if (!overrides.language || !overrides.language.name) {
|
|
258
|
+
dom.ketchup.language.set(KupLanguageDefaults[locale]);
|
|
259
|
+
}
|
|
260
|
+
if (!overrides.math || !overrides.math.locale) {
|
|
261
|
+
dom.ketchup.math.setLocale(KupMathLocales[locale]);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
240
264
|
document.dispatchEvent(new CustomEvent('kup-manager-ready'));
|
|
241
265
|
}
|
|
242
266
|
return dom.ketchup;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Locales available for KupMath.
|
|
3
|
+
*/
|
|
4
|
+
export var KupMathLocales;
|
|
5
|
+
(function (KupMathLocales) {
|
|
6
|
+
KupMathLocales["cn"] = "chs";
|
|
7
|
+
KupMathLocales["en"] = "en";
|
|
8
|
+
KupMathLocales["es"] = "es";
|
|
9
|
+
KupMathLocales["it"] = "it";
|
|
10
|
+
KupMathLocales["fr"] = "fr";
|
|
11
|
+
KupMathLocales["pl"] = "pl";
|
|
12
|
+
KupMathLocales["ru"] = "ru";
|
|
13
|
+
})(KupMathLocales || (KupMathLocales = {}));
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { KupDebugCategory } from '../kup-debug/kup-debug-declarations';
|
|
2
|
+
const dom = document.documentElement;
|
|
3
|
+
/**
|
|
4
|
+
* Takes a mathematical formula as string in input, with column names between brackets, and returns the result as a number.
|
|
5
|
+
* @param {string} formula - Mathematical operation (i.e.: ([COL1] - [COL2]) * 100 / [COL3]).
|
|
6
|
+
* @param {{ [index: string]: number }} row - Object containing column names as indexes and the related values as keys.
|
|
7
|
+
* @returns {number} Result of the formula.
|
|
8
|
+
*/
|
|
9
|
+
export function customFormula(formula, row) {
|
|
10
|
+
const keys = Object.keys(row);
|
|
11
|
+
for (let i = 0; i < keys.length; i++) {
|
|
12
|
+
let key = keys[i];
|
|
13
|
+
let value = row[key];
|
|
14
|
+
if (value != null && !isNaN(value)) {
|
|
15
|
+
let re = new RegExp(key, 'g');
|
|
16
|
+
formula = formula.replace(re, value.toString());
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
formula = formula.replace(/[\[\]']+/g, '');
|
|
20
|
+
try {
|
|
21
|
+
const result = Function('"use strict"; return (' + formula + ')')();
|
|
22
|
+
return result;
|
|
23
|
+
}
|
|
24
|
+
catch (e) {
|
|
25
|
+
dom.ketchup.debug.logMessage('kup-data', 'Error while evaluating the following formula!(' + formula + ')', KupDebugCategory.ERROR);
|
|
26
|
+
return NaN;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Calculates a single Y point of a normal distribution.
|
|
31
|
+
* @param {number} average - Average.
|
|
32
|
+
* @param {number} variance - Variance.
|
|
33
|
+
* @param {number} x - X coordinate.
|
|
34
|
+
* @returns {number} Result.
|
|
35
|
+
*/
|
|
36
|
+
export function normalDistributionFormula(average, variance, x) {
|
|
37
|
+
return ((1 / Math.sqrt(variance * 2 * Math.PI)) *
|
|
38
|
+
Math.exp(-Math.pow(x - average, 2) / (2 * variance)));
|
|
39
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
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 { KupDebugCategory } from '../kup-debug/kup-debug-declarations';
|
|
9
|
+
import { KupMathLocales, } from './kup-math-declarations';
|
|
10
|
+
import { customFormula, normalDistributionFormula } from './kup-math-helper';
|
|
11
|
+
const dom = document.documentElement;
|
|
12
|
+
/**
|
|
13
|
+
* Handles mathematical operations and number formatting/conversion.
|
|
14
|
+
* @module KupMath
|
|
15
|
+
*/
|
|
16
|
+
export class KupMath {
|
|
17
|
+
/**
|
|
18
|
+
* Initializes KupMath.
|
|
19
|
+
*/
|
|
20
|
+
constructor(locale) {
|
|
21
|
+
this.formulas = {
|
|
22
|
+
custom(formula, row) {
|
|
23
|
+
return customFormula(formula, row);
|
|
24
|
+
},
|
|
25
|
+
normalDistribution(average, variance, x) {
|
|
26
|
+
return normalDistributionFormula(average, variance, x);
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
this.numbers = {
|
|
30
|
+
toLocaleString(value) {
|
|
31
|
+
const maximumFractionDigits = 14;
|
|
32
|
+
if (value == null || value == '')
|
|
33
|
+
return value;
|
|
34
|
+
return Number(value).toLocaleString(dom.ketchup.math.locale, {
|
|
35
|
+
maximumFractionDigits: maximumFractionDigits,
|
|
36
|
+
});
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
this.locale = locale ? locale : KupMathLocales.en;
|
|
40
|
+
this.managedComponents = new Set();
|
|
41
|
+
this.numeral = numeral;
|
|
42
|
+
this.numeral.locale(this.locale);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Sets the locale of the numeral instance. The locales available must be tied to the KupDates locales.
|
|
46
|
+
* @param {KupMathLocales} locale - Numeraljs locale string.
|
|
47
|
+
*/
|
|
48
|
+
setLocale(locale) {
|
|
49
|
+
if (!Object.values(KupMathLocales).includes(locale)) {
|
|
50
|
+
locale = KupMathLocales.en;
|
|
51
|
+
dom.ketchup.debug.logMessage('kup-math', 'Invalid locale (' + locale + ')! Defaulting to english.', KupDebugCategory.WARNING);
|
|
52
|
+
}
|
|
53
|
+
this.locale = locale;
|
|
54
|
+
this.numeral.locale(locale);
|
|
55
|
+
this.managedComponents.forEach(function (comp) {
|
|
56
|
+
if (comp.isConnected) {
|
|
57
|
+
comp.refresh();
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
document.dispatchEvent(new CustomEvent('kup-math-localechange'));
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Calculates the normal distribution on a set of values.
|
|
64
|
+
* @param {string[] | number[] | String[]} values - Array of values.
|
|
65
|
+
* @param {number} precision - Number of iterations to run (points). When not specified, defaults to 201.
|
|
66
|
+
* @returns {number[][]} Returns an array of arrays containing numbers, which are the representation of the calculated normal distribution.
|
|
67
|
+
*/
|
|
68
|
+
normalDistribution(values, precision) {
|
|
69
|
+
if (!precision) {
|
|
70
|
+
precision = 201;
|
|
71
|
+
}
|
|
72
|
+
const data = [];
|
|
73
|
+
let max = Math.max.apply(Math, values);
|
|
74
|
+
let min = Math.min.apply(Math, values);
|
|
75
|
+
let average = 0;
|
|
76
|
+
let variance = 0;
|
|
77
|
+
for (let index = 0; index < values.length; index++) {
|
|
78
|
+
const value = values[index];
|
|
79
|
+
average += this.numberify(value);
|
|
80
|
+
}
|
|
81
|
+
average = average / values.length;
|
|
82
|
+
for (let index = 0; index < values.length; index++) {
|
|
83
|
+
const value = values[index];
|
|
84
|
+
variance += Math.pow(this.numberify(value) - average, 2);
|
|
85
|
+
}
|
|
86
|
+
variance = variance / values.length;
|
|
87
|
+
if (!variance) {
|
|
88
|
+
variance = 0.001;
|
|
89
|
+
}
|
|
90
|
+
max = max + ((average / 100) * 50 + (variance / average) * 3);
|
|
91
|
+
min = min - ((average / 100) * 50 + (variance / average) * 3);
|
|
92
|
+
for (let i = 0; i < precision; i++) {
|
|
93
|
+
const x = ((max - min) * i) / precision + min;
|
|
94
|
+
data.push([
|
|
95
|
+
x,
|
|
96
|
+
this.formulas.normalDistribution(average, variance, x),
|
|
97
|
+
]);
|
|
98
|
+
}
|
|
99
|
+
return data;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Formats the input number with the specified format of the currently set locale.
|
|
103
|
+
* @param {string | String | number} input - Input number which will be automatically "numberified".
|
|
104
|
+
* @param {string} format - Desired format. Defaults to '0,0.00' (i.e.: 2,000,000.51).
|
|
105
|
+
* @returns {string} Formatted number.
|
|
106
|
+
*/
|
|
107
|
+
format(input, format) {
|
|
108
|
+
const n = this.numberify(input);
|
|
109
|
+
if (!format) {
|
|
110
|
+
const positiveN = Math.abs(n);
|
|
111
|
+
const decimals = positiveN - Math.floor(positiveN);
|
|
112
|
+
if (decimals) {
|
|
113
|
+
format = '0,0.00';
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
format = '0,0';
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
const formatted = this.numeral(n).format(format);
|
|
120
|
+
return formatted;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Returns a number from a non-specified input type between string, number, or String.
|
|
124
|
+
* @param {string | String | number} input - Input value to numberify.
|
|
125
|
+
* @param {boolean} inputIsLocalized - Numberifies assuming the input string is in the current KupMath locale's format.
|
|
126
|
+
* @returns {number} Resulting number or NaN (when not a number).
|
|
127
|
+
*/
|
|
128
|
+
numberify(input, inputIsLocalized) {
|
|
129
|
+
let n = NaN;
|
|
130
|
+
if (inputIsLocalized) {
|
|
131
|
+
n = this.numeral(input).value();
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
const locale = this.numeral.locale();
|
|
135
|
+
this.numeral.locale(KupMathLocales.en);
|
|
136
|
+
n = this.numeral(input).value();
|
|
137
|
+
this.numeral.locale(locale);
|
|
138
|
+
}
|
|
139
|
+
if (n === null) {
|
|
140
|
+
return NaN;
|
|
141
|
+
}
|
|
142
|
+
return n;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Registers a KupComponent in KupMath, in order to be properly handled whenever the locale changes.
|
|
146
|
+
* @param {any} component - The Ketchup component to be registered.
|
|
147
|
+
*/
|
|
148
|
+
register(component) {
|
|
149
|
+
this.managedComponents.add(component.rootElement ? component.rootElement : component);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Unregisters a KupComponent, so it won't be refreshed when the locale changes.
|
|
153
|
+
*
|
|
154
|
+
* @param {any} component - The component calling this function.
|
|
155
|
+
*/
|
|
156
|
+
unregister(component) {
|
|
157
|
+
if (this.managedComponents) {
|
|
158
|
+
this.managedComponents.delete(component.rootElement ? component.rootElement : component);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
@@ -285,8 +285,9 @@ export class KupObjects {
|
|
|
285
285
|
* @returns {boolean} True when the object is null or empty.
|
|
286
286
|
*/
|
|
287
287
|
isEmptyKupObj(obj) {
|
|
288
|
-
if (
|
|
288
|
+
if (this.isEmptyJsObject(obj)) {
|
|
289
289
|
return true;
|
|
290
|
+
}
|
|
290
291
|
return ((!obj.t || obj.t.trim() == '') &&
|
|
291
292
|
(!obj.p || obj.p.trim() == '') &&
|
|
292
293
|
(!obj.k || obj.k.trim() == ''));
|
|
@@ -317,4 +318,50 @@ export class KupObjects {
|
|
|
317
318
|
}
|
|
318
319
|
return dom.ketchup.dates.toDayjs(obj.k);
|
|
319
320
|
}
|
|
321
|
+
/**
|
|
322
|
+
* Check whether two JS objects are deeply equal. When the arguments aren't objects, they are tested directly for equity.
|
|
323
|
+
* @param {GenericObject} object1 - First object to test.
|
|
324
|
+
* @param {GenericObject} object2 - Second object to test.
|
|
325
|
+
* @returns {boolean} True if the objects are equal.
|
|
326
|
+
* @see https://dmitripavlutin.com/how-to-compare-objects-in-javascript/#4-deep-equality
|
|
327
|
+
*/
|
|
328
|
+
deepEqual(object1, object2) {
|
|
329
|
+
if (!(this.isJsObject(object1) && this.isJsObject(object2))) {
|
|
330
|
+
return object1 === object2;
|
|
331
|
+
}
|
|
332
|
+
const keys1 = Object.keys(object1);
|
|
333
|
+
const keys2 = Object.keys(object2);
|
|
334
|
+
if (keys1.length !== keys2.length) {
|
|
335
|
+
return false;
|
|
336
|
+
}
|
|
337
|
+
for (const key of keys1) {
|
|
338
|
+
const val1 = object1[key];
|
|
339
|
+
const val2 = object2[key];
|
|
340
|
+
const areObjects = this.isJsObject(val1) && this.isJsObject(val2);
|
|
341
|
+
if ((areObjects && !this.deepEqual(val1, val2)) ||
|
|
342
|
+
(!areObjects && val1 !== val2)) {
|
|
343
|
+
return false;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
return true;
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Check whether the argument is a JavaScript object.
|
|
350
|
+
* @param {GenericObject} object - Object to test.
|
|
351
|
+
* @returns {boolean} True if the argument is a JavaScript object.
|
|
352
|
+
* @see https://dmitripavlutin.com/how-to-compare-objects-in-javascript/#4-deep-equality
|
|
353
|
+
*/
|
|
354
|
+
isJsObject(object) {
|
|
355
|
+
return object != null && typeof object === 'object';
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Check whether the object is empty or not.
|
|
359
|
+
* @param {GenericObject} object - Object to check.
|
|
360
|
+
* @returns {boolean} True if the object is empty.
|
|
361
|
+
*/
|
|
362
|
+
isEmptyJsObject(obj) {
|
|
363
|
+
return (!obj ||
|
|
364
|
+
obj === null ||
|
|
365
|
+
(Object.keys(obj).length === 0 && obj.constructor === Object));
|
|
366
|
+
}
|
|
320
367
|
}
|
|
@@ -171,7 +171,7 @@ export class KupTheme {
|
|
|
171
171
|
* @param {any} comp - The component calling this function.
|
|
172
172
|
*/
|
|
173
173
|
register(comp) {
|
|
174
|
-
this.managedComponents.add(comp.rootElement);
|
|
174
|
+
this.managedComponents.add(comp.rootElement ? comp.rootElement : comp);
|
|
175
175
|
}
|
|
176
176
|
/**
|
|
177
177
|
* Unregisters a KupComponent, so it won't be refreshed when the theme changes.
|
|
@@ -179,7 +179,7 @@ export class KupTheme {
|
|
|
179
179
|
*/
|
|
180
180
|
unregister(comp) {
|
|
181
181
|
if (this.managedComponents) {
|
|
182
|
-
this.managedComponents.delete(comp.rootElement);
|
|
182
|
+
this.managedComponents.delete(comp.rootElement ? comp.rootElement : comp);
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
185
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
+
};
|
|
6
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
7
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
10
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11
|
+
};
|
|
12
|
+
var _KupTooltip_instances, _KupTooltip_clickCb, _KupTooltip_dynPos, _KupTooltip_create, _KupTooltip_setOptions;
|
|
13
|
+
import { KupDebugCategory } from '../kup-debug/kup-debug-declarations';
|
|
14
|
+
const dom = document.documentElement;
|
|
15
|
+
/**
|
|
16
|
+
* Handles application-wide tooltip using card component.
|
|
17
|
+
* @module KupTooltip
|
|
18
|
+
*/
|
|
19
|
+
export class KupTooltip {
|
|
20
|
+
/**
|
|
21
|
+
* Initializes KupTooltip.
|
|
22
|
+
*/
|
|
23
|
+
constructor(delay) {
|
|
24
|
+
_KupTooltip_instances.add(this);
|
|
25
|
+
this.currentAnchor = null;
|
|
26
|
+
this.delay = null;
|
|
27
|
+
this.element = null;
|
|
28
|
+
this.managedElements = null;
|
|
29
|
+
this.timeout = null;
|
|
30
|
+
_KupTooltip_clickCb.set(this, null);
|
|
31
|
+
this.delay = delay ? delay : 125;
|
|
32
|
+
this.managedElements = new Set();
|
|
33
|
+
document.addEventListener('pointermove', (e) => {
|
|
34
|
+
const paths = e.composedPath();
|
|
35
|
+
// Leaving the function when hovering on the tooltip itself
|
|
36
|
+
if (paths.includes(this.element)) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const enterHandler = (anchor) => {
|
|
40
|
+
this.timeout = null;
|
|
41
|
+
requestAnimationFrame(anchor.kupTooltip.enter.bind(anchor.kupTooltip.enter, e));
|
|
42
|
+
};
|
|
43
|
+
const overHandler = (anchor) => {
|
|
44
|
+
requestAnimationFrame(anchor.kupTooltip.over.bind(anchor.kupTooltip.over, e));
|
|
45
|
+
};
|
|
46
|
+
const leaveHandler = () => {
|
|
47
|
+
requestAnimationFrame(this.currentAnchor.kupTooltip.leave.bind(this.currentAnchor.kupTooltip.leave, e));
|
|
48
|
+
};
|
|
49
|
+
// If the current anchor exists and is not included in the event path,
|
|
50
|
+
// the leaving callback is fired.
|
|
51
|
+
if (this.currentAnchor && !paths.includes(this.currentAnchor)) {
|
|
52
|
+
if (this.timeout) {
|
|
53
|
+
clearTimeout(this.timeout);
|
|
54
|
+
this.timeout = null;
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
if (this.currentAnchor.kupTooltip.leave) {
|
|
58
|
+
leaveHandler();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
this.currentAnchor = null;
|
|
62
|
+
}
|
|
63
|
+
else if (!this.timeout) {
|
|
64
|
+
for (let index = 0; index < paths.length; index++) {
|
|
65
|
+
const element = paths[index];
|
|
66
|
+
if (this.managedElements.has(element)) {
|
|
67
|
+
// If the current anchor is the same as the registered element found
|
|
68
|
+
// in the path, the mouse over function is invoked
|
|
69
|
+
if (this.currentAnchor === element) {
|
|
70
|
+
if (element.kupTooltip.over) {
|
|
71
|
+
overHandler(element);
|
|
72
|
+
}
|
|
73
|
+
// Otherwise, the mouse enter callback will be invoked
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
this.currentAnchor = element;
|
|
77
|
+
if (element.kupTooltip.enter) {
|
|
78
|
+
if (this.delay) {
|
|
79
|
+
this.timeout = setTimeout(enterHandler.bind(enterHandler, element), this.delay);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
enterHandler(element);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
hide() {
|
|
92
|
+
if (this.element) {
|
|
93
|
+
this.element.menuVisible = false;
|
|
94
|
+
dom.ketchup.dynamicPosition.stop(this.element);
|
|
95
|
+
dom.ketchup.removeClickCallback(__classPrivateFieldGet(this, _KupTooltip_clickCb, "f"));
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
show(anchor, options) {
|
|
99
|
+
// Creates the card or updates it with new options
|
|
100
|
+
if (!this.element) {
|
|
101
|
+
__classPrivateFieldGet(this, _KupTooltip_instances, "m", _KupTooltip_create).call(this, options);
|
|
102
|
+
}
|
|
103
|
+
else if (options) {
|
|
104
|
+
__classPrivateFieldGet(this, _KupTooltip_instances, "m", _KupTooltip_setOptions).call(this, options);
|
|
105
|
+
}
|
|
106
|
+
// If an anchor was provided, initializes or updates dynamic positioning
|
|
107
|
+
if (anchor) {
|
|
108
|
+
__classPrivateFieldGet(this, _KupTooltip_instances, "m", _KupTooltip_dynPos).call(this, anchor);
|
|
109
|
+
}
|
|
110
|
+
// If the tooltip is already visible, it's pointless to go on
|
|
111
|
+
if (this.element.menuVisible) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
// If the dynamic positioning is still to be registered, a warning is thrown
|
|
115
|
+
if (!dom.ketchup.dynamicPosition.isRegistered(this.element)) {
|
|
116
|
+
dom.ketchup.debug.logMessage('kup-tooltip', 'Unable to display KupTooltip without specifying a valid anchor point.', KupDebugCategory.WARNING);
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
this.element.menuVisible = true;
|
|
120
|
+
dom.ketchup.addClickCallback(__classPrivateFieldGet(this, _KupTooltip_clickCb, "f"), true);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Returns whether an element was previously registered or not.
|
|
124
|
+
* @param {KupTooltipAnchor} element - Element to test.
|
|
125
|
+
* @returns {boolean} True if the element was registered.
|
|
126
|
+
*/
|
|
127
|
+
isRegistered(element) {
|
|
128
|
+
return !this.managedElements
|
|
129
|
+
? false
|
|
130
|
+
: this.managedElements.has(element);
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Registers an HTMLElement as KupTooltipAnchor, triggering callback invocation on mouse over.
|
|
134
|
+
* @param {KupTooltipAnchor} element - The HTML element to be registered.
|
|
135
|
+
* @param {(e: PointerEvent) => void} cbEnter - Callback invoked when hovering on the the element for the first time.
|
|
136
|
+
* @param {(e: PointerEvent) => void} cbOver - Callback invoked when hovering on the element.
|
|
137
|
+
* @param {(e: PointerEvent) => void} cbLeave - Callback invoked when leaving the element.
|
|
138
|
+
*/
|
|
139
|
+
register(element, cbEnter, cbOver, cbLeave) {
|
|
140
|
+
this.managedElements.add(element);
|
|
141
|
+
const kupTooltip = {
|
|
142
|
+
enter: cbEnter,
|
|
143
|
+
leave: cbLeave,
|
|
144
|
+
over: cbOver,
|
|
145
|
+
};
|
|
146
|
+
element.kupTooltip = kupTooltip;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Unregisters an HTMLElement, preventing its attached callback from being invoked.
|
|
150
|
+
*
|
|
151
|
+
* @param {KupTooltipAnchor} element - - The HTML element to be unregistered.
|
|
152
|
+
*/
|
|
153
|
+
unregister(element) {
|
|
154
|
+
if (this.managedElements) {
|
|
155
|
+
this.managedElements.delete(element);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
_KupTooltip_clickCb = new WeakMap(), _KupTooltip_instances = new WeakSet(), _KupTooltip_dynPos = function _KupTooltip_dynPos(anchor) {
|
|
160
|
+
if (dom.ketchup.dynamicPosition.isRegistered(this.element)) {
|
|
161
|
+
dom.ketchup.dynamicPosition.changeAnchor(this.element, anchor);
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
dom.ketchup.dynamicPosition.register(this.element, anchor, null, null, true);
|
|
165
|
+
}
|
|
166
|
+
dom.ketchup.dynamicPosition.start(this.element);
|
|
167
|
+
}, _KupTooltip_create = function _KupTooltip_create(options) {
|
|
168
|
+
this.element = document.createElement('kup-card');
|
|
169
|
+
this.element.id = 'kup-tooltip';
|
|
170
|
+
this.element.isMenu = true;
|
|
171
|
+
this.element.layoutNumber = 15;
|
|
172
|
+
this.element.sizeX = 'auto';
|
|
173
|
+
this.element.sizeY = 'auto';
|
|
174
|
+
if (options) {
|
|
175
|
+
__classPrivateFieldGet(this, _KupTooltip_instances, "m", _KupTooltip_setOptions).call(this, options);
|
|
176
|
+
}
|
|
177
|
+
document.body.appendChild(this.element);
|
|
178
|
+
__classPrivateFieldSet(this, _KupTooltip_clickCb, {
|
|
179
|
+
cb: () => {
|
|
180
|
+
this.hide();
|
|
181
|
+
},
|
|
182
|
+
el: this.element,
|
|
183
|
+
}, "f");
|
|
184
|
+
}, _KupTooltip_setOptions = function _KupTooltip_setOptions(options) {
|
|
185
|
+
for (const key in options) {
|
|
186
|
+
if (Object.prototype.hasOwnProperty.call(options, key)) {
|
|
187
|
+
const prop = options[key];
|
|
188
|
+
this.element[key] = prop;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
};
|
|
@@ -32,6 +32,7 @@ export var KupTagNames;
|
|
|
32
32
|
KupTagNames["LIST"] = "KUP-LIST";
|
|
33
33
|
KupTagNames["MAGIC_BOX"] = "KUP-MAGIC-BOX";
|
|
34
34
|
KupTagNames["NAV_BAR"] = "KUP-NAV-BAR";
|
|
35
|
+
KupTagNames["NUMERIC_PICKER"] = "KUP-NUMERIC-PICKER";
|
|
35
36
|
KupTagNames["PROBE"] = "KUP-PROBE";
|
|
36
37
|
KupTagNames["PROGRESS_BAR"] = "KUP-PROGRESS-BAR";
|
|
37
38
|
KupTagNames["QLIK"] = "KUP-QLIK";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import numeral from 'numeral';
|
|
2
1
|
import { stringToNumber, unformattedStringToFormattedStringNumber, unformattedStringToFormattedStringTime, unformattedStringToFormattedStringTimestamp, } from './utils';
|
|
3
2
|
import { KupDatesFormats } from '../managers/kup-dates/kup-dates-declarations';
|
|
4
3
|
const dom = document.documentElement;
|
|
@@ -28,9 +27,9 @@ export function getValueForDisplay2(values, column) {
|
|
|
28
27
|
}
|
|
29
28
|
export function formatToNumber(cell) {
|
|
30
29
|
if (cell.obj) {
|
|
31
|
-
return
|
|
30
|
+
return dom.ketchup.math.numberify(cell.obj.k);
|
|
32
31
|
}
|
|
33
|
-
return
|
|
32
|
+
return dom.ketchup.math.numberify(cell.value);
|
|
34
33
|
}
|
|
35
34
|
function _getCellValueForDisplay(value, column, cell) {
|
|
36
35
|
let obj = column != null ? column.obj : null;
|