@progress/kendo-angular-buttons 7.0.6 → 7.0.7-dev.202204111624

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 (38) hide show
  1. package/dist/cdn/js/kendo-angular-buttons.js +2 -2
  2. package/dist/cdn/main.js +1 -1
  3. package/dist/es/button/button.directive.js +7 -7
  4. package/dist/es/buttongroup/buttongroup.component.js +7 -6
  5. package/dist/es/chip/chip.component.js +11 -19
  6. package/dist/es/dropdownbutton/dropdownbutton.component.js +10 -8
  7. package/dist/es/focusable/focusable.directive.js +5 -11
  8. package/dist/es/listbutton/list-button.js +16 -36
  9. package/dist/es/package-metadata.js +1 -1
  10. package/dist/es/splitbutton/splitbutton.component.js +5 -2
  11. package/dist/es2015/button/button.directive.d.ts +1 -2
  12. package/dist/es2015/button/button.directive.js +6 -6
  13. package/dist/es2015/buttongroup/buttongroup.component.d.ts +1 -2
  14. package/dist/es2015/buttongroup/buttongroup.component.js +6 -5
  15. package/dist/es2015/chip/chip.component.d.ts +1 -2
  16. package/dist/es2015/chip/chip.component.js +11 -19
  17. package/dist/es2015/dropdownbutton/dropdownbutton.component.d.ts +1 -0
  18. package/dist/es2015/dropdownbutton/dropdownbutton.component.js +10 -8
  19. package/dist/es2015/focusable/focusable.directive.d.ts +1 -2
  20. package/dist/es2015/focusable/focusable.directive.js +5 -11
  21. package/dist/es2015/index.metadata.json +1 -1
  22. package/dist/es2015/listbutton/list-button.d.ts +1 -11
  23. package/dist/es2015/listbutton/list-button.js +15 -35
  24. package/dist/es2015/package-metadata.js +1 -1
  25. package/dist/es2015/splitbutton/splitbutton.component.d.ts +1 -0
  26. package/dist/es2015/splitbutton/splitbutton.component.js +5 -2
  27. package/dist/fesm2015/index.js +53 -86
  28. package/dist/fesm5/index.js +56 -89
  29. package/dist/npm/button/button.directive.js +7 -7
  30. package/dist/npm/buttongroup/buttongroup.component.js +7 -6
  31. package/dist/npm/chip/chip.component.js +11 -19
  32. package/dist/npm/dropdownbutton/dropdownbutton.component.js +9 -7
  33. package/dist/npm/focusable/focusable.directive.js +5 -11
  34. package/dist/npm/listbutton/list-button.js +15 -35
  35. package/dist/npm/package-metadata.js +1 -1
  36. package/dist/npm/splitbutton/splitbutton.component.js +5 -2
  37. package/dist/systemjs/kendo-angular-buttons.js +1 -1
  38. package/package.json +1 -1
@@ -4,7 +4,7 @@
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import { __decorate, __metadata, __param, __extends } from 'tslib';
6
6
  import { Injectable, Input, Output, EventEmitter, HostBinding, HostListener, Directive, Optional, ElementRef, Renderer2, NgZone, isDevMode, ContentChildren, QueryList, Component, NgModule, TemplateRef, ViewContainerRef, InjectionToken, Inject, ContentChild, ViewChild, ChangeDetectorRef, forwardRef } from '@angular/core';
7
- import { Subject, fromEvent, merge, Subscription } from 'rxjs';
7
+ import { Subject, Subscription, fromEvent, merge } from 'rxjs';
8
8
  import { isDocumentAvailable, Keys, isChanged, hasObservers, guid, EventsModule } 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';
@@ -38,7 +38,7 @@ var packageMetadata = {
38
38
  name: '@progress/kendo-angular-buttons',
39
39
  productName: 'Kendo UI for Angular',
40
40
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
41
- publishDate: 1648649426,
41
+ publishDate: 1649694226,
42
42
  version: '',
43
43
  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'
44
44
  };
@@ -183,13 +183,13 @@ var ButtonDirective = /** @class */ (function () {
183
183
  this._fillMode = 'solid';
184
184
  this._themeColor = 'base';
185
185
  this._focused = false;
186
- this.domEvents = [];
186
+ this.subs = new Subscription();
187
187
  validatePackage(packageMetadata);
188
188
  this.direction = localization.rtl ? 'rtl' : 'ltr';
189
- this.localizationChangeSubscription = localization.changes.subscribe(function (_a) {
189
+ this.subs.add(localization.changes.subscribe(function (_a) {
190
190
  var rtl = _a.rtl;
191
191
  return (_this.direction = rtl ? 'rtl' : 'ltr');
192
- });
192
+ }));
193
193
  this.element = element.nativeElement;
194
194
  this.renderer = renderer;
195
195
  }
@@ -532,8 +532,8 @@ var ButtonDirective = /** @class */ (function () {
532
532
  this.setAttribute('role', this.role);
533
533
  }
534
534
  this.ngZone.runOutsideAngular(function () {
535
- _this.domEvents.push(_this.renderer.listen(_this.element, 'click', _this._onButtonClick.bind(_this)));
536
- _this.domEvents.push(_this.renderer.listen(_this.element, 'keydown', function (event) {
535
+ _this.subs.add(_this.renderer.listen(_this.element, 'click', _this._onButtonClick.bind(_this)));
536
+ _this.subs.add(_this.renderer.listen(_this.element, 'keydown', function (event) {
537
537
  var isSpaceOrEnter = event.keyCode === Keys.Space || event.keyCode === Keys.Enter;
538
538
  if (isSpan && isSpaceOrEnter) {
539
539
  _this.click.emit(event);
@@ -562,9 +562,8 @@ var ButtonDirective = /** @class */ (function () {
562
562
  this.iconNode = null;
563
563
  this.iconSpanNode = null;
564
564
  this.renderer = null;
565
- this.localizationChangeSubscription.unsubscribe();
565
+ this.subs.unsubscribe();
566
566
  clearTimeout(this.deferTimeout);
567
- this.domEvents.forEach(function (unbindHandler) { return unbindHandler(); });
568
567
  };
569
568
  /**
570
569
  * Focuses the Button component.
@@ -956,11 +955,12 @@ var ButtonGroupComponent = /** @class */ (function () {
956
955
  this.navigate = new EventEmitter();
957
956
  this._tabIndex = 0;
958
957
  this.currentTabIndex = 0;
958
+ this.subs = new Subscription();
959
959
  validatePackage(packageMetadata);
960
- this.localizationChangeSubscription = localization.changes.subscribe(function (_a) {
960
+ this.subs.add(localization.changes.subscribe(function (_a) {
961
961
  var rtl = _a.rtl;
962
962
  return _this.direction = rtl ? 'rtl' : 'ltr';
963
- });
963
+ }));
964
964
  }
965
965
  Object.defineProperty(ButtonGroupComponent.prototype, "tabIndex", {
966
966
  get: function () {
@@ -1062,7 +1062,7 @@ var ButtonGroupComponent = /** @class */ (function () {
1062
1062
  };
1063
1063
  ButtonGroupComponent.prototype.ngOnInit = function () {
1064
1064
  var _this = this;
1065
- this.subscription = this.service.buttonClicked$.subscribe(function (button) {
1065
+ this.subs.add(this.service.buttonClicked$.subscribe(function (button) {
1066
1066
  var newSelectionValue;
1067
1067
  if (_this.isSelectionSingle()) {
1068
1068
  newSelectionValue = true;
@@ -1076,7 +1076,7 @@ var ButtonGroupComponent = /** @class */ (function () {
1076
1076
  button.setSelected(newSelectionValue);
1077
1077
  }
1078
1078
  button.setAttribute(tabindex, '0');
1079
- });
1079
+ }));
1080
1080
  };
1081
1081
  ButtonGroupComponent.prototype.ngOnChanges = function (change) {
1082
1082
  var _this = this;
@@ -1105,8 +1105,7 @@ var ButtonGroupComponent = /** @class */ (function () {
1105
1105
  }
1106
1106
  };
1107
1107
  ButtonGroupComponent.prototype.ngOnDestroy = function () {
1108
- this.subscription.unsubscribe();
1109
- this.localizationChangeSubscription.unsubscribe();
1108
+ this.subs.unsubscribe();
1110
1109
  };
1111
1110
  ButtonGroupComponent.prototype.ngAfterContentChecked = function () {
1112
1111
  this.verifySettings();
@@ -1517,6 +1516,7 @@ var FocusableDirective = /** @class */ (function () {
1517
1516
  function FocusableDirective(focusService, elementRef, renderer) {
1518
1517
  this.focusService = focusService;
1519
1518
  this.renderer = renderer;
1519
+ this.subs = new Subscription();
1520
1520
  this.element = elementRef.nativeElement;
1521
1521
  this.subscribeEvents();
1522
1522
  }
@@ -1532,14 +1532,14 @@ var FocusableDirective = /** @class */ (function () {
1532
1532
  * @hidden
1533
1533
  */
1534
1534
  FocusableDirective.prototype.ngOnDestroy = function () {
1535
- this.unsubscribeEvents();
1535
+ this.subs.unsubscribe();
1536
1536
  };
1537
1537
  FocusableDirective.prototype.subscribeEvents = function () {
1538
1538
  var _this = this;
1539
1539
  if (!isDocumentAvailable()) {
1540
1540
  return;
1541
1541
  }
1542
- this.focusSubscription = this.focusService.onFocus.subscribe(function (index) {
1542
+ this.subs.add(this.focusService.onFocus.subscribe(function (index) {
1543
1543
  if (_this.index === index) {
1544
1544
  _this.renderer.addClass(_this.element, 'k-focus');
1545
1545
  _this.element.focus();
@@ -1547,15 +1547,7 @@ var FocusableDirective = /** @class */ (function () {
1547
1547
  else {
1548
1548
  _this.renderer.removeClass(_this.element, 'k-focus');
1549
1549
  }
1550
- });
1551
- };
1552
- FocusableDirective.prototype.unsubscribeEvents = function () {
1553
- if (!isDocumentAvailable()) {
1554
- return;
1555
- }
1556
- if (this.focusSubscription) {
1557
- this.focusSubscription.unsubscribe();
1558
- }
1550
+ }));
1559
1551
  };
1560
1552
  __decorate([
1561
1553
  Input(),
@@ -1670,14 +1662,15 @@ var ListButton = /** @class */ (function () {
1670
1662
  this._popupSettings = { animate: true, popupClass: '' };
1671
1663
  this.listId = guid();
1672
1664
  this._isFocused = false;
1665
+ this.subs = new Subscription();
1673
1666
  validatePackage(packageMetadata);
1674
1667
  this.focusService = focusService;
1675
1668
  this.navigationService = navigationService;
1676
1669
  this.wrapper = wrapperRef.nativeElement;
1677
- this.localizationChangeSubscription = localization.changes.subscribe(function (_a) {
1670
+ this.subs.add(localization.changes.subscribe(function (_a) {
1678
1671
  var rtl = _a.rtl;
1679
1672
  return (_this.direction = rtl ? 'rtl' : 'ltr');
1680
- });
1673
+ }));
1681
1674
  this.subscribeEvents();
1682
1675
  }
1683
1676
  Object.defineProperty(ListButton.prototype, "popupClasses", {
@@ -1723,12 +1716,9 @@ var ListButton = /** @class */ (function () {
1723
1716
  };
1724
1717
  ListButton.prototype.ngOnDestroy = function () {
1725
1718
  this.openState = false;
1726
- this.unsubscribeEvents();
1727
1719
  clearTimeout(this.focusFirstTimeout);
1728
1720
  clearTimeout(this.blurTimeout);
1729
- if (this.localizationChangeSubscription) {
1730
- this.localizationChangeSubscription.unsubscribe();
1731
- }
1721
+ this.subs.unsubscribe();
1732
1722
  };
1733
1723
  ListButton.prototype.subscribeEvents = function () {
1734
1724
  if (!isDocumentAvailable()) {
@@ -1740,27 +1730,27 @@ var ListButton = /** @class */ (function () {
1740
1730
  };
1741
1731
  ListButton.prototype.subscribeListItemFocusEvent = function () {
1742
1732
  var _this = this;
1743
- this.focusSubscription = this.focusService.onFocus.subscribe(function () {
1733
+ this.subs.add(this.focusService.onFocus.subscribe(function () {
1744
1734
  _this._isFocused = true;
1745
- });
1735
+ }));
1746
1736
  };
1747
1737
  ListButton.prototype.subscribeComponentBlurredEvent = function () {
1748
1738
  var _this = this;
1749
1739
  this._zone.runOutsideAngular(function () {
1750
- _this.tabSubscription = _this.navigationService.tab.pipe(filter(function () { return _this._isFocused; })).subscribe(_this.handleTab.bind(_this));
1751
- _this.componentBlurredSubscription = fromEvent(document, 'click')
1740
+ _this.subs.add(_this.navigationService.tab.pipe(filter(function () { return _this._isFocused; })).subscribe(_this.handleTab.bind(_this)));
1741
+ _this.subs.add(fromEvent(document, 'click')
1752
1742
  .pipe(filter(function (event) { return !_this.wrapperContains(event.target); }), filter(function () { return _this._isFocused; }))
1753
- .subscribe(function () { return _this._zone.run(function () { return _this.blurWrapper(); }); });
1743
+ .subscribe(function () { return _this._zone.run(function () { return _this.blurWrapper(); }); }));
1754
1744
  });
1755
1745
  };
1756
1746
  ListButton.prototype.subscribeNavigationEvents = function () {
1757
1747
  var _this = this;
1758
- this.navigationSubscription = this.navigationService.navigate.subscribe(this.focusService.focus.bind(this.focusService));
1759
- this.enterUpSubscription = this.navigationService.enterup.subscribe(function () {
1748
+ this.subs.add(this.navigationService.navigate.subscribe(this.focusService.focus.bind(this.focusService)));
1749
+ this.subs.add(this.navigationService.enterup.subscribe(function () {
1760
1750
  _this.enterHandler();
1761
1751
  _this.focusWrapper();
1762
- });
1763
- this.openSubscription = this.navigationService.open.subscribe(function () {
1752
+ }));
1753
+ this.subs.add(this.navigationService.open.subscribe(function () {
1764
1754
  if (!_this._open) {
1765
1755
  _this.togglePopupVisibility();
1766
1756
  _this.focusFirstItem();
@@ -1768,28 +1758,10 @@ var ListButton = /** @class */ (function () {
1768
1758
  else {
1769
1759
  _this.focusWrapper();
1770
1760
  }
1771
- });
1772
- this.closeSubscription = merge(this.navigationService.close, this.navigationService.esc).subscribe(function () { return _this.focusWrapper(); });
1761
+ }));
1762
+ this.subs.add(merge(this.navigationService.close, this.navigationService.esc).subscribe(function () { return _this.focusWrapper(); }));
1773
1763
  };
1774
1764
  ListButton.prototype.enterHandler = function () { }; // tslint:disable-line
1775
- ListButton.prototype.unsubscribeEvents = function () {
1776
- if (!isDocumentAvailable()) {
1777
- return;
1778
- }
1779
- this.unsubscribe(this.componentBlurredSubscription);
1780
- this.unsubscribe(this.focusSubscription);
1781
- this.unsubscribe(this.navigationSubscription);
1782
- this.unsubscribe(this.enterPressSubscription);
1783
- this.unsubscribe(this.enterUpSubscription);
1784
- this.unsubscribe(this.openSubscription);
1785
- this.unsubscribe(this.closeSubscription);
1786
- this.unsubscribe(this.tabSubscription);
1787
- };
1788
- ListButton.prototype.unsubscribe = function (subscription) {
1789
- if (subscription) {
1790
- subscription.unsubscribe();
1791
- }
1792
- };
1793
1765
  /**
1794
1766
  * @hidden
1795
1767
  */
@@ -2187,6 +2159,7 @@ var SplitButtonComponent = /** @class */ (function (_super) {
2187
2159
  _this.lockFocus = false;
2188
2160
  _this._rounded = 'medium';
2189
2161
  _this._fillMode = "solid";
2162
+ _this.popupSubs = new Subscription();
2190
2163
  _this._itemClick = _this.itemClick;
2191
2164
  _this._blur = _this.onBlur;
2192
2165
  return _this;
@@ -2602,11 +2575,12 @@ var SplitButtonComponent = /** @class */ (function (_super) {
2602
2575
  popupAlign: this.popupAlign,
2603
2576
  popupClass: this.popupClasses
2604
2577
  });
2605
- this.popupRef.popupAnchorViewportLeave.subscribe(function () { return (_this.openState = false); });
2606
- this.popupRef.popupOpen.subscribe(this.focusFirstItem.bind(this));
2578
+ this.popupSubs.add(this.popupRef.popupAnchorViewportLeave.subscribe(function () { return (_this.openState = false); }));
2579
+ this.popupSubs.add(this.popupRef.popupOpen.subscribe(this.focusFirstItem.bind(this)));
2607
2580
  };
2608
2581
  SplitButtonComponent.prototype.destroyPopup = function () {
2609
2582
  if (this.popupRef) {
2583
+ this.popupSubs.unsubscribe();
2610
2584
  this.popupRef.close();
2611
2585
  this.popupRef = null;
2612
2586
  }
@@ -3035,6 +3009,7 @@ var DropDownButtonComponent = /** @class */ (function (_super) {
3035
3009
  _this.onBlur = new EventEmitter(); //tslint:disable-line:no-output-rename
3036
3010
  _this.listId = guid();
3037
3011
  _this._fillMode = 'solid';
3012
+ _this.popupSubs = new Subscription();
3038
3013
  _this._itemClick = _this.itemClick;
3039
3014
  _this._blur = _this.onBlur;
3040
3015
  return _this;
@@ -3344,11 +3319,11 @@ var DropDownButtonComponent = /** @class */ (function (_super) {
3344
3319
  || (this.popupRef && this.popupRef.popupElement.contains(element));
3345
3320
  };
3346
3321
  DropDownButtonComponent.prototype.subscribeNavigationEvents = function () {
3347
- this.navigationSubscription = this.navigationService.navigate
3348
- .subscribe(this.onArrowKeyNavigate.bind(this));
3349
- this.enterUpSubscription = this.navigationService.enterup.subscribe(this.onNavigationEnterUp.bind(this));
3350
- this.openSubscription = this.navigationService.open.subscribe(this.onNavigationOpen.bind(this));
3351
- this.closeSubscription = merge(this.navigationService.close, this.navigationService.esc).subscribe(this.onNavigationClose.bind(this));
3322
+ this.subs.add(this.navigationService.navigate
3323
+ .subscribe(this.onArrowKeyNavigate.bind(this)));
3324
+ this.subs.add(this.navigationService.enterup.subscribe(this.onNavigationEnterUp.bind(this)));
3325
+ this.subs.add(this.navigationService.open.subscribe(this.onNavigationOpen.bind(this)));
3326
+ this.subs.add(merge(this.navigationService.close, this.navigationService.esc).subscribe(this.onNavigationClose.bind(this)));
3352
3327
  };
3353
3328
  DropDownButtonComponent.prototype.onNavigationEnterUp = function () {
3354
3329
  if (!this._disabled && !this.openState) {
@@ -3402,13 +3377,14 @@ var DropDownButtonComponent = /** @class */ (function (_super) {
3402
3377
  popupAlign: this.popupAlign,
3403
3378
  popupClass: this.popupClasses
3404
3379
  });
3405
- this.popupRef.popupAnchorViewportLeave.subscribe(function () { return _this.openState = false; });
3406
- this.popupRef.popupOpen.subscribe(this.focusFirstItem.bind(this));
3380
+ this.popupSubs.add(this.popupRef.popupAnchorViewportLeave.subscribe(function () { return _this.openState = false; }));
3381
+ this.popupSubs.add(this.popupRef.popupOpen.subscribe(this.focusFirstItem.bind(this)));
3407
3382
  };
3408
3383
  DropDownButtonComponent.prototype.destroyPopup = function () {
3409
3384
  if (this.popupRef) {
3410
3385
  this.popupRef.close();
3411
3386
  this.popupRef = null;
3387
+ this.popupSubs.unsubscribe();
3412
3388
  }
3413
3389
  };
3414
3390
  __decorate([
@@ -3645,6 +3621,7 @@ var ChipComponent = /** @class */ (function () {
3645
3621
  this._fillMode = 'solid';
3646
3622
  this._themeColor = 'base';
3647
3623
  this.focused = false;
3624
+ this.subs = new Subscription();
3648
3625
  validatePackage(packageMetadata);
3649
3626
  this.direction = localizationService.rtl ? 'rtl' : 'ltr';
3650
3627
  }
@@ -3772,19 +3749,14 @@ var ChipComponent = /** @class */ (function () {
3772
3749
  });
3773
3750
  ChipComponent.prototype.ngOnInit = function () {
3774
3751
  var _this = this;
3775
- this.dynamicRTLSubscription = this.localizationService.changes
3752
+ this.subs.add(this.localizationService.changes
3776
3753
  .subscribe(function (_a) {
3777
3754
  var rtl = _a.rtl;
3778
3755
  return _this.direction = rtl ? 'rtl' : 'ltr';
3779
- });
3756
+ }));
3780
3757
  };
3781
3758
  ChipComponent.prototype.ngOnDestroy = function () {
3782
- if (this.dynamicRTLSubscription) {
3783
- this.dynamicRTLSubscription.unsubscribe();
3784
- }
3785
- if (this.detachDomEvents) {
3786
- this.detachDomEvents();
3787
- }
3759
+ this.subs.unsubscribe();
3788
3760
  };
3789
3761
  ChipComponent.prototype.ngAfterViewInit = function () {
3790
3762
  var _this = this;
@@ -3868,25 +3840,20 @@ var ChipComponent = /** @class */ (function () {
3868
3840
  ChipComponent.prototype.attachElementEventHandlers = function (chip) {
3869
3841
  var _this = this;
3870
3842
  this.ngZone.runOutsideAngular(function () {
3871
- var focusListener = _this.renderer.listen(chip, 'focus', function () {
3843
+ _this.subs.add(_this.renderer.listen(chip, 'focus', function () {
3872
3844
  _this.renderer.addClass(chip, 'k-focus');
3873
- });
3874
- var blurListener = _this.renderer.listen(chip, 'blur', function () {
3845
+ }));
3846
+ _this.subs.add(_this.renderer.listen(chip, 'blur', function () {
3875
3847
  _this.renderer.removeClass(chip, 'k-focus');
3876
- });
3877
- var contentClickListener = _this.renderer.listen(chip, 'click', function (e) {
3848
+ }));
3849
+ _this.subs.add(_this.renderer.listen(chip, 'click', function (e) {
3878
3850
  var isRemoveClicked = closest(e.target, '.k-chip-remove-action');
3879
3851
  if (!isRemoveClicked) {
3880
3852
  _this.ngZone.run(function () {
3881
3853
  _this.contentClick.emit({ sender: _this, originalEvent: e });
3882
3854
  });
3883
3855
  }
3884
- });
3885
- _this.detachDomEvents = function () {
3886
- focusListener();
3887
- blurListener();
3888
- contentClickListener();
3889
- };
3856
+ }));
3890
3857
  });
3891
3858
  };
3892
3859
  /**
@@ -9,6 +9,7 @@ var core_1 = require("@angular/core");
9
9
  var button_service_1 = require("./button.service");
10
10
  var kendo_angular_common_1 = require("@progress/kendo-angular-common");
11
11
  var kendo_angular_l10n_1 = require("@progress/kendo-angular-l10n");
12
+ var rxjs_1 = require("rxjs");
12
13
  var kendo_licensing_1 = require("@progress/kendo-licensing");
13
14
  var package_metadata_1 = require("../package-metadata");
14
15
  var util_1 = require("../util");
@@ -49,13 +50,13 @@ var ButtonDirective = /** @class */ (function () {
49
50
  this._fillMode = 'solid';
50
51
  this._themeColor = 'base';
51
52
  this._focused = false;
52
- this.domEvents = [];
53
+ this.subs = new rxjs_1.Subscription();
53
54
  kendo_licensing_1.validatePackage(package_metadata_1.packageMetadata);
54
55
  this.direction = localization.rtl ? 'rtl' : 'ltr';
55
- this.localizationChangeSubscription = localization.changes.subscribe(function (_a) {
56
+ this.subs.add(localization.changes.subscribe(function (_a) {
56
57
  var rtl = _a.rtl;
57
58
  return (_this.direction = rtl ? 'rtl' : 'ltr');
58
- });
59
+ }));
59
60
  this.element = element.nativeElement;
60
61
  this.renderer = renderer;
61
62
  }
@@ -398,8 +399,8 @@ var ButtonDirective = /** @class */ (function () {
398
399
  this.setAttribute('role', this.role);
399
400
  }
400
401
  this.ngZone.runOutsideAngular(function () {
401
- _this.domEvents.push(_this.renderer.listen(_this.element, 'click', _this._onButtonClick.bind(_this)));
402
- _this.domEvents.push(_this.renderer.listen(_this.element, 'keydown', function (event) {
402
+ _this.subs.add(_this.renderer.listen(_this.element, 'click', _this._onButtonClick.bind(_this)));
403
+ _this.subs.add(_this.renderer.listen(_this.element, 'keydown', function (event) {
403
404
  var isSpaceOrEnter = event.keyCode === kendo_angular_common_1.Keys.Space || event.keyCode === kendo_angular_common_1.Keys.Enter;
404
405
  if (isSpan && isSpaceOrEnter) {
405
406
  _this.click.emit(event);
@@ -428,9 +429,8 @@ var ButtonDirective = /** @class */ (function () {
428
429
  this.iconNode = null;
429
430
  this.iconSpanNode = null;
430
431
  this.renderer = null;
431
- this.localizationChangeSubscription.unsubscribe();
432
+ this.subs.unsubscribe();
432
433
  clearTimeout(this.deferTimeout);
433
- this.domEvents.forEach(function (unbindHandler) { return unbindHandler(); });
434
434
  };
435
435
  /**
436
436
  * Focuses the Button component.
@@ -10,6 +10,7 @@ var core_1 = require("@angular/core");
10
10
  var kendo_angular_l10n_1 = require("@progress/kendo-angular-l10n");
11
11
  var kendo_angular_common_1 = require("@progress/kendo-angular-common");
12
12
  var button_service_1 = require("../button/button.service");
13
+ var rxjs_1 = require("rxjs");
13
14
  var util_1 = require("../util");
14
15
  var preventable_event_1 = require("../preventable-event");
15
16
  var package_metadata_1 = require("../package-metadata");
@@ -36,11 +37,12 @@ var ButtonGroupComponent = /** @class */ (function () {
36
37
  this.navigate = new core_1.EventEmitter();
37
38
  this._tabIndex = 0;
38
39
  this.currentTabIndex = 0;
40
+ this.subs = new rxjs_1.Subscription();
39
41
  kendo_licensing_1.validatePackage(package_metadata_1.packageMetadata);
40
- this.localizationChangeSubscription = localization.changes.subscribe(function (_a) {
42
+ this.subs.add(localization.changes.subscribe(function (_a) {
41
43
  var rtl = _a.rtl;
42
44
  return _this.direction = rtl ? 'rtl' : 'ltr';
43
- });
45
+ }));
44
46
  }
45
47
  Object.defineProperty(ButtonGroupComponent.prototype, "tabIndex", {
46
48
  get: function () {
@@ -142,7 +144,7 @@ var ButtonGroupComponent = /** @class */ (function () {
142
144
  };
143
145
  ButtonGroupComponent.prototype.ngOnInit = function () {
144
146
  var _this = this;
145
- this.subscription = this.service.buttonClicked$.subscribe(function (button) {
147
+ this.subs.add(this.service.buttonClicked$.subscribe(function (button) {
146
148
  var newSelectionValue;
147
149
  if (_this.isSelectionSingle()) {
148
150
  newSelectionValue = true;
@@ -156,7 +158,7 @@ var ButtonGroupComponent = /** @class */ (function () {
156
158
  button.setSelected(newSelectionValue);
157
159
  }
158
160
  button.setAttribute(tabindex, '0');
159
- });
161
+ }));
160
162
  };
161
163
  ButtonGroupComponent.prototype.ngOnChanges = function (change) {
162
164
  var _this = this;
@@ -185,8 +187,7 @@ var ButtonGroupComponent = /** @class */ (function () {
185
187
  }
186
188
  };
187
189
  ButtonGroupComponent.prototype.ngOnDestroy = function () {
188
- this.subscription.unsubscribe();
189
- this.localizationChangeSubscription.unsubscribe();
190
+ this.subs.unsubscribe();
190
191
  };
191
192
  ButtonGroupComponent.prototype.ngAfterContentChecked = function () {
192
193
  this.verifySettings();
@@ -6,6 +6,7 @@
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  var tslib_1 = require("tslib");
8
8
  var core_1 = require("@angular/core");
9
+ var rxjs_1 = require("rxjs");
9
10
  var kendo_angular_common_1 = require("@progress/kendo-angular-common");
10
11
  var kendo_angular_l10n_1 = require("@progress/kendo-angular-l10n");
11
12
  var kendo_licensing_1 = require("@progress/kendo-licensing");
@@ -51,6 +52,7 @@ var ChipComponent = /** @class */ (function () {
51
52
  this._fillMode = 'solid';
52
53
  this._themeColor = 'base';
53
54
  this.focused = false;
55
+ this.subs = new rxjs_1.Subscription();
54
56
  kendo_licensing_1.validatePackage(package_metadata_1.packageMetadata);
55
57
  this.direction = localizationService.rtl ? 'rtl' : 'ltr';
56
58
  }
@@ -178,19 +180,14 @@ var ChipComponent = /** @class */ (function () {
178
180
  });
179
181
  ChipComponent.prototype.ngOnInit = function () {
180
182
  var _this = this;
181
- this.dynamicRTLSubscription = this.localizationService.changes
183
+ this.subs.add(this.localizationService.changes
182
184
  .subscribe(function (_a) {
183
185
  var rtl = _a.rtl;
184
186
  return _this.direction = rtl ? 'rtl' : 'ltr';
185
- });
187
+ }));
186
188
  };
187
189
  ChipComponent.prototype.ngOnDestroy = function () {
188
- if (this.dynamicRTLSubscription) {
189
- this.dynamicRTLSubscription.unsubscribe();
190
- }
191
- if (this.detachDomEvents) {
192
- this.detachDomEvents();
193
- }
190
+ this.subs.unsubscribe();
194
191
  };
195
192
  ChipComponent.prototype.ngAfterViewInit = function () {
196
193
  var _this = this;
@@ -274,25 +271,20 @@ var ChipComponent = /** @class */ (function () {
274
271
  ChipComponent.prototype.attachElementEventHandlers = function (chip) {
275
272
  var _this = this;
276
273
  this.ngZone.runOutsideAngular(function () {
277
- var focusListener = _this.renderer.listen(chip, 'focus', function () {
274
+ _this.subs.add(_this.renderer.listen(chip, 'focus', function () {
278
275
  _this.renderer.addClass(chip, 'k-focus');
279
- });
280
- var blurListener = _this.renderer.listen(chip, 'blur', function () {
276
+ }));
277
+ _this.subs.add(_this.renderer.listen(chip, 'blur', function () {
281
278
  _this.renderer.removeClass(chip, 'k-focus');
282
- });
283
- var contentClickListener = _this.renderer.listen(chip, 'click', function (e) {
279
+ }));
280
+ _this.subs.add(_this.renderer.listen(chip, 'click', function (e) {
284
281
  var isRemoveClicked = util_1.closest(e.target, '.k-chip-remove-action');
285
282
  if (!isRemoveClicked) {
286
283
  _this.ngZone.run(function () {
287
284
  _this.contentClick.emit({ sender: _this, originalEvent: e });
288
285
  });
289
286
  }
290
- });
291
- _this.detachDomEvents = function () {
292
- focusListener();
293
- blurListener();
294
- contentClickListener();
295
- };
287
+ }));
296
288
  });
297
289
  };
298
290
  /**
@@ -155,6 +155,7 @@ var DropDownButtonComponent = /** @class */ (function (_super) {
155
155
  _this.onBlur = new core_1.EventEmitter(); //tslint:disable-line:no-output-rename
156
156
  _this.listId = kendo_angular_common_1.guid();
157
157
  _this._fillMode = 'solid';
158
+ _this.popupSubs = new rxjs_1.Subscription();
158
159
  _this._itemClick = _this.itemClick;
159
160
  _this._blur = _this.onBlur;
160
161
  return _this;
@@ -464,11 +465,11 @@ var DropDownButtonComponent = /** @class */ (function (_super) {
464
465
  || (this.popupRef && this.popupRef.popupElement.contains(element));
465
466
  };
466
467
  DropDownButtonComponent.prototype.subscribeNavigationEvents = function () {
467
- this.navigationSubscription = this.navigationService.navigate
468
- .subscribe(this.onArrowKeyNavigate.bind(this));
469
- this.enterUpSubscription = this.navigationService.enterup.subscribe(this.onNavigationEnterUp.bind(this));
470
- this.openSubscription = this.navigationService.open.subscribe(this.onNavigationOpen.bind(this));
471
- this.closeSubscription = rxjs_1.merge(this.navigationService.close, this.navigationService.esc).subscribe(this.onNavigationClose.bind(this));
468
+ this.subs.add(this.navigationService.navigate
469
+ .subscribe(this.onArrowKeyNavigate.bind(this)));
470
+ this.subs.add(this.navigationService.enterup.subscribe(this.onNavigationEnterUp.bind(this)));
471
+ this.subs.add(this.navigationService.open.subscribe(this.onNavigationOpen.bind(this)));
472
+ this.subs.add(rxjs_1.merge(this.navigationService.close, this.navigationService.esc).subscribe(this.onNavigationClose.bind(this)));
472
473
  };
473
474
  DropDownButtonComponent.prototype.onNavigationEnterUp = function () {
474
475
  if (!this._disabled && !this.openState) {
@@ -522,13 +523,14 @@ var DropDownButtonComponent = /** @class */ (function (_super) {
522
523
  popupAlign: this.popupAlign,
523
524
  popupClass: this.popupClasses
524
525
  });
525
- this.popupRef.popupAnchorViewportLeave.subscribe(function () { return _this.openState = false; });
526
- this.popupRef.popupOpen.subscribe(this.focusFirstItem.bind(this));
526
+ this.popupSubs.add(this.popupRef.popupAnchorViewportLeave.subscribe(function () { return _this.openState = false; }));
527
+ this.popupSubs.add(this.popupRef.popupOpen.subscribe(this.focusFirstItem.bind(this)));
527
528
  };
528
529
  DropDownButtonComponent.prototype.destroyPopup = function () {
529
530
  if (this.popupRef) {
530
531
  this.popupRef.close();
531
532
  this.popupRef = null;
533
+ this.popupSubs.unsubscribe();
532
534
  }
533
535
  };
534
536
  tslib_1.__decorate([
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  var tslib_1 = require("tslib");
8
8
  var core_1 = require("@angular/core");
9
9
  var focus_service_1 = require("./focus.service");
10
+ var rxjs_1 = require("rxjs");
10
11
  var kendo_angular_common_1 = require("@progress/kendo-angular-common");
11
12
  /**
12
13
  * @hidden
@@ -15,6 +16,7 @@ var FocusableDirective = /** @class */ (function () {
15
16
  function FocusableDirective(focusService, elementRef, renderer) {
16
17
  this.focusService = focusService;
17
18
  this.renderer = renderer;
19
+ this.subs = new rxjs_1.Subscription();
18
20
  this.element = elementRef.nativeElement;
19
21
  this.subscribeEvents();
20
22
  }
@@ -30,14 +32,14 @@ var FocusableDirective = /** @class */ (function () {
30
32
  * @hidden
31
33
  */
32
34
  FocusableDirective.prototype.ngOnDestroy = function () {
33
- this.unsubscribeEvents();
35
+ this.subs.unsubscribe();
34
36
  };
35
37
  FocusableDirective.prototype.subscribeEvents = function () {
36
38
  var _this = this;
37
39
  if (!kendo_angular_common_1.isDocumentAvailable()) {
38
40
  return;
39
41
  }
40
- this.focusSubscription = this.focusService.onFocus.subscribe(function (index) {
42
+ this.subs.add(this.focusService.onFocus.subscribe(function (index) {
41
43
  if (_this.index === index) {
42
44
  _this.renderer.addClass(_this.element, 'k-focus');
43
45
  _this.element.focus();
@@ -45,15 +47,7 @@ var FocusableDirective = /** @class */ (function () {
45
47
  else {
46
48
  _this.renderer.removeClass(_this.element, 'k-focus');
47
49
  }
48
- });
49
- };
50
- FocusableDirective.prototype.unsubscribeEvents = function () {
51
- if (!kendo_angular_common_1.isDocumentAvailable()) {
52
- return;
53
- }
54
- if (this.focusSubscription) {
55
- this.focusSubscription.unsubscribe();
56
- }
50
+ }));
57
51
  };
58
52
  tslib_1.__decorate([
59
53
  core_1.Input(),