@whitesev/pops 1.5.2 → 1.5.4
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 +178 -83
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +178 -83
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +178 -83
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +178 -83
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +178 -83
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +178 -83
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/components/rightClickMenu/indexType.d.ts +1 -1
- package/dist/types/src/components/searchSuggestion/indexType.d.ts +1 -1
- package/dist/types/src/components/tooltip/indexType.d.ts +1 -1
- package/dist/types/src/handler/PopsElementHandler.d.ts +2 -1
- package/dist/types/src/handler/PopsHandler.d.ts +5 -0
- package/dist/types/src/types/components.d.ts +1 -1
- package/package.json +3 -2
- package/src/Pops.ts +1 -1
- package/src/components/alert/index.ts +6 -3
- package/src/components/confirm/index.ts +6 -3
- package/src/components/drawer/index.ts +6 -3
- package/src/components/folder/index.ts +79 -40
- package/src/components/iframe/index.ts +12 -8
- package/src/components/loading/index.ts +8 -3
- package/src/components/panel/index.ts +8 -3
- package/src/components/prompt/index.ts +7 -4
- package/src/components/rightClickMenu/index.ts +15 -3
- package/src/components/rightClickMenu/indexType.ts +1 -1
- package/src/components/searchSuggestion/index.ts +1 -1
- package/src/components/searchSuggestion/indexType.ts +1 -1
- package/src/components/tooltip/index.ts +3 -1
- package/src/components/tooltip/indexType.ts +1 -1
- package/src/handler/PopsElementHandler.ts +24 -18
- package/src/handler/PopsHandler.ts +27 -4
- package/src/types/components.d.ts +1 -1
- package/src/utils/PopsUtils.ts +8 -4
|
@@ -24,6 +24,9 @@ export const PopsElementHandler = {
|
|
|
24
24
|
*/
|
|
25
25
|
getMaskHTML(guid: string, zIndex: number = 101, style = ""): string {
|
|
26
26
|
zIndex = zIndex - 100;
|
|
27
|
+
if (style.startsWith(";")) {
|
|
28
|
+
style = style.replace(";", "");
|
|
29
|
+
}
|
|
27
30
|
return `<div class="pops-mask" data-guid="${guid}" style="z-index:${zIndex};${style}"></div>`;
|
|
28
31
|
},
|
|
29
32
|
/**
|
|
@@ -33,21 +36,23 @@ export const PopsElementHandler = {
|
|
|
33
36
|
* @param config
|
|
34
37
|
* @param html
|
|
35
38
|
* @param bottomBtnHTML
|
|
39
|
+
* @param zIndex
|
|
36
40
|
*/
|
|
37
41
|
getAnimHTML(
|
|
38
42
|
guid: string,
|
|
39
43
|
type: PopsTypeSupportAnim,
|
|
40
44
|
config: PopsSupportAnim[keyof PopsSupportAnim],
|
|
41
45
|
html = "",
|
|
42
|
-
bottomBtnHTML = ""
|
|
46
|
+
bottomBtnHTML = "",
|
|
47
|
+
zIndex: number
|
|
43
48
|
) {
|
|
44
49
|
let __config = config as PopsAlertDetails;
|
|
45
50
|
let popsAnimStyle = "";
|
|
46
51
|
let popsStyle = "";
|
|
47
52
|
let popsPosition = __config.position || "";
|
|
48
53
|
if (config.zIndex != null) {
|
|
49
|
-
popsAnimStyle += `z-index: ${
|
|
50
|
-
popsStyle += `z-index: ${
|
|
54
|
+
popsAnimStyle += `z-index: ${zIndex};`;
|
|
55
|
+
popsStyle += `z-index: ${zIndex};`;
|
|
51
56
|
}
|
|
52
57
|
if (__config.width != null) {
|
|
53
58
|
popsStyle += `width: ${__config.width};`;
|
|
@@ -56,26 +61,27 @@ export const PopsElementHandler = {
|
|
|
56
61
|
popsStyle += `height: ${__config.height};`;
|
|
57
62
|
}
|
|
58
63
|
let hasBottomBtn = bottomBtnHTML.trim() === "" ? false : true;
|
|
59
|
-
return
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
+
return /*html*/ `
|
|
65
|
+
<div
|
|
66
|
+
class="pops-anim"
|
|
67
|
+
anim="${__config.animation || ""}"
|
|
68
|
+
style="${popsAnimStyle};"
|
|
69
|
+
data-guid="${guid}">
|
|
64
70
|
${
|
|
65
71
|
config.style != null
|
|
66
72
|
? `<style tyle="text/css">${config.style}</style>`
|
|
67
73
|
: ""
|
|
68
74
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
<div
|
|
76
|
+
class="pops ${config.class || ""}"
|
|
77
|
+
data-bottom-btn="${hasBottomBtn}"
|
|
78
|
+
type-value="${type}"
|
|
79
|
+
style="${popsStyle}"
|
|
80
|
+
position="${popsPosition}"
|
|
81
|
+
data-guid="${guid}">
|
|
82
|
+
${html}
|
|
83
|
+
</div>
|
|
84
|
+
</div>`;
|
|
79
85
|
},
|
|
80
86
|
/**
|
|
81
87
|
* 获取顶部按钮层HTML
|
|
@@ -605,6 +605,17 @@ export const PopsHandler = {
|
|
|
605
605
|
}
|
|
606
606
|
);
|
|
607
607
|
},
|
|
608
|
+
/**
|
|
609
|
+
* 把配置的z-index配置转为数字
|
|
610
|
+
* @param zIndex
|
|
611
|
+
*/
|
|
612
|
+
handleZIndex(zIndex: number | (() => number)): number {
|
|
613
|
+
if (typeof zIndex === "function") {
|
|
614
|
+
return zIndex();
|
|
615
|
+
} else {
|
|
616
|
+
return zIndex;
|
|
617
|
+
}
|
|
618
|
+
},
|
|
608
619
|
/**
|
|
609
620
|
* 处理config.only
|
|
610
621
|
* @param type 当前弹窗类型
|
|
@@ -641,10 +652,22 @@ export const PopsHandler = {
|
|
|
641
652
|
);
|
|
642
653
|
}
|
|
643
654
|
} else {
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
)
|
|
647
|
-
|
|
655
|
+
// 对配置进行处理
|
|
656
|
+
// 选择配置的z-index和已有的pops实例的最大z-index值
|
|
657
|
+
if (typeof config.zIndex === "function") {
|
|
658
|
+
let originZIndexFn = config.zIndex;
|
|
659
|
+
config.zIndex = () => {
|
|
660
|
+
const { zIndex: maxZIndex } = PopsInstanceUtils.getPopsMaxZIndex(
|
|
661
|
+
PopsHandler.handleZIndex(originZIndexFn) + 100
|
|
662
|
+
);
|
|
663
|
+
return maxZIndex;
|
|
664
|
+
};
|
|
665
|
+
}else{
|
|
666
|
+
const { zIndex: maxZIndex } = PopsInstanceUtils.getPopsMaxZIndex(
|
|
667
|
+
PopsHandler.handleZIndex(config.zIndex) + 100
|
|
668
|
+
);
|
|
669
|
+
config.zIndex = maxZIndex;
|
|
670
|
+
}
|
|
648
671
|
}
|
|
649
672
|
return config;
|
|
650
673
|
},
|
package/src/utils/PopsUtils.ts
CHANGED
|
@@ -130,8 +130,10 @@ class PopsUtils {
|
|
|
130
130
|
} else {
|
|
131
131
|
for (const targetKeyName in target) {
|
|
132
132
|
if (targetKeyName in source) {
|
|
133
|
-
|
|
134
|
-
let
|
|
133
|
+
// @ts-ignore
|
|
134
|
+
let targetValue = target[targetKeyName];
|
|
135
|
+
// @ts-ignore
|
|
136
|
+
let sourceValue = source[targetKeyName];
|
|
135
137
|
if (
|
|
136
138
|
typeof sourceValue === "object" &&
|
|
137
139
|
sourceValue != null &&
|
|
@@ -139,7 +141,8 @@ class PopsUtils {
|
|
|
139
141
|
Object.keys(sourceValue).length
|
|
140
142
|
) {
|
|
141
143
|
/* 源端的值是object类型,且不是元素节点 */
|
|
142
|
-
|
|
144
|
+
// @ts-ignore
|
|
145
|
+
target[targetKeyName] = UtilsContext.assign(
|
|
143
146
|
targetValue,
|
|
144
147
|
sourceValue,
|
|
145
148
|
isAdd
|
|
@@ -147,7 +150,8 @@ class PopsUtils {
|
|
|
147
150
|
continue;
|
|
148
151
|
}
|
|
149
152
|
/* 直接赋值 */
|
|
150
|
-
|
|
153
|
+
// @ts-ignore
|
|
154
|
+
target[targetKeyName] = sourceValue;
|
|
151
155
|
}
|
|
152
156
|
}
|
|
153
157
|
}
|