@progress/kendo-angular-menu 21.4.1 → 22.0.0
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/data-binding/binding-directive-base.d.ts +1 -1
- package/fesm2022/progress-kendo-angular-menu.mjs +87 -87
- package/menu-base.d.ts +1 -1
- package/package.json +11 -19
- package/esm2022/constants.mjs +0 -8
- package/esm2022/context-menu/context-menu-event.mjs +0 -25
- package/esm2022/context-menu/context-menu-items.service.mjs +0 -27
- package/esm2022/context-menu/context-menu-popup-event.mjs +0 -29
- package/esm2022/context-menu/context-menu-select-event.mjs +0 -14
- package/esm2022/context-menu/context-menu-target-container.directive.mjs +0 -49
- package/esm2022/context-menu/context-menu-target.directive.mjs +0 -62
- package/esm2022/context-menu/context-menu-target.service.mjs +0 -27
- package/esm2022/context-menu/context-menu-template.directive.mjs +0 -39
- package/esm2022/context-menu/context-menu.component.mjs +0 -527
- package/esm2022/context-menu/context-menu.module.mjs +0 -69
- package/esm2022/context-menu/context-menu.service.mjs +0 -30
- package/esm2022/data-binding/binding-directive-base.mjs +0 -46
- package/esm2022/data-binding/flat-binding.directive.mjs +0 -139
- package/esm2022/data-binding/hierachy-binding.directive.mjs +0 -124
- package/esm2022/data-binding/utils.mjs +0 -31
- package/esm2022/directives.mjs +0 -48
- package/esm2022/dom-queries.mjs +0 -104
- package/esm2022/index.mjs +0 -29
- package/esm2022/menu-animation.interface.mjs +0 -5
- package/esm2022/menu-base.mjs +0 -103
- package/esm2022/menu-event.mjs +0 -22
- package/esm2022/menu-item.component.mjs +0 -149
- package/esm2022/menu-item.interface.mjs +0 -5
- package/esm2022/menu-select-event.mjs +0 -14
- package/esm2022/menu.component.mjs +0 -304
- package/esm2022/menu.module.mjs +0 -65
- package/esm2022/menus.module.mjs +0 -59
- package/esm2022/open-on-click-settings.mjs +0 -10
- package/esm2022/package-metadata.mjs +0 -16
- package/esm2022/preventable-event.mjs +0 -34
- package/esm2022/progress-kendo-angular-menu.mjs +0 -8
- package/esm2022/rendering/arrow.component.mjs +0 -70
- package/esm2022/rendering/link.directive.mjs +0 -69
- package/esm2022/rendering/list.component.mjs +0 -679
- package/esm2022/rendering/popup-settings.mjs +0 -74
- package/esm2022/services/actions.service.mjs +0 -192
- package/esm2022/services/hover.service.mjs +0 -127
- package/esm2022/services/items.service.mjs +0 -128
- package/esm2022/services/navigation.service.mjs +0 -268
- package/esm2022/size.mjs +0 -5
- package/esm2022/templates/item-content-template.directive.mjs +0 -53
- package/esm2022/templates/item-link-template.directive.mjs +0 -57
- package/esm2022/templates/item-template.directive.mjs +0 -54
- package/esm2022/utils.mjs +0 -52
|
@@ -1,679 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { Component, ElementRef, Input, NgZone, Optional, Renderer2, TemplateRef, ViewContainerRef, forwardRef } from '@angular/core';
|
|
6
|
-
import { NgClass, NgStyle, NgTemplateOutlet } from '@angular/common';
|
|
7
|
-
import { ChangeDetectorRef, HostBinding, ViewChild } from '@angular/core';
|
|
8
|
-
import { isDocumentAvailable, isPresent, parseCSSClassNames } from '@progress/kendo-angular-common';
|
|
9
|
-
import { POPUP_CONTAINER, PopupService } from '@progress/kendo-angular-popup';
|
|
10
|
-
import { IconWrapperComponent } from '@progress/kendo-angular-icons';
|
|
11
|
-
import { ContextMenuService } from '../context-menu/context-menu.service';
|
|
12
|
-
import { NODE_INDEX } from '../constants';
|
|
13
|
-
import { closest, closestItem, hasClass, inMenu, isFocusable, nodeIndex } from '../dom-queries';
|
|
14
|
-
import { ActionsService } from '../services/actions.service';
|
|
15
|
-
import { HoverService } from '../services/hover.service';
|
|
16
|
-
import { ItemsService } from '../services/items.service';
|
|
17
|
-
import { NavigationService } from '../services/navigation.service';
|
|
18
|
-
import { bodyFactory, getFontIcon, getSizeClass, getSVGIcon } from '../utils';
|
|
19
|
-
import { DEFAULT_MARGIN, POPUP_SETTINGS, POPUP_SETTINGS_RTL } from './popup-settings';
|
|
20
|
-
import * as i0 from "@angular/core";
|
|
21
|
-
import * as i1 from "../services/items.service";
|
|
22
|
-
import * as i2 from "../services/hover.service";
|
|
23
|
-
import * as i3 from "../services/actions.service";
|
|
24
|
-
import * as i4 from "../services/navigation.service";
|
|
25
|
-
import * as i5 from "@progress/kendo-angular-popup";
|
|
26
|
-
import * as i6 from "../context-menu/context-menu.service";
|
|
27
|
-
/* eslint-disable @angular-eslint/component-selector */
|
|
28
|
-
/**
|
|
29
|
-
* @hidden
|
|
30
|
-
*/
|
|
31
|
-
export class ListComponent {
|
|
32
|
-
itemsService;
|
|
33
|
-
hover;
|
|
34
|
-
actions;
|
|
35
|
-
navigation;
|
|
36
|
-
renderer;
|
|
37
|
-
ngZone;
|
|
38
|
-
element;
|
|
39
|
-
appendTo;
|
|
40
|
-
items;
|
|
41
|
-
level;
|
|
42
|
-
index;
|
|
43
|
-
animate = true;
|
|
44
|
-
size = 'medium';
|
|
45
|
-
vertical;
|
|
46
|
-
rtl;
|
|
47
|
-
openOnClick;
|
|
48
|
-
itemTemplate;
|
|
49
|
-
itemLinkTemplate;
|
|
50
|
-
popupSettings;
|
|
51
|
-
domSubscriptions;
|
|
52
|
-
constructor(itemsService, hover, actions, navigation, renderer, ngZone, element) {
|
|
53
|
-
this.itemsService = itemsService;
|
|
54
|
-
this.hover = hover;
|
|
55
|
-
this.actions = actions;
|
|
56
|
-
this.navigation = navigation;
|
|
57
|
-
this.renderer = renderer;
|
|
58
|
-
this.ngZone = ngZone;
|
|
59
|
-
this.element = element;
|
|
60
|
-
}
|
|
61
|
-
hierarchyIndex(index) {
|
|
62
|
-
return this.itemsService.itemIndex(this.index, index);
|
|
63
|
-
}
|
|
64
|
-
ngOnInit() {
|
|
65
|
-
this.itemsService.addList(this);
|
|
66
|
-
this.initDomEvents();
|
|
67
|
-
}
|
|
68
|
-
ngOnDestroy() {
|
|
69
|
-
this.itemsService.removeList(this);
|
|
70
|
-
if (this.domSubscriptions) {
|
|
71
|
-
this.domSubscriptions();
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
initDomEvents() {
|
|
75
|
-
if (!isDocumentAvailable() || !this.element) {
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
this.ngZone.runOutsideAngular(() => {
|
|
79
|
-
const element = this.element.nativeElement;
|
|
80
|
-
const container = this.level > 0 ? closest(element, (node) => hasClass(node, 'k-popup')) : element;
|
|
81
|
-
const overSubscription = this.renderer.listen(element, 'mouseover', (e) => {
|
|
82
|
-
if (e.target === element && this.level === 0) {
|
|
83
|
-
this.onLeave();
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
const item = this.nodeItem(e.target) || this.itemsService.get(this.index);
|
|
87
|
-
if (item && !(this.openOnClick && this.openOnClick.toggle === 'click' && item.level === 0 && !item.hasContent)) {
|
|
88
|
-
this.hover.over(item);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
const leaveSubscription = this.renderer.listen(container, 'mouseleave', (e) => {
|
|
93
|
-
if (this.leavesMenu(e)) {
|
|
94
|
-
this.onLeave();
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
const keydownSubscription = this.renderer.listen(element, 'keydown', (e) => {
|
|
98
|
-
if (hasClass(e.target, 'k-menu-item')) {
|
|
99
|
-
this.navigation.keydown(e);
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
const blurSubscription = this.renderer.listen(element, 'focusout', (e) => {
|
|
103
|
-
if (this.leavesMenu(e)) {
|
|
104
|
-
this.navigation.focusLeave();
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
/**
|
|
108
|
-
* Handle focus/blur open/close for iOS devices since it behaves inconsistently with the rest
|
|
109
|
-
* Refer to: https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html
|
|
110
|
-
*/
|
|
111
|
-
const touchSubscription = this.renderer.listen(document, 'touchstart', (e) => {
|
|
112
|
-
if (inMenu(e.target, this.itemsService)) {
|
|
113
|
-
const item = this.nodeItem(e.target);
|
|
114
|
-
// Needs to be called because the 'click' handler will be called only on secondary tap and the item will remain unfocused
|
|
115
|
-
this.navigation.focus(item);
|
|
116
|
-
// This is needed since the 'mouseover' event is not always dispatched
|
|
117
|
-
if (!item.opened) {
|
|
118
|
-
this.hover.over(item);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
else if (this.navigation.focusedIdx) {
|
|
122
|
-
// If the touch is outside of the menu and the menu is not currently in focus
|
|
123
|
-
const activeItem = this.itemsService.get(this.navigation.activeIndex);
|
|
124
|
-
this.onLeave(); // needs to be called explicitly since mouseleave event is not triggered
|
|
125
|
-
activeItem.blur(); // needs to be called explicitly otherwise the item remains focused => triggers focusout
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
const clickSubscription = this.renderer.listen(element, 'click', this.clickHandler.bind(this));
|
|
129
|
-
this.domSubscriptions = () => {
|
|
130
|
-
overSubscription();
|
|
131
|
-
leaveSubscription();
|
|
132
|
-
keydownSubscription();
|
|
133
|
-
blurSubscription();
|
|
134
|
-
clickSubscription();
|
|
135
|
-
touchSubscription();
|
|
136
|
-
};
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
leavesMenu(e) {
|
|
140
|
-
if (!e.relatedTarget) {
|
|
141
|
-
return true;
|
|
142
|
-
}
|
|
143
|
-
return !inMenu(e.relatedTarget, this.itemsService);
|
|
144
|
-
}
|
|
145
|
-
onLeave() {
|
|
146
|
-
const openOnClick = this.openOnClick;
|
|
147
|
-
if (!openOnClick || openOnClick.toggle !== 'click') {
|
|
148
|
-
this.hover.leave(openOnClick && openOnClick.toggle === 'leave');
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
nodeItem(target) {
|
|
152
|
-
const node = closestItem(target, this.element.nativeElement);
|
|
153
|
-
if (node) {
|
|
154
|
-
const index = nodeIndex(node);
|
|
155
|
-
return this.itemsService.get(index);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
clickHandler(e) {
|
|
159
|
-
if (isFocusable(e.target) && !hasClass(e.target, 'k-menu-item')) {
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
const item = this.nodeItem(e.target);
|
|
163
|
-
if (!item || item.isContent || item.navigating) {
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
if (item.disabled) {
|
|
167
|
-
e.preventDefault();
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
this.actions.select(item, e, () => {
|
|
171
|
-
e.preventDefault();
|
|
172
|
-
});
|
|
173
|
-
this.navigation.focus(item);
|
|
174
|
-
if (item.level > 0 && !item.hasContent) {
|
|
175
|
-
this.actions.closeToRoot(item);
|
|
176
|
-
}
|
|
177
|
-
if (this.openOnClick) {
|
|
178
|
-
const hover = this.hover;
|
|
179
|
-
if (item.opened) {
|
|
180
|
-
if (item.level === 0) {
|
|
181
|
-
hover.openOnOver = false;
|
|
182
|
-
this.actions.close(item);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
else if (item.hasContent) {
|
|
186
|
-
hover.openOnOver = true;
|
|
187
|
-
this.actions.closeOthers(item);
|
|
188
|
-
this.actions.open(item);
|
|
189
|
-
}
|
|
190
|
-
else {
|
|
191
|
-
hover.openOnOver = false;
|
|
192
|
-
if (item.level === 0 && this.openOnClick.toggle === 'click') {
|
|
193
|
-
this.hover.closeCurrent();
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
this.actions.execute();
|
|
198
|
-
}
|
|
199
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ListComponent, deps: [{ token: i1.ItemsService }, { token: i2.HoverService }, { token: i3.ActionsService }, { token: i4.NavigationService }, { token: i0.Renderer2 }, { token: i0.NgZone }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
200
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: ListComponent, isStandalone: true, selector: "[kendoMenuList]", inputs: { appendTo: "appendTo", items: "items", level: "level", index: "index", animate: "animate", size: "size", vertical: "vertical", rtl: "rtl", openOnClick: "openOnClick", itemTemplate: "itemTemplate", itemLinkTemplate: "itemLinkTemplate", popupSettings: "popupSettings" }, ngImport: i0, template: "\n @for (item of items; track item; let idx = $index) {\n @if (!item.separator) {\n <li\n kendoMenuItem\n [appendTo]=\"appendTo\"\n [item]=\"item\"\n [level]=\"level\"\n [size]=\"size\"\n [vertical]=\"vertical\"\n [animate]=\"animate\"\n [rtl]=\"rtl\"\n [itemTemplate]=\"itemTemplate\"\n [itemLinkTemplate]=\"itemLinkTemplate\"\n [popupSettings]=\"popupSettings\"\n [openOnClick]=\"openOnClick\"\n [index]=\"hierarchyIndex(idx)\"\n [siblingIndex]=\"idx\"\n [attr.data-kendo-menu-index]=\"hierarchyIndex(idx)\"\n [ngClass]=\"item.cssClass\"\n [ngStyle]=\"item.cssStyle\"\n role=\"menuitem\"\n class=\"k-item k-menu-item\"\n [class.k-first]=\"idx === 0\"\n [class.k-last]=\"idx === items.length - 1\"\n [class.k-disabled]=\"item.disabled\"></li>\n }\n @if (item.separator) {\n <li\n class=\"k-separator k-item\"\n [ngClass]=\"item.cssClass\"\n aria-hidden=\"true\"\n [ngStyle]=\"item.cssStyle\">\n \n </li>\n }\n }\n ", isInline: true, dependencies: [{ kind: "component", type: i0.forwardRef(() => ItemComponent), selector: "[kendoMenuItem]", inputs: ["appendTo", "item", "level", "index", "siblingIndex", "animate", "size", "vertical", "rtl", "openOnClick", "itemTemplate", "itemLinkTemplate", "popupSettings"] }, { kind: "directive", type: i0.forwardRef(() => NgClass), selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i0.forwardRef(() => NgStyle), selector: "[ngStyle]", inputs: ["ngStyle"] }] });
|
|
201
|
-
}
|
|
202
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ListComponent, decorators: [{
|
|
203
|
-
type: Component,
|
|
204
|
-
args: [{
|
|
205
|
-
selector: '[kendoMenuList]',
|
|
206
|
-
template: `
|
|
207
|
-
@for (item of items; track item; let idx = $index) {
|
|
208
|
-
@if (!item.separator) {
|
|
209
|
-
<li
|
|
210
|
-
kendoMenuItem
|
|
211
|
-
[appendTo]="appendTo"
|
|
212
|
-
[item]="item"
|
|
213
|
-
[level]="level"
|
|
214
|
-
[size]="size"
|
|
215
|
-
[vertical]="vertical"
|
|
216
|
-
[animate]="animate"
|
|
217
|
-
[rtl]="rtl"
|
|
218
|
-
[itemTemplate]="itemTemplate"
|
|
219
|
-
[itemLinkTemplate]="itemLinkTemplate"
|
|
220
|
-
[popupSettings]="popupSettings"
|
|
221
|
-
[openOnClick]="openOnClick"
|
|
222
|
-
[index]="hierarchyIndex(idx)"
|
|
223
|
-
[siblingIndex]="idx"
|
|
224
|
-
[attr.${NODE_INDEX}]="hierarchyIndex(idx)"
|
|
225
|
-
[ngClass]="item.cssClass"
|
|
226
|
-
[ngStyle]="item.cssStyle"
|
|
227
|
-
role="menuitem"
|
|
228
|
-
class="k-item k-menu-item"
|
|
229
|
-
[class.k-first]="idx === 0"
|
|
230
|
-
[class.k-last]="idx === items.length - 1"
|
|
231
|
-
[class.k-disabled]="item.disabled"></li>
|
|
232
|
-
}
|
|
233
|
-
@if (item.separator) {
|
|
234
|
-
<li
|
|
235
|
-
class="k-separator k-item"
|
|
236
|
-
[ngClass]="item.cssClass"
|
|
237
|
-
aria-hidden="true"
|
|
238
|
-
[ngStyle]="item.cssStyle">
|
|
239
|
-
|
|
240
|
-
</li>
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
`,
|
|
244
|
-
standalone: true,
|
|
245
|
-
imports: [forwardRef(() => ItemComponent), NgClass, NgStyle]
|
|
246
|
-
}]
|
|
247
|
-
}], ctorParameters: () => [{ type: i1.ItemsService }, { type: i2.HoverService }, { type: i3.ActionsService }, { type: i4.NavigationService }, { type: i0.Renderer2 }, { type: i0.NgZone }, { type: i0.ElementRef }], propDecorators: { appendTo: [{
|
|
248
|
-
type: Input
|
|
249
|
-
}], items: [{
|
|
250
|
-
type: Input
|
|
251
|
-
}], level: [{
|
|
252
|
-
type: Input
|
|
253
|
-
}], index: [{
|
|
254
|
-
type: Input
|
|
255
|
-
}], animate: [{
|
|
256
|
-
type: Input
|
|
257
|
-
}], size: [{
|
|
258
|
-
type: Input
|
|
259
|
-
}], vertical: [{
|
|
260
|
-
type: Input
|
|
261
|
-
}], rtl: [{
|
|
262
|
-
type: Input
|
|
263
|
-
}], openOnClick: [{
|
|
264
|
-
type: Input
|
|
265
|
-
}], itemTemplate: [{
|
|
266
|
-
type: Input
|
|
267
|
-
}], itemLinkTemplate: [{
|
|
268
|
-
type: Input
|
|
269
|
-
}], popupSettings: [{
|
|
270
|
-
type: Input
|
|
271
|
-
}] } });
|
|
272
|
-
/**
|
|
273
|
-
* @hidden
|
|
274
|
-
*/
|
|
275
|
-
export class ItemComponent {
|
|
276
|
-
itemsService;
|
|
277
|
-
navigation;
|
|
278
|
-
changeDetector;
|
|
279
|
-
renderer;
|
|
280
|
-
popupService;
|
|
281
|
-
element;
|
|
282
|
-
contextService;
|
|
283
|
-
appendTo;
|
|
284
|
-
item;
|
|
285
|
-
level;
|
|
286
|
-
set index(index) {
|
|
287
|
-
if (this._index && this._index !== index) {
|
|
288
|
-
this.itemsService.remove(this);
|
|
289
|
-
this._index = index;
|
|
290
|
-
this.itemsService.add(this);
|
|
291
|
-
}
|
|
292
|
-
else {
|
|
293
|
-
this._index = index;
|
|
294
|
-
}
|
|
295
|
-
this.childId = this.itemsService.childId(index);
|
|
296
|
-
}
|
|
297
|
-
get index() {
|
|
298
|
-
return this._index;
|
|
299
|
-
}
|
|
300
|
-
siblingIndex;
|
|
301
|
-
animate = true;
|
|
302
|
-
size = 'medium';
|
|
303
|
-
vertical;
|
|
304
|
-
rtl;
|
|
305
|
-
openOnClick = false;
|
|
306
|
-
itemTemplate;
|
|
307
|
-
itemLinkTemplate;
|
|
308
|
-
popupSettings;
|
|
309
|
-
link;
|
|
310
|
-
popupTemplate;
|
|
311
|
-
get disabled() {
|
|
312
|
-
return this.item.disabled;
|
|
313
|
-
}
|
|
314
|
-
get hasPopup() {
|
|
315
|
-
return this.hasContent ? true : null;
|
|
316
|
-
}
|
|
317
|
-
get label() {
|
|
318
|
-
return this.item.text ? this.item.text : null;
|
|
319
|
-
}
|
|
320
|
-
get defaultPopupSettings() {
|
|
321
|
-
const settings = this.rtl ? POPUP_SETTINGS_RTL : POPUP_SETTINGS;
|
|
322
|
-
return this.horizontal ? settings.horizontal : settings.vertical;
|
|
323
|
-
}
|
|
324
|
-
get horizontal() {
|
|
325
|
-
return this.vertical || this.level > 0;
|
|
326
|
-
}
|
|
327
|
-
get hasLink() {
|
|
328
|
-
return Boolean(this.item.url);
|
|
329
|
-
}
|
|
330
|
-
get linkTemplate() {
|
|
331
|
-
return this.item.linkTemplate || this.itemLinkTemplate;
|
|
332
|
-
}
|
|
333
|
-
get hasContent() {
|
|
334
|
-
const items = this.item.items;
|
|
335
|
-
return items && items.length || this.item.contentTemplate;
|
|
336
|
-
}
|
|
337
|
-
get isContent() {
|
|
338
|
-
return Boolean(this.item.content);
|
|
339
|
-
}
|
|
340
|
-
get iconClass() {
|
|
341
|
-
return `k-i-${this.item.icon}`;
|
|
342
|
-
}
|
|
343
|
-
get isContextMenu() {
|
|
344
|
-
return Boolean(this.contextService);
|
|
345
|
-
}
|
|
346
|
-
get menuListClasses() {
|
|
347
|
-
const sizeClass = getSizeClass(this.size);
|
|
348
|
-
return this.isContextMenu ? `k-context-menu k-menu-group ${sizeClass}` : `k-menu-group ${sizeClass}`;
|
|
349
|
-
}
|
|
350
|
-
get children() {
|
|
351
|
-
const item = this.item;
|
|
352
|
-
if (item.contentTemplate) {
|
|
353
|
-
if (!this.contentItems) {
|
|
354
|
-
this.contentItems = [{
|
|
355
|
-
content: item.contentTemplate,
|
|
356
|
-
owner: item,
|
|
357
|
-
ownerIndex: this.index
|
|
358
|
-
}];
|
|
359
|
-
}
|
|
360
|
-
return this.contentItems;
|
|
361
|
-
}
|
|
362
|
-
return item.items;
|
|
363
|
-
}
|
|
364
|
-
get template() {
|
|
365
|
-
return this.item.template || this.itemTemplate;
|
|
366
|
-
}
|
|
367
|
-
/**
|
|
368
|
-
* @hidden
|
|
369
|
-
*/
|
|
370
|
-
fontIcon = getFontIcon;
|
|
371
|
-
/**
|
|
372
|
-
* @hidden
|
|
373
|
-
*/
|
|
374
|
-
SVGIcon = getSVGIcon;
|
|
375
|
-
opened = false;
|
|
376
|
-
navigating = false;
|
|
377
|
-
childId;
|
|
378
|
-
contentItems;
|
|
379
|
-
popupRef;
|
|
380
|
-
_index;
|
|
381
|
-
destroyed = false;
|
|
382
|
-
constructor(itemsService, navigation, changeDetector, renderer, popupService, element, contextService) {
|
|
383
|
-
this.itemsService = itemsService;
|
|
384
|
-
this.navigation = navigation;
|
|
385
|
-
this.changeDetector = changeDetector;
|
|
386
|
-
this.renderer = renderer;
|
|
387
|
-
this.popupService = popupService;
|
|
388
|
-
this.element = element;
|
|
389
|
-
this.contextService = contextService;
|
|
390
|
-
}
|
|
391
|
-
hasContentTemplates() {
|
|
392
|
-
const item = this.item;
|
|
393
|
-
return this.itemTemplate || item.contentTemplate || this.itemLinkTemplate ||
|
|
394
|
-
(item.items && item.items.find(current => current.template || current.linkTemplate));
|
|
395
|
-
}
|
|
396
|
-
ngOnInit() {
|
|
397
|
-
this.itemsService.add(this);
|
|
398
|
-
}
|
|
399
|
-
ngAfterViewInit() {
|
|
400
|
-
if (this.hasContent) {
|
|
401
|
-
this.setAttribute('aria-expanded', this.opened.toString());
|
|
402
|
-
}
|
|
403
|
-
this.index === this.navigation.activeIndex ? this.setAttribute('tabindex', '0') : this.setAttribute('tabindex', '-1');
|
|
404
|
-
}
|
|
405
|
-
ngOnDestroy() {
|
|
406
|
-
this.itemsService.remove(this);
|
|
407
|
-
this.destroyed = true;
|
|
408
|
-
if (this.popupRef) {
|
|
409
|
-
this.popupRef.close();
|
|
410
|
-
this.popupRef = null;
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
focus() {
|
|
414
|
-
this.element.nativeElement.focus();
|
|
415
|
-
}
|
|
416
|
-
blur() {
|
|
417
|
-
this.element.nativeElement.blur();
|
|
418
|
-
}
|
|
419
|
-
toggleActive(isActive) {
|
|
420
|
-
if (isActive) {
|
|
421
|
-
this.setAttribute('tabindex', '0');
|
|
422
|
-
}
|
|
423
|
-
else {
|
|
424
|
-
this.setAttribute('tabindex', '-1');
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
open() {
|
|
428
|
-
if (!this.destroyed && this.hasContent && !this.opened) {
|
|
429
|
-
const popupSettings = this.getMergedPopupSettings();
|
|
430
|
-
const animate = this.animate ? Object.assign({}, this.animate, {
|
|
431
|
-
direction: popupSettings.animate
|
|
432
|
-
}) : false;
|
|
433
|
-
this.opened = true;
|
|
434
|
-
this.popupRef = this.popupService.open({
|
|
435
|
-
appendTo: this.appendTo,
|
|
436
|
-
popupAlign: popupSettings.popup,
|
|
437
|
-
anchorAlign: popupSettings.anchor,
|
|
438
|
-
collision: popupSettings.collision,
|
|
439
|
-
anchor: this.element,
|
|
440
|
-
positionMode: 'absolute',
|
|
441
|
-
content: this.popupTemplate,
|
|
442
|
-
popupClass: popupSettings.popupClass,
|
|
443
|
-
margin: popupSettings.margin,
|
|
444
|
-
animate: animate
|
|
445
|
-
});
|
|
446
|
-
this.setAttribute('aria-expanded', 'true');
|
|
447
|
-
this.setAttribute('aria-controls', this.childId);
|
|
448
|
-
this.changeDetector.detectChanges();
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
close() {
|
|
452
|
-
if (!this.destroyed && this.opened) {
|
|
453
|
-
this.opened = false;
|
|
454
|
-
if (this.popupRef) {
|
|
455
|
-
this.popupRef.close();
|
|
456
|
-
this.popupRef = null;
|
|
457
|
-
}
|
|
458
|
-
this.changeDetector.detectChanges();
|
|
459
|
-
this.setAttribute('aria-expanded', 'false');
|
|
460
|
-
this.renderer.removeAttribute(this.element.nativeElement, 'aria-controls');
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
navigate() {
|
|
464
|
-
let link;
|
|
465
|
-
if (this.linkTemplate) {
|
|
466
|
-
link = this.element.nativeElement.querySelector('a.k-menu-link');
|
|
467
|
-
}
|
|
468
|
-
else if (this.hasLink) {
|
|
469
|
-
link = this.link.nativeElement;
|
|
470
|
-
}
|
|
471
|
-
if (link) {
|
|
472
|
-
this.navigating = true;
|
|
473
|
-
link.click();
|
|
474
|
-
this.navigating = false;
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
setAttribute(name, value) {
|
|
478
|
-
this.renderer.setAttribute(this.element.nativeElement, name, value);
|
|
479
|
-
}
|
|
480
|
-
getMergedPopupSettings() {
|
|
481
|
-
if (!isPresent(this.popupSettings)) {
|
|
482
|
-
return this.defaultPopupSettings;
|
|
483
|
-
}
|
|
484
|
-
const defaultSettings = this.defaultPopupSettings;
|
|
485
|
-
const customClasses = this.popupSettings.popupClass ? parseCSSClassNames(this.popupSettings.popupClass) : [];
|
|
486
|
-
return {
|
|
487
|
-
...defaultSettings,
|
|
488
|
-
popupClass: customClasses.length ? [...defaultSettings.popupClass, ...customClasses] : defaultSettings.popupClass,
|
|
489
|
-
margin: this.popupSettings.margin ?? DEFAULT_MARGIN
|
|
490
|
-
};
|
|
491
|
-
}
|
|
492
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ItemComponent, deps: [{ token: i1.ItemsService }, { token: i4.NavigationService }, { token: i0.ChangeDetectorRef }, { token: i0.Renderer2 }, { token: i5.PopupService }, { token: i0.ElementRef }, { token: i6.ContextMenuService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
493
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: ItemComponent, isStandalone: true, selector: "[kendoMenuItem]", inputs: { appendTo: "appendTo", item: "item", level: "level", index: "index", siblingIndex: "siblingIndex", animate: "animate", size: "size", vertical: "vertical", rtl: "rtl", openOnClick: "openOnClick", itemTemplate: "itemTemplate", itemLinkTemplate: "itemLinkTemplate", popupSettings: "popupSettings" }, host: { properties: { "attr.aria-disabled": "this.disabled", "attr.aria-haspopup": "this.hasPopup", "attr.aria-label": "this.label" } }, providers: [PopupService, {
|
|
494
|
-
provide: POPUP_CONTAINER,
|
|
495
|
-
useFactory: bodyFactory
|
|
496
|
-
}], viewQueries: [{ propertyName: "link", first: true, predicate: ["link"], descendants: true }, { propertyName: "popupTemplate", first: true, predicate: ["popupTemplate"], descendants: true, static: true }], ngImport: i0, template: `
|
|
497
|
-
@if (!hasLink && !item.content && !linkTemplate) {
|
|
498
|
-
<span class="k-link k-menu-link" #link
|
|
499
|
-
[class.k-active]="opened" role="presentation">
|
|
500
|
-
<ng-template [ngTemplateOutlet]="itemcontent">
|
|
501
|
-
</ng-template>
|
|
502
|
-
</span>
|
|
503
|
-
}
|
|
504
|
-
@if (item.url && !linkTemplate) {
|
|
505
|
-
<a class="k-link k-menu-link" #link [attr.href]="item.url"
|
|
506
|
-
[class.k-active]="opened" tabindex="-1" role="presentation">
|
|
507
|
-
<ng-template [ngTemplateOutlet]="itemcontent">
|
|
508
|
-
</ng-template>
|
|
509
|
-
</a>
|
|
510
|
-
}
|
|
511
|
-
@if (linkTemplate && !item.content) {
|
|
512
|
-
<ng-template [ngTemplateOutlet]="linkTemplate"
|
|
513
|
-
[ngTemplateOutletContext]="{ item: item, index: index }">
|
|
514
|
-
</ng-template>
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
@if (item.content) {
|
|
518
|
-
<div class="k-content" role="presentation">
|
|
519
|
-
<ng-template [ngTemplateOutlet]="item.content" [ngTemplateOutletContext]="{ item: item.owner, index: item.ownerIndex }">
|
|
520
|
-
</ng-template>
|
|
521
|
-
</div>
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
<ng-template #popupTemplate>
|
|
525
|
-
<ul kendoMenuList
|
|
526
|
-
[appendTo]="appendTo"
|
|
527
|
-
[attr.id]="childId"
|
|
528
|
-
[animate]="animate"
|
|
529
|
-
[rtl]="rtl"
|
|
530
|
-
[vertical]="vertical"
|
|
531
|
-
[size]="size"
|
|
532
|
-
[openOnClick]="openOnClick"
|
|
533
|
-
[items]="children"
|
|
534
|
-
[level]="level + 1"
|
|
535
|
-
[index]="index"
|
|
536
|
-
[itemTemplate]="itemTemplate"
|
|
537
|
-
[itemLinkTemplate]="itemLinkTemplate"
|
|
538
|
-
[popupSettings]="popupSettings"
|
|
539
|
-
[ngClass]="menuListClasses"
|
|
540
|
-
role="menu">
|
|
541
|
-
</ul>
|
|
542
|
-
</ng-template>
|
|
543
|
-
|
|
544
|
-
<ng-template #itemcontent>
|
|
545
|
-
@if (item.icon || item.svgIcon) {
|
|
546
|
-
<kendo-icon-wrapper [name]="item.icon" [svgIcon]="item.svgIcon" role="presentation"></kendo-icon-wrapper>
|
|
547
|
-
}
|
|
548
|
-
@if (!template) {
|
|
549
|
-
<span class="k-menu-link-text">{{ item.text }}</span>
|
|
550
|
-
}
|
|
551
|
-
@if (template) {
|
|
552
|
-
<ng-template [ngTemplateOutlet]="template" [ngTemplateOutletContext]="{ item: item, index: index }">
|
|
553
|
-
</ng-template>
|
|
554
|
-
}
|
|
555
|
-
@if (hasContent) {
|
|
556
|
-
<kendo-icon-wrapper [name]="fontIcon(horizontal, rtl)" [svgIcon]="SVGIcon(horizontal, rtl)" class="k-menu-expand-arrow" aria-hidden="true"></kendo-icon-wrapper>
|
|
557
|
-
}
|
|
558
|
-
</ng-template>
|
|
559
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: ListComponent, selector: "[kendoMenuList]", inputs: ["appendTo", "items", "level", "index", "animate", "size", "vertical", "rtl", "openOnClick", "itemTemplate", "itemLinkTemplate", "popupSettings"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: IconWrapperComponent, selector: "kendo-icon-wrapper", inputs: ["name", "svgIcon", "innerCssClass", "customFontClass", "size"], exportAs: ["kendoIconWrapper"] }] });
|
|
560
|
-
}
|
|
561
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ItemComponent, decorators: [{
|
|
562
|
-
type: Component,
|
|
563
|
-
args: [{
|
|
564
|
-
providers: [PopupService, {
|
|
565
|
-
provide: POPUP_CONTAINER,
|
|
566
|
-
useFactory: bodyFactory
|
|
567
|
-
}],
|
|
568
|
-
selector: '[kendoMenuItem]',
|
|
569
|
-
template: `
|
|
570
|
-
@if (!hasLink && !item.content && !linkTemplate) {
|
|
571
|
-
<span class="k-link k-menu-link" #link
|
|
572
|
-
[class.k-active]="opened" role="presentation">
|
|
573
|
-
<ng-template [ngTemplateOutlet]="itemcontent">
|
|
574
|
-
</ng-template>
|
|
575
|
-
</span>
|
|
576
|
-
}
|
|
577
|
-
@if (item.url && !linkTemplate) {
|
|
578
|
-
<a class="k-link k-menu-link" #link [attr.href]="item.url"
|
|
579
|
-
[class.k-active]="opened" tabindex="-1" role="presentation">
|
|
580
|
-
<ng-template [ngTemplateOutlet]="itemcontent">
|
|
581
|
-
</ng-template>
|
|
582
|
-
</a>
|
|
583
|
-
}
|
|
584
|
-
@if (linkTemplate && !item.content) {
|
|
585
|
-
<ng-template [ngTemplateOutlet]="linkTemplate"
|
|
586
|
-
[ngTemplateOutletContext]="{ item: item, index: index }">
|
|
587
|
-
</ng-template>
|
|
588
|
-
}
|
|
589
|
-
|
|
590
|
-
@if (item.content) {
|
|
591
|
-
<div class="k-content" role="presentation">
|
|
592
|
-
<ng-template [ngTemplateOutlet]="item.content" [ngTemplateOutletContext]="{ item: item.owner, index: item.ownerIndex }">
|
|
593
|
-
</ng-template>
|
|
594
|
-
</div>
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
<ng-template #popupTemplate>
|
|
598
|
-
<ul kendoMenuList
|
|
599
|
-
[appendTo]="appendTo"
|
|
600
|
-
[attr.id]="childId"
|
|
601
|
-
[animate]="animate"
|
|
602
|
-
[rtl]="rtl"
|
|
603
|
-
[vertical]="vertical"
|
|
604
|
-
[size]="size"
|
|
605
|
-
[openOnClick]="openOnClick"
|
|
606
|
-
[items]="children"
|
|
607
|
-
[level]="level + 1"
|
|
608
|
-
[index]="index"
|
|
609
|
-
[itemTemplate]="itemTemplate"
|
|
610
|
-
[itemLinkTemplate]="itemLinkTemplate"
|
|
611
|
-
[popupSettings]="popupSettings"
|
|
612
|
-
[ngClass]="menuListClasses"
|
|
613
|
-
role="menu">
|
|
614
|
-
</ul>
|
|
615
|
-
</ng-template>
|
|
616
|
-
|
|
617
|
-
<ng-template #itemcontent>
|
|
618
|
-
@if (item.icon || item.svgIcon) {
|
|
619
|
-
<kendo-icon-wrapper [name]="item.icon" [svgIcon]="item.svgIcon" role="presentation"></kendo-icon-wrapper>
|
|
620
|
-
}
|
|
621
|
-
@if (!template) {
|
|
622
|
-
<span class="k-menu-link-text">{{ item.text }}</span>
|
|
623
|
-
}
|
|
624
|
-
@if (template) {
|
|
625
|
-
<ng-template [ngTemplateOutlet]="template" [ngTemplateOutletContext]="{ item: item, index: index }">
|
|
626
|
-
</ng-template>
|
|
627
|
-
}
|
|
628
|
-
@if (hasContent) {
|
|
629
|
-
<kendo-icon-wrapper [name]="fontIcon(horizontal, rtl)" [svgIcon]="SVGIcon(horizontal, rtl)" class="k-menu-expand-arrow" aria-hidden="true"></kendo-icon-wrapper>
|
|
630
|
-
}
|
|
631
|
-
</ng-template>
|
|
632
|
-
`,
|
|
633
|
-
standalone: true,
|
|
634
|
-
imports: [NgTemplateOutlet, ListComponent, NgClass, IconWrapperComponent]
|
|
635
|
-
}]
|
|
636
|
-
}], ctorParameters: () => [{ type: i1.ItemsService }, { type: i4.NavigationService }, { type: i0.ChangeDetectorRef }, { type: i0.Renderer2 }, { type: i5.PopupService }, { type: i0.ElementRef }, { type: i6.ContextMenuService, decorators: [{
|
|
637
|
-
type: Optional
|
|
638
|
-
}] }], propDecorators: { appendTo: [{
|
|
639
|
-
type: Input
|
|
640
|
-
}], item: [{
|
|
641
|
-
type: Input
|
|
642
|
-
}], level: [{
|
|
643
|
-
type: Input
|
|
644
|
-
}], index: [{
|
|
645
|
-
type: Input
|
|
646
|
-
}], siblingIndex: [{
|
|
647
|
-
type: Input
|
|
648
|
-
}], animate: [{
|
|
649
|
-
type: Input
|
|
650
|
-
}], size: [{
|
|
651
|
-
type: Input
|
|
652
|
-
}], vertical: [{
|
|
653
|
-
type: Input
|
|
654
|
-
}], rtl: [{
|
|
655
|
-
type: Input
|
|
656
|
-
}], openOnClick: [{
|
|
657
|
-
type: Input
|
|
658
|
-
}], itemTemplate: [{
|
|
659
|
-
type: Input
|
|
660
|
-
}], itemLinkTemplate: [{
|
|
661
|
-
type: Input
|
|
662
|
-
}], popupSettings: [{
|
|
663
|
-
type: Input
|
|
664
|
-
}], link: [{
|
|
665
|
-
type: ViewChild,
|
|
666
|
-
args: ['link', { static: false }]
|
|
667
|
-
}], popupTemplate: [{
|
|
668
|
-
type: ViewChild,
|
|
669
|
-
args: ['popupTemplate', { static: true }]
|
|
670
|
-
}], disabled: [{
|
|
671
|
-
type: HostBinding,
|
|
672
|
-
args: ['attr.aria-disabled']
|
|
673
|
-
}], hasPopup: [{
|
|
674
|
-
type: HostBinding,
|
|
675
|
-
args: ['attr.aria-haspopup']
|
|
676
|
-
}], label: [{
|
|
677
|
-
type: HostBinding,
|
|
678
|
-
args: ['attr.aria-label']
|
|
679
|
-
}] } });
|