@progress/kendo-angular-dialog 5.2.0-dev.202110191158 → 5.2.2-dev.202111121554

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,12 +3,12 @@
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import { __decorate, __metadata, __param } from 'tslib';
6
- import { EventEmitter, TemplateRef, Input, Output, 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';
6
+ import { EventEmitter, TemplateRef, Input, Output, HostBinding, Component, ElementRef, InjectionToken, Inject, Optional, NgZone, ContentChildren, QueryList, ViewChildren, ViewChild, Renderer2, ChangeDetectorRef, Injectable, isDevMode, ComponentFactoryResolver, Directive, Host, HostListener, ContentChild, ViewContainerRef, forwardRef, NgModule } from '@angular/core';
7
7
  import { trigger, state, style, transition, animate } from '@angular/animations';
8
8
  import { LocalizationService, L10N_PREFIX, RTL, MessageService, ComponentMessages } from '@progress/kendo-angular-l10n';
9
9
  import { take, filter, map, share, tap, switchMap, takeUntil } from 'rxjs/operators';
10
10
  import { validatePackage } from '@progress/kendo-licensing';
11
- import { Subject, merge, Subscription, of } from 'rxjs';
11
+ import { Subscription, Subject, merge, of } from 'rxjs';
12
12
  import { DraggableDirective, isChanged, isDocumentAvailable, DraggableModule } from '@progress/kendo-angular-common';
13
13
  import { offset, scrollPosition, positionWithScroll, getDocumentElement, getWindowViewPort } from '@progress/kendo-popup-common';
14
14
  import { Button } from '@progress/kendo-angular-buttons';
@@ -257,7 +257,7 @@ const packageMetadata = {
257
257
  name: '@progress/kendo-angular-dialog',
258
258
  productName: 'Kendo UI for Angular',
259
259
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
260
- publishDate: 1634644651,
260
+ publishDate: 1636732380,
261
261
  version: '',
262
262
  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'
263
263
  };
@@ -470,11 +470,11 @@ class DialogRef {
470
470
  * Represents the [Kendo UI Dialog component for Angular]({% slug overview_dialog_dialogs %}).
471
471
  */
472
472
  let DialogComponent = class DialogComponent {
473
- constructor(_elRef, _renderer, localization, cdr, zone) {
474
- this._elRef = _elRef;
475
- this._renderer = _renderer;
473
+ constructor(wrapper, renderer, localization, cdr, ngZone) {
474
+ this.wrapper = wrapper;
475
+ this.renderer = renderer;
476
476
  this.cdr = cdr;
477
- this.zone = zone;
477
+ this.ngZone = ngZone;
478
478
  /**
479
479
  * Specifies the layout of the action buttons in the Dialog.
480
480
  * This option is only applicable if the action buttons are specified through the `actions` options.
@@ -501,6 +501,7 @@ let DialogComponent = class DialogComponent {
501
501
  this.close = new EventEmitter();
502
502
  this.tabIndex = 0;
503
503
  this.subscriptions = [];
504
+ this.domSubs = new Subscription();
504
505
  validatePackage(packageMetadata);
505
506
  this.direction = localization.rtl ? 'rtl' : 'ltr';
506
507
  this.subscriptions.push(localization.changes.subscribe(({ rtl }) => (this.direction = rtl ? 'rtl' : 'ltr')));
@@ -511,8 +512,8 @@ let DialogComponent = class DialogComponent {
511
512
  * @hidden
512
513
  */
513
514
  set htmlAttributes(attributes) {
514
- setHTMLAttributes(attributes, this._renderer, this._elRef.nativeElement);
515
- const el = this._elRef.nativeElement;
515
+ setHTMLAttributes(attributes, this.renderer, this.wrapper.nativeElement);
516
+ const el = this.wrapper.nativeElement;
516
517
  const dir = el.getAttribute('dir');
517
518
  const tIndex = el.getAttribute('tabindex');
518
519
  if (this.direction !== dir) {
@@ -539,29 +540,9 @@ let DialogComponent = class DialogComponent {
539
540
  get dir() {
540
541
  return this.direction;
541
542
  }
542
- /**
543
- * @hidden
544
- */
545
- onComponentKeydown(event) {
546
- const target = event.target;
547
- const parent = target.parentElement;
548
- if (hasClasses(target, DIALOG_ELEMENTS_HANDLING_ESC_KEY) || hasClasses(parent, DIALOG_ELEMENTS_HANDLING_ESC_KEY)) {
549
- if (event.keyCode === Keys.esc) {
550
- this.close.emit(new DialogCloseResult());
551
- }
552
- }
553
- if (hasClasses(target, 'k-button') &&
554
- hasClasses(parent, DIALOG_ELEMENTS_HANDLING_ARROWS) &&
555
- (event.keyCode === Keys.left || event.keyCode === Keys.right)) {
556
- this.handleActionButtonFocus(parent, event.keyCode);
557
- }
558
- if (event.keyCode === Keys.tab) {
559
- this.keepFocusWithinComponent(target, event);
560
- }
561
- }
562
543
  ngAfterContentInit() {
563
544
  this.bubble('close', this.titlebarContent.first);
564
- this._renderer.setAttribute(this._elRef.nativeElement.querySelector('.k-dialog'), 'aria-describedby', this.contentId);
545
+ this.renderer.setAttribute(this.wrapper.nativeElement.querySelector('.k-dialog'), 'aria-describedby', this.contentId);
565
546
  if (this.titlebarContent.first) {
566
547
  this.titlebarContent.first.id = this.titleId;
567
548
  }
@@ -569,9 +550,9 @@ let DialogComponent = class DialogComponent {
569
550
  this.subscriptions.push(this.titlebarContent.changes.subscribe(() => {
570
551
  if (isPresent(this.titlebarContent.first)) {
571
552
  this.titlebarContent.first.id = this.titleId;
572
- this.zone.onStable.pipe(take(1)).subscribe(() => {
553
+ this.ngZone.onStable.pipe(take(1)).subscribe(() => {
573
554
  this.bubble('close', this.titlebarContent.first);
574
- this._renderer.setAttribute(this._elRef.nativeElement.querySelector('.k-dialog'), 'aria-labelledby', this.titleId);
555
+ this.renderer.setAttribute(this.wrapper.nativeElement.querySelector('.k-dialog'), 'aria-labelledby', this.titleId);
575
556
  });
576
557
  }
577
558
  }));
@@ -583,47 +564,83 @@ let DialogComponent = class DialogComponent {
583
564
  this.bubble('action', this.actionsView);
584
565
  if (this.titlebarView.first || this.titlebarContent.first) {
585
566
  //Needed for Dialogs created via service
586
- this._renderer.setAttribute(this._elRef.nativeElement.querySelector('.k-dialog'), 'aria-labelledby', this.titleId);
567
+ this.renderer.setAttribute(this.wrapper.nativeElement.querySelector('.k-dialog'), 'aria-labelledby', this.titleId);
587
568
  }
588
569
  else {
589
570
  this.subscriptions.push(this.titlebarView.changes.subscribe(() => {
590
571
  if (isPresent(this.titlebarView.first)) {
591
572
  this.titlebarView.first.id = this.titleId;
592
- this.zone.onStable.pipe(take(1)).subscribe(() => {
573
+ this.ngZone.onStable.pipe(take(1)).subscribe(() => {
593
574
  this.bubble('close', this.titlebarView.first);
594
- this._renderer.setAttribute(this._elRef.nativeElement.querySelector('.k-dialog'), 'aria-labelledby', this.titleId);
575
+ this.renderer.setAttribute(this.wrapper.nativeElement.querySelector('.k-dialog'), 'aria-labelledby', this.titleId);
595
576
  });
596
577
  }
597
578
  }));
598
579
  }
580
+ this.initDomEvents();
599
581
  }
600
582
  ngOnInit() {
601
- this._renderer.removeAttribute(this._elRef.nativeElement, 'title');
583
+ this.renderer.removeAttribute(this.wrapper.nativeElement, 'title');
602
584
  this.cdr.detectChanges();
603
585
  }
604
586
  ngOnDestroy() {
605
587
  this.subscriptions.forEach(s => s.unsubscribe());
606
588
  this.subscriptions = [];
589
+ if (this.domSubs) {
590
+ this.domSubs.unsubscribe();
591
+ }
607
592
  }
608
593
  /**
609
594
  * Focuses the wrapper of the Dialog component.
610
595
  */
611
596
  focus() {
612
- const wrapper = this._elRef.nativeElement;
597
+ const wrapper = this.wrapper.nativeElement;
613
598
  if (isPresent(wrapper)) {
614
599
  wrapper.focus();
615
600
  }
616
601
  }
602
+ initDomEvents() {
603
+ if (!this.wrapper) {
604
+ return;
605
+ }
606
+ this.ngZone.runOutsideAngular(() => {
607
+ this.domSubs.add(this.renderer.listen(this.wrapper.nativeElement, 'keydown', (ev) => {
608
+ this.onKeyDown(ev);
609
+ }));
610
+ });
611
+ }
612
+ onKeyDown(event) {
613
+ const target = event.target;
614
+ const parent = target.parentElement;
615
+ if (hasClasses(target, DIALOG_ELEMENTS_HANDLING_ESC_KEY) || hasClasses(parent, DIALOG_ELEMENTS_HANDLING_ESC_KEY)) {
616
+ if (event.keyCode === Keys.esc) {
617
+ this.ngZone.run(() => {
618
+ this.close.emit(new DialogCloseResult());
619
+ });
620
+ }
621
+ }
622
+ if (hasClasses(target, 'k-button') && hasClasses(parent, DIALOG_ELEMENTS_HANDLING_ARROWS) &&
623
+ (event.keyCode === Keys.left || event.keyCode === Keys.right)) {
624
+ this.ngZone.run(() => {
625
+ this.handleActionButtonFocus(parent, event.keyCode);
626
+ });
627
+ }
628
+ if (event.keyCode === Keys.tab) {
629
+ this.ngZone.run(() => {
630
+ this.keepFocusWithinComponent(target, event);
631
+ });
632
+ }
633
+ }
617
634
  setServiceClasses(prevValue, value) {
618
- const el = this._elRef.nativeElement;
635
+ const el = this.wrapper.nativeElement;
619
636
  if (prevValue) {
620
637
  parseCSSClassNames(prevValue).forEach(className => {
621
- this._renderer.removeClass(el, className);
638
+ this.renderer.removeClass(el, className);
622
639
  });
623
640
  }
624
641
  if (value) {
625
642
  parseCSSClassNames(value).forEach(className => {
626
- this._renderer.addClass(el, className);
643
+ this.renderer.addClass(el, className);
627
644
  });
628
645
  }
629
646
  }
@@ -631,7 +648,7 @@ let DialogComponent = class DialogComponent {
631
648
  * @hidden
632
649
  */
633
650
  handleInitialFocus() {
634
- const wrapper = this._elRef.nativeElement;
651
+ const wrapper = this.wrapper.nativeElement;
635
652
  const primaryButton = wrapper.querySelector('.k-primary');
636
653
  if (this.autoFocusedElement) {
637
654
  const initiallyFocusedElement = wrapper.querySelector(this.autoFocusedElement);
@@ -669,7 +686,7 @@ let DialogComponent = class DialogComponent {
669
686
  * @hidden
670
687
  */
671
688
  keepFocusWithinComponent(target, event) {
672
- const wrapper = this._elRef.nativeElement;
689
+ const wrapper = this.wrapper.nativeElement;
673
690
  const [firstFocusable, lastFocusable] = this.getFirstAndLastFocusable(wrapper);
674
691
  const tabAfterLastFocusable = !event.shiftKey && target === lastFocusable;
675
692
  const shiftTabAfterFirstFocusable = event.shiftKey && target === firstFocusable;
@@ -817,12 +834,6 @@ __decorate([
817
834
  ViewChild(DialogActionsComponent, { static: false }),
818
835
  __metadata("design:type", DialogActionsComponent)
819
836
  ], DialogComponent.prototype, "actionsView", void 0);
820
- __decorate([
821
- HostListener('keydown', ['$event']),
822
- __metadata("design:type", Function),
823
- __metadata("design:paramtypes", [Object]),
824
- __metadata("design:returntype", void 0)
825
- ], DialogComponent.prototype, "onComponentKeydown", null);
826
837
  __decorate([
827
838
  HostBinding('class.k-dialog-wrapper'),
828
839
  __metadata("design:type", Boolean),
@@ -1648,8 +1659,9 @@ WindowTitleBarComponent = __decorate([
1648
1659
  * @hidden
1649
1660
  */
1650
1661
  let NavigationService = class NavigationService {
1651
- constructor(window) {
1662
+ constructor(window, ngZone) {
1652
1663
  this.window = window;
1664
+ this.ngZone = ngZone;
1653
1665
  }
1654
1666
  process(ev) {
1655
1667
  const key = ev.keyCode;
@@ -1659,11 +1671,15 @@ let NavigationService = class NavigationService {
1659
1671
  case Keys.left:
1660
1672
  case Keys.right: {
1661
1673
  ev.preventDefault();
1662
- this.handleArrow(key, ev);
1674
+ this.ngZone.run(() => {
1675
+ this.handleArrow(key, ev);
1676
+ });
1663
1677
  break;
1664
1678
  }
1665
1679
  case Keys.esc:
1666
- this.handleEscape();
1680
+ this.ngZone.run(() => {
1681
+ this.handleEscape();
1682
+ });
1667
1683
  break;
1668
1684
  default:
1669
1685
  break;
@@ -1779,7 +1795,8 @@ let NavigationService = class NavigationService {
1779
1795
  };
1780
1796
  NavigationService = __decorate([
1781
1797
  Injectable(),
1782
- __metadata("design:paramtypes", [DragResizeService])
1798
+ __metadata("design:paramtypes", [DragResizeService,
1799
+ NgZone])
1783
1800
  ], NavigationService);
1784
1801
 
1785
1802
  /**
@@ -1847,6 +1864,7 @@ let WindowComponent = class WindowComponent {
1847
1864
  this.draged = false;
1848
1865
  this.resized = false;
1849
1866
  this.windowSubscription = new Subscription();
1867
+ this.domSubs = new Subscription();
1850
1868
  validatePackage(packageMetadata);
1851
1869
  this.direction = this.localization.rtl ? 'rtl' : 'ltr';
1852
1870
  this.localizationChangeSubscription = this.localization.changes
@@ -2014,6 +2032,7 @@ let WindowComponent = class WindowComponent {
2014
2032
  this.setNextZIndex();
2015
2033
  this.handleInitialFocus();
2016
2034
  this.ngZone.runOutsideAngular(() => Promise.resolve(null).then(() => this.setInitialOffset()));
2035
+ this.initDomEvents();
2017
2036
  }
2018
2037
  ngOnInit() {
2019
2038
  this.renderer.removeAttribute(this.el.nativeElement, 'title');
@@ -2048,6 +2067,9 @@ let WindowComponent = class WindowComponent {
2048
2067
  if (this.windowSubscription) {
2049
2068
  this.windowSubscription.unsubscribe();
2050
2069
  }
2070
+ if (this.domSubs) {
2071
+ this.domSubs.unsubscribe();
2072
+ }
2051
2073
  this.localizationChangeSubscription.unsubscribe();
2052
2074
  }
2053
2075
  /**
@@ -2109,14 +2131,6 @@ let WindowComponent = class WindowComponent {
2109
2131
  get wrapperMinimizedClass() {
2110
2132
  return this.state === 'minimized';
2111
2133
  }
2112
- /**
2113
- * @hidden
2114
- */
2115
- onComponentKeydown(event) {
2116
- if (hasClasses(event.target, WINDOW_CLASSES)) {
2117
- this.navigation.process(event);
2118
- }
2119
- }
2120
2134
  /**
2121
2135
  * @hidden
2122
2136
  */
@@ -2190,6 +2204,21 @@ let WindowComponent = class WindowComponent {
2190
2204
  }
2191
2205
  }));
2192
2206
  }
2207
+ initDomEvents() {
2208
+ if (!this.el) {
2209
+ return;
2210
+ }
2211
+ this.ngZone.runOutsideAngular(() => {
2212
+ this.domSubs.add(this.renderer.listen(this.el.nativeElement, 'keydown', (ev) => {
2213
+ this.onKeyDown(ev);
2214
+ }));
2215
+ });
2216
+ }
2217
+ onKeyDown(event) {
2218
+ if (hasClasses(event.target, WINDOW_CLASSES)) {
2219
+ this.navigation.process(event);
2220
+ }
2221
+ }
2193
2222
  setServiceClasses(prevValue, value) {
2194
2223
  const el = this.el.nativeElement;
2195
2224
  if (prevValue) {
@@ -2413,12 +2442,6 @@ __decorate([
2413
2442
  __metadata("design:type", Boolean),
2414
2443
  __metadata("design:paramtypes", [])
2415
2444
  ], WindowComponent.prototype, "wrapperMinimizedClass", null);
2416
- __decorate([
2417
- HostListener('keydown', ['$event']),
2418
- __metadata("design:type", Function),
2419
- __metadata("design:paramtypes", [Object]),
2420
- __metadata("design:returntype", void 0)
2421
- ], WindowComponent.prototype, "onComponentKeydown", null);
2422
2445
  __decorate([
2423
2446
  HostListener('focus'),
2424
2447
  __metadata("design:type", Function),
@@ -3,12 +3,12 @@
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, ViewChildren, ViewChild, HostListener, Renderer2, ChangeDetectorRef, Injectable, isDevMode, ComponentFactoryResolver, Directive, Host, ContentChild, ViewContainerRef, forwardRef, NgModule } from '@angular/core';
6
+ import { TemplateRef, Input, Output, EventEmitter, HostBinding, Component, ElementRef, InjectionToken, Inject, Optional, NgZone, ContentChildren, QueryList, ViewChildren, ViewChild, Renderer2, ChangeDetectorRef, Injectable, isDevMode, ComponentFactoryResolver, Directive, Host, HostListener, 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';
10
10
  import { validatePackage } from '@progress/kendo-licensing';
11
- import { Subject, merge, Subscription, of } from 'rxjs';
11
+ import { Subscription, Subject, merge, of } from 'rxjs';
12
12
  import { DraggableDirective, isChanged, isDocumentAvailable, DraggableModule } from '@progress/kendo-angular-common';
13
13
  import { offset, scrollPosition, positionWithScroll, getDocumentElement, getWindowViewPort } from '@progress/kendo-popup-common';
14
14
  import { Button } from '@progress/kendo-angular-buttons';
@@ -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: 1634644651,
242
+ publishDate: 1636732380,
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
  };
@@ -466,12 +466,12 @@ var DialogRef = /** @class */ (function () {
466
466
  * Represents the [Kendo UI Dialog component for Angular]({% slug overview_dialog_dialogs %}).
467
467
  */
468
468
  var DialogComponent = /** @class */ (function () {
469
- function DialogComponent(_elRef, _renderer, localization, cdr, zone) {
469
+ function DialogComponent(wrapper, renderer, localization, cdr, ngZone) {
470
470
  var _this = this;
471
- this._elRef = _elRef;
472
- this._renderer = _renderer;
471
+ this.wrapper = wrapper;
472
+ this.renderer = renderer;
473
473
  this.cdr = cdr;
474
- this.zone = zone;
474
+ this.ngZone = ngZone;
475
475
  /**
476
476
  * Specifies the layout of the action buttons in the Dialog.
477
477
  * This option is only applicable if the action buttons are specified through the `actions` options.
@@ -498,6 +498,7 @@ var DialogComponent = /** @class */ (function () {
498
498
  this.close = new EventEmitter();
499
499
  this.tabIndex = 0;
500
500
  this.subscriptions = [];
501
+ this.domSubs = new Subscription();
501
502
  validatePackage(packageMetadata);
502
503
  this.direction = localization.rtl ? 'rtl' : 'ltr';
503
504
  this.subscriptions.push(localization.changes.subscribe(function (_a) {
@@ -515,8 +516,8 @@ var DialogComponent = /** @class */ (function () {
515
516
  * @hidden
516
517
  */
517
518
  set: function (attributes) {
518
- setHTMLAttributes(attributes, this._renderer, this._elRef.nativeElement);
519
- var el = this._elRef.nativeElement;
519
+ setHTMLAttributes(attributes, this.renderer, this.wrapper.nativeElement);
520
+ var el = this.wrapper.nativeElement;
520
521
  var dir = el.getAttribute('dir');
521
522
  var tIndex = el.getAttribute('tabindex');
522
523
  if (this.direction !== dir) {
@@ -551,30 +552,10 @@ var DialogComponent = /** @class */ (function () {
551
552
  enumerable: true,
552
553
  configurable: true
553
554
  });
554
- /**
555
- * @hidden
556
- */
557
- DialogComponent.prototype.onComponentKeydown = function (event) {
558
- var target = event.target;
559
- var parent = target.parentElement;
560
- if (hasClasses(target, DIALOG_ELEMENTS_HANDLING_ESC_KEY) || hasClasses(parent, DIALOG_ELEMENTS_HANDLING_ESC_KEY)) {
561
- if (event.keyCode === Keys.esc) {
562
- this.close.emit(new DialogCloseResult());
563
- }
564
- }
565
- if (hasClasses(target, 'k-button') &&
566
- hasClasses(parent, DIALOG_ELEMENTS_HANDLING_ARROWS) &&
567
- (event.keyCode === Keys.left || event.keyCode === Keys.right)) {
568
- this.handleActionButtonFocus(parent, event.keyCode);
569
- }
570
- if (event.keyCode === Keys.tab) {
571
- this.keepFocusWithinComponent(target, event);
572
- }
573
- };
574
555
  DialogComponent.prototype.ngAfterContentInit = function () {
575
556
  var _this = this;
576
557
  this.bubble('close', this.titlebarContent.first);
577
- this._renderer.setAttribute(this._elRef.nativeElement.querySelector('.k-dialog'), 'aria-describedby', this.contentId);
558
+ this.renderer.setAttribute(this.wrapper.nativeElement.querySelector('.k-dialog'), 'aria-describedby', this.contentId);
578
559
  if (this.titlebarContent.first) {
579
560
  this.titlebarContent.first.id = this.titleId;
580
561
  }
@@ -582,9 +563,9 @@ var DialogComponent = /** @class */ (function () {
582
563
  this.subscriptions.push(this.titlebarContent.changes.subscribe(function () {
583
564
  if (isPresent(_this.titlebarContent.first)) {
584
565
  _this.titlebarContent.first.id = _this.titleId;
585
- _this.zone.onStable.pipe(take(1)).subscribe(function () {
566
+ _this.ngZone.onStable.pipe(take(1)).subscribe(function () {
586
567
  _this.bubble('close', _this.titlebarContent.first);
587
- _this._renderer.setAttribute(_this._elRef.nativeElement.querySelector('.k-dialog'), 'aria-labelledby', _this.titleId);
568
+ _this.renderer.setAttribute(_this.wrapper.nativeElement.querySelector('.k-dialog'), 'aria-labelledby', _this.titleId);
588
569
  });
589
570
  }
590
571
  }));
@@ -597,48 +578,86 @@ var DialogComponent = /** @class */ (function () {
597
578
  this.bubble('action', this.actionsView);
598
579
  if (this.titlebarView.first || this.titlebarContent.first) {
599
580
  //Needed for Dialogs created via service
600
- this._renderer.setAttribute(this._elRef.nativeElement.querySelector('.k-dialog'), 'aria-labelledby', this.titleId);
581
+ this.renderer.setAttribute(this.wrapper.nativeElement.querySelector('.k-dialog'), 'aria-labelledby', this.titleId);
601
582
  }
602
583
  else {
603
584
  this.subscriptions.push(this.titlebarView.changes.subscribe(function () {
604
585
  if (isPresent(_this.titlebarView.first)) {
605
586
  _this.titlebarView.first.id = _this.titleId;
606
- _this.zone.onStable.pipe(take(1)).subscribe(function () {
587
+ _this.ngZone.onStable.pipe(take(1)).subscribe(function () {
607
588
  _this.bubble('close', _this.titlebarView.first);
608
- _this._renderer.setAttribute(_this._elRef.nativeElement.querySelector('.k-dialog'), 'aria-labelledby', _this.titleId);
589
+ _this.renderer.setAttribute(_this.wrapper.nativeElement.querySelector('.k-dialog'), 'aria-labelledby', _this.titleId);
609
590
  });
610
591
  }
611
592
  }));
612
593
  }
594
+ this.initDomEvents();
613
595
  };
614
596
  DialogComponent.prototype.ngOnInit = function () {
615
- this._renderer.removeAttribute(this._elRef.nativeElement, 'title');
597
+ this.renderer.removeAttribute(this.wrapper.nativeElement, 'title');
616
598
  this.cdr.detectChanges();
617
599
  };
618
600
  DialogComponent.prototype.ngOnDestroy = function () {
619
601
  this.subscriptions.forEach(function (s) { return s.unsubscribe(); });
620
602
  this.subscriptions = [];
603
+ if (this.domSubs) {
604
+ this.domSubs.unsubscribe();
605
+ }
621
606
  };
622
607
  /**
623
608
  * Focuses the wrapper of the Dialog component.
624
609
  */
625
610
  DialogComponent.prototype.focus = function () {
626
- var wrapper = this._elRef.nativeElement;
611
+ var wrapper = this.wrapper.nativeElement;
627
612
  if (isPresent(wrapper)) {
628
613
  wrapper.focus();
629
614
  }
630
615
  };
616
+ DialogComponent.prototype.initDomEvents = function () {
617
+ var _this = this;
618
+ if (!this.wrapper) {
619
+ return;
620
+ }
621
+ this.ngZone.runOutsideAngular(function () {
622
+ _this.domSubs.add(_this.renderer.listen(_this.wrapper.nativeElement, 'keydown', function (ev) {
623
+ _this.onKeyDown(ev);
624
+ }));
625
+ });
626
+ };
627
+ DialogComponent.prototype.onKeyDown = function (event) {
628
+ var _this = this;
629
+ var target = event.target;
630
+ var parent = target.parentElement;
631
+ if (hasClasses(target, DIALOG_ELEMENTS_HANDLING_ESC_KEY) || hasClasses(parent, DIALOG_ELEMENTS_HANDLING_ESC_KEY)) {
632
+ if (event.keyCode === Keys.esc) {
633
+ this.ngZone.run(function () {
634
+ _this.close.emit(new DialogCloseResult());
635
+ });
636
+ }
637
+ }
638
+ if (hasClasses(target, 'k-button') && hasClasses(parent, DIALOG_ELEMENTS_HANDLING_ARROWS) &&
639
+ (event.keyCode === Keys.left || event.keyCode === Keys.right)) {
640
+ this.ngZone.run(function () {
641
+ _this.handleActionButtonFocus(parent, event.keyCode);
642
+ });
643
+ }
644
+ if (event.keyCode === Keys.tab) {
645
+ this.ngZone.run(function () {
646
+ _this.keepFocusWithinComponent(target, event);
647
+ });
648
+ }
649
+ };
631
650
  DialogComponent.prototype.setServiceClasses = function (prevValue, value) {
632
651
  var _this = this;
633
- var el = this._elRef.nativeElement;
652
+ var el = this.wrapper.nativeElement;
634
653
  if (prevValue) {
635
654
  parseCSSClassNames(prevValue).forEach(function (className) {
636
- _this._renderer.removeClass(el, className);
655
+ _this.renderer.removeClass(el, className);
637
656
  });
638
657
  }
639
658
  if (value) {
640
659
  parseCSSClassNames(value).forEach(function (className) {
641
- _this._renderer.addClass(el, className);
660
+ _this.renderer.addClass(el, className);
642
661
  });
643
662
  }
644
663
  };
@@ -646,7 +665,7 @@ var DialogComponent = /** @class */ (function () {
646
665
  * @hidden
647
666
  */
648
667
  DialogComponent.prototype.handleInitialFocus = function () {
649
- var wrapper = this._elRef.nativeElement;
668
+ var wrapper = this.wrapper.nativeElement;
650
669
  var primaryButton = wrapper.querySelector('.k-primary');
651
670
  if (this.autoFocusedElement) {
652
671
  var initiallyFocusedElement = wrapper.querySelector(this.autoFocusedElement);
@@ -684,7 +703,7 @@ var DialogComponent = /** @class */ (function () {
684
703
  * @hidden
685
704
  */
686
705
  DialogComponent.prototype.keepFocusWithinComponent = function (target, event) {
687
- var wrapper = this._elRef.nativeElement;
706
+ var wrapper = this.wrapper.nativeElement;
688
707
  var _a = this.getFirstAndLastFocusable(wrapper), firstFocusable = _a[0], lastFocusable = _a[1];
689
708
  var tabAfterLastFocusable = !event.shiftKey && target === lastFocusable;
690
709
  var shiftTabAfterFirstFocusable = event.shiftKey && target === firstFocusable;
@@ -840,12 +859,6 @@ var DialogComponent = /** @class */ (function () {
840
859
  ViewChild(DialogActionsComponent, { static: false }),
841
860
  __metadata("design:type", DialogActionsComponent)
842
861
  ], DialogComponent.prototype, "actionsView", void 0);
843
- __decorate([
844
- HostListener('keydown', ['$event']),
845
- __metadata("design:type", Function),
846
- __metadata("design:paramtypes", [Object]),
847
- __metadata("design:returntype", void 0)
848
- ], DialogComponent.prototype, "onComponentKeydown", null);
849
862
  __decorate([
850
863
  HostBinding('class.k-dialog-wrapper'),
851
864
  __metadata("design:type", Boolean),
@@ -1691,10 +1704,12 @@ var WindowTitleBarComponent = /** @class */ (function () {
1691
1704
  * @hidden
1692
1705
  */
1693
1706
  var NavigationService = /** @class */ (function () {
1694
- function NavigationService(window) {
1707
+ function NavigationService(window, ngZone) {
1695
1708
  this.window = window;
1709
+ this.ngZone = ngZone;
1696
1710
  }
1697
1711
  NavigationService.prototype.process = function (ev) {
1712
+ var _this = this;
1698
1713
  var key = ev.keyCode;
1699
1714
  switch (key) {
1700
1715
  case Keys.up:
@@ -1702,11 +1717,15 @@ var NavigationService = /** @class */ (function () {
1702
1717
  case Keys.left:
1703
1718
  case Keys.right: {
1704
1719
  ev.preventDefault();
1705
- this.handleArrow(key, ev);
1720
+ this.ngZone.run(function () {
1721
+ _this.handleArrow(key, ev);
1722
+ });
1706
1723
  break;
1707
1724
  }
1708
1725
  case Keys.esc:
1709
- this.handleEscape();
1726
+ this.ngZone.run(function () {
1727
+ _this.handleEscape();
1728
+ });
1710
1729
  break;
1711
1730
  default:
1712
1731
  break;
@@ -1822,7 +1841,8 @@ var NavigationService = /** @class */ (function () {
1822
1841
  };
1823
1842
  NavigationService = __decorate([
1824
1843
  Injectable(),
1825
- __metadata("design:paramtypes", [DragResizeService])
1844
+ __metadata("design:paramtypes", [DragResizeService,
1845
+ NgZone])
1826
1846
  ], NavigationService);
1827
1847
  return NavigationService;
1828
1848
  }());
@@ -1893,6 +1913,7 @@ var WindowComponent = /** @class */ (function () {
1893
1913
  this.draged = false;
1894
1914
  this.resized = false;
1895
1915
  this.windowSubscription = new Subscription();
1916
+ this.domSubs = new Subscription();
1896
1917
  validatePackage(packageMetadata);
1897
1918
  this.direction = this.localization.rtl ? 'rtl' : 'ltr';
1898
1919
  this.localizationChangeSubscription = this.localization.changes
@@ -2134,6 +2155,7 @@ var WindowComponent = /** @class */ (function () {
2134
2155
  this.ngZone.runOutsideAngular(function () {
2135
2156
  return Promise.resolve(null).then(function () { return _this.setInitialOffset(); });
2136
2157
  });
2158
+ this.initDomEvents();
2137
2159
  };
2138
2160
  WindowComponent.prototype.ngOnInit = function () {
2139
2161
  this.renderer.removeAttribute(this.el.nativeElement, 'title');
@@ -2169,6 +2191,9 @@ var WindowComponent = /** @class */ (function () {
2169
2191
  if (this.windowSubscription) {
2170
2192
  this.windowSubscription.unsubscribe();
2171
2193
  }
2194
+ if (this.domSubs) {
2195
+ this.domSubs.unsubscribe();
2196
+ }
2172
2197
  this.localizationChangeSubscription.unsubscribe();
2173
2198
  };
2174
2199
  /**
@@ -2254,14 +2279,6 @@ var WindowComponent = /** @class */ (function () {
2254
2279
  enumerable: true,
2255
2280
  configurable: true
2256
2281
  });
2257
- /**
2258
- * @hidden
2259
- */
2260
- WindowComponent.prototype.onComponentKeydown = function (event) {
2261
- if (hasClasses(event.target, WINDOW_CLASSES)) {
2262
- this.navigation.process(event);
2263
- }
2264
- };
2265
2282
  /**
2266
2283
  * @hidden
2267
2284
  */
@@ -2336,6 +2353,22 @@ var WindowComponent = /** @class */ (function () {
2336
2353
  }
2337
2354
  }));
2338
2355
  };
2356
+ WindowComponent.prototype.initDomEvents = function () {
2357
+ var _this = this;
2358
+ if (!this.el) {
2359
+ return;
2360
+ }
2361
+ this.ngZone.runOutsideAngular(function () {
2362
+ _this.domSubs.add(_this.renderer.listen(_this.el.nativeElement, 'keydown', function (ev) {
2363
+ _this.onKeyDown(ev);
2364
+ }));
2365
+ });
2366
+ };
2367
+ WindowComponent.prototype.onKeyDown = function (event) {
2368
+ if (hasClasses(event.target, WINDOW_CLASSES)) {
2369
+ this.navigation.process(event);
2370
+ }
2371
+ };
2339
2372
  WindowComponent.prototype.setServiceClasses = function (prevValue, value) {
2340
2373
  var _this = this;
2341
2374
  var el = this.el.nativeElement;
@@ -2564,12 +2597,6 @@ var WindowComponent = /** @class */ (function () {
2564
2597
  __metadata("design:type", Boolean),
2565
2598
  __metadata("design:paramtypes", [])
2566
2599
  ], WindowComponent.prototype, "wrapperMinimizedClass", null);
2567
- __decorate([
2568
- HostListener('keydown', ['$event']),
2569
- __metadata("design:type", Function),
2570
- __metadata("design:paramtypes", [Object]),
2571
- __metadata("design:returntype", void 0)
2572
- ], WindowComponent.prototype, "onComponentKeydown", null);
2573
2600
  __decorate([
2574
2601
  HostListener('focus'),
2575
2602
  __metadata("design:type", Function),