@progress/kendo-angular-toolbar 5.0.1 → 5.0.2
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.
- package/README.md +11 -9
- package/dist/cdn/js/kendo-angular-toolbar.js +2 -2
- package/dist/cdn/main.js +1 -1
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/toolbar.component.js +34 -20
- package/dist/es2015/index.metadata.json +1 -1
- package/dist/es2015/package-metadata.js +1 -1
- package/dist/es2015/toolbar.component.d.ts +5 -4
- package/dist/es2015/toolbar.component.js +27 -13
- package/dist/fesm2015/index.js +27 -13
- package/dist/fesm5/index.js +34 -20
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/toolbar.component.js +31 -17
- package/dist/systemjs/kendo-angular-toolbar.js +1 -1
- package/package.json +10 -5
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as tslib_1 from "tslib";
|
|
6
|
-
import { Component, HostBinding, ViewChild, TemplateRef, ElementRef, QueryList, ContentChildren, Input,
|
|
6
|
+
import { Component, HostBinding, ViewChild, TemplateRef, ElementRef, QueryList, ContentChildren, Input, ViewChildren, HostListener, Output, EventEmitter, ViewContainerRef, NgZone, Renderer2 } from '@angular/core';
|
|
7
7
|
import { PopupService } from '@progress/kendo-angular-popup';
|
|
8
8
|
import { ResizeSensorComponent } from '@progress/kendo-angular-common';
|
|
9
9
|
import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
|
|
@@ -12,11 +12,11 @@ import { packageMetadata } from './package-metadata';
|
|
|
12
12
|
import { RefreshService } from './refresh.service';
|
|
13
13
|
import { NavigationService } from './navigation.service';
|
|
14
14
|
import { ToolBarToolComponent } from './tools/toolbar-tool.component';
|
|
15
|
-
import { outerWidth, innerWidth, closest } from './util';
|
|
15
|
+
import { outerWidth, innerWidth, closest, isPresent } from './util';
|
|
16
16
|
import { Keys } from '@progress/kendo-angular-common';
|
|
17
17
|
import { PreventableEvent } from './common/preventable-event';
|
|
18
18
|
import { Subscription, fromEvent, Subject, merge } from 'rxjs';
|
|
19
|
-
import { takeUntil } from 'rxjs/operators';
|
|
19
|
+
import { bufferTime, take, takeUntil } from 'rxjs/operators';
|
|
20
20
|
import { filter } from 'rxjs/operators';
|
|
21
21
|
import { isDocumentAvailable } from '@progress/kendo-angular-common';
|
|
22
22
|
import { defaultPopupWidth } from './common/constants';
|
|
@@ -30,13 +30,12 @@ const ɵ0 = getInitialPopupSettings;
|
|
|
30
30
|
* Represents the [Kendo UI ToolBar component for Angular]({% slug overview_toolbar %}).
|
|
31
31
|
*/
|
|
32
32
|
let ToolBarComponent = class ToolBarComponent {
|
|
33
|
-
constructor(localization, popupService, refreshService, navigationService, element,
|
|
33
|
+
constructor(localization, popupService, refreshService, navigationService, element, zone, renderer) {
|
|
34
34
|
this.localization = localization;
|
|
35
35
|
this.popupService = popupService;
|
|
36
36
|
this.refreshService = refreshService;
|
|
37
37
|
this.navigationService = navigationService;
|
|
38
38
|
this.element = element;
|
|
39
|
-
this.cdr = cdr;
|
|
40
39
|
this.zone = zone;
|
|
41
40
|
this.renderer = renderer;
|
|
42
41
|
/**
|
|
@@ -183,9 +182,14 @@ let ToolBarComponent = class ToolBarComponent {
|
|
|
183
182
|
});
|
|
184
183
|
});
|
|
185
184
|
if (this.overflow) {
|
|
186
|
-
this.subscriptions.add(merge(
|
|
185
|
+
this.subscriptions.add(merge(
|
|
186
|
+
// trigger resizing calculations once every 200ms instead of each time the resize event is emitted
|
|
187
|
+
this.resizeSensor.resize.pipe(bufferTime(200), filter(v => v.length > 0)), this.renderedTools.changes).subscribe(() => { this.onResize(); }));
|
|
187
188
|
// because of https://github.com/telerik/kendo-angular-buttons/pull/276
|
|
188
|
-
|
|
189
|
+
// calling onResize twice is the trade-off for removing the manual ChangeDetection
|
|
190
|
+
// triggering altogether - it ensures correct layout and calculations
|
|
191
|
+
// when some tools need overflow on initial rendering
|
|
192
|
+
this.zone.runOutsideAngular(() => setTimeout(() => { this.onResize(); this.onResize(); }));
|
|
189
193
|
this.navigationService.overflowButton = this.overflowButton;
|
|
190
194
|
}
|
|
191
195
|
this.navigationService.setRenderedTools(this.renderedTools.toArray());
|
|
@@ -272,8 +276,10 @@ let ToolBarComponent = class ToolBarComponent {
|
|
|
272
276
|
const containerWidth = innerWidth(this.element.nativeElement) - this.overflowAnchorWidth;
|
|
273
277
|
this.shrink(containerWidth, this.childrenWidth);
|
|
274
278
|
this.stretch(containerWidth, this.childrenWidth);
|
|
279
|
+
this.zone.onStable.pipe(take(1)).subscribe(() => {
|
|
280
|
+
this.displayAnchor();
|
|
281
|
+
});
|
|
275
282
|
}
|
|
276
|
-
this.cdr.detectChanges();
|
|
277
283
|
this.resizeSensor.acceptSize();
|
|
278
284
|
}
|
|
279
285
|
/**
|
|
@@ -330,8 +336,9 @@ let ToolBarComponent = class ToolBarComponent {
|
|
|
330
336
|
this.overflowKeydownListener();
|
|
331
337
|
}
|
|
332
338
|
}
|
|
333
|
-
|
|
334
|
-
|
|
339
|
+
displayAnchor() {
|
|
340
|
+
const visibility = this.allTools.filter(t => t.overflows && t.responsive).length > 0 ? 'visible' : 'hidden';
|
|
341
|
+
this.renderer.setStyle(this.overflowButton.nativeElement, 'visibility', visibility);
|
|
335
342
|
}
|
|
336
343
|
get popupWidth() {
|
|
337
344
|
if (!this.popupSettings || !this.popupSettings.width) {
|
|
@@ -354,8 +361,16 @@ let ToolBarComponent = class ToolBarComponent {
|
|
|
354
361
|
}
|
|
355
362
|
return this.cachedOverflowAnchorWidth;
|
|
356
363
|
}
|
|
364
|
+
get gap() {
|
|
365
|
+
if (isPresent(this.cachedGap)) {
|
|
366
|
+
return this.cachedGap;
|
|
367
|
+
}
|
|
368
|
+
const computedGap = getComputedStyle(this.element.nativeElement).gap;
|
|
369
|
+
this.cachedGap = isPresent(computedGap) ? parseInt(computedGap, 10) : 0;
|
|
370
|
+
return this.cachedGap;
|
|
371
|
+
}
|
|
357
372
|
get childrenWidth() {
|
|
358
|
-
const width = this.renderedTools.reduce((totalWidth, tool) => tool.width + totalWidth, 0);
|
|
373
|
+
const width = this.renderedTools.reduce((totalWidth, tool) => tool.width + totalWidth + (tool.isDisplayed() ? this.gap : 0), 0);
|
|
359
374
|
return Math.ceil(width);
|
|
360
375
|
}
|
|
361
376
|
get visibleTools() {
|
|
@@ -555,7 +570,7 @@ ToolBarComponent = tslib_1.__decorate([
|
|
|
555
570
|
[title]="moreToolsTitle"
|
|
556
571
|
[attr.aria-label]="moreToolsTitle"
|
|
557
572
|
*ngIf="overflow"
|
|
558
|
-
[style.visibility]="
|
|
573
|
+
[style.visibility]="'hidden'"
|
|
559
574
|
class="k-overflow-anchor k-button"
|
|
560
575
|
(click)="showPopup()"
|
|
561
576
|
>
|
|
@@ -585,7 +600,6 @@ ToolBarComponent = tslib_1.__decorate([
|
|
|
585
600
|
RefreshService,
|
|
586
601
|
NavigationService,
|
|
587
602
|
ElementRef,
|
|
588
|
-
ChangeDetectorRef,
|
|
589
603
|
NgZone,
|
|
590
604
|
Renderer2])
|
|
591
605
|
], ToolBarComponent);
|
package/dist/fesm2015/index.js
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { __decorate, __metadata } from 'tslib';
|
|
6
|
-
import { EventEmitter, Injectable, NgZone, Input, Component, Output, ContentChildren, QueryList, ViewChild, ElementRef, TemplateRef, ViewContainerRef, ViewChildren, HostBinding, HostListener,
|
|
6
|
+
import { EventEmitter, Injectable, NgZone, Input, Component, Output, ContentChildren, QueryList, ViewChild, ElementRef, TemplateRef, ViewContainerRef, ViewChildren, HostBinding, HostListener, Renderer2, forwardRef, Directive, NgModule } from '@angular/core';
|
|
7
7
|
import { PopupService, PopupModule } from '@progress/kendo-angular-popup';
|
|
8
8
|
import { Keys, isDocumentAvailable, ResizeSensorComponent, ResizeSensorModule } from '@progress/kendo-angular-common';
|
|
9
9
|
import { LocalizationService, L10N_PREFIX, ComponentMessages } from '@progress/kendo-angular-l10n';
|
|
10
10
|
import { validatePackage } from '@progress/kendo-licensing';
|
|
11
|
-
import { take, filter, takeUntil } from 'rxjs/operators';
|
|
11
|
+
import { take, bufferTime, filter, takeUntil } from 'rxjs/operators';
|
|
12
12
|
import { Subject, Subscription, merge, fromEvent } from 'rxjs';
|
|
13
13
|
import { ButtonGroupComponent, DropDownButtonComponent, SplitButtonComponent, ButtonsModule } from '@progress/kendo-angular-buttons';
|
|
14
14
|
import { CommonModule } from '@angular/common';
|
|
@@ -20,7 +20,7 @@ const packageMetadata = {
|
|
|
20
20
|
name: '@progress/kendo-angular-toolbar',
|
|
21
21
|
productName: 'Kendo UI for Angular',
|
|
22
22
|
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
23
|
-
publishDate:
|
|
23
|
+
publishDate: 1648214206,
|
|
24
24
|
version: '',
|
|
25
25
|
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
|
|
26
26
|
};
|
|
@@ -438,13 +438,12 @@ const getInitialPopupSettings = (isRtl) => ({
|
|
|
438
438
|
* Represents the [Kendo UI ToolBar component for Angular]({% slug overview_toolbar %}).
|
|
439
439
|
*/
|
|
440
440
|
let ToolBarComponent = class ToolBarComponent {
|
|
441
|
-
constructor(localization, popupService, refreshService, navigationService, element,
|
|
441
|
+
constructor(localization, popupService, refreshService, navigationService, element, zone, renderer) {
|
|
442
442
|
this.localization = localization;
|
|
443
443
|
this.popupService = popupService;
|
|
444
444
|
this.refreshService = refreshService;
|
|
445
445
|
this.navigationService = navigationService;
|
|
446
446
|
this.element = element;
|
|
447
|
-
this.cdr = cdr;
|
|
448
447
|
this.zone = zone;
|
|
449
448
|
this.renderer = renderer;
|
|
450
449
|
/**
|
|
@@ -591,9 +590,14 @@ let ToolBarComponent = class ToolBarComponent {
|
|
|
591
590
|
});
|
|
592
591
|
});
|
|
593
592
|
if (this.overflow) {
|
|
594
|
-
this.subscriptions.add(merge(
|
|
593
|
+
this.subscriptions.add(merge(
|
|
594
|
+
// trigger resizing calculations once every 200ms instead of each time the resize event is emitted
|
|
595
|
+
this.resizeSensor.resize.pipe(bufferTime(200), filter(v => v.length > 0)), this.renderedTools.changes).subscribe(() => { this.onResize(); }));
|
|
595
596
|
// because of https://github.com/telerik/kendo-angular-buttons/pull/276
|
|
596
|
-
|
|
597
|
+
// calling onResize twice is the trade-off for removing the manual ChangeDetection
|
|
598
|
+
// triggering altogether - it ensures correct layout and calculations
|
|
599
|
+
// when some tools need overflow on initial rendering
|
|
600
|
+
this.zone.runOutsideAngular(() => setTimeout(() => { this.onResize(); this.onResize(); }));
|
|
597
601
|
this.navigationService.overflowButton = this.overflowButton;
|
|
598
602
|
}
|
|
599
603
|
this.navigationService.setRenderedTools(this.renderedTools.toArray());
|
|
@@ -680,8 +684,10 @@ let ToolBarComponent = class ToolBarComponent {
|
|
|
680
684
|
const containerWidth = innerWidth(this.element.nativeElement) - this.overflowAnchorWidth;
|
|
681
685
|
this.shrink(containerWidth, this.childrenWidth);
|
|
682
686
|
this.stretch(containerWidth, this.childrenWidth);
|
|
687
|
+
this.zone.onStable.pipe(take(1)).subscribe(() => {
|
|
688
|
+
this.displayAnchor();
|
|
689
|
+
});
|
|
683
690
|
}
|
|
684
|
-
this.cdr.detectChanges();
|
|
685
691
|
this.resizeSensor.acceptSize();
|
|
686
692
|
}
|
|
687
693
|
/**
|
|
@@ -738,8 +744,9 @@ let ToolBarComponent = class ToolBarComponent {
|
|
|
738
744
|
this.overflowKeydownListener();
|
|
739
745
|
}
|
|
740
746
|
}
|
|
741
|
-
|
|
742
|
-
|
|
747
|
+
displayAnchor() {
|
|
748
|
+
const visibility = this.allTools.filter(t => t.overflows && t.responsive).length > 0 ? 'visible' : 'hidden';
|
|
749
|
+
this.renderer.setStyle(this.overflowButton.nativeElement, 'visibility', visibility);
|
|
743
750
|
}
|
|
744
751
|
get popupWidth() {
|
|
745
752
|
if (!this.popupSettings || !this.popupSettings.width) {
|
|
@@ -762,8 +769,16 @@ let ToolBarComponent = class ToolBarComponent {
|
|
|
762
769
|
}
|
|
763
770
|
return this.cachedOverflowAnchorWidth;
|
|
764
771
|
}
|
|
772
|
+
get gap() {
|
|
773
|
+
if (isPresent(this.cachedGap)) {
|
|
774
|
+
return this.cachedGap;
|
|
775
|
+
}
|
|
776
|
+
const computedGap = getComputedStyle(this.element.nativeElement).gap;
|
|
777
|
+
this.cachedGap = isPresent(computedGap) ? parseInt(computedGap, 10) : 0;
|
|
778
|
+
return this.cachedGap;
|
|
779
|
+
}
|
|
765
780
|
get childrenWidth() {
|
|
766
|
-
const width = this.renderedTools.reduce((totalWidth, tool) => tool.width + totalWidth, 0);
|
|
781
|
+
const width = this.renderedTools.reduce((totalWidth, tool) => tool.width + totalWidth + (tool.isDisplayed() ? this.gap : 0), 0);
|
|
767
782
|
return Math.ceil(width);
|
|
768
783
|
}
|
|
769
784
|
get visibleTools() {
|
|
@@ -963,7 +978,7 @@ ToolBarComponent = __decorate([
|
|
|
963
978
|
[title]="moreToolsTitle"
|
|
964
979
|
[attr.aria-label]="moreToolsTitle"
|
|
965
980
|
*ngIf="overflow"
|
|
966
|
-
[style.visibility]="
|
|
981
|
+
[style.visibility]="'hidden'"
|
|
967
982
|
class="k-overflow-anchor k-button"
|
|
968
983
|
(click)="showPopup()"
|
|
969
984
|
>
|
|
@@ -993,7 +1008,6 @@ ToolBarComponent = __decorate([
|
|
|
993
1008
|
RefreshService,
|
|
994
1009
|
NavigationService,
|
|
995
1010
|
ElementRef,
|
|
996
|
-
ChangeDetectorRef,
|
|
997
1011
|
NgZone,
|
|
998
1012
|
Renderer2])
|
|
999
1013
|
], ToolBarComponent);
|
package/dist/fesm5/index.js
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { __decorate, __metadata, __extends } from 'tslib';
|
|
6
|
-
import { Injectable, EventEmitter, NgZone, Input, Component, Output, ContentChildren, QueryList, ViewChild, ElementRef, TemplateRef, ViewContainerRef, ViewChildren, HostBinding, HostListener,
|
|
6
|
+
import { Injectable, EventEmitter, NgZone, Input, Component, Output, ContentChildren, QueryList, ViewChild, ElementRef, TemplateRef, ViewContainerRef, ViewChildren, HostBinding, HostListener, Renderer2, forwardRef, Directive, NgModule } from '@angular/core';
|
|
7
7
|
import { PopupService, PopupModule } from '@progress/kendo-angular-popup';
|
|
8
8
|
import { Keys, isDocumentAvailable, ResizeSensorComponent, ResizeSensorModule } from '@progress/kendo-angular-common';
|
|
9
9
|
import { LocalizationService, L10N_PREFIX, ComponentMessages } from '@progress/kendo-angular-l10n';
|
|
10
10
|
import { validatePackage } from '@progress/kendo-licensing';
|
|
11
|
-
import { take, filter, takeUntil } from 'rxjs/operators';
|
|
11
|
+
import { take, bufferTime, filter, takeUntil } from 'rxjs/operators';
|
|
12
12
|
import { merge, fromEvent, Subject, Subscription } from 'rxjs';
|
|
13
13
|
import { ButtonGroupComponent, DropDownButtonComponent, SplitButtonComponent, ButtonsModule } from '@progress/kendo-angular-buttons';
|
|
14
14
|
import { CommonModule } from '@angular/common';
|
|
@@ -20,7 +20,7 @@ var packageMetadata = {
|
|
|
20
20
|
name: '@progress/kendo-angular-toolbar',
|
|
21
21
|
productName: 'Kendo UI for Angular',
|
|
22
22
|
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
23
|
-
publishDate:
|
|
23
|
+
publishDate: 1648214206,
|
|
24
24
|
version: '',
|
|
25
25
|
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
|
|
26
26
|
};
|
|
@@ -463,13 +463,12 @@ var getInitialPopupSettings = function (isRtl) { return ({
|
|
|
463
463
|
* Represents the [Kendo UI ToolBar component for Angular]({% slug overview_toolbar %}).
|
|
464
464
|
*/
|
|
465
465
|
var ToolBarComponent = /** @class */ (function () {
|
|
466
|
-
function ToolBarComponent(localization, popupService, refreshService, navigationService, element,
|
|
466
|
+
function ToolBarComponent(localization, popupService, refreshService, navigationService, element, zone, renderer) {
|
|
467
467
|
this.localization = localization;
|
|
468
468
|
this.popupService = popupService;
|
|
469
469
|
this.refreshService = refreshService;
|
|
470
470
|
this.navigationService = navigationService;
|
|
471
471
|
this.element = element;
|
|
472
|
-
this.cdr = cdr;
|
|
473
472
|
this.zone = zone;
|
|
474
473
|
this.renderer = renderer;
|
|
475
474
|
/**
|
|
@@ -650,11 +649,14 @@ var ToolBarComponent = /** @class */ (function () {
|
|
|
650
649
|
});
|
|
651
650
|
});
|
|
652
651
|
if (this.overflow) {
|
|
653
|
-
this.subscriptions.add(merge(
|
|
654
|
-
|
|
655
|
-
}));
|
|
652
|
+
this.subscriptions.add(merge(
|
|
653
|
+
// trigger resizing calculations once every 200ms instead of each time the resize event is emitted
|
|
654
|
+
this.resizeSensor.resize.pipe(bufferTime(200), filter(function (v) { return v.length > 0; })), this.renderedTools.changes).subscribe(function () { _this.onResize(); }));
|
|
656
655
|
// because of https://github.com/telerik/kendo-angular-buttons/pull/276
|
|
657
|
-
|
|
656
|
+
// calling onResize twice is the trade-off for removing the manual ChangeDetection
|
|
657
|
+
// triggering altogether - it ensures correct layout and calculations
|
|
658
|
+
// when some tools need overflow on initial rendering
|
|
659
|
+
this.zone.runOutsideAngular(function () { return setTimeout(function () { _this.onResize(); _this.onResize(); }); });
|
|
658
660
|
this.navigationService.overflowButton = this.overflowButton;
|
|
659
661
|
}
|
|
660
662
|
this.navigationService.setRenderedTools(this.renderedTools.toArray());
|
|
@@ -749,12 +751,15 @@ var ToolBarComponent = /** @class */ (function () {
|
|
|
749
751
|
* @hidden
|
|
750
752
|
*/
|
|
751
753
|
ToolBarComponent.prototype.onResize = function () {
|
|
754
|
+
var _this = this;
|
|
752
755
|
if (isDocumentAvailable()) {
|
|
753
756
|
var containerWidth = innerWidth(this.element.nativeElement) - this.overflowAnchorWidth;
|
|
754
757
|
this.shrink(containerWidth, this.childrenWidth);
|
|
755
758
|
this.stretch(containerWidth, this.childrenWidth);
|
|
759
|
+
this.zone.onStable.pipe(take(1)).subscribe(function () {
|
|
760
|
+
_this.displayAnchor();
|
|
761
|
+
});
|
|
756
762
|
}
|
|
757
|
-
this.cdr.detectChanges();
|
|
758
763
|
this.resizeSensor.acceptSize();
|
|
759
764
|
};
|
|
760
765
|
/**
|
|
@@ -813,13 +818,10 @@ var ToolBarComponent = /** @class */ (function () {
|
|
|
813
818
|
this.overflowKeydownListener();
|
|
814
819
|
}
|
|
815
820
|
};
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
enumerable: true,
|
|
821
|
-
configurable: true
|
|
822
|
-
});
|
|
821
|
+
ToolBarComponent.prototype.displayAnchor = function () {
|
|
822
|
+
var visibility = this.allTools.filter(function (t) { return t.overflows && t.responsive; }).length > 0 ? 'visible' : 'hidden';
|
|
823
|
+
this.renderer.setStyle(this.overflowButton.nativeElement, 'visibility', visibility);
|
|
824
|
+
};
|
|
823
825
|
Object.defineProperty(ToolBarComponent.prototype, "popupWidth", {
|
|
824
826
|
get: function () {
|
|
825
827
|
if (!this.popupSettings || !this.popupSettings.width) {
|
|
@@ -853,9 +855,22 @@ var ToolBarComponent = /** @class */ (function () {
|
|
|
853
855
|
enumerable: true,
|
|
854
856
|
configurable: true
|
|
855
857
|
});
|
|
858
|
+
Object.defineProperty(ToolBarComponent.prototype, "gap", {
|
|
859
|
+
get: function () {
|
|
860
|
+
if (isPresent(this.cachedGap)) {
|
|
861
|
+
return this.cachedGap;
|
|
862
|
+
}
|
|
863
|
+
var computedGap = getComputedStyle(this.element.nativeElement).gap;
|
|
864
|
+
this.cachedGap = isPresent(computedGap) ? parseInt(computedGap, 10) : 0;
|
|
865
|
+
return this.cachedGap;
|
|
866
|
+
},
|
|
867
|
+
enumerable: true,
|
|
868
|
+
configurable: true
|
|
869
|
+
});
|
|
856
870
|
Object.defineProperty(ToolBarComponent.prototype, "childrenWidth", {
|
|
857
871
|
get: function () {
|
|
858
|
-
var
|
|
872
|
+
var _this = this;
|
|
873
|
+
var width = this.renderedTools.reduce(function (totalWidth, tool) { return tool.width + totalWidth + (tool.isDisplayed() ? _this.gap : 0); }, 0);
|
|
859
874
|
return Math.ceil(width);
|
|
860
875
|
},
|
|
861
876
|
enumerable: true,
|
|
@@ -1043,14 +1058,13 @@ var ToolBarComponent = /** @class */ (function () {
|
|
|
1043
1058
|
}
|
|
1044
1059
|
],
|
|
1045
1060
|
selector: 'kendo-toolbar',
|
|
1046
|
-
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]=\"
|
|
1061
|
+
template: "\n <ng-container kendoToolbarLocalizedMessages\n i18n-moreToolsTitle=\"kendo.toolbar.moreToolsTitle|The title of the **more tools** button in a responsive ToolBar\"\n moreToolsTitle=\"More tools\"\n >\n </ng-container>\n <ng-container *ngFor=\"let tool of allTools; let index = index\">\n <kendo-toolbar-renderer\n #toolbarRenderer\n (rendererClick)=\"onRendererClick($event)\"\n [location]=\"'toolbar'\"\n [resizable]=\"overflow\"\n [tool]=\"tool\"\n ></kendo-toolbar-renderer>\n </ng-container>\n <button\n #overflowButton\n type=\"button\"\n tabindex=\"-1\"\n [title]=\"moreToolsTitle\"\n [attr.aria-label]=\"moreToolsTitle\"\n *ngIf=\"overflow\"\n [style.visibility]=\"'hidden'\"\n class=\"k-overflow-anchor k-button\"\n (click)=\"showPopup()\"\n >\n <span class=\"k-icon k-i-more-vertical\"></span>\n </button>\n <ng-template #popupTemplate>\n <ul class=\"k-overflow-container k-list-container k-reset\">\n <ng-container *ngFor=\"let tool of allTools; let index = index\">\n <li class=\"k-item\">\n <kendo-toolbar-renderer\n #overflowRenderer\n (rendererClick)=\"onRendererClick($event)\"\n [location]=\"'overflow'\"\n [resizable]=\"overflow\"\n [tool]=\"tool\"\n ></kendo-toolbar-renderer>\n </li>\n </ng-container>\n </ul>\n </ng-template>\n <ng-container #container></ng-container>\n <kendo-resize-sensor *ngIf=\"overflow\" [rateLimit]=\"1000\" #resizeSensor></kendo-resize-sensor>\n "
|
|
1047
1062
|
}),
|
|
1048
1063
|
__metadata("design:paramtypes", [LocalizationService,
|
|
1049
1064
|
PopupService,
|
|
1050
1065
|
RefreshService,
|
|
1051
1066
|
NavigationService,
|
|
1052
1067
|
ElementRef,
|
|
1053
|
-
ChangeDetectorRef,
|
|
1054
1068
|
NgZone,
|
|
1055
1069
|
Renderer2])
|
|
1056
1070
|
], ToolBarComponent);
|
|
@@ -11,7 +11,7 @@ exports.packageMetadata = {
|
|
|
11
11
|
name: '@progress/kendo-angular-toolbar',
|
|
12
12
|
productName: 'Kendo UI for Angular',
|
|
13
13
|
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
14
|
-
publishDate:
|
|
14
|
+
publishDate: 1648214206,
|
|
15
15
|
version: '',
|
|
16
16
|
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
|
|
17
17
|
};
|
|
@@ -33,13 +33,12 @@ exports.ɵ0 = ɵ0;
|
|
|
33
33
|
* Represents the [Kendo UI ToolBar component for Angular]({% slug overview_toolbar %}).
|
|
34
34
|
*/
|
|
35
35
|
var ToolBarComponent = /** @class */ (function () {
|
|
36
|
-
function ToolBarComponent(localization, popupService, refreshService, navigationService, element,
|
|
36
|
+
function ToolBarComponent(localization, popupService, refreshService, navigationService, element, zone, renderer) {
|
|
37
37
|
this.localization = localization;
|
|
38
38
|
this.popupService = popupService;
|
|
39
39
|
this.refreshService = refreshService;
|
|
40
40
|
this.navigationService = navigationService;
|
|
41
41
|
this.element = element;
|
|
42
|
-
this.cdr = cdr;
|
|
43
42
|
this.zone = zone;
|
|
44
43
|
this.renderer = renderer;
|
|
45
44
|
/**
|
|
@@ -220,11 +219,14 @@ var ToolBarComponent = /** @class */ (function () {
|
|
|
220
219
|
});
|
|
221
220
|
});
|
|
222
221
|
if (this.overflow) {
|
|
223
|
-
this.subscriptions.add(rxjs_1.merge(
|
|
224
|
-
|
|
225
|
-
}));
|
|
222
|
+
this.subscriptions.add(rxjs_1.merge(
|
|
223
|
+
// trigger resizing calculations once every 200ms instead of each time the resize event is emitted
|
|
224
|
+
this.resizeSensor.resize.pipe(operators_1.bufferTime(200), operators_2.filter(function (v) { return v.length > 0; })), this.renderedTools.changes).subscribe(function () { _this.onResize(); }));
|
|
226
225
|
// because of https://github.com/telerik/kendo-angular-buttons/pull/276
|
|
227
|
-
|
|
226
|
+
// calling onResize twice is the trade-off for removing the manual ChangeDetection
|
|
227
|
+
// triggering altogether - it ensures correct layout and calculations
|
|
228
|
+
// when some tools need overflow on initial rendering
|
|
229
|
+
this.zone.runOutsideAngular(function () { return setTimeout(function () { _this.onResize(); _this.onResize(); }); });
|
|
228
230
|
this.navigationService.overflowButton = this.overflowButton;
|
|
229
231
|
}
|
|
230
232
|
this.navigationService.setRenderedTools(this.renderedTools.toArray());
|
|
@@ -319,12 +321,15 @@ var ToolBarComponent = /** @class */ (function () {
|
|
|
319
321
|
* @hidden
|
|
320
322
|
*/
|
|
321
323
|
ToolBarComponent.prototype.onResize = function () {
|
|
324
|
+
var _this = this;
|
|
322
325
|
if (kendo_angular_common_3.isDocumentAvailable()) {
|
|
323
326
|
var containerWidth = util_1.innerWidth(this.element.nativeElement) - this.overflowAnchorWidth;
|
|
324
327
|
this.shrink(containerWidth, this.childrenWidth);
|
|
325
328
|
this.stretch(containerWidth, this.childrenWidth);
|
|
329
|
+
this.zone.onStable.pipe(operators_1.take(1)).subscribe(function () {
|
|
330
|
+
_this.displayAnchor();
|
|
331
|
+
});
|
|
326
332
|
}
|
|
327
|
-
this.cdr.detectChanges();
|
|
328
333
|
this.resizeSensor.acceptSize();
|
|
329
334
|
};
|
|
330
335
|
/**
|
|
@@ -383,13 +388,10 @@ var ToolBarComponent = /** @class */ (function () {
|
|
|
383
388
|
this.overflowKeydownListener();
|
|
384
389
|
}
|
|
385
390
|
};
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
enumerable: true,
|
|
391
|
-
configurable: true
|
|
392
|
-
});
|
|
391
|
+
ToolBarComponent.prototype.displayAnchor = function () {
|
|
392
|
+
var visibility = this.allTools.filter(function (t) { return t.overflows && t.responsive; }).length > 0 ? 'visible' : 'hidden';
|
|
393
|
+
this.renderer.setStyle(this.overflowButton.nativeElement, 'visibility', visibility);
|
|
394
|
+
};
|
|
393
395
|
Object.defineProperty(ToolBarComponent.prototype, "popupWidth", {
|
|
394
396
|
get: function () {
|
|
395
397
|
if (!this.popupSettings || !this.popupSettings.width) {
|
|
@@ -423,9 +425,22 @@ var ToolBarComponent = /** @class */ (function () {
|
|
|
423
425
|
enumerable: true,
|
|
424
426
|
configurable: true
|
|
425
427
|
});
|
|
428
|
+
Object.defineProperty(ToolBarComponent.prototype, "gap", {
|
|
429
|
+
get: function () {
|
|
430
|
+
if (util_1.isPresent(this.cachedGap)) {
|
|
431
|
+
return this.cachedGap;
|
|
432
|
+
}
|
|
433
|
+
var computedGap = getComputedStyle(this.element.nativeElement).gap;
|
|
434
|
+
this.cachedGap = util_1.isPresent(computedGap) ? parseInt(computedGap, 10) : 0;
|
|
435
|
+
return this.cachedGap;
|
|
436
|
+
},
|
|
437
|
+
enumerable: true,
|
|
438
|
+
configurable: true
|
|
439
|
+
});
|
|
426
440
|
Object.defineProperty(ToolBarComponent.prototype, "childrenWidth", {
|
|
427
441
|
get: function () {
|
|
428
|
-
var
|
|
442
|
+
var _this = this;
|
|
443
|
+
var width = this.renderedTools.reduce(function (totalWidth, tool) { return tool.width + totalWidth + (tool.isDisplayed() ? _this.gap : 0); }, 0);
|
|
429
444
|
return Math.ceil(width);
|
|
430
445
|
},
|
|
431
446
|
enumerable: true,
|
|
@@ -613,14 +628,13 @@ var ToolBarComponent = /** @class */ (function () {
|
|
|
613
628
|
}
|
|
614
629
|
],
|
|
615
630
|
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]=\"
|
|
631
|
+
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 "
|
|
617
632
|
}),
|
|
618
633
|
tslib_1.__metadata("design:paramtypes", [kendo_angular_l10n_1.LocalizationService,
|
|
619
634
|
kendo_angular_popup_1.PopupService,
|
|
620
635
|
refresh_service_1.RefreshService,
|
|
621
636
|
navigation_service_1.NavigationService,
|
|
622
637
|
core_1.ElementRef,
|
|
623
|
-
core_1.ChangeDetectorRef,
|
|
624
638
|
core_1.NgZone,
|
|
625
639
|
core_1.Renderer2])
|
|
626
640
|
], ToolBarComponent);
|