@theseam/ui-common 0.4.13 → 0.4.14
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/buttons/public-api.d.ts +1 -0
- package/buttons/testing/anchor-badge-button.harness.d.ts +16 -0
- package/buttons/testing/anchor-button.harness.d.ts +16 -0
- package/buttons/testing/badge-button.harness.d.ts +15 -0
- package/buttons/testing/base-badge-button.harness.d.ts +15 -0
- package/buttons/testing/base-button.harness.d.ts +19 -0
- package/buttons/testing/button.harness.d.ts +15 -0
- package/buttons/testing/index.d.ts +5 -0
- package/buttons/testing/toggle-button.harness.d.ts +21 -0
- package/checkbox/checkbox.component.d.ts +1 -1
- package/checkbox/checkbox.module.d.ts +2 -3
- package/datatable/datatable.module.d.ts +1 -1
- package/esm2020/buttons/button/button.component.mjs +2 -1
- package/esm2020/buttons/public-api.mjs +2 -1
- package/esm2020/buttons/testing/anchor-badge-button.harness.mjs +18 -0
- package/esm2020/buttons/testing/anchor-button.harness.mjs +18 -0
- package/esm2020/buttons/testing/badge-button.harness.mjs +14 -0
- package/esm2020/buttons/testing/base-badge-button.harness.mjs +29 -0
- package/esm2020/buttons/testing/base-button.harness.mjs +41 -0
- package/esm2020/buttons/testing/button.harness.mjs +16 -0
- package/esm2020/buttons/testing/index.mjs +6 -0
- package/esm2020/buttons/testing/toggle-button.harness.mjs +25 -0
- package/esm2020/checkbox/checkbox.component.mjs +8 -3
- package/esm2020/checkbox/checkbox.module.mjs +5 -12
- package/esm2020/datatable/datatable.module.mjs +5 -5
- package/esm2020/form-field/form-field.component.mjs +4 -4
- package/esm2020/framework/schema-form/index.mjs +2 -1
- package/esm2020/framework/schema-form/schema-form-framework.component.mjs +6 -3
- package/esm2020/framework/schema-form/schema-form-framework.mjs +62 -7
- package/esm2020/framework/schema-form/schema-form-widget.mjs +2 -0
- package/esm2020/framework/schema-form/schema-form.module.mjs +1 -8
- package/esm2020/framework/schema-form-controls/schema-form-checkbox/schema-form-checkbox.component.mjs +21 -11
- package/esm2020/framework/schema-form-controls/schema-form-divider/schema-form-divider.component.mjs +20 -0
- package/esm2020/framework/schema-form-controls/schema-form-input/schema-form-input.component.mjs +17 -8
- package/esm2020/framework/schema-form-controls/schema-form-number/schema-form-number.component.mjs +14 -5
- package/esm2020/framework/schema-form-controls/schema-form-select/schema-form-select.component.mjs +19 -9
- package/esm2020/framework/schema-form-controls/schema-form-submit/schema-form-submit.component.mjs +21 -13
- package/esm2020/framework/schema-form-controls/schema-form-submit-split/schema-form-submit-split.component.mjs +30 -18
- package/esm2020/framework/schema-form-controls/schema-form-tel/schema-form-tel.component.mjs +48 -0
- package/esm2020/framework/schema-form-controls/schema-form-tiled-select/schema-form-tiled-select.component.mjs +57 -0
- package/esm2020/google-maps/google-maps-places-autocomplete/google-maps-places-autocomplete.component.mjs +3 -3
- package/esm2020/menu/public-api.mjs +5 -1
- package/esm2020/menu/testing/menu-footer.harness.mjs +28 -0
- package/esm2020/menu/testing/menu-header.harness.mjs +23 -0
- package/esm2020/menu/testing/menu-item.harness.mjs +59 -0
- package/esm2020/menu/testing/menu.harness.mjs +163 -0
- package/esm2020/menu/testing/utils.mjs +13 -0
- package/esm2020/services/preferences/preferences-accessor.mjs +1 -1
- package/esm2020/services/preferences/preferences-manager.service.mjs +1 -1
- package/esm2020/services/preferences/preferences-record.mjs +1 -1
- package/esm2020/services/preferences/preferences.models.mjs +1 -1
- package/esm2020/story-helpers/args-to-tpl.mjs +83 -0
- package/esm2020/story-helpers/public-api.mjs +2 -2
- package/esm2020/story-helpers/story-preferences-accessor.service.mjs +1 -1
- package/esm2020/tel-input/public-api.mjs +2 -1
- package/esm2020/tel-input/tel-input/tel-input.component.mjs +22 -10
- package/esm2020/tel-input/tel-input.directive.mjs +12 -13
- package/esm2020/tel-input/tel-input.module.mjs +10 -9
- package/esm2020/tel-input/testing/tel-input.harness.mjs +49 -0
- package/esm2020/testing/harnesses/ng-select-dropdown.harness.mjs +39 -0
- package/esm2020/testing/harnesses/ng-select-option.harness.mjs +26 -0
- package/esm2020/testing/harnesses/ng-select.harness.mjs +104 -0
- package/esm2020/testing/public-api.mjs +4 -1
- package/esm2020/tiled-select/components/tiled-select/tiled-select.component.mjs +1 -1
- package/esm2020/utils/geo-json/coerce-feature-collection.mjs +1 -1
- package/esm2020/utils/geo-json/is-feature-collection.validator.mjs +1 -1
- package/esm2020/utils/geo-json/is-only-geometry-types.mjs +1 -1
- package/esm2020/utils/geo-json/merge-polygons.mjs +1 -1
- package/esm2020/utils/geo-json/no-inner-rings.validator.mjs +1 -1
- package/esm2020/utils/geo-json/split-multi-polygons.mjs +1 -1
- package/esm2020/widget/preferences/widget-preferences.models.mjs +1 -1
- package/esm2020/widget/preferences/widget-preferences.service.mjs +1 -1
- package/esm2020/widget/preferences/widget-preferences.token.mjs +1 -1
- package/esm2020/widget/widget.models.mjs +1 -1
- package/fesm2015/theseam-ui-common-buttons.mjs +181 -3
- package/fesm2015/theseam-ui-common-buttons.mjs.map +1 -1
- package/fesm2015/theseam-ui-common-checkbox.mjs +12 -14
- package/fesm2015/theseam-ui-common-checkbox.mjs.map +1 -1
- package/fesm2015/theseam-ui-common-datatable.mjs +4 -4
- package/fesm2015/theseam-ui-common-datatable.mjs.map +1 -1
- package/fesm2015/theseam-ui-common-form-field.mjs +3 -3
- package/fesm2015/theseam-ui-common-form-field.mjs.map +1 -1
- package/fesm2015/theseam-ui-common-framework.mjs +248 -164
- package/fesm2015/theseam-ui-common-framework.mjs.map +1 -1
- package/fesm2015/theseam-ui-common-google-maps.mjs +2 -2
- package/fesm2015/theseam-ui-common-google-maps.mjs.map +1 -1
- package/fesm2015/theseam-ui-common-menu.mjs +329 -3
- package/fesm2015/theseam-ui-common-menu.mjs.map +1 -1
- package/fesm2015/theseam-ui-common-services.mjs.map +1 -1
- package/fesm2015/theseam-ui-common-story-helpers.mjs +86 -1
- package/fesm2015/theseam-ui-common-story-helpers.mjs.map +1 -1
- package/fesm2015/theseam-ui-common-tel-input.mjs +105 -29
- package/fesm2015/theseam-ui-common-tel-input.mjs.map +1 -1
- package/fesm2015/theseam-ui-common-testing.mjs +197 -1
- package/fesm2015/theseam-ui-common-testing.mjs.map +1 -1
- package/fesm2015/theseam-ui-common-tiled-select.mjs.map +1 -1
- package/fesm2015/theseam-ui-common-utils.mjs.map +1 -1
- package/fesm2015/theseam-ui-common-widget.mjs.map +1 -1
- package/fesm2020/theseam-ui-common-buttons.mjs +154 -2
- package/fesm2020/theseam-ui-common-buttons.mjs.map +1 -1
- package/fesm2020/theseam-ui-common-checkbox.mjs +12 -14
- package/fesm2020/theseam-ui-common-checkbox.mjs.map +1 -1
- package/fesm2020/theseam-ui-common-datatable.mjs +4 -4
- package/fesm2020/theseam-ui-common-datatable.mjs.map +1 -1
- package/fesm2020/theseam-ui-common-form-field.mjs +3 -3
- package/fesm2020/theseam-ui-common-form-field.mjs.map +1 -1
- package/fesm2020/theseam-ui-common-framework.mjs +236 -162
- package/fesm2020/theseam-ui-common-framework.mjs.map +1 -1
- package/fesm2020/theseam-ui-common-google-maps.mjs +2 -2
- package/fesm2020/theseam-ui-common-google-maps.mjs.map +1 -1
- package/fesm2020/theseam-ui-common-menu.mjs +275 -2
- package/fesm2020/theseam-ui-common-menu.mjs.map +1 -1
- package/fesm2020/theseam-ui-common-services.mjs.map +1 -1
- package/fesm2020/theseam-ui-common-story-helpers.mjs +84 -1
- package/fesm2020/theseam-ui-common-story-helpers.mjs.map +1 -1
- package/fesm2020/theseam-ui-common-tel-input.mjs +89 -29
- package/fesm2020/theseam-ui-common-tel-input.mjs.map +1 -1
- package/fesm2020/theseam-ui-common-testing.mjs +165 -1
- package/fesm2020/theseam-ui-common-testing.mjs.map +1 -1
- package/fesm2020/theseam-ui-common-tiled-select.mjs.map +1 -1
- package/fesm2020/theseam-ui-common-utils.mjs.map +1 -1
- package/fesm2020/theseam-ui-common-widget.mjs.map +1 -1
- package/framework/schema-form/index.d.ts +1 -0
- package/framework/schema-form/schema-form-framework.d.ts +12 -1
- package/framework/schema-form/schema-form-widget.d.ts +61 -0
- package/framework/schema-form/schema-form.module.d.ts +1 -2
- package/framework/schema-form-controls/schema-form-checkbox/schema-form-checkbox.component.d.ts +12 -11
- package/framework/schema-form-controls/schema-form-divider/schema-form-divider.component.d.ts +12 -0
- package/framework/schema-form-controls/schema-form-input/schema-form-input.component.d.ts +10 -9
- package/framework/schema-form-controls/schema-form-number/schema-form-number.component.d.ts +8 -7
- package/framework/schema-form-controls/schema-form-select/schema-form-select.component.d.ts +10 -9
- package/framework/schema-form-controls/schema-form-submit/schema-form-submit.component.d.ts +10 -9
- package/framework/schema-form-controls/schema-form-submit-split/schema-form-submit-split.component.d.ts +10 -9
- package/framework/schema-form-controls/schema-form-tel/schema-form-tel.component.d.ts +23 -0
- package/framework/schema-form-controls/schema-form-tiled-select/schema-form-tiled-select.component.d.ts +32 -0
- package/menu/menu-footer-action/menu-footer-action.component.d.ts +1 -1
- package/menu/public-api.d.ts +4 -0
- package/menu/testing/menu-footer.harness.d.ts +22 -0
- package/menu/testing/menu-header.harness.d.ts +18 -0
- package/menu/testing/menu-item.harness.d.ts +37 -0
- package/menu/testing/menu.harness.d.ts +74 -0
- package/menu/testing/utils.d.ts +5 -0
- package/package.json +1 -1
- package/story-helpers/args-to-tpl.d.ts +25 -0
- package/story-helpers/public-api.d.ts +1 -0
- package/tel-input/public-api.d.ts +1 -0
- package/tel-input/tel-input/tel-input.component.d.ts +2 -2
- package/tel-input/tel-input.directive.d.ts +1 -1
- package/tel-input/tel-input.module.d.ts +7 -7
- package/tel-input/testing/tel-input.harness.d.ts +19 -0
- package/testing/harnesses/ng-select-dropdown.harness.d.ts +23 -0
- package/testing/harnesses/ng-select-option.harness.d.ts +18 -0
- package/testing/harnesses/ng-select.harness.d.ts +50 -0
- package/testing/public-api.d.ts +3 -0
- package/tiled-select/components/tiled-select/tiled-select.component.d.ts +10 -10
- package/esm2020/framework/schema-form-controls/schema-form-controls.module.mjs +0 -79
- package/framework/schema-form-controls/schema-form-controls.module.d.ts +0 -20
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { __awaiter, __decorate } from 'tslib';
|
|
2
|
+
import { ContentContainerComponentHarness, HarnessPredicate, TestKey } from '@angular/cdk/testing';
|
|
3
|
+
import { waitOnConditionAsync } from '@theseam/ui-common/utils';
|
|
4
|
+
import { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';
|
|
1
5
|
import { animation, style, group, animate, query, useAnimation, trigger, transition } from '@angular/animations';
|
|
2
6
|
import * as i0 from '@angular/core';
|
|
3
7
|
import { Component, ChangeDetectionStrategy, InjectionToken, Inject, Optional, Input, HostListener, forwardRef, EventEmitter, TemplateRef, ViewChild, Output, inject, ChangeDetectorRef, Directive, Self, HostBinding, NgModule } from '@angular/core';
|
|
@@ -10,16 +14,338 @@ import * as i1 from '@angular/cdk/a11y';
|
|
|
10
14
|
import { FocusKeyManager, isFakeMousedownFromScreenReader } from '@angular/cdk/a11y';
|
|
11
15
|
import * as i3 from '@theseam/ui-common/icon';
|
|
12
16
|
import { TheSeamIconModule } from '@theseam/ui-common/icon';
|
|
13
|
-
import { __decorate } from 'tslib';
|
|
14
17
|
import { UP_ARROW, DOWN_ARROW, END, hasModifierKey, HOME, RIGHT_ARROW, LEFT_ARROW, ESCAPE, ENTER, SPACE } from '@angular/cdk/keycodes';
|
|
15
18
|
import { normalizePassiveListenerOptions } from '@angular/cdk/platform';
|
|
16
19
|
import { TemplatePortal } from '@angular/cdk/portal';
|
|
17
|
-
import { coerceNumberProperty } from '@angular/cdk/coercion';
|
|
18
20
|
import { map, switchMap, startWith, distinctUntilChanged, takeUntil } from 'rxjs/operators';
|
|
19
21
|
import * as i1$1 from '@angular/cdk/overlay';
|
|
20
22
|
import { OverlayModule } from '@angular/cdk/overlay';
|
|
21
23
|
import * as i4 from '@angular/cdk/bidi';
|
|
22
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Workaround to wait on the animation to finish in browser, until a generic
|
|
27
|
+
* broswer-based solution is added, for Storybook interactions.
|
|
28
|
+
*/
|
|
29
|
+
function animatingWait() {
|
|
30
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
const selectAnimating = () => document.querySelectorAll('.seam-menu-container .ng-animating');
|
|
32
|
+
if (selectAnimating().length === 0) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
yield waitOnConditionAsync(() => selectAnimating().length === 0, 1000);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
class TheSeamMenuFooterHarness extends ContentContainerComponentHarness {
|
|
40
|
+
/**
|
|
41
|
+
* Gets a `HarnessPredicate` that can be used to search for a menu item with specific attributes.
|
|
42
|
+
* @param options Options for filtering which menu item instances are considered a match.
|
|
43
|
+
* @return a `HarnessPredicate` configured with the given options.
|
|
44
|
+
*/
|
|
45
|
+
static with(options = {}) {
|
|
46
|
+
return new HarnessPredicate(this, options)
|
|
47
|
+
.addOption('text', options.text, (harness, text) => HarnessPredicate.stringMatches(harness.getText(), text));
|
|
48
|
+
}
|
|
49
|
+
/** Gets the text of the menu item. */
|
|
50
|
+
getText() {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
return (yield this.host()).text();
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
/** Clicks the menu item. */
|
|
56
|
+
click() {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
return (yield this.host()).click().then(() => animatingWait());
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
/** Hovers the menu item. */
|
|
62
|
+
hover() {
|
|
63
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
return (yield this.host()).hover().then(() => animatingWait());
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/** The selector for the host element of a `MenuFooterComponent` instance. */
|
|
69
|
+
TheSeamMenuFooterHarness.hostSelector = 'seam-menu-footer';
|
|
70
|
+
|
|
71
|
+
class TheSeamMenuHeaderHarness extends ContentContainerComponentHarness {
|
|
72
|
+
/**
|
|
73
|
+
* Gets a `HarnessPredicate` that can be used to search for a menu item with specific attributes.
|
|
74
|
+
* @param options Options for filtering which menu item instances are considered a match.
|
|
75
|
+
* @return a `HarnessPredicate` configured with the given options.
|
|
76
|
+
*/
|
|
77
|
+
static with(options = {}) {
|
|
78
|
+
return new HarnessPredicate(this, options);
|
|
79
|
+
}
|
|
80
|
+
/** Clicks the menu item. */
|
|
81
|
+
click() {
|
|
82
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
83
|
+
return (yield this.host()).click().then(() => animatingWait());
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
/** Hovers the menu item. */
|
|
87
|
+
hover() {
|
|
88
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
89
|
+
return (yield this.host()).hover().then(() => animatingWait());
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/** The selector for the host element of a `MenuHeaderComponent` instance. */
|
|
94
|
+
TheSeamMenuHeaderHarness.hostSelector = 'seam-menu-header';
|
|
95
|
+
|
|
96
|
+
class TheSeamMenuHarness extends ContentContainerComponentHarness {
|
|
97
|
+
constructor() {
|
|
98
|
+
super(...arguments);
|
|
99
|
+
this._documentRootLocator = this.documentRootLocatorFactory();
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Gets a `HarnessPredicate` that can be used to search for a menu with specific attributes.
|
|
103
|
+
* @param options Options for filtering which menu instances are considered a match.
|
|
104
|
+
* @return a `HarnessPredicate` configured with the given options.
|
|
105
|
+
*/
|
|
106
|
+
static with(options = {}) {
|
|
107
|
+
return new HarnessPredicate(this, options).addOption('triggerText', options.triggerText, (harness, text) => HarnessPredicate.stringMatches(harness.getTriggerText(), text));
|
|
108
|
+
}
|
|
109
|
+
/** Whether the menu is disabled. */
|
|
110
|
+
isDisabled() {
|
|
111
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
112
|
+
const disabled = (yield this.host()).getAttribute('disabled');
|
|
113
|
+
return coerceBooleanProperty(yield disabled);
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
/** Whether the menu is open. */
|
|
117
|
+
isOpen() {
|
|
118
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
119
|
+
return !!(yield this._getMenuPanel());
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
/** Gets the text of the menu's trigger element. */
|
|
123
|
+
getTriggerText() {
|
|
124
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
125
|
+
return (yield this.host()).text();
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
/** Focuses the menu. */
|
|
129
|
+
focus() {
|
|
130
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
131
|
+
return (yield this.host()).focus().then(() => animatingWait());
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
/** Blurs the menu. */
|
|
135
|
+
blur() {
|
|
136
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
137
|
+
return (yield this.host()).blur().then(() => animatingWait());
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
/** Whether the menu is focused. */
|
|
141
|
+
isFocused() {
|
|
142
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
143
|
+
return (yield this.host()).isFocused();
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
/** Opens the menu. */
|
|
147
|
+
open() {
|
|
148
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
149
|
+
if (!(yield this.isOpen())) {
|
|
150
|
+
return (yield this.host()).click().then(() => animatingWait());
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
/** Closes the menu. */
|
|
155
|
+
close() {
|
|
156
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
157
|
+
const panel = yield this._getMenuPanel();
|
|
158
|
+
if (panel) {
|
|
159
|
+
return panel.sendKeys(TestKey.ESCAPE).then(() => animatingWait());
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Gets a list of `TheSeamMenuItemHarness` representing the items in the menu.
|
|
165
|
+
* @param filters Optionally filters which menu items are included.
|
|
166
|
+
*/
|
|
167
|
+
getItems(filters) {
|
|
168
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
169
|
+
const panelId = yield this._getPanelId();
|
|
170
|
+
if (panelId) {
|
|
171
|
+
return this._documentRootLocator.locatorForAll(TheSeamMenuItemHarness.with(Object.assign(Object.assign({}, (filters || {})), { ancestor: `#${panelId}` })))();
|
|
172
|
+
}
|
|
173
|
+
return [];
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Clicks an item in the menu, and optionally continues clicking items in subsequent sub-menus.
|
|
178
|
+
* @param itemFilter A filter used to represent which item in the menu should be clicked. The
|
|
179
|
+
* first matching menu item will be clicked.
|
|
180
|
+
* @param subItemFilters A list of filters representing the items to click in any subsequent
|
|
181
|
+
* sub-menus. The first item in the sub-menu matching the corresponding filter in
|
|
182
|
+
* `subItemFilters` will be clicked.
|
|
183
|
+
*/
|
|
184
|
+
clickItem(itemFilter, ...subItemFilters) {
|
|
185
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
186
|
+
yield this.open();
|
|
187
|
+
const items = yield this.getItems(itemFilter);
|
|
188
|
+
if (!items.length) {
|
|
189
|
+
throw Error(`Could not find item matching ${JSON.stringify(itemFilter)}`);
|
|
190
|
+
}
|
|
191
|
+
if (!subItemFilters.length) {
|
|
192
|
+
return items[0].click();
|
|
193
|
+
}
|
|
194
|
+
const menu = yield items[0].getSubmenu();
|
|
195
|
+
if (!menu) {
|
|
196
|
+
throw Error(`Item matching ${JSON.stringify(itemFilter)} does not have a submenu`);
|
|
197
|
+
}
|
|
198
|
+
return menu.clickItem(...subItemFilters);
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Hovers an item in the menu, and optionally continues hovering items in subsequent sub-menus.
|
|
203
|
+
* @param itemFilter A filter used to represent which item in the menu should be hovered. The
|
|
204
|
+
* first matching menu item will be hovered.
|
|
205
|
+
* @param subItemFilters A list of filters representing the items to hover in any subsequent
|
|
206
|
+
* sub-menus. The first item in the sub-menu matching the corresponding filter in
|
|
207
|
+
* `subItemFilters` will be hovered.
|
|
208
|
+
*/
|
|
209
|
+
hoverItem(itemFilter, ...subItemFilters) {
|
|
210
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
211
|
+
yield this.open();
|
|
212
|
+
const items = yield this.getItems(itemFilter);
|
|
213
|
+
if (!items.length) {
|
|
214
|
+
throw Error(`Could not find item matching ${JSON.stringify(itemFilter)}`);
|
|
215
|
+
}
|
|
216
|
+
if (!subItemFilters.length) {
|
|
217
|
+
return items[0].hover();
|
|
218
|
+
}
|
|
219
|
+
const menu = yield items[0].getSubmenu();
|
|
220
|
+
if (!menu) {
|
|
221
|
+
throw Error(`Item matching ${JSON.stringify(itemFilter)} does not have a submenu`);
|
|
222
|
+
}
|
|
223
|
+
return menu.hoverItem(...subItemFilters);
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Gets a `TheSeamMenuHeaderHarness` representing the header in the menu.
|
|
228
|
+
* @param filters Optionally filters which menu items are included.
|
|
229
|
+
*/
|
|
230
|
+
getHeader(filters) {
|
|
231
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
232
|
+
const panelId = yield this._getPanelId();
|
|
233
|
+
if (panelId) {
|
|
234
|
+
return this._documentRootLocator.locatorForOptional(TheSeamMenuHeaderHarness.with(Object.assign(Object.assign({}, (filters || {})), { ancestor: `#${panelId}` })))();
|
|
235
|
+
}
|
|
236
|
+
return null;
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Gets a `TheSeamMenuFooterHarness` representing the footer in the menu.
|
|
241
|
+
* @param filters Optionally filters which menu items are included.
|
|
242
|
+
*/
|
|
243
|
+
getFooter(filters) {
|
|
244
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
245
|
+
const panelId = yield this._getPanelId();
|
|
246
|
+
if (panelId) {
|
|
247
|
+
return this._documentRootLocator.locatorForOptional(TheSeamMenuFooterHarness.with(Object.assign(Object.assign({}, (filters || {})), { ancestor: `#${panelId}` })))();
|
|
248
|
+
}
|
|
249
|
+
return null;
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
getRootHarnessLoader() {
|
|
253
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
254
|
+
const panelId = yield this._getPanelId();
|
|
255
|
+
return this.documentRootLocatorFactory().harnessLoaderFor(`#${panelId}`);
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
/** Gets the menu panel associated with this menu. */
|
|
259
|
+
_getMenuPanel() {
|
|
260
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
261
|
+
const panelId = yield this._getPanelId();
|
|
262
|
+
return panelId ? this._documentRootLocator.locatorForOptional(`#${panelId}`)() : null;
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
/** Gets the id of the menu panel associated with this menu. */
|
|
266
|
+
_getPanelId() {
|
|
267
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
268
|
+
const panelId = yield (yield this.host()).getAttribute('aria-controls');
|
|
269
|
+
return panelId || null;
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
/** The selector for the host element of a `MenuComponent` instance. */
|
|
274
|
+
TheSeamMenuHarness.hostSelector = '.seam-menu-toggle';
|
|
275
|
+
|
|
276
|
+
class TheSeamMenuItemHarness extends ContentContainerComponentHarness {
|
|
277
|
+
/**
|
|
278
|
+
* Gets a `HarnessPredicate` that can be used to search for a menu item with specific attributes.
|
|
279
|
+
* @param options Options for filtering which menu item instances are considered a match.
|
|
280
|
+
* @return a `HarnessPredicate` configured with the given options.
|
|
281
|
+
*/
|
|
282
|
+
static with(options = {}) {
|
|
283
|
+
return new HarnessPredicate(this, options)
|
|
284
|
+
.addOption('text', options.text, (harness, text) => HarnessPredicate.stringMatches(harness.getText(), text))
|
|
285
|
+
.addOption('hasSubmenu', options.hasSubmenu, (harness, hasSubmenu) => __awaiter(this, void 0, void 0, function* () { return (yield harness.hasSubmenu()) === hasSubmenu; }));
|
|
286
|
+
}
|
|
287
|
+
/** Whether the menu is disabled. */
|
|
288
|
+
isDisabled() {
|
|
289
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
290
|
+
const disabled = (yield this.host()).getAttribute('disabled');
|
|
291
|
+
return coerceBooleanProperty(yield disabled);
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
/** Gets the text of the menu item. */
|
|
295
|
+
getText() {
|
|
296
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
297
|
+
return (yield this.host()).text();
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
/** Focuses the menu item. */
|
|
301
|
+
focus() {
|
|
302
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
303
|
+
return (yield this.host()).focus().then(() => animatingWait());
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
/** Blurs the menu item. */
|
|
307
|
+
blur() {
|
|
308
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
309
|
+
return (yield this.host()).blur().then(() => animatingWait());
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
/** Whether the menu item is focused. */
|
|
313
|
+
isFocused() {
|
|
314
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
315
|
+
return (yield this.host()).isFocused();
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
/** Clicks the menu item. */
|
|
319
|
+
click() {
|
|
320
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
321
|
+
return (yield this.host()).click().then(() => animatingWait());
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
/** Hovers the menu item. */
|
|
325
|
+
hover() {
|
|
326
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
327
|
+
return (yield this.host()).hover().then(() => animatingWait());
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
/** Whether this item has a submenu. */
|
|
331
|
+
hasSubmenu() {
|
|
332
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
333
|
+
return (yield this.host()).matchesSelector(TheSeamMenuHarness.hostSelector);
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
/** Gets the submenu associated with this menu item, or null if none. */
|
|
337
|
+
getSubmenu() {
|
|
338
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
339
|
+
if (yield this.hasSubmenu()) {
|
|
340
|
+
return new TheSeamMenuHarness(this.locatorFactory);
|
|
341
|
+
}
|
|
342
|
+
return null;
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
/** The selector for the host element of a `MenuItemComponent` instance. */
|
|
347
|
+
TheSeamMenuItemHarness.hostSelector = '.seam-menu-item';
|
|
348
|
+
|
|
23
349
|
const menuDropdownPanelSlideIn = animation([
|
|
24
350
|
style({
|
|
25
351
|
opacity: 0,
|
|
@@ -1026,5 +1352,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
|
|
|
1026
1352
|
* Generated bundle index. Do not edit.
|
|
1027
1353
|
*/
|
|
1028
1354
|
|
|
1029
|
-
export { LIB_MENU, MenuComponent, MenuDividerComponent, MenuFooterActionComponent, MenuFooterComponent, MenuHeaderComponent, MenuItemComponent, MenuToggleDirective, THESEAM_MENU_PANEL, TheSeamMenuModule, menuDropdownPanelExpandIn, menuDropdownPanelExpandOut, menuDropdownPanelFadeIn, menuDropdownPanelFadeOut, menuDropdownPanelIn, menuDropdownPanelOut, menuDropdownPanelSlideIn, menuDropdownPanelSlideOut };
|
|
1355
|
+
export { LIB_MENU, MenuComponent, MenuDividerComponent, MenuFooterActionComponent, MenuFooterComponent, MenuHeaderComponent, MenuItemComponent, MenuToggleDirective, THESEAM_MENU_PANEL, TheSeamMenuFooterHarness, TheSeamMenuHarness, TheSeamMenuHeaderHarness, TheSeamMenuItemHarness, TheSeamMenuModule, menuDropdownPanelExpandIn, menuDropdownPanelExpandOut, menuDropdownPanelFadeIn, menuDropdownPanelFadeOut, menuDropdownPanelIn, menuDropdownPanelOut, menuDropdownPanelSlideIn, menuDropdownPanelSlideOut };
|
|
1030
1356
|
//# sourceMappingURL=theseam-ui-common-menu.mjs.map
|