@progress/kendo-angular-toolbar 5.0.3 → 6.0.0-dev.202204131416

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 (134) hide show
  1. package/bundles/kendo-angular-toolbar.umd.js +5 -0
  2. package/{dist/es2015/common → common}/constants.d.ts +0 -0
  3. package/{dist/es2015/common → common}/preventable-event.d.ts +0 -0
  4. package/{dist/es2015/common → common}/renderer-click.d.ts +0 -0
  5. package/{dist/es2015/direction.d.ts → direction.d.ts} +0 -0
  6. package/{dist/es2015/display-mode.d.ts → display-mode.d.ts} +0 -0
  7. package/{dist/es2015 → esm2015}/common/constants.js +0 -0
  8. package/{dist/es2015 → esm2015}/common/preventable-event.js +0 -0
  9. package/{dist/es → esm2015}/common/renderer-click.js +1 -0
  10. package/{dist/es2015 → esm2015}/direction.js +1 -0
  11. package/{dist/es2015 → esm2015}/display-mode.js +1 -0
  12. package/{dist/es2015 → esm2015}/group-selection-settings.js +1 -0
  13. package/{dist/es/common/constants.js → esm2015/kendo-angular-toolbar.js} +2 -2
  14. package/esm2015/localization/custom-messages.component.js +40 -0
  15. package/esm2015/localization/localized-toolbar-messages.directive.js +36 -0
  16. package/esm2015/localization/messages.js +23 -0
  17. package/{dist/es → esm2015}/main.js +0 -0
  18. package/{dist/es2015 → esm2015}/navigation.service.js +9 -9
  19. package/{dist/es2015 → esm2015}/package-metadata.js +1 -1
  20. package/{dist/es → esm2015}/popup-settings.js +1 -0
  21. package/{dist/es2015 → esm2015}/refresh.service.js +8 -10
  22. package/{dist/es → esm2015}/render-location.js +1 -0
  23. package/{dist/es2015 → esm2015}/renderer.component.js +36 -41
  24. package/{dist/es2015 → esm2015}/renderer.service.js +8 -7
  25. package/{dist/es → esm2015}/tool-options.js +1 -0
  26. package/{dist/es2015 → esm2015}/toolbar.component.js +158 -135
  27. package/{dist/es2015 → esm2015}/toolbar.module.js +27 -11
  28. package/{dist/es2015 → esm2015}/tools/toolbar-button.component.js +117 -114
  29. package/esm2015/tools/toolbar-buttongroup.component.js +267 -0
  30. package/esm2015/tools/toolbar-buttonlist.component.js +94 -0
  31. package/{dist/es2015 → esm2015}/tools/toolbar-dropdownbutton.component.js +119 -121
  32. package/esm2015/tools/toolbar-separator.component.js +68 -0
  33. package/{dist/es2015 → esm2015}/tools/toolbar-splitbutton.component.js +129 -125
  34. package/{dist/es2015 → esm2015}/tools/toolbar-tool.component.js +15 -19
  35. package/{dist/es2015 → esm2015}/util.js +0 -0
  36. package/{dist/fesm2015/index.js → fesm2015/kendo-angular-toolbar.js} +1015 -890
  37. package/{dist/es2015/group-selection-settings.d.ts → group-selection-settings.d.ts} +0 -0
  38. package/kendo-angular-toolbar.d.ts +9 -0
  39. package/{dist/es2015/localization → localization}/custom-messages.component.d.ts +4 -1
  40. package/{dist/es2015/localization → localization}/localized-toolbar-messages.directive.d.ts +3 -0
  41. package/{dist/es2015/localization → localization}/messages.d.ts +3 -0
  42. package/{dist/es2015/main.d.ts → main.d.ts} +0 -0
  43. package/{dist/es2015/navigation.service.d.ts → navigation.service.d.ts} +3 -0
  44. package/{dist/es2015/package-metadata.d.ts → package-metadata.d.ts} +0 -0
  45. package/package.json +34 -102
  46. package/{dist/es2015/popup-settings.d.ts → popup-settings.d.ts} +0 -0
  47. package/{dist/es2015/refresh.service.d.ts → refresh.service.d.ts} +3 -0
  48. package/{dist/es2015/render-location.d.ts → render-location.d.ts} +0 -0
  49. package/{dist/es2015/renderer.component.d.ts → renderer.component.d.ts} +4 -1
  50. package/{dist/es2015/renderer.service.d.ts → renderer.service.d.ts} +3 -0
  51. package/schematics/ngAdd/index.js +5 -2
  52. package/schematics/ngAdd/index.js.map +1 -1
  53. package/{dist/es2015/tool-options.d.ts → tool-options.d.ts} +0 -0
  54. package/{dist/es2015/toolbar.component.d.ts → toolbar.component.d.ts} +24 -17
  55. package/toolbar.module.d.ts +37 -0
  56. package/{dist/es2015/tools → tools}/toolbar-button.component.d.ts +10 -6
  57. package/{dist/es2015/tools → tools}/toolbar-buttongroup.component.d.ts +7 -5
  58. package/{dist/es2015/tools → tools}/toolbar-buttonlist.component.d.ts +3 -0
  59. package/{dist/es2015/tools → tools}/toolbar-dropdownbutton.component.d.ts +15 -10
  60. package/{dist/es2015/tools → tools}/toolbar-separator.component.d.ts +3 -0
  61. package/{dist/es2015/tools → tools}/toolbar-splitbutton.component.d.ts +14 -9
  62. package/{dist/es2015/tools → tools}/toolbar-tool.component.d.ts +5 -2
  63. package/{dist/es2015/util.d.ts → util.d.ts} +0 -0
  64. package/dist/cdn/js/kendo-angular-toolbar.js +0 -20
  65. package/dist/cdn/main.js +0 -5
  66. package/dist/es/common/preventable-event.js +0 -29
  67. package/dist/es/direction.js +0 -4
  68. package/dist/es/display-mode.js +0 -4
  69. package/dist/es/group-selection-settings.js +0 -4
  70. package/dist/es/index.js +0 -14
  71. package/dist/es/localization/custom-messages.component.js +0 -43
  72. package/dist/es/localization/localized-toolbar-messages.directive.js +0 -35
  73. package/dist/es/localization/messages.js +0 -22
  74. package/dist/es/navigation.service.js +0 -130
  75. package/dist/es/package-metadata.js +0 -15
  76. package/dist/es/refresh.service.js +0 -22
  77. package/dist/es/renderer.component.js +0 -132
  78. package/dist/es/renderer.service.js +0 -52
  79. package/dist/es/toolbar.component.js +0 -653
  80. package/dist/es/toolbar.module.js +0 -60
  81. package/dist/es/tools/toolbar-button.component.js +0 -310
  82. package/dist/es/tools/toolbar-buttongroup.component.js +0 -165
  83. package/dist/es/tools/toolbar-buttonlist.component.js +0 -66
  84. package/dist/es/tools/toolbar-dropdownbutton.component.js +0 -368
  85. package/dist/es/tools/toolbar-separator.component.js +0 -67
  86. package/dist/es/tools/toolbar-splitbutton.component.js +0 -380
  87. package/dist/es/tools/toolbar-tool.component.js +0 -76
  88. package/dist/es/util.js +0 -204
  89. package/dist/es2015/common/renderer-click.js +0 -4
  90. package/dist/es2015/index.d.ts +0 -14
  91. package/dist/es2015/index.js +0 -14
  92. package/dist/es2015/index.metadata.json +0 -1
  93. package/dist/es2015/localization/custom-messages.component.js +0 -35
  94. package/dist/es2015/localization/localized-toolbar-messages.directive.js +0 -31
  95. package/dist/es2015/localization/messages.js +0 -16
  96. package/dist/es2015/main.js +0 -14
  97. package/dist/es2015/popup-settings.js +0 -4
  98. package/dist/es2015/render-location.js +0 -4
  99. package/dist/es2015/tool-options.js +0 -4
  100. package/dist/es2015/toolbar.module.d.ts +0 -18
  101. package/dist/es2015/tools/toolbar-buttongroup.component.js +0 -216
  102. package/dist/es2015/tools/toolbar-buttonlist.component.js +0 -87
  103. package/dist/es2015/tools/toolbar-separator.component.js +0 -68
  104. package/dist/fesm5/index.js +0 -2677
  105. package/dist/npm/common/constants.js +0 -10
  106. package/dist/npm/common/preventable-event.js +0 -31
  107. package/dist/npm/common/renderer-click.js +0 -6
  108. package/dist/npm/direction.js +0 -6
  109. package/dist/npm/display-mode.js +0 -6
  110. package/dist/npm/group-selection-settings.js +0 -6
  111. package/dist/npm/index.js +0 -23
  112. package/dist/npm/localization/custom-messages.component.js +0 -45
  113. package/dist/npm/localization/localized-toolbar-messages.directive.js +0 -37
  114. package/dist/npm/localization/messages.js +0 -24
  115. package/dist/npm/main.js +0 -26
  116. package/dist/npm/navigation.service.js +0 -132
  117. package/dist/npm/package-metadata.js +0 -17
  118. package/dist/npm/popup-settings.js +0 -6
  119. package/dist/npm/refresh.service.js +0 -24
  120. package/dist/npm/render-location.js +0 -6
  121. package/dist/npm/renderer.component.js +0 -134
  122. package/dist/npm/renderer.service.js +0 -54
  123. package/dist/npm/tool-options.js +0 -6
  124. package/dist/npm/toolbar.component.js +0 -655
  125. package/dist/npm/toolbar.module.js +0 -62
  126. package/dist/npm/tools/toolbar-button.component.js +0 -312
  127. package/dist/npm/tools/toolbar-buttongroup.component.js +0 -167
  128. package/dist/npm/tools/toolbar-buttonlist.component.js +0 -68
  129. package/dist/npm/tools/toolbar-dropdownbutton.component.js +0 -370
  130. package/dist/npm/tools/toolbar-separator.component.js +0 -69
  131. package/dist/npm/tools/toolbar-splitbutton.component.js +0 -382
  132. package/dist/npm/tools/toolbar-tool.component.js +0 -78
  133. package/dist/npm/util.js +0 -209
  134. package/dist/systemjs/kendo-angular-toolbar.js +0 -5
@@ -1,2677 +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 { __decorate, __metadata, __extends } from 'tslib';
6
- import { Injectable, EventEmitter, NgZone, Input, Component, Output, ContentChildren, QueryList, ViewChild, ElementRef, TemplateRef, ViewContainerRef, ViewChildren, HostBinding, HostListener, Renderer2, ChangeDetectorRef, forwardRef, Directive, NgModule } from '@angular/core';
7
- import { PopupService, PopupModule } from '@progress/kendo-angular-popup';
8
- import { Keys, isDocumentAvailable, ResizeSensorComponent, ResizeSensorModule } from '@progress/kendo-angular-common';
9
- import { LocalizationService, L10N_PREFIX, ComponentMessages } from '@progress/kendo-angular-l10n';
10
- import { validatePackage } from '@progress/kendo-licensing';
11
- import { take, bufferTime, filter, takeUntil } from 'rxjs/operators';
12
- import { merge, fromEvent, Subject, Subscription } from 'rxjs';
13
- import { ButtonGroupComponent, DropDownButtonComponent, SplitButtonComponent, ButtonsModule } from '@progress/kendo-angular-buttons';
14
- import { CommonModule } from '@angular/common';
15
-
16
- /**
17
- * @hidden
18
- */
19
- var packageMetadata = {
20
- name: '@progress/kendo-angular-toolbar',
21
- productName: 'Kendo UI for Angular',
22
- productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
23
- publishDate: 1648459251,
24
- version: '',
25
- licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
26
- };
27
-
28
- /**
29
- * @hidden
30
- */
31
- var RefreshService = /** @class */ (function () {
32
- function RefreshService() {
33
- this.onRefresh = new EventEmitter();
34
- }
35
- RefreshService.prototype.refresh = function (tool) {
36
- this.onRefresh.emit(tool);
37
- };
38
- RefreshService = __decorate([
39
- Injectable()
40
- ], RefreshService);
41
- return RefreshService;
42
- }());
43
-
44
- /**
45
- * @hidden
46
- */
47
- var focusableRegex = /^(?:a|input|select|textarea|button|object)$/i;
48
- /**
49
- * @hidden
50
- */
51
- function outerWidth(element) {
52
- var width = element.offsetWidth;
53
- var style = getComputedStyle(element);
54
- width += parseFloat(style.marginLeft) || 0 + parseFloat(style.marginRight) || 0;
55
- return width;
56
- }
57
- /**
58
- * @hidden
59
- */
60
- function innerWidth(element) {
61
- var width = element.offsetWidth;
62
- var style = getComputedStyle(element);
63
- width -= parseFloat(style.paddingLeft) || 0 + parseFloat(style.borderLeftWidth) || 0;
64
- width -= parseFloat(style.paddingRight) || 0 + parseFloat(style.borderRightWidth) || 0;
65
- return width;
66
- }
67
- /**
68
- * @hidden
69
- */
70
- var closest = function (node, predicate) {
71
- while (node && !predicate(node)) {
72
- node = node.parentNode;
73
- }
74
- return node;
75
- };
76
- /**
77
- * @hidden
78
- */
79
- var isVisible = function (element) {
80
- var rect = element.getBoundingClientRect();
81
- var hasSize = rect.width > 0 && rect.height > 0;
82
- var hasPosition = rect.x !== 0 && rect.y !== 0;
83
- // Elements can have zero size due to styling, but they should still count as visible.
84
- // For example, the selection checkbox has no size, but is made visible through styling.
85
- return (hasSize || hasPosition) && window.getComputedStyle(element).visibility !== 'hidden';
86
- };
87
- /**
88
- * @hidden
89
- */
90
- var findElement = function (node, predicate, matchSelf) {
91
- if (matchSelf === void 0) { matchSelf = true; }
92
- if (!node) {
93
- return;
94
- }
95
- if (matchSelf && predicate(node)) {
96
- return node;
97
- }
98
- node = node.firstChild;
99
- while (node) {
100
- if (node.nodeType === 1) {
101
- var element = findElement(node, predicate);
102
- if (element) {
103
- return element;
104
- }
105
- }
106
- node = node.nextSibling;
107
- }
108
- };
109
- /**
110
- * @hidden
111
- */
112
- var isFocusable = function (element, checkVisibility) {
113
- if (checkVisibility === void 0) { checkVisibility = true; }
114
- if (element.tagName) {
115
- var tagName = element.tagName.toLowerCase();
116
- var tabIndex = element.getAttribute('tabIndex');
117
- var focusable = tabIndex !== null;
118
- if (focusableRegex.test(tagName)) {
119
- focusable = !element.disabled;
120
- }
121
- return focusable && (!checkVisibility || isVisible(element));
122
- }
123
- return false;
124
- };
125
- /**
126
- * @hidden
127
- */
128
- var findFocusable = function (element, checkVisibility) {
129
- if (checkVisibility === void 0) { checkVisibility = true; }
130
- return findElement(element, function (node) { return isFocusable(node, checkVisibility); });
131
- };
132
- /**
133
- * @hidden
134
- */
135
- var findFocusableChild = function (element, checkVisibility) {
136
- if (checkVisibility === void 0) { checkVisibility = true; }
137
- return findElement(element, function (node) { return isFocusable(node, checkVisibility); }, false);
138
- };
139
- /**
140
- * @hidden
141
- */
142
- var findFocusableSibling = function (element, checkVisibility, reverse) {
143
- if (checkVisibility === void 0) { checkVisibility = true; }
144
- var node = reverse ? element.prevSibling : element.nextSibling;
145
- while (node) {
146
- if (node.nodeType === 1) {
147
- var result = findElement(node, function (el) { return isFocusable(el, checkVisibility); });
148
- if (result) {
149
- return result;
150
- }
151
- }
152
- node = reverse ? node.prevSibling : node.nextSibling;
153
- }
154
- };
155
- /**
156
- * @hidden
157
- */
158
- var isPresent = function (value) { return value !== null && value !== undefined; };
159
- /**
160
- * @hidden
161
- */
162
- var makePeeker = function (collection) { return function (index) { return isPresent(collection[index]); }; };
163
- /**
164
- * @hidden
165
- */
166
- var getIndexOfFocused = function (prevKeyCode, nextKeyCode, collection) { return function (ev) {
167
- switch (ev.type) {
168
- case 'keydown':
169
- if (ev.keyCode === prevKeyCode) {
170
- return collection.length - 1;
171
- }
172
- if (ev.keyCode === nextKeyCode) {
173
- return 0;
174
- }
175
- break;
176
- case 'click':
177
- return collection.findIndex(function (be) { return be === ev.target || be.contains(ev.target); });
178
- case 'focus':
179
- return 0;
180
- default:
181
- return 0;
182
- }
183
- }; };
184
- /**
185
- * @hidden
186
- */
187
- var seekFocusedIndex = function (prevKeyCode, nextKeyCode, seeker) { return function (startIndex, ev) {
188
- switch (ev.keyCode) {
189
- case prevKeyCode:
190
- return seeker(startIndex - 1) ? startIndex - 1 : startIndex;
191
- case nextKeyCode:
192
- return seeker(startIndex + 1) ? startIndex + 1 : startIndex;
193
- default:
194
- return startIndex;
195
- }
196
- }; };
197
- /**
198
- * @hidden
199
- */
200
- var areEqual = function (first) { return function (second) { return first === second; }; };
201
- /**
202
- * @hidden
203
- */
204
- var getNextKey = function (rtl) {
205
- if (rtl === void 0) { rtl = false; }
206
- return function (overflows) {
207
- if (overflows === void 0) { overflows = true; }
208
- return overflows ? Keys.ArrowDown : rtl ? Keys.ArrowLeft : Keys.ArrowRight;
209
- };
210
- };
211
- /**
212
- * @hidden
213
- */
214
- var getPrevKey = function (rtl) {
215
- if (rtl === void 0) { rtl = false; }
216
- return function (overflows) {
217
- if (overflows === void 0) { overflows = true; }
218
- return overflows ? Keys.ArrowUp : rtl ? Keys.ArrowRight : Keys.ArrowLeft;
219
- };
220
- };
221
- /**
222
- * @hidden
223
- */
224
- var getValueForLocation = function (property, displayMode, overflows) {
225
- switch (displayMode) {
226
- case 'toolbar':
227
- return overflows ? undefined : property;
228
- case 'overflow':
229
- return overflows ? property : undefined;
230
- default:
231
- return property;
232
- }
233
- };
234
-
235
- /**
236
- * @hidden
237
- */
238
- var NavigationService = /** @class */ (function () {
239
- function NavigationService(zone) {
240
- this.zone = zone;
241
- this.focused = { renderedTool: null, index: -1 };
242
- this.renderedTools = [];
243
- this.isPopupFocused = false;
244
- this.isOverflowButtonFocused = false;
245
- }
246
- NavigationService.prototype.setRenderedTools = function (rts) {
247
- this.renderedTools = rts.slice();
248
- };
249
- NavigationService.prototype.click = function (_a) {
250
- var context = _a.context, ev = _a.event;
251
- if (this.focused.renderedTool !== context && ev) {
252
- this.focus(context, ev);
253
- }
254
- };
255
- NavigationService.prototype.moveFocusToToolBar = function () {
256
- this.isPopupFocused = false;
257
- this.focusOverflowButton();
258
- };
259
- NavigationService.prototype.moveFocusToPopup = function () {
260
- this.isPopupFocused = true;
261
- this.blurOverflowButton();
262
- this.focus();
263
- };
264
- NavigationService.prototype.focusNext = function (ev) {
265
- if (!this.isOverflowButtonFocused && this.focused.renderedTool && !this.focused.renderedTool.tool.handleKey(ev)) {
266
- var nextRT = this.getFocusableTools().slice(this.focused.index + 1)[0];
267
- if (nextRT) {
268
- this.focus(nextRT, ev);
269
- }
270
- else {
271
- if (this.isOverflowButtonVisible() && !this.isPopupFocused) {
272
- this.focusOverflowButton();
273
- }
274
- }
275
- }
276
- };
277
- NavigationService.prototype.focusPrev = function (ev) {
278
- if (this.isOverflowButtonFocused) {
279
- var lastFocusableRT = this.getFocusableTools().reverse()[0];
280
- this.focus(lastFocusableRT, ev);
281
- }
282
- else if (this.focused.renderedTool && !this.focused.renderedTool.tool.handleKey(ev)) {
283
- var prevRT = this.getFocusableTools()
284
- .slice(0, this.focused.index)
285
- .reverse()[0];
286
- if (prevRT) {
287
- this.focus(prevRT, ev);
288
- }
289
- }
290
- };
291
- NavigationService.prototype.resetNavigation = function () {
292
- this.blurOverflowButton();
293
- this.focused.renderedTool = null;
294
- this.focused.index = -1;
295
- };
296
- NavigationService.prototype.focusFirst = function (ev) {
297
- var firstTool = this.getFocusableTools()[0];
298
- var overFlowButton = this.overflowButton;
299
- if (firstTool) {
300
- this.focused.renderedTool = firstTool;
301
- this.focused.index = this.getFocusableTools().findIndex(function (rt) { return rt === firstTool; });
302
- this.focus(firstTool, ev);
303
- }
304
- else if (overFlowButton) {
305
- overFlowButton.nativeElement.focus();
306
- }
307
- };
308
- NavigationService.prototype.getFocusableTools = function () {
309
- var _this = this;
310
- return this.renderedTools.filter(function (rt) { return rt.tool.overflows === _this.isPopupFocused && rt.tool.canFocus(); });
311
- };
312
- NavigationService.prototype.focus = function (renderedTool, ev) {
313
- var _this = this;
314
- // running the code below in onStable fixes issue #2939
315
- this.zone.onStable.pipe(take(1)).subscribe(function () {
316
- if (!renderedTool) {
317
- var focusableRTs = _this.getFocusableTools();
318
- var lastFocusedRT_1 = focusableRTs.find(function (rt) { return rt === _this.focused.renderedTool; }) || focusableRTs[0];
319
- // guard against only disabled tools
320
- if (lastFocusedRT_1) {
321
- _this.focused.renderedTool = lastFocusedRT_1;
322
- _this.focused.index = _this.getFocusableTools().findIndex(function (rt) { return rt === lastFocusedRT_1; });
323
- // if event is undefined, then this means that the tool is the first one in the overflow popup
324
- lastFocusedRT_1.tool.focus(ev);
325
- }
326
- }
327
- else if (renderedTool.tool.canFocus && renderedTool.tool.canFocus()) {
328
- _this.focused.renderedTool = renderedTool;
329
- _this.focused.index = _this.getFocusableTools().findIndex(function (rt) { return rt === renderedTool; });
330
- renderedTool.tool.focus(ev);
331
- _this.blurOverflowButton();
332
- }
333
- });
334
- };
335
- NavigationService.prototype.blurOverflowButton = function () {
336
- if (this.overflowButton) {
337
- this.isOverflowButtonFocused = false;
338
- this.overflowButton.nativeElement.tabIndex = -1;
339
- }
340
- };
341
- NavigationService.prototype.focusOverflowButton = function () {
342
- this.isOverflowButtonFocused = true;
343
- this.overflowButton.nativeElement.tabIndex = 0;
344
- this.overflowButton.nativeElement.focus();
345
- };
346
- NavigationService.prototype.isOverflowButtonVisible = function () {
347
- return (isPresent(this.overflowButton) &&
348
- window.getComputedStyle(this.overflowButton.nativeElement).getPropertyValue('visibility') === 'visible');
349
- };
350
- NavigationService = __decorate([
351
- Injectable(),
352
- __metadata("design:paramtypes", [NgZone])
353
- ], NavigationService);
354
- return NavigationService;
355
- }());
356
-
357
- /**
358
- * Represents the Base ToolBar Tool component for Angular.
359
- * Extend this class to create custom tools.
360
- */
361
- var ToolBarToolComponent = /** @class */ (function () {
362
- function ToolBarToolComponent() {
363
- this.tabIndex = -1; //Focus movement inside the toolbar is managed using roving tabindex.
364
- this.overflows = true;
365
- // this should be replaced with showTool: DisplayMode = 'both';
366
- /**
367
- * @hidden
368
- */
369
- this.responsive = true;
370
- }
371
- Object.defineProperty(ToolBarToolComponent.prototype, "toolbarDisplay", {
372
- get: function () {
373
- return this.overflows ? 'none' : 'inline-block';
374
- },
375
- enumerable: true,
376
- configurable: true
377
- });
378
- Object.defineProperty(ToolBarToolComponent.prototype, "overflowDisplay", {
379
- get: function () {
380
- return this.overflows ? 'block' : 'none';
381
- },
382
- enumerable: true,
383
- configurable: true
384
- });
385
- /**
386
- * Determines if the tool can be focused.
387
- * If the returned value is `false`, the tool will not be part of the keyboard navigation.
388
- * @returns `true` if the tool should take part in keyboard navigation.
389
- */
390
- ToolBarToolComponent.prototype.canFocus = function () {
391
- return false;
392
- };
393
- /**
394
- * Called when the tool is focused.
395
- * The method accepts as argument the original browser event, which can be a `KeyboardEvent`, `MouseEvent` or `FocusEvent`.
396
- * @param {Event} ev - This is the event that caused the tool to be focused.
397
- */
398
- // @ts-ignore
399
- ToolBarToolComponent.prototype.focus = function (ev) {
400
- /* noop */
401
- };
402
- /**
403
- * Called when the tool is focused and one of the arrow keys is pressed.
404
- * The returned boolean value determines whether the `ToolBarComponent` will move the focus to the next/previous `ToolBarToolComponent`
405
- * ([see example]({% slug customcontroltypes_toolbar %}#toc-adding-keyboard-navigation)).
406
- * @param {KeyboardEvent} ev - The last pressed arrow key
407
- * @returns
408
- */
409
- // @ts-ignore
410
- ToolBarToolComponent.prototype.handleKey = function (ev) {
411
- return false;
412
- };
413
- __decorate([
414
- Input(),
415
- __metadata("design:type", Boolean)
416
- ], ToolBarToolComponent.prototype, "responsive", void 0);
417
- ToolBarToolComponent = __decorate([
418
- Component({
419
- // tslint:disable-next-line:component-selector
420
- selector: 'toolbar-tool',
421
- template: ""
422
- })
423
- ], ToolBarToolComponent);
424
- return ToolBarToolComponent;
425
- }());
426
-
427
- /**
428
- * @hidden
429
- */
430
- var PreventableEvent = /** @class */ (function () {
431
- function PreventableEvent() {
432
- this.prevented = false;
433
- }
434
- /**
435
- * Prevents the default action for a specified event.
436
- * In this way, the source component suppresses the built-in behavior that follows the event.
437
- */
438
- PreventableEvent.prototype.preventDefault = function () {
439
- this.prevented = true;
440
- };
441
- /**
442
- * If the event is prevented by any of its subscribers, returns `true`.
443
- *
444
- * @returns `true` if the default action was prevented. Otherwise, returns `false`.
445
- */
446
- PreventableEvent.prototype.isDefaultPrevented = function () {
447
- return this.prevented;
448
- };
449
- return PreventableEvent;
450
- }());
451
-
452
- /**
453
- * @hidden
454
- */
455
- var defaultPopupWidth = '150px';
456
-
457
- var getInitialPopupSettings = function (isRtl) { return ({
458
- animate: true,
459
- anchorAlign: { horizontal: isRtl ? 'left' : 'right', vertical: 'bottom' },
460
- popupAlign: { horizontal: isRtl ? 'left' : 'right', vertical: 'top' }
461
- }); };
462
- /**
463
- * Represents the [Kendo UI ToolBar component for Angular]({% slug overview_toolbar %}).
464
- */
465
- var ToolBarComponent = /** @class */ (function () {
466
- function ToolBarComponent(localization, popupService, refreshService, navigationService, element, zone, renderer, _cdr) {
467
- this.localization = localization;
468
- this.popupService = popupService;
469
- this.refreshService = refreshService;
470
- this.navigationService = navigationService;
471
- this.element = element;
472
- this.zone = zone;
473
- this.renderer = renderer;
474
- this._cdr = _cdr;
475
- /**
476
- * Hides the overflowing tools in a popup.
477
- */
478
- this.overflow = false;
479
- /**
480
- * Specifies the [`tabindex`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the ToolBar.
481
- */
482
- this.tabindex = 0;
483
- /**
484
- * Fires when the overflow popup of the ToolBar is opened.
485
- */
486
- this.open = new EventEmitter();
487
- /**
488
- * Fires when the overflow popup of the ToolBar is closed.
489
- */
490
- this.close = new EventEmitter();
491
- this.hostClasses = true;
492
- this.cancelRenderedToolsSubscription$ = new Subject();
493
- this.subscriptions = new Subscription();
494
- validatePackage(packageMetadata);
495
- this.direction = localization.rtl ? 'rtl' : 'ltr';
496
- }
497
- Object.defineProperty(ToolBarComponent.prototype, "resizable", {
498
- get: function () {
499
- return this.overflow;
500
- },
501
- /**
502
- * @hidden
503
- */
504
- set: function (value) {
505
- this.overflow = value;
506
- },
507
- enumerable: true,
508
- configurable: true
509
- });
510
- Object.defineProperty(ToolBarComponent.prototype, "popupSettings", {
511
- get: function () {
512
- return this._popupSettings || getInitialPopupSettings(this.localization.rtl);
513
- },
514
- /**
515
- * Configures the popup of the ToolBar drop-down list.
516
- *
517
- * The available options are:
518
- * - `animate: Boolean`—Controls the popup animation. By default, the open and close animations are enabled.
519
- * - `popupClass: String`—Specifies a list of CSS classes that are used to style the popup.
520
- */
521
- set: function (settings) {
522
- this._popupSettings = Object.assign({}, getInitialPopupSettings(this.localization.rtl), settings);
523
- },
524
- enumerable: true,
525
- configurable: true
526
- });
527
- Object.defineProperty(ToolBarComponent.prototype, "tabIndex", {
528
- get: function () {
529
- return this.tabindex;
530
- },
531
- /**
532
- * @hidden
533
- */
534
- set: function (tabIndex) {
535
- this.tabindex = tabIndex;
536
- },
537
- enumerable: true,
538
- configurable: true
539
- });
540
- Object.defineProperty(ToolBarComponent.prototype, "appendTo", {
541
- get: function () {
542
- var appendTo = this.popupSettings.appendTo;
543
- if (!appendTo || appendTo === 'root') {
544
- return undefined;
545
- }
546
- return appendTo === 'component' ? this.container : appendTo;
547
- },
548
- enumerable: true,
549
- configurable: true
550
- });
551
- Object.defineProperty(ToolBarComponent.prototype, "popupOpen", {
552
- get: function () {
553
- return this._open;
554
- },
555
- set: function (open) {
556
- if (this.popupOpen === open) {
557
- return;
558
- }
559
- var eventArgs = new PreventableEvent();
560
- if (open) {
561
- this.open.emit(eventArgs);
562
- }
563
- else {
564
- this.close.emit(eventArgs);
565
- }
566
- if (eventArgs.isDefaultPrevented()) {
567
- return;
568
- }
569
- this.toggle(open);
570
- },
571
- enumerable: true,
572
- configurable: true
573
- });
574
- /**
575
- * @hidden
576
- */
577
- ToolBarComponent.prototype.onFocus = function (ev) {
578
- this.navigationService.resetNavigation();
579
- this.navigationService.focusFirst(ev);
580
- // prevents ExpressionChangedAfterItHasBeenCheckedError when tools with popup are opened/closed asynchronously
581
- this.element.nativeElement.setAttribute('tabindex', '-1');
582
- };
583
- /**
584
- * @hidden
585
- */
586
- ToolBarComponent.prototype.onFocusOut = function (event) {
587
- var _this = this;
588
- // prevents ExpressionChangedAfterItHasBeenCheckedError when tools with popup are opened/closed asynchronously
589
- if (closest(event.relatedTarget, function (el) { return el === _this.element.nativeElement; })) {
590
- this.element.nativeElement.setAttribute('tabindex', '-1');
591
- return;
592
- }
593
- this.element.nativeElement.setAttribute('tabindex', this.tabindex.toString());
594
- };
595
- Object.defineProperty(ToolBarComponent.prototype, "getRole", {
596
- get: function () {
597
- return 'toolbar';
598
- },
599
- enumerable: true,
600
- configurable: true
601
- });
602
- Object.defineProperty(ToolBarComponent.prototype, "getDir", {
603
- get: function () {
604
- return this.direction;
605
- },
606
- enumerable: true,
607
- configurable: true
608
- });
609
- Object.defineProperty(ToolBarComponent.prototype, "resizableClass", {
610
- get: function () {
611
- return this.overflow;
612
- },
613
- enumerable: true,
614
- configurable: true
615
- });
616
- ToolBarComponent.prototype.ngAfterViewInit = function () {
617
- var _this = this;
618
- var element = this.element.nativeElement;
619
- if (!element.getAttribute('tabindex')) {
620
- this.element.nativeElement.setAttribute('tabindex', '0');
621
- }
622
- this.zone.runOutsideAngular(function () {
623
- _this.toolbarKeydownListener = _this.renderer.listen(_this.element.nativeElement, 'keydown', function (ev) {
624
- switch (ev.keyCode) {
625
- case Keys.ArrowLeft:
626
- _this.zone.run(function () {
627
- ev.preventDefault();
628
- _this.direction === 'ltr' ? _this.navigationService.focusPrev(ev) : _this.navigationService.focusNext(ev);
629
- // prevents ExpressionChangedAfterItHasBeenCheckedError when tools with popup are opened/closed asynchronously
630
- _this.element.nativeElement.setAttribute('tabindex', '-1');
631
- });
632
- break;
633
- case Keys.ArrowRight:
634
- _this.zone.run(function () {
635
- ev.preventDefault();
636
- _this.direction === 'ltr' ? _this.navigationService.focusNext(ev) : _this.navigationService.focusPrev(ev);
637
- // prevents ExpressionChangedAfterItHasBeenCheckedError when tools with popup are opened/closed asynchronously
638
- _this.element.nativeElement.setAttribute('tabindex', '-1');
639
- });
640
- break;
641
- case Keys.Tab:
642
- _this.zone.run(function () { return _this.navigationService.resetNavigation(); });
643
- break;
644
- case Keys.Escape:
645
- _this.zone.run(function () { return _this.toggle(false); });
646
- break;
647
- default:
648
- break;
649
- }
650
- });
651
- });
652
- if (this.overflow) {
653
- this.subscriptions.add(merge(
654
- // trigger resizing calculations once every 200ms instead of each time the resize event is emitted
655
- this.resizeSensor.resize.pipe(bufferTime(200), filter(function (v) { return v.length > 0; })), this.renderedTools.changes).subscribe(function () { _this.onResize(); }));
656
- // because of https://github.com/telerik/kendo-angular-buttons/pull/276
657
- // calling onResize twice is the trade-off for removing the manual ChangeDetection
658
- // triggering altogether - it ensures correct layout and calculations
659
- // when some tools need overflow on initial rendering
660
- this.zone.runOutsideAngular(function () { return setTimeout(function () { _this.onResize(); _this.onResize(); }); });
661
- this.navigationService.overflowButton = this.overflowButton;
662
- }
663
- this.navigationService.setRenderedTools(this.renderedTools.toArray());
664
- this.subscriptions.add(this.renderedTools.changes.subscribe(function (rts) {
665
- return _this.navigationService.setRenderedTools(rts.toArray());
666
- }));
667
- };
668
- ToolBarComponent.prototype.ngOnInit = function () {
669
- var _this = this;
670
- this.subscriptions.add(this.localization.changes.subscribe(function (_a) {
671
- var rtl = _a.rtl;
672
- return (_this.direction = rtl ? 'rtl' : 'ltr');
673
- }));
674
- if (isDocumentAvailable()) {
675
- this.zone.runOutsideAngular(function () {
676
- return _this.subscriptions.add(fromEvent(document, 'click')
677
- .pipe(filter(function () { return !!_this.popupRef; }), filter(function (ev) { return !_this.popupRef.popup.instance.container.nativeElement.contains(ev.target); }), filter(function (ev) { return !_this.overflowButton.nativeElement.contains(ev.target); }))
678
- .subscribe(function () {
679
- _this.zone.run(function () {
680
- _this.popupOpen = false;
681
- });
682
- }));
683
- });
684
- }
685
- };
686
- ToolBarComponent.prototype.ngOnChanges = function (changes) {
687
- if (changes.tabindex) {
688
- // prevents ExpressionChangedAfterItHasBeenCheckedError when tools with popup are opened/closed asynchronously
689
- this.element.nativeElement.setAttribute('tabindex', changes.tabindex.currentValue.toString());
690
- }
691
- };
692
- ToolBarComponent.prototype.ngOnDestroy = function () {
693
- if (this.popupRef) {
694
- this.popupRef.close();
695
- }
696
- if (this.toolbarKeydownListener) {
697
- this.toolbarKeydownListener();
698
- }
699
- this.cancelRenderedToolsSubscription$.next();
700
- this.subscriptions.unsubscribe();
701
- };
702
- Object.defineProperty(ToolBarComponent.prototype, "moreToolsTitle", {
703
- /**
704
- * @hidden
705
- */
706
- get: function () {
707
- return this.localization.get('moreToolsTitle');
708
- },
709
- enumerable: true,
710
- configurable: true
711
- });
712
- Object.defineProperty(ToolBarComponent.prototype, "cdr", {
713
- /**
714
- * @hidden
715
- */
716
- get: function () {
717
- return this._cdr;
718
- },
719
- enumerable: true,
720
- configurable: true
721
- });
722
- /**
723
- * @hidden
724
- */
725
- ToolBarComponent.prototype.onRendererClick = function (data) {
726
- this.navigationService.click(data);
727
- this.element.nativeElement.setAttribute('tabindex', '-1');
728
- };
729
- /**
730
- * @hidden
731
- */
732
- ToolBarComponent.prototype.showPopup = function () {
733
- this.popupOpen = !this.popupOpen;
734
- this.navigationService.click({ context: undefined, event: undefined });
735
- };
736
- /**
737
- * Toggles the visibility of the overflow popup.
738
- */
739
- ToolBarComponent.prototype.toggle = function (popupOpen) {
740
- this._open = popupOpen !== undefined ? popupOpen : !this.popupOpen;
741
- if (this.popupRef) {
742
- this.popupRef.close();
743
- this.popupRef = null;
744
- }
745
- if (this.popupOpen) {
746
- this.popupRef = this.popupService.open({
747
- anchor: this.overflowButton,
748
- anchorAlign: this.popupSettings.anchorAlign,
749
- popupAlign: this.popupSettings.popupAlign,
750
- content: this.popupTemplate,
751
- appendTo: this.appendTo,
752
- animate: this.popupSettings.animate,
753
- popupClass: this.popupSettings.popupClass,
754
- positionMode: 'absolute'
755
- });
756
- this.setPopupContentDimensions();
757
- this.popupRef.popupOpen.subscribe(this.onPopupOpen.bind(this));
758
- this.popupRef.popupClose.subscribe(this.onPopupClose.bind(this));
759
- }
760
- };
761
- /**
762
- * @hidden
763
- */
764
- ToolBarComponent.prototype.onResize = function () {
765
- var _this = this;
766
- if (isDocumentAvailable()) {
767
- var containerWidth = innerWidth(this.element.nativeElement) - this.overflowAnchorWidth;
768
- this.shrink(containerWidth, this.childrenWidth);
769
- this.stretch(containerWidth, this.childrenWidth);
770
- this.zone.onStable.pipe(take(1)).subscribe(function () {
771
- _this.displayAnchor();
772
- });
773
- }
774
- this.resizeSensor.acceptSize();
775
- };
776
- /**
777
- * @hidden
778
- */
779
- ToolBarComponent.prototype.onPopupOpen = function () {
780
- var _this = this;
781
- this.zone.runOutsideAngular(function () {
782
- _this.overflowKeydownListener = _this.renderer.listen(_this.popupRef.popupElement, 'keydown', function (ev) {
783
- switch (ev.keyCode) {
784
- case Keys.ArrowUp:
785
- _this.zone.run(function () {
786
- ev.preventDefault();
787
- _this.navigationService.focusPrev(ev);
788
- });
789
- break;
790
- case Keys.ArrowDown:
791
- _this.zone.run(function () {
792
- ev.preventDefault();
793
- _this.navigationService.focusNext(ev);
794
- });
795
- break;
796
- case Keys.Escape:
797
- _this.zone.run(function () { return _this.toggle(false); });
798
- break;
799
- case Keys.Tab:
800
- _this.zone.run(function () {
801
- _this.toggle(false);
802
- _this.navigationService.resetNavigation();
803
- });
804
- break;
805
- default:
806
- break;
807
- }
808
- });
809
- });
810
- this.cancelRenderedToolsSubscription$.next();
811
- this.navigationService.moveFocusToPopup();
812
- this.navigationService.setRenderedTools(this.overflowRenderedTools.toArray());
813
- this.overflowRenderedTools.changes
814
- .pipe(takeUntil(this.cancelRenderedToolsSubscription$))
815
- .subscribe(function (rts) { return _this.navigationService.setRenderedTools(rts.toArray()); });
816
- };
817
- /**
818
- * @hidden
819
- */
820
- ToolBarComponent.prototype.onPopupClose = function () {
821
- var _this = this;
822
- this.cancelRenderedToolsSubscription$.next();
823
- this.navigationService.setRenderedTools(this.renderedTools.toArray());
824
- this.renderedTools.changes
825
- .pipe(takeUntil(this.cancelRenderedToolsSubscription$))
826
- .subscribe(function (rts) { return _this.navigationService.setRenderedTools(rts.toArray()); });
827
- this.navigationService.moveFocusToToolBar();
828
- if (this.overflowKeydownListener) {
829
- this.overflowKeydownListener();
830
- }
831
- };
832
- ToolBarComponent.prototype.displayAnchor = function () {
833
- var visibility = this.allTools.filter(function (t) { return t.overflows && t.responsive; }).length > 0 ? 'visible' : 'hidden';
834
- this.renderer.setStyle(this.overflowButton.nativeElement, 'visibility', visibility);
835
- };
836
- Object.defineProperty(ToolBarComponent.prototype, "popupWidth", {
837
- get: function () {
838
- if (!this.popupSettings || !this.popupSettings.width) {
839
- return defaultPopupWidth;
840
- }
841
- return isNaN(this.popupSettings.width) ? this.popupSettings.width : this.popupSettings.width + "px";
842
- },
843
- enumerable: true,
844
- configurable: true
845
- });
846
- Object.defineProperty(ToolBarComponent.prototype, "popupHeight", {
847
- get: function () {
848
- if (!this.popupSettings || !this.popupSettings.height) {
849
- return;
850
- }
851
- return isNaN(this.popupSettings.height) ? this.popupSettings.height : this.popupSettings.height + "px";
852
- },
853
- enumerable: true,
854
- configurable: true
855
- });
856
- Object.defineProperty(ToolBarComponent.prototype, "overflowAnchorWidth", {
857
- get: function () {
858
- if (!this.overflow) {
859
- return 0;
860
- }
861
- if (!this.cachedOverflowAnchorWidth) {
862
- this.cachedOverflowAnchorWidth = outerWidth(this.overflowButton.nativeElement);
863
- }
864
- return this.cachedOverflowAnchorWidth;
865
- },
866
- enumerable: true,
867
- configurable: true
868
- });
869
- Object.defineProperty(ToolBarComponent.prototype, "gap", {
870
- get: function () {
871
- if (isPresent(this.cachedGap)) {
872
- return this.cachedGap;
873
- }
874
- var computedGap = getComputedStyle(this.element.nativeElement).gap;
875
- this.cachedGap = isPresent(computedGap) ? parseInt(computedGap, 10) : 0;
876
- return this.cachedGap;
877
- },
878
- enumerable: true,
879
- configurable: true
880
- });
881
- Object.defineProperty(ToolBarComponent.prototype, "childrenWidth", {
882
- get: function () {
883
- var _this = this;
884
- var width = this.renderedTools.reduce(function (totalWidth, tool) { return tool.width + totalWidth + (tool.isDisplayed() ? _this.gap : 0); }, 0);
885
- return Math.ceil(width);
886
- },
887
- enumerable: true,
888
- configurable: true
889
- });
890
- Object.defineProperty(ToolBarComponent.prototype, "visibleTools", {
891
- get: function () {
892
- return this.allTools.filter(function (tool) {
893
- return tool.overflows === false;
894
- });
895
- },
896
- enumerable: true,
897
- configurable: true
898
- });
899
- Object.defineProperty(ToolBarComponent.prototype, "overflowTools", {
900
- get: function () {
901
- return this.allTools.filter(function (tool) {
902
- return tool.overflows === true;
903
- });
904
- },
905
- enumerable: true,
906
- configurable: true
907
- });
908
- ToolBarComponent.prototype.shrink = function (containerWidth, childrenWidth) {
909
- var width;
910
- if (containerWidth < childrenWidth) {
911
- for (var i = this.visibleTools.length - 1; i >= 0; i--) {
912
- if (containerWidth > childrenWidth) {
913
- break;
914
- }
915
- else {
916
- width = this.hideLastVisibleTool();
917
- childrenWidth -= width;
918
- }
919
- }
920
- }
921
- };
922
- ToolBarComponent.prototype.stretch = function (containerWidth, childrenWidth) {
923
- var width;
924
- if (containerWidth > childrenWidth) {
925
- for (var i = this.overflowTools.length - 1; i >= 0; i--) {
926
- width = this.showFirstHiddenTool(containerWidth, childrenWidth);
927
- if (width) {
928
- childrenWidth += width;
929
- }
930
- else {
931
- break;
932
- }
933
- }
934
- }
935
- };
936
- ToolBarComponent.prototype.hideLastVisibleTool = function () {
937
- var tool = this.visibleTools[this.visibleTools.length - 1];
938
- var renderedElement = this.renderedTools.find(function (r) {
939
- return r.tool === tool;
940
- });
941
- var width = renderedElement.width;
942
- tool.overflows = true;
943
- this.refreshService.refresh(tool);
944
- return width;
945
- };
946
- ToolBarComponent.prototype.showFirstHiddenTool = function (containerWidth, childrenWidth) {
947
- var tool = this.overflowTools[0];
948
- var renderedElement = this.renderedTools.find(function (r) { return r.tool === tool; });
949
- tool.overflows = false;
950
- tool.visibility = 'hidden';
951
- this.refreshService.refresh(tool);
952
- if (containerWidth > childrenWidth + renderedElement.width) {
953
- tool.visibility = 'visible';
954
- this.refreshService.refresh(tool);
955
- }
956
- else {
957
- tool.overflows = true;
958
- this.refreshService.refresh(tool);
959
- }
960
- return renderedElement.width; // returns 0 if `overflows` is true
961
- };
962
- ToolBarComponent.prototype.setPopupContentDimensions = function () {
963
- var popupContentContainer = this.popupRef.popup.instance.contentContainer.nativeElement;
964
- popupContentContainer.style.width = this.popupWidth;
965
- popupContentContainer.style.height = this.popupHeight;
966
- popupContentContainer.style.overflow = 'auto';
967
- };
968
- __decorate([
969
- Input(),
970
- __metadata("design:type", Boolean)
971
- ], ToolBarComponent.prototype, "overflow", void 0);
972
- __decorate([
973
- Input(),
974
- __metadata("design:type", Boolean),
975
- __metadata("design:paramtypes", [Boolean])
976
- ], ToolBarComponent.prototype, "resizable", null);
977
- __decorate([
978
- Input(),
979
- __metadata("design:type", Object),
980
- __metadata("design:paramtypes", [Object])
981
- ], ToolBarComponent.prototype, "popupSettings", null);
982
- __decorate([
983
- Input(),
984
- __metadata("design:type", Number)
985
- ], ToolBarComponent.prototype, "tabindex", void 0);
986
- __decorate([
987
- Input('tabIndex'),
988
- __metadata("design:type", Number),
989
- __metadata("design:paramtypes", [Number])
990
- ], ToolBarComponent.prototype, "tabIndex", null);
991
- __decorate([
992
- Output(),
993
- __metadata("design:type", EventEmitter)
994
- ], ToolBarComponent.prototype, "open", void 0);
995
- __decorate([
996
- Output(),
997
- __metadata("design:type", EventEmitter)
998
- ], ToolBarComponent.prototype, "close", void 0);
999
- __decorate([
1000
- ContentChildren(ToolBarToolComponent),
1001
- __metadata("design:type", QueryList)
1002
- ], ToolBarComponent.prototype, "allTools", void 0);
1003
- __decorate([
1004
- ViewChild('overflowButton', { static: false }),
1005
- __metadata("design:type", ElementRef)
1006
- ], ToolBarComponent.prototype, "overflowButton", void 0);
1007
- __decorate([
1008
- ViewChild('popupTemplate', { static: true }),
1009
- __metadata("design:type", TemplateRef)
1010
- ], ToolBarComponent.prototype, "popupTemplate", void 0);
1011
- __decorate([
1012
- ViewChild('resizeSensor', { static: false }),
1013
- __metadata("design:type", ResizeSensorComponent)
1014
- ], ToolBarComponent.prototype, "resizeSensor", void 0);
1015
- __decorate([
1016
- ViewChild('container', { read: ViewContainerRef, static: true }),
1017
- __metadata("design:type", ViewContainerRef)
1018
- ], ToolBarComponent.prototype, "container", void 0);
1019
- __decorate([
1020
- ViewChildren('toolbarRenderer'),
1021
- __metadata("design:type", QueryList)
1022
- ], ToolBarComponent.prototype, "renderedTools", void 0);
1023
- __decorate([
1024
- ViewChildren('overflowRenderer'),
1025
- __metadata("design:type", QueryList)
1026
- ], ToolBarComponent.prototype, "overflowRenderedTools", void 0);
1027
- __decorate([
1028
- HostBinding('class.k-widget'),
1029
- HostBinding('class.k-toolbar'),
1030
- __metadata("design:type", Boolean)
1031
- ], ToolBarComponent.prototype, "hostClasses", void 0);
1032
- __decorate([
1033
- HostListener('focus', ['$event']),
1034
- __metadata("design:type", Function),
1035
- __metadata("design:paramtypes", [Object]),
1036
- __metadata("design:returntype", void 0)
1037
- ], ToolBarComponent.prototype, "onFocus", null);
1038
- __decorate([
1039
- HostListener('focusout', ['$event']),
1040
- __metadata("design:type", Function),
1041
- __metadata("design:paramtypes", [Object]),
1042
- __metadata("design:returntype", void 0)
1043
- ], ToolBarComponent.prototype, "onFocusOut", null);
1044
- __decorate([
1045
- HostBinding('attr.role'),
1046
- __metadata("design:type", String),
1047
- __metadata("design:paramtypes", [])
1048
- ], ToolBarComponent.prototype, "getRole", null);
1049
- __decorate([
1050
- HostBinding('attr.dir'),
1051
- __metadata("design:type", String),
1052
- __metadata("design:paramtypes", [])
1053
- ], ToolBarComponent.prototype, "getDir", null);
1054
- __decorate([
1055
- HostBinding('class.k-toolbar-resizable'),
1056
- __metadata("design:type", Boolean),
1057
- __metadata("design:paramtypes", [])
1058
- ], ToolBarComponent.prototype, "resizableClass", null);
1059
- ToolBarComponent = __decorate([
1060
- Component({
1061
- exportAs: 'kendoToolBar',
1062
- providers: [
1063
- RefreshService,
1064
- NavigationService,
1065
- LocalizationService,
1066
- {
1067
- provide: L10N_PREFIX,
1068
- useValue: 'kendo.toolbar'
1069
- }
1070
- ],
1071
- selector: 'kendo-toolbar',
1072
- template: "\n <ng-container kendoToolbarLocalizedMessages\n i18n-moreToolsTitle=\"kendo.toolbar.moreToolsTitle|The title of the **more tools** button in a responsive ToolBar\"\n moreToolsTitle=\"More tools\"\n >\n </ng-container>\n <ng-container *ngFor=\"let tool of allTools; let index = index\">\n <kendo-toolbar-renderer\n #toolbarRenderer\n (rendererClick)=\"onRendererClick($event)\"\n [location]=\"'toolbar'\"\n [resizable]=\"overflow\"\n [tool]=\"tool\"\n ></kendo-toolbar-renderer>\n </ng-container>\n <button\n #overflowButton\n type=\"button\"\n tabindex=\"-1\"\n [title]=\"moreToolsTitle\"\n [attr.aria-label]=\"moreToolsTitle\"\n *ngIf=\"overflow\"\n [style.visibility]=\"'hidden'\"\n class=\"k-overflow-anchor k-button\"\n (click)=\"showPopup()\"\n >\n <span class=\"k-icon k-i-more-vertical\"></span>\n </button>\n <ng-template #popupTemplate>\n <ul class=\"k-overflow-container k-list-container k-reset\">\n <ng-container *ngFor=\"let tool of allTools; let index = index\">\n <li class=\"k-item\">\n <kendo-toolbar-renderer\n #overflowRenderer\n (rendererClick)=\"onRendererClick($event)\"\n [location]=\"'overflow'\"\n [resizable]=\"overflow\"\n [tool]=\"tool\"\n ></kendo-toolbar-renderer>\n </li>\n </ng-container>\n </ul>\n </ng-template>\n <ng-container #container></ng-container>\n <kendo-resize-sensor *ngIf=\"overflow\" [rateLimit]=\"1000\" #resizeSensor></kendo-resize-sensor>\n "
1073
- }),
1074
- __metadata("design:paramtypes", [LocalizationService,
1075
- PopupService,
1076
- RefreshService,
1077
- NavigationService,
1078
- ElementRef,
1079
- NgZone,
1080
- Renderer2,
1081
- ChangeDetectorRef])
1082
- ], ToolBarComponent);
1083
- return ToolBarComponent;
1084
- }());
1085
-
1086
- /**
1087
- * Represents the [Kendo UI ToolBar Button tool for Angular]({% slug controltypes_toolbar %}#toc-buttons).
1088
- */
1089
- var ToolBarButtonComponent = /** @class */ (function (_super) {
1090
- __extends(ToolBarButtonComponent, _super);
1091
- function ToolBarButtonComponent() {
1092
- var _this = _super.call(this) || this;
1093
- // showText and showIcon showIcon should be declared first
1094
- /**
1095
- * Specifies where button text should be displayed
1096
- */
1097
- _this.showText = 'both';
1098
- /**
1099
- * Specifies where button icon should be displayed
1100
- */
1101
- _this.showIcon = 'both';
1102
- /**
1103
- * Provides visual styling that indicates if the Button is active
1104
- * ([see example]({% slug controltypes_toolbar %}#toc-toggle-buttons)).
1105
- * By default, `toggleable` is set to `false`.
1106
- */
1107
- _this.toggleable = false;
1108
- /**
1109
- * Sets the selected state of the Button.
1110
- */
1111
- _this.selected = false;
1112
- /**
1113
- * The fillMode property specifies the background and border styles of the Button.
1114
- *
1115
- * The available values are:
1116
- * * `solid` (default)
1117
- * * `flat`
1118
- * * `outline`
1119
- * * `link`
1120
- * * `null`
1121
- */
1122
- _this.fillMode = 'solid';
1123
- /**
1124
- * The Button allows you to specify predefined theme colors.
1125
- * The theme color will be applied as a background and border color while also amending the text color accordingly
1126
- * ([see example]({% slug api_buttons_dropdownbuttoncomponent %}#toc-themeColor)).
1127
- *
1128
- * The possible values are:
1129
- * * `base` &mdash;Applies coloring based on the `base` theme color. (default)
1130
- * * `primary` &mdash;Applies coloring based on the `primary` theme color.
1131
- * * `secondary`&mdash;Applies coloring based on the `secondary` theme color.
1132
- * * `tertiary`&mdash; Applies coloring based on the `tertiary` theme color.
1133
- * * `info`&mdash;Applies coloring based on the `info` theme color.
1134
- * * `success`&mdash; Applies coloring based on the `success` theme color.
1135
- * * `warning`&mdash; Applies coloring based on the `warning` theme color.
1136
- * * `error`&mdash; Applies coloring based on the `error` theme color.
1137
- * * `dark`&mdash; Applies coloring based on the `dark` theme color.
1138
- * * `light`&mdash; Applies coloring based on the `light` theme color.
1139
- * * `inverse`&mdash; Applies coloring based on the `inverse` theme color.
1140
- * * `null` &mdash;Removes the default CSS class (no class would be rendered).
1141
- */
1142
- _this.themeColor = 'base';
1143
- /**
1144
- * Fires each time the Button is clicked.
1145
- */
1146
- _this.click = new EventEmitter();
1147
- /**
1148
- * Fires when the Button [pointerdown](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/pointerdown_event) event is triggered.
1149
- */
1150
- _this.pointerdown = new EventEmitter();
1151
- /**
1152
- * Fires each time the selected state of a Toggle Button is changed.
1153
- * The event argument is the new selected state (Boolean).
1154
- */
1155
- _this.selectedChange = new EventEmitter();
1156
- _this.toolbarOptions = {
1157
- text: '',
1158
- icon: '',
1159
- iconClass: '',
1160
- imageUrl: ''
1161
- };
1162
- _this.overflowOptions = {
1163
- text: '',
1164
- icon: '',
1165
- iconClass: '',
1166
- imageUrl: ''
1167
- };
1168
- return _this;
1169
- }
1170
- ToolBarButtonComponent_1 = ToolBarButtonComponent;
1171
- Object.defineProperty(ToolBarButtonComponent.prototype, "text", {
1172
- /**
1173
- * Specifies the text of the Button ([see example]({% slug controltypes_toolbar %}#toc-buttons)).
1174
- */
1175
- set: function (text) {
1176
- this.toolbarOptions.text = getValueForLocation(text, this.showText, false);
1177
- this.overflowOptions.text = getValueForLocation(text, this.showText, true);
1178
- },
1179
- enumerable: true,
1180
- configurable: true
1181
- });
1182
- Object.defineProperty(ToolBarButtonComponent.prototype, "look", {
1183
- /**
1184
- * @hidden
1185
- */
1186
- set: function (look) {
1187
- if (look) {
1188
- this.fillMode = look === 'default' ? 'solid' : look;
1189
- }
1190
- },
1191
- enumerable: true,
1192
- configurable: true
1193
- });
1194
- Object.defineProperty(ToolBarButtonComponent.prototype, "togglable", {
1195
- /**
1196
- * @hidden
1197
- */
1198
- get: function () {
1199
- return this.toggleable;
1200
- },
1201
- set: function (value) {
1202
- this.toggleable = value;
1203
- },
1204
- enumerable: true,
1205
- configurable: true
1206
- });
1207
- Object.defineProperty(ToolBarButtonComponent.prototype, "icon", {
1208
- /**
1209
- * Defines the name for an existing icon in a Kendo UI theme
1210
- * ([see example]({% slug controltypes_toolbar %}#toc-buttons)).
1211
- * The icon is rendered inside the Button by a `span.k-icon` element.
1212
- */
1213
- set: function (icon) {
1214
- this.toolbarOptions.icon = getValueForLocation(icon, this.showIcon, false);
1215
- this.overflowOptions.icon = getValueForLocation(icon, this.showIcon, true);
1216
- },
1217
- enumerable: true,
1218
- configurable: true
1219
- });
1220
- Object.defineProperty(ToolBarButtonComponent.prototype, "iconClass", {
1221
- /**
1222
- * Defines a CSS class&mdash;or multiple classes separated by spaces&mdash;
1223
- * which are applied to a `span` element inside the Button. Allows the usage of custom icons.
1224
- */
1225
- set: function (iconClass) {
1226
- this.toolbarOptions.iconClass = getValueForLocation(iconClass, this.showIcon, false);
1227
- this.overflowOptions.iconClass = getValueForLocation(iconClass, this.showIcon, true);
1228
- },
1229
- enumerable: true,
1230
- configurable: true
1231
- });
1232
- Object.defineProperty(ToolBarButtonComponent.prototype, "imageUrl", {
1233
- /**
1234
- * Defines a URL which is used for an `img` element inside the Button.
1235
- * The URL can be relative or absolute. If relative, it is evaluated with relation to the web page URL.
1236
- */
1237
- set: function (imageUrl) {
1238
- this.toolbarOptions.imageUrl = getValueForLocation(imageUrl, this.showIcon, false);
1239
- this.overflowOptions.imageUrl = getValueForLocation(imageUrl, this.showIcon, true);
1240
- },
1241
- enumerable: true,
1242
- configurable: true
1243
- });
1244
- /**
1245
- * @hidden
1246
- */
1247
- ToolBarButtonComponent.prototype.onBlur = function () {
1248
- this.getButton().tabIndex = -1;
1249
- };
1250
- /**
1251
- * @hidden
1252
- */
1253
- ToolBarButtonComponent.prototype.canFocus = function () {
1254
- return !this.disabled;
1255
- };
1256
- /**
1257
- * @hidden
1258
- */
1259
- ToolBarButtonComponent.prototype.focus = function (ev) {
1260
- // guard against focusing twice on mousedown.
1261
- if (!ev || ev.type === 'focus' || ev.type === 'keydown') {
1262
- this.getButton().focus();
1263
- }
1264
- this.getButton().tabIndex = 0;
1265
- };
1266
- /**
1267
- * @hidden
1268
- */
1269
- ToolBarButtonComponent.prototype.handleKey = function () {
1270
- this.getButton().tabIndex = -1;
1271
- return false;
1272
- };
1273
- ToolBarButtonComponent.prototype.getButton = function () {
1274
- return (this.overflows ? this.overflowButtonElement : this.toolbarButtonElement).nativeElement;
1275
- };
1276
- var ToolBarButtonComponent_1;
1277
- __decorate([
1278
- Input(),
1279
- __metadata("design:type", String)
1280
- ], ToolBarButtonComponent.prototype, "showText", void 0);
1281
- __decorate([
1282
- Input(),
1283
- __metadata("design:type", String)
1284
- ], ToolBarButtonComponent.prototype, "showIcon", void 0);
1285
- __decorate([
1286
- Input(),
1287
- __metadata("design:type", String),
1288
- __metadata("design:paramtypes", [String])
1289
- ], ToolBarButtonComponent.prototype, "text", null);
1290
- __decorate([
1291
- Input(),
1292
- __metadata("design:type", Object)
1293
- ], ToolBarButtonComponent.prototype, "style", void 0);
1294
- __decorate([
1295
- Input(),
1296
- __metadata("design:type", Object)
1297
- ], ToolBarButtonComponent.prototype, "className", void 0);
1298
- __decorate([
1299
- Input(),
1300
- __metadata("design:type", String)
1301
- ], ToolBarButtonComponent.prototype, "title", void 0);
1302
- __decorate([
1303
- Input(),
1304
- __metadata("design:type", Boolean)
1305
- ], ToolBarButtonComponent.prototype, "disabled", void 0);
1306
- __decorate([
1307
- Input(),
1308
- __metadata("design:type", Boolean)
1309
- ], ToolBarButtonComponent.prototype, "toggleable", void 0);
1310
- __decorate([
1311
- Input(),
1312
- __metadata("design:type", String),
1313
- __metadata("design:paramtypes", [String])
1314
- ], ToolBarButtonComponent.prototype, "look", null);
1315
- __decorate([
1316
- Input(),
1317
- __metadata("design:type", Boolean),
1318
- __metadata("design:paramtypes", [Boolean])
1319
- ], ToolBarButtonComponent.prototype, "togglable", null);
1320
- __decorate([
1321
- Input(),
1322
- __metadata("design:type", Boolean)
1323
- ], ToolBarButtonComponent.prototype, "selected", void 0);
1324
- __decorate([
1325
- Input(),
1326
- __metadata("design:type", String)
1327
- ], ToolBarButtonComponent.prototype, "fillMode", void 0);
1328
- __decorate([
1329
- Input(),
1330
- __metadata("design:type", String)
1331
- ], ToolBarButtonComponent.prototype, "themeColor", void 0);
1332
- __decorate([
1333
- Input(),
1334
- __metadata("design:type", String),
1335
- __metadata("design:paramtypes", [String])
1336
- ], ToolBarButtonComponent.prototype, "icon", null);
1337
- __decorate([
1338
- Input(),
1339
- __metadata("design:type", String),
1340
- __metadata("design:paramtypes", [String])
1341
- ], ToolBarButtonComponent.prototype, "iconClass", null);
1342
- __decorate([
1343
- Input(),
1344
- __metadata("design:type", String),
1345
- __metadata("design:paramtypes", [String])
1346
- ], ToolBarButtonComponent.prototype, "imageUrl", null);
1347
- __decorate([
1348
- Output(),
1349
- __metadata("design:type", EventEmitter)
1350
- ], ToolBarButtonComponent.prototype, "click", void 0);
1351
- __decorate([
1352
- Output(),
1353
- __metadata("design:type", EventEmitter)
1354
- ], ToolBarButtonComponent.prototype, "pointerdown", void 0);
1355
- __decorate([
1356
- Output(),
1357
- __metadata("design:type", EventEmitter)
1358
- ], ToolBarButtonComponent.prototype, "selectedChange", void 0);
1359
- __decorate([
1360
- ViewChild('toolbarTemplate', { static: true }),
1361
- __metadata("design:type", TemplateRef)
1362
- ], ToolBarButtonComponent.prototype, "toolbarTemplate", void 0);
1363
- __decorate([
1364
- ViewChild('popupTemplate', { static: true }),
1365
- __metadata("design:type", TemplateRef)
1366
- ], ToolBarButtonComponent.prototype, "popupTemplate", void 0);
1367
- __decorate([
1368
- ViewChild('toolbarButton', { read: ElementRef, static: false }),
1369
- __metadata("design:type", ElementRef)
1370
- ], ToolBarButtonComponent.prototype, "toolbarButtonElement", void 0);
1371
- __decorate([
1372
- ViewChild('overflowButton', { read: ElementRef, static: false }),
1373
- __metadata("design:type", ElementRef)
1374
- ], ToolBarButtonComponent.prototype, "overflowButtonElement", void 0);
1375
- ToolBarButtonComponent = ToolBarButtonComponent_1 = __decorate([
1376
- Component({
1377
- exportAs: 'kendoToolBarButton',
1378
- // tslint:disable-next-line:no-forward-ref
1379
- providers: [{ provide: ToolBarToolComponent, useExisting: forwardRef(function () { return ToolBarButtonComponent_1; }) }],
1380
- selector: 'kendo-toolbar-button',
1381
- template: "\n <ng-template #toolbarTemplate>\n <button\n #toolbarButton\n [tabindex]=\"tabIndex\"\n type=\"button\"\n kendoButton\n [ngStyle]=\"style\"\n [ngClass]=\"className\"\n [attr.title]=\"title\"\n [disabled]=\"disabled\"\n [toggleable]=\"toggleable\"\n [fillMode]=\"fillMode\"\n [themeColor]=\"fillMode ? themeColor : null\"\n [selected]=\"selected\"\n [icon]=\"toolbarOptions.icon\"\n [iconClass]=\"toolbarOptions.iconClass\"\n [imageUrl]=\"toolbarOptions.imageUrl\"\n (click)=\"click.emit($event)\"\n (pointerdown)=\"pointerdown.emit($event)\"\n (selectedChange)=\"selectedChange.emit($event)\"\n (blur)=\"onBlur()\"\n >\n {{ toolbarOptions.text }}\n </button>\n </ng-template>\n <ng-template #popupTemplate>\n <button\n #overflowButton\n tabindex=\"-1\"\n type=\"button\"\n kendoButton\n class=\"k-overflow-button\"\n [ngStyle]=\"style\"\n [ngClass]=\"className\"\n [attr.title]=\"title\"\n [disabled]=\"disabled\"\n [toggleable]=\"toggleable\"\n [fillMode]=\"fillMode\"\n [themeColor]=\"fillMode ? themeColor : null\"\n [selected]=\"selected\"\n [icon]=\"overflowOptions.icon\"\n [iconClass]=\"overflowOptions.iconClass\"\n [imageUrl]=\"overflowOptions.imageUrl\"\n (click)=\"click.emit($event)\"\n (selectedChange)=\"selectedChange.emit($event)\"\n >\n {{ overflowOptions.text }}\n </button>\n </ng-template>\n "
1382
- }),
1383
- __metadata("design:paramtypes", [])
1384
- ], ToolBarButtonComponent);
1385
- return ToolBarButtonComponent;
1386
- }(ToolBarToolComponent));
1387
-
1388
- /**
1389
- * Represents the Kendo UI Toolbar ButtonGroup for Angular.
1390
- */
1391
- var ToolBarButtonGroupComponent = /** @class */ (function (_super) {
1392
- __extends(ToolBarButtonGroupComponent, _super);
1393
- function ToolBarButtonGroupComponent(localization) {
1394
- var _this = _super.call(this) || this;
1395
- _this.localization = localization;
1396
- /**
1397
- * By default, the selection mode of the ButtonGroup is set to `multiple`.
1398
- */
1399
- _this.selection = 'multiple';
1400
- _this.focusedIndex = -1;
1401
- _this.getNextKey = getNextKey(_this.localization.rtl);
1402
- _this.getPrevKey = getPrevKey(_this.localization.rtl);
1403
- return _this;
1404
- }
1405
- ToolBarButtonGroupComponent_1 = ToolBarButtonGroupComponent;
1406
- Object.defineProperty(ToolBarButtonGroupComponent.prototype, "look", {
1407
- /**
1408
- * @hidden
1409
- */
1410
- set: function (look) {
1411
- if (look) {
1412
- this.buttonComponents.forEach(function (b) { return b.fillMode = look === 'default' ? 'solid' : look; });
1413
- }
1414
- },
1415
- enumerable: true,
1416
- configurable: true
1417
- });
1418
- Object.defineProperty(ToolBarButtonGroupComponent.prototype, "buttonElements", {
1419
- get: function () {
1420
- return this.getButtonGroup()
1421
- .buttons.filter(function (b) { return !b.isDisabled; })
1422
- .map(function (b) { return b.element; });
1423
- },
1424
- enumerable: true,
1425
- configurable: true
1426
- });
1427
- /**
1428
- * @hidden
1429
- */
1430
- ToolBarButtonGroupComponent.prototype.onFocus = function () {
1431
- // triggered on tabin
1432
- this.focusedIndex = 0;
1433
- };
1434
- /**
1435
- * @hidden
1436
- */
1437
- ToolBarButtonGroupComponent.prototype.onNavigate = function (ev) {
1438
- ev.preventDefault();
1439
- };
1440
- /**
1441
- * @hidden
1442
- */
1443
- ToolBarButtonGroupComponent.prototype.selectedChangeHandler = function (state, button) {
1444
- button.selected = state;
1445
- button.selectedChange.emit(state);
1446
- };
1447
- /**
1448
- * @hidden
1449
- */
1450
- ToolBarButtonGroupComponent.prototype.onButtonClick = function (ev) {
1451
- this.focusedIndex = this.buttonElements.findIndex(function (be) { return be === ev.target || be.contains(ev.target); });
1452
- this.focusButton(this.focusedIndex, ev);
1453
- };
1454
- /**
1455
- * @hidden
1456
- */
1457
- ToolBarButtonGroupComponent.prototype.canFocus = function () {
1458
- return !(this.disabled || this.buttonElements.length === 0);
1459
- };
1460
- /**
1461
- * @hidden
1462
- */
1463
- ToolBarButtonGroupComponent.prototype.focus = function (ev) {
1464
- if (ev === void 0) { ev = {}; }
1465
- var nextKey = this.getNextKey(this.overflows);
1466
- var prevKey = this.getPrevKey(this.overflows);
1467
- this.focusedIndex = getIndexOfFocused(prevKey, nextKey, this.buttonElements)(ev);
1468
- this.focusButton(this.focusedIndex, ev);
1469
- };
1470
- /**
1471
- * @hidden
1472
- */
1473
- ToolBarButtonGroupComponent.prototype.handleKey = function (ev) {
1474
- var nextKey = this.getNextKey(this.overflows);
1475
- var prevKey = this.getPrevKey(this.overflows);
1476
- var peekAtIndex = makePeeker(this.buttonElements);
1477
- var isUnmodified = areEqual(this.focusedIndex);
1478
- this.focusedIndex = seekFocusedIndex(prevKey, nextKey, peekAtIndex)(this.focusedIndex, ev);
1479
- this.focusButton(this.focusedIndex, ev);
1480
- return !isUnmodified(this.focusedIndex);
1481
- };
1482
- ToolBarButtonGroupComponent.prototype.getButtonGroup = function () {
1483
- return this.overflows ? this.overflowButtonGroup : this.toolbarButtonGroup;
1484
- };
1485
- ToolBarButtonGroupComponent.prototype.focusButton = function (index, ev) {
1486
- // Guard against focusing twice on mousedown.
1487
- if (!ev.type || ev.type === 'focus' || ev.type === 'keydown') {
1488
- this.buttonElements[index].focus();
1489
- }
1490
- };
1491
- var ToolBarButtonGroupComponent_1;
1492
- __decorate([
1493
- Input(),
1494
- __metadata("design:type", Boolean)
1495
- ], ToolBarButtonGroupComponent.prototype, "disabled", void 0);
1496
- __decorate([
1497
- Input(),
1498
- __metadata("design:type", String)
1499
- ], ToolBarButtonGroupComponent.prototype, "selection", void 0);
1500
- __decorate([
1501
- Input(),
1502
- __metadata("design:type", String)
1503
- ], ToolBarButtonGroupComponent.prototype, "width", void 0);
1504
- __decorate([
1505
- Input(),
1506
- __metadata("design:type", String),
1507
- __metadata("design:paramtypes", [String])
1508
- ], ToolBarButtonGroupComponent.prototype, "look", null);
1509
- __decorate([
1510
- ViewChild('toolbarTemplate', { static: true }),
1511
- __metadata("design:type", TemplateRef)
1512
- ], ToolBarButtonGroupComponent.prototype, "toolbarTemplate", void 0);
1513
- __decorate([
1514
- ViewChild('popupTemplate', { static: true }),
1515
- __metadata("design:type", TemplateRef)
1516
- ], ToolBarButtonGroupComponent.prototype, "popupTemplate", void 0);
1517
- __decorate([
1518
- ContentChildren(forwardRef(function () { return ToolBarButtonComponent; })),
1519
- __metadata("design:type", QueryList)
1520
- ], ToolBarButtonGroupComponent.prototype, "buttonComponents", void 0);
1521
- __decorate([
1522
- ViewChild('toolbarButtonGroup', { static: false }),
1523
- __metadata("design:type", ButtonGroupComponent)
1524
- ], ToolBarButtonGroupComponent.prototype, "toolbarButtonGroup", void 0);
1525
- __decorate([
1526
- ViewChild('overflowButtonGroup', { static: false }),
1527
- __metadata("design:type", ButtonGroupComponent)
1528
- ], ToolBarButtonGroupComponent.prototype, "overflowButtonGroup", void 0);
1529
- ToolBarButtonGroupComponent = ToolBarButtonGroupComponent_1 = __decorate([
1530
- Component({
1531
- exportAs: 'kendoToolBarButtonGroup',
1532
- // tslint:disable-next-line:no-forward-ref
1533
- providers: [LocalizationService, { provide: ToolBarToolComponent, useExisting: forwardRef(function () { return ToolBarButtonGroupComponent_1; }) }],
1534
- selector: 'kendo-toolbar-buttongroup',
1535
- template: "\n <ng-template #toolbarTemplate>\n <kendo-buttongroup\n #toolbarButtonGroup\n [tabIndex]=\"-1\"\n [selection]=\"selection\"\n [disabled]=\"disabled\"\n [width]=\"width\"\n (navigate)=\"onNavigate($event)\"\n (focus)=\"onFocus()\"\n >\n <span\n kendoButton\n *ngFor=\"let button of buttonComponents\"\n [ngStyle]=\"button.style\"\n [ngClass]=\"button.className\"\n [attr.title]=\"button.title\"\n [disabled]=\"button.disabled\"\n [togglable]=\"button.togglable\"\n [selected]=\"button.selected\"\n [fillMode]=\"button.fillMode\"\n [themeColor]=\"button.fillMode ? button.themeColor : null\"\n [icon]=\"button.toolbarOptions.icon\"\n [iconClass]=\"button.toolbarOptions.iconClass\"\n [imageUrl]=\"button.toolbarOptions.imageUrl\"\n (click)=\"button.click.emit($event); onButtonClick($event)\"\n (pointerdown)=\"button.pointerdown.emit($event)\"\n (selectedChange)=\"selectedChangeHandler($event, button)\"\n >\n {{ button.toolbarOptions.text }}\n </span>\n </kendo-buttongroup>\n </ng-template>\n <ng-template #popupTemplate>\n <kendo-buttongroup\n #overflowButtonGroup\n class=\"k-overflow-button\"\n [tabIndex]=\"-1\"\n [selection]=\"selection\"\n [disabled]=\"disabled\"\n [width]=\"width\"\n >\n <span\n kendoButton\n class=\"k-overflow-button\"\n *ngFor=\"let button of buttonComponents\"\n [ngStyle]=\"button.style\"\n [ngClass]=\"button.className\"\n [attr.title]=\"button.title\"\n [disabled]=\"button.disabled\"\n [togglable]=\"button.togglable\"\n [selected]=\"button.selected\"\n [fillMode]=\"button.fillMode\"\n [themeColor]=\"button.fillMode ? button.themeColor : null\"\n [icon]=\"button.overflowOptions.icon\"\n [iconClass]=\"button.overflowOptions.iconClass\"\n [imageUrl]=\"button.overflowOptions.imageUrl\"\n (click)=\"button.click.emit($event); onButtonClick($event)\"\n (selectedChange)=\"selectedChangeHandler($event, button)\"\n >\n {{ button.overflowOptions.text }}\n </span>\n </kendo-buttongroup>\n </ng-template>\n "
1536
- }),
1537
- __metadata("design:paramtypes", [LocalizationService])
1538
- ], ToolBarButtonGroupComponent);
1539
- return ToolBarButtonGroupComponent;
1540
- }(ToolBarToolComponent));
1541
-
1542
- /**
1543
- * @hidden
1544
- */
1545
- var ToolBarButtonListComponent = /** @class */ (function () {
1546
- function ToolBarButtonListComponent() {
1547
- this.disabled = false;
1548
- this.fillMode = 'solid';
1549
- this.themeColor = 'base';
1550
- this.itemClick = new EventEmitter();
1551
- }
1552
- ToolBarButtonListComponent.prototype.getText = function (dataItem) {
1553
- if (dataItem) {
1554
- return this.textField ? dataItem[this.textField] : dataItem.text || dataItem;
1555
- }
1556
- return undefined;
1557
- };
1558
- ToolBarButtonListComponent.prototype.onClick = function (item, index) {
1559
- var dataItem = this.data[index];
1560
- if (item.click) {
1561
- item.click(dataItem);
1562
- }
1563
- this.itemClick.emit(dataItem);
1564
- };
1565
- __decorate([
1566
- Input(),
1567
- __metadata("design:type", Array)
1568
- ], ToolBarButtonListComponent.prototype, "data", void 0);
1569
- __decorate([
1570
- Input(),
1571
- __metadata("design:type", String)
1572
- ], ToolBarButtonListComponent.prototype, "textField", void 0);
1573
- __decorate([
1574
- Input(),
1575
- __metadata("design:type", Boolean)
1576
- ], ToolBarButtonListComponent.prototype, "disabled", void 0);
1577
- __decorate([
1578
- Input(),
1579
- __metadata("design:type", String)
1580
- ], ToolBarButtonListComponent.prototype, "fillMode", void 0);
1581
- __decorate([
1582
- Input(),
1583
- __metadata("design:type", String)
1584
- ], ToolBarButtonListComponent.prototype, "themeColor", void 0);
1585
- __decorate([
1586
- Output(),
1587
- __metadata("design:type", EventEmitter)
1588
- ], ToolBarButtonListComponent.prototype, "itemClick", void 0);
1589
- __decorate([
1590
- ViewChildren('button'),
1591
- __metadata("design:type", QueryList)
1592
- ], ToolBarButtonListComponent.prototype, "buttons", void 0);
1593
- ToolBarButtonListComponent = __decorate([
1594
- Component({
1595
- selector: 'kendo-toolbar-buttonlist',
1596
- template: "\n <button\n #button\n type=\"button\"\n tabindex=\"-1\"\n kendoButton\n style=\"padding-left: 16px\"\n class=\"k-overflow-button\"\n *ngFor=\"let item of data; let i = index\"\n [disabled]=\"disabled || item.disabled\"\n [icon]=\"item.icon\"\n [iconClass]=\"item.iconClass\"\n [imageUrl]=\"item.imageUrl\"\n [fillMode]=\"fillMode\"\n [themeColor]=\"fillMode ? themeColor : null\"\n (click)=\"onClick(item, i)\"\n >\n {{ getText(item) }}\n </button>\n "
1597
- })
1598
- ], ToolBarButtonListComponent);
1599
- return ToolBarButtonListComponent;
1600
- }());
1601
-
1602
- /**
1603
- * Represents the [Kendo UI ToolBar DropDownButton for Angular]({% slug controltypes_toolbar %}#toc-dropdownbuttons).
1604
- */
1605
- var ToolBarDropDownButtonComponent = /** @class */ (function (_super) {
1606
- __extends(ToolBarDropDownButtonComponent, _super);
1607
- function ToolBarDropDownButtonComponent() {
1608
- var _this = _super.call(this) || this;
1609
- // showText and showIcon showIcon should be declared first
1610
- /**
1611
- * Defines the location of the button text that will be displayed.
1612
- */
1613
- _this.showText = 'both';
1614
- /**
1615
- * Defines the location of the button icon that will be displayed.
1616
- */
1617
- _this.showIcon = 'both';
1618
- /**
1619
- * The fillMode property specifies the background and border styles of the Button.
1620
- *
1621
- * The available values are:
1622
- * * `solid` (default)
1623
- * * `flat`
1624
- * * `outline`
1625
- * * `link`
1626
- * * `null`
1627
- */
1628
- _this.fillMode = 'solid';
1629
- /**
1630
- * The Button allows you to specify predefined theme colors.
1631
- * The theme color will be applied as a background and border color while also amending the text color accordingly
1632
- * ([see example]({% slug api_buttons_dropdownbuttoncomponent %}#toc-themeColor)).
1633
- *
1634
- * The possible values are:
1635
- * * `base` &mdash;Applies coloring based on the `base` theme color. (default)
1636
- * * `primary` &mdash;Applies coloring based on the `primary` theme color.
1637
- * * `secondary`&mdash;Applies coloring based on the `secondary` theme color.
1638
- * * `tertiary`&mdash; Applies coloring based on the `tertiary` theme color.
1639
- * * `info`&mdash;Applies coloring based on the `info` theme color.
1640
- * * `success`&mdash; Applies coloring based on the `success` theme color.
1641
- * * `warning`&mdash; Applies coloring based on the `warning` theme color.
1642
- * * `error`&mdash; Applies coloring based on the `error` theme color.
1643
- * * `dark`&mdash; Applies coloring based on the `dark` theme color.
1644
- * * `light`&mdash; Applies coloring based on the `light` theme color.
1645
- * * `inverse`&mdash; Applies coloring based on the `inverse` theme color.
1646
- * * `null` &mdash;Removes the default CSS class (no class would be rendered).
1647
- */
1648
- _this.themeColor = 'base';
1649
- /**
1650
- * Fires each time the user clicks a DropDownButton item.
1651
- * The event data contains the data item that is bound to the clicked list item.
1652
- */
1653
- _this.itemClick = new EventEmitter();
1654
- /**
1655
- * Fires each time the popup is about to open.
1656
- * This event is preventable. If you cancel the event, the popup will remain closed.
1657
- */
1658
- _this.open = new EventEmitter();
1659
- /**
1660
- * Fires each time the popup is about to close.
1661
- * This event is preventable. If you cancel the event, the popup will remain open.
1662
- */
1663
- _this.close = new EventEmitter();
1664
- _this.toolbarOptions = {
1665
- text: '',
1666
- icon: '',
1667
- iconClass: '',
1668
- imageUrl: ''
1669
- };
1670
- _this.overflowOptions = {
1671
- text: '',
1672
- icon: '',
1673
- iconClass: '',
1674
- imageUrl: ''
1675
- };
1676
- _this._popupSettings = { animate: true, popupClass: '' };
1677
- _this.focusedIndex = -1;
1678
- _this.getNextKey = getNextKey();
1679
- _this.getPrevKey = getPrevKey();
1680
- return _this;
1681
- }
1682
- ToolBarDropDownButtonComponent_1 = ToolBarDropDownButtonComponent;
1683
- Object.defineProperty(ToolBarDropDownButtonComponent.prototype, "text", {
1684
- /**
1685
- * Sets the text of the DropDownButton
1686
- * ([see example]({% slug controltypes_toolbar %}#toc-dropdownbuttons).
1687
- */
1688
- set: function (text) {
1689
- this.toolbarOptions.text = getValueForLocation(text, this.showText, false);
1690
- this.overflowOptions.text = getValueForLocation(text, this.showText, true);
1691
- },
1692
- enumerable: true,
1693
- configurable: true
1694
- });
1695
- Object.defineProperty(ToolBarDropDownButtonComponent.prototype, "icon", {
1696
- /**
1697
- * Defines an icon that will be rendered next to the button text.
1698
- */
1699
- set: function (icon) {
1700
- this.toolbarOptions.icon = getValueForLocation(icon, this.showIcon, false);
1701
- this.overflowOptions.icon = getValueForLocation(icon, this.showIcon, true);
1702
- },
1703
- enumerable: true,
1704
- configurable: true
1705
- });
1706
- Object.defineProperty(ToolBarDropDownButtonComponent.prototype, "iconClass", {
1707
- /**
1708
- * Defines an icon with a custom CSS class that will be rendered next to the button text.
1709
- */
1710
- set: function (iconClass) {
1711
- this.toolbarOptions.iconClass = getValueForLocation(iconClass, this.showIcon, false);
1712
- this.overflowOptions.iconClass = getValueForLocation(iconClass, this.showIcon, true);
1713
- },
1714
- enumerable: true,
1715
- configurable: true
1716
- });
1717
- Object.defineProperty(ToolBarDropDownButtonComponent.prototype, "imageUrl", {
1718
- /**
1719
- * Defines the location of an image that will be displayed next to the button text.
1720
- */
1721
- set: function (imageUrl) {
1722
- this.toolbarOptions.imageUrl = getValueForLocation(imageUrl, this.showIcon, false);
1723
- this.overflowOptions.imageUrl = getValueForLocation(imageUrl, this.showIcon, true);
1724
- },
1725
- enumerable: true,
1726
- configurable: true
1727
- });
1728
- Object.defineProperty(ToolBarDropDownButtonComponent.prototype, "popupSettings", {
1729
- get: function () {
1730
- return this._popupSettings;
1731
- },
1732
- /**
1733
- * Configures the popup of the DropDownButton.
1734
- *
1735
- * The available options are:
1736
- * - `animate:Boolean`&mdash;Controls the popup animation. By default, the open and close animations are enabled.
1737
- * - `popupClass:String`&mdash;Specifies a list of CSS classes that are used to style the popup.
1738
- */
1739
- set: function (settings) {
1740
- this._popupSettings = Object.assign({ animate: true, popupClass: '' }, settings);
1741
- },
1742
- enumerable: true,
1743
- configurable: true
1744
- });
1745
- Object.defineProperty(ToolBarDropDownButtonComponent.prototype, "look", {
1746
- /**
1747
- * @hidden
1748
- */
1749
- set: function (look) {
1750
- if (look) {
1751
- this.fillMode = look === 'default' ? 'solid' : look;
1752
- }
1753
- },
1754
- enumerable: true,
1755
- configurable: true
1756
- });
1757
- Object.defineProperty(ToolBarDropDownButtonComponent.prototype, "primary", {
1758
- /**
1759
- * @hidden
1760
- */
1761
- set: function (primary) {
1762
- this.themeColor = primary ? 'primary' : 'base';
1763
- },
1764
- enumerable: true,
1765
- configurable: true
1766
- });
1767
- Object.defineProperty(ToolBarDropDownButtonComponent.prototype, "data", {
1768
- get: function () {
1769
- if (!this._data) {
1770
- this.data = [];
1771
- }
1772
- return this._data;
1773
- },
1774
- /**
1775
- * Sets the data of the DropDownButton
1776
- * ([see example]({% slug controltypes_toolbar %}#toc-dropdownbuttons)).
1777
- *
1778
- * > The data has to be provided in an array-like list.
1779
- */
1780
- set: function (data) {
1781
- this._data = data || [];
1782
- },
1783
- enumerable: true,
1784
- configurable: true
1785
- });
1786
- Object.defineProperty(ToolBarDropDownButtonComponent.prototype, "overflowButtons", {
1787
- get: function () {
1788
- return this.overflowDropDownButtonButtonList.buttons.toArray().filter(function (b) { return !b.nativeElement.disabled; }).slice();
1789
- },
1790
- enumerable: true,
1791
- configurable: true
1792
- });
1793
- /**
1794
- * @hidden
1795
- */
1796
- ToolBarDropDownButtonComponent.prototype.onButtonListClick = function (ev) {
1797
- this.focusedIndex = this.overflowDropDownButtonButtonList.buttons
1798
- .toArray()
1799
- .findIndex(function (b) { return b.nativeElement.contains(ev.target); });
1800
- };
1801
- /**
1802
- * @hidden
1803
- */
1804
- ToolBarDropDownButtonComponent.prototype.canFocus = function () {
1805
- return !this.disabled;
1806
- };
1807
- /**
1808
- * @hidden
1809
- */
1810
- ToolBarDropDownButtonComponent.prototype.focus = function (ev) {
1811
- if (ev === void 0) { ev = {}; }
1812
- if (!this.overflows) {
1813
- if (ev.type === 'focus' || ev.type === 'keydown') {
1814
- this.toolbarDropDownButton.focus();
1815
- }
1816
- }
1817
- else if (this.overflowButtons.length > 0) {
1818
- this.focusedIndex = getIndexOfFocused(this.getPrevKey(), this.getNextKey(), this.overflowButtons.map(function (ob) { return ob.nativeElement; }))(ev);
1819
- this.focusButton(this.focusedIndex, ev);
1820
- }
1821
- };
1822
- /**
1823
- * @hidden
1824
- */
1825
- ToolBarDropDownButtonComponent.prototype.handleKey = function (ev) {
1826
- if (!this.overflows && (ev.keyCode === this.getPrevKey(this.overflows) || ev.keyCode === this.getNextKey(this.overflows))) {
1827
- return false;
1828
- }
1829
- if (this.overflows) {
1830
- var peekAtIndex = makePeeker(this.overflowButtons);
1831
- var isUnmodified = areEqual(this.focusedIndex);
1832
- this.focusedIndex = seekFocusedIndex(this.getPrevKey(), this.getNextKey(), peekAtIndex)(this.focusedIndex, ev);
1833
- this.focusButton(this.focusedIndex, ev);
1834
- return !isUnmodified(this.focusedIndex);
1835
- }
1836
- };
1837
- ToolBarDropDownButtonComponent.prototype.focusButton = function (index, ev) {
1838
- if (!ev.type || ev.type === 'focus' || ev.type === 'keydown') {
1839
- this.overflowButtons[index].nativeElement.focus();
1840
- }
1841
- };
1842
- var ToolBarDropDownButtonComponent_1;
1843
- __decorate([
1844
- Input(),
1845
- __metadata("design:type", String)
1846
- ], ToolBarDropDownButtonComponent.prototype, "showText", void 0);
1847
- __decorate([
1848
- Input(),
1849
- __metadata("design:type", String)
1850
- ], ToolBarDropDownButtonComponent.prototype, "showIcon", void 0);
1851
- __decorate([
1852
- Input(),
1853
- __metadata("design:type", String),
1854
- __metadata("design:paramtypes", [String])
1855
- ], ToolBarDropDownButtonComponent.prototype, "text", null);
1856
- __decorate([
1857
- Input(),
1858
- __metadata("design:type", String),
1859
- __metadata("design:paramtypes", [String])
1860
- ], ToolBarDropDownButtonComponent.prototype, "icon", null);
1861
- __decorate([
1862
- Input(),
1863
- __metadata("design:type", String),
1864
- __metadata("design:paramtypes", [String])
1865
- ], ToolBarDropDownButtonComponent.prototype, "iconClass", null);
1866
- __decorate([
1867
- Input(),
1868
- __metadata("design:type", String),
1869
- __metadata("design:paramtypes", [String])
1870
- ], ToolBarDropDownButtonComponent.prototype, "imageUrl", null);
1871
- __decorate([
1872
- Input(),
1873
- __metadata("design:type", Object),
1874
- __metadata("design:paramtypes", [Object])
1875
- ], ToolBarDropDownButtonComponent.prototype, "popupSettings", null);
1876
- __decorate([
1877
- Input(),
1878
- __metadata("design:type", String),
1879
- __metadata("design:paramtypes", [String])
1880
- ], ToolBarDropDownButtonComponent.prototype, "look", null);
1881
- __decorate([
1882
- Input(),
1883
- __metadata("design:type", Boolean),
1884
- __metadata("design:paramtypes", [Boolean])
1885
- ], ToolBarDropDownButtonComponent.prototype, "primary", null);
1886
- __decorate([
1887
- Input(),
1888
- __metadata("design:type", String)
1889
- ], ToolBarDropDownButtonComponent.prototype, "fillMode", void 0);
1890
- __decorate([
1891
- Input(),
1892
- __metadata("design:type", String)
1893
- ], ToolBarDropDownButtonComponent.prototype, "themeColor", void 0);
1894
- __decorate([
1895
- Input(),
1896
- __metadata("design:type", String)
1897
- ], ToolBarDropDownButtonComponent.prototype, "buttonClass", void 0);
1898
- __decorate([
1899
- Input(),
1900
- __metadata("design:type", String)
1901
- ], ToolBarDropDownButtonComponent.prototype, "textField", void 0);
1902
- __decorate([
1903
- Input(),
1904
- __metadata("design:type", Boolean)
1905
- ], ToolBarDropDownButtonComponent.prototype, "disabled", void 0);
1906
- __decorate([
1907
- Input(),
1908
- __metadata("design:type", Array),
1909
- __metadata("design:paramtypes", [Array])
1910
- ], ToolBarDropDownButtonComponent.prototype, "data", null);
1911
- __decorate([
1912
- Output(),
1913
- __metadata("design:type", EventEmitter)
1914
- ], ToolBarDropDownButtonComponent.prototype, "itemClick", void 0);
1915
- __decorate([
1916
- Output(),
1917
- __metadata("design:type", EventEmitter)
1918
- ], ToolBarDropDownButtonComponent.prototype, "open", void 0);
1919
- __decorate([
1920
- Output(),
1921
- __metadata("design:type", EventEmitter)
1922
- ], ToolBarDropDownButtonComponent.prototype, "close", void 0);
1923
- __decorate([
1924
- ViewChild('toolbarTemplate', { static: true }),
1925
- __metadata("design:type", TemplateRef)
1926
- ], ToolBarDropDownButtonComponent.prototype, "toolbarTemplate", void 0);
1927
- __decorate([
1928
- ViewChild('popupTemplate', { static: true }),
1929
- __metadata("design:type", TemplateRef)
1930
- ], ToolBarDropDownButtonComponent.prototype, "popupTemplate", void 0);
1931
- __decorate([
1932
- ViewChild('dropdownButton', { read: ElementRef, static: true }),
1933
- __metadata("design:type", ElementRef)
1934
- ], ToolBarDropDownButtonComponent.prototype, "dropdownButton", void 0);
1935
- __decorate([
1936
- ViewChild(DropDownButtonComponent, { static: false }),
1937
- __metadata("design:type", DropDownButtonComponent)
1938
- ], ToolBarDropDownButtonComponent.prototype, "dropDownButtonComponent", void 0);
1939
- __decorate([
1940
- ViewChild('toolbarDropDownButton', { static: false }),
1941
- __metadata("design:type", DropDownButtonComponent)
1942
- ], ToolBarDropDownButtonComponent.prototype, "toolbarDropDownButton", void 0);
1943
- __decorate([
1944
- ViewChild('overflowDropDownButtonButtonList', { static: false }),
1945
- __metadata("design:type", ToolBarButtonListComponent)
1946
- ], ToolBarDropDownButtonComponent.prototype, "overflowDropDownButtonButtonList", void 0);
1947
- ToolBarDropDownButtonComponent = ToolBarDropDownButtonComponent_1 = __decorate([
1948
- Component({
1949
- exportAs: 'kendoToolBarDropDownButton',
1950
- // tslint:disable-next-line:no-forward-ref
1951
- providers: [{ provide: ToolBarToolComponent, useExisting: forwardRef(function () { return ToolBarDropDownButtonComponent_1; }) }],
1952
- selector: 'kendo-toolbar-dropdownbutton',
1953
- template: "\n <ng-template #toolbarTemplate>\n <kendo-dropdownbutton\n #toolbarDropDownButton\n [icon]=\"toolbarOptions.icon\"\n [iconClass]=\"toolbarOptions.iconClass\"\n [imageUrl]=\"toolbarOptions.imageUrl\"\n [buttonClass]=\"buttonClass\"\n [disabled]=\"disabled\"\n [tabIndex]=\"-1\"\n [data]=\"data\"\n [textField]=\"textField\"\n [popupSettings]=\"popupSettings\"\n [fillMode]=\"fillMode\"\n [themeColor]=\"fillMode ? themeColor : null\"\n (open)=\"open.emit($event)\"\n (close)=\"close.emit($event)\"\n (itemClick)=\"itemClick.emit($event)\"\n >\n {{ toolbarOptions.text }}\n </kendo-dropdownbutton>\n </ng-template>\n <ng-template #popupTemplate>\n <button\n type=\"button\"\n tabindex=\"-1\"\n kendoButton\n class=\"k-overflow-button\"\n [disabled]=\"true\"\n [icon]=\"overflowOptions.icon\"\n [iconClass]=\"overflowOptions.iconClass\"\n [imageUrl]=\"overflowOptions.imageUrl\"\n [ngClass]=\"buttonClass\"\n (click)=\"itemClick.emit($event)\"\n >\n {{ overflowOptions.text }}\n </button>\n <kendo-toolbar-buttonlist\n #overflowDropDownButtonButtonList\n [data]=\"data\"\n [disabled]=\"disabled\"\n [textField]=\"textField\"\n (itemClick)=\"itemClick.emit($event)\"\n (click)=\"onButtonListClick($event)\"\n >\n </kendo-toolbar-buttonlist>\n </ng-template>\n "
1954
- }),
1955
- __metadata("design:paramtypes", [])
1956
- ], ToolBarDropDownButtonComponent);
1957
- return ToolBarDropDownButtonComponent;
1958
- }(ToolBarToolComponent));
1959
-
1960
- /**
1961
- * Represents the [Kendo UI ToolBar SplitButton for Angular]({% slug controltypes_toolbar %}#toc-splitbuttons).
1962
- */
1963
- var ToolBarSplitButtonComponent = /** @class */ (function (_super) {
1964
- __extends(ToolBarSplitButtonComponent, _super);
1965
- function ToolBarSplitButtonComponent() {
1966
- var _this = _super.call(this) || this;
1967
- // showText and showIcon showIcon should be declared first
1968
- /**
1969
- * Specifies where button text should be displayed
1970
- */
1971
- _this.showText = 'both';
1972
- /**
1973
- * Specifies where button icon should be displayed
1974
- */
1975
- _this.showIcon = 'both';
1976
- /**
1977
- * The fillMode property specifies the background and border styles of the Button.
1978
- *
1979
- * The available values are:
1980
- * * `solid` (default)
1981
- * * `flat`
1982
- * * `outline`
1983
- * * `link`
1984
- * * `null`
1985
- */
1986
- _this.fillMode = 'solid';
1987
- /**
1988
- * The Button allows you to specify predefined theme colors.
1989
- * The theme color will be applied as a background and border color while also amending the text color accordingly.
1990
- *
1991
- * The possible values are:
1992
- * * `base` &mdash;Applies coloring based on the `base` theme color. (default)
1993
- * * `primary` &mdash;Applies coloring based on the `primary` theme color.
1994
- * * `secondary`&mdash;Applies coloring based on the `secondary` theme color.
1995
- * * `tertiary`&mdash; Applies coloring based on the `tertiary` theme color.
1996
- * * `info`&mdash;Applies coloring based on the `info` theme color.
1997
- * * `success`&mdash; Applies coloring based on the `success` theme color.
1998
- * * `warning`&mdash; Applies coloring based on the `warning` theme color.
1999
- * * `error`&mdash; Applies coloring based on the `error` theme color.
2000
- * * `dark`&mdash; Applies coloring based on the `dark` theme color.
2001
- * * `light`&mdash; Applies coloring based on the `light` theme color.
2002
- * * `inverse`&mdash; Applies coloring based on the `inverse` theme color.
2003
- * * `null` &mdash;Removes the default CSS class (no class would be rendered).
2004
- */
2005
- _this.themeColor = 'base';
2006
- /**
2007
- * Specifies the name of the [font icon]({% slug icons %}#toc-list-of-font-icons) that will
2008
- * be rendered for the button which opens the popup.
2009
- */
2010
- _this.arrowButtonIcon = 'arrow-s';
2011
- /**
2012
- * Configures the text field of the button-list popup.
2013
- */
2014
- _this.textField = 'text';
2015
- /**
2016
- * Fires each time the user clicks the main button.
2017
- */
2018
- _this.buttonClick = new EventEmitter();
2019
- /**
2020
- * Fires each time the user clicks the drop-down list.
2021
- * The event data contains the data item that is bound to the clicked list item.
2022
- */
2023
- _this.itemClick = new EventEmitter();
2024
- /**
2025
- * Fires each time the popup is about to open.
2026
- * This event is preventable. If you cancel the event, the popup will remain closed.
2027
- */
2028
- _this.open = new EventEmitter();
2029
- /**
2030
- * Fires each time the popup is about to close.
2031
- * This event is preventable. If you cancel the event, the popup will remain open.
2032
- */
2033
- _this.close = new EventEmitter();
2034
- _this.toolbarOptions = {
2035
- text: '',
2036
- icon: '',
2037
- iconClass: '',
2038
- imageUrl: ''
2039
- };
2040
- _this.overflowOptions = {
2041
- text: '',
2042
- icon: '',
2043
- iconClass: '',
2044
- imageUrl: ''
2045
- };
2046
- _this._popupSettings = { animate: true, popupClass: '' };
2047
- _this.focusedIndex = -1;
2048
- _this.getNextKey = getNextKey();
2049
- _this.getPrevKey = getPrevKey();
2050
- return _this;
2051
- }
2052
- ToolBarSplitButtonComponent_1 = ToolBarSplitButtonComponent;
2053
- Object.defineProperty(ToolBarSplitButtonComponent.prototype, "text", {
2054
- /**
2055
- * Sets the text of the SplitButton ([see example]({% slug controltypes_toolbar %}#toc-splitbuttons).
2056
- */
2057
- set: function (text) {
2058
- this.toolbarOptions.text = getValueForLocation(text, this.showText, false);
2059
- this.overflowOptions.text = getValueForLocation(text, this.showText, true);
2060
- },
2061
- enumerable: true,
2062
- configurable: true
2063
- });
2064
- Object.defineProperty(ToolBarSplitButtonComponent.prototype, "icon", {
2065
- /**
2066
- * Defines the icon that will be rendered next to the button text
2067
- * ([see example]({% slug controltypes_toolbar %}#toc-splitbuttons)).
2068
- */
2069
- set: function (icon) {
2070
- this.toolbarOptions.icon = getValueForLocation(icon, this.showIcon, false);
2071
- this.overflowOptions.icon = getValueForLocation(icon, this.showIcon, true);
2072
- },
2073
- enumerable: true,
2074
- configurable: true
2075
- });
2076
- Object.defineProperty(ToolBarSplitButtonComponent.prototype, "iconClass", {
2077
- /**
2078
- * Defines an icon with a custom CSS class that will be rendered next to the button text.
2079
- */
2080
- set: function (iconClass) {
2081
- this.toolbarOptions.iconClass = getValueForLocation(iconClass, this.showIcon, false);
2082
- this.overflowOptions.iconClass = getValueForLocation(iconClass, this.showIcon, true);
2083
- },
2084
- enumerable: true,
2085
- configurable: true
2086
- });
2087
- Object.defineProperty(ToolBarSplitButtonComponent.prototype, "imageUrl", {
2088
- /**
2089
- * Defines the location of an image that will be displayed next to the button text.
2090
- */
2091
- set: function (imageUrl) {
2092
- this.toolbarOptions.imageUrl = getValueForLocation(imageUrl, this.showIcon, false);
2093
- this.overflowOptions.imageUrl = getValueForLocation(imageUrl, this.showIcon, true);
2094
- },
2095
- enumerable: true,
2096
- configurable: true
2097
- });
2098
- Object.defineProperty(ToolBarSplitButtonComponent.prototype, "popupSettings", {
2099
- get: function () {
2100
- if (!this._popupSettings) {
2101
- this._popupSettings = { animate: true, popupClass: '' };
2102
- }
2103
- return this._popupSettings;
2104
- },
2105
- /**
2106
- * Configures the popup of the SplitButton.
2107
- *
2108
- * The available options are:
2109
- * - `animate:Boolean`&mdash;Controls the popup animation. By default, the open and close animations are enabled.
2110
- * - `popupClass:String`&mdash;Specifies a list of CSS classes that are used to style the popup.
2111
- */
2112
- set: function (value) {
2113
- this._popupSettings = value;
2114
- },
2115
- enumerable: true,
2116
- configurable: true
2117
- });
2118
- Object.defineProperty(ToolBarSplitButtonComponent.prototype, "look", {
2119
- /**
2120
- * @hidden
2121
- */
2122
- set: function (look) {
2123
- if (look) {
2124
- this.fillMode = look === 'default' ? 'solid' : look;
2125
- }
2126
- },
2127
- enumerable: true,
2128
- configurable: true
2129
- });
2130
- Object.defineProperty(ToolBarSplitButtonComponent.prototype, "data", {
2131
- get: function () {
2132
- if (!this._data) {
2133
- this.data = [];
2134
- }
2135
- return this._data;
2136
- },
2137
- /**
2138
- * Sets the data of the SplitButton ([see example]({% slug controltypes_toolbar %}#toc-splitbuttons)).
2139
- *
2140
- * > The data has to be provided in an array-like list.
2141
- */
2142
- set: function (data) {
2143
- this._data = data || [];
2144
- },
2145
- enumerable: true,
2146
- configurable: true
2147
- });
2148
- Object.defineProperty(ToolBarSplitButtonComponent.prototype, "overflowButtons", {
2149
- get: function () {
2150
- return [this.overflowSplitButton].concat(this.overflowSplitButtonButtonList.buttons.toArray().filter(function (b) { return !b.nativeElement.disabled; }));
2151
- },
2152
- enumerable: true,
2153
- configurable: true
2154
- });
2155
- /**
2156
- * @hidden
2157
- */
2158
- ToolBarSplitButtonComponent.prototype.onButtonListClick = function (ev) {
2159
- this.focusedIndex = this.overflowButtons.findIndex(function (b) { return b.nativeElement.contains(ev.target); });
2160
- };
2161
- /**
2162
- * @hidden
2163
- */
2164
- ToolBarSplitButtonComponent.prototype.onMainButtonClick = function (ev) {
2165
- this.buttonClick.emit(ev);
2166
- this.focusedIndex = 0;
2167
- };
2168
- /**
2169
- * @hidden
2170
- */
2171
- ToolBarSplitButtonComponent.prototype.canFocus = function () {
2172
- return !this.disabled;
2173
- };
2174
- /**
2175
- * @hidden
2176
- */
2177
- ToolBarSplitButtonComponent.prototype.focus = function (ev) {
2178
- if (ev === void 0) { ev = {}; }
2179
- if (!this.overflows) {
2180
- if (ev.type === 'focus' || ev.type === 'keydown') {
2181
- this.toolbarSplitButton.focus();
2182
- }
2183
- }
2184
- else if (this.overflowButtons.length > 0) {
2185
- this.focusedIndex = getIndexOfFocused(this.getPrevKey(), this.getNextKey(), this.overflowButtons.map(function (ob) { return ob.nativeElement; }))(ev);
2186
- this.focusButton(this.focusedIndex, ev);
2187
- }
2188
- };
2189
- /**
2190
- * @hidden
2191
- */
2192
- ToolBarSplitButtonComponent.prototype.handleKey = function (ev) {
2193
- if (!this.overflows && (ev.keyCode === this.getPrevKey(this.overflows) || ev.keyCode === this.getNextKey(this.overflows))) {
2194
- return false;
2195
- }
2196
- if (this.overflows) {
2197
- var peekAtIndex = makePeeker(this.overflowButtons);
2198
- var isUnmodified = areEqual(this.focusedIndex);
2199
- this.focusedIndex = seekFocusedIndex(this.getPrevKey(), this.getNextKey(), peekAtIndex)(this.focusedIndex, ev);
2200
- this.focusButton(this.focusedIndex, ev);
2201
- return !isUnmodified(this.focusedIndex);
2202
- }
2203
- };
2204
- ToolBarSplitButtonComponent.prototype.focusButton = function (index, ev) {
2205
- if (!ev.type || ev.type === 'focus' || ev.type === 'keydown' || ev.type === 'click') {
2206
- this.overflowButtons[index].nativeElement.focus();
2207
- }
2208
- };
2209
- var ToolBarSplitButtonComponent_1;
2210
- __decorate([
2211
- Input(),
2212
- __metadata("design:type", String)
2213
- ], ToolBarSplitButtonComponent.prototype, "showText", void 0);
2214
- __decorate([
2215
- Input(),
2216
- __metadata("design:type", String)
2217
- ], ToolBarSplitButtonComponent.prototype, "showIcon", void 0);
2218
- __decorate([
2219
- Input(),
2220
- __metadata("design:type", String),
2221
- __metadata("design:paramtypes", [String])
2222
- ], ToolBarSplitButtonComponent.prototype, "text", null);
2223
- __decorate([
2224
- Input(),
2225
- __metadata("design:type", String),
2226
- __metadata("design:paramtypes", [String])
2227
- ], ToolBarSplitButtonComponent.prototype, "icon", null);
2228
- __decorate([
2229
- Input(),
2230
- __metadata("design:type", String),
2231
- __metadata("design:paramtypes", [String])
2232
- ], ToolBarSplitButtonComponent.prototype, "iconClass", null);
2233
- __decorate([
2234
- Input(),
2235
- __metadata("design:type", String),
2236
- __metadata("design:paramtypes", [String])
2237
- ], ToolBarSplitButtonComponent.prototype, "imageUrl", null);
2238
- __decorate([
2239
- Input(),
2240
- __metadata("design:type", Boolean)
2241
- ], ToolBarSplitButtonComponent.prototype, "disabled", void 0);
2242
- __decorate([
2243
- Input(),
2244
- __metadata("design:type", Object),
2245
- __metadata("design:paramtypes", [Object])
2246
- ], ToolBarSplitButtonComponent.prototype, "popupSettings", null);
2247
- __decorate([
2248
- Input(),
2249
- __metadata("design:type", String)
2250
- ], ToolBarSplitButtonComponent.prototype, "fillMode", void 0);
2251
- __decorate([
2252
- Input(),
2253
- __metadata("design:type", String)
2254
- ], ToolBarSplitButtonComponent.prototype, "themeColor", void 0);
2255
- __decorate([
2256
- Input(),
2257
- __metadata("design:type", String),
2258
- __metadata("design:paramtypes", [String])
2259
- ], ToolBarSplitButtonComponent.prototype, "look", null);
2260
- __decorate([
2261
- Input(),
2262
- __metadata("design:type", String)
2263
- ], ToolBarSplitButtonComponent.prototype, "buttonClass", void 0);
2264
- __decorate([
2265
- Input(),
2266
- __metadata("design:type", Object)
2267
- ], ToolBarSplitButtonComponent.prototype, "arrowButtonClass", void 0);
2268
- __decorate([
2269
- Input(),
2270
- __metadata("design:type", String)
2271
- ], ToolBarSplitButtonComponent.prototype, "arrowButtonIcon", void 0);
2272
- __decorate([
2273
- Input(),
2274
- __metadata("design:type", String)
2275
- ], ToolBarSplitButtonComponent.prototype, "textField", void 0);
2276
- __decorate([
2277
- Input(),
2278
- __metadata("design:type", Array),
2279
- __metadata("design:paramtypes", [Array])
2280
- ], ToolBarSplitButtonComponent.prototype, "data", null);
2281
- __decorate([
2282
- Output(),
2283
- __metadata("design:type", EventEmitter)
2284
- ], ToolBarSplitButtonComponent.prototype, "buttonClick", void 0);
2285
- __decorate([
2286
- Output(),
2287
- __metadata("design:type", EventEmitter)
2288
- ], ToolBarSplitButtonComponent.prototype, "itemClick", void 0);
2289
- __decorate([
2290
- Output(),
2291
- __metadata("design:type", EventEmitter)
2292
- ], ToolBarSplitButtonComponent.prototype, "open", void 0);
2293
- __decorate([
2294
- Output(),
2295
- __metadata("design:type", EventEmitter)
2296
- ], ToolBarSplitButtonComponent.prototype, "close", void 0);
2297
- __decorate([
2298
- ViewChild('toolbarTemplate', { static: true }),
2299
- __metadata("design:type", TemplateRef)
2300
- ], ToolBarSplitButtonComponent.prototype, "toolbarTemplate", void 0);
2301
- __decorate([
2302
- ViewChild('popupTemplate', { static: true }),
2303
- __metadata("design:type", TemplateRef)
2304
- ], ToolBarSplitButtonComponent.prototype, "popupTemplate", void 0);
2305
- __decorate([
2306
- ViewChild('toolbarSplitButton', { static: false }),
2307
- __metadata("design:type", SplitButtonComponent)
2308
- ], ToolBarSplitButtonComponent.prototype, "toolbarSplitButton", void 0);
2309
- __decorate([
2310
- ViewChild('overflowSplitButton', { read: ElementRef, static: false }),
2311
- __metadata("design:type", ElementRef)
2312
- ], ToolBarSplitButtonComponent.prototype, "overflowSplitButton", void 0);
2313
- __decorate([
2314
- ViewChild('overflowSplitButtonButtonList', { static: false }),
2315
- __metadata("design:type", ToolBarButtonListComponent)
2316
- ], ToolBarSplitButtonComponent.prototype, "overflowSplitButtonButtonList", void 0);
2317
- ToolBarSplitButtonComponent = ToolBarSplitButtonComponent_1 = __decorate([
2318
- Component({
2319
- exportAs: 'kendoToolBarSplitButton',
2320
- // tslint:disable-next-line:no-forward-ref
2321
- providers: [{ provide: ToolBarToolComponent, useExisting: forwardRef(function () { return ToolBarSplitButtonComponent_1; }) }],
2322
- selector: 'kendo-toolbar-splitbutton',
2323
- template: "\n <ng-template #toolbarTemplate>\n <kendo-splitbutton\n #toolbarSplitButton\n [data]=\"data\"\n [text]=\"toolbarOptions.text\"\n [icon]=\"toolbarOptions.icon\"\n [iconClass]=\"toolbarOptions.iconClass\"\n [imageUrl]=\"toolbarOptions.imageUrl\"\n [buttonClass]=\"buttonClass\"\n [arrowButtonClass]=\"arrowButtonClass\"\n [arrowButtonIcon]=\"arrowButtonIcon\"\n [disabled]=\"disabled\"\n [tabIndex]=\"-1\"\n [textField]=\"textField\"\n [popupSettings]=\"popupSettings\"\n [fillMode]=\"fillMode\"\n [themeColor]=\"fillMode ? themeColor : null\"\n (buttonClick)=\"buttonClick.emit($event)\"\n (open)=\"open.emit($event)\"\n (close)=\"close.emit($event)\"\n (itemClick)=\"itemClick.emit($event)\"\n >\n </kendo-splitbutton>\n </ng-template>\n <ng-template #popupTemplate>\n <button\n #overflowSplitButton\n type=\"button\"\n tabindex=\"-1\"\n [fillMode]=\"fillMode\"\n [themeColor]=\"fillMode ? themeColor : null\"\n kendoButton\n class=\"k-overflow-button\"\n [disabled]=\"disabled\"\n [icon]=\"overflowOptions.icon\"\n [iconClass]=\"overflowOptions.iconClass\"\n [imageUrl]=\"overflowOptions.imageUrl\"\n [ngClass]=\"buttonClass\"\n (click)=\"buttonClick.emit($event)\"\n (click)=\"onMainButtonClick($event)\"\n >\n {{ overflowOptions.text }}\n </button>\n <kendo-toolbar-buttonlist\n #overflowSplitButtonButtonList\n [data]=\"data\"\n [disabled]=\"disabled\"\n [fillMode]=\"fillMode\"\n [themeColor]=\"fillMode ? themeColor : null\"\n [textField]=\"textField\"\n (itemClick)=\"itemClick.emit($event)\"\n (click)=\"onButtonListClick($event)\"\n >\n </kendo-toolbar-buttonlist>\n </ng-template>\n "
2324
- }),
2325
- __metadata("design:paramtypes", [])
2326
- ], ToolBarSplitButtonComponent);
2327
- return ToolBarSplitButtonComponent;
2328
- }(ToolBarToolComponent));
2329
-
2330
- /**
2331
- * Represents the [Kendo UI ToolBar Separator for Angular]({% slug controltypes_toolbar %}#toc-separators).
2332
- */
2333
- var ToolBarSeparatorComponent = /** @class */ (function (_super) {
2334
- __extends(ToolBarSeparatorComponent, _super);
2335
- function ToolBarSeparatorComponent() {
2336
- return _super.call(this) || this;
2337
- }
2338
- ToolBarSeparatorComponent_1 = ToolBarSeparatorComponent;
2339
- /**
2340
- * @hidden
2341
- */
2342
- ToolBarSeparatorComponent.prototype.canFocus = function () {
2343
- return false;
2344
- };
2345
- // If this is not here, the docs display info from its parent(ToolBarToolComponent).
2346
- /**
2347
- * @hidden
2348
- */
2349
- ToolBarSeparatorComponent.prototype.focus = function () {
2350
- /* noop */
2351
- };
2352
- // If this is not here, the docs display info from its parent(ToolBarToolComponent).
2353
- /**
2354
- * @hidden
2355
- */
2356
- ToolBarSeparatorComponent.prototype.handleKey = function () {
2357
- return false;
2358
- };
2359
- ToolBarSeparatorComponent.prototype.ngAfterViewInit = function () {
2360
- if (!this.popupTemplate) {
2361
- this.popupTemplate = this.toolbarTemplate;
2362
- }
2363
- };
2364
- var ToolBarSeparatorComponent_1;
2365
- __decorate([
2366
- ViewChild('toolbarTemplate', { static: true }),
2367
- __metadata("design:type", TemplateRef)
2368
- ], ToolBarSeparatorComponent.prototype, "toolbarTemplate", void 0);
2369
- __decorate([
2370
- ViewChild('popupTemplate', { static: true }),
2371
- __metadata("design:type", TemplateRef)
2372
- ], ToolBarSeparatorComponent.prototype, "popupTemplate", void 0);
2373
- __decorate([
2374
- ViewChild('separator', { static: false }),
2375
- __metadata("design:type", ElementRef)
2376
- ], ToolBarSeparatorComponent.prototype, "separator", void 0);
2377
- ToolBarSeparatorComponent = ToolBarSeparatorComponent_1 = __decorate([
2378
- Component({
2379
- exportAs: 'kendoToolBarSeparator',
2380
- // tslint:disable-next-line:no-forward-ref
2381
- providers: [{ provide: ToolBarToolComponent, useExisting: forwardRef(function () { return ToolBarSeparatorComponent_1; }) }],
2382
- selector: 'kendo-toolbar-separator',
2383
- template: "\n <ng-template #toolbarTemplate>\n <div class=\"k-separator\"></div>\n </ng-template>\n "
2384
- }),
2385
- __metadata("design:paramtypes", [])
2386
- ], ToolBarSeparatorComponent);
2387
- return ToolBarSeparatorComponent;
2388
- }(ToolBarToolComponent));
2389
-
2390
- /**
2391
- * @hidden
2392
- */
2393
- var RendererService = /** @class */ (function () {
2394
- function RendererService() {
2395
- }
2396
- RendererService.prototype.getElement = function () {
2397
- return this.element.nativeElement;
2398
- };
2399
- RendererService.prototype.querySelector = function (selector) {
2400
- return this.element.nativeElement.querySelector(selector);
2401
- };
2402
- RendererService.prototype.querySelectorAll = function (selector) {
2403
- return this.element.nativeElement.querySelectorAll(selector);
2404
- };
2405
- RendererService.prototype.findFocusable = function () {
2406
- return findFocusable(this.element.nativeElement, false);
2407
- };
2408
- RendererService.prototype.findFocusableChild = function (element) {
2409
- if (!element) {
2410
- element = this.findFocusable();
2411
- }
2412
- return findFocusableChild(element, false);
2413
- };
2414
- RendererService.prototype.findNextFocusableSibling = function (element) {
2415
- if (!element) {
2416
- element = this.findFocusable();
2417
- }
2418
- return findFocusableSibling(element, false);
2419
- };
2420
- RendererService.prototype.findPrevFocusableSibling = function (element) {
2421
- if (!element) {
2422
- element = this.findFocusable();
2423
- }
2424
- return findFocusableSibling(element, false, true);
2425
- };
2426
- RendererService.prototype.setAttribute = function (element, attr, value) {
2427
- this.renderer.setAttribute(element, attr, value);
2428
- };
2429
- RendererService = __decorate([
2430
- Injectable()
2431
- ], RendererService);
2432
- return RendererService;
2433
- }());
2434
-
2435
- /**
2436
- * @hidden
2437
- */
2438
- var ToolBarRendererComponent = /** @class */ (function () {
2439
- function ToolBarRendererComponent(element, renderer, rendererService, refreshService) {
2440
- var _this = this;
2441
- this.element = element;
2442
- this.renderer = renderer;
2443
- this.rendererService = rendererService;
2444
- this.refreshService = refreshService;
2445
- this.rendererClick = new EventEmitter();
2446
- this.rendererService.element = element;
2447
- this.rendererService.renderer = this;
2448
- this.refreshSubscription = this.refreshService.onRefresh.subscribe(function (tool) {
2449
- if (_this.tool === tool) {
2450
- _this.refresh();
2451
- }
2452
- });
2453
- }
2454
- ToolBarRendererComponent.prototype.onClick = function (ev) {
2455
- this.rendererClick.emit({ context: this, event: ev });
2456
- };
2457
- ToolBarRendererComponent.prototype.ngOnInit = function () {
2458
- if (this.resizable) {
2459
- if (this.location === 'toolbar') {
2460
- this.template = this.tool.toolbarTemplate;
2461
- this.renderer.setStyle(this.element.nativeElement, 'visibility', 'hidden');
2462
- this.renderer.setStyle(this.element.nativeElement, 'display', 'none');
2463
- }
2464
- else {
2465
- this.template = this.tool.popupTemplate;
2466
- this.renderer.setStyle(this.element.nativeElement, 'display', 'none');
2467
- }
2468
- }
2469
- else {
2470
- this.tool.overflows = false;
2471
- this.template = this.tool.toolbarTemplate;
2472
- this.renderer.setStyle(this.element.nativeElement, 'visibility', 'display');
2473
- this.renderer.setStyle(this.element.nativeElement, 'display', 'inline-block');
2474
- }
2475
- };
2476
- ToolBarRendererComponent.prototype.ngOnDestroy = function () {
2477
- this.refreshSubscription.unsubscribe();
2478
- };
2479
- ToolBarRendererComponent.prototype.ngAfterViewInit = function () {
2480
- if (this.resizable) {
2481
- this.refresh();
2482
- }
2483
- };
2484
- Object.defineProperty(ToolBarRendererComponent.prototype, "width", {
2485
- /**
2486
- * @hidden
2487
- */
2488
- get: function () {
2489
- return this.tool.overflows ? 0 : outerWidth(this.element.nativeElement);
2490
- },
2491
- enumerable: true,
2492
- configurable: true
2493
- });
2494
- /**
2495
- * @hidden
2496
- */
2497
- ToolBarRendererComponent.prototype.isDisplayed = function () {
2498
- return this.element.nativeElement.style.display !== 'none';
2499
- };
2500
- /**
2501
- * @hidden
2502
- */
2503
- ToolBarRendererComponent.prototype.refresh = function () {
2504
- if (this.resizable) {
2505
- if (this.location === 'toolbar') {
2506
- this.renderer.setStyle(this.element.nativeElement, 'visibility', this.tool.visibility);
2507
- this.renderer.setStyle(this.element.nativeElement, 'display', this.tool.toolbarDisplay);
2508
- }
2509
- else {
2510
- this.renderer.setStyle(this.element.nativeElement, 'display', this.tool.overflowDisplay);
2511
- }
2512
- }
2513
- };
2514
- /**
2515
- * @hidden
2516
- */
2517
- ToolBarRendererComponent.prototype.setAttribute = function (element, attr, value) {
2518
- this.renderer.setAttribute(element, attr, value);
2519
- };
2520
- __decorate([
2521
- Input(),
2522
- __metadata("design:type", ToolBarToolComponent)
2523
- ], ToolBarRendererComponent.prototype, "tool", void 0);
2524
- __decorate([
2525
- Input(),
2526
- __metadata("design:type", String)
2527
- ], ToolBarRendererComponent.prototype, "location", void 0);
2528
- __decorate([
2529
- Input(),
2530
- __metadata("design:type", Boolean)
2531
- ], ToolBarRendererComponent.prototype, "resizable", void 0);
2532
- __decorate([
2533
- Output(),
2534
- __metadata("design:type", EventEmitter)
2535
- ], ToolBarRendererComponent.prototype, "rendererClick", void 0);
2536
- __decorate([
2537
- HostListener('click', ['$event']),
2538
- __metadata("design:type", Function),
2539
- __metadata("design:paramtypes", [Object]),
2540
- __metadata("design:returntype", void 0)
2541
- ], ToolBarRendererComponent.prototype, "onClick", null);
2542
- ToolBarRendererComponent = __decorate([
2543
- Component({
2544
- exportAs: 'kendoToolBarRenderer',
2545
- providers: [RendererService],
2546
- selector: 'kendo-toolbar-renderer',
2547
- template: "\n <ng-container *ngIf=\"location === 'toolbar'\">\n <ng-template [ngTemplateOutlet]=\"template\"></ng-template>\n </ng-container>\n <ng-container *ngIf=\"location === 'overflow' && tool.responsive\">\n <ng-template [ngTemplateOutlet]=\"template\"></ng-template>\n </ng-container>\n "
2548
- }),
2549
- __metadata("design:paramtypes", [ElementRef,
2550
- Renderer2,
2551
- RendererService,
2552
- RefreshService])
2553
- ], ToolBarRendererComponent);
2554
- return ToolBarRendererComponent;
2555
- }());
2556
-
2557
- /**
2558
- * @hidden
2559
- */
2560
- var ToolbarMessages = /** @class */ (function (_super) {
2561
- __extends(ToolbarMessages, _super);
2562
- function ToolbarMessages() {
2563
- return _super !== null && _super.apply(this, arguments) || this;
2564
- }
2565
- __decorate([
2566
- Input(),
2567
- __metadata("design:type", String)
2568
- ], ToolbarMessages.prototype, "moreToolsTitle", void 0);
2569
- return ToolbarMessages;
2570
- }(ComponentMessages));
2571
-
2572
- /**
2573
- * @hidden
2574
- */
2575
- var LocalizedToolbarMessagesDirective = /** @class */ (function (_super) {
2576
- __extends(LocalizedToolbarMessagesDirective, _super);
2577
- function LocalizedToolbarMessagesDirective(service) {
2578
- var _this = _super.call(this) || this;
2579
- _this.service = service;
2580
- return _this;
2581
- }
2582
- LocalizedToolbarMessagesDirective_1 = LocalizedToolbarMessagesDirective;
2583
- var LocalizedToolbarMessagesDirective_1;
2584
- LocalizedToolbarMessagesDirective = LocalizedToolbarMessagesDirective_1 = __decorate([
2585
- Directive({
2586
- providers: [
2587
- {
2588
- provide: ToolbarMessages,
2589
- useExisting: forwardRef(function () { return LocalizedToolbarMessagesDirective_1; }) // tslint:disable-line:no-forward-ref
2590
- }
2591
- ],
2592
- selector: '[kendoToolbarLocalizedMessages]'
2593
- }),
2594
- __metadata("design:paramtypes", [LocalizationService])
2595
- ], LocalizedToolbarMessagesDirective);
2596
- return LocalizedToolbarMessagesDirective;
2597
- }(ToolbarMessages));
2598
-
2599
- /**
2600
- * Custom component messages override default component messages.
2601
- */
2602
- var ToolbarCustomMessagesComponent = /** @class */ (function (_super) {
2603
- __extends(ToolbarCustomMessagesComponent, _super);
2604
- function ToolbarCustomMessagesComponent(service) {
2605
- var _this = _super.call(this) || this;
2606
- _this.service = service;
2607
- return _this;
2608
- }
2609
- ToolbarCustomMessagesComponent_1 = ToolbarCustomMessagesComponent;
2610
- Object.defineProperty(ToolbarCustomMessagesComponent.prototype, "override", {
2611
- get: function () {
2612
- return true;
2613
- },
2614
- enumerable: true,
2615
- configurable: true
2616
- });
2617
- var ToolbarCustomMessagesComponent_1;
2618
- ToolbarCustomMessagesComponent = ToolbarCustomMessagesComponent_1 = __decorate([
2619
- Component({
2620
- providers: [
2621
- {
2622
- provide: ToolbarMessages,
2623
- useExisting: forwardRef(function () { return ToolbarCustomMessagesComponent_1; }) // tslint:disable-line:no-forward-ref
2624
- }
2625
- ],
2626
- selector: 'kendo-toolbar-messages',
2627
- template: ""
2628
- }),
2629
- __metadata("design:paramtypes", [LocalizationService])
2630
- ], ToolbarCustomMessagesComponent);
2631
- return ToolbarCustomMessagesComponent;
2632
- }(ToolbarMessages));
2633
-
2634
- var TOOLBAR_TOOLS = [
2635
- ToolBarToolComponent,
2636
- ToolBarButtonComponent,
2637
- ToolBarButtonGroupComponent,
2638
- ToolBarDropDownButtonComponent,
2639
- ToolBarSplitButtonComponent,
2640
- ToolBarSeparatorComponent
2641
- ];
2642
- var TOOLBAR_COMMON = [
2643
- ToolBarRendererComponent,
2644
- ToolBarButtonListComponent,
2645
- ToolbarCustomMessagesComponent,
2646
- LocalizedToolbarMessagesDirective
2647
- ];
2648
- /**
2649
- * Represents the [NgModule]({{ site.data.urls.angular['ngmoduleapi'] }}) definition for the ToolBar component.
2650
- *
2651
- * The package exports:
2652
- * - `ToolBarComponent`&mdash;The ToolBarComponent class.
2653
- * - `ToolBarToolComponent`&mdash;The base Tool component class.
2654
- * - `ToolBarButtonComponent`&mdash;The Button Tool component class.
2655
- * - `ToolBarButtonGroupComponent`&mdash;The ButtonGroup Tool component class.
2656
- * - `ToolBarDropDownButtonComponent`&mdash;The DropDownButton Tool component class.
2657
- * - `ToolBarSplitButtonComponent`&mdash;The SplitButton Tool component class.
2658
- * - `ToolBarSeparatorComponent`&mdash;The Separator Tool component class.
2659
- */
2660
- var ToolBarModule = /** @class */ (function () {
2661
- function ToolBarModule() {
2662
- }
2663
- ToolBarModule = __decorate([
2664
- NgModule({
2665
- declarations: [ToolBarComponent, TOOLBAR_TOOLS, TOOLBAR_COMMON],
2666
- exports: [ToolBarComponent, TOOLBAR_TOOLS, ToolbarCustomMessagesComponent, LocalizedToolbarMessagesDirective],
2667
- imports: [CommonModule, ButtonsModule, PopupModule, ResizeSensorModule]
2668
- })
2669
- ], ToolBarModule);
2670
- return ToolBarModule;
2671
- }());
2672
-
2673
- /**
2674
- * Generated bundle index. Do not edit.
2675
- */
2676
-
2677
- export { ToolbarMessages, NavigationService, RefreshService, ToolBarRendererComponent, RendererService, ToolBarButtonListComponent, ToolBarComponent, ToolBarToolComponent, ToolBarButtonComponent, ToolBarButtonGroupComponent, ToolBarDropDownButtonComponent, ToolBarSplitButtonComponent, ToolBarSeparatorComponent, ToolBarModule, LocalizedToolbarMessagesDirective, ToolbarCustomMessagesComponent };