@progress/kendo-angular-toolbar 5.0.0-dev.202201190923 → 6.0.0-next.202203010923

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 +22 -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 +141 -124
  27. package/{dist/es2015 → esm2015}/toolbar.module.js +27 -11
  28. package/{dist/es2015 → esm2015}/tools/toolbar-button.component.js +118 -114
  29. package/esm2015/tools/toolbar-buttongroup.component.js +268 -0
  30. package/esm2015/tools/toolbar-buttonlist.component.js +94 -0
  31. package/{dist/es2015 → esm2015}/tools/toolbar-dropdownbutton.component.js +120 -121
  32. package/esm2015/tools/toolbar-separator.component.js +69 -0
  33. package/{dist/es2015 → esm2015}/tools/toolbar-splitbutton.component.js +130 -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} +1001 -878
  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 +32 -97
  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} +23 -16
  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 -627
  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 -2651
  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 -629
  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,629 +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
- "use strict";
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- var tslib_1 = require("tslib");
8
- var core_1 = require("@angular/core");
9
- var kendo_angular_popup_1 = require("@progress/kendo-angular-popup");
10
- var kendo_angular_common_1 = require("@progress/kendo-angular-common");
11
- var kendo_angular_l10n_1 = require("@progress/kendo-angular-l10n");
12
- var kendo_licensing_1 = require("@progress/kendo-licensing");
13
- var package_metadata_1 = require("./package-metadata");
14
- var refresh_service_1 = require("./refresh.service");
15
- var navigation_service_1 = require("./navigation.service");
16
- var toolbar_tool_component_1 = require("./tools/toolbar-tool.component");
17
- var util_1 = require("./util");
18
- var kendo_angular_common_2 = require("@progress/kendo-angular-common");
19
- var preventable_event_1 = require("./common/preventable-event");
20
- var rxjs_1 = require("rxjs");
21
- var operators_1 = require("rxjs/operators");
22
- var operators_2 = require("rxjs/operators");
23
- var kendo_angular_common_3 = require("@progress/kendo-angular-common");
24
- var constants_1 = require("./common/constants");
25
- var getInitialPopupSettings = function (isRtl) { return ({
26
- animate: true,
27
- anchorAlign: { horizontal: isRtl ? 'left' : 'right', vertical: 'bottom' },
28
- popupAlign: { horizontal: isRtl ? 'left' : 'right', vertical: 'top' }
29
- }); };
30
- var ɵ0 = getInitialPopupSettings;
31
- exports.ɵ0 = ɵ0;
32
- /**
33
- * Represents the [Kendo UI ToolBar component for Angular]({% slug overview_toolbar %}).
34
- */
35
- var ToolBarComponent = /** @class */ (function () {
36
- function ToolBarComponent(localization, popupService, refreshService, navigationService, element, cdr, zone, renderer) {
37
- this.localization = localization;
38
- this.popupService = popupService;
39
- this.refreshService = refreshService;
40
- this.navigationService = navigationService;
41
- this.element = element;
42
- this.cdr = cdr;
43
- this.zone = zone;
44
- this.renderer = renderer;
45
- /**
46
- * Hides the overflowing tools in a popup.
47
- */
48
- this.overflow = false;
49
- /**
50
- * Specifies the [`tabindex`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the ToolBar.
51
- */
52
- this.tabindex = 0;
53
- /**
54
- * Fires when the overflow popup of the ToolBar is opened.
55
- */
56
- this.open = new core_1.EventEmitter();
57
- /**
58
- * Fires when the overflow popup of the ToolBar is closed.
59
- */
60
- this.close = new core_1.EventEmitter();
61
- this.hostClasses = true;
62
- this.cancelRenderedToolsSubscription$ = new rxjs_1.Subject();
63
- this.subscriptions = new rxjs_1.Subscription();
64
- kendo_licensing_1.validatePackage(package_metadata_1.packageMetadata);
65
- this.direction = localization.rtl ? 'rtl' : 'ltr';
66
- }
67
- Object.defineProperty(ToolBarComponent.prototype, "resizable", {
68
- get: function () {
69
- return this.overflow;
70
- },
71
- /**
72
- * @hidden
73
- */
74
- set: function (value) {
75
- this.overflow = value;
76
- },
77
- enumerable: true,
78
- configurable: true
79
- });
80
- Object.defineProperty(ToolBarComponent.prototype, "popupSettings", {
81
- get: function () {
82
- return this._popupSettings || getInitialPopupSettings(this.localization.rtl);
83
- },
84
- /**
85
- * Configures the popup of the ToolBar drop-down list.
86
- *
87
- * The available options are:
88
- * - `animate: Boolean`—Controls the popup animation. By default, the open and close animations are enabled.
89
- * - `popupClass: String`—Specifies a list of CSS classes that are used to style the popup.
90
- */
91
- set: function (settings) {
92
- this._popupSettings = Object.assign({}, getInitialPopupSettings(this.localization.rtl), settings);
93
- },
94
- enumerable: true,
95
- configurable: true
96
- });
97
- Object.defineProperty(ToolBarComponent.prototype, "tabIndex", {
98
- get: function () {
99
- return this.tabindex;
100
- },
101
- /**
102
- * @hidden
103
- */
104
- set: function (tabIndex) {
105
- this.tabindex = tabIndex;
106
- },
107
- enumerable: true,
108
- configurable: true
109
- });
110
- Object.defineProperty(ToolBarComponent.prototype, "appendTo", {
111
- get: function () {
112
- var appendTo = this.popupSettings.appendTo;
113
- if (!appendTo || appendTo === 'root') {
114
- return undefined;
115
- }
116
- return appendTo === 'component' ? this.container : appendTo;
117
- },
118
- enumerable: true,
119
- configurable: true
120
- });
121
- Object.defineProperty(ToolBarComponent.prototype, "popupOpen", {
122
- get: function () {
123
- return this._open;
124
- },
125
- set: function (open) {
126
- if (this.popupOpen === open) {
127
- return;
128
- }
129
- var eventArgs = new preventable_event_1.PreventableEvent();
130
- if (open) {
131
- this.open.emit(eventArgs);
132
- }
133
- else {
134
- this.close.emit(eventArgs);
135
- }
136
- if (eventArgs.isDefaultPrevented()) {
137
- return;
138
- }
139
- this.toggle(open);
140
- },
141
- enumerable: true,
142
- configurable: true
143
- });
144
- /**
145
- * @hidden
146
- */
147
- ToolBarComponent.prototype.onFocus = function (ev) {
148
- this.navigationService.resetNavigation();
149
- this.navigationService.focusFirst(ev);
150
- // prevents ExpressionChangedAfterItHasBeenCheckedError when tools with popup are opened/closed asynchronously
151
- this.element.nativeElement.setAttribute('tabindex', '-1');
152
- };
153
- /**
154
- * @hidden
155
- */
156
- ToolBarComponent.prototype.onFocusOut = function (event) {
157
- var _this = this;
158
- // prevents ExpressionChangedAfterItHasBeenCheckedError when tools with popup are opened/closed asynchronously
159
- if (util_1.closest(event.relatedTarget, function (el) { return el === _this.element.nativeElement; })) {
160
- this.element.nativeElement.setAttribute('tabindex', '-1');
161
- return;
162
- }
163
- this.element.nativeElement.setAttribute('tabindex', this.tabindex.toString());
164
- };
165
- Object.defineProperty(ToolBarComponent.prototype, "getRole", {
166
- get: function () {
167
- return 'toolbar';
168
- },
169
- enumerable: true,
170
- configurable: true
171
- });
172
- Object.defineProperty(ToolBarComponent.prototype, "getDir", {
173
- get: function () {
174
- return this.direction;
175
- },
176
- enumerable: true,
177
- configurable: true
178
- });
179
- Object.defineProperty(ToolBarComponent.prototype, "resizableClass", {
180
- get: function () {
181
- return this.overflow;
182
- },
183
- enumerable: true,
184
- configurable: true
185
- });
186
- ToolBarComponent.prototype.ngAfterViewInit = function () {
187
- var _this = this;
188
- var element = this.element.nativeElement;
189
- if (!element.getAttribute('tabindex')) {
190
- this.element.nativeElement.setAttribute('tabindex', '0');
191
- }
192
- this.zone.runOutsideAngular(function () {
193
- _this.toolbarKeydownListener = _this.renderer.listen(_this.element.nativeElement, 'keydown', function (ev) {
194
- switch (ev.keyCode) {
195
- case kendo_angular_common_2.Keys.ArrowLeft:
196
- _this.zone.run(function () {
197
- ev.preventDefault();
198
- _this.direction === 'ltr' ? _this.navigationService.focusPrev(ev) : _this.navigationService.focusNext(ev);
199
- // prevents ExpressionChangedAfterItHasBeenCheckedError when tools with popup are opened/closed asynchronously
200
- _this.element.nativeElement.setAttribute('tabindex', '-1');
201
- });
202
- break;
203
- case kendo_angular_common_2.Keys.ArrowRight:
204
- _this.zone.run(function () {
205
- ev.preventDefault();
206
- _this.direction === 'ltr' ? _this.navigationService.focusNext(ev) : _this.navigationService.focusPrev(ev);
207
- // prevents ExpressionChangedAfterItHasBeenCheckedError when tools with popup are opened/closed asynchronously
208
- _this.element.nativeElement.setAttribute('tabindex', '-1');
209
- });
210
- break;
211
- case kendo_angular_common_2.Keys.Tab:
212
- _this.zone.run(function () { return _this.navigationService.resetNavigation(); });
213
- break;
214
- case kendo_angular_common_2.Keys.Escape:
215
- _this.zone.run(function () { return _this.toggle(false); });
216
- break;
217
- default:
218
- break;
219
- }
220
- });
221
- });
222
- if (this.overflow) {
223
- this.subscriptions.add(rxjs_1.merge(this.resizeSensor.resize.pipe(operators_2.filter(function () { return _this.overflow; })), this.renderedTools.changes).subscribe(function () {
224
- return _this.onResize();
225
- }));
226
- // because of https://github.com/telerik/kendo-angular-buttons/pull/276
227
- this.zone.runOutsideAngular(function () { return setTimeout(function () { return _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 (kendo_angular_common_3.isDocumentAvailable()) {
242
- this.zone.runOutsideAngular(function () {
243
- return _this.subscriptions.add(rxjs_1.fromEvent(document, 'click')
244
- .pipe(operators_2.filter(function () { return !!_this.popupRef; }), operators_2.filter(function (ev) { return !_this.popupRef.popup.instance.container.nativeElement.contains(ev.target); }), operators_2.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
- /**
280
- * @hidden
281
- */
282
- ToolBarComponent.prototype.onRendererClick = function (data) {
283
- this.navigationService.click(data);
284
- this.element.nativeElement.setAttribute('tabindex', '-1');
285
- };
286
- /**
287
- * @hidden
288
- */
289
- ToolBarComponent.prototype.showPopup = function () {
290
- this.popupOpen = !this.popupOpen;
291
- this.navigationService.click({ context: undefined, event: undefined });
292
- };
293
- /**
294
- * Toggles the visibility of the overflow popup.
295
- */
296
- ToolBarComponent.prototype.toggle = function (popupOpen) {
297
- this._open = popupOpen !== undefined ? popupOpen : !this.popupOpen;
298
- if (this.popupRef) {
299
- this.popupRef.close();
300
- this.popupRef = null;
301
- }
302
- if (this.popupOpen) {
303
- this.popupRef = this.popupService.open({
304
- anchor: this.overflowButton,
305
- anchorAlign: this.popupSettings.anchorAlign,
306
- popupAlign: this.popupSettings.popupAlign,
307
- content: this.popupTemplate,
308
- appendTo: this.appendTo,
309
- animate: this.popupSettings.animate,
310
- popupClass: this.popupSettings.popupClass,
311
- positionMode: 'absolute'
312
- });
313
- this.setPopupContentDimensions();
314
- this.popupRef.popupOpen.subscribe(this.onPopupOpen.bind(this));
315
- this.popupRef.popupClose.subscribe(this.onPopupClose.bind(this));
316
- }
317
- };
318
- /**
319
- * @hidden
320
- */
321
- ToolBarComponent.prototype.onResize = function () {
322
- if (kendo_angular_common_3.isDocumentAvailable()) {
323
- var containerWidth = util_1.innerWidth(this.element.nativeElement) - this.overflowAnchorWidth;
324
- this.shrink(containerWidth, this.childrenWidth);
325
- this.stretch(containerWidth, this.childrenWidth);
326
- }
327
- this.cdr.detectChanges();
328
- this.resizeSensor.acceptSize();
329
- };
330
- /**
331
- * @hidden
332
- */
333
- ToolBarComponent.prototype.onPopupOpen = function () {
334
- var _this = this;
335
- this.zone.runOutsideAngular(function () {
336
- _this.overflowKeydownListener = _this.renderer.listen(_this.popupRef.popupElement, 'keydown', function (ev) {
337
- switch (ev.keyCode) {
338
- case kendo_angular_common_2.Keys.ArrowUp:
339
- _this.zone.run(function () {
340
- ev.preventDefault();
341
- _this.navigationService.focusPrev(ev);
342
- });
343
- break;
344
- case kendo_angular_common_2.Keys.ArrowDown:
345
- _this.zone.run(function () {
346
- ev.preventDefault();
347
- _this.navigationService.focusNext(ev);
348
- });
349
- break;
350
- case kendo_angular_common_2.Keys.Escape:
351
- _this.zone.run(function () { return _this.toggle(false); });
352
- break;
353
- case kendo_angular_common_2.Keys.Tab:
354
- _this.zone.run(function () {
355
- _this.toggle(false);
356
- _this.navigationService.resetNavigation();
357
- });
358
- break;
359
- default:
360
- break;
361
- }
362
- });
363
- });
364
- this.cancelRenderedToolsSubscription$.next();
365
- this.navigationService.moveFocusToPopup();
366
- this.navigationService.setRenderedTools(this.overflowRenderedTools.toArray());
367
- this.overflowRenderedTools.changes
368
- .pipe(operators_1.takeUntil(this.cancelRenderedToolsSubscription$))
369
- .subscribe(function (rts) { return _this.navigationService.setRenderedTools(rts.toArray()); });
370
- };
371
- /**
372
- * @hidden
373
- */
374
- ToolBarComponent.prototype.onPopupClose = function () {
375
- var _this = this;
376
- this.cancelRenderedToolsSubscription$.next();
377
- this.navigationService.setRenderedTools(this.renderedTools.toArray());
378
- this.renderedTools.changes
379
- .pipe(operators_1.takeUntil(this.cancelRenderedToolsSubscription$))
380
- .subscribe(function (rts) { return _this.navigationService.setRenderedTools(rts.toArray()); });
381
- this.navigationService.moveFocusToToolBar();
382
- if (this.overflowKeydownListener) {
383
- this.overflowKeydownListener();
384
- }
385
- };
386
- Object.defineProperty(ToolBarComponent.prototype, "displayAnchor", {
387
- get: function () {
388
- return this.allTools.filter(function (t) { return t.overflows && t.responsive; }).length > 0 ? 'visible' : 'hidden';
389
- },
390
- enumerable: true,
391
- configurable: true
392
- });
393
- Object.defineProperty(ToolBarComponent.prototype, "popupWidth", {
394
- get: function () {
395
- if (!this.popupSettings || !this.popupSettings.width) {
396
- return constants_1.defaultPopupWidth;
397
- }
398
- return isNaN(this.popupSettings.width) ? this.popupSettings.width : this.popupSettings.width + "px";
399
- },
400
- enumerable: true,
401
- configurable: true
402
- });
403
- Object.defineProperty(ToolBarComponent.prototype, "popupHeight", {
404
- get: function () {
405
- if (!this.popupSettings || !this.popupSettings.height) {
406
- return;
407
- }
408
- return isNaN(this.popupSettings.height) ? this.popupSettings.height : this.popupSettings.height + "px";
409
- },
410
- enumerable: true,
411
- configurable: true
412
- });
413
- Object.defineProperty(ToolBarComponent.prototype, "overflowAnchorWidth", {
414
- get: function () {
415
- if (!this.overflow) {
416
- return 0;
417
- }
418
- if (!this.cachedOverflowAnchorWidth) {
419
- this.cachedOverflowAnchorWidth = util_1.outerWidth(this.overflowButton.nativeElement);
420
- }
421
- return this.cachedOverflowAnchorWidth;
422
- },
423
- enumerable: true,
424
- configurable: true
425
- });
426
- Object.defineProperty(ToolBarComponent.prototype, "childrenWidth", {
427
- get: function () {
428
- var width = this.renderedTools.reduce(function (totalWidth, tool) { return tool.width + totalWidth; }, 0);
429
- return Math.ceil(width);
430
- },
431
- enumerable: true,
432
- configurable: true
433
- });
434
- Object.defineProperty(ToolBarComponent.prototype, "visibleTools", {
435
- get: function () {
436
- return this.allTools.filter(function (tool) {
437
- return tool.overflows === false;
438
- });
439
- },
440
- enumerable: true,
441
- configurable: true
442
- });
443
- Object.defineProperty(ToolBarComponent.prototype, "overflowTools", {
444
- get: function () {
445
- return this.allTools.filter(function (tool) {
446
- return tool.overflows === true;
447
- });
448
- },
449
- enumerable: true,
450
- configurable: true
451
- });
452
- ToolBarComponent.prototype.shrink = function (containerWidth, childrenWidth) {
453
- var width;
454
- if (containerWidth < childrenWidth) {
455
- for (var i = this.visibleTools.length - 1; i >= 0; i--) {
456
- if (containerWidth > childrenWidth) {
457
- break;
458
- }
459
- else {
460
- width = this.hideLastVisibleTool();
461
- childrenWidth -= width;
462
- }
463
- }
464
- }
465
- };
466
- ToolBarComponent.prototype.stretch = function (containerWidth, childrenWidth) {
467
- var width;
468
- if (containerWidth > childrenWidth) {
469
- for (var i = this.overflowTools.length - 1; i >= 0; i--) {
470
- width = this.showFirstHiddenTool(containerWidth, childrenWidth);
471
- if (width) {
472
- childrenWidth += width;
473
- }
474
- else {
475
- break;
476
- }
477
- }
478
- }
479
- };
480
- ToolBarComponent.prototype.hideLastVisibleTool = function () {
481
- var tool = this.visibleTools[this.visibleTools.length - 1];
482
- var renderedElement = this.renderedTools.find(function (r) {
483
- return r.tool === tool;
484
- });
485
- var width = renderedElement.width;
486
- tool.overflows = true;
487
- this.refreshService.refresh(tool);
488
- return width;
489
- };
490
- ToolBarComponent.prototype.showFirstHiddenTool = function (containerWidth, childrenWidth) {
491
- var tool = this.overflowTools[0];
492
- var renderedElement = this.renderedTools.find(function (r) { return r.tool === tool; });
493
- tool.overflows = false;
494
- tool.visibility = 'hidden';
495
- this.refreshService.refresh(tool);
496
- if (containerWidth > childrenWidth + renderedElement.width) {
497
- tool.visibility = 'visible';
498
- this.refreshService.refresh(tool);
499
- }
500
- else {
501
- tool.overflows = true;
502
- this.refreshService.refresh(tool);
503
- }
504
- return renderedElement.width; // returns 0 if `overflows` is true
505
- };
506
- ToolBarComponent.prototype.setPopupContentDimensions = function () {
507
- var popupContentContainer = this.popupRef.popup.instance.contentContainer.nativeElement;
508
- popupContentContainer.style.width = this.popupWidth;
509
- popupContentContainer.style.height = this.popupHeight;
510
- popupContentContainer.style.overflow = 'auto';
511
- };
512
- tslib_1.__decorate([
513
- core_1.Input(),
514
- tslib_1.__metadata("design:type", Boolean)
515
- ], ToolBarComponent.prototype, "overflow", void 0);
516
- tslib_1.__decorate([
517
- core_1.Input(),
518
- tslib_1.__metadata("design:type", Boolean),
519
- tslib_1.__metadata("design:paramtypes", [Boolean])
520
- ], ToolBarComponent.prototype, "resizable", null);
521
- tslib_1.__decorate([
522
- core_1.Input(),
523
- tslib_1.__metadata("design:type", Object),
524
- tslib_1.__metadata("design:paramtypes", [Object])
525
- ], ToolBarComponent.prototype, "popupSettings", null);
526
- tslib_1.__decorate([
527
- core_1.Input(),
528
- tslib_1.__metadata("design:type", Number)
529
- ], ToolBarComponent.prototype, "tabindex", void 0);
530
- tslib_1.__decorate([
531
- core_1.Input('tabIndex'),
532
- tslib_1.__metadata("design:type", Number),
533
- tslib_1.__metadata("design:paramtypes", [Number])
534
- ], ToolBarComponent.prototype, "tabIndex", null);
535
- tslib_1.__decorate([
536
- core_1.Output(),
537
- tslib_1.__metadata("design:type", core_1.EventEmitter)
538
- ], ToolBarComponent.prototype, "open", void 0);
539
- tslib_1.__decorate([
540
- core_1.Output(),
541
- tslib_1.__metadata("design:type", core_1.EventEmitter)
542
- ], ToolBarComponent.prototype, "close", void 0);
543
- tslib_1.__decorate([
544
- core_1.ContentChildren(toolbar_tool_component_1.ToolBarToolComponent),
545
- tslib_1.__metadata("design:type", core_1.QueryList)
546
- ], ToolBarComponent.prototype, "allTools", void 0);
547
- tslib_1.__decorate([
548
- core_1.ViewChild('overflowButton', { static: false }),
549
- tslib_1.__metadata("design:type", core_1.ElementRef)
550
- ], ToolBarComponent.prototype, "overflowButton", void 0);
551
- tslib_1.__decorate([
552
- core_1.ViewChild('popupTemplate', { static: true }),
553
- tslib_1.__metadata("design:type", core_1.TemplateRef)
554
- ], ToolBarComponent.prototype, "popupTemplate", void 0);
555
- tslib_1.__decorate([
556
- core_1.ViewChild('resizeSensor', { static: false }),
557
- tslib_1.__metadata("design:type", kendo_angular_common_1.ResizeSensorComponent)
558
- ], ToolBarComponent.prototype, "resizeSensor", void 0);
559
- tslib_1.__decorate([
560
- core_1.ViewChild('container', { read: core_1.ViewContainerRef, static: true }),
561
- tslib_1.__metadata("design:type", core_1.ViewContainerRef)
562
- ], ToolBarComponent.prototype, "container", void 0);
563
- tslib_1.__decorate([
564
- core_1.ViewChildren('toolbarRenderer'),
565
- tslib_1.__metadata("design:type", core_1.QueryList)
566
- ], ToolBarComponent.prototype, "renderedTools", void 0);
567
- tslib_1.__decorate([
568
- core_1.ViewChildren('overflowRenderer'),
569
- tslib_1.__metadata("design:type", core_1.QueryList)
570
- ], ToolBarComponent.prototype, "overflowRenderedTools", void 0);
571
- tslib_1.__decorate([
572
- core_1.HostBinding('class.k-widget'),
573
- core_1.HostBinding('class.k-toolbar'),
574
- tslib_1.__metadata("design:type", Boolean)
575
- ], ToolBarComponent.prototype, "hostClasses", void 0);
576
- tslib_1.__decorate([
577
- core_1.HostListener('focus', ['$event']),
578
- tslib_1.__metadata("design:type", Function),
579
- tslib_1.__metadata("design:paramtypes", [Object]),
580
- tslib_1.__metadata("design:returntype", void 0)
581
- ], ToolBarComponent.prototype, "onFocus", null);
582
- tslib_1.__decorate([
583
- core_1.HostListener('focusout', ['$event']),
584
- tslib_1.__metadata("design:type", Function),
585
- tslib_1.__metadata("design:paramtypes", [Object]),
586
- tslib_1.__metadata("design:returntype", void 0)
587
- ], ToolBarComponent.prototype, "onFocusOut", null);
588
- tslib_1.__decorate([
589
- core_1.HostBinding('attr.role'),
590
- tslib_1.__metadata("design:type", String),
591
- tslib_1.__metadata("design:paramtypes", [])
592
- ], ToolBarComponent.prototype, "getRole", null);
593
- tslib_1.__decorate([
594
- core_1.HostBinding('attr.dir'),
595
- tslib_1.__metadata("design:type", String),
596
- tslib_1.__metadata("design:paramtypes", [])
597
- ], ToolBarComponent.prototype, "getDir", null);
598
- tslib_1.__decorate([
599
- core_1.HostBinding('class.k-toolbar-resizable'),
600
- tslib_1.__metadata("design:type", Boolean),
601
- tslib_1.__metadata("design:paramtypes", [])
602
- ], ToolBarComponent.prototype, "resizableClass", null);
603
- ToolBarComponent = tslib_1.__decorate([
604
- core_1.Component({
605
- exportAs: 'kendoToolBar',
606
- providers: [
607
- refresh_service_1.RefreshService,
608
- navigation_service_1.NavigationService,
609
- kendo_angular_l10n_1.LocalizationService,
610
- {
611
- provide: kendo_angular_l10n_1.L10N_PREFIX,
612
- useValue: 'kendo.toolbar'
613
- }
614
- ],
615
- selector: 'kendo-toolbar',
616
- 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]=\"displayAnchor\"\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 "
617
- }),
618
- tslib_1.__metadata("design:paramtypes", [kendo_angular_l10n_1.LocalizationService,
619
- kendo_angular_popup_1.PopupService,
620
- refresh_service_1.RefreshService,
621
- navigation_service_1.NavigationService,
622
- core_1.ElementRef,
623
- core_1.ChangeDetectorRef,
624
- core_1.NgZone,
625
- core_1.Renderer2])
626
- ], ToolBarComponent);
627
- return ToolBarComponent;
628
- }());
629
- exports.ToolBarComponent = ToolBarComponent;