@sapudex/web-components 0.184.0 → 0.192.4
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/CountrySelector.d.ts +2 -0
- package/dist/CountrySelector.js +5 -1
- package/dist/CountrySelector.js.map +1 -1
- package/dist/MastheadItem.d.ts +10 -1
- package/dist/MastheadItem.js +11 -5
- package/dist/MastheadItem.js.map +1 -1
- package/dist/MastheadMenu.d.ts +6 -0
- package/dist/MastheadMenu.js +3 -0
- package/dist/MastheadMenu.js.map +1 -1
- package/dist/MastheadMenuItem.d.ts +1 -0
- package/dist/MastheadMenuItem.js +3 -0
- package/dist/MastheadMenuItem.js.map +1 -1
- package/dist/MastheadProfileMenu.d.ts +6 -0
- package/dist/MastheadProfileMenu.js +3 -0
- package/dist/MastheadProfileMenu.js.map +1 -1
- package/dist/MastheadShell.d.ts +34 -4
- package/dist/MastheadShell.js +122 -11
- package/dist/MastheadShell.js.map +1 -1
- package/dist/Pagination.d.ts +3 -2
- package/dist/Pagination.js +4 -2
- package/dist/Pagination.js.map +1 -1
- package/dist/Search.js +1 -0
- package/dist/Search.js.map +1 -1
- package/dist/SelectBox.d.ts +2 -0
- package/dist/SelectBox.js +5 -1
- package/dist/SelectBox.js.map +1 -1
- package/dist/Tab.d.ts +4 -13
- package/dist/Tab.js +11 -14
- package/dist/Tab.js.map +1 -1
- package/dist/TabNavigation.js +0 -1
- package/dist/TabNavigation.js.map +1 -1
- package/dist/TextArea.d.ts +13 -22
- package/dist/TextArea.js +30 -33
- package/dist/TextArea.js.map +1 -1
- package/dist/assets/{bundle.esm-d98e72b5.js → bundle.esm-aa637b3f.js} +177 -177
- package/dist/assets/messagebundle_en-06c0dadc.js +1 -0
- package/dist/css/themes/CountrySelector.css +1 -1
- package/dist/css/themes/MastheadItem.css +1 -1
- package/dist/css/themes/MastheadMenu.css +1 -1
- package/dist/css/themes/MastheadMenuItem.css +1 -1
- package/dist/css/themes/MastheadProfileMenu.css +1 -1
- package/dist/css/themes/MastheadShell.css +1 -1
- package/dist/css/themes/MediaPlayer.css +1 -1
- package/dist/css/themes/RatingIndicator.css +1 -1
- package/dist/css/themes/Search.css +1 -1
- package/dist/css/themes/Slider.css +1 -1
- package/dist/css/themes/Tag.css +1 -1
- package/dist/css/themes/TextArea.css +1 -1
- package/dist/custom-elements-internal.json +14 -12
- package/dist/custom-elements.json +14 -12
- 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 +3 -3
- package/dist/generated/templates/MastheadItemTemplate.lit.js.map +1 -1
- package/dist/generated/templates/MastheadMenuItemTemplate.lit.js +2 -2
- package/dist/generated/templates/MastheadMenuItemTemplate.lit.js.map +1 -1
- package/dist/generated/templates/MastheadShellTemplate.lit.js +8 -9
- package/dist/generated/templates/MastheadShellTemplate.lit.js.map +1 -1
- package/dist/generated/templates/PaginationTemplate.lit.js +1 -1
- package/dist/generated/templates/PaginationTemplate.lit.js.map +1 -1
- package/dist/generated/templates/TabHeaderTemplate.lit.js +1 -1
- package/dist/generated/templates/TabHeaderTemplate.lit.js.map +1 -1
- package/dist/generated/templates/TabNavigationTemplate.lit.js +1 -1
- package/dist/generated/templates/TabNavigationTemplate.lit.js.map +1 -1
- package/dist/generated/templates/TextAreaTemplate.lit.js +5 -4
- package/dist/generated/templates/TextAreaTemplate.lit.js.map +1 -1
- package/dist/generated/templates/TextFieldTemplate.lit.js +1 -1
- package/dist/generated/templates/TextFieldTemplate.lit.js.map +1 -1
- package/dist/generated/themes/CountrySelector.css.js +1 -1
- package/dist/generated/themes/CountrySelector.css.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/MastheadMenu.css.js +1 -1
- package/dist/generated/themes/MastheadMenu.css.js.map +1 -1
- package/dist/generated/themes/MastheadMenuItem.css.js +1 -1
- package/dist/generated/themes/MastheadMenuItem.css.js.map +1 -1
- package/dist/generated/themes/MastheadProfileMenu.css.js +1 -1
- package/dist/generated/themes/MastheadProfileMenu.css.js.map +1 -1
- package/dist/generated/themes/MastheadShell.css.js +1 -1
- package/dist/generated/themes/MastheadShell.css.js.map +1 -1
- package/dist/generated/themes/MediaPlayer.css.js +1 -1
- package/dist/generated/themes/MediaPlayer.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/Search.css.js +1 -1
- package/dist/generated/themes/Search.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/Tag.css.js +1 -1
- package/dist/generated/themes/Tag.css.js.map +1 -1
- package/dist/generated/themes/TextArea.css.js +1 -1
- package/dist/generated/themes/TextArea.css.js.map +1 -1
- package/dist/i18n/messagebundle.properties +3 -0
- package/dist/i18n/messagebundle_en.properties +1 -0
- package/dist/web-types.json +3 -3
- package/package.json +1 -1
- package/src/CountrySelector.hbs +30 -30
- package/src/CountrySelector.ts +18 -13
- package/src/MastheadItem.hbs +3 -3
- package/src/MastheadItem.ts +22 -10
- package/src/MastheadMenu.ts +8 -0
- package/src/MastheadMenuItem.hbs +2 -1
- package/src/MastheadMenuItem.ts +4 -0
- package/src/MastheadProfileMenu.ts +8 -0
- package/src/MastheadShell.hbs +69 -67
- package/src/MastheadShell.ts +154 -16
- package/src/Pagination.hbs +2 -2
- package/src/Pagination.ts +8 -5
- package/src/Search.ts +1 -0
- package/src/SelectBox.ts +7 -1
- package/src/Tab.ts +18 -29
- package/src/TabHeader.hbs +1 -1
- package/src/TabNavigation.hbs +1 -2
- package/src/TabNavigation.ts +2 -1
- package/src/TextArea.hbs +21 -21
- package/src/TextArea.ts +82 -78
- package/src/TextField.hbs +4 -2
- package/src/generated/i18n/i18n-defaults.ts +2 -2
- package/src/generated/templates/MastheadItemTemplate.lit.ts +3 -3
- package/src/generated/templates/MastheadMenuItemTemplate.lit.ts +2 -2
- package/src/generated/templates/MastheadShellTemplate.lit.ts +8 -9
- package/src/generated/templates/PaginationTemplate.lit.ts +1 -1
- package/src/generated/templates/TabHeaderTemplate.lit.ts +1 -1
- package/src/generated/templates/TabNavigationTemplate.lit.ts +1 -1
- package/src/generated/templates/TextAreaTemplate.lit.ts +5 -4
- package/src/generated/templates/TextFieldTemplate.lit.ts +1 -1
- package/src/generated/themes/CountrySelector.css.ts +1 -1
- package/src/generated/themes/MastheadItem.css.ts +1 -1
- package/src/generated/themes/MastheadMenu.css.ts +1 -1
- package/src/generated/themes/MastheadMenuItem.css.ts +1 -1
- package/src/generated/themes/MastheadProfileMenu.css.ts +1 -1
- package/src/generated/themes/MastheadShell.css.ts +1 -1
- package/src/generated/themes/MediaPlayer.css.ts +1 -1
- package/src/generated/themes/RatingIndicator.css.ts +1 -1
- package/src/generated/themes/Search.css.ts +1 -1
- package/src/generated/themes/Slider.css.ts +1 -1
- package/src/generated/themes/Tag.css.ts +1 -1
- package/src/generated/themes/TextArea.css.ts +1 -1
- package/src/i18n/messagebundle.properties +3 -0
- package/src/i18n/messagebundle_en.properties +1 -0
- package/src/themes/CountrySelector.css +23 -16
- package/src/themes/MastheadItem.css +40 -2
- package/src/themes/MastheadMenu.css +72 -0
- package/src/themes/MastheadMenuItem.css +1 -0
- package/src/themes/MastheadProfileMenu.css +8 -0
- package/src/themes/MastheadShell.css +59 -27
- package/src/themes/MediaPlayer.css +18 -9
- package/src/themes/Search.css +4 -4
- package/src/themes/Tag.css +6 -3
- package/src/themes/TextArea.css +12 -1
- package/dist/assets/messagebundle_en-4997b226.js +0 -1
package/src/MastheadItem.ts
CHANGED
|
@@ -13,9 +13,8 @@ import { isDesktop } from "@ui5/webcomponents-base/dist/Device.js";
|
|
|
13
13
|
import { OPENS_IN_A_NEW_WINDOW, PROFILE } from "./generated/i18n/i18n-defaults.js";
|
|
14
14
|
import UDExMastheadMenu from "./MastheadMenu.js";
|
|
15
15
|
import UDExAvatar from "./Avatar.js";
|
|
16
|
-
import MastheadShell from "./MastheadShell.js";
|
|
17
16
|
import "@ui5/webcomponents-icons/dist/slim-arrow-down.js";
|
|
18
|
-
|
|
17
|
+
import UDExMastheadShell from "./MastheadShell.js";
|
|
19
18
|
import MastheadItemTemplate from "./generated/templates/MastheadItemTemplate.lit.js";
|
|
20
19
|
|
|
21
20
|
// Styles
|
|
@@ -212,6 +211,14 @@ class UDExMastheadItem extends UI5Element implements IMastheadItem {
|
|
|
212
211
|
@property({ type: String })
|
|
213
212
|
_direction?: string;
|
|
214
213
|
|
|
214
|
+
/**
|
|
215
|
+
* Defines the mobile mode for component
|
|
216
|
+
*
|
|
217
|
+
* @private
|
|
218
|
+
*/
|
|
219
|
+
@property({ type: Boolean })
|
|
220
|
+
_isMobileMode!: boolean;
|
|
221
|
+
|
|
215
222
|
/**
|
|
216
223
|
* Slot for the dropdown
|
|
217
224
|
*
|
|
@@ -231,20 +238,23 @@ class UDExMastheadItem extends UI5Element implements IMastheadItem {
|
|
|
231
238
|
content?: Array<HTMLElement>;
|
|
232
239
|
|
|
233
240
|
_profileAvatar!: UDExAvatar;
|
|
241
|
+
_mastheadShell!: UDExMastheadShell;
|
|
242
|
+
|
|
234
243
|
static i18nBundle: I18nBundle;
|
|
235
244
|
|
|
236
245
|
static async onDefine(): Promise<void> {
|
|
237
246
|
UDExMastheadItem.i18nBundle = await getI18nBundle("@udex/web-components");
|
|
238
247
|
}
|
|
239
248
|
|
|
240
|
-
onEnterDOM() {
|
|
249
|
+
onEnterDOM(): void {
|
|
241
250
|
if (isDesktop()) {
|
|
242
251
|
this.setAttribute("desktop", "");
|
|
243
252
|
}
|
|
244
253
|
}
|
|
245
254
|
|
|
246
|
-
onAfterRendering() {
|
|
255
|
+
onAfterRendering(): void {
|
|
247
256
|
this._profileAvatar = this.profileAvatar;
|
|
257
|
+
this._mastheadShell = this.mastheadShell;
|
|
248
258
|
this.handleDirection();
|
|
249
259
|
if (this.selected && this.hasDropdownSlot && !this.isMobile && !this.isExploreBtn) {
|
|
250
260
|
this.setDropdownInsetStart();
|
|
@@ -280,13 +290,11 @@ class UDExMastheadItem extends UI5Element implements IMastheadItem {
|
|
|
280
290
|
}
|
|
281
291
|
|
|
282
292
|
handleKeyEscapeMobile(): void {
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
mastheadShell.closeMobileMenu();
|
|
286
|
-
mastheadShell.mobileBtn?.focus();
|
|
293
|
+
this._mastheadShell.closeMobileMenu();
|
|
294
|
+
this._mastheadShell.mobileBtn?.focus();
|
|
287
295
|
}
|
|
288
296
|
|
|
289
|
-
|
|
297
|
+
handleItemClick(e: Event): void {
|
|
290
298
|
this.selected = this.isMobile ? true : !this.selected;
|
|
291
299
|
|
|
292
300
|
this.fireEvent<ItemClickEventDetail>("item-click", {
|
|
@@ -357,6 +365,10 @@ class UDExMastheadItem extends UI5Element implements IMastheadItem {
|
|
|
357
365
|
return this.parseArrayFromString(this.subItems);
|
|
358
366
|
}
|
|
359
367
|
|
|
368
|
+
get mastheadShell(): UDExMastheadShell {
|
|
369
|
+
return document.querySelector<UDExMastheadShell>("[udex-masthead-shell]")!;
|
|
370
|
+
}
|
|
371
|
+
|
|
360
372
|
get additionalClass(): string {
|
|
361
373
|
const iconClass = this.icon ? "udex-masthead-item__button--icon" : "";
|
|
362
374
|
const profileClass = this.isProfileBtn ? "udex-masthead-item__button--profile" : "";
|
|
@@ -435,7 +447,7 @@ class UDExMastheadItem extends UI5Element implements IMastheadItem {
|
|
|
435
447
|
}
|
|
436
448
|
|
|
437
449
|
get isMobile(): boolean {
|
|
438
|
-
return window.innerWidth < breakpointSizeM;
|
|
450
|
+
return window.innerWidth < breakpointSizeM || this.mastheadShell?._isMobileMode;
|
|
439
451
|
}
|
|
440
452
|
|
|
441
453
|
get isTargetBlank(): boolean {
|
package/src/MastheadMenu.ts
CHANGED
|
@@ -99,6 +99,14 @@ class UDExMastheadMenu extends UI5Element {
|
|
|
99
99
|
@property({ type: String, defaultValue: "[]" })
|
|
100
100
|
subItems!: string;
|
|
101
101
|
|
|
102
|
+
/**
|
|
103
|
+
* Defines the mobile mode for component
|
|
104
|
+
*
|
|
105
|
+
* @private
|
|
106
|
+
*/
|
|
107
|
+
@property({ type: Boolean })
|
|
108
|
+
_isMobileMode!: boolean;
|
|
109
|
+
|
|
102
110
|
handleKeyDown(e: KeyboardEvent): void {
|
|
103
111
|
this.handleUpArrow(e);
|
|
104
112
|
this.handleDownArrow(e);
|
package/src/MastheadMenuItem.hbs
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
aria-describedby="{{ariaDescribedby}}"
|
|
12
12
|
role="{{accessibleRoleText}}"
|
|
13
13
|
href="{{url}}"
|
|
14
|
-
part="
|
|
14
|
+
part="{{partAttr}}"
|
|
15
15
|
target="{{target}}">
|
|
16
16
|
{{#if iconStart}}
|
|
17
17
|
{{>arrow-left}}
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
</a>
|
|
26
26
|
{{#if badge}}
|
|
27
27
|
<udex-badge
|
|
28
|
+
part="badge"
|
|
28
29
|
class="udex-masthead-menu-item-badge"
|
|
29
30
|
type="Number"
|
|
30
31
|
number-design="Blue"
|
package/src/MastheadMenuItem.ts
CHANGED
|
@@ -196,6 +196,10 @@ class UDExMastheadMenuItem extends UI5Element {
|
|
|
196
196
|
get accessibleRoleText(): string | null {
|
|
197
197
|
return this.accessibleRole ? this.accessibleRole : null;
|
|
198
198
|
}
|
|
199
|
+
|
|
200
|
+
get partAttr(): string {
|
|
201
|
+
return this.badge ? "menu-item-link-badge" : "menu-item-link";
|
|
202
|
+
}
|
|
199
203
|
}
|
|
200
204
|
|
|
201
205
|
UDExMastheadMenuItem.define();
|
|
@@ -112,6 +112,14 @@ class UDExMastheadProfileMenu extends UI5Element {
|
|
|
112
112
|
@property()
|
|
113
113
|
logoutUrl!: string;
|
|
114
114
|
|
|
115
|
+
/**
|
|
116
|
+
* Defines the mobile mode for component
|
|
117
|
+
*
|
|
118
|
+
* @private
|
|
119
|
+
*/
|
|
120
|
+
@property({ type: Boolean })
|
|
121
|
+
_isMobileMode!: boolean;
|
|
122
|
+
|
|
115
123
|
/**
|
|
116
124
|
* Placeholder for message strip.
|
|
117
125
|
*
|
package/src/MastheadShell.hbs
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
<
|
|
1
|
+
<header class="udex-masthead-shell" @keydown="{{handleKeyDown}}">
|
|
2
2
|
<div class="udex-masthead-shell__main-content">
|
|
3
|
-
|
|
4
|
-
{{
|
|
5
|
-
|
|
3
|
+
<div class="udex-masthead-shell__landing-wrap">
|
|
4
|
+
{{#if logoUrl}}
|
|
5
|
+
{{>logo}}
|
|
6
|
+
{{/if}}
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
{{#if siteLabel}}
|
|
9
|
+
{{>siteLabel}}
|
|
10
|
+
{{/if}}
|
|
11
|
+
</div>
|
|
10
12
|
|
|
11
13
|
{{#if isMainMenuVisible}}
|
|
12
|
-
<nav
|
|
14
|
+
<nav
|
|
15
|
+
class="udex-masthead-shell__nav"
|
|
16
|
+
aria-label="{{mainNavigationAriaLabel}}">
|
|
13
17
|
<ul
|
|
14
18
|
class="udex-masthead-shell__main-menu"
|
|
15
19
|
aria-label="{{mainNavigationAriaLabel}}">
|
|
@@ -39,67 +43,65 @@
|
|
|
39
43
|
{{/if}}
|
|
40
44
|
{{/if}}
|
|
41
45
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
<div class="udex-masthead-shell__search-icon">
|
|
64
|
-
<udex-masthead-item
|
|
65
|
-
class="udex-masthead-shell__search-btn"
|
|
66
|
-
icon="search"
|
|
67
|
-
@click="{{handleSearchClick}}"
|
|
68
|
-
accessible-name="search">
|
|
69
|
-
</udex-masthead-item>
|
|
70
|
-
</div>
|
|
71
|
-
{{/if}}
|
|
72
|
-
{{#if hasCart}}
|
|
73
|
-
<div
|
|
74
|
-
class="udex-masthead-shell__cart"
|
|
75
|
-
@ui5-item-click="{{setSelectedItem}}"
|
|
76
|
-
@click="{{handleCartClick}}">
|
|
77
|
-
<slot name="cart"></slot>
|
|
78
|
-
</div>
|
|
79
|
-
{{/if}}
|
|
80
|
-
{{#if hasProfile}}
|
|
81
|
-
<div
|
|
82
|
-
class="udex-masthead-shell__profile"
|
|
83
|
-
@ui5-item-click="{{setSelectedItem}}"
|
|
84
|
-
@click="{{handleProfileClick}}">
|
|
85
|
-
<slot name="profile"></slot>
|
|
86
|
-
</div>
|
|
87
|
-
{{/if}}
|
|
88
|
-
{{#if hasMobileMenuButtons}}
|
|
46
|
+
<div class="udex-masthead-shell__right-menu">
|
|
47
|
+
{{#if hasMobileMenuButtons}}
|
|
48
|
+
<udex-masthead-item
|
|
49
|
+
@ui5-item-click="{{handleMobileMenuClick}}"
|
|
50
|
+
class="udex-masthead-shell__menu-btn"
|
|
51
|
+
accessible-role="button"
|
|
52
|
+
icon="menu2"
|
|
53
|
+
part="menu-open-btn"
|
|
54
|
+
accessible-name="menu">
|
|
55
|
+
<slot slot="dropdown" name="mobileMenu"></slot>
|
|
56
|
+
</udex-masthead-item>
|
|
57
|
+
{{/if}}
|
|
58
|
+
{{#if hasExploreSAP}}
|
|
59
|
+
<div
|
|
60
|
+
class="udex-masthead-shell__explore"
|
|
61
|
+
@ui5-item-click="{{setSelectedItem}}">
|
|
62
|
+
<slot name="exploreSAP"></slot>
|
|
63
|
+
</div>
|
|
64
|
+
{{/if}}
|
|
65
|
+
{{#if hasSearch}}
|
|
66
|
+
<div class="udex-masthead-shell__search-icon udex-masthead-shell__item_icon">
|
|
89
67
|
<udex-masthead-item
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
accessible-
|
|
94
|
-
icon="decline"
|
|
95
|
-
accessible-name="close"
|
|
96
|
-
part="menu-close-btn"
|
|
97
|
-
hide-active-border>
|
|
68
|
+
class="udex-masthead-shell__search-btn"
|
|
69
|
+
icon="search"
|
|
70
|
+
@click="{{handleSearchClick}}"
|
|
71
|
+
accessible-name="search">
|
|
98
72
|
</udex-masthead-item>
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
73
|
+
</div>
|
|
74
|
+
{{/if}}
|
|
75
|
+
{{#if hasCart}}
|
|
76
|
+
<div
|
|
77
|
+
class="udex-masthead-shell__cart udex-masthead-shell__item_icon"
|
|
78
|
+
@ui5-item-click="{{setSelectedItem}}"
|
|
79
|
+
@click="{{handleCartClick}}">
|
|
80
|
+
<slot name="cart"></slot>
|
|
81
|
+
</div>
|
|
82
|
+
{{/if}}
|
|
83
|
+
{{#if hasProfile}}
|
|
84
|
+
<div
|
|
85
|
+
class="udex-masthead-shell__profile udex-masthead-shell__item_icon"
|
|
86
|
+
@ui5-item-click="{{setSelectedItem}}"
|
|
87
|
+
@click="{{handleProfileClick}}">
|
|
88
|
+
<slot name="profile"></slot>
|
|
89
|
+
</div>
|
|
90
|
+
{{/if}}
|
|
91
|
+
{{#if hasMobileMenuButtons}}
|
|
92
|
+
<udex-masthead-item
|
|
93
|
+
@keydown="{{handleEnterAndSpaceOnCloseBtn}}"
|
|
94
|
+
@ui5-item-click="{{handleMobileCloseClick}}"
|
|
95
|
+
class="udex-masthead-shell__close-btn"
|
|
96
|
+
accessible-role="button"
|
|
97
|
+
icon="decline"
|
|
98
|
+
accessible-name="close"
|
|
99
|
+
part="menu-close-btn"
|
|
100
|
+
hide-active-border>
|
|
101
|
+
</udex-masthead-item>
|
|
102
|
+
{{/if}}
|
|
103
|
+
</div>
|
|
104
|
+
</header>
|
|
103
105
|
|
|
104
106
|
{{#*inline "item"}}
|
|
105
107
|
<li
|
package/src/MastheadShell.ts
CHANGED
|
@@ -15,19 +15,22 @@ import "@ui5/webcomponents-icons/dist/search.js";
|
|
|
15
15
|
import "@ui5/webcomponents-icons/dist/cart.js";
|
|
16
16
|
import type I18nBundle from "@ui5/webcomponents-base/dist/i18nBundle.js";
|
|
17
17
|
import { getI18nBundle } from "@ui5/webcomponents-base/dist/i18nBundle.js";
|
|
18
|
+
import { MAIN_LINKS } from "./generated/i18n/i18n-defaults.js";
|
|
18
19
|
import UDExMastheadItem from "./MastheadItem.js";
|
|
19
20
|
import UDExMastheadMenu from "./MastheadMenu.js";
|
|
20
21
|
import UDExControlButton from "./ControlButton.js";
|
|
21
22
|
import UDExSearch from "./Search.js";
|
|
22
23
|
import UDExMastheadMobileMenu from "./MastheadMobileMenu.js";
|
|
23
|
-
|
|
24
|
+
import UDExMastheadProfileMenu from "./MastheadProfileMenu.js";
|
|
24
25
|
import MastheadShellTemplate from "./generated/templates/MastheadShellTemplate.lit.js";
|
|
25
26
|
|
|
26
27
|
// Styles
|
|
27
28
|
import MastheadShellCss from "./generated/themes/MastheadShell.css.js";
|
|
28
|
-
import { MAIN_LINKS } from "./generated/i18n/i18n-defaults.js";
|
|
29
29
|
|
|
30
30
|
const breakpointSizeM: number = 1279;
|
|
31
|
+
const canvasContentFont = "16px '72 Brand Variable'";
|
|
32
|
+
type MastheadSlottedItem = UDExMastheadItem | UDExMastheadProfileMenu | UDExMastheadMenu | undefined | null;
|
|
33
|
+
type MastheadItemType = UDExMastheadItem | null | undefined;
|
|
31
34
|
/**
|
|
32
35
|
* @class
|
|
33
36
|
*
|
|
@@ -293,6 +296,14 @@ class UDExMastheadShell extends UI5Element {
|
|
|
293
296
|
@property({ type: Boolean })
|
|
294
297
|
_isMobileMenuOpen!: boolean;
|
|
295
298
|
|
|
299
|
+
/**
|
|
300
|
+
* Defines the mobile mode for component
|
|
301
|
+
*
|
|
302
|
+
* @private
|
|
303
|
+
*/
|
|
304
|
+
@property({ type: Boolean })
|
|
305
|
+
_isMobileMode!: boolean;
|
|
306
|
+
|
|
296
307
|
/**
|
|
297
308
|
* Defines if the close button was clicked
|
|
298
309
|
*
|
|
@@ -343,11 +354,15 @@ class UDExMastheadShell extends UI5Element {
|
|
|
343
354
|
}
|
|
344
355
|
|
|
345
356
|
_handleResize(): void {
|
|
357
|
+
if (this.shouldHandleMobileView) {
|
|
358
|
+
this.handleMobileMode();
|
|
359
|
+
}
|
|
360
|
+
|
|
346
361
|
if (this.isBreakpointSizeM) {
|
|
347
362
|
this._isSearchOpened = false;
|
|
348
363
|
}
|
|
349
364
|
|
|
350
|
-
if (this._shouldHandleResize && this.
|
|
365
|
+
if (this._shouldHandleResize && this._isMobileMenuOpen) {
|
|
351
366
|
this.closeMobileMenu();
|
|
352
367
|
return;
|
|
353
368
|
}
|
|
@@ -355,6 +370,23 @@ class UDExMastheadShell extends UI5Element {
|
|
|
355
370
|
this._shouldHandleResize = true;
|
|
356
371
|
}
|
|
357
372
|
|
|
373
|
+
handleMobileMode(): void {
|
|
374
|
+
const rootHolder = this.getDomRef();
|
|
375
|
+
if (rootHolder) {
|
|
376
|
+
const rootHolderWidth = this.getRootHolderWidth(rootHolder);
|
|
377
|
+
const landingHolderWidth = this.getLandingHolderWidth();
|
|
378
|
+
const rightMenuWidth = this.getRightMenuWidth();
|
|
379
|
+
const mainMenuWidth = this.getMainMenuWidth();
|
|
380
|
+
const availableWidth = rootHolderWidth - rightMenuWidth - landingHolderWidth;
|
|
381
|
+
|
|
382
|
+
if (mainMenuWidth >= availableWidth) {
|
|
383
|
+
this.setMobileMode();
|
|
384
|
+
} else {
|
|
385
|
+
this.removeMobileMode();
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
|
|
358
390
|
handleKeyDown(e: KeyboardEvent): void {
|
|
359
391
|
e.stopPropagation();
|
|
360
392
|
this.handleLeftArrow(e);
|
|
@@ -429,12 +461,14 @@ class UDExMastheadShell extends UI5Element {
|
|
|
429
461
|
handleMobileCloseClick(e: CustomEvent) {
|
|
430
462
|
e.preventDefault();
|
|
431
463
|
this.closeMobileMenu();
|
|
464
|
+
this.fireMobileMenuCloseEvent();
|
|
432
465
|
}
|
|
433
466
|
|
|
434
467
|
handleEnterAndSpaceOnCloseBtn(e: KeyboardEvent) {
|
|
435
468
|
if (isSpace(e) || isEnter(e)) {
|
|
436
469
|
e.preventDefault();
|
|
437
470
|
this.closeMobileMenu();
|
|
471
|
+
this.fireMobileMenuCloseEvent();
|
|
438
472
|
this.mobileBtn?.focus();
|
|
439
473
|
}
|
|
440
474
|
}
|
|
@@ -442,7 +476,7 @@ class UDExMastheadShell extends UI5Element {
|
|
|
442
476
|
handleOutsideClick(): void {
|
|
443
477
|
document.addEventListener("click", (e: Event) => {
|
|
444
478
|
const el = e.target as UDExMastheadItem;
|
|
445
|
-
const isMobile = window.innerWidth < 1280;
|
|
479
|
+
const isMobile = window.innerWidth < 1280 || this._isMobileMode;
|
|
446
480
|
const isDropdownSlot = el.getAttribute("slot") === "dropdown";
|
|
447
481
|
if (!isDropdownSlot && !el.isMenuItem && !isMobile) {
|
|
448
482
|
this.resetSelectedItems();
|
|
@@ -459,16 +493,18 @@ class UDExMastheadShell extends UI5Element {
|
|
|
459
493
|
}
|
|
460
494
|
|
|
461
495
|
focusPreviousMenuItem(item: UDExMastheadItem): void {
|
|
496
|
+
const menuItems = this.menuItems;
|
|
497
|
+
const lastItemIndex = menuItems.length - 1;
|
|
462
498
|
const currentSelectedIndex = this.getCurrentIndex(item);
|
|
463
|
-
const lastItemIndex = this.menuItems.length - 1;
|
|
464
499
|
const previousSelectIndex = currentSelectedIndex - 1 < 0 ? lastItemIndex : currentSelectedIndex - 1;
|
|
465
|
-
|
|
500
|
+
menuItems[previousSelectIndex].focus();
|
|
466
501
|
}
|
|
467
502
|
|
|
468
503
|
focusNextMenuItem(item: UDExMastheadItem): void {
|
|
504
|
+
const menuItems = this.menuItems;
|
|
469
505
|
const currentSelectedIndex = this.getCurrentIndex(item);
|
|
470
|
-
const nextSelectIndex = currentSelectedIndex + 1 >
|
|
471
|
-
|
|
506
|
+
const nextSelectIndex = currentSelectedIndex + 1 > menuItems.length - 1 ? 0 : currentSelectedIndex + 1;
|
|
507
|
+
menuItems[nextSelectIndex].focus();
|
|
472
508
|
}
|
|
473
509
|
|
|
474
510
|
resetSelectedItems(): void {
|
|
@@ -518,6 +554,74 @@ class UDExMastheadShell extends UI5Element {
|
|
|
518
554
|
return buttonsArray.filter(({ selected }) => selected);
|
|
519
555
|
}
|
|
520
556
|
|
|
557
|
+
getRootHolderWidth(root: HTMLElement): number {
|
|
558
|
+
const rootPadding = parseInt(window.getComputedStyle(root).getPropertyValue("padding-left")) * 2;
|
|
559
|
+
const scrollWidth = window.innerWidth - document.documentElement.clientWidth;
|
|
560
|
+
return this.getDomRef()!.clientWidth + scrollWidth - rootPadding;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
getLandingHolderWidth(): number {
|
|
564
|
+
const landingHolder = this.getDomElement(".udex-masthead-shell__landing-wrap");
|
|
565
|
+
return landingHolder?.offsetWidth || 0;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
getRightMenuWidth(): number {
|
|
569
|
+
const itemsIcon = [...this.shadowRoot!.querySelectorAll<HTMLDivElement>(".udex-masthead-shell__item_icon")];
|
|
570
|
+
const itemIconWidths = itemsIcon.length * this.getItemIconWidth();
|
|
571
|
+
const itemIconGaps = itemsIcon.length * this.getItemIconGap();
|
|
572
|
+
const exploreSAPWidth = this.hasExploreSAP ? this.getItemWidth(this.exploreSAP[0]) : 0;
|
|
573
|
+
const rightMenuGaps = this.getRightMenuGap() + this.getExploreSapBtnGap() + itemIconGaps;
|
|
574
|
+
return exploreSAPWidth + itemIconWidths + rightMenuGaps;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
getItemIconWidth(): number {
|
|
578
|
+
const style = window.getComputedStyle(this.profileItem);
|
|
579
|
+
const itemIconWidthVar = style.getPropertyValue("--udex-masthead-item-button-icon-size");
|
|
580
|
+
return parseInt(itemIconWidthVar);
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
getMainMenuWidth(): number {
|
|
584
|
+
const mainItems = this.getSlottedNodes("menuItems");
|
|
585
|
+
const gapItemVar = this.getRootVar("--udex-masthead-shell-item-gap");
|
|
586
|
+
return mainItems.reduce((accumulatedWidth, item, index) => {
|
|
587
|
+
return accumulatedWidth + this.getItemWidth(item as UDExMastheadItem) + (index && parseInt(gapItemVar));
|
|
588
|
+
}, 0);
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
getDomElement(selector: string): HTMLElement | undefined | null {
|
|
592
|
+
return this.shadowRoot?.querySelector(`${selector}`);
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
getItemWidth(item: UDExMastheadItem): number {
|
|
596
|
+
const context = this.getCanvasContext();
|
|
597
|
+
context.font = canvasContentFont;
|
|
598
|
+
return Math.ceil(context.measureText(item.innerText.trim()).width);
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
getCanvasContext(): CanvasRenderingContext2D {
|
|
602
|
+
const canvas = document.createElement("canvas");
|
|
603
|
+
return canvas.getContext("2d")!;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
getItemIconGap(): number {
|
|
607
|
+
const gapIconItemVar = this.getRootVar("--udex-masthead-shell-item-icon-gap");
|
|
608
|
+
return parseInt(gapIconItemVar);
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
getExploreSapBtnGap(): number {
|
|
612
|
+
const exploreSapBtnGapVar = this.getRootVar("--udex-masthead-shell-explore-margin");
|
|
613
|
+
return this.hasExploreSAP ? parseInt(exploreSapBtnGapVar) : 0;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
getRightMenuGap(): number {
|
|
617
|
+
const rightMenuGapVar = this.getRootVar("--udex-masthead-right-menu-padding");
|
|
618
|
+
return parseInt(rightMenuGapVar);
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
getRootVar(variableName: string): string {
|
|
622
|
+
return window.getComputedStyle(this.getDomRef()!).getPropertyValue(`${variableName}`);
|
|
623
|
+
}
|
|
624
|
+
|
|
521
625
|
isNavigationItem(item: UDExMastheadItem): boolean {
|
|
522
626
|
return this.menuItems.some(menuItem => menuItem === item);
|
|
523
627
|
}
|
|
@@ -541,15 +645,33 @@ class UDExMastheadShell extends UI5Element {
|
|
|
541
645
|
if (this.bodyOverflow) {
|
|
542
646
|
this.removeOverflowBody();
|
|
543
647
|
}
|
|
648
|
+
}
|
|
544
649
|
|
|
545
|
-
|
|
650
|
+
setMobileMode(): void {
|
|
651
|
+
this._isMobileMode = true;
|
|
652
|
+
this.slottedItems.forEach((item: MastheadSlottedItem) => {
|
|
653
|
+
if (item) {
|
|
654
|
+
item._isMobileMode = true;
|
|
655
|
+
}
|
|
656
|
+
});
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
removeMobileMode(): void {
|
|
660
|
+
this._isMobileMode = false;
|
|
661
|
+
this.slottedItems.forEach((item: MastheadSlottedItem) => {
|
|
662
|
+
item?.removeAttribute("_is-mobile-mode");
|
|
663
|
+
});
|
|
546
664
|
}
|
|
547
665
|
|
|
548
666
|
fireMobileMenuCloseEvent(): void {
|
|
549
667
|
this.fireEvent("mobile-menu-close");
|
|
550
668
|
}
|
|
551
669
|
|
|
552
|
-
get
|
|
670
|
+
get slottedItems(): (MastheadSlottedItem)[] {
|
|
671
|
+
return [this.profileItem, this.cartItem, this.profileMenu, this.profileMenuLinks];
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
get searchOpener(): MastheadItemType {
|
|
553
675
|
return this.shadowRoot?.querySelector(".udex-masthead-shell__search-btn");
|
|
554
676
|
}
|
|
555
677
|
|
|
@@ -561,14 +683,30 @@ class UDExMastheadShell extends UI5Element {
|
|
|
561
683
|
return this.querySelector("[udex-masthead-mobile-menu]");
|
|
562
684
|
}
|
|
563
685
|
|
|
564
|
-
get mobileBtn():
|
|
686
|
+
get mobileBtn(): MastheadItemType {
|
|
565
687
|
return this.shadowRoot?.querySelector(".udex-masthead-shell__menu-btn");
|
|
566
688
|
}
|
|
567
689
|
|
|
568
|
-
get closeBtn():
|
|
690
|
+
get closeBtn(): MastheadItemType {
|
|
569
691
|
return this.shadowRoot?.querySelector(".udex-masthead-shell__close-btn");
|
|
570
692
|
}
|
|
571
693
|
|
|
694
|
+
get profileItem(): UDExMastheadItem {
|
|
695
|
+
return this.getSlottedNodes<UDExMastheadItem>("profile")[0];
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
get cartItem(): MastheadItemType {
|
|
699
|
+
return this.getSlottedNodes<UDExMastheadItem>("cart")[0];
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
get profileMenu(): UDExMastheadProfileMenu {
|
|
703
|
+
return this.querySelector("[udex-masthead-profile-menu]")!;
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
get profileMenuLinks(): UDExMastheadMenu | undefined | null {
|
|
707
|
+
return this.profileMenu?.shadowRoot?.querySelector("[udex-masthead-menu]");
|
|
708
|
+
}
|
|
709
|
+
|
|
572
710
|
get hasProfile(): boolean {
|
|
573
711
|
return !!this.profile.length;
|
|
574
712
|
}
|
|
@@ -597,14 +735,14 @@ class UDExMastheadShell extends UI5Element {
|
|
|
597
735
|
return !this.showSearchByDefault && !this._isSearchOpened;
|
|
598
736
|
}
|
|
599
737
|
|
|
600
|
-
get isRightMenuVisible(): boolean {
|
|
601
|
-
return this.showSearchByDefault || !this._isSearchOpened;
|
|
602
|
-
}
|
|
603
|
-
|
|
604
738
|
get isSearchVisible(): boolean {
|
|
605
739
|
return this.showSearchByDefault || this._isSearchOpened;
|
|
606
740
|
}
|
|
607
741
|
|
|
742
|
+
get shouldHandleMobileView(): boolean {
|
|
743
|
+
return !this.isBreakpointSizeM && !this.showSearchByDefault;
|
|
744
|
+
}
|
|
745
|
+
|
|
608
746
|
get mainNavigationAriaLabel(): string {
|
|
609
747
|
return UDExMastheadShell.i18nBundle.getText(MAIN_LINKS);
|
|
610
748
|
}
|
package/src/Pagination.hbs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{{#if pages}}
|
|
2
|
-
<nav
|
|
3
|
-
<ul class="udex-pagination__list"
|
|
2
|
+
<nav class="{{paginationClass}}" role="navigation" aria-label="{{paginationAccessibleName}}">
|
|
3
|
+
<ul class="udex-pagination__list">
|
|
4
4
|
{{#if absoluteNavigation}}
|
|
5
5
|
<li class="udex-pagination__item--first udex-pagination__item">
|
|
6
6
|
<udex-button
|
package/src/Pagination.ts
CHANGED
|
@@ -82,9 +82,10 @@ class UDExPagination extends UI5Element {
|
|
|
82
82
|
* Defines number of pages.
|
|
83
83
|
*
|
|
84
84
|
* @public
|
|
85
|
+
* @default 0
|
|
85
86
|
*/
|
|
86
|
-
@property({ validator: Integer })
|
|
87
|
-
pages
|
|
87
|
+
@property({ validator: Integer, defaultValue: 0 })
|
|
88
|
+
pages: number;
|
|
88
89
|
|
|
89
90
|
/**
|
|
90
91
|
* Defines type of pagination.
|
|
@@ -143,6 +144,7 @@ class UDExPagination extends UI5Element {
|
|
|
143
144
|
|
|
144
145
|
constructor() {
|
|
145
146
|
super();
|
|
147
|
+
this.pages = 0;
|
|
146
148
|
this._pages = [];
|
|
147
149
|
this._visiblePages = [];
|
|
148
150
|
this.currentPageIndex = 0;
|
|
@@ -348,15 +350,16 @@ class UDExPagination extends UI5Element {
|
|
|
348
350
|
this.emitChangeEvent();
|
|
349
351
|
}
|
|
350
352
|
|
|
351
|
-
setupPages(pages
|
|
353
|
+
setupPages(pages: number) {
|
|
352
354
|
if (!pages) {
|
|
353
355
|
this._visiblePages = [];
|
|
354
356
|
return;
|
|
355
357
|
}
|
|
356
358
|
|
|
357
|
-
if (!this._pages.length) {
|
|
359
|
+
if (!this._pages.length || this._visiblePages.length < this.displayNumber) {
|
|
358
360
|
this._firstPageIndex = 0;
|
|
359
361
|
this._lastPageIndex = pages > this.displayNumber ? this.displayNumber : pages;
|
|
362
|
+
this._pageFocusedManually = false;
|
|
360
363
|
}
|
|
361
364
|
|
|
362
365
|
this._pages = this.setupPagesData();
|
|
@@ -397,7 +400,7 @@ class UDExPagination extends UI5Element {
|
|
|
397
400
|
this._lastPageIndex--;
|
|
398
401
|
}
|
|
399
402
|
} else {
|
|
400
|
-
while (this._lastPageIndex - this.currentPageIndex - 1 < this.pageOffset && this._lastPageIndex < this.pages
|
|
403
|
+
while (this._lastPageIndex - this.currentPageIndex - 1 < this.pageOffset && this._lastPageIndex < this.pages) {
|
|
401
404
|
this._firstPageIndex++;
|
|
402
405
|
this._lastPageIndex++;
|
|
403
406
|
}
|
package/src/Search.ts
CHANGED
|
@@ -904,6 +904,7 @@ class UDExSearch extends UI5Element {
|
|
|
904
904
|
const suggestionObserver = this._createObserver(this.Suggestion.popover);
|
|
905
905
|
const popoverNode = this.Suggestion?.popover as Node;
|
|
906
906
|
suggestionObserver.observe(popoverNode, { attributes: true, attributeOldValue: true });
|
|
907
|
+
this.Suggestion.initLists();
|
|
907
908
|
}
|
|
908
909
|
|
|
909
910
|
if (prefixPopover) {
|