blob: 6a242e2ac2c50f04b0d3a98f089eed596ee2f24f [file] [log] [blame]
Nils Diewald4c221252015-04-21 20:19:25 +00001/**
2 * Menu showing all key fields.
3 */
Akrone4961b12017-05-10 21:04:46 +02004define(['menu', 'vc/item', 'vc/prefix'], function (menuClass, itemClass, prefixClass) {
Akron0b489ad2018-02-02 16:49:32 +01005
Nils Diewald0e6992a2015-04-14 20:13:52 +00006 return {
7 create : function (params) {
Nils Diewald7148c6f2015-05-04 15:07:53 +00008 var obj = Object.create(menuClass)
Akrone4961b12017-05-10 21:04:46 +02009 .upgradeTo(this)
10 ._init(params, {
11 itemClass : itemClass,
12 prefixClass : prefixClass
13 });
Nils Diewald7148c6f2015-05-04 15:07:53 +000014 obj.limit(6);
15
16 // This is only domspecific
17 obj.element().addEventListener('blur', function (e) {
Akrone4961b12017-05-10 21:04:46 +020018 this.menu.hide();
Nils Diewald7148c6f2015-05-04 15:07:53 +000019 });
Akrone4961b12017-05-10 21:04:46 +020020
Nils Diewald7148c6f2015-05-04 15:07:53 +000021 return obj;
Nils Diewald1fcb2ad2015-04-20 19:19:18 +000022 },
Nils Diewald4c221252015-04-21 20:19:25 +000023
24 /**
25 * Register callback for click event.
26 */
Nils Diewald1fcb2ad2015-04-20 19:19:18 +000027 released : function (cb) {
28 this._cb = cb;
29 },
Nils Diewald4c221252015-04-21 20:19:25 +000030
31 /**
32 * A click event was released
33 */
34 release : function (key, type) {
Nils Diewald1fcb2ad2015-04-20 19:19:18 +000035 if (this._cb !== undefined)
Akrone4961b12017-05-10 21:04:46 +020036 this._cb(key, type);
Nils Diewald0e6992a2015-04-14 20:13:52 +000037 }
38 };
39});