@progress/kendo-angular-toolbar 5.0.2-dev.202203090949 → 5.0.3-dev.202203280906
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 +47 -21
- package/dist/es2015/index.metadata.json +1 -1
- package/dist/es2015/package-metadata.js +1 -1
- package/dist/es2015/toolbar.component.d.ts +10 -4
- package/dist/es2015/toolbar.component.js +36 -14
- package/dist/fesm2015/index.js +36 -14
- package/dist/fesm5/index.js +47 -21
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/toolbar.component.js +44 -18
- package/dist/systemjs/kendo-angular-toolbar.js +1 -1
- package/package.json +9 -4
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, ChangeDetectorRef, 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: 1648458287,
|
|
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,15 +438,15 @@ 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, _cdr) {
|
|
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;
|
|
449
|
+
this._cdr = _cdr;
|
|
450
450
|
/**
|
|
451
451
|
* Hides the overflowing tools in a popup.
|
|
452
452
|
*/
|
|
@@ -591,9 +591,14 @@ let ToolBarComponent = class ToolBarComponent {
|
|
|
591
591
|
});
|
|
592
592
|
});
|
|
593
593
|
if (this.overflow) {
|
|
594
|
-
this.subscriptions.add(merge(
|
|
594
|
+
this.subscriptions.add(merge(
|
|
595
|
+
// trigger resizing calculations once every 200ms instead of each time the resize event is emitted
|
|
596
|
+
this.resizeSensor.resize.pipe(bufferTime(200), filter(v => v.length > 0)), this.renderedTools.changes).subscribe(() => { this.onResize(); }));
|
|
595
597
|
// because of https://github.com/telerik/kendo-angular-buttons/pull/276
|
|
596
|
-
|
|
598
|
+
// calling onResize twice is the trade-off for removing the manual ChangeDetection
|
|
599
|
+
// triggering altogether - it ensures correct layout and calculations
|
|
600
|
+
// when some tools need overflow on initial rendering
|
|
601
|
+
this.zone.runOutsideAngular(() => setTimeout(() => { this.onResize(); this.onResize(); }));
|
|
597
602
|
this.navigationService.overflowButton = this.overflowButton;
|
|
598
603
|
}
|
|
599
604
|
this.navigationService.setRenderedTools(this.renderedTools.toArray());
|
|
@@ -633,6 +638,12 @@ let ToolBarComponent = class ToolBarComponent {
|
|
|
633
638
|
get moreToolsTitle() {
|
|
634
639
|
return this.localization.get('moreToolsTitle');
|
|
635
640
|
}
|
|
641
|
+
/**
|
|
642
|
+
* @hidden
|
|
643
|
+
*/
|
|
644
|
+
get cdr() {
|
|
645
|
+
return this._cdr;
|
|
646
|
+
}
|
|
636
647
|
/**
|
|
637
648
|
* @hidden
|
|
638
649
|
*/
|
|
@@ -680,8 +691,10 @@ let ToolBarComponent = class ToolBarComponent {
|
|
|
680
691
|
const containerWidth = innerWidth(this.element.nativeElement) - this.overflowAnchorWidth;
|
|
681
692
|
this.shrink(containerWidth, this.childrenWidth);
|
|
682
693
|
this.stretch(containerWidth, this.childrenWidth);
|
|
694
|
+
this.zone.onStable.pipe(take(1)).subscribe(() => {
|
|
695
|
+
this.displayAnchor();
|
|
696
|
+
});
|
|
683
697
|
}
|
|
684
|
-
this.cdr.detectChanges();
|
|
685
698
|
this.resizeSensor.acceptSize();
|
|
686
699
|
}
|
|
687
700
|
/**
|
|
@@ -738,8 +751,9 @@ let ToolBarComponent = class ToolBarComponent {
|
|
|
738
751
|
this.overflowKeydownListener();
|
|
739
752
|
}
|
|
740
753
|
}
|
|
741
|
-
|
|
742
|
-
|
|
754
|
+
displayAnchor() {
|
|
755
|
+
const visibility = this.allTools.filter(t => t.overflows && t.responsive).length > 0 ? 'visible' : 'hidden';
|
|
756
|
+
this.renderer.setStyle(this.overflowButton.nativeElement, 'visibility', visibility);
|
|
743
757
|
}
|
|
744
758
|
get popupWidth() {
|
|
745
759
|
if (!this.popupSettings || !this.popupSettings.width) {
|
|
@@ -762,8 +776,16 @@ let ToolBarComponent = class ToolBarComponent {
|
|
|
762
776
|
}
|
|
763
777
|
return this.cachedOverflowAnchorWidth;
|
|
764
778
|
}
|
|
779
|
+
get gap() {
|
|
780
|
+
if (isPresent(this.cachedGap)) {
|
|
781
|
+
return this.cachedGap;
|
|
782
|
+
}
|
|
783
|
+
const computedGap = getComputedStyle(this.element.nativeElement).gap;
|
|
784
|
+
this.cachedGap = isPresent(computedGap) ? parseInt(computedGap, 10) : 0;
|
|
785
|
+
return this.cachedGap;
|
|
786
|
+
}
|
|
765
787
|
get childrenWidth() {
|
|
766
|
-
const width = this.renderedTools.reduce((totalWidth, tool) => tool.width + totalWidth, 0);
|
|
788
|
+
const width = this.renderedTools.reduce((totalWidth, tool) => tool.width + totalWidth + (tool.isDisplayed() ? this.gap : 0), 0);
|
|
767
789
|
return Math.ceil(width);
|
|
768
790
|
}
|
|
769
791
|
get visibleTools() {
|
|
@@ -963,7 +985,7 @@ ToolBarComponent = __decorate([
|
|
|
963
985
|
[title]="moreToolsTitle"
|
|
964
986
|
[attr.aria-label]="moreToolsTitle"
|
|
965
987
|
*ngIf="overflow"
|
|
966
|
-
[style.visibility]="
|
|
988
|
+
[style.visibility]="'hidden'"
|
|
967
989
|
class="k-overflow-anchor k-button"
|
|
968
990
|
(click)="showPopup()"
|
|
969
991
|
>
|
|
@@ -993,9 +1015,9 @@ ToolBarComponent = __decorate([
|
|
|
993
1015
|
RefreshService,
|
|
994
1016
|
NavigationService,
|
|
995
1017
|
ElementRef,
|
|
996
|
-
ChangeDetectorRef,
|
|
997
1018
|
NgZone,
|
|
998
|
-
Renderer2
|
|
1019
|
+
Renderer2,
|
|
1020
|
+
ChangeDetectorRef])
|
|
999
1021
|
], ToolBarComponent);
|
|
1000
1022
|
|
|
1001
1023
|
var ToolBarButtonComponent_1;
|
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, ChangeDetectorRef, 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: 1648458287,
|
|
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,15 +463,15 @@ 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, _cdr) {
|
|
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;
|
|
474
|
+
this._cdr = _cdr;
|
|
475
475
|
/**
|
|
476
476
|
* Hides the overflowing tools in a popup.
|
|
477
477
|
*/
|
|
@@ -650,11 +650,14 @@ var ToolBarComponent = /** @class */ (function () {
|
|
|
650
650
|
});
|
|
651
651
|
});
|
|
652
652
|
if (this.overflow) {
|
|
653
|
-
this.subscriptions.add(merge(
|
|
654
|
-
|
|
655
|
-
}));
|
|
653
|
+
this.subscriptions.add(merge(
|
|
654
|
+
// trigger resizing calculations once every 200ms instead of each time the resize event is emitted
|
|
655
|
+
this.resizeSensor.resize.pipe(bufferTime(200), filter(function (v) { return v.length > 0; })), this.renderedTools.changes).subscribe(function () { _this.onResize(); }));
|
|
656
656
|
// because of https://github.com/telerik/kendo-angular-buttons/pull/276
|
|
657
|
-
|
|
657
|
+
// calling onResize twice is the trade-off for removing the manual ChangeDetection
|
|
658
|
+
// triggering altogether - it ensures correct layout and calculations
|
|
659
|
+
// when some tools need overflow on initial rendering
|
|
660
|
+
this.zone.runOutsideAngular(function () { return setTimeout(function () { _this.onResize(); _this.onResize(); }); });
|
|
658
661
|
this.navigationService.overflowButton = this.overflowButton;
|
|
659
662
|
}
|
|
660
663
|
this.navigationService.setRenderedTools(this.renderedTools.toArray());
|
|
@@ -706,6 +709,16 @@ var ToolBarComponent = /** @class */ (function () {
|
|
|
706
709
|
enumerable: true,
|
|
707
710
|
configurable: true
|
|
708
711
|
});
|
|
712
|
+
Object.defineProperty(ToolBarComponent.prototype, "cdr", {
|
|
713
|
+
/**
|
|
714
|
+
* @hidden
|
|
715
|
+
*/
|
|
716
|
+
get: function () {
|
|
717
|
+
return this._cdr;
|
|
718
|
+
},
|
|
719
|
+
enumerable: true,
|
|
720
|
+
configurable: true
|
|
721
|
+
});
|
|
709
722
|
/**
|
|
710
723
|
* @hidden
|
|
711
724
|
*/
|
|
@@ -749,12 +762,15 @@ var ToolBarComponent = /** @class */ (function () {
|
|
|
749
762
|
* @hidden
|
|
750
763
|
*/
|
|
751
764
|
ToolBarComponent.prototype.onResize = function () {
|
|
765
|
+
var _this = this;
|
|
752
766
|
if (isDocumentAvailable()) {
|
|
753
767
|
var containerWidth = innerWidth(this.element.nativeElement) - this.overflowAnchorWidth;
|
|
754
768
|
this.shrink(containerWidth, this.childrenWidth);
|
|
755
769
|
this.stretch(containerWidth, this.childrenWidth);
|
|
770
|
+
this.zone.onStable.pipe(take(1)).subscribe(function () {
|
|
771
|
+
_this.displayAnchor();
|
|
772
|
+
});
|
|
756
773
|
}
|
|
757
|
-
this.cdr.detectChanges();
|
|
758
774
|
this.resizeSensor.acceptSize();
|
|
759
775
|
};
|
|
760
776
|
/**
|
|
@@ -813,13 +829,10 @@ var ToolBarComponent = /** @class */ (function () {
|
|
|
813
829
|
this.overflowKeydownListener();
|
|
814
830
|
}
|
|
815
831
|
};
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
enumerable: true,
|
|
821
|
-
configurable: true
|
|
822
|
-
});
|
|
832
|
+
ToolBarComponent.prototype.displayAnchor = function () {
|
|
833
|
+
var visibility = this.allTools.filter(function (t) { return t.overflows && t.responsive; }).length > 0 ? 'visible' : 'hidden';
|
|
834
|
+
this.renderer.setStyle(this.overflowButton.nativeElement, 'visibility', visibility);
|
|
835
|
+
};
|
|
823
836
|
Object.defineProperty(ToolBarComponent.prototype, "popupWidth", {
|
|
824
837
|
get: function () {
|
|
825
838
|
if (!this.popupSettings || !this.popupSettings.width) {
|
|
@@ -853,9 +866,22 @@ var ToolBarComponent = /** @class */ (function () {
|
|
|
853
866
|
enumerable: true,
|
|
854
867
|
configurable: true
|
|
855
868
|
});
|
|
869
|
+
Object.defineProperty(ToolBarComponent.prototype, "gap", {
|
|
870
|
+
get: function () {
|
|
871
|
+
if (isPresent(this.cachedGap)) {
|
|
872
|
+
return this.cachedGap;
|
|
873
|
+
}
|
|
874
|
+
var computedGap = getComputedStyle(this.element.nativeElement).gap;
|
|
875
|
+
this.cachedGap = isPresent(computedGap) ? parseInt(computedGap, 10) : 0;
|
|
876
|
+
return this.cachedGap;
|
|
877
|
+
},
|
|
878
|
+
enumerable: true,
|
|
879
|
+
configurable: true
|
|
880
|
+
});
|
|
856
881
|
Object.defineProperty(ToolBarComponent.prototype, "childrenWidth", {
|
|
857
882
|
get: function () {
|
|
858
|
-
var
|
|
883
|
+
var _this = this;
|
|
884
|
+
var width = this.renderedTools.reduce(function (totalWidth, tool) { return tool.width + totalWidth + (tool.isDisplayed() ? _this.gap : 0); }, 0);
|
|
859
885
|
return Math.ceil(width);
|
|
860
886
|
},
|
|
861
887
|
enumerable: true,
|
|
@@ -1043,16 +1069,16 @@ var ToolBarComponent = /** @class */ (function () {
|
|
|
1043
1069
|
}
|
|
1044
1070
|
],
|
|
1045
1071
|
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]=\"
|
|
1072
|
+
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
1073
|
}),
|
|
1048
1074
|
__metadata("design:paramtypes", [LocalizationService,
|
|
1049
1075
|
PopupService,
|
|
1050
1076
|
RefreshService,
|
|
1051
1077
|
NavigationService,
|
|
1052
1078
|
ElementRef,
|
|
1053
|
-
ChangeDetectorRef,
|
|
1054
1079
|
NgZone,
|
|
1055
|
-
Renderer2
|
|
1080
|
+
Renderer2,
|
|
1081
|
+
ChangeDetectorRef])
|
|
1056
1082
|
], ToolBarComponent);
|
|
1057
1083
|
return ToolBarComponent;
|
|
1058
1084
|
}());
|
|
@@ -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: 1648458287,
|
|
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,15 +33,15 @@ 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, _cdr) {
|
|
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;
|
|
44
|
+
this._cdr = _cdr;
|
|
45
45
|
/**
|
|
46
46
|
* Hides the overflowing tools in a popup.
|
|
47
47
|
*/
|
|
@@ -220,11 +220,14 @@ var ToolBarComponent = /** @class */ (function () {
|
|
|
220
220
|
});
|
|
221
221
|
});
|
|
222
222
|
if (this.overflow) {
|
|
223
|
-
this.subscriptions.add(rxjs_1.merge(
|
|
224
|
-
|
|
225
|
-
}));
|
|
223
|
+
this.subscriptions.add(rxjs_1.merge(
|
|
224
|
+
// trigger resizing calculations once every 200ms instead of each time the resize event is emitted
|
|
225
|
+
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
226
|
// because of https://github.com/telerik/kendo-angular-buttons/pull/276
|
|
227
|
-
|
|
227
|
+
// calling onResize twice is the trade-off for removing the manual ChangeDetection
|
|
228
|
+
// triggering altogether - it ensures correct layout and calculations
|
|
229
|
+
// when some tools need overflow on initial rendering
|
|
230
|
+
this.zone.runOutsideAngular(function () { return setTimeout(function () { _this.onResize(); _this.onResize(); }); });
|
|
228
231
|
this.navigationService.overflowButton = this.overflowButton;
|
|
229
232
|
}
|
|
230
233
|
this.navigationService.setRenderedTools(this.renderedTools.toArray());
|
|
@@ -276,6 +279,16 @@ var ToolBarComponent = /** @class */ (function () {
|
|
|
276
279
|
enumerable: true,
|
|
277
280
|
configurable: true
|
|
278
281
|
});
|
|
282
|
+
Object.defineProperty(ToolBarComponent.prototype, "cdr", {
|
|
283
|
+
/**
|
|
284
|
+
* @hidden
|
|
285
|
+
*/
|
|
286
|
+
get: function () {
|
|
287
|
+
return this._cdr;
|
|
288
|
+
},
|
|
289
|
+
enumerable: true,
|
|
290
|
+
configurable: true
|
|
291
|
+
});
|
|
279
292
|
/**
|
|
280
293
|
* @hidden
|
|
281
294
|
*/
|
|
@@ -319,12 +332,15 @@ var ToolBarComponent = /** @class */ (function () {
|
|
|
319
332
|
* @hidden
|
|
320
333
|
*/
|
|
321
334
|
ToolBarComponent.prototype.onResize = function () {
|
|
335
|
+
var _this = this;
|
|
322
336
|
if (kendo_angular_common_3.isDocumentAvailable()) {
|
|
323
337
|
var containerWidth = util_1.innerWidth(this.element.nativeElement) - this.overflowAnchorWidth;
|
|
324
338
|
this.shrink(containerWidth, this.childrenWidth);
|
|
325
339
|
this.stretch(containerWidth, this.childrenWidth);
|
|
340
|
+
this.zone.onStable.pipe(operators_1.take(1)).subscribe(function () {
|
|
341
|
+
_this.displayAnchor();
|
|
342
|
+
});
|
|
326
343
|
}
|
|
327
|
-
this.cdr.detectChanges();
|
|
328
344
|
this.resizeSensor.acceptSize();
|
|
329
345
|
};
|
|
330
346
|
/**
|
|
@@ -383,13 +399,10 @@ var ToolBarComponent = /** @class */ (function () {
|
|
|
383
399
|
this.overflowKeydownListener();
|
|
384
400
|
}
|
|
385
401
|
};
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
enumerable: true,
|
|
391
|
-
configurable: true
|
|
392
|
-
});
|
|
402
|
+
ToolBarComponent.prototype.displayAnchor = function () {
|
|
403
|
+
var visibility = this.allTools.filter(function (t) { return t.overflows && t.responsive; }).length > 0 ? 'visible' : 'hidden';
|
|
404
|
+
this.renderer.setStyle(this.overflowButton.nativeElement, 'visibility', visibility);
|
|
405
|
+
};
|
|
393
406
|
Object.defineProperty(ToolBarComponent.prototype, "popupWidth", {
|
|
394
407
|
get: function () {
|
|
395
408
|
if (!this.popupSettings || !this.popupSettings.width) {
|
|
@@ -423,9 +436,22 @@ var ToolBarComponent = /** @class */ (function () {
|
|
|
423
436
|
enumerable: true,
|
|
424
437
|
configurable: true
|
|
425
438
|
});
|
|
439
|
+
Object.defineProperty(ToolBarComponent.prototype, "gap", {
|
|
440
|
+
get: function () {
|
|
441
|
+
if (util_1.isPresent(this.cachedGap)) {
|
|
442
|
+
return this.cachedGap;
|
|
443
|
+
}
|
|
444
|
+
var computedGap = getComputedStyle(this.element.nativeElement).gap;
|
|
445
|
+
this.cachedGap = util_1.isPresent(computedGap) ? parseInt(computedGap, 10) : 0;
|
|
446
|
+
return this.cachedGap;
|
|
447
|
+
},
|
|
448
|
+
enumerable: true,
|
|
449
|
+
configurable: true
|
|
450
|
+
});
|
|
426
451
|
Object.defineProperty(ToolBarComponent.prototype, "childrenWidth", {
|
|
427
452
|
get: function () {
|
|
428
|
-
var
|
|
453
|
+
var _this = this;
|
|
454
|
+
var width = this.renderedTools.reduce(function (totalWidth, tool) { return tool.width + totalWidth + (tool.isDisplayed() ? _this.gap : 0); }, 0);
|
|
429
455
|
return Math.ceil(width);
|
|
430
456
|
},
|
|
431
457
|
enumerable: true,
|
|
@@ -613,16 +639,16 @@ var ToolBarComponent = /** @class */ (function () {
|
|
|
613
639
|
}
|
|
614
640
|
],
|
|
615
641
|
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]=\"
|
|
642
|
+
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
643
|
}),
|
|
618
644
|
tslib_1.__metadata("design:paramtypes", [kendo_angular_l10n_1.LocalizationService,
|
|
619
645
|
kendo_angular_popup_1.PopupService,
|
|
620
646
|
refresh_service_1.RefreshService,
|
|
621
647
|
navigation_service_1.NavigationService,
|
|
622
648
|
core_1.ElementRef,
|
|
623
|
-
core_1.ChangeDetectorRef,
|
|
624
649
|
core_1.NgZone,
|
|
625
|
-
core_1.Renderer2
|
|
650
|
+
core_1.Renderer2,
|
|
651
|
+
core_1.ChangeDetectorRef])
|
|
626
652
|
], ToolBarComponent);
|
|
627
653
|
return ToolBarComponent;
|
|
628
654
|
}());
|