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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 +35 -110
  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,274 +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, NgZone } from '@angular/core';
7
- import { LocalizationService } from '@progress/kendo-angular-l10n';
8
- import { ItemsService } from './items.service';
9
- import { ActionsService } from './actions.service';
10
- var DEFAULT_ACTIVE = '0';
11
- var NO_SPACE_REGEX = /\S/;
12
- var handlers = {};
13
- handlers['37'] = 'left';
14
- handlers['39'] = 'right';
15
- handlers['38'] = 'up';
16
- handlers['40'] = 'down';
17
- handlers['36'] = 'home';
18
- handlers['35'] = 'end';
19
- handlers['32'] = 'enter';
20
- handlers['13'] = 'enter';
21
- handlers['27'] = 'esc';
22
- handlers['9'] = 'tab';
23
- var handlersRTL = Object.assign({}, handlers, {
24
- '37': 'right',
25
- '39': 'left'
26
- });
27
- function isPrintableCharacter(key) {
28
- return key.length === 1 && NO_SPACE_REGEX.test(key);
29
- }
30
- var resolvedPromise = Promise.resolve(null);
31
- /**
32
- * @hidden
33
- */
34
- var NavigationService = /** @class */ (function () {
35
- function NavigationService(items, actions, localization, ngZone) {
36
- this.items = items;
37
- this.actions = actions;
38
- this.localization = localization;
39
- this.ngZone = ngZone;
40
- this.vertical = false;
41
- this.activeIndex = DEFAULT_ACTIVE;
42
- }
43
- Object.defineProperty(NavigationService.prototype, "focusedItem", {
44
- get: function () {
45
- return this.items.get(this.focusedIdx);
46
- },
47
- enumerable: true,
48
- configurable: true
49
- });
50
- Object.defineProperty(NavigationService.prototype, "activeItem", {
51
- get: function () {
52
- return this.items.get(this.activeIndex);
53
- },
54
- enumerable: true,
55
- configurable: true
56
- });
57
- Object.defineProperty(NavigationService.prototype, "handlers", {
58
- get: function () {
59
- return this.localization.rtl ? handlersRTL : handlers;
60
- },
61
- enumerable: true,
62
- configurable: true
63
- });
64
- NavigationService.prototype.focus = function (item) {
65
- if (item.index === this.focusedIdx) {
66
- return;
67
- }
68
- if (!this.activeItem || !this.items.hasParent(item, this.activeItem)) {
69
- this.setActive(item);
70
- }
71
- this.setFocus(item);
72
- };
73
- NavigationService.prototype.setFocus = function (item) {
74
- this.focusedIdx = item.index;
75
- item.focus();
76
- };
77
- NavigationService.prototype.focusLeave = function () {
78
- var focused = this.focusedItem;
79
- if (focused) {
80
- this.actions.closeToRoot(focused);
81
- this.actions.execute();
82
- }
83
- this.focusedIdx = null;
84
- };
85
- NavigationService.prototype.updateActive = function () {
86
- var _this = this;
87
- if (!this.activeItem && this.items.hasItems) {
88
- var firstItem = this.items.get(DEFAULT_ACTIVE);
89
- firstItem.toggleActive(true);
90
- this.ngZone.runOutsideAngular(function () {
91
- resolvedPromise.then(function () {
92
- _this.activeIndex = DEFAULT_ACTIVE;
93
- });
94
- });
95
- }
96
- };
97
- NavigationService.prototype.keydown = function (e) {
98
- var current = this.focusedItem || this.activeItem;
99
- var handler = this.handlers[e.keyCode];
100
- if (!current) {
101
- return;
102
- }
103
- if (handler) {
104
- if (handler !== 'tab') {
105
- e.preventDefault();
106
- }
107
- this[handler](current, e);
108
- }
109
- else if (isPrintableCharacter(e.key)) {
110
- this.search(current, e.key);
111
- }
112
- this.actions.execute();
113
- };
114
- NavigationService.prototype.focusIndex = function (index) {
115
- if (!index && this.activeItem) {
116
- this.setFocus(this.activeItem);
117
- }
118
- else if (index === 'first') {
119
- this.focusFirst();
120
- }
121
- else if (index === 'last') {
122
- this.focusLast();
123
- }
124
- else {
125
- var item = this.items.get(index);
126
- if (item) {
127
- this.focus(item);
128
- }
129
- }
130
- };
131
- NavigationService.prototype.focusFirst = function () {
132
- var items = this.items.siblings(this.items.get('0'));
133
- this.focus(items[0]);
134
- };
135
- NavigationService.prototype.focusLast = function () {
136
- var items = this.items.siblings(this.items.get('0'));
137
- this.focus(items[items.length - 1]);
138
- };
139
- NavigationService.prototype.search = function (current, key) {
140
- var siblings = this.items.siblings(current);
141
- var startIndex = siblings.indexOf(current);
142
- var items = siblings.slice(startIndex + 1).concat(siblings.slice(0, startIndex));
143
- for (var idx = 0; idx < items.length; idx++) {
144
- var sibling = items[idx];
145
- var text = sibling.item.text || "";
146
- if (text.toLowerCase().startsWith(key.toLowerCase())) {
147
- this.focus(sibling);
148
- break;
149
- }
150
- }
151
- };
152
- NavigationService.prototype.down = function (current) {
153
- if (current.level === 0 && !this.vertical) {
154
- if (current.hasContent) {
155
- this.actions.open(current, this.focusChild(current, 0));
156
- }
157
- }
158
- else {
159
- this.focus(this.items.next(current));
160
- }
161
- };
162
- NavigationService.prototype.up = function (current) {
163
- if (current.level === 0 && !this.vertical) {
164
- if (current.hasContent) {
165
- this.actions.open(current, this.focusChild(current, current.children.length - 1));
166
- }
167
- }
168
- else {
169
- this.focus(this.items.previous(current));
170
- }
171
- };
172
- NavigationService.prototype.left = function (current) {
173
- if (this.vertical && current.level === 0 && current.disabled) {
174
- return;
175
- }
176
- if (current.level > 1 || (this.vertical && current.level > 0)) {
177
- var parent_1 = this.items.parent(current);
178
- this.focus(parent_1);
179
- this.actions.close(parent_1);
180
- }
181
- else if (this.vertical && current.level === 0 && !current.disabled) {
182
- if (current.hasContent) {
183
- this.actions.open(current, this.focusChild(current, current.children.length - 1));
184
- }
185
- }
186
- else {
187
- this.focus(this.items.previous(this.activeItem));
188
- }
189
- };
190
- NavigationService.prototype.right = function (current) {
191
- if (this.vertical && current.level === 0 && current.disabled) {
192
- return;
193
- }
194
- if (current.horizontal && !current.disabled) {
195
- if (current.hasContent) {
196
- this.actions.open(current, this.focusChild(current, 0));
197
- }
198
- else if (!this.vertical || current.level > 0) {
199
- this.focus(this.items.next(this.activeItem));
200
- }
201
- }
202
- else {
203
- this.focus(this.items.next(this.activeItem));
204
- }
205
- };
206
- NavigationService.prototype.home = function (current) {
207
- var siblings = this.items.siblings(current);
208
- this.focus(siblings[0]);
209
- };
210
- NavigationService.prototype.end = function (current) {
211
- var siblings = this.items.siblings(current);
212
- this.focus(siblings[siblings.length - 1]);
213
- };
214
- NavigationService.prototype.enter = function (current, domEvent) {
215
- var actions = this.actions;
216
- if (current.disabled) {
217
- return;
218
- }
219
- if (current.hasContent) {
220
- actions.select(current, domEvent);
221
- actions.open(current, this.focusChild(current, 0));
222
- }
223
- else {
224
- actions.select(current, domEvent, null, function () {
225
- current.navigate();
226
- });
227
- this.focus(this.items.root(current));
228
- actions.closeToRoot(current);
229
- }
230
- };
231
- NavigationService.prototype.esc = function (current) {
232
- if (current.level > 0) {
233
- var parent_2 = this.items.parent(current);
234
- this.actions.close(parent_2);
235
- this.focus(parent_2);
236
- }
237
- };
238
- NavigationService.prototype.tab = function (current) {
239
- if (current.level > 0) {
240
- this.activeItem.focus();
241
- }
242
- };
243
- NavigationService.prototype.focusChild = function (item, index) {
244
- var _this = this;
245
- return function () {
246
- var child = _this.items.children(item)[index];
247
- _this.setFocus(child);
248
- };
249
- };
250
- NavigationService.prototype.setActive = function (item) {
251
- var focused = this.focusedItem;
252
- var active = this.items.root(item);
253
- if (this.activeItem) {
254
- this.activeItem.toggleActive(false);
255
- }
256
- this.activeIndex = active.index;
257
- active.toggleActive(true);
258
- if (focused) {
259
- this.actions.closeToRoot(focused);
260
- if (focused.level > 0) {
261
- this.actions.open(active);
262
- }
263
- }
264
- };
265
- NavigationService = tslib_1.__decorate([
266
- Injectable(),
267
- tslib_1.__metadata("design:paramtypes", [ItemsService,
268
- ActionsService,
269
- LocalizationService,
270
- NgZone])
271
- ], NavigationService);
272
- return NavigationService;
273
- }());
274
- export { NavigationService };
@@ -1,50 +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 Menu items ([see example]({% slug templates_menu %})). To define the template,
9
- * nest an `<ng-template>` tag with the `kendoMenuItemContentTemplate` directive inside a `<kendo-menu-item>` component.
10
- *
11
- * The available fields in the template context are:
12
- * - `item`&mdash;The item data.
13
- * - `index`&mdash;The item index.
14
- *
15
- * @example
16
- * ```ts-preview
17
- *
18
- * _@Component({
19
- * selector: 'my-app',
20
- * template: `
21
- * <kendo-menu>
22
- * <kendo-menu-item text="item2">
23
- * <ng-template kendoMenuItemContentTemplate let-item="item" let-index="index">
24
- * <div style="padding: 10px;">
25
- * My Content Template for: {{ item.text }} at index: {{ index }}
26
- * </div>
27
- * </ng-template>
28
- * </kendo-menu-item>
29
- * </kendo-menu>
30
- * `
31
- * })
32
- *
33
- * class AppComponent {
34
- * }
35
- * ```
36
- */
37
- var ItemContentTemplateDirective = /** @class */ (function () {
38
- function ItemContentTemplateDirective(templateRef) {
39
- this.templateRef = templateRef;
40
- }
41
- ItemContentTemplateDirective = tslib_1.__decorate([
42
- Directive({
43
- selector: '[kendoMenuItemContentTemplate]'
44
- }),
45
- tslib_1.__param(0, Optional()),
46
- tslib_1.__metadata("design:paramtypes", [TemplateRef])
47
- ], ItemContentTemplateDirective);
48
- return ItemContentTemplateDirective;
49
- }());
50
- export { ItemContentTemplateDirective };
@@ -1,52 +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 links of the Menu items ([see example]({% slug templates_menu %})). To define a template
9
- * for an item, nest an `<ng-template>` tag with the `kendoMenuItemLinkTemplate` directive inside a `<kendo-menu-item>`
10
- * component. To define a template for all Menu items, nest the template inside the `<kendo-menu>` component.
11
- *
12
- * The available fields in the template context are:
13
- * - `item`&mdash;The item data.
14
- * - `index`&mdash;The item index.
15
- *
16
- * @example
17
- * ```ts-preview
18
- *
19
- * _@Component({
20
- * selector: 'my-app',
21
- * template: `
22
- * <kendo-menu>
23
- * <kendo-menu-item text="item2">
24
- * <ng-template kendoMenuItemLinkTemplate let-item="item" let-index="index">
25
- * <span [kendoMenuItemLink]="index">
26
- * {{ item.text }}
27
- * <span *ngIf="item.items && item.items.length" [kendoMenuExpandArrow]="index"></span>
28
- * </span>
29
- * </ng-template>
30
- * </kendo-menu-item>
31
- * </kendo-menu>
32
- * `
33
- * })
34
- *
35
- * class AppComponent {
36
- * }
37
- * ```
38
- */
39
- var ItemLinkTemplateDirective = /** @class */ (function () {
40
- function ItemLinkTemplateDirective(templateRef) {
41
- this.templateRef = templateRef;
42
- }
43
- ItemLinkTemplateDirective = tslib_1.__decorate([
44
- Directive({
45
- selector: '[kendoMenuItemLinkTemplate]'
46
- }),
47
- tslib_1.__param(0, Optional()),
48
- tslib_1.__metadata("design:paramtypes", [TemplateRef])
49
- ], ItemLinkTemplateDirective);
50
- return ItemLinkTemplateDirective;
51
- }());
52
- export { ItemLinkTemplateDirective };
@@ -1,51 +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 Menu items ([see example]({% slug templates_menu %})). To define a template
9
- * for an item, nest an `<ng-template>` tag with the `kendoMenuItemTemplate` directive inside a `<kendo-menu-item>`
10
- * component. To define a template for all Menu items, nest the template inside the `<kendo-menu>` component.
11
- *
12
- * The available fields in the template context are:
13
- * - `item`&mdash;The item data.
14
- * - `index`&mdash;The item index.
15
- *
16
- * @example
17
- * ```ts-preview
18
- *
19
- * _@Component({
20
- * selector: 'my-app',
21
- * template: `
22
- * <kendo-menu>
23
- * <kendo-menu-item text="item2">
24
- * <ng-template kendoMenuItemTemplate let-item="item" let-index="index">
25
- * <div style="padding: 10px;">
26
- * My Template for: {{ item.text }} at index: {{ index }}
27
- * </div>
28
- * </ng-template>
29
- * </kendo-menu-item>
30
- * </kendo-menu>
31
- * `
32
- * })
33
- *
34
- * class AppComponent {
35
- * }
36
- * ```
37
- */
38
- var ItemTemplateDirective = /** @class */ (function () {
39
- function ItemTemplateDirective(templateRef) {
40
- this.templateRef = templateRef;
41
- }
42
- ItemTemplateDirective = tslib_1.__decorate([
43
- Directive({
44
- selector: '[kendoMenuItemTemplate]'
45
- }),
46
- tslib_1.__param(0, Optional()),
47
- tslib_1.__metadata("design:paramtypes", [TemplateRef])
48
- ], ItemTemplateDirective);
49
- return ItemTemplateDirective;
50
- }());
51
- export { ItemTemplateDirective };
package/dist/es/utils.js DELETED
@@ -1,18 +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 { ElementRef } from '@angular/core';
6
- import { isDocumentAvailable } from '@progress/kendo-angular-common';
7
- /**
8
- * @hidden
9
- */
10
- export var defined = function (value) { return typeof value !== 'undefined'; };
11
- /**
12
- * @hidden
13
- */
14
- export var bodyFactory = function () {
15
- if (isDocumentAvailable()) {
16
- return new ElementRef(document.body);
17
- }
18
- };
@@ -1,25 +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
- import { ContextMenuService } from './context-menu.service';
8
- /**
9
- * @hidden
10
- */
11
- let ContextMenuItemsService = class ContextMenuItemsService {
12
- constructor(contextService) {
13
- this.contextService = contextService;
14
- }
15
- get(index) {
16
- if (this.contextService.items) {
17
- return this.contextService.items.get(index);
18
- }
19
- }
20
- };
21
- ContextMenuItemsService = tslib_1.__decorate([
22
- Injectable(),
23
- tslib_1.__metadata("design:paramtypes", [ContextMenuService])
24
- ], ContextMenuItemsService);
25
- export { ContextMenuItemsService };
@@ -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 { Directive, ElementRef } from '@angular/core';
7
- import { ContextMenuTargetService } from './context-menu-target.service';
8
- /**
9
- * Specifies a container for the [targets]({% slug api_menu_contextmenutargetdirective %}) of the ContextMenu.
10
- */
11
- let ContextMenuTargetContainerDirective = class ContextMenuTargetContainerDirective {
12
- /**
13
- * @hidden
14
- */
15
- constructor(elementRef, targetService) {
16
- this.targetService = targetService;
17
- if (elementRef) {
18
- this.element = elementRef.nativeElement;
19
- }
20
- }
21
- };
22
- ContextMenuTargetContainerDirective = tslib_1.__decorate([
23
- Directive({
24
- selector: '[kendoContextMenuTargetContainer]',
25
- exportAs: 'kendoContextMenuTargetContainer',
26
- providers: [ContextMenuTargetService]
27
- }),
28
- tslib_1.__metadata("design:paramtypes", [ElementRef, ContextMenuTargetService])
29
- ], ContextMenuTargetContainerDirective);
30
- export { ContextMenuTargetContainerDirective };
@@ -1,47 +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, ElementRef, Input, HostBinding } from '@angular/core';
7
- import { ContextMenuTargetService } from './context-menu-target.service';
8
- /**
9
- * @hidden
10
- */
11
- export const TARGET_CLASS = 'k-contextmenu-target';
12
- /**
13
- * Specifies a [target]({% slug api_menu_contextmenutargetdirective %}) for the ContextMenu
14
- * ([see example]({% slug target_contextmenu %}#toc-directives)).
15
- */
16
- let ContextMenuTargetDirective = class ContextMenuTargetDirective {
17
- constructor(elementRef, targetService) {
18
- this.targetService = targetService;
19
- /**
20
- * @hidden
21
- */
22
- this.hostClass = true;
23
- if (elementRef) {
24
- this.element = elementRef.nativeElement;
25
- }
26
- targetService.add(this);
27
- }
28
- ngOnDestroy() {
29
- this.targetService.remove(this);
30
- }
31
- };
32
- tslib_1.__decorate([
33
- Input('kendoContextMenuTarget'),
34
- tslib_1.__metadata("design:type", Object)
35
- ], ContextMenuTargetDirective.prototype, "data", void 0);
36
- tslib_1.__decorate([
37
- HostBinding(`class.${TARGET_CLASS}`),
38
- tslib_1.__metadata("design:type", Boolean)
39
- ], ContextMenuTargetDirective.prototype, "hostClass", void 0);
40
- ContextMenuTargetDirective = tslib_1.__decorate([
41
- Directive({
42
- selector: '[kendoContextMenuTarget]',
43
- exportAs: 'kendoContextMenuTarget'
44
- }),
45
- tslib_1.__metadata("design:paramtypes", [ElementRef, ContextMenuTargetService])
46
- ], ContextMenuTargetDirective);
47
- export { ContextMenuTargetDirective };
@@ -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 { 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
- let ContextMenuTemplateDirective = class ContextMenuTemplateDirective {
19
- constructor(templateRef) {
20
- this.templateRef = templateRef;
21
- }
22
- };
23
- ContextMenuTemplateDirective = tslib_1.__decorate([
24
- Directive({
25
- selector: '[kendoContextMenuTemplate]'
26
- }),
27
- tslib_1.__param(0, Optional()),
28
- tslib_1.__metadata("design:paramtypes", [TemplateRef])
29
- ], ContextMenuTemplateDirective);
30
- export { ContextMenuTemplateDirective };
@@ -1,101 +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, Input } from '@angular/core';
7
- import { MenuBase } from '../menu-base';
8
- import { BindingDirectiveBase } from './binding-directive-base';
9
- import { getter } from './utils';
10
- /* tslint:disable:no-input-rename */
11
- /**
12
- * A directive that converts the provided flat data to [MenuItems]({% slug api_menu_menuitem %}) and binds them to the Menu.
13
- */
14
- let FlatBindingDirective = class FlatBindingDirective extends BindingDirectiveBase {
15
- constructor(menu) {
16
- super(menu);
17
- }
18
- mapItems(items) {
19
- if (!this.idField || !this.parentIdField) {
20
- return items.map(item => this.createItem(item));
21
- }
22
- const result = [];
23
- const map = {};
24
- for (let idx = 0; idx < items.length; idx++) {
25
- const item = items[idx];
26
- const menuItem = this.createItem(item);
27
- const id = getter(this.idField)(item);
28
- const parentId = getter(this.parentIdField)(item);
29
- if (parentId === null || parentId === undefined) {
30
- result.push(menuItem);
31
- }
32
- else {
33
- const parent = map[parentId] = map[parentId] || {};
34
- parent.items = parent.items || [];
35
- parent.items.push(menuItem);
36
- }
37
- if (map[id]) {
38
- menuItem.items = map[id].items;
39
- }
40
- map[id] = menuItem;
41
- }
42
- return result;
43
- }
44
- createItem(dataItem) {
45
- const result = { data: dataItem };
46
- const fields = this.fields;
47
- for (let idx = 0; idx < fields.length; idx++) {
48
- const { source, target } = fields[idx];
49
- result[target] = getter(source)(dataItem);
50
- }
51
- return result;
52
- }
53
- };
54
- tslib_1.__decorate([
55
- Input("kendoMenuFlatBinding"),
56
- tslib_1.__metadata("design:type", Array)
57
- ], FlatBindingDirective.prototype, "data", void 0);
58
- tslib_1.__decorate([
59
- Input(),
60
- tslib_1.__metadata("design:type", String)
61
- ], FlatBindingDirective.prototype, "textField", void 0);
62
- tslib_1.__decorate([
63
- Input(),
64
- tslib_1.__metadata("design:type", String)
65
- ], FlatBindingDirective.prototype, "urlField", void 0);
66
- tslib_1.__decorate([
67
- Input(),
68
- tslib_1.__metadata("design:type", Object)
69
- ], FlatBindingDirective.prototype, "iconField", void 0);
70
- tslib_1.__decorate([
71
- Input(),
72
- tslib_1.__metadata("design:type", String)
73
- ], FlatBindingDirective.prototype, "disabledField", void 0);
74
- tslib_1.__decorate([
75
- Input(),
76
- tslib_1.__metadata("design:type", String)
77
- ], FlatBindingDirective.prototype, "cssClassField", void 0);
78
- tslib_1.__decorate([
79
- Input(),
80
- tslib_1.__metadata("design:type", String)
81
- ], FlatBindingDirective.prototype, "cssStyleField", void 0);
82
- tslib_1.__decorate([
83
- Input(),
84
- tslib_1.__metadata("design:type", String)
85
- ], FlatBindingDirective.prototype, "separatorField", void 0);
86
- tslib_1.__decorate([
87
- Input(),
88
- tslib_1.__metadata("design:type", String)
89
- ], FlatBindingDirective.prototype, "idField", void 0);
90
- tslib_1.__decorate([
91
- Input(),
92
- tslib_1.__metadata("design:type", String)
93
- ], FlatBindingDirective.prototype, "parentIdField", void 0);
94
- FlatBindingDirective = tslib_1.__decorate([
95
- Directive({
96
- exportAs: 'kendoMenuFlatBinding',
97
- selector: '[kendoMenuFlatBinding]'
98
- }),
99
- tslib_1.__metadata("design:paramtypes", [MenuBase])
100
- ], FlatBindingDirective);
101
- export { FlatBindingDirective };