@progress/kendo-angular-menu 3.0.6 → 4.0.0-dev.202204131917
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/kendo-angular-menu.umd.js +5 -0
- package/{dist/es2015/constants.d.ts → constants.d.ts} +0 -0
- package/{dist/es2015/context-menu → context-menu}/context-menu-event.d.ts +0 -0
- package/{dist/es2015/context-menu → context-menu}/context-menu-items.service.d.ts +3 -0
- package/{dist/es2015/context-menu → context-menu}/context-menu-popup-event.d.ts +0 -0
- package/{dist/es2015/context-menu → context-menu}/context-menu-select-event.d.ts +0 -0
- package/{dist/es2015/context-menu → context-menu}/context-menu-target-container.directive.d.ts +3 -0
- package/{dist/es2015/context-menu → context-menu}/context-menu-target.directive.d.ts +3 -0
- package/{dist/es2015/context-menu → context-menu}/context-menu-target.service.d.ts +3 -0
- package/{dist/es2015/context-menu → context-menu}/context-menu-template.directive.d.ts +3 -0
- package/{dist/es2015/context-menu → context-menu}/context-menu.component.d.ts +4 -1
- package/{dist/es2015/context-menu → context-menu}/context-menu.module.d.ts +11 -0
- package/{dist/es2015/context-menu → context-menu}/context-menu.service.d.ts +3 -0
- package/{dist/es2015/data-binding → data-binding}/binding-directive-base.d.ts +3 -0
- package/{dist/es2015/data-binding → data-binding}/flat-binding.directive.d.ts +3 -0
- package/{dist/es2015/data-binding → data-binding}/hierachy-binding.directive.d.ts +3 -0
- package/{dist/es2015/data-binding → data-binding}/utils.d.ts +0 -0
- package/{dist/es2015/dom-queries.d.ts → dom-queries.d.ts} +0 -0
- package/{dist/es2015 → esm2015}/constants.js +0 -0
- package/{dist/es2015 → esm2015}/context-menu/context-menu-event.js +0 -0
- package/esm2015/context-menu/context-menu-items.service.js +25 -0
- package/{dist/es2015 → esm2015}/context-menu/context-menu-popup-event.js +0 -0
- package/{dist/es2015 → esm2015}/context-menu/context-menu-select-event.js +0 -0
- package/esm2015/context-menu/context-menu-target-container.directive.js +32 -0
- package/esm2015/context-menu/context-menu-target.directive.js +46 -0
- package/{dist/es2015 → esm2015}/context-menu/context-menu-target.service.js +8 -10
- package/esm2015/context-menu/context-menu-template.directive.js +32 -0
- package/{dist/es2015 → esm2015}/context-menu/context-menu.component.js +107 -113
- package/{dist/es2015 → esm2015}/context-menu/context-menu.module.js +20 -11
- package/{dist/es2015 → esm2015}/context-menu/context-menu.service.js +8 -10
- package/{dist/es2015 → esm2015}/data-binding/binding-directive-base.js +11 -0
- package/esm2015/data-binding/flat-binding.directive.js +82 -0
- package/esm2015/data-binding/hierachy-binding.directive.js +71 -0
- package/{dist/es2015 → esm2015}/data-binding/utils.js +0 -1
- package/{dist/es2015 → esm2015}/dom-queries.js +0 -3
- package/{dist/es/constants.js → esm2015/kendo-angular-menu.js} +2 -2
- package/{dist/es → esm2015}/main.js +3 -2
- package/{dist/es → esm2015}/menu-animation.interface.js +1 -0
- package/esm2015/menu-base.js +69 -0
- package/{dist/es2015 → esm2015}/menu-event.js +0 -0
- package/{dist/es2015 → esm2015}/menu-item.component.js +41 -60
- package/{dist/es → esm2015}/menu-item.interface.js +1 -0
- package/{dist/es2015 → esm2015}/menu-select-event.js +0 -0
- package/{dist/es2015 → esm2015}/menu.component.js +76 -63
- package/{dist/es2015 → esm2015}/menu.module.js +32 -13
- package/{dist/es2015 → esm2015}/menus.module.js +12 -9
- package/{dist/es2015 → esm2015}/open-on-click-settings.js +0 -1
- package/{dist/es2015 → esm2015}/package-metadata.js +1 -1
- package/{dist/es2015 → esm2015}/preventable-event.js +0 -0
- package/esm2015/rendering/arrow.directive.js +62 -0
- package/esm2015/rendering/link.directive.js +54 -0
- package/esm2015/rendering/list.component.js +546 -0
- package/{dist/es2015 → esm2015}/rendering/popup-settings.js +0 -0
- package/{dist/es2015 → esm2015}/services/actions.service.js +21 -14
- package/{dist/es2015 → esm2015}/services/hover.service.js +10 -10
- package/{dist/es2015 → esm2015}/services/items.service.js +8 -13
- package/{dist/es2015 → esm2015}/services/navigation.service.js +12 -15
- package/{dist/es2015 → esm2015}/templates/item-content-template.directive.js +14 -12
- package/{dist/es2015 → esm2015}/templates/item-link-template.directive.js +14 -12
- package/{dist/es2015 → esm2015}/templates/item-template.directive.js +14 -12
- package/{dist/es2015 → esm2015}/utils.js +0 -0
- package/{dist/fesm2015/index.js → fesm2015/kendo-angular-menu.js} +1112 -1113
- package/kendo-angular-menu.d.ts +9 -0
- package/{dist/es2015/main.d.ts → main.d.ts} +3 -2
- package/{dist/es2015/menu-animation.interface.d.ts → menu-animation.interface.d.ts} +0 -0
- package/{dist/es2015/menu-base.d.ts → menu-base.d.ts} +4 -1
- package/{dist/es2015/menu-event.d.ts → menu-event.d.ts} +0 -0
- package/{dist/es2015/menu-item.component.d.ts → menu-item.component.d.ts} +7 -4
- package/{dist/es2015/menu-item.interface.d.ts → menu-item.interface.d.ts} +0 -0
- package/{dist/es2015/menu-select-event.d.ts → menu-select-event.d.ts} +0 -0
- package/{dist/es2015/menu.component.d.ts → menu.component.d.ts} +7 -4
- package/menu.module.d.ts +54 -0
- package/{dist/es2015/menus.module.d.ts → menus.module.d.ts} +6 -0
- package/{dist/es2015/open-on-click-settings.d.ts → open-on-click-settings.d.ts} +0 -0
- package/{dist/es2015/package-metadata.d.ts → package-metadata.d.ts} +0 -0
- package/package.json +35 -110
- package/{dist/es2015/preventable-event.d.ts → preventable-event.d.ts} +0 -0
- package/{dist/es2015/rendering → rendering}/arrow.directive.d.ts +6 -3
- package/{dist/es2015/rendering → rendering}/link.directive.d.ts +4 -1
- package/rendering/list.component.d.ts +104 -0
- package/{dist/es2015/rendering → rendering}/popup-settings.d.ts +0 -0
- package/schematics/ngAdd/index.js +5 -2
- package/schematics/ngAdd/index.js.map +1 -1
- package/{dist/es2015/services → services}/actions.service.d.ts +24 -1
- package/{dist/es2015/services → services}/hover.service.d.ts +7 -2
- package/{dist/es2015/services → services}/items.service.d.ts +4 -1
- package/{dist/es2015/services → services}/navigation.service.d.ts +6 -3
- package/{dist/es2015/templates → templates}/item-content-template.directive.d.ts +3 -0
- package/{dist/es2015/templates → templates}/item-link-template.directive.d.ts +3 -0
- package/{dist/es2015/templates → templates}/item-template.directive.d.ts +3 -0
- package/{dist/es2015/utils.d.ts → utils.d.ts} +1 -1
- package/dist/cdn/js/kendo-angular-menu.js +0 -20
- package/dist/cdn/main.js +0 -5
- package/dist/es/context-menu/context-menu-event.js +0 -13
- package/dist/es/context-menu/context-menu-items.service.js +0 -26
- package/dist/es/context-menu/context-menu-popup-event.js +0 -17
- package/dist/es/context-menu/context-menu-select-event.js +0 -17
- package/dist/es/context-menu/context-menu-target-container.directive.js +0 -31
- package/dist/es/context-menu/context-menu-target.directive.js +0 -48
- package/dist/es/context-menu/context-menu-target.service.js +0 -29
- package/dist/es/context-menu/context-menu-template.directive.js +0 -31
- package/dist/es/context-menu/context-menu.component.js +0 -456
- package/dist/es/context-menu/context-menu.module.js +0 -64
- package/dist/es/context-menu/context-menu.service.js +0 -30
- package/dist/es/data-binding/binding-directive-base.js +0 -32
- package/dist/es/data-binding/flat-binding.directive.js +0 -104
- package/dist/es/data-binding/hierachy-binding.directive.js +0 -94
- package/dist/es/data-binding/utils.js +0 -32
- package/dist/es/dom-queries.js +0 -107
- package/dist/es/index.js +0 -21
- package/dist/es/menu-base.js +0 -79
- package/dist/es/menu-event.js +0 -17
- package/dist/es/menu-item.component.js +0 -165
- package/dist/es/menu-select-event.js +0 -17
- package/dist/es/menu.component.js +0 -256
- package/dist/es/menu.module.js +0 -79
- package/dist/es/menus.module.js +0 -41
- package/dist/es/open-on-click-settings.js +0 -13
- package/dist/es/package-metadata.js +0 -15
- package/dist/es/preventable-event.js +0 -36
- package/dist/es/rendering/arrow.directive.js +0 -81
- package/dist/es/rendering/item.component.js +0 -337
- package/dist/es/rendering/link.directive.js +0 -62
- package/dist/es/rendering/list.component.js +0 -219
- package/dist/es/rendering/popup-settings.js +0 -66
- package/dist/es/services/actions.service.js +0 -178
- package/dist/es/services/hover.service.js +0 -136
- package/dist/es/services/items.service.js +0 -140
- package/dist/es/services/navigation.service.js +0 -274
- package/dist/es/templates/item-content-template.directive.js +0 -50
- package/dist/es/templates/item-link-template.directive.js +0 -52
- package/dist/es/templates/item-template.directive.js +0 -51
- package/dist/es/utils.js +0 -18
- package/dist/es2015/context-menu/context-menu-items.service.js +0 -25
- package/dist/es2015/context-menu/context-menu-target-container.directive.js +0 -30
- package/dist/es2015/context-menu/context-menu-target.directive.js +0 -47
- package/dist/es2015/context-menu/context-menu-template.directive.js +0 -30
- package/dist/es2015/data-binding/flat-binding.directive.js +0 -101
- package/dist/es2015/data-binding/hierachy-binding.directive.js +0 -90
- package/dist/es2015/index.d.ts +0 -21
- package/dist/es2015/index.js +0 -21
- package/dist/es2015/index.metadata.json +0 -1
- package/dist/es2015/main.js +0 -26
- package/dist/es2015/menu-animation.interface.js +0 -4
- package/dist/es2015/menu-base.js +0 -73
- package/dist/es2015/menu-item.interface.js +0 -4
- package/dist/es2015/menu.module.d.ts +0 -38
- package/dist/es2015/rendering/arrow.directive.js +0 -68
- package/dist/es2015/rendering/item.component.d.ts +0 -64
- package/dist/es2015/rendering/item.component.js +0 -327
- package/dist/es2015/rendering/link.directive.js +0 -57
- package/dist/es2015/rendering/list.component.d.ts +0 -41
- package/dist/es2015/rendering/list.component.js +0 -233
- package/dist/fesm5/index.js +0 -3222
- package/dist/npm/constants.js +0 -10
- package/dist/npm/context-menu/context-menu-event.js +0 -15
- package/dist/npm/context-menu/context-menu-items.service.js +0 -28
- package/dist/npm/context-menu/context-menu-popup-event.js +0 -19
- package/dist/npm/context-menu/context-menu-select-event.js +0 -19
- package/dist/npm/context-menu/context-menu-target-container.directive.js +0 -33
- package/dist/npm/context-menu/context-menu-target.directive.js +0 -50
- package/dist/npm/context-menu/context-menu-target.service.js +0 -31
- package/dist/npm/context-menu/context-menu-template.directive.js +0 -33
- package/dist/npm/context-menu/context-menu.component.js +0 -459
- package/dist/npm/context-menu/context-menu.module.js +0 -66
- package/dist/npm/context-menu/context-menu.service.js +0 -32
- package/dist/npm/data-binding/binding-directive-base.js +0 -34
- package/dist/npm/data-binding/flat-binding.directive.js +0 -106
- package/dist/npm/data-binding/hierachy-binding.directive.js +0 -96
- package/dist/npm/data-binding/utils.js +0 -34
- package/dist/npm/dom-queries.js +0 -110
- package/dist/npm/index.js +0 -37
- package/dist/npm/main.js +0 -50
- package/dist/npm/menu-animation.interface.js +0 -6
- package/dist/npm/menu-base.js +0 -81
- package/dist/npm/menu-event.js +0 -19
- package/dist/npm/menu-item.component.js +0 -167
- package/dist/npm/menu-item.interface.js +0 -6
- package/dist/npm/menu-select-event.js +0 -19
- package/dist/npm/menu.component.js +0 -258
- package/dist/npm/menu.module.js +0 -81
- package/dist/npm/menus.module.js +0 -43
- package/dist/npm/open-on-click-settings.js +0 -15
- package/dist/npm/package-metadata.js +0 -17
- package/dist/npm/preventable-event.js +0 -38
- package/dist/npm/rendering/arrow.directive.js +0 -83
- package/dist/npm/rendering/item.component.js +0 -339
- package/dist/npm/rendering/link.directive.js +0 -64
- package/dist/npm/rendering/list.component.js +0 -221
- package/dist/npm/rendering/popup-settings.js +0 -68
- package/dist/npm/services/actions.service.js +0 -180
- package/dist/npm/services/hover.service.js +0 -138
- package/dist/npm/services/items.service.js +0 -143
- package/dist/npm/services/navigation.service.js +0 -276
- package/dist/npm/templates/item-content-template.directive.js +0 -52
- package/dist/npm/templates/item-link-template.directive.js +0 -54
- package/dist/npm/templates/item-template.directive.js +0 -53
- package/dist/npm/utils.js +0 -20
- package/dist/systemjs/kendo-angular-menu.js +0 -5
package/dist/fesm5/index.js
DELETED
|
@@ -1,3222 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { __decorate, __extends, __metadata, __param } from 'tslib';
|
|
6
|
-
import { Injectable, NgZone, EventEmitter, Directive, Optional, TemplateRef, Input, ContentChildren, QueryList, Component, Output, HostBinding, forwardRef, Renderer2, ElementRef, ViewChild, ChangeDetectorRef, isDevMode, NgModule, ViewContainerRef, ContentChild } from '@angular/core';
|
|
7
|
-
import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
|
|
8
|
-
import { validatePackage } from '@progress/kendo-licensing';
|
|
9
|
-
import { hasObservers, isDocumentAvailable, Keys } from '@progress/kendo-angular-common';
|
|
10
|
-
import { PopupService, POPUP_CONTAINER, PopupModule } from '@progress/kendo-angular-popup';
|
|
11
|
-
import { CommonModule } from '@angular/common';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* @hidden
|
|
15
|
-
*/
|
|
16
|
-
var packageMetadata = {
|
|
17
|
-
name: '@progress/kendo-angular-menu',
|
|
18
|
-
productName: 'Kendo UI for Angular',
|
|
19
|
-
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
20
|
-
publishDate: 1647359300,
|
|
21
|
-
version: '',
|
|
22
|
-
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
var PARENT_REGEX = /_?\d+$/;
|
|
26
|
-
var SEPARATOR = '_';
|
|
27
|
-
var id = 0;
|
|
28
|
-
var itemIndexComparer = function (a, b) { return a.siblingIndex - b.siblingIndex; };
|
|
29
|
-
var next = function (idx, items, dir) {
|
|
30
|
-
var current = items[idx + dir];
|
|
31
|
-
while (!current) {
|
|
32
|
-
if (idx < 0) {
|
|
33
|
-
idx = items.length - 1;
|
|
34
|
-
}
|
|
35
|
-
else if (idx >= items.length) {
|
|
36
|
-
idx = 0;
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
idx += dir;
|
|
40
|
-
}
|
|
41
|
-
current = items[idx];
|
|
42
|
-
}
|
|
43
|
-
return current;
|
|
44
|
-
};
|
|
45
|
-
/**
|
|
46
|
-
* @hidden
|
|
47
|
-
*/
|
|
48
|
-
var ItemsService = /** @class */ (function () {
|
|
49
|
-
function ItemsService() {
|
|
50
|
-
this.items = {};
|
|
51
|
-
this.lists = [];
|
|
52
|
-
this.idPrefix = "k-menu" + id++;
|
|
53
|
-
}
|
|
54
|
-
Object.defineProperty(ItemsService.prototype, "hasItems", {
|
|
55
|
-
get: function () {
|
|
56
|
-
return Object.keys(this.items).length > 0;
|
|
57
|
-
},
|
|
58
|
-
enumerable: true,
|
|
59
|
-
configurable: true
|
|
60
|
-
});
|
|
61
|
-
ItemsService.prototype.childId = function (index) {
|
|
62
|
-
return this.idPrefix + "-child" + index;
|
|
63
|
-
};
|
|
64
|
-
ItemsService.prototype.itemIndex = function (parentIndex, index) {
|
|
65
|
-
return (parentIndex ? parentIndex + SEPARATOR : '') + index;
|
|
66
|
-
};
|
|
67
|
-
ItemsService.prototype.get = function (index) {
|
|
68
|
-
return this.items[index];
|
|
69
|
-
};
|
|
70
|
-
ItemsService.prototype.add = function (item) {
|
|
71
|
-
this.items[item.index] = item;
|
|
72
|
-
};
|
|
73
|
-
ItemsService.prototype.remove = function (item) {
|
|
74
|
-
if (this.items[item.index] === item) {
|
|
75
|
-
delete this.items[item.index];
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
ItemsService.prototype.addList = function (list) {
|
|
79
|
-
this.lists.push(list);
|
|
80
|
-
};
|
|
81
|
-
ItemsService.prototype.removeList = function (list) {
|
|
82
|
-
var index = this.lists.indexOf(list);
|
|
83
|
-
if (index >= 0) {
|
|
84
|
-
this.lists.splice(index, 1);
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
ItemsService.prototype.containsList = function (element) {
|
|
88
|
-
return Boolean(this.lists.find(function (list) { return list.element.nativeElement === element; }));
|
|
89
|
-
};
|
|
90
|
-
ItemsService.prototype.siblings = function (item) {
|
|
91
|
-
var _this = this;
|
|
92
|
-
var parentIndex = this.parentIndex(item.index);
|
|
93
|
-
return this.filter(function (index) { return _this.parentIndex(index) === parentIndex; });
|
|
94
|
-
};
|
|
95
|
-
ItemsService.prototype.otherSiblings = function (item) {
|
|
96
|
-
var _this = this;
|
|
97
|
-
var parentIndex = this.parentIndex(item.index);
|
|
98
|
-
return this.filter(function (index) { return _this.parentIndex(index) === parentIndex && index !== item.index; });
|
|
99
|
-
};
|
|
100
|
-
ItemsService.prototype.children = function (item) {
|
|
101
|
-
var _this = this;
|
|
102
|
-
return this.filter(function (index) { return _this.parentIndex(index) === item.index; });
|
|
103
|
-
};
|
|
104
|
-
ItemsService.prototype.parent = function (item) {
|
|
105
|
-
return this.items[this.parentIndex(item.index)];
|
|
106
|
-
};
|
|
107
|
-
ItemsService.prototype.root = function (item) {
|
|
108
|
-
return this.items[this.indices(item.index)[0]];
|
|
109
|
-
};
|
|
110
|
-
ItemsService.prototype.indices = function (index) {
|
|
111
|
-
return index.split(SEPARATOR);
|
|
112
|
-
};
|
|
113
|
-
ItemsService.prototype.filter = function (predicate) {
|
|
114
|
-
var result = [];
|
|
115
|
-
var items = this.items;
|
|
116
|
-
for (var index in items) {
|
|
117
|
-
if (predicate(index, items[index])) {
|
|
118
|
-
result.push(items[index]);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
return result.sort(itemIndexComparer);
|
|
122
|
-
};
|
|
123
|
-
ItemsService.prototype.previous = function (item) {
|
|
124
|
-
var siblings = this.siblings(item);
|
|
125
|
-
var itemIndex = siblings.indexOf(item);
|
|
126
|
-
return next(itemIndex, siblings, -1);
|
|
127
|
-
};
|
|
128
|
-
ItemsService.prototype.next = function (item) {
|
|
129
|
-
var siblings = this.siblings(item);
|
|
130
|
-
var itemIndex = siblings.indexOf(item);
|
|
131
|
-
return next(itemIndex, siblings, 1);
|
|
132
|
-
};
|
|
133
|
-
ItemsService.prototype.hasParent = function (item, parent) {
|
|
134
|
-
return item.index.startsWith(parent.index);
|
|
135
|
-
};
|
|
136
|
-
ItemsService.prototype.areSiblings = function (item1, item2) {
|
|
137
|
-
return item1 !== item2 && this.parent(item1) === this.parent(item2);
|
|
138
|
-
};
|
|
139
|
-
ItemsService.prototype.forEach = function (callback) {
|
|
140
|
-
var items = this.items;
|
|
141
|
-
for (var index in items) {
|
|
142
|
-
if (items.hasOwnProperty(index)) {
|
|
143
|
-
callback(items[index]);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
ItemsService.prototype.parentIndex = function (index) {
|
|
148
|
-
return index.replace(PARENT_REGEX, '');
|
|
149
|
-
};
|
|
150
|
-
ItemsService = __decorate([
|
|
151
|
-
Injectable()
|
|
152
|
-
], ItemsService);
|
|
153
|
-
return ItemsService;
|
|
154
|
-
}());
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* @hidden
|
|
158
|
-
*/
|
|
159
|
-
var PreventableEvent = /** @class */ (function () {
|
|
160
|
-
/**
|
|
161
|
-
* @hidden
|
|
162
|
-
*/
|
|
163
|
-
function PreventableEvent(args) {
|
|
164
|
-
this.prevented = false;
|
|
165
|
-
Object.assign(this, args);
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Prevents the default action for a specified event.
|
|
169
|
-
* In this way, the source component suppresses
|
|
170
|
-
* the built-in behavior that follows the event.
|
|
171
|
-
*/
|
|
172
|
-
PreventableEvent.prototype.preventDefault = function () {
|
|
173
|
-
this.prevented = true;
|
|
174
|
-
};
|
|
175
|
-
/**
|
|
176
|
-
* Returns `true` if the event was prevented
|
|
177
|
-
* by any of its subscribers.
|
|
178
|
-
*
|
|
179
|
-
* @returns `true` if the default action was prevented.
|
|
180
|
-
* Otherwise, returns `false`.
|
|
181
|
-
*/
|
|
182
|
-
PreventableEvent.prototype.isDefaultPrevented = function () {
|
|
183
|
-
return this.prevented;
|
|
184
|
-
};
|
|
185
|
-
return PreventableEvent;
|
|
186
|
-
}());
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* Arguments for the `open` and `close` events of the Menu.
|
|
190
|
-
*/
|
|
191
|
-
var MenuEvent = /** @class */ (function (_super) {
|
|
192
|
-
__extends(MenuEvent, _super);
|
|
193
|
-
function MenuEvent() {
|
|
194
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
195
|
-
}
|
|
196
|
-
return MenuEvent;
|
|
197
|
-
}(PreventableEvent));
|
|
198
|
-
|
|
199
|
-
var canPerformAction = function (item, action) {
|
|
200
|
-
return !((action === 'open' && item.opened) || (action === 'close' && !item.opened));
|
|
201
|
-
};
|
|
202
|
-
/**
|
|
203
|
-
* @hidden
|
|
204
|
-
*/
|
|
205
|
-
var ActionsService = /** @class */ (function () {
|
|
206
|
-
function ActionsService(ngZone, items) {
|
|
207
|
-
this.ngZone = ngZone;
|
|
208
|
-
this.items = items;
|
|
209
|
-
this.actions = [];
|
|
210
|
-
}
|
|
211
|
-
ActionsService.prototype.open = function (item, finished) {
|
|
212
|
-
if (item.disabled) {
|
|
213
|
-
return;
|
|
214
|
-
}
|
|
215
|
-
if (item.hasContent && !item.opened) {
|
|
216
|
-
this.actions.push({
|
|
217
|
-
name: 'open',
|
|
218
|
-
requiresZone: item.hasContentTemplates(),
|
|
219
|
-
item: item,
|
|
220
|
-
finished: finished
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
else if (finished) {
|
|
224
|
-
finished();
|
|
225
|
-
}
|
|
226
|
-
};
|
|
227
|
-
ActionsService.prototype.close = function (item) {
|
|
228
|
-
this.closeChildren(item);
|
|
229
|
-
this.closeItem(item);
|
|
230
|
-
};
|
|
231
|
-
ActionsService.prototype.closeItem = function (item) {
|
|
232
|
-
if (item.opened) {
|
|
233
|
-
this.actions.push({
|
|
234
|
-
name: 'close',
|
|
235
|
-
item: item
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
};
|
|
239
|
-
ActionsService.prototype.closeToRoot = function (item) {
|
|
240
|
-
this.closeChildren(item);
|
|
241
|
-
var current = item;
|
|
242
|
-
do {
|
|
243
|
-
this.closeItem(current);
|
|
244
|
-
current = this.items.parent(current);
|
|
245
|
-
} while (current);
|
|
246
|
-
};
|
|
247
|
-
ActionsService.prototype.closeOthers = function (item) {
|
|
248
|
-
this.closeChildren(item);
|
|
249
|
-
var current = item;
|
|
250
|
-
while (current) {
|
|
251
|
-
var siblings = this.items.otherSiblings(current);
|
|
252
|
-
this.closeItems(siblings);
|
|
253
|
-
current = this.items.parent(current);
|
|
254
|
-
}
|
|
255
|
-
};
|
|
256
|
-
ActionsService.prototype.closeAll = function () {
|
|
257
|
-
var _this = this;
|
|
258
|
-
this.items.forEach(function (item) {
|
|
259
|
-
if (item.opened && item.level === 0) {
|
|
260
|
-
_this.close(item);
|
|
261
|
-
}
|
|
262
|
-
});
|
|
263
|
-
};
|
|
264
|
-
ActionsService.prototype.select = function (item, domEvent, prevented, finished) {
|
|
265
|
-
this.actions.push({
|
|
266
|
-
name: 'select',
|
|
267
|
-
item: item,
|
|
268
|
-
prevented: prevented,
|
|
269
|
-
finished: finished,
|
|
270
|
-
domEvent: domEvent
|
|
271
|
-
});
|
|
272
|
-
};
|
|
273
|
-
ActionsService.prototype.emit = function (name, item, domEvent) {
|
|
274
|
-
var owner = this.owner;
|
|
275
|
-
var eventArgs = new MenuEvent({
|
|
276
|
-
sender: owner,
|
|
277
|
-
item: item.item,
|
|
278
|
-
index: item.index,
|
|
279
|
-
originalEvent: domEvent,
|
|
280
|
-
hasContent: item.hasContent
|
|
281
|
-
});
|
|
282
|
-
owner[name].emit(eventArgs);
|
|
283
|
-
if (owner.contextService) {
|
|
284
|
-
owner.contextService.emit(name, eventArgs);
|
|
285
|
-
}
|
|
286
|
-
return eventArgs.isDefaultPrevented();
|
|
287
|
-
};
|
|
288
|
-
Object.defineProperty(ActionsService.prototype, "hasPending", {
|
|
289
|
-
get: function () {
|
|
290
|
-
return this.actions.length > 0;
|
|
291
|
-
},
|
|
292
|
-
enumerable: true,
|
|
293
|
-
configurable: true
|
|
294
|
-
});
|
|
295
|
-
ActionsService.prototype.execute = function (toExecute) {
|
|
296
|
-
var _this = this;
|
|
297
|
-
if (!this.hasPending && !toExecute) {
|
|
298
|
-
return;
|
|
299
|
-
}
|
|
300
|
-
var actions = toExecute || this.clear();
|
|
301
|
-
if (!NgZone.isInAngularZone() && this.requiresZone(actions)) {
|
|
302
|
-
this.ngZone.run(function () {
|
|
303
|
-
_this.executeActions(actions);
|
|
304
|
-
});
|
|
305
|
-
}
|
|
306
|
-
else {
|
|
307
|
-
this.executeActions(actions);
|
|
308
|
-
}
|
|
309
|
-
};
|
|
310
|
-
ActionsService.prototype.clear = function () {
|
|
311
|
-
var actions = this.actions;
|
|
312
|
-
this.actions = [];
|
|
313
|
-
return actions;
|
|
314
|
-
};
|
|
315
|
-
ActionsService.prototype.executeActions = function (actions) {
|
|
316
|
-
for (var idx = 0; idx < actions.length; idx++) {
|
|
317
|
-
var _a = actions[idx], item = _a.item, name_1 = _a.name, prevented = _a.prevented, finished = _a.finished, domEvent = _a.domEvent;
|
|
318
|
-
if (!canPerformAction(item, name_1)) {
|
|
319
|
-
continue;
|
|
320
|
-
}
|
|
321
|
-
if (!this.emit(name_1, item, domEvent)) {
|
|
322
|
-
if (item[name_1]) {
|
|
323
|
-
item[name_1]();
|
|
324
|
-
}
|
|
325
|
-
if (finished) {
|
|
326
|
-
finished();
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
else if (prevented) {
|
|
330
|
-
prevented();
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
};
|
|
334
|
-
ActionsService.prototype.requiresZone = function (toExecute) {
|
|
335
|
-
var actions = toExecute || this.actions;
|
|
336
|
-
var owner = this.owner;
|
|
337
|
-
var contextService = owner.contextService;
|
|
338
|
-
for (var idx = 0; idx < actions.length; idx++) {
|
|
339
|
-
var action = actions[idx];
|
|
340
|
-
var name_2 = action.name;
|
|
341
|
-
if (action.requiresZone || (name_2 && (hasObservers(owner[name_2]) || (contextService && contextService.hasObservers(name_2))))) {
|
|
342
|
-
return true;
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
return false;
|
|
346
|
-
};
|
|
347
|
-
ActionsService.prototype.closeChildren = function (item) {
|
|
348
|
-
if (!item.opened) {
|
|
349
|
-
return;
|
|
350
|
-
}
|
|
351
|
-
var children = this.items.children(item);
|
|
352
|
-
this.closeItems(children);
|
|
353
|
-
};
|
|
354
|
-
ActionsService.prototype.closeItems = function (items) {
|
|
355
|
-
for (var idx = 0; idx < items.length; idx++) {
|
|
356
|
-
this.close(items[idx]);
|
|
357
|
-
}
|
|
358
|
-
};
|
|
359
|
-
ActionsService = __decorate([
|
|
360
|
-
Injectable(),
|
|
361
|
-
__metadata("design:paramtypes", [NgZone, ItemsService])
|
|
362
|
-
], ActionsService);
|
|
363
|
-
return ActionsService;
|
|
364
|
-
}());
|
|
365
|
-
|
|
366
|
-
var DEFAULT_ACTIVE = '0';
|
|
367
|
-
var NO_SPACE_REGEX = /\S/;
|
|
368
|
-
var handlers = {};
|
|
369
|
-
handlers['37'] = 'left';
|
|
370
|
-
handlers['39'] = 'right';
|
|
371
|
-
handlers['38'] = 'up';
|
|
372
|
-
handlers['40'] = 'down';
|
|
373
|
-
handlers['36'] = 'home';
|
|
374
|
-
handlers['35'] = 'end';
|
|
375
|
-
handlers['32'] = 'enter';
|
|
376
|
-
handlers['13'] = 'enter';
|
|
377
|
-
handlers['27'] = 'esc';
|
|
378
|
-
handlers['9'] = 'tab';
|
|
379
|
-
var handlersRTL = Object.assign({}, handlers, {
|
|
380
|
-
'37': 'right',
|
|
381
|
-
'39': 'left'
|
|
382
|
-
});
|
|
383
|
-
function isPrintableCharacter(key) {
|
|
384
|
-
return key.length === 1 && NO_SPACE_REGEX.test(key);
|
|
385
|
-
}
|
|
386
|
-
var resolvedPromise = Promise.resolve(null);
|
|
387
|
-
/**
|
|
388
|
-
* @hidden
|
|
389
|
-
*/
|
|
390
|
-
var NavigationService = /** @class */ (function () {
|
|
391
|
-
function NavigationService(items, actions, localization, ngZone) {
|
|
392
|
-
this.items = items;
|
|
393
|
-
this.actions = actions;
|
|
394
|
-
this.localization = localization;
|
|
395
|
-
this.ngZone = ngZone;
|
|
396
|
-
this.vertical = false;
|
|
397
|
-
this.activeIndex = DEFAULT_ACTIVE;
|
|
398
|
-
}
|
|
399
|
-
Object.defineProperty(NavigationService.prototype, "focusedItem", {
|
|
400
|
-
get: function () {
|
|
401
|
-
return this.items.get(this.focusedIdx);
|
|
402
|
-
},
|
|
403
|
-
enumerable: true,
|
|
404
|
-
configurable: true
|
|
405
|
-
});
|
|
406
|
-
Object.defineProperty(NavigationService.prototype, "activeItem", {
|
|
407
|
-
get: function () {
|
|
408
|
-
return this.items.get(this.activeIndex);
|
|
409
|
-
},
|
|
410
|
-
enumerable: true,
|
|
411
|
-
configurable: true
|
|
412
|
-
});
|
|
413
|
-
Object.defineProperty(NavigationService.prototype, "handlers", {
|
|
414
|
-
get: function () {
|
|
415
|
-
return this.localization.rtl ? handlersRTL : handlers;
|
|
416
|
-
},
|
|
417
|
-
enumerable: true,
|
|
418
|
-
configurable: true
|
|
419
|
-
});
|
|
420
|
-
NavigationService.prototype.focus = function (item) {
|
|
421
|
-
if (item.index === this.focusedIdx) {
|
|
422
|
-
return;
|
|
423
|
-
}
|
|
424
|
-
if (!this.activeItem || !this.items.hasParent(item, this.activeItem)) {
|
|
425
|
-
this.setActive(item);
|
|
426
|
-
}
|
|
427
|
-
this.setFocus(item);
|
|
428
|
-
};
|
|
429
|
-
NavigationService.prototype.setFocus = function (item) {
|
|
430
|
-
this.focusedIdx = item.index;
|
|
431
|
-
item.focus();
|
|
432
|
-
};
|
|
433
|
-
NavigationService.prototype.focusLeave = function () {
|
|
434
|
-
var focused = this.focusedItem;
|
|
435
|
-
if (focused) {
|
|
436
|
-
this.actions.closeToRoot(focused);
|
|
437
|
-
this.actions.execute();
|
|
438
|
-
}
|
|
439
|
-
this.focusedIdx = null;
|
|
440
|
-
};
|
|
441
|
-
NavigationService.prototype.updateActive = function () {
|
|
442
|
-
var _this = this;
|
|
443
|
-
if (!this.activeItem && this.items.hasItems) {
|
|
444
|
-
var firstItem = this.items.get(DEFAULT_ACTIVE);
|
|
445
|
-
firstItem.toggleActive(true);
|
|
446
|
-
this.ngZone.runOutsideAngular(function () {
|
|
447
|
-
resolvedPromise.then(function () {
|
|
448
|
-
_this.activeIndex = DEFAULT_ACTIVE;
|
|
449
|
-
});
|
|
450
|
-
});
|
|
451
|
-
}
|
|
452
|
-
};
|
|
453
|
-
NavigationService.prototype.keydown = function (e) {
|
|
454
|
-
var current = this.focusedItem || this.activeItem;
|
|
455
|
-
var handler = this.handlers[e.keyCode];
|
|
456
|
-
if (!current) {
|
|
457
|
-
return;
|
|
458
|
-
}
|
|
459
|
-
if (handler) {
|
|
460
|
-
if (handler !== 'tab') {
|
|
461
|
-
e.preventDefault();
|
|
462
|
-
}
|
|
463
|
-
this[handler](current, e);
|
|
464
|
-
}
|
|
465
|
-
else if (isPrintableCharacter(e.key)) {
|
|
466
|
-
this.search(current, e.key);
|
|
467
|
-
}
|
|
468
|
-
this.actions.execute();
|
|
469
|
-
};
|
|
470
|
-
NavigationService.prototype.focusIndex = function (index) {
|
|
471
|
-
if (!index && this.activeItem) {
|
|
472
|
-
this.setFocus(this.activeItem);
|
|
473
|
-
}
|
|
474
|
-
else if (index === 'first') {
|
|
475
|
-
this.focusFirst();
|
|
476
|
-
}
|
|
477
|
-
else if (index === 'last') {
|
|
478
|
-
this.focusLast();
|
|
479
|
-
}
|
|
480
|
-
else {
|
|
481
|
-
var item = this.items.get(index);
|
|
482
|
-
if (item) {
|
|
483
|
-
this.focus(item);
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
};
|
|
487
|
-
NavigationService.prototype.focusFirst = function () {
|
|
488
|
-
var items = this.items.siblings(this.items.get('0'));
|
|
489
|
-
this.focus(items[0]);
|
|
490
|
-
};
|
|
491
|
-
NavigationService.prototype.focusLast = function () {
|
|
492
|
-
var items = this.items.siblings(this.items.get('0'));
|
|
493
|
-
this.focus(items[items.length - 1]);
|
|
494
|
-
};
|
|
495
|
-
NavigationService.prototype.search = function (current, key) {
|
|
496
|
-
var siblings = this.items.siblings(current);
|
|
497
|
-
var startIndex = siblings.indexOf(current);
|
|
498
|
-
var items = siblings.slice(startIndex + 1).concat(siblings.slice(0, startIndex));
|
|
499
|
-
for (var idx = 0; idx < items.length; idx++) {
|
|
500
|
-
var sibling = items[idx];
|
|
501
|
-
var text = sibling.item.text || "";
|
|
502
|
-
if (text.toLowerCase().startsWith(key.toLowerCase())) {
|
|
503
|
-
this.focus(sibling);
|
|
504
|
-
break;
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
};
|
|
508
|
-
NavigationService.prototype.down = function (current) {
|
|
509
|
-
if (current.level === 0 && !this.vertical) {
|
|
510
|
-
if (current.hasContent) {
|
|
511
|
-
this.actions.open(current, this.focusChild(current, 0));
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
else {
|
|
515
|
-
this.focus(this.items.next(current));
|
|
516
|
-
}
|
|
517
|
-
};
|
|
518
|
-
NavigationService.prototype.up = function (current) {
|
|
519
|
-
if (current.level === 0 && !this.vertical) {
|
|
520
|
-
if (current.hasContent) {
|
|
521
|
-
this.actions.open(current, this.focusChild(current, current.children.length - 1));
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
else {
|
|
525
|
-
this.focus(this.items.previous(current));
|
|
526
|
-
}
|
|
527
|
-
};
|
|
528
|
-
NavigationService.prototype.left = function (current) {
|
|
529
|
-
if (this.vertical && current.level === 0 && current.disabled) {
|
|
530
|
-
return;
|
|
531
|
-
}
|
|
532
|
-
if (current.level > 1 || (this.vertical && current.level > 0)) {
|
|
533
|
-
var parent_1 = this.items.parent(current);
|
|
534
|
-
this.focus(parent_1);
|
|
535
|
-
this.actions.close(parent_1);
|
|
536
|
-
}
|
|
537
|
-
else if (this.vertical && current.level === 0 && !current.disabled) {
|
|
538
|
-
if (current.hasContent) {
|
|
539
|
-
this.actions.open(current, this.focusChild(current, current.children.length - 1));
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
else {
|
|
543
|
-
this.focus(this.items.previous(this.activeItem));
|
|
544
|
-
}
|
|
545
|
-
};
|
|
546
|
-
NavigationService.prototype.right = function (current) {
|
|
547
|
-
if (this.vertical && current.level === 0 && current.disabled) {
|
|
548
|
-
return;
|
|
549
|
-
}
|
|
550
|
-
if (current.horizontal && !current.disabled) {
|
|
551
|
-
if (current.hasContent) {
|
|
552
|
-
this.actions.open(current, this.focusChild(current, 0));
|
|
553
|
-
}
|
|
554
|
-
else if (!this.vertical || current.level > 0) {
|
|
555
|
-
this.focus(this.items.next(this.activeItem));
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
|
-
else {
|
|
559
|
-
this.focus(this.items.next(this.activeItem));
|
|
560
|
-
}
|
|
561
|
-
};
|
|
562
|
-
NavigationService.prototype.home = function (current) {
|
|
563
|
-
var siblings = this.items.siblings(current);
|
|
564
|
-
this.focus(siblings[0]);
|
|
565
|
-
};
|
|
566
|
-
NavigationService.prototype.end = function (current) {
|
|
567
|
-
var siblings = this.items.siblings(current);
|
|
568
|
-
this.focus(siblings[siblings.length - 1]);
|
|
569
|
-
};
|
|
570
|
-
NavigationService.prototype.enter = function (current, domEvent) {
|
|
571
|
-
var actions = this.actions;
|
|
572
|
-
if (current.disabled) {
|
|
573
|
-
return;
|
|
574
|
-
}
|
|
575
|
-
if (current.hasContent) {
|
|
576
|
-
actions.select(current, domEvent);
|
|
577
|
-
actions.open(current, this.focusChild(current, 0));
|
|
578
|
-
}
|
|
579
|
-
else {
|
|
580
|
-
actions.select(current, domEvent, null, function () {
|
|
581
|
-
current.navigate();
|
|
582
|
-
});
|
|
583
|
-
this.focus(this.items.root(current));
|
|
584
|
-
actions.closeToRoot(current);
|
|
585
|
-
}
|
|
586
|
-
};
|
|
587
|
-
NavigationService.prototype.esc = function (current) {
|
|
588
|
-
if (current.level > 0) {
|
|
589
|
-
var parent_2 = this.items.parent(current);
|
|
590
|
-
this.actions.close(parent_2);
|
|
591
|
-
this.focus(parent_2);
|
|
592
|
-
}
|
|
593
|
-
};
|
|
594
|
-
NavigationService.prototype.tab = function (current) {
|
|
595
|
-
if (current.level > 0) {
|
|
596
|
-
this.activeItem.focus();
|
|
597
|
-
}
|
|
598
|
-
};
|
|
599
|
-
NavigationService.prototype.focusChild = function (item, index) {
|
|
600
|
-
var _this = this;
|
|
601
|
-
return function () {
|
|
602
|
-
var child = _this.items.children(item)[index];
|
|
603
|
-
_this.setFocus(child);
|
|
604
|
-
};
|
|
605
|
-
};
|
|
606
|
-
NavigationService.prototype.setActive = function (item) {
|
|
607
|
-
var focused = this.focusedItem;
|
|
608
|
-
var active = this.items.root(item);
|
|
609
|
-
if (this.activeItem) {
|
|
610
|
-
this.activeItem.toggleActive(false);
|
|
611
|
-
}
|
|
612
|
-
this.activeIndex = active.index;
|
|
613
|
-
active.toggleActive(true);
|
|
614
|
-
if (focused) {
|
|
615
|
-
this.actions.closeToRoot(focused);
|
|
616
|
-
if (focused.level > 0) {
|
|
617
|
-
this.actions.open(active);
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
|
-
};
|
|
621
|
-
NavigationService = __decorate([
|
|
622
|
-
Injectable(),
|
|
623
|
-
__metadata("design:paramtypes", [ItemsService,
|
|
624
|
-
ActionsService,
|
|
625
|
-
LocalizationService,
|
|
626
|
-
NgZone])
|
|
627
|
-
], NavigationService);
|
|
628
|
-
return NavigationService;
|
|
629
|
-
}());
|
|
630
|
-
|
|
631
|
-
var DISABLE_OPEN_ON_OVER_DELAY = 500;
|
|
632
|
-
/**
|
|
633
|
-
* @hidden
|
|
634
|
-
*/
|
|
635
|
-
var HoverService = /** @class */ (function () {
|
|
636
|
-
function HoverService(actions, items) {
|
|
637
|
-
this.actions = actions;
|
|
638
|
-
this.items = items;
|
|
639
|
-
this.delay = 100;
|
|
640
|
-
this._openOnOver = true;
|
|
641
|
-
this.scheduled = [];
|
|
642
|
-
}
|
|
643
|
-
Object.defineProperty(HoverService.prototype, "openOnOver", {
|
|
644
|
-
get: function () {
|
|
645
|
-
return this._openOnOver;
|
|
646
|
-
},
|
|
647
|
-
set: function (value) {
|
|
648
|
-
this.cancelActions();
|
|
649
|
-
this._openOnOver = value;
|
|
650
|
-
},
|
|
651
|
-
enumerable: true,
|
|
652
|
-
configurable: true
|
|
653
|
-
});
|
|
654
|
-
Object.defineProperty(HoverService.prototype, "hovered", {
|
|
655
|
-
get: function () {
|
|
656
|
-
return this.items.get(this.hoveredIdx);
|
|
657
|
-
},
|
|
658
|
-
set: function (item) {
|
|
659
|
-
this.hoveredIdx = item ? item.index : null;
|
|
660
|
-
},
|
|
661
|
-
enumerable: true,
|
|
662
|
-
configurable: true
|
|
663
|
-
});
|
|
664
|
-
HoverService.prototype.ngOnDestroy = function () {
|
|
665
|
-
this.cancelActions();
|
|
666
|
-
};
|
|
667
|
-
HoverService.prototype.over = function (item) {
|
|
668
|
-
var _this = this;
|
|
669
|
-
this.cancelActions(function (action) { return action.name === 'openOnOver'; });
|
|
670
|
-
if (!this.hovered || this.hovered !== item) {
|
|
671
|
-
this.actions.closeOthers(item);
|
|
672
|
-
this.hovered = item;
|
|
673
|
-
if ((item.level > 0 || this.openOnOver) && !item.disabled) {
|
|
674
|
-
this.actions.open(item);
|
|
675
|
-
this.cancelActions(function (action) {
|
|
676
|
-
return (action.name === 'close' && (item === action.item || _this.items.hasParent(item, action.item))) ||
|
|
677
|
-
(action.name === 'open' && !_this.items.hasParent(item, action.item));
|
|
678
|
-
});
|
|
679
|
-
}
|
|
680
|
-
this.scheduleActions();
|
|
681
|
-
}
|
|
682
|
-
};
|
|
683
|
-
HoverService.prototype.leave = function (disableOpenOnOver) {
|
|
684
|
-
var hovered = this.hovered;
|
|
685
|
-
if (hovered) {
|
|
686
|
-
this.actions.closeToRoot(hovered);
|
|
687
|
-
this.cancelActions(function (action) { return action.name === 'open'; });
|
|
688
|
-
this.scheduleActions();
|
|
689
|
-
}
|
|
690
|
-
if (disableOpenOnOver && this._openOnOver) {
|
|
691
|
-
this.scheduleDisableOpenOnOver();
|
|
692
|
-
}
|
|
693
|
-
this.hovered = null;
|
|
694
|
-
};
|
|
695
|
-
HoverService.prototype.closeCurrent = function () {
|
|
696
|
-
var hovered = this.hovered;
|
|
697
|
-
if (hovered) {
|
|
698
|
-
this.actions.closeToRoot(hovered);
|
|
699
|
-
this.hovered = null;
|
|
700
|
-
}
|
|
701
|
-
};
|
|
702
|
-
HoverService.prototype.scheduleActions = function () {
|
|
703
|
-
var _this = this;
|
|
704
|
-
if (this.actions.hasPending) {
|
|
705
|
-
var item_1 = {};
|
|
706
|
-
item_1.actions = this.actions.clear();
|
|
707
|
-
item_1.id = setTimeout(function () {
|
|
708
|
-
_this.actions.execute(item_1.actions);
|
|
709
|
-
_this.removeScheduled(item_1);
|
|
710
|
-
}, this.delay);
|
|
711
|
-
this.scheduled.push(item_1);
|
|
712
|
-
}
|
|
713
|
-
};
|
|
714
|
-
HoverService.prototype.scheduleDisableOpenOnOver = function () {
|
|
715
|
-
var _this = this;
|
|
716
|
-
var item = {
|
|
717
|
-
actions: [{ name: 'openOnOver' }]
|
|
718
|
-
};
|
|
719
|
-
item.id = setTimeout(function () {
|
|
720
|
-
_this._openOnOver = false;
|
|
721
|
-
_this.removeScheduled(item);
|
|
722
|
-
}, Math.max(this.delay, DISABLE_OPEN_ON_OVER_DELAY));
|
|
723
|
-
this.scheduled.push(item);
|
|
724
|
-
};
|
|
725
|
-
HoverService.prototype.removeScheduled = function (item) {
|
|
726
|
-
var scheduled = this.scheduled;
|
|
727
|
-
for (var idx = 0; idx < scheduled.length; idx++) {
|
|
728
|
-
if (scheduled[idx] === item) {
|
|
729
|
-
scheduled.splice(idx, 1);
|
|
730
|
-
return;
|
|
731
|
-
}
|
|
732
|
-
}
|
|
733
|
-
};
|
|
734
|
-
HoverService.prototype.cancelActions = function (predicate) {
|
|
735
|
-
var scheduled = this.scheduled;
|
|
736
|
-
for (var idx = scheduled.length - 1; idx >= 0; idx--) {
|
|
737
|
-
var item = scheduled[idx];
|
|
738
|
-
var actions = item.actions;
|
|
739
|
-
if (predicate) {
|
|
740
|
-
for (var actionIdx = actions.length - 1; actionIdx >= 0; actionIdx--) {
|
|
741
|
-
if (predicate(actions[actionIdx])) {
|
|
742
|
-
actions.splice(actionIdx, 1);
|
|
743
|
-
}
|
|
744
|
-
}
|
|
745
|
-
}
|
|
746
|
-
if (!predicate || actions.length === 0) {
|
|
747
|
-
clearTimeout(item.id);
|
|
748
|
-
scheduled.splice(idx, 1);
|
|
749
|
-
}
|
|
750
|
-
}
|
|
751
|
-
};
|
|
752
|
-
HoverService = __decorate([
|
|
753
|
-
Injectable(),
|
|
754
|
-
__metadata("design:paramtypes", [ActionsService, ItemsService])
|
|
755
|
-
], HoverService);
|
|
756
|
-
return HoverService;
|
|
757
|
-
}());
|
|
758
|
-
|
|
759
|
-
/* tslint:disable:max-line-length */
|
|
760
|
-
/**
|
|
761
|
-
* @hidden
|
|
762
|
-
*/
|
|
763
|
-
var normalize = function (settings) {
|
|
764
|
-
return settings && Object.assign({
|
|
765
|
-
toggle: 'select'
|
|
766
|
-
}, settings);
|
|
767
|
-
};
|
|
768
|
-
|
|
769
|
-
/**
|
|
770
|
-
* @hidden
|
|
771
|
-
*/
|
|
772
|
-
var NODE_INDEX = 'data-kendo-menu-index';
|
|
773
|
-
|
|
774
|
-
var DEFAULT_ID = 'kendo-matches-container';
|
|
775
|
-
var focusableRegex = /^(?:a|input|select|option|textarea|button|object)$/i;
|
|
776
|
-
var matches = function (element, selector) { return (element.matches || element.msMatchesSelector).call(element, selector); };
|
|
777
|
-
/**
|
|
778
|
-
* @hidden
|
|
779
|
-
*/
|
|
780
|
-
var closest = function (node, predicate) {
|
|
781
|
-
while (node && !predicate(node)) {
|
|
782
|
-
node = node.parentNode;
|
|
783
|
-
}
|
|
784
|
-
return node;
|
|
785
|
-
};
|
|
786
|
-
/**
|
|
787
|
-
* @hidden
|
|
788
|
-
*/
|
|
789
|
-
var closestInScope = function (node, predicate, scope) {
|
|
790
|
-
while (node && node !== scope && !predicate(node)) {
|
|
791
|
-
node = node.parentNode;
|
|
792
|
-
}
|
|
793
|
-
if (node !== scope) {
|
|
794
|
-
return node;
|
|
795
|
-
}
|
|
796
|
-
};
|
|
797
|
-
/**
|
|
798
|
-
* @hidden
|
|
799
|
-
*/
|
|
800
|
-
var isFocusable = function (element) {
|
|
801
|
-
if (element.tagName) {
|
|
802
|
-
var tagName = element.tagName.toLowerCase();
|
|
803
|
-
var tabIndex = element.getAttribute('tabIndex');
|
|
804
|
-
var skipTab = tabIndex === '-1';
|
|
805
|
-
var focusable = tabIndex !== null && !skipTab;
|
|
806
|
-
if (focusableRegex.test(tagName)) {
|
|
807
|
-
focusable = !element.disabled && !skipTab;
|
|
808
|
-
}
|
|
809
|
-
return focusable;
|
|
810
|
-
}
|
|
811
|
-
return false;
|
|
812
|
-
};
|
|
813
|
-
var toClassList = function (classNames) { return String(classNames).trim().split(' '); };
|
|
814
|
-
/**
|
|
815
|
-
* @hidden
|
|
816
|
-
*/
|
|
817
|
-
var hasClass = function (element, name) {
|
|
818
|
-
return toClassList(element.className).indexOf(name) >= 0;
|
|
819
|
-
};
|
|
820
|
-
/**
|
|
821
|
-
* @hidden
|
|
822
|
-
*/
|
|
823
|
-
var matchesClasses = function (classes) {
|
|
824
|
-
var list = toClassList(classes);
|
|
825
|
-
return function (element) {
|
|
826
|
-
var classList = toClassList(element.className);
|
|
827
|
-
return Boolean(list.find(function (name) { return classList.indexOf(name) >= 0; }));
|
|
828
|
-
};
|
|
829
|
-
};
|
|
830
|
-
/**
|
|
831
|
-
* @hidden
|
|
832
|
-
*/
|
|
833
|
-
var nodeIndex = function (node) { return node.getAttribute(NODE_INDEX); };
|
|
834
|
-
/**
|
|
835
|
-
* @hidden
|
|
836
|
-
*/
|
|
837
|
-
var closestItem = function (node, scope) { return closestInScope(node, nodeIndex, scope); };
|
|
838
|
-
/**
|
|
839
|
-
* @hidden
|
|
840
|
-
*/
|
|
841
|
-
var closestList = function (node) {
|
|
842
|
-
var list = closest(node, matchesClasses('k-menu-popup k-menu k-menu-group'));
|
|
843
|
-
if (list && hasClass(list, 'k-menu-popup')) {
|
|
844
|
-
list = list.querySelector('.k-menu-group');
|
|
845
|
-
}
|
|
846
|
-
return list;
|
|
847
|
-
};
|
|
848
|
-
/**
|
|
849
|
-
* @hidden
|
|
850
|
-
*/
|
|
851
|
-
var inMenu = function (node, itemsService) {
|
|
852
|
-
if (node === itemsService.lists[0].element.nativeElement) {
|
|
853
|
-
return false;
|
|
854
|
-
}
|
|
855
|
-
var list = closestList(node);
|
|
856
|
-
return list && itemsService.containsList(list);
|
|
857
|
-
};
|
|
858
|
-
/**
|
|
859
|
-
* @hidden
|
|
860
|
-
*/
|
|
861
|
-
var findInContainer = function (element, selector, container) {
|
|
862
|
-
var id = container.getAttribute('id');
|
|
863
|
-
if (!id) {
|
|
864
|
-
container.setAttribute('id', DEFAULT_ID);
|
|
865
|
-
}
|
|
866
|
-
var contextSelector = "#" + (id || DEFAULT_ID) + " " + selector;
|
|
867
|
-
var match = closestInScope(element, function (node) { return matches(node, contextSelector); }, container);
|
|
868
|
-
if (!id) {
|
|
869
|
-
container.removeAttribute('id');
|
|
870
|
-
}
|
|
871
|
-
return match;
|
|
872
|
-
};
|
|
873
|
-
|
|
874
|
-
/**
|
|
875
|
-
* @hidden
|
|
876
|
-
*/
|
|
877
|
-
var ContextMenuService = /** @class */ (function () {
|
|
878
|
-
function ContextMenuService() {
|
|
879
|
-
this.keydown = new EventEmitter();
|
|
880
|
-
}
|
|
881
|
-
ContextMenuService.prototype.emit = function (name, args) {
|
|
882
|
-
this.owner.emitMenuEvent(name, args);
|
|
883
|
-
};
|
|
884
|
-
ContextMenuService.prototype.hasObservers = function (name) {
|
|
885
|
-
return this.owner && hasObservers(this.owner[name]);
|
|
886
|
-
};
|
|
887
|
-
ContextMenuService.prototype.leaveMenu = function (e) {
|
|
888
|
-
return this.items ? !inMenu(e.target, this.items) : true;
|
|
889
|
-
};
|
|
890
|
-
ContextMenuService = __decorate([
|
|
891
|
-
Injectable()
|
|
892
|
-
], ContextMenuService);
|
|
893
|
-
return ContextMenuService;
|
|
894
|
-
}());
|
|
895
|
-
|
|
896
|
-
/**
|
|
897
|
-
* Represents a template for the Menu items ([see example]({% slug templates_menu %})). To define a template
|
|
898
|
-
* for an item, nest an `<ng-template>` tag with the `kendoMenuItemTemplate` directive inside a `<kendo-menu-item>`
|
|
899
|
-
* component. To define a template for all Menu items, nest the template inside the `<kendo-menu>` component.
|
|
900
|
-
*
|
|
901
|
-
* The available fields in the template context are:
|
|
902
|
-
* - `item`—The item data.
|
|
903
|
-
* - `index`—The item index.
|
|
904
|
-
*
|
|
905
|
-
* @example
|
|
906
|
-
* ```ts-preview
|
|
907
|
-
*
|
|
908
|
-
* _@Component({
|
|
909
|
-
* selector: 'my-app',
|
|
910
|
-
* template: `
|
|
911
|
-
* <kendo-menu>
|
|
912
|
-
* <kendo-menu-item text="item2">
|
|
913
|
-
* <ng-template kendoMenuItemTemplate let-item="item" let-index="index">
|
|
914
|
-
* <div style="padding: 10px;">
|
|
915
|
-
* My Template for: {{ item.text }} at index: {{ index }}
|
|
916
|
-
* </div>
|
|
917
|
-
* </ng-template>
|
|
918
|
-
* </kendo-menu-item>
|
|
919
|
-
* </kendo-menu>
|
|
920
|
-
* `
|
|
921
|
-
* })
|
|
922
|
-
*
|
|
923
|
-
* class AppComponent {
|
|
924
|
-
* }
|
|
925
|
-
* ```
|
|
926
|
-
*/
|
|
927
|
-
var ItemTemplateDirective = /** @class */ (function () {
|
|
928
|
-
function ItemTemplateDirective(templateRef) {
|
|
929
|
-
this.templateRef = templateRef;
|
|
930
|
-
}
|
|
931
|
-
ItemTemplateDirective = __decorate([
|
|
932
|
-
Directive({
|
|
933
|
-
selector: '[kendoMenuItemTemplate]'
|
|
934
|
-
}),
|
|
935
|
-
__param(0, Optional()),
|
|
936
|
-
__metadata("design:paramtypes", [TemplateRef])
|
|
937
|
-
], ItemTemplateDirective);
|
|
938
|
-
return ItemTemplateDirective;
|
|
939
|
-
}());
|
|
940
|
-
|
|
941
|
-
/**
|
|
942
|
-
* Represents a template for the links of the Menu items ([see example]({% slug templates_menu %})). To define a template
|
|
943
|
-
* for an item, nest an `<ng-template>` tag with the `kendoMenuItemLinkTemplate` directive inside a `<kendo-menu-item>`
|
|
944
|
-
* component. To define a template for all Menu items, nest the template inside the `<kendo-menu>` component.
|
|
945
|
-
*
|
|
946
|
-
* The available fields in the template context are:
|
|
947
|
-
* - `item`—The item data.
|
|
948
|
-
* - `index`—The item index.
|
|
949
|
-
*
|
|
950
|
-
* @example
|
|
951
|
-
* ```ts-preview
|
|
952
|
-
*
|
|
953
|
-
* _@Component({
|
|
954
|
-
* selector: 'my-app',
|
|
955
|
-
* template: `
|
|
956
|
-
* <kendo-menu>
|
|
957
|
-
* <kendo-menu-item text="item2">
|
|
958
|
-
* <ng-template kendoMenuItemLinkTemplate let-item="item" let-index="index">
|
|
959
|
-
* <span [kendoMenuItemLink]="index">
|
|
960
|
-
* {{ item.text }}
|
|
961
|
-
* <span *ngIf="item.items && item.items.length" [kendoMenuExpandArrow]="index"></span>
|
|
962
|
-
* </span>
|
|
963
|
-
* </ng-template>
|
|
964
|
-
* </kendo-menu-item>
|
|
965
|
-
* </kendo-menu>
|
|
966
|
-
* `
|
|
967
|
-
* })
|
|
968
|
-
*
|
|
969
|
-
* class AppComponent {
|
|
970
|
-
* }
|
|
971
|
-
* ```
|
|
972
|
-
*/
|
|
973
|
-
var ItemLinkTemplateDirective = /** @class */ (function () {
|
|
974
|
-
function ItemLinkTemplateDirective(templateRef) {
|
|
975
|
-
this.templateRef = templateRef;
|
|
976
|
-
}
|
|
977
|
-
ItemLinkTemplateDirective = __decorate([
|
|
978
|
-
Directive({
|
|
979
|
-
selector: '[kendoMenuItemLinkTemplate]'
|
|
980
|
-
}),
|
|
981
|
-
__param(0, Optional()),
|
|
982
|
-
__metadata("design:paramtypes", [TemplateRef])
|
|
983
|
-
], ItemLinkTemplateDirective);
|
|
984
|
-
return ItemLinkTemplateDirective;
|
|
985
|
-
}());
|
|
986
|
-
|
|
987
|
-
/**
|
|
988
|
-
* Represents a template for the content of the Menu items ([see example]({% slug templates_menu %})). To define the template,
|
|
989
|
-
* nest an `<ng-template>` tag with the `kendoMenuItemContentTemplate` directive inside a `<kendo-menu-item>` component.
|
|
990
|
-
*
|
|
991
|
-
* The available fields in the template context are:
|
|
992
|
-
* - `item`—The item data.
|
|
993
|
-
* - `index`—The item index.
|
|
994
|
-
*
|
|
995
|
-
* @example
|
|
996
|
-
* ```ts-preview
|
|
997
|
-
*
|
|
998
|
-
* _@Component({
|
|
999
|
-
* selector: 'my-app',
|
|
1000
|
-
* template: `
|
|
1001
|
-
* <kendo-menu>
|
|
1002
|
-
* <kendo-menu-item text="item2">
|
|
1003
|
-
* <ng-template kendoMenuItemContentTemplate let-item="item" let-index="index">
|
|
1004
|
-
* <div style="padding: 10px;">
|
|
1005
|
-
* My Content Template for: {{ item.text }} at index: {{ index }}
|
|
1006
|
-
* </div>
|
|
1007
|
-
* </ng-template>
|
|
1008
|
-
* </kendo-menu-item>
|
|
1009
|
-
* </kendo-menu>
|
|
1010
|
-
* `
|
|
1011
|
-
* })
|
|
1012
|
-
*
|
|
1013
|
-
* class AppComponent {
|
|
1014
|
-
* }
|
|
1015
|
-
* ```
|
|
1016
|
-
*/
|
|
1017
|
-
var ItemContentTemplateDirective = /** @class */ (function () {
|
|
1018
|
-
function ItemContentTemplateDirective(templateRef) {
|
|
1019
|
-
this.templateRef = templateRef;
|
|
1020
|
-
}
|
|
1021
|
-
ItemContentTemplateDirective = __decorate([
|
|
1022
|
-
Directive({
|
|
1023
|
-
selector: '[kendoMenuItemContentTemplate]'
|
|
1024
|
-
}),
|
|
1025
|
-
__param(0, Optional()),
|
|
1026
|
-
__metadata("design:paramtypes", [TemplateRef])
|
|
1027
|
-
], ItemContentTemplateDirective);
|
|
1028
|
-
return ItemContentTemplateDirective;
|
|
1029
|
-
}());
|
|
1030
|
-
|
|
1031
|
-
/**
|
|
1032
|
-
* A component that can be used to specify the Menu items
|
|
1033
|
-
* ([more information and examples]({% slug items_menu %})).
|
|
1034
|
-
*
|
|
1035
|
-
* @example
|
|
1036
|
-
* ```ts-preview
|
|
1037
|
-
*
|
|
1038
|
-
* _@Component({
|
|
1039
|
-
* selector: 'my-app',
|
|
1040
|
-
* template: `
|
|
1041
|
-
* <kendo-menu>
|
|
1042
|
-
* <kendo-menu-item text="item1">
|
|
1043
|
-
* <kendo-menu-item text="item1.1" url="https://example.com">
|
|
1044
|
-
* </kendo-menu-item>
|
|
1045
|
-
* <kendo-menu-item text="item1.2" [disabled]="true">
|
|
1046
|
-
* </kendo-menu-item>
|
|
1047
|
-
* </kendo-menu-item>
|
|
1048
|
-
* <kendo-menu-item text="item2">
|
|
1049
|
-
* <ng-template kendoMenuItemContentTemplate let-item="item">
|
|
1050
|
-
* <div style="padding: 10px;">
|
|
1051
|
-
* My Content Template: {{ item.text }}
|
|
1052
|
-
* </div>
|
|
1053
|
-
* </ng-template>
|
|
1054
|
-
* <ng-template kendoMenuItemTemplate let-item="item">
|
|
1055
|
-
* <div style="padding: 10px;">
|
|
1056
|
-
* My Template: {{ item.text }}
|
|
1057
|
-
* </div>
|
|
1058
|
-
* </ng-template>
|
|
1059
|
-
* </kendo-menu-item>
|
|
1060
|
-
* <kendo-menu-item text="item3">
|
|
1061
|
-
* <ng-template kendoMenuItemLinkTemplate let-item="item" let-index="index">
|
|
1062
|
-
* <span [kendoMenuItemLink]="index">
|
|
1063
|
-
* {{ item.text }}
|
|
1064
|
-
* <span *ngIf="item.items && item.items.length" [kendoMenuExpandArrow]="index"></span>
|
|
1065
|
-
* </span>
|
|
1066
|
-
* </ng-template>
|
|
1067
|
-
* </kendo-menu-item>
|
|
1068
|
-
* </kendo-menu>
|
|
1069
|
-
* `
|
|
1070
|
-
* })
|
|
1071
|
-
*
|
|
1072
|
-
* class AppComponent {
|
|
1073
|
-
* }
|
|
1074
|
-
* ```
|
|
1075
|
-
*/
|
|
1076
|
-
var MenuItemComponent = /** @class */ (function () {
|
|
1077
|
-
function MenuItemComponent() {
|
|
1078
|
-
}
|
|
1079
|
-
MenuItemComponent_1 = MenuItemComponent;
|
|
1080
|
-
Object.defineProperty(MenuItemComponent.prototype, "template", {
|
|
1081
|
-
/**
|
|
1082
|
-
* @hidden
|
|
1083
|
-
*/
|
|
1084
|
-
get: function () {
|
|
1085
|
-
if (this.itemTemplate && this.itemTemplate.length) {
|
|
1086
|
-
return this.itemTemplate.first.templateRef;
|
|
1087
|
-
}
|
|
1088
|
-
},
|
|
1089
|
-
enumerable: true,
|
|
1090
|
-
configurable: true
|
|
1091
|
-
});
|
|
1092
|
-
Object.defineProperty(MenuItemComponent.prototype, "linkTemplate", {
|
|
1093
|
-
/**
|
|
1094
|
-
* @hidden
|
|
1095
|
-
*/
|
|
1096
|
-
get: function () {
|
|
1097
|
-
if (this.itemLinkTemplate && this.itemLinkTemplate.length) {
|
|
1098
|
-
return this.itemLinkTemplate.first.templateRef;
|
|
1099
|
-
}
|
|
1100
|
-
},
|
|
1101
|
-
enumerable: true,
|
|
1102
|
-
configurable: true
|
|
1103
|
-
});
|
|
1104
|
-
Object.defineProperty(MenuItemComponent.prototype, "contentTemplate", {
|
|
1105
|
-
/**
|
|
1106
|
-
* @hidden
|
|
1107
|
-
*/
|
|
1108
|
-
get: function () {
|
|
1109
|
-
if (this.itemContentTemplate && this.itemContentTemplate.length) {
|
|
1110
|
-
return this.itemContentTemplate.first.templateRef;
|
|
1111
|
-
}
|
|
1112
|
-
},
|
|
1113
|
-
enumerable: true,
|
|
1114
|
-
configurable: true
|
|
1115
|
-
});
|
|
1116
|
-
Object.defineProperty(MenuItemComponent.prototype, "items", {
|
|
1117
|
-
/**
|
|
1118
|
-
* @hidden
|
|
1119
|
-
*/
|
|
1120
|
-
get: function () {
|
|
1121
|
-
var _this = this;
|
|
1122
|
-
if (this.children.length) {
|
|
1123
|
-
return this.children.toArray().filter(function (c) { return c !== _this; });
|
|
1124
|
-
}
|
|
1125
|
-
},
|
|
1126
|
-
enumerable: true,
|
|
1127
|
-
configurable: true
|
|
1128
|
-
});
|
|
1129
|
-
var MenuItemComponent_1;
|
|
1130
|
-
__decorate([
|
|
1131
|
-
Input(),
|
|
1132
|
-
__metadata("design:type", String)
|
|
1133
|
-
], MenuItemComponent.prototype, "text", void 0);
|
|
1134
|
-
__decorate([
|
|
1135
|
-
Input(),
|
|
1136
|
-
__metadata("design:type", String)
|
|
1137
|
-
], MenuItemComponent.prototype, "url", void 0);
|
|
1138
|
-
__decorate([
|
|
1139
|
-
Input(),
|
|
1140
|
-
__metadata("design:type", Boolean)
|
|
1141
|
-
], MenuItemComponent.prototype, "disabled", void 0);
|
|
1142
|
-
__decorate([
|
|
1143
|
-
Input(),
|
|
1144
|
-
__metadata("design:type", Object)
|
|
1145
|
-
], MenuItemComponent.prototype, "cssClass", void 0);
|
|
1146
|
-
__decorate([
|
|
1147
|
-
Input(),
|
|
1148
|
-
__metadata("design:type", Object)
|
|
1149
|
-
], MenuItemComponent.prototype, "cssStyle", void 0);
|
|
1150
|
-
__decorate([
|
|
1151
|
-
Input(),
|
|
1152
|
-
__metadata("design:type", String)
|
|
1153
|
-
], MenuItemComponent.prototype, "icon", void 0);
|
|
1154
|
-
__decorate([
|
|
1155
|
-
Input(),
|
|
1156
|
-
__metadata("design:type", Object)
|
|
1157
|
-
], MenuItemComponent.prototype, "data", void 0);
|
|
1158
|
-
__decorate([
|
|
1159
|
-
Input(),
|
|
1160
|
-
__metadata("design:type", Boolean)
|
|
1161
|
-
], MenuItemComponent.prototype, "separator", void 0);
|
|
1162
|
-
__decorate([
|
|
1163
|
-
ContentChildren(ItemTemplateDirective),
|
|
1164
|
-
__metadata("design:type", QueryList)
|
|
1165
|
-
], MenuItemComponent.prototype, "itemTemplate", void 0);
|
|
1166
|
-
__decorate([
|
|
1167
|
-
ContentChildren(ItemLinkTemplateDirective),
|
|
1168
|
-
__metadata("design:type", QueryList)
|
|
1169
|
-
], MenuItemComponent.prototype, "itemLinkTemplate", void 0);
|
|
1170
|
-
__decorate([
|
|
1171
|
-
ContentChildren(ItemContentTemplateDirective),
|
|
1172
|
-
__metadata("design:type", QueryList)
|
|
1173
|
-
], MenuItemComponent.prototype, "itemContentTemplate", void 0);
|
|
1174
|
-
__decorate([
|
|
1175
|
-
ContentChildren(MenuItemComponent_1),
|
|
1176
|
-
__metadata("design:type", QueryList)
|
|
1177
|
-
], MenuItemComponent.prototype, "children", void 0);
|
|
1178
|
-
MenuItemComponent = MenuItemComponent_1 = __decorate([
|
|
1179
|
-
Component({
|
|
1180
|
-
selector: 'kendo-menu-item',
|
|
1181
|
-
template: ""
|
|
1182
|
-
})
|
|
1183
|
-
], MenuItemComponent);
|
|
1184
|
-
return MenuItemComponent;
|
|
1185
|
-
}());
|
|
1186
|
-
|
|
1187
|
-
/**
|
|
1188
|
-
* @hidden
|
|
1189
|
-
*/
|
|
1190
|
-
var MenuBase = /** @class */ (function () {
|
|
1191
|
-
function MenuBase() {
|
|
1192
|
-
/**
|
|
1193
|
-
* Specifies if the Menu will be vertical ([see example]({% slug vertical_menu %})).
|
|
1194
|
-
*/
|
|
1195
|
-
this.vertical = false;
|
|
1196
|
-
/**
|
|
1197
|
-
* Specifies that the root items can be opened only on click
|
|
1198
|
-
* ([see example]({% slug openclose_menu %}#toc-opening-on-click)).
|
|
1199
|
-
*/
|
|
1200
|
-
this.openOnClick = false;
|
|
1201
|
-
/**
|
|
1202
|
-
* Specifies the delay in milliseconds before the Menu items are opened or closed on item hover
|
|
1203
|
-
* or leave ([see example]({% slug openclose_menu %}#toc-delay-on-hover)). Used to avoid the accidental
|
|
1204
|
-
* opening or closing of the items.
|
|
1205
|
-
*/
|
|
1206
|
-
this.hoverDelay = 100;
|
|
1207
|
-
/**
|
|
1208
|
-
* Sets the Menu animation.
|
|
1209
|
-
*/
|
|
1210
|
-
this.animate = true;
|
|
1211
|
-
}
|
|
1212
|
-
Object.defineProperty(MenuBase.prototype, "rootItems", {
|
|
1213
|
-
/**
|
|
1214
|
-
* @hidden
|
|
1215
|
-
*/
|
|
1216
|
-
get: function () {
|
|
1217
|
-
return this.items || (this.children ? this.children.toArray() : []);
|
|
1218
|
-
},
|
|
1219
|
-
enumerable: true,
|
|
1220
|
-
configurable: true
|
|
1221
|
-
});
|
|
1222
|
-
__decorate([
|
|
1223
|
-
Input(),
|
|
1224
|
-
__metadata("design:type", Array)
|
|
1225
|
-
], MenuBase.prototype, "items", void 0);
|
|
1226
|
-
__decorate([
|
|
1227
|
-
Input(),
|
|
1228
|
-
__metadata("design:type", Boolean)
|
|
1229
|
-
], MenuBase.prototype, "vertical", void 0);
|
|
1230
|
-
__decorate([
|
|
1231
|
-
Input(),
|
|
1232
|
-
__metadata("design:type", Object)
|
|
1233
|
-
], MenuBase.prototype, "openOnClick", void 0);
|
|
1234
|
-
__decorate([
|
|
1235
|
-
Input(),
|
|
1236
|
-
__metadata("design:type", Number)
|
|
1237
|
-
], MenuBase.prototype, "hoverDelay", void 0);
|
|
1238
|
-
__decorate([
|
|
1239
|
-
Input(),
|
|
1240
|
-
__metadata("design:type", Object)
|
|
1241
|
-
], MenuBase.prototype, "animate", void 0);
|
|
1242
|
-
__decorate([
|
|
1243
|
-
ContentChildren(ItemTemplateDirective),
|
|
1244
|
-
__metadata("design:type", QueryList)
|
|
1245
|
-
], MenuBase.prototype, "itemTemplate", void 0);
|
|
1246
|
-
__decorate([
|
|
1247
|
-
ContentChildren(ItemLinkTemplateDirective),
|
|
1248
|
-
__metadata("design:type", QueryList)
|
|
1249
|
-
], MenuBase.prototype, "itemLinkTemplate", void 0);
|
|
1250
|
-
__decorate([
|
|
1251
|
-
ContentChildren(MenuItemComponent),
|
|
1252
|
-
__metadata("design:type", QueryList)
|
|
1253
|
-
], MenuBase.prototype, "children", void 0);
|
|
1254
|
-
return MenuBase;
|
|
1255
|
-
}());
|
|
1256
|
-
|
|
1257
|
-
/**
|
|
1258
|
-
* Represents the [Kendo UI Menu component for Angular]({% slug overview_menu %}).
|
|
1259
|
-
*
|
|
1260
|
-
* @example
|
|
1261
|
-
* ```ts
|
|
1262
|
-
* _@Component({
|
|
1263
|
-
* selector: 'my-app',
|
|
1264
|
-
* template: `
|
|
1265
|
-
* <kendo-menu [items]="items">
|
|
1266
|
-
* </kendo-menu>
|
|
1267
|
-
* `
|
|
1268
|
-
* })
|
|
1269
|
-
* class AppComponent {
|
|
1270
|
-
* public items: any[] = [{ text: 'item1', items: [{ text: 'item1.1' }] }, { text: 'item2', disabled: true }];
|
|
1271
|
-
* }
|
|
1272
|
-
* ```
|
|
1273
|
-
*/
|
|
1274
|
-
var MenuComponent = /** @class */ (function (_super) {
|
|
1275
|
-
__extends(MenuComponent, _super);
|
|
1276
|
-
function MenuComponent(itemsService, hover, actions, navigation, localization, ngZone, renderer, contextService) {
|
|
1277
|
-
var _this = _super.call(this) || this;
|
|
1278
|
-
_this.itemsService = itemsService;
|
|
1279
|
-
_this.hover = hover;
|
|
1280
|
-
_this.actions = actions;
|
|
1281
|
-
_this.navigation = navigation;
|
|
1282
|
-
_this.localization = localization;
|
|
1283
|
-
_this.ngZone = ngZone;
|
|
1284
|
-
_this.renderer = renderer;
|
|
1285
|
-
_this.contextService = contextService;
|
|
1286
|
-
/**
|
|
1287
|
-
* Fires when a Menu item is selected ([see example]({% slug routing_menu %})).
|
|
1288
|
-
*/
|
|
1289
|
-
_this.select = new EventEmitter();
|
|
1290
|
-
/**
|
|
1291
|
-
* Fires when a Menu item is opened.
|
|
1292
|
-
*/
|
|
1293
|
-
_this.open = new EventEmitter();
|
|
1294
|
-
/**
|
|
1295
|
-
* Fires when a Menu item is closed.
|
|
1296
|
-
*/
|
|
1297
|
-
_this.close = new EventEmitter();
|
|
1298
|
-
validatePackage(packageMetadata);
|
|
1299
|
-
_this.actions.owner = _this;
|
|
1300
|
-
if (contextService) {
|
|
1301
|
-
contextService.items = _this.itemsService;
|
|
1302
|
-
_this.contextKeyDownSubscription = contextService.keydown.subscribe(_this.contextKeyDown.bind(_this));
|
|
1303
|
-
}
|
|
1304
|
-
return _this;
|
|
1305
|
-
}
|
|
1306
|
-
MenuComponent_1 = MenuComponent;
|
|
1307
|
-
Object.defineProperty(MenuComponent.prototype, "ariaOrientation", {
|
|
1308
|
-
/**
|
|
1309
|
-
* @hidden
|
|
1310
|
-
*/
|
|
1311
|
-
get: function () {
|
|
1312
|
-
if (this.vertical) {
|
|
1313
|
-
return 'vertical';
|
|
1314
|
-
}
|
|
1315
|
-
},
|
|
1316
|
-
enumerable: true,
|
|
1317
|
-
configurable: true
|
|
1318
|
-
});
|
|
1319
|
-
Object.defineProperty(MenuComponent.prototype, "contextMenuClass", {
|
|
1320
|
-
/**
|
|
1321
|
-
* @hidden
|
|
1322
|
-
*/
|
|
1323
|
-
get: function () {
|
|
1324
|
-
return Boolean(this.contextService);
|
|
1325
|
-
},
|
|
1326
|
-
enumerable: true,
|
|
1327
|
-
configurable: true
|
|
1328
|
-
});
|
|
1329
|
-
Object.defineProperty(MenuComponent.prototype, "direction", {
|
|
1330
|
-
get: function () {
|
|
1331
|
-
return this.rtl;
|
|
1332
|
-
},
|
|
1333
|
-
enumerable: true,
|
|
1334
|
-
configurable: true
|
|
1335
|
-
});
|
|
1336
|
-
Object.defineProperty(MenuComponent.prototype, "rtl", {
|
|
1337
|
-
get: function () {
|
|
1338
|
-
return this.localization.rtl;
|
|
1339
|
-
},
|
|
1340
|
-
enumerable: true,
|
|
1341
|
-
configurable: true
|
|
1342
|
-
});
|
|
1343
|
-
/**
|
|
1344
|
-
* Opens or closes the specified Menu items.
|
|
1345
|
-
*
|
|
1346
|
-
* @param open - A Boolean value which indicates if the items will be opened or closed.
|
|
1347
|
-
* @param indices - One or more values which represent the hierarchical indices of the items that will be opened or closed.
|
|
1348
|
-
*/
|
|
1349
|
-
MenuComponent.prototype.toggle = function (open) {
|
|
1350
|
-
var indices = [];
|
|
1351
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
1352
|
-
indices[_i - 1] = arguments[_i];
|
|
1353
|
-
}
|
|
1354
|
-
for (var idx = 0; idx < indices.length; idx++) {
|
|
1355
|
-
var item = this.itemsService.get(indices[idx]);
|
|
1356
|
-
if (item && !item.disabled) {
|
|
1357
|
-
if (open) {
|
|
1358
|
-
item.open();
|
|
1359
|
-
}
|
|
1360
|
-
else {
|
|
1361
|
-
item.close();
|
|
1362
|
-
}
|
|
1363
|
-
}
|
|
1364
|
-
}
|
|
1365
|
-
};
|
|
1366
|
-
/**
|
|
1367
|
-
* @hidden
|
|
1368
|
-
*/
|
|
1369
|
-
MenuComponent.prototype.focus = function (index) {
|
|
1370
|
-
this.navigation.focusIndex(index);
|
|
1371
|
-
};
|
|
1372
|
-
MenuComponent.prototype.ngOnChanges = function (changes) {
|
|
1373
|
-
this.navigation.vertical = this.vertical;
|
|
1374
|
-
this.hover.delay = this.hoverDelay;
|
|
1375
|
-
if (changes.openOnClick) {
|
|
1376
|
-
var openOnClick = this.openOnClick = normalize(this.openOnClick);
|
|
1377
|
-
this.hover.openOnOver = !openOnClick;
|
|
1378
|
-
if (openOnClick && openOnClick.toggle === 'click') {
|
|
1379
|
-
this.attachCloseClick();
|
|
1380
|
-
}
|
|
1381
|
-
else {
|
|
1382
|
-
this.unsubscribeClick();
|
|
1383
|
-
}
|
|
1384
|
-
}
|
|
1385
|
-
};
|
|
1386
|
-
MenuComponent.prototype.ngAfterViewChecked = function () {
|
|
1387
|
-
this.navigation.updateActive();
|
|
1388
|
-
};
|
|
1389
|
-
MenuComponent.prototype.ngOnDestroy = function () {
|
|
1390
|
-
this.unsubscribeClick();
|
|
1391
|
-
if (this.contextService) {
|
|
1392
|
-
this.contextService.items = null;
|
|
1393
|
-
this.contextKeyDownSubscription.unsubscribe();
|
|
1394
|
-
}
|
|
1395
|
-
};
|
|
1396
|
-
MenuComponent.prototype.attachCloseClick = function () {
|
|
1397
|
-
var _this = this;
|
|
1398
|
-
if (!this.closeClickSubscription && isDocumentAvailable()) {
|
|
1399
|
-
this.ngZone.runOutsideAngular(function () {
|
|
1400
|
-
_this.closeClickSubscription = _this.renderer.listen('document', 'click', function (e) {
|
|
1401
|
-
if (!inMenu(e.target, _this.itemsService)) {
|
|
1402
|
-
_this.hover.openOnOver = false;
|
|
1403
|
-
_this.actions.closeAll();
|
|
1404
|
-
_this.actions.execute();
|
|
1405
|
-
}
|
|
1406
|
-
});
|
|
1407
|
-
});
|
|
1408
|
-
}
|
|
1409
|
-
};
|
|
1410
|
-
MenuComponent.prototype.unsubscribeClick = function () {
|
|
1411
|
-
if (this.closeClickSubscription) {
|
|
1412
|
-
this.closeClickSubscription();
|
|
1413
|
-
}
|
|
1414
|
-
};
|
|
1415
|
-
MenuComponent.prototype.contextKeyDown = function (e) {
|
|
1416
|
-
if (!this.itemsService.hasItems) {
|
|
1417
|
-
return;
|
|
1418
|
-
}
|
|
1419
|
-
var keyCode = e.keyCode;
|
|
1420
|
-
var rtl = this.localization.rtl;
|
|
1421
|
-
var first = keyCode === Keys.ArrowDown || keyCode === Keys.ArrowRight;
|
|
1422
|
-
var last = keyCode === Keys.ArrowUp || keyCode === Keys.ArrowLeft;
|
|
1423
|
-
var index;
|
|
1424
|
-
if ((first && !rtl) || (last && rtl)) {
|
|
1425
|
-
index = 'first';
|
|
1426
|
-
}
|
|
1427
|
-
else if ((first && rtl) || (last && !rtl)) {
|
|
1428
|
-
index = 'last';
|
|
1429
|
-
}
|
|
1430
|
-
if (index) {
|
|
1431
|
-
e.preventDefault();
|
|
1432
|
-
this.focus(index);
|
|
1433
|
-
}
|
|
1434
|
-
};
|
|
1435
|
-
var MenuComponent_1;
|
|
1436
|
-
__decorate([
|
|
1437
|
-
Input(),
|
|
1438
|
-
__metadata("design:type", TemplateRef)
|
|
1439
|
-
], MenuComponent.prototype, "menuItemTemplate", void 0);
|
|
1440
|
-
__decorate([
|
|
1441
|
-
Input(),
|
|
1442
|
-
__metadata("design:type", TemplateRef)
|
|
1443
|
-
], MenuComponent.prototype, "menuItemLinkTemplate", void 0);
|
|
1444
|
-
__decorate([
|
|
1445
|
-
Output(),
|
|
1446
|
-
__metadata("design:type", EventEmitter)
|
|
1447
|
-
], MenuComponent.prototype, "select", void 0);
|
|
1448
|
-
__decorate([
|
|
1449
|
-
Output(),
|
|
1450
|
-
__metadata("design:type", EventEmitter)
|
|
1451
|
-
], MenuComponent.prototype, "open", void 0);
|
|
1452
|
-
__decorate([
|
|
1453
|
-
Output(),
|
|
1454
|
-
__metadata("design:type", EventEmitter)
|
|
1455
|
-
], MenuComponent.prototype, "close", void 0);
|
|
1456
|
-
__decorate([
|
|
1457
|
-
HostBinding('class.k-rtl'),
|
|
1458
|
-
__metadata("design:type", Boolean),
|
|
1459
|
-
__metadata("design:paramtypes", [])
|
|
1460
|
-
], MenuComponent.prototype, "direction", null);
|
|
1461
|
-
MenuComponent = MenuComponent_1 = __decorate([
|
|
1462
|
-
Component({
|
|
1463
|
-
exportAs: 'kendoMenu',
|
|
1464
|
-
providers: [
|
|
1465
|
-
ItemsService,
|
|
1466
|
-
ActionsService,
|
|
1467
|
-
NavigationService,
|
|
1468
|
-
HoverService,
|
|
1469
|
-
LocalizationService,
|
|
1470
|
-
{
|
|
1471
|
-
provide: L10N_PREFIX,
|
|
1472
|
-
useValue: 'kendo.menu'
|
|
1473
|
-
},
|
|
1474
|
-
{
|
|
1475
|
-
provide: MenuBase,
|
|
1476
|
-
useExisting: forwardRef(function () { return MenuComponent_1; })
|
|
1477
|
-
}
|
|
1478
|
-
],
|
|
1479
|
-
selector: 'kendo-menu',
|
|
1480
|
-
template: "\n <ul role=\"menubar\"\n [attr.aria-orientation]=\"ariaOrientation\"\n kendoMenuList [items]=\"rootItems\" [level]=\"0\" class=\"k-widget k-reset k-header k-menu\"\n [vertical]=\"vertical\" [rtl]=\"rtl\" [animate]=\"animate\" [openOnClick]=\"openOnClick\"\n [itemTemplate]=\"itemTemplate.first?.templateRef || menuItemTemplate\"\n [itemLinkTemplate]=\"itemLinkTemplate.first?.templateRef || menuItemLinkTemplate\"\n [class.k-menu-horizontal]=\"!vertical\"\n [class.k-menu-vertical]=\"vertical\"\n [class.k-context-menu]=\"contextMenuClass\">\n </ul>\n "
|
|
1481
|
-
}),
|
|
1482
|
-
__param(7, Optional()),
|
|
1483
|
-
__metadata("design:paramtypes", [ItemsService,
|
|
1484
|
-
HoverService,
|
|
1485
|
-
ActionsService,
|
|
1486
|
-
NavigationService,
|
|
1487
|
-
LocalizationService,
|
|
1488
|
-
NgZone,
|
|
1489
|
-
Renderer2,
|
|
1490
|
-
ContextMenuService])
|
|
1491
|
-
], MenuComponent);
|
|
1492
|
-
return MenuComponent;
|
|
1493
|
-
}(MenuBase));
|
|
1494
|
-
|
|
1495
|
-
/* tslint:disable:component-selector */
|
|
1496
|
-
/**
|
|
1497
|
-
* @hidden
|
|
1498
|
-
*/
|
|
1499
|
-
var ListComponent = /** @class */ (function () {
|
|
1500
|
-
function ListComponent(itemsService, hover, actions, navigation, renderer, ngZone, element) {
|
|
1501
|
-
this.itemsService = itemsService;
|
|
1502
|
-
this.hover = hover;
|
|
1503
|
-
this.actions = actions;
|
|
1504
|
-
this.navigation = navigation;
|
|
1505
|
-
this.renderer = renderer;
|
|
1506
|
-
this.ngZone = ngZone;
|
|
1507
|
-
this.element = element;
|
|
1508
|
-
this.animate = true;
|
|
1509
|
-
}
|
|
1510
|
-
ListComponent.prototype.hierarchyIndex = function (index) {
|
|
1511
|
-
return this.itemsService.itemIndex(this.index, index);
|
|
1512
|
-
};
|
|
1513
|
-
ListComponent.prototype.ngOnInit = function () {
|
|
1514
|
-
this.itemsService.addList(this);
|
|
1515
|
-
this.initDomEvents();
|
|
1516
|
-
};
|
|
1517
|
-
ListComponent.prototype.ngOnDestroy = function () {
|
|
1518
|
-
this.itemsService.removeList(this);
|
|
1519
|
-
if (this.domSubscriptions) {
|
|
1520
|
-
this.domSubscriptions();
|
|
1521
|
-
}
|
|
1522
|
-
};
|
|
1523
|
-
ListComponent.prototype.initDomEvents = function () {
|
|
1524
|
-
var _this = this;
|
|
1525
|
-
if (!isDocumentAvailable() || !this.element) {
|
|
1526
|
-
return;
|
|
1527
|
-
}
|
|
1528
|
-
this.ngZone.runOutsideAngular(function () {
|
|
1529
|
-
var element = _this.element.nativeElement;
|
|
1530
|
-
var container = _this.level > 0 ? closest(element, function (node) { return hasClass(node, 'k-popup'); }) : element;
|
|
1531
|
-
var overSubscription = _this.renderer.listen(element, 'mouseover', function (e) {
|
|
1532
|
-
if (e.target === element && _this.level === 0) {
|
|
1533
|
-
_this.onLeave();
|
|
1534
|
-
}
|
|
1535
|
-
else {
|
|
1536
|
-
var item = _this.nodeItem(e.target) || _this.itemsService.get(_this.index);
|
|
1537
|
-
if (item && !(_this.openOnClick && _this.openOnClick.toggle === 'click' && item.level === 0 && !item.hasContent)) {
|
|
1538
|
-
_this.hover.over(item);
|
|
1539
|
-
}
|
|
1540
|
-
}
|
|
1541
|
-
});
|
|
1542
|
-
var leaveSubscription = _this.renderer.listen(container, 'mouseleave', function (e) {
|
|
1543
|
-
if (_this.leavesMenu(e)) {
|
|
1544
|
-
_this.onLeave();
|
|
1545
|
-
}
|
|
1546
|
-
});
|
|
1547
|
-
var keydownSubscription = _this.renderer.listen(element, 'keydown', function (e) {
|
|
1548
|
-
if (hasClass(e.target, 'k-menu-item')) {
|
|
1549
|
-
_this.navigation.keydown(e);
|
|
1550
|
-
}
|
|
1551
|
-
});
|
|
1552
|
-
var blurSubscription = _this.renderer.listen(element, 'focusout', function (e) {
|
|
1553
|
-
if (_this.leavesMenu(e)) {
|
|
1554
|
-
_this.navigation.focusLeave();
|
|
1555
|
-
}
|
|
1556
|
-
});
|
|
1557
|
-
/**
|
|
1558
|
-
* Handle focus/blur open/close for iOS devices since it behaves inconsistently with the rest
|
|
1559
|
-
* Refer to: https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html
|
|
1560
|
-
*/
|
|
1561
|
-
var touchSubscription = _this.renderer.listen(document, 'touchstart', function (e) {
|
|
1562
|
-
if (inMenu(e.target, _this.itemsService)) {
|
|
1563
|
-
var item = _this.nodeItem(e.target);
|
|
1564
|
-
// Needs to be called because the 'click' handler will be called only on secondary tap and the item will remain unfocused
|
|
1565
|
-
_this.navigation.focus(item);
|
|
1566
|
-
// This is needed since the 'mouseover' event is not always dispatched
|
|
1567
|
-
if (!item.opened) {
|
|
1568
|
-
_this.hover.over(item);
|
|
1569
|
-
}
|
|
1570
|
-
}
|
|
1571
|
-
else if (_this.navigation.focusedIdx) {
|
|
1572
|
-
// If the touch is outside of the menu and the menu is not currently in focus
|
|
1573
|
-
var activeItem = _this.itemsService.get(_this.navigation.activeIndex);
|
|
1574
|
-
_this.onLeave(); // needs to be called explicitly since mouseleave event is not triggered
|
|
1575
|
-
activeItem.blur(); // needs to be called explicitly otherwise the item remains focused => triggers focusout
|
|
1576
|
-
}
|
|
1577
|
-
});
|
|
1578
|
-
var clickSubscription = _this.renderer.listen(element, 'click', _this.clickHandler.bind(_this));
|
|
1579
|
-
_this.domSubscriptions = function () {
|
|
1580
|
-
overSubscription();
|
|
1581
|
-
leaveSubscription();
|
|
1582
|
-
keydownSubscription();
|
|
1583
|
-
blurSubscription();
|
|
1584
|
-
clickSubscription();
|
|
1585
|
-
touchSubscription();
|
|
1586
|
-
};
|
|
1587
|
-
});
|
|
1588
|
-
};
|
|
1589
|
-
ListComponent.prototype.leavesMenu = function (e) {
|
|
1590
|
-
if (!e.relatedTarget) {
|
|
1591
|
-
return true;
|
|
1592
|
-
}
|
|
1593
|
-
return !inMenu(e.relatedTarget, this.itemsService);
|
|
1594
|
-
};
|
|
1595
|
-
ListComponent.prototype.onLeave = function () {
|
|
1596
|
-
var openOnClick = this.openOnClick;
|
|
1597
|
-
if (!openOnClick || openOnClick.toggle !== 'click') {
|
|
1598
|
-
this.hover.leave(openOnClick && openOnClick.toggle === 'leave');
|
|
1599
|
-
}
|
|
1600
|
-
};
|
|
1601
|
-
ListComponent.prototype.nodeItem = function (target) {
|
|
1602
|
-
var node = closestItem(target, this.element.nativeElement);
|
|
1603
|
-
if (node) {
|
|
1604
|
-
var index = nodeIndex(node);
|
|
1605
|
-
return this.itemsService.get(index);
|
|
1606
|
-
}
|
|
1607
|
-
};
|
|
1608
|
-
ListComponent.prototype.clickHandler = function (e) {
|
|
1609
|
-
if (isFocusable(e.target) && !hasClass(e.target, 'k-menu-item')) {
|
|
1610
|
-
return;
|
|
1611
|
-
}
|
|
1612
|
-
var item = this.nodeItem(e.target);
|
|
1613
|
-
if (!item || item.isContent || item.navigating) {
|
|
1614
|
-
return;
|
|
1615
|
-
}
|
|
1616
|
-
if (item.disabled) {
|
|
1617
|
-
e.preventDefault();
|
|
1618
|
-
return;
|
|
1619
|
-
}
|
|
1620
|
-
this.actions.select(item, e, function () {
|
|
1621
|
-
e.preventDefault();
|
|
1622
|
-
});
|
|
1623
|
-
this.navigation.focus(item);
|
|
1624
|
-
if (item.level > 0 && !item.hasContent) {
|
|
1625
|
-
this.actions.closeToRoot(item);
|
|
1626
|
-
}
|
|
1627
|
-
if (this.openOnClick) {
|
|
1628
|
-
var hover = this.hover;
|
|
1629
|
-
if (item.opened) {
|
|
1630
|
-
if (item.level === 0) {
|
|
1631
|
-
hover.openOnOver = false;
|
|
1632
|
-
this.actions.close(item);
|
|
1633
|
-
}
|
|
1634
|
-
}
|
|
1635
|
-
else if (item.hasContent) {
|
|
1636
|
-
hover.openOnOver = true;
|
|
1637
|
-
this.actions.closeOthers(item);
|
|
1638
|
-
this.actions.open(item);
|
|
1639
|
-
}
|
|
1640
|
-
else {
|
|
1641
|
-
hover.openOnOver = false;
|
|
1642
|
-
if (item.level === 0 && this.openOnClick.toggle === 'click') {
|
|
1643
|
-
this.hover.closeCurrent();
|
|
1644
|
-
}
|
|
1645
|
-
}
|
|
1646
|
-
}
|
|
1647
|
-
this.actions.execute();
|
|
1648
|
-
};
|
|
1649
|
-
__decorate([
|
|
1650
|
-
Input(),
|
|
1651
|
-
__metadata("design:type", Array)
|
|
1652
|
-
], ListComponent.prototype, "items", void 0);
|
|
1653
|
-
__decorate([
|
|
1654
|
-
Input(),
|
|
1655
|
-
__metadata("design:type", Number)
|
|
1656
|
-
], ListComponent.prototype, "level", void 0);
|
|
1657
|
-
__decorate([
|
|
1658
|
-
Input(),
|
|
1659
|
-
__metadata("design:type", String)
|
|
1660
|
-
], ListComponent.prototype, "index", void 0);
|
|
1661
|
-
__decorate([
|
|
1662
|
-
Input(),
|
|
1663
|
-
__metadata("design:type", Object)
|
|
1664
|
-
], ListComponent.prototype, "animate", void 0);
|
|
1665
|
-
__decorate([
|
|
1666
|
-
Input(),
|
|
1667
|
-
__metadata("design:type", Boolean)
|
|
1668
|
-
], ListComponent.prototype, "vertical", void 0);
|
|
1669
|
-
__decorate([
|
|
1670
|
-
Input(),
|
|
1671
|
-
__metadata("design:type", Boolean)
|
|
1672
|
-
], ListComponent.prototype, "rtl", void 0);
|
|
1673
|
-
__decorate([
|
|
1674
|
-
Input(),
|
|
1675
|
-
__metadata("design:type", Object)
|
|
1676
|
-
], ListComponent.prototype, "openOnClick", void 0);
|
|
1677
|
-
__decorate([
|
|
1678
|
-
Input(),
|
|
1679
|
-
__metadata("design:type", TemplateRef)
|
|
1680
|
-
], ListComponent.prototype, "itemTemplate", void 0);
|
|
1681
|
-
__decorate([
|
|
1682
|
-
Input(),
|
|
1683
|
-
__metadata("design:type", TemplateRef)
|
|
1684
|
-
], ListComponent.prototype, "itemLinkTemplate", void 0);
|
|
1685
|
-
ListComponent = __decorate([
|
|
1686
|
-
Component({
|
|
1687
|
-
selector: '[kendoMenuList]',
|
|
1688
|
-
template: "\n <ng-container *ngFor=\"let item of items; let idx = index\">\n <li *ngIf=\"!item.separator\" kendoMenuItem\n [item]=\"item\" [level]=\"level\" [vertical]=\"vertical\" [animate]=\"animate\" [rtl]=\"rtl\"\n [itemTemplate]=\"itemTemplate\" [itemLinkTemplate]=\"itemLinkTemplate\" [openOnClick]=\"openOnClick\"\n [index]=\"hierarchyIndex(idx)\" [siblingIndex]=\"idx\" [attr." + NODE_INDEX + "]=\"hierarchyIndex(idx)\"\n [ngClass]=\"item.cssClass\" [ngStyle]=\"item.cssStyle\"\n role=\"menuitem\"\n class=\"k-item k-menu-item\"\n [class.k-first]=\"idx === 0\" [class.k-last]=\"idx === items.length - 1\"\n [class.k-state-disabled]=\"item.disabled\"></li>\n <li *ngIf=\"item.separator\" class=\"k-separator k-item\"\n role=\"separator\" [ngClass]=\"item.cssClass\" [ngStyle]=\"item.cssStyle\">\n \n </li>\n </ng-container>\n "
|
|
1689
|
-
}),
|
|
1690
|
-
__metadata("design:paramtypes", [ItemsService,
|
|
1691
|
-
HoverService,
|
|
1692
|
-
ActionsService,
|
|
1693
|
-
NavigationService,
|
|
1694
|
-
Renderer2,
|
|
1695
|
-
NgZone,
|
|
1696
|
-
ElementRef])
|
|
1697
|
-
], ListComponent);
|
|
1698
|
-
return ListComponent;
|
|
1699
|
-
}());
|
|
1700
|
-
|
|
1701
|
-
var POPUP_ALIGN = {
|
|
1702
|
-
vertical: 'top',
|
|
1703
|
-
horizontal: 'left'
|
|
1704
|
-
};
|
|
1705
|
-
var POPUP_ALIGN_RTL = {
|
|
1706
|
-
vertical: 'top',
|
|
1707
|
-
horizontal: 'right'
|
|
1708
|
-
};
|
|
1709
|
-
var VERTICAL_COLLISION = {
|
|
1710
|
-
vertical: 'flip',
|
|
1711
|
-
horizontal: 'fit'
|
|
1712
|
-
};
|
|
1713
|
-
var HORIZONTAL_COLLISION = {
|
|
1714
|
-
vertical: 'fit',
|
|
1715
|
-
horizontal: 'flip'
|
|
1716
|
-
};
|
|
1717
|
-
/**
|
|
1718
|
-
* @hidden
|
|
1719
|
-
*/
|
|
1720
|
-
var POPUP_SETTINGS_RTL = {
|
|
1721
|
-
vertical: {
|
|
1722
|
-
anchor: {
|
|
1723
|
-
vertical: 'bottom',
|
|
1724
|
-
horizontal: 'right'
|
|
1725
|
-
},
|
|
1726
|
-
popup: POPUP_ALIGN_RTL,
|
|
1727
|
-
collision: VERTICAL_COLLISION,
|
|
1728
|
-
animate: 'down'
|
|
1729
|
-
},
|
|
1730
|
-
horizontal: {
|
|
1731
|
-
anchor: {
|
|
1732
|
-
vertical: 'top',
|
|
1733
|
-
horizontal: 'left'
|
|
1734
|
-
},
|
|
1735
|
-
popup: POPUP_ALIGN_RTL,
|
|
1736
|
-
collision: HORIZONTAL_COLLISION,
|
|
1737
|
-
animate: 'left'
|
|
1738
|
-
}
|
|
1739
|
-
};
|
|
1740
|
-
/**
|
|
1741
|
-
* @hidden
|
|
1742
|
-
*/
|
|
1743
|
-
var POPUP_SETTINGS = {
|
|
1744
|
-
vertical: {
|
|
1745
|
-
anchor: {
|
|
1746
|
-
vertical: 'bottom',
|
|
1747
|
-
horizontal: 'left'
|
|
1748
|
-
},
|
|
1749
|
-
popup: POPUP_ALIGN,
|
|
1750
|
-
collision: VERTICAL_COLLISION,
|
|
1751
|
-
animate: 'down'
|
|
1752
|
-
},
|
|
1753
|
-
horizontal: {
|
|
1754
|
-
anchor: {
|
|
1755
|
-
vertical: 'top',
|
|
1756
|
-
horizontal: 'right'
|
|
1757
|
-
},
|
|
1758
|
-
popup: POPUP_ALIGN,
|
|
1759
|
-
collision: HORIZONTAL_COLLISION,
|
|
1760
|
-
animate: 'right'
|
|
1761
|
-
}
|
|
1762
|
-
};
|
|
1763
|
-
|
|
1764
|
-
/**
|
|
1765
|
-
* @hidden
|
|
1766
|
-
*/
|
|
1767
|
-
var defined = function (value) { return typeof value !== 'undefined'; };
|
|
1768
|
-
/**
|
|
1769
|
-
* @hidden
|
|
1770
|
-
*/
|
|
1771
|
-
var bodyFactory = function () {
|
|
1772
|
-
if (isDocumentAvailable()) {
|
|
1773
|
-
return new ElementRef(document.body);
|
|
1774
|
-
}
|
|
1775
|
-
};
|
|
1776
|
-
|
|
1777
|
-
var ɵ0$3 = bodyFactory;
|
|
1778
|
-
/* tslint:disable:component-selector */
|
|
1779
|
-
/**
|
|
1780
|
-
* @hidden
|
|
1781
|
-
*/
|
|
1782
|
-
var ItemComponent = /** @class */ (function () {
|
|
1783
|
-
function ItemComponent(itemsService, navigation, changeDetector, renderer, popupService, element) {
|
|
1784
|
-
this.itemsService = itemsService;
|
|
1785
|
-
this.navigation = navigation;
|
|
1786
|
-
this.changeDetector = changeDetector;
|
|
1787
|
-
this.renderer = renderer;
|
|
1788
|
-
this.popupService = popupService;
|
|
1789
|
-
this.element = element;
|
|
1790
|
-
this.animate = true;
|
|
1791
|
-
this.openOnClick = false;
|
|
1792
|
-
this.opened = false;
|
|
1793
|
-
this.navigating = false;
|
|
1794
|
-
this.destroyed = false;
|
|
1795
|
-
}
|
|
1796
|
-
Object.defineProperty(ItemComponent.prototype, "index", {
|
|
1797
|
-
get: function () {
|
|
1798
|
-
return this._index;
|
|
1799
|
-
},
|
|
1800
|
-
set: function (index) {
|
|
1801
|
-
if (this._index && this._index !== index) {
|
|
1802
|
-
this.itemsService.remove(this);
|
|
1803
|
-
this._index = index;
|
|
1804
|
-
this.itemsService.add(this);
|
|
1805
|
-
}
|
|
1806
|
-
else {
|
|
1807
|
-
this._index = index;
|
|
1808
|
-
}
|
|
1809
|
-
this.childId = this.itemsService.childId(index);
|
|
1810
|
-
},
|
|
1811
|
-
enumerable: true,
|
|
1812
|
-
configurable: true
|
|
1813
|
-
});
|
|
1814
|
-
Object.defineProperty(ItemComponent.prototype, "disabled", {
|
|
1815
|
-
get: function () {
|
|
1816
|
-
return this.item.disabled;
|
|
1817
|
-
},
|
|
1818
|
-
enumerable: true,
|
|
1819
|
-
configurable: true
|
|
1820
|
-
});
|
|
1821
|
-
Object.defineProperty(ItemComponent.prototype, "hasPopup", {
|
|
1822
|
-
get: function () {
|
|
1823
|
-
return this.hasContent ? true : null;
|
|
1824
|
-
},
|
|
1825
|
-
enumerable: true,
|
|
1826
|
-
configurable: true
|
|
1827
|
-
});
|
|
1828
|
-
Object.defineProperty(ItemComponent.prototype, "expanded", {
|
|
1829
|
-
get: function () {
|
|
1830
|
-
return this.hasContent ? this.opened : null;
|
|
1831
|
-
},
|
|
1832
|
-
enumerable: true,
|
|
1833
|
-
configurable: true
|
|
1834
|
-
});
|
|
1835
|
-
Object.defineProperty(ItemComponent.prototype, "label", {
|
|
1836
|
-
get: function () {
|
|
1837
|
-
return this.item.text ? this.item.text : null;
|
|
1838
|
-
},
|
|
1839
|
-
enumerable: true,
|
|
1840
|
-
configurable: true
|
|
1841
|
-
});
|
|
1842
|
-
Object.defineProperty(ItemComponent.prototype, "activeId", {
|
|
1843
|
-
get: function () {
|
|
1844
|
-
return this.index === this.navigation.activeIndex ? '0' : '-1';
|
|
1845
|
-
},
|
|
1846
|
-
enumerable: true,
|
|
1847
|
-
configurable: true
|
|
1848
|
-
});
|
|
1849
|
-
Object.defineProperty(ItemComponent.prototype, "popupSettings", {
|
|
1850
|
-
get: function () {
|
|
1851
|
-
var settings = this.rtl ? POPUP_SETTINGS_RTL : POPUP_SETTINGS;
|
|
1852
|
-
return this.horizontal ? settings.horizontal : settings.vertical;
|
|
1853
|
-
},
|
|
1854
|
-
enumerable: true,
|
|
1855
|
-
configurable: true
|
|
1856
|
-
});
|
|
1857
|
-
Object.defineProperty(ItemComponent.prototype, "horizontal", {
|
|
1858
|
-
get: function () {
|
|
1859
|
-
return this.vertical || this.level > 0;
|
|
1860
|
-
},
|
|
1861
|
-
enumerable: true,
|
|
1862
|
-
configurable: true
|
|
1863
|
-
});
|
|
1864
|
-
Object.defineProperty(ItemComponent.prototype, "hasLink", {
|
|
1865
|
-
get: function () {
|
|
1866
|
-
return Boolean(this.item.url);
|
|
1867
|
-
},
|
|
1868
|
-
enumerable: true,
|
|
1869
|
-
configurable: true
|
|
1870
|
-
});
|
|
1871
|
-
Object.defineProperty(ItemComponent.prototype, "linkTemplate", {
|
|
1872
|
-
get: function () {
|
|
1873
|
-
return this.item.linkTemplate || this.itemLinkTemplate;
|
|
1874
|
-
},
|
|
1875
|
-
enumerable: true,
|
|
1876
|
-
configurable: true
|
|
1877
|
-
});
|
|
1878
|
-
Object.defineProperty(ItemComponent.prototype, "hasContent", {
|
|
1879
|
-
get: function () {
|
|
1880
|
-
var items = this.item.items;
|
|
1881
|
-
return items && items.length || this.item.contentTemplate;
|
|
1882
|
-
},
|
|
1883
|
-
enumerable: true,
|
|
1884
|
-
configurable: true
|
|
1885
|
-
});
|
|
1886
|
-
Object.defineProperty(ItemComponent.prototype, "isContent", {
|
|
1887
|
-
get: function () {
|
|
1888
|
-
return Boolean(this.item.content);
|
|
1889
|
-
},
|
|
1890
|
-
enumerable: true,
|
|
1891
|
-
configurable: true
|
|
1892
|
-
});
|
|
1893
|
-
Object.defineProperty(ItemComponent.prototype, "iconClass", {
|
|
1894
|
-
get: function () {
|
|
1895
|
-
return "k-i-" + this.item.icon;
|
|
1896
|
-
},
|
|
1897
|
-
enumerable: true,
|
|
1898
|
-
configurable: true
|
|
1899
|
-
});
|
|
1900
|
-
Object.defineProperty(ItemComponent.prototype, "children", {
|
|
1901
|
-
get: function () {
|
|
1902
|
-
var item = this.item;
|
|
1903
|
-
if (item.contentTemplate) {
|
|
1904
|
-
if (!this.contentItems) {
|
|
1905
|
-
this.contentItems = [{
|
|
1906
|
-
content: item.contentTemplate,
|
|
1907
|
-
owner: item,
|
|
1908
|
-
ownerIndex: this.index
|
|
1909
|
-
}];
|
|
1910
|
-
}
|
|
1911
|
-
return this.contentItems;
|
|
1912
|
-
}
|
|
1913
|
-
return item.items;
|
|
1914
|
-
},
|
|
1915
|
-
enumerable: true,
|
|
1916
|
-
configurable: true
|
|
1917
|
-
});
|
|
1918
|
-
Object.defineProperty(ItemComponent.prototype, "template", {
|
|
1919
|
-
get: function () {
|
|
1920
|
-
return this.item.template || this.itemTemplate;
|
|
1921
|
-
},
|
|
1922
|
-
enumerable: true,
|
|
1923
|
-
configurable: true
|
|
1924
|
-
});
|
|
1925
|
-
ItemComponent.prototype.hasContentTemplates = function () {
|
|
1926
|
-
var item = this.item;
|
|
1927
|
-
return this.itemTemplate || item.contentTemplate || this.itemLinkTemplate ||
|
|
1928
|
-
(item.items && item.items.find(function (current) { return current.template || current.linkTemplate; }));
|
|
1929
|
-
};
|
|
1930
|
-
ItemComponent.prototype.ngOnInit = function () {
|
|
1931
|
-
this.itemsService.add(this);
|
|
1932
|
-
};
|
|
1933
|
-
ItemComponent.prototype.ngOnDestroy = function () {
|
|
1934
|
-
this.itemsService.remove(this);
|
|
1935
|
-
this.destroyed = true;
|
|
1936
|
-
if (this.popupRef) {
|
|
1937
|
-
this.popupRef.close();
|
|
1938
|
-
this.popupRef = null;
|
|
1939
|
-
}
|
|
1940
|
-
};
|
|
1941
|
-
ItemComponent.prototype.focus = function () {
|
|
1942
|
-
this.element.nativeElement.focus();
|
|
1943
|
-
};
|
|
1944
|
-
ItemComponent.prototype.blur = function () {
|
|
1945
|
-
this.element.nativeElement.blur();
|
|
1946
|
-
};
|
|
1947
|
-
ItemComponent.prototype.toggleActive = function (isActive) {
|
|
1948
|
-
if (isActive) {
|
|
1949
|
-
this.setAttribute('tabindex', '0');
|
|
1950
|
-
}
|
|
1951
|
-
else {
|
|
1952
|
-
this.setAttribute('tabindex', '-1');
|
|
1953
|
-
}
|
|
1954
|
-
};
|
|
1955
|
-
ItemComponent.prototype.open = function () {
|
|
1956
|
-
if (!this.destroyed && this.hasContent && !this.opened) {
|
|
1957
|
-
var popupSettings = this.popupSettings;
|
|
1958
|
-
var animate = this.animate ? Object.assign({}, this.animate, {
|
|
1959
|
-
direction: popupSettings.animate
|
|
1960
|
-
}) : false;
|
|
1961
|
-
this.opened = true;
|
|
1962
|
-
this.popupRef = this.popupService.open({
|
|
1963
|
-
popupAlign: popupSettings.popup,
|
|
1964
|
-
anchorAlign: popupSettings.anchor,
|
|
1965
|
-
collision: popupSettings.collision,
|
|
1966
|
-
anchor: this.element,
|
|
1967
|
-
positionMode: 'absolute',
|
|
1968
|
-
content: this.popupTemplate,
|
|
1969
|
-
popupClass: {
|
|
1970
|
-
'k-rtl': this.rtl,
|
|
1971
|
-
'k-menu-popup': true
|
|
1972
|
-
},
|
|
1973
|
-
animate: animate
|
|
1974
|
-
});
|
|
1975
|
-
this.setAttribute('aria-expanded', 'true');
|
|
1976
|
-
this.setAttribute('aria-owns', this.childId);
|
|
1977
|
-
this.changeDetector.detectChanges();
|
|
1978
|
-
}
|
|
1979
|
-
};
|
|
1980
|
-
ItemComponent.prototype.close = function () {
|
|
1981
|
-
if (!this.destroyed && this.opened) {
|
|
1982
|
-
this.opened = false;
|
|
1983
|
-
if (this.popupRef) {
|
|
1984
|
-
this.popupRef.close();
|
|
1985
|
-
this.popupRef = null;
|
|
1986
|
-
}
|
|
1987
|
-
this.changeDetector.detectChanges();
|
|
1988
|
-
this.setAttribute('aria-expanded', 'false');
|
|
1989
|
-
this.renderer.removeAttribute(this.element.nativeElement, 'aria-owns');
|
|
1990
|
-
}
|
|
1991
|
-
};
|
|
1992
|
-
ItemComponent.prototype.navigate = function () {
|
|
1993
|
-
var link;
|
|
1994
|
-
if (this.linkTemplate) {
|
|
1995
|
-
link = this.element.nativeElement.querySelector('a.k-menu-link');
|
|
1996
|
-
}
|
|
1997
|
-
else if (this.hasLink) {
|
|
1998
|
-
link = this.link.nativeElement;
|
|
1999
|
-
}
|
|
2000
|
-
if (link) {
|
|
2001
|
-
this.navigating = true;
|
|
2002
|
-
link.click();
|
|
2003
|
-
this.navigating = false;
|
|
2004
|
-
}
|
|
2005
|
-
};
|
|
2006
|
-
ItemComponent.prototype.setAttribute = function (name, value) {
|
|
2007
|
-
this.renderer.setAttribute(this.element.nativeElement, name, value);
|
|
2008
|
-
};
|
|
2009
|
-
__decorate([
|
|
2010
|
-
Input(),
|
|
2011
|
-
__metadata("design:type", Object)
|
|
2012
|
-
], ItemComponent.prototype, "item", void 0);
|
|
2013
|
-
__decorate([
|
|
2014
|
-
Input(),
|
|
2015
|
-
__metadata("design:type", Number)
|
|
2016
|
-
], ItemComponent.prototype, "level", void 0);
|
|
2017
|
-
__decorate([
|
|
2018
|
-
Input(),
|
|
2019
|
-
__metadata("design:type", String),
|
|
2020
|
-
__metadata("design:paramtypes", [String])
|
|
2021
|
-
], ItemComponent.prototype, "index", null);
|
|
2022
|
-
__decorate([
|
|
2023
|
-
Input(),
|
|
2024
|
-
__metadata("design:type", Number)
|
|
2025
|
-
], ItemComponent.prototype, "siblingIndex", void 0);
|
|
2026
|
-
__decorate([
|
|
2027
|
-
Input(),
|
|
2028
|
-
__metadata("design:type", Object)
|
|
2029
|
-
], ItemComponent.prototype, "animate", void 0);
|
|
2030
|
-
__decorate([
|
|
2031
|
-
Input(),
|
|
2032
|
-
__metadata("design:type", Boolean)
|
|
2033
|
-
], ItemComponent.prototype, "vertical", void 0);
|
|
2034
|
-
__decorate([
|
|
2035
|
-
Input(),
|
|
2036
|
-
__metadata("design:type", Boolean)
|
|
2037
|
-
], ItemComponent.prototype, "rtl", void 0);
|
|
2038
|
-
__decorate([
|
|
2039
|
-
Input(),
|
|
2040
|
-
__metadata("design:type", Boolean)
|
|
2041
|
-
], ItemComponent.prototype, "openOnClick", void 0);
|
|
2042
|
-
__decorate([
|
|
2043
|
-
Input(),
|
|
2044
|
-
__metadata("design:type", TemplateRef)
|
|
2045
|
-
], ItemComponent.prototype, "itemTemplate", void 0);
|
|
2046
|
-
__decorate([
|
|
2047
|
-
Input(),
|
|
2048
|
-
__metadata("design:type", TemplateRef)
|
|
2049
|
-
], ItemComponent.prototype, "itemLinkTemplate", void 0);
|
|
2050
|
-
__decorate([
|
|
2051
|
-
ViewChild('link', { static: false }),
|
|
2052
|
-
__metadata("design:type", ElementRef)
|
|
2053
|
-
], ItemComponent.prototype, "link", void 0);
|
|
2054
|
-
__decorate([
|
|
2055
|
-
ViewChild('popupTemplate', { static: true }),
|
|
2056
|
-
__metadata("design:type", TemplateRef)
|
|
2057
|
-
], ItemComponent.prototype, "popupTemplate", void 0);
|
|
2058
|
-
__decorate([
|
|
2059
|
-
HostBinding('attr.aria-disabled'),
|
|
2060
|
-
__metadata("design:type", Boolean),
|
|
2061
|
-
__metadata("design:paramtypes", [])
|
|
2062
|
-
], ItemComponent.prototype, "disabled", null);
|
|
2063
|
-
__decorate([
|
|
2064
|
-
HostBinding('attr.aria-haspopup'),
|
|
2065
|
-
__metadata("design:type", Boolean),
|
|
2066
|
-
__metadata("design:paramtypes", [])
|
|
2067
|
-
], ItemComponent.prototype, "hasPopup", null);
|
|
2068
|
-
__decorate([
|
|
2069
|
-
HostBinding('attr.aria-expanded'),
|
|
2070
|
-
__metadata("design:type", Boolean),
|
|
2071
|
-
__metadata("design:paramtypes", [])
|
|
2072
|
-
], ItemComponent.prototype, "expanded", null);
|
|
2073
|
-
__decorate([
|
|
2074
|
-
HostBinding('attr.aria-label'),
|
|
2075
|
-
__metadata("design:type", Boolean),
|
|
2076
|
-
__metadata("design:paramtypes", [])
|
|
2077
|
-
], ItemComponent.prototype, "label", null);
|
|
2078
|
-
__decorate([
|
|
2079
|
-
HostBinding('attr.tabindex'),
|
|
2080
|
-
__metadata("design:type", String),
|
|
2081
|
-
__metadata("design:paramtypes", [])
|
|
2082
|
-
], ItemComponent.prototype, "activeId", null);
|
|
2083
|
-
ItemComponent = __decorate([
|
|
2084
|
-
Component({
|
|
2085
|
-
providers: [PopupService, {
|
|
2086
|
-
provide: POPUP_CONTAINER,
|
|
2087
|
-
useFactory: ɵ0$3
|
|
2088
|
-
}],
|
|
2089
|
-
selector: '[kendoMenuItem]',
|
|
2090
|
-
template: "\n <span *ngIf=\"!hasLink && !item.content && !linkTemplate\" class=\"k-link k-menu-link\" #link\n [class.k-state-active]=\"opened\" role=\"presentation\">\n <ng-template [ngTemplateOutlet]=\"itemcontent\">\n </ng-template>\n </span>\n <a *ngIf=\"item.url && !linkTemplate\" class=\"k-link k-menu-link\" #link [attr.href]=\"item.url\"\n [class.k-state-active]=\"opened\" tabindex=\"-1\" role=\"presentation\">\n <ng-template [ngTemplateOutlet]=\"itemcontent\">\n </ng-template>\n </a>\n <ng-template *ngIf=\"linkTemplate && !item.content\" [ngTemplateOutlet]=\"linkTemplate\"\n [ngTemplateOutletContext]=\"{ item: item, index: index }\">\n </ng-template>\n\n <div class=\"k-content\" *ngIf=\"item.content\" role=\"presentation\">\n <ng-template [ngTemplateOutlet]=\"item.content\" [ngTemplateOutletContext]=\"{ item: item.owner, index: item.ownerIndex }\">\n </ng-template>\n </div>\n\n <ng-template #popupTemplate>\n <ul kendoMenuList\n [attr.id]=\"childId\"\n [animate]=\"animate\"\n [rtl]=\"rtl\"\n [vertical]=\"vertical\"\n [openOnClick]=\"openOnClick\"\n [items]=\"children\"\n [level]=\"level + 1\"\n [index]=\"index\"\n [itemTemplate]=\"itemTemplate\"\n [itemLinkTemplate]=\"itemLinkTemplate\"\n role=\"menu\"\n class=\"k-group k-menu-group k-reset\">\n </ul>\n </ng-template>\n\n <ng-template #itemcontent>\n <span *ngIf=\"item.icon\" class=\"k-icon\" [ngClass]=\"iconClass\" role=\"presentation\"></span>\n <ng-container *ngIf=\"!template\">\n <span class=\"k-menu-link-text\">{{ item.text }}</span>\n </ng-container>\n <ng-template *ngIf=\"template\" [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ item: item, index: index }\">\n </ng-template>\n <span class=\"k-icon k-menu-expand-arrow\" *ngIf=\"hasContent\"\n role=\"presentation\"\n [class.k-i-arrow-60-down]=\"!horizontal\"\n [class.k-i-arrow-60-right]=\"horizontal && !rtl\"\n [class.k-i-arrow-60-left]=\"horizontal && rtl\">\n </span>\n </ng-template>\n "
|
|
2091
|
-
}),
|
|
2092
|
-
__metadata("design:paramtypes", [ItemsService,
|
|
2093
|
-
NavigationService,
|
|
2094
|
-
ChangeDetectorRef,
|
|
2095
|
-
Renderer2,
|
|
2096
|
-
PopupService,
|
|
2097
|
-
ElementRef])
|
|
2098
|
-
], ItemComponent);
|
|
2099
|
-
return ItemComponent;
|
|
2100
|
-
}());
|
|
2101
|
-
|
|
2102
|
-
/**
|
|
2103
|
-
* Represents a directive that can be used in the [`linkTemplate`]({% slug api_menu_itemlinktemplatedirective %})
|
|
2104
|
-
* of the items to apply the default styling and behavior.
|
|
2105
|
-
*/
|
|
2106
|
-
var LinkDirective = /** @class */ (function () {
|
|
2107
|
-
function LinkDirective(itemsService) {
|
|
2108
|
-
this.itemsService = itemsService;
|
|
2109
|
-
this.hostClasses = true;
|
|
2110
|
-
this.role = 'presentation';
|
|
2111
|
-
this.tabindex = '-1';
|
|
2112
|
-
}
|
|
2113
|
-
Object.defineProperty(LinkDirective.prototype, "activeClass", {
|
|
2114
|
-
get: function () {
|
|
2115
|
-
return this.item.opened;
|
|
2116
|
-
},
|
|
2117
|
-
enumerable: true,
|
|
2118
|
-
configurable: true
|
|
2119
|
-
});
|
|
2120
|
-
LinkDirective.prototype.ngOnInit = function () {
|
|
2121
|
-
if (isDevMode() && !this.index) {
|
|
2122
|
-
throw new Error('The kendoMenuItemLink directive requires the item index to be set.');
|
|
2123
|
-
}
|
|
2124
|
-
this.item = this.itemsService.get(this.index) || {};
|
|
2125
|
-
};
|
|
2126
|
-
__decorate([
|
|
2127
|
-
Input('kendoMenuItemLink'),
|
|
2128
|
-
__metadata("design:type", String)
|
|
2129
|
-
], LinkDirective.prototype, "index", void 0);
|
|
2130
|
-
__decorate([
|
|
2131
|
-
HostBinding('class.k-link'),
|
|
2132
|
-
HostBinding('class.k-menu-link'),
|
|
2133
|
-
__metadata("design:type", Boolean)
|
|
2134
|
-
], LinkDirective.prototype, "hostClasses", void 0);
|
|
2135
|
-
__decorate([
|
|
2136
|
-
HostBinding('attr.role'),
|
|
2137
|
-
__metadata("design:type", String)
|
|
2138
|
-
], LinkDirective.prototype, "role", void 0);
|
|
2139
|
-
__decorate([
|
|
2140
|
-
HostBinding('attr.tabindex'),
|
|
2141
|
-
__metadata("design:type", String)
|
|
2142
|
-
], LinkDirective.prototype, "tabindex", void 0);
|
|
2143
|
-
__decorate([
|
|
2144
|
-
HostBinding('class.k-state-active'),
|
|
2145
|
-
__metadata("design:type", Boolean),
|
|
2146
|
-
__metadata("design:paramtypes", [])
|
|
2147
|
-
], LinkDirective.prototype, "activeClass", null);
|
|
2148
|
-
LinkDirective = __decorate([
|
|
2149
|
-
Directive({
|
|
2150
|
-
selector: '[kendoMenuItemLink]'
|
|
2151
|
-
}),
|
|
2152
|
-
__metadata("design:paramtypes", [ItemsService])
|
|
2153
|
-
], LinkDirective);
|
|
2154
|
-
return LinkDirective;
|
|
2155
|
-
}());
|
|
2156
|
-
|
|
2157
|
-
/**
|
|
2158
|
-
* Represents a directive that can be used in the [`linkTemplate`]({% slug api_menu_itemlinktemplatedirective %})
|
|
2159
|
-
* of the items to render the default expand arrow.
|
|
2160
|
-
*/
|
|
2161
|
-
var ExpandArrowDirective = /** @class */ (function () {
|
|
2162
|
-
function ExpandArrowDirective(itemsService) {
|
|
2163
|
-
this.itemsService = itemsService;
|
|
2164
|
-
this.hostClasses = true;
|
|
2165
|
-
this.role = 'presentation';
|
|
2166
|
-
}
|
|
2167
|
-
Object.defineProperty(ExpandArrowDirective.prototype, "arrowDown", {
|
|
2168
|
-
get: function () {
|
|
2169
|
-
return !this.item.horizontal;
|
|
2170
|
-
},
|
|
2171
|
-
enumerable: true,
|
|
2172
|
-
configurable: true
|
|
2173
|
-
});
|
|
2174
|
-
Object.defineProperty(ExpandArrowDirective.prototype, "arrowRight", {
|
|
2175
|
-
get: function () {
|
|
2176
|
-
return this.item.horizontal && !this.item.rtl;
|
|
2177
|
-
},
|
|
2178
|
-
enumerable: true,
|
|
2179
|
-
configurable: true
|
|
2180
|
-
});
|
|
2181
|
-
Object.defineProperty(ExpandArrowDirective.prototype, "arrowLeft", {
|
|
2182
|
-
get: function () {
|
|
2183
|
-
return this.item.horizontal && this.item.rtl;
|
|
2184
|
-
},
|
|
2185
|
-
enumerable: true,
|
|
2186
|
-
configurable: true
|
|
2187
|
-
});
|
|
2188
|
-
ExpandArrowDirective.prototype.ngOnInit = function () {
|
|
2189
|
-
if (isDevMode() && !this.index) {
|
|
2190
|
-
throw new Error('The kendoMenuExpandArrow directive requires the item index to be set.');
|
|
2191
|
-
}
|
|
2192
|
-
this.item = this.itemsService.get(this.index) || {};
|
|
2193
|
-
};
|
|
2194
|
-
__decorate([
|
|
2195
|
-
Input('kendoMenuExpandArrow'),
|
|
2196
|
-
__metadata("design:type", String)
|
|
2197
|
-
], ExpandArrowDirective.prototype, "index", void 0);
|
|
2198
|
-
__decorate([
|
|
2199
|
-
HostBinding('class.k-icon'),
|
|
2200
|
-
HostBinding('class.k-menu-expand-arrow'),
|
|
2201
|
-
__metadata("design:type", Boolean)
|
|
2202
|
-
], ExpandArrowDirective.prototype, "hostClasses", void 0);
|
|
2203
|
-
__decorate([
|
|
2204
|
-
HostBinding('attr.role'),
|
|
2205
|
-
__metadata("design:type", String)
|
|
2206
|
-
], ExpandArrowDirective.prototype, "role", void 0);
|
|
2207
|
-
__decorate([
|
|
2208
|
-
HostBinding('class.k-i-arrow-60-down'),
|
|
2209
|
-
__metadata("design:type", Boolean),
|
|
2210
|
-
__metadata("design:paramtypes", [])
|
|
2211
|
-
], ExpandArrowDirective.prototype, "arrowDown", null);
|
|
2212
|
-
__decorate([
|
|
2213
|
-
HostBinding('class.k-i-arrow-60-right'),
|
|
2214
|
-
__metadata("design:type", Boolean),
|
|
2215
|
-
__metadata("design:paramtypes", [])
|
|
2216
|
-
], ExpandArrowDirective.prototype, "arrowRight", null);
|
|
2217
|
-
__decorate([
|
|
2218
|
-
HostBinding('class.k-i-arrow-60-left'),
|
|
2219
|
-
__metadata("design:type", Boolean),
|
|
2220
|
-
__metadata("design:paramtypes", [])
|
|
2221
|
-
], ExpandArrowDirective.prototype, "arrowLeft", null);
|
|
2222
|
-
ExpandArrowDirective = __decorate([
|
|
2223
|
-
Directive({
|
|
2224
|
-
selector: '[kendoMenuExpandArrow]'
|
|
2225
|
-
}),
|
|
2226
|
-
__metadata("design:paramtypes", [ItemsService])
|
|
2227
|
-
], ExpandArrowDirective);
|
|
2228
|
-
return ExpandArrowDirective;
|
|
2229
|
-
}());
|
|
2230
|
-
|
|
2231
|
-
/**
|
|
2232
|
-
* Arguments for the `select` event of the Menu.
|
|
2233
|
-
*/
|
|
2234
|
-
var MenuSelectEvent = /** @class */ (function (_super) {
|
|
2235
|
-
__extends(MenuSelectEvent, _super);
|
|
2236
|
-
function MenuSelectEvent() {
|
|
2237
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
2238
|
-
}
|
|
2239
|
-
return MenuSelectEvent;
|
|
2240
|
-
}(MenuEvent));
|
|
2241
|
-
|
|
2242
|
-
var ITEM_FIELDS = ['textField', 'urlField', 'iconField', 'disabledField', 'cssClassField', 'cssStyleField', 'separatorField'];
|
|
2243
|
-
/**
|
|
2244
|
-
* @hidden
|
|
2245
|
-
*/
|
|
2246
|
-
var BindingDirectiveBase = /** @class */ (function () {
|
|
2247
|
-
function BindingDirectiveBase(menu) {
|
|
2248
|
-
this.menu = menu;
|
|
2249
|
-
}
|
|
2250
|
-
BindingDirectiveBase.prototype.ngOnChanges = function () {
|
|
2251
|
-
this.rebind();
|
|
2252
|
-
};
|
|
2253
|
-
/**
|
|
2254
|
-
* Rebinds the Menu items.
|
|
2255
|
-
*/
|
|
2256
|
-
BindingDirectiveBase.prototype.rebind = function () {
|
|
2257
|
-
var fields = this.fields = [];
|
|
2258
|
-
for (var idx = 0; idx < ITEM_FIELDS.length; idx++) {
|
|
2259
|
-
var inputName = ITEM_FIELDS[idx];
|
|
2260
|
-
var inputValue = this[inputName];
|
|
2261
|
-
if (inputValue) {
|
|
2262
|
-
fields.push({ target: inputName.replace('Field', ''), source: inputValue });
|
|
2263
|
-
}
|
|
2264
|
-
}
|
|
2265
|
-
this.menu.items = this.data ? this.mapItems(this.data) : [];
|
|
2266
|
-
};
|
|
2267
|
-
return BindingDirectiveBase;
|
|
2268
|
-
}());
|
|
2269
|
-
|
|
2270
|
-
var FIELD_REGEX = /\[(?:(\d+)|['"](.*?)['"])\]|((?:(?!\[.*?\]|\.).)+)/g;
|
|
2271
|
-
var getterCache = {};
|
|
2272
|
-
// tslint:disable-next-line:no-string-literal
|
|
2273
|
-
getterCache['undefined'] = function (obj) { return obj; };
|
|
2274
|
-
/**
|
|
2275
|
-
* @hidden
|
|
2276
|
-
*/
|
|
2277
|
-
var getter = function (field) {
|
|
2278
|
-
if (getterCache[field]) {
|
|
2279
|
-
return getterCache[field];
|
|
2280
|
-
}
|
|
2281
|
-
var fields = [];
|
|
2282
|
-
field.replace(FIELD_REGEX, function (_match, index, indexAccessor, name) {
|
|
2283
|
-
fields.push(index !== undefined ? index : (indexAccessor || name));
|
|
2284
|
-
});
|
|
2285
|
-
getterCache[field] = function (obj) {
|
|
2286
|
-
var result = obj;
|
|
2287
|
-
for (var idx = 0; idx < fields.length && result; idx++) {
|
|
2288
|
-
result = result[fields[idx]];
|
|
2289
|
-
}
|
|
2290
|
-
return result;
|
|
2291
|
-
};
|
|
2292
|
-
return getterCache[field];
|
|
2293
|
-
};
|
|
2294
|
-
/**
|
|
2295
|
-
* @hidden
|
|
2296
|
-
*/
|
|
2297
|
-
var last = function (arr) { return arr[arr.length - 1]; };
|
|
2298
|
-
|
|
2299
|
-
var getField = function (field, level) { return Array.isArray(field) ? field[level] || last(field) : field; };
|
|
2300
|
-
/* tslint:disable:no-input-rename */
|
|
2301
|
-
/**
|
|
2302
|
-
* A directive that converts the provided hierarchical data to [MenuItems]({% slug api_menu_menuitem %}) and binds them to the Menu.
|
|
2303
|
-
*/
|
|
2304
|
-
var HierarchyBindingDirective = /** @class */ (function (_super) {
|
|
2305
|
-
__extends(HierarchyBindingDirective, _super);
|
|
2306
|
-
function HierarchyBindingDirective(menu) {
|
|
2307
|
-
return _super.call(this, menu) || this;
|
|
2308
|
-
}
|
|
2309
|
-
HierarchyBindingDirective.prototype.mapItems = function (items, level) {
|
|
2310
|
-
var _this = this;
|
|
2311
|
-
if (level === void 0) { level = 0; }
|
|
2312
|
-
return items.map(function (item) {
|
|
2313
|
-
var menuItem = _this.createItem(item, level);
|
|
2314
|
-
var children = _this.getChildren(item, level);
|
|
2315
|
-
if (children) {
|
|
2316
|
-
menuItem.items = _this.mapItems(children, level + 1);
|
|
2317
|
-
}
|
|
2318
|
-
return menuItem;
|
|
2319
|
-
});
|
|
2320
|
-
};
|
|
2321
|
-
HierarchyBindingDirective.prototype.createItem = function (item, level) {
|
|
2322
|
-
var result = { data: item };
|
|
2323
|
-
var fields = this.fields;
|
|
2324
|
-
for (var idx = 0; idx < fields.length; idx++) {
|
|
2325
|
-
var _a = fields[idx], target = _a.target, source = _a.source;
|
|
2326
|
-
result[target] = getter(getField(source, level))(item);
|
|
2327
|
-
}
|
|
2328
|
-
return result;
|
|
2329
|
-
};
|
|
2330
|
-
HierarchyBindingDirective.prototype.getChildren = function (item, level) {
|
|
2331
|
-
if (this.childrenField) {
|
|
2332
|
-
var field = getField(this.childrenField, level);
|
|
2333
|
-
return item[field];
|
|
2334
|
-
}
|
|
2335
|
-
};
|
|
2336
|
-
__decorate([
|
|
2337
|
-
Input("kendoMenuHierarchyBinding"),
|
|
2338
|
-
__metadata("design:type", Array)
|
|
2339
|
-
], HierarchyBindingDirective.prototype, "data", void 0);
|
|
2340
|
-
__decorate([
|
|
2341
|
-
Input(),
|
|
2342
|
-
__metadata("design:type", Object)
|
|
2343
|
-
], HierarchyBindingDirective.prototype, "textField", void 0);
|
|
2344
|
-
__decorate([
|
|
2345
|
-
Input(),
|
|
2346
|
-
__metadata("design:type", Object)
|
|
2347
|
-
], HierarchyBindingDirective.prototype, "urlField", void 0);
|
|
2348
|
-
__decorate([
|
|
2349
|
-
Input(),
|
|
2350
|
-
__metadata("design:type", Object)
|
|
2351
|
-
], HierarchyBindingDirective.prototype, "iconField", void 0);
|
|
2352
|
-
__decorate([
|
|
2353
|
-
Input(),
|
|
2354
|
-
__metadata("design:type", Object)
|
|
2355
|
-
], HierarchyBindingDirective.prototype, "disabledField", void 0);
|
|
2356
|
-
__decorate([
|
|
2357
|
-
Input(),
|
|
2358
|
-
__metadata("design:type", Object)
|
|
2359
|
-
], HierarchyBindingDirective.prototype, "cssClassField", void 0);
|
|
2360
|
-
__decorate([
|
|
2361
|
-
Input(),
|
|
2362
|
-
__metadata("design:type", Object)
|
|
2363
|
-
], HierarchyBindingDirective.prototype, "cssStyleField", void 0);
|
|
2364
|
-
__decorate([
|
|
2365
|
-
Input(),
|
|
2366
|
-
__metadata("design:type", Object)
|
|
2367
|
-
], HierarchyBindingDirective.prototype, "separatorField", void 0);
|
|
2368
|
-
__decorate([
|
|
2369
|
-
Input(),
|
|
2370
|
-
__metadata("design:type", Object)
|
|
2371
|
-
], HierarchyBindingDirective.prototype, "childrenField", void 0);
|
|
2372
|
-
HierarchyBindingDirective = __decorate([
|
|
2373
|
-
Directive({
|
|
2374
|
-
exportAs: 'kendoMenuHierarchyBinding',
|
|
2375
|
-
selector: '[kendoMenuHierarchyBinding]'
|
|
2376
|
-
}),
|
|
2377
|
-
__metadata("design:paramtypes", [MenuBase])
|
|
2378
|
-
], HierarchyBindingDirective);
|
|
2379
|
-
return HierarchyBindingDirective;
|
|
2380
|
-
}(BindingDirectiveBase));
|
|
2381
|
-
|
|
2382
|
-
/* tslint:disable:no-input-rename */
|
|
2383
|
-
/**
|
|
2384
|
-
* A directive that converts the provided flat data to [MenuItems]({% slug api_menu_menuitem %}) and binds them to the Menu.
|
|
2385
|
-
*/
|
|
2386
|
-
var FlatBindingDirective = /** @class */ (function (_super) {
|
|
2387
|
-
__extends(FlatBindingDirective, _super);
|
|
2388
|
-
function FlatBindingDirective(menu) {
|
|
2389
|
-
return _super.call(this, menu) || this;
|
|
2390
|
-
}
|
|
2391
|
-
FlatBindingDirective.prototype.mapItems = function (items) {
|
|
2392
|
-
var _this = this;
|
|
2393
|
-
if (!this.idField || !this.parentIdField) {
|
|
2394
|
-
return items.map(function (item) { return _this.createItem(item); });
|
|
2395
|
-
}
|
|
2396
|
-
var result = [];
|
|
2397
|
-
var map = {};
|
|
2398
|
-
for (var idx = 0; idx < items.length; idx++) {
|
|
2399
|
-
var item = items[idx];
|
|
2400
|
-
var menuItem = this.createItem(item);
|
|
2401
|
-
var id = getter(this.idField)(item);
|
|
2402
|
-
var parentId = getter(this.parentIdField)(item);
|
|
2403
|
-
if (parentId === null || parentId === undefined) {
|
|
2404
|
-
result.push(menuItem);
|
|
2405
|
-
}
|
|
2406
|
-
else {
|
|
2407
|
-
var parent_1 = map[parentId] = map[parentId] || {};
|
|
2408
|
-
parent_1.items = parent_1.items || [];
|
|
2409
|
-
parent_1.items.push(menuItem);
|
|
2410
|
-
}
|
|
2411
|
-
if (map[id]) {
|
|
2412
|
-
menuItem.items = map[id].items;
|
|
2413
|
-
}
|
|
2414
|
-
map[id] = menuItem;
|
|
2415
|
-
}
|
|
2416
|
-
return result;
|
|
2417
|
-
};
|
|
2418
|
-
FlatBindingDirective.prototype.createItem = function (dataItem) {
|
|
2419
|
-
var result = { data: dataItem };
|
|
2420
|
-
var fields = this.fields;
|
|
2421
|
-
for (var idx = 0; idx < fields.length; idx++) {
|
|
2422
|
-
var _a = fields[idx], source = _a.source, target = _a.target;
|
|
2423
|
-
result[target] = getter(source)(dataItem);
|
|
2424
|
-
}
|
|
2425
|
-
return result;
|
|
2426
|
-
};
|
|
2427
|
-
__decorate([
|
|
2428
|
-
Input("kendoMenuFlatBinding"),
|
|
2429
|
-
__metadata("design:type", Array)
|
|
2430
|
-
], FlatBindingDirective.prototype, "data", void 0);
|
|
2431
|
-
__decorate([
|
|
2432
|
-
Input(),
|
|
2433
|
-
__metadata("design:type", String)
|
|
2434
|
-
], FlatBindingDirective.prototype, "textField", void 0);
|
|
2435
|
-
__decorate([
|
|
2436
|
-
Input(),
|
|
2437
|
-
__metadata("design:type", String)
|
|
2438
|
-
], FlatBindingDirective.prototype, "urlField", void 0);
|
|
2439
|
-
__decorate([
|
|
2440
|
-
Input(),
|
|
2441
|
-
__metadata("design:type", Object)
|
|
2442
|
-
], FlatBindingDirective.prototype, "iconField", void 0);
|
|
2443
|
-
__decorate([
|
|
2444
|
-
Input(),
|
|
2445
|
-
__metadata("design:type", String)
|
|
2446
|
-
], FlatBindingDirective.prototype, "disabledField", void 0);
|
|
2447
|
-
__decorate([
|
|
2448
|
-
Input(),
|
|
2449
|
-
__metadata("design:type", String)
|
|
2450
|
-
], FlatBindingDirective.prototype, "cssClassField", void 0);
|
|
2451
|
-
__decorate([
|
|
2452
|
-
Input(),
|
|
2453
|
-
__metadata("design:type", String)
|
|
2454
|
-
], FlatBindingDirective.prototype, "cssStyleField", void 0);
|
|
2455
|
-
__decorate([
|
|
2456
|
-
Input(),
|
|
2457
|
-
__metadata("design:type", String)
|
|
2458
|
-
], FlatBindingDirective.prototype, "separatorField", void 0);
|
|
2459
|
-
__decorate([
|
|
2460
|
-
Input(),
|
|
2461
|
-
__metadata("design:type", String)
|
|
2462
|
-
], FlatBindingDirective.prototype, "idField", void 0);
|
|
2463
|
-
__decorate([
|
|
2464
|
-
Input(),
|
|
2465
|
-
__metadata("design:type", String)
|
|
2466
|
-
], FlatBindingDirective.prototype, "parentIdField", void 0);
|
|
2467
|
-
FlatBindingDirective = __decorate([
|
|
2468
|
-
Directive({
|
|
2469
|
-
exportAs: 'kendoMenuFlatBinding',
|
|
2470
|
-
selector: '[kendoMenuFlatBinding]'
|
|
2471
|
-
}),
|
|
2472
|
-
__metadata("design:paramtypes", [MenuBase])
|
|
2473
|
-
], FlatBindingDirective);
|
|
2474
|
-
return FlatBindingDirective;
|
|
2475
|
-
}(BindingDirectiveBase));
|
|
2476
|
-
|
|
2477
|
-
var COMPONENT_EXPORTS = [
|
|
2478
|
-
MenuComponent,
|
|
2479
|
-
MenuItemComponent,
|
|
2480
|
-
ItemTemplateDirective,
|
|
2481
|
-
ItemLinkTemplateDirective,
|
|
2482
|
-
ItemContentTemplateDirective,
|
|
2483
|
-
HierarchyBindingDirective,
|
|
2484
|
-
FlatBindingDirective,
|
|
2485
|
-
LinkDirective,
|
|
2486
|
-
ExpandArrowDirective
|
|
2487
|
-
];
|
|
2488
|
-
var COMPONENT_DIRECTIVES = COMPONENT_EXPORTS.concat([
|
|
2489
|
-
ListComponent,
|
|
2490
|
-
ItemComponent
|
|
2491
|
-
]);
|
|
2492
|
-
/**
|
|
2493
|
-
* Represents the [NgModule]({{ site.data.urls.angular['ngmoduleapi'] }})
|
|
2494
|
-
* definition for the Menu component.
|
|
2495
|
-
*
|
|
2496
|
-
* @example
|
|
2497
|
-
*
|
|
2498
|
-
* ```ts-no-run
|
|
2499
|
-
* // Import the Menu module
|
|
2500
|
-
* import { MenuModule } from '@progress/kendo-angular-menu';
|
|
2501
|
-
*
|
|
2502
|
-
* // The browser platform with a compiler
|
|
2503
|
-
* import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
|
2504
|
-
* import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
2505
|
-
*
|
|
2506
|
-
* import { NgModule } from '@angular/core';
|
|
2507
|
-
*
|
|
2508
|
-
* // Import the app component
|
|
2509
|
-
* import { AppComponent } from './app.component';
|
|
2510
|
-
*
|
|
2511
|
-
* // Define the app module
|
|
2512
|
-
* _@NgModule({
|
|
2513
|
-
* declarations: [AppComponent], // declare app component
|
|
2514
|
-
* imports: [BrowserModule, BrowserAnimationsModule, MenuModule], // import Menu module
|
|
2515
|
-
* bootstrap: [AppComponent]
|
|
2516
|
-
* })
|
|
2517
|
-
* export class AppModule {}
|
|
2518
|
-
*
|
|
2519
|
-
* // Compile and launch the module
|
|
2520
|
-
* platformBrowserDynamic().bootstrapModule(AppModule);
|
|
2521
|
-
*
|
|
2522
|
-
* ```
|
|
2523
|
-
*/
|
|
2524
|
-
var MenuModule = /** @class */ (function () {
|
|
2525
|
-
function MenuModule() {
|
|
2526
|
-
}
|
|
2527
|
-
MenuModule = __decorate([
|
|
2528
|
-
NgModule({
|
|
2529
|
-
declarations: [COMPONENT_DIRECTIVES],
|
|
2530
|
-
exports: [COMPONENT_EXPORTS],
|
|
2531
|
-
imports: [PopupModule, CommonModule]
|
|
2532
|
-
})
|
|
2533
|
-
], MenuModule);
|
|
2534
|
-
return MenuModule;
|
|
2535
|
-
}());
|
|
2536
|
-
|
|
2537
|
-
/**
|
|
2538
|
-
* Arguments for the `open` and `close` events of the ContextMenu.
|
|
2539
|
-
*/
|
|
2540
|
-
var ContextMenuEvent = /** @class */ (function () {
|
|
2541
|
-
function ContextMenuEvent() {
|
|
2542
|
-
}
|
|
2543
|
-
return ContextMenuEvent;
|
|
2544
|
-
}());
|
|
2545
|
-
|
|
2546
|
-
/**
|
|
2547
|
-
* Arguments for the `select` event of the ContextMenu.
|
|
2548
|
-
*/
|
|
2549
|
-
var ContextMenuSelectEvent = /** @class */ (function (_super) {
|
|
2550
|
-
__extends(ContextMenuSelectEvent, _super);
|
|
2551
|
-
function ContextMenuSelectEvent() {
|
|
2552
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
2553
|
-
}
|
|
2554
|
-
return ContextMenuSelectEvent;
|
|
2555
|
-
}(ContextMenuEvent));
|
|
2556
|
-
|
|
2557
|
-
/**
|
|
2558
|
-
* Arguments for the `popupOpen` and `popupClose` events of the ContextMenu.
|
|
2559
|
-
*/
|
|
2560
|
-
var ContextMenuPopupEvent = /** @class */ (function (_super) {
|
|
2561
|
-
__extends(ContextMenuPopupEvent, _super);
|
|
2562
|
-
function ContextMenuPopupEvent() {
|
|
2563
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
2564
|
-
}
|
|
2565
|
-
return ContextMenuPopupEvent;
|
|
2566
|
-
}(PreventableEvent));
|
|
2567
|
-
|
|
2568
|
-
/**
|
|
2569
|
-
* Represents a template for the content of the ContextMenu. To define a template, nest an `<ng-template>`
|
|
2570
|
-
* tag with the `kendoContextMenuTemplate` directive inside a `<kendo-contextmenu>` component
|
|
2571
|
-
* ([more information and examples]({% slug templates_contextmenu %})).
|
|
2572
|
-
*
|
|
2573
|
-
* {% meta height:200 %}
|
|
2574
|
-
* {% embed_file context-menu/template/app.component.ts preview %}
|
|
2575
|
-
* {% embed_file shared/app.module.ts %}
|
|
2576
|
-
* {% embed_file shared/main.ts %}
|
|
2577
|
-
* {% endmeta %}
|
|
2578
|
-
*/
|
|
2579
|
-
var ContextMenuTemplateDirective = /** @class */ (function () {
|
|
2580
|
-
function ContextMenuTemplateDirective(templateRef) {
|
|
2581
|
-
this.templateRef = templateRef;
|
|
2582
|
-
}
|
|
2583
|
-
ContextMenuTemplateDirective = __decorate([
|
|
2584
|
-
Directive({
|
|
2585
|
-
selector: '[kendoContextMenuTemplate]'
|
|
2586
|
-
}),
|
|
2587
|
-
__param(0, Optional()),
|
|
2588
|
-
__metadata("design:paramtypes", [TemplateRef])
|
|
2589
|
-
], ContextMenuTemplateDirective);
|
|
2590
|
-
return ContextMenuTemplateDirective;
|
|
2591
|
-
}());
|
|
2592
|
-
|
|
2593
|
-
/**
|
|
2594
|
-
* @hidden
|
|
2595
|
-
*/
|
|
2596
|
-
var ContextMenuItemsService = /** @class */ (function () {
|
|
2597
|
-
function ContextMenuItemsService(contextService) {
|
|
2598
|
-
this.contextService = contextService;
|
|
2599
|
-
}
|
|
2600
|
-
ContextMenuItemsService.prototype.get = function (index) {
|
|
2601
|
-
if (this.contextService.items) {
|
|
2602
|
-
return this.contextService.items.get(index);
|
|
2603
|
-
}
|
|
2604
|
-
};
|
|
2605
|
-
ContextMenuItemsService = __decorate([
|
|
2606
|
-
Injectable(),
|
|
2607
|
-
__metadata("design:paramtypes", [ContextMenuService])
|
|
2608
|
-
], ContextMenuItemsService);
|
|
2609
|
-
return ContextMenuItemsService;
|
|
2610
|
-
}());
|
|
2611
|
-
|
|
2612
|
-
/**
|
|
2613
|
-
* @hidden
|
|
2614
|
-
*/
|
|
2615
|
-
var ContextMenuTargetService = /** @class */ (function () {
|
|
2616
|
-
function ContextMenuTargetService() {
|
|
2617
|
-
this.targets = [];
|
|
2618
|
-
}
|
|
2619
|
-
ContextMenuTargetService.prototype.add = function (target) {
|
|
2620
|
-
this.targets.push(target);
|
|
2621
|
-
};
|
|
2622
|
-
ContextMenuTargetService.prototype.remove = function (target) {
|
|
2623
|
-
var index = this.targets.indexOf(target);
|
|
2624
|
-
this.targets.splice(index, 1);
|
|
2625
|
-
};
|
|
2626
|
-
ContextMenuTargetService.prototype.find = function (targetElement) {
|
|
2627
|
-
return this.targets.find(function (target) { return target.element === targetElement; });
|
|
2628
|
-
};
|
|
2629
|
-
ContextMenuTargetService = __decorate([
|
|
2630
|
-
Injectable()
|
|
2631
|
-
], ContextMenuTargetService);
|
|
2632
|
-
return ContextMenuTargetService;
|
|
2633
|
-
}());
|
|
2634
|
-
|
|
2635
|
-
/**
|
|
2636
|
-
* Specifies a container for the [targets]({% slug api_menu_contextmenutargetdirective %}) of the ContextMenu.
|
|
2637
|
-
*/
|
|
2638
|
-
var ContextMenuTargetContainerDirective = /** @class */ (function () {
|
|
2639
|
-
/**
|
|
2640
|
-
* @hidden
|
|
2641
|
-
*/
|
|
2642
|
-
function ContextMenuTargetContainerDirective(elementRef, targetService) {
|
|
2643
|
-
this.targetService = targetService;
|
|
2644
|
-
if (elementRef) {
|
|
2645
|
-
this.element = elementRef.nativeElement;
|
|
2646
|
-
}
|
|
2647
|
-
}
|
|
2648
|
-
ContextMenuTargetContainerDirective = __decorate([
|
|
2649
|
-
Directive({
|
|
2650
|
-
selector: '[kendoContextMenuTargetContainer]',
|
|
2651
|
-
exportAs: 'kendoContextMenuTargetContainer',
|
|
2652
|
-
providers: [ContextMenuTargetService]
|
|
2653
|
-
}),
|
|
2654
|
-
__metadata("design:paramtypes", [ElementRef, ContextMenuTargetService])
|
|
2655
|
-
], ContextMenuTargetContainerDirective);
|
|
2656
|
-
return ContextMenuTargetContainerDirective;
|
|
2657
|
-
}());
|
|
2658
|
-
|
|
2659
|
-
/**
|
|
2660
|
-
* @hidden
|
|
2661
|
-
*/
|
|
2662
|
-
var TARGET_CLASS = 'k-contextmenu-target';
|
|
2663
|
-
/**
|
|
2664
|
-
* Specifies a [target]({% slug api_menu_contextmenutargetdirective %}) for the ContextMenu
|
|
2665
|
-
* ([see example]({% slug target_contextmenu %}#toc-directives)).
|
|
2666
|
-
*/
|
|
2667
|
-
var ContextMenuTargetDirective = /** @class */ (function () {
|
|
2668
|
-
function ContextMenuTargetDirective(elementRef, targetService) {
|
|
2669
|
-
this.targetService = targetService;
|
|
2670
|
-
/**
|
|
2671
|
-
* @hidden
|
|
2672
|
-
*/
|
|
2673
|
-
this.hostClass = true;
|
|
2674
|
-
if (elementRef) {
|
|
2675
|
-
this.element = elementRef.nativeElement;
|
|
2676
|
-
}
|
|
2677
|
-
targetService.add(this);
|
|
2678
|
-
}
|
|
2679
|
-
ContextMenuTargetDirective.prototype.ngOnDestroy = function () {
|
|
2680
|
-
this.targetService.remove(this);
|
|
2681
|
-
};
|
|
2682
|
-
__decorate([
|
|
2683
|
-
Input('kendoContextMenuTarget'),
|
|
2684
|
-
__metadata("design:type", Object)
|
|
2685
|
-
], ContextMenuTargetDirective.prototype, "data", void 0);
|
|
2686
|
-
__decorate([
|
|
2687
|
-
HostBinding("class." + TARGET_CLASS),
|
|
2688
|
-
__metadata("design:type", Boolean)
|
|
2689
|
-
], ContextMenuTargetDirective.prototype, "hostClass", void 0);
|
|
2690
|
-
ContextMenuTargetDirective = __decorate([
|
|
2691
|
-
Directive({
|
|
2692
|
-
selector: '[kendoContextMenuTarget]',
|
|
2693
|
-
exportAs: 'kendoContextMenuTarget'
|
|
2694
|
-
}),
|
|
2695
|
-
__metadata("design:paramtypes", [ElementRef, ContextMenuTargetService])
|
|
2696
|
-
], ContextMenuTargetDirective);
|
|
2697
|
-
return ContextMenuTargetDirective;
|
|
2698
|
-
}());
|
|
2699
|
-
|
|
2700
|
-
var CONTEXT_MENU = 'contextmenu';
|
|
2701
|
-
var DEFAULT_ANCHOR_ALIGN = { horizontal: 'left', vertical: 'bottom' };
|
|
2702
|
-
var DEFAULT_POPUP_ALIGN = { horizontal: 'left', vertical: 'top' };
|
|
2703
|
-
var DEFAULT_COLLISION = { horizontal: 'fit', vertical: 'flip' };
|
|
2704
|
-
var preventDefault = function (e) { return e.preventDefault(); };
|
|
2705
|
-
var ɵ1$2 = bodyFactory;
|
|
2706
|
-
/**
|
|
2707
|
-
* Represents the [Kendo UI ContextMenu component for Angular]({% slug overview_contextmenu %}).
|
|
2708
|
-
*
|
|
2709
|
-
* @example
|
|
2710
|
-
* ```ts
|
|
2711
|
-
* _@Component({
|
|
2712
|
-
* selector: 'my-app',
|
|
2713
|
-
* template: `
|
|
2714
|
-
* <div #target>
|
|
2715
|
-
* Right-click to open Context menu</p>
|
|
2716
|
-
* </div>
|
|
2717
|
-
* <kendo-contextmenu [target]="target" [items]="items"> </kendo-contextmenu>
|
|
2718
|
-
* `
|
|
2719
|
-
* })
|
|
2720
|
-
* class AppComponent {
|
|
2721
|
-
* public items: any[] = [{ text: 'item1', items: [{ text: 'item1.1' }] }, { text: 'item2', disabled: true }];
|
|
2722
|
-
* }
|
|
2723
|
-
* ```
|
|
2724
|
-
*/
|
|
2725
|
-
var ContextMenuComponent = /** @class */ (function (_super) {
|
|
2726
|
-
__extends(ContextMenuComponent, _super);
|
|
2727
|
-
function ContextMenuComponent(popupService, service, ngZone, renderer) {
|
|
2728
|
-
var _this = _super.call(this) || this;
|
|
2729
|
-
_this.popupService = popupService;
|
|
2730
|
-
_this.service = service;
|
|
2731
|
-
_this.ngZone = ngZone;
|
|
2732
|
-
_this.renderer = renderer;
|
|
2733
|
-
/**
|
|
2734
|
-
* Specifies the event on which the ContextMenu will open ([see example]({% slug showon_contextmenu %})).
|
|
2735
|
-
* Accepts the name of a native DOM event. Defaults to `contextmenu` which opens the ContextMenu for the target element.
|
|
2736
|
-
*/
|
|
2737
|
-
_this.showOn = CONTEXT_MENU;
|
|
2738
|
-
/**
|
|
2739
|
-
* Indicates that the ContextMenu will be aligned to the target or to the `filter` element (if specified).
|
|
2740
|
-
*/
|
|
2741
|
-
_this.alignToAnchor = false;
|
|
2742
|
-
/**
|
|
2743
|
-
* Specifies if the Menu will be vertically rendered ([see example]({% slug orientation_contextmenu %})).
|
|
2744
|
-
* @default true
|
|
2745
|
-
*/
|
|
2746
|
-
_this.vertical = true;
|
|
2747
|
-
/**
|
|
2748
|
-
* Fires when the Menu is opened ([see example]({% slug target_contextmenu %}#toc-changing-items-for-specified-targets)).
|
|
2749
|
-
*/
|
|
2750
|
-
_this.popupOpen = new EventEmitter();
|
|
2751
|
-
/**
|
|
2752
|
-
* Fires when the Menu is closed.
|
|
2753
|
-
*/
|
|
2754
|
-
_this.popupClose = new EventEmitter();
|
|
2755
|
-
/**
|
|
2756
|
-
* Fires when a Menu item is selected.
|
|
2757
|
-
*/
|
|
2758
|
-
_this.select = new EventEmitter();
|
|
2759
|
-
/**
|
|
2760
|
-
* Fires when a Menu item is opened.
|
|
2761
|
-
*/
|
|
2762
|
-
_this.open = new EventEmitter();
|
|
2763
|
-
/**
|
|
2764
|
-
* Fires when a Menu item is closed.
|
|
2765
|
-
*/
|
|
2766
|
-
_this.close = new EventEmitter();
|
|
2767
|
-
_this.service.owner = _this;
|
|
2768
|
-
_this.popupKeyDownHandler = _this.popupKeyDownHandler.bind(_this);
|
|
2769
|
-
return _this;
|
|
2770
|
-
}
|
|
2771
|
-
ContextMenuComponent_1 = ContextMenuComponent;
|
|
2772
|
-
/**
|
|
2773
|
-
* Hides the ContextMenu.
|
|
2774
|
-
*/
|
|
2775
|
-
ContextMenuComponent.prototype.hide = function () {
|
|
2776
|
-
this.removePopup();
|
|
2777
|
-
};
|
|
2778
|
-
/**
|
|
2779
|
-
* Shows the ContextMenu for the specified target.
|
|
2780
|
-
* @param target - The offset or the target element for which the ContextMenu will open.
|
|
2781
|
-
*/
|
|
2782
|
-
ContextMenuComponent.prototype.show = function (target) {
|
|
2783
|
-
if (!target) {
|
|
2784
|
-
return;
|
|
2785
|
-
}
|
|
2786
|
-
var showTarget = target;
|
|
2787
|
-
this.removePopup();
|
|
2788
|
-
if (defined(showTarget.left) && defined(showTarget.top)) {
|
|
2789
|
-
this.createPopup({ offset: showTarget });
|
|
2790
|
-
}
|
|
2791
|
-
else {
|
|
2792
|
-
this.currentTarget = showTarget.nativeElement || showTarget;
|
|
2793
|
-
this.createPopup({ anchor: this.currentTarget });
|
|
2794
|
-
}
|
|
2795
|
-
};
|
|
2796
|
-
ContextMenuComponent.prototype.ngOnChanges = function (changes) {
|
|
2797
|
-
if (changes.target || changes.showOn) {
|
|
2798
|
-
this.bindShowHandler();
|
|
2799
|
-
}
|
|
2800
|
-
};
|
|
2801
|
-
ContextMenuComponent.prototype.ngOnInit = function () {
|
|
2802
|
-
var _this = this;
|
|
2803
|
-
this.ngZone.runOutsideAngular(function () {
|
|
2804
|
-
var closeClickSubscription = _this.renderer.listen('document', 'mousedown', function (e) {
|
|
2805
|
-
if (_this.popupRef && !closest(e.target, function (node) { return node === _this.popupRef.popupElement; }) && _this.service.leaveMenu(e)) {
|
|
2806
|
-
_this.closePopup(e);
|
|
2807
|
-
}
|
|
2808
|
-
});
|
|
2809
|
-
var closeBlurSubscription = _this.renderer.listen('window', 'blur', function (e) {
|
|
2810
|
-
if (_this.popupRef) {
|
|
2811
|
-
_this.closePopup(e);
|
|
2812
|
-
}
|
|
2813
|
-
});
|
|
2814
|
-
_this.closeSubscription = function () {
|
|
2815
|
-
closeClickSubscription();
|
|
2816
|
-
closeBlurSubscription();
|
|
2817
|
-
};
|
|
2818
|
-
});
|
|
2819
|
-
};
|
|
2820
|
-
ContextMenuComponent.prototype.ngOnDestroy = function () {
|
|
2821
|
-
if (this.closeSubscription) {
|
|
2822
|
-
this.closeSubscription();
|
|
2823
|
-
this.closeSubscription = null;
|
|
2824
|
-
}
|
|
2825
|
-
this.unbindShowHandler();
|
|
2826
|
-
this.removePopup();
|
|
2827
|
-
};
|
|
2828
|
-
/**
|
|
2829
|
-
* @hidden
|
|
2830
|
-
*/
|
|
2831
|
-
ContextMenuComponent.prototype.emitMenuEvent = function (name, args) {
|
|
2832
|
-
args.target = this.currentTarget;
|
|
2833
|
-
args.sender = this;
|
|
2834
|
-
this[name].emit(args);
|
|
2835
|
-
if (name === 'select' && !args.hasContent) {
|
|
2836
|
-
this.closeAndFocus(args.originalEvent);
|
|
2837
|
-
}
|
|
2838
|
-
};
|
|
2839
|
-
ContextMenuComponent.prototype.bindShowHandler = function () {
|
|
2840
|
-
var _this = this;
|
|
2841
|
-
this.unbindShowHandler();
|
|
2842
|
-
this.ngZone.runOutsideAngular(function () {
|
|
2843
|
-
var element = _this.targetElement();
|
|
2844
|
-
if (!element) {
|
|
2845
|
-
return;
|
|
2846
|
-
}
|
|
2847
|
-
var eventName = _this.showOn || CONTEXT_MENU;
|
|
2848
|
-
_this.showSubscription = _this.renderer.listen(element, _this.showOn || CONTEXT_MENU, function (e) {
|
|
2849
|
-
_this.showContextMenu(e, element);
|
|
2850
|
-
});
|
|
2851
|
-
if (eventName === CONTEXT_MENU) {
|
|
2852
|
-
_this.keydownSubscription = _this.renderer.listen(element, 'keydown', function (e) {
|
|
2853
|
-
if (e.shiftKey && e.keyCode === Keys.F10) {
|
|
2854
|
-
_this.showContextMenu(e, element);
|
|
2855
|
-
}
|
|
2856
|
-
});
|
|
2857
|
-
}
|
|
2858
|
-
});
|
|
2859
|
-
};
|
|
2860
|
-
ContextMenuComponent.prototype.showContextMenu = function (e, element) {
|
|
2861
|
-
var _this = this;
|
|
2862
|
-
var filter = this.targetFilter();
|
|
2863
|
-
var currentTarget = element;
|
|
2864
|
-
if (filter) {
|
|
2865
|
-
currentTarget = findInContainer(e.target, filter, element);
|
|
2866
|
-
if (currentTarget && currentTarget !== e.target && isFocusable(e.target)) {
|
|
2867
|
-
return;
|
|
2868
|
-
}
|
|
2869
|
-
if (currentTarget && this.directiveTarget) {
|
|
2870
|
-
currentTarget = this.target.targetService.find(currentTarget);
|
|
2871
|
-
}
|
|
2872
|
-
}
|
|
2873
|
-
if (!currentTarget) {
|
|
2874
|
-
this.closePopup(e);
|
|
2875
|
-
return;
|
|
2876
|
-
}
|
|
2877
|
-
this.ngZone.run(function () {
|
|
2878
|
-
if (!_this.closePopup(e)) {
|
|
2879
|
-
_this.currentTarget = currentTarget;
|
|
2880
|
-
_this.openPopup(e);
|
|
2881
|
-
}
|
|
2882
|
-
});
|
|
2883
|
-
};
|
|
2884
|
-
ContextMenuComponent.prototype.unbindShowHandler = function () {
|
|
2885
|
-
if (this.showSubscription) {
|
|
2886
|
-
this.showSubscription();
|
|
2887
|
-
this.showSubscription = null;
|
|
2888
|
-
}
|
|
2889
|
-
if (this.keydownSubscription) {
|
|
2890
|
-
this.keydownSubscription();
|
|
2891
|
-
this.keydownSubscription = null;
|
|
2892
|
-
}
|
|
2893
|
-
};
|
|
2894
|
-
ContextMenuComponent.prototype.targetElement = function () {
|
|
2895
|
-
if (!isDocumentAvailable()) {
|
|
2896
|
-
return;
|
|
2897
|
-
}
|
|
2898
|
-
this.directiveTarget = false;
|
|
2899
|
-
var target = this.target;
|
|
2900
|
-
if (typeof target === 'string') {
|
|
2901
|
-
target = document.querySelector(target); // maybe querySelectorAll?
|
|
2902
|
-
}
|
|
2903
|
-
else if (target && target.nativeElement) {
|
|
2904
|
-
target = target.nativeElement;
|
|
2905
|
-
}
|
|
2906
|
-
else if (target instanceof ContextMenuTargetContainerDirective) {
|
|
2907
|
-
target = target.element;
|
|
2908
|
-
this.directiveTarget = true;
|
|
2909
|
-
}
|
|
2910
|
-
return target;
|
|
2911
|
-
};
|
|
2912
|
-
ContextMenuComponent.prototype.targetFilter = function () {
|
|
2913
|
-
if (this.directiveTarget) {
|
|
2914
|
-
return "." + TARGET_CLASS;
|
|
2915
|
-
}
|
|
2916
|
-
return this.filter;
|
|
2917
|
-
};
|
|
2918
|
-
ContextMenuComponent.prototype.closePopup = function (e) {
|
|
2919
|
-
var _this = this;
|
|
2920
|
-
if (!this.popupRef) {
|
|
2921
|
-
return;
|
|
2922
|
-
}
|
|
2923
|
-
return this.popupAction('popupClose', e, function () {
|
|
2924
|
-
_this.removePopup();
|
|
2925
|
-
});
|
|
2926
|
-
};
|
|
2927
|
-
ContextMenuComponent.prototype.removePopup = function () {
|
|
2928
|
-
if (this.popupRef) {
|
|
2929
|
-
this.popupRef.close();
|
|
2930
|
-
this.popupRef = null;
|
|
2931
|
-
this.currentTarget = null;
|
|
2932
|
-
}
|
|
2933
|
-
if (this.popupSubscriptions) {
|
|
2934
|
-
this.popupSubscriptions();
|
|
2935
|
-
this.popupSubscriptions = null;
|
|
2936
|
-
}
|
|
2937
|
-
};
|
|
2938
|
-
ContextMenuComponent.prototype.openPopup = function (e) {
|
|
2939
|
-
var _this = this;
|
|
2940
|
-
this.popupAction('popupOpen', e, function () {
|
|
2941
|
-
e.preventDefault();
|
|
2942
|
-
var anchor, offset;
|
|
2943
|
-
if (_this.alignToAnchor || e.type === 'keydown') {
|
|
2944
|
-
anchor = _this.currentTargetElement;
|
|
2945
|
-
}
|
|
2946
|
-
else {
|
|
2947
|
-
offset = { left: e.pageX, top: e.pageY };
|
|
2948
|
-
}
|
|
2949
|
-
_this.createPopup({ anchor: anchor, offset: offset });
|
|
2950
|
-
});
|
|
2951
|
-
};
|
|
2952
|
-
ContextMenuComponent.prototype.createPopup = function (options) {
|
|
2953
|
-
var _this = this;
|
|
2954
|
-
this.popupRef = this.popupService.open(Object.assign({
|
|
2955
|
-
animate: defined(this.popupAnimate) ? this.popupAnimate : true,
|
|
2956
|
-
appendTo: this.appendTo,
|
|
2957
|
-
collision: this.collision || DEFAULT_COLLISION,
|
|
2958
|
-
popupAlign: this.popupAlign || DEFAULT_POPUP_ALIGN,
|
|
2959
|
-
anchorAlign: this.anchorAlign || DEFAULT_ANCHOR_ALIGN,
|
|
2960
|
-
content: this.contentTemplate ? this.contentTemplate.templateRef : this.defaultContentTemplate,
|
|
2961
|
-
popupClass: 'k-menu-popup'
|
|
2962
|
-
}, options));
|
|
2963
|
-
var element = this.popupRef.popupElement;
|
|
2964
|
-
this.renderer.addClass(element, 'k-context-menu-popup');
|
|
2965
|
-
this.renderer.setAttribute(element, 'tabindex', '-1');
|
|
2966
|
-
this.renderer.setStyle(element, 'outline', '0'); //possibly move to styles
|
|
2967
|
-
if (this.ariaLabel) {
|
|
2968
|
-
this.renderer.setAttribute(element, 'aria-label', this.ariaLabel);
|
|
2969
|
-
}
|
|
2970
|
-
this.activeTarget = this.currentTargetElement === document.activeElement;
|
|
2971
|
-
this.ngZone.runOutsideAngular(function () {
|
|
2972
|
-
var unbindKeyDown = _this.renderer.listen(element, 'keydown', _this.popupKeyDownHandler);
|
|
2973
|
-
var unbindContextmenu = _this.renderer.listen(element, 'contextmenu', preventDefault);
|
|
2974
|
-
_this.popupSubscriptions = function () {
|
|
2975
|
-
unbindKeyDown();
|
|
2976
|
-
unbindContextmenu();
|
|
2977
|
-
};
|
|
2978
|
-
});
|
|
2979
|
-
element.focus();
|
|
2980
|
-
};
|
|
2981
|
-
ContextMenuComponent.prototype.closeAndFocus = function (e) {
|
|
2982
|
-
var currentTarget = this.currentTargetElement;
|
|
2983
|
-
if (!this.closePopup(e) && this.activeTarget) {
|
|
2984
|
-
currentTarget.focus();
|
|
2985
|
-
}
|
|
2986
|
-
};
|
|
2987
|
-
ContextMenuComponent.prototype.popupKeyDownHandler = function (e) {
|
|
2988
|
-
var element = this.popupRef.popupElement;
|
|
2989
|
-
if (e.keyCode === Keys.Escape && (hasClass(e.target, 'k-menu-item') || e.target === element)) {
|
|
2990
|
-
this.closeAndFocus(e);
|
|
2991
|
-
}
|
|
2992
|
-
else if (e.target === element) {
|
|
2993
|
-
this.service.keydown.emit(e);
|
|
2994
|
-
}
|
|
2995
|
-
};
|
|
2996
|
-
ContextMenuComponent.prototype.popupAction = function (name, originalEvent, callback) {
|
|
2997
|
-
var _this = this;
|
|
2998
|
-
var emitter = this[name];
|
|
2999
|
-
var prevented = false;
|
|
3000
|
-
if (hasObservers(emitter)) {
|
|
3001
|
-
this.ngZone.run(function () {
|
|
3002
|
-
var args = new ContextMenuPopupEvent({
|
|
3003
|
-
originalEvent: originalEvent,
|
|
3004
|
-
sender: _this,
|
|
3005
|
-
target: _this.currentTarget
|
|
3006
|
-
});
|
|
3007
|
-
emitter.emit(args);
|
|
3008
|
-
if (!args.isDefaultPrevented()) {
|
|
3009
|
-
callback();
|
|
3010
|
-
}
|
|
3011
|
-
prevented = args.isDefaultPrevented();
|
|
3012
|
-
});
|
|
3013
|
-
}
|
|
3014
|
-
else {
|
|
3015
|
-
callback();
|
|
3016
|
-
}
|
|
3017
|
-
return prevented;
|
|
3018
|
-
};
|
|
3019
|
-
Object.defineProperty(ContextMenuComponent.prototype, "currentTargetElement", {
|
|
3020
|
-
get: function () {
|
|
3021
|
-
return this.directiveTarget && this.currentTarget ? this.currentTarget.element : this.currentTarget;
|
|
3022
|
-
},
|
|
3023
|
-
enumerable: true,
|
|
3024
|
-
configurable: true
|
|
3025
|
-
});
|
|
3026
|
-
var ContextMenuComponent_1;
|
|
3027
|
-
__decorate([
|
|
3028
|
-
Input(),
|
|
3029
|
-
__metadata("design:type", String)
|
|
3030
|
-
], ContextMenuComponent.prototype, "showOn", void 0);
|
|
3031
|
-
__decorate([
|
|
3032
|
-
Input(),
|
|
3033
|
-
__metadata("design:type", Object)
|
|
3034
|
-
], ContextMenuComponent.prototype, "target", void 0);
|
|
3035
|
-
__decorate([
|
|
3036
|
-
Input(),
|
|
3037
|
-
__metadata("design:type", String)
|
|
3038
|
-
], ContextMenuComponent.prototype, "filter", void 0);
|
|
3039
|
-
__decorate([
|
|
3040
|
-
Input(),
|
|
3041
|
-
__metadata("design:type", Boolean)
|
|
3042
|
-
], ContextMenuComponent.prototype, "alignToAnchor", void 0);
|
|
3043
|
-
__decorate([
|
|
3044
|
-
Input(),
|
|
3045
|
-
__metadata("design:type", Boolean)
|
|
3046
|
-
], ContextMenuComponent.prototype, "vertical", void 0);
|
|
3047
|
-
__decorate([
|
|
3048
|
-
Input(),
|
|
3049
|
-
__metadata("design:type", Object)
|
|
3050
|
-
], ContextMenuComponent.prototype, "popupAnimate", void 0);
|
|
3051
|
-
__decorate([
|
|
3052
|
-
Input(),
|
|
3053
|
-
__metadata("design:type", Object)
|
|
3054
|
-
], ContextMenuComponent.prototype, "popupAlign", void 0);
|
|
3055
|
-
__decorate([
|
|
3056
|
-
Input(),
|
|
3057
|
-
__metadata("design:type", Object)
|
|
3058
|
-
], ContextMenuComponent.prototype, "anchorAlign", void 0);
|
|
3059
|
-
__decorate([
|
|
3060
|
-
Input(),
|
|
3061
|
-
__metadata("design:type", Object)
|
|
3062
|
-
], ContextMenuComponent.prototype, "collision", void 0);
|
|
3063
|
-
__decorate([
|
|
3064
|
-
Input(),
|
|
3065
|
-
__metadata("design:type", ViewContainerRef)
|
|
3066
|
-
], ContextMenuComponent.prototype, "appendTo", void 0);
|
|
3067
|
-
__decorate([
|
|
3068
|
-
Input(),
|
|
3069
|
-
__metadata("design:type", String)
|
|
3070
|
-
], ContextMenuComponent.prototype, "ariaLabel", void 0);
|
|
3071
|
-
__decorate([
|
|
3072
|
-
Output(),
|
|
3073
|
-
__metadata("design:type", EventEmitter)
|
|
3074
|
-
], ContextMenuComponent.prototype, "popupOpen", void 0);
|
|
3075
|
-
__decorate([
|
|
3076
|
-
Output(),
|
|
3077
|
-
__metadata("design:type", EventEmitter)
|
|
3078
|
-
], ContextMenuComponent.prototype, "popupClose", void 0);
|
|
3079
|
-
__decorate([
|
|
3080
|
-
Output(),
|
|
3081
|
-
__metadata("design:type", EventEmitter)
|
|
3082
|
-
], ContextMenuComponent.prototype, "select", void 0);
|
|
3083
|
-
__decorate([
|
|
3084
|
-
Output(),
|
|
3085
|
-
__metadata("design:type", EventEmitter)
|
|
3086
|
-
], ContextMenuComponent.prototype, "open", void 0);
|
|
3087
|
-
__decorate([
|
|
3088
|
-
Output(),
|
|
3089
|
-
__metadata("design:type", EventEmitter)
|
|
3090
|
-
], ContextMenuComponent.prototype, "close", void 0);
|
|
3091
|
-
__decorate([
|
|
3092
|
-
ContentChild(ContextMenuTemplateDirective, { static: false }),
|
|
3093
|
-
__metadata("design:type", ContextMenuTemplateDirective)
|
|
3094
|
-
], ContextMenuComponent.prototype, "contentTemplate", void 0);
|
|
3095
|
-
__decorate([
|
|
3096
|
-
ViewChild('default', { static: false }),
|
|
3097
|
-
__metadata("design:type", TemplateRef)
|
|
3098
|
-
], ContextMenuComponent.prototype, "defaultContentTemplate", void 0);
|
|
3099
|
-
ContextMenuComponent = ContextMenuComponent_1 = __decorate([
|
|
3100
|
-
Component({
|
|
3101
|
-
exportAs: 'kendoContextMenu',
|
|
3102
|
-
providers: [
|
|
3103
|
-
ContextMenuService,
|
|
3104
|
-
LocalizationService,
|
|
3105
|
-
{
|
|
3106
|
-
provide: L10N_PREFIX,
|
|
3107
|
-
useValue: 'kendo.contextmenu'
|
|
3108
|
-
},
|
|
3109
|
-
{
|
|
3110
|
-
provide: ItemsService,
|
|
3111
|
-
useClass: ContextMenuItemsService
|
|
3112
|
-
},
|
|
3113
|
-
{
|
|
3114
|
-
provide: MenuBase,
|
|
3115
|
-
useExisting: forwardRef(function () { return ContextMenuComponent_1; })
|
|
3116
|
-
},
|
|
3117
|
-
PopupService,
|
|
3118
|
-
{
|
|
3119
|
-
provide: POPUP_CONTAINER,
|
|
3120
|
-
useFactory: ɵ1$2
|
|
3121
|
-
}
|
|
3122
|
-
],
|
|
3123
|
-
selector: 'kendo-contextmenu',
|
|
3124
|
-
template: "\n <ng-template #default>\n <kendo-menu [items]=\"rootItems\"\n [vertical]=\"vertical\"\n [openOnClick]=\"openOnClick\"\n [hoverDelay]=\"hoverDelay\"\n [animate]=\"animate\"\n [menuItemTemplate]=\"itemTemplate.first?.templateRef\"\n [menuItemLinkTemplate]=\"itemLinkTemplate.first?.templateRef\"\n ></kendo-menu>\n </ng-template>\n "
|
|
3125
|
-
}),
|
|
3126
|
-
__metadata("design:paramtypes", [PopupService,
|
|
3127
|
-
ContextMenuService,
|
|
3128
|
-
NgZone,
|
|
3129
|
-
Renderer2])
|
|
3130
|
-
], ContextMenuComponent);
|
|
3131
|
-
return ContextMenuComponent;
|
|
3132
|
-
}(MenuBase));
|
|
3133
|
-
|
|
3134
|
-
var COMPONENT_DIRECTIVES$1 = [
|
|
3135
|
-
ContextMenuComponent,
|
|
3136
|
-
ContextMenuTemplateDirective,
|
|
3137
|
-
ContextMenuTargetDirective,
|
|
3138
|
-
ContextMenuTargetContainerDirective
|
|
3139
|
-
];
|
|
3140
|
-
/**
|
|
3141
|
-
* Represents the [NgModule]({{ site.data.urls.angular['ngmoduleapi'] }})
|
|
3142
|
-
* definition for the ContextMenu component.
|
|
3143
|
-
*
|
|
3144
|
-
* @example
|
|
3145
|
-
*
|
|
3146
|
-
* ```ts-no-run
|
|
3147
|
-
* // Import the ContextMenu module
|
|
3148
|
-
* import { ContextMenuModule } from '@progress/kendo-angular-menu';
|
|
3149
|
-
*
|
|
3150
|
-
* // The browser platform with a compiler
|
|
3151
|
-
* import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
|
3152
|
-
* import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
3153
|
-
*
|
|
3154
|
-
* import { NgModule } from '@angular/core';
|
|
3155
|
-
*
|
|
3156
|
-
* // Import the app component
|
|
3157
|
-
* import { AppComponent } from './app.component';
|
|
3158
|
-
*
|
|
3159
|
-
* // Define the app module
|
|
3160
|
-
* _@NgModule({
|
|
3161
|
-
* declarations: [AppComponent], // declare app component
|
|
3162
|
-
* imports: [BrowserModule, BrowserAnimationsModule, ContextMenuModule], // import ContextMenuModule module
|
|
3163
|
-
* bootstrap: [AppComponent]
|
|
3164
|
-
* })
|
|
3165
|
-
* export class AppModule {}
|
|
3166
|
-
*
|
|
3167
|
-
* // Compile and launch the module
|
|
3168
|
-
* platformBrowserDynamic().bootstrapModule(AppModule);
|
|
3169
|
-
*
|
|
3170
|
-
* ```
|
|
3171
|
-
*/
|
|
3172
|
-
var ContextMenuModule = /** @class */ (function () {
|
|
3173
|
-
function ContextMenuModule() {
|
|
3174
|
-
}
|
|
3175
|
-
ContextMenuModule = __decorate([
|
|
3176
|
-
NgModule({
|
|
3177
|
-
declarations: [COMPONENT_DIRECTIVES$1],
|
|
3178
|
-
exports: [COMPONENT_DIRECTIVES$1, MenuModule],
|
|
3179
|
-
imports: [PopupModule, CommonModule, MenuModule]
|
|
3180
|
-
})
|
|
3181
|
-
], ContextMenuModule);
|
|
3182
|
-
return ContextMenuModule;
|
|
3183
|
-
}());
|
|
3184
|
-
|
|
3185
|
-
/**
|
|
3186
|
-
* A [module]({{ site.data.urls.angular['ngmoduleapi'] }}) that includes the Menu and ContextMenu components and directives.
|
|
3187
|
-
* Imports the MenusModule into your application [root module]({{ site.data.urls.angular['ngmodules'] }}#angular-modularity)
|
|
3188
|
-
* or any other sub-module that will use the Menu and ContextMenu components.
|
|
3189
|
-
*
|
|
3190
|
-
* @example
|
|
3191
|
-
* ```ts-no-run
|
|
3192
|
-
* import { NgModule } from '@angular/core';
|
|
3193
|
-
* import { BrowserModule } from '@angular/platform-browser';
|
|
3194
|
-
* import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
3195
|
-
* import { MenusModule } from '@progress/kendo-angular-menu';
|
|
3196
|
-
* import { AppComponent } from './app.component';
|
|
3197
|
-
*
|
|
3198
|
-
* _@NgModule({
|
|
3199
|
-
* bootstrap: [AppComponent],
|
|
3200
|
-
* declarations: [AppComponent],
|
|
3201
|
-
* imports: [BrowserModule, BrowserAnimationsModule, MenusModule]
|
|
3202
|
-
* })
|
|
3203
|
-
* export class AppModule {
|
|
3204
|
-
* }
|
|
3205
|
-
* ```
|
|
3206
|
-
*/
|
|
3207
|
-
var MenusModule = /** @class */ (function () {
|
|
3208
|
-
function MenusModule() {
|
|
3209
|
-
}
|
|
3210
|
-
MenusModule = __decorate([
|
|
3211
|
-
NgModule({
|
|
3212
|
-
exports: [MenuModule, ContextMenuModule]
|
|
3213
|
-
})
|
|
3214
|
-
], MenusModule);
|
|
3215
|
-
return MenusModule;
|
|
3216
|
-
}());
|
|
3217
|
-
|
|
3218
|
-
/**
|
|
3219
|
-
* Generated bundle index. Do not edit.
|
|
3220
|
-
*/
|
|
3221
|
-
|
|
3222
|
-
export { NODE_INDEX, ContextMenuItemsService, ContextMenuTargetContainerDirective, ContextMenuTargetDirective, ContextMenuTargetService, BindingDirectiveBase, MenuBase, PreventableEvent, ActionsService, HoverService, ItemsService, NavigationService, bodyFactory, MenuComponent, ListComponent, ItemComponent, LinkDirective, ExpandArrowDirective, MenuItemComponent, MenuEvent, MenuSelectEvent, ItemContentTemplateDirective, ItemTemplateDirective, ItemLinkTemplateDirective, HierarchyBindingDirective, FlatBindingDirective, MenuModule, ContextMenuEvent, ContextMenuSelectEvent, ContextMenuPopupEvent, ContextMenuTemplateDirective, ContextMenuComponent, ContextMenuModule, ContextMenuService, MenusModule };
|