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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/bundles/kendo-angular-toolbar.umd.js +5 -0
  2. package/{dist/es2015/common → common}/constants.d.ts +0 -0
  3. package/{dist/es2015/common → common}/preventable-event.d.ts +0 -0
  4. package/{dist/es2015/common → common}/renderer-click.d.ts +0 -0
  5. package/{dist/es2015/direction.d.ts → direction.d.ts} +0 -0
  6. package/{dist/es2015/display-mode.d.ts → display-mode.d.ts} +0 -0
  7. package/{dist/es2015 → esm2015}/common/constants.js +0 -0
  8. package/{dist/es2015 → esm2015}/common/preventable-event.js +0 -0
  9. package/{dist/es → esm2015}/common/renderer-click.js +1 -0
  10. package/{dist/es2015 → esm2015}/direction.js +1 -0
  11. package/{dist/es2015 → esm2015}/display-mode.js +1 -0
  12. package/{dist/es2015 → esm2015}/group-selection-settings.js +1 -0
  13. package/{dist/es/common/constants.js → esm2015/kendo-angular-toolbar.js} +2 -2
  14. package/esm2015/localization/custom-messages.component.js +40 -0
  15. package/esm2015/localization/localized-toolbar-messages.directive.js +36 -0
  16. package/esm2015/localization/messages.js +23 -0
  17. package/{dist/es → esm2015}/main.js +0 -0
  18. package/{dist/es2015 → esm2015}/navigation.service.js +9 -9
  19. package/{dist/es2015 → esm2015}/package-metadata.js +1 -1
  20. package/{dist/es → esm2015}/popup-settings.js +1 -0
  21. package/{dist/es2015 → esm2015}/refresh.service.js +8 -10
  22. package/{dist/es → esm2015}/render-location.js +1 -0
  23. package/{dist/es2015 → esm2015}/renderer.component.js +36 -41
  24. package/{dist/es2015 → esm2015}/renderer.service.js +8 -7
  25. package/{dist/es → esm2015}/tool-options.js +1 -0
  26. package/{dist/es2015 → esm2015}/toolbar.component.js +158 -135
  27. package/{dist/es2015 → esm2015}/toolbar.module.js +27 -11
  28. package/{dist/es2015 → esm2015}/tools/toolbar-button.component.js +117 -114
  29. package/esm2015/tools/toolbar-buttongroup.component.js +267 -0
  30. package/esm2015/tools/toolbar-buttonlist.component.js +94 -0
  31. package/{dist/es2015 → esm2015}/tools/toolbar-dropdownbutton.component.js +119 -121
  32. package/esm2015/tools/toolbar-separator.component.js +68 -0
  33. package/{dist/es2015 → esm2015}/tools/toolbar-splitbutton.component.js +129 -125
  34. package/{dist/es2015 → esm2015}/tools/toolbar-tool.component.js +15 -19
  35. package/{dist/es2015 → esm2015}/util.js +0 -0
  36. package/{dist/fesm2015/index.js → fesm2015/kendo-angular-toolbar.js} +1015 -890
  37. package/{dist/es2015/group-selection-settings.d.ts → group-selection-settings.d.ts} +0 -0
  38. package/kendo-angular-toolbar.d.ts +9 -0
  39. package/{dist/es2015/localization → localization}/custom-messages.component.d.ts +4 -1
  40. package/{dist/es2015/localization → localization}/localized-toolbar-messages.directive.d.ts +3 -0
  41. package/{dist/es2015/localization → localization}/messages.d.ts +3 -0
  42. package/{dist/es2015/main.d.ts → main.d.ts} +0 -0
  43. package/{dist/es2015/navigation.service.d.ts → navigation.service.d.ts} +3 -0
  44. package/{dist/es2015/package-metadata.d.ts → package-metadata.d.ts} +0 -0
  45. package/package.json +34 -102
  46. package/{dist/es2015/popup-settings.d.ts → popup-settings.d.ts} +0 -0
  47. package/{dist/es2015/refresh.service.d.ts → refresh.service.d.ts} +3 -0
  48. package/{dist/es2015/render-location.d.ts → render-location.d.ts} +0 -0
  49. package/{dist/es2015/renderer.component.d.ts → renderer.component.d.ts} +4 -1
  50. package/{dist/es2015/renderer.service.d.ts → renderer.service.d.ts} +3 -0
  51. package/schematics/ngAdd/index.js +5 -2
  52. package/schematics/ngAdd/index.js.map +1 -1
  53. package/{dist/es2015/tool-options.d.ts → tool-options.d.ts} +0 -0
  54. package/{dist/es2015/toolbar.component.d.ts → toolbar.component.d.ts} +24 -17
  55. package/toolbar.module.d.ts +37 -0
  56. package/{dist/es2015/tools → tools}/toolbar-button.component.d.ts +10 -6
  57. package/{dist/es2015/tools → tools}/toolbar-buttongroup.component.d.ts +7 -5
  58. package/{dist/es2015/tools → tools}/toolbar-buttonlist.component.d.ts +3 -0
  59. package/{dist/es2015/tools → tools}/toolbar-dropdownbutton.component.d.ts +15 -10
  60. package/{dist/es2015/tools → tools}/toolbar-separator.component.d.ts +3 -0
  61. package/{dist/es2015/tools → tools}/toolbar-splitbutton.component.d.ts +14 -9
  62. package/{dist/es2015/tools → tools}/toolbar-tool.component.d.ts +5 -2
  63. package/{dist/es2015/util.d.ts → util.d.ts} +0 -0
  64. package/dist/cdn/js/kendo-angular-toolbar.js +0 -20
  65. package/dist/cdn/main.js +0 -5
  66. package/dist/es/common/preventable-event.js +0 -29
  67. package/dist/es/direction.js +0 -4
  68. package/dist/es/display-mode.js +0 -4
  69. package/dist/es/group-selection-settings.js +0 -4
  70. package/dist/es/index.js +0 -14
  71. package/dist/es/localization/custom-messages.component.js +0 -43
  72. package/dist/es/localization/localized-toolbar-messages.directive.js +0 -35
  73. package/dist/es/localization/messages.js +0 -22
  74. package/dist/es/navigation.service.js +0 -130
  75. package/dist/es/package-metadata.js +0 -15
  76. package/dist/es/refresh.service.js +0 -22
  77. package/dist/es/renderer.component.js +0 -132
  78. package/dist/es/renderer.service.js +0 -52
  79. package/dist/es/toolbar.component.js +0 -653
  80. package/dist/es/toolbar.module.js +0 -60
  81. package/dist/es/tools/toolbar-button.component.js +0 -310
  82. package/dist/es/tools/toolbar-buttongroup.component.js +0 -165
  83. package/dist/es/tools/toolbar-buttonlist.component.js +0 -66
  84. package/dist/es/tools/toolbar-dropdownbutton.component.js +0 -368
  85. package/dist/es/tools/toolbar-separator.component.js +0 -67
  86. package/dist/es/tools/toolbar-splitbutton.component.js +0 -380
  87. package/dist/es/tools/toolbar-tool.component.js +0 -76
  88. package/dist/es/util.js +0 -204
  89. package/dist/es2015/common/renderer-click.js +0 -4
  90. package/dist/es2015/index.d.ts +0 -14
  91. package/dist/es2015/index.js +0 -14
  92. package/dist/es2015/index.metadata.json +0 -1
  93. package/dist/es2015/localization/custom-messages.component.js +0 -35
  94. package/dist/es2015/localization/localized-toolbar-messages.directive.js +0 -31
  95. package/dist/es2015/localization/messages.js +0 -16
  96. package/dist/es2015/main.js +0 -14
  97. package/dist/es2015/popup-settings.js +0 -4
  98. package/dist/es2015/render-location.js +0 -4
  99. package/dist/es2015/tool-options.js +0 -4
  100. package/dist/es2015/toolbar.module.d.ts +0 -18
  101. package/dist/es2015/tools/toolbar-buttongroup.component.js +0 -216
  102. package/dist/es2015/tools/toolbar-buttonlist.component.js +0 -87
  103. package/dist/es2015/tools/toolbar-separator.component.js +0 -68
  104. package/dist/fesm5/index.js +0 -2677
  105. package/dist/npm/common/constants.js +0 -10
  106. package/dist/npm/common/preventable-event.js +0 -31
  107. package/dist/npm/common/renderer-click.js +0 -6
  108. package/dist/npm/direction.js +0 -6
  109. package/dist/npm/display-mode.js +0 -6
  110. package/dist/npm/group-selection-settings.js +0 -6
  111. package/dist/npm/index.js +0 -23
  112. package/dist/npm/localization/custom-messages.component.js +0 -45
  113. package/dist/npm/localization/localized-toolbar-messages.directive.js +0 -37
  114. package/dist/npm/localization/messages.js +0 -24
  115. package/dist/npm/main.js +0 -26
  116. package/dist/npm/navigation.service.js +0 -132
  117. package/dist/npm/package-metadata.js +0 -17
  118. package/dist/npm/popup-settings.js +0 -6
  119. package/dist/npm/refresh.service.js +0 -24
  120. package/dist/npm/render-location.js +0 -6
  121. package/dist/npm/renderer.component.js +0 -134
  122. package/dist/npm/renderer.service.js +0 -54
  123. package/dist/npm/tool-options.js +0 -6
  124. package/dist/npm/toolbar.component.js +0 -655
  125. package/dist/npm/toolbar.module.js +0 -62
  126. package/dist/npm/tools/toolbar-button.component.js +0 -312
  127. package/dist/npm/tools/toolbar-buttongroup.component.js +0 -167
  128. package/dist/npm/tools/toolbar-buttonlist.component.js +0 -68
  129. package/dist/npm/tools/toolbar-dropdownbutton.component.js +0 -370
  130. package/dist/npm/tools/toolbar-separator.component.js +0 -69
  131. package/dist/npm/tools/toolbar-splitbutton.component.js +0 -382
  132. package/dist/npm/tools/toolbar-tool.component.js +0 -78
  133. package/dist/npm/util.js +0 -209
  134. package/dist/systemjs/kendo-angular-toolbar.js +0 -5
@@ -1,653 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import * as tslib_1 from "tslib";
6
- import { Component, HostBinding, ViewChild, TemplateRef, ElementRef, QueryList, ContentChildren, Input, ViewChildren, HostListener, Output, EventEmitter, ViewContainerRef, NgZone, Renderer2, ChangeDetectorRef } from '@angular/core';
7
- import { PopupService } from '@progress/kendo-angular-popup';
8
- import { ResizeSensorComponent } from '@progress/kendo-angular-common';
9
- import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
10
- import { validatePackage } from '@progress/kendo-licensing';
11
- import { packageMetadata } from './package-metadata';
12
- import { RefreshService } from './refresh.service';
13
- import { NavigationService } from './navigation.service';
14
- import { ToolBarToolComponent } from './tools/toolbar-tool.component';
15
- import { outerWidth, innerWidth, closest, isPresent } from './util';
16
- import { Keys } from '@progress/kendo-angular-common';
17
- import { PreventableEvent } from './common/preventable-event';
18
- import { Subscription, fromEvent, Subject, merge } from 'rxjs';
19
- import { bufferTime, take, takeUntil } from 'rxjs/operators';
20
- import { filter } from 'rxjs/operators';
21
- import { isDocumentAvailable } from '@progress/kendo-angular-common';
22
- import { defaultPopupWidth } from './common/constants';
23
- var getInitialPopupSettings = function (isRtl) { return ({
24
- animate: true,
25
- anchorAlign: { horizontal: isRtl ? 'left' : 'right', vertical: 'bottom' },
26
- popupAlign: { horizontal: isRtl ? 'left' : 'right', vertical: 'top' }
27
- }); };
28
- var ɵ0 = getInitialPopupSettings;
29
- /**
30
- * Represents the [Kendo UI ToolBar component for Angular]({% slug overview_toolbar %}).
31
- */
32
- var ToolBarComponent = /** @class */ (function () {
33
- function ToolBarComponent(localization, popupService, refreshService, navigationService, element, zone, renderer, _cdr) {
34
- this.localization = localization;
35
- this.popupService = popupService;
36
- this.refreshService = refreshService;
37
- this.navigationService = navigationService;
38
- this.element = element;
39
- this.zone = zone;
40
- this.renderer = renderer;
41
- this._cdr = _cdr;
42
- /**
43
- * Hides the overflowing tools in a popup.
44
- */
45
- this.overflow = false;
46
- /**
47
- * Specifies the [`tabindex`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the ToolBar.
48
- */
49
- this.tabindex = 0;
50
- /**
51
- * Fires when the overflow popup of the ToolBar is opened.
52
- */
53
- this.open = new EventEmitter();
54
- /**
55
- * Fires when the overflow popup of the ToolBar is closed.
56
- */
57
- this.close = new EventEmitter();
58
- this.hostClasses = true;
59
- this.cancelRenderedToolsSubscription$ = new Subject();
60
- this.subscriptions = new Subscription();
61
- validatePackage(packageMetadata);
62
- this.direction = localization.rtl ? 'rtl' : 'ltr';
63
- }
64
- Object.defineProperty(ToolBarComponent.prototype, "resizable", {
65
- get: function () {
66
- return this.overflow;
67
- },
68
- /**
69
- * @hidden
70
- */
71
- set: function (value) {
72
- this.overflow = value;
73
- },
74
- enumerable: true,
75
- configurable: true
76
- });
77
- Object.defineProperty(ToolBarComponent.prototype, "popupSettings", {
78
- get: function () {
79
- return this._popupSettings || getInitialPopupSettings(this.localization.rtl);
80
- },
81
- /**
82
- * Configures the popup of the ToolBar drop-down list.
83
- *
84
- * The available options are:
85
- * - `animate: Boolean`—Controls the popup animation. By default, the open and close animations are enabled.
86
- * - `popupClass: String`—Specifies a list of CSS classes that are used to style the popup.
87
- */
88
- set: function (settings) {
89
- this._popupSettings = Object.assign({}, getInitialPopupSettings(this.localization.rtl), settings);
90
- },
91
- enumerable: true,
92
- configurable: true
93
- });
94
- Object.defineProperty(ToolBarComponent.prototype, "tabIndex", {
95
- get: function () {
96
- return this.tabindex;
97
- },
98
- /**
99
- * @hidden
100
- */
101
- set: function (tabIndex) {
102
- this.tabindex = tabIndex;
103
- },
104
- enumerable: true,
105
- configurable: true
106
- });
107
- Object.defineProperty(ToolBarComponent.prototype, "appendTo", {
108
- get: function () {
109
- var appendTo = this.popupSettings.appendTo;
110
- if (!appendTo || appendTo === 'root') {
111
- return undefined;
112
- }
113
- return appendTo === 'component' ? this.container : appendTo;
114
- },
115
- enumerable: true,
116
- configurable: true
117
- });
118
- Object.defineProperty(ToolBarComponent.prototype, "popupOpen", {
119
- get: function () {
120
- return this._open;
121
- },
122
- set: function (open) {
123
- if (this.popupOpen === open) {
124
- return;
125
- }
126
- var eventArgs = new PreventableEvent();
127
- if (open) {
128
- this.open.emit(eventArgs);
129
- }
130
- else {
131
- this.close.emit(eventArgs);
132
- }
133
- if (eventArgs.isDefaultPrevented()) {
134
- return;
135
- }
136
- this.toggle(open);
137
- },
138
- enumerable: true,
139
- configurable: true
140
- });
141
- /**
142
- * @hidden
143
- */
144
- ToolBarComponent.prototype.onFocus = function (ev) {
145
- this.navigationService.resetNavigation();
146
- this.navigationService.focusFirst(ev);
147
- // prevents ExpressionChangedAfterItHasBeenCheckedError when tools with popup are opened/closed asynchronously
148
- this.element.nativeElement.setAttribute('tabindex', '-1');
149
- };
150
- /**
151
- * @hidden
152
- */
153
- ToolBarComponent.prototype.onFocusOut = function (event) {
154
- var _this = this;
155
- // prevents ExpressionChangedAfterItHasBeenCheckedError when tools with popup are opened/closed asynchronously
156
- if (closest(event.relatedTarget, function (el) { return el === _this.element.nativeElement; })) {
157
- this.element.nativeElement.setAttribute('tabindex', '-1');
158
- return;
159
- }
160
- this.element.nativeElement.setAttribute('tabindex', this.tabindex.toString());
161
- };
162
- Object.defineProperty(ToolBarComponent.prototype, "getRole", {
163
- get: function () {
164
- return 'toolbar';
165
- },
166
- enumerable: true,
167
- configurable: true
168
- });
169
- Object.defineProperty(ToolBarComponent.prototype, "getDir", {
170
- get: function () {
171
- return this.direction;
172
- },
173
- enumerable: true,
174
- configurable: true
175
- });
176
- Object.defineProperty(ToolBarComponent.prototype, "resizableClass", {
177
- get: function () {
178
- return this.overflow;
179
- },
180
- enumerable: true,
181
- configurable: true
182
- });
183
- ToolBarComponent.prototype.ngAfterViewInit = function () {
184
- var _this = this;
185
- var element = this.element.nativeElement;
186
- if (!element.getAttribute('tabindex')) {
187
- this.element.nativeElement.setAttribute('tabindex', '0');
188
- }
189
- this.zone.runOutsideAngular(function () {
190
- _this.toolbarKeydownListener = _this.renderer.listen(_this.element.nativeElement, 'keydown', function (ev) {
191
- switch (ev.keyCode) {
192
- case Keys.ArrowLeft:
193
- _this.zone.run(function () {
194
- ev.preventDefault();
195
- _this.direction === 'ltr' ? _this.navigationService.focusPrev(ev) : _this.navigationService.focusNext(ev);
196
- // prevents ExpressionChangedAfterItHasBeenCheckedError when tools with popup are opened/closed asynchronously
197
- _this.element.nativeElement.setAttribute('tabindex', '-1');
198
- });
199
- break;
200
- case Keys.ArrowRight:
201
- _this.zone.run(function () {
202
- ev.preventDefault();
203
- _this.direction === 'ltr' ? _this.navigationService.focusNext(ev) : _this.navigationService.focusPrev(ev);
204
- // prevents ExpressionChangedAfterItHasBeenCheckedError when tools with popup are opened/closed asynchronously
205
- _this.element.nativeElement.setAttribute('tabindex', '-1');
206
- });
207
- break;
208
- case Keys.Tab:
209
- _this.zone.run(function () { return _this.navigationService.resetNavigation(); });
210
- break;
211
- case Keys.Escape:
212
- _this.zone.run(function () { return _this.toggle(false); });
213
- break;
214
- default:
215
- break;
216
- }
217
- });
218
- });
219
- if (this.overflow) {
220
- this.subscriptions.add(merge(
221
- // trigger resizing calculations once every 200ms instead of each time the resize event is emitted
222
- this.resizeSensor.resize.pipe(bufferTime(200), filter(function (v) { return v.length > 0; })), this.renderedTools.changes).subscribe(function () { _this.onResize(); }));
223
- // because of https://github.com/telerik/kendo-angular-buttons/pull/276
224
- // calling onResize twice is the trade-off for removing the manual ChangeDetection
225
- // triggering altogether - it ensures correct layout and calculations
226
- // when some tools need overflow on initial rendering
227
- this.zone.runOutsideAngular(function () { return setTimeout(function () { _this.onResize(); _this.onResize(); }); });
228
- this.navigationService.overflowButton = this.overflowButton;
229
- }
230
- this.navigationService.setRenderedTools(this.renderedTools.toArray());
231
- this.subscriptions.add(this.renderedTools.changes.subscribe(function (rts) {
232
- return _this.navigationService.setRenderedTools(rts.toArray());
233
- }));
234
- };
235
- ToolBarComponent.prototype.ngOnInit = function () {
236
- var _this = this;
237
- this.subscriptions.add(this.localization.changes.subscribe(function (_a) {
238
- var rtl = _a.rtl;
239
- return (_this.direction = rtl ? 'rtl' : 'ltr');
240
- }));
241
- if (isDocumentAvailable()) {
242
- this.zone.runOutsideAngular(function () {
243
- return _this.subscriptions.add(fromEvent(document, 'click')
244
- .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); }))
245
- .subscribe(function () {
246
- _this.zone.run(function () {
247
- _this.popupOpen = false;
248
- });
249
- }));
250
- });
251
- }
252
- };
253
- ToolBarComponent.prototype.ngOnChanges = function (changes) {
254
- if (changes.tabindex) {
255
- // prevents ExpressionChangedAfterItHasBeenCheckedError when tools with popup are opened/closed asynchronously
256
- this.element.nativeElement.setAttribute('tabindex', changes.tabindex.currentValue.toString());
257
- }
258
- };
259
- ToolBarComponent.prototype.ngOnDestroy = function () {
260
- if (this.popupRef) {
261
- this.popupRef.close();
262
- }
263
- if (this.toolbarKeydownListener) {
264
- this.toolbarKeydownListener();
265
- }
266
- this.cancelRenderedToolsSubscription$.next();
267
- this.subscriptions.unsubscribe();
268
- };
269
- Object.defineProperty(ToolBarComponent.prototype, "moreToolsTitle", {
270
- /**
271
- * @hidden
272
- */
273
- get: function () {
274
- return this.localization.get('moreToolsTitle');
275
- },
276
- enumerable: true,
277
- configurable: true
278
- });
279
- Object.defineProperty(ToolBarComponent.prototype, "cdr", {
280
- /**
281
- * @hidden
282
- */
283
- get: function () {
284
- return this._cdr;
285
- },
286
- enumerable: true,
287
- configurable: true
288
- });
289
- /**
290
- * @hidden
291
- */
292
- ToolBarComponent.prototype.onRendererClick = function (data) {
293
- this.navigationService.click(data);
294
- this.element.nativeElement.setAttribute('tabindex', '-1');
295
- };
296
- /**
297
- * @hidden
298
- */
299
- ToolBarComponent.prototype.showPopup = function () {
300
- this.popupOpen = !this.popupOpen;
301
- this.navigationService.click({ context: undefined, event: undefined });
302
- };
303
- /**
304
- * Toggles the visibility of the overflow popup.
305
- */
306
- ToolBarComponent.prototype.toggle = function (popupOpen) {
307
- this._open = popupOpen !== undefined ? popupOpen : !this.popupOpen;
308
- if (this.popupRef) {
309
- this.popupRef.close();
310
- this.popupRef = null;
311
- }
312
- if (this.popupOpen) {
313
- this.popupRef = this.popupService.open({
314
- anchor: this.overflowButton,
315
- anchorAlign: this.popupSettings.anchorAlign,
316
- popupAlign: this.popupSettings.popupAlign,
317
- content: this.popupTemplate,
318
- appendTo: this.appendTo,
319
- animate: this.popupSettings.animate,
320
- popupClass: this.popupSettings.popupClass,
321
- positionMode: 'absolute'
322
- });
323
- this.setPopupContentDimensions();
324
- this.popupRef.popupOpen.subscribe(this.onPopupOpen.bind(this));
325
- this.popupRef.popupClose.subscribe(this.onPopupClose.bind(this));
326
- }
327
- };
328
- /**
329
- * @hidden
330
- */
331
- ToolBarComponent.prototype.onResize = function () {
332
- var _this = this;
333
- if (isDocumentAvailable()) {
334
- var containerWidth = innerWidth(this.element.nativeElement) - this.overflowAnchorWidth;
335
- this.shrink(containerWidth, this.childrenWidth);
336
- this.stretch(containerWidth, this.childrenWidth);
337
- this.zone.onStable.pipe(take(1)).subscribe(function () {
338
- _this.displayAnchor();
339
- });
340
- }
341
- this.resizeSensor.acceptSize();
342
- };
343
- /**
344
- * @hidden
345
- */
346
- ToolBarComponent.prototype.onPopupOpen = function () {
347
- var _this = this;
348
- this.zone.runOutsideAngular(function () {
349
- _this.overflowKeydownListener = _this.renderer.listen(_this.popupRef.popupElement, 'keydown', function (ev) {
350
- switch (ev.keyCode) {
351
- case Keys.ArrowUp:
352
- _this.zone.run(function () {
353
- ev.preventDefault();
354
- _this.navigationService.focusPrev(ev);
355
- });
356
- break;
357
- case Keys.ArrowDown:
358
- _this.zone.run(function () {
359
- ev.preventDefault();
360
- _this.navigationService.focusNext(ev);
361
- });
362
- break;
363
- case Keys.Escape:
364
- _this.zone.run(function () { return _this.toggle(false); });
365
- break;
366
- case Keys.Tab:
367
- _this.zone.run(function () {
368
- _this.toggle(false);
369
- _this.navigationService.resetNavigation();
370
- });
371
- break;
372
- default:
373
- break;
374
- }
375
- });
376
- });
377
- this.cancelRenderedToolsSubscription$.next();
378
- this.navigationService.moveFocusToPopup();
379
- this.navigationService.setRenderedTools(this.overflowRenderedTools.toArray());
380
- this.overflowRenderedTools.changes
381
- .pipe(takeUntil(this.cancelRenderedToolsSubscription$))
382
- .subscribe(function (rts) { return _this.navigationService.setRenderedTools(rts.toArray()); });
383
- };
384
- /**
385
- * @hidden
386
- */
387
- ToolBarComponent.prototype.onPopupClose = function () {
388
- var _this = this;
389
- this.cancelRenderedToolsSubscription$.next();
390
- this.navigationService.setRenderedTools(this.renderedTools.toArray());
391
- this.renderedTools.changes
392
- .pipe(takeUntil(this.cancelRenderedToolsSubscription$))
393
- .subscribe(function (rts) { return _this.navigationService.setRenderedTools(rts.toArray()); });
394
- this.navigationService.moveFocusToToolBar();
395
- if (this.overflowKeydownListener) {
396
- this.overflowKeydownListener();
397
- }
398
- };
399
- ToolBarComponent.prototype.displayAnchor = function () {
400
- var visibility = this.allTools.filter(function (t) { return t.overflows && t.responsive; }).length > 0 ? 'visible' : 'hidden';
401
- this.renderer.setStyle(this.overflowButton.nativeElement, 'visibility', visibility);
402
- };
403
- Object.defineProperty(ToolBarComponent.prototype, "popupWidth", {
404
- get: function () {
405
- if (!this.popupSettings || !this.popupSettings.width) {
406
- return defaultPopupWidth;
407
- }
408
- return isNaN(this.popupSettings.width) ? this.popupSettings.width : this.popupSettings.width + "px";
409
- },
410
- enumerable: true,
411
- configurable: true
412
- });
413
- Object.defineProperty(ToolBarComponent.prototype, "popupHeight", {
414
- get: function () {
415
- if (!this.popupSettings || !this.popupSettings.height) {
416
- return;
417
- }
418
- return isNaN(this.popupSettings.height) ? this.popupSettings.height : this.popupSettings.height + "px";
419
- },
420
- enumerable: true,
421
- configurable: true
422
- });
423
- Object.defineProperty(ToolBarComponent.prototype, "overflowAnchorWidth", {
424
- get: function () {
425
- if (!this.overflow) {
426
- return 0;
427
- }
428
- if (!this.cachedOverflowAnchorWidth) {
429
- this.cachedOverflowAnchorWidth = outerWidth(this.overflowButton.nativeElement);
430
- }
431
- return this.cachedOverflowAnchorWidth;
432
- },
433
- enumerable: true,
434
- configurable: true
435
- });
436
- Object.defineProperty(ToolBarComponent.prototype, "gap", {
437
- get: function () {
438
- if (isPresent(this.cachedGap)) {
439
- return this.cachedGap;
440
- }
441
- var computedGap = getComputedStyle(this.element.nativeElement).gap;
442
- this.cachedGap = isPresent(computedGap) ? parseInt(computedGap, 10) : 0;
443
- return this.cachedGap;
444
- },
445
- enumerable: true,
446
- configurable: true
447
- });
448
- Object.defineProperty(ToolBarComponent.prototype, "childrenWidth", {
449
- get: function () {
450
- var _this = this;
451
- var width = this.renderedTools.reduce(function (totalWidth, tool) { return tool.width + totalWidth + (tool.isDisplayed() ? _this.gap : 0); }, 0);
452
- return Math.ceil(width);
453
- },
454
- enumerable: true,
455
- configurable: true
456
- });
457
- Object.defineProperty(ToolBarComponent.prototype, "visibleTools", {
458
- get: function () {
459
- return this.allTools.filter(function (tool) {
460
- return tool.overflows === false;
461
- });
462
- },
463
- enumerable: true,
464
- configurable: true
465
- });
466
- Object.defineProperty(ToolBarComponent.prototype, "overflowTools", {
467
- get: function () {
468
- return this.allTools.filter(function (tool) {
469
- return tool.overflows === true;
470
- });
471
- },
472
- enumerable: true,
473
- configurable: true
474
- });
475
- ToolBarComponent.prototype.shrink = function (containerWidth, childrenWidth) {
476
- var width;
477
- if (containerWidth < childrenWidth) {
478
- for (var i = this.visibleTools.length - 1; i >= 0; i--) {
479
- if (containerWidth > childrenWidth) {
480
- break;
481
- }
482
- else {
483
- width = this.hideLastVisibleTool();
484
- childrenWidth -= width;
485
- }
486
- }
487
- }
488
- };
489
- ToolBarComponent.prototype.stretch = function (containerWidth, childrenWidth) {
490
- var width;
491
- if (containerWidth > childrenWidth) {
492
- for (var i = this.overflowTools.length - 1; i >= 0; i--) {
493
- width = this.showFirstHiddenTool(containerWidth, childrenWidth);
494
- if (width) {
495
- childrenWidth += width;
496
- }
497
- else {
498
- break;
499
- }
500
- }
501
- }
502
- };
503
- ToolBarComponent.prototype.hideLastVisibleTool = function () {
504
- var tool = this.visibleTools[this.visibleTools.length - 1];
505
- var renderedElement = this.renderedTools.find(function (r) {
506
- return r.tool === tool;
507
- });
508
- var width = renderedElement.width;
509
- tool.overflows = true;
510
- this.refreshService.refresh(tool);
511
- return width;
512
- };
513
- ToolBarComponent.prototype.showFirstHiddenTool = function (containerWidth, childrenWidth) {
514
- var tool = this.overflowTools[0];
515
- var renderedElement = this.renderedTools.find(function (r) { return r.tool === tool; });
516
- tool.overflows = false;
517
- tool.visibility = 'hidden';
518
- this.refreshService.refresh(tool);
519
- if (containerWidth > childrenWidth + renderedElement.width) {
520
- tool.visibility = 'visible';
521
- this.refreshService.refresh(tool);
522
- }
523
- else {
524
- tool.overflows = true;
525
- this.refreshService.refresh(tool);
526
- }
527
- return renderedElement.width; // returns 0 if `overflows` is true
528
- };
529
- ToolBarComponent.prototype.setPopupContentDimensions = function () {
530
- var popupContentContainer = this.popupRef.popup.instance.contentContainer.nativeElement;
531
- popupContentContainer.style.width = this.popupWidth;
532
- popupContentContainer.style.height = this.popupHeight;
533
- popupContentContainer.style.overflow = 'auto';
534
- };
535
- tslib_1.__decorate([
536
- Input(),
537
- tslib_1.__metadata("design:type", Boolean)
538
- ], ToolBarComponent.prototype, "overflow", void 0);
539
- tslib_1.__decorate([
540
- Input(),
541
- tslib_1.__metadata("design:type", Boolean),
542
- tslib_1.__metadata("design:paramtypes", [Boolean])
543
- ], ToolBarComponent.prototype, "resizable", null);
544
- tslib_1.__decorate([
545
- Input(),
546
- tslib_1.__metadata("design:type", Object),
547
- tslib_1.__metadata("design:paramtypes", [Object])
548
- ], ToolBarComponent.prototype, "popupSettings", null);
549
- tslib_1.__decorate([
550
- Input(),
551
- tslib_1.__metadata("design:type", Number)
552
- ], ToolBarComponent.prototype, "tabindex", void 0);
553
- tslib_1.__decorate([
554
- Input('tabIndex'),
555
- tslib_1.__metadata("design:type", Number),
556
- tslib_1.__metadata("design:paramtypes", [Number])
557
- ], ToolBarComponent.prototype, "tabIndex", null);
558
- tslib_1.__decorate([
559
- Output(),
560
- tslib_1.__metadata("design:type", EventEmitter)
561
- ], ToolBarComponent.prototype, "open", void 0);
562
- tslib_1.__decorate([
563
- Output(),
564
- tslib_1.__metadata("design:type", EventEmitter)
565
- ], ToolBarComponent.prototype, "close", void 0);
566
- tslib_1.__decorate([
567
- ContentChildren(ToolBarToolComponent),
568
- tslib_1.__metadata("design:type", QueryList)
569
- ], ToolBarComponent.prototype, "allTools", void 0);
570
- tslib_1.__decorate([
571
- ViewChild('overflowButton', { static: false }),
572
- tslib_1.__metadata("design:type", ElementRef)
573
- ], ToolBarComponent.prototype, "overflowButton", void 0);
574
- tslib_1.__decorate([
575
- ViewChild('popupTemplate', { static: true }),
576
- tslib_1.__metadata("design:type", TemplateRef)
577
- ], ToolBarComponent.prototype, "popupTemplate", void 0);
578
- tslib_1.__decorate([
579
- ViewChild('resizeSensor', { static: false }),
580
- tslib_1.__metadata("design:type", ResizeSensorComponent)
581
- ], ToolBarComponent.prototype, "resizeSensor", void 0);
582
- tslib_1.__decorate([
583
- ViewChild('container', { read: ViewContainerRef, static: true }),
584
- tslib_1.__metadata("design:type", ViewContainerRef)
585
- ], ToolBarComponent.prototype, "container", void 0);
586
- tslib_1.__decorate([
587
- ViewChildren('toolbarRenderer'),
588
- tslib_1.__metadata("design:type", QueryList)
589
- ], ToolBarComponent.prototype, "renderedTools", void 0);
590
- tslib_1.__decorate([
591
- ViewChildren('overflowRenderer'),
592
- tslib_1.__metadata("design:type", QueryList)
593
- ], ToolBarComponent.prototype, "overflowRenderedTools", void 0);
594
- tslib_1.__decorate([
595
- HostBinding('class.k-widget'),
596
- HostBinding('class.k-toolbar'),
597
- tslib_1.__metadata("design:type", Boolean)
598
- ], ToolBarComponent.prototype, "hostClasses", void 0);
599
- tslib_1.__decorate([
600
- HostListener('focus', ['$event']),
601
- tslib_1.__metadata("design:type", Function),
602
- tslib_1.__metadata("design:paramtypes", [Object]),
603
- tslib_1.__metadata("design:returntype", void 0)
604
- ], ToolBarComponent.prototype, "onFocus", null);
605
- tslib_1.__decorate([
606
- HostListener('focusout', ['$event']),
607
- tslib_1.__metadata("design:type", Function),
608
- tslib_1.__metadata("design:paramtypes", [Object]),
609
- tslib_1.__metadata("design:returntype", void 0)
610
- ], ToolBarComponent.prototype, "onFocusOut", null);
611
- tslib_1.__decorate([
612
- HostBinding('attr.role'),
613
- tslib_1.__metadata("design:type", String),
614
- tslib_1.__metadata("design:paramtypes", [])
615
- ], ToolBarComponent.prototype, "getRole", null);
616
- tslib_1.__decorate([
617
- HostBinding('attr.dir'),
618
- tslib_1.__metadata("design:type", String),
619
- tslib_1.__metadata("design:paramtypes", [])
620
- ], ToolBarComponent.prototype, "getDir", null);
621
- tslib_1.__decorate([
622
- HostBinding('class.k-toolbar-resizable'),
623
- tslib_1.__metadata("design:type", Boolean),
624
- tslib_1.__metadata("design:paramtypes", [])
625
- ], ToolBarComponent.prototype, "resizableClass", null);
626
- ToolBarComponent = tslib_1.__decorate([
627
- Component({
628
- exportAs: 'kendoToolBar',
629
- providers: [
630
- RefreshService,
631
- NavigationService,
632
- LocalizationService,
633
- {
634
- provide: L10N_PREFIX,
635
- useValue: 'kendo.toolbar'
636
- }
637
- ],
638
- selector: 'kendo-toolbar',
639
- template: "\n <ng-container kendoToolbarLocalizedMessages\n i18n-moreToolsTitle=\"kendo.toolbar.moreToolsTitle|The title of the **more tools** button in a responsive ToolBar\"\n moreToolsTitle=\"More tools\"\n >\n </ng-container>\n <ng-container *ngFor=\"let tool of allTools; let index = index\">\n <kendo-toolbar-renderer\n #toolbarRenderer\n (rendererClick)=\"onRendererClick($event)\"\n [location]=\"'toolbar'\"\n [resizable]=\"overflow\"\n [tool]=\"tool\"\n ></kendo-toolbar-renderer>\n </ng-container>\n <button\n #overflowButton\n type=\"button\"\n tabindex=\"-1\"\n [title]=\"moreToolsTitle\"\n [attr.aria-label]=\"moreToolsTitle\"\n *ngIf=\"overflow\"\n [style.visibility]=\"'hidden'\"\n class=\"k-overflow-anchor k-button\"\n (click)=\"showPopup()\"\n >\n <span class=\"k-icon k-i-more-vertical\"></span>\n </button>\n <ng-template #popupTemplate>\n <ul class=\"k-overflow-container k-list-container k-reset\">\n <ng-container *ngFor=\"let tool of allTools; let index = index\">\n <li class=\"k-item\">\n <kendo-toolbar-renderer\n #overflowRenderer\n (rendererClick)=\"onRendererClick($event)\"\n [location]=\"'overflow'\"\n [resizable]=\"overflow\"\n [tool]=\"tool\"\n ></kendo-toolbar-renderer>\n </li>\n </ng-container>\n </ul>\n </ng-template>\n <ng-container #container></ng-container>\n <kendo-resize-sensor *ngIf=\"overflow\" [rateLimit]=\"1000\" #resizeSensor></kendo-resize-sensor>\n "
640
- }),
641
- tslib_1.__metadata("design:paramtypes", [LocalizationService,
642
- PopupService,
643
- RefreshService,
644
- NavigationService,
645
- ElementRef,
646
- NgZone,
647
- Renderer2,
648
- ChangeDetectorRef])
649
- ], ToolBarComponent);
650
- return ToolBarComponent;
651
- }());
652
- export { ToolBarComponent };
653
- export { ɵ0 };