Skip to content

Commit 5d1c920

Browse files
authored
refactor(ui5-shellbar): rename press handlers param (#300)
BREAKING CHANGE: press handlers used to have param "iconRef". As not always an Icon is pressed (e.g. title is not an icon) - the parameter is renamed to targetRef. Fixes: #297
1 parent 2641ec6 commit 5d1c920

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

packages/main/src/ShellBar.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,12 @@ const metadata = {
182182
* Fired, when the primaryTitle is pressed.
183183
*
184184
* @event
185-
* @param {HTMLElement} iconRef dom ref of the clicked icon
185+
* @param {HTMLElement} targetRef dom ref of the clicked element
186186
* @public
187187
*/
188188
titlePress: {
189189
detail: {
190-
iconRef: { type: HTMLElement },
190+
targetRef: { type: HTMLElement },
191191
},
192192
},
193193

@@ -197,38 +197,38 @@ const metadata = {
197197
*
198198
*
199199
* @event
200-
* @param {HTMLElement} iconRef dom ref of the clicked icon
200+
* @param {HTMLElement} targetRef dom ref of the clicked element
201201
* @public
202202
*/
203203
notificationsPress: {
204204
detail: {
205-
iconRef: { type: HTMLElement },
205+
targetRef: { type: HTMLElement },
206206
},
207207
},
208208

209209
/**
210210
* Fired, when the profile icon is pressed.
211211
*
212212
* @event
213-
* @param {HTMLElement} iconRef dom ref of the clicked icon
213+
* @param {HTMLElement} targetRef dom ref of the clicked element
214214
* @public
215215
*/
216216
profilePress: {
217217
detail: {
218-
iconRef: { type: HTMLElement },
218+
targetRef: { type: HTMLElement },
219219
},
220220
},
221221

222222
/**
223223
* Fired, when the product switch icon is pressed.
224224
*
225225
* @event
226-
* @param {HTMLElement} iconRef dom ref of the clicked icon
226+
* @param {HTMLElement} targetRef dom ref of the clicked element
227227
* @public
228228
*/
229229
productSwitchPress: {
230230
detail: {
231-
iconRef: { type: HTMLElement },
231+
targetRef: { type: HTMLElement },
232232
},
233233
},
234234
},
@@ -306,7 +306,7 @@ class ShellBar extends WebComponent {
306306
this._header = {
307307
press: event => {
308308
this.fireEvent("titlePress", {
309-
iconRef: this.shadowRoot.querySelector(".sapWCShellBarMenuButton"),
309+
targetRef: this.shadowRoot.querySelector(".sapWCShellBarMenuButton"),
310310
});
311311
},
312312
};
@@ -610,19 +610,19 @@ class ShellBar extends WebComponent {
610610

611611
_handleNotificationsPress(event) {
612612
this.fireEvent("notificationsPress", {
613-
iconRef: this.shadowRoot.querySelector(".sapWCShellBarBellIcon"),
613+
targetRef: this.shadowRoot.querySelector(".sapWCShellBarBellIcon"),
614614
});
615615
}
616616

617617
_handleProfilePress(event) {
618618
this.fireEvent("profilePress", {
619-
iconRef: this.shadowRoot.querySelector(".sapWCShellBarImageButton"),
619+
targetRef: this.shadowRoot.querySelector(".sapWCShellBarImageButton"),
620620
});
621621
}
622622

623623
_handleProductSwitchPress(event) {
624624
this.fireEvent("productSwitchPress", {
625-
iconRef: this.shadowRoot.querySelector(".sapWCShellBarIconProductSwitch"),
625+
targetRef: this.shadowRoot.querySelector(".sapWCShellBarIconProductSwitch"),
626626
});
627627
}
628628

packages/main/test/sap/ui/webcomponents/main/pages/ShellBar.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,12 @@
158158

159159
<script>
160160
shellbar.addEventListener("profilePress", function(event) {
161-
popover.openBy(event.detail.iconRef);
161+
popover.openBy(event.detail.targetRef);
162162
window["press-input"].value = "Profile";
163163
});
164164

165165
shellbar.addEventListener("titlePress", function(event) {
166-
window["app-list-popover"].openBy(event.detail.iconRef);
166+
window["app-list-popover"].openBy(event.detail.targetRef);
167167
window["press-input"].value = "Title";
168168
});
169169

packages/main/test/sap/ui/webcomponents/main/samples/ShellBar.sample.html

+4-4
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,11 @@ <h3>ShellBar</h3>
9797

9898
<script>
9999
shellbar.addEventListener("profilePress", function(event) {
100-
window["action-popover"].openBy(event.detail.iconRef);
100+
window["action-popover"].openBy(event.detail.targetRef);
101101
});
102102

103103
shellbar.addEventListener("titlePress", function(event) {
104-
window["app-list-popover"].openBy(event.detail.iconRef);
104+
window["app-list-popover"].openBy(event.detail.targetRef);
105105
});
106106
</script>
107107
</div>
@@ -156,11 +156,11 @@ <h3>ShellBar</h3>
156156

157157
<script>
158158
shellbar.addEventListener("profilePress", function(event) {
159-
popover.openBy(event.detail.iconRef);
159+
popover.openBy(event.detail.targetRef);
160160
});
161161

162162
shellbar.addEventListener("titlePress", function(event) {
163-
window["app-list-popover"].openBy(event.detail.iconRef);
163+
window["app-list-popover"].openBy(event.detail.targetRef);
164164
});
165165
</script>
166166
</xmp>

0 commit comments

Comments
 (0)