@whitesev/pops 1.4.0 → 1.5.0
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.map +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +50 -48
- package/src/Config.ts +3 -0
- package/src/Core.ts +45 -0
- package/src/Pops.ts +340 -0
- package/src/components/alert/index.css +45 -0
- package/src/components/alert/index.ts +216 -0
- package/src/components/alert/indexType.ts +30 -0
- package/src/components/confirm/index.css +45 -0
- package/src/components/confirm/index.ts +264 -0
- package/src/components/confirm/indexType.ts +17 -0
- package/src/components/drawer/index.css +47 -0
- package/src/components/drawer/index.ts +338 -0
- package/src/components/drawer/indexType.ts +53 -0
- package/src/components/folder/folderIcon.ts +28 -0
- package/src/components/folder/index.css +291 -0
- package/src/components/folder/index.ts +1111 -0
- package/src/components/folder/indexType.ts +87 -0
- package/src/components/iframe/index.css +90 -0
- package/src/components/iframe/index.ts +415 -0
- package/src/components/iframe/indexType.ts +144 -0
- package/src/components/loading/index.css +60 -0
- package/src/components/loading/index.ts +123 -0
- package/src/components/loading/indexType.ts +31 -0
- package/src/components/panel/buttonType.ts +60 -0
- package/src/components/panel/commonType.ts +50 -0
- package/src/components/panel/deepMenuType.ts +59 -0
- package/src/components/panel/formsType.ts +32 -0
- package/src/components/panel/index.css +754 -0
- package/src/components/panel/index.ts +2435 -0
- package/src/components/panel/indexType.ts +107 -0
- package/src/components/panel/inputType.ts +65 -0
- package/src/components/panel/ownType.ts +28 -0
- package/src/components/panel/selectType.ts +80 -0
- package/src/components/panel/sliderType.ts +59 -0
- package/src/components/panel/switchType.ts +43 -0
- package/src/components/panel/textareaType.ts +54 -0
- package/src/components/prompt/index.css +60 -0
- package/src/components/prompt/index.ts +293 -0
- package/src/components/prompt/indexType.ts +47 -0
- package/src/components/rightClickMenu/index.ts +729 -0
- package/src/components/rightClickMenu/indexType.ts +89 -0
- package/src/components/searchSuggestion/index.css +0 -0
- package/src/components/searchSuggestion/index.ts +656 -0
- package/src/components/searchSuggestion/indexType.ts +238 -0
- package/src/components/tooltip/index.css +171 -0
- package/src/components/tooltip/index.ts +358 -0
- package/src/components/tooltip/indexType.ts +95 -0
- package/src/css/animation.css +2240 -0
- package/src/css/button.css +290 -0
- package/src/css/common.css +24 -0
- package/src/css/index.css +135 -0
- package/src/css/ninePalaceGridPosition.css +50 -0
- package/src/css/scrollbar.css +18 -0
- package/src/handler/PopsElementHandler.ts +353 -0
- package/src/handler/PopsHandler.ts +659 -0
- package/src/svg/arrowLeft.svg +4 -0
- package/src/svg/arrowRight.svg +4 -0
- package/src/svg/chromeFilled.svg +14 -0
- package/src/svg/circleClose.svg +8 -0
- package/src/svg/close.svg +5 -0
- package/src/svg/cpu.svg +8 -0
- package/src/svg/delete.svg +5 -0
- package/src/svg/documentCopy.svg +5 -0
- package/src/svg/edit.svg +8 -0
- package/src/svg/eleme.svg +5 -0
- package/src/svg/elemePlus.svg +5 -0
- package/src/svg/headset.svg +5 -0
- package/src/svg/hide.svg +8 -0
- package/src/svg/keyboard.svg +8 -0
- package/src/svg/loading.svg +5 -0
- package/src/svg/max.svg +5 -0
- package/src/svg/min.svg +5 -0
- package/src/svg/mise.svg +5 -0
- package/src/svg/monitor.svg +5 -0
- package/src/svg/next.svg +5 -0
- package/src/svg/picture.svg +8 -0
- package/src/svg/prev.svg +5 -0
- package/src/svg/search.svg +5 -0
- package/src/svg/share.svg +5 -0
- package/src/svg/upload.svg +5 -0
- package/src/svg/videoPause.svg +5 -0
- package/src/svg/videoPlay.svg +5 -0
- package/src/svg/view.svg +5 -0
- package/src/types/PopsDOMUtilsEventType.d.ts +246 -0
- package/src/types/animation.d.ts +19 -0
- package/src/types/button.d.ts +226 -0
- package/src/types/components.d.ts +197 -0
- package/src/types/event.d.ts +62 -0
- package/src/types/global.d.ts +11 -0
- package/src/types/icon.d.ts +32 -0
- package/src/types/layer.d.ts +20 -0
- package/src/types/main.d.ts +136 -0
- package/src/types/mask.d.ts +35 -0
- package/src/types/position.d.ts +60 -0
- package/src/utils/AnyTouch.js +1394 -0
- package/src/utils/PopsDOMUtils.ts +2013 -0
- package/src/utils/PopsInstanceUtils.ts +685 -0
- package/src/utils/PopsMathUtils.ts +77 -0
- package/src/utils/PopsUtils.ts +380 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
PopsTitleConfig,
|
|
3
|
+
PopsDragConfig,
|
|
4
|
+
PopsCommonConfig,
|
|
5
|
+
PopsMoreButtonConfig,
|
|
6
|
+
} from "../../types/components";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* pops.folder的folder配置信息
|
|
10
|
+
*/
|
|
11
|
+
export interface PopsFolderDataConfig {
|
|
12
|
+
/**
|
|
13
|
+
* 文件/文件夹名
|
|
14
|
+
*/
|
|
15
|
+
fileName: string;
|
|
16
|
+
/**
|
|
17
|
+
* 文件大小,如果是文件夹的话,为0
|
|
18
|
+
*/
|
|
19
|
+
fileSize: number;
|
|
20
|
+
/**
|
|
21
|
+
* 文件类型,如果是文件夹,为空
|
|
22
|
+
*/
|
|
23
|
+
fileType: string;
|
|
24
|
+
/**
|
|
25
|
+
* 创建时间
|
|
26
|
+
*/
|
|
27
|
+
createTime: number;
|
|
28
|
+
/**
|
|
29
|
+
* 修改时间(最新时间)
|
|
30
|
+
*/
|
|
31
|
+
latestTime: number;
|
|
32
|
+
/**
|
|
33
|
+
* 是否是文件夹
|
|
34
|
+
*/
|
|
35
|
+
isFolder: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* 层级
|
|
38
|
+
*/
|
|
39
|
+
index: number;
|
|
40
|
+
/**
|
|
41
|
+
* 点击事件
|
|
42
|
+
*/
|
|
43
|
+
clickEvent: (
|
|
44
|
+
event: MouseEvent | PointerEvent,
|
|
45
|
+
config: PopsFolderDataConfig
|
|
46
|
+
) => Promise<{
|
|
47
|
+
autoDownload: boolean;
|
|
48
|
+
url: string;
|
|
49
|
+
mode: "a" | "aBlank" | "iframe" | "open" | "openBlank";
|
|
50
|
+
}> | null;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* pops.folder
|
|
55
|
+
*/
|
|
56
|
+
export interface PopsFolderDetails
|
|
57
|
+
extends PopsTitleConfig,
|
|
58
|
+
PopsDragConfig,
|
|
59
|
+
PopsMoreButtonConfig,
|
|
60
|
+
PopsCommonConfig {
|
|
61
|
+
/**
|
|
62
|
+
* 排序
|
|
63
|
+
*/
|
|
64
|
+
sort: {
|
|
65
|
+
/**
|
|
66
|
+
* 比较的名字,默认为fileName
|
|
67
|
+
*/
|
|
68
|
+
name: "fileName" | "fileSize" | "latestTime";
|
|
69
|
+
/**
|
|
70
|
+
* 是否降序,默认false(升序)
|
|
71
|
+
*/
|
|
72
|
+
isDesc: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* 触发排序的回调,如果返回true,则中止内部的排序
|
|
75
|
+
*/
|
|
76
|
+
callback: (
|
|
77
|
+
targert: HTMLElement,
|
|
78
|
+
event: PointerEvent | MouseEvent,
|
|
79
|
+
sortName: "fileName" | "fileSize" | "latestTime",
|
|
80
|
+
sortDesc: boolean
|
|
81
|
+
) => boolean;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* 文件夹信息
|
|
85
|
+
*/
|
|
86
|
+
folder: PopsFolderDataConfig[];
|
|
87
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
.pops[type-value="iframe"] {
|
|
2
|
+
--container-title-height: 55px;
|
|
3
|
+
}
|
|
4
|
+
.pops[type-value] .pops-iframe-title {
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
justify-content: space-between;
|
|
8
|
+
}
|
|
9
|
+
.pops[type-value="iframe"] .pops-iframe-title {
|
|
10
|
+
width: calc(100% - 0px);
|
|
11
|
+
height: var(--container-title-height);
|
|
12
|
+
border-bottom: 1px solid rgb(229, 229, 229, var(--pops-bd-opacity));
|
|
13
|
+
}
|
|
14
|
+
.pops[type-value="iframe"] .pops-iframe-title p[pops] {
|
|
15
|
+
width: 100%;
|
|
16
|
+
overflow: hidden;
|
|
17
|
+
color: rgb(51, 51, 51);
|
|
18
|
+
text-indent: 15px;
|
|
19
|
+
text-overflow: ellipsis;
|
|
20
|
+
white-space: nowrap;
|
|
21
|
+
font-weight: 500;
|
|
22
|
+
line-height: var(--container-title-height);
|
|
23
|
+
}
|
|
24
|
+
.pops[type-value="iframe"] .pops-iframe-content p[pops] {
|
|
25
|
+
padding: 5px 10px;
|
|
26
|
+
color: #333;
|
|
27
|
+
text-indent: 15px;
|
|
28
|
+
}
|
|
29
|
+
.pops[type-value="iframe"] .pops-iframe-content {
|
|
30
|
+
width: 100%;
|
|
31
|
+
height: calc(100% - var(--container-title-height));
|
|
32
|
+
overflow: hidden;
|
|
33
|
+
word-break: break-word;
|
|
34
|
+
}
|
|
35
|
+
.pops-loading {
|
|
36
|
+
position: absolute;
|
|
37
|
+
top: 40px;
|
|
38
|
+
right: 0;
|
|
39
|
+
bottom: 0;
|
|
40
|
+
left: 0;
|
|
41
|
+
z-index: 5;
|
|
42
|
+
background-color: rgb(255, 255, 255, var(--pops-bg-opacity));
|
|
43
|
+
}
|
|
44
|
+
.pops-loading:before {
|
|
45
|
+
position: absolute;
|
|
46
|
+
top: 50%;
|
|
47
|
+
left: 50%;
|
|
48
|
+
z-index: 3;
|
|
49
|
+
display: block;
|
|
50
|
+
margin: -20px 0 0 -20px;
|
|
51
|
+
padding: 20px;
|
|
52
|
+
border: 4px solid rgb(221, 221, 221, var(--pops-bd-opacity));
|
|
53
|
+
border-radius: 50%;
|
|
54
|
+
content: "";
|
|
55
|
+
border-top-color: transparent;
|
|
56
|
+
animation: pops-anim-wait-rotate 1.2s linear infinite;
|
|
57
|
+
}
|
|
58
|
+
.pops[type-value="iframe"].pops[type-module="min"] {
|
|
59
|
+
top: unset !important;
|
|
60
|
+
bottom: 0;
|
|
61
|
+
max-width: 200px;
|
|
62
|
+
max-height: 53px;
|
|
63
|
+
transform: none;
|
|
64
|
+
}
|
|
65
|
+
.pops[type-value="iframe"].pops[type-module="min"]
|
|
66
|
+
.pops-header-control[type="min"] {
|
|
67
|
+
display: none;
|
|
68
|
+
}
|
|
69
|
+
.pops[type-value="iframe"].pops[type-module="max"] {
|
|
70
|
+
top: unset !important;
|
|
71
|
+
left: unset !important;
|
|
72
|
+
width: 100% !important;
|
|
73
|
+
height: 100% !important;
|
|
74
|
+
transform: none;
|
|
75
|
+
}
|
|
76
|
+
.pops[type-value="iframe"] iframe[pops] {
|
|
77
|
+
width: calc(100% - 4px);
|
|
78
|
+
height: calc(100% - 4px);
|
|
79
|
+
border: 0;
|
|
80
|
+
}
|
|
81
|
+
.pops-iframe-content-global-loading {
|
|
82
|
+
position: absolute;
|
|
83
|
+
top: 0;
|
|
84
|
+
left: 0;
|
|
85
|
+
z-index: 999999;
|
|
86
|
+
width: 0;
|
|
87
|
+
height: 4px;
|
|
88
|
+
background: linear-gradient(to right, #4995dd, #fff, rgb(202 224 246));
|
|
89
|
+
animation: iframeLoadingChange 2s forwards;
|
|
90
|
+
}
|
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
import { PopsElementHandler } from "../../handler/PopsElementHandler";
|
|
2
|
+
import { PopsHandler } from "../../handler/PopsHandler";
|
|
3
|
+
import { pops } from "../../Pops";
|
|
4
|
+
import type { PopsEventDetails } from "../../types/event";
|
|
5
|
+
import { popsDOMUtils } from "../../utils/PopsDOMUtils";
|
|
6
|
+
import { PopsInstanceUtils } from "../../utils/PopsInstanceUtils";
|
|
7
|
+
import { popsUtils } from "../../utils/PopsUtils";
|
|
8
|
+
import type { PopsIframeDetails } from "./indexType";
|
|
9
|
+
|
|
10
|
+
export class PopsIframe {
|
|
11
|
+
constructor(details: PopsIframeDetails) {
|
|
12
|
+
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow();
|
|
13
|
+
PopsHandler.handleInit($shadowRoot, [
|
|
14
|
+
pops.config.cssText.index,
|
|
15
|
+
pops.config.cssText.ninePalaceGridPosition,
|
|
16
|
+
pops.config.cssText.scrollbar,
|
|
17
|
+
pops.config.cssText.anim,
|
|
18
|
+
pops.config.cssText.common,
|
|
19
|
+
pops.config.cssText.iframeCSS,
|
|
20
|
+
]);
|
|
21
|
+
|
|
22
|
+
let config: Required<PopsIframeDetails> = {
|
|
23
|
+
title: {
|
|
24
|
+
position: "center",
|
|
25
|
+
text: "",
|
|
26
|
+
html: false,
|
|
27
|
+
style: "",
|
|
28
|
+
},
|
|
29
|
+
loading: {
|
|
30
|
+
enable: true,
|
|
31
|
+
icon: true,
|
|
32
|
+
text: "",
|
|
33
|
+
},
|
|
34
|
+
class: "",
|
|
35
|
+
url: window.location.href,
|
|
36
|
+
only: false,
|
|
37
|
+
zIndex: 10000,
|
|
38
|
+
mask: {
|
|
39
|
+
enable: false,
|
|
40
|
+
clickEvent: {
|
|
41
|
+
toClose: false,
|
|
42
|
+
toHide: false,
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
clickCallBack: void 0,
|
|
46
|
+
},
|
|
47
|
+
animation: "pops-anim-fadein-zoom",
|
|
48
|
+
position: "center",
|
|
49
|
+
drag: false,
|
|
50
|
+
dragLimit: true,
|
|
51
|
+
dragExtraDistance: 3,
|
|
52
|
+
dragMoveCallBack() {},
|
|
53
|
+
dragEndCallBack() {},
|
|
54
|
+
width: "300px",
|
|
55
|
+
height: "250px",
|
|
56
|
+
topRightButton: "min|max|mise|close",
|
|
57
|
+
sandbox: false,
|
|
58
|
+
forbiddenScroll: false,
|
|
59
|
+
loadEndCallBack() {},
|
|
60
|
+
btn: {
|
|
61
|
+
min: {
|
|
62
|
+
callback() {},
|
|
63
|
+
},
|
|
64
|
+
max: {
|
|
65
|
+
callback() {},
|
|
66
|
+
},
|
|
67
|
+
mise: {
|
|
68
|
+
callback() {},
|
|
69
|
+
},
|
|
70
|
+
close: {
|
|
71
|
+
callback() {},
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
style: null,
|
|
76
|
+
beforeAppendToPageCallBack() {},
|
|
77
|
+
};
|
|
78
|
+
config = popsUtils.assign(config, details);
|
|
79
|
+
if (config.url == null) {
|
|
80
|
+
throw "config.url不能为空";
|
|
81
|
+
}
|
|
82
|
+
let guid = popsUtils.getRandomGUID();
|
|
83
|
+
const PopsType = "iframe";
|
|
84
|
+
|
|
85
|
+
config = PopsHandler.handleOnly(PopsType, config);
|
|
86
|
+
let maskExtraStyle =
|
|
87
|
+
config.animation != null && (config as any).animation != ""
|
|
88
|
+
? "position:absolute;"
|
|
89
|
+
: "";
|
|
90
|
+
let maskHTML = PopsElementHandler.getMaskHTML(
|
|
91
|
+
guid,
|
|
92
|
+
|
|
93
|
+
config.zIndex,
|
|
94
|
+
maskExtraStyle
|
|
95
|
+
);
|
|
96
|
+
let headerBtnHTML = PopsElementHandler.getHeaderBtnHTML(PopsType, config);
|
|
97
|
+
let iframeLoadingHTML = '<div class="pops-loading"></div>';
|
|
98
|
+
let titleText =
|
|
99
|
+
config.title!.text!.trim() !== "" ? config.title.text : config.url;
|
|
100
|
+
let { headerStyle, headerPStyle } = PopsElementHandler.getHeaderStyle(
|
|
101
|
+
PopsType,
|
|
102
|
+
config
|
|
103
|
+
);
|
|
104
|
+
let animHTML = PopsElementHandler.getAnimHTML(
|
|
105
|
+
guid,
|
|
106
|
+
PopsType,
|
|
107
|
+
config,
|
|
108
|
+
`
|
|
109
|
+
<div
|
|
110
|
+
class="pops-iframe-title"
|
|
111
|
+
style="text-align: ${config.title.position};${headerStyle}"
|
|
112
|
+
>
|
|
113
|
+
${
|
|
114
|
+
config.title.html
|
|
115
|
+
? titleText
|
|
116
|
+
: `<p pops style="${headerPStyle}">${titleText}</p>`
|
|
117
|
+
}
|
|
118
|
+
${headerBtnHTML}
|
|
119
|
+
</div>
|
|
120
|
+
<div class="pops-iframe-content">
|
|
121
|
+
<div class="pops-iframe-content-global-loading"></div>
|
|
122
|
+
<iframe
|
|
123
|
+
src="${config.url}"
|
|
124
|
+
pops
|
|
125
|
+
${
|
|
126
|
+
config.sandbox
|
|
127
|
+
? "sandbox='allow-forms allow-same-origin allow-scripts'"
|
|
128
|
+
: ""
|
|
129
|
+
}>
|
|
130
|
+
</iframe>
|
|
131
|
+
</div>
|
|
132
|
+
${config.loading.enable ? iframeLoadingHTML : ""}
|
|
133
|
+
`,
|
|
134
|
+
""
|
|
135
|
+
);
|
|
136
|
+
/**
|
|
137
|
+
* 弹窗的主元素,包括动画层
|
|
138
|
+
*/
|
|
139
|
+
|
|
140
|
+
let $anim = PopsElementHandler.parseElement<HTMLDivElement>(animHTML);
|
|
141
|
+
let {
|
|
142
|
+
popsElement: $pops,
|
|
143
|
+
headerCloseBtnElement,
|
|
144
|
+
headerControlsElement,
|
|
145
|
+
titleElement: $title,
|
|
146
|
+
iframeElement: $iframe,
|
|
147
|
+
loadingElement,
|
|
148
|
+
contentLoadingElement: $contentLoading,
|
|
149
|
+
headerMinBtnElement,
|
|
150
|
+
headerMaxBtnElement,
|
|
151
|
+
headerMiseBtnElement,
|
|
152
|
+
} = PopsHandler.handleQueryElement($anim, PopsType);
|
|
153
|
+
/**
|
|
154
|
+
* 遮罩层元素
|
|
155
|
+
*/
|
|
156
|
+
let $mask: HTMLDivElement | null = null;
|
|
157
|
+
/**
|
|
158
|
+
* 已创建的元素列表
|
|
159
|
+
*/
|
|
160
|
+
let elementList: HTMLElement[] = [$anim];
|
|
161
|
+
|
|
162
|
+
if (config.mask.enable) {
|
|
163
|
+
let _handleMask_ = PopsHandler.handleMask({
|
|
164
|
+
type: PopsType,
|
|
165
|
+
guid: guid,
|
|
166
|
+
|
|
167
|
+
config: config,
|
|
168
|
+
animElement: $anim,
|
|
169
|
+
maskHTML: maskHTML,
|
|
170
|
+
});
|
|
171
|
+
$mask = _handleMask_.maskElement;
|
|
172
|
+
elementList.push($mask);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
let eventDetails = PopsHandler.handleEventDetails(
|
|
176
|
+
guid,
|
|
177
|
+
$shadowContainer,
|
|
178
|
+
$shadowRoot,
|
|
179
|
+
PopsType,
|
|
180
|
+
$anim,
|
|
181
|
+
|
|
182
|
+
$pops!,
|
|
183
|
+
$mask!,
|
|
184
|
+
config
|
|
185
|
+
) as any as PopsEventDetails & {
|
|
186
|
+
iframeElement: HTMLIFrameElement;
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
eventDetails["iframeElement"] = $iframe!;
|
|
190
|
+
|
|
191
|
+
popsDOMUtils.on($anim, popsDOMUtils.getAnimationEndNameList(), function () {
|
|
192
|
+
/* 动画加载完毕 */
|
|
193
|
+
$anim.style.width = "0%";
|
|
194
|
+
$anim.style.height = "0%";
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
popsDOMUtils.on($iframe, "load", () => {
|
|
198
|
+
/* iframe加载中... */
|
|
199
|
+
loadingElement?.remove();
|
|
200
|
+
|
|
201
|
+
$contentLoading!.style.animation = "iframeLoadingChange_85 0.3s forwards";
|
|
202
|
+
|
|
203
|
+
popsDOMUtils.on(
|
|
204
|
+
$contentLoading,
|
|
205
|
+
popsDOMUtils.getAnimationEndNameList(),
|
|
206
|
+
() => {
|
|
207
|
+
/* 动画加载完毕就移除 */
|
|
208
|
+
$contentLoading!.remove();
|
|
209
|
+
}
|
|
210
|
+
);
|
|
211
|
+
|
|
212
|
+
if (config.title!.text!.trim() === "" && $iframe!.contentDocument) {
|
|
213
|
+
/* 同域名下的才可以获取网页标题 */
|
|
214
|
+
|
|
215
|
+
$title!.querySelector<HTMLElement>("p")!.innerText =
|
|
216
|
+
$iframe!.contentDocument.title;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
config.loadEndCallBack(eventDetails as any);
|
|
220
|
+
});
|
|
221
|
+
/* 创建到页面中 */
|
|
222
|
+
|
|
223
|
+
popsDOMUtils.append($shadowRoot, elementList);
|
|
224
|
+
if (typeof config.beforeAppendToPageCallBack === "function") {
|
|
225
|
+
config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
popsDOMUtils.appendBody($shadowContainer);
|
|
229
|
+
if ($mask != null) {
|
|
230
|
+
$anim.after($mask);
|
|
231
|
+
}
|
|
232
|
+
/* 拖拽 */
|
|
233
|
+
if (config.drag) {
|
|
234
|
+
PopsInstanceUtils.drag($pops!, {
|
|
235
|
+
dragElement: $title!,
|
|
236
|
+
limit: config.dragLimit,
|
|
237
|
+
extraDistance: config.dragExtraDistance,
|
|
238
|
+
moveCallBack: config.dragMoveCallBack,
|
|
239
|
+
endCallBack: config.dragEndCallBack,
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
let normalLeft = "";
|
|
243
|
+
/* 最小化按钮点击事件 */
|
|
244
|
+
|
|
245
|
+
popsDOMUtils.on<PointerEvent | MouseEvent>(
|
|
246
|
+
headerMinBtnElement,
|
|
247
|
+
"click",
|
|
248
|
+
(event) => {
|
|
249
|
+
/**
|
|
250
|
+
* 所有最小化的iframe数组
|
|
251
|
+
*/
|
|
252
|
+
let allMinElementList: HTMLElement[] = [];
|
|
253
|
+
|
|
254
|
+
pops.config.layer.iframe.forEach((item) => {
|
|
255
|
+
if (
|
|
256
|
+
item.animElement != $anim &&
|
|
257
|
+
item.popsElement.getAttribute("type-module") === "min"
|
|
258
|
+
) {
|
|
259
|
+
allMinElementList.push(item.popsElement);
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
let maxLeftValue = allMinElementList.length
|
|
263
|
+
? allMinElementList.length * 205
|
|
264
|
+
: 0;
|
|
265
|
+
|
|
266
|
+
$pops!.style.transitionDuration = "";
|
|
267
|
+
|
|
268
|
+
normalLeft = $pops!.style.left;
|
|
269
|
+
|
|
270
|
+
$pops!.style.left = maxLeftValue + "px";
|
|
271
|
+
|
|
272
|
+
$pops!.setAttribute("type-module", "min");
|
|
273
|
+
|
|
274
|
+
$anim!
|
|
275
|
+
.querySelector<HTMLDivElement>(".pops-header-controls")
|
|
276
|
+
?.setAttribute("type", "max");
|
|
277
|
+
|
|
278
|
+
config.btn.min.callback(eventDetails, event);
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
capture: true,
|
|
282
|
+
}
|
|
283
|
+
);
|
|
284
|
+
/* 最大化按钮点击事件 */
|
|
285
|
+
popsDOMUtils.on<MouseEvent | PointerEvent>(
|
|
286
|
+
headerMaxBtnElement,
|
|
287
|
+
"click",
|
|
288
|
+
(event) => {
|
|
289
|
+
$pops!.style.transitionDuration = "";
|
|
290
|
+
|
|
291
|
+
normalLeft = $pops!.style.left;
|
|
292
|
+
|
|
293
|
+
$pops!.removeAttribute("type-module");
|
|
294
|
+
|
|
295
|
+
$pops!.setAttribute("type-module", "max");
|
|
296
|
+
|
|
297
|
+
headerControlsElement!.setAttribute("type", "max");
|
|
298
|
+
|
|
299
|
+
headerMaxBtnElement!.style.setProperty("display", "none");
|
|
300
|
+
|
|
301
|
+
headerMiseBtnElement!.style.setProperty("display", "");
|
|
302
|
+
|
|
303
|
+
config.btn.max.callback(eventDetails, event);
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
capture: true,
|
|
307
|
+
}
|
|
308
|
+
);
|
|
309
|
+
/* 先隐藏窗口化按钮 */
|
|
310
|
+
headerMiseBtnElement?.style?.setProperty("display", "none");
|
|
311
|
+
/* 窗口化按钮点击事件 */
|
|
312
|
+
popsDOMUtils.on<MouseEvent | PointerEvent>(
|
|
313
|
+
headerMiseBtnElement,
|
|
314
|
+
"click",
|
|
315
|
+
(event) => {
|
|
316
|
+
$pops!.style.transitionDuration = "";
|
|
317
|
+
|
|
318
|
+
$pops!.style.left = normalLeft;
|
|
319
|
+
|
|
320
|
+
headerControlsElement!.removeAttribute("type");
|
|
321
|
+
|
|
322
|
+
$pops!.removeAttribute("type-module");
|
|
323
|
+
/**
|
|
324
|
+
* 所有最小化的iframe数组
|
|
325
|
+
*/
|
|
326
|
+
let allMinElementList: HTMLElement[] = [];
|
|
327
|
+
pops.config.layer.iframe.forEach((item) => {
|
|
328
|
+
if (
|
|
329
|
+
item.animElement != $anim &&
|
|
330
|
+
$pops!.getAttribute("type-module") === "min"
|
|
331
|
+
) {
|
|
332
|
+
allMinElementList.push(item.popsElement);
|
|
333
|
+
}
|
|
334
|
+
});
|
|
335
|
+
allMinElementList.sort(
|
|
336
|
+
PopsInstanceUtils.sortElementListByProperty<HTMLElement, number>(
|
|
337
|
+
(obj) => {
|
|
338
|
+
return parseInt(getComputedStyle(obj).left);
|
|
339
|
+
},
|
|
340
|
+
(obj) => {
|
|
341
|
+
return parseInt(getComputedStyle(obj).left);
|
|
342
|
+
},
|
|
343
|
+
false
|
|
344
|
+
)
|
|
345
|
+
);
|
|
346
|
+
allMinElementList.forEach((item, index) => {
|
|
347
|
+
item.style.left = index * 205 + "px";
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
headerMiseBtnElement!.style.setProperty("display", "none");
|
|
351
|
+
|
|
352
|
+
headerMaxBtnElement!.style.setProperty("display", "");
|
|
353
|
+
|
|
354
|
+
config.btn.mise.callback(eventDetails, event);
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
capture: true,
|
|
358
|
+
}
|
|
359
|
+
);
|
|
360
|
+
/* 关闭按钮点击事件 */
|
|
361
|
+
popsDOMUtils.on<MouseEvent | PointerEvent>(
|
|
362
|
+
headerCloseBtnElement,
|
|
363
|
+
"click",
|
|
364
|
+
(event) => {
|
|
365
|
+
PopsInstanceUtils.removeInstance([pops.config.layer.iframe], guid, false);
|
|
366
|
+
setTimeout(() => {
|
|
367
|
+
let allIsMinElementList: HTMLElement[] = [];
|
|
368
|
+
pops.config.layer.iframe.forEach((item) => {
|
|
369
|
+
if (
|
|
370
|
+
item.animElement != $anim &&
|
|
371
|
+
$pops!.getAttribute("type-module") === "min"
|
|
372
|
+
) {
|
|
373
|
+
allIsMinElementList.push(item.popsElement);
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
allIsMinElementList.sort(
|
|
378
|
+
PopsInstanceUtils.sortElementListByProperty(
|
|
379
|
+
(obj) => {
|
|
380
|
+
return parseInt(getComputedStyle(obj).left);
|
|
381
|
+
},
|
|
382
|
+
(obj) => {
|
|
383
|
+
return parseInt(getComputedStyle(obj).left);
|
|
384
|
+
},
|
|
385
|
+
false
|
|
386
|
+
)
|
|
387
|
+
);
|
|
388
|
+
|
|
389
|
+
allIsMinElementList.forEach((item, index) => {
|
|
390
|
+
item.style.left = index * 205 + "px";
|
|
391
|
+
});
|
|
392
|
+
}, 1000 * 0.3);
|
|
393
|
+
|
|
394
|
+
config.btn.close.callback(eventDetails, event);
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
capture: true,
|
|
398
|
+
}
|
|
399
|
+
);
|
|
400
|
+
|
|
401
|
+
PopsHandler.handlePush(PopsType, {
|
|
402
|
+
guid: guid,
|
|
403
|
+
animElement: $anim,
|
|
404
|
+
|
|
405
|
+
popsElement: $pops!,
|
|
406
|
+
|
|
407
|
+
maskElement: $mask!,
|
|
408
|
+
$shadowContainer: $shadowContainer,
|
|
409
|
+
$shadowRoot: $shadowRoot,
|
|
410
|
+
});
|
|
411
|
+
|
|
412
|
+
let result = PopsHandler.handleResultDetails(eventDetails);
|
|
413
|
+
return result;
|
|
414
|
+
}
|
|
415
|
+
}
|