@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,143 +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 PARENT_REGEX = /_?\d+$/;
10
- var SEPARATOR = '_';
11
- var id = 0;
12
- var itemIndexComparer = function (a, b) { return a.siblingIndex - b.siblingIndex; };
13
- var ɵ0 = itemIndexComparer;
14
- exports.ɵ0 = ɵ0;
15
- var next = function (idx, items, dir) {
16
- var current = items[idx + dir];
17
- while (!current) {
18
- if (idx < 0) {
19
- idx = items.length - 1;
20
- }
21
- else if (idx >= items.length) {
22
- idx = 0;
23
- }
24
- else {
25
- idx += dir;
26
- }
27
- current = items[idx];
28
- }
29
- return current;
30
- };
31
- var ɵ1 = next;
32
- exports.ɵ1 = ɵ1;
33
- /**
34
- * @hidden
35
- */
36
- var ItemsService = /** @class */ (function () {
37
- function ItemsService() {
38
- this.items = {};
39
- this.lists = [];
40
- this.idPrefix = "k-menu" + id++;
41
- }
42
- Object.defineProperty(ItemsService.prototype, "hasItems", {
43
- get: function () {
44
- return Object.keys(this.items).length > 0;
45
- },
46
- enumerable: true,
47
- configurable: true
48
- });
49
- ItemsService.prototype.childId = function (index) {
50
- return this.idPrefix + "-child" + index;
51
- };
52
- ItemsService.prototype.itemIndex = function (parentIndex, index) {
53
- return (parentIndex ? parentIndex + SEPARATOR : '') + index;
54
- };
55
- ItemsService.prototype.get = function (index) {
56
- return this.items[index];
57
- };
58
- ItemsService.prototype.add = function (item) {
59
- this.items[item.index] = item;
60
- };
61
- ItemsService.prototype.remove = function (item) {
62
- if (this.items[item.index] === item) {
63
- delete this.items[item.index];
64
- }
65
- };
66
- ItemsService.prototype.addList = function (list) {
67
- this.lists.push(list);
68
- };
69
- ItemsService.prototype.removeList = function (list) {
70
- var index = this.lists.indexOf(list);
71
- if (index >= 0) {
72
- this.lists.splice(index, 1);
73
- }
74
- };
75
- ItemsService.prototype.containsList = function (element) {
76
- return Boolean(this.lists.find(function (list) { return list.element.nativeElement === element; }));
77
- };
78
- ItemsService.prototype.siblings = function (item) {
79
- var _this = this;
80
- var parentIndex = this.parentIndex(item.index);
81
- return this.filter(function (index) { return _this.parentIndex(index) === parentIndex; });
82
- };
83
- ItemsService.prototype.otherSiblings = function (item) {
84
- var _this = this;
85
- var parentIndex = this.parentIndex(item.index);
86
- return this.filter(function (index) { return _this.parentIndex(index) === parentIndex && index !== item.index; });
87
- };
88
- ItemsService.prototype.children = function (item) {
89
- var _this = this;
90
- return this.filter(function (index) { return _this.parentIndex(index) === item.index; });
91
- };
92
- ItemsService.prototype.parent = function (item) {
93
- return this.items[this.parentIndex(item.index)];
94
- };
95
- ItemsService.prototype.root = function (item) {
96
- return this.items[this.indices(item.index)[0]];
97
- };
98
- ItemsService.prototype.indices = function (index) {
99
- return index.split(SEPARATOR);
100
- };
101
- ItemsService.prototype.filter = function (predicate) {
102
- var result = [];
103
- var items = this.items;
104
- for (var index in items) {
105
- if (predicate(index, items[index])) {
106
- result.push(items[index]);
107
- }
108
- }
109
- return result.sort(itemIndexComparer);
110
- };
111
- ItemsService.prototype.previous = function (item) {
112
- var siblings = this.siblings(item);
113
- var itemIndex = siblings.indexOf(item);
114
- return next(itemIndex, siblings, -1);
115
- };
116
- ItemsService.prototype.next = function (item) {
117
- var siblings = this.siblings(item);
118
- var itemIndex = siblings.indexOf(item);
119
- return next(itemIndex, siblings, 1);
120
- };
121
- ItemsService.prototype.hasParent = function (item, parent) {
122
- return item.index.startsWith(parent.index);
123
- };
124
- ItemsService.prototype.areSiblings = function (item1, item2) {
125
- return item1 !== item2 && this.parent(item1) === this.parent(item2);
126
- };
127
- ItemsService.prototype.forEach = function (callback) {
128
- var items = this.items;
129
- for (var index in items) {
130
- if (items.hasOwnProperty(index)) {
131
- callback(items[index]);
132
- }
133
- }
134
- };
135
- ItemsService.prototype.parentIndex = function (index) {
136
- return index.replace(PARENT_REGEX, '');
137
- };
138
- ItemsService = tslib_1.__decorate([
139
- core_1.Injectable()
140
- ], ItemsService);
141
- return ItemsService;
142
- }());
143
- exports.ItemsService = ItemsService;
@@ -1,276 +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 items_service_1 = require("./items.service");
11
- var actions_service_1 = require("./actions.service");
12
- var DEFAULT_ACTIVE = '0';
13
- var NO_SPACE_REGEX = /\S/;
14
- var handlers = {};
15
- handlers['37'] = 'left';
16
- handlers['39'] = 'right';
17
- handlers['38'] = 'up';
18
- handlers['40'] = 'down';
19
- handlers['36'] = 'home';
20
- handlers['35'] = 'end';
21
- handlers['32'] = 'enter';
22
- handlers['13'] = 'enter';
23
- handlers['27'] = 'esc';
24
- handlers['9'] = 'tab';
25
- var handlersRTL = Object.assign({}, handlers, {
26
- '37': 'right',
27
- '39': 'left'
28
- });
29
- function isPrintableCharacter(key) {
30
- return key.length === 1 && NO_SPACE_REGEX.test(key);
31
- }
32
- var resolvedPromise = Promise.resolve(null);
33
- /**
34
- * @hidden
35
- */
36
- var NavigationService = /** @class */ (function () {
37
- function NavigationService(items, actions, localization, ngZone) {
38
- this.items = items;
39
- this.actions = actions;
40
- this.localization = localization;
41
- this.ngZone = ngZone;
42
- this.vertical = false;
43
- this.activeIndex = DEFAULT_ACTIVE;
44
- }
45
- Object.defineProperty(NavigationService.prototype, "focusedItem", {
46
- get: function () {
47
- return this.items.get(this.focusedIdx);
48
- },
49
- enumerable: true,
50
- configurable: true
51
- });
52
- Object.defineProperty(NavigationService.prototype, "activeItem", {
53
- get: function () {
54
- return this.items.get(this.activeIndex);
55
- },
56
- enumerable: true,
57
- configurable: true
58
- });
59
- Object.defineProperty(NavigationService.prototype, "handlers", {
60
- get: function () {
61
- return this.localization.rtl ? handlersRTL : handlers;
62
- },
63
- enumerable: true,
64
- configurable: true
65
- });
66
- NavigationService.prototype.focus = function (item) {
67
- if (item.index === this.focusedIdx) {
68
- return;
69
- }
70
- if (!this.activeItem || !this.items.hasParent(item, this.activeItem)) {
71
- this.setActive(item);
72
- }
73
- this.setFocus(item);
74
- };
75
- NavigationService.prototype.setFocus = function (item) {
76
- this.focusedIdx = item.index;
77
- item.focus();
78
- };
79
- NavigationService.prototype.focusLeave = function () {
80
- var focused = this.focusedItem;
81
- if (focused) {
82
- this.actions.closeToRoot(focused);
83
- this.actions.execute();
84
- }
85
- this.focusedIdx = null;
86
- };
87
- NavigationService.prototype.updateActive = function () {
88
- var _this = this;
89
- if (!this.activeItem && this.items.hasItems) {
90
- var firstItem = this.items.get(DEFAULT_ACTIVE);
91
- firstItem.toggleActive(true);
92
- this.ngZone.runOutsideAngular(function () {
93
- resolvedPromise.then(function () {
94
- _this.activeIndex = DEFAULT_ACTIVE;
95
- });
96
- });
97
- }
98
- };
99
- NavigationService.prototype.keydown = function (e) {
100
- var current = this.focusedItem || this.activeItem;
101
- var handler = this.handlers[e.keyCode];
102
- if (!current) {
103
- return;
104
- }
105
- if (handler) {
106
- if (handler !== 'tab') {
107
- e.preventDefault();
108
- }
109
- this[handler](current, e);
110
- }
111
- else if (isPrintableCharacter(e.key)) {
112
- this.search(current, e.key);
113
- }
114
- this.actions.execute();
115
- };
116
- NavigationService.prototype.focusIndex = function (index) {
117
- if (!index && this.activeItem) {
118
- this.setFocus(this.activeItem);
119
- }
120
- else if (index === 'first') {
121
- this.focusFirst();
122
- }
123
- else if (index === 'last') {
124
- this.focusLast();
125
- }
126
- else {
127
- var item = this.items.get(index);
128
- if (item) {
129
- this.focus(item);
130
- }
131
- }
132
- };
133
- NavigationService.prototype.focusFirst = function () {
134
- var items = this.items.siblings(this.items.get('0'));
135
- this.focus(items[0]);
136
- };
137
- NavigationService.prototype.focusLast = function () {
138
- var items = this.items.siblings(this.items.get('0'));
139
- this.focus(items[items.length - 1]);
140
- };
141
- NavigationService.prototype.search = function (current, key) {
142
- var siblings = this.items.siblings(current);
143
- var startIndex = siblings.indexOf(current);
144
- var items = siblings.slice(startIndex + 1).concat(siblings.slice(0, startIndex));
145
- for (var idx = 0; idx < items.length; idx++) {
146
- var sibling = items[idx];
147
- var text = sibling.item.text || "";
148
- if (text.toLowerCase().startsWith(key.toLowerCase())) {
149
- this.focus(sibling);
150
- break;
151
- }
152
- }
153
- };
154
- NavigationService.prototype.down = function (current) {
155
- if (current.level === 0 && !this.vertical) {
156
- if (current.hasContent) {
157
- this.actions.open(current, this.focusChild(current, 0));
158
- }
159
- }
160
- else {
161
- this.focus(this.items.next(current));
162
- }
163
- };
164
- NavigationService.prototype.up = function (current) {
165
- if (current.level === 0 && !this.vertical) {
166
- if (current.hasContent) {
167
- this.actions.open(current, this.focusChild(current, current.children.length - 1));
168
- }
169
- }
170
- else {
171
- this.focus(this.items.previous(current));
172
- }
173
- };
174
- NavigationService.prototype.left = function (current) {
175
- if (this.vertical && current.level === 0 && current.disabled) {
176
- return;
177
- }
178
- if (current.level > 1 || (this.vertical && current.level > 0)) {
179
- var parent_1 = this.items.parent(current);
180
- this.focus(parent_1);
181
- this.actions.close(parent_1);
182
- }
183
- else if (this.vertical && current.level === 0 && !current.disabled) {
184
- if (current.hasContent) {
185
- this.actions.open(current, this.focusChild(current, current.children.length - 1));
186
- }
187
- }
188
- else {
189
- this.focus(this.items.previous(this.activeItem));
190
- }
191
- };
192
- NavigationService.prototype.right = function (current) {
193
- if (this.vertical && current.level === 0 && current.disabled) {
194
- return;
195
- }
196
- if (current.horizontal && !current.disabled) {
197
- if (current.hasContent) {
198
- this.actions.open(current, this.focusChild(current, 0));
199
- }
200
- else if (!this.vertical || current.level > 0) {
201
- this.focus(this.items.next(this.activeItem));
202
- }
203
- }
204
- else {
205
- this.focus(this.items.next(this.activeItem));
206
- }
207
- };
208
- NavigationService.prototype.home = function (current) {
209
- var siblings = this.items.siblings(current);
210
- this.focus(siblings[0]);
211
- };
212
- NavigationService.prototype.end = function (current) {
213
- var siblings = this.items.siblings(current);
214
- this.focus(siblings[siblings.length - 1]);
215
- };
216
- NavigationService.prototype.enter = function (current, domEvent) {
217
- var actions = this.actions;
218
- if (current.disabled) {
219
- return;
220
- }
221
- if (current.hasContent) {
222
- actions.select(current, domEvent);
223
- actions.open(current, this.focusChild(current, 0));
224
- }
225
- else {
226
- actions.select(current, domEvent, null, function () {
227
- current.navigate();
228
- });
229
- this.focus(this.items.root(current));
230
- actions.closeToRoot(current);
231
- }
232
- };
233
- NavigationService.prototype.esc = function (current) {
234
- if (current.level > 0) {
235
- var parent_2 = this.items.parent(current);
236
- this.actions.close(parent_2);
237
- this.focus(parent_2);
238
- }
239
- };
240
- NavigationService.prototype.tab = function (current) {
241
- if (current.level > 0) {
242
- this.activeItem.focus();
243
- }
244
- };
245
- NavigationService.prototype.focusChild = function (item, index) {
246
- var _this = this;
247
- return function () {
248
- var child = _this.items.children(item)[index];
249
- _this.setFocus(child);
250
- };
251
- };
252
- NavigationService.prototype.setActive = function (item) {
253
- var focused = this.focusedItem;
254
- var active = this.items.root(item);
255
- if (this.activeItem) {
256
- this.activeItem.toggleActive(false);
257
- }
258
- this.activeIndex = active.index;
259
- active.toggleActive(true);
260
- if (focused) {
261
- this.actions.closeToRoot(focused);
262
- if (focused.level > 0) {
263
- this.actions.open(active);
264
- }
265
- }
266
- };
267
- NavigationService = tslib_1.__decorate([
268
- core_1.Injectable(),
269
- tslib_1.__metadata("design:paramtypes", [items_service_1.ItemsService,
270
- actions_service_1.ActionsService,
271
- kendo_angular_l10n_1.LocalizationService,
272
- core_1.NgZone])
273
- ], NavigationService);
274
- return NavigationService;
275
- }());
276
- exports.NavigationService = NavigationService;
@@ -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
- "use strict";
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- var tslib_1 = require("tslib");
8
- var core_1 = require("@angular/core");
9
- /**
10
- * Represents a template for the content of the Menu items ([see example]({% slug templates_menu %})). To define the template,
11
- * nest an `<ng-template>` tag with the `kendoMenuItemContentTemplate` directive inside a `<kendo-menu-item>` component.
12
- *
13
- * The available fields in the template context are:
14
- * - `item`&mdash;The item data.
15
- * - `index`&mdash;The item index.
16
- *
17
- * @example
18
- * ```ts-preview
19
- *
20
- * _@Component({
21
- * selector: 'my-app',
22
- * template: `
23
- * <kendo-menu>
24
- * <kendo-menu-item text="item2">
25
- * <ng-template kendoMenuItemContentTemplate let-item="item" let-index="index">
26
- * <div style="padding: 10px;">
27
- * My Content Template for: {{ item.text }} at index: {{ index }}
28
- * </div>
29
- * </ng-template>
30
- * </kendo-menu-item>
31
- * </kendo-menu>
32
- * `
33
- * })
34
- *
35
- * class AppComponent {
36
- * }
37
- * ```
38
- */
39
- var ItemContentTemplateDirective = /** @class */ (function () {
40
- function ItemContentTemplateDirective(templateRef) {
41
- this.templateRef = templateRef;
42
- }
43
- ItemContentTemplateDirective = tslib_1.__decorate([
44
- core_1.Directive({
45
- selector: '[kendoMenuItemContentTemplate]'
46
- }),
47
- tslib_1.__param(0, core_1.Optional()),
48
- tslib_1.__metadata("design:paramtypes", [core_1.TemplateRef])
49
- ], ItemContentTemplateDirective);
50
- return ItemContentTemplateDirective;
51
- }());
52
- exports.ItemContentTemplateDirective = ItemContentTemplateDirective;
@@ -1,54 +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
- /**
10
- * Represents a template for the links of the Menu items ([see example]({% slug templates_menu %})). To define a template
11
- * for an item, nest an `<ng-template>` tag with the `kendoMenuItemLinkTemplate` directive inside a `<kendo-menu-item>`
12
- * component. To define a template for all Menu items, nest the template inside the `<kendo-menu>` component.
13
- *
14
- * The available fields in the template context are:
15
- * - `item`&mdash;The item data.
16
- * - `index`&mdash;The item index.
17
- *
18
- * @example
19
- * ```ts-preview
20
- *
21
- * _@Component({
22
- * selector: 'my-app',
23
- * template: `
24
- * <kendo-menu>
25
- * <kendo-menu-item text="item2">
26
- * <ng-template kendoMenuItemLinkTemplate let-item="item" let-index="index">
27
- * <span [kendoMenuItemLink]="index">
28
- * {{ item.text }}
29
- * <span *ngIf="item.items && item.items.length" [kendoMenuExpandArrow]="index"></span>
30
- * </span>
31
- * </ng-template>
32
- * </kendo-menu-item>
33
- * </kendo-menu>
34
- * `
35
- * })
36
- *
37
- * class AppComponent {
38
- * }
39
- * ```
40
- */
41
- var ItemLinkTemplateDirective = /** @class */ (function () {
42
- function ItemLinkTemplateDirective(templateRef) {
43
- this.templateRef = templateRef;
44
- }
45
- ItemLinkTemplateDirective = tslib_1.__decorate([
46
- core_1.Directive({
47
- selector: '[kendoMenuItemLinkTemplate]'
48
- }),
49
- tslib_1.__param(0, core_1.Optional()),
50
- tslib_1.__metadata("design:paramtypes", [core_1.TemplateRef])
51
- ], ItemLinkTemplateDirective);
52
- return ItemLinkTemplateDirective;
53
- }());
54
- exports.ItemLinkTemplateDirective = ItemLinkTemplateDirective;
@@ -1,53 +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
- /**
10
- * Represents a template for the Menu items ([see example]({% slug templates_menu %})). To define a template
11
- * for an item, nest an `<ng-template>` tag with the `kendoMenuItemTemplate` directive inside a `<kendo-menu-item>`
12
- * component. To define a template for all Menu items, nest the template inside the `<kendo-menu>` component.
13
- *
14
- * The available fields in the template context are:
15
- * - `item`&mdash;The item data.
16
- * - `index`&mdash;The item index.
17
- *
18
- * @example
19
- * ```ts-preview
20
- *
21
- * _@Component({
22
- * selector: 'my-app',
23
- * template: `
24
- * <kendo-menu>
25
- * <kendo-menu-item text="item2">
26
- * <ng-template kendoMenuItemTemplate let-item="item" let-index="index">
27
- * <div style="padding: 10px;">
28
- * My Template for: {{ item.text }} at index: {{ index }}
29
- * </div>
30
- * </ng-template>
31
- * </kendo-menu-item>
32
- * </kendo-menu>
33
- * `
34
- * })
35
- *
36
- * class AppComponent {
37
- * }
38
- * ```
39
- */
40
- var ItemTemplateDirective = /** @class */ (function () {
41
- function ItemTemplateDirective(templateRef) {
42
- this.templateRef = templateRef;
43
- }
44
- ItemTemplateDirective = tslib_1.__decorate([
45
- core_1.Directive({
46
- selector: '[kendoMenuItemTemplate]'
47
- }),
48
- tslib_1.__param(0, core_1.Optional()),
49
- tslib_1.__metadata("design:paramtypes", [core_1.TemplateRef])
50
- ], ItemTemplateDirective);
51
- return ItemTemplateDirective;
52
- }());
53
- exports.ItemTemplateDirective = ItemTemplateDirective;
package/dist/npm/utils.js DELETED
@@ -1,20 +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 core_1 = require("@angular/core");
8
- var kendo_angular_common_1 = require("@progress/kendo-angular-common");
9
- /**
10
- * @hidden
11
- */
12
- exports.defined = function (value) { return typeof value !== 'undefined'; };
13
- /**
14
- * @hidden
15
- */
16
- exports.bodyFactory = function () {
17
- if (kendo_angular_common_1.isDocumentAvailable()) {
18
- return new core_1.ElementRef(document.body);
19
- }
20
- };