ngwr 16.0.0 → 16.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/badge/styles/_tag.scss +8 -4
- package/button/styles/_index.scss +13 -7
- package/cascader/styles/_rules.scss +4 -2
- package/checkbox/styles/_index.scss +4 -2
- package/date-picker/styles/_index.scss +95 -3
- package/date-stamp/styles/_index.scss +38 -0
- package/dialog/styles/_index.scss +38 -0
- package/dropdown/styles/_index.scss +37 -1
- package/fesm2022/internal-CVLvP9b_.mjs +33 -0
- package/fesm2022/internal-CVLvP9b_.mjs.map +1 -0
- package/fesm2022/ngwr-alert.mjs +11 -7
- package/fesm2022/ngwr-alert.mjs.map +1 -1
- package/fesm2022/ngwr-avatar.mjs +11 -7
- package/fesm2022/ngwr-avatar.mjs.map +1 -1
- package/fesm2022/ngwr-back-top.mjs +10 -6
- package/fesm2022/ngwr-back-top.mjs.map +1 -1
- package/fesm2022/ngwr-badge.mjs +18 -6
- package/fesm2022/ngwr-badge.mjs.map +1 -1
- package/fesm2022/ngwr-burger.mjs +9 -6
- package/fesm2022/ngwr-burger.mjs.map +1 -1
- package/fesm2022/ngwr-button.mjs +8 -4
- package/fesm2022/ngwr-button.mjs.map +1 -1
- package/fesm2022/ngwr-calendar.mjs +19 -8
- package/fesm2022/ngwr-calendar.mjs.map +1 -1
- package/fesm2022/ngwr-card.mjs +9 -5
- package/fesm2022/ngwr-card.mjs.map +1 -1
- package/fesm2022/ngwr-cascader.mjs +11 -5
- package/fesm2022/ngwr-cascader.mjs.map +1 -1
- package/fesm2022/ngwr-charts-calendar-heatmap.mjs +5 -2
- package/fesm2022/ngwr-charts-calendar-heatmap.mjs.map +1 -1
- package/fesm2022/ngwr-checkbox.mjs +10 -6
- package/fesm2022/ngwr-checkbox.mjs.map +1 -1
- package/fesm2022/ngwr-clipboard.mjs +2 -1
- package/fesm2022/ngwr-clipboard.mjs.map +1 -1
- package/fesm2022/ngwr-collapse.mjs +9 -5
- package/fesm2022/ngwr-collapse.mjs.map +1 -1
- package/fesm2022/ngwr-color-picker.mjs +4 -2
- package/fesm2022/ngwr-color-picker.mjs.map +1 -1
- package/fesm2022/ngwr-comment.mjs +13 -7
- package/fesm2022/ngwr-comment.mjs.map +1 -1
- package/fesm2022/ngwr-compare.mjs +9 -3
- package/fesm2022/ngwr-compare.mjs.map +1 -1
- package/fesm2022/ngwr-context-menu.mjs +4 -2
- package/fesm2022/ngwr-context-menu.mjs.map +1 -1
- package/fesm2022/ngwr-copy-value.mjs +11 -6
- package/fesm2022/ngwr-copy-value.mjs.map +1 -1
- package/fesm2022/ngwr-date-picker-testing.mjs +18 -0
- package/fesm2022/ngwr-date-picker-testing.mjs.map +1 -1
- package/fesm2022/ngwr-date-picker.mjs +238 -38
- package/fesm2022/ngwr-date-picker.mjs.map +1 -1
- package/fesm2022/ngwr-date-stamp-testing.mjs +34 -0
- package/fesm2022/ngwr-date-stamp-testing.mjs.map +1 -0
- package/fesm2022/ngwr-date-stamp.mjs +213 -0
- package/fesm2022/ngwr-date-stamp.mjs.map +1 -0
- package/fesm2022/ngwr-date.mjs +364 -54
- package/fesm2022/ngwr-date.mjs.map +1 -1
- package/fesm2022/ngwr-descriptions.mjs +9 -5
- package/fesm2022/ngwr-descriptions.mjs.map +1 -1
- package/fesm2022/ngwr-dialog-testing.mjs +23 -2
- package/fesm2022/ngwr-dialog-testing.mjs.map +1 -1
- package/fesm2022/ngwr-dialog.mjs +45 -16
- package/fesm2022/ngwr-dialog.mjs.map +1 -1
- package/fesm2022/ngwr-directives.mjs +102 -11
- package/fesm2022/ngwr-directives.mjs.map +1 -1
- package/fesm2022/ngwr-divider.mjs +4 -2
- package/fesm2022/ngwr-divider.mjs.map +1 -1
- package/fesm2022/ngwr-drawer.mjs +29 -3
- package/fesm2022/ngwr-drawer.mjs.map +1 -1
- package/fesm2022/ngwr-dropdown-testing.mjs +38 -3
- package/fesm2022/ngwr-dropdown-testing.mjs.map +1 -1
- package/fesm2022/ngwr-dropdown.mjs +362 -26
- package/fesm2022/ngwr-dropdown.mjs.map +1 -1
- package/fesm2022/ngwr-editor.mjs +5 -2
- package/fesm2022/ngwr-editor.mjs.map +1 -1
- package/fesm2022/ngwr-event-calendar.mjs +4 -2
- package/fesm2022/ngwr-event-calendar.mjs.map +1 -1
- package/fesm2022/ngwr-file-upload.mjs +9 -3
- package/fesm2022/ngwr-file-upload.mjs.map +1 -1
- package/fesm2022/ngwr-form.mjs +18 -6
- package/fesm2022/ngwr-form.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ar.mjs +9 -2
- package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-cs.mjs +9 -2
- package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-de.mjs +9 -2
- package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-en.mjs +9 -2
- package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-es.mjs +9 -2
- package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-fr.mjs +9 -2
- package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-he.mjs +9 -2
- package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-hi.mjs +9 -2
- package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-id.mjs +9 -2
- package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-it.mjs +9 -2
- package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ja.mjs +9 -2
- package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ko.mjs +9 -2
- package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-nl.mjs +9 -2
- package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pl.mjs +9 -2
- package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pt.mjs +9 -2
- package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ru.mjs +9 -2
- package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-sv.mjs +9 -2
- package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-tr.mjs +9 -2
- package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-uk.mjs +9 -2
- package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-vi.mjs +9 -2
- package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh-tw.mjs +9 -2
- package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh.mjs +9 -2
- package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
- package/fesm2022/ngwr-i18n.mjs +34 -8
- package/fesm2022/ngwr-i18n.mjs.map +1 -1
- package/fesm2022/ngwr-input-number.mjs +9 -3
- package/fesm2022/ngwr-input-number.mjs.map +1 -1
- package/fesm2022/ngwr-input-otp.mjs +4 -2
- package/fesm2022/ngwr-input-otp.mjs.map +1 -1
- package/fesm2022/ngwr-input.mjs +20 -10
- package/fesm2022/ngwr-input.mjs.map +1 -1
- package/fesm2022/ngwr-keyboard.mjs +9 -3
- package/fesm2022/ngwr-keyboard.mjs.map +1 -1
- package/fesm2022/ngwr-knob.mjs +9 -3
- package/fesm2022/ngwr-knob.mjs.map +1 -1
- package/fesm2022/ngwr-layout.mjs +13 -5
- package/fesm2022/ngwr-layout.mjs.map +1 -1
- package/fesm2022/ngwr-lightbox-testing.mjs +26 -0
- package/fesm2022/ngwr-lightbox-testing.mjs.map +1 -1
- package/fesm2022/ngwr-lightbox.mjs +255 -15
- package/fesm2022/ngwr-lightbox.mjs.map +1 -1
- package/fesm2022/ngwr-list.mjs +13 -5
- package/fesm2022/ngwr-list.mjs.map +1 -1
- package/fesm2022/ngwr-load-state.mjs +9 -5
- package/fesm2022/ngwr-load-state.mjs.map +1 -1
- package/fesm2022/ngwr-overlay.mjs +84 -1
- package/fesm2022/ngwr-overlay.mjs.map +1 -1
- package/fesm2022/ngwr-pagination.mjs +3 -2
- package/fesm2022/ngwr-pagination.mjs.map +1 -1
- package/fesm2022/ngwr-pipes.mjs +47 -9
- package/fesm2022/ngwr-pipes.mjs.map +1 -1
- package/fesm2022/ngwr-popover.mjs +93 -4
- package/fesm2022/ngwr-popover.mjs.map +1 -1
- package/fesm2022/ngwr-progress.mjs +4 -2
- package/fesm2022/ngwr-progress.mjs.map +1 -1
- package/fesm2022/ngwr-radio.mjs +9 -5
- package/fesm2022/ngwr-radio.mjs.map +1 -1
- package/fesm2022/ngwr-rating.mjs +9 -3
- package/fesm2022/ngwr-rating.mjs.map +1 -1
- package/fesm2022/ngwr-resizable.mjs +503 -0
- package/fesm2022/ngwr-resizable.mjs.map +1 -0
- package/fesm2022/ngwr-result.mjs +9 -5
- package/fesm2022/ngwr-result.mjs.map +1 -1
- package/fesm2022/ngwr-schema-form.mjs +3 -0
- package/fesm2022/ngwr-schema-form.mjs.map +1 -1
- package/fesm2022/ngwr-segmented.mjs +4 -2
- package/fesm2022/ngwr-segmented.mjs.map +1 -1
- package/fesm2022/ngwr-select.mjs +13 -5
- package/fesm2022/ngwr-select.mjs.map +1 -1
- package/fesm2022/ngwr-skeleton.mjs +4 -2
- package/fesm2022/ngwr-skeleton.mjs.map +1 -1
- package/fesm2022/ngwr-slider-testing.mjs +17 -0
- package/fesm2022/ngwr-slider-testing.mjs.map +1 -1
- package/fesm2022/ngwr-slider.mjs +91 -13
- package/fesm2022/ngwr-slider.mjs.map +1 -1
- package/fesm2022/ngwr-sortable-list-testing.mjs +103 -0
- package/fesm2022/ngwr-sortable-list-testing.mjs.map +1 -0
- package/fesm2022/ngwr-sortable-list.mjs +257 -53
- package/fesm2022/ngwr-sortable-list.mjs.map +1 -1
- package/fesm2022/ngwr-speed-dial.mjs +4 -2
- package/fesm2022/ngwr-speed-dial.mjs.map +1 -1
- package/fesm2022/ngwr-spinner.mjs +4 -2
- package/fesm2022/ngwr-spinner.mjs.map +1 -1
- package/fesm2022/ngwr-splitter.mjs +17 -21
- package/fesm2022/ngwr-splitter.mjs.map +1 -1
- package/fesm2022/ngwr-stepper.mjs +9 -3
- package/fesm2022/ngwr-stepper.mjs.map +1 -1
- package/fesm2022/ngwr-switch.mjs +9 -5
- package/fesm2022/ngwr-switch.mjs.map +1 -1
- package/fesm2022/ngwr-table-testing.mjs +5 -1
- package/fesm2022/ngwr-table-testing.mjs.map +1 -1
- package/fesm2022/ngwr-table.mjs +167 -10
- package/fesm2022/ngwr-table.mjs.map +1 -1
- package/fesm2022/ngwr-textarea.mjs +9 -3
- package/fesm2022/ngwr-textarea.mjs.map +1 -1
- package/fesm2022/ngwr-timeline.mjs +18 -8
- package/fesm2022/ngwr-timeline.mjs.map +1 -1
- package/fesm2022/ngwr-toast-testing.mjs +6 -1
- package/fesm2022/ngwr-toast-testing.mjs.map +1 -1
- package/fesm2022/ngwr-toast.mjs +529 -104
- package/fesm2022/ngwr-toast.mjs.map +1 -1
- package/fesm2022/ngwr-transfer.mjs +4 -2
- package/fesm2022/ngwr-transfer.mjs.map +1 -1
- package/fesm2022/ngwr-tree.mjs +4 -2
- package/fesm2022/ngwr-tree.mjs.map +1 -1
- package/fesm2022/ngwr-typography.mjs +9 -3
- package/fesm2022/ngwr-typography.mjs.map +1 -1
- package/fesm2022/ngwr-utils-router.mjs +18 -2
- package/fesm2022/ngwr-utils-router.mjs.map +1 -1
- package/fesm2022/ngwr-utils.mjs +9 -2
- package/fesm2022/ngwr-utils.mjs.map +1 -1
- package/fesm2022/ngwr-version.mjs +1 -1
- package/fesm2022/ngwr-version.mjs.map +1 -1
- package/fesm2022/ngwr-window.mjs +7 -4
- package/fesm2022/ngwr-window.mjs.map +1 -1
- package/fesm2022/ngwr.mjs.map +1 -1
- package/i18n/ar.json +13 -2
- package/i18n/cs.json +13 -2
- package/i18n/de.json +13 -2
- package/i18n/en.json +13 -2
- package/i18n/es.json +13 -2
- package/i18n/fr.json +13 -2
- package/i18n/he.json +13 -2
- package/i18n/hi.json +13 -2
- package/i18n/id.json +13 -2
- package/i18n/it.json +13 -2
- package/i18n/ja.json +13 -2
- package/i18n/ko.json +13 -2
- package/i18n/nl.json +13 -2
- package/i18n/pl.json +13 -2
- package/i18n/pt.json +13 -2
- package/i18n/ru.json +13 -2
- package/i18n/sv.json +13 -2
- package/i18n/tr.json +13 -2
- package/i18n/uk.json +13 -2
- package/i18n/vi.json +13 -2
- package/i18n/zh-TW.json +13 -2
- package/i18n/zh.json +13 -2
- package/input/styles/_index.scss +10 -5
- package/input-number/styles/_index.scss +6 -3
- package/input-otp/styles/_index.scss +4 -2
- package/lightbox/styles/_rules.scss +96 -0
- package/llms-full.txt +40 -17
- package/llms.txt +20 -4
- package/package.json +19 -1
- package/radio/styles/_index.scss +4 -2
- package/resizable/styles/_index.scss +154 -0
- package/schematics/use/rule.js +1 -0
- package/schematics/use/symbol-map.json +5 -0
- package/select/styles/_index.scss +6 -3
- package/skills/ngwr/SKILL.md +1 -1
- package/skills/ngwr/references/catalog.md +6 -2
- package/skills/ngwr/references/setup.md +3 -0
- package/slider/styles/_index.scss +106 -0
- package/sortable-list/styles/_rules.scss +23 -1
- package/switch/styles/_index.scss +4 -2
- package/table/styles/_index.scss +53 -0
- package/textarea/styles/_index.scss +4 -2
- package/theme/styles/_motion.scss +6 -0
- package/toast/styles/_index.scss +19 -0
- package/types/ngwr-burger.d.ts +0 -1
- package/types/ngwr-calendar.d.ts +7 -0
- package/types/ngwr-charts-calendar-heatmap.d.ts +2 -1
- package/types/ngwr-clipboard.d.ts +7 -0
- package/types/ngwr-date-picker-testing.d.ts +17 -0
- package/types/ngwr-date-picker.d.ts +88 -4
- package/types/ngwr-date-stamp-testing.d.ts +47 -0
- package/types/ngwr-date-stamp.d.ts +127 -0
- package/types/ngwr-date.d.ts +251 -37
- package/types/ngwr-dialog-testing.d.ts +10 -0
- package/types/ngwr-dialog.d.ts +72 -4
- package/types/ngwr-directives.d.ts +36 -1
- package/types/ngwr-drawer.d.ts +21 -0
- package/types/ngwr-dropdown-testing.d.ts +53 -5
- package/types/ngwr-dropdown.d.ts +100 -0
- package/types/ngwr-i18n.d.ts +44 -14
- package/types/ngwr-lightbox-testing.d.ts +27 -0
- package/types/ngwr-lightbox.d.ts +71 -6
- package/types/ngwr-overlay.d.ts +36 -0
- package/types/ngwr-pipes.d.ts +48 -13
- package/types/ngwr-popover.d.ts +39 -1
- package/types/ngwr-resizable.d.ts +228 -0
- package/types/ngwr-slider-testing.d.ts +8 -1
- package/types/ngwr-slider.d.ts +89 -3
- package/types/ngwr-sortable-list-testing.d.ts +79 -0
- package/types/ngwr-sortable-list.d.ts +113 -10
- package/types/ngwr-table-testing.d.ts +3 -1
- package/types/ngwr-table.d.ts +120 -4
- package/types/ngwr-toast-testing.d.ts +12 -1
- package/types/ngwr-toast.d.ts +215 -18
- package/types/ngwr-utils-router.d.ts +22 -0
- package/types/ngwr-utils.d.ts +8 -1
- package/types/ngwr-version.d.ts +1 -1
- package/types/ngwr.d.ts +1 -0
|
@@ -19,6 +19,9 @@ var WrDropdownItemHarness = class WrDropdownItemHarness extends ComponentHarness
|
|
|
19
19
|
async isDisabled() {
|
|
20
20
|
return await (await this.host()).getAttribute("aria-disabled") === "true";
|
|
21
21
|
}
|
|
22
|
+
async hasSubmenu() {
|
|
23
|
+
return await (await this.host()).getAttribute("aria-haspopup") === "menu";
|
|
24
|
+
}
|
|
22
25
|
async hasIcon() {
|
|
23
26
|
return await this.locatorForOptional(".wr-dropdown-item__icon")() !== null;
|
|
24
27
|
}
|
|
@@ -40,10 +43,10 @@ var WrDropdownItemHarness = class WrDropdownItemHarness extends ComponentHarness
|
|
|
40
43
|
* Use of this source code is governed by an MIT-style license that can be
|
|
41
44
|
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
42
45
|
*/
|
|
43
|
-
var WrDropdownHarness = class
|
|
46
|
+
var WrDropdownHarness = class extends ContentContainerComponentHarness {
|
|
44
47
|
static hostSelector = ".wr-dropdown-trigger";
|
|
45
48
|
static with(options = {}) {
|
|
46
|
-
return new HarnessPredicate(
|
|
49
|
+
return new HarnessPredicate(this, options).addOption("text", options.text, (harness, text) => HarnessPredicate.stringMatches(harness.getTriggerText(), text)).addOption("open", options.open, async (harness, open) => await harness.isOpen() === open);
|
|
47
50
|
}
|
|
48
51
|
async getTriggerText() {
|
|
49
52
|
return (await this.host()).text();
|
|
@@ -107,6 +110,17 @@ var WrDropdownHarness = class WrDropdownHarness extends ContentContainerComponen
|
|
|
107
110
|
}
|
|
108
111
|
await item.click();
|
|
109
112
|
}
|
|
113
|
+
async openSubmenu(text) {
|
|
114
|
+
await this.open();
|
|
115
|
+
const submenu = await this.getHarnessOrNull(WrDropdownSubmenuHarness.with({ text }));
|
|
116
|
+
if (!submenu) {
|
|
117
|
+
const offered = await this.getAllHarnesses(WrDropdownSubmenuHarness);
|
|
118
|
+
const labels = await Promise.all(offered.map((item) => item.getTriggerText()));
|
|
119
|
+
throw new Error(`WrDropdownHarness.openSubmenu(): no item labelled ${String(text)} opens a submenu. Items with a submenu here: ${labels.join(", ") || "none"}.`);
|
|
120
|
+
}
|
|
121
|
+
await submenu.open();
|
|
122
|
+
return submenu;
|
|
123
|
+
}
|
|
110
124
|
async getFocusedItemText() {
|
|
111
125
|
for (const item of await this.getItems()) if (await item.isFocused()) return item.getText();
|
|
112
126
|
return null;
|
|
@@ -123,6 +137,27 @@ var WrDropdownHarness = class WrDropdownHarness extends ContentContainerComponen
|
|
|
123
137
|
return id;
|
|
124
138
|
}
|
|
125
139
|
};
|
|
126
|
-
|
|
140
|
+
var WrDropdownSubmenuHarness = class extends WrDropdownHarness {
|
|
141
|
+
static hostSelector = ".wr-dropdown-submenu-trigger";
|
|
142
|
+
async open() {
|
|
143
|
+
if (await this.isOpen()) return;
|
|
144
|
+
await (await this.host()).click();
|
|
145
|
+
if (await this.isOpen()) return;
|
|
146
|
+
throw new Error("WrDropdownSubmenuHarness.open(): clicking the item did not open its submenu. A disabled item opens nothing, and neither does one whose own menu has closed; check isOpen() on the level above.");
|
|
147
|
+
}
|
|
148
|
+
async openByKeyboard() {
|
|
149
|
+
if (await this.isOpen()) return;
|
|
150
|
+
await (await this.host()).sendKeys(TestKey.ENTER);
|
|
151
|
+
if (await this.isOpen()) return;
|
|
152
|
+
throw new Error("WrDropdownSubmenuHarness.openByKeyboard(): Enter on the item did not open its submenu. Enter reaches it through `<wr-dropdown-item>`, so check that the directive sits on one and that it is enabled.");
|
|
153
|
+
}
|
|
154
|
+
async close() {
|
|
155
|
+
if (!await this.isOpen()) return;
|
|
156
|
+
await (await this.menu()).sendKeys(TestKey.ESCAPE);
|
|
157
|
+
if (!await this.isOpen()) return;
|
|
158
|
+
throw new Error("WrDropdownSubmenuHarness.close(): the submenu is still open after Escape was typed in it.");
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
export { WrDropdownHarness, WrDropdownItemHarness, WrDropdownSubmenuHarness };
|
|
127
162
|
|
|
128
163
|
//# sourceMappingURL=ngwr-dropdown-testing.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-dropdown-testing.mjs","names":[],"sources":["../../../projects/lib/dropdown/testing/wr-dropdown-item-harness.ts","../../../projects/lib/dropdown/testing/wr-dropdown-harness.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';\n\nimport type { WrDropdownItemHarnessFilters } from './types';\n\n/**\n * Test harness for one `<wr-dropdown-item>` inside a dropdown menu.\n *\n * The selector is the CLASS rather than the element: `.wr-dropdown-item` is what\n * the directive's own keyboard navigation queries, so it is the contract both\n * sides already rely on. Only the class, though — the directive narrows its query\n * to `:not(.wr-dropdown-item--disabled)` because it is looking for focus stops,\n * while a spec still has to be able to see a disabled item and assert that it is\n * one.\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrDropdownItemHarness extends ComponentHarness {\n /** The class the item paints on its host, and the one arrow-key navigation looks for. */\n static hostSelector = '.wr-dropdown-item';\n\n /** Build a predicate that narrows the query. */\n static with(options: WrDropdownItemHarnessFilters = {}): HarnessPredicate<WrDropdownItemHarness> {\n return new HarnessPredicate(WrDropdownItemHarness, options)\n .addOption('text', options.text, (harness, text) => HarnessPredicate.stringMatches(harness.getText(), text))\n .addOption('disabled', options.disabled, async (harness, disabled) => (await harness.isDisabled()) === disabled);\n }\n\n /** The item's label, trimmed. A leading icon is not part of it. */\n async getText(): Promise<string> {\n return (await this.locatorFor('.wr-dropdown-item__label')()).text();\n }\n\n /** The role the item announces — `menuitem`. */\n async getRole(): Promise<string | null> {\n return (await this.host()).getAttribute('role');\n }\n\n /** Whether the item refuses activation. */\n async isDisabled(): Promise<boolean> {\n return (await (await this.host()).getAttribute('aria-disabled')) === 'true';\n }\n\n /** Whether the item shows a leading icon. */\n async hasIcon(): Promise<boolean> {\n return (await this.locatorForOptional('.wr-dropdown-item__icon')()) !== null;\n }\n\n /** The leading icon's registered name, or `null` when the item has no icon. */\n async getIconName(): Promise<string | null> {\n const icon = await this.locatorForOptional('.wr-dropdown-item__icon')();\n // `<wr-icon>` reflects the name it was asked for as `data-icon`, whether or not\n // that name is registered — so this answers what the item MEANT to draw.\n return icon ? icon.getAttribute('data-icon') : null;\n }\n\n /** Whether the item holds the menu's roving focus. */\n async isFocused(): Promise<boolean> {\n return (await this.host()).isFocused();\n }\n\n /**\n * Click the item. A disabled item throws instead.\n *\n * Refusing is the only honest answer: the item's own `disabled` guards the\n * KEYBOARD path only, and a pointer is stopped by `pointer-events: none` in the\n * stylesheet. jsdom loads no stylesheets, so a click dispatched here would land\n * on the host — exactly where the consumer bound `(click)` — and the spec would\n * record an activation that cannot happen in a browser. Assert `isDisabled()`\n * instead.\n */\n async click(): Promise<void> {\n if (await this.isDisabled()) {\n throw new Error(\n `WrDropdownItemHarness.click(): \"${await this.getText()}\" is disabled, so clicking it would ` +\n 'report behaviour a browser cannot produce — the pointer is stopped by CSS, which jsdom does ' +\n 'not load. Assert isDisabled() instead.'\n );\n }\n\n return (await this.host()).click();\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport {\n ContentContainerComponentHarness,\n type HarnessLoader,\n HarnessPredicate,\n TestKey,\n type TestElement,\n} from '@angular/cdk/testing';\n\nimport type { WrDropdownHarnessFilters, WrDropdownItemHarnessFilters } from './types';\nimport { WrDropdownItemHarness } from './wr-dropdown-item-harness';\n\n/**\n * Test harness for `[wrDropdown]` — the trigger, and the menu it opens.\n *\n * The harness matches the TRIGGER, because that is the only part of the dropdown\n * in the fixture: `<wr-dropdown-menu>` renders nothing of its own (it hands over\n * an `<ng-template>`), and the menu is portalled into the overlay container, a\n * sibling of the whole app. So every item is read through the document root,\n * scoped by the `aria-controls` id the trigger publishes while it is open — which\n * is what keeps two dropdowns on one page from answering with each other's items.\n *\n * That scoped loader is also this harness's CONTENT loader, so\n * `dropdown.getHarness(…)` resolves inside THIS dropdown's menu: the consumer's\n * own components in the menu are reachable without the spec ever touching the\n * overlay, and so is a nested `[wrDropdown]`, which is how a submenu is built\n * here (the component ships no submenu API of its own).\n *\n * @example\n * ```ts\n * const dropdown = await loader.getHarness(WrDropdownHarness.with({ text: 'Actions' }));\n *\n * await dropdown.open();\n * expect(await dropdown.getItemTexts()).toEqual(['Copy', 'Delete']);\n *\n * await dropdown.clickItem({ text: 'Copy' });\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrDropdownHarness extends ContentContainerComponentHarness {\n /** The directive's host — whatever element the consumer put `[wrDropdown]` on. */\n static hostSelector = '.wr-dropdown-trigger';\n\n /** Build a predicate that narrows the query. */\n static with(options: WrDropdownHarnessFilters = {}): HarnessPredicate<WrDropdownHarness> {\n return new HarnessPredicate(WrDropdownHarness, options)\n .addOption('text', options.text, (harness, text) =>\n HarnessPredicate.stringMatches(harness.getTriggerText(), text)\n )\n .addOption('open', options.open, async (harness, open) => (await harness.isOpen()) === open);\n }\n\n /** The trigger's visible text. */\n async getTriggerText(): Promise<string> {\n return (await this.host()).text();\n }\n\n /** Whether the menu is showing. */\n async isOpen(): Promise<boolean> {\n return (await (await this.host()).getAttribute('aria-expanded')) === 'true';\n }\n\n /** The role the menu announces — `menu`. Throws while the menu is closed. */\n async getMenuRole(): Promise<string | null> {\n return (await this.menu()).getAttribute('role');\n }\n\n /**\n * Whether the menu takes its accessible name from this trigger.\n *\n * The menu carries no label of its own, so that reference IS its name — and the\n * id it points at is generated unless the consumer named the trigger\n * themselves, which is why a spec cannot simply hard-code one.\n */\n async isMenuLabelledByTrigger(): Promise<boolean> {\n const labelledBy = await (await this.menu()).getAttribute('aria-labelledby');\n return labelledBy !== null && labelledBy === (await (await this.host()).getAttribute('id'));\n }\n\n /**\n * Open the menu, whichever gesture this dropdown listens for.\n *\n * `trigger` is not reflected in the DOM, so the harness cannot ask which mode it\n * is in: it moves the pointer on first and falls back to a click. Hover leads\n * because a click is an outside pointer event for every OTHER open overlay — so\n * leading with it would shut someone else's menu on the way to opening this one\n * — and a `trigger=\"click\"` dropdown ignores the hover outright.\n */\n async open(): Promise<void> {\n if (await this.isOpen()) return;\n const host = await this.host();\n\n await host.hover();\n if (await this.isOpen()) return;\n\n await host.click();\n if (await this.isOpen()) return;\n\n throw new Error(\n 'WrDropdownHarness.open(): the menu did not open — neither hovering the trigger nor clicking it ' +\n 'had any effect. Both gestures were tried, so the `trigger` mode is not the cause; check that this ' +\n 'element is the trigger you meant. openByKeyboard() is the third route in.'\n );\n }\n\n /**\n * Open the menu from the keyboard — ArrowDown on the trigger, the APG\n * menu-button path (ArrowUp / Enter / Space do the same).\n *\n * Worth its own method rather than an argument to `open()`: it is the only way\n * to get TWO dropdowns open at once, because clicking a second trigger is an\n * outside pointer event for the first and closes it.\n */\n async openByKeyboard(): Promise<void> {\n if (await this.isOpen()) return;\n\n await (await this.host()).sendKeys(TestKey.DOWN_ARROW);\n if (await this.isOpen()) return;\n\n throw new Error(\n 'WrDropdownHarness.openByKeyboard(): ArrowDown on the trigger did not open the menu. The component ' +\n 'takes ArrowDown / ArrowUp / Enter / Space in EVERY `trigger` mode, so the mode is not the cause; ' +\n 'check that this element is the trigger you meant.'\n );\n }\n\n /** Close the menu. A closed dropdown is left alone. */\n async close(): Promise<void> {\n if (!(await this.isOpen())) return;\n const host = await this.host();\n\n // Pointer-out leads for the reason `open()` hovers first: it closes a\n // `trigger=\"hover\"` dropdown without a click, and the click a `trigger=\"click\"`\n // one needs would also count as an outside press for every other open overlay.\n await host.mouseAway();\n if (!(await this.isOpen())) return;\n\n await host.click();\n if (!(await this.isOpen())) return;\n\n throw new Error(\n 'WrDropdownHarness.close(): the menu is still open. Moving the pointer away closes a ' +\n '`trigger=\"hover\"` dropdown and a second click closes a `trigger=\"click\"` one; neither worked.'\n );\n }\n\n /** Click the trigger. A `trigger=\"hover\"` dropdown deliberately ignores this. */\n async clickTrigger(): Promise<void> {\n return (await this.host()).click();\n }\n\n /** Move the pointer onto the trigger. Opens a `trigger=\"hover\"` dropdown. */\n async hoverTrigger(): Promise<void> {\n return (await this.host()).hover();\n }\n\n /** Move the pointer off the trigger. Closes a `trigger=\"hover\"` dropdown. */\n async mouseAwayFromTrigger(): Promise<void> {\n return (await this.host()).mouseAway();\n }\n\n /**\n * The items in this dropdown's menu, in DOM order.\n *\n * Throws while the menu is closed: the items do not exist anywhere until the\n * portal is attached, and an empty array reads like a menu that rendered\n * nothing — a failure three lines later instead of here.\n */\n async getItems(filters: WrDropdownItemHarnessFilters = {}): Promise<WrDropdownItemHarness[]> {\n return this.getAllHarnesses(WrDropdownItemHarness.with(filters));\n }\n\n /** The labels of the items in this dropdown's menu, in DOM order. */\n async getItemTexts(): Promise<string[]> {\n const items = await this.getItems();\n return Promise.all(items.map(item => item.getText()));\n }\n\n /**\n * Open the menu if it is closed, then click the first item matching the filters.\n *\n * Picking does NOT close the menu — there is no close-on-select in the item or\n * the menu, so a consumer who wants one calls `close()` themselves.\n */\n async clickItem(filters: WrDropdownItemHarnessFilters): Promise<void> {\n await this.open();\n\n const [item] = await this.getItems(filters);\n if (!item) {\n const offered = await this.getItemTexts();\n throw new Error(\n `WrDropdownHarness.clickItem(): no item matched ${JSON.stringify(filters)}. ` +\n `The menu offers: ${offered.join(', ')}.`\n );\n }\n\n await item.click();\n }\n\n /**\n * The label of the item that currently holds focus, or `null` when focus is\n * elsewhere.\n *\n * The menu roves focus rather than moving a visual cursor — it lands on the\n * first ENABLED item as the menu renders, and the arrow keys walk it from there\n * over the enabled items only (a disabled one is not a stop) — so this is the\n * only way to ask where the keyboard is.\n */\n async getFocusedItemText(): Promise<string | null> {\n for (const item of await this.getItems()) {\n if (await item.isFocused()) return item.getText();\n }\n return null;\n }\n\n /**\n * A loader scoped to THIS dropdown's menu — the content loader every\n * `HarnessLoader` method on this class runs through, `getItems()` included.\n *\n * Scoped by the published id rather than by `.wr-dropdown-menu`: the overlay\n * container is shared, so a bare class query would answer with whichever\n * dropdown happened to open first.\n */\n protected override async getRootHarnessLoader(): Promise<HarnessLoader> {\n return this.documentRootLocatorFactory().harnessLoaderFor(`#${await this.menuId()}`);\n }\n\n /** This dropdown's menu element in the overlay. */\n private async menu(): Promise<TestElement> {\n return this.documentRootLocatorFactory().locatorFor(`#${await this.menuId()}`)();\n }\n\n /** The id the trigger publishes as `aria-controls`, which its menu carries. */\n private async menuId(): Promise<string> {\n const id = await (await this.host()).getAttribute('aria-controls');\n if (!id) {\n throw new Error(\n 'WrDropdownHarness: the menu is closed, so there is nothing inside it to read — call open() ' +\n 'first. The trigger publishes `aria-controls` only while its menu is open.'\n );\n }\n return id;\n }\n}\n"],"mappings":";;;;;;;AAuBA,IAAa,wBAAb,MAAa,8BAA8B,iBAAgB;CAEzD,OAAO,eAAe;CAGtB,OAAO,KAAK,UAAwC,CAAA,GAAE;EACpD,OAAO,IAAI,iBAAiB,uBAAuB,OAAO,CAAC,CACxD,UAAU,QAAQ,QAAQ,OAAO,SAAS,SAAS,iBAAiB,cAAc,QAAQ,QAAO,GAAI,IAAI,CAAC,CAAC,CAC3G,UAAU,YAAY,QAAQ,UAAU,OAAO,SAAS,aAAc,MAAM,QAAQ,WAAU,MAAQ,QAAQ;CACnH;CAGA,MAAM,UAAO;EACX,QAAQ,MAAM,KAAK,WAAW,0BAA0B,CAAC,CAAA,EAAA,CAAI,KAAI;CACnE;CAGA,MAAM,UAAO;EACX,QAAQ,MAAM,KAAK,KAAI,EAAA,CAAI,aAAa,MAAM;CAChD;CAGA,MAAM,aAAU;EACd,OAAQ,OAAO,MAAM,KAAK,KAAI,EAAA,CAAI,aAAa,eAAe,MAAO;CACvE;CAGA,MAAM,UAAO;EACX,OAAQ,MAAM,KAAK,mBAAmB,yBAAyB,CAAC,CAAA,MAAQ;CAC1E;CAGA,MAAM,cAAW;EACf,MAAM,OAAO,MAAM,KAAK,mBAAmB,yBAAyB,CAAC,CAAA;EAGrE,OAAO,OAAO,KAAK,aAAa,WAAW,IAAI;CACjD;CAGA,MAAM,YAAS;EACb,QAAQ,MAAM,KAAK,KAAI,EAAA,CAAI,UAAS;CACtC;CAYA,MAAM,QAAK;EACT,IAAI,MAAM,KAAK,WAAU,GACvB,MAAM,IAAI,MACR,mCAAmC,MAAM,KAAK,QAAO,EAAE,uKAEb;EAI9C,QAAQ,MAAM,KAAK,KAAI,EAAA,CAAI,MAAK;CACl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Q,MAAM,OAAI;EAChB,OAAO,KAAK,2BAA0B,CAAE,CAAC,WAAW,IAAI,MAAM,KAAK,OAAM,GAAI,CAAC,CAAA;CAChF;CAGQ,MAAM,SAAM;EAClB,MAAM,KAAK,OAAO,MAAM,KAAK,KAAI,EAAA,CAAI,aAAa,eAAe;EACjE,IAAI,CAAC,IACH,MAAM,IAAI,MACR,sKAC6E;EAGjF,OAAO;CACT"}
|
|
1
|
+
{"version":3,"file":"ngwr-dropdown-testing.mjs","names":[],"sources":["../../../projects/lib/dropdown/testing/wr-dropdown-item-harness.ts","../../../projects/lib/dropdown/testing/wr-dropdown-harness.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';\n\nimport type { WrDropdownItemHarnessFilters } from './types';\n\n/**\n * Test harness for one `<wr-dropdown-item>` inside a dropdown menu.\n *\n * The selector is the CLASS rather than the element: `.wr-dropdown-item` is what\n * the directive's own keyboard navigation queries, so it is the contract both\n * sides already rely on. Only the class, though — the directive narrows its query\n * to `:not(.wr-dropdown-item--disabled)` because it is looking for focus stops,\n * while a spec still has to be able to see a disabled item and assert that it is\n * one.\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrDropdownItemHarness extends ComponentHarness {\n /** The class the item paints on its host, and the one arrow-key navigation looks for. */\n static hostSelector = '.wr-dropdown-item';\n\n /** Build a predicate that narrows the query. */\n static with(options: WrDropdownItemHarnessFilters = {}): HarnessPredicate<WrDropdownItemHarness> {\n return new HarnessPredicate(WrDropdownItemHarness, options)\n .addOption('text', options.text, (harness, text) => HarnessPredicate.stringMatches(harness.getText(), text))\n .addOption('disabled', options.disabled, async (harness, disabled) => (await harness.isDisabled()) === disabled);\n }\n\n /** The item's label, trimmed. A leading icon is not part of it. */\n async getText(): Promise<string> {\n return (await this.locatorFor('.wr-dropdown-item__label')()).text();\n }\n\n /** The role the item announces — `menuitem`. */\n async getRole(): Promise<string | null> {\n return (await this.host()).getAttribute('role');\n }\n\n /** Whether the item refuses activation. */\n async isDisabled(): Promise<boolean> {\n return (await (await this.host()).getAttribute('aria-disabled')) === 'true';\n }\n\n /** Whether the item opens a submenu. `WrDropdownHarness.openSubmenu()` opens it. */\n async hasSubmenu(): Promise<boolean> {\n return (await (await this.host()).getAttribute('aria-haspopup')) === 'menu';\n }\n\n /** Whether the item shows a leading icon. */\n async hasIcon(): Promise<boolean> {\n return (await this.locatorForOptional('.wr-dropdown-item__icon')()) !== null;\n }\n\n /** The leading icon's registered name, or `null` when the item has no icon. */\n async getIconName(): Promise<string | null> {\n const icon = await this.locatorForOptional('.wr-dropdown-item__icon')();\n // `<wr-icon>` reflects the name it was asked for as `data-icon`, whether or not\n // that name is registered — so this answers what the item MEANT to draw.\n return icon ? icon.getAttribute('data-icon') : null;\n }\n\n /** Whether the item holds the menu's roving focus. */\n async isFocused(): Promise<boolean> {\n return (await this.host()).isFocused();\n }\n\n /**\n * Click the item. A disabled item throws instead.\n *\n * Refusing is the only honest answer: the item's own `disabled` guards the\n * KEYBOARD path only, and a pointer is stopped by `pointer-events: none` in the\n * stylesheet. jsdom loads no stylesheets, so a click dispatched here would land\n * on the host — exactly where the consumer bound `(click)` — and the spec would\n * record an activation that cannot happen in a browser. Assert `isDisabled()`\n * instead.\n */\n async click(): Promise<void> {\n if (await this.isDisabled()) {\n throw new Error(\n `WrDropdownItemHarness.click(): \"${await this.getText()}\" is disabled, so clicking it would ` +\n 'report behaviour a browser cannot produce — the pointer is stopped by CSS, which jsdom does ' +\n 'not load. Assert isDisabled() instead.'\n );\n }\n\n return (await this.host()).click();\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport {\n type ComponentHarnessConstructor,\n ContentContainerComponentHarness,\n type HarnessLoader,\n HarnessPredicate,\n TestKey,\n type TestElement,\n} from '@angular/cdk/testing';\n\nimport type { WrDropdownHarnessFilters, WrDropdownItemHarnessFilters } from './types';\nimport { WrDropdownItemHarness } from './wr-dropdown-item-harness';\n\n/**\n * Test harness for `[wrDropdown]` — the trigger, and the menu it opens.\n *\n * The harness matches the TRIGGER, because that is the only part of the dropdown\n * in the fixture: `<wr-dropdown-menu>` renders nothing of its own (it hands over\n * an `<ng-template>`), and the menu is portalled into the overlay container, a\n * sibling of the whole app. So every item is read through the document root,\n * scoped by the `aria-controls` id the trigger publishes while it is open — which\n * is what keeps two dropdowns on one page from answering with each other's items.\n *\n * That scoped loader is also this harness's CONTENT loader, so\n * `dropdown.getHarness(…)` resolves inside THIS dropdown's menu: the consumer's\n * own components in the menu are reachable without the spec ever touching the\n * overlay, and so is a nested `[wrDropdown]`. A submenu is reached with\n * `openSubmenu()`, which answers with a harness scoped to that submenu.\n *\n * @example\n * ```ts\n * const dropdown = await loader.getHarness(WrDropdownHarness.with({ text: 'Actions' }));\n *\n * await dropdown.open();\n * expect(await dropdown.getItemTexts()).toEqual(['Copy', 'Delete']);\n *\n * await dropdown.clickItem({ text: 'Copy' });\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrDropdownHarness extends ContentContainerComponentHarness {\n /** The directive's host — whatever element the consumer put `[wrDropdown]` on. */\n static hostSelector = '.wr-dropdown-trigger';\n\n /** Build a predicate that narrows the query. */\n static with<T extends WrDropdownHarness>(\n this: ComponentHarnessConstructor<T>,\n options: WrDropdownHarnessFilters = {}\n ): HarnessPredicate<T> {\n return new HarnessPredicate(this, options)\n .addOption('text', options.text, (harness, text) =>\n HarnessPredicate.stringMatches(harness.getTriggerText(), text)\n )\n .addOption('open', options.open, async (harness, open) => (await harness.isOpen()) === open);\n }\n\n /** The trigger's visible text. */\n async getTriggerText(): Promise<string> {\n return (await this.host()).text();\n }\n\n /** Whether the menu is showing. */\n async isOpen(): Promise<boolean> {\n return (await (await this.host()).getAttribute('aria-expanded')) === 'true';\n }\n\n /** The role the menu announces — `menu`. Throws while the menu is closed. */\n async getMenuRole(): Promise<string | null> {\n return (await this.menu()).getAttribute('role');\n }\n\n /**\n * Whether the menu takes its accessible name from this trigger.\n *\n * The menu carries no label of its own, so that reference IS its name — and the\n * id it points at is generated unless the consumer named the trigger\n * themselves, which is why a spec cannot simply hard-code one.\n */\n async isMenuLabelledByTrigger(): Promise<boolean> {\n const labelledBy = await (await this.menu()).getAttribute('aria-labelledby');\n return labelledBy !== null && labelledBy === (await (await this.host()).getAttribute('id'));\n }\n\n /**\n * Open the menu, whichever gesture this dropdown listens for.\n *\n * `trigger` is not reflected in the DOM, so the harness cannot ask which mode it\n * is in: it moves the pointer on first and falls back to a click. Hover leads\n * because a click is an outside pointer event for every OTHER open overlay — so\n * leading with it would shut someone else's menu on the way to opening this one\n * — and a `trigger=\"click\"` dropdown ignores the hover outright.\n */\n async open(): Promise<void> {\n if (await this.isOpen()) return;\n const host = await this.host();\n\n await host.hover();\n if (await this.isOpen()) return;\n\n await host.click();\n if (await this.isOpen()) return;\n\n throw new Error(\n 'WrDropdownHarness.open(): the menu did not open — neither hovering the trigger nor clicking it ' +\n 'had any effect. Both gestures were tried, so the `trigger` mode is not the cause; check that this ' +\n 'element is the trigger you meant. openByKeyboard() is the third route in.'\n );\n }\n\n /**\n * Open the menu from the keyboard — ArrowDown on the trigger, the APG\n * menu-button path (ArrowUp / Enter / Space do the same).\n *\n * Worth its own method rather than an argument to `open()`: it is the only way\n * to get TWO dropdowns open at once, because clicking a second trigger is an\n * outside pointer event for the first and closes it.\n */\n async openByKeyboard(): Promise<void> {\n if (await this.isOpen()) return;\n\n await (await this.host()).sendKeys(TestKey.DOWN_ARROW);\n if (await this.isOpen()) return;\n\n throw new Error(\n 'WrDropdownHarness.openByKeyboard(): ArrowDown on the trigger did not open the menu. The component ' +\n 'takes ArrowDown / ArrowUp / Enter / Space in EVERY `trigger` mode, so the mode is not the cause; ' +\n 'check that this element is the trigger you meant.'\n );\n }\n\n /** Close the menu. A closed dropdown is left alone. */\n async close(): Promise<void> {\n if (!(await this.isOpen())) return;\n const host = await this.host();\n\n // Pointer-out leads for the reason `open()` hovers first: it closes a\n // `trigger=\"hover\"` dropdown without a click, and the click a `trigger=\"click\"`\n // one needs would also count as an outside press for every other open overlay.\n await host.mouseAway();\n if (!(await this.isOpen())) return;\n\n await host.click();\n if (!(await this.isOpen())) return;\n\n throw new Error(\n 'WrDropdownHarness.close(): the menu is still open. Moving the pointer away closes a ' +\n '`trigger=\"hover\"` dropdown and a second click closes a `trigger=\"click\"` one; neither worked.'\n );\n }\n\n /** Click the trigger. A `trigger=\"hover\"` dropdown deliberately ignores this. */\n async clickTrigger(): Promise<void> {\n return (await this.host()).click();\n }\n\n /** Move the pointer onto the trigger. Opens a `trigger=\"hover\"` dropdown. */\n async hoverTrigger(): Promise<void> {\n return (await this.host()).hover();\n }\n\n /** Move the pointer off the trigger. Closes a `trigger=\"hover\"` dropdown. */\n async mouseAwayFromTrigger(): Promise<void> {\n return (await this.host()).mouseAway();\n }\n\n /**\n * The items in this dropdown's menu, in DOM order.\n *\n * Throws while the menu is closed: the items do not exist anywhere until the\n * portal is attached, and an empty array reads like a menu that rendered\n * nothing — a failure three lines later instead of here.\n */\n async getItems(filters: WrDropdownItemHarnessFilters = {}): Promise<WrDropdownItemHarness[]> {\n return this.getAllHarnesses(WrDropdownItemHarness.with(filters));\n }\n\n /** The labels of the items in this dropdown's menu, in DOM order. */\n async getItemTexts(): Promise<string[]> {\n const items = await this.getItems();\n return Promise.all(items.map(item => item.getText()));\n }\n\n /**\n * Open the menu if it is closed, then click the first item matching the filters.\n *\n * Picking does NOT close the menu — there is no close-on-select in the item or\n * the menu, so a consumer who wants one calls `close()` themselves.\n */\n async clickItem(filters: WrDropdownItemHarnessFilters): Promise<void> {\n await this.open();\n\n const [item] = await this.getItems(filters);\n if (!item) {\n const offered = await this.getItemTexts();\n throw new Error(\n `WrDropdownHarness.clickItem(): no item matched ${JSON.stringify(filters)}. ` +\n `The menu offers: ${offered.join(', ')}.`\n );\n }\n\n await item.click();\n }\n\n /**\n * Open the menu if it is closed, then open the submenu of the item with this\n * label and answer with its harness: `getItems()`, `clickItem()` and a further\n * `openSubmenu()` all read that submenu and nothing else.\n *\n * A click opens it, since hovering waits out the item's `showDelay`.\n */\n async openSubmenu(text: string | RegExp): Promise<WrDropdownSubmenuHarness> {\n await this.open();\n\n const submenu = await this.getHarnessOrNull(WrDropdownSubmenuHarness.with({ text }));\n if (!submenu) {\n const offered = await this.getAllHarnesses(WrDropdownSubmenuHarness);\n const labels = await Promise.all(offered.map(item => item.getTriggerText()));\n throw new Error(\n `WrDropdownHarness.openSubmenu(): no item labelled ${String(text)} opens a submenu. ` +\n `Items with a submenu here: ${labels.join(', ') || 'none'}.`\n );\n }\n\n await submenu.open();\n return submenu;\n }\n\n /**\n * The label of the item that currently holds focus, or `null` when focus is\n * elsewhere.\n *\n * The menu roves focus rather than moving a visual cursor — it lands on the\n * first ENABLED item as the menu renders, and the arrow keys walk it from there\n * over the enabled items only (a disabled one is not a stop) — so this is the\n * only way to ask where the keyboard is.\n */\n async getFocusedItemText(): Promise<string | null> {\n for (const item of await this.getItems()) {\n if (await item.isFocused()) return item.getText();\n }\n return null;\n }\n\n /**\n * A loader scoped to THIS dropdown's menu — the content loader every\n * `HarnessLoader` method on this class runs through, `getItems()` included.\n *\n * Scoped by the published id rather than by `.wr-dropdown-menu`: the overlay\n * container is shared, so a bare class query would answer with whichever\n * dropdown happened to open first.\n */\n protected override async getRootHarnessLoader(): Promise<HarnessLoader> {\n return this.documentRootLocatorFactory().harnessLoaderFor(`#${await this.menuId()}`);\n }\n\n /** This dropdown's menu element in the overlay. */\n protected async menu(): Promise<TestElement> {\n return this.documentRootLocatorFactory().locatorFor(`#${await this.menuId()}`)();\n }\n\n /** The id the trigger publishes as `aria-controls`, which its menu carries. */\n private async menuId(): Promise<string> {\n const id = await (await this.host()).getAttribute('aria-controls');\n if (!id) {\n throw new Error(\n 'WrDropdownHarness: the menu is closed, so there is nothing inside it to read — call open() ' +\n 'first. The trigger publishes `aria-controls` only while its menu is open.'\n );\n }\n return id;\n }\n}\n\n/**\n * Test harness for an item carrying `[wrDropdownSubmenu]`, and the submenu it\n * opens. Usually reached through `openSubmenu()` on the level above.\n *\n * It is a `WrDropdownHarness` whose trigger is the item, so everything that\n * reads a menu reads the submenu, scoped the same way, by the id the item\n * publishes. Two things differ. `hoverTrigger()` opens nothing by itself: the\n * item waits out its `showDelay`, which is the spec's own fake timer to\n * advance. And clicking a leaf item closes every submenu, so `clickItem()`\n * leaves this one closed, while the root menu stays open as it always has.\n *\n * Which side the submenu opened on is not readable: jsdom has no layout.\n *\n * @example\n * ```ts\n * const file = await loader.getHarness(WrDropdownHarness.with({ text: 'File' }));\n * const exportAs = await file.openSubmenu('Export');\n *\n * expect(await exportAs.getItemTexts()).toEqual(['CSV', 'PDF', 'Excel']);\n * await exportAs.clickItem({ text: 'CSV' });\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrDropdownSubmenuHarness extends WrDropdownHarness {\n /** The class the directive puts on its item. */\n static override hostSelector = '.wr-dropdown-submenu-trigger';\n\n /** Open the submenu with a click on its item. */\n override async open(): Promise<void> {\n if (await this.isOpen()) return;\n\n await (await this.host()).click();\n if (await this.isOpen()) return;\n\n throw new Error(\n 'WrDropdownSubmenuHarness.open(): clicking the item did not open its submenu. A disabled item ' +\n 'opens nothing, and neither does one whose own menu has closed; check isOpen() on the level above.'\n );\n }\n\n /**\n * Open the submenu from the keyboard, with Enter on its item. Enter rather\n * than the arrow because the arrow that opens a submenu depends on the\n * reading direction, and Enter does not.\n */\n override async openByKeyboard(): Promise<void> {\n if (await this.isOpen()) return;\n\n await (await this.host()).sendKeys(TestKey.ENTER);\n if (await this.isOpen()) return;\n\n throw new Error(\n 'WrDropdownSubmenuHarness.openByKeyboard(): Enter on the item did not open its submenu. Enter ' +\n 'reaches it through `<wr-dropdown-item>`, so check that the directive sits on one and that it is enabled.'\n );\n }\n\n /** Close the submenu with Escape typed inside it, which closes this level only. */\n override async close(): Promise<void> {\n if (!(await this.isOpen())) return;\n\n await (await this.menu()).sendKeys(TestKey.ESCAPE);\n if (!(await this.isOpen())) return;\n\n throw new Error('WrDropdownSubmenuHarness.close(): the submenu is still open after Escape was typed in it.');\n }\n}\n"],"mappings":";;;;;;;AAuBA,IAAa,wBAAb,MAAa,8BAA8B,iBAAgB;CAEzD,OAAO,eAAe;CAGtB,OAAO,KAAK,UAAwC,CAAA,GAAE;EACpD,OAAO,IAAI,iBAAiB,uBAAuB,OAAO,CAAC,CACxD,UAAU,QAAQ,QAAQ,OAAO,SAAS,SAAS,iBAAiB,cAAc,QAAQ,QAAO,GAAI,IAAI,CAAC,CAAC,CAC3G,UAAU,YAAY,QAAQ,UAAU,OAAO,SAAS,aAAc,MAAM,QAAQ,WAAU,MAAQ,QAAQ;CACnH;CAGA,MAAM,UAAO;EACX,QAAQ,MAAM,KAAK,WAAW,0BAA0B,CAAC,CAAA,EAAA,CAAI,KAAI;CACnE;CAGA,MAAM,UAAO;EACX,QAAQ,MAAM,KAAK,KAAI,EAAA,CAAI,aAAa,MAAM;CAChD;CAGA,MAAM,aAAU;EACd,OAAQ,OAAO,MAAM,KAAK,KAAI,EAAA,CAAI,aAAa,eAAe,MAAO;CACvE;CAGA,MAAM,aAAU;EACd,OAAQ,OAAO,MAAM,KAAK,KAAI,EAAA,CAAI,aAAa,eAAe,MAAO;CACvE;CAGA,MAAM,UAAO;EACX,OAAQ,MAAM,KAAK,mBAAmB,yBAAyB,CAAC,CAAA,MAAQ;CAC1E;CAGA,MAAM,cAAW;EACf,MAAM,OAAO,MAAM,KAAK,mBAAmB,yBAAyB,CAAC,CAAA;EAGrE,OAAO,OAAO,KAAK,aAAa,WAAW,IAAI;CACjD;CAGA,MAAM,YAAS;EACb,QAAQ,MAAM,KAAK,KAAI,EAAA,CAAI,UAAS;CACtC;CAYA,MAAM,QAAK;EACT,IA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G;CAEhH;CAGS,MAAM,QAAK;EAClB,IAAI,CAAE,MAAM,KAAK,OAAM,GAAK;EAE5B,OAAO,MAAM,KAAK,KAAI,EAAA,CAAI,SAAS,QAAQ,MAAM;EACjD,IAAI,CAAE,MAAM,KAAK,OAAM,GAAK;EAE5B,MAAM,IAAI,MAAM,2FAA2F;CAC7G"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
2
|
import { Component, DestroyRef, Directive, ElementRef, Injector, TemplateRef, ViewContainerRef, ViewEncapsulation, computed, effect, inject, input, output, signal, viewChild } from "@angular/core";
|
|
3
3
|
import { coerceBooleanProperty } from "@angular/cdk/coercion";
|
|
4
|
-
import { wrCheckStyles, wrRestoreFocus, wrToClassList } from "ngwr/utils";
|
|
4
|
+
import { wrCheckStyles, wrNumAttr, wrRestoreFocus, wrToClassList } from "ngwr/utils";
|
|
5
5
|
import { WrIcon } from "ngwr/icon";
|
|
6
6
|
import { Directionality } from "@angular/cdk/bidi";
|
|
7
7
|
import { ScrollStrategyOptions } from "@angular/cdk/overlay";
|
|
@@ -15,6 +15,33 @@ import { FocusMonitor } from "@angular/cdk/a11y";
|
|
|
15
15
|
* Use of this source code is governed by an MIT-style license that can be
|
|
16
16
|
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
17
17
|
*/
|
|
18
|
+
const levels = /* @__PURE__ */ new WeakMap();
|
|
19
|
+
function wrDropdownRegisterLevel(level) {
|
|
20
|
+
levels.set(level.pane, level);
|
|
21
|
+
if (level.parent) level.parent.child = level;
|
|
22
|
+
}
|
|
23
|
+
function wrDropdownReleaseLevel(level) {
|
|
24
|
+
levels.delete(level.pane);
|
|
25
|
+
if (level.parent?.child === level) level.parent.child = null;
|
|
26
|
+
}
|
|
27
|
+
function wrDropdownLevelAround(el) {
|
|
28
|
+
const pane = el.closest(".wr-dropdown-overlay");
|
|
29
|
+
return (pane && levels.get(pane)) ?? null;
|
|
30
|
+
}
|
|
31
|
+
function wrDropdownLevelOf(from, node) {
|
|
32
|
+
if (!(node instanceof Node)) return null;
|
|
33
|
+
for (let level = from; level; level = level.child) if (level.pane.contains(node)) return level;
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
function wrDropdownItems(pane) {
|
|
37
|
+
return Array.from(pane.querySelectorAll(".wr-dropdown-item:not(.wr-dropdown-item--disabled)"));
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* @license
|
|
41
|
+
*
|
|
42
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
43
|
+
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
44
|
+
*/
|
|
18
45
|
const WR_DROPDOWN_POSITIONS = {
|
|
19
46
|
top: {
|
|
20
47
|
originX: "center",
|
|
@@ -126,6 +153,7 @@ var WrDropdown = class WrDropdown {
|
|
|
126
153
|
return this.host.nativeElement.id || this.fallbackId;
|
|
127
154
|
}
|
|
128
155
|
overlayRef = null;
|
|
156
|
+
level = null;
|
|
129
157
|
constructor() {
|
|
130
158
|
if (typeof ngDevMode === "undefined" || ngDevMode) wrCheckStyles("dropdown");
|
|
131
159
|
this.destroyRef.onDestroy(() => this.closeOverlay(false));
|
|
@@ -158,7 +186,7 @@ var WrDropdown = class WrDropdown {
|
|
|
158
186
|
onMouseLeave(event) {
|
|
159
187
|
if (this.trigger() !== "hover") return;
|
|
160
188
|
const related = event.relatedTarget;
|
|
161
|
-
if (
|
|
189
|
+
if (this.inMenus(related)) return;
|
|
162
190
|
this.openState.set(false);
|
|
163
191
|
}
|
|
164
192
|
openOverlay() {
|
|
@@ -192,6 +220,14 @@ var WrDropdown = class WrDropdown {
|
|
|
192
220
|
this.menu().triggerId.set(this.triggerId);
|
|
193
221
|
const portal = new TemplatePortal(this.menu().contentTpl(), this.vcr);
|
|
194
222
|
this.overlayRef.attach(portal);
|
|
223
|
+
this.level = {
|
|
224
|
+
pane,
|
|
225
|
+
parent: null,
|
|
226
|
+
child: null,
|
|
227
|
+
close: () => this.close(),
|
|
228
|
+
pointerLeft: (related) => this.onMenusLeave(related)
|
|
229
|
+
};
|
|
230
|
+
wrDropdownRegisterLevel(this.level);
|
|
195
231
|
if (!this.openedByPointer) queueMicrotask(() => this.focusItemAt(0));
|
|
196
232
|
this.outsideClick.outsidePointerEvents(this.overlayRef).pipe(takeUntilDestroyed(this.destroyRef)).subscribe((event) => {
|
|
197
233
|
if (this.host.nativeElement.contains(event.target)) return;
|
|
@@ -206,8 +242,12 @@ var WrDropdown = class WrDropdown {
|
|
|
206
242
|
closeOverlay(notify = true) {
|
|
207
243
|
if (!this.overlayRef) return;
|
|
208
244
|
if (this.trigger() === "hover") this.overlayRef.overlayElement.removeEventListener("mouseleave", this.onOverlayMouseLeave);
|
|
209
|
-
const
|
|
210
|
-
|
|
245
|
+
const focusWasInside = this.inMenus(document.activeElement);
|
|
246
|
+
if (this.level) {
|
|
247
|
+
this.level.child?.close();
|
|
248
|
+
wrDropdownReleaseLevel(this.level);
|
|
249
|
+
this.level = null;
|
|
250
|
+
}
|
|
211
251
|
this.overlayRef.dispose();
|
|
212
252
|
this.overlayRef = null;
|
|
213
253
|
if (notify) {
|
|
@@ -224,13 +264,24 @@ var WrDropdown = class WrDropdown {
|
|
|
224
264
|
}
|
|
225
265
|
}
|
|
226
266
|
handleMenuKeydown(event) {
|
|
227
|
-
const
|
|
267
|
+
const level = this.level && wrDropdownLevelOf(this.level, event.target);
|
|
268
|
+
const submenu = level?.parent ? level : null;
|
|
269
|
+
const items = this.getItems(level?.pane);
|
|
228
270
|
if (items.length === 0 && event.key !== "Escape" && event.key !== "Tab") return;
|
|
229
271
|
const current = document.activeElement;
|
|
230
272
|
const idx = current ? items.indexOf(current) : -1;
|
|
231
273
|
const typedIn = event.target;
|
|
232
|
-
const ours = typedIn instanceof Node && (this.host.nativeElement.contains(typedIn) ||
|
|
274
|
+
const ours = typedIn instanceof Node && (this.host.nativeElement.contains(typedIn) || level !== null);
|
|
233
275
|
if (!ours && event.key !== "Escape" && event.key !== "Tab") return;
|
|
276
|
+
if (submenu && (event.key === "Escape" || event.key === (this.dir?.value === "rtl" ? "ArrowRight" : "ArrowLeft"))) {
|
|
277
|
+
event.preventDefault();
|
|
278
|
+
submenu.close();
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
const focusAt = (index) => {
|
|
282
|
+
event.preventDefault();
|
|
283
|
+
items[index]?.focus();
|
|
284
|
+
};
|
|
234
285
|
switch (event.key) {
|
|
235
286
|
case "Escape":
|
|
236
287
|
event.preventDefault();
|
|
@@ -242,36 +293,35 @@ var WrDropdown = class WrDropdown {
|
|
|
242
293
|
this.openState.set(false);
|
|
243
294
|
break;
|
|
244
295
|
case "ArrowDown":
|
|
245
|
-
|
|
246
|
-
this.focusItemAt(idx < items.length - 1 ? idx + 1 : 0);
|
|
296
|
+
focusAt(idx < items.length - 1 ? idx + 1 : 0);
|
|
247
297
|
break;
|
|
248
298
|
case "ArrowUp":
|
|
249
|
-
|
|
250
|
-
this.focusItemAt(idx > 0 ? idx - 1 : items.length - 1);
|
|
299
|
+
focusAt(idx > 0 ? idx - 1 : items.length - 1);
|
|
251
300
|
break;
|
|
252
301
|
case "Home":
|
|
253
|
-
|
|
254
|
-
this.focusItemAt(0);
|
|
302
|
+
focusAt(0);
|
|
255
303
|
break;
|
|
256
|
-
case "End":
|
|
257
|
-
event.preventDefault();
|
|
258
|
-
this.focusItemAt(items.length - 1);
|
|
304
|
+
case "End": focusAt(items.length - 1);
|
|
259
305
|
}
|
|
260
306
|
}
|
|
261
|
-
getItems() {
|
|
262
|
-
|
|
263
|
-
|
|
307
|
+
getItems(pane = this.overlayRef?.overlayElement) {
|
|
308
|
+
return pane ? wrDropdownItems(pane) : [];
|
|
309
|
+
}
|
|
310
|
+
inMenus(node) {
|
|
311
|
+
return this.level !== null && wrDropdownLevelOf(this.level, node) !== null;
|
|
312
|
+
}
|
|
313
|
+
onMenusLeave(related) {
|
|
314
|
+
if (this.trigger() !== "hover") return;
|
|
315
|
+
if (related instanceof Node && this.host.nativeElement.contains(related)) return;
|
|
316
|
+
if (this.inMenus(related)) return;
|
|
317
|
+
this.openState.set(false);
|
|
264
318
|
}
|
|
265
319
|
focusItemAt(index) {
|
|
266
320
|
const items = this.getItems();
|
|
267
321
|
if (items.length === 0) return;
|
|
268
322
|
items[(index % items.length + items.length) % items.length]?.focus();
|
|
269
323
|
}
|
|
270
|
-
onOverlayMouseLeave = (event) =>
|
|
271
|
-
const related = event.relatedTarget;
|
|
272
|
-
if (related && this.host.nativeElement.contains(related)) return;
|
|
273
|
-
this.openState.set(false);
|
|
274
|
-
};
|
|
324
|
+
onOverlayMouseLeave = (event) => this.onMenusLeave(event.relatedTarget);
|
|
275
325
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
276
326
|
minVersion: "12.0.0",
|
|
277
327
|
version: "22.2.5",
|
|
@@ -501,7 +551,7 @@ var WrDropdownItem = class WrDropdownItem {
|
|
|
501
551
|
transform: coerceBooleanProperty
|
|
502
552
|
});
|
|
503
553
|
classes = computed(() => {
|
|
504
|
-
const parts = [
|
|
554
|
+
const parts = [];
|
|
505
555
|
if (this.disabled()) parts.push("wr-dropdown-item--disabled");
|
|
506
556
|
return parts.join(" ");
|
|
507
557
|
}, ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
|
|
@@ -551,7 +601,8 @@ var WrDropdownItem = class WrDropdownItem {
|
|
|
551
601
|
"class": "classes()",
|
|
552
602
|
"attr.tabindex": "-1",
|
|
553
603
|
"attr.aria-disabled": "disabled() ? true : null"
|
|
554
|
-
}
|
|
604
|
+
},
|
|
605
|
+
classAttribute: "wr-dropdown-item"
|
|
555
606
|
},
|
|
556
607
|
ngImport: i0,
|
|
557
608
|
template: "@if (icon(); as name) {\n <wr-icon class=\"wr-dropdown-item__icon\" [name]=\"name\" />\n}\n<span class=\"wr-dropdown-item__label\">\n <ng-content />\n</span>\n",
|
|
@@ -576,6 +627,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
576
627
|
encapsulation: ViewEncapsulation.None,
|
|
577
628
|
host: {
|
|
578
629
|
role: "menuitem",
|
|
630
|
+
class: "wr-dropdown-item",
|
|
579
631
|
"[class]": "classes()",
|
|
580
632
|
"[attr.tabindex]": "-1",
|
|
581
633
|
"[attr.aria-disabled]": "disabled() ? true : null",
|
|
@@ -606,6 +658,290 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
606
658
|
}]
|
|
607
659
|
}
|
|
608
660
|
});
|
|
609
|
-
|
|
661
|
+
/**
|
|
662
|
+
* @license
|
|
663
|
+
*
|
|
664
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
665
|
+
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
666
|
+
*/
|
|
667
|
+
const POSITIONS = [
|
|
668
|
+
{
|
|
669
|
+
originX: "end",
|
|
670
|
+
originY: "top",
|
|
671
|
+
overlayX: "start",
|
|
672
|
+
overlayY: "top"
|
|
673
|
+
},
|
|
674
|
+
{
|
|
675
|
+
originX: "start",
|
|
676
|
+
originY: "top",
|
|
677
|
+
overlayX: "end",
|
|
678
|
+
overlayY: "top"
|
|
679
|
+
},
|
|
680
|
+
{
|
|
681
|
+
originX: "end",
|
|
682
|
+
originY: "bottom",
|
|
683
|
+
overlayX: "start",
|
|
684
|
+
overlayY: "bottom"
|
|
685
|
+
},
|
|
686
|
+
{
|
|
687
|
+
originX: "start",
|
|
688
|
+
originY: "bottom",
|
|
689
|
+
overlayX: "end",
|
|
690
|
+
overlayY: "bottom"
|
|
691
|
+
}
|
|
692
|
+
];
|
|
693
|
+
let itemUid = 0;
|
|
694
|
+
var WrDropdownSubmenu = class WrDropdownSubmenu {
|
|
695
|
+
menu = input.required({
|
|
696
|
+
...ngDevMode ? { debugName: "menu" } : /* istanbul ignore next */ {},
|
|
697
|
+
alias: "wrDropdownSubmenu"
|
|
698
|
+
});
|
|
699
|
+
showDelay = input(150, {
|
|
700
|
+
...ngDevMode ? { debugName: "showDelay" } : /* istanbul ignore next */ {},
|
|
701
|
+
transform: wrNumAttr(150)
|
|
702
|
+
});
|
|
703
|
+
hideDelay = input(150, {
|
|
704
|
+
...ngDevMode ? { debugName: "hideDelay" } : /* istanbul ignore next */ {},
|
|
705
|
+
transform: wrNumAttr(150)
|
|
706
|
+
});
|
|
707
|
+
host = inject(ElementRef);
|
|
708
|
+
focusMonitor = inject(FocusMonitor);
|
|
709
|
+
overlay = inject(WR_OVERLAY);
|
|
710
|
+
dir = inject(Directionality, { optional: true });
|
|
711
|
+
outsideClick = inject(WrOutsideClick);
|
|
712
|
+
vcr = inject(ViewContainerRef);
|
|
713
|
+
scrollStrategies = inject(ScrollStrategyOptions);
|
|
714
|
+
injector = inject(Injector);
|
|
715
|
+
openState = signal(false, ...ngDevMode ? [{ debugName: "openState" }] : /* istanbul ignore next */ []);
|
|
716
|
+
isOpen = this.openState.asReadonly();
|
|
717
|
+
fallbackId = `wr-dropdown-submenu-trigger-${++itemUid}`;
|
|
718
|
+
get itemId() {
|
|
719
|
+
return this.host.nativeElement.id || this.fallbackId;
|
|
720
|
+
}
|
|
721
|
+
overlayRef = null;
|
|
722
|
+
level = null;
|
|
723
|
+
outside = null;
|
|
724
|
+
showTimer = null;
|
|
725
|
+
hideTimer = null;
|
|
726
|
+
constructor() {
|
|
727
|
+
if (typeof ngDevMode === "undefined" || ngDevMode) wrCheckStyles("dropdown");
|
|
728
|
+
inject(DestroyRef).onDestroy(() => this.dispose(false));
|
|
729
|
+
}
|
|
730
|
+
open() {
|
|
731
|
+
this.show(true);
|
|
732
|
+
}
|
|
733
|
+
close() {
|
|
734
|
+
this.dispose(true);
|
|
735
|
+
}
|
|
736
|
+
onClick(event) {
|
|
737
|
+
this.show(event.detail === 0);
|
|
738
|
+
}
|
|
739
|
+
onKeydown(event) {
|
|
740
|
+
if (event.key !== (this.dir?.value === "rtl" ? "ArrowLeft" : "ArrowRight") || this.disabled) return;
|
|
741
|
+
event.preventDefault();
|
|
742
|
+
this.show(true);
|
|
743
|
+
}
|
|
744
|
+
onMouseEnter() {
|
|
745
|
+
this.clearTimers();
|
|
746
|
+
if (this.overlayRef || this.disabled) return;
|
|
747
|
+
this.showTimer = setTimeout(() => this.show(false), this.showDelay());
|
|
748
|
+
}
|
|
749
|
+
onMouseLeave(event) {
|
|
750
|
+
this.clearTimers();
|
|
751
|
+
if (!this.level || wrDropdownLevelOf(this.level, event.relatedTarget)) return;
|
|
752
|
+
this.hideLater();
|
|
753
|
+
}
|
|
754
|
+
get disabled() {
|
|
755
|
+
return this.host.nativeElement.getAttribute("aria-disabled") === "true";
|
|
756
|
+
}
|
|
757
|
+
show(focus) {
|
|
758
|
+
this.clearTimers();
|
|
759
|
+
if (!this.overlayRef) this.attach();
|
|
760
|
+
if (focus && this.overlayRef) wrDropdownItems(this.overlayRef.overlayElement)[0]?.focus();
|
|
761
|
+
}
|
|
762
|
+
attach() {
|
|
763
|
+
const parent = wrDropdownLevelAround(this.host.nativeElement);
|
|
764
|
+
if (!parent || this.disabled) return;
|
|
765
|
+
parent.child?.close();
|
|
766
|
+
const ref = this.overlay.create({
|
|
767
|
+
positionStrategy: this.overlay.position().flexibleConnectedTo(this.host).withPositions(POSITIONS).withPush(true).withGrowAfterOpen(true),
|
|
768
|
+
scrollStrategy: this.scrollStrategies.reposition(),
|
|
769
|
+
panelClass: ["wr-dropdown-overlay", "wr-dropdown-overlay--submenu"]
|
|
770
|
+
});
|
|
771
|
+
wrFollowDirection(ref, this.dir, this.injector);
|
|
772
|
+
this.menu().triggerId.set(this.itemId);
|
|
773
|
+
ref.attach(new TemplatePortal(this.menu().contentTpl(), this.vcr));
|
|
774
|
+
const pane = ref.overlayElement;
|
|
775
|
+
pane.addEventListener("mouseenter", this.clearTimers);
|
|
776
|
+
pane.addEventListener("mouseleave", this.onPaneLeave);
|
|
777
|
+
pane.addEventListener("click", this.onPaneClick);
|
|
778
|
+
this.outside = this.outsideClick.outsidePointerEvents(ref).subscribe((event) => {
|
|
779
|
+
if (!this.host.nativeElement.contains(event.target)) this.close();
|
|
780
|
+
});
|
|
781
|
+
this.overlayRef = ref;
|
|
782
|
+
this.level = {
|
|
783
|
+
pane,
|
|
784
|
+
parent,
|
|
785
|
+
child: null,
|
|
786
|
+
close: () => this.close()
|
|
787
|
+
};
|
|
788
|
+
wrDropdownRegisterLevel(this.level);
|
|
789
|
+
this.openState.set(true);
|
|
790
|
+
}
|
|
791
|
+
dispose(restoreFocus) {
|
|
792
|
+
this.clearTimers();
|
|
793
|
+
const ref = this.overlayRef;
|
|
794
|
+
const level = this.level;
|
|
795
|
+
if (!ref || !level) return;
|
|
796
|
+
const focusWasInside = wrDropdownLevelOf(level, document.activeElement) !== null;
|
|
797
|
+
level.child?.close();
|
|
798
|
+
wrDropdownReleaseLevel(level);
|
|
799
|
+
const pane = ref.overlayElement;
|
|
800
|
+
pane.removeEventListener("mouseenter", this.clearTimers);
|
|
801
|
+
pane.removeEventListener("mouseleave", this.onPaneLeave);
|
|
802
|
+
pane.removeEventListener("click", this.onPaneClick);
|
|
803
|
+
this.outside?.unsubscribe();
|
|
804
|
+
this.outside = null;
|
|
805
|
+
ref.dispose();
|
|
806
|
+
this.overlayRef = null;
|
|
807
|
+
this.level = null;
|
|
808
|
+
this.openState.set(false);
|
|
809
|
+
if (restoreFocus && focusWasInside) wrRestoreFocus(this.host.nativeElement, this.focusMonitor);
|
|
810
|
+
}
|
|
811
|
+
hideLater() {
|
|
812
|
+
this.hideTimer = setTimeout(() => this.close(), this.hideDelay());
|
|
813
|
+
}
|
|
814
|
+
clearTimers = () => {
|
|
815
|
+
if (this.showTimer !== null) clearTimeout(this.showTimer);
|
|
816
|
+
if (this.hideTimer !== null) clearTimeout(this.hideTimer);
|
|
817
|
+
this.showTimer = this.hideTimer = null;
|
|
818
|
+
};
|
|
819
|
+
onPaneLeave = (event) => {
|
|
820
|
+
const level = this.level;
|
|
821
|
+
const related = event.relatedTarget;
|
|
822
|
+
if (!level) return;
|
|
823
|
+
if (related instanceof Node && this.host.nativeElement.contains(related)) return;
|
|
824
|
+
if (wrDropdownLevelOf(level, related)) return;
|
|
825
|
+
this.clearTimers();
|
|
826
|
+
this.hideLater();
|
|
827
|
+
let root = level;
|
|
828
|
+
while (root.parent) root = root.parent;
|
|
829
|
+
root.pointerLeft?.(related);
|
|
830
|
+
};
|
|
831
|
+
onPaneClick = (event) => {
|
|
832
|
+
const item = event.target instanceof Element ? event.target.closest(".wr-dropdown-item") : null;
|
|
833
|
+
if (!item || item.matches(".wr-dropdown-item--disabled, .wr-dropdown-submenu-trigger")) return;
|
|
834
|
+
let top = this.level;
|
|
835
|
+
while (top?.parent?.parent) top = top.parent;
|
|
836
|
+
top?.close();
|
|
837
|
+
};
|
|
838
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
839
|
+
minVersion: "12.0.0",
|
|
840
|
+
version: "22.2.5",
|
|
841
|
+
ngImport: i0,
|
|
842
|
+
type: WrDropdownSubmenu,
|
|
843
|
+
deps: [],
|
|
844
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
845
|
+
});
|
|
846
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
847
|
+
minVersion: "17.1.0",
|
|
848
|
+
version: "22.2.5",
|
|
849
|
+
type: WrDropdownSubmenu,
|
|
850
|
+
isStandalone: true,
|
|
851
|
+
selector: "[wrDropdownSubmenu]",
|
|
852
|
+
inputs: {
|
|
853
|
+
menu: {
|
|
854
|
+
classPropertyName: "menu",
|
|
855
|
+
publicName: "wrDropdownSubmenu",
|
|
856
|
+
isSignal: true,
|
|
857
|
+
isRequired: true,
|
|
858
|
+
transformFunction: null
|
|
859
|
+
},
|
|
860
|
+
showDelay: {
|
|
861
|
+
classPropertyName: "showDelay",
|
|
862
|
+
publicName: "showDelay",
|
|
863
|
+
isSignal: true,
|
|
864
|
+
isRequired: false,
|
|
865
|
+
transformFunction: null
|
|
866
|
+
},
|
|
867
|
+
hideDelay: {
|
|
868
|
+
classPropertyName: "hideDelay",
|
|
869
|
+
publicName: "hideDelay",
|
|
870
|
+
isSignal: true,
|
|
871
|
+
isRequired: false,
|
|
872
|
+
transformFunction: null
|
|
873
|
+
}
|
|
874
|
+
},
|
|
875
|
+
host: {
|
|
876
|
+
attributes: { "aria-haspopup": "menu" },
|
|
877
|
+
listeners: {
|
|
878
|
+
"click": "onClick($event)",
|
|
879
|
+
"keydown": "onKeydown($event)",
|
|
880
|
+
"mouseenter": "onMouseEnter()",
|
|
881
|
+
"mouseleave": "onMouseLeave($event)"
|
|
882
|
+
},
|
|
883
|
+
properties: {
|
|
884
|
+
"attr.id": "itemId",
|
|
885
|
+
"attr.aria-expanded": "isOpen()",
|
|
886
|
+
"attr.aria-controls": "isOpen() ? menu().menuId() : null"
|
|
887
|
+
},
|
|
888
|
+
classAttribute: "wr-dropdown-submenu-trigger"
|
|
889
|
+
},
|
|
890
|
+
exportAs: ["wrDropdownSubmenu"],
|
|
891
|
+
ngImport: i0
|
|
892
|
+
});
|
|
893
|
+
};
|
|
894
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
895
|
+
minVersion: "12.0.0",
|
|
896
|
+
version: "22.2.5",
|
|
897
|
+
ngImport: i0,
|
|
898
|
+
type: WrDropdownSubmenu,
|
|
899
|
+
decorators: [{
|
|
900
|
+
type: Directive,
|
|
901
|
+
args: [{
|
|
902
|
+
selector: "[wrDropdownSubmenu]",
|
|
903
|
+
exportAs: "wrDropdownSubmenu",
|
|
904
|
+
host: {
|
|
905
|
+
class: "wr-dropdown-submenu-trigger",
|
|
906
|
+
"[attr.id]": "itemId",
|
|
907
|
+
"aria-haspopup": "menu",
|
|
908
|
+
"[attr.aria-expanded]": "isOpen()",
|
|
909
|
+
"[attr.aria-controls]": "isOpen() ? menu().menuId() : null",
|
|
910
|
+
"(click)": "onClick($event)",
|
|
911
|
+
"(keydown)": "onKeydown($event)",
|
|
912
|
+
"(mouseenter)": "onMouseEnter()",
|
|
913
|
+
"(mouseleave)": "onMouseLeave($event)"
|
|
914
|
+
}
|
|
915
|
+
}]
|
|
916
|
+
}],
|
|
917
|
+
ctorParameters: () => [],
|
|
918
|
+
propDecorators: {
|
|
919
|
+
menu: [{
|
|
920
|
+
type: i0.Input,
|
|
921
|
+
args: [{
|
|
922
|
+
isSignal: true,
|
|
923
|
+
alias: "wrDropdownSubmenu",
|
|
924
|
+
required: true
|
|
925
|
+
}]
|
|
926
|
+
}],
|
|
927
|
+
showDelay: [{
|
|
928
|
+
type: i0.Input,
|
|
929
|
+
args: [{
|
|
930
|
+
isSignal: true,
|
|
931
|
+
alias: "showDelay",
|
|
932
|
+
required: false
|
|
933
|
+
}]
|
|
934
|
+
}],
|
|
935
|
+
hideDelay: [{
|
|
936
|
+
type: i0.Input,
|
|
937
|
+
args: [{
|
|
938
|
+
isSignal: true,
|
|
939
|
+
alias: "hideDelay",
|
|
940
|
+
required: false
|
|
941
|
+
}]
|
|
942
|
+
}]
|
|
943
|
+
}
|
|
944
|
+
});
|
|
945
|
+
export { WrDropdown, WrDropdownItem, WrDropdownMenu, WrDropdownSubmenu };
|
|
610
946
|
|
|
611
947
|
//# sourceMappingURL=ngwr-dropdown.mjs.map
|