blob: af4f8e155c3a297a8fdecef923035a5ad828c879 [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) {
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)
Akrone4961b12017-05-10 21:04:46 +02008 .upgradeTo(this)
9 ._init(params, {
10 itemClass : itemClass,
11 prefixClass : prefixClass
12 });
Nils Diewald7148c6f2015-05-04 15:07:53 +000013 obj.limit(6);
14
15 // This is only domspecific
16 obj.element().addEventListener('blur', function (e) {
Akrone4961b12017-05-10 21:04:46 +020017 this.menu.hide();
Nils Diewald7148c6f2015-05-04 15:07:53 +000018 });
Akrone4961b12017-05-10 21:04:46 +020019
Nils Diewald7148c6f2015-05-04 15:07:53 +000020 return obj;
Nils Diewald1fcb2ad2015-04-20 19:19:18 +000021 },
Nils Diewald4c221252015-04-21 20:19:25 +000022
23 /**
24 * Register callback for click event.
25 */
Nils Diewald1fcb2ad2015-04-20 19:19:18 +000026 released : function (cb) {
27 this._cb = cb;
28 },
Nils Diewald4c221252015-04-21 20:19:25 +000029
30 /**
31 * A click event was released
32 */
33 release : function (key, type) {
Nils Diewald1fcb2ad2015-04-20 19:19:18 +000034 if (this._cb !== undefined)
Akrone4961b12017-05-10 21:04:46 +020035 this._cb(key, type);
Nils Diewald0e6992a2015-04-14 20:13:52 +000036 }
37 };
38});