@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.
- package/dist/cdn/js/kendo-angular-buttons.js +2 -2
- package/dist/cdn/main.js +1 -1
- package/dist/es/button/button.directive.js +7 -7
- package/dist/es/buttongroup/buttongroup.component.js +7 -6
- package/dist/es/chip/chip.component.js +11 -19
- package/dist/es/dropdownbutton/dropdownbutton.component.js +10 -8
- package/dist/es/focusable/focusable.directive.js +5 -11
- package/dist/es/listbutton/list-button.js +16 -36
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/splitbutton/splitbutton.component.js +5 -2
- package/dist/es2015/button/button.directive.d.ts +1 -2
- package/dist/es2015/button/button.directive.js +6 -6
- package/dist/es2015/buttongroup/buttongroup.component.d.ts +1 -2
- package/dist/es2015/buttongroup/buttongroup.component.js +6 -5
- package/dist/es2015/chip/chip.component.d.ts +1 -2
- package/dist/es2015/chip/chip.component.js +11 -19
- package/dist/es2015/dropdownbutton/dropdownbutton.component.d.ts +1 -0
- package/dist/es2015/dropdownbutton/dropdownbutton.component.js +10 -8
- package/dist/es2015/focusable/focusable.directive.d.ts +1 -2
- package/dist/es2015/focusable/focusable.directive.js +5 -11
- package/dist/es2015/index.metadata.json +1 -1
- package/dist/es2015/listbutton/list-button.d.ts +1 -11
- package/dist/es2015/listbutton/list-button.js +15 -35
- package/dist/es2015/package-metadata.js +1 -1
- package/dist/es2015/splitbutton/splitbutton.component.d.ts +1 -0
- package/dist/es2015/splitbutton/splitbutton.component.js +5 -2
- package/dist/fesm2015/index.js +53 -86
- package/dist/fesm5/index.js +56 -89
- package/dist/npm/button/button.directive.js +7 -7
- package/dist/npm/buttongroup/buttongroup.component.js +7 -6
- package/dist/npm/chip/chip.component.js +11 -19
- package/dist/npm/dropdownbutton/dropdownbutton.component.js +9 -7
- package/dist/npm/focusable/focusable.directive.js +5 -11
- package/dist/npm/listbutton/list-button.js +15 -35
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/splitbutton/splitbutton.component.js +5 -2
- package/dist/systemjs/kendo-angular-buttons.js +1 -1
- package/package.json +1 -1
|
@@ -7,6 +7,7 @@ import { Directive, ElementRef, EventEmitter, HostBinding, HostListener, Input,
|
|
|
7
7
|
import { KendoButtonService } from './button.service';
|
|
8
8
|
import { isDocumentAvailable, isChanged, hasObservers, Keys } from '@progress/kendo-angular-common';
|
|
9
9
|
import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
|
|
10
|
+
import { Subscription } from 'rxjs';
|
|
10
11
|
import { validatePackage } from '@progress/kendo-licensing';
|
|
11
12
|
import { packageMetadata } from '../package-metadata';
|
|
12
13
|
import { getStylingClasses, getThemeColorClasses, isFirefox } from '../util';
|
|
@@ -47,13 +48,13 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
47
48
|
this._fillMode = 'solid';
|
|
48
49
|
this._themeColor = 'base';
|
|
49
50
|
this._focused = false;
|
|
50
|
-
this.
|
|
51
|
+
this.subs = new Subscription();
|
|
51
52
|
validatePackage(packageMetadata);
|
|
52
53
|
this.direction = localization.rtl ? 'rtl' : 'ltr';
|
|
53
|
-
this.
|
|
54
|
+
this.subs.add(localization.changes.subscribe(function (_a) {
|
|
54
55
|
var rtl = _a.rtl;
|
|
55
56
|
return (_this.direction = rtl ? 'rtl' : 'ltr');
|
|
56
|
-
});
|
|
57
|
+
}));
|
|
57
58
|
this.element = element.nativeElement;
|
|
58
59
|
this.renderer = renderer;
|
|
59
60
|
}
|
|
@@ -396,8 +397,8 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
396
397
|
this.setAttribute('role', this.role);
|
|
397
398
|
}
|
|
398
399
|
this.ngZone.runOutsideAngular(function () {
|
|
399
|
-
_this.
|
|
400
|
-
_this.
|
|
400
|
+
_this.subs.add(_this.renderer.listen(_this.element, 'click', _this._onButtonClick.bind(_this)));
|
|
401
|
+
_this.subs.add(_this.renderer.listen(_this.element, 'keydown', function (event) {
|
|
401
402
|
var isSpaceOrEnter = event.keyCode === Keys.Space || event.keyCode === Keys.Enter;
|
|
402
403
|
if (isSpan && isSpaceOrEnter) {
|
|
403
404
|
_this.click.emit(event);
|
|
@@ -426,9 +427,8 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
426
427
|
this.iconNode = null;
|
|
427
428
|
this.iconSpanNode = null;
|
|
428
429
|
this.renderer = null;
|
|
429
|
-
this.
|
|
430
|
+
this.subs.unsubscribe();
|
|
430
431
|
clearTimeout(this.deferTimeout);
|
|
431
|
-
this.domEvents.forEach(function (unbindHandler) { return unbindHandler(); });
|
|
432
432
|
};
|
|
433
433
|
/**
|
|
434
434
|
* Focuses the Button component.
|
|
@@ -8,6 +8,7 @@ import { Component, EventEmitter, Output, Input, ContentChildren, QueryList, Hos
|
|
|
8
8
|
import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
|
|
9
9
|
import { isChanged, Keys } from '@progress/kendo-angular-common';
|
|
10
10
|
import { KendoButtonService } from '../button/button.service';
|
|
11
|
+
import { Subscription } from 'rxjs';
|
|
11
12
|
import { isPresent } from '../util';
|
|
12
13
|
import { PreventableEvent } from '../preventable-event';
|
|
13
14
|
import { packageMetadata } from '../package-metadata';
|
|
@@ -34,11 +35,12 @@ var ButtonGroupComponent = /** @class */ (function () {
|
|
|
34
35
|
this.navigate = new EventEmitter();
|
|
35
36
|
this._tabIndex = 0;
|
|
36
37
|
this.currentTabIndex = 0;
|
|
38
|
+
this.subs = new Subscription();
|
|
37
39
|
validatePackage(packageMetadata);
|
|
38
|
-
this.
|
|
40
|
+
this.subs.add(localization.changes.subscribe(function (_a) {
|
|
39
41
|
var rtl = _a.rtl;
|
|
40
42
|
return _this.direction = rtl ? 'rtl' : 'ltr';
|
|
41
|
-
});
|
|
43
|
+
}));
|
|
42
44
|
}
|
|
43
45
|
Object.defineProperty(ButtonGroupComponent.prototype, "tabIndex", {
|
|
44
46
|
get: function () {
|
|
@@ -140,7 +142,7 @@ var ButtonGroupComponent = /** @class */ (function () {
|
|
|
140
142
|
};
|
|
141
143
|
ButtonGroupComponent.prototype.ngOnInit = function () {
|
|
142
144
|
var _this = this;
|
|
143
|
-
this.
|
|
145
|
+
this.subs.add(this.service.buttonClicked$.subscribe(function (button) {
|
|
144
146
|
var newSelectionValue;
|
|
145
147
|
if (_this.isSelectionSingle()) {
|
|
146
148
|
newSelectionValue = true;
|
|
@@ -154,7 +156,7 @@ var ButtonGroupComponent = /** @class */ (function () {
|
|
|
154
156
|
button.setSelected(newSelectionValue);
|
|
155
157
|
}
|
|
156
158
|
button.setAttribute(tabindex, '0');
|
|
157
|
-
});
|
|
159
|
+
}));
|
|
158
160
|
};
|
|
159
161
|
ButtonGroupComponent.prototype.ngOnChanges = function (change) {
|
|
160
162
|
var _this = this;
|
|
@@ -183,8 +185,7 @@ var ButtonGroupComponent = /** @class */ (function () {
|
|
|
183
185
|
}
|
|
184
186
|
};
|
|
185
187
|
ButtonGroupComponent.prototype.ngOnDestroy = function () {
|
|
186
|
-
this.
|
|
187
|
-
this.localizationChangeSubscription.unsubscribe();
|
|
188
|
+
this.subs.unsubscribe();
|
|
188
189
|
};
|
|
189
190
|
ButtonGroupComponent.prototype.ngAfterContentChecked = function () {
|
|
190
191
|
this.verifySettings();
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as tslib_1 from "tslib";
|
|
6
6
|
import { Component, HostBinding, Input, Output, EventEmitter, ElementRef, Renderer2, NgZone, isDevMode } from '@angular/core';
|
|
7
|
+
import { Subscription } from 'rxjs';
|
|
7
8
|
import { isDocumentAvailable } from '@progress/kendo-angular-common';
|
|
8
9
|
import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
|
|
9
10
|
import { validatePackage } from '@progress/kendo-licensing';
|
|
@@ -49,6 +50,7 @@ var ChipComponent = /** @class */ (function () {
|
|
|
49
50
|
this._fillMode = 'solid';
|
|
50
51
|
this._themeColor = 'base';
|
|
51
52
|
this.focused = false;
|
|
53
|
+
this.subs = new Subscription();
|
|
52
54
|
validatePackage(packageMetadata);
|
|
53
55
|
this.direction = localizationService.rtl ? 'rtl' : 'ltr';
|
|
54
56
|
}
|
|
@@ -176,19 +178,14 @@ var ChipComponent = /** @class */ (function () {
|
|
|
176
178
|
});
|
|
177
179
|
ChipComponent.prototype.ngOnInit = function () {
|
|
178
180
|
var _this = this;
|
|
179
|
-
this.
|
|
181
|
+
this.subs.add(this.localizationService.changes
|
|
180
182
|
.subscribe(function (_a) {
|
|
181
183
|
var rtl = _a.rtl;
|
|
182
184
|
return _this.direction = rtl ? 'rtl' : 'ltr';
|
|
183
|
-
});
|
|
185
|
+
}));
|
|
184
186
|
};
|
|
185
187
|
ChipComponent.prototype.ngOnDestroy = function () {
|
|
186
|
-
|
|
187
|
-
this.dynamicRTLSubscription.unsubscribe();
|
|
188
|
-
}
|
|
189
|
-
if (this.detachDomEvents) {
|
|
190
|
-
this.detachDomEvents();
|
|
191
|
-
}
|
|
188
|
+
this.subs.unsubscribe();
|
|
192
189
|
};
|
|
193
190
|
ChipComponent.prototype.ngAfterViewInit = function () {
|
|
194
191
|
var _this = this;
|
|
@@ -272,25 +269,20 @@ var ChipComponent = /** @class */ (function () {
|
|
|
272
269
|
ChipComponent.prototype.attachElementEventHandlers = function (chip) {
|
|
273
270
|
var _this = this;
|
|
274
271
|
this.ngZone.runOutsideAngular(function () {
|
|
275
|
-
|
|
272
|
+
_this.subs.add(_this.renderer.listen(chip, 'focus', function () {
|
|
276
273
|
_this.renderer.addClass(chip, 'k-focus');
|
|
277
|
-
});
|
|
278
|
-
|
|
274
|
+
}));
|
|
275
|
+
_this.subs.add(_this.renderer.listen(chip, 'blur', function () {
|
|
279
276
|
_this.renderer.removeClass(chip, 'k-focus');
|
|
280
|
-
});
|
|
281
|
-
|
|
277
|
+
}));
|
|
278
|
+
_this.subs.add(_this.renderer.listen(chip, 'click', function (e) {
|
|
282
279
|
var isRemoveClicked = closest(e.target, '.k-chip-remove-action');
|
|
283
280
|
if (!isRemoveClicked) {
|
|
284
281
|
_this.ngZone.run(function () {
|
|
285
282
|
_this.contentClick.emit({ sender: _this, originalEvent: e });
|
|
286
283
|
});
|
|
287
284
|
}
|
|
288
|
-
});
|
|
289
|
-
_this.detachDomEvents = function () {
|
|
290
|
-
focusListener();
|
|
291
|
-
blurListener();
|
|
292
|
-
contentClickListener();
|
|
293
|
-
};
|
|
285
|
+
}));
|
|
294
286
|
});
|
|
295
287
|
};
|
|
296
288
|
/**
|
|
@@ -16,7 +16,7 @@ import { FocusService } from '../focusable/focus.service';
|
|
|
16
16
|
import { NavigationService } from '../navigation/navigation.service';
|
|
17
17
|
import { NAVIGATION_CONFIG } from '../navigation/navigation-config';
|
|
18
18
|
import { PreventableEvent } from '../preventable-event';
|
|
19
|
-
import { merge } from 'rxjs';
|
|
19
|
+
import { merge, Subscription } from 'rxjs';
|
|
20
20
|
var NAVIGATION_SETTINGS = {
|
|
21
21
|
useLeftRightArrows: true
|
|
22
22
|
};
|
|
@@ -152,6 +152,7 @@ var DropDownButtonComponent = /** @class */ (function (_super) {
|
|
|
152
152
|
_this.onBlur = new EventEmitter(); //tslint:disable-line:no-output-rename
|
|
153
153
|
_this.listId = guid();
|
|
154
154
|
_this._fillMode = 'solid';
|
|
155
|
+
_this.popupSubs = new Subscription();
|
|
155
156
|
_this._itemClick = _this.itemClick;
|
|
156
157
|
_this._blur = _this.onBlur;
|
|
157
158
|
return _this;
|
|
@@ -461,11 +462,11 @@ var DropDownButtonComponent = /** @class */ (function (_super) {
|
|
|
461
462
|
|| (this.popupRef && this.popupRef.popupElement.contains(element));
|
|
462
463
|
};
|
|
463
464
|
DropDownButtonComponent.prototype.subscribeNavigationEvents = function () {
|
|
464
|
-
this.
|
|
465
|
-
.subscribe(this.onArrowKeyNavigate.bind(this));
|
|
466
|
-
this.
|
|
467
|
-
this.
|
|
468
|
-
this.
|
|
465
|
+
this.subs.add(this.navigationService.navigate
|
|
466
|
+
.subscribe(this.onArrowKeyNavigate.bind(this)));
|
|
467
|
+
this.subs.add(this.navigationService.enterup.subscribe(this.onNavigationEnterUp.bind(this)));
|
|
468
|
+
this.subs.add(this.navigationService.open.subscribe(this.onNavigationOpen.bind(this)));
|
|
469
|
+
this.subs.add(merge(this.navigationService.close, this.navigationService.esc).subscribe(this.onNavigationClose.bind(this)));
|
|
469
470
|
};
|
|
470
471
|
DropDownButtonComponent.prototype.onNavigationEnterUp = function () {
|
|
471
472
|
if (!this._disabled && !this.openState) {
|
|
@@ -519,13 +520,14 @@ var DropDownButtonComponent = /** @class */ (function (_super) {
|
|
|
519
520
|
popupAlign: this.popupAlign,
|
|
520
521
|
popupClass: this.popupClasses
|
|
521
522
|
});
|
|
522
|
-
this.popupRef.popupAnchorViewportLeave.subscribe(function () { return _this.openState = false; });
|
|
523
|
-
this.popupRef.popupOpen.subscribe(this.focusFirstItem.bind(this));
|
|
523
|
+
this.popupSubs.add(this.popupRef.popupAnchorViewportLeave.subscribe(function () { return _this.openState = false; }));
|
|
524
|
+
this.popupSubs.add(this.popupRef.popupOpen.subscribe(this.focusFirstItem.bind(this)));
|
|
524
525
|
};
|
|
525
526
|
DropDownButtonComponent.prototype.destroyPopup = function () {
|
|
526
527
|
if (this.popupRef) {
|
|
527
528
|
this.popupRef.close();
|
|
528
529
|
this.popupRef = null;
|
|
530
|
+
this.popupSubs.unsubscribe();
|
|
529
531
|
}
|
|
530
532
|
};
|
|
531
533
|
tslib_1.__decorate([
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import * as tslib_1 from "tslib";
|
|
6
6
|
import { Directive, Input, ElementRef, Renderer2 } from '@angular/core';
|
|
7
7
|
import { FocusService } from './focus.service';
|
|
8
|
+
import { Subscription } from 'rxjs';
|
|
8
9
|
import { isDocumentAvailable } from '@progress/kendo-angular-common';
|
|
9
10
|
/**
|
|
10
11
|
* @hidden
|
|
@@ -13,6 +14,7 @@ var FocusableDirective = /** @class */ (function () {
|
|
|
13
14
|
function FocusableDirective(focusService, elementRef, renderer) {
|
|
14
15
|
this.focusService = focusService;
|
|
15
16
|
this.renderer = renderer;
|
|
17
|
+
this.subs = new Subscription();
|
|
16
18
|
this.element = elementRef.nativeElement;
|
|
17
19
|
this.subscribeEvents();
|
|
18
20
|
}
|
|
@@ -28,14 +30,14 @@ var FocusableDirective = /** @class */ (function () {
|
|
|
28
30
|
* @hidden
|
|
29
31
|
*/
|
|
30
32
|
FocusableDirective.prototype.ngOnDestroy = function () {
|
|
31
|
-
this.
|
|
33
|
+
this.subs.unsubscribe();
|
|
32
34
|
};
|
|
33
35
|
FocusableDirective.prototype.subscribeEvents = function () {
|
|
34
36
|
var _this = this;
|
|
35
37
|
if (!isDocumentAvailable()) {
|
|
36
38
|
return;
|
|
37
39
|
}
|
|
38
|
-
this.
|
|
40
|
+
this.subs.add(this.focusService.onFocus.subscribe(function (index) {
|
|
39
41
|
if (_this.index === index) {
|
|
40
42
|
_this.renderer.addClass(_this.element, 'k-focus');
|
|
41
43
|
_this.element.focus();
|
|
@@ -43,15 +45,7 @@ var FocusableDirective = /** @class */ (function () {
|
|
|
43
45
|
else {
|
|
44
46
|
_this.renderer.removeClass(_this.element, 'k-focus');
|
|
45
47
|
}
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
FocusableDirective.prototype.unsubscribeEvents = function () {
|
|
49
|
-
if (!isDocumentAvailable()) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
if (this.focusSubscription) {
|
|
53
|
-
this.focusSubscription.unsubscribe();
|
|
54
|
-
}
|
|
48
|
+
}));
|
|
55
49
|
};
|
|
56
50
|
tslib_1.__decorate([
|
|
57
51
|
Input(),
|
|
@@ -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';
|
|
@@ -28,14 +28,15 @@ var ListButton = /** @class */ (function () {
|
|
|
28
28
|
this._popupSettings = { animate: true, popupClass: '' };
|
|
29
29
|
this.listId = guid();
|
|
30
30
|
this._isFocused = false;
|
|
31
|
+
this.subs = new Subscription();
|
|
31
32
|
validatePackage(packageMetadata);
|
|
32
33
|
this.focusService = focusService;
|
|
33
34
|
this.navigationService = navigationService;
|
|
34
35
|
this.wrapper = wrapperRef.nativeElement;
|
|
35
|
-
this.
|
|
36
|
+
this.subs.add(localization.changes.subscribe(function (_a) {
|
|
36
37
|
var rtl = _a.rtl;
|
|
37
38
|
return (_this.direction = rtl ? 'rtl' : 'ltr');
|
|
38
|
-
});
|
|
39
|
+
}));
|
|
39
40
|
this.subscribeEvents();
|
|
40
41
|
}
|
|
41
42
|
Object.defineProperty(ListButton.prototype, "popupClasses", {
|
|
@@ -81,12 +82,9 @@ var ListButton = /** @class */ (function () {
|
|
|
81
82
|
};
|
|
82
83
|
ListButton.prototype.ngOnDestroy = function () {
|
|
83
84
|
this.openState = false;
|
|
84
|
-
this.unsubscribeEvents();
|
|
85
85
|
clearTimeout(this.focusFirstTimeout);
|
|
86
86
|
clearTimeout(this.blurTimeout);
|
|
87
|
-
|
|
88
|
-
this.localizationChangeSubscription.unsubscribe();
|
|
89
|
-
}
|
|
87
|
+
this.subs.unsubscribe();
|
|
90
88
|
};
|
|
91
89
|
ListButton.prototype.subscribeEvents = function () {
|
|
92
90
|
if (!isDocumentAvailable()) {
|
|
@@ -98,27 +96,27 @@ var ListButton = /** @class */ (function () {
|
|
|
98
96
|
};
|
|
99
97
|
ListButton.prototype.subscribeListItemFocusEvent = function () {
|
|
100
98
|
var _this = this;
|
|
101
|
-
this.
|
|
99
|
+
this.subs.add(this.focusService.onFocus.subscribe(function () {
|
|
102
100
|
_this._isFocused = true;
|
|
103
|
-
});
|
|
101
|
+
}));
|
|
104
102
|
};
|
|
105
103
|
ListButton.prototype.subscribeComponentBlurredEvent = function () {
|
|
106
104
|
var _this = this;
|
|
107
105
|
this._zone.runOutsideAngular(function () {
|
|
108
|
-
_this.
|
|
109
|
-
_this.
|
|
106
|
+
_this.subs.add(_this.navigationService.tab.pipe(filter(function () { return _this._isFocused; })).subscribe(_this.handleTab.bind(_this)));
|
|
107
|
+
_this.subs.add(fromEvent(document, 'click')
|
|
110
108
|
.pipe(filter(function (event) { return !_this.wrapperContains(event.target); }), filter(function () { return _this._isFocused; }))
|
|
111
|
-
.subscribe(function () { return _this._zone.run(function () { return _this.blurWrapper(); }); });
|
|
109
|
+
.subscribe(function () { return _this._zone.run(function () { return _this.blurWrapper(); }); }));
|
|
112
110
|
});
|
|
113
111
|
};
|
|
114
112
|
ListButton.prototype.subscribeNavigationEvents = function () {
|
|
115
113
|
var _this = this;
|
|
116
|
-
this.
|
|
117
|
-
this.
|
|
114
|
+
this.subs.add(this.navigationService.navigate.subscribe(this.focusService.focus.bind(this.focusService)));
|
|
115
|
+
this.subs.add(this.navigationService.enterup.subscribe(function () {
|
|
118
116
|
_this.enterHandler();
|
|
119
117
|
_this.focusWrapper();
|
|
120
|
-
});
|
|
121
|
-
this.
|
|
118
|
+
}));
|
|
119
|
+
this.subs.add(this.navigationService.open.subscribe(function () {
|
|
122
120
|
if (!_this._open) {
|
|
123
121
|
_this.togglePopupVisibility();
|
|
124
122
|
_this.focusFirstItem();
|
|
@@ -126,28 +124,10 @@ var ListButton = /** @class */ (function () {
|
|
|
126
124
|
else {
|
|
127
125
|
_this.focusWrapper();
|
|
128
126
|
}
|
|
129
|
-
});
|
|
130
|
-
this.
|
|
127
|
+
}));
|
|
128
|
+
this.subs.add(merge(this.navigationService.close, this.navigationService.esc).subscribe(function () { return _this.focusWrapper(); }));
|
|
131
129
|
};
|
|
132
130
|
ListButton.prototype.enterHandler = function () { }; // tslint:disable-line
|
|
133
|
-
ListButton.prototype.unsubscribeEvents = function () {
|
|
134
|
-
if (!isDocumentAvailable()) {
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
this.unsubscribe(this.componentBlurredSubscription);
|
|
138
|
-
this.unsubscribe(this.focusSubscription);
|
|
139
|
-
this.unsubscribe(this.navigationSubscription);
|
|
140
|
-
this.unsubscribe(this.enterPressSubscription);
|
|
141
|
-
this.unsubscribe(this.enterUpSubscription);
|
|
142
|
-
this.unsubscribe(this.openSubscription);
|
|
143
|
-
this.unsubscribe(this.closeSubscription);
|
|
144
|
-
this.unsubscribe(this.tabSubscription);
|
|
145
|
-
};
|
|
146
|
-
ListButton.prototype.unsubscribe = function (subscription) {
|
|
147
|
-
if (subscription) {
|
|
148
|
-
subscription.unsubscribe();
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
131
|
/**
|
|
152
132
|
* @hidden
|
|
153
133
|
*/
|
|
@@ -9,7 +9,7 @@ export var packageMetadata = {
|
|
|
9
9
|
name: '@progress/kendo-angular-buttons',
|
|
10
10
|
productName: 'Kendo UI for Angular',
|
|
11
11
|
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
12
|
-
publishDate:
|
|
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
|
};
|
|
@@ -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
|
var NAVIGATION_SETTINGS = {
|
|
21
22
|
useLeftRightArrows: true
|
|
22
23
|
};
|
|
@@ -213,6 +214,7 @@ var SplitButtonComponent = /** @class */ (function (_super) {
|
|
|
213
214
|
_this.lockFocus = false;
|
|
214
215
|
_this._rounded = 'medium';
|
|
215
216
|
_this._fillMode = "solid";
|
|
217
|
+
_this.popupSubs = new Subscription();
|
|
216
218
|
_this._itemClick = _this.itemClick;
|
|
217
219
|
_this._blur = _this.onBlur;
|
|
218
220
|
return _this;
|
|
@@ -628,11 +630,12 @@ var SplitButtonComponent = /** @class */ (function (_super) {
|
|
|
628
630
|
popupAlign: this.popupAlign,
|
|
629
631
|
popupClass: this.popupClasses
|
|
630
632
|
});
|
|
631
|
-
this.popupRef.popupAnchorViewportLeave.subscribe(function () { return (_this.openState = false); });
|
|
632
|
-
this.popupRef.popupOpen.subscribe(this.focusFirstItem.bind(this));
|
|
633
|
+
this.popupSubs.add(this.popupRef.popupAnchorViewportLeave.subscribe(function () { return (_this.openState = false); }));
|
|
634
|
+
this.popupSubs.add(this.popupRef.popupOpen.subscribe(this.focusFirstItem.bind(this)));
|
|
633
635
|
};
|
|
634
636
|
SplitButtonComponent.prototype.destroyPopup = function () {
|
|
635
637
|
if (this.popupRef) {
|
|
638
|
+
this.popupSubs.unsubscribe();
|
|
636
639
|
this.popupRef.close();
|
|
637
640
|
this.popupRef = null;
|
|
638
641
|
}
|
|
@@ -144,12 +144,11 @@ export declare class ButtonDirective implements OnDestroy, AfterViewInit {
|
|
|
144
144
|
private _shape;
|
|
145
145
|
private _fillMode;
|
|
146
146
|
private _themeColor;
|
|
147
|
-
private localizationChangeSubscription;
|
|
148
147
|
private _focused;
|
|
149
148
|
private direction;
|
|
150
149
|
private _selected;
|
|
151
150
|
private deferTimeout;
|
|
152
|
-
private
|
|
151
|
+
private subs;
|
|
153
152
|
isFocused: boolean;
|
|
154
153
|
readonly classButton: boolean;
|
|
155
154
|
readonly isToggleable: boolean;
|
|
@@ -7,6 +7,7 @@ import { Directive, ElementRef, EventEmitter, HostBinding, HostListener, Input,
|
|
|
7
7
|
import { KendoButtonService } from './button.service';
|
|
8
8
|
import { isDocumentAvailable, isChanged, hasObservers, Keys } from '@progress/kendo-angular-common';
|
|
9
9
|
import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
|
|
10
|
+
import { Subscription } from 'rxjs';
|
|
10
11
|
import { validatePackage } from '@progress/kendo-licensing';
|
|
11
12
|
import { packageMetadata } from '../package-metadata';
|
|
12
13
|
import { getStylingClasses, getThemeColorClasses, isFirefox } from '../util';
|
|
@@ -46,10 +47,10 @@ let ButtonDirective = class ButtonDirective {
|
|
|
46
47
|
this._fillMode = 'solid';
|
|
47
48
|
this._themeColor = 'base';
|
|
48
49
|
this._focused = false;
|
|
49
|
-
this.
|
|
50
|
+
this.subs = new Subscription();
|
|
50
51
|
validatePackage(packageMetadata);
|
|
51
52
|
this.direction = localization.rtl ? 'rtl' : 'ltr';
|
|
52
|
-
this.
|
|
53
|
+
this.subs.add(localization.changes.subscribe(({ rtl }) => (this.direction = rtl ? 'rtl' : 'ltr')));
|
|
53
54
|
this.element = element.nativeElement;
|
|
54
55
|
this.renderer = renderer;
|
|
55
56
|
}
|
|
@@ -305,8 +306,8 @@ let ButtonDirective = class ButtonDirective {
|
|
|
305
306
|
this.setAttribute('role', this.role);
|
|
306
307
|
}
|
|
307
308
|
this.ngZone.runOutsideAngular(() => {
|
|
308
|
-
this.
|
|
309
|
-
this.
|
|
309
|
+
this.subs.add(this.renderer.listen(this.element, 'click', this._onButtonClick.bind(this)));
|
|
310
|
+
this.subs.add(this.renderer.listen(this.element, 'keydown', (event) => {
|
|
310
311
|
const isSpaceOrEnter = event.keyCode === Keys.Space || event.keyCode === Keys.Enter;
|
|
311
312
|
if (isSpan && isSpaceOrEnter) {
|
|
312
313
|
this.click.emit(event);
|
|
@@ -334,9 +335,8 @@ let ButtonDirective = class ButtonDirective {
|
|
|
334
335
|
this.iconNode = null;
|
|
335
336
|
this.iconSpanNode = null;
|
|
336
337
|
this.renderer = null;
|
|
337
|
-
this.
|
|
338
|
+
this.subs.unsubscribe();
|
|
338
339
|
clearTimeout(this.deferTimeout);
|
|
339
|
-
this.domEvents.forEach(unbindHandler => unbindHandler());
|
|
340
340
|
}
|
|
341
341
|
/**
|
|
342
342
|
* Focuses the Button component.
|
|
@@ -50,8 +50,7 @@ export declare class ButtonGroupComponent implements OnInit, OnDestroy, AfterCon
|
|
|
50
50
|
private _tabIndex;
|
|
51
51
|
private currentTabIndex;
|
|
52
52
|
private direction;
|
|
53
|
-
private
|
|
54
|
-
private localizationChangeSubscription;
|
|
53
|
+
private subs;
|
|
55
54
|
readonly wrapperClass: boolean;
|
|
56
55
|
readonly disabledClass: boolean;
|
|
57
56
|
readonly stretchedClass: boolean;
|
|
@@ -8,6 +8,7 @@ import { Component, EventEmitter, Output, Input, ContentChildren, QueryList, Hos
|
|
|
8
8
|
import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
|
|
9
9
|
import { isChanged, Keys } from '@progress/kendo-angular-common';
|
|
10
10
|
import { KendoButtonService } from '../button/button.service';
|
|
11
|
+
import { Subscription } from 'rxjs';
|
|
11
12
|
import { isPresent } from '../util';
|
|
12
13
|
import { PreventableEvent } from '../preventable-event';
|
|
13
14
|
import { packageMetadata } from '../package-metadata';
|
|
@@ -33,8 +34,9 @@ let ButtonGroupComponent = class ButtonGroupComponent {
|
|
|
33
34
|
this.navigate = new EventEmitter();
|
|
34
35
|
this._tabIndex = 0;
|
|
35
36
|
this.currentTabIndex = 0;
|
|
37
|
+
this.subs = new Subscription();
|
|
36
38
|
validatePackage(packageMetadata);
|
|
37
|
-
this.
|
|
39
|
+
this.subs.add(localization.changes.subscribe(({ rtl }) => this.direction = rtl ? 'rtl' : 'ltr'));
|
|
38
40
|
}
|
|
39
41
|
/**
|
|
40
42
|
* Specifies the [`tabIndex`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the component.
|
|
@@ -99,7 +101,7 @@ let ButtonGroupComponent = class ButtonGroupComponent {
|
|
|
99
101
|
}
|
|
100
102
|
}
|
|
101
103
|
ngOnInit() {
|
|
102
|
-
this.
|
|
104
|
+
this.subs.add(this.service.buttonClicked$.subscribe((button) => {
|
|
103
105
|
let newSelectionValue;
|
|
104
106
|
if (this.isSelectionSingle()) {
|
|
105
107
|
newSelectionValue = true;
|
|
@@ -113,7 +115,7 @@ let ButtonGroupComponent = class ButtonGroupComponent {
|
|
|
113
115
|
button.setSelected(newSelectionValue);
|
|
114
116
|
}
|
|
115
117
|
button.setAttribute(tabindex, '0');
|
|
116
|
-
});
|
|
118
|
+
}));
|
|
117
119
|
}
|
|
118
120
|
ngOnChanges(change) {
|
|
119
121
|
if (isChanged('disabled', change)) {
|
|
@@ -141,8 +143,7 @@ let ButtonGroupComponent = class ButtonGroupComponent {
|
|
|
141
143
|
}
|
|
142
144
|
}
|
|
143
145
|
ngOnDestroy() {
|
|
144
|
-
this.
|
|
145
|
-
this.localizationChangeSubscription.unsubscribe();
|
|
146
|
+
this.subs.unsubscribe();
|
|
146
147
|
}
|
|
147
148
|
ngAfterContentChecked() {
|
|
148
149
|
this.verifySettings();
|
|
@@ -126,8 +126,7 @@ export declare class ChipComponent implements OnInit, AfterViewInit {
|
|
|
126
126
|
private _fillMode;
|
|
127
127
|
private _themeColor;
|
|
128
128
|
private focused;
|
|
129
|
-
private
|
|
130
|
-
private detachDomEvents;
|
|
129
|
+
private subs;
|
|
131
130
|
constructor(element: ElementRef, renderer: Renderer2, ngZone: NgZone, localizationService: LocalizationService);
|
|
132
131
|
ngOnInit(): void;
|
|
133
132
|
ngOnDestroy(): void;
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as tslib_1 from "tslib";
|
|
6
6
|
import { Component, HostBinding, Input, Output, EventEmitter, ElementRef, Renderer2, NgZone, isDevMode } from '@angular/core';
|
|
7
|
+
import { Subscription } from 'rxjs';
|
|
7
8
|
import { isDocumentAvailable } from '@progress/kendo-angular-common';
|
|
8
9
|
import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
|
|
9
10
|
import { validatePackage } from '@progress/kendo-licensing';
|
|
@@ -49,6 +50,7 @@ let ChipComponent = class ChipComponent {
|
|
|
49
50
|
this._fillMode = 'solid';
|
|
50
51
|
this._themeColor = 'base';
|
|
51
52
|
this.focused = false;
|
|
53
|
+
this.subs = new Subscription();
|
|
52
54
|
validatePackage(packageMetadata);
|
|
53
55
|
this.direction = localizationService.rtl ? 'rtl' : 'ltr';
|
|
54
56
|
}
|
|
@@ -139,16 +141,11 @@ let ChipComponent = class ChipComponent {
|
|
|
139
141
|
return this.focused;
|
|
140
142
|
}
|
|
141
143
|
ngOnInit() {
|
|
142
|
-
this.
|
|
143
|
-
.subscribe(({ rtl }) => this.direction = rtl ? 'rtl' : 'ltr');
|
|
144
|
+
this.subs.add(this.localizationService.changes
|
|
145
|
+
.subscribe(({ rtl }) => this.direction = rtl ? 'rtl' : 'ltr'));
|
|
144
146
|
}
|
|
145
147
|
ngOnDestroy() {
|
|
146
|
-
|
|
147
|
-
this.dynamicRTLSubscription.unsubscribe();
|
|
148
|
-
}
|
|
149
|
-
if (this.detachDomEvents) {
|
|
150
|
-
this.detachDomEvents();
|
|
151
|
-
}
|
|
148
|
+
this.subs.unsubscribe();
|
|
152
149
|
}
|
|
153
150
|
ngAfterViewInit() {
|
|
154
151
|
const chip = this.element.nativeElement;
|
|
@@ -214,25 +211,20 @@ let ChipComponent = class ChipComponent {
|
|
|
214
211
|
}
|
|
215
212
|
attachElementEventHandlers(chip) {
|
|
216
213
|
this.ngZone.runOutsideAngular(() => {
|
|
217
|
-
|
|
214
|
+
this.subs.add(this.renderer.listen(chip, 'focus', () => {
|
|
218
215
|
this.renderer.addClass(chip, 'k-focus');
|
|
219
|
-
});
|
|
220
|
-
|
|
216
|
+
}));
|
|
217
|
+
this.subs.add(this.renderer.listen(chip, 'blur', () => {
|
|
221
218
|
this.renderer.removeClass(chip, 'k-focus');
|
|
222
|
-
});
|
|
223
|
-
|
|
219
|
+
}));
|
|
220
|
+
this.subs.add(this.renderer.listen(chip, 'click', (e) => {
|
|
224
221
|
const isRemoveClicked = closest(e.target, '.k-chip-remove-action');
|
|
225
222
|
if (!isRemoveClicked) {
|
|
226
223
|
this.ngZone.run(() => {
|
|
227
224
|
this.contentClick.emit({ sender: this, originalEvent: e });
|
|
228
225
|
});
|
|
229
226
|
}
|
|
230
|
-
});
|
|
231
|
-
this.detachDomEvents = () => {
|
|
232
|
-
focusListener();
|
|
233
|
-
blurListener();
|
|
234
|
-
contentClickListener();
|
|
235
|
-
};
|
|
227
|
+
}));
|
|
236
228
|
});
|
|
237
229
|
}
|
|
238
230
|
/**
|