@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.
Files changed (33) hide show
  1. package/dist/cdn/js/kendo-angular-dialog.js +1 -1
  2. package/dist/cdn/main.js +1 -1
  3. package/dist/es/common/util.js +66 -1
  4. package/dist/es/dialog/dialog-titlebar.component.js +1 -1
  5. package/dist/es/dialog/dialog.component.js +93 -26
  6. package/dist/es/dialog/dialog.service.js +2 -0
  7. package/dist/es/package-metadata.js +1 -1
  8. package/dist/es/window/window.component.js +52 -2
  9. package/dist/es/window/window.service.js +6 -0
  10. package/dist/es2015/common/util.d.ts +21 -0
  11. package/dist/es2015/common/util.js +66 -1
  12. package/dist/es2015/dialog/dialog-settings.d.ts +12 -0
  13. package/dist/es2015/dialog/dialog-titlebar.component.js +1 -1
  14. package/dist/es2015/dialog/dialog.component.d.ts +26 -6
  15. package/dist/es2015/dialog/dialog.component.js +84 -26
  16. package/dist/es2015/dialog/dialog.service.js +2 -0
  17. package/dist/es2015/index.metadata.json +1 -1
  18. package/dist/es2015/package-metadata.js +1 -1
  19. package/dist/es2015/window/window-settings.d.ts +12 -0
  20. package/dist/es2015/window/window.component.d.ts +13 -0
  21. package/dist/es2015/window/window.component.js +43 -2
  22. package/dist/es2015/window/window.service.js +6 -0
  23. package/dist/fesm2015/index.js +197 -28
  24. package/dist/fesm5/index.js +215 -28
  25. package/dist/npm/common/util.js +68 -0
  26. package/dist/npm/dialog/dialog-titlebar.component.js +1 -1
  27. package/dist/npm/dialog/dialog.component.js +91 -24
  28. package/dist/npm/dialog/dialog.service.js +2 -0
  29. package/dist/npm/package-metadata.js +1 -1
  30. package/dist/npm/window/window.component.js +51 -1
  31. package/dist/npm/window/window.service.js +6 -0
  32. package/dist/systemjs/kendo-angular-dialog.js +1 -1
  33. package/package.json +1 -1
@@ -37,13 +37,17 @@ var DialogComponent = /** @class */ (function () {
37
37
  * @hidden
38
38
  */
39
39
  this.titleId = null;
40
+ /**
41
+ * @hidden
42
+ */
43
+ this.contentId = null;
40
44
  /**
41
45
  * Fires when the user clicks an action button of the Dialog.
42
46
  * The event is fired only when the action buttons are specified through the `actions` options.
43
47
  */
44
48
  this.action = new core_1.EventEmitter();
45
49
  /**
46
- * Fires when the user clicks the **Close** button of the Dialog.
50
+ * Fires when the user clicks the **Close** button of the Dialog or the **ESC** key.
47
51
  */
48
52
  this.close = new core_1.EventEmitter();
49
53
  this.tabIndex = 0;
@@ -55,7 +59,45 @@ var DialogComponent = /** @class */ (function () {
55
59
  return (_this.direction = rtl ? 'rtl' : 'ltr');
56
60
  }));
57
61
  this.titleId = this.generateTitleId();
62
+ this.contentId = this.generateContentId();
58
63
  }
64
+ Object.defineProperty(DialogComponent.prototype, "htmlAttributes", {
65
+ get: function () {
66
+ return this._htmlAttributes;
67
+ },
68
+ /**
69
+ * @hidden
70
+ */
71
+ set: function (attributes) {
72
+ util_1.setHTMLAttributes(attributes, this._renderer, this._elRef.nativeElement);
73
+ var el = this._elRef.nativeElement;
74
+ var dir = el.getAttribute('dir');
75
+ var tIndex = el.getAttribute('tabindex');
76
+ if (this.direction !== dir) {
77
+ this.direction = dir;
78
+ }
79
+ if (this.tabIndex !== tIndex) {
80
+ this.tabIndex = tIndex;
81
+ }
82
+ this._htmlAttributes = attributes;
83
+ },
84
+ enumerable: true,
85
+ configurable: true
86
+ });
87
+ Object.defineProperty(DialogComponent.prototype, "cssClass", {
88
+ get: function () {
89
+ return this._cssClass;
90
+ },
91
+ /**
92
+ * @hidden
93
+ */
94
+ set: function (classes) {
95
+ this.setServiceClasses(this._cssClass, classes);
96
+ this._cssClass = classes;
97
+ },
98
+ enumerable: true,
99
+ configurable: true
100
+ });
59
101
  Object.defineProperty(DialogComponent.prototype, "dir", {
60
102
  get: function () {
61
103
  return this.direction;
@@ -86,6 +128,7 @@ var DialogComponent = /** @class */ (function () {
86
128
  DialogComponent.prototype.ngAfterContentInit = function () {
87
129
  var _this = this;
88
130
  this.bubble('close', this.titlebarContent.first);
131
+ this._renderer.setAttribute(this._elRef.nativeElement.querySelector('.k-dialog'), 'aria-describedby', this.contentId);
89
132
  if (this.titlebarContent.first) {
90
133
  this.titlebarContent.first.id = this.titleId;
91
134
  }
@@ -101,23 +144,26 @@ var DialogComponent = /** @class */ (function () {
101
144
  }));
102
145
  }
103
146
  };
104
- DialogComponent.prototype.ngOnChanges = function (changes) {
105
- var _this = this;
106
- if (changes.title && changes.title.currentValue && !changes.title.previousValue) {
107
- this.zone.onStable.pipe(operators_1.take(1)).subscribe(function () {
108
- _this.bubble('close', _this.titlebarView);
109
- _this._renderer.setAttribute(_this._elRef.nativeElement.querySelector('.k-dialog'), 'aria-labelledby', _this.titleId);
110
- });
111
- }
112
- };
113
147
  DialogComponent.prototype.ngAfterViewInit = function () {
148
+ var _this = this;
114
149
  this.handleInitialFocus();
115
- this.bubble('close', this.titlebarView);
150
+ this.bubble('close', this.titlebarView.first);
116
151
  this.bubble('action', this.actionsView);
117
- if (this.titlebarView || this.titlebarContent.first) {
152
+ if (this.titlebarView.first || this.titlebarContent.first) {
118
153
  //Needed for Dialogs created via service
119
154
  this._renderer.setAttribute(this._elRef.nativeElement.querySelector('.k-dialog'), 'aria-labelledby', this.titleId);
120
155
  }
156
+ else {
157
+ this.subscriptions.push(this.titlebarView.changes.subscribe(function () {
158
+ if (util_1.isPresent(_this.titlebarView.first)) {
159
+ _this.titlebarView.first.id = _this.titleId;
160
+ _this.zone.onStable.pipe(operators_1.take(1)).subscribe(function () {
161
+ _this.bubble('close', _this.titlebarView.first);
162
+ _this._renderer.setAttribute(_this._elRef.nativeElement.querySelector('.k-dialog'), 'aria-labelledby', _this.titleId);
163
+ });
164
+ }
165
+ }));
166
+ }
121
167
  };
122
168
  DialogComponent.prototype.ngOnInit = function () {
123
169
  this._renderer.removeAttribute(this._elRef.nativeElement, 'title');
@@ -136,6 +182,20 @@ var DialogComponent = /** @class */ (function () {
136
182
  wrapper.focus();
137
183
  }
138
184
  };
185
+ DialogComponent.prototype.setServiceClasses = function (prevValue, value) {
186
+ var _this = this;
187
+ var el = this._elRef.nativeElement;
188
+ if (prevValue) {
189
+ util_1.parseCSSClassNames(prevValue).forEach(function (className) {
190
+ _this._renderer.removeClass(el, className);
191
+ });
192
+ }
193
+ if (value) {
194
+ util_1.parseCSSClassNames(value).forEach(function (className) {
195
+ _this._renderer.addClass(el, className);
196
+ });
197
+ }
198
+ };
139
199
  /**
140
200
  * @hidden
141
201
  */
@@ -178,16 +238,15 @@ var DialogComponent = /** @class */ (function () {
178
238
  * @hidden
179
239
  */
180
240
  DialogComponent.prototype.keepFocusWithinComponent = function (target, event) {
181
- var firstFocusable = this._elRef.nativeElement;
182
- var lastFocusable = this.getLastFocusableElement(firstFocusable);
183
- var tabBeforeFirstFocusable = target === firstFocusable && event.shiftKey;
184
- var tabAfterLastFocusable = !event.shiftKey && util_1.isPresent(lastFocusable) && target === lastFocusable;
185
- var tabWithNoFocusable = !util_1.isPresent(lastFocusable) && !event.shiftKey;
186
- if (tabBeforeFirstFocusable || tabWithNoFocusable) {
241
+ var wrapper = this._elRef.nativeElement;
242
+ var _a = this.getFirstAndLastFocusable(wrapper), firstFocusable = _a[0], lastFocusable = _a[1];
243
+ var tabAfterLastFocusable = !event.shiftKey && target === lastFocusable;
244
+ var shiftTabAfterFirstFocusable = event.shiftKey && target === firstFocusable;
245
+ if (tabAfterLastFocusable) {
187
246
  event.preventDefault();
188
247
  firstFocusable.focus();
189
248
  }
190
- if (tabAfterLastFocusable) {
249
+ if (shiftTabAfterFirstFocusable) {
191
250
  event.preventDefault();
192
251
  lastFocusable.focus();
193
252
  }
@@ -207,9 +266,11 @@ var DialogComponent = /** @class */ (function () {
207
266
  /**
208
267
  * @hidden
209
268
  */
210
- DialogComponent.prototype.getLastFocusableElement = function (parent) {
269
+ DialogComponent.prototype.getFirstAndLastFocusable = function (parent) {
211
270
  var all = this.getAllFocusableChildren(parent);
212
- return all.length > 0 ? all[all.length - 1] : null;
271
+ var firstFocusable = all.length > 0 ? all[0] : parent;
272
+ var lastFocusable = all.length > 0 ? all[all.length - 1] : parent;
273
+ return [firstFocusable, lastFocusable];
213
274
  };
214
275
  /**
215
276
  * @hidden
@@ -217,6 +278,12 @@ var DialogComponent = /** @class */ (function () {
217
278
  DialogComponent.prototype.generateTitleId = function () {
218
279
  return 'kendo-dialog-title-' + Math.ceil(Math.random() * 1000000).toString();
219
280
  };
281
+ /**
282
+ * @hidden
283
+ */
284
+ DialogComponent.prototype.generateContentId = function () {
285
+ return 'kendo-dialog-content-' + Math.ceil(Math.random() * 1000000).toString();
286
+ };
220
287
  Object.defineProperty(DialogComponent.prototype, "wrapperClass", {
221
288
  get: function () {
222
289
  return true;
@@ -320,8 +387,8 @@ var DialogComponent = /** @class */ (function () {
320
387
  tslib_1.__metadata("design:type", core_1.QueryList)
321
388
  ], DialogComponent.prototype, "titlebarContent", void 0);
322
389
  tslib_1.__decorate([
323
- core_1.ViewChild(dialog_titlebar_component_1.DialogTitleBarComponent, { static: false }),
324
- tslib_1.__metadata("design:type", dialog_titlebar_component_1.DialogTitleBarComponent)
390
+ core_1.ViewChildren(dialog_titlebar_component_1.DialogTitleBarComponent),
391
+ tslib_1.__metadata("design:type", core_1.QueryList)
325
392
  ], DialogComponent.prototype, "titlebarView", void 0);
326
393
  tslib_1.__decorate([
327
394
  core_1.ViewChild(dialog_actions_component_1.DialogActionsComponent, { static: false }),
@@ -363,7 +430,7 @@ var DialogComponent = /** @class */ (function () {
363
430
  }
364
431
  ],
365
432
  selector: 'kendo-dialog',
366
- 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-widget k-window k-dialog\" role=\"dialog\" [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 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 "
433
+ 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 "
367
434
  }),
368
435
  tslib_1.__metadata("design:paramtypes", [core_1.ElementRef,
369
436
  core_1.Renderer2,
@@ -171,6 +171,8 @@ var DialogService = /** @class */ (function () {
171
171
  instance.maxHeight = options.maxHeight;
172
172
  instance.autoFocusedElement = options.autoFocusedElement;
173
173
  instance.closeTitle = options.closeTitle;
174
+ instance.cssClass = options.cssClass;
175
+ instance.htmlAttributes = options.htmlAttributes;
174
176
  if (options.content instanceof core_1.TemplateRef) {
175
177
  instance.contentTemplate = options.content;
176
178
  }
@@ -11,7 +11,7 @@ exports.packageMetadata = {
11
11
  name: '@progress/kendo-angular-dialog',
12
12
  productName: 'Kendo UI for Angular',
13
13
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
14
- publishDate: 1631198413,
14
+ publishDate: 1634903940,
15
15
  version: '',
16
16
  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'
17
17
  };
@@ -121,6 +121,43 @@ var WindowComponent = /** @class */ (function () {
121
121
  enumerable: true,
122
122
  configurable: true
123
123
  });
124
+ Object.defineProperty(WindowComponent.prototype, "cssClass", {
125
+ get: function () {
126
+ return this._cssClass;
127
+ },
128
+ /**
129
+ * @hidden
130
+ */
131
+ set: function (classes) {
132
+ this.setServiceClasses(this._cssClass, classes);
133
+ this._cssClass = classes;
134
+ },
135
+ enumerable: true,
136
+ configurable: true
137
+ });
138
+ Object.defineProperty(WindowComponent.prototype, "htmlAttributes", {
139
+ get: function () {
140
+ return this._htmlAttributes;
141
+ },
142
+ /**
143
+ * @hidden
144
+ */
145
+ set: function (attributes) {
146
+ util_1.setHTMLAttributes(attributes, this.renderer, this.el.nativeElement);
147
+ var el = this.el.nativeElement;
148
+ var dir = el.getAttribute('dir');
149
+ var tIndex = el.getAttribute('tabindex');
150
+ if (this.direction !== dir) {
151
+ this.direction = dir;
152
+ }
153
+ if (this.tabIndex !== tIndex) {
154
+ this.tabIndex = tIndex;
155
+ }
156
+ this._htmlAttributes = attributes;
157
+ },
158
+ enumerable: true,
159
+ configurable: true
160
+ });
124
161
  Object.defineProperty(WindowComponent.prototype, "state", {
125
162
  get: function () {
126
163
  return this.options.state;
@@ -489,6 +526,20 @@ var WindowComponent = /** @class */ (function () {
489
526
  }
490
527
  }));
491
528
  };
529
+ WindowComponent.prototype.setServiceClasses = function (prevValue, value) {
530
+ var _this = this;
531
+ var el = this.el.nativeElement;
532
+ if (prevValue) {
533
+ util_1.parseCSSClassNames(prevValue).forEach(function (className) {
534
+ _this.renderer.removeClass(el, className);
535
+ });
536
+ }
537
+ if (value) {
538
+ util_1.parseCSSClassNames(value).forEach(function (className) {
539
+ _this.renderer.addClass(el, className);
540
+ });
541
+ }
542
+ };
492
543
  WindowComponent.prototype.setNextZIndex = function () {
493
544
  var currentZIndex = this.el.nativeElement.style['z-index'];
494
545
  var nextPossibleZIndex = this.service.nextPossibleZIndex;
@@ -657,7 +708,6 @@ var WindowComponent = /** @class */ (function () {
657
708
  tslib_1.__metadata("design:type", Number)
658
709
  ], WindowComponent.prototype, "tabIndex", void 0);
659
710
  tslib_1.__decorate([
660
- core_1.HostBinding('class.k-widget'),
661
711
  core_1.HostBinding('class.k-window'),
662
712
  tslib_1.__metadata("design:type", Boolean),
663
713
  tslib_1.__metadata("design:paramtypes", [])
@@ -119,6 +119,12 @@ var WindowService = /** @class */ (function () {
119
119
  return windowRef;
120
120
  };
121
121
  WindowService.prototype.applyOptions = function (instance, options) {
122
+ if (util_1.isPresent(options.htmlAttributes)) {
123
+ instance.htmlAttributes = options.htmlAttributes;
124
+ }
125
+ if (util_1.isPresent(options.cssClass)) {
126
+ instance.cssClass = options.cssClass;
127
+ }
122
128
  if (util_1.isPresent(options.title)) {
123
129
  instance.title = options.title;
124
130
  }