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