@whitesev/pops 2.0.10 → 2.0.11
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 +1632 -1570
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +1632 -1570
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1632 -1570
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +1632 -1570
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +1632 -1570
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +1632 -1570
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/Pops.d.ts +50 -30
- 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 +1 -2
- package/dist/types/src/components/rightClickMenu/indexType.d.ts +2 -2
- 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 +12 -0
- 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 +9 -10
- package/src/components/rightClickMenu/indexType.ts +2 -2
- 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/button.d.ts +3 -3
- package/src/types/icon.d.ts +1 -1
- package/src/utils/PopsDOMUtils.ts +34 -1
- package/src/utils/PopsInstanceUtils.ts +13 -31
- package/src/utils/PopsUtils.ts +7 -16
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { PopsElementHandler } from "../../handler/PopsElementHandler";
|
|
2
2
|
import { PopsHandler } from "../../handler/PopsHandler";
|
|
3
|
-
import { pops } from "../../Pops";
|
|
4
3
|
import { popsDOMUtils } from "../../utils/PopsDOMUtils";
|
|
5
4
|
import { PopsInstanceUtils } from "../../utils/PopsInstanceUtils";
|
|
6
5
|
import { popsUtils } from "../../utils/PopsUtils";
|
|
@@ -8,6 +7,7 @@ import type { PopsPanelDetails } from "./indexType";
|
|
|
8
7
|
import { PopsPanelConfig } from "./config";
|
|
9
8
|
import { PanelHandleContentDetails } from "./PanelHandleContentDetails";
|
|
10
9
|
import { GlobalConfig } from "../../GlobalConfig";
|
|
10
|
+
import { PopsCSS } from "../../PopsCSS";
|
|
11
11
|
|
|
12
12
|
export const PopsPanel = {
|
|
13
13
|
init(details: PopsPanelDetails) {
|
|
@@ -25,13 +25,13 @@ export const PopsPanel = {
|
|
|
25
25
|
|
|
26
26
|
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
|
|
27
27
|
PopsHandler.handleInit($shadowRoot, [
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
PopsCSS.index,
|
|
29
|
+
PopsCSS.ninePalaceGridPosition,
|
|
30
|
+
PopsCSS.scrollbar,
|
|
31
|
+
PopsCSS.button,
|
|
32
|
+
PopsCSS.anim,
|
|
33
|
+
PopsCSS.common,
|
|
34
|
+
PopsCSS.panelCSS,
|
|
35
35
|
]);
|
|
36
36
|
|
|
37
37
|
// 先把z-index提取出来
|
|
@@ -81,7 +81,7 @@ export const PopsPanel = {
|
|
|
81
81
|
contentAsideElement: $contentAside,
|
|
82
82
|
contentSectionContainerElement: $contentSectionContainer,
|
|
83
83
|
} = PopsHandler.handleQueryElement($anim, PopsType);
|
|
84
|
-
if (config.isMobile ||
|
|
84
|
+
if (config.isMobile || popsUtils.isPhone()) {
|
|
85
85
|
popsDOMUtils.addClassName($pops, config.mobileClassName);
|
|
86
86
|
}
|
|
87
87
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { GlobalConfig } from "../../GlobalConfig";
|
|
2
2
|
import { PopsElementHandler } from "../../handler/PopsElementHandler";
|
|
3
3
|
import { PopsHandler } from "../../handler/PopsHandler";
|
|
4
|
-
import {
|
|
4
|
+
import { PopsCSS } from "../../PopsCSS";
|
|
5
5
|
import { popsDOMUtils } from "../../utils/PopsDOMUtils";
|
|
6
6
|
import { PopsInstanceUtils } from "../../utils/PopsInstanceUtils";
|
|
7
7
|
import { popsUtils } from "../../utils/PopsUtils";
|
|
@@ -21,13 +21,13 @@ export const PopsPrompt = {
|
|
|
21
21
|
|
|
22
22
|
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
|
|
23
23
|
PopsHandler.handleInit($shadowRoot, [
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
PopsCSS.index,
|
|
25
|
+
PopsCSS.ninePalaceGridPosition,
|
|
26
|
+
PopsCSS.scrollbar,
|
|
27
|
+
PopsCSS.button,
|
|
28
|
+
PopsCSS.anim,
|
|
29
|
+
PopsCSS.common,
|
|
30
|
+
PopsCSS.promptCSS,
|
|
31
31
|
]);
|
|
32
32
|
|
|
33
33
|
// 先把z-index提取出来
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PopsIcon } from "../../PopsIcon";
|
|
2
2
|
import type { PopsRightClickMenuDetails } from "./indexType";
|
|
3
3
|
|
|
4
4
|
export const rightClickMenuConfig =
|
|
@@ -8,7 +8,7 @@ export const rightClickMenuConfig =
|
|
|
8
8
|
targetSelector: null,
|
|
9
9
|
data: [
|
|
10
10
|
{
|
|
11
|
-
icon:
|
|
11
|
+
icon: PopsIcon.getIcon("search")!,
|
|
12
12
|
iconIsLoading: false,
|
|
13
13
|
text: "搜索",
|
|
14
14
|
item: [],
|
|
@@ -21,7 +21,7 @@ export const rightClickMenuConfig =
|
|
|
21
21
|
},
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
|
-
icon:
|
|
24
|
+
icon: PopsIcon.getIcon("documentCopy")!,
|
|
25
25
|
iconIsLoading: false,
|
|
26
26
|
text: "复制",
|
|
27
27
|
item: [],
|
|
@@ -34,7 +34,7 @@ export const rightClickMenuConfig =
|
|
|
34
34
|
},
|
|
35
35
|
},
|
|
36
36
|
{
|
|
37
|
-
icon:
|
|
37
|
+
icon: PopsIcon.getIcon("delete")!,
|
|
38
38
|
text: "删除",
|
|
39
39
|
iconIsLoading: false,
|
|
40
40
|
item: [],
|
|
@@ -47,7 +47,7 @@ export const rightClickMenuConfig =
|
|
|
47
47
|
},
|
|
48
48
|
},
|
|
49
49
|
{
|
|
50
|
-
icon:
|
|
50
|
+
icon: PopsIcon.getIcon("loading")!,
|
|
51
51
|
iconIsLoading: true,
|
|
52
52
|
text: "加载",
|
|
53
53
|
item: [],
|
|
@@ -61,7 +61,7 @@ export const rightClickMenuConfig =
|
|
|
61
61
|
},
|
|
62
62
|
},
|
|
63
63
|
{
|
|
64
|
-
icon:
|
|
64
|
+
icon: PopsIcon.getIcon("elemePlus")!,
|
|
65
65
|
iconIsLoading: true,
|
|
66
66
|
text: "饿了么",
|
|
67
67
|
callback(clickEvent, contextMenuEvent, liElement) {
|
|
@@ -99,7 +99,7 @@ export const rightClickMenuConfig =
|
|
|
99
99
|
},
|
|
100
100
|
item: [
|
|
101
101
|
{
|
|
102
|
-
icon:
|
|
102
|
+
icon: PopsIcon.getIcon("view")!,
|
|
103
103
|
iconIsLoading: false,
|
|
104
104
|
text: "查看",
|
|
105
105
|
item: [],
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { OriginPrototype } from "../../Core";
|
|
2
2
|
import { GlobalConfig } from "../../GlobalConfig";
|
|
3
3
|
import { PopsHandler } from "../../handler/PopsHandler";
|
|
4
|
-
import { pops } from "../../Pops";
|
|
5
4
|
import { popsDOMUtils } from "../../utils/PopsDOMUtils";
|
|
6
5
|
import { PopsSafeUtils } from "../../utils/PopsSafeUtils";
|
|
7
6
|
import { popsUtils } from "../../utils/PopsUtils";
|
|
8
7
|
import { rightClickMenuConfig as PopsRightClickMenuConfig } from "./config";
|
|
9
|
-
import type { PopsIcon } from "../../types/icon";
|
|
10
8
|
import type {
|
|
11
9
|
PopsRightClickMenuDataDetails,
|
|
12
10
|
PopsRightClickMenuDetails,
|
|
13
11
|
} from "./indexType";
|
|
12
|
+
import { PopsCSS } from "../../PopsCSS";
|
|
13
|
+
import { PopsIcon } from "../../PopsIcon";
|
|
14
14
|
|
|
15
15
|
export const PopsRightClickMenu = {
|
|
16
16
|
init(details: PopsRightClickMenuDetails) {
|
|
@@ -31,10 +31,10 @@ export const PopsRightClickMenu = {
|
|
|
31
31
|
}
|
|
32
32
|
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
|
|
33
33
|
PopsHandler.handleInit($shadowRoot, [
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
PopsCSS.index,
|
|
35
|
+
PopsCSS.anim,
|
|
36
|
+
PopsCSS.common,
|
|
37
|
+
PopsCSS.rightClickMenu,
|
|
38
38
|
]);
|
|
39
39
|
|
|
40
40
|
if (config.style != null) {
|
|
@@ -441,12 +441,11 @@ export const PopsRightClickMenu = {
|
|
|
441
441
|
let menuULElement = menuElement.querySelector<HTMLUListElement>("ul")!;
|
|
442
442
|
_config_.forEach((item) => {
|
|
443
443
|
let menuLiElement =
|
|
444
|
-
|
|
444
|
+
popsDOMUtils.parseTextToDOM<HTMLLIElement>(`<li></li>`);
|
|
445
445
|
/* 判断有无图标,有就添加进去 */
|
|
446
446
|
if (typeof item.icon === "string" && item.icon.trim() !== "") {
|
|
447
|
-
let iconSVGHTML =
|
|
448
|
-
|
|
449
|
-
let iconElement = popsUtils.parseTextToDOM(
|
|
447
|
+
let iconSVGHTML = PopsIcon.getIcon(item.icon) ?? item.icon;
|
|
448
|
+
let iconElement = popsDOMUtils.parseTextToDOM(
|
|
450
449
|
/*html*/ `<i class="pops-${PopsType}-icon" is-loading="${item.iconIsLoading}">${iconSVGHTML}</i>`
|
|
451
450
|
);
|
|
452
451
|
menuLiElement.appendChild(iconElement);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PopsCommonConfig } from "../../types/components";
|
|
2
|
-
import type {
|
|
2
|
+
import type { PopsIconType } from "../../types/icon";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* pops.rightClickMenu的右键菜单配置
|
|
@@ -8,7 +8,7 @@ export interface PopsRightClickMenuDataDetails {
|
|
|
8
8
|
/**
|
|
9
9
|
* svg图标
|
|
10
10
|
*/
|
|
11
|
-
icon:
|
|
11
|
+
icon: PopsIconType | string;
|
|
12
12
|
/**
|
|
13
13
|
* 图标是否旋转
|
|
14
14
|
*/
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { PopsHandler } from "../../handler/PopsHandler";
|
|
2
|
-
import { pops } from "../../Pops";
|
|
3
2
|
import { popsDOMUtils } from "../../utils/PopsDOMUtils";
|
|
4
3
|
import { popsUtils } from "../../utils/PopsUtils";
|
|
5
4
|
import { searchSuggestionConfig as PopsSearchSuggestionConfig } from "./config";
|
|
6
5
|
import { GlobalConfig } from "../../GlobalConfig";
|
|
7
6
|
import { PopsSafeUtils } from "../../utils/PopsSafeUtils";
|
|
8
7
|
import type { PopsSearchSuggestionDetails } from "./indexType";
|
|
8
|
+
import { PopsCSS } from "../../PopsCSS";
|
|
9
9
|
|
|
10
10
|
export const PopsSearchSuggestion = {
|
|
11
11
|
init(details: PopsSearchSuggestionDetails) {
|
|
@@ -29,9 +29,9 @@ export const PopsSearchSuggestion = {
|
|
|
29
29
|
|
|
30
30
|
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
|
|
31
31
|
PopsHandler.handleInit($shadowRoot, [
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
PopsCSS.index,
|
|
33
|
+
PopsCSS.anim,
|
|
34
|
+
PopsCSS.common,
|
|
35
35
|
]);
|
|
36
36
|
|
|
37
37
|
if (config.style != null) {
|
|
@@ -655,7 +655,7 @@ export const PopsSearchSuggestion = {
|
|
|
655
655
|
this.$data.isEmpty = true;
|
|
656
656
|
this.clearAllSearchItemLi();
|
|
657
657
|
this.$el.$hintULContainer.appendChild(
|
|
658
|
-
|
|
658
|
+
popsDOMUtils.parseTextToDOM(config.toSearhNotResultHTML)
|
|
659
659
|
);
|
|
660
660
|
if (config.toHideWithNotResult) {
|
|
661
661
|
this.hide();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GlobalConfig } from "../../GlobalConfig";
|
|
2
2
|
import { PopsHandler } from "../../handler/PopsHandler";
|
|
3
|
-
import {
|
|
3
|
+
import { PopsCSS } from "../../PopsCSS";
|
|
4
4
|
import { popsDOMUtils } from "../../utils/PopsDOMUtils";
|
|
5
5
|
import { PopsSafeUtils } from "../../utils/PopsSafeUtils";
|
|
6
6
|
import { popsUtils } from "../../utils/PopsUtils";
|
|
@@ -613,10 +613,10 @@ export const PopsTooltip = {
|
|
|
613
613
|
|
|
614
614
|
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
|
|
615
615
|
PopsHandler.handleInit($shadowRoot, [
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
616
|
+
PopsCSS.index,
|
|
617
|
+
PopsCSS.anim,
|
|
618
|
+
PopsCSS.common,
|
|
619
|
+
PopsCSS.tooltipCSS,
|
|
620
620
|
]);
|
|
621
621
|
|
|
622
622
|
let toolTip = new ToolTip(config, guid, {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { PopsAlertDetails } from "../components/alert/indexType";
|
|
2
2
|
import type { PopsConfirmDetails } from "../components/confirm/indexType";
|
|
3
3
|
import type { PopsIframeDetails } from "../components/iframe/indexType";
|
|
4
|
-
import {
|
|
5
|
-
import type { PopsIcon } from "../types/icon";
|
|
4
|
+
import type { PopsIconType } from "../types/icon";
|
|
6
5
|
import type {
|
|
7
6
|
PopsSupportAnim,
|
|
8
7
|
PopsSupportBottomBtn,
|
|
@@ -13,7 +12,8 @@ import type {
|
|
|
13
12
|
PopsTypeSupportContent,
|
|
14
13
|
PopsTypeSupportHeaderTitle,
|
|
15
14
|
} from "../types/main";
|
|
16
|
-
import {
|
|
15
|
+
import { PopsIcon } from "../PopsIcon";
|
|
16
|
+
import { popsDOMUtils } from "../utils/PopsDOMUtils";
|
|
17
17
|
|
|
18
18
|
export const PopsElementHandler = {
|
|
19
19
|
/**
|
|
@@ -101,9 +101,7 @@ export const PopsElementHandler = {
|
|
|
101
101
|
item = item.toLowerCase();
|
|
102
102
|
topRightButtonHTML += /*html*/ `
|
|
103
103
|
<button class="pops-header-control" type="${item}">
|
|
104
|
-
<i class="pops-icon">${
|
|
105
|
-
(pops.config.iconSVG as any)[item]
|
|
106
|
-
}</i>
|
|
104
|
+
<i class="pops-icon">${PopsIcon.getIcon(item)}</i>
|
|
107
105
|
</button>`;
|
|
108
106
|
});
|
|
109
107
|
resultHTML = /*html*/ `
|
|
@@ -113,7 +111,7 @@ export const PopsElementHandler = {
|
|
|
113
111
|
closeHTML = /*html*/ `
|
|
114
112
|
<div class="pops-header-controls">
|
|
115
113
|
<button class="pops-header-control" type="close" data-header>
|
|
116
|
-
<i class="pops-icon">${
|
|
114
|
+
<i class="pops-icon">${PopsIcon.getIcon("close")}</i>
|
|
117
115
|
</button>
|
|
118
116
|
</div>`;
|
|
119
117
|
}
|
|
@@ -168,12 +166,12 @@ export const PopsElementHandler = {
|
|
|
168
166
|
okButtonSizeClassName = "pops-button-" + config.btn.ok.size;
|
|
169
167
|
}
|
|
170
168
|
let okIconHTML = "";
|
|
171
|
-
let okIcon = __config_confirm.btn.ok!.icon! as
|
|
169
|
+
let okIcon = __config_confirm.btn.ok!.icon! as PopsIconType | string;
|
|
172
170
|
if (okIcon !== "") {
|
|
173
171
|
// 判断图标是否是svg库内的
|
|
174
172
|
let iconHTML = "";
|
|
175
|
-
if (okIcon
|
|
176
|
-
iconHTML =
|
|
173
|
+
if (PopsIcon.hasIcon(okIcon)) {
|
|
174
|
+
iconHTML = PopsIcon.getIcon(okIcon)!;
|
|
177
175
|
} else {
|
|
178
176
|
iconHTML = okIcon;
|
|
179
177
|
}
|
|
@@ -202,12 +200,14 @@ export const PopsElementHandler = {
|
|
|
202
200
|
"pops-button-" + __config_confirm.btn.cancel.size;
|
|
203
201
|
}
|
|
204
202
|
let cancelIconHTML = "";
|
|
205
|
-
let cancelIcon = __config_confirm.btn.cancel!.icon as
|
|
203
|
+
let cancelIcon = __config_confirm.btn.cancel!.icon as
|
|
204
|
+
| PopsIconType
|
|
205
|
+
| string;
|
|
206
206
|
if (cancelIcon !== "") {
|
|
207
207
|
let iconHTML = "";
|
|
208
208
|
// 判断图标是否是svg库内的
|
|
209
|
-
if (cancelIcon
|
|
210
|
-
iconHTML =
|
|
209
|
+
if (PopsIcon.hasIcon(cancelIcon)) {
|
|
210
|
+
iconHTML = PopsIcon.getIcon(cancelIcon)!;
|
|
211
211
|
} else {
|
|
212
212
|
iconHTML = cancelIcon;
|
|
213
213
|
}
|
|
@@ -236,12 +236,12 @@ export const PopsElementHandler = {
|
|
|
236
236
|
"pops-button-" + __config_confirm.btn.other.size;
|
|
237
237
|
}
|
|
238
238
|
let otherIconHTML = "";
|
|
239
|
-
let otherIcon = __config_confirm.btn.other!.icon as
|
|
239
|
+
let otherIcon = __config_confirm.btn.other!.icon as PopsIconType | string;
|
|
240
240
|
if (otherIcon !== "") {
|
|
241
241
|
let iconHTML = "";
|
|
242
242
|
// 判断图标是否是svg库内的
|
|
243
|
-
if (otherIcon
|
|
244
|
-
iconHTML =
|
|
243
|
+
if (PopsIcon.hasIcon(otherIcon)) {
|
|
244
|
+
iconHTML = PopsIcon.getIcon(otherIcon)!;
|
|
245
245
|
} else {
|
|
246
246
|
otherIcon;
|
|
247
247
|
}
|
|
@@ -315,6 +315,6 @@ export const PopsElementHandler = {
|
|
|
315
315
|
* @param html
|
|
316
316
|
*/
|
|
317
317
|
parseElement<T extends HTMLElement>(html: string): T {
|
|
318
|
-
return
|
|
318
|
+
return popsDOMUtils.parseTextToDOM(html);
|
|
319
319
|
},
|
|
320
320
|
};
|
|
@@ -7,7 +7,8 @@ import type { PopsLoadingDetails } from "../components/loading/indexType";
|
|
|
7
7
|
import type { PopsPanelDetails } from "../components/panel/indexType";
|
|
8
8
|
import type { PopsPromptDetails } from "../components/prompt/indexType";
|
|
9
9
|
import { PopsCore } from "../Core";
|
|
10
|
-
import {
|
|
10
|
+
import { PopsAnimation } from "../PopsAnimation";
|
|
11
|
+
import { PopsLayer } from "../PopsLayer";
|
|
11
12
|
import type { PopsCommonConfig } from "../types/components";
|
|
12
13
|
import { PopsEventDetails, PopsHandlerEventDetails } from "../types/event";
|
|
13
14
|
import { PopsLayerCommonConfig } from "../types/layer";
|
|
@@ -50,7 +51,7 @@ export const PopsHandler = {
|
|
|
50
51
|
$shadowRoot?: ShadowRoot | HTMLElement,
|
|
51
52
|
cssText?: string | string[]
|
|
52
53
|
) {
|
|
53
|
-
|
|
54
|
+
PopsAnimation.init();
|
|
54
55
|
if (!arguments.length) {
|
|
55
56
|
return;
|
|
56
57
|
}
|
|
@@ -101,7 +102,9 @@ export const PopsHandler = {
|
|
|
101
102
|
}
|
|
102
103
|
) {
|
|
103
104
|
let result = {
|
|
104
|
-
maskElement:
|
|
105
|
+
maskElement: popsDOMUtils.parseTextToDOM<HTMLDivElement>(
|
|
106
|
+
details.maskHTML
|
|
107
|
+
),
|
|
105
108
|
};
|
|
106
109
|
let isMaskClick = false;
|
|
107
110
|
/**
|
|
@@ -111,7 +114,7 @@ export const PopsHandler = {
|
|
|
111
114
|
function clickEvent(event: MouseEvent | PointerEvent) {
|
|
112
115
|
popsDOMUtils.preventEvent(event);
|
|
113
116
|
// 获取该类型实例存储列表
|
|
114
|
-
let targetLayer =
|
|
117
|
+
let targetLayer = PopsLayer[details.type];
|
|
115
118
|
function originalRun() {
|
|
116
119
|
if (details.config.mask!.clickEvent!.toClose) {
|
|
117
120
|
/* 关闭 */
|
|
@@ -400,7 +403,7 @@ export const PopsHandler = {
|
|
|
400
403
|
close() {
|
|
401
404
|
return PopsInstanceUtils.close(
|
|
402
405
|
mode,
|
|
403
|
-
|
|
406
|
+
PopsLayer[mode],
|
|
404
407
|
guid,
|
|
405
408
|
config,
|
|
406
409
|
animElement
|
|
@@ -409,7 +412,7 @@ export const PopsHandler = {
|
|
|
409
412
|
hide() {
|
|
410
413
|
return PopsInstanceUtils.hide(
|
|
411
414
|
mode,
|
|
412
|
-
|
|
415
|
+
PopsLayer[mode],
|
|
413
416
|
guid,
|
|
414
417
|
config,
|
|
415
418
|
animElement,
|
|
@@ -419,7 +422,7 @@ export const PopsHandler = {
|
|
|
419
422
|
show() {
|
|
420
423
|
return PopsInstanceUtils.show(
|
|
421
424
|
mode,
|
|
422
|
-
|
|
425
|
+
PopsLayer[mode],
|
|
423
426
|
guid,
|
|
424
427
|
config,
|
|
425
428
|
animElement,
|
|
@@ -463,7 +466,7 @@ export const PopsHandler = {
|
|
|
463
466
|
close() {
|
|
464
467
|
return PopsInstanceUtils.close(
|
|
465
468
|
mode,
|
|
466
|
-
|
|
469
|
+
PopsLayer[mode],
|
|
467
470
|
guid,
|
|
468
471
|
config,
|
|
469
472
|
animElement
|
|
@@ -472,7 +475,7 @@ export const PopsHandler = {
|
|
|
472
475
|
hide() {
|
|
473
476
|
return PopsInstanceUtils.hide(
|
|
474
477
|
mode,
|
|
475
|
-
|
|
478
|
+
PopsLayer[mode],
|
|
476
479
|
guid,
|
|
477
480
|
config,
|
|
478
481
|
animElement,
|
|
@@ -482,7 +485,7 @@ export const PopsHandler = {
|
|
|
482
485
|
show() {
|
|
483
486
|
return PopsInstanceUtils.show(
|
|
484
487
|
mode,
|
|
485
|
-
|
|
488
|
+
PopsLayer[mode],
|
|
486
489
|
guid,
|
|
487
490
|
config,
|
|
488
491
|
animElement,
|
|
@@ -636,20 +639,20 @@ export const PopsHandler = {
|
|
|
636
639
|
type === "tooltip" ||
|
|
637
640
|
type === "rightClickMenu"
|
|
638
641
|
) {
|
|
639
|
-
let layer =
|
|
642
|
+
let layer = PopsLayer[type as keyof typeof PopsLayer];
|
|
640
643
|
if (layer) {
|
|
641
644
|
PopsInstanceUtils.removeInstance([layer], "", true);
|
|
642
645
|
}
|
|
643
646
|
} else {
|
|
644
647
|
PopsInstanceUtils.removeInstance(
|
|
645
648
|
[
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
649
|
+
PopsLayer.alert,
|
|
650
|
+
PopsLayer.confirm,
|
|
651
|
+
PopsLayer.prompt,
|
|
652
|
+
PopsLayer.iframe,
|
|
653
|
+
PopsLayer.drawer,
|
|
654
|
+
PopsLayer.folder,
|
|
655
|
+
PopsLayer.panel,
|
|
653
656
|
],
|
|
654
657
|
"",
|
|
655
658
|
true
|
|
@@ -674,6 +677,6 @@ export const PopsHandler = {
|
|
|
674
677
|
* @param value
|
|
675
678
|
*/
|
|
676
679
|
handlePush(type: PopsLayerMode, value: PopsLayerCommonConfig) {
|
|
677
|
-
|
|
680
|
+
PopsLayer[type].push(value);
|
|
678
681
|
},
|
|
679
682
|
};
|
package/src/types/button.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PopsEventDetails, PopsHandlerEventDetails } from "./event";
|
|
2
|
-
import type {
|
|
2
|
+
import type { PopsIconType } from "./icon";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* 按钮类型
|
|
@@ -79,7 +79,7 @@ export interface PopsButtonDetails<T = {}> {
|
|
|
79
79
|
/**
|
|
80
80
|
* 图标按钮,如果名字为内置的,则使用内置的,否则为自定义的svg
|
|
81
81
|
*/
|
|
82
|
-
icon:
|
|
82
|
+
icon: PopsIconType;
|
|
83
83
|
/**
|
|
84
84
|
* 图标按钮是否放在右边
|
|
85
85
|
*/
|
|
@@ -125,7 +125,7 @@ export interface PopsButtonDetailsAnyType<T = {}> {
|
|
|
125
125
|
/**
|
|
126
126
|
* 图标按钮,如果名字为内置的,则使用内置的,否则为自定义的svg
|
|
127
127
|
*/
|
|
128
|
-
icon:
|
|
128
|
+
icon: PopsIconType;
|
|
129
129
|
/**
|
|
130
130
|
* 图标按钮是否放在右边
|
|
131
131
|
*/
|
package/src/types/icon.d.ts
CHANGED
|
@@ -1670,7 +1670,21 @@ class PopsDOMUtils extends PopsDOMUtilsEvent {
|
|
|
1670
1670
|
});
|
|
1671
1671
|
return tempElement;
|
|
1672
1672
|
}
|
|
1673
|
-
|
|
1673
|
+
/**
|
|
1674
|
+
* 字符串转HTMLElement
|
|
1675
|
+
* @param elementString
|
|
1676
|
+
* @returns
|
|
1677
|
+
*/
|
|
1678
|
+
parseTextToDOM<R extends HTMLElement>(elementString: string): R {
|
|
1679
|
+
/* 去除前后的换行和空格 */
|
|
1680
|
+
elementString = elementString
|
|
1681
|
+
.replace(/^[\n|\s]*/g, "")
|
|
1682
|
+
.replace(/[\n|\s]*$/g, "");
|
|
1683
|
+
let targetElement = this.createElement("div", {
|
|
1684
|
+
innerHTML: elementString,
|
|
1685
|
+
});
|
|
1686
|
+
return targetElement.firstChild as any as R;
|
|
1687
|
+
}
|
|
1674
1688
|
/**
|
|
1675
1689
|
* 获取文字的位置信息
|
|
1676
1690
|
* @param input 输入框
|
|
@@ -2119,6 +2133,25 @@ class PopsDOMUtils extends PopsDOMUtilsEvent {
|
|
|
2119
2133
|
element!.parentElement!.insertBefore(content, element.nextSibling);
|
|
2120
2134
|
}
|
|
2121
2135
|
}
|
|
2136
|
+
/**
|
|
2137
|
+
* 获取CSS Rule
|
|
2138
|
+
* @param sheet
|
|
2139
|
+
* @returns
|
|
2140
|
+
*/
|
|
2141
|
+
getKeyFrames(sheet: CSSStyleSheet) {
|
|
2142
|
+
let result = {};
|
|
2143
|
+
Object.keys(sheet.cssRules).forEach((key) => {
|
|
2144
|
+
if (
|
|
2145
|
+
(sheet.cssRules as any)[key].type === 7 &&
|
|
2146
|
+
(sheet.cssRules as any)[key].name.startsWith("pops-anim-")
|
|
2147
|
+
) {
|
|
2148
|
+
(result as any)[(sheet.cssRules as any)[key].name] = (
|
|
2149
|
+
sheet.cssRules as any
|
|
2150
|
+
)[key];
|
|
2151
|
+
}
|
|
2152
|
+
});
|
|
2153
|
+
return result;
|
|
2154
|
+
}
|
|
2122
2155
|
}
|
|
2123
2156
|
|
|
2124
2157
|
const popsDOMUtils = new PopsDOMUtils();
|
|
@@ -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
|
) {
|