@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';
|
|
@@ -35,13 +35,17 @@ var DialogComponent = /** @class */ (function () {
|
|
|
35
35
|
* @hidden
|
|
36
36
|
*/
|
|
37
37
|
this.titleId = null;
|
|
38
|
+
/**
|
|
39
|
+
* @hidden
|
|
40
|
+
*/
|
|
41
|
+
this.contentId = null;
|
|
38
42
|
/**
|
|
39
43
|
* Fires when the user clicks an action button of the Dialog.
|
|
40
44
|
* The event is fired only when the action buttons are specified through the `actions` options.
|
|
41
45
|
*/
|
|
42
46
|
this.action = new EventEmitter();
|
|
43
47
|
/**
|
|
44
|
-
* Fires when the user clicks the **Close** button of the Dialog.
|
|
48
|
+
* Fires when the user clicks the **Close** button of the Dialog or the **ESC** key.
|
|
45
49
|
*/
|
|
46
50
|
this.close = new EventEmitter();
|
|
47
51
|
this.tabIndex = 0;
|
|
@@ -53,7 +57,45 @@ var DialogComponent = /** @class */ (function () {
|
|
|
53
57
|
return (_this.direction = rtl ? 'rtl' : 'ltr');
|
|
54
58
|
}));
|
|
55
59
|
this.titleId = this.generateTitleId();
|
|
60
|
+
this.contentId = this.generateContentId();
|
|
56
61
|
}
|
|
62
|
+
Object.defineProperty(DialogComponent.prototype, "htmlAttributes", {
|
|
63
|
+
get: function () {
|
|
64
|
+
return this._htmlAttributes;
|
|
65
|
+
},
|
|
66
|
+
/**
|
|
67
|
+
* @hidden
|
|
68
|
+
*/
|
|
69
|
+
set: function (attributes) {
|
|
70
|
+
setHTMLAttributes(attributes, this._renderer, this._elRef.nativeElement);
|
|
71
|
+
var el = this._elRef.nativeElement;
|
|
72
|
+
var dir = el.getAttribute('dir');
|
|
73
|
+
var tIndex = el.getAttribute('tabindex');
|
|
74
|
+
if (this.direction !== dir) {
|
|
75
|
+
this.direction = dir;
|
|
76
|
+
}
|
|
77
|
+
if (this.tabIndex !== tIndex) {
|
|
78
|
+
this.tabIndex = tIndex;
|
|
79
|
+
}
|
|
80
|
+
this._htmlAttributes = attributes;
|
|
81
|
+
},
|
|
82
|
+
enumerable: true,
|
|
83
|
+
configurable: true
|
|
84
|
+
});
|
|
85
|
+
Object.defineProperty(DialogComponent.prototype, "cssClass", {
|
|
86
|
+
get: function () {
|
|
87
|
+
return this._cssClass;
|
|
88
|
+
},
|
|
89
|
+
/**
|
|
90
|
+
* @hidden
|
|
91
|
+
*/
|
|
92
|
+
set: function (classes) {
|
|
93
|
+
this.setServiceClasses(this._cssClass, classes);
|
|
94
|
+
this._cssClass = classes;
|
|
95
|
+
},
|
|
96
|
+
enumerable: true,
|
|
97
|
+
configurable: true
|
|
98
|
+
});
|
|
57
99
|
Object.defineProperty(DialogComponent.prototype, "dir", {
|
|
58
100
|
get: function () {
|
|
59
101
|
return this.direction;
|
|
@@ -84,6 +126,7 @@ var DialogComponent = /** @class */ (function () {
|
|
|
84
126
|
DialogComponent.prototype.ngAfterContentInit = function () {
|
|
85
127
|
var _this = this;
|
|
86
128
|
this.bubble('close', this.titlebarContent.first);
|
|
129
|
+
this._renderer.setAttribute(this._elRef.nativeElement.querySelector('.k-dialog'), 'aria-describedby', this.contentId);
|
|
87
130
|
if (this.titlebarContent.first) {
|
|
88
131
|
this.titlebarContent.first.id = this.titleId;
|
|
89
132
|
}
|
|
@@ -99,23 +142,26 @@ var DialogComponent = /** @class */ (function () {
|
|
|
99
142
|
}));
|
|
100
143
|
}
|
|
101
144
|
};
|
|
102
|
-
DialogComponent.prototype.ngOnChanges = function (changes) {
|
|
103
|
-
var _this = this;
|
|
104
|
-
if (changes.title && changes.title.currentValue && !changes.title.previousValue) {
|
|
105
|
-
this.zone.onStable.pipe(take(1)).subscribe(function () {
|
|
106
|
-
_this.bubble('close', _this.titlebarView);
|
|
107
|
-
_this._renderer.setAttribute(_this._elRef.nativeElement.querySelector('.k-dialog'), 'aria-labelledby', _this.titleId);
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
145
|
DialogComponent.prototype.ngAfterViewInit = function () {
|
|
146
|
+
var _this = this;
|
|
112
147
|
this.handleInitialFocus();
|
|
113
|
-
this.bubble('close', this.titlebarView);
|
|
148
|
+
this.bubble('close', this.titlebarView.first);
|
|
114
149
|
this.bubble('action', this.actionsView);
|
|
115
|
-
if (this.titlebarView || this.titlebarContent.first) {
|
|
150
|
+
if (this.titlebarView.first || this.titlebarContent.first) {
|
|
116
151
|
//Needed for Dialogs created via service
|
|
117
152
|
this._renderer.setAttribute(this._elRef.nativeElement.querySelector('.k-dialog'), 'aria-labelledby', this.titleId);
|
|
118
153
|
}
|
|
154
|
+
else {
|
|
155
|
+
this.subscriptions.push(this.titlebarView.changes.subscribe(function () {
|
|
156
|
+
if (isPresent(_this.titlebarView.first)) {
|
|
157
|
+
_this.titlebarView.first.id = _this.titleId;
|
|
158
|
+
_this.zone.onStable.pipe(take(1)).subscribe(function () {
|
|
159
|
+
_this.bubble('close', _this.titlebarView.first);
|
|
160
|
+
_this._renderer.setAttribute(_this._elRef.nativeElement.querySelector('.k-dialog'), 'aria-labelledby', _this.titleId);
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
}));
|
|
164
|
+
}
|
|
119
165
|
};
|
|
120
166
|
DialogComponent.prototype.ngOnInit = function () {
|
|
121
167
|
this._renderer.removeAttribute(this._elRef.nativeElement, 'title');
|
|
@@ -134,6 +180,20 @@ var DialogComponent = /** @class */ (function () {
|
|
|
134
180
|
wrapper.focus();
|
|
135
181
|
}
|
|
136
182
|
};
|
|
183
|
+
DialogComponent.prototype.setServiceClasses = function (prevValue, value) {
|
|
184
|
+
var _this = this;
|
|
185
|
+
var el = this._elRef.nativeElement;
|
|
186
|
+
if (prevValue) {
|
|
187
|
+
parseCSSClassNames(prevValue).forEach(function (className) {
|
|
188
|
+
_this._renderer.removeClass(el, className);
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
if (value) {
|
|
192
|
+
parseCSSClassNames(value).forEach(function (className) {
|
|
193
|
+
_this._renderer.addClass(el, className);
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
};
|
|
137
197
|
/**
|
|
138
198
|
* @hidden
|
|
139
199
|
*/
|
|
@@ -176,16 +236,15 @@ var DialogComponent = /** @class */ (function () {
|
|
|
176
236
|
* @hidden
|
|
177
237
|
*/
|
|
178
238
|
DialogComponent.prototype.keepFocusWithinComponent = function (target, event) {
|
|
179
|
-
var
|
|
180
|
-
var
|
|
181
|
-
var
|
|
182
|
-
var
|
|
183
|
-
|
|
184
|
-
if (tabBeforeFirstFocusable || tabWithNoFocusable) {
|
|
239
|
+
var wrapper = this._elRef.nativeElement;
|
|
240
|
+
var _a = this.getFirstAndLastFocusable(wrapper), firstFocusable = _a[0], lastFocusable = _a[1];
|
|
241
|
+
var tabAfterLastFocusable = !event.shiftKey && target === lastFocusable;
|
|
242
|
+
var shiftTabAfterFirstFocusable = event.shiftKey && target === firstFocusable;
|
|
243
|
+
if (tabAfterLastFocusable) {
|
|
185
244
|
event.preventDefault();
|
|
186
245
|
firstFocusable.focus();
|
|
187
246
|
}
|
|
188
|
-
if (
|
|
247
|
+
if (shiftTabAfterFirstFocusable) {
|
|
189
248
|
event.preventDefault();
|
|
190
249
|
lastFocusable.focus();
|
|
191
250
|
}
|
|
@@ -205,9 +264,11 @@ var DialogComponent = /** @class */ (function () {
|
|
|
205
264
|
/**
|
|
206
265
|
* @hidden
|
|
207
266
|
*/
|
|
208
|
-
DialogComponent.prototype.
|
|
267
|
+
DialogComponent.prototype.getFirstAndLastFocusable = function (parent) {
|
|
209
268
|
var all = this.getAllFocusableChildren(parent);
|
|
210
|
-
|
|
269
|
+
var firstFocusable = all.length > 0 ? all[0] : parent;
|
|
270
|
+
var lastFocusable = all.length > 0 ? all[all.length - 1] : parent;
|
|
271
|
+
return [firstFocusable, lastFocusable];
|
|
211
272
|
};
|
|
212
273
|
/**
|
|
213
274
|
* @hidden
|
|
@@ -215,6 +276,12 @@ var DialogComponent = /** @class */ (function () {
|
|
|
215
276
|
DialogComponent.prototype.generateTitleId = function () {
|
|
216
277
|
return 'kendo-dialog-title-' + Math.ceil(Math.random() * 1000000).toString();
|
|
217
278
|
};
|
|
279
|
+
/**
|
|
280
|
+
* @hidden
|
|
281
|
+
*/
|
|
282
|
+
DialogComponent.prototype.generateContentId = function () {
|
|
283
|
+
return 'kendo-dialog-content-' + Math.ceil(Math.random() * 1000000).toString();
|
|
284
|
+
};
|
|
218
285
|
Object.defineProperty(DialogComponent.prototype, "wrapperClass", {
|
|
219
286
|
get: function () {
|
|
220
287
|
return true;
|
|
@@ -318,8 +385,8 @@ var DialogComponent = /** @class */ (function () {
|
|
|
318
385
|
tslib_1.__metadata("design:type", QueryList)
|
|
319
386
|
], DialogComponent.prototype, "titlebarContent", void 0);
|
|
320
387
|
tslib_1.__decorate([
|
|
321
|
-
|
|
322
|
-
tslib_1.__metadata("design:type",
|
|
388
|
+
ViewChildren(DialogTitleBarComponent),
|
|
389
|
+
tslib_1.__metadata("design:type", QueryList)
|
|
323
390
|
], DialogComponent.prototype, "titlebarView", void 0);
|
|
324
391
|
tslib_1.__decorate([
|
|
325
392
|
ViewChild(DialogActionsComponent, { static: false }),
|
|
@@ -361,7 +428,7 @@ var DialogComponent = /** @class */ (function () {
|
|
|
361
428
|
}
|
|
362
429
|
],
|
|
363
430
|
selector: 'kendo-dialog',
|
|
364
|
-
template: "\n <ng-container\n kendoDialogLocalizedMessages\n i18n-closeTitle=\"kendo.dialog.closeTitle|The title of the close button\"\n closeTitle=\"Close\"\n >\n <div class=\"k-overlay\" @overlayAppear></div>\n\n <div class=\"k-
|
|
431
|
+
template: "\n <ng-container\n kendoDialogLocalizedMessages\n i18n-closeTitle=\"kendo.dialog.closeTitle|The title of the close button\"\n closeTitle=\"Close\"\n >\n <div class=\"k-overlay\" @overlayAppear></div>\n\n <div class=\"k-window k-dialog\" role=\"dialog\" aria-modal=\"true\" [ngStyle]=\"styles\" @dialogSlideInAppear>\n <kendo-dialog-titlebar *ngIf=\"title\" [closeTitle]=\"closeTitle\" [id]=\"titleId\">{{ title }}</kendo-dialog-titlebar>\n <ng-content select=\"kendo-dialog-titlebar\" *ngIf=\"!title\"></ng-content>\n\n <div [id]=\"contentId\" class=\"k-content k-window-content k-dialog-content\">\n <ng-content *ngIf=\"!contentTemplate\"></ng-content>\n <ng-template [ngTemplateOutlet]=\"contentTemplate\" *ngIf=\"contentTemplate\"></ng-template>\n </div>\n\n <ng-content select=\"kendo-dialog-actions\" *ngIf=\"!actions\"></ng-content>\n <kendo-dialog-actions *ngIf=\"actions\" [actions]=\"actions\" [layout]=\"actionsLayout\"> </kendo-dialog-actions>\n </div>\n </ng-container>\n "
|
|
365
432
|
}),
|
|
366
433
|
tslib_1.__metadata("design:paramtypes", [ElementRef,
|
|
367
434
|
Renderer2,
|
|
@@ -168,6 +168,8 @@ var DialogService = /** @class */ (function () {
|
|
|
168
168
|
instance.maxHeight = options.maxHeight;
|
|
169
169
|
instance.autoFocusedElement = options.autoFocusedElement;
|
|
170
170
|
instance.closeTitle = options.closeTitle;
|
|
171
|
+
instance.cssClass = options.cssClass;
|
|
172
|
+
instance.htmlAttributes = options.htmlAttributes;
|
|
171
173
|
if (options.content instanceof TemplateRef) {
|
|
172
174
|
instance.contentTemplate = options.content;
|
|
173
175
|
}
|
|
@@ -9,7 +9,7 @@ export var packageMetadata = {
|
|
|
9
9
|
name: '@progress/kendo-angular-dialog',
|
|
10
10
|
productName: 'Kendo UI for Angular',
|
|
11
11
|
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
12
|
-
publishDate:
|
|
12
|
+
publishDate: 1634903940,
|
|
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
|
};
|
|
@@ -10,7 +10,7 @@ import { Subscription } from 'rxjs';
|
|
|
10
10
|
import { validatePackage } from '@progress/kendo-licensing';
|
|
11
11
|
import { packageMetadata } from '../package-metadata';
|
|
12
12
|
import { DragResizeService } from './drag-resize.service';
|
|
13
|
-
import { OFFSET_STYLES, isPresent, isTruthy, hasClasses, WINDOW_CLASSES } from '../common/util';
|
|
13
|
+
import { OFFSET_STYLES, isPresent, isTruthy, hasClasses, WINDOW_CLASSES, parseCSSClassNames, setHTMLAttributes } from '../common/util';
|
|
14
14
|
import { RESIZE_DIRECTIONS } from "../common/util";
|
|
15
15
|
import { ResizeHandleDirective } from './window-resize-handle.directive';
|
|
16
16
|
import { WindowTitleBarComponent } from './window-titlebar.component';
|
|
@@ -119,6 +119,43 @@ var WindowComponent = /** @class */ (function () {
|
|
|
119
119
|
enumerable: true,
|
|
120
120
|
configurable: true
|
|
121
121
|
});
|
|
122
|
+
Object.defineProperty(WindowComponent.prototype, "cssClass", {
|
|
123
|
+
get: function () {
|
|
124
|
+
return this._cssClass;
|
|
125
|
+
},
|
|
126
|
+
/**
|
|
127
|
+
* @hidden
|
|
128
|
+
*/
|
|
129
|
+
set: function (classes) {
|
|
130
|
+
this.setServiceClasses(this._cssClass, classes);
|
|
131
|
+
this._cssClass = classes;
|
|
132
|
+
},
|
|
133
|
+
enumerable: true,
|
|
134
|
+
configurable: true
|
|
135
|
+
});
|
|
136
|
+
Object.defineProperty(WindowComponent.prototype, "htmlAttributes", {
|
|
137
|
+
get: function () {
|
|
138
|
+
return this._htmlAttributes;
|
|
139
|
+
},
|
|
140
|
+
/**
|
|
141
|
+
* @hidden
|
|
142
|
+
*/
|
|
143
|
+
set: function (attributes) {
|
|
144
|
+
setHTMLAttributes(attributes, this.renderer, this.el.nativeElement);
|
|
145
|
+
var el = this.el.nativeElement;
|
|
146
|
+
var dir = el.getAttribute('dir');
|
|
147
|
+
var tIndex = el.getAttribute('tabindex');
|
|
148
|
+
if (this.direction !== dir) {
|
|
149
|
+
this.direction = dir;
|
|
150
|
+
}
|
|
151
|
+
if (this.tabIndex !== tIndex) {
|
|
152
|
+
this.tabIndex = tIndex;
|
|
153
|
+
}
|
|
154
|
+
this._htmlAttributes = attributes;
|
|
155
|
+
},
|
|
156
|
+
enumerable: true,
|
|
157
|
+
configurable: true
|
|
158
|
+
});
|
|
122
159
|
Object.defineProperty(WindowComponent.prototype, "state", {
|
|
123
160
|
get: function () {
|
|
124
161
|
return this.options.state;
|
|
@@ -487,6 +524,20 @@ var WindowComponent = /** @class */ (function () {
|
|
|
487
524
|
}
|
|
488
525
|
}));
|
|
489
526
|
};
|
|
527
|
+
WindowComponent.prototype.setServiceClasses = function (prevValue, value) {
|
|
528
|
+
var _this = this;
|
|
529
|
+
var el = this.el.nativeElement;
|
|
530
|
+
if (prevValue) {
|
|
531
|
+
parseCSSClassNames(prevValue).forEach(function (className) {
|
|
532
|
+
_this.renderer.removeClass(el, className);
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
if (value) {
|
|
536
|
+
parseCSSClassNames(value).forEach(function (className) {
|
|
537
|
+
_this.renderer.addClass(el, className);
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
};
|
|
490
541
|
WindowComponent.prototype.setNextZIndex = function () {
|
|
491
542
|
var currentZIndex = this.el.nativeElement.style['z-index'];
|
|
492
543
|
var nextPossibleZIndex = this.service.nextPossibleZIndex;
|
|
@@ -655,7 +706,6 @@ var WindowComponent = /** @class */ (function () {
|
|
|
655
706
|
tslib_1.__metadata("design:type", Number)
|
|
656
707
|
], WindowComponent.prototype, "tabIndex", void 0);
|
|
657
708
|
tslib_1.__decorate([
|
|
658
|
-
HostBinding('class.k-widget'),
|
|
659
709
|
HostBinding('class.k-window'),
|
|
660
710
|
tslib_1.__metadata("design:type", Boolean),
|
|
661
711
|
tslib_1.__metadata("design:paramtypes", [])
|
|
@@ -116,6 +116,12 @@ var WindowService = /** @class */ (function () {
|
|
|
116
116
|
return windowRef;
|
|
117
117
|
};
|
|
118
118
|
WindowService.prototype.applyOptions = function (instance, options) {
|
|
119
|
+
if (isPresent(options.htmlAttributes)) {
|
|
120
|
+
instance.htmlAttributes = options.htmlAttributes;
|
|
121
|
+
}
|
|
122
|
+
if (isPresent(options.cssClass)) {
|
|
123
|
+
instance.cssClass = options.cssClass;
|
|
124
|
+
}
|
|
119
125
|
if (isPresent(options.title)) {
|
|
120
126
|
instance.title = options.title;
|
|
121
127
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { Renderer2 } from '@angular/core';
|
|
5
6
|
import { Observable } from 'rxjs';
|
|
6
7
|
/**
|
|
7
8
|
* @hidden
|
|
@@ -50,6 +51,18 @@ export declare const isVisible: (element: any) => boolean;
|
|
|
50
51
|
* @hidden
|
|
51
52
|
*/
|
|
52
53
|
export declare const isFocusable: (element: any, checkVisibility?: boolean) => boolean;
|
|
54
|
+
/**
|
|
55
|
+
* @hidden
|
|
56
|
+
*/
|
|
57
|
+
export declare const setHTMLAttributes: (attributes: {
|
|
58
|
+
[key: string]: string;
|
|
59
|
+
}, renderer: Renderer2, element: Element) => void;
|
|
60
|
+
/**
|
|
61
|
+
* Receives CSS class declarations either as an object, string or array and returns an array of the class names.
|
|
62
|
+
*
|
|
63
|
+
* @hidden
|
|
64
|
+
*/
|
|
65
|
+
export declare const parseCSSClassNames: (value: any) => string[];
|
|
53
66
|
/**
|
|
54
67
|
* @hidden
|
|
55
68
|
*/
|
|
@@ -80,6 +93,10 @@ export declare const OFFSET_STYLES: Array<string>;
|
|
|
80
93
|
* @hidden
|
|
81
94
|
*/
|
|
82
95
|
export declare const isString: (value: any) => value is string;
|
|
96
|
+
/**
|
|
97
|
+
* @hidden
|
|
98
|
+
*/
|
|
99
|
+
export declare const isObject: (value: any) => value is object;
|
|
83
100
|
/**
|
|
84
101
|
* @hidden
|
|
85
102
|
*/
|
|
@@ -88,3 +105,7 @@ export declare const isNumber: (value: string | number) => boolean;
|
|
|
88
105
|
* @hidden
|
|
89
106
|
*/
|
|
90
107
|
export declare const createValueWithUnit: (value: string | number) => string;
|
|
108
|
+
/**
|
|
109
|
+
* @hidden
|
|
110
|
+
*/
|
|
111
|
+
export declare const splitStringToArray: (value: string) => string[];
|
|
@@ -76,6 +76,63 @@ export const isFocusable = (element, checkVisibility = true) => {
|
|
|
76
76
|
}
|
|
77
77
|
return false;
|
|
78
78
|
};
|
|
79
|
+
/**
|
|
80
|
+
* @hidden
|
|
81
|
+
*/
|
|
82
|
+
export const setHTMLAttributes = (attributes, renderer, element) => {
|
|
83
|
+
for (const attribute in attributes) {
|
|
84
|
+
if (attribute) {
|
|
85
|
+
renderer.setAttribute(element, attribute, attributes[attribute]);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Receives CSS class declarations either as an object, string or array and returns an array of the class names.
|
|
91
|
+
*
|
|
92
|
+
* @hidden
|
|
93
|
+
*/
|
|
94
|
+
export const parseCSSClassNames = (value) => {
|
|
95
|
+
if (isObject(value)) {
|
|
96
|
+
return parseObjectClassNames(value);
|
|
97
|
+
}
|
|
98
|
+
if (isString(value)) {
|
|
99
|
+
return parseStringClassNames(value);
|
|
100
|
+
}
|
|
101
|
+
if (Array.isArray(value)) {
|
|
102
|
+
return parseArrayClassNames(value);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
const parseObjectClassNames = (value) => {
|
|
106
|
+
const classes = [];
|
|
107
|
+
Object.keys(value).forEach(className => {
|
|
108
|
+
const currentClassName = splitStringToArray(className);
|
|
109
|
+
if (value[className] && currentClassName[0]) {
|
|
110
|
+
classes.push(...currentClassName);
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
return classes;
|
|
114
|
+
};
|
|
115
|
+
const ɵ1 = parseObjectClassNames;
|
|
116
|
+
const parseStringClassNames = (value) => {
|
|
117
|
+
const classes = [];
|
|
118
|
+
const classesArray = splitStringToArray(value);
|
|
119
|
+
classesArray.forEach(className => {
|
|
120
|
+
classes.push(className);
|
|
121
|
+
});
|
|
122
|
+
return classes;
|
|
123
|
+
};
|
|
124
|
+
const ɵ2 = parseStringClassNames;
|
|
125
|
+
const parseArrayClassNames = (value) => {
|
|
126
|
+
const classes = [];
|
|
127
|
+
value.forEach((className) => {
|
|
128
|
+
const current = splitStringToArray(className);
|
|
129
|
+
if (current[0]) {
|
|
130
|
+
classes.push(...current);
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
return classes;
|
|
134
|
+
};
|
|
135
|
+
const ɵ3 = parseArrayClassNames;
|
|
79
136
|
/**
|
|
80
137
|
* @hidden
|
|
81
138
|
*/
|
|
@@ -121,6 +178,10 @@ export const OFFSET_STYLES = ['top', 'left', 'width', 'height'];
|
|
|
121
178
|
* @hidden
|
|
122
179
|
*/
|
|
123
180
|
export const isString = (value) => value instanceof String || typeof value === 'string';
|
|
181
|
+
/**
|
|
182
|
+
* @hidden
|
|
183
|
+
*/
|
|
184
|
+
export const isObject = (value) => isPresent(value) && !Array.isArray(value) && typeof value === 'object';
|
|
124
185
|
/**
|
|
125
186
|
* @hidden
|
|
126
187
|
*/
|
|
@@ -129,4 +190,8 @@ export const isNumber = (value) => typeof value === 'number' && isFinite(value);
|
|
|
129
190
|
* @hidden
|
|
130
191
|
*/
|
|
131
192
|
export const createValueWithUnit = (value) => value + (isNumber(value) ? 'px' : '');
|
|
132
|
-
|
|
193
|
+
/**
|
|
194
|
+
* @hidden
|
|
195
|
+
*/
|
|
196
|
+
export const splitStringToArray = (value) => value.trim().replace(/\s+/g, " ").split(' ');
|
|
197
|
+
export { ɵ0, ɵ1, ɵ2, ɵ3 };
|
|
@@ -54,6 +54,18 @@ export declare class DialogSettings {
|
|
|
54
54
|
* the Dialog will not render a **Close** button.
|
|
55
55
|
*/
|
|
56
56
|
title?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Sets the CSS classes that will be rendered on the Dialog wrapper element.
|
|
59
|
+
* Supports the union type of values that NgClass accepts [ngClass]({{ site.data.urls.angular['ngclassapi'] }}).
|
|
60
|
+
*/
|
|
61
|
+
cssClass?: any;
|
|
62
|
+
/**
|
|
63
|
+
* Sets the HTML attributes of the Dialog wrapper element.
|
|
64
|
+
* The property accepts string key-value based pairs.
|
|
65
|
+
*/
|
|
66
|
+
htmlAttributes?: {
|
|
67
|
+
[key: string]: string;
|
|
68
|
+
};
|
|
57
69
|
/**
|
|
58
70
|
* Defines the content of the Dialog.
|
|
59
71
|
* ([see example]({% slug service_dialog %}#toc-using-components)).
|
|
@@ -31,7 +31,7 @@ let DialogTitleBarComponent = class DialogTitleBarComponent {
|
|
|
31
31
|
}
|
|
32
32
|
ngAfterViewInit() {
|
|
33
33
|
this.zone.onStable.pipe(take(1)).subscribe(() => {
|
|
34
|
-
const element = this.hostElement.nativeElement;
|
|
34
|
+
const element = this.hostElement.nativeElement.querySelector('.k-dialog-title');
|
|
35
35
|
element.setAttribute('id', this.id);
|
|
36
36
|
});
|
|
37
37
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { AfterContentInit, AfterViewInit, EventEmitter, OnInit, OnDestroy, ElementRef, TemplateRef, Renderer2, ChangeDetectorRef,
|
|
5
|
+
import { AfterContentInit, AfterViewInit, EventEmitter, OnInit, OnDestroy, ElementRef, TemplateRef, Renderer2, ChangeDetectorRef, NgZone, QueryList } from '@angular/core';
|
|
6
6
|
import { DialogActionsComponent } from './dialog-actions.component';
|
|
7
7
|
import { DialogTitleBarComponent } from './dialog-titlebar.component';
|
|
8
8
|
import { LocalizationService } from '@progress/kendo-angular-l10n';
|
|
@@ -11,7 +11,7 @@ import { DialogAction } from './dialog-settings';
|
|
|
11
11
|
/**
|
|
12
12
|
* Represents the [Kendo UI Dialog component for Angular]({% slug overview_dialog_dialogs %}).
|
|
13
13
|
*/
|
|
14
|
-
export declare class DialogComponent implements AfterContentInit, AfterViewInit, OnInit,
|
|
14
|
+
export declare class DialogComponent implements AfterContentInit, AfterViewInit, OnInit, OnDestroy {
|
|
15
15
|
private _elRef;
|
|
16
16
|
private _renderer;
|
|
17
17
|
private cdr;
|
|
@@ -71,6 +71,16 @@ export declare class DialogComponent implements AfterContentInit, AfterViewInit,
|
|
|
71
71
|
* A string value sets the maximum height in arbitrary units—for example, `50%`.
|
|
72
72
|
*/
|
|
73
73
|
maxHeight: number | string;
|
|
74
|
+
/**
|
|
75
|
+
* @hidden
|
|
76
|
+
*/
|
|
77
|
+
htmlAttributes: {
|
|
78
|
+
[key: string]: string;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* @hidden
|
|
82
|
+
*/
|
|
83
|
+
cssClass: any;
|
|
74
84
|
/**
|
|
75
85
|
* @hidden
|
|
76
86
|
*/
|
|
@@ -79,6 +89,10 @@ export declare class DialogComponent implements AfterContentInit, AfterViewInit,
|
|
|
79
89
|
* @hidden
|
|
80
90
|
*/
|
|
81
91
|
titleId: string;
|
|
92
|
+
/**
|
|
93
|
+
* @hidden
|
|
94
|
+
*/
|
|
95
|
+
contentId: string;
|
|
82
96
|
/**
|
|
83
97
|
* @hidden
|
|
84
98
|
*/
|
|
@@ -89,14 +103,16 @@ export declare class DialogComponent implements AfterContentInit, AfterViewInit,
|
|
|
89
103
|
*/
|
|
90
104
|
action: EventEmitter<DialogAction>;
|
|
91
105
|
/**
|
|
92
|
-
* Fires when the user clicks the **Close** button of the Dialog.
|
|
106
|
+
* Fires when the user clicks the **Close** button of the Dialog or the **ESC** key.
|
|
93
107
|
*/
|
|
94
108
|
close: EventEmitter<any>;
|
|
95
109
|
readonly dir: string;
|
|
96
110
|
tabIndex: number;
|
|
97
111
|
titlebarContent: QueryList<DialogTitleBarComponent>;
|
|
98
|
-
titlebarView: DialogTitleBarComponent
|
|
112
|
+
titlebarView: QueryList<DialogTitleBarComponent>;
|
|
99
113
|
actionsView: DialogActionsComponent;
|
|
114
|
+
private _htmlAttributes;
|
|
115
|
+
private _cssClass;
|
|
100
116
|
private direction;
|
|
101
117
|
private subscriptions;
|
|
102
118
|
constructor(_elRef: ElementRef, _renderer: Renderer2, localization: LocalizationService, cdr: ChangeDetectorRef, zone: NgZone);
|
|
@@ -105,7 +121,6 @@ export declare class DialogComponent implements AfterContentInit, AfterViewInit,
|
|
|
105
121
|
*/
|
|
106
122
|
onComponentKeydown(event: any): void;
|
|
107
123
|
ngAfterContentInit(): void;
|
|
108
|
-
ngOnChanges(changes: SimpleChanges): void;
|
|
109
124
|
ngAfterViewInit(): void;
|
|
110
125
|
ngOnInit(): void;
|
|
111
126
|
ngOnDestroy(): void;
|
|
@@ -113,6 +128,7 @@ export declare class DialogComponent implements AfterContentInit, AfterViewInit,
|
|
|
113
128
|
* Focuses the wrapper of the Dialog component.
|
|
114
129
|
*/
|
|
115
130
|
focus(): void;
|
|
131
|
+
private setServiceClasses;
|
|
116
132
|
/**
|
|
117
133
|
* @hidden
|
|
118
134
|
*/
|
|
@@ -136,11 +152,15 @@ export declare class DialogComponent implements AfterContentInit, AfterViewInit,
|
|
|
136
152
|
/**
|
|
137
153
|
* @hidden
|
|
138
154
|
*/
|
|
139
|
-
private
|
|
155
|
+
private getFirstAndLastFocusable;
|
|
140
156
|
/**
|
|
141
157
|
* @hidden
|
|
142
158
|
*/
|
|
143
159
|
private generateTitleId;
|
|
160
|
+
/**
|
|
161
|
+
* @hidden
|
|
162
|
+
*/
|
|
163
|
+
private generateContentId;
|
|
144
164
|
readonly wrapperClass: boolean;
|
|
145
165
|
readonly styles: any;
|
|
146
166
|
private bubble;
|