@watermarkinsights/ripple 3.0.1-0 → 3.0.2-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ripple/functions-316c1b23.js → cjs/functions-e3f5ae65.js} +188 -2391
- package/dist/cjs/global-1e540de6.js +38 -0
- package/dist/cjs/http-service-9e8c4dd5.js +57 -0
- package/dist/cjs/index-d930307d.js +1392 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/interfaces-30a74c1f.js +35 -0
- package/dist/cjs/loader.cjs.js +22 -0
- package/dist/cjs/priv-chart-popover.cjs.entry.js +89 -0
- package/dist/cjs/priv-datepicker.cjs.entry.js +672 -0
- package/dist/cjs/priv-navigator-button.cjs.entry.js +29 -0
- package/dist/cjs/priv-navigator-item.cjs.entry.js +34 -0
- package/dist/cjs/ripple.cjs.js +20 -0
- package/dist/cjs/wm-action-menu_2.cjs.entry.js +318 -0
- package/dist/cjs/wm-button.cjs.entry.js +152 -0
- package/dist/cjs/wm-chart-slice.cjs.entry.js +22 -0
- package/dist/cjs/wm-chart.cjs.entry.js +508 -0
- package/dist/cjs/wm-datepicker.cjs.entry.js +257 -0
- package/dist/cjs/wm-input.cjs.entry.js +110 -0
- package/dist/cjs/wm-modal-footer.cjs.entry.js +43 -0
- package/dist/cjs/wm-modal-header.cjs.entry.js +45 -0
- package/dist/cjs/wm-modal.cjs.entry.js +149 -0
- package/dist/cjs/wm-navigator.cjs.entry.js +279 -0
- package/dist/cjs/wm-network-uploader.cjs.entry.js +431 -0
- package/dist/cjs/wm-option_2.cjs.entry.js +483 -0
- package/dist/cjs/wm-pagination.cjs.entry.js +176 -0
- package/dist/cjs/wm-search.cjs.entry.js +231 -0
- package/dist/cjs/wm-snackbar.cjs.entry.js +160 -0
- package/dist/cjs/wm-tab-item_3.cjs.entry.js +316 -0
- package/dist/cjs/wm-tag-input.cjs.entry.js +538 -0
- package/dist/cjs/wm-timepicker.cjs.entry.js +386 -0
- package/dist/cjs/wm-toggletip.cjs.entry.js +128 -0
- package/dist/cjs/wm-uploader.cjs.entry.js +342 -0
- package/dist/cjs/wm-wrapper.cjs.entry.js +21 -0
- package/dist/collection/collection-manifest.json +131 -0
- package/dist/{ripple/ripple.css → collection/components/wm-action-menu/wm-action-menu.css} +80 -42
- package/dist/collection/components/wm-action-menu/wm-action-menu.js +392 -0
- package/dist/collection/components/wm-button/wm-button.css +572 -0
- package/dist/collection/components/wm-button/wm-button.js +365 -0
- package/dist/collection/components/wm-chart/priv-chart-popover/priv-chart-popover.css +132 -0
- package/dist/collection/components/wm-chart/priv-chart-popover/priv-chart-popover.js +232 -0
- package/dist/collection/components/wm-chart/wm-chart-slice.js +64 -0
- package/dist/collection/components/wm-chart/wm-chart.css +337 -0
- package/dist/collection/components/wm-chart/wm-chart.js +710 -0
- package/dist/collection/components/wm-datepicker/priv-datepicker/priv-datepicker.css +374 -0
- package/dist/collection/components/wm-datepicker/priv-datepicker/priv-datepicker.js +1003 -0
- package/dist/collection/components/wm-datepicker/wm-datepicker.css +211 -0
- package/dist/collection/components/wm-datepicker/wm-datepicker.js +439 -0
- package/dist/collection/components/wm-input/wm-input.css +220 -0
- package/dist/collection/components/wm-input/wm-input.js +302 -0
- package/dist/collection/components/wm-menuitem/wm-menuitem.css +118 -0
- package/dist/collection/components/wm-menuitem/wm-menuitem.js +411 -0
- package/dist/collection/components/wm-modal/wm-modal-footer.css +84 -0
- package/dist/collection/components/wm-modal/wm-modal-footer.js +159 -0
- package/dist/collection/components/wm-modal/wm-modal-header.css +78 -0
- package/dist/collection/components/wm-modal/wm-modal-header.js +109 -0
- package/dist/collection/components/wm-modal/wm-modal.css +155 -0
- package/dist/collection/components/wm-modal/wm-modal.js +356 -0
- package/dist/collection/components/wm-navigator/priv-navigator-button/priv-navigator-button.css +94 -0
- package/dist/collection/components/wm-navigator/priv-navigator-button/priv-navigator-button.js +97 -0
- package/dist/collection/components/wm-navigator/priv-navigator-item/priv-navigator-item.css +67 -0
- package/dist/collection/components/wm-navigator/priv-navigator-item/priv-navigator-item.js +114 -0
- package/dist/collection/components/wm-navigator/wm-navigator.css +137 -0
- package/dist/collection/components/wm-navigator/wm-navigator.js +468 -0
- package/dist/collection/components/wm-option/wm-option.css +162 -0
- package/dist/collection/components/wm-option/wm-option.js +394 -0
- package/dist/collection/components/wm-pagination/wm-pagination.css +217 -0
- package/dist/collection/components/wm-pagination/wm-pagination.js +348 -0
- package/dist/collection/components/wm-search/wm-search.css +155 -0
- package/dist/collection/components/wm-search/wm-search.js +439 -0
- package/dist/collection/components/wm-select/wm-select.css +315 -0
- package/dist/collection/components/wm-select/wm-select.js +676 -0
- package/dist/collection/components/wm-snackbar/wm-snackbar.css +331 -0
- package/dist/collection/components/wm-snackbar/wm-snackbar.js +240 -0
- package/dist/collection/components/wm-tabs/wm-tab-item/wm-tab-item.css +104 -0
- package/dist/collection/components/wm-tabs/wm-tab-item/wm-tab-item.js +202 -0
- package/dist/collection/components/wm-tabs/wm-tab-list/wm-tab-list.css +73 -0
- package/dist/{ripple/wm-tab-list.entry.js → collection/components/wm-tabs/wm-tab-list/wm-tab-list.js} +131 -17
- package/dist/collection/components/wm-tabs/wm-tab-panel/wm-tab-panel.css +57 -0
- package/dist/collection/components/wm-tabs/wm-tab-panel/wm-tab-panel.js +104 -0
- package/dist/collection/components/wm-tag-input/wm-tag-input.css +431 -0
- package/dist/collection/components/wm-tag-input/wm-tag-input.js +754 -0
- package/dist/collection/components/wm-timepicker/wm-timepicker.css +370 -0
- package/dist/collection/components/wm-timepicker/wm-timepicker.js +567 -0
- package/dist/collection/components/wm-toggletip/wm-toggletip.css +350 -0
- package/dist/collection/components/wm-toggletip/wm-toggletip.js +217 -0
- package/dist/collection/components/wm-uploader/wm-network-uploader/wm-network-uploader.css +642 -0
- package/dist/collection/components/wm-uploader/wm-network-uploader/wm-network-uploader.js +753 -0
- package/dist/collection/components/wm-uploader/wm-uploader.css +666 -0
- package/dist/collection/components/wm-uploader/wm-uploader.js +673 -0
- package/dist/collection/components/wm-wrapper/wm-wrapper.js +27 -0
- package/dist/collection/dev/scripts.js +20 -0
- package/dist/collection/global/__mocks__/functions.js +5 -0
- package/dist/collection/global/functions.js +420 -0
- package/dist/{ripple/app-globals-b5693c90.js → collection/global/global.js} +3 -8
- package/dist/{ripple/interfaces-50753346.js → collection/global/interfaces.js} +4 -6
- package/dist/collection/global/services/__mocks__/http-service.js +130 -0
- package/dist/collection/global/services/http-service.js +50 -0
- package/dist/collection/lang/lang.js +5 -0
- package/dist/collection/lang/piglatin.js +93 -0
- package/dist/esm/functions-0deb7f8e.js +6117 -0
- package/dist/esm/global-d6b49e98.js +36 -0
- package/dist/{ripple → esm}/http-service-5d037e16.js +0 -0
- package/dist/esm/index-5a842e48.js +1363 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/interfaces-61c6305b.js +32 -0
- package/dist/esm/loader.js +18 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/{ripple → esm}/priv-chart-popover.entry.js +2 -2
- package/dist/{ripple → esm}/priv-datepicker.entry.js +3 -3
- package/dist/{ripple → esm}/priv-navigator-button.entry.js +1 -1
- package/dist/{ripple → esm}/priv-navigator-item.entry.js +1 -1
- package/dist/esm/ripple.js +18 -0
- package/dist/{ripple/wm-action-menu.entry.js → esm/wm-action-menu_2.entry.js} +114 -3
- package/dist/{ripple → esm}/wm-button.entry.js +3 -3
- package/dist/{ripple → esm}/wm-chart-slice.entry.js +1 -1
- package/dist/{ripple → esm}/wm-chart.entry.js +2 -2
- package/dist/{ripple → esm}/wm-datepicker.entry.js +27 -32
- package/dist/{ripple → esm}/wm-input.entry.js +2 -2
- package/dist/{ripple → esm}/wm-modal-footer.entry.js +2 -2
- package/dist/{ripple → esm}/wm-modal-header.entry.js +2 -2
- package/dist/{ripple → esm}/wm-modal.entry.js +2 -2
- package/dist/{ripple → esm}/wm-navigator.entry.js +3 -3
- package/dist/{ripple → esm}/wm-network-uploader.entry.js +2 -2
- package/dist/{ripple/wm-select.entry.js → esm/wm-option_2.entry.js} +119 -3
- package/dist/{ripple → esm}/wm-pagination.entry.js +2 -2
- package/dist/{ripple → esm}/wm-search.entry.js +2 -2
- package/dist/{ripple → esm}/wm-snackbar.entry.js +2 -2
- package/dist/esm/wm-tab-item_3.entry.js +310 -0
- package/dist/{ripple → esm}/wm-tag-input.entry.js +2 -2
- package/dist/{ripple → esm}/wm-timepicker.entry.js +2 -2
- package/dist/{ripple → esm}/wm-toggletip.entry.js +2 -2
- package/dist/{ripple → esm}/wm-uploader.entry.js +2 -2
- package/dist/{ripple → esm}/wm-wrapper.entry.js +1 -1
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/loader/cdn.js +3 -0
- package/dist/loader/index.cjs.js +3 -0
- package/dist/loader/index.d.ts +13 -0
- package/dist/loader/index.es2017.js +3 -0
- package/dist/loader/index.js +4 -0
- package/dist/loader/package.json +10 -0
- package/dist/ripple/index.esm.js +0 -1
- package/dist/ripple/p-103f8cae.entry.js +1 -0
- package/dist/ripple/p-129d94fa.entry.js +1 -0
- package/dist/ripple/p-139fe143.entry.js +1 -0
- package/dist/ripple/p-16367805.entry.js +1 -0
- package/dist/ripple/p-1d334060.entry.js +1 -0
- package/dist/ripple/p-2562f330.entry.js +1 -0
- package/dist/ripple/p-278b26ef.entry.js +1 -0
- package/dist/ripple/p-2c21bb72.entry.js +1 -0
- package/dist/ripple/p-2f5fda71.entry.js +1 -0
- package/dist/ripple/p-3e6f04d5.entry.js +1 -0
- package/dist/ripple/p-7185de7f.entry.js +1 -0
- package/dist/ripple/p-770d0798.entry.js +1 -0
- package/dist/ripple/p-846b4c5f.entry.js +1 -0
- package/dist/ripple/p-888bec42.js +1 -0
- package/dist/ripple/p-90779d53.entry.js +1 -0
- package/dist/ripple/p-934543f2.js +1 -0
- package/dist/ripple/p-9a087fee.entry.js +1 -0
- package/dist/ripple/p-a6d6eae7.js +1 -0
- package/dist/ripple/p-a942ad10.entry.js +1 -0
- package/dist/ripple/p-bfb4652d.entry.js +1 -0
- package/dist/ripple/p-c0fe5201.entry.js +1 -0
- package/dist/ripple/p-c2e27acc.entry.js +1 -0
- package/dist/ripple/p-c2edda64.entry.js +1 -0
- package/dist/ripple/p-d1fdcbcf.entry.js +1 -0
- package/dist/ripple/p-d40b6afb.entry.js +1 -0
- package/dist/ripple/p-da73db1c.entry.js +1 -0
- package/dist/ripple/p-e3843249.js +1 -0
- package/dist/ripple/p-ea5cd8b8.js +16 -0
- package/dist/ripple/p-ed0f43f4.entry.js +1 -0
- package/dist/ripple/p-ffafd363.entry.js +1 -0
- package/dist/ripple/ripple.esm.js +1 -125
- package/dist/types/components/wm-action-menu/wm-action-menu.d.ts +43 -0
- package/dist/types/components/wm-button/wm-button.d.ts +36 -0
- package/dist/types/components/wm-chart/priv-chart-popover/priv-chart-popover.d.ts +23 -0
- package/dist/types/components/wm-chart/wm-chart-slice.d.ts +8 -0
- package/dist/types/components/wm-chart/wm-chart.d.ts +77 -0
- package/dist/types/components/wm-datepicker/priv-datepicker/priv-datepicker.d.ts +75 -0
- package/dist/types/components/wm-datepicker/wm-datepicker.d.ts +39 -0
- package/dist/types/components/wm-input/wm-input.d.ts +30 -0
- package/dist/types/components/wm-menuitem/wm-menuitem.d.ts +30 -0
- package/dist/types/components/wm-modal/wm-modal-footer.d.ts +15 -0
- package/dist/types/components/wm-modal/wm-modal-header.d.ts +12 -0
- package/dist/types/components/wm-modal/wm-modal.d.ts +34 -0
- package/dist/types/components/wm-navigator/priv-navigator-button/priv-navigator-button.d.ts +10 -0
- package/dist/types/components/wm-navigator/priv-navigator-item/priv-navigator-item.d.ts +13 -0
- package/dist/types/components/wm-navigator/wm-navigator.d.ts +61 -0
- package/dist/types/components/wm-option/wm-option.d.ts +28 -0
- package/dist/types/components/wm-pagination/wm-pagination.d.ts +31 -0
- package/dist/types/components/wm-search/wm-search.d.ts +78 -0
- package/dist/types/components/wm-select/wm-select.d.ts +63 -0
- package/dist/types/components/wm-snackbar/wm-snackbar.d.ts +32 -0
- package/dist/types/components/wm-tabs/wm-tab-item/wm-tab-item.d.ts +35 -0
- package/dist/types/components/wm-tabs/wm-tab-list/wm-tab-list.d.ts +50 -0
- package/dist/types/components/wm-tabs/wm-tab-panel/wm-tab-panel.d.ts +20 -0
- package/dist/types/components/wm-tag-input/{wm-tag-input.d.ts~ds312_tagInputMaxTags → wm-tag-input.d.ts} +1 -1
- package/dist/types/components/wm-timepicker/wm-timepicker.d.ts +59 -0
- package/dist/types/components/wm-toggletip/wm-toggletip.d.ts +25 -0
- package/dist/types/components/wm-uploader/wm-network-uploader/wm-network-uploader.d.ts +85 -0
- package/dist/types/components/wm-uploader/wm-uploader.d.ts +75 -0
- package/dist/types/components/wm-wrapper/wm-wrapper.d.ts +7 -0
- package/dist/types/{components.d.ts~ds312_tagInputMaxTags → components.d.ts} +0 -0
- package/dist/types/global/__mocks__/functions.d.ts +5 -0
- package/dist/types/global/global.d.ts +1 -0
- package/dist/types/global/interfaces.d.ts +33 -0
- package/dist/types/global/services/__mocks__/http-service.d.ts +6 -0
- package/dist/types/global/services/http-service.d.ts +4 -0
- package/dist/types/lang/lang.d.ts +5 -0
- package/dist/types/{stencil-public-runtime.d.ts~ds312_tagInputMaxTags → stencil-public-runtime.d.ts} +190 -182
- package/package.json +1 -1
- package/dist/ripple/css-shim-bbdf0cc6.js +0 -4
- package/dist/ripple/dom-1f98a75f.js +0 -73
- package/dist/ripple/index-20b65f86.js +0 -2938
- package/dist/ripple/shadow-css-67b66845.js +0 -389
- package/dist/ripple/wm-menuitem.entry.js +0 -114
- package/dist/ripple/wm-option.entry.js +0 -119
- package/dist/ripple/wm-tab-item.entry.js +0 -78
- package/dist/ripple/wm-tab-panel.entry.js +0 -38
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
import { h, Component, Element, Listen, Prop, State, Event, Host } from "@stencil/core";
|
|
2
|
+
import { generateId, getTextDir, shouldOpenUp, shouldShiftRight } from "../../global/functions";
|
|
3
|
+
export class ActionMenu {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.openUp = false;
|
|
6
|
+
this.isExpanded = false;
|
|
7
|
+
this.buttonType = "icon";
|
|
8
|
+
this.disabled = false;
|
|
9
|
+
this.keysSoFar = "";
|
|
10
|
+
this.searchIndex = 0;
|
|
11
|
+
this.keyClear = null;
|
|
12
|
+
}
|
|
13
|
+
get horizontalPosition() {
|
|
14
|
+
return !!this.el && !!this.itemsEl && shouldShiftRight(this.el, this.itemsEl) ? "right" : "left";
|
|
15
|
+
}
|
|
16
|
+
get childItems() {
|
|
17
|
+
return Array.from(this.el.querySelectorAll("wm-menuitem"));
|
|
18
|
+
}
|
|
19
|
+
handleClickedItem() {
|
|
20
|
+
this.close();
|
|
21
|
+
}
|
|
22
|
+
handleKeyUp(ev) {
|
|
23
|
+
this.moveUp(ev.target);
|
|
24
|
+
}
|
|
25
|
+
handleKeyDown(ev) {
|
|
26
|
+
this.moveDown(ev.detail);
|
|
27
|
+
}
|
|
28
|
+
handleHomeKey() {
|
|
29
|
+
this.focusFirstItem();
|
|
30
|
+
}
|
|
31
|
+
handleEndKey() {
|
|
32
|
+
this.focusLastItem();
|
|
33
|
+
}
|
|
34
|
+
handleTabKey() {
|
|
35
|
+
if (this.isExpanded) {
|
|
36
|
+
this.close();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
handleEscKey() {
|
|
40
|
+
this.close();
|
|
41
|
+
this.wmButtonEl.focus();
|
|
42
|
+
}
|
|
43
|
+
blurHandler(ev) {
|
|
44
|
+
const isElOrChild = ev.target === this.el || this.el.contains(ev.target);
|
|
45
|
+
if (!isElOrChild && this.isExpanded) {
|
|
46
|
+
this.close();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
handleKey(ev) {
|
|
50
|
+
switch (ev.key) {
|
|
51
|
+
case "ArrowDown":
|
|
52
|
+
if (!this.isExpanded) {
|
|
53
|
+
ev.preventDefault();
|
|
54
|
+
this.open();
|
|
55
|
+
window.requestAnimationFrame(() => this.focusFirstItem());
|
|
56
|
+
}
|
|
57
|
+
break;
|
|
58
|
+
case "ArrowUp":
|
|
59
|
+
if (!this.isExpanded) {
|
|
60
|
+
ev.preventDefault();
|
|
61
|
+
this.open();
|
|
62
|
+
window.requestAnimationFrame(() => this.focusLastItem());
|
|
63
|
+
}
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
componentWillLoad() {
|
|
68
|
+
this.uid = this.el.id ? this.el.id : generateId();
|
|
69
|
+
this.el.focus = function () {
|
|
70
|
+
if (!this.disabled) {
|
|
71
|
+
const button = this.shadowRoot.querySelector("wm-button");
|
|
72
|
+
button && button.focus();
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
componentDidLoad() {
|
|
77
|
+
if (this.childItems.length === 0) {
|
|
78
|
+
console.error("wm-action-menu should have wm-menuitem elements as children");
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
this.focusFirstItem();
|
|
82
|
+
}
|
|
83
|
+
if (this.buttonType !== "icon" && !this.buttonText) {
|
|
84
|
+
console.error("wm-action-menu should have a valid button-text property when button-type is set to 'text' or 'selector'");
|
|
85
|
+
}
|
|
86
|
+
if (this.buttonType === "icon" && !this.tooltip) {
|
|
87
|
+
console.error("wm-action-menu should have a valid tooltip when button-type is set to 'icon'");
|
|
88
|
+
}
|
|
89
|
+
this.menuLoaded.emit();
|
|
90
|
+
}
|
|
91
|
+
moveUp(el) {
|
|
92
|
+
const index = this.childItems.indexOf(el);
|
|
93
|
+
if (index === 0) {
|
|
94
|
+
this.focusLastItem();
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
this.focusItem(this.childItems[index - 1]);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
moveDown(el) {
|
|
101
|
+
const index = this.childItems.indexOf(el);
|
|
102
|
+
if (index === this.childItems.length - 1) {
|
|
103
|
+
this.focusFirstItem();
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
this.focusItem(this.childItems[index + 1]);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
open() {
|
|
110
|
+
if (!this.disabled) {
|
|
111
|
+
this.openUp = shouldOpenUp(this.el, this.itemsEl);
|
|
112
|
+
// action menu usually is on the right side of the screen,
|
|
113
|
+
// so dropdown opens to the left (is anchored on the right corner)
|
|
114
|
+
// if there is not enough space on the left and enough on the right though,
|
|
115
|
+
// it will open on the right side
|
|
116
|
+
this.isExpanded = true;
|
|
117
|
+
this.itemsEl.classList.remove("hidden");
|
|
118
|
+
window.requestAnimationFrame(() => this.focusFirstItem());
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
close() {
|
|
122
|
+
this.isExpanded = false;
|
|
123
|
+
this.childItems.forEach((i) => (i.focused = false));
|
|
124
|
+
window.setTimeout(() => {
|
|
125
|
+
this.itemsEl.classList.add("hidden");
|
|
126
|
+
}, 150);
|
|
127
|
+
window.setTimeout(() => {
|
|
128
|
+
// if dev omits to assign focus after an action is triggered,
|
|
129
|
+
// the component brings the focus back on the button
|
|
130
|
+
// Focus will only be lost (and go to the body) once the menuitem
|
|
131
|
+
// is not visible anymore, so we need to wait for the transition to
|
|
132
|
+
// finish and the hidden class to be applied.
|
|
133
|
+
// also checking if focus stayed on the menuitem
|
|
134
|
+
if (document.activeElement.tagName === "BODY" || document.activeElement.tagName === "WM-MENUITEM") {
|
|
135
|
+
this.wmButtonEl.focus();
|
|
136
|
+
}
|
|
137
|
+
}, 250);
|
|
138
|
+
}
|
|
139
|
+
focusItem(item) {
|
|
140
|
+
this.childItems.map((i) => (i.focused = i === item));
|
|
141
|
+
item.focus && item.focus();
|
|
142
|
+
}
|
|
143
|
+
focusFirstItem() {
|
|
144
|
+
this.focusItem(this.childItems[0]);
|
|
145
|
+
}
|
|
146
|
+
focusLastItem() {
|
|
147
|
+
this.focusItem(this.childItems[this.childItems.length - 1]);
|
|
148
|
+
}
|
|
149
|
+
findAndFocusItem(ev) {
|
|
150
|
+
const character = ev.detail.toUpperCase();
|
|
151
|
+
this.focusFirstItem();
|
|
152
|
+
if (!this.keysSoFar) {
|
|
153
|
+
for (var i = 0; i < this.childItems.length; i++) {
|
|
154
|
+
if (this.childItems[i] === document.activeElement) {
|
|
155
|
+
this.searchIndex = i;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
this.keysSoFar += character;
|
|
160
|
+
this.clearKeysSoFarAfterDelay();
|
|
161
|
+
var nextMatch = this.findMatchInRange(this.childItems, this.searchIndex + 1, this.childItems.length);
|
|
162
|
+
if (!nextMatch) {
|
|
163
|
+
nextMatch = this.findMatchInRange(this.childItems, 0, this.searchIndex);
|
|
164
|
+
}
|
|
165
|
+
if (nextMatch) {
|
|
166
|
+
this.focusItem(nextMatch);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
clearKeysSoFarAfterDelay() {
|
|
170
|
+
if (this.keyClear) {
|
|
171
|
+
window.clearTimeout(this.keyClear);
|
|
172
|
+
this.keyClear = null;
|
|
173
|
+
}
|
|
174
|
+
this.keyClear = window.setTimeout(function () {
|
|
175
|
+
this.keysSoFar = "";
|
|
176
|
+
this.keyClear = null;
|
|
177
|
+
}.bind(this), 500);
|
|
178
|
+
}
|
|
179
|
+
findMatchInRange(list, startIndex, endIndex) {
|
|
180
|
+
// Find the first item starting with the keysSoFar substring, searching in
|
|
181
|
+
// the specified range of items
|
|
182
|
+
for (var n = startIndex; n < endIndex; n++) {
|
|
183
|
+
var label = list[n].innerText;
|
|
184
|
+
if (label && label.toUpperCase().indexOf(this.keysSoFar) === 0) {
|
|
185
|
+
return list[n];
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
190
|
+
render() {
|
|
191
|
+
return (h(Host, null,
|
|
192
|
+
h("div", { class: getTextDir() },
|
|
193
|
+
h("wm-button", { "button-style": `${this.buttonType}only`, tooltip: this.tooltip, "label-for-identical-buttons": this.labelForIdenticalButtons, icon: this.buttonType === "icon" ? "f1d9" : "", id: `menubtn-${this.uid}`, onClick: () => (this.isExpanded ? this.close() : this.open()), disabled: this.disabled, ref: (el) => (this.wmButtonEl = el), "tooltip-position": this.tooltipPosition || this.horizontalPosition, "aria-haspopup": "true", "aria-expanded": this.isExpanded ? "true" : "false", "aria-controls": `menu-${this.uid}` }, this.buttonText),
|
|
194
|
+
h("div", { class: `dropdown ${this.openUp ? "open-up" : ""} ${this.horizontalPosition} ${this.isExpanded ? "open" : ""} hidden`, id: `menu-${this.uid}`, tabindex: -1, role: "menu", ref: (el) => (this.itemsEl = el) },
|
|
195
|
+
h("slot", null)))));
|
|
196
|
+
}
|
|
197
|
+
static get is() { return "wm-action-menu"; }
|
|
198
|
+
static get encapsulation() { return "shadow"; }
|
|
199
|
+
static get originalStyleUrls() { return {
|
|
200
|
+
"$": ["wm-action-menu.scss"]
|
|
201
|
+
}; }
|
|
202
|
+
static get styleUrls() { return {
|
|
203
|
+
"$": ["wm-action-menu.css"]
|
|
204
|
+
}; }
|
|
205
|
+
static get properties() { return {
|
|
206
|
+
"tooltipPosition": {
|
|
207
|
+
"type": "string",
|
|
208
|
+
"mutable": false,
|
|
209
|
+
"complexType": {
|
|
210
|
+
"original": "| \"top\"\n | \"bottom\"\n | \"left\"\n | \"right\"\n | \"bottom-left\"\n | \"bottom-right\"\n | \"top-right\"\n | \"top-left\"",
|
|
211
|
+
"resolved": "\"bottom\" | \"bottom-left\" | \"bottom-right\" | \"left\" | \"right\" | \"top\" | \"top-left\" | \"top-right\" | undefined",
|
|
212
|
+
"references": {}
|
|
213
|
+
},
|
|
214
|
+
"required": false,
|
|
215
|
+
"optional": true,
|
|
216
|
+
"docs": {
|
|
217
|
+
"tags": [],
|
|
218
|
+
"text": ""
|
|
219
|
+
},
|
|
220
|
+
"attribute": "tooltip-position",
|
|
221
|
+
"reflect": false
|
|
222
|
+
},
|
|
223
|
+
"buttonType": {
|
|
224
|
+
"type": "string",
|
|
225
|
+
"mutable": false,
|
|
226
|
+
"complexType": {
|
|
227
|
+
"original": "\"icon\" | \"text\" | \"selector\"",
|
|
228
|
+
"resolved": "\"icon\" | \"selector\" | \"text\"",
|
|
229
|
+
"references": {}
|
|
230
|
+
},
|
|
231
|
+
"required": false,
|
|
232
|
+
"optional": false,
|
|
233
|
+
"docs": {
|
|
234
|
+
"tags": [],
|
|
235
|
+
"text": ""
|
|
236
|
+
},
|
|
237
|
+
"attribute": "button-type",
|
|
238
|
+
"reflect": false,
|
|
239
|
+
"defaultValue": "\"icon\""
|
|
240
|
+
},
|
|
241
|
+
"buttonText": {
|
|
242
|
+
"type": "string",
|
|
243
|
+
"mutable": false,
|
|
244
|
+
"complexType": {
|
|
245
|
+
"original": "string",
|
|
246
|
+
"resolved": "string | undefined",
|
|
247
|
+
"references": {}
|
|
248
|
+
},
|
|
249
|
+
"required": false,
|
|
250
|
+
"optional": true,
|
|
251
|
+
"docs": {
|
|
252
|
+
"tags": [],
|
|
253
|
+
"text": ""
|
|
254
|
+
},
|
|
255
|
+
"attribute": "button-text",
|
|
256
|
+
"reflect": false
|
|
257
|
+
},
|
|
258
|
+
"disabled": {
|
|
259
|
+
"type": "boolean",
|
|
260
|
+
"mutable": false,
|
|
261
|
+
"complexType": {
|
|
262
|
+
"original": "boolean",
|
|
263
|
+
"resolved": "boolean",
|
|
264
|
+
"references": {}
|
|
265
|
+
},
|
|
266
|
+
"required": false,
|
|
267
|
+
"optional": false,
|
|
268
|
+
"docs": {
|
|
269
|
+
"tags": [],
|
|
270
|
+
"text": ""
|
|
271
|
+
},
|
|
272
|
+
"attribute": "disabled",
|
|
273
|
+
"reflect": true,
|
|
274
|
+
"defaultValue": "false"
|
|
275
|
+
},
|
|
276
|
+
"tooltip": {
|
|
277
|
+
"type": "string",
|
|
278
|
+
"mutable": false,
|
|
279
|
+
"complexType": {
|
|
280
|
+
"original": "string",
|
|
281
|
+
"resolved": "string | undefined",
|
|
282
|
+
"references": {}
|
|
283
|
+
},
|
|
284
|
+
"required": false,
|
|
285
|
+
"optional": true,
|
|
286
|
+
"docs": {
|
|
287
|
+
"tags": [],
|
|
288
|
+
"text": ""
|
|
289
|
+
},
|
|
290
|
+
"attribute": "tooltip",
|
|
291
|
+
"reflect": false
|
|
292
|
+
},
|
|
293
|
+
"labelForIdenticalButtons": {
|
|
294
|
+
"type": "string",
|
|
295
|
+
"mutable": false,
|
|
296
|
+
"complexType": {
|
|
297
|
+
"original": "string",
|
|
298
|
+
"resolved": "string | undefined",
|
|
299
|
+
"references": {}
|
|
300
|
+
},
|
|
301
|
+
"required": false,
|
|
302
|
+
"optional": true,
|
|
303
|
+
"docs": {
|
|
304
|
+
"tags": [],
|
|
305
|
+
"text": ""
|
|
306
|
+
},
|
|
307
|
+
"attribute": "label-for-identical-buttons",
|
|
308
|
+
"reflect": false
|
|
309
|
+
}
|
|
310
|
+
}; }
|
|
311
|
+
static get states() { return {
|
|
312
|
+
"isExpanded": {}
|
|
313
|
+
}; }
|
|
314
|
+
static get events() { return [{
|
|
315
|
+
"method": "menuLoaded",
|
|
316
|
+
"name": "menuLoaded",
|
|
317
|
+
"bubbles": true,
|
|
318
|
+
"cancelable": true,
|
|
319
|
+
"composed": true,
|
|
320
|
+
"docs": {
|
|
321
|
+
"tags": [],
|
|
322
|
+
"text": ""
|
|
323
|
+
},
|
|
324
|
+
"complexType": {
|
|
325
|
+
"original": "any",
|
|
326
|
+
"resolved": "any",
|
|
327
|
+
"references": {}
|
|
328
|
+
}
|
|
329
|
+
}]; }
|
|
330
|
+
static get elementRef() { return "el"; }
|
|
331
|
+
static get listeners() { return [{
|
|
332
|
+
"name": "wmMenuitemClicked",
|
|
333
|
+
"method": "handleClickedItem",
|
|
334
|
+
"target": undefined,
|
|
335
|
+
"capture": false,
|
|
336
|
+
"passive": false
|
|
337
|
+
}, {
|
|
338
|
+
"name": "wmKeyUpPressed",
|
|
339
|
+
"method": "handleKeyUp",
|
|
340
|
+
"target": undefined,
|
|
341
|
+
"capture": false,
|
|
342
|
+
"passive": false
|
|
343
|
+
}, {
|
|
344
|
+
"name": "wmKeyDownPressed",
|
|
345
|
+
"method": "handleKeyDown",
|
|
346
|
+
"target": undefined,
|
|
347
|
+
"capture": false,
|
|
348
|
+
"passive": false
|
|
349
|
+
}, {
|
|
350
|
+
"name": "wmHomeKeyPressed",
|
|
351
|
+
"method": "handleHomeKey",
|
|
352
|
+
"target": undefined,
|
|
353
|
+
"capture": false,
|
|
354
|
+
"passive": false
|
|
355
|
+
}, {
|
|
356
|
+
"name": "wmEndKeyPressed",
|
|
357
|
+
"method": "handleEndKey",
|
|
358
|
+
"target": undefined,
|
|
359
|
+
"capture": false,
|
|
360
|
+
"passive": false
|
|
361
|
+
}, {
|
|
362
|
+
"name": "wmTabKeyPressed",
|
|
363
|
+
"method": "handleTabKey",
|
|
364
|
+
"target": undefined,
|
|
365
|
+
"capture": false,
|
|
366
|
+
"passive": false
|
|
367
|
+
}, {
|
|
368
|
+
"name": "wmEscKeyPressed",
|
|
369
|
+
"method": "handleEscKey",
|
|
370
|
+
"target": undefined,
|
|
371
|
+
"capture": false,
|
|
372
|
+
"passive": false
|
|
373
|
+
}, {
|
|
374
|
+
"name": "click",
|
|
375
|
+
"method": "blurHandler",
|
|
376
|
+
"target": "document",
|
|
377
|
+
"capture": false,
|
|
378
|
+
"passive": false
|
|
379
|
+
}, {
|
|
380
|
+
"name": "keydown",
|
|
381
|
+
"method": "handleKey",
|
|
382
|
+
"target": undefined,
|
|
383
|
+
"capture": false,
|
|
384
|
+
"passive": false
|
|
385
|
+
}, {
|
|
386
|
+
"name": "wmLetterPressed",
|
|
387
|
+
"method": "findAndFocusItem",
|
|
388
|
+
"target": undefined,
|
|
389
|
+
"capture": false,
|
|
390
|
+
"passive": false
|
|
391
|
+
}]; }
|
|
392
|
+
}
|