@sapudex/web-components 2.22.0 → 2.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cypress/specs/CountrySelector.cy.tsx +158 -144
- package/cypress/specs/EventRibbon.cy.tsx +3 -1
- package/cypress/specs/SelectBox.cy.tsx +173 -206
- package/cypress/specs/Tag.cy.tsx +1 -1
- package/cypress/specs/TextField.cy.tsx +15 -0
- package/cypress/specs/Textarea.cy.tsx +15 -33
- package/dist/CountrySelector.d.ts +25 -142
- package/dist/CountrySelector.js +91 -268
- package/dist/CountrySelector.js.map +1 -1
- package/dist/FilterMenu.d.ts +14 -2
- package/dist/FilterMenu.js +11 -1
- package/dist/FilterMenu.js.map +1 -1
- package/dist/List.js +2 -3
- package/dist/List.js.map +1 -1
- package/dist/ListGroupHeaderBase.d.ts +1 -0
- package/dist/ListGroupHeaderBase.js +3 -0
- package/dist/ListGroupHeaderBase.js.map +1 -1
- package/dist/ListItemBase.d.ts +12 -0
- package/dist/ListItemBase.js +17 -2
- package/dist/ListItemBase.js.map +1 -1
- package/dist/MediaPlayer.js +2 -0
- package/dist/MediaPlayer.js.map +1 -1
- package/dist/MediaPlayerTemplate.js +4 -4
- package/dist/MediaPlayerTemplate.js.map +1 -1
- package/dist/SearchableListBase.d.ts +23 -16
- package/dist/SearchableListBase.js +48 -72
- package/dist/SearchableListBase.js.map +1 -1
- package/dist/SelectBase.d.ts +193 -0
- package/dist/SelectBase.js +428 -0
- package/dist/SelectBase.js.map +1 -0
- package/dist/SelectBox.d.ts +30 -152
- package/dist/SelectBox.js +139 -348
- package/dist/SelectBox.js.map +1 -1
- package/dist/TagGroup.d.ts +23 -5
- package/dist/TagGroup.js +37 -16
- package/dist/TagGroup.js.map +1 -1
- package/dist/TagTemplate.js +4 -2
- package/dist/TagTemplate.js.map +1 -1
- package/dist/TextArea.d.ts +1 -1
- package/dist/TextArea.js +5 -5
- package/dist/TextArea.js.map +1 -1
- package/dist/TextAreaTemplate.d.ts +2 -0
- package/dist/TextAreaTemplate.js +13 -0
- package/dist/TextAreaTemplate.js.map +1 -0
- package/dist/TextField.d.ts +29 -4
- package/dist/TextField.js +32 -16
- package/dist/TextField.js.map +1 -1
- package/dist/TextFieldTemplate.d.ts +2 -0
- package/dist/TextFieldTemplate.js +14 -0
- package/dist/TextFieldTemplate.js.map +1 -0
- package/dist/assets/{InputSuggestions-By00xQan.js → InputSuggestions-C8m6N2-d.js} +1 -1
- package/dist/assets/{ListItemStandardExpandableTextTemplate-BGtoxRbA.js → ListItemStandardExpandableTextTemplate-BwD5bYhw.js} +1 -1
- package/dist/assets/{bundle.esm-9yDdQqR5.js → bundle.esm-hGsUwmUy.js} +218 -217
- package/dist/css/themes/CountrySelector.css +1 -1
- package/dist/css/themes/EventRibbon.css +1 -1
- package/dist/css/themes/ListItem.css +1 -1
- package/dist/css/themes/MastheadItem.css +1 -1
- package/dist/css/themes/MastheadMobileMenu.css +1 -1
- package/dist/css/themes/RatingIndicator.css +1 -1
- package/dist/css/themes/Search.css +1 -1
- package/dist/css/themes/SelectBase.css +1 -0
- package/dist/css/themes/SelectBox.css +1 -1
- package/dist/css/themes/Slider.css +1 -1
- package/dist/css/themes/TagGroup.css +1 -1
- package/dist/css/themes/TextField.css +1 -1
- package/dist/custom-elements-internal.json +1088 -1284
- package/dist/custom-elements.json +284 -934
- package/dist/generated/templates/CountrySelectorTemplate.lit.js +3 -3
- package/dist/generated/templates/CountrySelectorTemplate.lit.js.map +1 -1
- package/dist/generated/templates/ListItemTemplate.lit.js +1 -1
- package/dist/generated/templates/ListItemTemplate.lit.js.map +1 -1
- package/dist/generated/templates/SelectBoxTemplate.lit.js +10 -9
- package/dist/generated/templates/SelectBoxTemplate.lit.js.map +1 -1
- package/dist/generated/themes/CountrySelector.css.d.ts +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/EventRibbon.css.d.ts +1 -1
- package/dist/generated/themes/EventRibbon.css.js +1 -1
- package/dist/generated/themes/EventRibbon.css.js.map +1 -1
- package/dist/generated/themes/ListItem.css.d.ts +1 -1
- package/dist/generated/themes/ListItem.css.js +1 -1
- package/dist/generated/themes/ListItem.css.js.map +1 -1
- package/dist/generated/themes/MastheadItem.css.d.ts +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/MastheadMobileMenu.css.d.ts +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/RatingIndicator.css.d.ts +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.d.ts +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/SelectBase.css.d.ts +2 -0
- package/dist/generated/themes/SelectBase.css.js +8 -0
- package/dist/generated/themes/SelectBase.css.js.map +1 -0
- package/dist/generated/themes/SelectBox.css.d.ts +1 -1
- package/dist/generated/themes/SelectBox.css.js +1 -1
- package/dist/generated/themes/SelectBox.css.js.map +1 -1
- package/dist/generated/themes/Slider.css.d.ts +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/TagGroup.css.d.ts +1 -1
- package/dist/generated/themes/TagGroup.css.js +1 -1
- package/dist/generated/themes/TagGroup.css.js.map +1 -1
- package/dist/generated/themes/TextField.css.d.ts +1 -1
- package/dist/generated/themes/TextField.css.js +1 -1
- package/dist/generated/themes/TextField.css.js.map +1 -1
- package/dist/types/common.d.ts +1 -1
- package/dist/types/common.js +1 -1
- package/dist/types/common.js.map +1 -1
- package/dist/vscode.html-custom-data.json +23 -234
- package/dist/web-types.json +256 -811
- package/package.json +1 -1
- package/src/CountrySelector.hbs +6 -61
- package/src/CountrySelector.ts +93 -375
- package/src/FilterMenu.ts +13 -3
- package/src/List.ts +2 -3
- package/src/ListGroupHeaderBase.ts +4 -0
- package/src/ListItem.hbs +0 -1
- package/src/ListItemBase.ts +17 -3
- package/src/MediaPlayer.ts +2 -0
- package/src/MediaPlayerTemplate.tsx +0 -1
- package/src/SearchableListBase.ts +68 -83
- package/src/SelectBase.ts +580 -0
- package/src/SelectBox.hbs +118 -107
- package/src/SelectBox.ts +155 -445
- package/src/TagGroup.ts +53 -19
- package/src/TagTemplate.tsx +4 -2
- package/src/TextArea.ts +5 -5
- package/src/TextAreaTemplate.tsx +67 -0
- package/src/TextField.ts +57 -24
- package/src/TextFieldTemplate.tsx +90 -0
- package/src/generated/templates/CountrySelectorTemplate.lit.ts +2 -2
- package/src/generated/templates/ListItemTemplate.lit.ts +1 -1
- package/src/generated/templates/SelectBoxTemplate.lit.ts +10 -9
- package/src/generated/themes/CountrySelector.css.ts +1 -1
- package/src/generated/themes/EventRibbon.css.ts +1 -1
- package/src/generated/themes/ListItem.css.ts +1 -1
- package/src/generated/themes/MastheadItem.css.ts +1 -1
- package/src/generated/themes/MastheadMobileMenu.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/SelectBase.css.ts +9 -0
- package/src/generated/themes/SelectBox.css.ts +1 -1
- package/src/generated/themes/Slider.css.ts +1 -1
- package/src/generated/themes/TagGroup.css.ts +1 -1
- package/src/generated/themes/TextField.css.ts +1 -1
- package/src/themes/CountrySelector.css +42 -115
- package/src/themes/EventRibbon.css +21 -13
- package/src/themes/ListItem.css +6 -0
- package/src/themes/MastheadItem.css +0 -2
- package/src/themes/MastheadMobileMenu.css +2 -0
- package/src/themes/Search.css +0 -1
- package/src/themes/SelectBase.css +239 -0
- package/src/themes/SelectBox.css +13 -195
- package/src/themes/TagGroup.css +0 -1
- package/src/themes/TextField.css +7 -7
- package/src/types/common.ts +1 -1
- package/dist/generated/templates/TextAreaTemplate.lit.d.ts +0 -3
- package/dist/generated/templates/TextAreaTemplate.lit.js +0 -13
- package/dist/generated/templates/TextAreaTemplate.lit.js.map +0 -1
- package/dist/generated/templates/TextFieldTemplate.lit.d.ts +0 -3
- package/dist/generated/templates/TextFieldTemplate.lit.js +0 -14
- package/dist/generated/templates/TextFieldTemplate.lit.js.map +0 -1
- package/src/TextArea.hbs +0 -54
- package/src/TextField.hbs +0 -78
- package/src/generated/templates/TextAreaTemplate.lit.ts +0 -17
- package/src/generated/templates/TextFieldTemplate.lit.ts +0 -18
package/package.json
CHANGED
package/src/CountrySelector.hbs
CHANGED
|
@@ -1,61 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
height="{{height}}"
|
|
8
|
-
@ui5-item-press="{{handleItemPress}}"
|
|
9
|
-
@ui5-before-open="{{_dropdownBeforeOpen}}"
|
|
10
|
-
@ui5-open="{{_dropdownOpen}}"
|
|
11
|
-
@ui5-before-close="{{_dropdownBeforeClose}}"
|
|
12
|
-
@ui5-close="{{_dropdownClose}}"
|
|
13
|
-
@ui5-submit-search-value="{{handleSubmitSearch}}"
|
|
14
|
-
@ui5-handle-value-search="{{handleValueSearch}}"
|
|
15
|
-
@ui5-handle-value-reset="{{handleResetSearch}}"
|
|
16
|
-
@ui5-search-keydown="{{handleKeyDownSearch}}"
|
|
17
|
-
@keydown="{{handleKeyDownDropdown}}">
|
|
18
|
-
{{searchableList}}
|
|
19
|
-
</udex-dropdown>
|
|
20
|
-
</div>
|
|
21
|
-
|
|
22
|
-
{{#*inline "trigger"}}
|
|
23
|
-
<div
|
|
24
|
-
id="udex-{{this._id}}-country-selector__opener"
|
|
25
|
-
class="{{countrySelectorTriggerClasses}}"
|
|
26
|
-
?disabled="{{isOpenerDisabled}}"
|
|
27
|
-
@click="{{handleTriggerClick}}"
|
|
28
|
-
slot="trigger">
|
|
29
|
-
{{#if showFlagImages}}
|
|
30
|
-
<img
|
|
31
|
-
class="udex-country-selector__image"
|
|
32
|
-
aria-label="{{flagAriaLabel}}"
|
|
33
|
-
style="background-position-x: {{selectedCountryFlagX}}; background-position-y: {{selectedCountryFlagY}}">
|
|
34
|
-
{{/if}}
|
|
35
|
-
<udex-text-field
|
|
36
|
-
label="{{effectiveAriaLabel}}"
|
|
37
|
-
id="udexTextField"
|
|
38
|
-
class="udex-country-selector__text"
|
|
39
|
-
value="{{selectedCountryName}}"
|
|
40
|
-
value-state="{{valueState}}"
|
|
41
|
-
supporting-text="{{supportingText}}"
|
|
42
|
-
direction="left"
|
|
43
|
-
aria-label="{{effectiveAriaLabel}}"
|
|
44
|
-
accessible-name="{{supportingText}}"
|
|
45
|
-
accessible-name-ref="{{accessibleNameRef}}"
|
|
46
|
-
aria-controls="{{ariaControls}}"
|
|
47
|
-
aria-haspopup="true"
|
|
48
|
-
aria-expanded="{{_open}}"
|
|
49
|
-
?required="{{required}}"
|
|
50
|
-
?disabled="{{disabled}}"
|
|
51
|
-
?readonly="{{readonly}}"
|
|
52
|
-
?displayonly="{{displayonly}}"
|
|
53
|
-
@ui5-click-icon="{{handleTriggerClick}}"
|
|
54
|
-
@mousedown="{{handleInputMouseDown}}"
|
|
55
|
-
icon="{{triggerIcon}}"
|
|
56
|
-
accessible-icon-name="{{effectiveAriaLabel}}"
|
|
57
|
-
maxlength="0"
|
|
58
|
-
_is-combobox-role>
|
|
59
|
-
</udex-text-field>
|
|
60
|
-
</div>
|
|
61
|
-
{{/inline}}
|
|
1
|
+
{{#unless hideFlagImages}}
|
|
2
|
+
<img
|
|
3
|
+
class="udex-text-field__image"
|
|
4
|
+
aria-label="{{flagAriaLabel}}"
|
|
5
|
+
style="background-position-x: {{selectedCountryFlagX}}; background-position-y: {{selectedCountryFlagY}}">
|
|
6
|
+
{{/unless}}
|
package/src/CountrySelector.ts
CHANGED
|
@@ -1,33 +1,26 @@
|
|
|
1
1
|
import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js";
|
|
2
2
|
import litRender from "@ui5/webcomponents-base/dist/renderer/LitRenderer.js";
|
|
3
3
|
import property from "@ui5/webcomponents-base/dist/decorators/property.js";
|
|
4
|
-
import
|
|
5
|
-
import { isEscape, isTabPrevious, isTabNext } from "@ui5/webcomponents-base/dist/Keys.js";
|
|
6
|
-
import type Popover from "@ui5/webcomponents/dist/Popover.js";
|
|
7
|
-
import event from "@ui5/webcomponents-base/dist/decorators/event-strict.js";
|
|
8
|
-
import Button from "@ui5/webcomponents/dist/Button.js";
|
|
9
|
-
import type { ResizeObserverCallback } from "@ui5/webcomponents-base/dist/delegate/ResizeHandler.js";
|
|
10
|
-
import ResizeHandler from "@ui5/webcomponents-base/dist/delegate/ResizeHandler.js";
|
|
4
|
+
import UI5Button from "@ui5/webcomponents/dist/Button.js";
|
|
11
5
|
import "@ui5/webcomponents-icons/dist/navigation-down-arrow.js";
|
|
12
6
|
import "@ui5/webcomponents-icons/dist/navigation-up-arrow.js";
|
|
13
7
|
import type { Country } from "./data/CountryListISO3166.js";
|
|
14
8
|
import { CountryListDB } from "./data/CountryListISO3166.js";
|
|
15
|
-
import
|
|
16
|
-
import Search from "./Search.js";
|
|
9
|
+
import UDExSearch from "./Search.js";
|
|
17
10
|
import UDExDropdown from "./Dropdown.js";
|
|
18
11
|
import UDExList from "./List.js";
|
|
19
|
-
import
|
|
12
|
+
import UDExSelectBase from "./SelectBase.js";
|
|
20
13
|
import UDExListItem from "./ListItem.js";
|
|
21
14
|
import UDExTextField from "./TextField.js";
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import type { UDExSearchKeydownEventDetail } from "./Search.js";
|
|
25
|
-
import type { UDExSearchableListBaseEvents } from "./SearchableListBase.js";
|
|
26
|
-
import CountrySelectorTemplate from "./generated/templates/CountrySelectorTemplate.lit.js";
|
|
27
|
-
import SearchableListBaseTemplate from "./generated/templates/SearchableListBaseTemplate.lit.js";
|
|
15
|
+
import UDExStatusMessage from "./StatusMessage.js";
|
|
16
|
+
import SelectBoxTemplate from "./generated/templates/SelectBoxTemplate.lit.js";
|
|
28
17
|
|
|
29
18
|
// Styles
|
|
30
19
|
import CountrySelectorCss from "./generated/themes/CountrySelector.css.js";
|
|
20
|
+
import TextFieldCss from "./generated/themes/TextField.css.js";
|
|
21
|
+
import SelectBaseCss from "./generated/themes/SelectBase.css.js";
|
|
22
|
+
import SearchableListCss from "./generated/themes/SearchableList.css.js";
|
|
23
|
+
import getEffectiveScrollbarStyle from "./utils/getEffectiveScrollbarStyle.js";
|
|
31
24
|
|
|
32
25
|
type UDExCountrySelectorChangeSearchEventDetail = {
|
|
33
26
|
value: string,
|
|
@@ -54,157 +47,26 @@ type UDExCountrySelectorChangeSearchEventDetail = {
|
|
|
54
47
|
@customElement({
|
|
55
48
|
tag: "udex-country-selector",
|
|
56
49
|
renderer: litRender,
|
|
57
|
-
styles:
|
|
58
|
-
|
|
50
|
+
styles: [
|
|
51
|
+
TextFieldCss,
|
|
52
|
+
SelectBaseCss,
|
|
53
|
+
CountrySelectorCss,
|
|
54
|
+
SearchableListCss,
|
|
55
|
+
getEffectiveScrollbarStyle(),
|
|
56
|
+
],
|
|
57
|
+
template: SelectBoxTemplate,
|
|
59
58
|
dependencies: [
|
|
60
|
-
|
|
61
|
-
Button,
|
|
59
|
+
UI5Button,
|
|
62
60
|
UDExList,
|
|
61
|
+
UDExSearch,
|
|
63
62
|
UDExListItem,
|
|
64
63
|
UDExDropdown,
|
|
65
64
|
UDExTextField,
|
|
66
|
-
|
|
65
|
+
UDExStatusMessage,
|
|
67
66
|
],
|
|
68
67
|
})
|
|
69
68
|
|
|
70
|
-
|
|
71
|
-
* Fired before the dropdown pane is opened.
|
|
72
|
-
*
|
|
73
|
-
* @public
|
|
74
|
-
*/
|
|
75
|
-
@event("before-open", { bubbles: true })
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Fired after the dropdown pane is opened.
|
|
79
|
-
*
|
|
80
|
-
* @public
|
|
81
|
-
*/
|
|
82
|
-
@event("open", { bubbles: true })
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Fired before the dropdown pane is closed.
|
|
86
|
-
*
|
|
87
|
-
* @public
|
|
88
|
-
*/
|
|
89
|
-
@event("before-close", { bubbles: true })
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Fired after the dropdown pane is closed.
|
|
93
|
-
*
|
|
94
|
-
* @public
|
|
95
|
-
*/
|
|
96
|
-
@event("close", { bubbles: true })
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Fired event when the user submitted the value in the search.
|
|
100
|
-
*
|
|
101
|
-
* @public
|
|
102
|
-
* @param {string} value The current value of the search field
|
|
103
|
-
*/
|
|
104
|
-
@event("change-search", { bubbles: true })
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Fired event when the user clicks on the reset button in the search.
|
|
108
|
-
*
|
|
109
|
-
* @public
|
|
110
|
-
*/
|
|
111
|
-
@event("reset-search", { bubbles: true })
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Fired event when the user clicks on the submitted icon in the search.
|
|
115
|
-
*
|
|
116
|
-
* @public
|
|
117
|
-
*/
|
|
118
|
-
@event("submit-search", { bubbles: true })
|
|
119
|
-
|
|
120
|
-
class UDExCountrySelector extends UDExSearchableListBase {
|
|
121
|
-
eventDetails!: {
|
|
122
|
-
"open": void,
|
|
123
|
-
"close": void,
|
|
124
|
-
"before-close": void,
|
|
125
|
-
"before-open": void,
|
|
126
|
-
"change-search": UDExCountrySelectorChangeSearchEventDetail,
|
|
127
|
-
} & Omit<UDExSearchableListBaseEvents, "change-search">;
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Defines label text for the input field.
|
|
131
|
-
*
|
|
132
|
-
* @default undefined
|
|
133
|
-
* @public
|
|
134
|
-
*/
|
|
135
|
-
@property({ type: String })
|
|
136
|
-
label?: string;
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Defines the accessible ARIA name of the component.
|
|
140
|
-
*
|
|
141
|
-
* @default undefined
|
|
142
|
-
* @public
|
|
143
|
-
*/
|
|
144
|
-
@property()
|
|
145
|
-
accessibleName?: string;
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* Receives id (or many ids) of the elements that label the component.
|
|
149
|
-
* @default ""
|
|
150
|
-
* @public
|
|
151
|
-
*/
|
|
152
|
-
@property()
|
|
153
|
-
accessibleNameRef: string = "";
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Defines whether the component is required.
|
|
157
|
-
*
|
|
158
|
-
* @default false
|
|
159
|
-
* @public
|
|
160
|
-
*/
|
|
161
|
-
@property({ type: Boolean })
|
|
162
|
-
required!: boolean;
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Allows control over the height.
|
|
166
|
-
*
|
|
167
|
-
* @public
|
|
168
|
-
*/
|
|
169
|
-
@property({ type: String })
|
|
170
|
-
height?: string;
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* Defines whether the component is in disabled state.
|
|
174
|
-
* <br><br>
|
|
175
|
-
* <b>Note:</b> A disabled component is completely noninteractive.
|
|
176
|
-
*
|
|
177
|
-
* @default false
|
|
178
|
-
* @public
|
|
179
|
-
*/
|
|
180
|
-
@property({ type: Boolean })
|
|
181
|
-
disabled!: boolean;
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Defines whether the component is read-only.
|
|
185
|
-
* <br><br>
|
|
186
|
-
* <b>Note:</b> A read-only component is not editable,
|
|
187
|
-
* but still provides visual feedback upon user interaction.
|
|
188
|
-
*
|
|
189
|
-
* @default false
|
|
190
|
-
* @public
|
|
191
|
-
*/
|
|
192
|
-
@property({ type: Boolean })
|
|
193
|
-
readonly!: boolean;
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* Defines whether the component is display-only.
|
|
197
|
-
* <br><br>
|
|
198
|
-
* <b>Note:</b> A display-only component is not editable,
|
|
199
|
-
* but still provides visual feedback upon user interaction, input border is not visible.
|
|
200
|
-
*
|
|
201
|
-
* @default false
|
|
202
|
-
* @public
|
|
203
|
-
*/
|
|
204
|
-
|
|
205
|
-
@property({ type: Boolean })
|
|
206
|
-
displayonly!: boolean;
|
|
207
|
-
|
|
69
|
+
class UDExCountrySelector extends UDExSelectBase {
|
|
208
70
|
/**
|
|
209
71
|
* Allows to define the initially preselected country.
|
|
210
72
|
*
|
|
@@ -224,194 +86,113 @@ class UDExCountrySelector extends UDExSearchableListBase {
|
|
|
224
86
|
blockedCountryCodes?: string;
|
|
225
87
|
|
|
226
88
|
/**
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
-
* @default ""
|
|
230
|
-
* @public
|
|
231
|
-
*/
|
|
232
|
-
@property({ type: String })
|
|
233
|
-
searchPlaceholder!: string;
|
|
234
|
-
|
|
235
|
-
/**
|
|
236
|
-
* Defines the value state of the component.
|
|
89
|
+
* Allows to hide the flag images in the country selector.
|
|
237
90
|
*
|
|
238
|
-
* @default
|
|
239
|
-
* @public
|
|
240
|
-
*/
|
|
241
|
-
@property()
|
|
242
|
-
valueState: `${UDExValueState}` = UDExValueState.Standard;
|
|
243
|
-
|
|
244
|
-
/**
|
|
245
|
-
* Defines supporting text under the country selector.
|
|
246
|
-
*
|
|
247
|
-
* @default undefined
|
|
91
|
+
* @default false
|
|
248
92
|
* @public
|
|
249
93
|
*/
|
|
250
|
-
@property({ type:
|
|
251
|
-
|
|
94
|
+
@property({ type: Boolean })
|
|
95
|
+
hideFlagImages?: boolean;
|
|
252
96
|
|
|
253
97
|
/**
|
|
98
|
+
* Indicates whether the country selector is enabled.
|
|
254
99
|
*
|
|
255
|
-
* @
|
|
100
|
+
* @default true
|
|
101
|
+
* @private
|
|
256
102
|
*/
|
|
257
103
|
@property({ type: Boolean })
|
|
258
|
-
|
|
104
|
+
_countrySelector: boolean = true;
|
|
259
105
|
|
|
260
|
-
|
|
261
|
-
|
|
106
|
+
_countryList: Country[] = CountryListDB;
|
|
107
|
+
_selectedCountry!: Country | undefined;
|
|
262
108
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
_dropdown!: UDExDropdown;
|
|
268
|
-
_search!: Search;
|
|
269
|
-
_handleResizeBound: ResizeObserverCallback;
|
|
270
|
-
|
|
271
|
-
constructor() {
|
|
272
|
-
super();
|
|
273
|
-
this._shouldFilterItems = false;
|
|
274
|
-
this._handleResizeBound = this._handleResize.bind(this);
|
|
275
|
-
this._filteredItems = [];
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
onEnterDOM(): void {
|
|
279
|
-
ResizeHandler.register(this, this._handleResizeBound);
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
onExitDOM(): void {
|
|
283
|
-
ResizeHandler.deregister(this, this._handleResizeBound);
|
|
109
|
+
onAfterRendering(): void {
|
|
110
|
+
super.onAfterRendering();
|
|
111
|
+
this.handleOutsideClick();
|
|
284
112
|
}
|
|
285
113
|
|
|
286
114
|
onBeforeRendering(): void {
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
if (!this.selectedCountry) {
|
|
293
|
-
this.selectedCountry = this.countryList.find(country => country.iso.toUpperCase() === this.preselectedCountry?.toUpperCase());
|
|
294
|
-
}
|
|
295
|
-
|
|
115
|
+
super.onBeforeRendering();
|
|
116
|
+
this.filterBlockedCountries();
|
|
117
|
+
this.setPreselectedCountry();
|
|
296
118
|
this.prepareCountrySelectorItems();
|
|
297
|
-
|
|
298
|
-
if (!this._shouldFilterItems) {
|
|
299
|
-
this._filteredItems = this.getProcessedItems();
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
onAfterRendering() {
|
|
304
|
-
this._dropdown = this.getDropdown();
|
|
305
|
-
this._search = this.getSearch();
|
|
306
|
-
this._trigger = this.getTrigger();
|
|
307
119
|
}
|
|
308
120
|
|
|
309
|
-
|
|
310
|
-
|
|
121
|
+
handleItemPress(e: CustomEvent): void {
|
|
122
|
+
this.handleItemSelection(e);
|
|
123
|
+
this.selectCountryByElement(e.target as HTMLElement);
|
|
311
124
|
}
|
|
312
125
|
|
|
313
|
-
|
|
314
|
-
this.
|
|
315
|
-
this._trigger.iconActive = false;
|
|
126
|
+
handleInputFocusIn(): void {
|
|
127
|
+
this.inputFocusIn();
|
|
316
128
|
}
|
|
317
129
|
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
_dropdownBeforeOpen() {
|
|
324
|
-
this._open = true;
|
|
325
|
-
this.onResetSearch();
|
|
326
|
-
this.fireDecoratorEvent("before-open");
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
_dropdownBeforeClose() {
|
|
330
|
-
this._open = false;
|
|
331
|
-
this.fireDecoratorEvent("before-close");
|
|
332
|
-
}
|
|
130
|
+
handleInputFocusOut(e: FocusEvent): void {
|
|
131
|
+
const relatedTarget = e.relatedTarget as HTMLElement;
|
|
132
|
+
const isInsideComponent = relatedTarget?.closest(`.${this._rootClass}`);
|
|
333
133
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
static get searchableListBaseTemplate() {
|
|
340
|
-
return SearchableListBaseTemplate;
|
|
341
|
-
}
|
|
134
|
+
if (!isInsideComponent) {
|
|
135
|
+
this.closeDropdown();
|
|
136
|
+
this.resetSearchState();
|
|
137
|
+
this.updateImagePosition();
|
|
138
|
+
}
|
|
342
139
|
|
|
343
|
-
|
|
344
|
-
this._dropdown.style.setProperty("--udex-dropdown-pane-width", `${this._trigger.offsetWidth}px`);
|
|
140
|
+
this._focused = false;
|
|
345
141
|
}
|
|
346
142
|
|
|
347
|
-
|
|
348
|
-
this.
|
|
143
|
+
handleKeyDownSearch(e: KeyboardEvent): void {
|
|
144
|
+
this.onKeyDownSearch(e);
|
|
349
145
|
}
|
|
350
146
|
|
|
351
|
-
|
|
352
|
-
this.
|
|
353
|
-
const target = e.target as HTMLElement;
|
|
354
|
-
const item: any = this.getItemFromList(target?.getAttribute("data-token-id") as string);
|
|
355
|
-
this.selectedCountry = this.countryList.find(country => country.iso === item._id);
|
|
356
|
-
this.dropDownClose();
|
|
147
|
+
handleDropdownBeforeOpen(): void {
|
|
148
|
+
this.dropdownBeforeOpen();
|
|
357
149
|
}
|
|
358
150
|
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
this.
|
|
362
|
-
this._search.focus();
|
|
363
|
-
this._search.value = key;
|
|
364
|
-
this.fireChangeSearch();
|
|
151
|
+
handleDropdownClose(): void {
|
|
152
|
+
this._open = false;
|
|
153
|
+
this.fireEventDropdownClose();
|
|
365
154
|
}
|
|
366
155
|
|
|
367
|
-
|
|
368
|
-
|
|
156
|
+
handleOutsideClick(): void {
|
|
157
|
+
document.addEventListener("click", (e: Event) => {
|
|
158
|
+
if (e.target !== this) {
|
|
159
|
+
this._open = this._popover.open;
|
|
160
|
+
}
|
|
161
|
+
});
|
|
369
162
|
}
|
|
370
163
|
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
164
|
+
updateImagePosition(): void {
|
|
165
|
+
const imagePlaceholder = this.shadowRoot!.querySelector<HTMLElement>(".udex-text-field__input > .udex-text-field__image");
|
|
166
|
+
if (imagePlaceholder) {
|
|
167
|
+
imagePlaceholder.style.backgroundPosition = this.selectedCountryFlagX || "";
|
|
375
168
|
}
|
|
376
169
|
}
|
|
377
170
|
|
|
378
|
-
|
|
379
|
-
this.
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
handleSubmitSearch(): void {
|
|
384
|
-
this.onSubmitSearch();
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
handleKeyDownSearch(keyEvent: CustomEvent<UDExSearchKeydownEventDetail>) {
|
|
388
|
-
const { detail: { e } } = keyEvent;
|
|
389
|
-
|
|
390
|
-
if (isTabPrevious(e) || isEscape(e)) {
|
|
391
|
-
e.preventDefault();
|
|
392
|
-
this.dropDownClose();
|
|
393
|
-
this.handleCloseSearch();
|
|
171
|
+
filterBlockedCountries(): void {
|
|
172
|
+
if (this.blockedCountryCodes?.length) {
|
|
173
|
+
const blockedCountryCodesArray = this.blockedCountryCodes.split(",").map(code => code.trim().toUpperCase());
|
|
174
|
+
this._countryList = this._countryList.filter(country => !blockedCountryCodesArray.includes(country.iso.toUpperCase()));
|
|
394
175
|
}
|
|
395
176
|
}
|
|
396
177
|
|
|
397
|
-
|
|
398
|
-
if (
|
|
399
|
-
this.
|
|
178
|
+
setPreselectedCountry(): void {
|
|
179
|
+
if (!this._selectedCountry && this.preselectedCountry) {
|
|
180
|
+
const preselectedISO = this.preselectedCountry.toUpperCase();
|
|
181
|
+
this._selectedCountry = this._countryList.find(({ iso }) => iso.toUpperCase() === preselectedISO);
|
|
400
182
|
}
|
|
401
183
|
}
|
|
402
184
|
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
this.onResetSearch();
|
|
185
|
+
selectCountryByElement(el: HTMLElement): void {
|
|
186
|
+
const tokenId = el?.getAttribute("data-token-id") || "";
|
|
187
|
+
const itemObj = this.getItemFromList(tokenId);
|
|
188
|
+
this._selectedCountry = this._countryList.find(country => country.iso === itemObj?._id);
|
|
189
|
+
this._selectedOption = this.selectedCountryName || "";
|
|
409
190
|
}
|
|
410
191
|
|
|
411
192
|
prepareCountrySelectorItems(): void {
|
|
412
193
|
this.items.length = 0;
|
|
413
|
-
this.
|
|
414
|
-
const selected = country.iso.toUpperCase() === this.
|
|
194
|
+
this._countryList.forEach(country => {
|
|
195
|
+
const selected = country.iso.toUpperCase() === this._selectedCountry?.iso.toUpperCase();
|
|
415
196
|
this.items.push({
|
|
416
197
|
label: this.getCountryLabel(country.countryName, country.localName),
|
|
417
198
|
innerHTML: this.getItemTemplate(country),
|
|
@@ -421,95 +202,32 @@ class UDExCountrySelector extends UDExSearchableListBase {
|
|
|
421
202
|
});
|
|
422
203
|
}
|
|
423
204
|
|
|
424
|
-
|
|
425
|
-
this.
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
getItemTemplate(country: Country) {
|
|
429
|
-
return this.hideFlagImages ? undefined : `<span class="udex-country-selector-item__image" style="background-position:${country.flagX}">`;
|
|
205
|
+
getItemTemplate(country: Country) :string | undefined {
|
|
206
|
+
return this.hideFlagImages ? undefined : `<span class="udex-text-field__image" style="background-position:${country.flagX}">`;
|
|
430
207
|
}
|
|
431
208
|
|
|
432
209
|
getCountryLabel(countryName?: string, localName?: string): string | null {
|
|
433
210
|
return localName ? `${countryName} (${localName})` : countryName || null;
|
|
434
211
|
}
|
|
435
212
|
|
|
436
|
-
get ariaControls(): string | null | undefined {
|
|
437
|
-
const list = this.shadowRoot!.querySelector<UDExList>("[udex-list]");
|
|
438
|
-
return list?.getAttribute("id");
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
get selectedCountryFlagX(): string | undefined {
|
|
442
|
-
return this.selectedCountry?.flagX;
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
get selectedCountryFlagY(): string | undefined {
|
|
446
|
-
return this.selectedCountry?.flagY;
|
|
447
|
-
}
|
|
448
|
-
|
|
449
213
|
get selectedCountryName(): string | null {
|
|
450
|
-
return this.
|
|
214
|
+
return this._selectedCountry ? this.getCountryLabel(this._selectedCountry.countryName, this._selectedCountry.localName) : "";
|
|
451
215
|
}
|
|
452
216
|
|
|
453
217
|
get flagAriaLabel(): string {
|
|
454
|
-
return this.getCountryLabel(this.
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
get triggerIcon(): string | undefined {
|
|
458
|
-
if (!this.displayonly) {
|
|
459
|
-
return this._open ? "navigation-up-arrow" : "navigation-down-arrow";
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
get countrySelectorClasses(): string {
|
|
464
|
-
const baseClass = "udex-country-selector__dropdown";
|
|
465
|
-
return this.hideFlagImages ? `${baseClass} ${baseClass}--hide-flag` : baseClass;
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
get countrySelectorTriggerClasses(): string {
|
|
469
|
-
const baseClass = "udex-country-selector__trigger";
|
|
470
|
-
const classes = [baseClass];
|
|
471
|
-
|
|
472
|
-
if (this.disabled) {
|
|
473
|
-
classes.push(`${baseClass}--disabled`);
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
if (this.readonly) {
|
|
477
|
-
classes.push(`${baseClass}--readonly`);
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
if (this.displayonly) {
|
|
481
|
-
classes.push(`${baseClass}--displayonly`);
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
return classes.join(" ");
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
get showFlagImages(): boolean {
|
|
488
|
-
return !this.hideFlagImages;
|
|
218
|
+
return this.getCountryLabel(this._selectedCountry?.countryName, this._selectedCountry?.localName) || "None";
|
|
489
219
|
}
|
|
490
220
|
|
|
491
|
-
get
|
|
492
|
-
return this.
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
getSearch(): Search {
|
|
496
|
-
return this.shadowRoot!.querySelector<Search>("[udex-search]")!;
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
getDropdownPopover(): Popover {
|
|
500
|
-
return this._dropdown.shadowRoot!.querySelector<Popover>("[ui5-popover]")!;
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
getDropdown(): UDExDropdown {
|
|
504
|
-
return this.shadowRoot!.querySelector<UDExDropdown>("[udex-dropdown]")!;
|
|
221
|
+
get selectedCountryFlagX(): string | undefined {
|
|
222
|
+
return this._selectedCountry?.flagX;
|
|
505
223
|
}
|
|
506
224
|
|
|
507
|
-
|
|
508
|
-
return this.
|
|
225
|
+
get selectedCountryFlagY(): string | undefined {
|
|
226
|
+
return this._selectedCountry?.flagY;
|
|
509
227
|
}
|
|
510
228
|
|
|
511
|
-
get
|
|
512
|
-
return
|
|
229
|
+
get showImageFlags(): boolean {
|
|
230
|
+
return true;
|
|
513
231
|
}
|
|
514
232
|
}
|
|
515
233
|
|
package/src/FilterMenu.ts
CHANGED
|
@@ -305,14 +305,24 @@ class UDExFilterMenu extends UDExSearchableListBase {
|
|
|
305
305
|
@property({ type: String })
|
|
306
306
|
triggerAccessibleRole: string = "combobox";
|
|
307
307
|
|
|
308
|
+
/**
|
|
309
|
+
* Determines whether the filter should be applied.
|
|
310
|
+
* @default false
|
|
311
|
+
* @private
|
|
312
|
+
*/
|
|
308
313
|
@property({ type: Boolean })
|
|
309
314
|
_shouldApplyFilter: boolean = false;
|
|
310
315
|
|
|
316
|
+
/**
|
|
317
|
+
* Determines whether the component should be re-rendered.
|
|
318
|
+
* @default false
|
|
319
|
+
* @private
|
|
320
|
+
*/
|
|
311
321
|
@property({ type: Boolean, noAttribute: true })
|
|
312
322
|
_requestRender = false;
|
|
313
323
|
|
|
314
324
|
_trigger!: UDExButton;
|
|
315
|
-
_search!: UDExSearch;
|
|
325
|
+
_search!: UDExSearch | HTMLInputElement;
|
|
316
326
|
_popover!: Popover;
|
|
317
327
|
_breakpointSizeXS = 640;
|
|
318
328
|
_initialState: Array<initialItemState> = [];
|
|
@@ -349,8 +359,8 @@ class UDExFilterMenu extends UDExSearchableListBase {
|
|
|
349
359
|
this.onHeaderPress(e);
|
|
350
360
|
}
|
|
351
361
|
|
|
352
|
-
handleValueSearch(e:CustomEvent): void {
|
|
353
|
-
this.onSearch(e);
|
|
362
|
+
handleValueSearch(e:CustomEvent<{ value: string }>): void {
|
|
363
|
+
this.onSearch(e.detail.value);
|
|
354
364
|
}
|
|
355
365
|
|
|
356
366
|
handleSubmitSearch(): void {
|