blob: 17ad073e97ac35fa95f8a5c802299715a1c4d178 [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)
Nils Diewald7148c6f2015-05-04 15:07:53 +00009 ._init(itemClass, undefined, params);
10 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});