@whitesev/pops 2.0.10 → 2.0.12
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/dist/index.amd.js +4695 -4403
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +4695 -4403
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +4695 -4403
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +4695 -4403
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +4695 -4403
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +4695 -4403
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/Pops.d.ts +66 -42
- package/dist/types/src/PopsAnimation.d.ts +14 -0
- package/dist/types/src/PopsCSS.d.ts +34 -0
- package/dist/types/src/PopsIcon.d.ts +25 -0
- package/dist/types/src/PopsLayer.d.ts +3 -0
- package/dist/types/src/components/panel/buttonType.d.ts +2 -2
- package/dist/types/src/components/rightClickMenu/index.d.ts +2 -3
- package/dist/types/src/components/rightClickMenu/indexType.d.ts +4 -3
- package/dist/types/src/types/PopsDOMUtilsEventType.d.ts +19 -6
- package/dist/types/src/types/button.d.ts +3 -3
- package/dist/types/src/types/icon.d.ts +1 -1
- package/dist/types/src/utils/PopsDOMUtils.d.ts +120 -26
- package/dist/types/src/utils/PopsInstanceUtils.d.ts +0 -6
- package/dist/types/src/utils/PopsUtils.d.ts +5 -6
- package/package.json +1 -1
- package/src/Pops.ts +12 -152
- package/src/PopsAnimation.ts +32 -0
- package/src/PopsCSS.ts +51 -0
- package/src/PopsIcon.ts +93 -0
- package/src/PopsLayer.ts +17 -0
- package/src/components/alert/index.ts +8 -8
- package/src/components/confirm/index.ts +8 -8
- package/src/components/drawer/index.ts +8 -8
- package/src/components/folder/index.ts +15 -15
- package/src/components/iframe/index.ts +9 -12
- package/src/components/loading/index.ts +5 -5
- package/src/components/panel/PanelHandleContentDetails.ts +28 -25
- package/src/components/panel/buttonType.ts +2 -2
- package/src/components/panel/config.ts +4 -0
- package/src/components/panel/index.css +33 -0
- package/src/components/panel/index.ts +9 -9
- package/src/components/prompt/index.ts +8 -8
- package/src/components/rightClickMenu/config.ts +7 -7
- package/src/components/rightClickMenu/index.ts +41 -29
- package/src/components/rightClickMenu/indexType.ts +5 -3
- package/src/components/searchSuggestion/index.ts +5 -5
- package/src/components/tooltip/index.ts +5 -5
- package/src/handler/PopsElementHandler.ts +17 -17
- package/src/handler/PopsHandler.ts +22 -19
- package/src/types/PopsDOMUtilsEventType.d.ts +19 -6
- package/src/types/button.d.ts +3 -3
- package/src/types/icon.d.ts +1 -1
- package/src/utils/PopsDOMUtils.ts +568 -170
- package/src/utils/PopsInstanceUtils.ts +13 -31
- package/src/utils/PopsUtils.ts +7 -16
|
@@ -11,7 +11,8 @@ import type { PopsLayerMode } from "../types/main";
|
|
|
11
11
|
import { popsDOMUtils } from "./PopsDOMUtils";
|
|
12
12
|
import { popsUtils } from "./PopsUtils";
|
|
13
13
|
import { PopsCore } from "../Core";
|
|
14
|
-
import {
|
|
14
|
+
import { PopsLayer } from "../PopsLayer";
|
|
15
|
+
import { PopsAnimation } from "../PopsAnimation";
|
|
15
16
|
|
|
16
17
|
export const PopsInstanceUtils = {
|
|
17
18
|
/**
|
|
@@ -120,8 +121,8 @@ export const PopsInstanceUtils = {
|
|
|
120
121
|
function isVisibleNode($css: CSSStyleDeclaration): boolean {
|
|
121
122
|
return $css.position !== "static" && $css.display !== "none";
|
|
122
123
|
}
|
|
123
|
-
Object.keys(
|
|
124
|
-
let layerList =
|
|
124
|
+
Object.keys(PopsLayer).forEach((layerName) => {
|
|
125
|
+
let layerList = PopsLayer[layerName as PopsLayerMode];
|
|
125
126
|
for (let index = 0; index < layerList.length; index++) {
|
|
126
127
|
const layer = layerList[index];
|
|
127
128
|
let nodeStyle = window.getComputedStyle(layer.animElement);
|
|
@@ -155,25 +156,6 @@ export const PopsInstanceUtils = {
|
|
|
155
156
|
getMaxZIndex(deviation = 1): number {
|
|
156
157
|
return this.getMaxZIndexNodeInfo(deviation).zIndex;
|
|
157
158
|
},
|
|
158
|
-
/**
|
|
159
|
-
* 获取CSS Rule
|
|
160
|
-
* @param sheet
|
|
161
|
-
* @returns
|
|
162
|
-
*/
|
|
163
|
-
getKeyFrames(sheet: CSSStyleSheet) {
|
|
164
|
-
let result = {};
|
|
165
|
-
Object.keys(sheet.cssRules).forEach((key) => {
|
|
166
|
-
if (
|
|
167
|
-
(sheet.cssRules as any)[key].type === 7 &&
|
|
168
|
-
(sheet.cssRules as any)[key].name.startsWith("pops-anim-")
|
|
169
|
-
) {
|
|
170
|
-
(result as any)[(sheet.cssRules as any)[key].name] = (
|
|
171
|
-
sheet.cssRules as any
|
|
172
|
-
)[key];
|
|
173
|
-
}
|
|
174
|
-
});
|
|
175
|
-
return result;
|
|
176
|
-
},
|
|
177
159
|
/**
|
|
178
160
|
* 删除配置中对应的对象
|
|
179
161
|
* @param moreLayerConfigList 配置实例列表
|
|
@@ -206,17 +188,17 @@ export const PopsInstanceUtils = {
|
|
|
206
188
|
// 移除全部或者guid相同
|
|
207
189
|
if (isAll || layerConfigItem["guid"] === guid) {
|
|
208
190
|
// 判断是否有动画
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
191
|
+
let animName = layerConfigItem.animElement.getAttribute(
|
|
192
|
+
"anim"
|
|
193
|
+
) as string;
|
|
194
|
+
if (PopsAnimation.hasAnim(animName)) {
|
|
195
|
+
let reverseAnimName = animName + "-reverse";
|
|
214
196
|
layerConfigItem.animElement.style.width = "100%";
|
|
215
197
|
layerConfigItem.animElement.style.height = "100%";
|
|
216
198
|
(layerConfigItem.animElement.style as any)["animation-name"] =
|
|
217
|
-
|
|
199
|
+
reverseAnimName;
|
|
218
200
|
if (
|
|
219
|
-
|
|
201
|
+
PopsAnimation.hasAnim(
|
|
220
202
|
(layerConfigItem.animElement.style as any)["animation-name"]
|
|
221
203
|
)
|
|
222
204
|
) {
|
|
@@ -296,7 +278,7 @@ export const PopsInstanceUtils = {
|
|
|
296
278
|
(layerConfigItem.animElement.style as any)["animation-name"] =
|
|
297
279
|
layerConfigItem.animElement.getAttribute("anim") + "-reverse";
|
|
298
280
|
if (
|
|
299
|
-
|
|
281
|
+
PopsAnimation.hasAnim(
|
|
300
282
|
(layerConfigItem.animElement.style as any)["animation-name"]
|
|
301
283
|
)
|
|
302
284
|
) {
|
|
@@ -394,7 +376,7 @@ export const PopsInstanceUtils = {
|
|
|
394
376
|
.animElement!.getAttribute("anim")!
|
|
395
377
|
.replace("-reverse", "");
|
|
396
378
|
if (
|
|
397
|
-
|
|
379
|
+
PopsAnimation.hasAnim(
|
|
398
380
|
(layerConfigItem.animElement.style as any)["animation-name"]
|
|
399
381
|
)
|
|
400
382
|
) {
|
package/src/utils/PopsUtils.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { PopsCore } from "../Core";
|
|
2
2
|
import type { PopsUtilsOwnObject } from "../types/main";
|
|
3
|
-
import { popsDOMUtils } from "./PopsDOMUtils";
|
|
4
3
|
import {
|
|
5
4
|
clearInterval as WorkerClearInterval,
|
|
6
5
|
clearTimeout as WorkerClearTimeout,
|
|
@@ -182,21 +181,6 @@ class PopsUtils {
|
|
|
182
181
|
);
|
|
183
182
|
}
|
|
184
183
|
}
|
|
185
|
-
/**
|
|
186
|
-
* 字符串转HTMLElement
|
|
187
|
-
* @param elementString
|
|
188
|
-
* @returns
|
|
189
|
-
*/
|
|
190
|
-
parseTextToDOM<R extends HTMLElement>(elementString: string): R {
|
|
191
|
-
/* 去除前后的换行和空格 */
|
|
192
|
-
elementString = elementString
|
|
193
|
-
.replace(/^[\n|\s]*/g, "")
|
|
194
|
-
.replace(/[\n|\s]*$/g, "");
|
|
195
|
-
let targetElement = popsDOMUtils.createElement("div", {
|
|
196
|
-
innerHTML: elementString,
|
|
197
|
-
});
|
|
198
|
-
return targetElement.firstChild as any as R;
|
|
199
|
-
}
|
|
200
184
|
/**
|
|
201
185
|
* 判断元素/页面中是否包含该元素
|
|
202
186
|
* @param target 需要判断的元素
|
|
@@ -389,6 +373,13 @@ class PopsUtils {
|
|
|
389
373
|
AnyTouch = () => {
|
|
390
374
|
return AnyTouch;
|
|
391
375
|
};
|
|
376
|
+
/**
|
|
377
|
+
* 通过navigator.userAgent判断是否是手机访问
|
|
378
|
+
* @param userAgent
|
|
379
|
+
*/
|
|
380
|
+
isPhone(userAgent = PopsCore.globalThis.navigator.userAgent): boolean {
|
|
381
|
+
return Boolean(/(iPhone|iPad|iPod|iOS|Android)/i.test(userAgent));
|
|
382
|
+
}
|
|
392
383
|
/**
|
|
393
384
|
* 自动使用 Worker 执行 setTimeout
|
|
394
385
|
*/
|