@progress/kendo-angular-popup 4.0.6-dev.202203161114 → 5.0.0-dev.202204191152

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 (115) hide show
  1. package/bundles/kendo-angular-popup.umd.js +5 -0
  2. package/{dist/es2015/models/position-mode.js → esm2015/kendo-angular-popup.js} +2 -1
  3. package/{dist/es → esm2015}/main.js +0 -0
  4. package/{dist/es → esm2015}/models/align-element-settings.interface.js +1 -0
  5. package/{dist/es2015 → esm2015}/models/align.interface.js +1 -0
  6. package/{dist/es2015 → esm2015}/models/collision.interface.js +1 -0
  7. package/{dist/es2015 → esm2015}/models/collision.type.js +1 -0
  8. package/{dist/es → esm2015}/models/margin.interface.js +1 -0
  9. package/{dist/es → esm2015}/models/offset.interface.js +1 -0
  10. package/{dist/es → esm2015}/models/popup-animation.interface.js +1 -0
  11. package/{dist/es → esm2015}/models/popup-ref.js +1 -0
  12. package/{dist/es → esm2015}/models/popup-settings.js +1 -0
  13. package/{dist/es → esm2015}/models/position-element-settings.interface.js +1 -0
  14. package/{dist/es → esm2015}/models/position-mode.js +1 -0
  15. package/{dist/es → esm2015}/models/position.interface.js +1 -0
  16. package/{dist/es2015 → esm2015}/package-metadata.js +1 -1
  17. package/{dist/es2015 → esm2015}/popup.component.js +64 -86
  18. package/{dist/es2015 → esm2015}/popup.module.js +16 -13
  19. package/{dist/es2015 → esm2015}/popup.service.js +14 -15
  20. package/{dist/es2015 → esm2015}/scale.js +0 -0
  21. package/{dist/es2015 → esm2015}/services/align.service.js +14 -10
  22. package/{dist/es2015 → esm2015}/services/animation.service.js +10 -10
  23. package/{dist/es2015 → esm2015}/services/dom.service.js +9 -8
  24. package/{dist/es2015 → esm2015}/services/position.service.js +14 -10
  25. package/{dist/es2015 → esm2015}/services/resize.service.js +10 -10
  26. package/{dist/es2015 → esm2015}/services/scrollable.service.js +10 -10
  27. package/{dist/es2015 → esm2015}/util.js +5 -10
  28. package/{dist/fesm2015/index.js → fesm2015/kendo-angular-popup.js} +205 -192
  29. package/kendo-angular-popup.d.ts +9 -0
  30. package/{dist/es2015/main.d.ts → main.d.ts} +1 -1
  31. package/{dist/es2015/models → models}/align-element-settings.interface.d.ts +0 -0
  32. package/{dist/es2015/models → models}/align.interface.d.ts +0 -0
  33. package/{dist/es2015/models → models}/collision.interface.d.ts +0 -0
  34. package/{dist/es2015/models → models}/collision.type.d.ts +0 -0
  35. package/{dist/es2015/models → models}/margin.interface.d.ts +0 -0
  36. package/{dist/es2015/models → models}/offset.interface.d.ts +0 -0
  37. package/{dist/es2015/models → models}/popup-animation.interface.d.ts +4 -2
  38. package/{dist/es2015/models → models}/popup-ref.d.ts +0 -0
  39. package/{dist/es2015/models → models}/popup-settings.d.ts +0 -0
  40. package/{dist/es2015/models → models}/position-element-settings.interface.d.ts +0 -0
  41. package/{dist/es2015/models → models}/position-mode.d.ts +0 -0
  42. package/{dist/es2015/models → models}/position.interface.d.ts +0 -0
  43. package/{dist/es2015/package-metadata.d.ts → package-metadata.d.ts} +0 -0
  44. package/package.json +30 -97
  45. package/{dist/es2015/popup.component.d.ts → popup.component.d.ts} +5 -1
  46. package/{dist/es2015/popup.module.d.ts → popup.module.d.ts} +7 -0
  47. package/{dist/es2015/popup.service.d.ts → popup.service.d.ts} +5 -2
  48. package/{dist/es2015/scale.d.ts → scale.d.ts} +0 -0
  49. package/schematics/ngAdd/index.js +5 -2
  50. package/schematics/ngAdd/index.js.map +1 -1
  51. package/{dist/es2015/services → services}/align.service.d.ts +3 -0
  52. package/{dist/es2015/services → services}/animation.service.d.ts +3 -0
  53. package/{dist/es2015/services → services}/dom.service.d.ts +3 -0
  54. package/{dist/es2015/services → services}/position.service.d.ts +3 -0
  55. package/{dist/es2015/services → services}/resize.service.d.ts +3 -0
  56. package/{dist/es2015/services → services}/scrollable.service.d.ts +3 -0
  57. package/{dist/es2015/util.d.ts → util.d.ts} +1 -1
  58. package/dist/cdn/js/kendo-angular-popup.js +0 -20
  59. package/dist/cdn/main.js +0 -5
  60. package/dist/es/index.js +0 -14
  61. package/dist/es/models/align.interface.js +0 -4
  62. package/dist/es/models/collision.interface.js +0 -4
  63. package/dist/es/models/collision.type.js +0 -4
  64. package/dist/es/package-metadata.js +0 -15
  65. package/dist/es/popup.component.js +0 -438
  66. package/dist/es/popup.module.js +0 -57
  67. package/dist/es/popup.service.js +0 -254
  68. package/dist/es/scale.js +0 -21
  69. package/dist/es/services/align.service.js +0 -64
  70. package/dist/es/services/animation.service.js +0 -137
  71. package/dist/es/services/dom.service.js +0 -158
  72. package/dist/es/services/position.service.js +0 -53
  73. package/dist/es/services/resize.service.js +0 -46
  74. package/dist/es/services/scrollable.service.js +0 -78
  75. package/dist/es/util.js +0 -168
  76. package/dist/es2015/index.d.ts +0 -14
  77. package/dist/es2015/index.js +0 -14
  78. package/dist/es2015/index.metadata.json +0 -1
  79. package/dist/es2015/main.js +0 -8
  80. package/dist/es2015/models/align-element-settings.interface.js +0 -4
  81. package/dist/es2015/models/margin.interface.js +0 -4
  82. package/dist/es2015/models/offset.interface.js +0 -4
  83. package/dist/es2015/models/popup-animation.interface.js +0 -4
  84. package/dist/es2015/models/popup-ref.js +0 -4
  85. package/dist/es2015/models/popup-settings.js +0 -4
  86. package/dist/es2015/models/position-element-settings.interface.js +0 -4
  87. package/dist/es2015/models/position.interface.js +0 -4
  88. package/dist/fesm5/index.js +0 -1381
  89. package/dist/npm/index.js +0 -23
  90. package/dist/npm/main.js +0 -15
  91. package/dist/npm/models/align-element-settings.interface.js +0 -6
  92. package/dist/npm/models/align.interface.js +0 -6
  93. package/dist/npm/models/collision.interface.js +0 -6
  94. package/dist/npm/models/collision.type.js +0 -6
  95. package/dist/npm/models/margin.interface.js +0 -6
  96. package/dist/npm/models/offset.interface.js +0 -6
  97. package/dist/npm/models/popup-animation.interface.js +0 -6
  98. package/dist/npm/models/popup-ref.js +0 -6
  99. package/dist/npm/models/popup-settings.js +0 -6
  100. package/dist/npm/models/position-element-settings.interface.js +0 -6
  101. package/dist/npm/models/position-mode.js +0 -9
  102. package/dist/npm/models/position.interface.js +0 -6
  103. package/dist/npm/package-metadata.js +0 -17
  104. package/dist/npm/popup.component.js +0 -440
  105. package/dist/npm/popup.module.js +0 -59
  106. package/dist/npm/popup.service.js +0 -256
  107. package/dist/npm/scale.js +0 -23
  108. package/dist/npm/services/align.service.js +0 -66
  109. package/dist/npm/services/animation.service.js +0 -139
  110. package/dist/npm/services/dom.service.js +0 -160
  111. package/dist/npm/services/position.service.js +0 -55
  112. package/dist/npm/services/resize.service.js +0 -48
  113. package/dist/npm/services/scrollable.service.js +0 -80
  114. package/dist/npm/util.js +0 -173
  115. package/dist/systemjs/kendo-angular-popup.js +0 -5
@@ -1,256 +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 popup_component_1 = require("./popup.component");
10
- var removeElement = function (element) {
11
- if (element && element.parentNode) {
12
- element.parentNode.removeChild(element);
13
- }
14
- };
15
- var ɵ0 = removeElement;
16
- exports.ɵ0 = ɵ0;
17
- /**
18
- * Used to inject the Popup container. If not provided, the first root component of
19
- * the application is used.
20
- *
21
- * > The `POPUP_CONTAINER` can be used only with the [`PopupService`]({% slug service_popup %}) class.
22
- *
23
- * @example
24
- *
25
- * ```ts-no-run
26
- * // Import the Popup module
27
- * import { PopupModule, POPUP_CONTAINER } from '@progress/kendo-angular-popup';
28
- *
29
- * // The browser platform with a compiler
30
- * import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
31
- *
32
- * import { ElementRef, NgModule } from '@angular/core';
33
- *
34
- * // Import the app component
35
- * import { AppComponent } from './app.component';
36
- *
37
- * // Define the app module
38
- * _@NgModule({
39
- * declarations: [AppComponent], // declare app component
40
- * imports: [BrowserModule, PopupModule], // import Popup module
41
- * bootstrap: [AppComponent],
42
- * providers: [{
43
- * provide: POPUP_CONTAINER,
44
- * useFactory: () => {
45
- * //return the container ElementRef, where the popup will be injected
46
- * return { nativeElement: document.body } as ElementRef;
47
- * }
48
- * }]
49
- * })
50
- * export class AppModule {}
51
- *
52
- * // Compile and launch the module
53
- * platformBrowserDynamic().bootstrapModule(AppModule);
54
- * ```
55
- */
56
- exports.POPUP_CONTAINER = new core_1.InjectionToken('Popup Container');
57
- /**
58
- * A service for opening Popup components dynamically
59
- * ([see example]({% slug service_popup %})).
60
- *
61
- * @export
62
- * @class PopupService
63
- */
64
- var PopupService = /** @class */ (function () {
65
- function PopupService(applicationRef, componentFactoryResolver, injector, container) {
66
- this.applicationRef = applicationRef;
67
- this.componentFactoryResolver = componentFactoryResolver;
68
- this.injector = injector;
69
- this.container = container;
70
- }
71
- Object.defineProperty(PopupService.prototype, "rootViewContainer", {
72
- /**
73
- * Gets the root view container into which the component will be injected.
74
- *
75
- * @returns {ComponentRef<any>}
76
- */
77
- get: function () {
78
- // https://github.com/angular/angular/blob/4.0.x/packages/core/src/application_ref.ts#L571
79
- var rootComponents = this.applicationRef.components || [];
80
- if (rootComponents[0]) {
81
- return rootComponents[0];
82
- }
83
- throw new Error("\n View Container not found! Inject the POPUP_CONTAINER or define a specific ViewContainerRef via the appendTo option.\n See http://www.telerik.com/kendo-angular-ui/components/popup/api/POPUP_CONTAINER/ for more details.\n ");
84
- },
85
- enumerable: true,
86
- configurable: true
87
- });
88
- Object.defineProperty(PopupService.prototype, "rootViewContainerNode", {
89
- /**
90
- * Sets or gets the HTML element of the root component container.
91
- *
92
- * @returns {HTMLElement}
93
- */
94
- get: function () {
95
- return this.container ? this.container.nativeElement : this.getComponentRootNode(this.rootViewContainer);
96
- },
97
- enumerable: true,
98
- configurable: true
99
- });
100
- /**
101
- * Opens a Popup component. Created Popups are mounted
102
- * in the DOM directly in the root application component.
103
- *
104
- * @param {PopupSettings} options - The options which define the Popup.
105
- * @returns {ComponentRef<PopupComponent>} - A reference to the Popup object.
106
- *
107
- * @example
108
- *
109
- * ```ts-no-run
110
- * _@Component({
111
- * selector: 'my-app',
112
- * template: `
113
- * <ng-template #template>
114
- * Popup content
115
- * </ng-template>
116
- * <button #anchor kendoButton (click)="open(anchor, template)">Open</button>
117
- * `
118
- * })
119
- * export class AppComponent {
120
- * public popupRef: PopupRef;
121
- *
122
- * constructor( private popupService: PopupService ) {}
123
- *
124
- * public open(anchor: ElementRef, template: TemplateRef<any>): void {
125
- * if (this.popupRef) {
126
- * this.popupRef.close();
127
- * this.popupRef = null;
128
- * return;
129
- * }
130
- *
131
- * this.popupRef = this.popupService.open({
132
- * anchor: anchor,
133
- * content: template
134
- * });
135
- * }
136
- * }
137
- * ```
138
- */
139
- PopupService.prototype.open = function (options) {
140
- if (options === void 0) { options = {}; }
141
- var _a = this.contentFrom(options.content), component = _a.component, nodes = _a.nodes;
142
- var popupComponentRef = this.appendPopup(nodes, options.appendTo);
143
- var popupInstance = popupComponentRef.instance;
144
- this.projectComponentInputs(popupComponentRef, options);
145
- popupComponentRef.changeDetectorRef.detectChanges();
146
- if (component) {
147
- component.changeDetectorRef.detectChanges();
148
- }
149
- var popupElement = this.getComponentRootNode(popupComponentRef);
150
- return {
151
- close: function () {
152
- if (component) {
153
- component.destroy();
154
- }
155
- popupComponentRef.destroy();
156
- // Angular will not remove the element unless the change detection is triggered
157
- removeElement(popupElement);
158
- },
159
- content: component,
160
- popup: popupComponentRef,
161
- popupAnchorViewportLeave: popupInstance.anchorViewportLeave,
162
- popupClose: popupInstance.close,
163
- popupElement: popupElement,
164
- popupOpen: popupInstance.open,
165
- popupPositionChange: popupInstance.positionChange
166
- };
167
- };
168
- PopupService.prototype.appendPopup = function (nodes, container) {
169
- var popupComponentRef = this.createComponent(popup_component_1.PopupComponent, nodes, container);
170
- if (!container) {
171
- this.rootViewContainerNode.appendChild(this.getComponentRootNode(popupComponentRef));
172
- }
173
- return popupComponentRef;
174
- };
175
- /**
176
- * Gets the HTML element for a component reference.
177
- *
178
- * @param {ComponentRef<any>} componentRef
179
- * @returns {HTMLElement}
180
- */
181
- PopupService.prototype.getComponentRootNode = function (componentRef) {
182
- return componentRef.location.nativeElement;
183
- };
184
- /**
185
- * Gets the `ComponentFactory` instance by its type.
186
- *
187
- * @param {*} componentClass
188
- * @param {*} nodes
189
- * @returns {ComponentRef<any>}
190
- */
191
- PopupService.prototype.getComponentFactory = function (componentClass) {
192
- return this.componentFactoryResolver.resolveComponentFactory(componentClass);
193
- };
194
- /**
195
- * Creates a component reference from a `Component` type class.
196
- *
197
- * @param {*} componentClass
198
- * @param {*} nodes
199
- * @returns {ComponentRef<any>}
200
- */
201
- PopupService.prototype.createComponent = function (componentClass, nodes, container) {
202
- var factory = this.getComponentFactory(componentClass);
203
- if (container) {
204
- return container.createComponent(factory, undefined, this.injector, nodes);
205
- }
206
- else {
207
- var component = factory.create(this.injector, nodes);
208
- this.applicationRef.attachView(component.hostView);
209
- return component;
210
- }
211
- };
212
- /**
213
- * Projects the inputs on the component.
214
- *
215
- * @param {ComponentRef<any>} component
216
- * @param {*} options
217
- * @returns {ComponentRef<any>}
218
- */
219
- PopupService.prototype.projectComponentInputs = function (component, options) {
220
- Object.getOwnPropertyNames(options)
221
- .filter(function (prop) { return prop !== 'content' || options.content instanceof core_1.TemplateRef; })
222
- .map(function (prop) {
223
- component.instance[prop] = options[prop];
224
- });
225
- return component;
226
- };
227
- /**
228
- * Gets the component and the nodes to append from the `content` option.
229
- *
230
- * @param {*} content
231
- * @returns {any}
232
- */
233
- PopupService.prototype.contentFrom = function (content) {
234
- if (!content || content instanceof core_1.TemplateRef) {
235
- return { component: null, nodes: [[]] };
236
- }
237
- var component = this.createComponent(content);
238
- var nodes = component ? [component.location.nativeElement] : [];
239
- return {
240
- component: component,
241
- nodes: [
242
- nodes // <ng-content>
243
- ]
244
- };
245
- };
246
- PopupService = tslib_1.__decorate([
247
- core_1.Injectable(),
248
- tslib_1.__param(3, core_1.Inject(exports.POPUP_CONTAINER)), tslib_1.__param(3, core_1.Optional()),
249
- tslib_1.__metadata("design:paramtypes", [core_1.ApplicationRef,
250
- core_1.ComponentFactoryResolver,
251
- core_1.Injector,
252
- core_1.ElementRef])
253
- ], PopupService);
254
- return PopupService;
255
- }());
256
- exports.PopupService = PopupService;
package/dist/npm/scale.js DELETED
@@ -1,23 +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 core_1 = require("@angular/core");
8
- /**
9
- * Used to set the document scale when using a [scale transform](https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/scale).
10
- *
11
- * The document or container scale is required to compute the popup position correctly. Detecting the scale is not reliable and must be set by providing a value for SCALE. See [Support for Document Scale]({% slug documentscale_popup %}).
12
- *
13
- * > Using this token is not necessary for user-applied browser zoom.
14
- *
15
- * {% meta height:300 %}
16
- * {% embed_file scale/app.component.ts preview %}
17
- * {% embed_file shared/app.module.ts %}
18
- * {% embed_file shared/main.ts %}
19
- * {% endmeta %}
20
- *
21
- *
22
- */
23
- exports.SCALE = new core_1.InjectionToken('Popup Document Scale');
@@ -1,66 +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 dom_service_1 = require("./dom.service");
10
- var util_1 = require("../util");
11
- var scale_1 = require("../scale");
12
- /**
13
- * @hidden
14
- */
15
- var AlignService = /** @class */ (function () {
16
- function AlignService(_dom, scale) {
17
- if (scale === void 0) { scale = 1; }
18
- this._dom = _dom;
19
- this.scale = scale;
20
- }
21
- AlignService.prototype.alignElement = function (settings) {
22
- var anchor = settings.anchor, element = settings.element, anchorAlign = settings.anchorAlign, elementAlign = settings.elementAlign, margin = settings.margin, offset = settings.offset, positionMode = settings.positionMode;
23
- var scale = this.scale || 1;
24
- var fixedMode = positionMode === 'fixed' || !this._dom.hasOffsetParent(element);
25
- var anchorRect = fixedMode ? this.absoluteRect(anchor, element, offset, scale) : this.relativeRect(anchor, element, offset, scale);
26
- var elementRect = util_1.scaleRect(this._dom.offset(element.nativeElement), scale);
27
- var result = this._dom.align({
28
- anchorAlign: anchorAlign,
29
- anchorRect: anchorRect,
30
- elementAlign: elementAlign,
31
- elementRect: elementRect,
32
- margin: margin
33
- });
34
- return result;
35
- };
36
- AlignService.prototype.absoluteRect = function (anchor, element, offset, scale) {
37
- var scrollPos = this.elementScrollPosition(anchor, element);
38
- var rect = util_1.eitherRect(this._dom.offset(anchor), offset);
39
- var stackScale = 2 * scale;
40
- var stackScroll = this._dom.stackingElementScroll(element);
41
- if (scale !== 1 && stackScroll) {
42
- stackScroll.x /= stackScale;
43
- stackScroll.y /= stackScale;
44
- }
45
- var stackOffset = this._dom.stackingElementOffset(element);
46
- if (scale !== 1 && stackOffset) {
47
- stackOffset.left /= stackScale;
48
- stackOffset.top /= stackScale;
49
- }
50
- return this._dom.removeScroll(this._dom.addScroll(util_1.removeStackingOffset(util_1.scaleRect(rect, scale), stackOffset), stackScroll), scrollPos);
51
- };
52
- AlignService.prototype.elementScrollPosition = function (anchor, element) {
53
- return anchor ? { x: 0, y: 0 } : this._dom.scrollPosition(element);
54
- };
55
- AlignService.prototype.relativeRect = function (anchor, element, offset, scale) {
56
- var rect = util_1.eitherRect(this._dom.position(anchor, element, scale), offset);
57
- return util_1.scaleRect(rect, scale);
58
- };
59
- AlignService = tslib_1.__decorate([
60
- core_1.Injectable(),
61
- tslib_1.__param(1, core_1.Inject(scale_1.SCALE)), tslib_1.__param(1, core_1.Optional()),
62
- tslib_1.__metadata("design:paramtypes", [dom_service_1.DOMService, Number])
63
- ], AlignService);
64
- return AlignService;
65
- }());
66
- exports.AlignService = AlignService;
@@ -1,139 +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 LEFT = 'left';
11
- var RIGHT = 'right';
12
- var DOWN = 'down';
13
- var UP = 'up';
14
- var DEFAULT_TYPE = 'slide';
15
- var DEFAULT_DURATION = 100;
16
- var animationTypes = {};
17
- /* tslint:disable:object-literal-sort-keys */
18
- animationTypes.expand = function (direction) {
19
- var scale = direction === UP || direction === DOWN ? 'scaleY' : 'scaleX';
20
- var startScale = 0;
21
- var endScale = 1;
22
- var origin;
23
- if (direction === DOWN) {
24
- origin = 'top';
25
- }
26
- else if (direction === LEFT) {
27
- origin = RIGHT;
28
- }
29
- else if (direction === RIGHT) {
30
- origin = LEFT;
31
- }
32
- else {
33
- origin = 'bottom';
34
- }
35
- return {
36
- start: { transform: scale + "(" + startScale + ")", transformOrigin: origin },
37
- end: { transform: scale + "(" + endScale + ")" }
38
- };
39
- };
40
- animationTypes.slide = function (direction) {
41
- var translate = direction === LEFT || direction === RIGHT ? 'translateX' : 'translateY';
42
- var start = direction === RIGHT || direction === DOWN ? -100 : 100;
43
- var end = 0;
44
- return {
45
- start: { transform: translate + "(" + start + "%)" },
46
- end: { transform: translate + "(" + end + "%)" }
47
- };
48
- };
49
- animationTypes.fade = function () {
50
- return {
51
- start: { opacity: 0 },
52
- end: { opacity: 1 }
53
- };
54
- };
55
- animationTypes.zoom = function () {
56
- var start = 0;
57
- var end = 1;
58
- return {
59
- start: { transform: "scale(" + start + ")" },
60
- end: { transform: "scale(" + end + ")" }
61
- };
62
- };
63
- /**
64
- * @hidden
65
- */
66
- var AnimationService = /** @class */ (function () {
67
- function AnimationService(animationBuilder) {
68
- this.animationBuilder = animationBuilder;
69
- this.start = new core_1.EventEmitter();
70
- this.end = new core_1.EventEmitter();
71
- }
72
- AnimationService.prototype.play = function (element, options, flip) {
73
- if (!this.flip || this.flip.horizontal !== flip.horizontal ||
74
- this.flip.vertical !== flip.vertical) {
75
- this.flip = flip;
76
- var type = options.type || DEFAULT_TYPE;
77
- var statesFn = animationTypes[type];
78
- if (statesFn) {
79
- var direction = this.getDirection(flip, options);
80
- var states = statesFn(direction);
81
- this.playStates(element, states, options);
82
- }
83
- else if (core_1.isDevMode()) {
84
- throw new Error("Unsupported animation type: \"" + type + "\". The supported types are slide, expand, fade and zoom.");
85
- }
86
- }
87
- };
88
- AnimationService.prototype.ngOnDestroy = function () {
89
- this.stopPlayer();
90
- };
91
- AnimationService.prototype.playStates = function (element, states, options) {
92
- var _this = this;
93
- this.stopPlayer();
94
- var duration = options.duration || DEFAULT_DURATION;
95
- var factory = this.animationBuilder.build([
96
- animations_1.style(states.start),
97
- animations_1.animate(duration + "ms ease-in", animations_1.style(states.end))
98
- ]);
99
- var player = this.player = factory.create(element);
100
- player.onDone(function () {
101
- _this.end.emit();
102
- _this.stopPlayer();
103
- });
104
- this.start.emit();
105
- player.play();
106
- };
107
- AnimationService.prototype.getDirection = function (flip, options) {
108
- var direction = options.direction || DOWN;
109
- if (flip.horizontal) {
110
- if (direction === LEFT) {
111
- direction = RIGHT;
112
- }
113
- else if (direction === RIGHT) {
114
- direction = LEFT;
115
- }
116
- }
117
- if (flip.vertical) {
118
- if (direction === DOWN) {
119
- direction = UP;
120
- }
121
- else if (direction === UP) {
122
- direction = DOWN;
123
- }
124
- }
125
- return direction;
126
- };
127
- AnimationService.prototype.stopPlayer = function () {
128
- if (this.player) {
129
- this.player.destroy();
130
- this.player = null;
131
- }
132
- };
133
- AnimationService = tslib_1.__decorate([
134
- core_1.Injectable(),
135
- tslib_1.__metadata("design:paramtypes", [animations_1.AnimationBuilder])
136
- ], AnimationService);
137
- return AnimationService;
138
- }());
139
- exports.AnimationService = AnimationService;
@@ -1,160 +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 kendo_popup_common_1 = require("@progress/kendo-popup-common");
10
- var util_1 = require("../util");
11
- var kendo_angular_common_1 = require("@progress/kendo-angular-common");
12
- var STYLES = [
13
- 'font-size',
14
- 'font-family',
15
- 'font-stretch',
16
- 'font-style',
17
- 'font-weight',
18
- 'line-height'
19
- ];
20
- /**
21
- * @hidden
22
- */
23
- var DOMService = /** @class */ (function () {
24
- function DOMService() {
25
- }
26
- DOMService.prototype.addOffset = function (current, addition) {
27
- return {
28
- left: current.left + addition.left,
29
- top: current.top + addition.top
30
- };
31
- };
32
- DOMService.prototype.addScroll = function (rect, scroll) {
33
- return kendo_popup_common_1.addScroll(rect, scroll);
34
- };
35
- DOMService.prototype.align = function (settings) {
36
- return kendo_popup_common_1.align(settings);
37
- };
38
- DOMService.prototype.boundingOffset = function (el) {
39
- return kendo_popup_common_1.boundingOffset(el);
40
- };
41
- DOMService.prototype.getFontStyles = function (el) {
42
- var window = this.getWindow();
43
- if (!window || !el) {
44
- return [];
45
- }
46
- var computedStyles = window.getComputedStyle(el);
47
- return STYLES.map(function (font) { return ({ key: font, value: computedStyles[font] }); });
48
- };
49
- DOMService.prototype.getWindow = function () {
50
- return util_1.isWindowAvailable() ? window : null;
51
- };
52
- DOMService.prototype.hasOffsetParent = function (el) {
53
- if (!el) {
54
- return false;
55
- }
56
- return !!this.nativeElement(el).offsetParent;
57
- };
58
- DOMService.prototype.offset = function (el) {
59
- if (!el) {
60
- return null;
61
- }
62
- return kendo_popup_common_1.offset(el);
63
- };
64
- DOMService.prototype.offsetAtPoint = function (el, currentLocation) {
65
- if (!el) {
66
- return null;
67
- }
68
- var element = this.nativeElement(el);
69
- var _a = element.style, left = _a.left, top = _a.top, transition = _a.transition;
70
- element.style.transition = 'none';
71
- element.style.left = currentLocation.left + "px";
72
- element.style.top = currentLocation.top + "px";
73
- var currentOffset = kendo_popup_common_1.offset(element);
74
- element.style.left = left;
75
- element.style.top = top;
76
- // prevents elements with transition to be animated because of the change
77
- // tslint:disable-next-line:no-unused-expression
78
- element.offsetHeight;
79
- element.style.transition = transition;
80
- return currentOffset;
81
- };
82
- DOMService.prototype.nativeElement = function (el) {
83
- if (!el) {
84
- return null;
85
- }
86
- return el.nativeElement || el;
87
- };
88
- DOMService.prototype.position = function (element, popup, scale) {
89
- if (scale === void 0) { scale = 1; }
90
- if (!element || !popup) {
91
- return null;
92
- }
93
- return kendo_popup_common_1.positionWithScroll(element, this.nativeElement(popup), scale);
94
- };
95
- DOMService.prototype.removeScroll = function (rect, scroll) {
96
- return kendo_popup_common_1.removeScroll(rect, scroll);
97
- };
98
- DOMService.prototype.restrictToView = function (settings) {
99
- return kendo_popup_common_1.restrictToView(settings);
100
- };
101
- DOMService.prototype.scrollPosition = function (el) {
102
- return kendo_popup_common_1.scrollPosition(this.nativeElement(el));
103
- };
104
- DOMService.prototype.scrollableParents = function (el) {
105
- return util_1.scrollableParents(el);
106
- };
107
- DOMService.prototype.stackingElementOffset = function (el) {
108
- var relativeContextElement = this.getRelativeContextElement(el);
109
- if (!relativeContextElement) {
110
- return null;
111
- }
112
- return kendo_popup_common_1.offset(relativeContextElement);
113
- };
114
- DOMService.prototype.stackingElementScroll = function (el) {
115
- var relativeContextElement = this.getRelativeContextElement(el);
116
- if (!relativeContextElement) {
117
- return { x: 0, y: 0 };
118
- }
119
- return {
120
- x: relativeContextElement.scrollLeft,
121
- y: relativeContextElement.scrollTop
122
- };
123
- };
124
- DOMService.prototype.getRelativeContextElement = function (el) {
125
- if (!el || !util_1.hasRelativeStackingContext()) {
126
- return null;
127
- }
128
- var parent = this.nativeElement(el).parentElement;
129
- while (parent) {
130
- if (window.getComputedStyle(parent).transform !== 'none') {
131
- return parent;
132
- }
133
- parent = parent.parentElement;
134
- }
135
- return null;
136
- };
137
- DOMService.prototype.useRelativePosition = function (el) {
138
- return !!this.getRelativeContextElement(el);
139
- };
140
- DOMService.prototype.windowViewPort = function (el) {
141
- return kendo_popup_common_1.getWindowViewPort(this.nativeElement(el));
142
- };
143
- DOMService.prototype.zIndex = function (anchor, container) {
144
- return util_1.zIndex(anchor, this.nativeElement(container));
145
- };
146
- DOMService.prototype.zoomLevel = function () {
147
- if (!kendo_angular_common_1.isDocumentAvailable() || !util_1.isWindowAvailable()) {
148
- return 1;
149
- }
150
- return parseFloat((document.documentElement.clientWidth / window.innerWidth).toFixed(2)) || 1;
151
- };
152
- DOMService.prototype.isZoomed = function () {
153
- return this.zoomLevel() > 1;
154
- };
155
- DOMService = tslib_1.__decorate([
156
- core_1.Injectable()
157
- ], DOMService);
158
- return DOMService;
159
- }());
160
- exports.DOMService = DOMService;