@progress/kendo-angular-dialog 6.0.3-dev.202203091004 → 7.0.0-next.202203171702
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/bundles/kendo-angular-dialog.umd.js +5 -0
- package/{dist/es2015/common → common}/actions-layout.d.ts +0 -0
- package/{dist/es2015/common → common}/preventable-event.d.ts +0 -0
- package/{dist/es2015/common → common}/util.d.ts +1 -1
- package/{dist/es2015/dialog → dialog}/dialog-actions.component.d.ts +14 -7
- package/{dist/es2015/dialog → dialog}/dialog-container.directive.d.ts +3 -0
- package/dialog/dialog-container.service.d.ts +16 -0
- package/{dist/es2015/dialog → dialog}/dialog-content-base.d.ts +4 -1
- package/{dist/es2015/dialog → dialog}/dialog-titlebar.component.d.ts +5 -2
- package/{dist/es2015/dialog → dialog}/dialog.component.d.ts +13 -6
- package/{dist/es2015/dialog → dialog}/dialog.service.d.ts +5 -1
- package/dialog/models/dialog-action.d.ts +28 -0
- package/dialog/models/dialog-close-result.d.ts +11 -0
- package/dialog/models/dialog-ref.d.ts +38 -0
- package/dialog/models/dialog-result.d.ts +14 -0
- package/{dist/es2015/dialog → dialog/models}/dialog-settings.d.ts +5 -73
- package/{dist/es/localization/dialog-localization.service.js → dialog/models/index.d.ts} +5 -5
- package/{dist/es2015/dialog.module.d.ts → dialog.module.d.ts} +11 -0
- package/{dist/es2015/dialogs.module.d.ts → dialogs.module.d.ts} +6 -0
- package/{dist/es2015 → esm2015}/common/actions-layout.js +1 -0
- package/{dist/es2015 → esm2015}/common/preventable-event.js +0 -0
- package/{dist/es2015 → esm2015}/common/util.js +0 -5
- package/esm2015/dialog/dialog-actions.component.js +115 -0
- package/esm2015/dialog/dialog-container.directive.js +30 -0
- package/esm2015/dialog/dialog-container.service.js +23 -0
- package/{dist/es2015 → esm2015}/dialog/dialog-content-base.js +18 -10
- package/esm2015/dialog/dialog-titlebar.component.js +136 -0
- package/{dist/es2015 → esm2015}/dialog/dialog.component.js +123 -113
- package/{dist/es2015 → esm2015}/dialog/dialog.service.js +16 -15
- package/{dist/es2015/window/window-container.service.d.ts → esm2015/dialog/models/dialog-action.js} +3 -5
- package/esm2015/dialog/models/dialog-close-result.js +11 -0
- package/esm2015/dialog/models/dialog-ref.js +11 -0
- package/{dist/es/common/actions-layout.js → esm2015/dialog/models/dialog-result.js} +1 -0
- package/{dist/es2015/dialog/dialog-container.service.d.ts → esm2015/dialog/models/dialog-settings.js} +3 -5
- package/esm2015/dialog/models/index.js +9 -0
- package/{dist/es2015 → esm2015}/dialog.module.js +20 -13
- package/{dist/es → esm2015}/dialogs.module.js +12 -12
- package/esm2015/kendo-angular-dialog.js +8 -0
- package/esm2015/localization/custom-messages.component.js +41 -0
- package/{dist/es2015 → esm2015}/localization/dialog-localization.service.js +0 -0
- package/esm2015/localization/localized-messages.directive.js +40 -0
- package/esm2015/localization/messages.js +28 -0
- package/esm2015/localization/titlebar-localization.service.js +44 -0
- package/{dist/es2015 → esm2015}/main.js +8 -2
- package/{dist/es2015 → esm2015}/package-metadata.js +1 -1
- package/esm2015/shared.module.js +38 -0
- package/esm2015/window/actions/window-close-action.directive.js +59 -0
- package/esm2015/window/actions/window-maximize-action.directive.js +65 -0
- package/esm2015/window/actions/window-minimize-action.directive.js +65 -0
- package/esm2015/window/actions/window-restore-action.directive.js +65 -0
- package/{dist/es2015 → esm2015}/window/drag-resize.service.js +9 -11
- package/esm2015/window/models/index.js +10 -0
- package/esm2015/window/models/window-close-result.js +9 -0
- package/{dist/es2015/window/window-events.js → esm2015/window/models/window-messages.js} +1 -0
- package/esm2015/window/models/window-options.js +5 -0
- package/{dist/es2015/window/window-settings.js → esm2015/window/models/window-ref.js} +0 -11
- package/esm2015/window/models/window-settings.js +10 -0
- package/esm2015/window/models/window-types.js +5 -0
- package/{dist/es2015 → esm2015}/window/navigation.service.js +10 -11
- package/esm2015/window/window-container.directive.js +30 -0
- package/esm2015/window/window-container.service.js +23 -0
- package/{dist/es → esm2015}/window/window-events.js +1 -0
- package/{dist/es2015 → esm2015}/window/window-resize-handle.directive.js +21 -26
- package/{dist/es2015 → esm2015}/window/window-titlebar.component.js +35 -34
- package/{dist/es2015 → esm2015}/window/window.component.js +168 -187
- package/{dist/es2015 → esm2015}/window/window.service.js +15 -14
- package/{dist/es2015 → esm2015}/window.module.js +29 -17
- package/{dist/fesm2015/index.js → fesm2015/kendo-angular-dialog.js} +1023 -926
- package/{dist/es2015/shared.module.d.ts → kendo-angular-dialog.d.ts} +3 -7
- package/{dist/es2015/localization → localization}/custom-messages.component.d.ts +4 -1
- package/{dist/es2015/localization → localization}/dialog-localization.service.d.ts +0 -0
- package/{dist/es2015/localization → localization}/localized-messages.directive.d.ts +3 -0
- package/{dist/es2015/localization → localization}/messages.d.ts +3 -0
- package/{dist/es2015/localization → localization}/titlebar-localization.service.d.ts +3 -0
- package/{dist/es2015/main.d.ts → main.d.ts} +7 -2
- package/{dist/es2015/package-metadata.d.ts → package-metadata.d.ts} +0 -0
- package/package.json +33 -105
- package/schematics/ngAdd/index.js +5 -2
- package/schematics/ngAdd/index.js.map +1 -1
- package/shared.module.d.ts +21 -0
- package/{dist/es2015/window → window}/actions/window-close-action.directive.d.ts +3 -0
- package/{dist/es2015/window → window}/actions/window-maximize-action.directive.d.ts +4 -1
- package/{dist/es2015/window → window}/actions/window-minimize-action.directive.d.ts +4 -1
- package/{dist/es2015/window → window}/actions/window-restore-action.directive.d.ts +4 -1
- package/{dist/es2015/window → window}/drag-resize.service.d.ts +8 -4
- package/window/models/index.d.ts +10 -0
- package/window/models/window-close-result.d.ts +9 -0
- package/window/models/window-messages.d.ts +26 -0
- package/window/models/window-options.d.ts +20 -0
- package/window/models/window-ref.d.ts +40 -0
- package/{dist/es2015/window → window/models}/window-settings.d.ts +4 -84
- package/window/models/window-types.d.ts +11 -0
- package/{dist/es2015/window → window}/navigation.service.d.ts +4 -1
- package/{dist/es2015/window → window}/window-container.directive.d.ts +3 -0
- package/window/window-container.service.d.ts +16 -0
- package/{dist/es2015/window → window}/window-events.d.ts +0 -0
- package/{dist/es2015/window → window}/window-resize-handle.directive.d.ts +4 -1
- package/{dist/es2015/window → window}/window-titlebar.component.d.ts +6 -3
- package/{dist/es2015/window → window}/window.component.d.ts +42 -25
- package/{dist/es2015/window → window}/window.service.d.ts +5 -1
- package/window.module.d.ts +45 -0
- package/dist/cdn/js/kendo-angular-dialog.js +0 -20
- package/dist/cdn/main.js +0 -5
- package/dist/es/common/preventable-event.js +0 -29
- package/dist/es/common/util.js +0 -214
- package/dist/es/dialog/dialog-actions.component.js +0 -89
- package/dist/es/dialog/dialog-container.directive.js +0 -31
- package/dist/es/dialog/dialog-container.service.js +0 -31
- package/dist/es/dialog/dialog-content-base.js +0 -45
- package/dist/es/dialog/dialog-settings.js +0 -46
- package/dist/es/dialog/dialog-titlebar.component.js +0 -94
- package/dist/es/dialog/dialog.component.js +0 -462
- package/dist/es/dialog/dialog.service.js +0 -214
- package/dist/es/dialog.module.js +0 -56
- package/dist/es/index.js +0 -22
- package/dist/es/localization/custom-messages.component.js +0 -44
- package/dist/es/localization/localized-messages.directive.js +0 -35
- package/dist/es/localization/messages.js +0 -34
- package/dist/es/localization/titlebar-localization.service.js +0 -34
- package/dist/es/main.js +0 -21
- package/dist/es/package-metadata.js +0 -15
- package/dist/es/shared.module.js +0 -34
- package/dist/es/window/actions/window-close-action.directive.js +0 -63
- package/dist/es/window/actions/window-maximize-action.directive.js +0 -75
- package/dist/es/window/actions/window-minimize-action.directive.js +0 -75
- package/dist/es/window/actions/window-restore-action.directive.js +0 -75
- package/dist/es/window/drag-resize.service.js +0 -351
- package/dist/es/window/navigation.service.js +0 -155
- package/dist/es/window/window-container.directive.js +0 -31
- package/dist/es/window/window-container.service.js +0 -31
- package/dist/es/window/window-resize-handle.directive.js +0 -78
- package/dist/es/window/window-settings.js +0 -34
- package/dist/es/window/window-titlebar.component.js +0 -144
- package/dist/es/window/window.component.js +0 -808
- package/dist/es/window/window.service.js +0 -214
- package/dist/es/window.module.js +0 -76
- package/dist/es2015/dialog/dialog-actions.component.js +0 -98
- package/dist/es2015/dialog/dialog-container.directive.js +0 -30
- package/dist/es2015/dialog/dialog-container.service.js +0 -23
- package/dist/es2015/dialog/dialog-settings.js +0 -30
- package/dist/es2015/dialog/dialog-titlebar.component.js +0 -106
- package/dist/es2015/dialogs.module.js +0 -41
- package/dist/es2015/index.d.ts +0 -22
- package/dist/es2015/index.js +0 -22
- package/dist/es2015/index.metadata.json +0 -1
- package/dist/es2015/localization/custom-messages.component.js +0 -36
- package/dist/es2015/localization/localized-messages.directive.js +0 -35
- package/dist/es2015/localization/messages.js +0 -28
- package/dist/es2015/localization/titlebar-localization.service.js +0 -31
- package/dist/es2015/shared.module.js +0 -31
- package/dist/es2015/window/actions/window-close-action.directive.js +0 -60
- package/dist/es2015/window/actions/window-maximize-action.directive.js +0 -68
- package/dist/es2015/window/actions/window-minimize-action.directive.js +0 -68
- package/dist/es2015/window/actions/window-restore-action.directive.js +0 -68
- package/dist/es2015/window/window-container.directive.js +0 -30
- package/dist/es2015/window/window-container.service.js +0 -23
- package/dist/es2015/window.module.d.ts +0 -28
- package/dist/fesm5/index.js +0 -3474
- package/dist/npm/common/actions-layout.js +0 -6
- package/dist/npm/common/preventable-event.js +0 -31
- package/dist/npm/common/util.js +0 -219
- package/dist/npm/dialog/dialog-actions.component.js +0 -91
- package/dist/npm/dialog/dialog-container.directive.js +0 -33
- package/dist/npm/dialog/dialog-container.service.js +0 -33
- package/dist/npm/dialog/dialog-content-base.js +0 -47
- package/dist/npm/dialog/dialog-settings.js +0 -48
- package/dist/npm/dialog/dialog-titlebar.component.js +0 -96
- package/dist/npm/dialog/dialog.component.js +0 -464
- package/dist/npm/dialog/dialog.service.js +0 -216
- package/dist/npm/dialog.module.js +0 -58
- package/dist/npm/dialogs.module.js +0 -46
- package/dist/npm/index.js +0 -40
- package/dist/npm/localization/custom-messages.component.js +0 -46
- package/dist/npm/localization/dialog-localization.service.js +0 -11
- package/dist/npm/localization/localized-messages.directive.js +0 -37
- package/dist/npm/localization/messages.js +0 -36
- package/dist/npm/localization/titlebar-localization.service.js +0 -36
- package/dist/npm/main.js +0 -45
- package/dist/npm/package-metadata.js +0 -17
- package/dist/npm/shared.module.js +0 -36
- package/dist/npm/window/actions/window-close-action.directive.js +0 -65
- package/dist/npm/window/actions/window-maximize-action.directive.js +0 -77
- package/dist/npm/window/actions/window-minimize-action.directive.js +0 -77
- package/dist/npm/window/actions/window-restore-action.directive.js +0 -77
- package/dist/npm/window/drag-resize.service.js +0 -353
- package/dist/npm/window/navigation.service.js +0 -157
- package/dist/npm/window/window-container.directive.js +0 -33
- package/dist/npm/window/window-container.service.js +0 -33
- package/dist/npm/window/window-events.js +0 -6
- package/dist/npm/window/window-resize-handle.directive.js +0 -80
- package/dist/npm/window/window-settings.js +0 -36
- package/dist/npm/window/window-titlebar.component.js +0 -146
- package/dist/npm/window/window.component.js +0 -810
- package/dist/npm/window/window.service.js +0 -216
- package/dist/npm/window.module.js +0 -78
- package/dist/systemjs/kendo-angular-dialog.js +0 -5
|
@@ -1,464 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
"use strict";
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
var tslib_1 = require("tslib");
|
|
8
|
-
var core_1 = require("@angular/core");
|
|
9
|
-
var animations_1 = require("@angular/animations");
|
|
10
|
-
var dialog_actions_component_1 = require("./dialog-actions.component");
|
|
11
|
-
var dialog_titlebar_component_1 = require("./dialog-titlebar.component");
|
|
12
|
-
var kendo_angular_l10n_1 = require("@progress/kendo-angular-l10n");
|
|
13
|
-
var kendo_licensing_1 = require("@progress/kendo-licensing");
|
|
14
|
-
var package_metadata_1 = require("../package-metadata");
|
|
15
|
-
var util_1 = require("../common/util");
|
|
16
|
-
var dialog_settings_1 = require("./dialog-settings");
|
|
17
|
-
var dialog_localization_service_1 = require("./../localization/dialog-localization.service");
|
|
18
|
-
var operators_1 = require("rxjs/operators");
|
|
19
|
-
var rxjs_1 = require("rxjs");
|
|
20
|
-
/**
|
|
21
|
-
* Represents the [Kendo UI Dialog component for Angular]({% slug overview_dialog_dialogs %}).
|
|
22
|
-
*/
|
|
23
|
-
var DialogComponent = /** @class */ (function () {
|
|
24
|
-
function DialogComponent(wrapper, renderer, localization, cdr, ngZone) {
|
|
25
|
-
var _this = this;
|
|
26
|
-
this.wrapper = wrapper;
|
|
27
|
-
this.renderer = renderer;
|
|
28
|
-
this.cdr = cdr;
|
|
29
|
-
this.ngZone = ngZone;
|
|
30
|
-
/**
|
|
31
|
-
* Specifies the layout of the action buttons in the Dialog.
|
|
32
|
-
* This option is only applicable if the action buttons are specified through the `actions` options.
|
|
33
|
-
*
|
|
34
|
-
* @default 'stretched'
|
|
35
|
-
*/
|
|
36
|
-
this.actionsLayout = 'stretched';
|
|
37
|
-
/**
|
|
38
|
-
* @hidden
|
|
39
|
-
*/
|
|
40
|
-
this.titleId = null;
|
|
41
|
-
/**
|
|
42
|
-
* @hidden
|
|
43
|
-
*/
|
|
44
|
-
this.contentId = null;
|
|
45
|
-
/**
|
|
46
|
-
* Fires when the user clicks an action button of the Dialog.
|
|
47
|
-
* The event is fired only when the action buttons are specified through the `actions` options.
|
|
48
|
-
*/
|
|
49
|
-
this.action = new core_1.EventEmitter();
|
|
50
|
-
/**
|
|
51
|
-
* Fires when the user clicks the **Close** button of the Dialog or the **ESC** key.
|
|
52
|
-
*/
|
|
53
|
-
this.close = new core_1.EventEmitter();
|
|
54
|
-
this.tabIndex = 0;
|
|
55
|
-
this.subscriptions = [];
|
|
56
|
-
this.domSubs = new rxjs_1.Subscription();
|
|
57
|
-
kendo_licensing_1.validatePackage(package_metadata_1.packageMetadata);
|
|
58
|
-
this.direction = localization.rtl ? 'rtl' : 'ltr';
|
|
59
|
-
this.subscriptions.push(localization.changes.subscribe(function (_a) {
|
|
60
|
-
var rtl = _a.rtl;
|
|
61
|
-
return (_this.direction = rtl ? 'rtl' : 'ltr');
|
|
62
|
-
}));
|
|
63
|
-
this.titleId = this.generateTitleId();
|
|
64
|
-
this.contentId = this.generateContentId();
|
|
65
|
-
}
|
|
66
|
-
Object.defineProperty(DialogComponent.prototype, "htmlAttributes", {
|
|
67
|
-
get: function () {
|
|
68
|
-
return this._htmlAttributes;
|
|
69
|
-
},
|
|
70
|
-
/**
|
|
71
|
-
* @hidden
|
|
72
|
-
*/
|
|
73
|
-
set: function (attributes) {
|
|
74
|
-
util_1.setHTMLAttributes(attributes, this.renderer, this.wrapper.nativeElement);
|
|
75
|
-
var el = this.wrapper.nativeElement;
|
|
76
|
-
var dir = el.getAttribute('dir');
|
|
77
|
-
var tIndex = el.getAttribute('tabindex');
|
|
78
|
-
if (this.direction !== dir && dir) {
|
|
79
|
-
this.direction = dir;
|
|
80
|
-
}
|
|
81
|
-
if (this.tabIndex !== tIndex && tIndex) {
|
|
82
|
-
this.tabIndex = tIndex;
|
|
83
|
-
}
|
|
84
|
-
this._htmlAttributes = attributes;
|
|
85
|
-
},
|
|
86
|
-
enumerable: true,
|
|
87
|
-
configurable: true
|
|
88
|
-
});
|
|
89
|
-
Object.defineProperty(DialogComponent.prototype, "cssClass", {
|
|
90
|
-
get: function () {
|
|
91
|
-
return this._cssClass;
|
|
92
|
-
},
|
|
93
|
-
/**
|
|
94
|
-
* @hidden
|
|
95
|
-
*/
|
|
96
|
-
set: function (classes) {
|
|
97
|
-
this.setServiceClasses(this._cssClass, classes);
|
|
98
|
-
this._cssClass = classes;
|
|
99
|
-
},
|
|
100
|
-
enumerable: true,
|
|
101
|
-
configurable: true
|
|
102
|
-
});
|
|
103
|
-
Object.defineProperty(DialogComponent.prototype, "dir", {
|
|
104
|
-
get: function () {
|
|
105
|
-
return this.direction;
|
|
106
|
-
},
|
|
107
|
-
enumerable: true,
|
|
108
|
-
configurable: true
|
|
109
|
-
});
|
|
110
|
-
DialogComponent.prototype.ngAfterContentInit = function () {
|
|
111
|
-
var _this = this;
|
|
112
|
-
this.bubble('close', this.titlebarContent.first);
|
|
113
|
-
this.renderer.setAttribute(this.wrapper.nativeElement.querySelector('.k-dialog'), 'aria-describedby', this.contentId);
|
|
114
|
-
if (this.titlebarContent.first) {
|
|
115
|
-
this.titlebarContent.first.id = this.titleId;
|
|
116
|
-
}
|
|
117
|
-
else {
|
|
118
|
-
this.subscriptions.push(this.titlebarContent.changes.subscribe(function () {
|
|
119
|
-
if (util_1.isPresent(_this.titlebarContent.first)) {
|
|
120
|
-
_this.titlebarContent.first.id = _this.titleId;
|
|
121
|
-
_this.ngZone.onStable.pipe(operators_1.take(1)).subscribe(function () {
|
|
122
|
-
_this.bubble('close', _this.titlebarContent.first);
|
|
123
|
-
_this.renderer.setAttribute(_this.wrapper.nativeElement.querySelector('.k-dialog'), 'aria-labelledby', _this.titleId);
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
}));
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
DialogComponent.prototype.ngAfterViewInit = function () {
|
|
130
|
-
var _this = this;
|
|
131
|
-
this.handleInitialFocus();
|
|
132
|
-
this.bubble('close', this.titlebarView.first);
|
|
133
|
-
this.bubble('action', this.actionsView);
|
|
134
|
-
if (this.titlebarView.first || this.titlebarContent.first) {
|
|
135
|
-
//Needed for Dialogs created via service
|
|
136
|
-
this.renderer.setAttribute(this.wrapper.nativeElement.querySelector('.k-dialog'), 'aria-labelledby', this.titleId);
|
|
137
|
-
}
|
|
138
|
-
else {
|
|
139
|
-
this.subscriptions.push(this.titlebarView.changes.subscribe(function () {
|
|
140
|
-
if (util_1.isPresent(_this.titlebarView.first)) {
|
|
141
|
-
_this.titlebarView.first.id = _this.titleId;
|
|
142
|
-
_this.ngZone.onStable.pipe(operators_1.take(1)).subscribe(function () {
|
|
143
|
-
_this.bubble('close', _this.titlebarView.first);
|
|
144
|
-
_this.renderer.setAttribute(_this.wrapper.nativeElement.querySelector('.k-dialog'), 'aria-labelledby', _this.titleId);
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
}));
|
|
148
|
-
}
|
|
149
|
-
this.initDomEvents();
|
|
150
|
-
};
|
|
151
|
-
DialogComponent.prototype.ngOnInit = function () {
|
|
152
|
-
this.renderer.removeAttribute(this.wrapper.nativeElement, 'title');
|
|
153
|
-
this.cdr.detectChanges();
|
|
154
|
-
};
|
|
155
|
-
DialogComponent.prototype.ngOnDestroy = function () {
|
|
156
|
-
this.subscriptions.forEach(function (s) { return s.unsubscribe(); });
|
|
157
|
-
this.subscriptions = [];
|
|
158
|
-
if (this.domSubs) {
|
|
159
|
-
this.domSubs.unsubscribe();
|
|
160
|
-
}
|
|
161
|
-
};
|
|
162
|
-
/**
|
|
163
|
-
* Focuses the wrapper of the Dialog component.
|
|
164
|
-
*/
|
|
165
|
-
DialogComponent.prototype.focus = function () {
|
|
166
|
-
var wrapper = this.wrapper.nativeElement;
|
|
167
|
-
if (util_1.isPresent(wrapper)) {
|
|
168
|
-
wrapper.focus();
|
|
169
|
-
}
|
|
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
|
-
};
|
|
205
|
-
DialogComponent.prototype.setServiceClasses = function (prevValue, value) {
|
|
206
|
-
var _this = this;
|
|
207
|
-
var el = this.wrapper.nativeElement;
|
|
208
|
-
if (prevValue) {
|
|
209
|
-
util_1.parseCSSClassNames(prevValue).forEach(function (className) {
|
|
210
|
-
_this.renderer.removeClass(el, className);
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
if (value) {
|
|
214
|
-
util_1.parseCSSClassNames(value).forEach(function (className) {
|
|
215
|
-
_this.renderer.addClass(el, className);
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
};
|
|
219
|
-
/**
|
|
220
|
-
* @hidden
|
|
221
|
-
*/
|
|
222
|
-
DialogComponent.prototype.handleInitialFocus = function () {
|
|
223
|
-
var wrapper = this.wrapper.nativeElement;
|
|
224
|
-
var primaryButton = this.findPrimary(wrapper);
|
|
225
|
-
if (this.autoFocusedElement) {
|
|
226
|
-
var initiallyFocusedElement = wrapper.querySelector(this.autoFocusedElement);
|
|
227
|
-
if (initiallyFocusedElement) {
|
|
228
|
-
initiallyFocusedElement.focus();
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
else if (this.shouldFocusPrimary(primaryButton)) {
|
|
232
|
-
primaryButton.focus();
|
|
233
|
-
}
|
|
234
|
-
else {
|
|
235
|
-
wrapper.focus();
|
|
236
|
-
}
|
|
237
|
-
};
|
|
238
|
-
/**
|
|
239
|
-
* @hidden
|
|
240
|
-
*/
|
|
241
|
-
DialogComponent.prototype.findPrimary = function (wrapper) {
|
|
242
|
-
var actionBtns = wrapper.querySelectorAll('.k-actions .k-button');
|
|
243
|
-
return util_1.findPrimaryButton(actionBtns);
|
|
244
|
-
};
|
|
245
|
-
/**
|
|
246
|
-
* @hidden
|
|
247
|
-
*/
|
|
248
|
-
DialogComponent.prototype.handleActionButtonFocus = function (parent, key) {
|
|
249
|
-
var focusableActionButtons = this.getAllFocusableChildren(parent);
|
|
250
|
-
for (var i = 0; i < focusableActionButtons.length; i++) {
|
|
251
|
-
var current = focusableActionButtons[i];
|
|
252
|
-
if (current === document.activeElement) {
|
|
253
|
-
if (key === util_1.Keys.left && i > 0) {
|
|
254
|
-
focusableActionButtons[i - 1].focus();
|
|
255
|
-
break;
|
|
256
|
-
}
|
|
257
|
-
if (key === util_1.Keys.right && i < focusableActionButtons.length - 1) {
|
|
258
|
-
focusableActionButtons[i + 1].focus();
|
|
259
|
-
break;
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
};
|
|
264
|
-
/**
|
|
265
|
-
* @hidden
|
|
266
|
-
*/
|
|
267
|
-
DialogComponent.prototype.keepFocusWithinComponent = function (target, event) {
|
|
268
|
-
var wrapper = this.wrapper.nativeElement;
|
|
269
|
-
var _a = this.getFirstAndLastFocusable(wrapper), firstFocusable = _a[0], lastFocusable = _a[1];
|
|
270
|
-
var tabAfterLastFocusable = !event.shiftKey && target === lastFocusable;
|
|
271
|
-
var shiftTabAfterFirstFocusable = event.shiftKey && target === firstFocusable;
|
|
272
|
-
if (tabAfterLastFocusable) {
|
|
273
|
-
event.preventDefault();
|
|
274
|
-
firstFocusable.focus();
|
|
275
|
-
}
|
|
276
|
-
if (shiftTabAfterFirstFocusable) {
|
|
277
|
-
event.preventDefault();
|
|
278
|
-
lastFocusable.focus();
|
|
279
|
-
}
|
|
280
|
-
};
|
|
281
|
-
/**
|
|
282
|
-
* @hidden
|
|
283
|
-
*/
|
|
284
|
-
DialogComponent.prototype.shouldFocusPrimary = function (el) {
|
|
285
|
-
return util_1.isPresent(el) && util_1.isFocusable(el);
|
|
286
|
-
};
|
|
287
|
-
/**
|
|
288
|
-
* @hidden
|
|
289
|
-
*/
|
|
290
|
-
DialogComponent.prototype.getAllFocusableChildren = function (parent) {
|
|
291
|
-
return parent.querySelectorAll(util_1.focusableSelector);
|
|
292
|
-
};
|
|
293
|
-
/**
|
|
294
|
-
* @hidden
|
|
295
|
-
*/
|
|
296
|
-
DialogComponent.prototype.getFirstAndLastFocusable = function (parent) {
|
|
297
|
-
var all = this.getAllFocusableChildren(parent);
|
|
298
|
-
var firstFocusable = all.length > 0 ? all[0] : parent;
|
|
299
|
-
var lastFocusable = all.length > 0 ? all[all.length - 1] : parent;
|
|
300
|
-
return [firstFocusable, lastFocusable];
|
|
301
|
-
};
|
|
302
|
-
/**
|
|
303
|
-
* @hidden
|
|
304
|
-
*/
|
|
305
|
-
DialogComponent.prototype.generateTitleId = function () {
|
|
306
|
-
return 'kendo-dialog-title-' + Math.ceil(Math.random() * 1000000).toString();
|
|
307
|
-
};
|
|
308
|
-
/**
|
|
309
|
-
* @hidden
|
|
310
|
-
*/
|
|
311
|
-
DialogComponent.prototype.generateContentId = function () {
|
|
312
|
-
return 'kendo-dialog-content-' + Math.ceil(Math.random() * 1000000).toString();
|
|
313
|
-
};
|
|
314
|
-
Object.defineProperty(DialogComponent.prototype, "wrapperClass", {
|
|
315
|
-
get: function () {
|
|
316
|
-
return true;
|
|
317
|
-
},
|
|
318
|
-
enumerable: true,
|
|
319
|
-
configurable: true
|
|
320
|
-
});
|
|
321
|
-
Object.defineProperty(DialogComponent.prototype, "styles", {
|
|
322
|
-
get: function () {
|
|
323
|
-
var styles = {};
|
|
324
|
-
if (this.width) {
|
|
325
|
-
styles.width = util_1.createValueWithUnit(this.width);
|
|
326
|
-
}
|
|
327
|
-
if (this.height) {
|
|
328
|
-
styles.height = util_1.createValueWithUnit(this.height);
|
|
329
|
-
}
|
|
330
|
-
if (this.minWidth) {
|
|
331
|
-
styles.minWidth = util_1.createValueWithUnit(this.minWidth);
|
|
332
|
-
}
|
|
333
|
-
if (this.maxWidth) {
|
|
334
|
-
styles.maxWidth = util_1.createValueWithUnit(this.maxWidth);
|
|
335
|
-
}
|
|
336
|
-
if (this.minHeight) {
|
|
337
|
-
styles.minHeight = util_1.createValueWithUnit(this.minHeight);
|
|
338
|
-
}
|
|
339
|
-
if (this.maxHeight) {
|
|
340
|
-
styles.maxHeight = util_1.createValueWithUnit(this.maxHeight);
|
|
341
|
-
}
|
|
342
|
-
return styles;
|
|
343
|
-
},
|
|
344
|
-
enumerable: true,
|
|
345
|
-
configurable: true
|
|
346
|
-
});
|
|
347
|
-
DialogComponent.prototype.bubble = function (eventName, component) {
|
|
348
|
-
var _this = this;
|
|
349
|
-
if (component) {
|
|
350
|
-
var emit = function (e) { return _this[eventName].emit(e); };
|
|
351
|
-
var s = component[eventName].subscribe(emit);
|
|
352
|
-
this.subscriptions.push(s);
|
|
353
|
-
}
|
|
354
|
-
};
|
|
355
|
-
tslib_1.__decorate([
|
|
356
|
-
core_1.Input(),
|
|
357
|
-
tslib_1.__metadata("design:type", Array)
|
|
358
|
-
], DialogComponent.prototype, "actions", void 0);
|
|
359
|
-
tslib_1.__decorate([
|
|
360
|
-
core_1.Input(),
|
|
361
|
-
tslib_1.__metadata("design:type", String)
|
|
362
|
-
], DialogComponent.prototype, "actionsLayout", void 0);
|
|
363
|
-
tslib_1.__decorate([
|
|
364
|
-
core_1.Input(),
|
|
365
|
-
tslib_1.__metadata("design:type", String)
|
|
366
|
-
], DialogComponent.prototype, "autoFocusedElement", void 0);
|
|
367
|
-
tslib_1.__decorate([
|
|
368
|
-
core_1.Input(),
|
|
369
|
-
tslib_1.__metadata("design:type", String)
|
|
370
|
-
], DialogComponent.prototype, "title", void 0);
|
|
371
|
-
tslib_1.__decorate([
|
|
372
|
-
core_1.Input(),
|
|
373
|
-
tslib_1.__metadata("design:type", Object)
|
|
374
|
-
], DialogComponent.prototype, "width", void 0);
|
|
375
|
-
tslib_1.__decorate([
|
|
376
|
-
core_1.Input(),
|
|
377
|
-
tslib_1.__metadata("design:type", Object)
|
|
378
|
-
], DialogComponent.prototype, "minWidth", void 0);
|
|
379
|
-
tslib_1.__decorate([
|
|
380
|
-
core_1.Input(),
|
|
381
|
-
tslib_1.__metadata("design:type", Object)
|
|
382
|
-
], DialogComponent.prototype, "maxWidth", void 0);
|
|
383
|
-
tslib_1.__decorate([
|
|
384
|
-
core_1.Input(),
|
|
385
|
-
tslib_1.__metadata("design:type", Object)
|
|
386
|
-
], DialogComponent.prototype, "height", void 0);
|
|
387
|
-
tslib_1.__decorate([
|
|
388
|
-
core_1.Input(),
|
|
389
|
-
tslib_1.__metadata("design:type", Object)
|
|
390
|
-
], DialogComponent.prototype, "minHeight", void 0);
|
|
391
|
-
tslib_1.__decorate([
|
|
392
|
-
core_1.Input(),
|
|
393
|
-
tslib_1.__metadata("design:type", Object)
|
|
394
|
-
], DialogComponent.prototype, "maxHeight", void 0);
|
|
395
|
-
tslib_1.__decorate([
|
|
396
|
-
core_1.Output(),
|
|
397
|
-
tslib_1.__metadata("design:type", core_1.EventEmitter)
|
|
398
|
-
], DialogComponent.prototype, "action", void 0);
|
|
399
|
-
tslib_1.__decorate([
|
|
400
|
-
core_1.Output(),
|
|
401
|
-
tslib_1.__metadata("design:type", core_1.EventEmitter)
|
|
402
|
-
], DialogComponent.prototype, "close", void 0);
|
|
403
|
-
tslib_1.__decorate([
|
|
404
|
-
core_1.HostBinding('attr.dir'),
|
|
405
|
-
tslib_1.__metadata("design:type", String),
|
|
406
|
-
tslib_1.__metadata("design:paramtypes", [])
|
|
407
|
-
], DialogComponent.prototype, "dir", null);
|
|
408
|
-
tslib_1.__decorate([
|
|
409
|
-
core_1.HostBinding('attr.tabIndex'),
|
|
410
|
-
tslib_1.__metadata("design:type", Number)
|
|
411
|
-
], DialogComponent.prototype, "tabIndex", void 0);
|
|
412
|
-
tslib_1.__decorate([
|
|
413
|
-
core_1.ContentChildren(dialog_titlebar_component_1.DialogTitleBarComponent, { descendants: false }),
|
|
414
|
-
tslib_1.__metadata("design:type", core_1.QueryList)
|
|
415
|
-
], DialogComponent.prototype, "titlebarContent", void 0);
|
|
416
|
-
tslib_1.__decorate([
|
|
417
|
-
core_1.ViewChildren(dialog_titlebar_component_1.DialogTitleBarComponent),
|
|
418
|
-
tslib_1.__metadata("design:type", core_1.QueryList)
|
|
419
|
-
], DialogComponent.prototype, "titlebarView", void 0);
|
|
420
|
-
tslib_1.__decorate([
|
|
421
|
-
core_1.ViewChild(dialog_actions_component_1.DialogActionsComponent, { static: false }),
|
|
422
|
-
tslib_1.__metadata("design:type", dialog_actions_component_1.DialogActionsComponent)
|
|
423
|
-
], DialogComponent.prototype, "actionsView", void 0);
|
|
424
|
-
tslib_1.__decorate([
|
|
425
|
-
core_1.HostBinding('class.k-dialog-wrapper'),
|
|
426
|
-
tslib_1.__metadata("design:type", Boolean),
|
|
427
|
-
tslib_1.__metadata("design:paramtypes", [])
|
|
428
|
-
], DialogComponent.prototype, "wrapperClass", null);
|
|
429
|
-
DialogComponent = tslib_1.__decorate([
|
|
430
|
-
core_1.Component({
|
|
431
|
-
animations: [
|
|
432
|
-
animations_1.trigger('overlayAppear', [
|
|
433
|
-
animations_1.state('in', animations_1.style({ opacity: 1 })),
|
|
434
|
-
animations_1.transition('void => *', [animations_1.style({ opacity: 0.1 }), animations_1.animate('.3s cubic-bezier(.2, .6, .4, 1)')])
|
|
435
|
-
]),
|
|
436
|
-
animations_1.trigger('dialogSlideInAppear', [
|
|
437
|
-
animations_1.state('in', animations_1.style({ transform: 'translate(0, 0)' })),
|
|
438
|
-
animations_1.transition('void => *', [animations_1.style({ transform: 'translate(0, -10%)' }), animations_1.animate('.3s cubic-bezier(.2, 1, .2, 1)')])
|
|
439
|
-
])
|
|
440
|
-
],
|
|
441
|
-
exportAs: 'kendoDialog',
|
|
442
|
-
providers: [
|
|
443
|
-
kendo_angular_l10n_1.LocalizationService,
|
|
444
|
-
{
|
|
445
|
-
provide: dialog_localization_service_1.DIALOG_LOCALIZATION_SERVICE,
|
|
446
|
-
useExisting: kendo_angular_l10n_1.LocalizationService
|
|
447
|
-
},
|
|
448
|
-
{
|
|
449
|
-
provide: kendo_angular_l10n_1.L10N_PREFIX,
|
|
450
|
-
useValue: 'kendo.dialog'
|
|
451
|
-
}
|
|
452
|
-
],
|
|
453
|
-
selector: 'kendo-dialog',
|
|
454
|
-
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 "
|
|
455
|
-
}),
|
|
456
|
-
tslib_1.__metadata("design:paramtypes", [core_1.ElementRef,
|
|
457
|
-
core_1.Renderer2,
|
|
458
|
-
kendo_angular_l10n_1.LocalizationService,
|
|
459
|
-
core_1.ChangeDetectorRef,
|
|
460
|
-
core_1.NgZone])
|
|
461
|
-
], DialogComponent);
|
|
462
|
-
return DialogComponent;
|
|
463
|
-
}());
|
|
464
|
-
exports.DialogComponent = DialogComponent;
|
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
"use strict";
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
var tslib_1 = require("tslib");
|
|
8
|
-
// tslint:disable:max-line-length
|
|
9
|
-
var rxjs_1 = require("rxjs");
|
|
10
|
-
var operators_1 = require("rxjs/operators");
|
|
11
|
-
var core_1 = require("@angular/core");
|
|
12
|
-
var dialog_component_1 = require("./dialog.component");
|
|
13
|
-
var dialog_container_service_1 = require("./dialog-container.service");
|
|
14
|
-
var dialog_settings_1 = require("./dialog-settings");
|
|
15
|
-
var dialog_content_base_1 = require("./dialog-content-base");
|
|
16
|
-
var preventable_event_1 = require("../common/preventable-event");
|
|
17
|
-
var util_1 = require("../common/util");
|
|
18
|
-
var isNotComponent = function (component) { return util_1.isString(component) || component instanceof core_1.TemplateRef; };
|
|
19
|
-
var ɵ0 = isNotComponent;
|
|
20
|
-
exports.ɵ0 = ɵ0;
|
|
21
|
-
var DialogInjector = /** @class */ (function () {
|
|
22
|
-
function DialogInjector(getDialogRef, parentInjector) {
|
|
23
|
-
this.getDialogRef = getDialogRef;
|
|
24
|
-
this.parentInjector = parentInjector;
|
|
25
|
-
}
|
|
26
|
-
DialogInjector.prototype.get = function (token, notFoundValue) {
|
|
27
|
-
if (token === dialog_settings_1.DialogRef) {
|
|
28
|
-
return this.getDialogRef();
|
|
29
|
-
}
|
|
30
|
-
return this.parentInjector.get(token, notFoundValue);
|
|
31
|
-
};
|
|
32
|
-
return DialogInjector;
|
|
33
|
-
}());
|
|
34
|
-
/**
|
|
35
|
-
* A service for opening Dialog windows dynamically
|
|
36
|
-
* ([see example]({% slug service_dialog %})).
|
|
37
|
-
*/
|
|
38
|
-
var DialogService = /** @class */ (function () {
|
|
39
|
-
function DialogService(
|
|
40
|
-
/**
|
|
41
|
-
* @hidden
|
|
42
|
-
*/
|
|
43
|
-
resolver, containerService) {
|
|
44
|
-
this.resolver = resolver;
|
|
45
|
-
this.containerService = containerService;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Opens a Dialog window. Requires an element in the application that uses the
|
|
49
|
-
* [`kendoDialogContainer`]({% slug api_dialog_dialogcontainerdirective %}) directive.
|
|
50
|
-
* Created Dialogs will be mounted in the DOM directly after that element.
|
|
51
|
-
*
|
|
52
|
-
* @param {DialogAction} options - The options that define the Dialog.
|
|
53
|
-
* @returns {DialogRef} - A reference to the Dialog object and the convenience properties.
|
|
54
|
-
*
|
|
55
|
-
* @example
|
|
56
|
-
*
|
|
57
|
-
* ```ts-no-run
|
|
58
|
-
* _@Component({
|
|
59
|
-
* selector: 'my-app',
|
|
60
|
-
* template: `
|
|
61
|
-
* <button kendoButton (click)="open()">Harmless button</button>
|
|
62
|
-
* <div kendoDialogContainer></div>
|
|
63
|
-
* `
|
|
64
|
-
* })
|
|
65
|
-
* export class AppComponent {
|
|
66
|
-
* constructor( private dialogService: DialogService ) {}
|
|
67
|
-
*
|
|
68
|
-
* public open() {
|
|
69
|
-
* var dialog = this.dialogService.open({
|
|
70
|
-
* title: "Please confirm",
|
|
71
|
-
* content: "Are you sure?",
|
|
72
|
-
* actions: [
|
|
73
|
-
* { text: "No" },
|
|
74
|
-
* { text: "Yes", themeColor: 'primary' }
|
|
75
|
-
* ]
|
|
76
|
-
* });
|
|
77
|
-
*
|
|
78
|
-
* dialog.result.subscribe((result) => {
|
|
79
|
-
* if (result instanceof DialogCloseResult) {
|
|
80
|
-
* console.log("close");
|
|
81
|
-
* } else {
|
|
82
|
-
* console.log("action", result);
|
|
83
|
-
* }
|
|
84
|
-
* });
|
|
85
|
-
* }
|
|
86
|
-
* }
|
|
87
|
-
* ```
|
|
88
|
-
*
|
|
89
|
-
*/
|
|
90
|
-
DialogService.prototype.open = function (options) {
|
|
91
|
-
var factory = this.resolver.resolveComponentFactory(dialog_component_1.DialogComponent);
|
|
92
|
-
var container = options.appendTo || this.containerService.container;
|
|
93
|
-
if (!container) {
|
|
94
|
-
throw new Error("\nCannot attach dialog to the page.\nAdd an element that uses the kendoDialogContainer directive, or set the 'appendTo' property.\nSee https://www.telerik.com/kendo-angular-ui/components/dialogs/dialog/service/.\n ");
|
|
95
|
-
}
|
|
96
|
-
// create DialogRef to (1) pass as result, (2) provide through injector
|
|
97
|
-
var dialogRef = {
|
|
98
|
-
close: function () {
|
|
99
|
-
/* noop */
|
|
100
|
-
},
|
|
101
|
-
content: null,
|
|
102
|
-
dialog: null,
|
|
103
|
-
result: null
|
|
104
|
-
};
|
|
105
|
-
return this.initializeDialog(options.content, factory, container, dialogRef, options);
|
|
106
|
-
};
|
|
107
|
-
DialogService.prototype.initializeDialog = function (component, factory, container, dialogRef, options) {
|
|
108
|
-
var content = this.contentFrom(component, container, dialogRef);
|
|
109
|
-
var dialog = container.createComponent(factory, undefined, undefined, content.nodes);
|
|
110
|
-
dialogRef.dialog = dialog;
|
|
111
|
-
dialog.changeDetectorRef.markForCheck();
|
|
112
|
-
// copy @Input options to dialog instance
|
|
113
|
-
this.applyOptions(dialog.instance, options);
|
|
114
|
-
// create close handler and result stream
|
|
115
|
-
var apiClose = new rxjs_1.Subject();
|
|
116
|
-
var close = function (e) {
|
|
117
|
-
if (e instanceof preventable_event_1.PreventableEvent) {
|
|
118
|
-
e = new dialog_settings_1.DialogCloseResult();
|
|
119
|
-
}
|
|
120
|
-
apiClose.next(e || new dialog_settings_1.DialogCloseResult());
|
|
121
|
-
if (content.componentRef) {
|
|
122
|
-
content.componentRef.destroy();
|
|
123
|
-
}
|
|
124
|
-
dialog.destroy();
|
|
125
|
-
};
|
|
126
|
-
var result = rxjs_1.merge(apiClose,
|
|
127
|
-
// triggered when the titlebar or actions are defined in DialogSettings
|
|
128
|
-
rxjs_1.merge(dialog.instance.close, dialog.instance.action).pipe(operators_1.map(function (e) { return (e instanceof preventable_event_1.PreventableEvent ? new dialog_settings_1.DialogCloseResult() : e); }), operators_1.filter(function (e) {
|
|
129
|
-
if (options.preventAction) {
|
|
130
|
-
// add dialogRef only when using component
|
|
131
|
-
var dialogRefParameter = isNotComponent(component) ? undefined : dialogRef;
|
|
132
|
-
return !options.preventAction(e, dialogRefParameter);
|
|
133
|
-
}
|
|
134
|
-
return true;
|
|
135
|
-
}))).pipe(operators_1.take(1),
|
|
136
|
-
// Takes care for multiple subscriptions:
|
|
137
|
-
// We subscribe internaly and the user may subscribe to get a close result - dialog.result.subscribe().
|
|
138
|
-
// This causes multiple subscriptions to the same source and thus multiple emissions. share() solves that.
|
|
139
|
-
operators_1.share());
|
|
140
|
-
result.subscribe(close);
|
|
141
|
-
dialogRef.close = close;
|
|
142
|
-
dialogRef.result = result;
|
|
143
|
-
if (component && core_1.isDevMode()) {
|
|
144
|
-
var hasContentTitle = content.nodes[0] && content.nodes[0].length > 0;
|
|
145
|
-
var hasContentActions = content.nodes[2] && content.nodes[2].length > 0;
|
|
146
|
-
var multipleTitles = options.title && hasContentTitle;
|
|
147
|
-
var multipleActions = options.actions && hasContentActions;
|
|
148
|
-
if (component.prototype instanceof dialog_content_base_1.DialogContentBase) {
|
|
149
|
-
// content component extends DialogContentBase
|
|
150
|
-
if (multipleTitles || multipleActions) {
|
|
151
|
-
console.warn("\n Multiple Title and/or Actions configurations detected.\n When using a component as content, provide the title and actions either in the component's markup\n or via the title and actions properties of the DialogSettings object, but not both.\n See https://www.telerik.com/kendo-angular-ui/components/dialogs/dialog/service/#toc-passing-title-content-and-actions-as-a-single-component'");
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
else {
|
|
155
|
-
if (hasContentTitle || hasContentActions) {
|
|
156
|
-
console.warn("\n When Title and/or Actions markup is provided in content component's template,\n the component needs to inherit the DialogContentBase class to ensure that close and result events are properly hooked.\n See https://www.telerik.com/kendo-angular-ui/components/dialogs/dialog/service/#toc-passing-title-content-and-actions-as-a-single-component'");
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
return dialogRef;
|
|
161
|
-
};
|
|
162
|
-
DialogService.prototype.applyOptions = function (instance, options) {
|
|
163
|
-
instance.title = options.title;
|
|
164
|
-
instance.actions = options.actions;
|
|
165
|
-
instance.actionsLayout = options.actionsLayout || 'stretched';
|
|
166
|
-
instance.width = options.width;
|
|
167
|
-
instance.minWidth = options.minWidth;
|
|
168
|
-
instance.maxWidth = options.maxWidth;
|
|
169
|
-
instance.height = options.height;
|
|
170
|
-
instance.minHeight = options.minHeight;
|
|
171
|
-
instance.maxHeight = options.maxHeight;
|
|
172
|
-
instance.autoFocusedElement = options.autoFocusedElement;
|
|
173
|
-
instance.closeTitle = options.closeTitle;
|
|
174
|
-
instance.cssClass = options.cssClass;
|
|
175
|
-
instance.htmlAttributes = options.htmlAttributes;
|
|
176
|
-
if (options.content instanceof core_1.TemplateRef) {
|
|
177
|
-
instance.contentTemplate = options.content;
|
|
178
|
-
}
|
|
179
|
-
};
|
|
180
|
-
DialogService.prototype.contentFrom = function (content, container, dialogRef) {
|
|
181
|
-
var renderer = container.injector.get(core_1.Renderer2);
|
|
182
|
-
var nodes = [];
|
|
183
|
-
var titleNodes = [];
|
|
184
|
-
var actionNodes = [];
|
|
185
|
-
var componentRef = null;
|
|
186
|
-
if (typeof content === 'string') {
|
|
187
|
-
nodes = [renderer.createText(content)];
|
|
188
|
-
}
|
|
189
|
-
else if (content && !(content instanceof core_1.TemplateRef)) {
|
|
190
|
-
// Component
|
|
191
|
-
var injector = new DialogInjector(function () { return dialogRef; }, container.injector);
|
|
192
|
-
var factory = this.resolver.resolveComponentFactory(content);
|
|
193
|
-
componentRef = container.createComponent(factory, undefined, injector);
|
|
194
|
-
titleNodes = Array.from(componentRef.location.nativeElement.querySelectorAll('kendo-dialog-titlebar'));
|
|
195
|
-
nodes = [componentRef.location.nativeElement];
|
|
196
|
-
actionNodes = Array.from(componentRef.location.nativeElement.querySelectorAll('kendo-dialog-actions'));
|
|
197
|
-
dialogRef.content = componentRef;
|
|
198
|
-
}
|
|
199
|
-
return {
|
|
200
|
-
componentRef: componentRef,
|
|
201
|
-
nodes: [
|
|
202
|
-
titleNodes,
|
|
203
|
-
nodes,
|
|
204
|
-
actionNodes // <ng-content select="kendo-dialog-actions">
|
|
205
|
-
]
|
|
206
|
-
};
|
|
207
|
-
};
|
|
208
|
-
DialogService = tslib_1.__decorate([
|
|
209
|
-
core_1.Injectable(),
|
|
210
|
-
tslib_1.__param(1, core_1.Inject(dialog_container_service_1.DialogContainerService)),
|
|
211
|
-
tslib_1.__metadata("design:paramtypes", [core_1.ComponentFactoryResolver,
|
|
212
|
-
dialog_container_service_1.DialogContainerService])
|
|
213
|
-
], DialogService);
|
|
214
|
-
return DialogService;
|
|
215
|
-
}());
|
|
216
|
-
exports.DialogService = DialogService;
|