@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.
@@ -16,16 +16,17 @@ var util_1 = require("../common/util");
16
16
  var dialog_settings_1 = require("./dialog-settings");
17
17
  var dialog_localization_service_1 = require("./../localization/dialog-localization.service");
18
18
  var operators_1 = require("rxjs/operators");
19
+ var rxjs_1 = require("rxjs");
19
20
  /**
20
21
  * Represents the [Kendo UI Dialog component for Angular]({% slug overview_dialog_dialogs %}).
21
22
  */
22
23
  var DialogComponent = /** @class */ (function () {
23
- function DialogComponent(_elRef, _renderer, localization, cdr, zone) {
24
+ function DialogComponent(wrapper, renderer, localization, cdr, ngZone) {
24
25
  var _this = this;
25
- this._elRef = _elRef;
26
- this._renderer = _renderer;
26
+ this.wrapper = wrapper;
27
+ this.renderer = renderer;
27
28
  this.cdr = cdr;
28
- this.zone = zone;
29
+ this.ngZone = ngZone;
29
30
  /**
30
31
  * Specifies the layout of the action buttons in the Dialog.
31
32
  * This option is only applicable if the action buttons are specified through the `actions` options.
@@ -52,6 +53,7 @@ var DialogComponent = /** @class */ (function () {
52
53
  this.close = new core_1.EventEmitter();
53
54
  this.tabIndex = 0;
54
55
  this.subscriptions = [];
56
+ this.domSubs = new rxjs_1.Subscription();
55
57
  kendo_licensing_1.validatePackage(package_metadata_1.packageMetadata);
56
58
  this.direction = localization.rtl ? 'rtl' : 'ltr';
57
59
  this.subscriptions.push(localization.changes.subscribe(function (_a) {
@@ -69,8 +71,8 @@ var DialogComponent = /** @class */ (function () {
69
71
  * @hidden
70
72
  */
71
73
  set: function (attributes) {
72
- util_1.setHTMLAttributes(attributes, this._renderer, this._elRef.nativeElement);
73
- var el = this._elRef.nativeElement;
74
+ util_1.setHTMLAttributes(attributes, this.renderer, this.wrapper.nativeElement);
75
+ var el = this.wrapper.nativeElement;
74
76
  var dir = el.getAttribute('dir');
75
77
  var tIndex = el.getAttribute('tabindex');
76
78
  if (this.direction !== dir) {
@@ -105,30 +107,10 @@ var DialogComponent = /** @class */ (function () {
105
107
  enumerable: true,
106
108
  configurable: true
107
109
  });
108
- /**
109
- * @hidden
110
- */
111
- DialogComponent.prototype.onComponentKeydown = function (event) {
112
- var target = event.target;
113
- var parent = target.parentElement;
114
- if (util_1.hasClasses(target, util_1.DIALOG_ELEMENTS_HANDLING_ESC_KEY) || util_1.hasClasses(parent, util_1.DIALOG_ELEMENTS_HANDLING_ESC_KEY)) {
115
- if (event.keyCode === util_1.Keys.esc) {
116
- this.close.emit(new dialog_settings_1.DialogCloseResult());
117
- }
118
- }
119
- if (util_1.hasClasses(target, 'k-button') &&
120
- util_1.hasClasses(parent, util_1.DIALOG_ELEMENTS_HANDLING_ARROWS) &&
121
- (event.keyCode === util_1.Keys.left || event.keyCode === util_1.Keys.right)) {
122
- this.handleActionButtonFocus(parent, event.keyCode);
123
- }
124
- if (event.keyCode === util_1.Keys.tab) {
125
- this.keepFocusWithinComponent(target, event);
126
- }
127
- };
128
110
  DialogComponent.prototype.ngAfterContentInit = function () {
129
111
  var _this = this;
130
112
  this.bubble('close', this.titlebarContent.first);
131
- this._renderer.setAttribute(this._elRef.nativeElement.querySelector('.k-dialog'), 'aria-describedby', this.contentId);
113
+ this.renderer.setAttribute(this.wrapper.nativeElement.querySelector('.k-dialog'), 'aria-describedby', this.contentId);
132
114
  if (this.titlebarContent.first) {
133
115
  this.titlebarContent.first.id = this.titleId;
134
116
  }
@@ -136,9 +118,9 @@ var DialogComponent = /** @class */ (function () {
136
118
  this.subscriptions.push(this.titlebarContent.changes.subscribe(function () {
137
119
  if (util_1.isPresent(_this.titlebarContent.first)) {
138
120
  _this.titlebarContent.first.id = _this.titleId;
139
- _this.zone.onStable.pipe(operators_1.take(1)).subscribe(function () {
121
+ _this.ngZone.onStable.pipe(operators_1.take(1)).subscribe(function () {
140
122
  _this.bubble('close', _this.titlebarContent.first);
141
- _this._renderer.setAttribute(_this._elRef.nativeElement.querySelector('.k-dialog'), 'aria-labelledby', _this.titleId);
123
+ _this.renderer.setAttribute(_this.wrapper.nativeElement.querySelector('.k-dialog'), 'aria-labelledby', _this.titleId);
142
124
  });
143
125
  }
144
126
  }));
@@ -151,48 +133,86 @@ var DialogComponent = /** @class */ (function () {
151
133
  this.bubble('action', this.actionsView);
152
134
  if (this.titlebarView.first || this.titlebarContent.first) {
153
135
  //Needed for Dialogs created via service
154
- this._renderer.setAttribute(this._elRef.nativeElement.querySelector('.k-dialog'), 'aria-labelledby', this.titleId);
136
+ this.renderer.setAttribute(this.wrapper.nativeElement.querySelector('.k-dialog'), 'aria-labelledby', this.titleId);
155
137
  }
156
138
  else {
157
139
  this.subscriptions.push(this.titlebarView.changes.subscribe(function () {
158
140
  if (util_1.isPresent(_this.titlebarView.first)) {
159
141
  _this.titlebarView.first.id = _this.titleId;
160
- _this.zone.onStable.pipe(operators_1.take(1)).subscribe(function () {
142
+ _this.ngZone.onStable.pipe(operators_1.take(1)).subscribe(function () {
161
143
  _this.bubble('close', _this.titlebarView.first);
162
- _this._renderer.setAttribute(_this._elRef.nativeElement.querySelector('.k-dialog'), 'aria-labelledby', _this.titleId);
144
+ _this.renderer.setAttribute(_this.wrapper.nativeElement.querySelector('.k-dialog'), 'aria-labelledby', _this.titleId);
163
145
  });
164
146
  }
165
147
  }));
166
148
  }
149
+ this.initDomEvents();
167
150
  };
168
151
  DialogComponent.prototype.ngOnInit = function () {
169
- this._renderer.removeAttribute(this._elRef.nativeElement, 'title');
152
+ this.renderer.removeAttribute(this.wrapper.nativeElement, 'title');
170
153
  this.cdr.detectChanges();
171
154
  };
172
155
  DialogComponent.prototype.ngOnDestroy = function () {
173
156
  this.subscriptions.forEach(function (s) { return s.unsubscribe(); });
174
157
  this.subscriptions = [];
158
+ if (this.domSubs) {
159
+ this.domSubs.unsubscribe();
160
+ }
175
161
  };
176
162
  /**
177
163
  * Focuses the wrapper of the Dialog component.
178
164
  */
179
165
  DialogComponent.prototype.focus = function () {
180
- var wrapper = this._elRef.nativeElement;
166
+ var wrapper = this.wrapper.nativeElement;
181
167
  if (util_1.isPresent(wrapper)) {
182
168
  wrapper.focus();
183
169
  }
184
170
  };
171
+ DialogComponent.prototype.initDomEvents = function () {
172
+ var _this = this;
173
+ if (!this.wrapper) {
174
+ return;
175
+ }
176
+ this.ngZone.runOutsideAngular(function () {
177
+ _this.domSubs.add(_this.renderer.listen(_this.wrapper.nativeElement, 'keydown', function (ev) {
178
+ _this.onKeyDown(ev);
179
+ }));
180
+ });
181
+ };
182
+ DialogComponent.prototype.onKeyDown = function (event) {
183
+ var _this = this;
184
+ var target = event.target;
185
+ var parent = target.parentElement;
186
+ if (util_1.hasClasses(target, util_1.DIALOG_ELEMENTS_HANDLING_ESC_KEY) || util_1.hasClasses(parent, util_1.DIALOG_ELEMENTS_HANDLING_ESC_KEY)) {
187
+ if (event.keyCode === util_1.Keys.esc) {
188
+ this.ngZone.run(function () {
189
+ _this.close.emit(new dialog_settings_1.DialogCloseResult());
190
+ });
191
+ }
192
+ }
193
+ if (util_1.hasClasses(target, 'k-button') && util_1.hasClasses(parent, util_1.DIALOG_ELEMENTS_HANDLING_ARROWS) &&
194
+ (event.keyCode === util_1.Keys.left || event.keyCode === util_1.Keys.right)) {
195
+ this.ngZone.run(function () {
196
+ _this.handleActionButtonFocus(parent, event.keyCode);
197
+ });
198
+ }
199
+ if (event.keyCode === util_1.Keys.tab) {
200
+ this.ngZone.run(function () {
201
+ _this.keepFocusWithinComponent(target, event);
202
+ });
203
+ }
204
+ };
185
205
  DialogComponent.prototype.setServiceClasses = function (prevValue, value) {
186
206
  var _this = this;
187
- var el = this._elRef.nativeElement;
207
+ var el = this.wrapper.nativeElement;
188
208
  if (prevValue) {
189
209
  util_1.parseCSSClassNames(prevValue).forEach(function (className) {
190
- _this._renderer.removeClass(el, className);
210
+ _this.renderer.removeClass(el, className);
191
211
  });
192
212
  }
193
213
  if (value) {
194
214
  util_1.parseCSSClassNames(value).forEach(function (className) {
195
- _this._renderer.addClass(el, className);
215
+ _this.renderer.addClass(el, className);
196
216
  });
197
217
  }
198
218
  };
@@ -200,7 +220,7 @@ var DialogComponent = /** @class */ (function () {
200
220
  * @hidden
201
221
  */
202
222
  DialogComponent.prototype.handleInitialFocus = function () {
203
- var wrapper = this._elRef.nativeElement;
223
+ var wrapper = this.wrapper.nativeElement;
204
224
  var primaryButton = wrapper.querySelector('.k-primary');
205
225
  if (this.autoFocusedElement) {
206
226
  var initiallyFocusedElement = wrapper.querySelector(this.autoFocusedElement);
@@ -238,7 +258,7 @@ var DialogComponent = /** @class */ (function () {
238
258
  * @hidden
239
259
  */
240
260
  DialogComponent.prototype.keepFocusWithinComponent = function (target, event) {
241
- var wrapper = this._elRef.nativeElement;
261
+ var wrapper = this.wrapper.nativeElement;
242
262
  var _a = this.getFirstAndLastFocusable(wrapper), firstFocusable = _a[0], lastFocusable = _a[1];
243
263
  var tabAfterLastFocusable = !event.shiftKey && target === lastFocusable;
244
264
  var shiftTabAfterFirstFocusable = event.shiftKey && target === firstFocusable;
@@ -394,12 +414,6 @@ var DialogComponent = /** @class */ (function () {
394
414
  core_1.ViewChild(dialog_actions_component_1.DialogActionsComponent, { static: false }),
395
415
  tslib_1.__metadata("design:type", dialog_actions_component_1.DialogActionsComponent)
396
416
  ], DialogComponent.prototype, "actionsView", void 0);
397
- tslib_1.__decorate([
398
- core_1.HostListener('keydown', ['$event']),
399
- tslib_1.__metadata("design:type", Function),
400
- tslib_1.__metadata("design:paramtypes", [Object]),
401
- tslib_1.__metadata("design:returntype", void 0)
402
- ], DialogComponent.prototype, "onComponentKeydown", null);
403
417
  tslib_1.__decorate([
404
418
  core_1.HostBinding('class.k-dialog-wrapper'),
405
419
  tslib_1.__metadata("design:type", Boolean),
@@ -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: 1634644651,
14
+ publishDate: 1636732380,
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
  };
@@ -12,10 +12,12 @@ var util_1 = require("../common/util");
12
12
  * @hidden
13
13
  */
14
14
  var NavigationService = /** @class */ (function () {
15
- function NavigationService(window) {
15
+ function NavigationService(window, ngZone) {
16
16
  this.window = window;
17
+ this.ngZone = ngZone;
17
18
  }
18
19
  NavigationService.prototype.process = function (ev) {
20
+ var _this = this;
19
21
  var key = ev.keyCode;
20
22
  switch (key) {
21
23
  case util_1.Keys.up:
@@ -23,11 +25,15 @@ var NavigationService = /** @class */ (function () {
23
25
  case util_1.Keys.left:
24
26
  case util_1.Keys.right: {
25
27
  ev.preventDefault();
26
- this.handleArrow(key, ev);
28
+ this.ngZone.run(function () {
29
+ _this.handleArrow(key, ev);
30
+ });
27
31
  break;
28
32
  }
29
33
  case util_1.Keys.esc:
30
- this.handleEscape();
34
+ this.ngZone.run(function () {
35
+ _this.handleEscape();
36
+ });
31
37
  break;
32
38
  default:
33
39
  break;
@@ -143,7 +149,8 @@ var NavigationService = /** @class */ (function () {
143
149
  };
144
150
  NavigationService = tslib_1.__decorate([
145
151
  core_1.Injectable(),
146
- tslib_1.__metadata("design:paramtypes", [drag_resize_service_1.DragResizeService])
152
+ tslib_1.__metadata("design:paramtypes", [drag_resize_service_1.DragResizeService,
153
+ core_1.NgZone])
147
154
  ], NavigationService);
148
155
  return NavigationService;
149
156
  }());
@@ -83,6 +83,7 @@ var WindowComponent = /** @class */ (function () {
83
83
  this.draged = false;
84
84
  this.resized = false;
85
85
  this.windowSubscription = new rxjs_1.Subscription();
86
+ this.domSubs = new rxjs_1.Subscription();
86
87
  kendo_licensing_1.validatePackage(package_metadata_1.packageMetadata);
87
88
  this.direction = this.localization.rtl ? 'rtl' : 'ltr';
88
89
  this.localizationChangeSubscription = this.localization.changes
@@ -324,6 +325,7 @@ var WindowComponent = /** @class */ (function () {
324
325
  this.ngZone.runOutsideAngular(function () {
325
326
  return Promise.resolve(null).then(function () { return _this.setInitialOffset(); });
326
327
  });
328
+ this.initDomEvents();
327
329
  };
328
330
  WindowComponent.prototype.ngOnInit = function () {
329
331
  this.renderer.removeAttribute(this.el.nativeElement, 'title');
@@ -359,6 +361,9 @@ var WindowComponent = /** @class */ (function () {
359
361
  if (this.windowSubscription) {
360
362
  this.windowSubscription.unsubscribe();
361
363
  }
364
+ if (this.domSubs) {
365
+ this.domSubs.unsubscribe();
366
+ }
362
367
  this.localizationChangeSubscription.unsubscribe();
363
368
  };
364
369
  /**
@@ -444,14 +449,6 @@ var WindowComponent = /** @class */ (function () {
444
449
  enumerable: true,
445
450
  configurable: true
446
451
  });
447
- /**
448
- * @hidden
449
- */
450
- WindowComponent.prototype.onComponentKeydown = function (event) {
451
- if (util_1.hasClasses(event.target, util_1.WINDOW_CLASSES)) {
452
- this.navigation.process(event);
453
- }
454
- };
455
452
  /**
456
453
  * @hidden
457
454
  */
@@ -526,6 +523,22 @@ var WindowComponent = /** @class */ (function () {
526
523
  }
527
524
  }));
528
525
  };
526
+ WindowComponent.prototype.initDomEvents = function () {
527
+ var _this = this;
528
+ if (!this.el) {
529
+ return;
530
+ }
531
+ this.ngZone.runOutsideAngular(function () {
532
+ _this.domSubs.add(_this.renderer.listen(_this.el.nativeElement, 'keydown', function (ev) {
533
+ _this.onKeyDown(ev);
534
+ }));
535
+ });
536
+ };
537
+ WindowComponent.prototype.onKeyDown = function (event) {
538
+ if (util_1.hasClasses(event.target, util_1.WINDOW_CLASSES)) {
539
+ this.navigation.process(event);
540
+ }
541
+ };
529
542
  WindowComponent.prototype.setServiceClasses = function (prevValue, value) {
530
543
  var _this = this;
531
544
  var el = this.el.nativeElement;
@@ -754,12 +767,6 @@ var WindowComponent = /** @class */ (function () {
754
767
  tslib_1.__metadata("design:type", Boolean),
755
768
  tslib_1.__metadata("design:paramtypes", [])
756
769
  ], WindowComponent.prototype, "wrapperMinimizedClass", null);
757
- tslib_1.__decorate([
758
- core_1.HostListener('keydown', ['$event']),
759
- tslib_1.__metadata("design:type", Function),
760
- tslib_1.__metadata("design:paramtypes", [Object]),
761
- tslib_1.__metadata("design:returntype", void 0)
762
- ], WindowComponent.prototype, "onComponentKeydown", null);
763
770
  tslib_1.__decorate([
764
771
  core_1.HostListener('focus'),
765
772
  tslib_1.__metadata("design:type", Function),