blob: b2ac071ca4db1f80466c5d0a0ffe940022a7f23f [file] [log] [blame]
Akrone51eaa32020-11-10 09:35:53 +01001"use strict";
2
Akron6bb71582016-06-10 20:41:08 +02003define(['menu/item'], function (itemClass) {
4 /**
5 * Menu item for select menus.
6 */
Akron6bb71582016-06-10 20:41:08 +02007 return {
8
9 /**
10 * Create new menu item
11 * for tree views.
12 */
13 create : function (params) {
14 return Object.create(itemClass)
Akronaba7a5a2016-08-15 21:58:33 +020015 .upgradeTo(this)._init(params);
Akron6bb71582016-06-10 20:41:08 +020016 },
17
Akron0b489ad2018-02-02 16:49:32 +010018
Akron6bb71582016-06-10 20:41:08 +020019 /**
20 * Override click action of the menu item.
21 */
22 onclick : function (e) {
23 var menu = this.menu();
24 menu.hide();
25 // Index was set on initialization
26 menu.select(this._index);
27 menu.showTitle();
28 e.halt();
29 },
30
Akron0b489ad2018-02-02 16:49:32 +010031
32 /**
33 * Get title of item.
34 */
Akron6bb71582016-06-10 20:41:08 +020035 title : function () {
36 return this.content().textContent;
37 }
38 };
39});