@watermarkinsights/ripple 5.23.0-alpha.5 → 5.23.0-alpha.7
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/dist/cjs/{app-globals-7b533418.js → app-globals-19f6e3b0.js} +26 -17
- package/dist/cjs/{chartFunctions-97471b69.js → chartFunctions-8d17cbb8.js} +19 -1
- package/dist/cjs/{functions-71af585d.js → functions-156cc201.js} +2 -2
- package/dist/cjs/{interfaces-069f135e.js → interfaces-8419be91.js} +22 -21
- package/dist/cjs/{intl-169a8805.js → intl-789e4b6c.js} +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/priv-calendar.cjs.entry.js +1 -1
- package/dist/cjs/priv-chart-popover-old.cjs.entry.js +1 -1
- package/dist/cjs/priv-chart-popover_2.cjs.entry.js +8 -8
- package/dist/cjs/priv-option-list.cjs.entry.js +2 -2
- package/dist/cjs/ripple.cjs.js +2 -2
- package/dist/cjs/wm-action-menu_2.cjs.entry.js +2 -2
- package/dist/cjs/wm-button.cjs.entry.js +2 -2
- package/dist/cjs/wm-chart-bar.cjs.entry.js +39 -25
- package/dist/cjs/wm-chart.cjs.entry.js +3 -3
- package/dist/cjs/wm-date-range.cjs.entry.js +1 -1
- package/dist/cjs/wm-datepicker.cjs.entry.js +1 -1
- package/dist/cjs/wm-file.cjs.entry.js +1 -1
- package/dist/cjs/wm-flyout.cjs.entry.js +2 -2
- package/dist/cjs/wm-input.cjs.entry.js +2 -2
- package/dist/cjs/wm-line-chart.cjs.entry.js +3 -3
- package/dist/cjs/wm-modal-pss_3.cjs.entry.js +2 -2
- package/dist/cjs/wm-modal_3.cjs.entry.js +6 -8
- package/dist/cjs/wm-navigation_3.cjs.entry.js +2 -2
- package/dist/cjs/wm-navigator.cjs.entry.js +2 -2
- package/dist/cjs/wm-nested-select.cjs.entry.js +2 -2
- package/dist/cjs/wm-optgroup.cjs.entry.js +1 -1
- package/dist/cjs/wm-option_2.cjs.entry.js +48 -37
- package/dist/cjs/wm-pagination.cjs.entry.js +2 -2
- package/dist/cjs/wm-progress-indicator_3.cjs.entry.js +2 -2
- package/dist/cjs/wm-search.cjs.entry.js +2 -2
- package/dist/cjs/wm-snackbar.cjs.entry.js +2 -2
- package/dist/cjs/wm-tab-item_3.cjs.entry.js +1 -1
- package/dist/cjs/wm-tag-input.cjs.entry.js +2 -2
- package/dist/cjs/wm-tag-option.cjs.entry.js +1 -1
- package/dist/cjs/wm-textarea.cjs.entry.js +2 -2
- package/dist/cjs/wm-timepicker.cjs.entry.js +1 -1
- package/dist/cjs/wm-toggletip.cjs.entry.js +1 -1
- package/dist/cjs/wm-uploader.cjs.entry.js +2 -2
- package/dist/collection/components/charts/chartFunctions.js +17 -0
- package/dist/collection/components/charts/priv-chart-popover/priv-chart-popover.css +13 -13
- package/dist/collection/components/charts/priv-chart-popover/priv-chart-popover.js +5 -5
- package/dist/collection/components/charts/wm-chart-bar/wm-chart-bar.css +1 -6
- package/dist/collection/components/charts/wm-chart-bar/wm-chart-bar.js +38 -36
- package/dist/collection/components/charts/wm-chart-legend/wm-chart-legend.js +2 -2
- package/dist/collection/components/selects/wm-select/wm-select.js +46 -35
- package/dist/collection/components/wm-modal/wm-modal.js +4 -6
- package/dist/collection/dev/chart-bar.js +31 -3
- package/dist/collection/global/functions.js +2 -2
- package/dist/collection/global/global.js +25 -16
- package/dist/collection/global/interfaces.js +21 -19
- package/dist/esm/{app-globals-e00b1feb.js → app-globals-09333105.js} +26 -17
- package/dist/esm/{chartFunctions-9c95674d.js → chartFunctions-93592f14.js} +19 -2
- package/dist/esm/{functions-2cfbd8c7.js → functions-c1d5f184.js} +2 -2
- package/dist/esm/{interfaces-30d10bc0.js → interfaces-7e50d034.js} +22 -20
- package/dist/esm/{intl-23d21b06.js → intl-8c69d10b.js} +1 -1
- package/dist/esm/loader.js +2 -2
- package/dist/esm/priv-calendar.entry.js +1 -1
- package/dist/esm/priv-chart-popover-old.entry.js +1 -1
- package/dist/esm/priv-chart-popover_2.entry.js +8 -8
- package/dist/esm/priv-option-list.entry.js +2 -2
- package/dist/esm/ripple.js +2 -2
- package/dist/esm/wm-action-menu_2.entry.js +2 -2
- package/dist/esm/wm-button.entry.js +2 -2
- package/dist/esm/wm-chart-bar.entry.js +39 -25
- package/dist/esm/wm-chart.entry.js +3 -3
- package/dist/esm/wm-date-range.entry.js +1 -1
- package/dist/esm/wm-datepicker.entry.js +1 -1
- package/dist/esm/wm-file.entry.js +1 -1
- package/dist/esm/wm-flyout.entry.js +2 -2
- package/dist/esm/wm-input.entry.js +2 -2
- package/dist/esm/wm-line-chart.entry.js +3 -3
- package/dist/esm/wm-modal-pss_3.entry.js +2 -2
- package/dist/esm/wm-modal_3.entry.js +6 -8
- package/dist/esm/wm-navigation_3.entry.js +2 -2
- package/dist/esm/wm-navigator.entry.js +2 -2
- package/dist/esm/wm-nested-select.entry.js +2 -2
- package/dist/esm/wm-optgroup.entry.js +1 -1
- package/dist/esm/wm-option_2.entry.js +48 -37
- package/dist/esm/wm-pagination.entry.js +2 -2
- package/dist/esm/wm-progress-indicator_3.entry.js +2 -2
- package/dist/esm/wm-search.entry.js +2 -2
- package/dist/esm/wm-snackbar.entry.js +2 -2
- package/dist/esm/wm-tab-item_3.entry.js +1 -1
- package/dist/esm/wm-tag-input.entry.js +2 -2
- package/dist/esm/wm-tag-option.entry.js +1 -1
- package/dist/esm/wm-textarea.entry.js +2 -2
- package/dist/esm/wm-timepicker.entry.js +1 -1
- package/dist/esm/wm-toggletip.entry.js +1 -1
- package/dist/esm/wm-uploader.entry.js +2 -2
- package/dist/esm-es5/app-globals-09333105.js +1 -0
- package/dist/esm-es5/{chartFunctions-9c95674d.js → chartFunctions-93592f14.js} +1 -1
- package/dist/esm-es5/{functions-2cfbd8c7.js → functions-c1d5f184.js} +1 -1
- package/dist/esm-es5/interfaces-7e50d034.js +1 -0
- package/dist/esm-es5/{intl-23d21b06.js → intl-8c69d10b.js} +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/priv-calendar.entry.js +1 -1
- package/dist/esm-es5/priv-chart-popover-old.entry.js +1 -1
- package/dist/esm-es5/priv-chart-popover_2.entry.js +1 -1
- package/dist/esm-es5/priv-option-list.entry.js +1 -1
- package/dist/esm-es5/ripple.js +1 -1
- package/dist/esm-es5/wm-action-menu_2.entry.js +1 -1
- package/dist/esm-es5/wm-button.entry.js +1 -1
- package/dist/esm-es5/wm-chart-bar.entry.js +1 -1
- package/dist/esm-es5/wm-chart.entry.js +1 -1
- package/dist/esm-es5/wm-date-range.entry.js +1 -1
- package/dist/esm-es5/wm-datepicker.entry.js +1 -1
- package/dist/esm-es5/wm-file.entry.js +1 -1
- package/dist/esm-es5/wm-flyout.entry.js +1 -1
- package/dist/esm-es5/wm-input.entry.js +1 -1
- package/dist/esm-es5/wm-line-chart.entry.js +1 -1
- package/dist/esm-es5/wm-modal-pss_3.entry.js +1 -1
- package/dist/esm-es5/wm-modal_3.entry.js +1 -1
- package/dist/esm-es5/wm-navigation_3.entry.js +1 -1
- package/dist/esm-es5/wm-navigator.entry.js +1 -1
- package/dist/esm-es5/wm-nested-select.entry.js +1 -1
- package/dist/esm-es5/wm-optgroup.entry.js +1 -1
- package/dist/esm-es5/wm-option_2.entry.js +1 -1
- package/dist/esm-es5/wm-pagination.entry.js +1 -1
- package/dist/esm-es5/wm-progress-indicator_3.entry.js +1 -1
- package/dist/esm-es5/wm-search.entry.js +1 -1
- package/dist/esm-es5/wm-snackbar.entry.js +1 -1
- package/dist/esm-es5/wm-tab-item_3.entry.js +1 -1
- package/dist/esm-es5/wm-tag-input.entry.js +1 -1
- package/dist/esm-es5/wm-tag-option.entry.js +1 -1
- package/dist/esm-es5/wm-textarea.entry.js +1 -1
- package/dist/esm-es5/wm-timepicker.entry.js +1 -1
- package/dist/esm-es5/wm-toggletip.entry.js +1 -1
- package/dist/esm-es5/wm-uploader.entry.js +1 -1
- package/dist/ripple/{p-d5e5c55a.system.entry.js → p-086da1c5.system.entry.js} +1 -1
- package/dist/ripple/{p-b939d3cb.system.entry.js → p-0886099f.system.entry.js} +1 -1
- package/dist/ripple/{p-5cbbaf69.system.entry.js → p-08ba2a77.system.entry.js} +1 -1
- package/dist/ripple/{p-5f50c561.system.entry.js → p-0cdb5b52.system.entry.js} +1 -1
- package/dist/ripple/{p-d49676b7.system.entry.js → p-0e418fe4.system.entry.js} +1 -1
- package/dist/ripple/{p-278accdb.system.entry.js → p-0efafbd8.system.entry.js} +1 -1
- package/dist/ripple/{p-00a9e425.system.entry.js → p-17f3fa47.system.entry.js} +1 -1
- package/dist/ripple/{p-842dcfd6.entry.js → p-23f08f5a.entry.js} +1 -1
- package/dist/ripple/{p-b3092643.entry.js → p-24598e3e.entry.js} +1 -1
- package/dist/ripple/{p-e7615737.entry.js → p-24ce5997.entry.js} +1 -1
- package/dist/ripple/{p-828afdbe.entry.js → p-25043b32.entry.js} +1 -1
- package/dist/ripple/{p-10f93b97.system.entry.js → p-262d5bd5.system.entry.js} +1 -1
- package/dist/ripple/{p-bc052b23.entry.js → p-26dcc8e6.entry.js} +1 -1
- package/dist/ripple/{p-fab7195d.system.entry.js → p-275386c1.system.entry.js} +1 -1
- package/dist/ripple/p-2ae41131.entry.js +1 -0
- package/dist/ripple/{p-e7988695.system.entry.js → p-2d042b40.system.entry.js} +1 -1
- package/dist/ripple/{p-a1f2ce53.system.entry.js → p-2d5bd606.system.entry.js} +1 -1
- package/dist/ripple/p-3162b3de.entry.js +1 -0
- package/dist/ripple/{p-79ec0bb2.entry.js → p-3410da36.entry.js} +1 -1
- package/dist/ripple/{p-02b50251.entry.js → p-3436e819.entry.js} +1 -1
- package/dist/ripple/{p-e2a2f3ca.system.entry.js → p-35dfeacb.system.entry.js} +1 -1
- package/dist/ripple/{p-7e56aca4.entry.js → p-367df770.entry.js} +1 -1
- package/dist/ripple/{p-f63ef9c1.entry.js → p-3b2e7166.entry.js} +1 -1
- package/dist/ripple/{p-d522499c.entry.js → p-3de0e2b0.entry.js} +1 -1
- package/dist/ripple/{p-b200dc04.system.entry.js → p-46c77ecb.system.entry.js} +1 -1
- package/dist/ripple/{p-d28816c9.entry.js → p-48950aef.entry.js} +1 -1
- package/dist/ripple/{p-b9a55887.entry.js → p-49b75a61.entry.js} +1 -1
- package/dist/ripple/{p-30f1afd4.entry.js → p-4b813987.entry.js} +1 -1
- package/dist/ripple/{p-0a226179.entry.js → p-6434eacf.entry.js} +1 -1
- package/dist/ripple/{p-9246f0dc.js → p-6a2fb1a1.js} +1 -1
- package/dist/ripple/p-7021c38c.system.js +1 -0
- package/dist/ripple/{p-79b3dfc8.entry.js → p-724fbe77.entry.js} +1 -1
- package/dist/ripple/p-75816848.system.js +1 -0
- package/dist/ripple/{p-83a41243.system.entry.js → p-7c103a48.system.entry.js} +1 -1
- package/dist/ripple/{p-62cdc8c6.system.entry.js → p-7ec1d308.system.entry.js} +1 -1
- package/dist/ripple/{p-73f81790.entry.js → p-7f4a409e.entry.js} +1 -1
- package/dist/ripple/{p-7616ddda.system.entry.js → p-8a4d79dc.system.entry.js} +1 -1
- package/dist/ripple/p-8ac14bb1.system.js +1 -0
- package/dist/ripple/{p-acdfbdb8.system.entry.js → p-90f0283c.system.entry.js} +1 -1
- package/dist/ripple/{p-01e8cea6.entry.js → p-94842057.entry.js} +1 -1
- package/dist/ripple/{p-78524594.entry.js → p-986d1792.entry.js} +1 -1
- package/dist/ripple/{p-08063ac2.system.entry.js → p-a0b732aa.system.entry.js} +1 -1
- package/dist/ripple/{p-8f4fcdf4.system.entry.js → p-a289d92b.system.entry.js} +1 -1
- package/dist/ripple/{p-c8c8e85f.system.js → p-a402c6bb.system.js} +1 -1
- package/dist/ripple/{p-6a6e4645.system.entry.js → p-af9e6028.system.entry.js} +1 -1
- package/dist/ripple/p-b1afda53.entry.js +1 -0
- package/dist/ripple/{p-1720b84f.entry.js → p-b37fbb7e.entry.js} +1 -1
- package/dist/ripple/{p-95677d9b.entry.js → p-b589b0da.entry.js} +1 -1
- package/dist/ripple/{p-6c01961b.system.entry.js → p-bfe3c687.system.entry.js} +1 -1
- package/dist/ripple/{p-25c56231.entry.js → p-c04fad73.entry.js} +1 -1
- package/dist/ripple/{p-84d41f0e.entry.js → p-c3ba7789.entry.js} +1 -1
- package/dist/ripple/{p-07b703b6.system.entry.js → p-c5030fa3.system.entry.js} +1 -1
- package/dist/ripple/{p-d404695d.system.entry.js → p-c97b06b5.system.entry.js} +1 -1
- package/dist/ripple/{p-d13b78fd.system.entry.js → p-cd5aa832.system.entry.js} +1 -1
- package/dist/ripple/p-cda66d45.js +1 -0
- package/dist/ripple/{p-a0c4a12e.entry.js → p-d002e65f.entry.js} +1 -1
- package/dist/ripple/{p-fda4032a.system.entry.js → p-d4051c50.system.entry.js} +1 -1
- package/dist/ripple/p-d9a61605.js +1 -0
- package/dist/ripple/{p-dddeb54c.entry.js → p-d9d16c9d.entry.js} +1 -1
- package/dist/ripple/{p-79e2e6f0.system.entry.js → p-da88bdfa.system.entry.js} +1 -1
- package/dist/ripple/{p-bf42cf44.system.entry.js → p-defdef0c.system.entry.js} +1 -1
- package/dist/ripple/p-e35bebb7.system.js +1 -0
- package/dist/ripple/{p-d4fe10ec.entry.js → p-e70f1e74.entry.js} +1 -1
- package/dist/ripple/{p-719ade3d.system.entry.js → p-eee663f4.system.entry.js} +1 -1
- package/dist/ripple/{p-325393da.js → p-f031ced7.js} +1 -1
- package/dist/ripple/{p-685863a1.system.entry.js → p-f2b09954.system.entry.js} +1 -1
- package/dist/ripple/{p-c8d6b61a.system.js → p-f503991a.system.js} +1 -1
- package/dist/ripple/{p-8c0ba5b7.entry.js → p-f6844f41.entry.js} +1 -1
- package/dist/ripple/{p-5f822c17.system.entry.js → p-f91c86d2.system.entry.js} +1 -1
- package/dist/ripple/{p-ff70ddd9.entry.js → p-fc67950d.entry.js} +1 -1
- package/dist/ripple/{p-7457705b.system.entry.js → p-fce3ce5c.system.entry.js} +1 -1
- package/dist/ripple/{p-4eb3a4a9.system.entry.js → p-fe49bfb7.system.entry.js} +1 -1
- package/dist/ripple/{p-56d17ec6.js → p-fe625125.js} +1 -1
- package/dist/ripple/{p-5b0fe876.entry.js → p-ff25bdd6.entry.js} +1 -1
- package/dist/ripple/{p-a35a0e24.entry.js → p-ffa6f621.entry.js} +1 -1
- package/dist/ripple/ripple.esm.js +1 -1
- package/dist/ripple/ripple.js +1 -1
- package/dist/types/components/charts/chartFunctions.d.ts +1 -0
- package/dist/types/components/charts/priv-chart-popover/priv-chart-popover.d.ts +1 -1
- package/dist/types/components/charts/wm-chart/wm-chart.d.ts +1 -1
- package/dist/types/components/charts/wm-chart-bar/wm-chart-bar.d.ts +7 -16
- package/dist/types/components/charts/wm-progress-monitor/wm-progress-indicator.d.ts +1 -1
- package/dist/types/components/selects/wm-select/wm-select.d.ts +3 -2
- package/dist/types/components.d.ts +2 -2
- package/dist/types/global/interfaces.d.ts +13 -5
- package/package.json +2 -2
- package/dist/esm-es5/app-globals-e00b1feb.js +0 -1
- package/dist/esm-es5/interfaces-30d10bc0.js +0 -1
- package/dist/ripple/p-1eae5841.entry.js +0 -1
- package/dist/ripple/p-30a65553.system.js +0 -1
- package/dist/ripple/p-38a6a099.system.js +0 -1
- package/dist/ripple/p-7f333b52.entry.js +0 -1
- package/dist/ripple/p-98b9e488.js +0 -1
- package/dist/ripple/p-b7f12170.entry.js +0 -1
- package/dist/ripple/p-c9e6cb3d.system.js +0 -1
- package/dist/ripple/p-d6effc35.system.js +0 -1
- package/dist/ripple/p-f210f4ff.js +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { h, Host } from "@stencil/core";
|
|
2
|
-
import {
|
|
3
|
-
import { formatDisplayValue, suffixNumber, renderInstructionsText, findLargestNiceInterval, getMaxTicks, } from "../chartFunctions";
|
|
2
|
+
import { chartPalettes, } from "../../../global/interfaces";
|
|
3
|
+
import { formatDisplayValue, suffixNumber, renderInstructionsText, findLargestNiceInterval, getMaxTicks, findNiceRoundNumber, } from "../chartFunctions";
|
|
4
4
|
import { chartMessages } from "../../../global/intl";
|
|
5
5
|
import { isElOrChild } from "../../../global/functions";
|
|
6
6
|
export class ChartBar {
|
|
@@ -21,10 +21,10 @@ export class ChartBar {
|
|
|
21
21
|
var _a, _b, _c, _d;
|
|
22
22
|
let palette = ["wmcolor-dataviz-discrete-01"]; // default to single color
|
|
23
23
|
if (((_a = this.config) === null || _a === void 0 ? void 0 : _a.colors) === "semantic") {
|
|
24
|
-
palette =
|
|
24
|
+
palette = chartPalettes.semantic;
|
|
25
25
|
}
|
|
26
26
|
else if (((_b = this.config) === null || _b === void 0 ? void 0 : _b.colors) == "discrete") {
|
|
27
|
-
palette =
|
|
27
|
+
palette = chartPalettes.discrete;
|
|
28
28
|
}
|
|
29
29
|
else if ((_d = (_c = this.config) === null || _c === void 0 ? void 0 : _c.colors) === null || _d === void 0 ? void 0 : _d.startsWith("wmcolor-")) {
|
|
30
30
|
palette = [this.config.colors];
|
|
@@ -43,6 +43,10 @@ export class ChartBar {
|
|
|
43
43
|
var _a;
|
|
44
44
|
return this.subinfo || ((_a = this.config) === null || _a === void 0 ? void 0 : _a.subinfo) || "";
|
|
45
45
|
}
|
|
46
|
+
get gridVisible() {
|
|
47
|
+
var _a, _b, _c;
|
|
48
|
+
return !!this.gridInfo && ((_a = this.config) === null || _a === void 0 ? void 0 : _a.gridMax) != undefined && ((_c = (_b = this.config) === null || _b === void 0 ? void 0 : _b.showGrid) !== null && _c !== void 0 ? _c : true);
|
|
49
|
+
}
|
|
46
50
|
// #endregion getters
|
|
47
51
|
////////////////////////////////////////////////////////////
|
|
48
52
|
// #region Component lifecycle
|
|
@@ -63,10 +67,16 @@ export class ChartBar {
|
|
|
63
67
|
if (this.config && this.data) {
|
|
64
68
|
const itemTotal = this.data.reduce((acc, item) => acc + item.amount, 0);
|
|
65
69
|
const largest = Math.max(...this.data.map((item) => item.amount));
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
+
if (this.config.gridMax == "auto") {
|
|
71
|
+
this.gridMax = findNiceRoundNumber(largest);
|
|
72
|
+
}
|
|
73
|
+
else if (!!this.config.gridMax) {
|
|
74
|
+
this.gridMax = this.config.gridMax;
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
// fallback to 1 and chart should not render
|
|
78
|
+
this.gridMax = 1;
|
|
79
|
+
}
|
|
70
80
|
const processedItems = this.processItems(itemTotal);
|
|
71
81
|
if (this.sort === "ascending") {
|
|
72
82
|
processedItems.sort((a, b) => a.amount - b.amount);
|
|
@@ -80,6 +90,9 @@ export class ChartBar {
|
|
|
80
90
|
}
|
|
81
91
|
processItems(itemTotal) {
|
|
82
92
|
var _a, _b;
|
|
93
|
+
if (!this.data) {
|
|
94
|
+
return [];
|
|
95
|
+
}
|
|
83
96
|
const valueFormat = ((_a = this.config) === null || _a === void 0 ? void 0 : _a.valueFormat) || "amount"; // default to amount
|
|
84
97
|
const printModeFormat = ((_b = this.config) === null || _b === void 0 ? void 0 : _b.printModeFormat) || "amount"; // default to amount
|
|
85
98
|
const defaultColor = "wmcolor-dataviz-discrete-01";
|
|
@@ -102,7 +115,7 @@ export class ChartBar {
|
|
|
102
115
|
}
|
|
103
116
|
propogateExternalLegendData() {
|
|
104
117
|
document.querySelectorAll("wm-chart-legend").forEach((legend) => {
|
|
105
|
-
if (legend.chartIds.includes(this.el.id)) {
|
|
118
|
+
if (legend.chartIds.split(" ").includes(this.el.id)) {
|
|
106
119
|
legend.processedData = this.processedData;
|
|
107
120
|
}
|
|
108
121
|
});
|
|
@@ -170,21 +183,15 @@ export class ChartBar {
|
|
|
170
183
|
this.highlightBar(idx);
|
|
171
184
|
}
|
|
172
185
|
}
|
|
173
|
-
|
|
186
|
+
handleLegendItemClick(ev) {
|
|
174
187
|
if (ev.target.nodeName === "WM-CHART-LEGEND") {
|
|
175
|
-
//
|
|
188
|
+
// If event from an internal legend bubbles up to the chart, ignore it
|
|
176
189
|
const legendEl = ev.target;
|
|
177
190
|
if (legendEl.chartIds.includes(this.el.id)) {
|
|
178
191
|
this.highlightBar(ev.detail.idx);
|
|
179
192
|
}
|
|
180
193
|
}
|
|
181
194
|
}
|
|
182
|
-
handleInternalLegendItemClick(ev) {
|
|
183
|
-
const legendEl = ev.target;
|
|
184
|
-
if (legendEl.chartIds.includes(this.el.id)) {
|
|
185
|
-
this.highlightBar(ev.detail.idx);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
195
|
handleDocumentClick(_ev) {
|
|
189
196
|
// Clear highlights when highlight is set from an external legend (not opening a popover)
|
|
190
197
|
if (!this.popoverEl.open) {
|
|
@@ -219,7 +226,7 @@ export class ChartBar {
|
|
|
219
226
|
y: barToFocus.getBoundingClientRect().top + cornerOffset,
|
|
220
227
|
});
|
|
221
228
|
}
|
|
222
|
-
|
|
229
|
+
handlePopoverToggled(_ev) {
|
|
223
230
|
setTimeout(() => {
|
|
224
231
|
// allow time for the popover to reopen if the click that closed it was on a bar, to prevent flash
|
|
225
232
|
if (this.popoverEl.open) {
|
|
@@ -231,6 +238,9 @@ export class ChartBar {
|
|
|
231
238
|
}, 30);
|
|
232
239
|
}
|
|
233
240
|
openPopover(clickedProcessedData, coords) {
|
|
241
|
+
if (!this.data || !this.config) {
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
234
244
|
let matchingChartData = this.data.find((item) => item.barLegend === clickedProcessedData.barLegend);
|
|
235
245
|
if (matchingChartData) {
|
|
236
246
|
this.popoverEl.chartData = matchingChartData;
|
|
@@ -262,7 +272,6 @@ export class ChartBar {
|
|
|
262
272
|
clearFocus() {
|
|
263
273
|
if (this.popoverEl.open) {
|
|
264
274
|
this.popoverEl.open = false;
|
|
265
|
-
console.log("popover closed from clearFocus: ", this.popoverEl.open);
|
|
266
275
|
}
|
|
267
276
|
this.clearHighlights();
|
|
268
277
|
}
|
|
@@ -274,6 +283,9 @@ export class ChartBar {
|
|
|
274
283
|
return this.processedData.map((item) => (h("div", { key: `legend-${item.barLegend}`, class: "bar-legend" }, item.barLegend)));
|
|
275
284
|
}
|
|
276
285
|
renderBars() {
|
|
286
|
+
if (!this.gridInfo || !this.processedData) {
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
277
289
|
// Use effective grid max (numTicks * interval) for accurate bar sizing
|
|
278
290
|
const effectiveGridMax = this.gridInfo.numTicks * this.gridInfo.interval;
|
|
279
291
|
return this.processedData.map((item, idx) => {
|
|
@@ -287,17 +299,19 @@ export class ChartBar {
|
|
|
287
299
|
_a.tickLabels.map((label) => (h("div", { class: "tick", key: label }, h("span", null, label))))));
|
|
288
300
|
}
|
|
289
301
|
renderGrid() {
|
|
290
|
-
|
|
302
|
+
var _a;
|
|
303
|
+
const backgroundSize = (_a = this.gridInfo) === null || _a === void 0 ? void 0 : _a.backgroundSize;
|
|
304
|
+
return h("div", { class: "grid-lines", style: { "--background-size": backgroundSize } });
|
|
291
305
|
}
|
|
292
306
|
renderLegend(orientation) {
|
|
293
307
|
var _a, _b, _c;
|
|
294
|
-
return (h("div", { class: `legend --${orientation} --${this.showLegend}` }, h("wm-chart-legend", { orientation: orientation, chartIds: this.el.id, processedData: this.processedData, printMode: (_c = (_a = this.printMode) !== null && _a !== void 0 ? _a : (_b = this.config) === null || _b === void 0 ? void 0 : _b.printMode) !== null && _c !== void 0 ? _c : false, onWmLegendItemClick: (ev) => this.
|
|
308
|
+
return (h("div", { class: `legend --${orientation} --${this.showLegend}` }, h("wm-chart-legend", { orientation: orientation, chartIds: this.el.id, processedData: this.processedData, printMode: (_c = (_a = this.printMode) !== null && _a !== void 0 ? _a : (_b = this.config) === null || _b === void 0 ? void 0 : _b.printMode) !== null && _c !== void 0 ? _c : false, onWmLegendItemClick: (ev) => this.handleLegendItemClick(ev) })));
|
|
295
309
|
}
|
|
296
310
|
// #endregion rendering
|
|
297
311
|
render() {
|
|
298
312
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
299
313
|
const rowCount = this.processedData.length || 1;
|
|
300
|
-
return (h(Host, { key: '
|
|
314
|
+
return (h(Host, { key: '25ef2866c614550701343844dc090c2196317bf3' }, h("div", { key: '5012a4e3e9326abff99b9130dc9fd141d0114dd2', class: "component-wrapper", tabindex: "0", role: "application", onKeyDown: (ev) => this.handleChartKeyDown(ev), onBlur: (ev) => this.handleComponentBlur(ev), "aria-roledescription": chartMessages.interactiveChart, "aria-describedby": "chart-instructions", "aria-label": (_a = this.config) === null || _a === void 0 ? void 0 : _a.label }, h("div", { key: '02247b94279f67f82614da4e18c0797c7c474a31', class: "popover-wrapper" }, h("priv-chart-popover", { key: 'cb0ff3aa92bd15f39efd9d89f23595804063c12e', ref: (el) => (this.popoverEl = el), onIntChartPopoverToggled: (ev) => this.handlePopoverToggled(ev) })), ((_c = (_b = this.config) === null || _b === void 0 ? void 0 : _b.showLabel) !== null && _c !== void 0 ? _c : true) && (h("label", { key: 'd0b96650b5eabf977528d6c172623c42368d59ad', id: "label", class: "label" }, h("span", { key: '19f5401c9d400abcd0c235937cdcf36397b87a13', class: "label-text" }, (_d = this.config) === null || _d === void 0 ? void 0 : _d.label), this.subinfoText ? h("span", { class: "subinfo" }, this.subinfoText) : "")), this.showLegend === "top" && this.renderLegend("horizontal"), h("div", { key: '65f5c1c4509ece96afe38e450afdf247a5707017', class: "chart-wrapper" }, h("div", { key: '84889144d8cfc1499f756ee507f74c53019b321d', class: "chart-left-side" }, this.showLegend === "left" && this.renderLegend("vertical"), h("div", { key: '4a26740efcf32dddaa0dc858d7e6f9ccd0ecafe4', class: "category-axis-label" }, h("span", { key: '52085b0bc973c4ffa0d1b39eac5ad5ae94051e66', class: "axis-label-text" }, (_e = this.config) === null || _e === void 0 ? void 0 : _e.categoryAxisLabel))), h("div", { key: '6c3da024ac970921a432d7ebbb8c959375cea841', class: "chart-center" }, h("div", { key: 'bc769c8d38e10be0533ce16acc199f5e7892bd86', class: "chart-area", style: { "--row-count": rowCount.toString() } }, this.processedData && this.renderBarLegends(), h("div", { key: 'c7492058e017606d1363007efc5030ff6f51b06b', class: `bar-area ${this.isKeying ? "user-is-keying" : ""}`, ref: (el) => (this.barAreaEl = el) }, this.gridVisible && this.renderGrid(), ((_f = this.config) === null || _f === void 0 ? void 0 : _f.gridMax) != undefined && this.renderBars())), h("div", { key: 'db4a916f0538f8803072bd529f1af4b6c259cb75', class: "value-axis-label" }, h("span", { key: '48d215befd2f8f999b9c6beffbb3284f59971c46', class: "axis-label-text" }, (_g = this.config) === null || _g === void 0 ? void 0 : _g.valueAxisLabel)), this.gridVisible && this.renderXAxis()), h("div", { key: '816f3e01ba832d4dc540de68af6f2ccab2d88c5c', class: "chart-right-side" }, this.showLegend === "right" && this.renderLegend("vertical"))), this.showLegend === "bottom" && this.renderLegend("horizontal"), renderInstructionsText())));
|
|
301
315
|
}
|
|
302
316
|
static get is() { return "wm-chart-bar"; }
|
|
303
317
|
static get encapsulation() { return "shadow"; }
|
|
@@ -318,7 +332,7 @@ export class ChartBar {
|
|
|
318
332
|
"mutable": false,
|
|
319
333
|
"complexType": {
|
|
320
334
|
"original": "ChartConfig",
|
|
321
|
-
"resolved": "undefined | { label: string;
|
|
335
|
+
"resolved": "undefined | { label: string; showLabel: boolean; valueAxisLabel: string; categoryAxisLabel: string; printMode: boolean; printModeFormat: \"amount\" | \"percentage\"; gridMax: number | \"auto\"; sort?: \"ascending\" | \"descending\" | \"none\" | undefined; showLegend?: \"top\" | \"bottom\" | \"left\" | \"right\" | \"none\" | undefined; showGrid?: boolean | undefined; subinfo?: string | undefined; valueFormat?: \"amount\" | \"percentage\" | \"none\" | undefined; colors?: string | undefined; popoverTitle?: string | undefined; popoverText?: string | undefined; popoverButtonText?: string | undefined; }",
|
|
322
336
|
"references": {
|
|
323
337
|
"ChartConfig": {
|
|
324
338
|
"location": "import",
|
|
@@ -432,7 +446,7 @@ export class ChartBar {
|
|
|
432
446
|
static get listeners() {
|
|
433
447
|
return [{
|
|
434
448
|
"name": "wmLegendItemClick",
|
|
435
|
-
"method": "
|
|
449
|
+
"method": "handleLegendItemClick",
|
|
436
450
|
"target": "document",
|
|
437
451
|
"capture": false,
|
|
438
452
|
"passive": false
|
|
@@ -448,24 +462,12 @@ export class ChartBar {
|
|
|
448
462
|
"target": "window",
|
|
449
463
|
"capture": false,
|
|
450
464
|
"passive": false
|
|
451
|
-
}, {
|
|
452
|
-
"name": "wmUserIsTabbing",
|
|
453
|
-
"method": "handleUserIsKeying",
|
|
454
|
-
"target": "window",
|
|
455
|
-
"capture": false,
|
|
456
|
-
"passive": false
|
|
457
465
|
}, {
|
|
458
466
|
"name": "wmUserIsNotKeying",
|
|
459
467
|
"method": "handleUserIsNotKeying",
|
|
460
468
|
"target": "window",
|
|
461
469
|
"capture": false,
|
|
462
470
|
"passive": false
|
|
463
|
-
}, {
|
|
464
|
-
"name": "wmUserIsNotTabbing",
|
|
465
|
-
"method": "handleUserIsNotKeying",
|
|
466
|
-
"target": "window",
|
|
467
|
-
"capture": false,
|
|
468
|
-
"passive": false
|
|
469
471
|
}];
|
|
470
472
|
}
|
|
471
473
|
}
|
|
@@ -7,7 +7,7 @@ export class ChartLegend {
|
|
|
7
7
|
this.printMode = false;
|
|
8
8
|
}
|
|
9
9
|
handleChartBarHighlighted(ev) {
|
|
10
|
-
if (this.chartIds.includes(ev.target.id)) {
|
|
10
|
+
if (this.chartIds.split(" ").includes(ev.target.id)) {
|
|
11
11
|
this.highlightLegendItem(ev.detail.idx);
|
|
12
12
|
}
|
|
13
13
|
}
|
|
@@ -29,7 +29,7 @@ export class ChartLegend {
|
|
|
29
29
|
return this.processedData.map((item, idx) => (h("div", { class: "legend-item", key: item.barLegend, onClick: () => this.handleLegendItemClick(idx) }, h("div", { class: "color", style: { "--color": `var(--${item.color})` } }), h("div", { class: "label" }, item.barLegend), h("span", { class: `print-value ${this.printMode ? "force-visible" : ""}` }, "(", item.printValue, ")"))));
|
|
30
30
|
}
|
|
31
31
|
render() {
|
|
32
|
-
return (h(Host, { key: '
|
|
32
|
+
return (h(Host, { key: 'f8c8c56e0a679b0f8ba7cb3af815276cb766b2fc' }, h("div", { key: '6d1a25c5b967ca52eed5653e850e9348146162e4', class: `legend-container --${this.orientation}` }, this.renderLegendItems())));
|
|
33
33
|
}
|
|
34
34
|
static get is() { return "wm-chart-legend"; }
|
|
35
35
|
static get encapsulation() { return "shadow"; }
|
|
@@ -7,11 +7,8 @@ export class Select {
|
|
|
7
7
|
this.scrollableParents = [];
|
|
8
8
|
this.returnFocus = false;
|
|
9
9
|
this.hasAnchor = CSS.supports("top", "anchor(bottom)"); // for FF polyfill
|
|
10
|
-
//////////////////////////////////////
|
|
11
|
-
// for multiselect button text
|
|
12
|
-
this.overflowCount = 0;
|
|
13
10
|
this.displayedOptions = [];
|
|
14
|
-
this.
|
|
11
|
+
this.oldDisplayText = "";
|
|
15
12
|
this.debouncedReposition = debounce(() => {
|
|
16
13
|
this.dropdownPosition();
|
|
17
14
|
}, 100);
|
|
@@ -39,6 +36,9 @@ export class Select {
|
|
|
39
36
|
// string "false" needs to be treated as bool False because react wrappers convert bool to string.
|
|
40
37
|
return toBool(this.disabled);
|
|
41
38
|
}
|
|
39
|
+
get displayText() {
|
|
40
|
+
return this.displayedOptions.map((x) => x.textContent).join(", ");
|
|
41
|
+
}
|
|
42
42
|
get selectedOptions() {
|
|
43
43
|
return Array.from(this.el.querySelectorAll("wm-option")).filter((x) => x.selected);
|
|
44
44
|
}
|
|
@@ -274,22 +274,27 @@ export class Select {
|
|
|
274
274
|
this.announcement = message;
|
|
275
275
|
}
|
|
276
276
|
handleOverflow() {
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
this.overflowCount
|
|
290
|
-
this.
|
|
291
|
-
|
|
292
|
-
optionsTotalWidth
|
|
277
|
+
if (!this.buttonEl) {
|
|
278
|
+
forceUpdate(this.el);
|
|
279
|
+
}
|
|
280
|
+
else {
|
|
281
|
+
// handle overflow + counter for multiselect
|
|
282
|
+
// this is a fixed measurement accounting for the max width of a 3 character overflow counter
|
|
283
|
+
const overflowCounterWidth = 38;
|
|
284
|
+
const computedStyle = window.getComputedStyle(this.buttonEl);
|
|
285
|
+
// there seems to be no quick way to get an elements width without padding, except for subtracting padding manually
|
|
286
|
+
const paddingLeft = parseInt(computedStyle.getPropertyValue("padding-left").slice(0, -2));
|
|
287
|
+
const paddingRight = parseInt(computedStyle.getPropertyValue("padding-right").slice(0, -2));
|
|
288
|
+
const availableSpace = this.buttonEl.clientWidth - paddingLeft - paddingRight - overflowCounterWidth;
|
|
289
|
+
this.overflowCount = 0;
|
|
290
|
+
this.measurementAreaEl.textContent = this.displayText;
|
|
291
|
+
let optionsTotalWidth = this.measurementAreaEl.clientWidth;
|
|
292
|
+
while (optionsTotalWidth > availableSpace && this.displayedOptions.length > 1) {
|
|
293
|
+
this.overflowCount++;
|
|
294
|
+
this.displayedOptions.pop();
|
|
295
|
+
this.measurementAreaEl.textContent = this.displayText;
|
|
296
|
+
optionsTotalWidth = this.measurementAreaEl.clientWidth;
|
|
297
|
+
}
|
|
293
298
|
}
|
|
294
299
|
}
|
|
295
300
|
setButtonText() {
|
|
@@ -299,28 +304,34 @@ export class Select {
|
|
|
299
304
|
}
|
|
300
305
|
else {
|
|
301
306
|
this.displayedOptions = this.childOptions.filter((x) => x.selected);
|
|
302
|
-
const hasChanged = this.
|
|
307
|
+
const hasChanged = this.displayText !== this.oldDisplayText;
|
|
303
308
|
const noDisplayedOptions = this.displayedOptions.length < 1;
|
|
304
309
|
if (noDisplayedOptions) {
|
|
310
|
+
this.overflowCount = 0;
|
|
305
311
|
return this.placeholder;
|
|
306
312
|
}
|
|
307
|
-
else if (!this.buttonEl) {
|
|
308
|
-
forceUpdate(this.el);
|
|
309
|
-
return "";
|
|
310
|
-
}
|
|
311
313
|
else if (hasChanged) {
|
|
312
314
|
this.handleOverflow();
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
315
|
+
if (this.allSelected) {
|
|
316
|
+
// we want all selected message only if there's an overflow.
|
|
317
|
+
if (!this.overflowCount) {
|
|
318
|
+
// but on first render we don't know: handleOverflow can't calculate measurements
|
|
319
|
+
// in that case, display all selected message even if there's a chance options could have been shown
|
|
320
|
+
this.buttonText = this.allSelectedMessage;
|
|
321
|
+
}
|
|
322
|
+
else if (this.overflowCount > 0)
|
|
323
|
+
// if calc could be made and there is an overflow, reset it as it shouldn't be shown
|
|
324
|
+
this.overflowCount = 0;
|
|
325
|
+
// then display all selected message
|
|
317
326
|
this.buttonText = this.allSelectedMessage;
|
|
318
327
|
}
|
|
319
328
|
else {
|
|
320
|
-
|
|
329
|
+
// otherwise, if handleOverflow was able to calculate, it set the count and the display text
|
|
330
|
+
// if it wasn't able to calculate, the text of all the selected options will be displayed and may truncate (acceptable as fallback)
|
|
331
|
+
this.buttonText = this.displayText;
|
|
321
332
|
}
|
|
322
333
|
}
|
|
323
|
-
this.
|
|
334
|
+
this.oldDisplayText = this.displayText;
|
|
324
335
|
// the reason for setting a global variable and returning it
|
|
325
336
|
// is that we need the stored value when displayedOptions haven't changed.
|
|
326
337
|
return this.buttonText; // multiselect value
|
|
@@ -333,14 +344,14 @@ export class Select {
|
|
|
333
344
|
}
|
|
334
345
|
render() {
|
|
335
346
|
const showSubinfo = !this.multiple && this.selectedOptions.length > 0 && this.selectedOptions[0].subinfo;
|
|
336
|
-
return (h(Host, { key: '
|
|
347
|
+
return (h(Host, { key: 'b9e427db71b61d4731a3c8c31826358efb2e71c9', onBlur: (ev) => this.handleComponentBlur(ev) }, h("div", { key: '6a8ad960dfcf56ba23736c5dc7306517a0f4cc61', class: `wrapper ${getTextDir()} label-${this.labelPosition} ${this.errorMessage ? "invalid" : ""}` }, h("div", { key: 'a1829bc5949a9e75629bb645ab63331af4ae71f1', class: "label-wrapper" }, h("label", { key: '329944256ca0c0a76881b03192579849106fc0b8', class: "label", id: "label", htmlFor: "selectbtn", onMouseEnter: (ev) => this.handleLabelMouseEnter(ev), onMouseLeave: () => hideTooltip() }, this.label),
|
|
337
348
|
// we can't use aria-required because the listbox is in a sub-component and it is not announced
|
|
338
|
-
this.requiredField && (h("span", { key: '
|
|
349
|
+
this.requiredField && (h("span", { key: '5a7d128c99b2eb064c038aecca4097304775b94c', class: "required" }, h("span", { key: 'fea081b4029d61add6f8a1a6743e30eb64329f89', class: "sr-only" }, globalMessages.requiredField), h("span", { key: 'a8f8fd3695883555ccfdf1d63a56aa0b54472ac7', "aria-hidden": "true" }, "*")))), h("div", { key: 'd8c783d92db1f7599ad431ff14069d26f335efee', class: "button-wrapper" }, h("button", { key: '56a36ae5267f5323a595f411d9a4a7257e04ede1', id: "selectbtn", disabled: this.isDisabled, "aria-labelledby": "label selectbtn", "aria-describedby": "error", popoverTarget: "dropdown", popoverTargetAction: "toggle", class: "displayedoption", ref: (el) => (this.buttonEl = el) }, h("span", { key: 'f026cf1c1f331ef84253a55df3308e518e8c38ed', class: `overflowcontrol ${showSubinfo ? "hassubinfo" : ""}` }, h("span", { key: 'c48385d25e0ac06b1faa8b5760949c4e3872a6c1', class: "button-text" }, this.setButtonText()), showSubinfo && h("span", { key: 'd47f6e6ccb3dfda11fdfd74c3880038a3582f593', class: "subinfo" }, this.selectedOptions[0].subinfo)), h("div", { key: 'ec2f38fce7005421341b176bbb9a07a2f4f930f2', class: `expand-icon svg-icon ${this.isExpanded ? "svg-expand-less" : "svg-expand-more"}` }), this.renderOverflowCount(), h("div", { key: '76e51beef029574af384673324937b78631baac0', ref: (el) => (this.measurementAreaEl = el), class: "measurement-area", "aria-hidden": "true" })), h("div", { key: '5ada44373bccb9ff83b8d33d5454f197fdbcece2',
|
|
339
350
|
// is-open is for the CSS transition in modern browsers
|
|
340
351
|
// hidden is to wait for position calculations in Firefox
|
|
341
352
|
class: `dropdown ${this.isExpanded ? "is-open" : ""} ${this.isHidden ? "hidden" : ""} ${this.openUp ? "upward" : ""}`, id: "dropdown", popover: "auto", ref: (el) => (this.dropdownEl = el),
|
|
342
353
|
// @ts-ignore -- don't tell typescript but we're in the future
|
|
343
|
-
onToggle: (ev) => this.handleToggle(ev) }, h("priv-option-list", { key: '
|
|
354
|
+
onToggle: (ev) => this.handleToggle(ev) }, h("priv-option-list", { key: '85262c7c088219e1bb7e50953c4fd058d8750a12', ref: (el) => (this.optionListEl = el), multiple: this.multiple, search: this.search, selectAll: this.selectAll, maxHeight: this.maxHeight, searchPlaceholder: this.searchPlaceholder, onOptionListCloseRequested: () => {
|
|
344
355
|
this.dropdownEl.hidePopover();
|
|
345
356
|
}, onOptionListAllSelected: () => {
|
|
346
357
|
this.returnFocus = true;
|
|
@@ -348,7 +359,7 @@ export class Select {
|
|
|
348
359
|
}, onOptionListAllDeselected: () => {
|
|
349
360
|
this.returnFocus = true;
|
|
350
361
|
this.wmSelectAllDeselected.emit();
|
|
351
|
-
} }, h("slot", { key: '
|
|
362
|
+
} }, h("slot", { key: '66b4a65b4477b82cb8e0073cc49842e4d2a9e724' }))), h("div", { key: 'a3e19f185805e5ce1818fbc101e8e41ebeda3b8d', id: "error", class: this.errorMessage ? "error-message" : "" }, this.errorMessage), h("div", { key: 'e524c3fdfc16d96750e7ddfa84207fb92803b648', id: "announcement", "aria-live": "polite", "aria-atomic": "true", class: "sr-only", ref: (el) => (this.liveRegionEl = el) }, this.announcement)))));
|
|
352
363
|
}
|
|
353
364
|
static get is() { return "wm-select"; }
|
|
354
365
|
static get encapsulation() { return "shadow"; }
|
|
@@ -31,10 +31,8 @@ export class Modal {
|
|
|
31
31
|
return customElementToFocus;
|
|
32
32
|
}
|
|
33
33
|
get hasBrowserPopoverSupport() {
|
|
34
|
-
//
|
|
35
|
-
|
|
36
|
-
//@ts-ignore
|
|
37
|
-
return tooltipEl ? !!tooltipEl.showPopover : false;
|
|
34
|
+
// For browsers without popover support, render a fallback tooltip inside the dialog so it appears above it
|
|
35
|
+
return typeof HTMLElement.prototype.showPopover === 'function';
|
|
38
36
|
}
|
|
39
37
|
toggleModal() {
|
|
40
38
|
this.open ? this.showModal() : this.hideModal();
|
|
@@ -116,11 +114,11 @@ export class Modal {
|
|
|
116
114
|
}
|
|
117
115
|
}
|
|
118
116
|
render() {
|
|
119
|
-
return (h("dialog", { key: '
|
|
117
|
+
return (h("dialog", { key: '633554a1b1e5df10d410e1c31e2f960642718e57', class: `${"wm-" + this.modalType}`, "aria-labelledby": `wm-modal-heading-text-${this.uid}`, ref: (el) => (this.dialogEl = el), onKeyDown: (ev) => this.handleKeyDown(ev) }, h("div", { key: '3d6d3bbce8760bfb1e642771f534b1d603f6a74b', class: "tabtrap sr-only", tabindex: "0", onFocus: (ev) => {
|
|
120
118
|
const focusedFromCloseButton = ev.relatedTarget && ev.relatedTarget == this.closeButtonEl;
|
|
121
119
|
// no related target means we're coming from outside the page (browser chrome), and first element should be focused instead
|
|
122
120
|
focusedFromCloseButton ? this.focusLastElement.emit() : this.focusFirstElement.emit();
|
|
123
|
-
} }), !this.hasBrowserPopoverSupport && h("div", { key: '
|
|
121
|
+
} }), !this.hasBrowserPopoverSupport && h("div", { key: '7c660029e60f4b8df004dd3b830025f047710ccc', class: "wm-tooltip" }), h("slot", { key: '7779d237802e80dd2c7f84516bd1327438813ce2' }), h("div", { key: 'eb2fa33d5fdae1b8c41102380471c593b10e1826', class: "tabtrap sr-only", tabindex: "0", onFocus: () => {
|
|
124
122
|
this.focusFirstElement.emit();
|
|
125
123
|
} })));
|
|
126
124
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const barChart1 = document.getElementById("bar-chart-1");
|
|
2
|
+
const barChart2 = document.getElementById("bar-chart-2");
|
|
2
3
|
|
|
3
4
|
// Event listener for popover button triggered
|
|
4
5
|
barChart1.addEventListener("wmPopoverButtonClick", (ev) => {
|
|
@@ -6,19 +7,22 @@ barChart1.addEventListener("wmPopoverButtonClick", (ev) => {
|
|
|
6
7
|
document.body.style.backgroundColor = `var(--${ev.detail.color})`;
|
|
7
8
|
});
|
|
8
9
|
|
|
10
|
+
barChart2.addEventListener("wmPopoverButtonClick", (ev) => {
|
|
11
|
+
console.log("wmPopoverButtonClick: ", ev.detail);
|
|
12
|
+
document.body.style.backgroundColor = `var(--${ev.detail.color})`;
|
|
13
|
+
});
|
|
14
|
+
|
|
9
15
|
// Setup chart data
|
|
10
16
|
setTimeout(() => {
|
|
11
17
|
|
|
12
18
|
barChart1.config = {
|
|
13
19
|
label: "Number of Students by Department",
|
|
14
20
|
subinfo: "University of Education",
|
|
15
|
-
labelPosition: "top",
|
|
16
|
-
labelWidth: "150px",
|
|
17
21
|
valueAxisLabel: "Students",
|
|
18
22
|
categoryAxisLabel: "University Departments",
|
|
19
23
|
printMode: true,
|
|
20
24
|
printModeFormat: "percentage",
|
|
21
|
-
gridMax:
|
|
25
|
+
gridMax: 2000,
|
|
22
26
|
popoverTitle: "Config Title",
|
|
23
27
|
popoverText: "Description set by the config",
|
|
24
28
|
popoverButtonText: "View Details",
|
|
@@ -34,6 +38,30 @@ setTimeout(() => {
|
|
|
34
38
|
{ barLegend: "Urban Sociology", amount: 500 },
|
|
35
39
|
{ barLegend: "Behavioral Economics & Economy Sciences", amount: 250 },
|
|
36
40
|
];
|
|
41
|
+
|
|
42
|
+
barChart2.config = {
|
|
43
|
+
label: "Number of Students by Department",
|
|
44
|
+
subinfo: "University of Education",
|
|
45
|
+
valueAxisLabel: "Students",
|
|
46
|
+
categoryAxisLabel: "University Departments",
|
|
47
|
+
printMode: true,
|
|
48
|
+
printModeFormat: "percentage",
|
|
49
|
+
gridMax: 2000,
|
|
50
|
+
popoverTitle: "Config Title",
|
|
51
|
+
popoverText: "Description set by the config",
|
|
52
|
+
popoverButtonText: "View Details",
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
barChart2.data = [
|
|
56
|
+
{ barLegend: "Marine Biology", amount: 250, whatever: "whatever", color: "wmcolor-border" },
|
|
57
|
+
{ barLegend: "Organic Chemistry", amount: 500 },
|
|
58
|
+
{ barLegend: "Aeronautical Engineering", amount: 982 },
|
|
59
|
+
{ barLegend: "Pure Mathematics", amount: 100 },
|
|
60
|
+
{ barLegend: "Astrophysics", amount: 500, popoverTitle: "Astrophysics", popoverText: "Astrophysics description set by the data", popoverButtonText: "View Astrophysics Details" },
|
|
61
|
+
{ barLegend: "Social Psychology", amount: 900 },
|
|
62
|
+
{ barLegend: "Urban Sociology", amount: 500 },
|
|
63
|
+
{ barLegend: "Behavioral Economics & Economy Sciences", amount: 250 },
|
|
64
|
+
];
|
|
37
65
|
}, 1000);
|
|
38
66
|
|
|
39
67
|
////////////////////////////////////////////////////////////
|
|
@@ -289,7 +289,7 @@ export function showTooltip(placement, anchorEl, tooltipText) {
|
|
|
289
289
|
// this additional tooltip is only rendered in browsers that do not support popover
|
|
290
290
|
const tooltipEls = document.querySelectorAll(".wm-tooltip");
|
|
291
291
|
tooltipEls.length > 0 && tooltipEls.forEach((tooltipEl) => {
|
|
292
|
-
if (!!tooltipEl.showPopover) {
|
|
292
|
+
if (!!tooltipEl.showPopover && tooltipEl.hasAttribute('popover')) {
|
|
293
293
|
tooltipEl.showPopover();
|
|
294
294
|
}
|
|
295
295
|
tooltipEl.classList.add("show");
|
|
@@ -316,7 +316,7 @@ export function showTooltip(placement, anchorEl, tooltipText) {
|
|
|
316
316
|
export function hideTooltip() {
|
|
317
317
|
const tooltipEls = document.querySelectorAll(".wm-tooltip");
|
|
318
318
|
tooltipEls.length > 0 && tooltipEls.forEach((tooltipEl) => {
|
|
319
|
-
if (!!tooltipEl.hidePopover) {
|
|
319
|
+
if (!!tooltipEl.hidePopover && tooltipEl.hasAttribute('popover')) {
|
|
320
320
|
tooltipEl.hidePopover();
|
|
321
321
|
}
|
|
322
322
|
tooltipEl.classList.remove("show");
|
|
@@ -34,20 +34,19 @@ window.addEventListener("mousedown", wmComponentMouseDownOnce);
|
|
|
34
34
|
setMode((elm) => {
|
|
35
35
|
return elm.getAttribute("mode") || document.documentElement.getAttribute("mode") || "planning";
|
|
36
36
|
});
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
tooltipStyles.textContent = `
|
|
37
|
+
// TOOLTIP
|
|
38
|
+
// Add a tooltip element
|
|
39
|
+
// This allows tooltips to be always at the highest stacking context (always on top)
|
|
40
|
+
// Element is added withing a container to avoid performance impact
|
|
41
|
+
const tooltipContainer = document.createElement("div");
|
|
42
|
+
tooltipContainer.id = "wm-tooltip-container";
|
|
43
|
+
const tooltipEl = document.createElement("div");
|
|
44
|
+
tooltipEl.id = "wm-tooltip";
|
|
45
|
+
tooltipEl.classList.add("wm-tooltip");
|
|
46
|
+
tooltipEl.setAttribute("popover", "manual");
|
|
47
|
+
tooltipEl.setAttribute("aria-hidden", "true");
|
|
48
|
+
const tooltipStyles = document.createElement("style");
|
|
49
|
+
tooltipStyles.textContent = `
|
|
51
50
|
.wm-tooltip {
|
|
52
51
|
position: fixed;
|
|
53
52
|
overflow: hidden;
|
|
@@ -84,7 +83,17 @@ document.addEventListener("DOMContentLoaded", () => {
|
|
|
84
83
|
opacity: 1;
|
|
85
84
|
}
|
|
86
85
|
`;
|
|
86
|
+
const body = document.querySelector("body");
|
|
87
|
+
if (body) {
|
|
87
88
|
document.head.appendChild(tooltipStyles);
|
|
88
89
|
tooltipContainer.appendChild(tooltipEl);
|
|
89
|
-
|
|
90
|
-
}
|
|
90
|
+
body.appendChild(tooltipContainer);
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
document.addEventListener("DOMContentLoaded", () => {
|
|
94
|
+
const body = document.querySelector("body");
|
|
95
|
+
document.head.appendChild(tooltipStyles);
|
|
96
|
+
tooltipContainer.appendChild(tooltipEl);
|
|
97
|
+
body.appendChild(tooltipContainer);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
@@ -49,22 +49,24 @@ export const getWmMode = (ref) => {
|
|
|
49
49
|
document.documentElement.getAttribute("mode") ||
|
|
50
50
|
defaultMode);
|
|
51
51
|
};
|
|
52
|
-
export const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
52
|
+
export const chartPalettes = {
|
|
53
|
+
discrete: [
|
|
54
|
+
"wmcolor-dataviz-discrete-01",
|
|
55
|
+
"wmcolor-dataviz-discrete-02",
|
|
56
|
+
"wmcolor-dataviz-discrete-03",
|
|
57
|
+
"wmcolor-dataviz-discrete-04",
|
|
58
|
+
"wmcolor-dataviz-discrete-05",
|
|
59
|
+
"wmcolor-dataviz-discrete-06",
|
|
60
|
+
"wmcolor-dataviz-discrete-07",
|
|
61
|
+
],
|
|
62
|
+
semantic: [
|
|
63
|
+
"wmcolor-dataviz-semantic-positive-01",
|
|
64
|
+
"wmcolor-dataviz-semantic-positive-02",
|
|
65
|
+
"wmcolor-dataviz-semantic-negative-01",
|
|
66
|
+
"wmcolor-dataviz-semantic-negative-02",
|
|
67
|
+
"wmcolor-dataviz-semantic-neutral-01",
|
|
68
|
+
"wmcolor-dataviz-semantic-neutral-02",
|
|
69
|
+
"wmcolor-dataviz-semantic-neutral-03",
|
|
70
|
+
"wmcolor-dataviz-semantic-unspecified",
|
|
71
|
+
],
|
|
72
|
+
};
|