@progress/kendo-angular-menu 3.0.6 → 4.0.0-next.202203230842

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