@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,648 +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 { 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(this.resizeSensor.resize, this.renderedTools.changes).subscribe(function () { _this.onResize(); }));
221
- // because of https://github.com/telerik/kendo-angular-buttons/pull/276
222
- // calling onResize twice is the trade-off for removing the manual ChangeDetection
223
- // triggering altogether - it ensures correct layout and calculations
224
- // when some tools need overflow on initial rendering
225
- this.zone.runOutsideAngular(function () { return setTimeout(function () { _this.onResize(); _this.onResize(); }); });
226
- this.navigationService.overflowButton = this.overflowButton;
227
- }
228
- this.navigationService.setRenderedTools(this.renderedTools.toArray());
229
- this.subscriptions.add(this.renderedTools.changes.subscribe(function (rts) {
230
- return _this.navigationService.setRenderedTools(rts.toArray());
231
- }));
232
- };
233
- ToolBarComponent.prototype.ngOnInit = function () {
234
- var _this = this;
235
- this.subscriptions.add(this.localization.changes.subscribe(function (_a) {
236
- var rtl = _a.rtl;
237
- return (_this.direction = rtl ? 'rtl' : 'ltr');
238
- }));
239
- if (isDocumentAvailable()) {
240
- this.zone.runOutsideAngular(function () {
241
- return _this.subscriptions.add(fromEvent(document, 'click')
242
- .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); }))
243
- .subscribe(function () {
244
- _this.zone.run(function () {
245
- _this.popupOpen = false;
246
- });
247
- }));
248
- });
249
- }
250
- };
251
- ToolBarComponent.prototype.ngOnChanges = function (changes) {
252
- if (changes.tabindex) {
253
- // prevents ExpressionChangedAfterItHasBeenCheckedError when tools with popup are opened/closed asynchronously
254
- this.element.nativeElement.setAttribute('tabindex', changes.tabindex.currentValue.toString());
255
- }
256
- };
257
- ToolBarComponent.prototype.ngOnDestroy = function () {
258
- if (this.popupRef) {
259
- this.popupRef.close();
260
- }
261
- if (this.toolbarKeydownListener) {
262
- this.toolbarKeydownListener();
263
- }
264
- this.cancelRenderedToolsSubscription$.next();
265
- this.subscriptions.unsubscribe();
266
- };
267
- Object.defineProperty(ToolBarComponent.prototype, "moreToolsTitle", {
268
- /**
269
- * @hidden
270
- */
271
- get: function () {
272
- return this.localization.get('moreToolsTitle');
273
- },
274
- enumerable: true,
275
- configurable: true
276
- });
277
- Object.defineProperty(ToolBarComponent.prototype, "cdr", {
278
- /**
279
- * @hidden
280
- */
281
- get: function () {
282
- return this._cdr;
283
- },
284
- enumerable: true,
285
- configurable: true
286
- });
287
- /**
288
- * @hidden
289
- */
290
- ToolBarComponent.prototype.onRendererClick = function (data) {
291
- this.navigationService.click(data);
292
- this.element.nativeElement.setAttribute('tabindex', '-1');
293
- };
294
- /**
295
- * @hidden
296
- */
297
- ToolBarComponent.prototype.showPopup = function () {
298
- this.popupOpen = !this.popupOpen;
299
- this.navigationService.click({ context: undefined, event: undefined });
300
- };
301
- /**
302
- * Toggles the visibility of the overflow popup.
303
- */
304
- ToolBarComponent.prototype.toggle = function (popupOpen) {
305
- this._open = popupOpen !== undefined ? popupOpen : !this.popupOpen;
306
- if (this.popupRef) {
307
- this.popupRef.close();
308
- this.popupRef = null;
309
- }
310
- if (this.popupOpen) {
311
- this.popupRef = this.popupService.open({
312
- anchor: this.overflowButton,
313
- anchorAlign: this.popupSettings.anchorAlign,
314
- popupAlign: this.popupSettings.popupAlign,
315
- content: this.popupTemplate,
316
- appendTo: this.appendTo,
317
- animate: this.popupSettings.animate,
318
- popupClass: this.popupSettings.popupClass,
319
- positionMode: 'absolute'
320
- });
321
- this.setPopupContentDimensions();
322
- this.popupRef.popupOpen.subscribe(this.onPopupOpen.bind(this));
323
- this.popupRef.popupClose.subscribe(this.onPopupClose.bind(this));
324
- }
325
- };
326
- /**
327
- * @hidden
328
- */
329
- ToolBarComponent.prototype.onResize = function () {
330
- if (isDocumentAvailable()) {
331
- var containerWidth = innerWidth(this.element.nativeElement) - this.overflowAnchorWidth;
332
- this.shrink(containerWidth, this.childrenWidth);
333
- this.stretch(containerWidth, this.childrenWidth);
334
- this.displayAnchor();
335
- this.resizeSensor.acceptSize();
336
- }
337
- };
338
- /**
339
- * @hidden
340
- */
341
- ToolBarComponent.prototype.onPopupOpen = function () {
342
- var _this = this;
343
- this.zone.runOutsideAngular(function () {
344
- _this.overflowKeydownListener = _this.renderer.listen(_this.popupRef.popupElement, 'keydown', function (ev) {
345
- switch (ev.keyCode) {
346
- case Keys.ArrowUp:
347
- _this.zone.run(function () {
348
- ev.preventDefault();
349
- _this.navigationService.focusPrev(ev);
350
- });
351
- break;
352
- case Keys.ArrowDown:
353
- _this.zone.run(function () {
354
- ev.preventDefault();
355
- _this.navigationService.focusNext(ev);
356
- });
357
- break;
358
- case Keys.Escape:
359
- _this.zone.run(function () { return _this.toggle(false); });
360
- break;
361
- case Keys.Tab:
362
- _this.zone.run(function () {
363
- _this.toggle(false);
364
- _this.navigationService.resetNavigation();
365
- });
366
- break;
367
- default:
368
- break;
369
- }
370
- });
371
- });
372
- this.cancelRenderedToolsSubscription$.next();
373
- this.navigationService.moveFocusToPopup();
374
- this.navigationService.setRenderedTools(this.overflowRenderedTools.toArray());
375
- this.overflowRenderedTools.changes
376
- .pipe(takeUntil(this.cancelRenderedToolsSubscription$))
377
- .subscribe(function (rts) { return _this.navigationService.setRenderedTools(rts.toArray()); });
378
- };
379
- /**
380
- * @hidden
381
- */
382
- ToolBarComponent.prototype.onPopupClose = function () {
383
- var _this = this;
384
- this.cancelRenderedToolsSubscription$.next();
385
- this.navigationService.setRenderedTools(this.renderedTools.toArray());
386
- this.renderedTools.changes
387
- .pipe(takeUntil(this.cancelRenderedToolsSubscription$))
388
- .subscribe(function (rts) { return _this.navigationService.setRenderedTools(rts.toArray()); });
389
- this.navigationService.moveFocusToToolBar();
390
- if (this.overflowKeydownListener) {
391
- this.overflowKeydownListener();
392
- }
393
- };
394
- ToolBarComponent.prototype.displayAnchor = function () {
395
- var visibility = this.allTools.filter(function (t) { return t.overflows && t.responsive; }).length > 0 ? 'visible' : 'hidden';
396
- this.renderer.setStyle(this.overflowButton.nativeElement, 'visibility', visibility);
397
- };
398
- Object.defineProperty(ToolBarComponent.prototype, "popupWidth", {
399
- get: function () {
400
- if (!this.popupSettings || !this.popupSettings.width) {
401
- return defaultPopupWidth;
402
- }
403
- return isNaN(this.popupSettings.width) ? this.popupSettings.width : this.popupSettings.width + "px";
404
- },
405
- enumerable: true,
406
- configurable: true
407
- });
408
- Object.defineProperty(ToolBarComponent.prototype, "popupHeight", {
409
- get: function () {
410
- if (!this.popupSettings || !this.popupSettings.height) {
411
- return;
412
- }
413
- return isNaN(this.popupSettings.height) ? this.popupSettings.height : this.popupSettings.height + "px";
414
- },
415
- enumerable: true,
416
- configurable: true
417
- });
418
- Object.defineProperty(ToolBarComponent.prototype, "overflowAnchorWidth", {
419
- get: function () {
420
- if (!this.overflow) {
421
- return 0;
422
- }
423
- if (!this.cachedOverflowAnchorWidth) {
424
- this.cachedOverflowAnchorWidth = outerWidth(this.overflowButton.nativeElement);
425
- }
426
- return this.cachedOverflowAnchorWidth;
427
- },
428
- enumerable: true,
429
- configurable: true
430
- });
431
- Object.defineProperty(ToolBarComponent.prototype, "gap", {
432
- get: function () {
433
- if (isPresent(this.cachedGap)) {
434
- return this.cachedGap;
435
- }
436
- var computedGap = getComputedStyle(this.element.nativeElement).gap;
437
- this.cachedGap = isPresent(computedGap) ? parseInt(computedGap, 10) : 0;
438
- return this.cachedGap;
439
- },
440
- enumerable: true,
441
- configurable: true
442
- });
443
- Object.defineProperty(ToolBarComponent.prototype, "childrenWidth", {
444
- get: function () {
445
- var _this = this;
446
- var width = this.renderedTools.reduce(function (totalWidth, tool) { return tool.width + totalWidth + (tool.isDisplayed() ? _this.gap : 0); }, 0);
447
- return Math.ceil(width);
448
- },
449
- enumerable: true,
450
- configurable: true
451
- });
452
- Object.defineProperty(ToolBarComponent.prototype, "visibleTools", {
453
- get: function () {
454
- return this.allTools.filter(function (tool) {
455
- return tool.overflows === false;
456
- });
457
- },
458
- enumerable: true,
459
- configurable: true
460
- });
461
- Object.defineProperty(ToolBarComponent.prototype, "overflowTools", {
462
- get: function () {
463
- return this.allTools.filter(function (tool) {
464
- return tool.overflows === true;
465
- });
466
- },
467
- enumerable: true,
468
- configurable: true
469
- });
470
- ToolBarComponent.prototype.shrink = function (containerWidth, childrenWidth) {
471
- var width;
472
- if (containerWidth < childrenWidth) {
473
- for (var i = this.visibleTools.length - 1; i >= 0; i--) {
474
- if (containerWidth > childrenWidth) {
475
- break;
476
- }
477
- else {
478
- width = this.hideLastVisibleTool();
479
- childrenWidth -= width;
480
- }
481
- }
482
- }
483
- };
484
- ToolBarComponent.prototype.stretch = function (containerWidth, childrenWidth) {
485
- var width;
486
- if (containerWidth > childrenWidth) {
487
- for (var i = this.overflowTools.length - 1; i >= 0; i--) {
488
- width = this.showFirstHiddenTool(containerWidth, childrenWidth);
489
- if (width) {
490
- childrenWidth += width;
491
- }
492
- else {
493
- break;
494
- }
495
- }
496
- }
497
- };
498
- ToolBarComponent.prototype.hideLastVisibleTool = function () {
499
- var tool = this.visibleTools[this.visibleTools.length - 1];
500
- var renderedElement = this.renderedTools.find(function (r) {
501
- return r.tool === tool;
502
- });
503
- var width = renderedElement.width;
504
- tool.overflows = true;
505
- this.refreshService.refresh(tool);
506
- return width;
507
- };
508
- ToolBarComponent.prototype.showFirstHiddenTool = function (containerWidth, childrenWidth) {
509
- var tool = this.overflowTools[0];
510
- var renderedElement = this.renderedTools.find(function (r) { return r.tool === tool; });
511
- tool.overflows = false;
512
- tool.visibility = 'hidden';
513
- this.refreshService.refresh(tool);
514
- if (containerWidth > childrenWidth + renderedElement.width) {
515
- tool.visibility = 'visible';
516
- this.refreshService.refresh(tool);
517
- }
518
- else {
519
- tool.overflows = true;
520
- this.refreshService.refresh(tool);
521
- }
522
- return renderedElement.width; // returns 0 if `overflows` is true
523
- };
524
- ToolBarComponent.prototype.setPopupContentDimensions = function () {
525
- var popupContentContainer = this.popupRef.popup.instance.contentContainer.nativeElement;
526
- popupContentContainer.style.width = this.popupWidth;
527
- popupContentContainer.style.height = this.popupHeight;
528
- popupContentContainer.style.overflow = 'auto';
529
- };
530
- tslib_1.__decorate([
531
- Input(),
532
- tslib_1.__metadata("design:type", Boolean)
533
- ], ToolBarComponent.prototype, "overflow", void 0);
534
- tslib_1.__decorate([
535
- Input(),
536
- tslib_1.__metadata("design:type", Boolean),
537
- tslib_1.__metadata("design:paramtypes", [Boolean])
538
- ], ToolBarComponent.prototype, "resizable", null);
539
- tslib_1.__decorate([
540
- Input(),
541
- tslib_1.__metadata("design:type", Object),
542
- tslib_1.__metadata("design:paramtypes", [Object])
543
- ], ToolBarComponent.prototype, "popupSettings", null);
544
- tslib_1.__decorate([
545
- Input(),
546
- tslib_1.__metadata("design:type", Number)
547
- ], ToolBarComponent.prototype, "tabindex", void 0);
548
- tslib_1.__decorate([
549
- Input('tabIndex'),
550
- tslib_1.__metadata("design:type", Number),
551
- tslib_1.__metadata("design:paramtypes", [Number])
552
- ], ToolBarComponent.prototype, "tabIndex", null);
553
- tslib_1.__decorate([
554
- Output(),
555
- tslib_1.__metadata("design:type", EventEmitter)
556
- ], ToolBarComponent.prototype, "open", void 0);
557
- tslib_1.__decorate([
558
- Output(),
559
- tslib_1.__metadata("design:type", EventEmitter)
560
- ], ToolBarComponent.prototype, "close", void 0);
561
- tslib_1.__decorate([
562
- ContentChildren(ToolBarToolComponent),
563
- tslib_1.__metadata("design:type", QueryList)
564
- ], ToolBarComponent.prototype, "allTools", void 0);
565
- tslib_1.__decorate([
566
- ViewChild('overflowButton', { static: false }),
567
- tslib_1.__metadata("design:type", ElementRef)
568
- ], ToolBarComponent.prototype, "overflowButton", void 0);
569
- tslib_1.__decorate([
570
- ViewChild('popupTemplate', { static: true }),
571
- tslib_1.__metadata("design:type", TemplateRef)
572
- ], ToolBarComponent.prototype, "popupTemplate", void 0);
573
- tslib_1.__decorate([
574
- ViewChild('resizeSensor', { static: false }),
575
- tslib_1.__metadata("design:type", ResizeSensorComponent)
576
- ], ToolBarComponent.prototype, "resizeSensor", void 0);
577
- tslib_1.__decorate([
578
- ViewChild('container', { read: ViewContainerRef, static: true }),
579
- tslib_1.__metadata("design:type", ViewContainerRef)
580
- ], ToolBarComponent.prototype, "container", void 0);
581
- tslib_1.__decorate([
582
- ViewChildren('toolbarRenderer'),
583
- tslib_1.__metadata("design:type", QueryList)
584
- ], ToolBarComponent.prototype, "renderedTools", void 0);
585
- tslib_1.__decorate([
586
- ViewChildren('overflowRenderer'),
587
- tslib_1.__metadata("design:type", QueryList)
588
- ], ToolBarComponent.prototype, "overflowRenderedTools", void 0);
589
- tslib_1.__decorate([
590
- HostBinding('class.k-widget'),
591
- HostBinding('class.k-toolbar'),
592
- tslib_1.__metadata("design:type", Boolean)
593
- ], ToolBarComponent.prototype, "hostClasses", void 0);
594
- tslib_1.__decorate([
595
- HostListener('focus', ['$event']),
596
- tslib_1.__metadata("design:type", Function),
597
- tslib_1.__metadata("design:paramtypes", [Object]),
598
- tslib_1.__metadata("design:returntype", void 0)
599
- ], ToolBarComponent.prototype, "onFocus", null);
600
- tslib_1.__decorate([
601
- HostListener('focusout', ['$event']),
602
- tslib_1.__metadata("design:type", Function),
603
- tslib_1.__metadata("design:paramtypes", [Object]),
604
- tslib_1.__metadata("design:returntype", void 0)
605
- ], ToolBarComponent.prototype, "onFocusOut", null);
606
- tslib_1.__decorate([
607
- HostBinding('attr.role'),
608
- tslib_1.__metadata("design:type", String),
609
- tslib_1.__metadata("design:paramtypes", [])
610
- ], ToolBarComponent.prototype, "getRole", null);
611
- tslib_1.__decorate([
612
- HostBinding('attr.dir'),
613
- tslib_1.__metadata("design:type", String),
614
- tslib_1.__metadata("design:paramtypes", [])
615
- ], ToolBarComponent.prototype, "getDir", null);
616
- tslib_1.__decorate([
617
- HostBinding('class.k-toolbar-resizable'),
618
- tslib_1.__metadata("design:type", Boolean),
619
- tslib_1.__metadata("design:paramtypes", [])
620
- ], ToolBarComponent.prototype, "resizableClass", null);
621
- ToolBarComponent = tslib_1.__decorate([
622
- Component({
623
- exportAs: 'kendoToolBar',
624
- providers: [
625
- RefreshService,
626
- NavigationService,
627
- LocalizationService,
628
- {
629
- provide: L10N_PREFIX,
630
- useValue: 'kendo.toolbar'
631
- }
632
- ],
633
- selector: 'kendo-toolbar',
634
- 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 "
635
- }),
636
- tslib_1.__metadata("design:paramtypes", [LocalizationService,
637
- PopupService,
638
- RefreshService,
639
- NavigationService,
640
- ElementRef,
641
- NgZone,
642
- Renderer2,
643
- ChangeDetectorRef])
644
- ], ToolBarComponent);
645
- return ToolBarComponent;
646
- }());
647
- export { ToolBarComponent };
648
- export { ɵ0 };