@progress/kendo-angular-buttons 7.0.5 → 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 +8 -8
  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 +7 -7
  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 +55 -88
  28. package/dist/fesm5/index.js +58 -91
  29. package/dist/npm/button/button.directive.js +8 -8
  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
@@ -30,18 +30,10 @@ export declare class ListButton implements OnDestroy {
30
30
  protected _blur: EventEmitter<any>;
31
31
  protected wrapper: HTMLElement;
32
32
  protected button: ElementRef;
33
- protected focusSubscription: Subscription;
34
- protected navigationSubscription: Subscription;
35
- protected enterPressSubscription: Subscription;
36
- protected enterUpSubscription: Subscription;
37
- protected openSubscription: Subscription;
38
- protected closeSubscription: Subscription;
39
- protected componentBlurredSubscription: Subscription;
40
- protected tabSubscription: Subscription;
33
+ protected subs: Subscription;
41
34
  protected direction: Direction;
42
35
  protected focusFirstTimeout: any;
43
36
  protected blurTimeout: any;
44
- private localizationChangeSubscription;
45
37
  constructor(focusService: FocusService, navigationService: NavigationService, wrapperRef: ElementRef, _zone: NgZone, localization: LocalizationService, cdr: ChangeDetectorRef);
46
38
  readonly popupClasses: string;
47
39
  openState: boolean;
@@ -59,8 +51,6 @@ export declare class ListButton implements OnDestroy {
59
51
  protected subscribeComponentBlurredEvent(): void;
60
52
  protected subscribeNavigationEvents(): void;
61
53
  protected enterHandler(): void;
62
- protected unsubscribeEvents(): void;
63
- protected unsubscribe(subscription: Subscription): void;
64
54
  /**
65
55
  * @hidden
66
56
  */
@@ -3,7 +3,7 @@
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  /* tslint:disable:deprecation */
6
- import { fromEvent, merge } from 'rxjs';
6
+ import { Subscription, fromEvent, merge } from 'rxjs';
7
7
  import { filter } from 'rxjs/operators';
8
8
  import { KeyEvents } from './../navigation/key-events';
9
9
  import { NavigationAction } from './../navigation/navigation-action';
@@ -27,11 +27,12 @@ export class ListButton {
27
27
  this._popupSettings = { animate: true, popupClass: '' };
28
28
  this.listId = guid();
29
29
  this._isFocused = false;
30
+ this.subs = new Subscription();
30
31
  validatePackage(packageMetadata);
31
32
  this.focusService = focusService;
32
33
  this.navigationService = navigationService;
33
34
  this.wrapper = wrapperRef.nativeElement;
34
- this.localizationChangeSubscription = localization.changes.subscribe(({ rtl }) => (this.direction = rtl ? 'rtl' : 'ltr'));
35
+ this.subs.add(localization.changes.subscribe(({ rtl }) => (this.direction = rtl ? 'rtl' : 'ltr')));
35
36
  this.subscribeEvents();
36
37
  }
37
38
  get popupClasses() {
@@ -68,12 +69,9 @@ export class ListButton {
68
69
  }
69
70
  ngOnDestroy() {
70
71
  this.openState = false;
71
- this.unsubscribeEvents();
72
72
  clearTimeout(this.focusFirstTimeout);
73
73
  clearTimeout(this.blurTimeout);
74
- if (this.localizationChangeSubscription) {
75
- this.localizationChangeSubscription.unsubscribe();
76
- }
74
+ this.subs.unsubscribe();
77
75
  }
78
76
  subscribeEvents() {
79
77
  if (!isDocumentAvailable()) {
@@ -84,25 +82,25 @@ export class ListButton {
84
82
  this.subscribeNavigationEvents();
85
83
  }
86
84
  subscribeListItemFocusEvent() {
87
- this.focusSubscription = this.focusService.onFocus.subscribe(() => {
85
+ this.subs.add(this.focusService.onFocus.subscribe(() => {
88
86
  this._isFocused = true;
89
- });
87
+ }));
90
88
  }
91
89
  subscribeComponentBlurredEvent() {
92
90
  this._zone.runOutsideAngular(() => {
93
- this.tabSubscription = this.navigationService.tab.pipe(filter(() => this._isFocused)).subscribe(this.handleTab.bind(this));
94
- this.componentBlurredSubscription = fromEvent(document, 'click')
91
+ this.subs.add(this.navigationService.tab.pipe(filter(() => this._isFocused)).subscribe(this.handleTab.bind(this)));
92
+ this.subs.add(fromEvent(document, 'click')
95
93
  .pipe(filter((event) => !this.wrapperContains(event.target)), filter(() => this._isFocused))
96
- .subscribe(() => this._zone.run(() => this.blurWrapper()));
94
+ .subscribe(() => this._zone.run(() => this.blurWrapper())));
97
95
  });
98
96
  }
99
97
  subscribeNavigationEvents() {
100
- this.navigationSubscription = this.navigationService.navigate.subscribe(this.focusService.focus.bind(this.focusService));
101
- this.enterUpSubscription = this.navigationService.enterup.subscribe(() => {
98
+ this.subs.add(this.navigationService.navigate.subscribe(this.focusService.focus.bind(this.focusService)));
99
+ this.subs.add(this.navigationService.enterup.subscribe(() => {
102
100
  this.enterHandler();
103
101
  this.focusWrapper();
104
- });
105
- this.openSubscription = this.navigationService.open.subscribe(() => {
102
+ }));
103
+ this.subs.add(this.navigationService.open.subscribe(() => {
106
104
  if (!this._open) {
107
105
  this.togglePopupVisibility();
108
106
  this.focusFirstItem();
@@ -110,28 +108,10 @@ export class ListButton {
110
108
  else {
111
109
  this.focusWrapper();
112
110
  }
113
- });
114
- this.closeSubscription = merge(this.navigationService.close, this.navigationService.esc).subscribe(() => this.focusWrapper());
111
+ }));
112
+ this.subs.add(merge(this.navigationService.close, this.navigationService.esc).subscribe(() => this.focusWrapper()));
115
113
  }
116
114
  enterHandler() { } // tslint:disable-line
117
- unsubscribeEvents() {
118
- if (!isDocumentAvailable()) {
119
- return;
120
- }
121
- this.unsubscribe(this.componentBlurredSubscription);
122
- this.unsubscribe(this.focusSubscription);
123
- this.unsubscribe(this.navigationSubscription);
124
- this.unsubscribe(this.enterPressSubscription);
125
- this.unsubscribe(this.enterUpSubscription);
126
- this.unsubscribe(this.openSubscription);
127
- this.unsubscribe(this.closeSubscription);
128
- this.unsubscribe(this.tabSubscription);
129
- }
130
- unsubscribe(subscription) {
131
- if (subscription) {
132
- subscription.unsubscribe();
133
- }
134
- }
135
115
  /**
136
116
  * @hidden
137
117
  */
@@ -9,7 +9,7 @@ export const packageMetadata = {
9
9
  name: '@progress/kendo-angular-buttons',
10
10
  productName: 'Kendo UI for Angular',
11
11
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
12
- publishDate: 1648131806,
12
+ publishDate: 1649694226,
13
13
  version: '',
14
14
  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'
15
15
  };
@@ -279,6 +279,7 @@ export declare class SplitButtonComponent extends ListButton implements AfterVie
279
279
  private lockFocus;
280
280
  private _rounded;
281
281
  private _fillMode;
282
+ private popupSubs;
282
283
  isFocused: boolean;
283
284
  readonly widgetClasses: boolean;
284
285
  readonly dir: string;
@@ -17,6 +17,7 @@ import { isPresent, tick } from './../util';
17
17
  import { PreventableEvent } from '../preventable-event';
18
18
  import { Keys } from '@progress/kendo-angular-common';
19
19
  import { replaceMessagePlaceholder, getStylingClasses } from '../util';
20
+ import { Subscription } from 'rxjs';
20
21
  const NAVIGATION_SETTINGS = {
21
22
  useLeftRightArrows: true
22
23
  };
@@ -212,6 +213,7 @@ let SplitButtonComponent = class SplitButtonComponent extends ListButton {
212
213
  this.lockFocus = false;
213
214
  this._rounded = 'medium';
214
215
  this._fillMode = "solid";
216
+ this.popupSubs = new Subscription();
215
217
  this._itemClick = this.itemClick;
216
218
  this._blur = this.onBlur;
217
219
  }
@@ -559,11 +561,12 @@ let SplitButtonComponent = class SplitButtonComponent extends ListButton {
559
561
  popupAlign: this.popupAlign,
560
562
  popupClass: this.popupClasses
561
563
  });
562
- this.popupRef.popupAnchorViewportLeave.subscribe(() => (this.openState = false));
563
- this.popupRef.popupOpen.subscribe(this.focusFirstItem.bind(this));
564
+ this.popupSubs.add(this.popupRef.popupAnchorViewportLeave.subscribe(() => (this.openState = false)));
565
+ this.popupSubs.add(this.popupRef.popupOpen.subscribe(this.focusFirstItem.bind(this)));
564
566
  }
565
567
  destroyPopup() {
566
568
  if (this.popupRef) {
569
+ this.popupSubs.unsubscribe();
567
570
  this.popupRef.close();
568
571
  this.popupRef = null;
569
572
  }
@@ -4,8 +4,8 @@
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import { __decorate, __metadata, __param } from 'tslib';
6
6
  import { Injectable, EventEmitter, Input, Output, 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';
8
- import { Keys, isChanged, isDocumentAvailable, hasObservers, guid, EventsModule } from '@progress/kendo-angular-common';
7
+ import { Subject, Subscription, fromEvent, merge } from 'rxjs';
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';
11
11
  import { detectDesktopBrowser, detectMobileOS } from '@progress/kendo-common';
@@ -40,7 +40,7 @@ const packageMetadata = {
40
40
  name: '@progress/kendo-angular-buttons',
41
41
  productName: 'Kendo UI for Angular',
42
42
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
43
- publishDate: 1648131806,
43
+ publishDate: 1649694226,
44
44
  version: '',
45
45
  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'
46
46
  };
@@ -182,10 +182,10 @@ let ButtonDirective = class ButtonDirective {
182
182
  this._fillMode = 'solid';
183
183
  this._themeColor = 'base';
184
184
  this._focused = false;
185
- this.domEvents = [];
185
+ this.subs = new Subscription();
186
186
  validatePackage(packageMetadata);
187
187
  this.direction = localization.rtl ? 'rtl' : 'ltr';
188
- this.localizationChangeSubscription = localization.changes.subscribe(({ rtl }) => (this.direction = rtl ? 'rtl' : 'ltr'));
188
+ this.subs.add(localization.changes.subscribe(({ rtl }) => (this.direction = rtl ? 'rtl' : 'ltr')));
189
189
  this.element = element.nativeElement;
190
190
  this.renderer = renderer;
191
191
  }
@@ -272,7 +272,7 @@ let ButtonDirective = class ButtonDirective {
272
272
  */
273
273
  set disabled(disabled) {
274
274
  //Required, because in FF focused buttons are not blurred on disabled
275
- if (isFirefox(navigator.userAgent) && disabled) {
275
+ if (disabled && isDocumentAvailable() && isFirefox(navigator.userAgent)) {
276
276
  this.blur();
277
277
  }
278
278
  this.isDisabled = disabled;
@@ -441,8 +441,8 @@ let ButtonDirective = class ButtonDirective {
441
441
  this.setAttribute('role', this.role);
442
442
  }
443
443
  this.ngZone.runOutsideAngular(() => {
444
- this.domEvents.push(this.renderer.listen(this.element, 'click', this._onButtonClick.bind(this)));
445
- this.domEvents.push(this.renderer.listen(this.element, 'keydown', (event) => {
444
+ this.subs.add(this.renderer.listen(this.element, 'click', this._onButtonClick.bind(this)));
445
+ this.subs.add(this.renderer.listen(this.element, 'keydown', (event) => {
446
446
  const isSpaceOrEnter = event.keyCode === Keys.Space || event.keyCode === Keys.Enter;
447
447
  if (isSpan && isSpaceOrEnter) {
448
448
  this.click.emit(event);
@@ -470,9 +470,8 @@ let ButtonDirective = class ButtonDirective {
470
470
  this.iconNode = null;
471
471
  this.iconSpanNode = null;
472
472
  this.renderer = null;
473
- this.localizationChangeSubscription.unsubscribe();
473
+ this.subs.unsubscribe();
474
474
  clearTimeout(this.deferTimeout);
475
- this.domEvents.forEach(unbindHandler => unbindHandler());
476
475
  }
477
476
  /**
478
477
  * Focuses the Button component.
@@ -856,8 +855,9 @@ let ButtonGroupComponent = class ButtonGroupComponent {
856
855
  this.navigate = new EventEmitter();
857
856
  this._tabIndex = 0;
858
857
  this.currentTabIndex = 0;
858
+ this.subs = new Subscription();
859
859
  validatePackage(packageMetadata);
860
- this.localizationChangeSubscription = localization.changes.subscribe(({ rtl }) => this.direction = rtl ? 'rtl' : 'ltr');
860
+ this.subs.add(localization.changes.subscribe(({ rtl }) => this.direction = rtl ? 'rtl' : 'ltr'));
861
861
  }
862
862
  /**
863
863
  * Specifies the [`tabIndex`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the component.
@@ -922,7 +922,7 @@ let ButtonGroupComponent = class ButtonGroupComponent {
922
922
  }
923
923
  }
924
924
  ngOnInit() {
925
- this.subscription = this.service.buttonClicked$.subscribe((button) => {
925
+ this.subs.add(this.service.buttonClicked$.subscribe((button) => {
926
926
  let newSelectionValue;
927
927
  if (this.isSelectionSingle()) {
928
928
  newSelectionValue = true;
@@ -936,7 +936,7 @@ let ButtonGroupComponent = class ButtonGroupComponent {
936
936
  button.setSelected(newSelectionValue);
937
937
  }
938
938
  button.setAttribute(tabindex, '0');
939
- });
939
+ }));
940
940
  }
941
941
  ngOnChanges(change) {
942
942
  if (isChanged('disabled', change)) {
@@ -964,8 +964,7 @@ let ButtonGroupComponent = class ButtonGroupComponent {
964
964
  }
965
965
  }
966
966
  ngOnDestroy() {
967
- this.subscription.unsubscribe();
968
- this.localizationChangeSubscription.unsubscribe();
967
+ this.subs.unsubscribe();
969
968
  }
970
969
  ngAfterContentChecked() {
971
970
  this.verifySettings();
@@ -1398,6 +1397,7 @@ let FocusableDirective = class FocusableDirective {
1398
1397
  constructor(focusService, elementRef, renderer) {
1399
1398
  this.focusService = focusService;
1400
1399
  this.renderer = renderer;
1400
+ this.subs = new Subscription();
1401
1401
  this.element = elementRef.nativeElement;
1402
1402
  this.subscribeEvents();
1403
1403
  }
@@ -1413,13 +1413,13 @@ let FocusableDirective = class FocusableDirective {
1413
1413
  * @hidden
1414
1414
  */
1415
1415
  ngOnDestroy() {
1416
- this.unsubscribeEvents();
1416
+ this.subs.unsubscribe();
1417
1417
  }
1418
1418
  subscribeEvents() {
1419
1419
  if (!isDocumentAvailable()) {
1420
1420
  return;
1421
1421
  }
1422
- this.focusSubscription = this.focusService.onFocus.subscribe((index) => {
1422
+ this.subs.add(this.focusService.onFocus.subscribe((index) => {
1423
1423
  if (this.index === index) {
1424
1424
  this.renderer.addClass(this.element, 'k-focus');
1425
1425
  this.element.focus();
@@ -1427,15 +1427,7 @@ let FocusableDirective = class FocusableDirective {
1427
1427
  else {
1428
1428
  this.renderer.removeClass(this.element, 'k-focus');
1429
1429
  }
1430
- });
1431
- }
1432
- unsubscribeEvents() {
1433
- if (!isDocumentAvailable()) {
1434
- return;
1435
- }
1436
- if (this.focusSubscription) {
1437
- this.focusSubscription.unsubscribe();
1438
- }
1430
+ }));
1439
1431
  }
1440
1432
  };
1441
1433
  __decorate([
@@ -1540,11 +1532,12 @@ class ListButton {
1540
1532
  this._popupSettings = { animate: true, popupClass: '' };
1541
1533
  this.listId = guid();
1542
1534
  this._isFocused = false;
1535
+ this.subs = new Subscription();
1543
1536
  validatePackage(packageMetadata);
1544
1537
  this.focusService = focusService;
1545
1538
  this.navigationService = navigationService;
1546
1539
  this.wrapper = wrapperRef.nativeElement;
1547
- this.localizationChangeSubscription = localization.changes.subscribe(({ rtl }) => (this.direction = rtl ? 'rtl' : 'ltr'));
1540
+ this.subs.add(localization.changes.subscribe(({ rtl }) => (this.direction = rtl ? 'rtl' : 'ltr')));
1548
1541
  this.subscribeEvents();
1549
1542
  }
1550
1543
  get popupClasses() {
@@ -1581,12 +1574,9 @@ class ListButton {
1581
1574
  }
1582
1575
  ngOnDestroy() {
1583
1576
  this.openState = false;
1584
- this.unsubscribeEvents();
1585
1577
  clearTimeout(this.focusFirstTimeout);
1586
1578
  clearTimeout(this.blurTimeout);
1587
- if (this.localizationChangeSubscription) {
1588
- this.localizationChangeSubscription.unsubscribe();
1589
- }
1579
+ this.subs.unsubscribe();
1590
1580
  }
1591
1581
  subscribeEvents() {
1592
1582
  if (!isDocumentAvailable()) {
@@ -1597,25 +1587,25 @@ class ListButton {
1597
1587
  this.subscribeNavigationEvents();
1598
1588
  }
1599
1589
  subscribeListItemFocusEvent() {
1600
- this.focusSubscription = this.focusService.onFocus.subscribe(() => {
1590
+ this.subs.add(this.focusService.onFocus.subscribe(() => {
1601
1591
  this._isFocused = true;
1602
- });
1592
+ }));
1603
1593
  }
1604
1594
  subscribeComponentBlurredEvent() {
1605
1595
  this._zone.runOutsideAngular(() => {
1606
- this.tabSubscription = this.navigationService.tab.pipe(filter(() => this._isFocused)).subscribe(this.handleTab.bind(this));
1607
- this.componentBlurredSubscription = fromEvent(document, 'click')
1596
+ this.subs.add(this.navigationService.tab.pipe(filter(() => this._isFocused)).subscribe(this.handleTab.bind(this)));
1597
+ this.subs.add(fromEvent(document, 'click')
1608
1598
  .pipe(filter((event) => !this.wrapperContains(event.target)), filter(() => this._isFocused))
1609
- .subscribe(() => this._zone.run(() => this.blurWrapper()));
1599
+ .subscribe(() => this._zone.run(() => this.blurWrapper())));
1610
1600
  });
1611
1601
  }
1612
1602
  subscribeNavigationEvents() {
1613
- this.navigationSubscription = this.navigationService.navigate.subscribe(this.focusService.focus.bind(this.focusService));
1614
- this.enterUpSubscription = this.navigationService.enterup.subscribe(() => {
1603
+ this.subs.add(this.navigationService.navigate.subscribe(this.focusService.focus.bind(this.focusService)));
1604
+ this.subs.add(this.navigationService.enterup.subscribe(() => {
1615
1605
  this.enterHandler();
1616
1606
  this.focusWrapper();
1617
- });
1618
- this.openSubscription = this.navigationService.open.subscribe(() => {
1607
+ }));
1608
+ this.subs.add(this.navigationService.open.subscribe(() => {
1619
1609
  if (!this._open) {
1620
1610
  this.togglePopupVisibility();
1621
1611
  this.focusFirstItem();
@@ -1623,28 +1613,10 @@ class ListButton {
1623
1613
  else {
1624
1614
  this.focusWrapper();
1625
1615
  }
1626
- });
1627
- this.closeSubscription = merge(this.navigationService.close, this.navigationService.esc).subscribe(() => this.focusWrapper());
1616
+ }));
1617
+ this.subs.add(merge(this.navigationService.close, this.navigationService.esc).subscribe(() => this.focusWrapper()));
1628
1618
  }
1629
1619
  enterHandler() { } // tslint:disable-line
1630
- unsubscribeEvents() {
1631
- if (!isDocumentAvailable()) {
1632
- return;
1633
- }
1634
- this.unsubscribe(this.componentBlurredSubscription);
1635
- this.unsubscribe(this.focusSubscription);
1636
- this.unsubscribe(this.navigationSubscription);
1637
- this.unsubscribe(this.enterPressSubscription);
1638
- this.unsubscribe(this.enterUpSubscription);
1639
- this.unsubscribe(this.openSubscription);
1640
- this.unsubscribe(this.closeSubscription);
1641
- this.unsubscribe(this.tabSubscription);
1642
- }
1643
- unsubscribe(subscription) {
1644
- if (subscription) {
1645
- subscription.unsubscribe();
1646
- }
1647
- }
1648
1620
  /**
1649
1621
  * @hidden
1650
1622
  */
@@ -2037,6 +2009,7 @@ let SplitButtonComponent = class SplitButtonComponent extends ListButton {
2037
2009
  this.lockFocus = false;
2038
2010
  this._rounded = 'medium';
2039
2011
  this._fillMode = "solid";
2012
+ this.popupSubs = new Subscription();
2040
2013
  this._itemClick = this.itemClick;
2041
2014
  this._blur = this.onBlur;
2042
2015
  }
@@ -2384,11 +2357,12 @@ let SplitButtonComponent = class SplitButtonComponent extends ListButton {
2384
2357
  popupAlign: this.popupAlign,
2385
2358
  popupClass: this.popupClasses
2386
2359
  });
2387
- this.popupRef.popupAnchorViewportLeave.subscribe(() => (this.openState = false));
2388
- this.popupRef.popupOpen.subscribe(this.focusFirstItem.bind(this));
2360
+ this.popupSubs.add(this.popupRef.popupAnchorViewportLeave.subscribe(() => (this.openState = false)));
2361
+ this.popupSubs.add(this.popupRef.popupOpen.subscribe(this.focusFirstItem.bind(this)));
2389
2362
  }
2390
2363
  destroyPopup() {
2391
2364
  if (this.popupRef) {
2365
+ this.popupSubs.unsubscribe();
2392
2366
  this.popupRef.close();
2393
2367
  this.popupRef = null;
2394
2368
  }
@@ -2864,6 +2838,7 @@ let DropDownButtonComponent = class DropDownButtonComponent extends ListButton {
2864
2838
  this.onBlur = new EventEmitter(); //tslint:disable-line:no-output-rename
2865
2839
  this.listId = guid();
2866
2840
  this._fillMode = 'solid';
2841
+ this.popupSubs = new Subscription();
2867
2842
  this._itemClick = this.itemClick;
2868
2843
  this._blur = this.onBlur;
2869
2844
  }
@@ -3115,11 +3090,11 @@ let DropDownButtonComponent = class DropDownButtonComponent extends ListButton {
3115
3090
  || (this.popupRef && this.popupRef.popupElement.contains(element));
3116
3091
  }
3117
3092
  subscribeNavigationEvents() {
3118
- this.navigationSubscription = this.navigationService.navigate
3119
- .subscribe(this.onArrowKeyNavigate.bind(this));
3120
- this.enterUpSubscription = this.navigationService.enterup.subscribe(this.onNavigationEnterUp.bind(this));
3121
- this.openSubscription = this.navigationService.open.subscribe(this.onNavigationOpen.bind(this));
3122
- this.closeSubscription = merge(this.navigationService.close, this.navigationService.esc).subscribe(this.onNavigationClose.bind(this));
3093
+ this.subs.add(this.navigationService.navigate
3094
+ .subscribe(this.onArrowKeyNavigate.bind(this)));
3095
+ this.subs.add(this.navigationService.enterup.subscribe(this.onNavigationEnterUp.bind(this)));
3096
+ this.subs.add(this.navigationService.open.subscribe(this.onNavigationOpen.bind(this)));
3097
+ this.subs.add(merge(this.navigationService.close, this.navigationService.esc).subscribe(this.onNavigationClose.bind(this)));
3123
3098
  }
3124
3099
  onNavigationEnterUp() {
3125
3100
  if (!this._disabled && !this.openState) {
@@ -3172,13 +3147,14 @@ let DropDownButtonComponent = class DropDownButtonComponent extends ListButton {
3172
3147
  popupAlign: this.popupAlign,
3173
3148
  popupClass: this.popupClasses
3174
3149
  });
3175
- this.popupRef.popupAnchorViewportLeave.subscribe(() => this.openState = false);
3176
- this.popupRef.popupOpen.subscribe(this.focusFirstItem.bind(this));
3150
+ this.popupSubs.add(this.popupRef.popupAnchorViewportLeave.subscribe(() => this.openState = false));
3151
+ this.popupSubs.add(this.popupRef.popupOpen.subscribe(this.focusFirstItem.bind(this)));
3177
3152
  }
3178
3153
  destroyPopup() {
3179
3154
  if (this.popupRef) {
3180
3155
  this.popupRef.close();
3181
3156
  this.popupRef = null;
3157
+ this.popupSubs.unsubscribe();
3182
3158
  }
3183
3159
  }
3184
3160
  };
@@ -3454,6 +3430,7 @@ let ChipComponent = class ChipComponent {
3454
3430
  this._fillMode = 'solid';
3455
3431
  this._themeColor = 'base';
3456
3432
  this.focused = false;
3433
+ this.subs = new Subscription();
3457
3434
  validatePackage(packageMetadata);
3458
3435
  this.direction = localizationService.rtl ? 'rtl' : 'ltr';
3459
3436
  }
@@ -3544,16 +3521,11 @@ let ChipComponent = class ChipComponent {
3544
3521
  return this.focused;
3545
3522
  }
3546
3523
  ngOnInit() {
3547
- this.dynamicRTLSubscription = this.localizationService.changes
3548
- .subscribe(({ rtl }) => this.direction = rtl ? 'rtl' : 'ltr');
3524
+ this.subs.add(this.localizationService.changes
3525
+ .subscribe(({ rtl }) => this.direction = rtl ? 'rtl' : 'ltr'));
3549
3526
  }
3550
3527
  ngOnDestroy() {
3551
- if (this.dynamicRTLSubscription) {
3552
- this.dynamicRTLSubscription.unsubscribe();
3553
- }
3554
- if (this.detachDomEvents) {
3555
- this.detachDomEvents();
3556
- }
3528
+ this.subs.unsubscribe();
3557
3529
  }
3558
3530
  ngAfterViewInit() {
3559
3531
  const chip = this.element.nativeElement;
@@ -3619,25 +3591,20 @@ let ChipComponent = class ChipComponent {
3619
3591
  }
3620
3592
  attachElementEventHandlers(chip) {
3621
3593
  this.ngZone.runOutsideAngular(() => {
3622
- const focusListener = this.renderer.listen(chip, 'focus', () => {
3594
+ this.subs.add(this.renderer.listen(chip, 'focus', () => {
3623
3595
  this.renderer.addClass(chip, 'k-focus');
3624
- });
3625
- const blurListener = this.renderer.listen(chip, 'blur', () => {
3596
+ }));
3597
+ this.subs.add(this.renderer.listen(chip, 'blur', () => {
3626
3598
  this.renderer.removeClass(chip, 'k-focus');
3627
- });
3628
- const contentClickListener = this.renderer.listen(chip, 'click', (e) => {
3599
+ }));
3600
+ this.subs.add(this.renderer.listen(chip, 'click', (e) => {
3629
3601
  const isRemoveClicked = closest(e.target, '.k-chip-remove-action');
3630
3602
  if (!isRemoveClicked) {
3631
3603
  this.ngZone.run(() => {
3632
3604
  this.contentClick.emit({ sender: this, originalEvent: e });
3633
3605
  });
3634
3606
  }
3635
- });
3636
- this.detachDomEvents = () => {
3637
- focusListener();
3638
- blurListener();
3639
- contentClickListener();
3640
- };
3607
+ }));
3641
3608
  });
3642
3609
  }
3643
3610
  /**