@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,483 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-d930307d.js');
|
|
6
|
+
const functions = require('./functions-e3f5ae65.js');
|
|
7
|
+
|
|
8
|
+
const wmOptionCss = "@charset \"UTF-8\";:host(:not(:last-child)),wm-option:not(:last-child){border-bottom:2px solid rgba(46, 27, 70, 0.05)}:host,wm-option{display:block;cursor:pointer;position:relative;padding:1.25rem;background:#fff;font-family:inherit;list-style:none;color:#4a4a4a;user-select:none}:host:focus,:host.focus,wm-option:focus,wm-option.focus{outline:none;background:#f4f4f4}:host.icon,wm-option.icon{color:#575195}.checkbox:before{display:inline-block;font:normal normal normal 24px/1 \"Material Design Icons\";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:\"\";display:inline;margin-right:0.25rem;color:#575195}:host([aria-selected=true]),wm-option[aria-selected=true]{background:rgba(46, 27, 70, 0.05);font-weight:500}:host([aria-selected=true]) .checkbox:before,wm-option[aria-selected=true] .checkbox:before{content:\"\"}:host([aria-disabled=true]),wm-option[aria-disabled=true]{font-style:italic;color:#6b6b6b;cursor:default}:host([aria-disabled=true]) .checkbox:before,wm-option[aria-disabled=true] .checkbox:before{color:#6b6b6b}:host(.multi-option),wm-option.multi-option{background:unset}:host(.hassubinfo),wm-option.hassubinfo{display:flex}:host(.hassubinfo) .option-wrapper,wm-option.hassubinfo .option-wrapper{flex:1}:host(.hassubinfo) .subinfo,wm-option.hassubinfo .subinfo{flex:none}.subinfo{font-style:italic}.option-wrapper{display:inline-block}::slotted{font-family:inherit}::slotted(i){font-size:0.875rem}::slotted(i):before{display:inline-block;font:normal normal normal 24px/1 \"Material Design Icons\";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;display:inline-block;margin-right:0.625rem;pointer-events:none}:host(:focus),wm-option:focus{outline:none;background:#f4f4f4}:host(:hover){background:#f4f4f4;outline:none}";
|
|
9
|
+
|
|
10
|
+
const Option = class {
|
|
11
|
+
constructor(hostRef) {
|
|
12
|
+
index.registerInstance(this, hostRef);
|
|
13
|
+
this.wmOptionSelected = index.createEvent(this, "wmOptionSelected", 7);
|
|
14
|
+
this.wmKeyUpPressed = index.createEvent(this, "wmKeyUpPressed", 7);
|
|
15
|
+
this.wmKeyDownPressed = index.createEvent(this, "wmKeyDownPressed", 7);
|
|
16
|
+
this.wmEscKeyPressed = index.createEvent(this, "wmEscKeyPressed", 7);
|
|
17
|
+
this.wmHomeKeyPressed = index.createEvent(this, "wmHomeKeyPressed", 7);
|
|
18
|
+
this.wmEndKeyPressed = index.createEvent(this, "wmEndKeyPressed", 7);
|
|
19
|
+
this.wmTabKeyPressed = index.createEvent(this, "wmTabKeyPressed", 7);
|
|
20
|
+
this.wmEnterKeyPressed = index.createEvent(this, "wmEnterKeyPressed", 7);
|
|
21
|
+
this.wmLetterPressed = index.createEvent(this, "wmLetterPressed", 7);
|
|
22
|
+
this.subinfo = undefined;
|
|
23
|
+
this.disabled = false;
|
|
24
|
+
this.selected = false;
|
|
25
|
+
this.focused = false;
|
|
26
|
+
}
|
|
27
|
+
get isMultiChild() {
|
|
28
|
+
var _a;
|
|
29
|
+
return (_a = this.el.parentElement) === null || _a === void 0 ? void 0 : _a.multiple;
|
|
30
|
+
}
|
|
31
|
+
handleKeydown(ev) {
|
|
32
|
+
switch (ev.keyCode) {
|
|
33
|
+
// Arrow Up
|
|
34
|
+
case 38:
|
|
35
|
+
ev.preventDefault();
|
|
36
|
+
this.wmKeyUpPressed.emit();
|
|
37
|
+
break;
|
|
38
|
+
// Arrow Down
|
|
39
|
+
case 40:
|
|
40
|
+
ev.preventDefault();
|
|
41
|
+
this.wmKeyDownPressed.emit(this.el);
|
|
42
|
+
break;
|
|
43
|
+
// Enter
|
|
44
|
+
case 13:
|
|
45
|
+
ev.preventDefault();
|
|
46
|
+
if (!this.disabled) {
|
|
47
|
+
this.el.click();
|
|
48
|
+
this.wmEnterKeyPressed.emit(this.el);
|
|
49
|
+
}
|
|
50
|
+
break;
|
|
51
|
+
// Space
|
|
52
|
+
case 32:
|
|
53
|
+
ev.preventDefault();
|
|
54
|
+
this.el.click();
|
|
55
|
+
break;
|
|
56
|
+
// Escape
|
|
57
|
+
case 27:
|
|
58
|
+
ev.preventDefault();
|
|
59
|
+
ev.stopPropagation(); // for instance if select is in a modal, esc should close the select but not the modal
|
|
60
|
+
this.wmEscKeyPressed.emit();
|
|
61
|
+
break;
|
|
62
|
+
// Home
|
|
63
|
+
case 36:
|
|
64
|
+
ev.preventDefault();
|
|
65
|
+
this.wmHomeKeyPressed.emit();
|
|
66
|
+
break;
|
|
67
|
+
// End
|
|
68
|
+
case 35:
|
|
69
|
+
ev.preventDefault();
|
|
70
|
+
this.wmEndKeyPressed.emit();
|
|
71
|
+
break;
|
|
72
|
+
// Tab
|
|
73
|
+
case 9:
|
|
74
|
+
this.wmTabKeyPressed.emit();
|
|
75
|
+
break;
|
|
76
|
+
default:
|
|
77
|
+
this.wmLetterPressed.emit(ev.key);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
handleSelection() {
|
|
81
|
+
if (!this.disabled) {
|
|
82
|
+
this.wmOptionSelected.emit();
|
|
83
|
+
// the parent wm-select is in charge of the actual selection
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
syncAriaSelected() {
|
|
87
|
+
// this function only keeps the aria-selected attr in sync with the selected prop
|
|
88
|
+
// all the logic for selecting / deselecting happens in the parent wm-select
|
|
89
|
+
this.selected ? this.el.setAttribute("aria-selected", "true") : this.el.removeAttribute("aria-selected");
|
|
90
|
+
}
|
|
91
|
+
syncAriaDisabled() {
|
|
92
|
+
this.disabled ? this.el.setAttribute("aria-disabled", "true") : this.el.removeAttribute("aria-disabled");
|
|
93
|
+
}
|
|
94
|
+
focusHandler(newValue) {
|
|
95
|
+
if (newValue)
|
|
96
|
+
this.el.focus();
|
|
97
|
+
}
|
|
98
|
+
updateDisabledOnClick() {
|
|
99
|
+
if (this.disabled && this.el.onclick) {
|
|
100
|
+
this.onClickFunc = this.el.onclick;
|
|
101
|
+
this.el.onclick = null;
|
|
102
|
+
}
|
|
103
|
+
else if (!this.disabled && this.onClickFunc) {
|
|
104
|
+
this.el.onclick = this.onClickFunc;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
componentWillLoad() {
|
|
108
|
+
this.syncAriaSelected();
|
|
109
|
+
this.syncAriaDisabled();
|
|
110
|
+
this.updateDisabledOnClick();
|
|
111
|
+
}
|
|
112
|
+
render() {
|
|
113
|
+
return (index.h(index.Host, { role: "option", tabindex: this.focused ? 0 : -1, class: `${this.subinfo ? "hassubinfo" : ""} ${this.isMultiChild ? "multi-option" : ""}` }, index.h("div", { class: `option-wrapper ${this.isMultiChild ? "checkbox" : ""}` }, index.h("slot", null)), index.h("div", { class: "subinfo" }, this.subinfo)));
|
|
114
|
+
}
|
|
115
|
+
get el() { return index.getElement(this); }
|
|
116
|
+
static get watchers() { return {
|
|
117
|
+
"selected": ["syncAriaSelected"],
|
|
118
|
+
"disabled": ["syncAriaDisabled", "updateDisabledOnClick"],
|
|
119
|
+
"focused": ["focusHandler"]
|
|
120
|
+
}; }
|
|
121
|
+
};
|
|
122
|
+
Option.style = wmOptionCss;
|
|
123
|
+
|
|
124
|
+
const wmSelectCss = "@charset \"UTF-8\";:host{position:relative;display:block;box-sizing:border-box;font-family:inherit}:host .sr-only{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}.wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;flex-direction:column;font-size:0.875rem}.wrapper .label{display:block;line-height:normal;font-weight:600;white-space:nowrap;margin-bottom:0.25rem}.wrapper .label .required{color:#c0392b}.wrapper.label-left{flex-direction:row}.wrapper.label-left .label-wrapper{line-height:2.5rem}.wrapper.label-left .label-wrapper .label{display:flex;align-items:center;min-height:2.5rem;white-space:normal;margin-bottom:0;margin-right:0.75rem}.wrapper.label-none label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}.wrapper.invalid .label{color:#c0392b}.wrapper.invalid .label:after{display:inline-block;font:normal normal normal 24px/1 \"Material Design Icons\";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:\"\";margin-left:0.3125rem}[dir=RTL] .wrapper.invalid .label:after{margin-left:0;margin-right:0.3125rem}.wrapper.rtl.label-left .label{margin-right:0;margin-left:0.75rem}.wrapper .dropdown{position:relative;font-size:1.125rem;color:#575195;min-width:8.75rem}.wrapper .dropdown .displayedoption{-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;display:flex;align-items:center;flex-wrap:nowrap;background:transparent;width:100%;border:solid 1px rgba(35, 35, 35, 0.6);padding:0 1.875rem 0 0.9375rem;cursor:pointer;height:2.5rem;line-height:normal;font-family:inherit;color:#575195;font-weight:400;font-size:0.875rem;text-transform:none;text-align:left}@media only screen and (max-width: 768px){.wrapper .dropdown .displayedoption{height:2.75rem}}.wrapper .dropdown .displayedoption:before{display:inline-block;font:normal normal normal 24px/1 \"Material Design Icons\";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:\"\";position:absolute;right:0.5625rem;pointer-events:none}.wrapper .dropdown .displayedoption:hover:not(:disabled):not(.-disabled):not(.-raised){background:transparent;text-decoration:none}.wrapper .dropdown .displayedoption:active{-ms-transform:scale(1, 1) !important;transform:scale(1, 1) !important}.wrapper .dropdown .displayedoption:focus{outline:none}.wrapper .dropdown .displayedoption::-moz-focus-inner{border:0}.wrapper .dropdown .displayedoption.user-is-tabbing:focus{-webkit-box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px #61279e;-moz-box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px #61279e;box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px #61279e}.wrapper .dropdown .displayedoption.user-is-tabbing:focus::-moz-focus-inner{border:0}.wrapper .dropdown .displayedoption .overflowcontrol{display:block;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;flex:1}.wrapper .dropdown .displayedoption .overflowcontrol.hassubinfo{display:flex}.wrapper .dropdown .displayedoption .overflowcontrol.hassubinfo .button-text{flex:1;text-overflow:ellipsis;overflow:hidden;min-width:0}.wrapper .dropdown .displayedoption .overflowcontrol.hassubinfo .subinfo{flex:none;font-style:italic}.wrapper .dropdown .displayedoption .overflow-counter{font-weight:bold;margin-left:0.5rem}.wrapper .dropdown>.displayedoption[disabled]{color:#6b6b6b;border-color:#8a8a8a;background:#f0f0f0;cursor:default}.wrapper .dropdown>.options{-webkit-overflow-scrolling:touch;overflow:auto;max-height:12.5rem;-webkit-box-shadow:0 4px 15px 0 rgba(0, 0, 0, 0.2);-moz-box-shadow:0 4px 15px 0 rgba(0, 0, 0, 0.2);box-shadow:0 4px 15px 0 rgba(0, 0, 0, 0.2);-ms-transition:transform 0.25s ease;-webkit-transition:transform 0.25s ease;-moz-transition:transform 0.25s ease;transition:transform 0.25s ease;-ms-transform:scale(1, 0);-webkit-transform:scale(1, 0);-moz-transform:scale(1, 0);transform:scale(1, 0);-ms-transform-origin:center top;-webkit-transform-origin:center top;-moz-transform-origin:center top;transform-origin:center top;-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;position:absolute;top:0;right:0;background:#fff;z-index:100;width:100%;font-size:0.875rem}.wrapper .dropdown>.options.upwards{top:unset;bottom:calc(100% - 2.5rem);-ms-transform-origin:center bottom;-webkit-transform-origin:center bottom;-moz-transform-origin:center bottom;transform-origin:center bottom}.wrapper .dropdown>.options.hidden{visibility:hidden}.wrapper .dropdown>.options.open{-ms-transform:scale(1, 1);-webkit-transform:scale(1, 1);-moz-transform:scale(1, 1);transform:scale(1, 1)}.wrapper.invalid .dropdown .displayedoption{-webkit-box-shadow:0 0 0 1px #c0392b;-moz-box-shadow:0 0 0 1px #c0392b;box-shadow:0 0 0 1px #c0392b;border-color:#c0392b}.wrapper .error-message{color:#c0392b;font-size:0.875rem;margin-top:0.25rem;margin-bottom:0.25rem;display:block;top:100%;left:0;font-style:italic}.rtl>.options{-ms-transform-origin:left top;-webkit-transform-origin:left top;-moz-transform-origin:left top;transform-origin:left top;left:0;right:auto}.rtl>.options .option{padding-left:3rem;padding-right:1.25rem}.rtl>.displayedoption{padding:0 0.9375rem 0 1.875rem;text-align:right}.rtl>.displayedoption:before{right:auto;left:0.5625rem}";
|
|
125
|
+
|
|
126
|
+
const Select = class {
|
|
127
|
+
constructor(hostRef) {
|
|
128
|
+
index.registerInstance(this, hostRef);
|
|
129
|
+
this.wmSelectDidLoad = index.createEvent(this, "wmSelectDidLoad", 7);
|
|
130
|
+
this.wmComponentBlurred = index.createEvent(this, "wmComponentBlurred", 7);
|
|
131
|
+
this.disabled = false;
|
|
132
|
+
this.invalid = false;
|
|
133
|
+
this.labelPosition = "top";
|
|
134
|
+
this.requiredField = false;
|
|
135
|
+
this.errorMessage = "";
|
|
136
|
+
this.multiple = false;
|
|
137
|
+
this.placeholder = functions.intl.formatMessage({
|
|
138
|
+
id: "select.multiPlaceholder",
|
|
139
|
+
defaultMessage: "Make a selection",
|
|
140
|
+
});
|
|
141
|
+
this.allSelectedMessage = functions.intl.formatMessage({
|
|
142
|
+
id: "select.allSelected",
|
|
143
|
+
defaultMessage: "All selected",
|
|
144
|
+
});
|
|
145
|
+
this.requiredMessage = functions.intl.formatMessage({
|
|
146
|
+
id: "global.requiredField",
|
|
147
|
+
defaultMessage: "required field",
|
|
148
|
+
});
|
|
149
|
+
this.isTabbing = false;
|
|
150
|
+
this.isExpanded = false;
|
|
151
|
+
this.keysSoFar = "";
|
|
152
|
+
this.searchIndex = 0;
|
|
153
|
+
this.keyClear = null;
|
|
154
|
+
this.openUp = false;
|
|
155
|
+
// for multiselect button text
|
|
156
|
+
this.overflowCount = 0;
|
|
157
|
+
this.displayedItems = [];
|
|
158
|
+
this.allSelected = false;
|
|
159
|
+
}
|
|
160
|
+
get childItems() {
|
|
161
|
+
return Array.from(this.el.querySelectorAll("wm-option"));
|
|
162
|
+
}
|
|
163
|
+
get selectedItems() {
|
|
164
|
+
return Array.from(this.el.querySelectorAll("wm-option")).filter((x) => x.selected);
|
|
165
|
+
}
|
|
166
|
+
toggleTabbingOn() {
|
|
167
|
+
this.isTabbing = true;
|
|
168
|
+
}
|
|
169
|
+
toggleTabbingOff() {
|
|
170
|
+
this.isTabbing = false;
|
|
171
|
+
}
|
|
172
|
+
handleOptionSelection(ev) {
|
|
173
|
+
if (!this.multiple) {
|
|
174
|
+
// ensure only one option is selected at a time
|
|
175
|
+
this.childItems
|
|
176
|
+
// remove selected on any other option
|
|
177
|
+
.filter((option) => option != ev.target && !!option.selected)
|
|
178
|
+
.map((option) => (option.selected = false));
|
|
179
|
+
}
|
|
180
|
+
this.focusItem(ev.target);
|
|
181
|
+
this.selectItem(ev.target);
|
|
182
|
+
if (!this.multiple) {
|
|
183
|
+
this.close();
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
handeChildEnter() {
|
|
187
|
+
// only occurs for multiselects. handle the click, then close
|
|
188
|
+
this.close();
|
|
189
|
+
}
|
|
190
|
+
handleChildUp(ev) {
|
|
191
|
+
this.moveUp(ev.target);
|
|
192
|
+
}
|
|
193
|
+
handleChildDown(ev) {
|
|
194
|
+
this.moveDown(ev.target);
|
|
195
|
+
}
|
|
196
|
+
moveToFirstItem() {
|
|
197
|
+
this.focusItem(this.childItems[0]);
|
|
198
|
+
}
|
|
199
|
+
moveToLastItem() {
|
|
200
|
+
this.focusItem(this.childItems[this.childItems.length - 1]);
|
|
201
|
+
}
|
|
202
|
+
handleTabKey() {
|
|
203
|
+
this.close(false);
|
|
204
|
+
}
|
|
205
|
+
closePopupOnEscape() {
|
|
206
|
+
this.close();
|
|
207
|
+
}
|
|
208
|
+
blurHandler(ev) {
|
|
209
|
+
const isElOrChild = ev.target === this.el || this.el.contains(ev.target);
|
|
210
|
+
if (!isElOrChild && this.isExpanded) {
|
|
211
|
+
this.close();
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
handleKey(ev) {
|
|
215
|
+
switch (ev.keyCode) {
|
|
216
|
+
// Arrow down
|
|
217
|
+
case 40:
|
|
218
|
+
if (this.isExpanded === false) {
|
|
219
|
+
ev.preventDefault();
|
|
220
|
+
this.open("next");
|
|
221
|
+
}
|
|
222
|
+
break;
|
|
223
|
+
// Arrow up
|
|
224
|
+
case 38:
|
|
225
|
+
if (this.isExpanded === false) {
|
|
226
|
+
ev.preventDefault();
|
|
227
|
+
this.open("previous");
|
|
228
|
+
}
|
|
229
|
+
break;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
componentWillLoad() {
|
|
233
|
+
if (!this.label) {
|
|
234
|
+
console.error("For accessibility purposes, this component requires a label (even if `label-position` is set to `none`).");
|
|
235
|
+
}
|
|
236
|
+
this.el.focus = function () {
|
|
237
|
+
if (!this.disabled) {
|
|
238
|
+
this.shadowRoot.querySelector("button").focus();
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
this.uid = this.el.id ? this.el.id : functions.generateId();
|
|
242
|
+
if (document.body.classList.contains("wmcl-user-is-tabbing")) {
|
|
243
|
+
this.toggleTabbingOn();
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
componentDidLoad() {
|
|
247
|
+
this.wmSelectDidLoad.emit();
|
|
248
|
+
if (!this.childItems.length) {
|
|
249
|
+
throw new Error("wm-select should have wm-option elements as children.");
|
|
250
|
+
}
|
|
251
|
+
if (this.multiple && this.childItems.filter((x) => x.subinfo).length > 0) {
|
|
252
|
+
throw new Error("wm-select with the multiple prop cannot have subinfo options");
|
|
253
|
+
}
|
|
254
|
+
if (this.multiple && !this.placeholder) {
|
|
255
|
+
throw new Error("wm-select with the multiple prop needs to also use the placeholder prop.");
|
|
256
|
+
}
|
|
257
|
+
// set initial selections / button text
|
|
258
|
+
if (this.selectedItems.length > 0) {
|
|
259
|
+
this.selectedItems.forEach((x) => this.displayedItems.push(x));
|
|
260
|
+
this.setButtonText();
|
|
261
|
+
// single Select only, pre-select if no default option from dev
|
|
262
|
+
}
|
|
263
|
+
else if (!this.multiple) {
|
|
264
|
+
this.selectItem(this.childItems[0]);
|
|
265
|
+
}
|
|
266
|
+
this.optionsEl.classList.add("hidden");
|
|
267
|
+
index.forceUpdate(this.el);
|
|
268
|
+
// Dev can overwrite the max-height rule set in the Sass file
|
|
269
|
+
if (this.maxHeight) {
|
|
270
|
+
this.optionsEl.style.maxHeight = this.maxHeight;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
moveUp(el) {
|
|
274
|
+
const prevEl = el.previousElementSibling;
|
|
275
|
+
if (prevEl) {
|
|
276
|
+
// scroll option to top of dropdown if partially obscured / out of view
|
|
277
|
+
if (prevEl.getBoundingClientRect().top < this.optionsEl.getBoundingClientRect().top) {
|
|
278
|
+
this.optionsEl.scrollTop =
|
|
279
|
+
prevEl.getBoundingClientRect().top - this.optionsEl.getBoundingClientRect().top + this.optionsEl.scrollTop;
|
|
280
|
+
}
|
|
281
|
+
this.focusItem(prevEl);
|
|
282
|
+
}
|
|
283
|
+
else {
|
|
284
|
+
this.focusItem(this.childItems[this.childItems.length - 1]);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
moveDown(el) {
|
|
288
|
+
const nextEl = el.nextElementSibling;
|
|
289
|
+
if (nextEl && nextEl.tagName !== "INPUT") {
|
|
290
|
+
// scroll option to bottom of dropdown if partially obscured / out of view
|
|
291
|
+
if (nextEl.getBoundingClientRect().bottom > this.optionsEl.getBoundingClientRect().bottom) {
|
|
292
|
+
this.optionsEl.scrollTop =
|
|
293
|
+
nextEl.getBoundingClientRect().bottom -
|
|
294
|
+
this.optionsEl.getBoundingClientRect().top +
|
|
295
|
+
this.optionsEl.scrollTop -
|
|
296
|
+
this.optionsEl.offsetHeight;
|
|
297
|
+
}
|
|
298
|
+
this.focusItem(nextEl);
|
|
299
|
+
}
|
|
300
|
+
else {
|
|
301
|
+
this.focusItem(this.childItems[0]);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
open(itemToSelect) {
|
|
305
|
+
if (!this.disabled) {
|
|
306
|
+
const elHeight = this.el.clientHeight;
|
|
307
|
+
const buttonHeight = this.buttonEl.clientHeight;
|
|
308
|
+
this.openUp = functions.shouldOpenUp(this.el, this.optionsEl,
|
|
309
|
+
// when opening up, dropdown covers both label and button
|
|
310
|
+
elHeight,
|
|
311
|
+
// when opening down, dropdown covers only the button
|
|
312
|
+
buttonHeight);
|
|
313
|
+
this.isExpanded = true;
|
|
314
|
+
this.optionsEl.classList.remove("hidden");
|
|
315
|
+
window.requestAnimationFrame(() => {
|
|
316
|
+
if (this.selectedItems.length > 0) {
|
|
317
|
+
if (itemToSelect === "next") {
|
|
318
|
+
this.moveDown(this.selectedItems[this.selectedItems.length - 1]);
|
|
319
|
+
}
|
|
320
|
+
else if (itemToSelect === "previous") {
|
|
321
|
+
this.moveUp(this.selectedItems[0]);
|
|
322
|
+
}
|
|
323
|
+
else {
|
|
324
|
+
this.focusItem(this.selectedItems[0]);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
else {
|
|
328
|
+
this.focusItem(this.childItems[0]);
|
|
329
|
+
}
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
close(returnFocus = true) {
|
|
334
|
+
this.isExpanded = false;
|
|
335
|
+
this.childItems.map((i) => (i.focused = false));
|
|
336
|
+
window.setTimeout(() => {
|
|
337
|
+
this.optionsEl.classList.add("hidden");
|
|
338
|
+
// Returns focus to button after popup closes (no need if user is tabbing)
|
|
339
|
+
// Delay is necessary for screenreader to get new expanded state before focus
|
|
340
|
+
// window.requestAnimationFrame is probably enough, but since we are already using setTimeout it may as well be here
|
|
341
|
+
// also UX wise, it makes sense for the button to only be focused after the animation is complete
|
|
342
|
+
if (returnFocus) {
|
|
343
|
+
this.el.focus();
|
|
344
|
+
}
|
|
345
|
+
}, 150);
|
|
346
|
+
}
|
|
347
|
+
focusItem(item) {
|
|
348
|
+
this.childItems.forEach((i) => (i.focused = i === item));
|
|
349
|
+
}
|
|
350
|
+
selectItem(item) {
|
|
351
|
+
if (this.multiple) {
|
|
352
|
+
item.selected = !item.selected;
|
|
353
|
+
}
|
|
354
|
+
else {
|
|
355
|
+
this.childItems.forEach((i) => (i.selected = i === item));
|
|
356
|
+
}
|
|
357
|
+
this.setButtonText();
|
|
358
|
+
}
|
|
359
|
+
findAndFocusItem(ev) {
|
|
360
|
+
const character = ev.detail.toUpperCase();
|
|
361
|
+
if (!this.keysSoFar) {
|
|
362
|
+
for (var i = 0; i < this.childItems.length; i++) {
|
|
363
|
+
if (this.childItems[i].focused) {
|
|
364
|
+
this.searchIndex = i;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
this.keysSoFar += character;
|
|
369
|
+
this.clearKeysSoFarAfterDelay();
|
|
370
|
+
var nextMatch = this.findMatchInRange(this.childItems, this.searchIndex + 1, this.childItems.length);
|
|
371
|
+
if (!nextMatch) {
|
|
372
|
+
nextMatch = this.findMatchInRange(this.childItems, 0, this.searchIndex);
|
|
373
|
+
}
|
|
374
|
+
if (nextMatch) {
|
|
375
|
+
this.focusItem(nextMatch);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
clearKeysSoFarAfterDelay() {
|
|
379
|
+
if (this.keyClear) {
|
|
380
|
+
window.clearTimeout(this.keyClear);
|
|
381
|
+
this.keyClear = null;
|
|
382
|
+
}
|
|
383
|
+
this.keyClear = window.setTimeout(function () {
|
|
384
|
+
this.keysSoFar = "";
|
|
385
|
+
this.keyClear = null;
|
|
386
|
+
}.bind(this), 500);
|
|
387
|
+
}
|
|
388
|
+
findMatchInRange(list, startIndex, endIndex) {
|
|
389
|
+
// Find the first item starting with the keysSoFar substring, searching in
|
|
390
|
+
// the specified range of items
|
|
391
|
+
for (var n = startIndex; n < endIndex; n++) {
|
|
392
|
+
var label = list[n].textContent;
|
|
393
|
+
if (label && label.toUpperCase().indexOf(this.keysSoFar) === 0) {
|
|
394
|
+
return list[n];
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
return null;
|
|
398
|
+
}
|
|
399
|
+
exposeErrors() {
|
|
400
|
+
// When the error changes, a new id is set for the error container and the button's aria-describedby attribute is updated accordingly. This is to make sure the screen reader announces teh updated errors in Firefox. See this longstanding bug: https://bugzilla.mozilla.org/show_bug.cgi?id=493683
|
|
401
|
+
const newId = functions.generateId();
|
|
402
|
+
this.errorContainer.id = `wm-errors-${newId}`;
|
|
403
|
+
this.buttonEl.setAttribute("aria-describedby", `wm-errors-${newId}`);
|
|
404
|
+
}
|
|
405
|
+
renderErrorContainer() {
|
|
406
|
+
return (index.h("div", { id: "wm-errors", class: this.errorMessage ? "error-message" : "", ref: (el) => (this.errorContainer = el), "aria-live": "assertive", "aria-atomic": "true" }, this.errorMessage));
|
|
407
|
+
}
|
|
408
|
+
handleComponentBlur() {
|
|
409
|
+
if (!this.isExpanded) {
|
|
410
|
+
this.wmComponentBlurred.emit();
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
setButtonText() {
|
|
414
|
+
this.displayedItems = this.childItems.filter((x) => x.selected);
|
|
415
|
+
this.allSelected = this.displayedItems.length === this.childItems.length;
|
|
416
|
+
// handle overflow + counter for multiselect
|
|
417
|
+
if (this.multiple) {
|
|
418
|
+
// this is a fixed measurement accounting for the max width of a 3 character overflow counter
|
|
419
|
+
const overflowCounterWidth = 38;
|
|
420
|
+
const computedStyle = window.getComputedStyle(this.buttonEl);
|
|
421
|
+
// there seems to be no quick way to get an elements width without padding, except for subtracting padding manually
|
|
422
|
+
const paddingLeft = parseInt(computedStyle.getPropertyValue("padding-left").slice(0, -2));
|
|
423
|
+
const paddingRight = parseInt(computedStyle.getPropertyValue("padding-right").slice(0, -2));
|
|
424
|
+
const availableSpace = this.buttonEl.clientWidth - paddingLeft - paddingRight - overflowCounterWidth;
|
|
425
|
+
let optionsWidths = this.displayedItems.map((x) => x.shadowRoot.querySelector(".option-wrapper").clientWidth);
|
|
426
|
+
let optionsTotalWidth = optionsWidths.reduce((acc, x) => acc + x, 0);
|
|
427
|
+
this.overflowCount = 0;
|
|
428
|
+
while (optionsTotalWidth > availableSpace && this.displayedItems.length > 1) {
|
|
429
|
+
this.overflowCount++;
|
|
430
|
+
optionsTotalWidth -= optionsWidths[optionsWidths.length - 1];
|
|
431
|
+
optionsWidths.pop();
|
|
432
|
+
this.displayedItems.pop();
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
renderButtonText() {
|
|
437
|
+
if (this.multiple && this.displayedItems.length < 1) {
|
|
438
|
+
return index.h("span", null, this.placeholder);
|
|
439
|
+
}
|
|
440
|
+
else if (this.multiple && this.allSelected && this.overflowCount > 0) {
|
|
441
|
+
return this.allSelectedMessage;
|
|
442
|
+
}
|
|
443
|
+
else {
|
|
444
|
+
return this.displayedItems.map((x, idx) => (index.h("span", null, idx > 0 ? ", " : "", x.textContent)));
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
renderSubinfo() {
|
|
448
|
+
// multiselects cannot have subinfo for options
|
|
449
|
+
if (!this.multiple && this.selectedItems.length > 0 && this.selectedItems[0].subinfo) {
|
|
450
|
+
return index.h("span", { class: "subinfo" }, this.selectedItems[0].subinfo);
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
renderOverflowCount() {
|
|
454
|
+
if (this.overflowCount > 0 && !this.allSelected) {
|
|
455
|
+
return (index.h("span", null, index.h("span", { class: "overflow-counter" }, "+", this.overflowCount)));
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
render() {
|
|
459
|
+
const buttonProps = {
|
|
460
|
+
id: `selectbtn-${this.uid}`,
|
|
461
|
+
["disabled"]: this.disabled,
|
|
462
|
+
["aria-controls"]: `list-${this.uid}`,
|
|
463
|
+
["aria-labelledby"]: `label-${this.uid} selectbtn-${this.uid}`,
|
|
464
|
+
["aria-describedby"]: "wm-errors",
|
|
465
|
+
["aria-expanded"]: this.isExpanded ? "true" : "false",
|
|
466
|
+
onClick: () => (this.isExpanded ? this.close() : this.open()),
|
|
467
|
+
onBlur: () => this.handleComponentBlur(),
|
|
468
|
+
};
|
|
469
|
+
return (index.h("div", { class: `wrapper ${functions.getTextDir()} label-${this.labelPosition} ${this.invalid || this.errorMessage ? "invalid" : ""}` }, index.h("div", { class: "label-wrapper" }, index.h("label", { class: "label", id: `label-${this.uid}`, htmlFor: `selectbtn-${this.uid}` }, this.label,
|
|
470
|
+
// we can't use aria-required or required attributes because it's invalid on the elements we're using (button controlling a listbox)
|
|
471
|
+
this.requiredField ? (index.h("span", { class: "required" }, index.h("span", { class: "sr-only" }, this.requiredMessage), index.h("span", { "aria-hidden": "true" }, "*"))) : (""))), index.h("div", { class: "dropdown" }, index.h("button", Object.assign({}, buttonProps, { class: `displayedoption ${this.isTabbing ? "user-is-tabbing" : ""}`, ref: (el) => (this.buttonEl = el) }), index.h("span", { class: this.selectedItems.length > 0 && this.selectedItems.filter((x) => x.subinfo).length > 0
|
|
472
|
+
? "overflowcontrol hassubinfo"
|
|
473
|
+
: "overflowcontrol" }, index.h("span", { class: "button-text" }, this.renderButtonText()), this.renderSubinfo()), this.renderOverflowCount()), index.h("div", { class: `options ${this.isExpanded ? "open" : ""} ${this.openUp ? "upwards" : ""}`, id: `list-${this.uid}`, tabindex: -1, role: "listbox", "aria-multiselectable": this.multiple ? "true" : null, "aria-labelledby": `label-${this.uid}`, ref: (el) => (this.optionsEl = el) }, index.h("slot", null)), this.renderErrorContainer())));
|
|
474
|
+
}
|
|
475
|
+
get el() { return index.getElement(this); }
|
|
476
|
+
static get watchers() { return {
|
|
477
|
+
"errorMessage": ["exposeErrors"]
|
|
478
|
+
}; }
|
|
479
|
+
};
|
|
480
|
+
Select.style = wmSelectCss;
|
|
481
|
+
|
|
482
|
+
exports.wm_option = Option;
|
|
483
|
+
exports.wm_select = Select;
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-d930307d.js');
|
|
6
|
+
const functions = require('./functions-e3f5ae65.js');
|
|
7
|
+
|
|
8
|
+
const wmPaginationCss = "nav .largescreen,nav .smallscreen{margin-bottom:0.625rem;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:flex-end;-ms-flex-pack:flex-end;-webkit-justify-content:flex-end;justify-content:flex-end;font-size:0.875rem}nav .largescreen .pageview,nav .smallscreen .pageview{font-size:0.875rem;margin:0 0.625rem}nav .largescreen .paginationbtn,nav .smallscreen .paginationbtn{position:relative;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;-ms-transition:none;-webkit-transition:none;-moz-transition:none;transition:none;border:none;color:#575195;background-color:transparent;margin:0;padding:0;height:2.5rem;width:2.5rem;font-family:inherit;letter-spacing:0.3px;font-size:0.875rem;font-weight:500;cursor:pointer;text-transform:none}nav .largescreen .paginationbtn svg *,nav .smallscreen .paginationbtn svg *{fill:#565397}nav .largescreen .paginationbtn:hover:not([aria-current=page]):not([disabled]),nav .smallscreen .paginationbtn:hover:not([aria-current=page]):not([disabled]){text-decoration:underline}nav .largescreen .paginationbtn:focus,nav .smallscreen .paginationbtn:focus{outline:none}nav .largescreen .paginationbtn::-moz-focus-inner,nav .smallscreen .paginationbtn::-moz-focus-inner{border:0;outline:none}nav .largescreen .paginationbtn[disabled],nav .smallscreen .paginationbtn[disabled]{color:#9f9f9f;pointer-events:none}nav .largescreen .paginationbtn[disabled] svg *,nav .smallscreen .paginationbtn[disabled] svg *{fill:#9f9f9f}nav .largescreen .previousbtn,nav .smallscreen .previousbtn{margin-right:0.625rem;width:auto !important}nav .largescreen .nextbtn,nav .smallscreen .nextbtn{margin-left:0.625rem;margin-right:0;width:auto !important}nav .largescreen .previousbtn,nav .largescreen .nextbtn,nav .smallscreen .previousbtn,nav .smallscreen .nextbtn{-ms-transition:none;-webkit-transition:none;-moz-transition:none;transition:none}nav .largescreen .ellipsis,nav .smallscreen .ellipsis{display:inline-block;width:2.5rem;text-align:center}nav .largescreen .pagebtncontainer.user-is-tabbing :focus:not(.-disabled):not([aria-current=page]),nav .smallscreen .pagebtncontainer.user-is-tabbing :focus:not(.-disabled):not([aria-current=page]){-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}nav .largescreen .pagebtncontainer.user-is-tabbing :focus:not(.-disabled):not([aria-current=page]):before,nav .smallscreen .pagebtncontainer.user-is-tabbing :focus:not(.-disabled):not([aria-current=page]):before{position:absolute;content:\"\";height:auto;width:16px;top:0;bottom:0;left:12px;right:0;background:linear-gradient(90deg, #3862e9 66%, transparent 0) repeat-x;background-size:6px 2px;background-position:0 2em;border-radius:0;line-height:normal}nav .largescreen .pagebtncontainer.user-is-tabbing :focus:not(.-disabled):not([aria-current=page]).previousbtn:focus:before,nav .smallscreen .pagebtncontainer.user-is-tabbing :focus:not(.-disabled):not([aria-current=page]).previousbtn:focus:before{left:0 !important}nav .largescreen .pagebtncontainer.user-is-tabbing :focus:not(.-disabled):not([aria-current=page]).nextbtn:focus:before,nav .smallscreen .pagebtncontainer.user-is-tabbing :focus:not(.-disabled):not([aria-current=page]).nextbtn:focus:before{left:0 !important}nav .largescreen .pagebtncontainer.user-is-tabbing [aria-current=page]:focus,nav .smallscreen .pagebtncontainer.user-is-tabbing [aria-current=page]:focus{-webkit-box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px #61279e;-moz-box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px #61279e;box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px #61279e}nav .largescreen .pagebtncontainer.user-is-tabbing [aria-current=page]:focus::-moz-focus-inner,nav .smallscreen .pagebtncontainer.user-is-tabbing [aria-current=page]:focus::-moz-focus-inner{border:0}nav .largescreen .user-is-tabbing :focus:not(.-disabled):not([aria-current=page]).previousbtn:focus:before{width:56px !important}nav .largescreen .user-is-tabbing :focus:not(.-disabled):not([aria-current=page]).nextbtn:focus:before{width:32px !important}nav .largescreen .paginationbtn[aria-current=page]{-webkit-border-radius:50%;-moz-border-radius:50%;-ms-border-radius:50%;border-radius:50%;-webkit-box-shadow:0 2px 2px 0 rgba(87, 81, 149, 0.12), 0 2px 2px 0 rgba(0, 0, 0, 0.2);-moz-box-shadow:0 2px 2px 0 rgba(87, 81, 149, 0.12), 0 2px 2px 0 rgba(0, 0, 0, 0.2);box-shadow:0 2px 2px 0 rgba(87, 81, 149, 0.12), 0 2px 2px 0 rgba(0, 0, 0, 0.2);background-color:#575195;color:#fff}nav .largescreen .paginationbtn[aria-current=page]:hover{-webkit-box-shadow:0 4px 2px 0 rgba(87, 81, 149, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.2);-moz-box-shadow:0 4px 2px 0 rgba(87, 81, 149, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.2);box-shadow:0 4px 2px 0 rgba(87, 81, 149, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.2);background:#4e4986}.sr-only{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}";
|
|
9
|
+
|
|
10
|
+
const Pagination = class {
|
|
11
|
+
constructor(hostRef) {
|
|
12
|
+
index.registerInstance(this, hostRef);
|
|
13
|
+
this.pageClicked = index.createEvent(this, "pageClicked", 7);
|
|
14
|
+
this.focusCurrentPage = index.createEvent(this, "focusCurrentPage", 7);
|
|
15
|
+
this.currentPage = 1;
|
|
16
|
+
this.totalItems = undefined;
|
|
17
|
+
this.itemsPerPage = undefined;
|
|
18
|
+
this.value = 1;
|
|
19
|
+
this.isLargeViewport = window.innerWidth > 600;
|
|
20
|
+
this.isTabbing = false;
|
|
21
|
+
this.srAnnouncement = "";
|
|
22
|
+
this.totalPages = 0;
|
|
23
|
+
this.debouncedResize = functions.debounce(() => {
|
|
24
|
+
this.isLargeViewport = window.innerWidth > 600;
|
|
25
|
+
}, 250);
|
|
26
|
+
this.getMiddlePageNums = () => {
|
|
27
|
+
let coreBtns;
|
|
28
|
+
// if pg is 1, 2 or 3
|
|
29
|
+
if (this.currentPage < 4) {
|
|
30
|
+
coreBtns = [2, 3, 4];
|
|
31
|
+
}
|
|
32
|
+
else if (this.currentPage > this.totalPages - 3) {
|
|
33
|
+
coreBtns = [this.totalPages - 3, this.totalPages - 2, this.totalPages - 1];
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
coreBtns = [this.currentPage - 1, this.currentPage, this.currentPage + 1];
|
|
37
|
+
}
|
|
38
|
+
return coreBtns;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
toggleTabbingOn() {
|
|
42
|
+
this.isTabbing = true;
|
|
43
|
+
}
|
|
44
|
+
toggleTabbingOff() {
|
|
45
|
+
this.isTabbing = false;
|
|
46
|
+
}
|
|
47
|
+
maintainFocusOnNumberChange(el) {
|
|
48
|
+
window.requestAnimationFrame(() => {
|
|
49
|
+
switch (el) {
|
|
50
|
+
case "previous":
|
|
51
|
+
this.currentPage === 1 && this.el.shadowRoot.querySelector(`button#wm-1`).focus(); //Only shift focus from previous button to page 1 if page 1 is reached, which disables previous button. Otherwise, maintain focus on previous button.
|
|
52
|
+
break;
|
|
53
|
+
case "next":
|
|
54
|
+
this.currentPage === this.totalPages &&
|
|
55
|
+
this.el.shadowRoot.querySelector(`button#wm-${this.totalPages}`).focus(); //Only shift focus from next button if last page is reached, disabling next button. Otherwise, maintain focus on next button.
|
|
56
|
+
break;
|
|
57
|
+
case "prev-arrow":
|
|
58
|
+
this.currentPage === 1 && this.el.shadowRoot.querySelector("#next-arw").focus(); //Only shift focus if page 1 is reached, disabling previous buttons. Otherwise, maintain focus on previous buttons.
|
|
59
|
+
break;
|
|
60
|
+
case "next-arrow":
|
|
61
|
+
this.currentPage === this.totalPages && this.el.shadowRoot.querySelector("#previous-arw").focus(); //Only shift focus if last page is reached, disabling next buttons. Otherwise, maintain focus on next buttons.
|
|
62
|
+
break;
|
|
63
|
+
case "page":
|
|
64
|
+
this.el.shadowRoot.querySelector(`button#wm-${this.currentPage}`).focus();
|
|
65
|
+
default:
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
handleResize() {
|
|
71
|
+
this.debouncedResize();
|
|
72
|
+
}
|
|
73
|
+
calculateTotalPages() {
|
|
74
|
+
this.totalPages = Math.ceil(this.totalItems / this.itemsPerPage);
|
|
75
|
+
}
|
|
76
|
+
componentWillLoad() {
|
|
77
|
+
if (!this.totalItems || !this.itemsPerPage || !this.currentPage) {
|
|
78
|
+
throw new Error("Please check the required attributes");
|
|
79
|
+
}
|
|
80
|
+
this.calculateTotalPages();
|
|
81
|
+
if (document.body.classList.contains("wmcl-user-is-tabbing")) {
|
|
82
|
+
this.toggleTabbingOn();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
updatePageDisplayed(pageNum) {
|
|
86
|
+
this.value = pageNum;
|
|
87
|
+
this.pageClicked.emit();
|
|
88
|
+
this.srAnnouncement = `Current page, ${this.currentPage}. ${this.getCurrentPagesInView()}`;
|
|
89
|
+
}
|
|
90
|
+
displayShortPagination() {
|
|
91
|
+
let pages = [];
|
|
92
|
+
for (let i = 1; i <= this.totalPages; i++) {
|
|
93
|
+
pages.push(this.displayPageNumber(i));
|
|
94
|
+
}
|
|
95
|
+
return pages;
|
|
96
|
+
}
|
|
97
|
+
displayLongPagination() {
|
|
98
|
+
let view = [
|
|
99
|
+
this.displayPageNumber(1),
|
|
100
|
+
this.currentPage > 3 && this.displayEllipsis(),
|
|
101
|
+
...this.getMiddlePageNums().map((page) => this.displayPageNumber(page)),
|
|
102
|
+
this.currentPage + 2 < this.totalPages && this.displayEllipsis(),
|
|
103
|
+
this.displayPageNumber(this.totalPages),
|
|
104
|
+
];
|
|
105
|
+
return view;
|
|
106
|
+
}
|
|
107
|
+
displayPageNumber(pageNum) {
|
|
108
|
+
return (index.h("button", { id: `wm-${pageNum}`, class: "paginationbtn", onClick: () => {
|
|
109
|
+
this.currentPage = pageNum;
|
|
110
|
+
this.updatePageDisplayed(pageNum);
|
|
111
|
+
this.maintainFocusOnNumberChange("page");
|
|
112
|
+
}, value: pageNum, "aria-label": this.currentPage !== pageNum ? `Go to page ${pageNum}` : "", "aria-current": this.currentPage === pageNum ? "page" : undefined }, pageNum));
|
|
113
|
+
}
|
|
114
|
+
displayEllipsis() {
|
|
115
|
+
return index.h("span", { class: "ellipsis" }, "...");
|
|
116
|
+
}
|
|
117
|
+
// displayPageView = () => {
|
|
118
|
+
// // let end = this.itemsPerPage! * this.currentPage;
|
|
119
|
+
// // const begin = end - this.itemsPerPage! + 1;
|
|
120
|
+
// // if (end > this.totalItems!) {
|
|
121
|
+
// // end = this.totalItems!;
|
|
122
|
+
// // }
|
|
123
|
+
// return <div class="pageview">{this.getCurrentView()}</div>;
|
|
124
|
+
// };
|
|
125
|
+
getCurrentPagesInView() {
|
|
126
|
+
let end = this.itemsPerPage * this.currentPage;
|
|
127
|
+
const begin = end - this.itemsPerPage + 1;
|
|
128
|
+
if (end > this.totalItems) {
|
|
129
|
+
end = this.totalItems;
|
|
130
|
+
}
|
|
131
|
+
return "Viewing " + (begin === end ? `${begin}` : `${begin}–${end} of ${this.totalItems}`);
|
|
132
|
+
}
|
|
133
|
+
renderLarge() {
|
|
134
|
+
return (index.h("div", { class: "largescreen" }, index.h("div", { class: "pageview" }, this.getCurrentPagesInView()), index.h("div", { class: `pagebtncontainer ${this.isTabbing ? "user-is-tabbing" : ""}` }, index.h("button", { id: "previous", class: "paginationbtn previousbtn", onClick: () => {
|
|
135
|
+
this.currentPage = this.currentPage - 1;
|
|
136
|
+
this.updatePageDisplayed(this.currentPage);
|
|
137
|
+
this.maintainFocusOnNumberChange("previous");
|
|
138
|
+
}, disabled: this.currentPage === 1, "aria-label": "Go to previous page", "aria-controls": "status" }, "Previous"), this.totalPages < 6 ? this.displayShortPagination() : this.displayLongPagination(), index.h("button", { id: "next", class: "paginationbtn nextbtn", onClick: () => {
|
|
139
|
+
this.currentPage = this.currentPage + 1;
|
|
140
|
+
this.updatePageDisplayed(this.currentPage);
|
|
141
|
+
this.maintainFocusOnNumberChange("next");
|
|
142
|
+
}, disabled: this.currentPage === this.totalPages, "aria-label": "Go to next page", "aria-controls": "status" }, "Next"))));
|
|
143
|
+
}
|
|
144
|
+
renderSmall() {
|
|
145
|
+
return (index.h("div", { class: "smallscreen" }, index.h("div", { class: `pagebtncontainer ${this.isTabbing ? "user-is-tabbing" : ""}` }, index.h("button", { id: `wm-1-arw`, class: "paginationbtn", onClick: () => {
|
|
146
|
+
this.currentPage = 1;
|
|
147
|
+
this.updatePageDisplayed(1);
|
|
148
|
+
this.maintainFocusOnNumberChange("prev-arrow");
|
|
149
|
+
}, value: 1, "aria-current": this.currentPage === 1 ? "page" : undefined, "aria-label": `Go to page 1`, "aria-controls": "status", disabled: this.currentPage === 1 }, index.h("svg", { width: "16", height: "12", xmlns: "http://www.w3.org/2000/svg" }, index.h("path", { d: "M7.41 10.59L2.83 6l4.58-4.59L6 0 0 6l6 6zM15.41 10.59L10.83 6l4.58-4.59L14 0 8 6l6 6z" }))), index.h("button", { id: "previous-arw", class: "paginationbtn previousbtn", onClick: () => {
|
|
150
|
+
this.currentPage -= 1;
|
|
151
|
+
this.updatePageDisplayed(this.currentPage);
|
|
152
|
+
this.maintainFocusOnNumberChange("prev-arrow");
|
|
153
|
+
}, disabled: this.currentPage === 1, "aria-label": "Go to previous page" }, index.h("svg", { width: "8", height: "12", xmlns: "http://www.w3.org/2000/svg" }, index.h("path", { d: "M7.41 10.59L2.83 6l4.58-4.59L6 0 0 6l6 6z" }))), "Page ", this.currentPage, " of ", this.totalPages, index.h("button", { id: "next-arw", class: "paginationbtn nextbtn", onClick: () => {
|
|
154
|
+
this.currentPage += 1;
|
|
155
|
+
this.updatePageDisplayed(this.currentPage);
|
|
156
|
+
this.maintainFocusOnNumberChange("next-arrow");
|
|
157
|
+
}, disabled: this.currentPage === this.totalPages, "aria-label": "Go to next page" }, index.h("svg", { width: "8", height: "12", xmlns: "http://www.w3.org/2000/svg" }, index.h("path", { d: "M.59 10.59L5.17 6 .59 1.41 2 0l6 6-6 6z" }))), index.h("button", { id: `wm-${this.totalPages}-arw`, class: "paginationbtn", onClick: () => {
|
|
158
|
+
this.currentPage = this.totalPages;
|
|
159
|
+
this.updatePageDisplayed(this.totalPages);
|
|
160
|
+
this.maintainFocusOnNumberChange("next-arrow");
|
|
161
|
+
}, value: this.totalPages, "aria-current": this.currentPage === this.totalPages ? "page" : undefined, "aria-label": `Go to last page, page ${this.totalPages}`, "aria-controls": "status", disabled: this.currentPage === this.totalPages }, index.h("svg", { width: "17", height: "12", xmlns: "http://www.w3.org/2000/svg" }, index.h("path", { d: "M.59 10.59L5.17 6 .59 1.41 2 0l6 6-6 6zM9.59 10.59L14.17 6 9.59 1.41 11 0l6 6-6 6z" }))))));
|
|
162
|
+
}
|
|
163
|
+
render() {
|
|
164
|
+
return (
|
|
165
|
+
// do not render the component if there's only one page
|
|
166
|
+
this.totalItems > this.itemsPerPage && (index.h("nav", { "aria-label": `Pagination Navigation. ${this.getCurrentPagesInView()}. Current page, ${this.currentPage}.` }, this.isLargeViewport ? this.renderLarge() : this.renderSmall(), index.h("div", { id: "status", class: "sr-only", "aria-live": "polite", "aria-relevant": "text", "aria-atomic": "true" }, this.srAnnouncement))));
|
|
167
|
+
}
|
|
168
|
+
get el() { return index.getElement(this); }
|
|
169
|
+
static get watchers() { return {
|
|
170
|
+
"totalItems": ["calculateTotalPages"],
|
|
171
|
+
"itemsPerPage": ["calculateTotalPages"]
|
|
172
|
+
}; }
|
|
173
|
+
};
|
|
174
|
+
Pagination.style = wmPaginationCss;
|
|
175
|
+
|
|
176
|
+
exports.wm_pagination = Pagination;
|