@progress/kendo-angular-dialog 6.0.2-dev.202202251355 → 7.0.0-dev.202204150748

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