From 5d1c9206d25c11be8a42741f977f2d30b399b3d7 Mon Sep 17 00:00:00 2001 From: Martin Date: Thu, 4 Apr 2019 14:16:39 +0300 Subject: [PATCH] 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: https://github.com/SAP/ui5-webcomponents/issues/297 --- packages/main/src/ShellBar.js | 24 +++++++++---------- .../ui/webcomponents/main/pages/ShellBar.html | 4 ++-- .../main/samples/ShellBar.sample.html | 8 +++---- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/packages/main/src/ShellBar.js b/packages/main/src/ShellBar.js index 69e3b1b66c01..c922152dc795 100644 --- a/packages/main/src/ShellBar.js +++ b/packages/main/src/ShellBar.js @@ -182,12 +182,12 @@ const metadata = { * Fired, when the primaryTitle is pressed. * * @event - * @param {HTMLElement} iconRef dom ref of the clicked icon + * @param {HTMLElement} targetRef dom ref of the clicked element * @public */ titlePress: { detail: { - iconRef: { type: HTMLElement }, + targetRef: { type: HTMLElement }, }, }, @@ -197,12 +197,12 @@ const metadata = { * * * @event - * @param {HTMLElement} iconRef dom ref of the clicked icon + * @param {HTMLElement} targetRef dom ref of the clicked element * @public */ notificationsPress: { detail: { - iconRef: { type: HTMLElement }, + targetRef: { type: HTMLElement }, }, }, @@ -210,12 +210,12 @@ const metadata = { * Fired, when the profile icon is pressed. * * @event - * @param {HTMLElement} iconRef dom ref of the clicked icon + * @param {HTMLElement} targetRef dom ref of the clicked element * @public */ profilePress: { detail: { - iconRef: { type: HTMLElement }, + targetRef: { type: HTMLElement }, }, }, @@ -223,12 +223,12 @@ const metadata = { * Fired, when the product switch icon is pressed. * * @event - * @param {HTMLElement} iconRef dom ref of the clicked icon + * @param {HTMLElement} targetRef dom ref of the clicked element * @public */ productSwitchPress: { detail: { - iconRef: { type: HTMLElement }, + targetRef: { type: HTMLElement }, }, }, }, @@ -306,7 +306,7 @@ class ShellBar extends WebComponent { this._header = { press: event => { this.fireEvent("titlePress", { - iconRef: this.shadowRoot.querySelector(".sapWCShellBarMenuButton"), + targetRef: this.shadowRoot.querySelector(".sapWCShellBarMenuButton"), }); }, }; @@ -610,19 +610,19 @@ class ShellBar extends WebComponent { _handleNotificationsPress(event) { this.fireEvent("notificationsPress", { - iconRef: this.shadowRoot.querySelector(".sapWCShellBarBellIcon"), + targetRef: this.shadowRoot.querySelector(".sapWCShellBarBellIcon"), }); } _handleProfilePress(event) { this.fireEvent("profilePress", { - iconRef: this.shadowRoot.querySelector(".sapWCShellBarImageButton"), + targetRef: this.shadowRoot.querySelector(".sapWCShellBarImageButton"), }); } _handleProductSwitchPress(event) { this.fireEvent("productSwitchPress", { - iconRef: this.shadowRoot.querySelector(".sapWCShellBarIconProductSwitch"), + targetRef: this.shadowRoot.querySelector(".sapWCShellBarIconProductSwitch"), }); } diff --git a/packages/main/test/sap/ui/webcomponents/main/pages/ShellBar.html b/packages/main/test/sap/ui/webcomponents/main/pages/ShellBar.html index 5754dec972a5..d8c30ef357a3 100644 --- a/packages/main/test/sap/ui/webcomponents/main/pages/ShellBar.html +++ b/packages/main/test/sap/ui/webcomponents/main/pages/ShellBar.html @@ -158,12 +158,12 @@ @@ -156,11 +156,11 @@

ShellBar