@sapudex/web-components 0.231.0 → 0.231.2
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/Accordion.d.ts +7 -5
- package/dist/Accordion.js +22 -16
- package/dist/Accordion.js.map +1 -1
- package/dist/AccordionItem.js +7 -0
- package/dist/AccordionItem.js.map +1 -1
- package/dist/CountrySelector.d.ts +1 -1
- package/dist/CountrySelector.js +6 -7
- package/dist/CountrySelector.js.map +1 -1
- package/dist/MastheadCountrySelector.d.ts +6 -0
- package/dist/MastheadCountrySelector.js +17 -2
- package/dist/MastheadCountrySelector.js.map +1 -1
- package/dist/MastheadMenu.d.ts +1 -0
- package/dist/MastheadMenu.js +7 -3
- package/dist/MastheadMenu.js.map +1 -1
- package/dist/MastheadMobileMenu.js +6 -3
- package/dist/MastheadMobileMenu.js.map +1 -1
- package/dist/MastheadShell.d.ts +17 -0
- package/dist/MastheadShell.js +55 -13
- package/dist/MastheadShell.js.map +1 -1
- package/dist/Search.js +3 -3
- package/dist/Search.js.map +1 -1
- package/dist/SearchableListBase.d.ts +4 -0
- package/dist/SearchableListBase.js +21 -2
- package/dist/SearchableListBase.js.map +1 -1
- package/dist/assets/{bundle.esm-47166f9b.js → bundle.esm-7c89a94a.js} +194 -194
- package/dist/assets/messagebundle_en-4b95b93e.js +1 -0
- package/dist/css/themes/CountrySelector.css +1 -1
- package/dist/css/themes/MastheadCountrySelector.css +1 -1
- package/dist/css/themes/MastheadItem.css +1 -1
- package/dist/css/themes/MastheadMenuItem.css +1 -1
- package/dist/css/themes/MastheadMobileMenu.css +1 -1
- package/dist/css/themes/MastheadShell.css +1 -1
- package/dist/css/themes/RatingIndicator.css +1 -1
- package/dist/css/themes/Search.css +1 -1
- package/dist/css/themes/SearchSuggestions.css +1 -1
- package/dist/css/themes/SearchableList.css +1 -1
- package/dist/css/themes/Slider.css +1 -1
- package/dist/custom-elements-internal.json +83 -75
- package/dist/custom-elements.json +82 -75
- 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/AccordionTemplate.lit.js +1 -1
- package/dist/generated/templates/AccordionTemplate.lit.js.map +1 -1
- package/dist/generated/templates/MastheadCountrySelectorTemplate.lit.js +3 -3
- package/dist/generated/templates/MastheadCountrySelectorTemplate.lit.js.map +1 -1
- package/dist/generated/templates/MastheadMenuTemplate.lit.js +3 -3
- package/dist/generated/templates/MastheadMenuTemplate.lit.js.map +1 -1
- package/dist/generated/templates/MastheadMobileMenuTemplate.lit.js +12 -10
- package/dist/generated/templates/MastheadMobileMenuTemplate.lit.js.map +1 -1
- package/dist/generated/templates/MastheadShellTemplate.lit.js +1 -1
- package/dist/generated/templates/MastheadShellTemplate.lit.js.map +1 -1
- package/dist/generated/templates/SearchableListBaseTemplate.lit.js +1 -1
- package/dist/generated/templates/SearchableListBaseTemplate.lit.js.map +1 -1
- package/dist/generated/templates/SelectBoxTemplate.lit.js +1 -1
- package/dist/generated/templates/SelectBoxTemplate.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/MastheadCountrySelector.css.js +1 -1
- package/dist/generated/themes/MastheadCountrySelector.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/MastheadMenuItem.css.js +1 -1
- package/dist/generated/themes/MastheadMenuItem.css.js.map +1 -1
- package/dist/generated/themes/MastheadMobileMenu.css.js +1 -1
- package/dist/generated/themes/MastheadMobileMenu.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/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/SearchSuggestions.css.js +1 -1
- package/dist/generated/themes/SearchSuggestions.css.js.map +1 -1
- package/dist/generated/themes/SearchableList.css.js +1 -1
- package/dist/generated/themes/SearchableList.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/i18n/messagebundle.properties +3 -0
- package/dist/i18n/messagebundle_en.properties +1 -0
- package/dist/vscode.html-custom-data.json +1 -1
- package/dist/web-types.json +10 -2
- package/package.json +1 -1
- package/src/Accordion.hbs +1 -0
- package/src/Accordion.ts +26 -18
- package/src/AccordionItem.ts +19 -6
- package/src/CountrySelector.ts +8 -9
- package/src/MastheadCountrySelector.hbs +5 -9
- package/src/MastheadCountrySelector.ts +22 -0
- package/src/MastheadMenu.hbs +3 -3
- package/src/MastheadMenu.ts +10 -3
- package/src/MastheadMobileMenu.hbs +35 -22
- package/src/MastheadMobileMenu.ts +7 -3
- package/src/MastheadShell.hbs +5 -5
- package/src/MastheadShell.ts +66 -14
- package/src/Search.ts +3 -3
- package/src/SearchableListBase.hbs +6 -0
- package/src/SearchableListBase.ts +25 -2
- package/src/SelectBox.hbs +1 -0
- package/src/generated/i18n/i18n-defaults.ts +2 -2
- package/src/generated/templates/AccordionTemplate.lit.ts +1 -1
- package/src/generated/templates/MastheadCountrySelectorTemplate.lit.ts +3 -3
- package/src/generated/templates/MastheadMenuTemplate.lit.ts +3 -3
- package/src/generated/templates/MastheadMobileMenuTemplate.lit.ts +12 -10
- package/src/generated/templates/MastheadShellTemplate.lit.ts +1 -1
- package/src/generated/templates/SearchableListBaseTemplate.lit.ts +1 -1
- package/src/generated/templates/SelectBoxTemplate.lit.ts +1 -1
- package/src/generated/themes/CountrySelector.css.ts +1 -1
- package/src/generated/themes/MastheadCountrySelector.css.ts +1 -1
- package/src/generated/themes/MastheadItem.css.ts +1 -1
- package/src/generated/themes/MastheadMenuItem.css.ts +1 -1
- package/src/generated/themes/MastheadMobileMenu.css.ts +1 -1
- package/src/generated/themes/MastheadShell.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/SearchSuggestions.css.ts +1 -1
- package/src/generated/themes/SearchableList.css.ts +1 -1
- package/src/generated/themes/Slider.css.ts +1 -1
- package/src/i18n/messagebundle.properties +3 -0
- package/src/i18n/messagebundle_en.properties +1 -0
- package/src/themes/CountrySelector.css +11 -0
- package/src/themes/MastheadCountrySelector.css +11 -0
- package/src/themes/MastheadItem.css +5 -6
- package/src/themes/MastheadMenuItem.css +7 -0
- package/src/themes/MastheadMobileMenu.css +1 -0
- package/src/themes/MastheadShell.css +8 -4
- package/src/themes/Search.css +3 -2
- package/src/themes/SearchSuggestions.css +3 -0
- package/src/themes/SearchableList.css +11 -0
- package/dist/assets/messagebundle_en-d0c2d2d4.js +0 -1
package/src/CountrySelector.ts
CHANGED
|
@@ -427,28 +427,23 @@ class UDExCountrySelector extends UDExSearchableListBase {
|
|
|
427
427
|
this._dropdown.onOpen(this.getInput());
|
|
428
428
|
this._search.focus();
|
|
429
429
|
this._search.value = key;
|
|
430
|
-
this.
|
|
430
|
+
this.fireChangeSearch();
|
|
431
431
|
}
|
|
432
432
|
|
|
433
433
|
handleInputMouseDown(e: CustomEvent): void {
|
|
434
434
|
e.preventDefault();
|
|
435
435
|
}
|
|
436
436
|
|
|
437
|
-
onValueSearch(searchValue: string) {
|
|
438
|
-
this._shouldFilterItems = true;
|
|
439
|
-
this._filteredItems = this.filterItems(this.getProcessedItems(), searchValue);
|
|
440
|
-
this.fireEvent("change-search", { value: searchValue });
|
|
441
|
-
}
|
|
442
|
-
|
|
443
437
|
handleTriggerClick() {
|
|
444
438
|
this._dropdown.open = !this._dropdown.open;
|
|
445
439
|
}
|
|
446
440
|
|
|
447
441
|
handleValueSearch(e:CustomEvent) {
|
|
448
|
-
this.
|
|
442
|
+
this.onSearch(e);
|
|
443
|
+
this.fireChangeSearch();
|
|
449
444
|
}
|
|
450
445
|
|
|
451
|
-
handleSubmitSearch() {
|
|
446
|
+
handleSubmitSearch(): void {
|
|
452
447
|
this.onSubmitSearch();
|
|
453
448
|
}
|
|
454
449
|
|
|
@@ -491,6 +486,10 @@ class UDExCountrySelector extends UDExSearchableListBase {
|
|
|
491
486
|
});
|
|
492
487
|
}
|
|
493
488
|
|
|
489
|
+
fireChangeSearch(): void {
|
|
490
|
+
this.fireEvent("change-search", { value: this._search.value });
|
|
491
|
+
}
|
|
492
|
+
|
|
494
493
|
getSearch(): Search {
|
|
495
494
|
return this.shadowRoot!.querySelector<Search>("[udex-search]")!;
|
|
496
495
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
<div class="udex-masthead-country-selector" @keydown="{{handleKeyDown}}">
|
|
2
2
|
{{#if _isActiveRegionOpen}}
|
|
3
|
-
<span class="udex-masthead-country-selector__title">
|
|
4
|
-
{{countryTitle}}
|
|
5
|
-
</span>
|
|
3
|
+
<span class="udex-masthead-country-selector__title">{{countryTitle}}</span>
|
|
6
4
|
{{#unless this.isSingleMode}}
|
|
7
5
|
<udex-masthead-menu-item
|
|
8
6
|
class="udex-masthead-country-selector__region-back-item"
|
|
@@ -25,9 +23,10 @@
|
|
|
25
23
|
non-interactive-submit-button
|
|
26
24
|
show-submit-button>
|
|
27
25
|
</udex-search>
|
|
26
|
+
<span aria-live="polite" aria-atomic="true" class="hidden">{{_accSearchResultInfo}}</span>
|
|
28
27
|
<ul class="udex-masthead-country-selector__list udex-masthead-country-selector__list_countries" role="menu">
|
|
29
28
|
{{#each _activeCountries}}
|
|
30
|
-
<li role="
|
|
29
|
+
<li role="none">
|
|
31
30
|
<udex-masthead-menu-item
|
|
32
31
|
class="udex-masthead-country-selector__item udex-masthead-country-selector__item_countries"
|
|
33
32
|
@click="{{../fireEventCountryItemClick}}"
|
|
@@ -41,19 +40,16 @@
|
|
|
41
40
|
{{/each}}
|
|
42
41
|
</ul>
|
|
43
42
|
{{else}}
|
|
44
|
-
<span class="udex-masthead-country-selector__title">
|
|
45
|
-
{{regionTitle}}
|
|
46
|
-
</span>
|
|
43
|
+
<span class="udex-masthead-country-selector__title">{{regionTitle}}</span>
|
|
47
44
|
<ul class="udex-masthead-country-selector__list" role="menu">
|
|
48
45
|
{{#each regionsData}}
|
|
49
|
-
<li role="
|
|
46
|
+
<li role="none">
|
|
50
47
|
<udex-masthead-menu-item
|
|
51
48
|
id="{{this._id}}"
|
|
52
49
|
@click="{{../handleRegionClick}}"
|
|
53
50
|
index="{{@index}}"
|
|
54
51
|
class="udex-masthead-country-selector__item udex-masthead-country-selector__item_region"
|
|
55
52
|
aria-has-popup="true"
|
|
56
|
-
accessible-role="button"
|
|
57
53
|
type="Button"
|
|
58
54
|
is-nav-item
|
|
59
55
|
has-border
|
|
@@ -4,6 +4,8 @@ import property from "@ui5/webcomponents-base/dist/decorators/property.js";
|
|
|
4
4
|
import litRender from "@ui5/webcomponents-base/dist/renderer/LitRenderer.js";
|
|
5
5
|
import event from "@ui5/webcomponents-base/dist/decorators/event.js";
|
|
6
6
|
import UI5Icon from "@ui5/webcomponents/dist/Icon.js";
|
|
7
|
+
import { getI18nBundle } from "@ui5/webcomponents-base/dist/i18nBundle.js";
|
|
8
|
+
import type I18nBundle from "@ui5/webcomponents-base/dist/i18nBundle.js";
|
|
7
9
|
import { isDesktop } from "@ui5/webcomponents-base/dist/Device.js";
|
|
8
10
|
import "@ui5/webcomponents-icons/dist/slim-arrow-right.js";
|
|
9
11
|
import {
|
|
@@ -15,6 +17,7 @@ import MastheadCountrySelectorTemplate from "./generated/templates/MastheadCount
|
|
|
15
17
|
import AnalyticsName from "./types/AnalyticsName.js";
|
|
16
18
|
import { BreakpointUtils } from "./utils/Breakpoints.js";
|
|
17
19
|
import type UDExMastheadShell from "./MastheadShell.js";
|
|
20
|
+
import { NO_MATCHES_FOUND, RESULT_RETURNED } from "./generated/i18n/i18n-defaults.js";
|
|
18
21
|
|
|
19
22
|
// Styles
|
|
20
23
|
import MastheadCountrySelectorCss from "./generated/themes/MastheadCountrySelector.css.js";
|
|
@@ -227,8 +230,15 @@ class UDExMastheadCountrySelector extends UI5Element {
|
|
|
227
230
|
_activeCountries!: Array<Country>;
|
|
228
231
|
_shouldFocusBackBtn!: boolean;
|
|
229
232
|
_shouldFocusRegionByIndex!: boolean;
|
|
233
|
+
_accSearchResultInfo?: string;
|
|
230
234
|
_activeRegionIndex!: number;
|
|
231
235
|
|
|
236
|
+
static i18nBundle: I18nBundle;
|
|
237
|
+
|
|
238
|
+
static async onDefine() {
|
|
239
|
+
UDExMastheadCountrySelector.i18nBundle = await getI18nBundle("@sapudex/web-components");
|
|
240
|
+
}
|
|
241
|
+
|
|
232
242
|
constructor() {
|
|
233
243
|
super();
|
|
234
244
|
this._activeCountries = [];
|
|
@@ -325,6 +335,10 @@ class UDExMastheadCountrySelector extends UI5Element {
|
|
|
325
335
|
this.setActiveCountries(this._activeRegion.countries.filter(country => country.displayTitle.toLowerCase().includes(searchTerm)));
|
|
326
336
|
}
|
|
327
337
|
|
|
338
|
+
this._accSearchResultInfo = this._activeCountries.length
|
|
339
|
+
? `${this._activeCountries.length} ${this.resultReturnedText}`
|
|
340
|
+
: this.noMatchesFoundText;
|
|
341
|
+
|
|
328
342
|
this._shouldFocusBackBtn = false;
|
|
329
343
|
this.fireEvent<SearchEventDetail>("country-selector-search", {
|
|
330
344
|
value: e.detail.value,
|
|
@@ -502,6 +516,14 @@ class UDExMastheadCountrySelector extends UI5Element {
|
|
|
502
516
|
});
|
|
503
517
|
}
|
|
504
518
|
|
|
519
|
+
get noMatchesFoundText(): string {
|
|
520
|
+
return UDExMastheadCountrySelector.i18nBundle.getText(NO_MATCHES_FOUND);
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
get resultReturnedText(): string {
|
|
524
|
+
return UDExMastheadCountrySelector.i18nBundle.getText(RESULT_RETURNED);
|
|
525
|
+
}
|
|
526
|
+
|
|
505
527
|
get items(): Array<UDExMastheadMenuItem> {
|
|
506
528
|
const items = this.shadowRoot?.querySelectorAll<UDExMastheadMenuItem>(".udex-masthead-country-selector__item");
|
|
507
529
|
return items ? Array.from(items) : [];
|
package/src/MastheadMenu.hbs
CHANGED
|
@@ -40,7 +40,9 @@
|
|
|
40
40
|
category="{{this.category}}">
|
|
41
41
|
{{#each this.items}}
|
|
42
42
|
<li>
|
|
43
|
-
{{#if this.
|
|
43
|
+
{{#if this.isDivider}}
|
|
44
|
+
<udex-divider class="udex-masthead-menu__item-divider"></udex-divider>
|
|
45
|
+
{{else}}
|
|
44
46
|
<udex-masthead-menu-item
|
|
45
47
|
@click="{{../../../handleMenuItemClick}}"
|
|
46
48
|
badge="{{this.badge}}"
|
|
@@ -48,8 +50,6 @@
|
|
|
48
50
|
url="{{this.url}}"
|
|
49
51
|
label="{{this.title}}">
|
|
50
52
|
</udex-masthead-menu-item>
|
|
51
|
-
{{else}}
|
|
52
|
-
<udex-divider class="udex-masthead-menu__item-divider"></udex-divider>
|
|
53
53
|
{{/if}}
|
|
54
54
|
</li>
|
|
55
55
|
{{/each}}
|
package/src/MastheadMenu.ts
CHANGED
|
@@ -23,6 +23,7 @@ export type Item = {
|
|
|
23
23
|
title: string;
|
|
24
24
|
url: string;
|
|
25
25
|
externalLink: boolean;
|
|
26
|
+
isDivider?: boolean;
|
|
26
27
|
};
|
|
27
28
|
|
|
28
29
|
export type SubMenuLinkItem = {
|
|
@@ -199,10 +200,16 @@ class UDExMastheadMenu extends UI5Element {
|
|
|
199
200
|
get itemsList(): Array<MenuItem> {
|
|
200
201
|
let id = 1;
|
|
201
202
|
const parsedItems: Array<MenuItem> = this.parseArrayFromString(this.subItems);
|
|
203
|
+
|
|
202
204
|
return parsedItems.map((mainItem: MenuItem) => {
|
|
203
|
-
mainItem.subMenuLinkItems = mainItem.subMenuLinkItems.map((
|
|
204
|
-
|
|
205
|
-
|
|
205
|
+
mainItem.subMenuLinkItems = mainItem.subMenuLinkItems.map((subMenu: SubMenuLinkItem) => {
|
|
206
|
+
subMenu.categoryId = `${id++}`;
|
|
207
|
+
subMenu.items = subMenu.items.map((item: Item) => ({
|
|
208
|
+
...item,
|
|
209
|
+
...(item.title === "-" && { isDivider: true }),
|
|
210
|
+
}));
|
|
211
|
+
|
|
212
|
+
return subMenu;
|
|
206
213
|
});
|
|
207
214
|
|
|
208
215
|
return mainItem;
|
|
@@ -122,33 +122,46 @@
|
|
|
122
122
|
</li>
|
|
123
123
|
{{/if}}
|
|
124
124
|
{{#each _categories}}
|
|
125
|
-
{{#if this.
|
|
126
|
-
|
|
127
|
-
<udex-masthead-menu-item
|
|
128
|
-
@click="{{../handleMenuCategoryClick}}"
|
|
129
|
-
url="{{this.url}}"
|
|
130
|
-
id="{{@index}}"
|
|
131
|
-
label="{{this.category}}"
|
|
132
|
-
aria-has-popup="true"
|
|
133
|
-
type="Button"
|
|
134
|
-
second-level
|
|
135
|
-
second-level-btn
|
|
136
|
-
has-border
|
|
137
|
-
icon-end>
|
|
138
|
-
</udex-masthead-menu-item>
|
|
139
|
-
</li>
|
|
140
|
-
{{else}}
|
|
141
|
-
{{#each this.items}}
|
|
125
|
+
{{#if this.items}}
|
|
126
|
+
{{#if this.category}}
|
|
142
127
|
<li class="udex-masthead-mobile-menu__list-item" role="none">
|
|
143
128
|
<udex-masthead-menu-item
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
129
|
+
part="menu-item"
|
|
130
|
+
@click="{{../handleMenuCategoryClick}}"
|
|
131
|
+
id="{{@index}}"
|
|
132
|
+
label="{{this.category}}"
|
|
133
|
+
aria-has-popup="true"
|
|
134
|
+
type="Button"
|
|
135
|
+
second-level-btn
|
|
147
136
|
second-level
|
|
148
|
-
has-border
|
|
137
|
+
has-border
|
|
138
|
+
icon-end>
|
|
149
139
|
</udex-masthead-menu-item>
|
|
150
140
|
</li>
|
|
151
|
-
{{
|
|
141
|
+
{{else}}
|
|
142
|
+
{{#each this.items}}
|
|
143
|
+
<li class="udex-masthead-mobile-menu__list-item" role="none">
|
|
144
|
+
<udex-masthead-menu-item
|
|
145
|
+
part="menu-item"
|
|
146
|
+
@click="{{../handleMobileItemEvent}}"
|
|
147
|
+
url="{{this.url}}"
|
|
148
|
+
label="{{this.title}}"
|
|
149
|
+
second-level
|
|
150
|
+
has-border>
|
|
151
|
+
</udex-masthead-menu-item>
|
|
152
|
+
</li>
|
|
153
|
+
{{/each}}
|
|
154
|
+
{{/if}}
|
|
155
|
+
{{else}}
|
|
156
|
+
<udex-masthead-menu-item
|
|
157
|
+
id="{{@index}}"
|
|
158
|
+
@click="{{../handleMobileItemEvent}}"
|
|
159
|
+
label="{{this.category}}"
|
|
160
|
+
part="menu-item"
|
|
161
|
+
type="Button"
|
|
162
|
+
second-level
|
|
163
|
+
has-border>
|
|
164
|
+
</udex-masthead-menu-item>
|
|
152
165
|
{{/if}}
|
|
153
166
|
{{/each}}
|
|
154
167
|
{{/inline}}
|
|
@@ -18,6 +18,9 @@ import AnalyticsName from "./types/AnalyticsName.js";
|
|
|
18
18
|
// Styles
|
|
19
19
|
import MastheadMobileMenuCss from "./generated/themes/MastheadMobileMenu.css.js";
|
|
20
20
|
|
|
21
|
+
const INDEX_OFFSET_WITH_OVERVIEW = 2;
|
|
22
|
+
const INDEX_OFFSET_WITHOUT_OVERVIEW = 1;
|
|
23
|
+
|
|
21
24
|
export type MobileItemClickEventDetail = {
|
|
22
25
|
category?: string,
|
|
23
26
|
isBack: boolean,
|
|
@@ -202,7 +205,7 @@ class UDExMastheadMobileMenu extends UI5Element {
|
|
|
202
205
|
handleBackToCategories(e: Event) {
|
|
203
206
|
e.stopPropagation();
|
|
204
207
|
this.showCategories();
|
|
205
|
-
this.setFocusItemByIndex(this._category.index
|
|
208
|
+
this.setFocusItemByIndex(this._category.index);
|
|
206
209
|
this.fireMobileItemEvent(e);
|
|
207
210
|
}
|
|
208
211
|
|
|
@@ -311,7 +314,7 @@ class UDExMastheadMobileMenu extends UI5Element {
|
|
|
311
314
|
|
|
312
315
|
if (target.hasAttribute("is-back-to-categories")) {
|
|
313
316
|
this.showCategories();
|
|
314
|
-
this.setFocusItemByIndex(this._category.index
|
|
317
|
+
this.setFocusItemByIndex(this._category.index);
|
|
315
318
|
this.fireMobileItemEvent(e);
|
|
316
319
|
}
|
|
317
320
|
|
|
@@ -431,8 +434,9 @@ class UDExMastheadMobileMenu extends UI5Element {
|
|
|
431
434
|
|
|
432
435
|
openCategoryItems(e: Event) {
|
|
433
436
|
const item = e.target as UDExMastheadMenuItem;
|
|
437
|
+
const indexOffset = this._clickedItem.href ? INDEX_OFFSET_WITH_OVERVIEW : INDEX_OFFSET_WITHOUT_OVERVIEW;
|
|
434
438
|
const index = Number(item.getAttribute("id"));
|
|
435
|
-
this._category = { ...this._categories[index], index };
|
|
439
|
+
this._category = { ...this._categories[index], index: index + indexOffset };
|
|
436
440
|
this._showCategories = false;
|
|
437
441
|
this._showCategoryItems = true;
|
|
438
442
|
}
|
package/src/MastheadShell.hbs
CHANGED
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
{{/if}}
|
|
48
48
|
{{/if}}
|
|
49
49
|
|
|
50
|
-
<div class="
|
|
50
|
+
<div class="{{rightMenuClass}}">
|
|
51
51
|
{{#if hasMobileMenuButtons}}
|
|
52
52
|
<udex-masthead-item
|
|
53
53
|
@ui5-item-click="{{handleOpenMobileMenu}}"
|
|
@@ -69,10 +69,10 @@
|
|
|
69
69
|
{{#if hasSearch}}
|
|
70
70
|
<div class="udex-masthead-shell__search-icon udex-masthead-shell__item_icon">
|
|
71
71
|
<udex-masthead-item
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
class="udex-masthead-shell__search-btn"
|
|
73
|
+
icon="search"
|
|
74
|
+
@click="{{handleSearchClick}}"
|
|
75
|
+
accessible-name="search">
|
|
76
76
|
</udex-masthead-item>
|
|
77
77
|
</div>
|
|
78
78
|
{{/if}}
|
package/src/MastheadShell.ts
CHANGED
|
@@ -47,6 +47,17 @@ export const AnalyticsNameEventDetail = {
|
|
|
47
47
|
},
|
|
48
48
|
};
|
|
49
49
|
|
|
50
|
+
export enum UDExMastheadVariable {
|
|
51
|
+
mobileMenuHeight = "--udex-masthead-shell-mobile-menu-height",
|
|
52
|
+
itemButtonIconSize = "--udex-masthead-item-button-icon-size",
|
|
53
|
+
itemArrowIconSize = "--udex-masthead-item-arrow-icon-size",
|
|
54
|
+
rightMenuPadding = "--udex-masthead-right-menu-padding",
|
|
55
|
+
exploreMargin = "--udex-masthead-shell-explore-margin",
|
|
56
|
+
itemIconGap = "--udex-masthead-shell-item-icon-gap",
|
|
57
|
+
mastheadHeight = "--udex-masthead-shell-height",
|
|
58
|
+
itemGap = "--udex-masthead-shell-item-gap",
|
|
59
|
+
}
|
|
60
|
+
|
|
50
61
|
/**
|
|
51
62
|
* @class
|
|
52
63
|
*
|
|
@@ -367,6 +378,9 @@ class UDExMastheadShell extends UI5Element {
|
|
|
367
378
|
@property({ type: Boolean })
|
|
368
379
|
_closeBtnClicked!: boolean;
|
|
369
380
|
|
|
381
|
+
@property({ type: Boolean })
|
|
382
|
+
_isVisible!: boolean;
|
|
383
|
+
|
|
370
384
|
_searchOpener!: UDExMastheadItem | null | undefined;
|
|
371
385
|
_mobileMenu!: UDExMastheadMobileMenu | null | undefined;
|
|
372
386
|
_handleResizeBound: ResizeObserverCallback;
|
|
@@ -402,6 +416,8 @@ class UDExMastheadShell extends UI5Element {
|
|
|
402
416
|
if (this._closeBtnClicked) {
|
|
403
417
|
this.focusSearchBtn();
|
|
404
418
|
}
|
|
419
|
+
|
|
420
|
+
this.updateVisibility();
|
|
405
421
|
}
|
|
406
422
|
|
|
407
423
|
onEnterDOM(): void {
|
|
@@ -451,6 +467,8 @@ class UDExMastheadShell extends UI5Element {
|
|
|
451
467
|
} else {
|
|
452
468
|
this.removeMobileMode();
|
|
453
469
|
}
|
|
470
|
+
|
|
471
|
+
this._isVisible = true;
|
|
454
472
|
}
|
|
455
473
|
}
|
|
456
474
|
|
|
@@ -642,26 +660,42 @@ class UDExMastheadShell extends UI5Element {
|
|
|
642
660
|
const itemsIcon = [...this.shadowRoot!.querySelectorAll<HTMLDivElement>(".udex-masthead-shell__item_icon")];
|
|
643
661
|
const itemIconWidths = itemsIcon.length * this.getItemIconWidth();
|
|
644
662
|
const itemIconGaps = itemsIcon.length * this.getItemIconGap();
|
|
645
|
-
const
|
|
663
|
+
const exploreItem = this.exploreSAP[0];
|
|
664
|
+
const hasArrowIcon = exploreItem?.hasArrowDown && !exploreItem?.hideArrowIcon;
|
|
665
|
+
const exploreItemIconWidth = hasArrowIcon ? this.getItemArrowIconWidth() : 0;
|
|
666
|
+
const exploreSAPWidth = this.hasExploreSAP ? this.getItemWidth(exploreItem) : 0;
|
|
646
667
|
const rightMenuGaps = this.getRightMenuGap() + this.getExploreSapBtnGap() + itemIconGaps;
|
|
647
|
-
return exploreSAPWidth + itemIconWidths + rightMenuGaps;
|
|
668
|
+
return exploreSAPWidth + exploreItemIconWidth + itemIconWidths + rightMenuGaps;
|
|
648
669
|
}
|
|
649
670
|
|
|
650
|
-
|
|
671
|
+
getItemIconSize(cssVariableName: string): number {
|
|
651
672
|
const item = this.querySelector("[udex-masthead-item]");
|
|
652
673
|
|
|
653
|
-
if (!item) {
|
|
674
|
+
if (!item) {
|
|
675
|
+
return 0;
|
|
676
|
+
}
|
|
654
677
|
|
|
655
678
|
const style = window.getComputedStyle(item);
|
|
656
|
-
const
|
|
657
|
-
return parseInt(
|
|
679
|
+
const iconSizeVar = style.getPropertyValue(cssVariableName);
|
|
680
|
+
return parseInt(iconSizeVar);
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
getItemIconWidth(): number {
|
|
684
|
+
return this.getItemIconSize(UDExMastheadVariable.itemButtonIconSize);
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
getItemArrowIconWidth(): number {
|
|
688
|
+
return this.getItemIconSize(UDExMastheadVariable.itemArrowIconSize);
|
|
658
689
|
}
|
|
659
690
|
|
|
660
691
|
getMainMenuWidth(): number {
|
|
661
692
|
const mainItems = this.getSlottedNodes("menuItems");
|
|
662
|
-
const gapItemVar = this.getRootVar(
|
|
693
|
+
const gapItemVar = this.getRootVar(UDExMastheadVariable.itemGap);
|
|
663
694
|
return mainItems.reduce((accumulatedWidth, item, index) => {
|
|
664
|
-
|
|
695
|
+
const mainItem = item as UDExMastheadItem;
|
|
696
|
+
const hasArrowIcon = mainItem.hasArrowDown && !mainItem.hideArrowIcon;
|
|
697
|
+
const arrowIconWidth = hasArrowIcon ? this.getItemArrowIconWidth() : 0;
|
|
698
|
+
return accumulatedWidth + this.getItemWidth(mainItem) + (index && parseInt(gapItemVar) + arrowIconWidth);
|
|
665
699
|
}, 0);
|
|
666
700
|
}
|
|
667
701
|
|
|
@@ -681,17 +715,17 @@ class UDExMastheadShell extends UI5Element {
|
|
|
681
715
|
}
|
|
682
716
|
|
|
683
717
|
getItemIconGap(): number {
|
|
684
|
-
const gapIconItemVar = this.getRootVar(
|
|
718
|
+
const gapIconItemVar = this.getRootVar(UDExMastheadVariable.itemIconGap);
|
|
685
719
|
return parseInt(gapIconItemVar);
|
|
686
720
|
}
|
|
687
721
|
|
|
688
722
|
getExploreSapBtnGap(): number {
|
|
689
|
-
const exploreSapBtnGapVar = this.getRootVar(
|
|
723
|
+
const exploreSapBtnGapVar = this.getRootVar(UDExMastheadVariable.exploreMargin);
|
|
690
724
|
return this.hasExploreSAP ? parseInt(exploreSapBtnGapVar) : 0;
|
|
691
725
|
}
|
|
692
726
|
|
|
693
727
|
getRightMenuGap(): number {
|
|
694
|
-
const rightMenuGapVar = this.getRootVar(
|
|
728
|
+
const rightMenuGapVar = this.getRootVar(UDExMastheadVariable.rightMenuPadding);
|
|
695
729
|
return parseInt(rightMenuGapVar);
|
|
696
730
|
}
|
|
697
731
|
|
|
@@ -724,9 +758,9 @@ class UDExMastheadShell extends UI5Element {
|
|
|
724
758
|
}
|
|
725
759
|
|
|
726
760
|
setMobileMenuHeight(): void {
|
|
727
|
-
const mastheadHeight = parseInt(window.getComputedStyle(this).getPropertyValue(
|
|
761
|
+
const mastheadHeight = parseInt(window.getComputedStyle(this).getPropertyValue(UDExMastheadVariable.mastheadHeight));
|
|
728
762
|
const mobileMenuHeight = `${window.innerHeight - mastheadHeight}px`;
|
|
729
|
-
this.style.setProperty(
|
|
763
|
+
this.style.setProperty(UDExMastheadVariable.mobileMenuHeight, mobileMenuHeight);
|
|
730
764
|
}
|
|
731
765
|
|
|
732
766
|
removeMobileMode(): void {
|
|
@@ -736,6 +770,10 @@ class UDExMastheadShell extends UI5Element {
|
|
|
736
770
|
});
|
|
737
771
|
}
|
|
738
772
|
|
|
773
|
+
updateVisibility(): void {
|
|
774
|
+
this.style.opacity = this.isVisible ? "1" : "0";
|
|
775
|
+
}
|
|
776
|
+
|
|
739
777
|
/**
|
|
740
778
|
* Close the search panel.
|
|
741
779
|
* @public
|
|
@@ -911,7 +949,7 @@ class UDExMastheadShell extends UI5Element {
|
|
|
911
949
|
}
|
|
912
950
|
|
|
913
951
|
get isMainMenuVisible(): boolean {
|
|
914
|
-
return !this.showSearchByDefault && !this._isSearchOpened;
|
|
952
|
+
return !this.showSearchByDefault && !this._isSearchOpened && !!this.menuItems.length;
|
|
915
953
|
}
|
|
916
954
|
|
|
917
955
|
get isSearchVisible(): boolean {
|
|
@@ -925,6 +963,20 @@ class UDExMastheadShell extends UI5Element {
|
|
|
925
963
|
get mainNavigationAriaLabel(): string {
|
|
926
964
|
return UDExMastheadShell.i18nBundle.getText(MAIN_LINKS);
|
|
927
965
|
}
|
|
966
|
+
|
|
967
|
+
get isVisible(): boolean {
|
|
968
|
+
return this.isMobileMenuMode || !this.menuItems.length || this._isVisible;
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
get isSimpleExploreMode(): boolean {
|
|
972
|
+
return !this.hasSearch && !this.hasProfile && !this.hasCart && !this.hasSupport && !this.hasCountrySelector;
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
get rightMenuClass(): string {
|
|
976
|
+
const root = "udex-masthead-shell__right-menu";
|
|
977
|
+
const simpleExploreClass = this.isSimpleExploreMode ? `${root}_simple-explore` : "";
|
|
978
|
+
return `${root} ${simpleExploreClass}`.trim();
|
|
979
|
+
}
|
|
928
980
|
}
|
|
929
981
|
|
|
930
982
|
UDExMastheadShell.define();
|
package/src/Search.ts
CHANGED
|
@@ -19,7 +19,6 @@ import {
|
|
|
19
19
|
isSpace,
|
|
20
20
|
} from "@ui5/webcomponents-base/dist/Keys.js";
|
|
21
21
|
import { isDesktop } from "@ui5/webcomponents-base/dist/Device.js";
|
|
22
|
-
import Button from "@ui5/webcomponents/dist/Button.js";
|
|
23
22
|
import Icon from "@ui5/webcomponents/dist/Icon.js";
|
|
24
23
|
import List from "./List.js";
|
|
25
24
|
import ControlButton from "./ControlButton.js";
|
|
@@ -42,6 +41,8 @@ import {
|
|
|
42
41
|
OF,
|
|
43
42
|
} from "./generated/i18n/i18n-defaults.js";
|
|
44
43
|
import type SearchInputSuggestion from "./features/SearchSuggestionsPopover.js";
|
|
44
|
+
import retryUntilSuccessful from "./utils/retryUntilSuccessful.js";
|
|
45
|
+
import UDExButton from "./Button.js";
|
|
45
46
|
|
|
46
47
|
import SearchTemplate from "./generated/templates/SearchTemplate.lit.js";
|
|
47
48
|
import SearchSuggestionsTemplate from "./generated/templates/SearchSuggestionsTemplate.lit.js";
|
|
@@ -49,7 +50,6 @@ import SearchSuggestionsTemplate from "./generated/templates/SearchSuggestionsTe
|
|
|
49
50
|
// Styles
|
|
50
51
|
import SearchCss from "./generated/themes/Search.css.js";
|
|
51
52
|
import SearchSuggestionsCss from "./generated/themes/SearchSuggestions.css.js";
|
|
52
|
-
import retryUntilSuccessful from "./utils/retryUntilSuccessful.js";
|
|
53
53
|
|
|
54
54
|
const SearchIcon: string = "sap-icon://search";
|
|
55
55
|
|
|
@@ -122,7 +122,7 @@ export type PopoverPlacement = "Bottom" | "Top";
|
|
|
122
122
|
staticAreaTemplate: SearchSuggestionsTemplate,
|
|
123
123
|
get dependencies() {
|
|
124
124
|
const Suggestion = getFeature<typeof SearchInputSuggestion>("SearchInputSuggestion");
|
|
125
|
-
return ([ControlButton,
|
|
125
|
+
return ([ControlButton, UDExButton, Icon, List, Popover] as Array<typeof UI5Element>).concat(Suggestion ? [...Suggestion.dependencies] : []);
|
|
126
126
|
},
|
|
127
127
|
})
|
|
128
128
|
|
|
@@ -8,6 +8,12 @@
|
|
|
8
8
|
non-interactive-submit-button
|
|
9
9
|
show-submit-button>
|
|
10
10
|
</udex-search>
|
|
11
|
+
<span
|
|
12
|
+
aria-live="polite"
|
|
13
|
+
aria-atomic="true"
|
|
14
|
+
class="hidden">
|
|
15
|
+
{{_accSearchResultInfo}}
|
|
16
|
+
</span>
|
|
11
17
|
{{/if}}
|
|
12
18
|
{{#if isListEmpty}}
|
|
13
19
|
<div class="udex-no-result"><span>{{getNoResultText}}‎</span></div>
|
|
@@ -15,7 +15,7 @@ import UDExListGroupHeaderBase from "./ListGroupHeaderBase.js";
|
|
|
15
15
|
import { ListMode } from "./types/List.js";
|
|
16
16
|
import UDExFilterMenuItem from "./FilterMenuItem.js";
|
|
17
17
|
import { ProcessedItem, SHOW_SEARCH_AFTER_COUNT } from "./types/SearchableListBase.js";
|
|
18
|
-
import { NO_MATCHES_FOUND } from "./generated/i18n/i18n-defaults.js";
|
|
18
|
+
import { NO_MATCHES_FOUND, RESULT_RETURNED } from "./generated/i18n/i18n-defaults.js";
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* @class
|
|
@@ -177,6 +177,7 @@ class UDExSearchableListBase extends UI5Element {
|
|
|
177
177
|
_filteredItems!: Array<ProcessedItem>;
|
|
178
178
|
|
|
179
179
|
_shouldFilterItems?: boolean;
|
|
180
|
+
_accSearchResultInfo?: string;
|
|
180
181
|
|
|
181
182
|
static i18nBundle: I18nBundle;
|
|
182
183
|
|
|
@@ -274,6 +275,8 @@ class UDExSearchableListBase extends UI5Element {
|
|
|
274
275
|
const searchValue: string = e.detail.value;
|
|
275
276
|
this._shouldFilterItems = true;
|
|
276
277
|
this._filteredItems = this.filterItems(this.getProcessedItems(), searchValue);
|
|
278
|
+
const items = this.getFlattenItemsArray(this._filteredItems);
|
|
279
|
+
this._accSearchResultInfo = items.length ? `${items.length} ${this.resultReturnedText}` : this.noMatchesFoundText;
|
|
277
280
|
this.fireEvent("change-search", { value: searchValue });
|
|
278
281
|
}
|
|
279
282
|
|
|
@@ -430,6 +433,18 @@ class UDExSearchableListBase extends UI5Element {
|
|
|
430
433
|
}
|
|
431
434
|
}
|
|
432
435
|
|
|
436
|
+
getFlattenItemsArray(array: Array<ProcessedItem>): (ProcessedItem | UDExListItemBase)[] {
|
|
437
|
+
return array.flatMap(item => {
|
|
438
|
+
if (item.isGroup) {
|
|
439
|
+
return [
|
|
440
|
+
item,
|
|
441
|
+
...item.groupItems.filter(groupItem => !groupItem.disabled),
|
|
442
|
+
];
|
|
443
|
+
}
|
|
444
|
+
return item.item.disabled ? [] : [item.item];
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
|
|
433
448
|
getCurrentIndex(item: Element): number {
|
|
434
449
|
return this.getDomListItems().indexOf(item);
|
|
435
450
|
}
|
|
@@ -472,7 +487,15 @@ class UDExSearchableListBase extends UI5Element {
|
|
|
472
487
|
|
|
473
488
|
get getNoResultText(): string {
|
|
474
489
|
const hasTextProperty = this.noResultText !== "undefined" && this.noResultText.length > 0;
|
|
475
|
-
return hasTextProperty ? this.noResultText :
|
|
490
|
+
return hasTextProperty ? this.noResultText : this.noMatchesFoundText;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
get noMatchesFoundText(): string {
|
|
494
|
+
return UDExSearchableListBase.i18nBundle.getText(NO_MATCHES_FOUND);
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
get resultReturnedText(): string {
|
|
498
|
+
return UDExSearchableListBase.i18nBundle.getText(RESULT_RETURNED);
|
|
476
499
|
}
|
|
477
500
|
|
|
478
501
|
get isListEmpty(): boolean {
|