@progress/kendo-angular-dialog 5.2.0-dev.202109270843 → 5.2.1-dev.202110281710

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.
@@ -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 { __decorate, __metadata, __extends, __param } from 'tslib';
6
- import { TemplateRef, Input, Output, EventEmitter, HostBinding, Component, ElementRef, InjectionToken, Inject, Optional, NgZone, ContentChildren, QueryList, ViewChild, HostListener, Renderer2, ChangeDetectorRef, Injectable, isDevMode, ComponentFactoryResolver, Directive, Host, ContentChild, ViewChildren, ViewContainerRef, forwardRef, NgModule } from '@angular/core';
6
+ import { TemplateRef, Input, Output, EventEmitter, HostBinding, Component, ElementRef, InjectionToken, Inject, Optional, NgZone, ContentChildren, QueryList, ViewChildren, ViewChild, HostListener, Renderer2, ChangeDetectorRef, Injectable, isDevMode, ComponentFactoryResolver, Directive, Host, ContentChild, ViewContainerRef, forwardRef, NgModule } from '@angular/core';
7
7
  import { trigger, state, style, transition, animate } from '@angular/animations';
8
8
  import { L10N_PREFIX, RTL, MessageService, LocalizationService, ComponentMessages } from '@progress/kendo-angular-l10n';
9
9
  import { take, filter, map, share, tap, switchMap, takeUntil } from 'rxjs/operators';
@@ -180,7 +180,7 @@ var DialogTitleBarComponent = /** @class */ (function () {
180
180
  DialogTitleBarComponent.prototype.ngAfterViewInit = function () {
181
181
  var _this = this;
182
182
  this.zone.onStable.pipe(take(1)).subscribe(function () {
183
- var element = _this.hostElement.nativeElement;
183
+ var element = _this.hostElement.nativeElement.querySelector('.k-dialog-title');
184
184
  element.setAttribute('id', _this.id);
185
185
  });
186
186
  };
@@ -239,7 +239,7 @@ var packageMetadata = {
239
239
  name: '@progress/kendo-angular-dialog',
240
240
  productName: 'Kendo UI for Angular',
241
241
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
242
- publishDate: 1632732133,
242
+ publishDate: 1635440955,
243
243
  version: '',
244
244
  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'
245
245
  };
@@ -483,13 +483,17 @@ var DialogComponent = /** @class */ (function () {
483
483
  * @hidden
484
484
  */
485
485
  this.titleId = null;
486
+ /**
487
+ * @hidden
488
+ */
489
+ this.contentId = null;
486
490
  /**
487
491
  * Fires when the user clicks an action button of the Dialog.
488
492
  * The event is fired only when the action buttons are specified through the `actions` options.
489
493
  */
490
494
  this.action = new EventEmitter();
491
495
  /**
492
- * Fires when the user clicks the **Close** button of the Dialog.
496
+ * Fires when the user clicks the **Close** button of the Dialog or the **ESC** key.
493
497
  */
494
498
  this.close = new EventEmitter();
495
499
  this.tabIndex = 0;
@@ -501,6 +505,7 @@ var DialogComponent = /** @class */ (function () {
501
505
  return (_this.direction = rtl ? 'rtl' : 'ltr');
502
506
  }));
503
507
  this.titleId = this.generateTitleId();
508
+ this.contentId = this.generateContentId();
504
509
  }
505
510
  Object.defineProperty(DialogComponent.prototype, "htmlAttributes", {
506
511
  get: function () {
@@ -569,6 +574,7 @@ var DialogComponent = /** @class */ (function () {
569
574
  DialogComponent.prototype.ngAfterContentInit = function () {
570
575
  var _this = this;
571
576
  this.bubble('close', this.titlebarContent.first);
577
+ this._renderer.setAttribute(this._elRef.nativeElement.querySelector('.k-dialog'), 'aria-describedby', this.contentId);
572
578
  if (this.titlebarContent.first) {
573
579
  this.titlebarContent.first.id = this.titleId;
574
580
  }
@@ -584,23 +590,26 @@ var DialogComponent = /** @class */ (function () {
584
590
  }));
585
591
  }
586
592
  };
587
- DialogComponent.prototype.ngOnChanges = function (changes) {
588
- var _this = this;
589
- if (changes.title && changes.title.currentValue && !changes.title.previousValue) {
590
- this.zone.onStable.pipe(take(1)).subscribe(function () {
591
- _this.bubble('close', _this.titlebarView);
592
- _this._renderer.setAttribute(_this._elRef.nativeElement.querySelector('.k-dialog'), 'aria-labelledby', _this.titleId);
593
- });
594
- }
595
- };
596
593
  DialogComponent.prototype.ngAfterViewInit = function () {
594
+ var _this = this;
597
595
  this.handleInitialFocus();
598
- this.bubble('close', this.titlebarView);
596
+ this.bubble('close', this.titlebarView.first);
599
597
  this.bubble('action', this.actionsView);
600
- if (this.titlebarView || this.titlebarContent.first) {
598
+ if (this.titlebarView.first || this.titlebarContent.first) {
601
599
  //Needed for Dialogs created via service
602
600
  this._renderer.setAttribute(this._elRef.nativeElement.querySelector('.k-dialog'), 'aria-labelledby', this.titleId);
603
601
  }
602
+ else {
603
+ this.subscriptions.push(this.titlebarView.changes.subscribe(function () {
604
+ if (isPresent(_this.titlebarView.first)) {
605
+ _this.titlebarView.first.id = _this.titleId;
606
+ _this.zone.onStable.pipe(take(1)).subscribe(function () {
607
+ _this.bubble('close', _this.titlebarView.first);
608
+ _this._renderer.setAttribute(_this._elRef.nativeElement.querySelector('.k-dialog'), 'aria-labelledby', _this.titleId);
609
+ });
610
+ }
611
+ }));
612
+ }
604
613
  };
605
614
  DialogComponent.prototype.ngOnInit = function () {
606
615
  this._renderer.removeAttribute(this._elRef.nativeElement, 'title');
@@ -675,16 +684,15 @@ var DialogComponent = /** @class */ (function () {
675
684
  * @hidden
676
685
  */
677
686
  DialogComponent.prototype.keepFocusWithinComponent = function (target, event) {
678
- var firstFocusable = this._elRef.nativeElement;
679
- var lastFocusable = this.getLastFocusableElement(firstFocusable);
680
- var tabBeforeFirstFocusable = target === firstFocusable && event.shiftKey;
681
- var tabAfterLastFocusable = !event.shiftKey && isPresent(lastFocusable) && target === lastFocusable;
682
- var tabWithNoFocusable = !isPresent(lastFocusable) && !event.shiftKey;
683
- if (tabBeforeFirstFocusable || tabWithNoFocusable) {
687
+ var wrapper = this._elRef.nativeElement;
688
+ var _a = this.getFirstAndLastFocusable(wrapper), firstFocusable = _a[0], lastFocusable = _a[1];
689
+ var tabAfterLastFocusable = !event.shiftKey && target === lastFocusable;
690
+ var shiftTabAfterFirstFocusable = event.shiftKey && target === firstFocusable;
691
+ if (tabAfterLastFocusable) {
684
692
  event.preventDefault();
685
693
  firstFocusable.focus();
686
694
  }
687
- if (tabAfterLastFocusable) {
695
+ if (shiftTabAfterFirstFocusable) {
688
696
  event.preventDefault();
689
697
  lastFocusable.focus();
690
698
  }
@@ -704,9 +712,11 @@ var DialogComponent = /** @class */ (function () {
704
712
  /**
705
713
  * @hidden
706
714
  */
707
- DialogComponent.prototype.getLastFocusableElement = function (parent) {
715
+ DialogComponent.prototype.getFirstAndLastFocusable = function (parent) {
708
716
  var all = this.getAllFocusableChildren(parent);
709
- return all.length > 0 ? all[all.length - 1] : null;
717
+ var firstFocusable = all.length > 0 ? all[0] : parent;
718
+ var lastFocusable = all.length > 0 ? all[all.length - 1] : parent;
719
+ return [firstFocusable, lastFocusable];
710
720
  };
711
721
  /**
712
722
  * @hidden
@@ -714,6 +724,12 @@ var DialogComponent = /** @class */ (function () {
714
724
  DialogComponent.prototype.generateTitleId = function () {
715
725
  return 'kendo-dialog-title-' + Math.ceil(Math.random() * 1000000).toString();
716
726
  };
727
+ /**
728
+ * @hidden
729
+ */
730
+ DialogComponent.prototype.generateContentId = function () {
731
+ return 'kendo-dialog-content-' + Math.ceil(Math.random() * 1000000).toString();
732
+ };
717
733
  Object.defineProperty(DialogComponent.prototype, "wrapperClass", {
718
734
  get: function () {
719
735
  return true;
@@ -817,8 +833,8 @@ var DialogComponent = /** @class */ (function () {
817
833
  __metadata("design:type", QueryList)
818
834
  ], DialogComponent.prototype, "titlebarContent", void 0);
819
835
  __decorate([
820
- ViewChild(DialogTitleBarComponent, { static: false }),
821
- __metadata("design:type", DialogTitleBarComponent)
836
+ ViewChildren(DialogTitleBarComponent),
837
+ __metadata("design:type", QueryList)
822
838
  ], DialogComponent.prototype, "titlebarView", void 0);
823
839
  __decorate([
824
840
  ViewChild(DialogActionsComponent, { static: false }),
@@ -860,7 +876,7 @@ var DialogComponent = /** @class */ (function () {
860
876
  }
861
877
  ],
862
878
  selector: 'kendo-dialog',
863
- 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\" [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 "
879
+ 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 "
864
880
  }),
865
881
  __metadata("design:paramtypes", [ElementRef,
866
882
  Renderer2,
@@ -42,7 +42,7 @@ var DialogTitleBarComponent = /** @class */ (function () {
42
42
  DialogTitleBarComponent.prototype.ngAfterViewInit = function () {
43
43
  var _this = this;
44
44
  this.zone.onStable.pipe(operators_1.take(1)).subscribe(function () {
45
- var element = _this.hostElement.nativeElement;
45
+ var element = _this.hostElement.nativeElement.querySelector('.k-dialog-title');
46
46
  element.setAttribute('id', _this.id);
47
47
  });
48
48
  };
@@ -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,6 +59,7 @@ 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
  }
59
64
  Object.defineProperty(DialogComponent.prototype, "htmlAttributes", {
60
65
  get: function () {
@@ -123,6 +128,7 @@ var DialogComponent = /** @class */ (function () {
123
128
  DialogComponent.prototype.ngAfterContentInit = function () {
124
129
  var _this = this;
125
130
  this.bubble('close', this.titlebarContent.first);
131
+ this._renderer.setAttribute(this._elRef.nativeElement.querySelector('.k-dialog'), 'aria-describedby', this.contentId);
126
132
  if (this.titlebarContent.first) {
127
133
  this.titlebarContent.first.id = this.titleId;
128
134
  }
@@ -138,23 +144,26 @@ var DialogComponent = /** @class */ (function () {
138
144
  }));
139
145
  }
140
146
  };
141
- DialogComponent.prototype.ngOnChanges = function (changes) {
142
- var _this = this;
143
- if (changes.title && changes.title.currentValue && !changes.title.previousValue) {
144
- this.zone.onStable.pipe(operators_1.take(1)).subscribe(function () {
145
- _this.bubble('close', _this.titlebarView);
146
- _this._renderer.setAttribute(_this._elRef.nativeElement.querySelector('.k-dialog'), 'aria-labelledby', _this.titleId);
147
- });
148
- }
149
- };
150
147
  DialogComponent.prototype.ngAfterViewInit = function () {
148
+ var _this = this;
151
149
  this.handleInitialFocus();
152
- this.bubble('close', this.titlebarView);
150
+ this.bubble('close', this.titlebarView.first);
153
151
  this.bubble('action', this.actionsView);
154
- if (this.titlebarView || this.titlebarContent.first) {
152
+ if (this.titlebarView.first || this.titlebarContent.first) {
155
153
  //Needed for Dialogs created via service
156
154
  this._renderer.setAttribute(this._elRef.nativeElement.querySelector('.k-dialog'), 'aria-labelledby', this.titleId);
157
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
+ }
158
167
  };
159
168
  DialogComponent.prototype.ngOnInit = function () {
160
169
  this._renderer.removeAttribute(this._elRef.nativeElement, 'title');
@@ -229,16 +238,15 @@ var DialogComponent = /** @class */ (function () {
229
238
  * @hidden
230
239
  */
231
240
  DialogComponent.prototype.keepFocusWithinComponent = function (target, event) {
232
- var firstFocusable = this._elRef.nativeElement;
233
- var lastFocusable = this.getLastFocusableElement(firstFocusable);
234
- var tabBeforeFirstFocusable = target === firstFocusable && event.shiftKey;
235
- var tabAfterLastFocusable = !event.shiftKey && util_1.isPresent(lastFocusable) && target === lastFocusable;
236
- var tabWithNoFocusable = !util_1.isPresent(lastFocusable) && !event.shiftKey;
237
- 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) {
238
246
  event.preventDefault();
239
247
  firstFocusable.focus();
240
248
  }
241
- if (tabAfterLastFocusable) {
249
+ if (shiftTabAfterFirstFocusable) {
242
250
  event.preventDefault();
243
251
  lastFocusable.focus();
244
252
  }
@@ -258,9 +266,11 @@ var DialogComponent = /** @class */ (function () {
258
266
  /**
259
267
  * @hidden
260
268
  */
261
- DialogComponent.prototype.getLastFocusableElement = function (parent) {
269
+ DialogComponent.prototype.getFirstAndLastFocusable = function (parent) {
262
270
  var all = this.getAllFocusableChildren(parent);
263
- 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];
264
274
  };
265
275
  /**
266
276
  * @hidden
@@ -268,6 +278,12 @@ var DialogComponent = /** @class */ (function () {
268
278
  DialogComponent.prototype.generateTitleId = function () {
269
279
  return 'kendo-dialog-title-' + Math.ceil(Math.random() * 1000000).toString();
270
280
  };
281
+ /**
282
+ * @hidden
283
+ */
284
+ DialogComponent.prototype.generateContentId = function () {
285
+ return 'kendo-dialog-content-' + Math.ceil(Math.random() * 1000000).toString();
286
+ };
271
287
  Object.defineProperty(DialogComponent.prototype, "wrapperClass", {
272
288
  get: function () {
273
289
  return true;
@@ -371,8 +387,8 @@ var DialogComponent = /** @class */ (function () {
371
387
  tslib_1.__metadata("design:type", core_1.QueryList)
372
388
  ], DialogComponent.prototype, "titlebarContent", void 0);
373
389
  tslib_1.__decorate([
374
- core_1.ViewChild(dialog_titlebar_component_1.DialogTitleBarComponent, { static: false }),
375
- 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)
376
392
  ], DialogComponent.prototype, "titlebarView", void 0);
377
393
  tslib_1.__decorate([
378
394
  core_1.ViewChild(dialog_actions_component_1.DialogActionsComponent, { static: false }),
@@ -414,7 +430,7 @@ var DialogComponent = /** @class */ (function () {
414
430
  }
415
431
  ],
416
432
  selector: 'kendo-dialog',
417
- 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\" [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 "
418
434
  }),
419
435
  tslib_1.__metadata("design:paramtypes", [core_1.ElementRef,
420
436
  core_1.Renderer2,
@@ -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: 1632732133,
14
+ publishDate: 1635440955,
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
  };