@@ -145,6 +145,10 @@ const metadata = {
145
145
_coPilotPress : {
146
146
type : Function ,
147
147
} ,
148
+
149
+ _menuItemPress : {
150
+ type : Function ,
151
+ } ,
148
152
} ,
149
153
150
154
slots : /** @lends sap.ui.webcomponents.main.ShellBar.prototype */ {
@@ -163,6 +167,22 @@ const metadata = {
163
167
multiple : true ,
164
168
} ,
165
169
170
+ /**
171
+ * Defines the items displayed in menu after a click on the primary title.
172
+ * </br></br>
173
+ * <b>Note:</b>
174
+ * You can use the <ui5-li></ui5-li> and its ancestors.
175
+ *
176
+ * @type {HTMLElement }
177
+ * @slot
178
+ * @since 0.10
179
+ * @public
180
+ */
181
+ menuItems : {
182
+ type : HTMLElement ,
183
+ multiple : true ,
184
+ } ,
185
+
166
186
/**
167
187
* Defines the <code>ui5-input</code>, that will be used as a search field.
168
188
*
@@ -187,19 +207,6 @@ const metadata = {
187
207
} ,
188
208
defaultSlot : "items" ,
189
209
events : /** @lends sap.ui.webcomponents.main.ShellBar.prototype */ {
190
- /**
191
- * Fired, when the primaryTitle is pressed.
192
- *
193
- * @event
194
- * @param {HTMLElement } targetRef dom ref of the clicked element
195
- * @public
196
- */
197
- titlePress : {
198
- detail : {
199
- targetRef : { type : HTMLElement } ,
200
- } ,
201
- } ,
202
-
203
210
/**
204
211
*
205
212
* Fired, when the notification icon is pressed.
@@ -246,6 +253,7 @@ const metadata = {
246
253
*
247
254
* @event
248
255
* @param {HTMLElement } targetRef dom ref of the clicked element
256
+ * @since 0.10
249
257
* @public
250
258
*/
251
259
logoPress : {
@@ -259,13 +267,28 @@ const metadata = {
259
267
*
260
268
* @event
261
269
* @param {HTMLElement } targetRef dom ref of the clicked element
270
+ * @since 0.10
262
271
* @public
263
272
*/
264
273
coPilotPress : {
265
274
detail : {
266
275
targetRef : { type : HTMLElement } ,
267
276
} ,
268
277
} ,
278
+
279
+ /**
280
+ * Fired, when a menu item is selected
281
+ *
282
+ * @event
283
+ * @param {HTMLElement } item dom ref of the clicked list item
284
+ * @since 0.10
285
+ * @public
286
+ */
287
+ menuItemPress : {
288
+ detail : {
289
+ item : { type : HTMLElement } ,
290
+ } ,
291
+ } ,
269
292
} ,
270
293
} ;
271
294
@@ -332,20 +355,28 @@ class ShellBar extends WebComponent {
332
355
333
356
this . _actionList = {
334
357
itemPress : event => {
335
- const popover = this . shadowRoot . querySelector ( "ui5-popover " ) ;
358
+ const popover = this . shadowRoot . querySelector ( ".sapWCShellBarOverflowPopover " ) ;
336
359
337
360
popover . close ( ) ;
338
361
} ,
339
362
} ;
340
363
341
364
this . _header = {
342
365
press : event => {
343
- this . fireEvent ( "titlePress" , {
344
- targetRef : this . shadowRoot . querySelector ( ".sapWCShellBarMenuButton" ) ,
345
- } ) ;
366
+ const menuPopover = this . shadowRoot . querySelector ( ".sapWCShellBarMenuPopover" ) ;
367
+
368
+ if ( this . menuItems . length ) {
369
+ menuPopover . openBy ( this . shadowRoot . querySelector ( ".sapWCShellBarMenuButton" ) ) ;
370
+ }
346
371
} ,
347
372
} ;
348
373
374
+ this . _menuItemPress = event => {
375
+ this . fireEvent ( "menuItemPress" , {
376
+ item : event . detail . item ,
377
+ } ) ;
378
+ } ;
379
+
349
380
this . _itemNav = new ItemNavigation ( this ) ;
350
381
351
382
this . _itemNav . getItemsCallback = ( ) => {
@@ -406,7 +437,7 @@ class ShellBar extends WebComponent {
406
437
} ;
407
438
408
439
this . _handleResize = event => {
409
- this . shadowRoot . querySelector ( "ui5-popover " ) . close ( ) ;
440
+ this . shadowRoot . querySelector ( ".sapWCShellBarOverflowPopover " ) . close ( ) ;
410
441
this . _overflowActions ( ) ;
411
442
} ;
412
443
@@ -571,7 +602,7 @@ class ShellBar extends WebComponent {
571
602
}
572
603
573
604
_toggleActionPopover ( ) {
574
- const popover = this . shadowRoot . querySelector ( "ui5-popover " ) ;
605
+ const popover = this . shadowRoot . querySelector ( ".sapWCShellBarOverflowPopover " ) ;
575
606
const overflowButton = this . shadowRoot . querySelector ( ".sapWCShellBarOverflowIcon" ) ;
576
607
popover . openBy ( overflowButton ) ;
577
608
}
0 commit comments