@whitesev/pops 1.5.3 → 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 +111 -50
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +111 -50
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +111 -50
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +111 -50
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +111 -50
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +111 -50
- 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 +6 -2
- 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
|
@@ -14,8 +14,9 @@ export declare const PopsElementHandler: {
|
|
|
14
14
|
* @param config
|
|
15
15
|
* @param html
|
|
16
16
|
* @param bottomBtnHTML
|
|
17
|
+
* @param zIndex
|
|
17
18
|
*/
|
|
18
|
-
getAnimHTML(guid: string, type: PopsTypeSupportAnim, config: PopsSupportAnim[keyof PopsSupportAnim], html
|
|
19
|
+
getAnimHTML(guid: string, type: PopsTypeSupportAnim, config: PopsSupportAnim[keyof PopsSupportAnim], html: string | undefined, bottomBtnHTML: string | undefined, zIndex: number): string;
|
|
19
20
|
/**
|
|
20
21
|
* 获取顶部按钮层HTML
|
|
21
22
|
* @param type
|
|
@@ -207,6 +207,11 @@ export declare const PopsHandler: {
|
|
|
207
207
|
type: any;
|
|
208
208
|
text: string;
|
|
209
209
|
}, event: MouseEvent | PointerEvent) => void): void;
|
|
210
|
+
/**
|
|
211
|
+
* 把配置的z-index配置转为数字
|
|
212
|
+
* @param zIndex
|
|
213
|
+
*/
|
|
214
|
+
handleZIndex(zIndex: number | (() => number)): number;
|
|
210
215
|
/**
|
|
211
216
|
* 处理config.only
|
|
212
217
|
* @param type 当前弹窗类型
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@whitesev/pops",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.4",
|
|
4
4
|
"description": "弹窗库",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"typescript": "^5.4.5"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
|
-
"build": "rollup --config"
|
|
48
|
+
"build": "rollup --config",
|
|
49
|
+
"build:all": "rollup --config"
|
|
49
50
|
}
|
|
50
51
|
}
|
package/src/Pops.ts
CHANGED
|
@@ -83,7 +83,9 @@ export class PopsAlert {
|
|
|
83
83
|
const PopsType: PopsMode = "alert";
|
|
84
84
|
config = PopsHandler.handleOnly(PopsType, config);
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
// 先把z-index提取出来
|
|
87
|
+
let zIndex = PopsHandler.handleZIndex(config.zIndex);
|
|
88
|
+
let maskHTML = PopsElementHandler.getMaskHTML(guid, zIndex);
|
|
87
89
|
let headerBtnHTML = PopsElementHandler.getHeaderBtnHTML(PopsType, config);
|
|
88
90
|
let bottomBtnHTML = PopsElementHandler.getBottomBtnHTML(PopsType, config);
|
|
89
91
|
let { headerStyle, headerPStyle } = PopsElementHandler.getHeaderStyle(
|
|
@@ -98,7 +100,7 @@ export class PopsAlert {
|
|
|
98
100
|
guid,
|
|
99
101
|
PopsType,
|
|
100
102
|
config,
|
|
101
|
-
`
|
|
103
|
+
/*html*/ `
|
|
102
104
|
<div
|
|
103
105
|
class="pops-alert-title"
|
|
104
106
|
style="text-align: ${config.title.position};
|
|
@@ -118,7 +120,8 @@ export class PopsAlert {
|
|
|
118
120
|
}
|
|
119
121
|
</div>
|
|
120
122
|
${bottomBtnHTML}`,
|
|
121
|
-
bottomBtnHTML
|
|
123
|
+
bottomBtnHTML,
|
|
124
|
+
zIndex
|
|
122
125
|
);
|
|
123
126
|
/**
|
|
124
127
|
* 弹窗的主元素,包括动画层
|
|
@@ -117,7 +117,9 @@ export class PopsConfirm {
|
|
|
117
117
|
|
|
118
118
|
config = PopsHandler.handleOnly(PopsType, config);
|
|
119
119
|
|
|
120
|
-
|
|
120
|
+
// 先把z-index提取出来
|
|
121
|
+
let zIndex = PopsHandler.handleZIndex(config.zIndex);
|
|
122
|
+
let maskHTML = PopsElementHandler.getMaskHTML(guid, zIndex);
|
|
121
123
|
|
|
122
124
|
let headerBtnHTML = PopsElementHandler.getHeaderBtnHTML(PopsType, config);
|
|
123
125
|
let bottomBtnHTML = PopsElementHandler.getBottomBtnHTML(PopsType, config);
|
|
@@ -133,7 +135,7 @@ export class PopsConfirm {
|
|
|
133
135
|
guid,
|
|
134
136
|
PopsType,
|
|
135
137
|
config,
|
|
136
|
-
`
|
|
138
|
+
/*html*/ `
|
|
137
139
|
<div class="pops-confirm-title" style="text-align: ${
|
|
138
140
|
config.title.position
|
|
139
141
|
};${headerStyle}">
|
|
@@ -154,7 +156,8 @@ export class PopsConfirm {
|
|
|
154
156
|
</div>
|
|
155
157
|
${bottomBtnHTML}
|
|
156
158
|
`,
|
|
157
|
-
bottomBtnHTML
|
|
159
|
+
bottomBtnHTML,
|
|
160
|
+
zIndex
|
|
158
161
|
);
|
|
159
162
|
/**
|
|
160
163
|
* 弹窗的主元素,包括动画层
|
|
@@ -112,7 +112,9 @@ export class PopsDrawer {
|
|
|
112
112
|
|
|
113
113
|
config = PopsHandler.handleOnly(PopsType, config);
|
|
114
114
|
|
|
115
|
-
|
|
115
|
+
// 先把z-index提取出来
|
|
116
|
+
let zIndex = PopsHandler.handleZIndex(config.zIndex);
|
|
117
|
+
let maskHTML = PopsElementHandler.getMaskHTML(guid, zIndex);
|
|
116
118
|
|
|
117
119
|
let headerBtnHTML = PopsElementHandler.getHeaderBtnHTML(PopsType, config);
|
|
118
120
|
let bottomBtnHTML = PopsElementHandler.getBottomBtnHTML(PopsType, config);
|
|
@@ -128,7 +130,7 @@ export class PopsDrawer {
|
|
|
128
130
|
guid,
|
|
129
131
|
PopsType,
|
|
130
132
|
config,
|
|
131
|
-
`
|
|
133
|
+
/*html*/ `
|
|
132
134
|
${
|
|
133
135
|
config.title.enable
|
|
134
136
|
? `
|
|
@@ -159,7 +161,8 @@ export class PopsDrawer {
|
|
|
159
161
|
|
|
160
162
|
${bottomBtnHTML}
|
|
161
163
|
`,
|
|
162
|
-
bottomBtnHTML
|
|
164
|
+
bottomBtnHTML,
|
|
165
|
+
zIndex
|
|
163
166
|
);
|
|
164
167
|
/**
|
|
165
168
|
* 弹窗的主元素,包括动画层
|
|
@@ -217,7 +217,10 @@ export class PopsFolder {
|
|
|
217
217
|
|
|
218
218
|
config = PopsHandler.handleOnly(PopsType, config);
|
|
219
219
|
|
|
220
|
-
|
|
220
|
+
// 先把z-index提取出来
|
|
221
|
+
let zIndex = PopsHandler.handleZIndex(config.zIndex);
|
|
222
|
+
let maskHTML = PopsElementHandler.getMaskHTML(guid, zIndex);
|
|
223
|
+
|
|
221
224
|
let headerBtnHTML = PopsElementHandler.getHeaderBtnHTML(PopsType, config);
|
|
222
225
|
let bottomBtnHTML = PopsElementHandler.getBottomBtnHTML(
|
|
223
226
|
PopsType,
|
|
@@ -348,7 +351,8 @@ export class PopsFolder {
|
|
|
348
351
|
</div>
|
|
349
352
|
${bottomBtnHTML}
|
|
350
353
|
`,
|
|
351
|
-
bottomBtnHTML
|
|
354
|
+
bottomBtnHTML,
|
|
355
|
+
zIndex
|
|
352
356
|
);
|
|
353
357
|
/**
|
|
354
358
|
* 弹窗的主元素,包括动画层
|
|
@@ -87,12 +87,11 @@ export class PopsIframe {
|
|
|
87
87
|
config.animation != null && (config as any).animation != ""
|
|
88
88
|
? "position:absolute;"
|
|
89
89
|
: "";
|
|
90
|
-
let maskHTML = PopsElementHandler.getMaskHTML(
|
|
91
|
-
guid,
|
|
92
90
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
);
|
|
91
|
+
// 先把z-index提取出来
|
|
92
|
+
let zIndex = PopsHandler.handleZIndex(config.zIndex);
|
|
93
|
+
let maskHTML = PopsElementHandler.getMaskHTML(guid, zIndex, maskExtraStyle);
|
|
94
|
+
|
|
96
95
|
let headerBtnHTML = PopsElementHandler.getHeaderBtnHTML(PopsType, config);
|
|
97
96
|
let iframeLoadingHTML = '<div class="pops-loading"></div>';
|
|
98
97
|
let titleText =
|
|
@@ -105,7 +104,7 @@ export class PopsIframe {
|
|
|
105
104
|
guid,
|
|
106
105
|
PopsType,
|
|
107
106
|
config,
|
|
108
|
-
`
|
|
107
|
+
/*html*/ `
|
|
109
108
|
<div
|
|
110
109
|
class="pops-iframe-title"
|
|
111
110
|
style="text-align: ${config.title.position};${headerStyle}"
|
|
@@ -131,7 +130,8 @@ export class PopsIframe {
|
|
|
131
130
|
</div>
|
|
132
131
|
${config.loading.enable ? iframeLoadingHTML : ""}
|
|
133
132
|
`,
|
|
134
|
-
""
|
|
133
|
+
"",
|
|
134
|
+
zIndex
|
|
135
135
|
);
|
|
136
136
|
/**
|
|
137
137
|
* 弹窗的主元素,包括动画层
|
|
@@ -362,7 +362,11 @@ export class PopsIframe {
|
|
|
362
362
|
headerCloseBtnElement,
|
|
363
363
|
"click",
|
|
364
364
|
(event) => {
|
|
365
|
-
PopsInstanceUtils.removeInstance(
|
|
365
|
+
PopsInstanceUtils.removeInstance(
|
|
366
|
+
[pops.config.layer.iframe],
|
|
367
|
+
guid,
|
|
368
|
+
false
|
|
369
|
+
);
|
|
366
370
|
setTimeout(() => {
|
|
367
371
|
let allIsMinElementList: HTMLElement[] = [];
|
|
368
372
|
pops.config.layer.iframe.forEach((item) => {
|
|
@@ -37,7 +37,11 @@ export class PopsLoading {
|
|
|
37
37
|
const PopsType = "loading";
|
|
38
38
|
|
|
39
39
|
config = PopsHandler.handleOnly(PopsType, config);
|
|
40
|
-
|
|
40
|
+
|
|
41
|
+
// 先把z-index提取出来
|
|
42
|
+
let zIndex = PopsHandler.handleZIndex(config.zIndex);
|
|
43
|
+
let maskHTML = PopsElementHandler.getMaskHTML(guid, zIndex);
|
|
44
|
+
|
|
41
45
|
let { contentPStyle } = PopsElementHandler.getContentStyle(
|
|
42
46
|
"loading",
|
|
43
47
|
config
|
|
@@ -46,7 +50,7 @@ export class PopsLoading {
|
|
|
46
50
|
guid,
|
|
47
51
|
PopsType,
|
|
48
52
|
config,
|
|
49
|
-
`
|
|
53
|
+
/*html*/ `
|
|
50
54
|
<div class="pops-loading-content">
|
|
51
55
|
${
|
|
52
56
|
config.addIndexCSS
|
|
@@ -64,7 +68,8 @@ export class PopsLoading {
|
|
|
64
68
|
<p pops style="${contentPStyle}">${config.content.text}</p>
|
|
65
69
|
</div>
|
|
66
70
|
`,
|
|
67
|
-
""
|
|
71
|
+
"",
|
|
72
|
+
zIndex
|
|
68
73
|
);
|
|
69
74
|
|
|
70
75
|
/**
|
|
@@ -346,7 +346,11 @@ export class PopsPanel {
|
|
|
346
346
|
let guid = popsUtils.getRandomGUID();
|
|
347
347
|
const PopsType = "panel";
|
|
348
348
|
config = PopsHandler.handleOnly(PopsType, config);
|
|
349
|
-
|
|
349
|
+
|
|
350
|
+
// 先把z-index提取出来
|
|
351
|
+
let zIndex = PopsHandler.handleZIndex(config.zIndex);
|
|
352
|
+
let maskHTML = PopsElementHandler.getMaskHTML(guid, zIndex);
|
|
353
|
+
|
|
350
354
|
let headerBtnHTML = PopsElementHandler.getHeaderBtnHTML(PopsType, config);
|
|
351
355
|
let { headerStyle, headerPStyle } = PopsElementHandler.getHeaderStyle(
|
|
352
356
|
PopsType,
|
|
@@ -357,7 +361,7 @@ export class PopsPanel {
|
|
|
357
361
|
guid,
|
|
358
362
|
PopsType,
|
|
359
363
|
config,
|
|
360
|
-
`
|
|
364
|
+
/*html*/ `
|
|
361
365
|
<div
|
|
362
366
|
class="pops-${PopsType}-title"
|
|
363
367
|
style="text-align: ${config.title.position};
|
|
@@ -378,7 +382,8 @@ export class PopsPanel {
|
|
|
378
382
|
<ul></ul>
|
|
379
383
|
</section>
|
|
380
384
|
</div>`,
|
|
381
|
-
""
|
|
385
|
+
"",
|
|
386
|
+
zIndex
|
|
382
387
|
);
|
|
383
388
|
/**
|
|
384
389
|
* 弹窗的主元素,包括动画层
|
|
@@ -123,7 +123,9 @@ export class PopsPrompt {
|
|
|
123
123
|
|
|
124
124
|
config = PopsHandler.handleOnly(PopsType, config);
|
|
125
125
|
|
|
126
|
-
|
|
126
|
+
// 先把z-index提取出来
|
|
127
|
+
let zIndex = PopsHandler.handleZIndex(config.zIndex);
|
|
128
|
+
let maskHTML = PopsElementHandler.getMaskHTML(guid, zIndex);
|
|
127
129
|
|
|
128
130
|
let headerBtnHTML = PopsElementHandler.getHeaderBtnHTML(PopsType, config);
|
|
129
131
|
let bottomBtnHTML = PopsElementHandler.getBottomBtnHTML(PopsType, config);
|
|
@@ -139,7 +141,7 @@ export class PopsPrompt {
|
|
|
139
141
|
guid,
|
|
140
142
|
PopsType,
|
|
141
143
|
config,
|
|
142
|
-
`
|
|
144
|
+
/*html*/ `
|
|
143
145
|
<div class="pops-prompt-title" style="text-align: ${
|
|
144
146
|
config.title.position
|
|
145
147
|
};${headerStyle}">
|
|
@@ -163,9 +165,10 @@ export class PopsPrompt {
|
|
|
163
165
|
'">'
|
|
164
166
|
}
|
|
165
167
|
</div>
|
|
166
|
-
|
|
168
|
+
${bottomBtnHTML}
|
|
167
169
|
`,
|
|
168
|
-
bottomBtnHTML
|
|
170
|
+
bottomBtnHTML,
|
|
171
|
+
zIndex
|
|
169
172
|
);
|
|
170
173
|
/**
|
|
171
174
|
* 弹窗的主元素,包括动画层
|
|
@@ -355,7 +355,7 @@ export class PopsRightClickMenu {
|
|
|
355
355
|
* @param isChildren 是否是rightClickMenu的某一项的子菜单
|
|
356
356
|
*/
|
|
357
357
|
getMenuContainerElement(zIndex: number, isChildren: boolean) {
|
|
358
|
-
let menuElement = popsUtils.parseTextToDOM(`
|
|
358
|
+
let menuElement = popsUtils.parseTextToDOM(/*html*/ `
|
|
359
359
|
<div class="pops-${PopsType}" ${isChildren ? 'is-children="true"' : ""}>
|
|
360
360
|
<style type="text/css" data-from="pops-${PopsType}">
|
|
361
361
|
.pops-${PopsType} *{
|
|
@@ -443,6 +443,12 @@ export class PopsRightClickMenu {
|
|
|
443
443
|
}
|
|
444
444
|
return menuElement;
|
|
445
445
|
},
|
|
446
|
+
/**
|
|
447
|
+
* 动态获取配的z-index
|
|
448
|
+
*/
|
|
449
|
+
getMenuZIndex() {
|
|
450
|
+
return PopsHandler.handleZIndex(config.zIndex);
|
|
451
|
+
},
|
|
446
452
|
/**
|
|
447
453
|
* 获取left、top偏移
|
|
448
454
|
* @param menuElement 菜单元素
|
|
@@ -483,7 +489,10 @@ export class PopsRightClickMenu {
|
|
|
483
489
|
menuEvent: PointerEvent,
|
|
484
490
|
_config_: PopsRightClickMenuDataDetails[]
|
|
485
491
|
) {
|
|
486
|
-
let menuElement = this.getMenuContainerElement(
|
|
492
|
+
let menuElement = this.getMenuContainerElement(
|
|
493
|
+
this.getMenuZIndex(),
|
|
494
|
+
false
|
|
495
|
+
);
|
|
487
496
|
(menuElement as any)["__menuData__"] = {
|
|
488
497
|
child: [],
|
|
489
498
|
};
|
|
@@ -539,7 +548,10 @@ export class PopsRightClickMenu {
|
|
|
539
548
|
rootElement: HTMLDivElement,
|
|
540
549
|
targetLiElement: HTMLLIElement
|
|
541
550
|
) {
|
|
542
|
-
let menuElement = this.getMenuContainerElement(
|
|
551
|
+
let menuElement = this.getMenuContainerElement(
|
|
552
|
+
this.getMenuZIndex(),
|
|
553
|
+
true
|
|
554
|
+
);
|
|
543
555
|
(menuElement as any)["__menuData__"] = {
|
|
544
556
|
parent: targetLiElement,
|
|
545
557
|
root: rootElement,
|
|
@@ -144,7 +144,7 @@ export class PopsSearchSuggestion {
|
|
|
144
144
|
}
|
|
145
145
|
ul.pops-${PopsType}-search-suggestion-hint{
|
|
146
146
|
position: ${config.isAbsolute ? "absolute" : "fixed"};
|
|
147
|
-
z-index: ${config.zIndex};
|
|
147
|
+
z-index: ${PopsHandler.handleZIndex(config.zIndex)};
|
|
148
148
|
width: 0;
|
|
149
149
|
left: 0;
|
|
150
150
|
max-height: ${config.maxHeight};
|
|
@@ -69,7 +69,9 @@ export class PopsTooltip {
|
|
|
69
69
|
}
|
|
70
70
|
_toolTipElement_.setAttribute("data-guid", guid);
|
|
71
71
|
|
|
72
|
-
_toolTipElement_.style.zIndex =
|
|
72
|
+
_toolTipElement_.style.zIndex = PopsHandler.handleZIndex(
|
|
73
|
+
config.zIndex
|
|
74
|
+
).toString();
|
|
73
75
|
_toolTipElement_.innerHTML = `<div style="text-align: center;">${getContent()}</div>`;
|
|
74
76
|
/* 箭头元素 */
|
|
75
77
|
let _toolTipArrowHTML_ = '<div class="pops-tip-arrow"></div>';
|
|
@@ -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
|
}
|