@lion/ui 0.18.0-menu-system.5 → 0.18.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/collapsible.js +0 -1
- package/components/button/src/LionButton.js +0 -4
- package/components/button/test-suites/LionButton.suite.js +0 -1
- package/components/calendar/src/LionCalendar.js +1 -3
- package/components/combobox/test/lion-combobox.test.js +0 -1
- package/components/form-core/src/form-group/FormGroupMixin.js +0 -7
- package/components/form-core/src/registration/FormRegistrarMixin.js +0 -11
- package/components/form-core/test/FormControlMixin.test.js +0 -1
- package/components/form-core/test/validate/Validator.test.js +0 -2
- package/components/form-core/test-suites/ValidateMixin.suite.js +0 -2
- package/components/form-core/test-suites/ValidateMixinFeedbackPart.suite.js +0 -1
- package/components/input-datepicker/src/localizeNamespaceLoader.js +0 -1
- package/components/input-datepicker/test/lion-input-datepicker.test.js +6 -5
- package/components/listbox/test-suites/ListboxMixin.suite.js +1 -7
- package/components/localize/src/date/utils/normalizeIntlDate.js +2 -3
- package/components/localize/test/date/formatDate.test.js +2 -3
- package/components/overlays/src/OverlayController.js +110 -278
- package/components/overlays/src/OverlayMixin.js +11 -58
- package/components/overlays/src/OverlaysManager.js +2 -2
- package/components/overlays/src/configurations/withDropdownConfig.js +2 -22
- package/components/overlays/src/configurations/withPopoverConfig.js +32 -0
- package/components/overlays/src/utils/adopt-styles.js +5 -4
- package/components/overlays/src/utils/get-focusable-elements.js +0 -4
- package/components/overlays/src/utils/is-equal-config.js +6 -10
- package/components/overlays/test/OverlayController.test.js +21 -128
- package/components/overlays/test/utils-tests/is-equal-config.test.js +1 -1
- package/components/overlays/test-suites/OverlayMixin.suite.js +8 -8
- package/components/overlays/types/ArrowMixinTypes.ts +1 -3
- package/components/overlays/types/OverlayConfig.ts +5 -20
- package/components/select-rich/test/lion-select-rich.test.js +0 -3
- package/components/switch/src/LionSwitchButton.js +8 -3
- package/components/switch/test/lion-switch-button.test.js +38 -0
- package/custom-elements.json +17566 -30468
- package/dist-types/components/button/src/LionButton.d.ts +0 -1
- package/dist-types/components/button/src/LionButton.d.ts.map +1 -1
- package/dist-types/components/button/test-suites/LionButton.suite.d.ts.map +1 -1
- package/dist-types/components/calendar/src/LionCalendar.d.ts.map +1 -1
- package/dist-types/components/dialog/src/LionDialog.d.ts +1 -5
- package/dist-types/components/dialog/src/LionDialog.d.ts.map +1 -1
- package/dist-types/components/form-core/src/form-group/FormGroupMixin.d.ts.map +1 -1
- package/dist-types/components/form-core/src/registration/FormRegistrarMixin.d.ts.map +1 -1
- package/dist-types/components/form-core/test-suites/ValidateMixin.suite.d.ts.map +1 -1
- package/dist-types/components/form-core/test-suites/ValidateMixinFeedbackPart.suite.d.ts.map +1 -1
- package/dist-types/components/input-datepicker/src/localizeNamespaceLoader.d.ts.map +1 -1
- package/dist-types/components/listbox/test-suites/ListboxMixin.suite.d.ts.map +1 -1
- package/dist-types/components/localize/src/date/utils/normalizeIntlDate.d.ts.map +1 -1
- package/dist-types/components/overlays/src/OverlayController.d.ts +12 -24
- package/dist-types/components/overlays/src/OverlayController.d.ts.map +1 -1
- package/dist-types/components/overlays/src/OverlayMixin.d.ts.map +1 -1
- package/dist-types/components/overlays/src/configurations/withDropdownConfig.d.ts +0 -1
- package/dist-types/components/overlays/src/configurations/withDropdownConfig.d.ts.map +1 -1
- package/dist-types/components/overlays/src/configurations/withPopoverConfig.d.ts +6 -0
- package/dist-types/components/overlays/src/configurations/withPopoverConfig.d.ts.map +1 -0
- package/dist-types/components/overlays/src/utils/get-focusable-elements.d.ts.map +1 -1
- package/dist-types/components/overlays/src/utils/is-equal-config.d.ts.map +1 -1
- package/dist-types/components/overlays/types/ArrowMixinTypes.d.ts.map +1 -1
- package/dist-types/components/overlays/types/OverlayConfig.d.ts +2 -12
- package/dist-types/components/overlays/types/OverlayConfig.d.ts.map +1 -1
- package/dist-types/components/select-rich/src/LionSelectRich.d.ts +2 -10
- package/dist-types/components/select-rich/src/LionSelectRich.d.ts.map +1 -1
- package/dist-types/components/switch/src/LionSwitchButton.d.ts +6 -0
- package/dist-types/components/switch/src/LionSwitchButton.d.ts.map +1 -1
- package/dist-types/exports/overlays.d.ts +1 -3
- package/dist-types/exports/overlays.d.ts.map +1 -1
- package/dist-types/tsconfig.tsbuildinfo +1 -1
- package/docs/components/checkbox-group/overview.md +2 -2
- package/docs/components/collapsible/overview.md +1 -1
- package/docs/components/combobox/api-table.md +8 -21
- package/docs/components/combobox/overview.md +1 -1
- package/docs/components/combobox/use-cases.md +1 -1
- package/docs/components/dialog/api-table.md +6 -31
- package/docs/components/dialog/overview.md +1 -1
- package/docs/components/fieldset/overview.md +5 -5
- package/docs/components/form/overview.md +3 -3
- package/docs/components/form/use-cases.md +2 -2
- package/docs/components/icon/use-cases.md +1 -1
- package/docs/components/input/overview.md +1 -1
- package/docs/components/input-amount/overview.md +3 -3
- package/docs/components/input-date/overview.md +3 -3
- package/docs/components/input-datepicker/api-table.md +4 -21
- package/docs/components/input-datepicker/overview.md +5 -5
- package/docs/components/input-email/overview.md +2 -2
- package/docs/components/input-file/overview.md +1 -1
- package/docs/components/input-iban/overview.md +2 -2
- package/docs/components/input-range/overview.md +2 -2
- package/docs/components/input-stepper/overview.md +1 -1
- package/docs/components/input-tel/overview.md +1 -1
- package/docs/components/input-tel/use-cases.md +6 -6
- package/docs/components/input-tel-dropdown/overview.md +1 -1
- package/docs/components/listbox/use-cases.md +1 -1
- package/docs/components/radio-group/overview.md +3 -3
- package/docs/components/select/use-cases.md +1 -1
- package/docs/components/select-rich/api-table.md +5 -21
- package/docs/components/select-rich/use-cases.md +2 -2
- package/docs/components/switch/api-table.md +2 -0
- package/docs/components/tabs/examples.md +1 -1
- package/docs/components/tooltip/api-table.md +11 -36
- package/docs/fundamentals/index.md +4 -4
- package/docs/fundamentals/node-tools/publish-docs/overview.md +3 -3
- package/docs/fundamentals/node-tools/rocket-preset-extend-lion-docs/overview.md +2 -2
- package/docs/fundamentals/rationales/accessibility.md +1 -1
- package/docs/fundamentals/systems/core/SlotMixin.md +1 -1
- package/docs/fundamentals/systems/core/overview.md +1 -1
- package/docs/fundamentals/systems/form/formatting-and-parsing.md +4 -4
- package/docs/fundamentals/systems/form/model-value.md +1 -1
- package/docs/fundamentals/systems/form/overview.md +28 -28
- package/docs/fundamentals/systems/form/validate.md +2 -2
- package/docs/fundamentals/systems/localize/overview.md +4 -4
- package/docs/fundamentals/systems/overlays/api-table.md +34 -36
- package/docs/fundamentals/systems/overlays/configuration.md +2 -2
- package/docs/fundamentals/systems/overlays/overview.md +5 -5
- package/docs/fundamentals/systems/overlays/use-cases.md +2 -2
- package/docs/fundamentals/tools/helpers/overview.md +1 -1
- package/docs/fundamentals/tools/singleton-manager/overview.md +4 -4
- package/docs/guides/how-to/create-a-custom-field.md +5 -5
- package/docs/guides/how-to/create-a-form.md +4 -4
- package/docs/guides/how-to/extend-a-native-input.md +2 -2
- package/docs/guides/how-to/index.md +1 -1
- package/docs/guides/index.md +8 -8
- package/docs/guides/principles/index.md +5 -5
- package/docs/guides/principles/styling.md +1 -1
- package/exports/collapsible.js +0 -1
- package/exports/overlays.js +1 -6
- package/overlays.js +1 -6
- package/package.json +1 -1
- package/components/collapsible/src/DisclosureMixin.js +0 -313
- package/components/collapsible/test-suites/DisclosureMixin.suite.js +0 -30
- package/components/collapsible/types/DisclosureMixinTypes.ts +0 -48
- package/components/menu/CHANGELOG.md +0 -37
- package/components/menu/README.md +0 -335
- package/components/menu/index.js +0 -2
- package/components/menu/lion-menu-overlay.js +0 -3
- package/components/menu/lion-menu.js +0 -3
- package/components/menu/lion-spinbutton.js +0 -3
- package/components/menu/lion-toolbar.js +0 -3
- package/components/menu/lion-tree.js +0 -3
- package/components/menu/package.json +0 -46
- package/components/menu/requirements.temp.md +0 -12
- package/components/menu/src/InteractiveListMixin.js +0 -838
- package/components/menu/src/LionMenu.js +0 -250
- package/components/menu/src/LionMenuHybrid.js +0 -46
- package/components/menu/src/LionMenuOverlay.js +0 -155
- package/components/menu/src/LionSpinbutton.js +0 -213
- package/components/menu/src/LionToolbar.js +0 -94
- package/components/menu/src/LionTree.js +0 -52
- package/components/menu/src/MoreButtonMenuMixin.js +0 -287
- package/components/menu/src/MultiLevelListMixin.js +0 -274
- package/components/menu/src/utils/isInView.js +0 -26
- package/components/menu/src/utils/listItemInteractions.js +0 -123
- package/components/menu/src/utils/uuid.js +0 -3
- package/components/menu/test/lion-menu.test.js +0 -4
- package/components/menu/test-suites/InteractiveListMixin.suite.js +0 -304
- package/components/menu/types/InteractiveListMixinTypes.d.ts +0 -82
- package/components/navigation-bar/README.md +0 -1
- package/components/navigation-bar/src/LionNavigationBar.js +0 -439
- package/components/navigation-bar/src/types.js +0 -41
- package/components/overlays/NEXT.md +0 -49
- package/dist-types/components/collapsible/src/DisclosureMixin.d.ts +0 -3
- package/dist-types/components/collapsible/src/DisclosureMixin.d.ts.map +0 -1
- package/dist-types/components/collapsible/test-suites/DisclosureMixin.suite.d.ts +0 -2
- package/dist-types/components/collapsible/test-suites/DisclosureMixin.suite.d.ts.map +0 -1
- package/dist-types/components/collapsible/types/DisclosureMixinTypes.d.ts +0 -24
- package/dist-types/components/collapsible/types/DisclosureMixinTypes.d.ts.map +0 -1
- package/dist-types/components/menu/index.d.ts +0 -3
- package/dist-types/components/menu/index.d.ts.map +0 -1
- package/dist-types/components/menu/lion-menu-overlay.d.ts +0 -2
- package/dist-types/components/menu/lion-menu-overlay.d.ts.map +0 -1
- package/dist-types/components/menu/lion-menu.d.ts +0 -2
- package/dist-types/components/menu/lion-menu.d.ts.map +0 -1
- package/dist-types/components/menu/lion-spinbutton.d.ts +0 -2
- package/dist-types/components/menu/lion-spinbutton.d.ts.map +0 -1
- package/dist-types/components/menu/lion-toolbar.d.ts +0 -2
- package/dist-types/components/menu/lion-toolbar.d.ts.map +0 -1
- package/dist-types/components/menu/lion-tree.d.ts +0 -2
- package/dist-types/components/menu/lion-tree.d.ts.map +0 -1
- package/dist-types/components/menu/src/InteractiveListMixin.d.ts +0 -617
- package/dist-types/components/menu/src/InteractiveListMixin.d.ts.map +0 -1
- package/dist-types/components/menu/src/LionMenu.d.ts +0 -565
- package/dist-types/components/menu/src/LionMenu.d.ts.map +0 -1
- package/dist-types/components/menu/src/LionMenuHybrid.d.ts +0 -19
- package/dist-types/components/menu/src/LionMenuHybrid.d.ts.map +0 -1
- package/dist-types/components/menu/src/LionMenuOverlay.d.ts +0 -1013
- package/dist-types/components/menu/src/LionMenuOverlay.d.ts.map +0 -1
- package/dist-types/components/menu/src/LionSpinbutton.d.ts +0 -58
- package/dist-types/components/menu/src/LionSpinbutton.d.ts.map +0 -1
- package/dist-types/components/menu/src/LionToolbar.d.ts +0 -8
- package/dist-types/components/menu/src/LionToolbar.d.ts.map +0 -1
- package/dist-types/components/menu/src/LionTree.d.ts +0 -447
- package/dist-types/components/menu/src/LionTree.d.ts.map +0 -1
- package/dist-types/components/menu/src/MoreButtonMenuMixin.d.ts +0 -40
- package/dist-types/components/menu/src/MoreButtonMenuMixin.d.ts.map +0 -1
- package/dist-types/components/menu/src/MultiLevelListMixin.d.ts +0 -495
- package/dist-types/components/menu/src/MultiLevelListMixin.d.ts.map +0 -1
- package/dist-types/components/menu/src/utils/isInView.d.ts +0 -9
- package/dist-types/components/menu/src/utils/isInView.d.ts.map +0 -1
- package/dist-types/components/menu/src/utils/listItemInteractions.d.ts +0 -48
- package/dist-types/components/menu/src/utils/listItemInteractions.d.ts.map +0 -1
- package/dist-types/components/menu/src/utils/uuid.d.ts +0 -2
- package/dist-types/components/menu/src/utils/uuid.d.ts.map +0 -1
- package/dist-types/components/menu/test/lion-menu.test.d.ts +0 -2
- package/dist-types/components/menu/test/lion-menu.test.d.ts.map +0 -1
- package/dist-types/components/menu/test-suites/InteractiveListMixin.suite.d.ts +0 -14
- package/dist-types/components/menu/test-suites/InteractiveListMixin.suite.d.ts.map +0 -1
- package/dist-types/components/navigation-bar/src/LionNavigationBar.d.ts +0 -238
- package/dist-types/components/navigation-bar/src/LionNavigationBar.d.ts.map +0 -1
- package/dist-types/components/navigation-bar/src/types.d.ts +0 -85
- package/dist-types/components/navigation-bar/src/types.d.ts.map +0 -1
- package/dist-types/exports/define/lion-item.d.ts +0 -2
- package/dist-types/exports/define/lion-item.d.ts.map +0 -1
- package/dist-types/exports/define/lion-menu-overlay.d.ts +0 -2
- package/dist-types/exports/define/lion-menu-overlay.d.ts.map +0 -1
- package/dist-types/exports/define/lion-menu.d.ts +0 -2
- package/dist-types/exports/define/lion-menu.d.ts.map +0 -1
- package/dist-types/exports/define/lion-navigation-bar.d.ts +0 -2
- package/dist-types/exports/define/lion-navigation-bar.d.ts.map +0 -1
- package/dist-types/exports/define/lion-toolbar.d.ts +0 -2
- package/dist-types/exports/define/lion-toolbar.d.ts.map +0 -1
- package/dist-types/exports/define/lion-tree.d.ts +0 -2
- package/dist-types/exports/define/lion-tree.d.ts.map +0 -1
- package/dist-types/exports/menu-test-suites.d.ts +0 -2
- package/dist-types/exports/menu-test-suites.d.ts.map +0 -1
- package/dist-types/exports/menu.d.ts +0 -7
- package/dist-types/exports/menu.d.ts.map +0 -1
- package/dist-types/exports/navigation-bar.d.ts +0 -2
- package/dist-types/exports/navigation-bar.d.ts.map +0 -1
- package/docs/components/menu/api-table.md +0 -455
- package/docs/components/menu/applyMenuDemoStyles.js +0 -173
- package/docs/components/menu/extensions.md +0 -262
- package/docs/components/menu/index.md +0 -13
- package/docs/components/menu/overview.md +0 -422
- package/exports/define/lion-item.js +0 -3
- package/exports/define/lion-menu-overlay.js +0 -3
- package/exports/define/lion-menu.js +0 -3
- package/exports/define/lion-navigation-bar.js +0 -3
- package/exports/define/lion-toolbar.js +0 -3
- package/exports/define/lion-tree.js +0 -3
- package/exports/menu-test-suites.js +0 -2
- package/exports/menu.js +0 -7
- package/exports/navigation-bar.js +0 -1
- package/menu-test-suites.js +0 -2
- package/menu.js +0 -7
- package/navigation-bar.js +0 -1
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
/* eslint-disable max-classes-per-file */
|
|
2
|
-
/* eslint-disable import/no-extraneous-dependencies */
|
|
3
|
-
import { LitElement } from 'lit';
|
|
4
|
-
// import { dedupeMixin } from '@open-wc/dedupe-mixin';
|
|
5
|
-
import { MultiLevelListMixin } from './MultiLevelListMixin.js';
|
|
6
|
-
import { setChecked, toggleChecked } from './utils/listItemInteractions.js';
|
|
7
|
-
|
|
8
|
-
// /**
|
|
9
|
-
// * @param {Element} element
|
|
10
|
-
// */
|
|
11
|
-
// function getContentHeight(element) {
|
|
12
|
-
// return `${element.getBoundingClientRect().height}px`;
|
|
13
|
-
// }
|
|
14
|
-
|
|
15
|
-
// /**
|
|
16
|
-
// * Calculate total content height after collapsible opens
|
|
17
|
-
// * @param {HTMLElement} contentNode content node
|
|
18
|
-
// * @private
|
|
19
|
-
// */
|
|
20
|
-
// async function calculateHeight(contentNode) {
|
|
21
|
-
// contentNode.style.setProperty('max-height', '');
|
|
22
|
-
// await new Promise(resolve => requestAnimationFrame(() => resolve(undefined)));
|
|
23
|
-
// return getContentHeight(contentNode); // Expected height i.e. actual size once collapsed after animation
|
|
24
|
-
// }
|
|
25
|
-
|
|
26
|
-
// /**
|
|
27
|
-
// * @type {AnimateMixin}
|
|
28
|
-
// */
|
|
29
|
-
// const AnimateMixinImplementation = superclass =>
|
|
30
|
-
// class AnimateMixin extends superclass {
|
|
31
|
-
// constructor() {
|
|
32
|
-
// super();
|
|
33
|
-
// this.__handleAnimateComplete = this.__handleAnimateComplete.bind(this);
|
|
34
|
-
// }
|
|
35
|
-
|
|
36
|
-
// connectedCallback() {
|
|
37
|
-
// super.connectedCallback();
|
|
38
|
-
// this._contentNode.style.setProperty('transition', 'max-height 0.35s, opacity 0.35s');
|
|
39
|
-
// }
|
|
40
|
-
|
|
41
|
-
// /**
|
|
42
|
-
// * Trigger show animation and wait for transition to be finished.
|
|
43
|
-
// * @param {Object} options - element node and its options
|
|
44
|
-
// * @override
|
|
45
|
-
// */
|
|
46
|
-
// async _showAnimation(cfg) {
|
|
47
|
-
// super._showAnimation(cfg);
|
|
48
|
-
|
|
49
|
-
// const { contentNode } = cfg;
|
|
50
|
-
// const expectedHeight = await calculateHeight(contentNode);
|
|
51
|
-
// contentNode.style.setProperty('overflow', 'hidden');
|
|
52
|
-
// contentNode.style.setProperty('opacity', '1');
|
|
53
|
-
// contentNode.style.setProperty('max-height', '0');
|
|
54
|
-
// await new Promise(resolve => requestAnimationFrame(() => resolve(undefined)));
|
|
55
|
-
// contentNode.style.setProperty('max-height', expectedHeight);
|
|
56
|
-
// await this._animateComplete;
|
|
57
|
-
// ['opacity', 'padding', 'max-height', 'overflow'].map(prop =>
|
|
58
|
-
// contentNode.style.removeProperty(prop),
|
|
59
|
-
// );
|
|
60
|
-
// }
|
|
61
|
-
|
|
62
|
-
// /**
|
|
63
|
-
// * Trigger hide animation and wait for transition to be finished.
|
|
64
|
-
// * @param {Object} options - element node and its options
|
|
65
|
-
// * @override
|
|
66
|
-
// */
|
|
67
|
-
// async _hideAnimation(cfg) {
|
|
68
|
-
// super._hideAnimation(cfg);
|
|
69
|
-
|
|
70
|
-
// const { contentNode } = cfg;
|
|
71
|
-
// if (getContentHeight(contentNode) === '0px') {
|
|
72
|
-
// return;
|
|
73
|
-
// }
|
|
74
|
-
// const expectedHeight = await calculateHeight(contentNode);
|
|
75
|
-
|
|
76
|
-
// contentNode.style.setProperty('overflow', 'hidden');
|
|
77
|
-
// contentNode.style.setProperty('max-height', expectedHeight);
|
|
78
|
-
// await new Promise(resolve => requestAnimationFrame(() => resolve()));
|
|
79
|
-
// ['opacity', 'padding', 'max-height'].map(prop => contentNode.style.setProperty(prop, 0));
|
|
80
|
-
|
|
81
|
-
// await this._animateComplete;
|
|
82
|
-
// }
|
|
83
|
-
// };
|
|
84
|
-
// export const AnimateMixin = dedupeMixin(AnimateMixinImplementation);
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
*
|
|
88
|
-
* Api explanation:
|
|
89
|
-
* - No [slot="invoker"], because adding it inside the lion-menu would:
|
|
90
|
-
* - make api more verbose, less aligned with common html examples (examples from wai-aria etc.)
|
|
91
|
-
* - break Popper positioning (you would need to specify parent menuitem as reference node)
|
|
92
|
-
* - put click surface inside menuitem padding (you would need to correct with negative margin :( ...)
|
|
93
|
-
* - No [slot="content"], because for a "right click menu" it would be obsolete
|
|
94
|
-
*
|
|
95
|
-
* @example menu button (VsCode action menu right top of screen)
|
|
96
|
-
* <lion-menu>
|
|
97
|
-
* <button slot="invoker" title="More actions">...</button>
|
|
98
|
-
* <div role="menuitem">Show opened editors</div>
|
|
99
|
-
* <div role="separator"></div>
|
|
100
|
-
* <div role="menuitem">Close All</div>
|
|
101
|
-
* </lion-menu>
|
|
102
|
-
*
|
|
103
|
-
* @example as menubar (VsCode main menu)
|
|
104
|
-
* <lion-menu bar>
|
|
105
|
-
* <div>
|
|
106
|
-
* <div role="menuitem">File</div>
|
|
107
|
-
* <lion-menu>
|
|
108
|
-
* <div role="menuitem">New File</div>
|
|
109
|
-
* <div role="separator"></div>
|
|
110
|
-
* <div>
|
|
111
|
-
* <div role="menuitem">Open Recent</div>
|
|
112
|
-
* <lion-menu>
|
|
113
|
-
* More...
|
|
114
|
-
* </lion-menu>
|
|
115
|
-
* </div>
|
|
116
|
-
* </lion-menu>
|
|
117
|
-
* </div>
|
|
118
|
-
* <div>
|
|
119
|
-
* <div role="menuitem">View</div>
|
|
120
|
-
* <lion-menu>
|
|
121
|
-
* <div role="menuitemcheckbox">Show Minimap</div>
|
|
122
|
-
* </lion-menu>
|
|
123
|
-
* </div>
|
|
124
|
-
* </lion-menu>
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
* @example as context menu (VsCode right click menu)
|
|
128
|
-
* <lion-menu>
|
|
129
|
-
* <div role="menuitem">Go to Definition</div>
|
|
130
|
-
* <div role="menuitem">Go to Type Definition</div>
|
|
131
|
-
* <div>
|
|
132
|
-
* <div role="menuitem">Peek</div>
|
|
133
|
-
* <lion-menu>
|
|
134
|
-
* <div role="menuitem">Peek Call Hierarchy</div>
|
|
135
|
-
* <div role="separator"></div>
|
|
136
|
-
* <div role="menuitem">Peek Definition</div>
|
|
137
|
-
* </lion-menu>
|
|
138
|
-
* </div>
|
|
139
|
-
* <div role="separator"></div>
|
|
140
|
-
* <div role="menuitem">Find all References</div>
|
|
141
|
-
* </lion-menu>
|
|
142
|
-
*/
|
|
143
|
-
// @ts-ignore - _listRole property type compatibility
|
|
144
|
-
export class LionMenu extends MultiLevelListMixin(LitElement) {
|
|
145
|
-
static get properties() {
|
|
146
|
-
return {
|
|
147
|
-
/**
|
|
148
|
-
* Enable bar to use [role="menubar"] and horizontal navigation
|
|
149
|
-
*/
|
|
150
|
-
bar: { type: Boolean },
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Allows groups within one level. In case we deal with menuitemcheckbox,
|
|
156
|
-
* we treat it as multiple choice group
|
|
157
|
-
* @override InteractiveListMixin
|
|
158
|
-
* @param {number} index
|
|
159
|
-
*/
|
|
160
|
-
setCheckedIndex(index) {
|
|
161
|
-
const item = this.listItems[index];
|
|
162
|
-
if (!item) return;
|
|
163
|
-
|
|
164
|
-
// @ts-ignore - InteractiveListItemRole type
|
|
165
|
-
const role = /** @type {InteractiveListItemRole} */ (item.getAttribute('role'));
|
|
166
|
-
let listItemsWithinGroup = this.listItems;
|
|
167
|
-
let multiple = this.multipleChoice;
|
|
168
|
-
if (role === 'menuitemradio' || role === 'menuitemcheckbox') {
|
|
169
|
-
/**
|
|
170
|
-
* If index = 3 (menuitemradio 'Red'), closest group will be div[role=group]
|
|
171
|
-
* @example
|
|
172
|
-
* <interactive-list role="menu">
|
|
173
|
-
* <div role="menuitemcheckbox" aria-checked="true">Bold</div>
|
|
174
|
-
* <div role="menuitemcheckbox" aria-checked="true">Italic</div>
|
|
175
|
-
* <div role="separator"></div>
|
|
176
|
-
* <div role="group" aria-label="Text Color">
|
|
177
|
-
* <div role="menuitemradio" aria-checked="false">Blue</div>
|
|
178
|
-
* <div role="menuitemradio" aria-checked="true">Red</div>
|
|
179
|
-
* <div role="menuitemradio" aria-checked="false">Green</div>
|
|
180
|
-
* </div>
|
|
181
|
-
* </interactive-list>
|
|
182
|
-
*/
|
|
183
|
-
const closestGroup = item.closest('[role="group"]');
|
|
184
|
-
const group = closestGroup && this.contains(closestGroup) ? closestGroup : this;
|
|
185
|
-
listItemsWithinGroup = this.listItems.filter(listItem => group.contains(listItem));
|
|
186
|
-
multiple = role === 'menuitemcheckbox';
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
if (!multiple) {
|
|
190
|
-
// Uncheck all
|
|
191
|
-
listItemsWithinGroup.forEach(listItem => {
|
|
192
|
-
setChecked(listItem, true);
|
|
193
|
-
});
|
|
194
|
-
setChecked(this.listItems[index]);
|
|
195
|
-
} else {
|
|
196
|
-
toggleChecked(this.listItems[index]);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
constructor() {
|
|
201
|
-
super();
|
|
202
|
-
|
|
203
|
-
this.bar = false;
|
|
204
|
-
/** @configure MultiLevelListMixin */
|
|
205
|
-
this.behaveAsAccordion = true;
|
|
206
|
-
/** @configure InteractiveListMixin */
|
|
207
|
-
this._listRole = 'menu';
|
|
208
|
-
/** @configure InteractiveListMixin */
|
|
209
|
-
this._activateOnTypedChars = true;
|
|
210
|
-
/** @configure DisclosureMixin */
|
|
211
|
-
this.invokerInteraction = 'click';
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
/**
|
|
215
|
-
* @param {import('lit-element').PropertyValues } changedProperties
|
|
216
|
-
*/
|
|
217
|
-
firstUpdated(changedProperties) {
|
|
218
|
-
super.firstUpdated(changedProperties);
|
|
219
|
-
|
|
220
|
-
if (this._activeMode === 'tabbable-disclosure') {
|
|
221
|
-
this._listRole = 'list';
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
this._listNode.setAttribute('role', this._listRole);
|
|
225
|
-
|
|
226
|
-
// Allow generic attr for functional styling
|
|
227
|
-
this.dataset.menu = '';
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
* @param {import('lit-element').PropertyValues } changedProperties
|
|
232
|
-
*/
|
|
233
|
-
updated(changedProperties) {
|
|
234
|
-
super.updated(changedProperties);
|
|
235
|
-
|
|
236
|
-
if (changedProperties.has('bar')) {
|
|
237
|
-
if (this.bar) {
|
|
238
|
-
this.orientation = 'horizontal';
|
|
239
|
-
if (this._listRole === 'menu') {
|
|
240
|
-
this._listRole = 'menubar';
|
|
241
|
-
}
|
|
242
|
-
} else {
|
|
243
|
-
this.orientation = 'vertical';
|
|
244
|
-
if (this._listRole === 'menubar') {
|
|
245
|
-
this._listRole = 'menu';
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { LionMenuOverlay } from './LionMenuOverlay.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* LionMenuHybrid allows to choose whether the menu opens as overlay or as disclosure.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
// TODO: remove
|
|
8
|
-
// @ts-ignore - class extension properties mismatch
|
|
9
|
-
export class LionMenuHybrid extends LionMenuOverlay {
|
|
10
|
-
static get properties() {
|
|
11
|
-
return {
|
|
12
|
-
openableMode: { type: String, attribute: 'openable-mode' },
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
constructor() {
|
|
17
|
-
super();
|
|
18
|
-
|
|
19
|
-
// By default, we go for disclosure behavior
|
|
20
|
-
// a TODO: in the future, bring disclosure behavior to a controller (and therefore directive).
|
|
21
|
-
// Take inspiration from VisibilityToggleCtrl of portal elements
|
|
22
|
-
/**
|
|
23
|
-
* Terminology aligned with https://open-ui.org/components/openable.explainer/
|
|
24
|
-
* @type {'disclosure'|'overlay'}
|
|
25
|
-
*/
|
|
26
|
-
this.openableMode = 'disclosure';
|
|
27
|
-
|
|
28
|
-
this._shouldSetupOverlay = false;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* @param {import('lit').PropertyValues} changedProperties
|
|
33
|
-
*/
|
|
34
|
-
updated(changedProperties) {
|
|
35
|
-
super.updated(changedProperties);
|
|
36
|
-
|
|
37
|
-
if (changedProperties.has('openableMode')) {
|
|
38
|
-
if (this.openableMode === 'overlay') {
|
|
39
|
-
this._shouldSetupOverlay = true;
|
|
40
|
-
this._setupOverlayCtrl();
|
|
41
|
-
} else {
|
|
42
|
-
this._teardownOverlayCtrl();
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
/* eslint-disable max-classes-per-file */
|
|
2
|
-
/* eslint-disable import/no-extraneous-dependencies */
|
|
3
|
-
import { html } from 'lit';
|
|
4
|
-
import { dedupeMixin } from '@open-wc/dedupe-mixin';
|
|
5
|
-
|
|
6
|
-
import { OverlayMixin, withDropdownConfig } from '@lion/ui/overlays.js';
|
|
7
|
-
import { LionMenu } from './LionMenu.js';
|
|
8
|
-
import { InteractiveListMixin } from './InteractiveListMixin.js';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Handles integration of InteractiveListMixin and OverlayMixin
|
|
12
|
-
* Will be used by:
|
|
13
|
-
* - LionMenuOverlay
|
|
14
|
-
* - LionCombobox
|
|
15
|
-
* - LionSelectRich
|
|
16
|
-
*
|
|
17
|
-
* @param {import('@open-wc/dedupe-mixin').Constructor<import('lit').LitElement>} superclass
|
|
18
|
-
*/
|
|
19
|
-
const OverlayWithListInvokerMixinImplementation = superclass =>
|
|
20
|
-
class OverlayWithListInvokerMixin extends OverlayMixin(InteractiveListMixin(superclass)) {
|
|
21
|
-
// constructor() {
|
|
22
|
-
// super();
|
|
23
|
-
|
|
24
|
-
// /** @configure DisclosureMixin */
|
|
25
|
-
// this.handleFocus = true;
|
|
26
|
-
// }
|
|
27
|
-
|
|
28
|
-
// _onOverlayBeforeShow = () => {};
|
|
29
|
-
|
|
30
|
-
_onOverlayShow = () => {
|
|
31
|
-
if (this.checkedIndex != null) {
|
|
32
|
-
// @ts-ignore - activeIndex can be number or array
|
|
33
|
-
this.activeIndex = this.checkedIndex;
|
|
34
|
-
}
|
|
35
|
-
// this._listNode.focus();
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
// _onOverlayHide = () => {
|
|
39
|
-
// console.log('hide', this._overlayInvokerNode);
|
|
40
|
-
// this._overlayInvokerNode.focus();
|
|
41
|
-
// };
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* @enhance OverlayMixin
|
|
45
|
-
*/
|
|
46
|
-
_setupOverlayCtrl() {
|
|
47
|
-
super._setupOverlayCtrl();
|
|
48
|
-
|
|
49
|
-
if (!this._overlayCtrl) return;
|
|
50
|
-
|
|
51
|
-
// this._overlayCtrl.addEventListener('before-show', this._onOverlayBeforeShow);
|
|
52
|
-
this._overlayCtrl.addEventListener('show', this._onOverlayShow);
|
|
53
|
-
// this._overlayCtrl.addEventListener('hide', this._onOverlayHide);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* @enhance OverlayMixin
|
|
58
|
-
*/
|
|
59
|
-
_teardownOverlayCtrl() {
|
|
60
|
-
super._teardownOverlayCtrl();
|
|
61
|
-
|
|
62
|
-
if (!this._overlayCtrl) return;
|
|
63
|
-
|
|
64
|
-
// this._overlayCtrl.removeEventListener('before-show', this._onOverlayBeforeShow);
|
|
65
|
-
this._overlayCtrl.removeEventListener('show', this._onOverlayShow);
|
|
66
|
-
// this._overlayCtrl.removeEventListener('hide', this._onOverlayHide);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* make sure OverlayMixin gets the contentNode defined by DisclosureMixin
|
|
71
|
-
*/
|
|
72
|
-
get _overlayContentNode() {
|
|
73
|
-
// @ts-ignore - _contentNode property
|
|
74
|
-
return this._contentNode;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* make sure OverlayMixin gets the invokerNode defined by DisclosureMixin
|
|
79
|
-
*/
|
|
80
|
-
get _overlayInvokerNode() {
|
|
81
|
-
// @ts-ignore - _invokerNode property
|
|
82
|
-
return this._invokerNode;
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
export const OverlayWithListInvokerMixin = dedupeMixin(OverlayWithListInvokerMixinImplementation);
|
|
86
|
-
|
|
87
|
-
export class LionMenuOverlay extends OverlayWithListInvokerMixin(LionMenu) {
|
|
88
|
-
// TODO: this was created 5 years ago, do we still need id="overlay-content-node-wrapper" after the "dialog refactor"?
|
|
89
|
-
render() {
|
|
90
|
-
return html`
|
|
91
|
-
<slot name="invoker"></slot>
|
|
92
|
-
<div id="overlay-content-node-wrapper">
|
|
93
|
-
<slot name="list"></slot>
|
|
94
|
-
</div>
|
|
95
|
-
<slot id="list-items-outlet"></slot>
|
|
96
|
-
`;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// @ts-ignore - overlay config return type
|
|
100
|
-
_defineOverlayConfig() {
|
|
101
|
-
// @ts-ignore - parentList property
|
|
102
|
-
const { parentList } = this;
|
|
103
|
-
let placement = 'bottom-start';
|
|
104
|
-
if (parentList?.orientation !== 'horizontal') {
|
|
105
|
-
placement = 'right-start';
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
const menuConfig = {};
|
|
109
|
-
// if (this._activeMode === 'activedescendant') {
|
|
110
|
-
// menuConfig.elementToFocusAfterHide = this._listNode;
|
|
111
|
-
// }
|
|
112
|
-
|
|
113
|
-
const dropdownCfg = withDropdownConfig();
|
|
114
|
-
|
|
115
|
-
return {
|
|
116
|
-
...dropdownCfg,
|
|
117
|
-
hidesOnEsc: true,
|
|
118
|
-
...menuConfig,
|
|
119
|
-
popperConfig: {
|
|
120
|
-
...dropdownCfg.popperConfig,
|
|
121
|
-
placement,
|
|
122
|
-
strategy: 'absolute',
|
|
123
|
-
modifiers: [
|
|
124
|
-
{
|
|
125
|
-
name: 'offset',
|
|
126
|
-
enabled: true,
|
|
127
|
-
options: {
|
|
128
|
-
offset: [0, 0],
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
],
|
|
132
|
-
},
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* @enhance InteractiveListMixin
|
|
138
|
-
*/
|
|
139
|
-
/**
|
|
140
|
-
* @param {*} ev
|
|
141
|
-
*/
|
|
142
|
-
_onListKeyUp(ev) {
|
|
143
|
-
super._onListKeyUp(ev);
|
|
144
|
-
|
|
145
|
-
const { key } = ev;
|
|
146
|
-
|
|
147
|
-
switch (key) {
|
|
148
|
-
case 'Escape':
|
|
149
|
-
// We need to stop here, or else we affect parent menu (handled by OverlayController)
|
|
150
|
-
ev.stopPropagation();
|
|
151
|
-
break;
|
|
152
|
-
/* no default */
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
/* eslint-disable import/no-extraneous-dependencies */
|
|
2
|
-
import { LitElement, html, css } from 'lit';
|
|
3
|
-
|
|
4
|
-
export class LionSpinbutton extends LitElement {
|
|
5
|
-
static get properties() {
|
|
6
|
-
return {
|
|
7
|
-
now: { type: Number },
|
|
8
|
-
min: { type: Number },
|
|
9
|
-
max: { type: Number },
|
|
10
|
-
unit: { type: String },
|
|
11
|
-
step: { type: Number },
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
get _decreaseNode() {
|
|
16
|
-
return this.shadowRoot?.querySelector('[data-ref=decrease]');
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
get _increaseNode() {
|
|
20
|
-
return this.shadowRoot?.querySelector('[data-ref=increase]');
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
static get styles() {
|
|
24
|
-
return css`
|
|
25
|
-
:host {
|
|
26
|
-
display: flex;
|
|
27
|
-
align-items: center;
|
|
28
|
-
cursor: default;
|
|
29
|
-
}
|
|
30
|
-
`;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
render() {
|
|
34
|
-
return this._mainTemplate({ ariaText: this._getAriaText() });
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* @param {{ ariaText: string }} props
|
|
39
|
-
*/
|
|
40
|
-
_mainTemplate({ ariaText }) {
|
|
41
|
-
return html`${ariaText}${this._decreaseBtnTemplate()}${this._increaseBtnTemplate()}`;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// eslint-disable-next-line class-methods-use-this
|
|
45
|
-
_decreaseBtnTemplate() {
|
|
46
|
-
return html`<span data-ref="decrease">▼</span>`;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// eslint-disable-next-line class-methods-use-this
|
|
50
|
-
_increaseBtnTemplate() {
|
|
51
|
-
return html`<span data-ref="increase">▲</span>`;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
constructor() {
|
|
55
|
-
super();
|
|
56
|
-
this.unit = '';
|
|
57
|
-
|
|
58
|
-
this.step = 1;
|
|
59
|
-
|
|
60
|
-
this.__decrease = this.__decrease.bind(this);
|
|
61
|
-
this.__increase = this.__increase.bind(this);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
connectedCallback() {
|
|
65
|
-
super.connectedCallback();
|
|
66
|
-
|
|
67
|
-
if (this.__isSetup) {
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
this.setAttribute('tabindex', '0');
|
|
72
|
-
this.__isSetup = true;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* @param {import('lit').PropertyValues} changedProperties
|
|
77
|
-
*/
|
|
78
|
-
firstUpdated(changedProperties) {
|
|
79
|
-
super.firstUpdated(changedProperties);
|
|
80
|
-
|
|
81
|
-
// @ts-ignore - event listener type compatibility
|
|
82
|
-
this._decreaseNode?.addEventListener('mousedown', this.__decrease);
|
|
83
|
-
// @ts-ignore - event listener type compatibility
|
|
84
|
-
this._increaseNode?.addEventListener('mousedown', this.__increase);
|
|
85
|
-
this.addEventListener('keydown', this._onKeydown);
|
|
86
|
-
|
|
87
|
-
this.addEventListener('mousedown', () => {
|
|
88
|
-
this.__isMousedown = true;
|
|
89
|
-
});
|
|
90
|
-
this.addEventListener('mouseup', () => {
|
|
91
|
-
this.__isMousedown = false;
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* @param {import('lit').PropertyValues} changedProperties
|
|
97
|
-
*/
|
|
98
|
-
updated(changedProperties) {
|
|
99
|
-
super.updated(changedProperties);
|
|
100
|
-
|
|
101
|
-
if (changedProperties.has('now')) {
|
|
102
|
-
this.setAttribute('aria-valuenow', `${this.now}`);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
if (changedProperties.has('now') || changedProperties.has('unit')) {
|
|
106
|
-
this.setAttribute('aria-valuetext', this._getAriaText());
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
if (changedProperties.has('min')) {
|
|
110
|
-
// @ts-ignore - min property from properties
|
|
111
|
-
this.setAttribute('aria-valuemin', `${this.min}`);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
if (changedProperties.has('max')) {
|
|
115
|
-
// @ts-ignore - max property from properties
|
|
116
|
-
this.setAttribute('aria-valuemax', `${this.max}`);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* @overridable
|
|
122
|
-
*/
|
|
123
|
-
_getAriaText() {
|
|
124
|
-
return `${this.now}${this.unit ? this.unit : ''}`;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* @param {MouseEvent | null} ev
|
|
129
|
-
* @param {number} step
|
|
130
|
-
* @param {number} timeout
|
|
131
|
-
*/
|
|
132
|
-
__decrease(ev, step = this.step, timeout = 100) {
|
|
133
|
-
// @ts-ignore - min property from properties
|
|
134
|
-
if (this.min !== undefined && this.now - 1 >= this.min) {
|
|
135
|
-
this.now -= 1; // TODO: support step/increment?
|
|
136
|
-
}
|
|
137
|
-
// @ts-ignore - ev can be null
|
|
138
|
-
if (ev.type === 'mousedown') {
|
|
139
|
-
setTimeout(() => {
|
|
140
|
-
if (this.__isMousedown) {
|
|
141
|
-
this.__decrease(ev, step, timeout / 1.3);
|
|
142
|
-
}
|
|
143
|
-
}, timeout);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* @param {MouseEvent | null} ev
|
|
149
|
-
* @param {number} step
|
|
150
|
-
* @param {number} timeout
|
|
151
|
-
*/
|
|
152
|
-
__increase(ev, step = this.step, timeout = 100) {
|
|
153
|
-
// @ts-ignore - max property from properties
|
|
154
|
-
if (this.max !== undefined && this.now + 1 <= this.max) {
|
|
155
|
-
this.now += 1; // TODO: support step/increment?
|
|
156
|
-
}
|
|
157
|
-
// @ts-ignore - ev can be null
|
|
158
|
-
if (ev.type === 'mousedown') {
|
|
159
|
-
setTimeout(() => {
|
|
160
|
-
if (this.__isMousedown) {
|
|
161
|
-
this.__increase(ev, step, timeout / 1.3);
|
|
162
|
-
}
|
|
163
|
-
}, timeout);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* @param {KeyboardEvent} ev
|
|
169
|
-
*/
|
|
170
|
-
_onKeydown(ev) {
|
|
171
|
-
const { key } = ev;
|
|
172
|
-
|
|
173
|
-
// eslint-disable-next-line default-case
|
|
174
|
-
switch (key) {
|
|
175
|
-
case 'ArrowDown':
|
|
176
|
-
ev.stopPropagation(); // In case we are inside a menu
|
|
177
|
-
ev.preventDefault(); // Prevent scroll
|
|
178
|
-
// @ts-ignore - passing null for ev parameter
|
|
179
|
-
this.__decrease();
|
|
180
|
-
break;
|
|
181
|
-
case 'ArrowUp':
|
|
182
|
-
ev.stopPropagation(); // In case we are inside a menu
|
|
183
|
-
ev.preventDefault(); // Prevent scroll
|
|
184
|
-
// @ts-ignore - passing null for ev parameter
|
|
185
|
-
this.__increase();
|
|
186
|
-
break;
|
|
187
|
-
case 'Home':
|
|
188
|
-
ev.stopPropagation(); // In case we are inside a menu
|
|
189
|
-
ev.preventDefault(); // Prevent scroll
|
|
190
|
-
// @ts-ignore - min property from properties
|
|
191
|
-
if (this.min !== undefined) {
|
|
192
|
-
// @ts-ignore
|
|
193
|
-
this.now = this.min;
|
|
194
|
-
}
|
|
195
|
-
break;
|
|
196
|
-
case 'End':
|
|
197
|
-
ev.stopPropagation(); // In case we are inside a menu
|
|
198
|
-
ev.preventDefault(); // Prevent scroll
|
|
199
|
-
// @ts-ignore - max property from properties
|
|
200
|
-
if (this.max !== undefined) {
|
|
201
|
-
// @ts-ignore
|
|
202
|
-
this.now = this.max;
|
|
203
|
-
}
|
|
204
|
-
break;
|
|
205
|
-
case 'PageDown':
|
|
206
|
-
this.__decrease(null, this.step * 2);
|
|
207
|
-
break;
|
|
208
|
-
case 'PageUp':
|
|
209
|
-
this.__increase(null, this.step * 2);
|
|
210
|
-
break;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}
|