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