@progress/kendo-angular-menu 3.0.6-dev.202203091409 → 4.0.0-dev.202204191048

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.
Files changed (199) hide show
  1. package/bundles/kendo-angular-menu.umd.js +5 -0
  2. package/{dist/es2015/constants.d.ts → constants.d.ts} +0 -0
  3. package/{dist/es2015/context-menu → context-menu}/context-menu-event.d.ts +0 -0
  4. package/{dist/es2015/context-menu → context-menu}/context-menu-items.service.d.ts +3 -0
  5. package/{dist/es2015/context-menu → context-menu}/context-menu-popup-event.d.ts +0 -0
  6. package/{dist/es2015/context-menu → context-menu}/context-menu-select-event.d.ts +0 -0
  7. package/{dist/es2015/context-menu → context-menu}/context-menu-target-container.directive.d.ts +3 -0
  8. package/{dist/es2015/context-menu → context-menu}/context-menu-target.directive.d.ts +3 -0
  9. package/{dist/es2015/context-menu → context-menu}/context-menu-target.service.d.ts +3 -0
  10. package/{dist/es2015/context-menu → context-menu}/context-menu-template.directive.d.ts +3 -0
  11. package/{dist/es2015/context-menu → context-menu}/context-menu.component.d.ts +4 -1
  12. package/{dist/es2015/context-menu → context-menu}/context-menu.module.d.ts +11 -0
  13. package/{dist/es2015/context-menu → context-menu}/context-menu.service.d.ts +3 -0
  14. package/{dist/es2015/data-binding → data-binding}/binding-directive-base.d.ts +3 -0
  15. package/{dist/es2015/data-binding → data-binding}/flat-binding.directive.d.ts +3 -0
  16. package/{dist/es2015/data-binding → data-binding}/hierachy-binding.directive.d.ts +3 -0
  17. package/{dist/es2015/data-binding → data-binding}/utils.d.ts +0 -0
  18. package/{dist/es2015/dom-queries.d.ts → dom-queries.d.ts} +0 -0
  19. package/{dist/es2015 → esm2015}/constants.js +0 -0
  20. package/{dist/es2015 → esm2015}/context-menu/context-menu-event.js +0 -0
  21. package/esm2015/context-menu/context-menu-items.service.js +25 -0
  22. package/{dist/es2015 → esm2015}/context-menu/context-menu-popup-event.js +0 -0
  23. package/{dist/es2015 → esm2015}/context-menu/context-menu-select-event.js +0 -0
  24. package/esm2015/context-menu/context-menu-target-container.directive.js +32 -0
  25. package/esm2015/context-menu/context-menu-target.directive.js +46 -0
  26. package/{dist/es2015 → esm2015}/context-menu/context-menu-target.service.js +8 -10
  27. package/esm2015/context-menu/context-menu-template.directive.js +32 -0
  28. package/{dist/es2015 → esm2015}/context-menu/context-menu.component.js +107 -113
  29. package/{dist/es2015 → esm2015}/context-menu/context-menu.module.js +20 -11
  30. package/{dist/es2015 → esm2015}/context-menu/context-menu.service.js +8 -10
  31. package/{dist/es2015 → esm2015}/data-binding/binding-directive-base.js +12 -0
  32. package/esm2015/data-binding/flat-binding.directive.js +82 -0
  33. package/esm2015/data-binding/hierachy-binding.directive.js +71 -0
  34. package/{dist/es2015 → esm2015}/data-binding/utils.js +0 -1
  35. package/{dist/es2015 → esm2015}/dom-queries.js +0 -3
  36. package/{dist/es/constants.js → esm2015/kendo-angular-menu.js} +2 -2
  37. package/{dist/es → esm2015}/main.js +3 -2
  38. package/{dist/es → esm2015}/menu-animation.interface.js +1 -0
  39. package/esm2015/menu-base.js +69 -0
  40. package/{dist/es2015 → esm2015}/menu-event.js +0 -0
  41. package/{dist/es2015 → esm2015}/menu-item.component.js +41 -60
  42. package/{dist/es → esm2015}/menu-item.interface.js +1 -0
  43. package/{dist/es2015 → esm2015}/menu-select-event.js +0 -0
  44. package/{dist/es2015 → esm2015}/menu.component.js +76 -63
  45. package/{dist/es2015 → esm2015}/menu.module.js +32 -13
  46. package/{dist/es2015 → esm2015}/menus.module.js +12 -9
  47. package/{dist/es2015 → esm2015}/open-on-click-settings.js +0 -1
  48. package/{dist/es2015 → esm2015}/package-metadata.js +1 -1
  49. package/{dist/es2015 → esm2015}/preventable-event.js +0 -0
  50. package/esm2015/rendering/arrow.directive.js +62 -0
  51. package/esm2015/rendering/link.directive.js +54 -0
  52. package/esm2015/rendering/list.component.js +546 -0
  53. package/{dist/es2015 → esm2015}/rendering/popup-settings.js +0 -0
  54. package/{dist/es2015 → esm2015}/services/actions.service.js +21 -14
  55. package/{dist/es2015 → esm2015}/services/hover.service.js +10 -10
  56. package/{dist/es2015 → esm2015}/services/items.service.js +8 -13
  57. package/{dist/es2015 → esm2015}/services/navigation.service.js +12 -15
  58. package/{dist/es2015 → esm2015}/templates/item-content-template.directive.js +14 -12
  59. package/{dist/es2015 → esm2015}/templates/item-link-template.directive.js +14 -12
  60. package/{dist/es2015 → esm2015}/templates/item-template.directive.js +14 -12
  61. package/{dist/es2015 → esm2015}/utils.js +0 -0
  62. package/{dist/fesm2015/index.js → fesm2015/kendo-angular-menu.js} +1113 -1113
  63. package/kendo-angular-menu.d.ts +9 -0
  64. package/{dist/es2015/main.d.ts → main.d.ts} +3 -2
  65. package/{dist/es2015/menu-animation.interface.d.ts → menu-animation.interface.d.ts} +0 -0
  66. package/{dist/es2015/menu-base.d.ts → menu-base.d.ts} +4 -1
  67. package/{dist/es2015/menu-event.d.ts → menu-event.d.ts} +0 -0
  68. package/{dist/es2015/menu-item.component.d.ts → menu-item.component.d.ts} +7 -4
  69. package/{dist/es2015/menu-item.interface.d.ts → menu-item.interface.d.ts} +0 -0
  70. package/{dist/es2015/menu-select-event.d.ts → menu-select-event.d.ts} +0 -0
  71. package/{dist/es2015/menu.component.d.ts → menu.component.d.ts} +7 -4
  72. package/menu.module.d.ts +54 -0
  73. package/{dist/es2015/menus.module.d.ts → menus.module.d.ts} +6 -0
  74. package/{dist/es2015/open-on-click-settings.d.ts → open-on-click-settings.d.ts} +0 -0
  75. package/{dist/es2015/package-metadata.d.ts → package-metadata.d.ts} +0 -0
  76. package/package.json +31 -108
  77. package/{dist/es2015/preventable-event.d.ts → preventable-event.d.ts} +0 -0
  78. package/{dist/es2015/rendering → rendering}/arrow.directive.d.ts +6 -3
  79. package/{dist/es2015/rendering → rendering}/link.directive.d.ts +4 -1
  80. package/rendering/list.component.d.ts +104 -0
  81. package/{dist/es2015/rendering → rendering}/popup-settings.d.ts +0 -0
  82. package/schematics/ngAdd/index.js +5 -2
  83. package/schematics/ngAdd/index.js.map +1 -1
  84. package/{dist/es2015/services → services}/actions.service.d.ts +24 -1
  85. package/{dist/es2015/services → services}/hover.service.d.ts +7 -2
  86. package/{dist/es2015/services → services}/items.service.d.ts +4 -1
  87. package/{dist/es2015/services → services}/navigation.service.d.ts +6 -3
  88. package/{dist/es2015/templates → templates}/item-content-template.directive.d.ts +3 -0
  89. package/{dist/es2015/templates → templates}/item-link-template.directive.d.ts +3 -0
  90. package/{dist/es2015/templates → templates}/item-template.directive.d.ts +3 -0
  91. package/{dist/es2015/utils.d.ts → utils.d.ts} +1 -1
  92. package/dist/cdn/js/kendo-angular-menu.js +0 -20
  93. package/dist/cdn/main.js +0 -5
  94. package/dist/es/context-menu/context-menu-event.js +0 -13
  95. package/dist/es/context-menu/context-menu-items.service.js +0 -26
  96. package/dist/es/context-menu/context-menu-popup-event.js +0 -17
  97. package/dist/es/context-menu/context-menu-select-event.js +0 -17
  98. package/dist/es/context-menu/context-menu-target-container.directive.js +0 -31
  99. package/dist/es/context-menu/context-menu-target.directive.js +0 -48
  100. package/dist/es/context-menu/context-menu-target.service.js +0 -29
  101. package/dist/es/context-menu/context-menu-template.directive.js +0 -31
  102. package/dist/es/context-menu/context-menu.component.js +0 -456
  103. package/dist/es/context-menu/context-menu.module.js +0 -64
  104. package/dist/es/context-menu/context-menu.service.js +0 -30
  105. package/dist/es/data-binding/binding-directive-base.js +0 -32
  106. package/dist/es/data-binding/flat-binding.directive.js +0 -104
  107. package/dist/es/data-binding/hierachy-binding.directive.js +0 -94
  108. package/dist/es/data-binding/utils.js +0 -32
  109. package/dist/es/dom-queries.js +0 -107
  110. package/dist/es/index.js +0 -21
  111. package/dist/es/menu-base.js +0 -79
  112. package/dist/es/menu-event.js +0 -17
  113. package/dist/es/menu-item.component.js +0 -165
  114. package/dist/es/menu-select-event.js +0 -17
  115. package/dist/es/menu.component.js +0 -256
  116. package/dist/es/menu.module.js +0 -79
  117. package/dist/es/menus.module.js +0 -41
  118. package/dist/es/open-on-click-settings.js +0 -13
  119. package/dist/es/package-metadata.js +0 -15
  120. package/dist/es/preventable-event.js +0 -36
  121. package/dist/es/rendering/arrow.directive.js +0 -81
  122. package/dist/es/rendering/item.component.js +0 -337
  123. package/dist/es/rendering/link.directive.js +0 -62
  124. package/dist/es/rendering/list.component.js +0 -219
  125. package/dist/es/rendering/popup-settings.js +0 -66
  126. package/dist/es/services/actions.service.js +0 -178
  127. package/dist/es/services/hover.service.js +0 -136
  128. package/dist/es/services/items.service.js +0 -140
  129. package/dist/es/services/navigation.service.js +0 -274
  130. package/dist/es/templates/item-content-template.directive.js +0 -50
  131. package/dist/es/templates/item-link-template.directive.js +0 -52
  132. package/dist/es/templates/item-template.directive.js +0 -51
  133. package/dist/es/utils.js +0 -18
  134. package/dist/es2015/context-menu/context-menu-items.service.js +0 -25
  135. package/dist/es2015/context-menu/context-menu-target-container.directive.js +0 -30
  136. package/dist/es2015/context-menu/context-menu-target.directive.js +0 -47
  137. package/dist/es2015/context-menu/context-menu-template.directive.js +0 -30
  138. package/dist/es2015/data-binding/flat-binding.directive.js +0 -101
  139. package/dist/es2015/data-binding/hierachy-binding.directive.js +0 -90
  140. package/dist/es2015/index.d.ts +0 -21
  141. package/dist/es2015/index.js +0 -21
  142. package/dist/es2015/index.metadata.json +0 -1
  143. package/dist/es2015/main.js +0 -26
  144. package/dist/es2015/menu-animation.interface.js +0 -4
  145. package/dist/es2015/menu-base.js +0 -73
  146. package/dist/es2015/menu-item.interface.js +0 -4
  147. package/dist/es2015/menu.module.d.ts +0 -38
  148. package/dist/es2015/rendering/arrow.directive.js +0 -68
  149. package/dist/es2015/rendering/item.component.d.ts +0 -64
  150. package/dist/es2015/rendering/item.component.js +0 -327
  151. package/dist/es2015/rendering/link.directive.js +0 -57
  152. package/dist/es2015/rendering/list.component.d.ts +0 -41
  153. package/dist/es2015/rendering/list.component.js +0 -233
  154. package/dist/fesm5/index.js +0 -3222
  155. package/dist/npm/constants.js +0 -10
  156. package/dist/npm/context-menu/context-menu-event.js +0 -15
  157. package/dist/npm/context-menu/context-menu-items.service.js +0 -28
  158. package/dist/npm/context-menu/context-menu-popup-event.js +0 -19
  159. package/dist/npm/context-menu/context-menu-select-event.js +0 -19
  160. package/dist/npm/context-menu/context-menu-target-container.directive.js +0 -33
  161. package/dist/npm/context-menu/context-menu-target.directive.js +0 -50
  162. package/dist/npm/context-menu/context-menu-target.service.js +0 -31
  163. package/dist/npm/context-menu/context-menu-template.directive.js +0 -33
  164. package/dist/npm/context-menu/context-menu.component.js +0 -459
  165. package/dist/npm/context-menu/context-menu.module.js +0 -66
  166. package/dist/npm/context-menu/context-menu.service.js +0 -32
  167. package/dist/npm/data-binding/binding-directive-base.js +0 -34
  168. package/dist/npm/data-binding/flat-binding.directive.js +0 -106
  169. package/dist/npm/data-binding/hierachy-binding.directive.js +0 -96
  170. package/dist/npm/data-binding/utils.js +0 -34
  171. package/dist/npm/dom-queries.js +0 -110
  172. package/dist/npm/index.js +0 -37
  173. package/dist/npm/main.js +0 -50
  174. package/dist/npm/menu-animation.interface.js +0 -6
  175. package/dist/npm/menu-base.js +0 -81
  176. package/dist/npm/menu-event.js +0 -19
  177. package/dist/npm/menu-item.component.js +0 -167
  178. package/dist/npm/menu-item.interface.js +0 -6
  179. package/dist/npm/menu-select-event.js +0 -19
  180. package/dist/npm/menu.component.js +0 -258
  181. package/dist/npm/menu.module.js +0 -81
  182. package/dist/npm/menus.module.js +0 -43
  183. package/dist/npm/open-on-click-settings.js +0 -15
  184. package/dist/npm/package-metadata.js +0 -17
  185. package/dist/npm/preventable-event.js +0 -38
  186. package/dist/npm/rendering/arrow.directive.js +0 -83
  187. package/dist/npm/rendering/item.component.js +0 -339
  188. package/dist/npm/rendering/link.directive.js +0 -64
  189. package/dist/npm/rendering/list.component.js +0 -221
  190. package/dist/npm/rendering/popup-settings.js +0 -68
  191. package/dist/npm/services/actions.service.js +0 -180
  192. package/dist/npm/services/hover.service.js +0 -138
  193. package/dist/npm/services/items.service.js +0 -143
  194. package/dist/npm/services/navigation.service.js +0 -276
  195. package/dist/npm/templates/item-content-template.directive.js +0 -52
  196. package/dist/npm/templates/item-link-template.directive.js +0 -54
  197. package/dist/npm/templates/item-template.directive.js +0 -53
  198. package/dist/npm/utils.js +0 -20
  199. package/dist/systemjs/kendo-angular-menu.js +0 -5
@@ -1,29 +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 * as tslib_1 from "tslib";
6
- import { Injectable } from '@angular/core';
7
- /**
8
- * @hidden
9
- */
10
- var ContextMenuTargetService = /** @class */ (function () {
11
- function ContextMenuTargetService() {
12
- this.targets = [];
13
- }
14
- ContextMenuTargetService.prototype.add = function (target) {
15
- this.targets.push(target);
16
- };
17
- ContextMenuTargetService.prototype.remove = function (target) {
18
- var index = this.targets.indexOf(target);
19
- this.targets.splice(index, 1);
20
- };
21
- ContextMenuTargetService.prototype.find = function (targetElement) {
22
- return this.targets.find(function (target) { return target.element === targetElement; });
23
- };
24
- ContextMenuTargetService = tslib_1.__decorate([
25
- Injectable()
26
- ], ContextMenuTargetService);
27
- return ContextMenuTargetService;
28
- }());
29
- export { ContextMenuTargetService };
@@ -1,31 +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 * as tslib_1 from "tslib";
6
- import { Directive, TemplateRef, Optional } from '@angular/core';
7
- /**
8
- * Represents a template for the content of the ContextMenu. To define a template, nest an `<ng-template>`
9
- * tag with the `kendoContextMenuTemplate` directive inside a `<kendo-contextmenu>` component
10
- * ([more information and examples]({% slug templates_contextmenu %})).
11
- *
12
- * {% meta height:200 %}
13
- * {% embed_file context-menu/template/app.component.ts preview %}
14
- * {% embed_file shared/app.module.ts %}
15
- * {% embed_file shared/main.ts %}
16
- * {% endmeta %}
17
- */
18
- var ContextMenuTemplateDirective = /** @class */ (function () {
19
- function ContextMenuTemplateDirective(templateRef) {
20
- this.templateRef = templateRef;
21
- }
22
- ContextMenuTemplateDirective = tslib_1.__decorate([
23
- Directive({
24
- selector: '[kendoContextMenuTemplate]'
25
- }),
26
- tslib_1.__param(0, Optional()),
27
- tslib_1.__metadata("design:paramtypes", [TemplateRef])
28
- ], ContextMenuTemplateDirective);
29
- return ContextMenuTemplateDirective;
30
- }());
31
- export { ContextMenuTemplateDirective };
@@ -1,456 +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 * as tslib_1 from "tslib";
6
- import { Component, Input, ContentChild, ViewChild, EventEmitter, Output, NgZone, Renderer2, TemplateRef, ViewContainerRef, forwardRef } from '@angular/core';
7
- import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
8
- import { PopupService, POPUP_CONTAINER } from '@progress/kendo-angular-popup';
9
- import { hasObservers, Keys, isDocumentAvailable } from '@progress/kendo-angular-common';
10
- import { MenuBase } from '../menu-base';
11
- import { ContextMenuPopupEvent } from './context-menu-popup-event';
12
- import { ContextMenuService } from './context-menu.service';
13
- import { ContextMenuItemsService } from './context-menu-items.service';
14
- import { ContextMenuTemplateDirective } from './context-menu-template.directive';
15
- import { closest, findInContainer, isFocusable, hasClass } from '../dom-queries';
16
- import { defined } from '../utils';
17
- import { ItemsService } from '../services/items.service';
18
- import { ContextMenuTargetContainerDirective } from './context-menu-target-container.directive';
19
- import { TARGET_CLASS } from './context-menu-target.directive';
20
- import { bodyFactory } from '../utils';
21
- var CONTEXT_MENU = 'contextmenu';
22
- var DEFAULT_ANCHOR_ALIGN = { horizontal: 'left', vertical: 'bottom' };
23
- var DEFAULT_POPUP_ALIGN = { horizontal: 'left', vertical: 'top' };
24
- var DEFAULT_COLLISION = { horizontal: 'fit', vertical: 'flip' };
25
- var preventDefault = function (e) { return e.preventDefault(); };
26
- var ɵ0 = preventDefault;
27
- var ɵ1 = bodyFactory;
28
- /**
29
- * Represents the [Kendo UI ContextMenu component for Angular]({% slug overview_contextmenu %}).
30
- *
31
- * @example
32
- * ```ts
33
- * _@Component({
34
- * selector: 'my-app',
35
- * template: `
36
- * <div #target>
37
- * Right-click to open Context menu</p>
38
- * </div>
39
- * <kendo-contextmenu [target]="target" [items]="items"> </kendo-contextmenu>
40
- * `
41
- * })
42
- * class AppComponent {
43
- * public items: any[] = [{ text: 'item1', items: [{ text: 'item1.1' }] }, { text: 'item2', disabled: true }];
44
- * }
45
- * ```
46
- */
47
- var ContextMenuComponent = /** @class */ (function (_super) {
48
- tslib_1.__extends(ContextMenuComponent, _super);
49
- function ContextMenuComponent(popupService, service, ngZone, renderer) {
50
- var _this = _super.call(this) || this;
51
- _this.popupService = popupService;
52
- _this.service = service;
53
- _this.ngZone = ngZone;
54
- _this.renderer = renderer;
55
- /**
56
- * Specifies the event on which the ContextMenu will open ([see example]({% slug showon_contextmenu %})).
57
- * Accepts the name of a native DOM event. Defaults to `contextmenu` which opens the ContextMenu for the target element.
58
- */
59
- _this.showOn = CONTEXT_MENU;
60
- /**
61
- * Indicates that the ContextMenu will be aligned to the target or to the `filter` element (if specified).
62
- */
63
- _this.alignToAnchor = false;
64
- /**
65
- * Specifies if the Menu will be vertically rendered ([see example]({% slug orientation_contextmenu %})).
66
- * @default true
67
- */
68
- _this.vertical = true;
69
- /**
70
- * Fires when the Menu is opened ([see example]({% slug target_contextmenu %}#toc-changing-items-for-specified-targets)).
71
- */
72
- _this.popupOpen = new EventEmitter();
73
- /**
74
- * Fires when the Menu is closed.
75
- */
76
- _this.popupClose = new EventEmitter();
77
- /**
78
- * Fires when a Menu item is selected.
79
- */
80
- _this.select = new EventEmitter();
81
- /**
82
- * Fires when a Menu item is opened.
83
- */
84
- _this.open = new EventEmitter();
85
- /**
86
- * Fires when a Menu item is closed.
87
- */
88
- _this.close = new EventEmitter();
89
- _this.service.owner = _this;
90
- _this.popupKeyDownHandler = _this.popupKeyDownHandler.bind(_this);
91
- return _this;
92
- }
93
- ContextMenuComponent_1 = ContextMenuComponent;
94
- /**
95
- * Hides the ContextMenu.
96
- */
97
- ContextMenuComponent.prototype.hide = function () {
98
- this.removePopup();
99
- };
100
- /**
101
- * Shows the ContextMenu for the specified target.
102
- * @param target - The offset or the target element for which the ContextMenu will open.
103
- */
104
- ContextMenuComponent.prototype.show = function (target) {
105
- if (!target) {
106
- return;
107
- }
108
- var showTarget = target;
109
- this.removePopup();
110
- if (defined(showTarget.left) && defined(showTarget.top)) {
111
- this.createPopup({ offset: showTarget });
112
- }
113
- else {
114
- this.currentTarget = showTarget.nativeElement || showTarget;
115
- this.createPopup({ anchor: this.currentTarget });
116
- }
117
- };
118
- ContextMenuComponent.prototype.ngOnChanges = function (changes) {
119
- if (changes.target || changes.showOn) {
120
- this.bindShowHandler();
121
- }
122
- };
123
- ContextMenuComponent.prototype.ngOnInit = function () {
124
- var _this = this;
125
- this.ngZone.runOutsideAngular(function () {
126
- var closeClickSubscription = _this.renderer.listen('document', 'mousedown', function (e) {
127
- if (_this.popupRef && !closest(e.target, function (node) { return node === _this.popupRef.popupElement; }) && _this.service.leaveMenu(e)) {
128
- _this.closePopup(e);
129
- }
130
- });
131
- var closeBlurSubscription = _this.renderer.listen('window', 'blur', function (e) {
132
- if (_this.popupRef) {
133
- _this.closePopup(e);
134
- }
135
- });
136
- _this.closeSubscription = function () {
137
- closeClickSubscription();
138
- closeBlurSubscription();
139
- };
140
- });
141
- };
142
- ContextMenuComponent.prototype.ngOnDestroy = function () {
143
- if (this.closeSubscription) {
144
- this.closeSubscription();
145
- this.closeSubscription = null;
146
- }
147
- this.unbindShowHandler();
148
- this.removePopup();
149
- };
150
- /**
151
- * @hidden
152
- */
153
- ContextMenuComponent.prototype.emitMenuEvent = function (name, args) {
154
- args.target = this.currentTarget;
155
- args.sender = this;
156
- this[name].emit(args);
157
- if (name === 'select' && !args.hasContent) {
158
- this.closeAndFocus(args.originalEvent);
159
- }
160
- };
161
- ContextMenuComponent.prototype.bindShowHandler = function () {
162
- var _this = this;
163
- this.unbindShowHandler();
164
- this.ngZone.runOutsideAngular(function () {
165
- var element = _this.targetElement();
166
- if (!element) {
167
- return;
168
- }
169
- var eventName = _this.showOn || CONTEXT_MENU;
170
- _this.showSubscription = _this.renderer.listen(element, _this.showOn || CONTEXT_MENU, function (e) {
171
- _this.showContextMenu(e, element);
172
- });
173
- if (eventName === CONTEXT_MENU) {
174
- _this.keydownSubscription = _this.renderer.listen(element, 'keydown', function (e) {
175
- if (e.shiftKey && e.keyCode === Keys.F10) {
176
- _this.showContextMenu(e, element);
177
- }
178
- });
179
- }
180
- });
181
- };
182
- ContextMenuComponent.prototype.showContextMenu = function (e, element) {
183
- var _this = this;
184
- var filter = this.targetFilter();
185
- var currentTarget = element;
186
- if (filter) {
187
- currentTarget = findInContainer(e.target, filter, element);
188
- if (currentTarget && currentTarget !== e.target && isFocusable(e.target)) {
189
- return;
190
- }
191
- if (currentTarget && this.directiveTarget) {
192
- currentTarget = this.target.targetService.find(currentTarget);
193
- }
194
- }
195
- if (!currentTarget) {
196
- this.closePopup(e);
197
- return;
198
- }
199
- this.ngZone.run(function () {
200
- if (!_this.closePopup(e)) {
201
- _this.currentTarget = currentTarget;
202
- _this.openPopup(e);
203
- }
204
- });
205
- };
206
- ContextMenuComponent.prototype.unbindShowHandler = function () {
207
- if (this.showSubscription) {
208
- this.showSubscription();
209
- this.showSubscription = null;
210
- }
211
- if (this.keydownSubscription) {
212
- this.keydownSubscription();
213
- this.keydownSubscription = null;
214
- }
215
- };
216
- ContextMenuComponent.prototype.targetElement = function () {
217
- if (!isDocumentAvailable()) {
218
- return;
219
- }
220
- this.directiveTarget = false;
221
- var target = this.target;
222
- if (typeof target === 'string') {
223
- target = document.querySelector(target); // maybe querySelectorAll?
224
- }
225
- else if (target && target.nativeElement) {
226
- target = target.nativeElement;
227
- }
228
- else if (target instanceof ContextMenuTargetContainerDirective) {
229
- target = target.element;
230
- this.directiveTarget = true;
231
- }
232
- return target;
233
- };
234
- ContextMenuComponent.prototype.targetFilter = function () {
235
- if (this.directiveTarget) {
236
- return "." + TARGET_CLASS;
237
- }
238
- return this.filter;
239
- };
240
- ContextMenuComponent.prototype.closePopup = function (e) {
241
- var _this = this;
242
- if (!this.popupRef) {
243
- return;
244
- }
245
- return this.popupAction('popupClose', e, function () {
246
- _this.removePopup();
247
- });
248
- };
249
- ContextMenuComponent.prototype.removePopup = function () {
250
- if (this.popupRef) {
251
- this.popupRef.close();
252
- this.popupRef = null;
253
- this.currentTarget = null;
254
- }
255
- if (this.popupSubscriptions) {
256
- this.popupSubscriptions();
257
- this.popupSubscriptions = null;
258
- }
259
- };
260
- ContextMenuComponent.prototype.openPopup = function (e) {
261
- var _this = this;
262
- this.popupAction('popupOpen', e, function () {
263
- e.preventDefault();
264
- var anchor, offset;
265
- if (_this.alignToAnchor || e.type === 'keydown') {
266
- anchor = _this.currentTargetElement;
267
- }
268
- else {
269
- offset = { left: e.pageX, top: e.pageY };
270
- }
271
- _this.createPopup({ anchor: anchor, offset: offset });
272
- });
273
- };
274
- ContextMenuComponent.prototype.createPopup = function (options) {
275
- var _this = this;
276
- this.popupRef = this.popupService.open(Object.assign({
277
- animate: defined(this.popupAnimate) ? this.popupAnimate : true,
278
- appendTo: this.appendTo,
279
- collision: this.collision || DEFAULT_COLLISION,
280
- popupAlign: this.popupAlign || DEFAULT_POPUP_ALIGN,
281
- anchorAlign: this.anchorAlign || DEFAULT_ANCHOR_ALIGN,
282
- content: this.contentTemplate ? this.contentTemplate.templateRef : this.defaultContentTemplate,
283
- popupClass: 'k-menu-popup'
284
- }, options));
285
- var element = this.popupRef.popupElement;
286
- this.renderer.addClass(element, 'k-context-menu-popup');
287
- this.renderer.setAttribute(element, 'tabindex', '-1');
288
- this.renderer.setStyle(element, 'outline', '0'); //possibly move to styles
289
- if (this.ariaLabel) {
290
- this.renderer.setAttribute(element, 'aria-label', this.ariaLabel);
291
- }
292
- this.activeTarget = this.currentTargetElement === document.activeElement;
293
- this.ngZone.runOutsideAngular(function () {
294
- var unbindKeyDown = _this.renderer.listen(element, 'keydown', _this.popupKeyDownHandler);
295
- var unbindContextmenu = _this.renderer.listen(element, 'contextmenu', preventDefault);
296
- _this.popupSubscriptions = function () {
297
- unbindKeyDown();
298
- unbindContextmenu();
299
- };
300
- });
301
- element.focus();
302
- };
303
- ContextMenuComponent.prototype.closeAndFocus = function (e) {
304
- var currentTarget = this.currentTargetElement;
305
- if (!this.closePopup(e) && this.activeTarget) {
306
- currentTarget.focus();
307
- }
308
- };
309
- ContextMenuComponent.prototype.popupKeyDownHandler = function (e) {
310
- var element = this.popupRef.popupElement;
311
- if (e.keyCode === Keys.Escape && (hasClass(e.target, 'k-menu-item') || e.target === element)) {
312
- this.closeAndFocus(e);
313
- }
314
- else if (e.target === element) {
315
- this.service.keydown.emit(e);
316
- }
317
- };
318
- ContextMenuComponent.prototype.popupAction = function (name, originalEvent, callback) {
319
- var _this = this;
320
- var emitter = this[name];
321
- var prevented = false;
322
- if (hasObservers(emitter)) {
323
- this.ngZone.run(function () {
324
- var args = new ContextMenuPopupEvent({
325
- originalEvent: originalEvent,
326
- sender: _this,
327
- target: _this.currentTarget
328
- });
329
- emitter.emit(args);
330
- if (!args.isDefaultPrevented()) {
331
- callback();
332
- }
333
- prevented = args.isDefaultPrevented();
334
- });
335
- }
336
- else {
337
- callback();
338
- }
339
- return prevented;
340
- };
341
- Object.defineProperty(ContextMenuComponent.prototype, "currentTargetElement", {
342
- get: function () {
343
- return this.directiveTarget && this.currentTarget ? this.currentTarget.element : this.currentTarget;
344
- },
345
- enumerable: true,
346
- configurable: true
347
- });
348
- var ContextMenuComponent_1;
349
- tslib_1.__decorate([
350
- Input(),
351
- tslib_1.__metadata("design:type", String)
352
- ], ContextMenuComponent.prototype, "showOn", void 0);
353
- tslib_1.__decorate([
354
- Input(),
355
- tslib_1.__metadata("design:type", Object)
356
- ], ContextMenuComponent.prototype, "target", void 0);
357
- tslib_1.__decorate([
358
- Input(),
359
- tslib_1.__metadata("design:type", String)
360
- ], ContextMenuComponent.prototype, "filter", void 0);
361
- tslib_1.__decorate([
362
- Input(),
363
- tslib_1.__metadata("design:type", Boolean)
364
- ], ContextMenuComponent.prototype, "alignToAnchor", void 0);
365
- tslib_1.__decorate([
366
- Input(),
367
- tslib_1.__metadata("design:type", Boolean)
368
- ], ContextMenuComponent.prototype, "vertical", void 0);
369
- tslib_1.__decorate([
370
- Input(),
371
- tslib_1.__metadata("design:type", Object)
372
- ], ContextMenuComponent.prototype, "popupAnimate", void 0);
373
- tslib_1.__decorate([
374
- Input(),
375
- tslib_1.__metadata("design:type", Object)
376
- ], ContextMenuComponent.prototype, "popupAlign", void 0);
377
- tslib_1.__decorate([
378
- Input(),
379
- tslib_1.__metadata("design:type", Object)
380
- ], ContextMenuComponent.prototype, "anchorAlign", void 0);
381
- tslib_1.__decorate([
382
- Input(),
383
- tslib_1.__metadata("design:type", Object)
384
- ], ContextMenuComponent.prototype, "collision", void 0);
385
- tslib_1.__decorate([
386
- Input(),
387
- tslib_1.__metadata("design:type", ViewContainerRef)
388
- ], ContextMenuComponent.prototype, "appendTo", void 0);
389
- tslib_1.__decorate([
390
- Input(),
391
- tslib_1.__metadata("design:type", String)
392
- ], ContextMenuComponent.prototype, "ariaLabel", void 0);
393
- tslib_1.__decorate([
394
- Output(),
395
- tslib_1.__metadata("design:type", EventEmitter)
396
- ], ContextMenuComponent.prototype, "popupOpen", void 0);
397
- tslib_1.__decorate([
398
- Output(),
399
- tslib_1.__metadata("design:type", EventEmitter)
400
- ], ContextMenuComponent.prototype, "popupClose", void 0);
401
- tslib_1.__decorate([
402
- Output(),
403
- tslib_1.__metadata("design:type", EventEmitter)
404
- ], ContextMenuComponent.prototype, "select", void 0);
405
- tslib_1.__decorate([
406
- Output(),
407
- tslib_1.__metadata("design:type", EventEmitter)
408
- ], ContextMenuComponent.prototype, "open", void 0);
409
- tslib_1.__decorate([
410
- Output(),
411
- tslib_1.__metadata("design:type", EventEmitter)
412
- ], ContextMenuComponent.prototype, "close", void 0);
413
- tslib_1.__decorate([
414
- ContentChild(ContextMenuTemplateDirective, { static: false }),
415
- tslib_1.__metadata("design:type", ContextMenuTemplateDirective)
416
- ], ContextMenuComponent.prototype, "contentTemplate", void 0);
417
- tslib_1.__decorate([
418
- ViewChild('default', { static: false }),
419
- tslib_1.__metadata("design:type", TemplateRef)
420
- ], ContextMenuComponent.prototype, "defaultContentTemplate", void 0);
421
- ContextMenuComponent = ContextMenuComponent_1 = tslib_1.__decorate([
422
- Component({
423
- exportAs: 'kendoContextMenu',
424
- providers: [
425
- ContextMenuService,
426
- LocalizationService,
427
- {
428
- provide: L10N_PREFIX,
429
- useValue: 'kendo.contextmenu'
430
- },
431
- {
432
- provide: ItemsService,
433
- useClass: ContextMenuItemsService
434
- },
435
- {
436
- provide: MenuBase,
437
- useExisting: forwardRef(function () { return ContextMenuComponent_1; })
438
- },
439
- PopupService,
440
- {
441
- provide: POPUP_CONTAINER,
442
- useFactory: ɵ1
443
- }
444
- ],
445
- selector: 'kendo-contextmenu',
446
- 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 "
447
- }),
448
- tslib_1.__metadata("design:paramtypes", [PopupService,
449
- ContextMenuService,
450
- NgZone,
451
- Renderer2])
452
- ], ContextMenuComponent);
453
- return ContextMenuComponent;
454
- }(MenuBase));
455
- export { ContextMenuComponent };
456
- export { ɵ0, ɵ1 };
@@ -1,64 +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 * as tslib_1 from "tslib";
6
- import { NgModule } from '@angular/core';
7
- import { CommonModule } from '@angular/common';
8
- import { PopupModule } from '@progress/kendo-angular-popup';
9
- import { MenuModule } from '../menu.module';
10
- import { ContextMenuComponent } from './context-menu.component';
11
- import { ContextMenuTemplateDirective } from './context-menu-template.directive';
12
- import { ContextMenuTargetDirective } from './context-menu-target.directive';
13
- import { ContextMenuTargetContainerDirective } from './context-menu-target-container.directive';
14
- var COMPONENT_DIRECTIVES = [
15
- ContextMenuComponent,
16
- ContextMenuTemplateDirective,
17
- ContextMenuTargetDirective,
18
- ContextMenuTargetContainerDirective
19
- ];
20
- /**
21
- * Represents the [NgModule]({{ site.data.urls.angular['ngmoduleapi'] }})
22
- * definition for the ContextMenu component.
23
- *
24
- * @example
25
- *
26
- * ```ts-no-run
27
- * // Import the ContextMenu module
28
- * import { ContextMenuModule } from '@progress/kendo-angular-menu';
29
- *
30
- * // The browser platform with a compiler
31
- * import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
32
- * import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
33
- *
34
- * import { NgModule } from '@angular/core';
35
- *
36
- * // Import the app component
37
- * import { AppComponent } from './app.component';
38
- *
39
- * // Define the app module
40
- * _@NgModule({
41
- * declarations: [AppComponent], // declare app component
42
- * imports: [BrowserModule, BrowserAnimationsModule, ContextMenuModule], // import ContextMenuModule module
43
- * bootstrap: [AppComponent]
44
- * })
45
- * export class AppModule {}
46
- *
47
- * // Compile and launch the module
48
- * platformBrowserDynamic().bootstrapModule(AppModule);
49
- *
50
- * ```
51
- */
52
- var ContextMenuModule = /** @class */ (function () {
53
- function ContextMenuModule() {
54
- }
55
- ContextMenuModule = tslib_1.__decorate([
56
- NgModule({
57
- declarations: [COMPONENT_DIRECTIVES],
58
- exports: [COMPONENT_DIRECTIVES, MenuModule],
59
- imports: [PopupModule, CommonModule, MenuModule]
60
- })
61
- ], ContextMenuModule);
62
- return ContextMenuModule;
63
- }());
64
- export { ContextMenuModule };
@@ -1,30 +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 * as tslib_1 from "tslib";
6
- import { Injectable, EventEmitter } from '@angular/core';
7
- import { hasObservers } from '@progress/kendo-angular-common';
8
- import { inMenu } from '../dom-queries';
9
- /**
10
- * @hidden
11
- */
12
- var ContextMenuService = /** @class */ (function () {
13
- function ContextMenuService() {
14
- this.keydown = new EventEmitter();
15
- }
16
- ContextMenuService.prototype.emit = function (name, args) {
17
- this.owner.emitMenuEvent(name, args);
18
- };
19
- ContextMenuService.prototype.hasObservers = function (name) {
20
- return this.owner && hasObservers(this.owner[name]);
21
- };
22
- ContextMenuService.prototype.leaveMenu = function (e) {
23
- return this.items ? !inMenu(e.target, this.items) : true;
24
- };
25
- ContextMenuService = tslib_1.__decorate([
26
- Injectable()
27
- ], ContextMenuService);
28
- return ContextMenuService;
29
- }());
30
- export { ContextMenuService };
@@ -1,32 +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
- var ITEM_FIELDS = ['textField', 'urlField', 'iconField', 'disabledField', 'cssClassField', 'cssStyleField', 'separatorField'];
6
- /**
7
- * @hidden
8
- */
9
- var BindingDirectiveBase = /** @class */ (function () {
10
- function BindingDirectiveBase(menu) {
11
- this.menu = menu;
12
- }
13
- BindingDirectiveBase.prototype.ngOnChanges = function () {
14
- this.rebind();
15
- };
16
- /**
17
- * Rebinds the Menu items.
18
- */
19
- BindingDirectiveBase.prototype.rebind = function () {
20
- var fields = this.fields = [];
21
- for (var idx = 0; idx < ITEM_FIELDS.length; idx++) {
22
- var inputName = ITEM_FIELDS[idx];
23
- var inputValue = this[inputName];
24
- if (inputValue) {
25
- fields.push({ target: inputName.replace('Field', ''), source: inputValue });
26
- }
27
- }
28
- this.menu.items = this.data ? this.mapItems(this.data) : [];
29
- };
30
- return BindingDirectiveBase;
31
- }());
32
- export { BindingDirectiveBase };