@progress/kendo-angular-dialog 5.2.1-dev.202110281710 → 5.2.3-dev.202111171048
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/dialog/dialog.component.js +60 -46
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/window/navigation.service.js +12 -5
- package/dist/es/window/window.component.js +25 -14
- package/dist/es2015/dialog/dialog.component.d.ts +7 -8
- package/dist/es2015/dialog/dialog.component.js +58 -46
- package/dist/es2015/index.metadata.json +1 -1
- package/dist/es2015/package-metadata.js +1 -1
- package/dist/es2015/window/navigation.service.d.ts +3 -1
- package/dist/es2015/window/navigation.service.js +11 -5
- package/dist/es2015/window/window.component.d.ts +3 -4
- package/dist/es2015/window/window.component.js +24 -14
- package/dist/fesm2015/index.js +93 -66
- package/dist/fesm5/index.js +97 -66
- package/dist/npm/dialog/dialog.component.js +59 -45
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/window/navigation.service.js +11 -4
- package/dist/npm/window/window.component.js +25 -14
- package/dist/systemjs/kendo-angular-dialog.js +1 -1
- package/package.json +1 -1
package/dist/fesm5/index.js
CHANGED
|
@@ -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,
|
|
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,
|
|
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:
|
|
242
|
+
publishDate: 1637146063,
|
|
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(
|
|
469
|
+
function DialogComponent(wrapper, renderer, localization, cdr, ngZone) {
|
|
470
470
|
var _this = this;
|
|
471
|
-
this.
|
|
472
|
-
this.
|
|
471
|
+
this.wrapper = wrapper;
|
|
472
|
+
this.renderer = renderer;
|
|
473
473
|
this.cdr = cdr;
|
|
474
|
-
this.
|
|
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.
|
|
519
|
-
var el = this.
|
|
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.
|
|
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.
|
|
566
|
+
_this.ngZone.onStable.pipe(take(1)).subscribe(function () {
|
|
586
567
|
_this.bubble('close', _this.titlebarContent.first);
|
|
587
|
-
_this.
|
|
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.
|
|
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.
|
|
587
|
+
_this.ngZone.onStable.pipe(take(1)).subscribe(function () {
|
|
607
588
|
_this.bubble('close', _this.titlebarView.first);
|
|
608
|
-
_this.
|
|
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.
|
|
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.
|
|
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.
|
|
652
|
+
var el = this.wrapper.nativeElement;
|
|
634
653
|
if (prevValue) {
|
|
635
654
|
parseCSSClassNames(prevValue).forEach(function (className) {
|
|
636
|
-
_this.
|
|
655
|
+
_this.renderer.removeClass(el, className);
|
|
637
656
|
});
|
|
638
657
|
}
|
|
639
658
|
if (value) {
|
|
640
659
|
parseCSSClassNames(value).forEach(function (className) {
|
|
641
|
-
_this.
|
|
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.
|
|
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.
|
|
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.
|
|
1720
|
+
this.ngZone.run(function () {
|
|
1721
|
+
_this.handleArrow(key, ev);
|
|
1722
|
+
});
|
|
1706
1723
|
break;
|
|
1707
1724
|
}
|
|
1708
1725
|
case Keys.esc:
|
|
1709
|
-
this.
|
|
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
|
}());
|
|
@@ -1889,10 +1909,15 @@ var WindowComponent = /** @class */ (function () {
|
|
|
1889
1909
|
* two-way binding of the `state` property.
|
|
1890
1910
|
*/
|
|
1891
1911
|
this.stateChange = new EventEmitter();
|
|
1912
|
+
/**
|
|
1913
|
+
* @hidden
|
|
1914
|
+
*/
|
|
1915
|
+
this.messages = {};
|
|
1892
1916
|
this.tabIndex = 0;
|
|
1893
1917
|
this.draged = false;
|
|
1894
1918
|
this.resized = false;
|
|
1895
1919
|
this.windowSubscription = new Subscription();
|
|
1920
|
+
this.domSubs = new Subscription();
|
|
1896
1921
|
validatePackage(packageMetadata);
|
|
1897
1922
|
this.direction = this.localization.rtl ? 'rtl' : 'ltr';
|
|
1898
1923
|
this.localizationChangeSubscription = this.localization.changes
|
|
@@ -2134,6 +2159,7 @@ var WindowComponent = /** @class */ (function () {
|
|
|
2134
2159
|
this.ngZone.runOutsideAngular(function () {
|
|
2135
2160
|
return Promise.resolve(null).then(function () { return _this.setInitialOffset(); });
|
|
2136
2161
|
});
|
|
2162
|
+
this.initDomEvents();
|
|
2137
2163
|
};
|
|
2138
2164
|
WindowComponent.prototype.ngOnInit = function () {
|
|
2139
2165
|
this.renderer.removeAttribute(this.el.nativeElement, 'title');
|
|
@@ -2169,6 +2195,9 @@ var WindowComponent = /** @class */ (function () {
|
|
|
2169
2195
|
if (this.windowSubscription) {
|
|
2170
2196
|
this.windowSubscription.unsubscribe();
|
|
2171
2197
|
}
|
|
2198
|
+
if (this.domSubs) {
|
|
2199
|
+
this.domSubs.unsubscribe();
|
|
2200
|
+
}
|
|
2172
2201
|
this.localizationChangeSubscription.unsubscribe();
|
|
2173
2202
|
};
|
|
2174
2203
|
/**
|
|
@@ -2254,14 +2283,6 @@ var WindowComponent = /** @class */ (function () {
|
|
|
2254
2283
|
enumerable: true,
|
|
2255
2284
|
configurable: true
|
|
2256
2285
|
});
|
|
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
2286
|
/**
|
|
2266
2287
|
* @hidden
|
|
2267
2288
|
*/
|
|
@@ -2336,6 +2357,22 @@ var WindowComponent = /** @class */ (function () {
|
|
|
2336
2357
|
}
|
|
2337
2358
|
}));
|
|
2338
2359
|
};
|
|
2360
|
+
WindowComponent.prototype.initDomEvents = function () {
|
|
2361
|
+
var _this = this;
|
|
2362
|
+
if (!this.el) {
|
|
2363
|
+
return;
|
|
2364
|
+
}
|
|
2365
|
+
this.ngZone.runOutsideAngular(function () {
|
|
2366
|
+
_this.domSubs.add(_this.renderer.listen(_this.el.nativeElement, 'keydown', function (ev) {
|
|
2367
|
+
_this.onKeyDown(ev);
|
|
2368
|
+
}));
|
|
2369
|
+
});
|
|
2370
|
+
};
|
|
2371
|
+
WindowComponent.prototype.onKeyDown = function (event) {
|
|
2372
|
+
if (hasClasses(event.target, WINDOW_CLASSES)) {
|
|
2373
|
+
this.navigation.process(event);
|
|
2374
|
+
}
|
|
2375
|
+
};
|
|
2339
2376
|
WindowComponent.prototype.setServiceClasses = function (prevValue, value) {
|
|
2340
2377
|
var _this = this;
|
|
2341
2378
|
var el = this.el.nativeElement;
|
|
@@ -2564,12 +2601,6 @@ var WindowComponent = /** @class */ (function () {
|
|
|
2564
2601
|
__metadata("design:type", Boolean),
|
|
2565
2602
|
__metadata("design:paramtypes", [])
|
|
2566
2603
|
], 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
2604
|
__decorate([
|
|
2574
2605
|
HostListener('focus'),
|
|
2575
2606
|
__metadata("design:type", Function),
|
|
@@ -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(
|
|
24
|
+
function DialogComponent(wrapper, renderer, localization, cdr, ngZone) {
|
|
24
25
|
var _this = this;
|
|
25
|
-
this.
|
|
26
|
-
this.
|
|
26
|
+
this.wrapper = wrapper;
|
|
27
|
+
this.renderer = renderer;
|
|
27
28
|
this.cdr = cdr;
|
|
28
|
-
this.
|
|
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.
|
|
73
|
-
var el = this.
|
|
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.
|
|
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.
|
|
121
|
+
_this.ngZone.onStable.pipe(operators_1.take(1)).subscribe(function () {
|
|
140
122
|
_this.bubble('close', _this.titlebarContent.first);
|
|
141
|
-
_this.
|
|
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.
|
|
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.
|
|
142
|
+
_this.ngZone.onStable.pipe(operators_1.take(1)).subscribe(function () {
|
|
161
143
|
_this.bubble('close', _this.titlebarView.first);
|
|
162
|
-
_this.
|
|
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.
|
|
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.
|
|
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.
|
|
207
|
+
var el = this.wrapper.nativeElement;
|
|
188
208
|
if (prevValue) {
|
|
189
209
|
util_1.parseCSSClassNames(prevValue).forEach(function (className) {
|
|
190
|
-
_this.
|
|
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.
|
|
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.
|
|
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.
|
|
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:
|
|
14
|
+
publishDate: 1637146063,
|
|
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.
|
|
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.
|
|
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
|
}());
|