@progress/kendo-angular-dialog 5.1.1 → 5.2.0
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/common/util.js +66 -1
- package/dist/es/dialog/dialog-titlebar.component.js +1 -1
- package/dist/es/dialog/dialog.component.js +93 -26
- package/dist/es/dialog/dialog.service.js +2 -0
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/window/window.component.js +52 -2
- package/dist/es/window/window.service.js +6 -0
- package/dist/es2015/common/util.d.ts +21 -0
- package/dist/es2015/common/util.js +66 -1
- package/dist/es2015/dialog/dialog-settings.d.ts +12 -0
- package/dist/es2015/dialog/dialog-titlebar.component.js +1 -1
- package/dist/es2015/dialog/dialog.component.d.ts +26 -6
- package/dist/es2015/dialog/dialog.component.js +84 -26
- package/dist/es2015/dialog/dialog.service.js +2 -0
- package/dist/es2015/index.metadata.json +1 -1
- package/dist/es2015/package-metadata.js +1 -1
- package/dist/es2015/window/window-settings.d.ts +12 -0
- package/dist/es2015/window/window.component.d.ts +13 -0
- package/dist/es2015/window/window.component.js +43 -2
- package/dist/es2015/window/window.service.js +6 -0
- package/dist/fesm2015/index.js +197 -28
- package/dist/fesm5/index.js +215 -28
- package/dist/npm/common/util.js +68 -0
- package/dist/npm/dialog/dialog-titlebar.component.js +1 -1
- package/dist/npm/dialog/dialog.component.js +91 -24
- package/dist/npm/dialog/dialog.service.js +2 -0
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/window/window.component.js +51 -1
- package/dist/npm/window/window.service.js +6 -0
- package/dist/systemjs/kendo-angular-dialog.js +1 -1
- package/package.json +1 -1
|
@@ -3,14 +3,14 @@
|
|
|
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, HostListener, ChangeDetectorRef, NgZone, ContentChildren, QueryList } from '@angular/core';
|
|
6
|
+
import { Component, EventEmitter, HostBinding, Input, ViewChild, Output, ElementRef, Renderer2, HostListener, 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';
|
|
10
10
|
import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
|
|
11
11
|
import { validatePackage } from '@progress/kendo-licensing';
|
|
12
12
|
import { packageMetadata } from '../package-metadata';
|
|
13
|
-
import { hasClasses, Keys, isPresent, focusableSelector, isFocusable, DIALOG_ELEMENTS_HANDLING_ARROWS, DIALOG_ELEMENTS_HANDLING_ESC_KEY, createValueWithUnit } from '../common/util';
|
|
13
|
+
import { hasClasses, Keys, isPresent, focusableSelector, isFocusable, DIALOG_ELEMENTS_HANDLING_ARROWS, DIALOG_ELEMENTS_HANDLING_ESC_KEY, createValueWithUnit, setHTMLAttributes, parseCSSClassNames } from '../common/util';
|
|
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';
|
|
@@ -34,13 +34,17 @@ let DialogComponent = class DialogComponent {
|
|
|
34
34
|
* @hidden
|
|
35
35
|
*/
|
|
36
36
|
this.titleId = null;
|
|
37
|
+
/**
|
|
38
|
+
* @hidden
|
|
39
|
+
*/
|
|
40
|
+
this.contentId = null;
|
|
37
41
|
/**
|
|
38
42
|
* Fires when the user clicks an action button of the Dialog.
|
|
39
43
|
* The event is fired only when the action buttons are specified through the `actions` options.
|
|
40
44
|
*/
|
|
41
45
|
this.action = new EventEmitter();
|
|
42
46
|
/**
|
|
43
|
-
* Fires when the user clicks the **Close** button of the Dialog.
|
|
47
|
+
* Fires when the user clicks the **Close** button of the Dialog or the **ESC** key.
|
|
44
48
|
*/
|
|
45
49
|
this.close = new EventEmitter();
|
|
46
50
|
this.tabIndex = 0;
|
|
@@ -49,6 +53,36 @@ let DialogComponent = class DialogComponent {
|
|
|
49
53
|
this.direction = localization.rtl ? 'rtl' : 'ltr';
|
|
50
54
|
this.subscriptions.push(localization.changes.subscribe(({ rtl }) => (this.direction = rtl ? 'rtl' : 'ltr')));
|
|
51
55
|
this.titleId = this.generateTitleId();
|
|
56
|
+
this.contentId = this.generateContentId();
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* @hidden
|
|
60
|
+
*/
|
|
61
|
+
set htmlAttributes(attributes) {
|
|
62
|
+
setHTMLAttributes(attributes, this._renderer, this._elRef.nativeElement);
|
|
63
|
+
const el = this._elRef.nativeElement;
|
|
64
|
+
const dir = el.getAttribute('dir');
|
|
65
|
+
const tIndex = el.getAttribute('tabindex');
|
|
66
|
+
if (this.direction !== dir) {
|
|
67
|
+
this.direction = dir;
|
|
68
|
+
}
|
|
69
|
+
if (this.tabIndex !== tIndex) {
|
|
70
|
+
this.tabIndex = tIndex;
|
|
71
|
+
}
|
|
72
|
+
this._htmlAttributes = attributes;
|
|
73
|
+
}
|
|
74
|
+
get htmlAttributes() {
|
|
75
|
+
return this._htmlAttributes;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* @hidden
|
|
79
|
+
*/
|
|
80
|
+
set cssClass(classes) {
|
|
81
|
+
this.setServiceClasses(this._cssClass, classes);
|
|
82
|
+
this._cssClass = classes;
|
|
83
|
+
}
|
|
84
|
+
get cssClass() {
|
|
85
|
+
return this._cssClass;
|
|
52
86
|
}
|
|
53
87
|
get dir() {
|
|
54
88
|
return this.direction;
|
|
@@ -75,6 +109,7 @@ let DialogComponent = class DialogComponent {
|
|
|
75
109
|
}
|
|
76
110
|
ngAfterContentInit() {
|
|
77
111
|
this.bubble('close', this.titlebarContent.first);
|
|
112
|
+
this._renderer.setAttribute(this._elRef.nativeElement.querySelector('.k-dialog'), 'aria-describedby', this.contentId);
|
|
78
113
|
if (this.titlebarContent.first) {
|
|
79
114
|
this.titlebarContent.first.id = this.titleId;
|
|
80
115
|
}
|
|
@@ -90,22 +125,25 @@ let DialogComponent = class DialogComponent {
|
|
|
90
125
|
}));
|
|
91
126
|
}
|
|
92
127
|
}
|
|
93
|
-
ngOnChanges(changes) {
|
|
94
|
-
if (changes.title && changes.title.currentValue && !changes.title.previousValue) {
|
|
95
|
-
this.zone.onStable.pipe(take(1)).subscribe(() => {
|
|
96
|
-
this.bubble('close', this.titlebarView);
|
|
97
|
-
this._renderer.setAttribute(this._elRef.nativeElement.querySelector('.k-dialog'), 'aria-labelledby', this.titleId);
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
128
|
ngAfterViewInit() {
|
|
102
129
|
this.handleInitialFocus();
|
|
103
|
-
this.bubble('close', this.titlebarView);
|
|
130
|
+
this.bubble('close', this.titlebarView.first);
|
|
104
131
|
this.bubble('action', this.actionsView);
|
|
105
|
-
if (this.titlebarView || this.titlebarContent.first) {
|
|
132
|
+
if (this.titlebarView.first || this.titlebarContent.first) {
|
|
106
133
|
//Needed for Dialogs created via service
|
|
107
134
|
this._renderer.setAttribute(this._elRef.nativeElement.querySelector('.k-dialog'), 'aria-labelledby', this.titleId);
|
|
108
135
|
}
|
|
136
|
+
else {
|
|
137
|
+
this.subscriptions.push(this.titlebarView.changes.subscribe(() => {
|
|
138
|
+
if (isPresent(this.titlebarView.first)) {
|
|
139
|
+
this.titlebarView.first.id = this.titleId;
|
|
140
|
+
this.zone.onStable.pipe(take(1)).subscribe(() => {
|
|
141
|
+
this.bubble('close', this.titlebarView.first);
|
|
142
|
+
this._renderer.setAttribute(this._elRef.nativeElement.querySelector('.k-dialog'), 'aria-labelledby', this.titleId);
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
}));
|
|
146
|
+
}
|
|
109
147
|
}
|
|
110
148
|
ngOnInit() {
|
|
111
149
|
this._renderer.removeAttribute(this._elRef.nativeElement, 'title');
|
|
@@ -124,6 +162,19 @@ let DialogComponent = class DialogComponent {
|
|
|
124
162
|
wrapper.focus();
|
|
125
163
|
}
|
|
126
164
|
}
|
|
165
|
+
setServiceClasses(prevValue, value) {
|
|
166
|
+
const el = this._elRef.nativeElement;
|
|
167
|
+
if (prevValue) {
|
|
168
|
+
parseCSSClassNames(prevValue).forEach(className => {
|
|
169
|
+
this._renderer.removeClass(el, className);
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
if (value) {
|
|
173
|
+
parseCSSClassNames(value).forEach(className => {
|
|
174
|
+
this._renderer.addClass(el, className);
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
}
|
|
127
178
|
/**
|
|
128
179
|
* @hidden
|
|
129
180
|
*/
|
|
@@ -166,16 +217,15 @@ let DialogComponent = class DialogComponent {
|
|
|
166
217
|
* @hidden
|
|
167
218
|
*/
|
|
168
219
|
keepFocusWithinComponent(target, event) {
|
|
169
|
-
const
|
|
170
|
-
const lastFocusable = this.
|
|
171
|
-
const
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
if (tabBeforeFirstFocusable || tabWithNoFocusable) {
|
|
220
|
+
const wrapper = this._elRef.nativeElement;
|
|
221
|
+
const [firstFocusable, lastFocusable] = this.getFirstAndLastFocusable(wrapper);
|
|
222
|
+
const tabAfterLastFocusable = !event.shiftKey && target === lastFocusable;
|
|
223
|
+
const shiftTabAfterFirstFocusable = event.shiftKey && target === firstFocusable;
|
|
224
|
+
if (tabAfterLastFocusable) {
|
|
175
225
|
event.preventDefault();
|
|
176
226
|
firstFocusable.focus();
|
|
177
227
|
}
|
|
178
|
-
if (
|
|
228
|
+
if (shiftTabAfterFirstFocusable) {
|
|
179
229
|
event.preventDefault();
|
|
180
230
|
lastFocusable.focus();
|
|
181
231
|
}
|
|
@@ -195,9 +245,11 @@ let DialogComponent = class DialogComponent {
|
|
|
195
245
|
/**
|
|
196
246
|
* @hidden
|
|
197
247
|
*/
|
|
198
|
-
|
|
248
|
+
getFirstAndLastFocusable(parent) {
|
|
199
249
|
const all = this.getAllFocusableChildren(parent);
|
|
200
|
-
|
|
250
|
+
const firstFocusable = all.length > 0 ? all[0] : parent;
|
|
251
|
+
const lastFocusable = all.length > 0 ? all[all.length - 1] : parent;
|
|
252
|
+
return [firstFocusable, lastFocusable];
|
|
201
253
|
}
|
|
202
254
|
/**
|
|
203
255
|
* @hidden
|
|
@@ -205,6 +257,12 @@ let DialogComponent = class DialogComponent {
|
|
|
205
257
|
generateTitleId() {
|
|
206
258
|
return 'kendo-dialog-title-' + Math.ceil(Math.random() * 1000000).toString();
|
|
207
259
|
}
|
|
260
|
+
/**
|
|
261
|
+
* @hidden
|
|
262
|
+
*/
|
|
263
|
+
generateContentId() {
|
|
264
|
+
return 'kendo-dialog-content-' + Math.ceil(Math.random() * 1000000).toString();
|
|
265
|
+
}
|
|
208
266
|
get wrapperClass() {
|
|
209
267
|
return true;
|
|
210
268
|
}
|
|
@@ -300,8 +358,8 @@ tslib_1.__decorate([
|
|
|
300
358
|
tslib_1.__metadata("design:type", QueryList)
|
|
301
359
|
], DialogComponent.prototype, "titlebarContent", void 0);
|
|
302
360
|
tslib_1.__decorate([
|
|
303
|
-
|
|
304
|
-
tslib_1.__metadata("design:type",
|
|
361
|
+
ViewChildren(DialogTitleBarComponent),
|
|
362
|
+
tslib_1.__metadata("design:type", QueryList)
|
|
305
363
|
], DialogComponent.prototype, "titlebarView", void 0);
|
|
306
364
|
tslib_1.__decorate([
|
|
307
365
|
ViewChild(DialogActionsComponent, { static: false }),
|
|
@@ -351,11 +409,11 @@ DialogComponent = tslib_1.__decorate([
|
|
|
351
409
|
>
|
|
352
410
|
<div class="k-overlay" @overlayAppear></div>
|
|
353
411
|
|
|
354
|
-
<div class="k-
|
|
412
|
+
<div class="k-window k-dialog" role="dialog" aria-modal="true" [ngStyle]="styles" @dialogSlideInAppear>
|
|
355
413
|
<kendo-dialog-titlebar *ngIf="title" [closeTitle]="closeTitle" [id]="titleId">{{ title }}</kendo-dialog-titlebar>
|
|
356
414
|
<ng-content select="kendo-dialog-titlebar" *ngIf="!title"></ng-content>
|
|
357
415
|
|
|
358
|
-
<div class="k-content k-window-content k-dialog-content">
|
|
416
|
+
<div [id]="contentId" class="k-content k-window-content k-dialog-content">
|
|
359
417
|
<ng-content *ngIf="!contentTemplate"></ng-content>
|
|
360
418
|
<ng-template [ngTemplateOutlet]="contentTemplate" *ngIf="contentTemplate"></ng-template>
|
|
361
419
|
</div>
|
|
@@ -178,6 +178,8 @@ See https://www.telerik.com/kendo-angular-ui/components/dialogs/dialog/service/.
|
|
|
178
178
|
instance.maxHeight = options.maxHeight;
|
|
179
179
|
instance.autoFocusedElement = options.autoFocusedElement;
|
|
180
180
|
instance.closeTitle = options.closeTitle;
|
|
181
|
+
instance.cssClass = options.cssClass;
|
|
182
|
+
instance.htmlAttributes = options.htmlAttributes;
|
|
181
183
|
if (options.content instanceof TemplateRef) {
|
|
182
184
|
instance.contentTemplate = options.content;
|
|
183
185
|
}
|