@sapudex/web-components 0.230.1 → 0.230.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/MastheadCountrySelector.d.ts +9 -0
- package/dist/MastheadCountrySelector.js +34 -4
- package/dist/MastheadCountrySelector.js.map +1 -1
- package/dist/MastheadItem.d.ts +30 -1
- package/dist/MastheadItem.js +58 -12
- package/dist/MastheadItem.js.map +1 -1
- package/dist/MastheadMenu.d.ts +3 -0
- package/dist/MastheadMenu.js +9 -0
- package/dist/MastheadMenu.js.map +1 -1
- package/dist/MastheadMenuItem.d.ts +1 -1
- package/dist/MastheadMenuItem.js +1 -1
- package/dist/MastheadMenuItem.js.map +1 -1
- package/dist/MastheadMobileMenu.d.ts +4 -0
- package/dist/MastheadMobileMenu.js +25 -2
- package/dist/MastheadMobileMenu.js.map +1 -1
- package/dist/MastheadProfileMenu.d.ts +4 -4
- package/dist/MastheadProfileMenu.js +22 -0
- package/dist/MastheadProfileMenu.js.map +1 -1
- package/dist/MastheadShell.d.ts +18 -0
- package/dist/MastheadShell.js +32 -17
- package/dist/MastheadShell.js.map +1 -1
- package/dist/MediaPlayer.d.ts +310 -173
- package/dist/MediaPlayer.js +0 -1
- package/dist/MediaPlayer.js.map +1 -1
- package/dist/SecondaryNavigation.d.ts +10 -0
- package/dist/SecondaryNavigation.js +40 -0
- package/dist/SecondaryNavigation.js.map +1 -1
- package/dist/assets/{bundle.esm-9c2eba44.js → bundle.esm-6dbe4d40.js} +197 -197
- package/dist/assets/messagebundle_en-d0c2d2d4.js +1 -0
- package/dist/css/themes/MastheadItem.css +1 -1
- package/dist/css/themes/Modal.css +1 -1
- package/dist/css/themes/RatingIndicator.css +1 -1
- package/dist/css/themes/Slider.css +1 -1
- package/dist/css/themes/TabInOverflow.css +1 -1
- package/dist/custom-elements-internal.json +52 -3
- package/dist/custom-elements.json +49 -3
- package/dist/generated/assets/i18n/messagebundle_en.json +1 -1
- package/dist/generated/i18n/i18n-defaults.d.ts +2 -1
- package/dist/generated/i18n/i18n-defaults.js +2 -1
- package/dist/generated/i18n/i18n-defaults.js.map +1 -1
- package/dist/generated/templates/MastheadItemTemplate.lit.js +6 -6
- package/dist/generated/templates/MastheadItemTemplate.lit.js.map +1 -1
- package/dist/generated/templates/MastheadMenuItemTemplate.lit.js +1 -1
- package/dist/generated/templates/MastheadMenuItemTemplate.lit.js.map +1 -1
- package/dist/generated/templates/MastheadMobileMenuTemplate.lit.js +8 -8
- package/dist/generated/templates/MastheadMobileMenuTemplate.lit.js.map +1 -1
- package/dist/generated/templates/SecondaryNavigationTemplate.lit.js +1 -1
- package/dist/generated/templates/SecondaryNavigationTemplate.lit.js.map +1 -1
- package/dist/generated/themes/MastheadItem.css.js +1 -1
- package/dist/generated/themes/MastheadItem.css.js.map +1 -1
- package/dist/generated/themes/Modal.css.js +1 -1
- package/dist/generated/themes/Modal.css.js.map +1 -1
- package/dist/generated/themes/RatingIndicator.css.js +1 -1
- package/dist/generated/themes/RatingIndicator.css.js.map +1 -1
- package/dist/generated/themes/Slider.css.js +1 -1
- package/dist/generated/themes/Slider.css.js.map +1 -1
- package/dist/generated/themes/TabInOverflow.css.js +1 -1
- package/dist/generated/themes/TabInOverflow.css.js.map +1 -1
- package/dist/i18n/messagebundle.properties +3 -0
- package/dist/i18n/messagebundle_en.properties +1 -0
- package/dist/types/AnalyticsName.d.ts +5 -0
- package/dist/types/AnalyticsName.js +7 -0
- package/dist/types/AnalyticsName.js.map +1 -0
- package/dist/vscode.html-custom-data.json +6 -1
- package/dist/web-types.json +20 -2
- package/package.json +1 -1
- package/src/MastheadCountrySelector.ts +42 -5
- package/src/MastheadItem.hbs +23 -15
- package/src/MastheadItem.ts +79 -18
- package/src/MastheadMenu.ts +11 -1
- package/src/MastheadMenuItem.hbs +1 -1
- package/src/MastheadMenuItem.ts +2 -2
- package/src/MastheadMobileMenu.hbs +8 -8
- package/src/MastheadMobileMenu.ts +29 -3
- package/src/MastheadProfileMenu.ts +29 -8
- package/src/MastheadShell.ts +34 -17
- package/src/MediaPlayer.ts +0 -1
- package/src/SecondaryNavigation.hbs +6 -1
- package/src/SecondaryNavigation.ts +51 -0
- package/src/generated/i18n/i18n-defaults.ts +2 -2
- package/src/generated/templates/MastheadItemTemplate.lit.ts +6 -6
- package/src/generated/templates/MastheadMenuItemTemplate.lit.ts +1 -1
- package/src/generated/templates/MastheadMobileMenuTemplate.lit.ts +8 -8
- package/src/generated/templates/SecondaryNavigationTemplate.lit.ts +1 -1
- package/src/generated/themes/MastheadItem.css.ts +1 -1
- package/src/generated/themes/Modal.css.ts +1 -1
- package/src/generated/themes/RatingIndicator.css.ts +1 -1
- package/src/generated/themes/Slider.css.ts +1 -1
- package/src/generated/themes/TabInOverflow.css.ts +1 -1
- package/src/i18n/messagebundle.properties +3 -0
- package/src/i18n/messagebundle_en.properties +1 -0
- package/src/themes/MastheadItem.css +15 -0
- package/src/themes/Modal.css +2 -2
- package/src/themes/TabInOverflow.css +1 -1
- package/src/types/AnalyticsName.ts +6 -0
- package/dist/assets/messagebundle_en-f0b5e0d9.js +0 -1
- package/dist/assets/play-a1304ca2.svg +0 -3
package/src/MastheadItem.ts
CHANGED
|
@@ -11,15 +11,17 @@ import litRender from "@ui5/webcomponents-base/dist/renderer/LitRenderer.js";
|
|
|
11
11
|
import { isEscape } from "@ui5/webcomponents-base/dist/Keys.js";
|
|
12
12
|
import { isDesktop } from "@ui5/webcomponents-base/dist/Device.js";
|
|
13
13
|
import {
|
|
14
|
-
OPENS_IN_A_NEW_WINDOW, PROFILE, CART, COUNTRY_SELECTOR, SUPPORT,
|
|
14
|
+
OPENS_IN_A_NEW_WINDOW, PROFILE, CART, COUNTRY_SELECTOR, SUPPORT, SEARCH,
|
|
15
15
|
} from "./generated/i18n/i18n-defaults.js";
|
|
16
16
|
import UDExMastheadMenu from "./MastheadMenu.js";
|
|
17
17
|
import UDExAvatar from "./Avatar.js";
|
|
18
18
|
import "@ui5/webcomponents-icons/dist/slim-arrow-down.js";
|
|
19
19
|
import UDExMastheadShell from "./MastheadShell.js";
|
|
20
|
-
import MastheadItemTemplate from "./generated/templates/MastheadItemTemplate.lit.js";
|
|
21
20
|
import { Target } from "./types/common.js";
|
|
22
21
|
import { BreakpointUtils } from "./utils/Breakpoints.js";
|
|
22
|
+
import AnalyticsName from "./types/AnalyticsName.js";
|
|
23
|
+
import MastheadItemTemplate from "./generated/templates/MastheadItemTemplate.lit.js";
|
|
24
|
+
|
|
23
25
|
// Styles
|
|
24
26
|
import MastheadItemCss from "./generated/themes/MastheadItem.css.js";
|
|
25
27
|
|
|
@@ -56,11 +58,14 @@ export type MenuItem = {
|
|
|
56
58
|
export type ItemClickEventDetail = {
|
|
57
59
|
originalEvent: Event,
|
|
58
60
|
item: UDExMastheadItem,
|
|
61
|
+
analyticsName: AnalyticsName,
|
|
62
|
+
sourceNode: HTMLElement,
|
|
59
63
|
}
|
|
60
64
|
|
|
61
65
|
export type DropdownEventDetail = {
|
|
62
66
|
title: string,
|
|
63
67
|
action: DropdownItemAction,
|
|
68
|
+
analyticsName: AnalyticsName,
|
|
64
69
|
}
|
|
65
70
|
|
|
66
71
|
export const DropdownBaseEventDetail = {
|
|
@@ -78,6 +83,12 @@ export const ItemBaseEvent = {
|
|
|
78
83
|
originalEvent: {
|
|
79
84
|
type: Event,
|
|
80
85
|
},
|
|
86
|
+
analyticsName: {
|
|
87
|
+
type: AnalyticsName,
|
|
88
|
+
},
|
|
89
|
+
sourceNode: {
|
|
90
|
+
type: HTMLElement,
|
|
91
|
+
},
|
|
81
92
|
},
|
|
82
93
|
};
|
|
83
94
|
|
|
@@ -98,6 +109,7 @@ export const ItemBaseEvent = {
|
|
|
98
109
|
* @extends UI5Element
|
|
99
110
|
* @public
|
|
100
111
|
*/
|
|
112
|
+
|
|
101
113
|
@customElement({
|
|
102
114
|
tag: "udex-masthead-item",
|
|
103
115
|
renderer: litRender,
|
|
@@ -266,6 +278,14 @@ class UDExMastheadItem extends UI5Element implements IMastheadItem {
|
|
|
266
278
|
@property({ type: Boolean })
|
|
267
279
|
_isMobileMode!: boolean;
|
|
268
280
|
|
|
281
|
+
/**
|
|
282
|
+
* Defines the label for analytics
|
|
283
|
+
*
|
|
284
|
+
* @public
|
|
285
|
+
*/
|
|
286
|
+
@property({ type: String })
|
|
287
|
+
label!: string;
|
|
288
|
+
|
|
269
289
|
/**
|
|
270
290
|
* Slot for the dropdown
|
|
271
291
|
*
|
|
@@ -284,9 +304,11 @@ class UDExMastheadItem extends UI5Element implements IMastheadItem {
|
|
|
284
304
|
@slot({ type: HTMLElement, "default": true })
|
|
285
305
|
content?: Array<HTMLElement>;
|
|
286
306
|
|
|
307
|
+
@property({ type: Boolean })
|
|
308
|
+
_preventFocusOut!: boolean;
|
|
309
|
+
|
|
287
310
|
_profileAvatar!: UDExAvatar;
|
|
288
311
|
_mastheadShell!: UDExMastheadShell;
|
|
289
|
-
_isEscPress!: boolean;
|
|
290
312
|
|
|
291
313
|
static i18nBundle: I18nBundle;
|
|
292
314
|
|
|
@@ -300,6 +322,10 @@ class UDExMastheadItem extends UI5Element implements IMastheadItem {
|
|
|
300
322
|
}
|
|
301
323
|
}
|
|
302
324
|
|
|
325
|
+
onBeforeRendering(): void {
|
|
326
|
+
this.label = this.eventItemTitle;
|
|
327
|
+
}
|
|
328
|
+
|
|
303
329
|
onAfterRendering(): void {
|
|
304
330
|
this._profileAvatar = this.profileAvatar;
|
|
305
331
|
this._mastheadShell = this.mastheadShell;
|
|
@@ -309,14 +335,13 @@ class UDExMastheadItem extends UI5Element implements IMastheadItem {
|
|
|
309
335
|
}
|
|
310
336
|
|
|
311
337
|
this.handleOutsideClick();
|
|
312
|
-
this._isEscPress = false;
|
|
313
338
|
}
|
|
314
339
|
|
|
315
340
|
handleOutsideClick(): void {
|
|
316
341
|
document.addEventListener("click", (e: Event) => {
|
|
317
342
|
const target = e.target as HTMLElement;
|
|
318
343
|
const item = target.closest("[udex-masthead-item]");
|
|
319
|
-
if (item !== this && !this.isMobile) {
|
|
344
|
+
if (item !== this && !this.isMobile && this.selected) {
|
|
320
345
|
if (this.isDropdownOpened) {
|
|
321
346
|
this.fireDropdownCloseEvent(this.eventItemTitle, DropdownItemAction.ClickOutside);
|
|
322
347
|
}
|
|
@@ -326,13 +351,27 @@ class UDExMastheadItem extends UI5Element implements IMastheadItem {
|
|
|
326
351
|
});
|
|
327
352
|
}
|
|
328
353
|
|
|
354
|
+
handleMouseDown(): void {
|
|
355
|
+
this._preventFocusOut = true;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
handleMouseUp(): void {
|
|
359
|
+
this._preventFocusOut = false;
|
|
360
|
+
}
|
|
361
|
+
|
|
329
362
|
handleFocusout(e: FocusEvent): void {
|
|
330
|
-
if (
|
|
363
|
+
if (this.isFocusOutPrevented(e)) {
|
|
331
364
|
return;
|
|
332
365
|
}
|
|
333
366
|
|
|
334
|
-
|
|
335
|
-
|
|
367
|
+
this.handleFocusOutForDropdowns(e);
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
handleFocusOutForDropdowns(e: FocusEvent): void {
|
|
371
|
+
const relatedTarget = e.relatedTarget as HTMLElement;
|
|
372
|
+
const target = e.target as HTMLElement;
|
|
373
|
+
|
|
374
|
+
if (this.shouldCloseDropdown(relatedTarget, target)) {
|
|
336
375
|
this.closeDropdown();
|
|
337
376
|
}
|
|
338
377
|
}
|
|
@@ -348,7 +387,6 @@ class UDExMastheadItem extends UI5Element implements IMastheadItem {
|
|
|
348
387
|
}
|
|
349
388
|
|
|
350
389
|
handleKeyEscape(): void {
|
|
351
|
-
this._isEscPress = true;
|
|
352
390
|
this.closeDropdown();
|
|
353
391
|
if (this.isProfileBtn) {
|
|
354
392
|
this._profileAvatar.focus();
|
|
@@ -386,17 +424,19 @@ class UDExMastheadItem extends UI5Element implements IMastheadItem {
|
|
|
386
424
|
}
|
|
387
425
|
|
|
388
426
|
fireDropdownCloseEvent(title: string, action: DropdownItemAction): void {
|
|
389
|
-
this.fireEvent<DropdownEventDetail>("dropdown-closed", { title, action });
|
|
427
|
+
this.fireEvent<DropdownEventDetail>("dropdown-closed", { title, action, analyticsName: AnalyticsName.Header });
|
|
390
428
|
}
|
|
391
429
|
|
|
392
430
|
fireDropdownOpenEvent(title: string, action: DropdownItemAction): void {
|
|
393
|
-
this.fireEvent<DropdownEventDetail>("dropdown-opened", { title, action });
|
|
431
|
+
this.fireEvent<DropdownEventDetail>("dropdown-opened", { title, action, analyticsName: AnalyticsName.Header });
|
|
394
432
|
}
|
|
395
433
|
|
|
396
434
|
fireItemClickEvent(e: Event): void {
|
|
397
435
|
this.fireEvent<ItemClickEventDetail>("item-click", {
|
|
398
436
|
item: this,
|
|
399
437
|
originalEvent: e,
|
|
438
|
+
analyticsName: AnalyticsName.Header,
|
|
439
|
+
sourceNode: e.currentTarget as HTMLElement,
|
|
400
440
|
});
|
|
401
441
|
}
|
|
402
442
|
|
|
@@ -462,6 +502,28 @@ class UDExMastheadItem extends UI5Element implements IMastheadItem {
|
|
|
462
502
|
return this.parseArrayFromString(this.subItems);
|
|
463
503
|
}
|
|
464
504
|
|
|
505
|
+
private isFocusOutPrevented(e: FocusEvent): boolean {
|
|
506
|
+
return this.isMobile || e.relatedTarget === null || this._preventFocusOut;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
private isProfileButtonTarget(relatedTarget: HTMLElement | null): boolean {
|
|
510
|
+
return (relatedTarget?.tagName === "UDEX-AVATAR" || relatedTarget?.tagName === "UDEX-MASTHEAD-ITEM") && this.isProfileBtn;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
private isNavItemTarget(target: HTMLElement): boolean {
|
|
514
|
+
return target.getAttribute("slot") === "dropdown" && !this.isProfileBtn;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
private isRelatedTargetOutside(relatedTarget: HTMLElement | null): boolean {
|
|
518
|
+
return relatedTarget?.closest("[udex-masthead-item]") === null;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
private shouldCloseDropdown(relatedTarget: HTMLElement, target:HTMLElement): boolean {
|
|
522
|
+
return this.isRelatedTargetOutside(relatedTarget)
|
|
523
|
+
|| this.isProfileButtonTarget(relatedTarget)
|
|
524
|
+
|| this.isNavItemTarget(target);
|
|
525
|
+
}
|
|
526
|
+
|
|
465
527
|
get mastheadShell(): UDExMastheadShell {
|
|
466
528
|
return document.querySelector<UDExMastheadShell>("[udex-masthead-shell]")!;
|
|
467
529
|
}
|
|
@@ -541,6 +603,10 @@ class UDExMastheadItem extends UI5Element implements IMastheadItem {
|
|
|
541
603
|
return this.getAttribute("slot") === "cart";
|
|
542
604
|
}
|
|
543
605
|
|
|
606
|
+
get isSearchBtn(): boolean {
|
|
607
|
+
return this.icon === "search";
|
|
608
|
+
}
|
|
609
|
+
|
|
544
610
|
get isSupportBtn(): boolean {
|
|
545
611
|
return this.getAttribute("slot") === "support";
|
|
546
612
|
}
|
|
@@ -560,24 +626,19 @@ class UDExMastheadItem extends UI5Element implements IMastheadItem {
|
|
|
560
626
|
get openInNewWindowText(): string {
|
|
561
627
|
return UDExMastheadItem.i18nBundle.getText(OPENS_IN_A_NEW_WINDOW);
|
|
562
628
|
}
|
|
563
|
-
|
|
564
629
|
get eventItemTitle(): string {
|
|
565
|
-
if (this.
|
|
566
|
-
return
|
|
630
|
+
if (this.isSearchBtn) {
|
|
631
|
+
return UDExMastheadItem.i18nBundle.getText(SEARCH);
|
|
567
632
|
}
|
|
568
|
-
|
|
569
633
|
if (this.isCartBtn) {
|
|
570
634
|
return UDExMastheadItem.i18nBundle.getText(CART);
|
|
571
635
|
}
|
|
572
|
-
|
|
573
636
|
if (this.isProfileBtn) {
|
|
574
637
|
return UDExMastheadItem.i18nBundle.getText(PROFILE);
|
|
575
638
|
}
|
|
576
|
-
|
|
577
639
|
if (this.isCountrySelectorBtn) {
|
|
578
640
|
return UDExMastheadItem.i18nBundle.getText(COUNTRY_SELECTOR);
|
|
579
641
|
}
|
|
580
|
-
|
|
581
642
|
if (this.isSupportBtn) {
|
|
582
643
|
return UDExMastheadItem.i18nBundle.getText(SUPPORT);
|
|
583
644
|
}
|
package/src/MastheadMenu.ts
CHANGED
|
@@ -11,6 +11,7 @@ import UDExBadge from "./Badge.js";
|
|
|
11
11
|
import UDExMastheadMenuItem, { ItemType } from "./MastheadMenuItem.js";
|
|
12
12
|
import UDExDivider from "./Divider.js";
|
|
13
13
|
import MastheadMenuTemplate from "./generated/templates/MastheadMenuTemplate.lit.js";
|
|
14
|
+
import AnalyticsName from "./types/AnalyticsName.js";
|
|
14
15
|
|
|
15
16
|
// Styles
|
|
16
17
|
import MastheadMenuCss from "./generated/themes/MastheadMenu.css.js";
|
|
@@ -38,6 +39,8 @@ export type MenuItemClickEventDetail = {
|
|
|
38
39
|
category?: string,
|
|
39
40
|
originalEvent: Event,
|
|
40
41
|
item: UDExMastheadMenuItem,
|
|
42
|
+
analyticsName: AnalyticsName,
|
|
43
|
+
sourceNode: HTMLElement,
|
|
41
44
|
}
|
|
42
45
|
|
|
43
46
|
/**
|
|
@@ -82,6 +85,12 @@ export type MenuItemClickEventDetail = {
|
|
|
82
85
|
originalEvent: {
|
|
83
86
|
type: Event,
|
|
84
87
|
},
|
|
88
|
+
analyticsName: {
|
|
89
|
+
type: AnalyticsName,
|
|
90
|
+
},
|
|
91
|
+
sourceNode: {
|
|
92
|
+
type: HTMLElement,
|
|
93
|
+
},
|
|
85
94
|
},
|
|
86
95
|
})
|
|
87
96
|
|
|
@@ -136,10 +145,11 @@ class UDExMastheadMenu extends UI5Element {
|
|
|
136
145
|
handleMenuItemClick(e: Event): void {
|
|
137
146
|
const item = e.target as UDExMastheadMenuItem;
|
|
138
147
|
const { url, type } = item;
|
|
139
|
-
|
|
140
148
|
if (url?.length) {
|
|
141
149
|
const list = item.closest(".udex-masthead-menu__list") as HTMLElement;
|
|
142
150
|
this.fireEvent<MenuItemClickEventDetail>("menu-item-click", {
|
|
151
|
+
sourceNode: item.shadowRoot?.querySelector(".udex-masthead-menu-item") as HTMLElement,
|
|
152
|
+
analyticsName: AnalyticsName.Header,
|
|
143
153
|
item,
|
|
144
154
|
originalEvent: e,
|
|
145
155
|
...(type !== ItemType.Heading && { category: list?.getAttribute("category") || "" }),
|
package/src/MastheadMenuItem.hbs
CHANGED
package/src/MastheadMenuItem.ts
CHANGED
|
@@ -226,8 +226,8 @@ class UDExMastheadMenuItem extends UI5Element {
|
|
|
226
226
|
return this.externalLink ? "new-win-desc" : null;
|
|
227
227
|
}
|
|
228
228
|
|
|
229
|
-
get accessibleRoleText(): string
|
|
230
|
-
return this.accessibleRole ? this.accessibleRole :
|
|
229
|
+
get accessibleRoleText(): string {
|
|
230
|
+
return this.accessibleRole ? this.accessibleRole : "menuitem";
|
|
231
231
|
}
|
|
232
232
|
|
|
233
233
|
get partAttr(): string {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
{{>nav-items}}
|
|
11
11
|
{{/if}}
|
|
12
12
|
{{#if _showCategories}}
|
|
13
|
-
<li class="udex-masthead-mobile-menu__list-item" role="
|
|
13
|
+
<li class="udex-masthead-mobile-menu__list-item" role="none">
|
|
14
14
|
{{#if _hideExploreSapBtn}}
|
|
15
15
|
<udex-masthead-menu-item
|
|
16
16
|
class="udex-masthead-mobile-menu__back-item"
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
{{>categories}}
|
|
46
46
|
{{/if}}
|
|
47
47
|
{{#if _showCategoryItems}}
|
|
48
|
-
<li class="udex-masthead-mobile-menu__list-item" role="
|
|
48
|
+
<li class="udex-masthead-mobile-menu__list-item" role="none">
|
|
49
49
|
<udex-masthead-menu-item
|
|
50
50
|
class="udex-masthead-mobile-menu__back-item"
|
|
51
51
|
@click="{{handleBackToCategories}}"
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
|
|
79
79
|
{{#*inline "nav-items"}}
|
|
80
80
|
{{#each items}}
|
|
81
|
-
<li class="udex-masthead-mobile-menu__list-item" role="
|
|
81
|
+
<li class="udex-masthead-mobile-menu__list-item" role="none">
|
|
82
82
|
{{#if this.subItems}}
|
|
83
83
|
<udex-masthead-menu-item
|
|
84
84
|
@click="{{../handleMenuItemClick}}"
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
|
|
106
106
|
{{#*inline "categories"}}
|
|
107
107
|
{{#if _clickedItem.href}}
|
|
108
|
-
<li class="udex-masthead-mobile-menu__list-item" role="
|
|
108
|
+
<li class="udex-masthead-mobile-menu__list-item" role="none">
|
|
109
109
|
<udex-masthead-menu-item
|
|
110
110
|
url="{{_clickedItem.href}}"
|
|
111
111
|
label="{{overviewLinkText}}"
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
{{/if}}
|
|
117
117
|
{{#each _categories}}
|
|
118
118
|
{{#if this.category}}
|
|
119
|
-
<li class="udex-masthead-mobile-menu__list-item" role="
|
|
119
|
+
<li class="udex-masthead-mobile-menu__list-item" role="none">
|
|
120
120
|
<udex-masthead-menu-item
|
|
121
121
|
@click="{{../handleMenuCategoryClick}}"
|
|
122
122
|
url="{{this.url}}"
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
</li>
|
|
132
132
|
{{else}}
|
|
133
133
|
{{#each this.items}}
|
|
134
|
-
<li class="udex-masthead-mobile-menu__list-item" role="
|
|
134
|
+
<li class="udex-masthead-mobile-menu__list-item" role="none">
|
|
135
135
|
<udex-masthead-menu-item
|
|
136
136
|
@click="{{../handleMobileItemEvent}}"
|
|
137
137
|
url="{{this.url}}"
|
|
@@ -146,7 +146,7 @@
|
|
|
146
146
|
|
|
147
147
|
{{#*inline "category-items"}}
|
|
148
148
|
{{#if _category.url}}
|
|
149
|
-
<li class="udex-masthead-mobile-menu__list-item" role="
|
|
149
|
+
<li class="udex-masthead-mobile-menu__list-item" role="none">
|
|
150
150
|
<udex-masthead-menu-item
|
|
151
151
|
@click="{{../handleMobileCategoryItemEvent}}"
|
|
152
152
|
url="{{this._category.url}}"
|
|
@@ -157,7 +157,7 @@
|
|
|
157
157
|
{{/if}}
|
|
158
158
|
{{#each _category.items}}
|
|
159
159
|
{{#if this.url}}
|
|
160
|
-
<li class="udex-masthead-mobile-menu__list-item" role="
|
|
160
|
+
<li class="udex-masthead-mobile-menu__list-item" role="none">
|
|
161
161
|
<udex-masthead-menu-item
|
|
162
162
|
@click="{{../handleMobileCategoryItemEvent}}"
|
|
163
163
|
label="{{this.title}}"
|
|
@@ -12,8 +12,8 @@ import {
|
|
|
12
12
|
import UDExMastheadItem, { MenuItem, SubMenuLinkItem } from "./MastheadItem.js";
|
|
13
13
|
import UDExMastheadMenuItem, { ItemType } from "./MastheadMenuItem.js";
|
|
14
14
|
import { OVERVIEW } from "./generated/i18n/i18n-defaults.js";
|
|
15
|
-
|
|
16
15
|
import MastheadMobileMenuTemplate from "./generated/templates/MastheadMobileMenuTemplate.lit.js";
|
|
16
|
+
import AnalyticsName from "./types/AnalyticsName.js";
|
|
17
17
|
|
|
18
18
|
// Styles
|
|
19
19
|
import MastheadMobileMenuCss from "./generated/themes/MastheadMobileMenu.css.js";
|
|
@@ -23,6 +23,8 @@ export type MobileItemClickEventDetail = {
|
|
|
23
23
|
isMobile: boolean,
|
|
24
24
|
originalEvent: Event,
|
|
25
25
|
item: UDExMastheadMenuItem,
|
|
26
|
+
analyticsName: AnalyticsName,
|
|
27
|
+
sourceNode: HTMLElement,
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
/**
|
|
@@ -64,6 +66,12 @@ export type MobileItemClickEventDetail = {
|
|
|
64
66
|
originalEvent: {
|
|
65
67
|
type: Event,
|
|
66
68
|
},
|
|
69
|
+
analyticsName: {
|
|
70
|
+
type: AnalyticsName,
|
|
71
|
+
},
|
|
72
|
+
sourceNode: {
|
|
73
|
+
type: HTMLElement,
|
|
74
|
+
},
|
|
67
75
|
},
|
|
68
76
|
})
|
|
69
77
|
|
|
@@ -78,6 +86,12 @@ export type MobileItemClickEventDetail = {
|
|
|
78
86
|
originalEvent: {
|
|
79
87
|
type: Event,
|
|
80
88
|
},
|
|
89
|
+
analyticsName: {
|
|
90
|
+
type: AnalyticsName,
|
|
91
|
+
},
|
|
92
|
+
sourceNode: {
|
|
93
|
+
type: HTMLElement,
|
|
94
|
+
},
|
|
81
95
|
},
|
|
82
96
|
})
|
|
83
97
|
|
|
@@ -160,7 +174,7 @@ class UDExMastheadMobileMenu extends UI5Element {
|
|
|
160
174
|
e.preventDefault();
|
|
161
175
|
this.openExploreSapMenu(e);
|
|
162
176
|
this.setFocusItemByIndex(0);
|
|
163
|
-
this.
|
|
177
|
+
this.fireExploreSapMobileButton(e);
|
|
164
178
|
}
|
|
165
179
|
|
|
166
180
|
handleBackToMenuItems(e: Event) {
|
|
@@ -420,14 +434,26 @@ class UDExMastheadMobileMenu extends UI5Element {
|
|
|
420
434
|
}
|
|
421
435
|
|
|
422
436
|
fireMobileItemEvent(e: Event, category?: string) {
|
|
437
|
+
const item = e.target as UDExMastheadMenuItem;
|
|
438
|
+
|
|
423
439
|
this.fireEvent<MobileItemClickEventDetail>("item-click", {
|
|
424
440
|
...(category && { category }),
|
|
425
441
|
isMobile: true,
|
|
426
|
-
item
|
|
442
|
+
item,
|
|
427
443
|
originalEvent: e,
|
|
444
|
+
analyticsName: AnalyticsName.Header,
|
|
445
|
+
sourceNode: item.shadowRoot?.querySelector(".udex-masthead-menu-item") as HTMLElement,
|
|
428
446
|
}, true, false);
|
|
429
447
|
}
|
|
430
448
|
|
|
449
|
+
fireExploreSapMobileButton(e: Event) {
|
|
450
|
+
this.fireEvent("explorer-menu-click", {
|
|
451
|
+
originalEvent: e,
|
|
452
|
+
analyticsName: AnalyticsName.Header,
|
|
453
|
+
sourceNode: (e.target as HTMLElement).shadowRoot?.querySelector(".udex-masthead-menu-item") as HTMLElement,
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
|
|
431
457
|
setFocusItemByIndex(index: number) {
|
|
432
458
|
this._shouldFocusItemByIndex = true;
|
|
433
459
|
this._focusedItemIndex = index;
|
|
@@ -10,6 +10,7 @@ import { LOGOUT } from "./generated/i18n/i18n-defaults.js";
|
|
|
10
10
|
import UDExMastheadMenu from "./MastheadMenu.js";
|
|
11
11
|
import MastheadProfileMenuTemplate from "./generated/templates/MastheadProfileMenuTemplate.lit.js";
|
|
12
12
|
import UDExMastheadMenuItem from "./MastheadMenuItem.js";
|
|
13
|
+
import AnalyticsName from "./types/AnalyticsName.js";
|
|
13
14
|
|
|
14
15
|
// Styles
|
|
15
16
|
import MastheadProfileMenuCss from "./generated/themes/MastheadProfileMenu.css.js";
|
|
@@ -22,13 +23,11 @@ interface UserData {
|
|
|
22
23
|
avatarInitials?: string
|
|
23
24
|
}
|
|
24
25
|
|
|
25
|
-
export type
|
|
26
|
-
originalEvent: Event,
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export type ProfileMenuItemClickEventDetail = {
|
|
30
|
-
item: UDExMastheadMenuItem,
|
|
26
|
+
export type UDExProfileClickEventDetail = {
|
|
31
27
|
originalEvent: Event,
|
|
28
|
+
analyticsName: AnalyticsName,
|
|
29
|
+
item: UDExMastheadMenuItem
|
|
30
|
+
sourceNode: HTMLElement,
|
|
32
31
|
}
|
|
33
32
|
|
|
34
33
|
/**
|
|
@@ -65,6 +64,15 @@ export type ProfileMenuItemClickEventDetail = {
|
|
|
65
64
|
originalEvent: {
|
|
66
65
|
type: Event,
|
|
67
66
|
},
|
|
67
|
+
analyticsName: {
|
|
68
|
+
type: AnalyticsName,
|
|
69
|
+
},
|
|
70
|
+
item: {
|
|
71
|
+
type: HTMLElement,
|
|
72
|
+
},
|
|
73
|
+
sourceNode: {
|
|
74
|
+
type: HTMLElement,
|
|
75
|
+
},
|
|
68
76
|
},
|
|
69
77
|
})
|
|
70
78
|
|
|
@@ -81,6 +89,12 @@ export type ProfileMenuItemClickEventDetail = {
|
|
|
81
89
|
originalEvent: {
|
|
82
90
|
type: Event,
|
|
83
91
|
},
|
|
92
|
+
analyticsName: {
|
|
93
|
+
type: AnalyticsName,
|
|
94
|
+
},
|
|
95
|
+
sourceNode: {
|
|
96
|
+
type: HTMLElement,
|
|
97
|
+
},
|
|
84
98
|
},
|
|
85
99
|
})
|
|
86
100
|
|
|
@@ -135,17 +149,24 @@ class UDExMastheadProfileMenu extends UI5Element {
|
|
|
135
149
|
}
|
|
136
150
|
|
|
137
151
|
handleUserLogoutItemClick(e: Event): void {
|
|
138
|
-
|
|
152
|
+
const item = e.target as UDExMastheadMenuItem;
|
|
153
|
+
|
|
154
|
+
this.fireEvent<UDExProfileClickEventDetail>("logout", {
|
|
155
|
+
item,
|
|
156
|
+
sourceNode: item.shadowRoot?.querySelector(".udex-masthead-menu-item") as HTMLElement,
|
|
139
157
|
originalEvent: e,
|
|
158
|
+
analyticsName: AnalyticsName.Header,
|
|
140
159
|
});
|
|
141
160
|
}
|
|
142
161
|
|
|
143
162
|
handleProfileMenuItemClick(e: CustomEvent): void {
|
|
144
163
|
const { item, originalEvent } = e.detail;
|
|
145
164
|
|
|
146
|
-
this.fireEvent<
|
|
165
|
+
this.fireEvent<UDExProfileClickEventDetail>("profile-item-click", {
|
|
147
166
|
item,
|
|
148
167
|
originalEvent,
|
|
168
|
+
analyticsName: AnalyticsName.Header,
|
|
169
|
+
sourceNode: item.shadowRoot.querySelector(".udex-masthead-menu-item") as HTMLElement,
|
|
149
170
|
});
|
|
150
171
|
}
|
|
151
172
|
|
package/src/MastheadShell.ts
CHANGED
|
@@ -24,6 +24,7 @@ import UDExMastheadProfileMenu from "./MastheadProfileMenu.js";
|
|
|
24
24
|
import UDExMastheadCountrySelector from "./MastheadCountrySelector.js";
|
|
25
25
|
import MastheadShellTemplate from "./generated/templates/MastheadShellTemplate.lit.js";
|
|
26
26
|
import { BreakpointUtils } from "./utils/Breakpoints.js";
|
|
27
|
+
import AnalyticsName from "./types/AnalyticsName.js";
|
|
27
28
|
|
|
28
29
|
// Styles
|
|
29
30
|
import MastheadShellCss from "./generated/themes/MastheadShell.css.js";
|
|
@@ -34,6 +35,14 @@ type MastheadItemType = UDExMastheadItem | null | undefined;
|
|
|
34
35
|
export const MastheadOriginalEvent = {
|
|
35
36
|
detail: {
|
|
36
37
|
originalEvent: { type: Event },
|
|
38
|
+
analyticsName: { type: AnalyticsName },
|
|
39
|
+
sourceNode: { type: HTMLElement },
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const AnalyticsNameEventDetail = {
|
|
44
|
+
detail: {
|
|
45
|
+
analyticsName: { type: AnalyticsName },
|
|
37
46
|
},
|
|
38
47
|
};
|
|
39
48
|
|
|
@@ -74,14 +83,14 @@ export const MastheadOriginalEvent = {
|
|
|
74
83
|
*
|
|
75
84
|
* @public
|
|
76
85
|
*/
|
|
77
|
-
@event("mobile-menu-open")
|
|
86
|
+
@event("mobile-menu-open", AnalyticsNameEventDetail)
|
|
78
87
|
|
|
79
88
|
/**
|
|
80
89
|
* Fired event when the user clicks the mobile menu button closer.
|
|
81
90
|
*
|
|
82
91
|
* @public
|
|
83
92
|
*/
|
|
84
|
-
@event("mobile-menu-close")
|
|
93
|
+
@event("mobile-menu-close", AnalyticsNameEventDetail)
|
|
85
94
|
|
|
86
95
|
/**
|
|
87
96
|
* Fired event when the user clicks the search button trigger.
|
|
@@ -102,14 +111,14 @@ export const MastheadOriginalEvent = {
|
|
|
102
111
|
*
|
|
103
112
|
* @public
|
|
104
113
|
*/
|
|
105
|
-
@event("search-opened")
|
|
114
|
+
@event("search-opened", AnalyticsNameEventDetail)
|
|
106
115
|
|
|
107
116
|
/**
|
|
108
117
|
* Fired event when the search panel is closed.
|
|
109
118
|
*
|
|
110
119
|
* @public
|
|
111
120
|
*/
|
|
112
|
-
@event("search-closed")
|
|
121
|
+
@event("search-closed", AnalyticsNameEventDetail)
|
|
113
122
|
|
|
114
123
|
/**
|
|
115
124
|
* Fired event when the user clicks the cart button trigger.
|
|
@@ -150,7 +159,6 @@ export const MastheadOriginalEvent = {
|
|
|
150
159
|
* Fired event when the user clicks the site label.
|
|
151
160
|
*
|
|
152
161
|
* @public
|
|
153
|
-
* @public
|
|
154
162
|
*/
|
|
155
163
|
@event("site-label-click", MastheadOriginalEvent)
|
|
156
164
|
|
|
@@ -486,37 +494,37 @@ class UDExMastheadShell extends UI5Element {
|
|
|
486
494
|
}
|
|
487
495
|
|
|
488
496
|
handleLogoClick(e: CustomEvent): void {
|
|
489
|
-
this.
|
|
497
|
+
this.fireMastheadEvent("logo-click", e);
|
|
490
498
|
}
|
|
491
499
|
|
|
492
500
|
handleSiteLabelClick(e: CustomEvent): void {
|
|
493
|
-
this.
|
|
501
|
+
this.fireMastheadEvent("site-label-click", e);
|
|
494
502
|
}
|
|
495
503
|
|
|
496
504
|
handleSearchClick(e: CustomEvent): void {
|
|
497
505
|
e.stopPropagation();
|
|
498
|
-
this.
|
|
506
|
+
this.fireMastheadEvent("search-click", e);
|
|
499
507
|
this.openSearch();
|
|
500
508
|
}
|
|
501
509
|
|
|
502
510
|
handleCartClick(e: CustomEvent): void {
|
|
503
511
|
e.stopPropagation();
|
|
504
|
-
this.
|
|
512
|
+
this.fireMastheadEvent("cart-click", e);
|
|
505
513
|
}
|
|
506
514
|
|
|
507
515
|
handleSupportClick(e: CustomEvent): void {
|
|
508
516
|
e.stopPropagation();
|
|
509
|
-
this.
|
|
517
|
+
this.fireMastheadEvent("support-click", e);
|
|
510
518
|
}
|
|
511
519
|
|
|
512
520
|
handleProfileClick(e: CustomEvent): void {
|
|
513
521
|
e.stopPropagation();
|
|
514
|
-
this.
|
|
522
|
+
this.fireMastheadEvent("profile-click", e);
|
|
515
523
|
}
|
|
516
524
|
|
|
517
525
|
handleCountrySelectorClick(e: CustomEvent): void {
|
|
518
526
|
e.stopPropagation();
|
|
519
|
-
this.
|
|
527
|
+
this.fireMastheadEvent("country-selector-click", e);
|
|
520
528
|
}
|
|
521
529
|
|
|
522
530
|
handleOpenMobileMenu(): void {
|
|
@@ -532,12 +540,12 @@ class UDExMastheadShell extends UI5Element {
|
|
|
532
540
|
this.setOverflowBody();
|
|
533
541
|
}
|
|
534
542
|
|
|
535
|
-
this.
|
|
543
|
+
this.fireMastheadEvent("mobile-menu-open");
|
|
536
544
|
}
|
|
537
545
|
|
|
538
546
|
handleCloseSearch(e: CustomEvent): void {
|
|
539
547
|
this._closeBtnClicked = true;
|
|
540
|
-
this.
|
|
548
|
+
this.fireMastheadEvent("search-close-click", e);
|
|
541
549
|
this.closeSearch();
|
|
542
550
|
}
|
|
543
551
|
|
|
@@ -730,7 +738,16 @@ class UDExMastheadShell extends UI5Element {
|
|
|
730
738
|
*/
|
|
731
739
|
closeSearch(): void {
|
|
732
740
|
this._isSearchOpened = false;
|
|
733
|
-
this.
|
|
741
|
+
this.fireMastheadEvent("search-closed");
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
fireMastheadEvent(eventName: string, e?: CustomEvent): void {
|
|
745
|
+
const eventDetails = {
|
|
746
|
+
analyticsName: AnalyticsName.Header,
|
|
747
|
+
...(e && { originalEvent: e }),
|
|
748
|
+
...(e && { sourceNode: e.currentTarget as HTMLElement }),
|
|
749
|
+
};
|
|
750
|
+
this.fireEvent(eventName, eventDetails);
|
|
734
751
|
}
|
|
735
752
|
|
|
736
753
|
/**
|
|
@@ -754,7 +771,7 @@ class UDExMastheadShell extends UI5Element {
|
|
|
754
771
|
this._searchOpener.selected = false;
|
|
755
772
|
}
|
|
756
773
|
|
|
757
|
-
this.
|
|
774
|
+
this.fireMastheadEvent("search-opened");
|
|
758
775
|
}
|
|
759
776
|
|
|
760
777
|
/**
|
|
@@ -785,7 +802,7 @@ class UDExMastheadShell extends UI5Element {
|
|
|
785
802
|
this.removeOverflowBody();
|
|
786
803
|
}
|
|
787
804
|
|
|
788
|
-
this.
|
|
805
|
+
this.fireMastheadEvent("mobile-menu-close");
|
|
789
806
|
}
|
|
790
807
|
|
|
791
808
|
get slottedItems(): (MastheadSlottedItem)[] {
|