@progress/kendo-angular-dialog 5.2.1-dev.202110281710 → 5.2.3-dev.202111171048
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-dialog.js +1 -1
- package/dist/cdn/main.js +1 -1
- package/dist/es/dialog/dialog.component.js +60 -46
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/window/navigation.service.js +12 -5
- package/dist/es/window/window.component.js +25 -14
- package/dist/es2015/dialog/dialog.component.d.ts +7 -8
- package/dist/es2015/dialog/dialog.component.js +58 -46
- package/dist/es2015/index.metadata.json +1 -1
- package/dist/es2015/package-metadata.js +1 -1
- package/dist/es2015/window/navigation.service.d.ts +3 -1
- package/dist/es2015/window/navigation.service.js +11 -5
- package/dist/es2015/window/window.component.d.ts +3 -4
- package/dist/es2015/window/window.component.js +24 -14
- package/dist/fesm2015/index.js +93 -66
- package/dist/fesm5/index.js +97 -66
- package/dist/npm/dialog/dialog.component.js +59 -45
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/window/navigation.service.js +11 -4
- package/dist/npm/window/window.component.js +25 -14
- package/dist/systemjs/kendo-angular-dialog.js +1 -1
- package/package.json +1 -1
|
@@ -3,17 +3,19 @@
|
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as tslib_1 from "tslib";
|
|
6
|
-
import { Injectable } from "@angular/core";
|
|
6
|
+
import { Injectable, NgZone } from "@angular/core";
|
|
7
7
|
import { DragResizeService } from './drag-resize.service';
|
|
8
8
|
import { isPresent, OFFSET_STYLES, Keys } from '../common/util';
|
|
9
9
|
/**
|
|
10
10
|
* @hidden
|
|
11
11
|
*/
|
|
12
12
|
var NavigationService = /** @class */ (function () {
|
|
13
|
-
function NavigationService(window) {
|
|
13
|
+
function NavigationService(window, ngZone) {
|
|
14
14
|
this.window = window;
|
|
15
|
+
this.ngZone = ngZone;
|
|
15
16
|
}
|
|
16
17
|
NavigationService.prototype.process = function (ev) {
|
|
18
|
+
var _this = this;
|
|
17
19
|
var key = ev.keyCode;
|
|
18
20
|
switch (key) {
|
|
19
21
|
case Keys.up:
|
|
@@ -21,11 +23,15 @@ var NavigationService = /** @class */ (function () {
|
|
|
21
23
|
case Keys.left:
|
|
22
24
|
case Keys.right: {
|
|
23
25
|
ev.preventDefault();
|
|
24
|
-
this.
|
|
26
|
+
this.ngZone.run(function () {
|
|
27
|
+
_this.handleArrow(key, ev);
|
|
28
|
+
});
|
|
25
29
|
break;
|
|
26
30
|
}
|
|
27
31
|
case Keys.esc:
|
|
28
|
-
this.
|
|
32
|
+
this.ngZone.run(function () {
|
|
33
|
+
_this.handleEscape();
|
|
34
|
+
});
|
|
29
35
|
break;
|
|
30
36
|
default:
|
|
31
37
|
break;
|
|
@@ -141,7 +147,8 @@ var NavigationService = /** @class */ (function () {
|
|
|
141
147
|
};
|
|
142
148
|
NavigationService = tslib_1.__decorate([
|
|
143
149
|
Injectable(),
|
|
144
|
-
tslib_1.__metadata("design:paramtypes", [DragResizeService
|
|
150
|
+
tslib_1.__metadata("design:paramtypes", [DragResizeService,
|
|
151
|
+
NgZone])
|
|
145
152
|
], NavigationService);
|
|
146
153
|
return NavigationService;
|
|
147
154
|
}());
|
|
@@ -77,10 +77,15 @@ var WindowComponent = /** @class */ (function () {
|
|
|
77
77
|
* two-way binding of the `state` property.
|
|
78
78
|
*/
|
|
79
79
|
this.stateChange = new EventEmitter();
|
|
80
|
+
/**
|
|
81
|
+
* @hidden
|
|
82
|
+
*/
|
|
83
|
+
this.messages = {};
|
|
80
84
|
this.tabIndex = 0;
|
|
81
85
|
this.draged = false;
|
|
82
86
|
this.resized = false;
|
|
83
87
|
this.windowSubscription = new Subscription();
|
|
88
|
+
this.domSubs = new Subscription();
|
|
84
89
|
validatePackage(packageMetadata);
|
|
85
90
|
this.direction = this.localization.rtl ? 'rtl' : 'ltr';
|
|
86
91
|
this.localizationChangeSubscription = this.localization.changes
|
|
@@ -322,6 +327,7 @@ var WindowComponent = /** @class */ (function () {
|
|
|
322
327
|
this.ngZone.runOutsideAngular(function () {
|
|
323
328
|
return Promise.resolve(null).then(function () { return _this.setInitialOffset(); });
|
|
324
329
|
});
|
|
330
|
+
this.initDomEvents();
|
|
325
331
|
};
|
|
326
332
|
WindowComponent.prototype.ngOnInit = function () {
|
|
327
333
|
this.renderer.removeAttribute(this.el.nativeElement, 'title');
|
|
@@ -357,6 +363,9 @@ var WindowComponent = /** @class */ (function () {
|
|
|
357
363
|
if (this.windowSubscription) {
|
|
358
364
|
this.windowSubscription.unsubscribe();
|
|
359
365
|
}
|
|
366
|
+
if (this.domSubs) {
|
|
367
|
+
this.domSubs.unsubscribe();
|
|
368
|
+
}
|
|
360
369
|
this.localizationChangeSubscription.unsubscribe();
|
|
361
370
|
};
|
|
362
371
|
/**
|
|
@@ -442,14 +451,6 @@ var WindowComponent = /** @class */ (function () {
|
|
|
442
451
|
enumerable: true,
|
|
443
452
|
configurable: true
|
|
444
453
|
});
|
|
445
|
-
/**
|
|
446
|
-
* @hidden
|
|
447
|
-
*/
|
|
448
|
-
WindowComponent.prototype.onComponentKeydown = function (event) {
|
|
449
|
-
if (hasClasses(event.target, WINDOW_CLASSES)) {
|
|
450
|
-
this.navigation.process(event);
|
|
451
|
-
}
|
|
452
|
-
};
|
|
453
454
|
/**
|
|
454
455
|
* @hidden
|
|
455
456
|
*/
|
|
@@ -524,6 +525,22 @@ var WindowComponent = /** @class */ (function () {
|
|
|
524
525
|
}
|
|
525
526
|
}));
|
|
526
527
|
};
|
|
528
|
+
WindowComponent.prototype.initDomEvents = function () {
|
|
529
|
+
var _this = this;
|
|
530
|
+
if (!this.el) {
|
|
531
|
+
return;
|
|
532
|
+
}
|
|
533
|
+
this.ngZone.runOutsideAngular(function () {
|
|
534
|
+
_this.domSubs.add(_this.renderer.listen(_this.el.nativeElement, 'keydown', function (ev) {
|
|
535
|
+
_this.onKeyDown(ev);
|
|
536
|
+
}));
|
|
537
|
+
});
|
|
538
|
+
};
|
|
539
|
+
WindowComponent.prototype.onKeyDown = function (event) {
|
|
540
|
+
if (hasClasses(event.target, WINDOW_CLASSES)) {
|
|
541
|
+
this.navigation.process(event);
|
|
542
|
+
}
|
|
543
|
+
};
|
|
527
544
|
WindowComponent.prototype.setServiceClasses = function (prevValue, value) {
|
|
528
545
|
var _this = this;
|
|
529
546
|
var el = this.el.nativeElement;
|
|
@@ -752,12 +769,6 @@ var WindowComponent = /** @class */ (function () {
|
|
|
752
769
|
tslib_1.__metadata("design:type", Boolean),
|
|
753
770
|
tslib_1.__metadata("design:paramtypes", [])
|
|
754
771
|
], WindowComponent.prototype, "wrapperMinimizedClass", null);
|
|
755
|
-
tslib_1.__decorate([
|
|
756
|
-
HostListener('keydown', ['$event']),
|
|
757
|
-
tslib_1.__metadata("design:type", Function),
|
|
758
|
-
tslib_1.__metadata("design:paramtypes", [Object]),
|
|
759
|
-
tslib_1.__metadata("design:returntype", void 0)
|
|
760
|
-
], WindowComponent.prototype, "onComponentKeydown", null);
|
|
761
772
|
tslib_1.__decorate([
|
|
762
773
|
HostListener('focus'),
|
|
763
774
|
tslib_1.__metadata("design:type", Function),
|
|
@@ -12,10 +12,10 @@ import { DialogAction } from './dialog-settings';
|
|
|
12
12
|
* Represents the [Kendo UI Dialog component for Angular]({% slug overview_dialog_dialogs %}).
|
|
13
13
|
*/
|
|
14
14
|
export declare class DialogComponent implements AfterContentInit, AfterViewInit, OnInit, OnDestroy {
|
|
15
|
-
private
|
|
16
|
-
private
|
|
15
|
+
private wrapper;
|
|
16
|
+
private renderer;
|
|
17
17
|
private cdr;
|
|
18
|
-
private
|
|
18
|
+
private ngZone;
|
|
19
19
|
/**
|
|
20
20
|
* Specifies the action buttons that will be rendered.
|
|
21
21
|
*/
|
|
@@ -115,11 +115,8 @@ export declare class DialogComponent implements AfterContentInit, AfterViewInit,
|
|
|
115
115
|
private _cssClass;
|
|
116
116
|
private direction;
|
|
117
117
|
private subscriptions;
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
* @hidden
|
|
121
|
-
*/
|
|
122
|
-
onComponentKeydown(event: any): void;
|
|
118
|
+
private domSubs;
|
|
119
|
+
constructor(wrapper: ElementRef, renderer: Renderer2, localization: LocalizationService, cdr: ChangeDetectorRef, ngZone: NgZone);
|
|
123
120
|
ngAfterContentInit(): void;
|
|
124
121
|
ngAfterViewInit(): void;
|
|
125
122
|
ngOnInit(): void;
|
|
@@ -128,6 +125,8 @@ export declare class DialogComponent implements AfterContentInit, AfterViewInit,
|
|
|
128
125
|
* Focuses the wrapper of the Dialog component.
|
|
129
126
|
*/
|
|
130
127
|
focus(): void;
|
|
128
|
+
private initDomEvents;
|
|
129
|
+
private onKeyDown;
|
|
131
130
|
private setServiceClasses;
|
|
132
131
|
/**
|
|
133
132
|
* @hidden
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as tslib_1 from "tslib";
|
|
6
|
-
import { Component, EventEmitter, HostBinding, Input, ViewChild, Output, ElementRef, Renderer2,
|
|
6
|
+
import { Component, EventEmitter, HostBinding, Input, ViewChild, Output, ElementRef, Renderer2, ChangeDetectorRef, NgZone, ContentChildren, QueryList, ViewChildren } from '@angular/core';
|
|
7
7
|
import { animate, state, style, transition, trigger } from '@angular/animations';
|
|
8
8
|
import { DialogActionsComponent } from './dialog-actions.component';
|
|
9
9
|
import { DialogTitleBarComponent } from './dialog-titlebar.component';
|
|
@@ -14,15 +14,16 @@ import { hasClasses, Keys, isPresent, focusableSelector, isFocusable, DIALOG_ELE
|
|
|
14
14
|
import { DialogCloseResult } from './dialog-settings';
|
|
15
15
|
import { DIALOG_LOCALIZATION_SERVICE } from './../localization/dialog-localization.service';
|
|
16
16
|
import { take } from 'rxjs/operators';
|
|
17
|
+
import { Subscription } from 'rxjs';
|
|
17
18
|
/**
|
|
18
19
|
* Represents the [Kendo UI Dialog component for Angular]({% slug overview_dialog_dialogs %}).
|
|
19
20
|
*/
|
|
20
21
|
let DialogComponent = class DialogComponent {
|
|
21
|
-
constructor(
|
|
22
|
-
this.
|
|
23
|
-
this.
|
|
22
|
+
constructor(wrapper, renderer, localization, cdr, ngZone) {
|
|
23
|
+
this.wrapper = wrapper;
|
|
24
|
+
this.renderer = renderer;
|
|
24
25
|
this.cdr = cdr;
|
|
25
|
-
this.
|
|
26
|
+
this.ngZone = ngZone;
|
|
26
27
|
/**
|
|
27
28
|
* Specifies the layout of the action buttons in the Dialog.
|
|
28
29
|
* This option is only applicable if the action buttons are specified through the `actions` options.
|
|
@@ -49,6 +50,7 @@ let DialogComponent = class DialogComponent {
|
|
|
49
50
|
this.close = new EventEmitter();
|
|
50
51
|
this.tabIndex = 0;
|
|
51
52
|
this.subscriptions = [];
|
|
53
|
+
this.domSubs = new Subscription();
|
|
52
54
|
validatePackage(packageMetadata);
|
|
53
55
|
this.direction = localization.rtl ? 'rtl' : 'ltr';
|
|
54
56
|
this.subscriptions.push(localization.changes.subscribe(({ rtl }) => (this.direction = rtl ? 'rtl' : 'ltr')));
|
|
@@ -59,8 +61,8 @@ let DialogComponent = class DialogComponent {
|
|
|
59
61
|
* @hidden
|
|
60
62
|
*/
|
|
61
63
|
set htmlAttributes(attributes) {
|
|
62
|
-
setHTMLAttributes(attributes, this.
|
|
63
|
-
const el = this.
|
|
64
|
+
setHTMLAttributes(attributes, this.renderer, this.wrapper.nativeElement);
|
|
65
|
+
const el = this.wrapper.nativeElement;
|
|
64
66
|
const dir = el.getAttribute('dir');
|
|
65
67
|
const tIndex = el.getAttribute('tabindex');
|
|
66
68
|
if (this.direction !== dir) {
|
|
@@ -87,29 +89,9 @@ let DialogComponent = class DialogComponent {
|
|
|
87
89
|
get dir() {
|
|
88
90
|
return this.direction;
|
|
89
91
|
}
|
|
90
|
-
/**
|
|
91
|
-
* @hidden
|
|
92
|
-
*/
|
|
93
|
-
onComponentKeydown(event) {
|
|
94
|
-
const target = event.target;
|
|
95
|
-
const parent = target.parentElement;
|
|
96
|
-
if (hasClasses(target, DIALOG_ELEMENTS_HANDLING_ESC_KEY) || hasClasses(parent, DIALOG_ELEMENTS_HANDLING_ESC_KEY)) {
|
|
97
|
-
if (event.keyCode === Keys.esc) {
|
|
98
|
-
this.close.emit(new DialogCloseResult());
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
if (hasClasses(target, 'k-button') &&
|
|
102
|
-
hasClasses(parent, DIALOG_ELEMENTS_HANDLING_ARROWS) &&
|
|
103
|
-
(event.keyCode === Keys.left || event.keyCode === Keys.right)) {
|
|
104
|
-
this.handleActionButtonFocus(parent, event.keyCode);
|
|
105
|
-
}
|
|
106
|
-
if (event.keyCode === Keys.tab) {
|
|
107
|
-
this.keepFocusWithinComponent(target, event);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
92
|
ngAfterContentInit() {
|
|
111
93
|
this.bubble('close', this.titlebarContent.first);
|
|
112
|
-
this.
|
|
94
|
+
this.renderer.setAttribute(this.wrapper.nativeElement.querySelector('.k-dialog'), 'aria-describedby', this.contentId);
|
|
113
95
|
if (this.titlebarContent.first) {
|
|
114
96
|
this.titlebarContent.first.id = this.titleId;
|
|
115
97
|
}
|
|
@@ -117,9 +99,9 @@ let DialogComponent = class DialogComponent {
|
|
|
117
99
|
this.subscriptions.push(this.titlebarContent.changes.subscribe(() => {
|
|
118
100
|
if (isPresent(this.titlebarContent.first)) {
|
|
119
101
|
this.titlebarContent.first.id = this.titleId;
|
|
120
|
-
this.
|
|
102
|
+
this.ngZone.onStable.pipe(take(1)).subscribe(() => {
|
|
121
103
|
this.bubble('close', this.titlebarContent.first);
|
|
122
|
-
this.
|
|
104
|
+
this.renderer.setAttribute(this.wrapper.nativeElement.querySelector('.k-dialog'), 'aria-labelledby', this.titleId);
|
|
123
105
|
});
|
|
124
106
|
}
|
|
125
107
|
}));
|
|
@@ -131,47 +113,83 @@ let DialogComponent = class DialogComponent {
|
|
|
131
113
|
this.bubble('action', this.actionsView);
|
|
132
114
|
if (this.titlebarView.first || this.titlebarContent.first) {
|
|
133
115
|
//Needed for Dialogs created via service
|
|
134
|
-
this.
|
|
116
|
+
this.renderer.setAttribute(this.wrapper.nativeElement.querySelector('.k-dialog'), 'aria-labelledby', this.titleId);
|
|
135
117
|
}
|
|
136
118
|
else {
|
|
137
119
|
this.subscriptions.push(this.titlebarView.changes.subscribe(() => {
|
|
138
120
|
if (isPresent(this.titlebarView.first)) {
|
|
139
121
|
this.titlebarView.first.id = this.titleId;
|
|
140
|
-
this.
|
|
122
|
+
this.ngZone.onStable.pipe(take(1)).subscribe(() => {
|
|
141
123
|
this.bubble('close', this.titlebarView.first);
|
|
142
|
-
this.
|
|
124
|
+
this.renderer.setAttribute(this.wrapper.nativeElement.querySelector('.k-dialog'), 'aria-labelledby', this.titleId);
|
|
143
125
|
});
|
|
144
126
|
}
|
|
145
127
|
}));
|
|
146
128
|
}
|
|
129
|
+
this.initDomEvents();
|
|
147
130
|
}
|
|
148
131
|
ngOnInit() {
|
|
149
|
-
this.
|
|
132
|
+
this.renderer.removeAttribute(this.wrapper.nativeElement, 'title');
|
|
150
133
|
this.cdr.detectChanges();
|
|
151
134
|
}
|
|
152
135
|
ngOnDestroy() {
|
|
153
136
|
this.subscriptions.forEach(s => s.unsubscribe());
|
|
154
137
|
this.subscriptions = [];
|
|
138
|
+
if (this.domSubs) {
|
|
139
|
+
this.domSubs.unsubscribe();
|
|
140
|
+
}
|
|
155
141
|
}
|
|
156
142
|
/**
|
|
157
143
|
* Focuses the wrapper of the Dialog component.
|
|
158
144
|
*/
|
|
159
145
|
focus() {
|
|
160
|
-
const wrapper = this.
|
|
146
|
+
const wrapper = this.wrapper.nativeElement;
|
|
161
147
|
if (isPresent(wrapper)) {
|
|
162
148
|
wrapper.focus();
|
|
163
149
|
}
|
|
164
150
|
}
|
|
151
|
+
initDomEvents() {
|
|
152
|
+
if (!this.wrapper) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
this.ngZone.runOutsideAngular(() => {
|
|
156
|
+
this.domSubs.add(this.renderer.listen(this.wrapper.nativeElement, 'keydown', (ev) => {
|
|
157
|
+
this.onKeyDown(ev);
|
|
158
|
+
}));
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
onKeyDown(event) {
|
|
162
|
+
const target = event.target;
|
|
163
|
+
const parent = target.parentElement;
|
|
164
|
+
if (hasClasses(target, DIALOG_ELEMENTS_HANDLING_ESC_KEY) || hasClasses(parent, DIALOG_ELEMENTS_HANDLING_ESC_KEY)) {
|
|
165
|
+
if (event.keyCode === Keys.esc) {
|
|
166
|
+
this.ngZone.run(() => {
|
|
167
|
+
this.close.emit(new DialogCloseResult());
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
if (hasClasses(target, 'k-button') && hasClasses(parent, DIALOG_ELEMENTS_HANDLING_ARROWS) &&
|
|
172
|
+
(event.keyCode === Keys.left || event.keyCode === Keys.right)) {
|
|
173
|
+
this.ngZone.run(() => {
|
|
174
|
+
this.handleActionButtonFocus(parent, event.keyCode);
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
if (event.keyCode === Keys.tab) {
|
|
178
|
+
this.ngZone.run(() => {
|
|
179
|
+
this.keepFocusWithinComponent(target, event);
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
}
|
|
165
183
|
setServiceClasses(prevValue, value) {
|
|
166
|
-
const el = this.
|
|
184
|
+
const el = this.wrapper.nativeElement;
|
|
167
185
|
if (prevValue) {
|
|
168
186
|
parseCSSClassNames(prevValue).forEach(className => {
|
|
169
|
-
this.
|
|
187
|
+
this.renderer.removeClass(el, className);
|
|
170
188
|
});
|
|
171
189
|
}
|
|
172
190
|
if (value) {
|
|
173
191
|
parseCSSClassNames(value).forEach(className => {
|
|
174
|
-
this.
|
|
192
|
+
this.renderer.addClass(el, className);
|
|
175
193
|
});
|
|
176
194
|
}
|
|
177
195
|
}
|
|
@@ -179,7 +197,7 @@ let DialogComponent = class DialogComponent {
|
|
|
179
197
|
* @hidden
|
|
180
198
|
*/
|
|
181
199
|
handleInitialFocus() {
|
|
182
|
-
const wrapper = this.
|
|
200
|
+
const wrapper = this.wrapper.nativeElement;
|
|
183
201
|
const primaryButton = wrapper.querySelector('.k-primary');
|
|
184
202
|
if (this.autoFocusedElement) {
|
|
185
203
|
const initiallyFocusedElement = wrapper.querySelector(this.autoFocusedElement);
|
|
@@ -217,7 +235,7 @@ let DialogComponent = class DialogComponent {
|
|
|
217
235
|
* @hidden
|
|
218
236
|
*/
|
|
219
237
|
keepFocusWithinComponent(target, event) {
|
|
220
|
-
const wrapper = this.
|
|
238
|
+
const wrapper = this.wrapper.nativeElement;
|
|
221
239
|
const [firstFocusable, lastFocusable] = this.getFirstAndLastFocusable(wrapper);
|
|
222
240
|
const tabAfterLastFocusable = !event.shiftKey && target === lastFocusable;
|
|
223
241
|
const shiftTabAfterFirstFocusable = event.shiftKey && target === firstFocusable;
|
|
@@ -365,12 +383,6 @@ tslib_1.__decorate([
|
|
|
365
383
|
ViewChild(DialogActionsComponent, { static: false }),
|
|
366
384
|
tslib_1.__metadata("design:type", DialogActionsComponent)
|
|
367
385
|
], DialogComponent.prototype, "actionsView", void 0);
|
|
368
|
-
tslib_1.__decorate([
|
|
369
|
-
HostListener('keydown', ['$event']),
|
|
370
|
-
tslib_1.__metadata("design:type", Function),
|
|
371
|
-
tslib_1.__metadata("design:paramtypes", [Object]),
|
|
372
|
-
tslib_1.__metadata("design:returntype", void 0)
|
|
373
|
-
], DialogComponent.prototype, "onComponentKeydown", null);
|
|
374
386
|
tslib_1.__decorate([
|
|
375
387
|
HostBinding('class.k-dialog-wrapper'),
|
|
376
388
|
tslib_1.__metadata("design:type", Boolean),
|