blob: 584043839557fa9f5c09b4e7024324676b54eea2 [file] [log] [blame]
Nils Diewald4c221252015-04-21 20:19:25 +00001/**
2 * Menu showing all key fields.
3 */
Nils Diewald1fcb2ad2015-04-20 19:19:18 +00004define(['menu', 'vc/item'], function (menuClass, itemClass) {
Nils Diewald0e6992a2015-04-14 20:13:52 +00005 return {
6 create : function (params) {
Nils Diewald7148c6f2015-05-04 15:07:53 +00007 var obj = Object.create(menuClass)
Nils Diewald0e6992a2015-04-14 20:13:52 +00008 .upgradeTo(this)
Akron7524be12016-06-01 17:31:33 +02009 ._init(params, {itemClass : itemClass});
Nils Diewald7148c6f2015-05-04 15:07:53 +000010 obj.limit(6);
11
12 // This is only domspecific
13 obj.element().addEventListener('blur', function (e) {
14 this.menu.hide();
15 });
16
17 return obj;
Nils Diewald1fcb2ad2015-04-20 19:19:18 +000018 },
Nils Diewald4c221252015-04-21 20:19:25 +000019
20 /**
21 * Register callback for click event.
22 */
Nils Diewald1fcb2ad2015-04-20 19:19:18 +000023 released : function (cb) {
24 this._cb = cb;
25 },
Nils Diewald4c221252015-04-21 20:19:25 +000026
27 /**
28 * A click event was released
29 */
30 release : function (key, type) {
Nils Diewald1fcb2ad2015-04-20 19:19:18 +000031 if (this._cb !== undefined)
Nils Diewald4c221252015-04-21 20:19:25 +000032 this._cb(key, type);
Nils Diewald0e6992a2015-04-14 20:13:52 +000033 }
34 };
35});