@progress/kendo-angular-toolbar 5.0.4 → 6.0.0-dev.202204190531

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