@progress/kendo-angular-popup 21.4.1-develop.1 → 22.0.0-develop.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/esm2022/util.mjs DELETED
@@ -1,163 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2026 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import { parents, siblingContainer } from '@progress/kendo-popup-common';
6
- import { isDocumentAvailable } from '@progress/kendo-angular-common';
7
- /**
8
- * @hidden
9
- */
10
- export const eitherRect = (rect, offset) => {
11
- if (!rect) {
12
- return { height: 0, left: offset.left, top: offset.top, width: 0 };
13
- }
14
- return rect;
15
- };
16
- /**
17
- * @hidden
18
- */
19
- export const replaceOffset = (rect, offset) => {
20
- if (!offset) {
21
- return rect;
22
- }
23
- const result = {
24
- height: rect.height,
25
- left: offset.left,
26
- top: offset.top,
27
- width: rect.width
28
- };
29
- return result;
30
- };
31
- /**
32
- * @hidden
33
- */
34
- export const removeStackingOffset = (rect, stackingOffset) => {
35
- if (!stackingOffset) {
36
- return rect;
37
- }
38
- const result = {
39
- height: rect.height,
40
- left: rect.left - stackingOffset.left,
41
- top: rect.top - stackingOffset.top,
42
- width: rect.width
43
- };
44
- return result;
45
- };
46
- /**
47
- * @hidden
48
- */
49
- export const isDifferentOffset = (oldOffset, newOffset) => {
50
- const { left: oldLeft, top: oldTop } = oldOffset;
51
- const { left: newLeft, top: newTop } = newOffset;
52
- return Math.abs(oldLeft - newLeft) >= 1 || Math.abs(oldTop - newTop) >= 1;
53
- };
54
- /**
55
- * @hidden
56
- */
57
- export const isWindowAvailable = () => {
58
- return typeof window !== 'undefined';
59
- };
60
- /**
61
- * @hidden
62
- */
63
- export const hasBoundingRect = (elem) => !!elem.getBoundingClientRect;
64
- /**
65
- * @hidden
66
- */
67
- export const OVERFLOW_REGEXP = /auto|scroll/;
68
- const overflowElementStyle = (element) => {
69
- return `${element.style.overflow}${element.style.overflowX}${element.style.overflowY}`;
70
- };
71
- const overflowComputedStyle = (element) => {
72
- const styles = window.getComputedStyle(element);
73
- return `${styles.overflow}${styles.overflowX}${styles.overflowY}`;
74
- };
75
- const overflowStyle = (element) => {
76
- return overflowElementStyle(element) || overflowComputedStyle(element);
77
- };
78
- /**
79
- * @hidden
80
- */
81
- export const scrollableParents = (element) => {
82
- const parentElements = [];
83
- if (!isDocumentAvailable() || !isWindowAvailable()) {
84
- return parentElements;
85
- }
86
- let parent = element.parentElement;
87
- while (parent) {
88
- if (OVERFLOW_REGEXP.test(overflowStyle(parent)) || parent.hasAttribute('data-scrollable')) {
89
- parentElements.push(parent);
90
- }
91
- parent = parent.parentElement;
92
- }
93
- parentElements.push(window);
94
- return parentElements;
95
- };
96
- /**
97
- * @hidden
98
- */
99
- export const FRAME_DURATION = 1000 / 60; //1000ms divided by 60fps
100
- function memoize(fun) {
101
- let result;
102
- let called = false;
103
- return (...args) => {
104
- if (called) {
105
- return result;
106
- }
107
- result = fun(...args);
108
- called = true;
109
- return result;
110
- };
111
- }
112
- /**
113
- * @hidden
114
- */
115
- export const hasRelativeStackingContext = memoize(() => {
116
- if (!isDocumentAvailable() && document.body !== null) {
117
- return false;
118
- }
119
- const top = 10;
120
- const parent = document.createElement("div");
121
- parent.style.transform = "matrix(10, 0, 0, 10, 0, 0)";
122
- const childElement = document.createElement("div");
123
- childElement.style.position = 'fixed';
124
- childElement.style.top = `${top}px`;
125
- childElement.textContent = 'child';
126
- parent.appendChild(childElement);
127
- document.body.appendChild(parent);
128
- const isDifferent = parent.children[0].getBoundingClientRect().top !== top;
129
- document.body.removeChild(parent);
130
- return isDifferent;
131
- });
132
- /**
133
- * @hidden
134
- */
135
- export const zIndex = (anchor, container) => {
136
- if (!anchor || !isDocumentAvailable() || !isWindowAvailable()) {
137
- return null;
138
- }
139
- const sibling = siblingContainer(anchor, container);
140
- if (!sibling) {
141
- return null;
142
- }
143
- const result = [anchor].concat(parents(anchor, sibling)).reduce((index, p) => {
144
- const zIndexStyle = p.style.zIndex || window.getComputedStyle(p).zIndex;
145
- const current = parseInt(zIndexStyle, 10);
146
- return current > index ? current : index;
147
- }, 0);
148
- return result ? (result + 1) : null;
149
- };
150
- /**
151
- * @hidden
152
- */
153
- export const scaleRect = (rect, scale) => {
154
- if (!rect || scale === 1) {
155
- return rect;
156
- }
157
- return {
158
- height: rect.height / scale,
159
- left: rect.left / scale,
160
- top: rect.top / scale,
161
- width: rect.width / scale
162
- };
163
- };