@whitesev/pops 2.2.8 → 2.2.9
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 +2815 -3010
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +2815 -3010
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +2815 -3010
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +2815 -3010
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +2815 -3010
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +2815 -3010
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/Pops.d.ts +11 -11
- package/dist/types/src/PopsIcon.d.ts +2 -2
- package/dist/types/src/components/rightClickMenu/index.d.ts +2 -2
- package/dist/types/src/components/tooltip/index.d.ts +2 -2
- package/dist/types/src/types/PopsDOMUtilsEventType.d.ts +256 -259
- package/dist/types/src/types/animation.d.ts +19 -19
- package/dist/types/src/types/button.d.ts +187 -196
- package/dist/types/src/types/components.d.ts +213 -229
- package/dist/types/src/types/event.d.ts +63 -63
- package/dist/types/src/types/global.d.ts +20 -20
- package/dist/types/src/types/icon.d.ts +32 -32
- package/dist/types/src/types/inst.d.ts +24 -24
- package/dist/types/src/types/main.d.ts +114 -122
- package/dist/types/src/types/mask.d.ts +49 -49
- package/dist/types/src/types/position.d.ts +60 -60
- package/package.json +61 -56
- package/LICENSE +0 -674
- package/src/Pops.ts +0 -209
- package/src/PopsAnimation.ts +0 -32
- package/src/PopsCSS.ts +0 -51
- package/src/PopsCore.ts +0 -44
- package/src/PopsIcon.ts +0 -95
- package/src/PopsInst.ts +0 -21
- package/src/components/alert/config.ts +0 -62
- package/src/components/alert/index.css +0 -0
- package/src/components/alert/index.ts +0 -181
- package/src/components/alert/types/index.ts +0 -30
- package/src/components/confirm/config.ts +0 -90
- package/src/components/confirm/index.css +0 -0
- package/src/components/confirm/index.ts +0 -192
- package/src/components/confirm/types/index.ts +0 -17
- package/src/components/drawer/config.ts +0 -89
- package/src/components/drawer/index.css +0 -35
- package/src/components/drawer/index.ts +0 -260
- package/src/components/drawer/types/index.ts +0 -61
- package/src/components/folder/config.ts +0 -147
- package/src/components/folder/folderIcon.ts +0 -28
- package/src/components/folder/index.css +0 -314
- package/src/components/folder/index.ts +0 -1050
- package/src/components/folder/types/index.ts +0 -101
- package/src/components/iframe/config.ts +0 -60
- package/src/components/iframe/index.css +0 -75
- package/src/components/iframe/index.ts +0 -351
- package/src/components/iframe/types/index.ts +0 -146
- package/src/components/loading/config.ts +0 -29
- package/src/components/loading/index.css +0 -66
- package/src/components/loading/index.ts +0 -114
- package/src/components/loading/types/index.ts +0 -40
- package/src/components/panel/config.ts +0 -550
- package/src/components/panel/handlerComponents.ts +0 -3277
- package/src/components/panel/index.css +0 -1292
- package/src/components/panel/index.ts +0 -213
- package/src/components/panel/types/components-button.ts +0 -69
- package/src/components/panel/types/components-common.ts +0 -55
- package/src/components/panel/types/components-deepMenu.ts +0 -85
- package/src/components/panel/types/components-forms.ts +0 -45
- package/src/components/panel/types/components-input.ts +0 -82
- package/src/components/panel/types/components-own.ts +0 -31
- package/src/components/panel/types/components-select.ts +0 -101
- package/src/components/panel/types/components-selectMultiple.ts +0 -133
- package/src/components/panel/types/components-slider.ts +0 -78
- package/src/components/panel/types/components-switch.ts +0 -57
- package/src/components/panel/types/components-textarea.ts +0 -69
- package/src/components/panel/types/index.ts +0 -177
- package/src/components/prompt/config.ts +0 -94
- package/src/components/prompt/index.css +0 -34
- package/src/components/prompt/index.ts +0 -222
- package/src/components/prompt/types/index.ts +0 -55
- package/src/components/rightClickMenu/config.ts +0 -130
- package/src/components/rightClickMenu/index.css +0 -88
- package/src/components/rightClickMenu/index.ts +0 -689
- package/src/components/rightClickMenu/types/index.ts +0 -91
- package/src/components/searchSuggestion/config.ts +0 -59
- package/src/components/searchSuggestion/index.ts +0 -708
- package/src/components/searchSuggestion/types/index.ts +0 -147
- package/src/components/tooltip/config.ts +0 -34
- package/src/components/tooltip/index.css +0 -196
- package/src/components/tooltip/index.ts +0 -655
- package/src/components/tooltip/types/index.ts +0 -125
- package/src/config/CommonCSSClassName.ts +0 -17
- package/src/config/GlobalConfig.ts +0 -80
- package/src/css/animation.css +0 -2245
- package/src/css/button.css +0 -542
- package/src/css/common.css +0 -52
- package/src/css/index.css +0 -254
- package/src/css/ninePalaceGridPosition.css +0 -50
- package/src/css/scrollbar.css +0 -22
- package/src/handler/PopsElementHandler.ts +0 -325
- package/src/handler/PopsHandler.ts +0 -719
- package/src/svg/arrowLeft.svg +0 -4
- package/src/svg/arrowRight.svg +0 -4
- package/src/svg/chromeFilled.svg +0 -14
- package/src/svg/circleClose.svg +0 -8
- package/src/svg/close.svg +0 -5
- package/src/svg/cpu.svg +0 -8
- package/src/svg/delete.svg +0 -5
- package/src/svg/documentCopy.svg +0 -5
- package/src/svg/edit.svg +0 -8
- package/src/svg/eleme.svg +0 -5
- package/src/svg/elemePlus.svg +0 -5
- package/src/svg/headset.svg +0 -5
- package/src/svg/hide.svg +0 -8
- package/src/svg/keyboard.svg +0 -8
- package/src/svg/loading.svg +0 -5
- package/src/svg/max.svg +0 -5
- package/src/svg/min.svg +0 -5
- package/src/svg/mise.svg +0 -5
- package/src/svg/monitor.svg +0 -5
- package/src/svg/next.svg +0 -5
- package/src/svg/picture.svg +0 -8
- package/src/svg/prev.svg +0 -5
- package/src/svg/search.svg +0 -5
- package/src/svg/share.svg +0 -5
- package/src/svg/upload.svg +0 -5
- package/src/svg/videoPause.svg +0 -5
- package/src/svg/videoPlay.svg +0 -5
- package/src/svg/view.svg +0 -5
- package/src/types/PopsDOMUtilsEventType.d.ts +0 -259
- package/src/types/animation.d.ts +0 -19
- package/src/types/button.d.ts +0 -196
- package/src/types/components.d.ts +0 -229
- package/src/types/event.d.ts +0 -63
- package/src/types/global.d.ts +0 -20
- package/src/types/icon.d.ts +0 -32
- package/src/types/inst.d.ts +0 -24
- package/src/types/main.d.ts +0 -122
- package/src/types/mask.d.ts +0 -49
- package/src/types/position.d.ts +0 -60
- package/src/utils/PopsDOMUtils.ts +0 -2649
- package/src/utils/PopsDOMUtilsEventsConfig.ts +0 -6
- package/src/utils/PopsInstanceUtils.ts +0 -801
- package/src/utils/PopsMathUtils.ts +0 -77
- package/src/utils/PopsSafeUtils.ts +0 -24
- package/src/utils/PopsUtils.ts +0 -430
|
@@ -1,101 +0,0 @@
|
|
|
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 | string;
|
|
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
|
-
) =>
|
|
47
|
-
| Promise<
|
|
48
|
-
| {
|
|
49
|
-
autoDownload: boolean;
|
|
50
|
-
url: string;
|
|
51
|
-
mode: "a" | "aBlank" | "iframe" | "open" | "openBlank";
|
|
52
|
-
}
|
|
53
|
-
| null
|
|
54
|
-
| undefined
|
|
55
|
-
| void
|
|
56
|
-
| PopsFolderDataConfig[]
|
|
57
|
-
>
|
|
58
|
-
| null
|
|
59
|
-
| undefined
|
|
60
|
-
| void
|
|
61
|
-
| PopsFolderDataConfig[];
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* pops.folder
|
|
66
|
-
*/
|
|
67
|
-
export interface PopsFolderDetails
|
|
68
|
-
extends PopsTitleConfig,
|
|
69
|
-
PopsDragConfig,
|
|
70
|
-
PopsMoreButtonConfig,
|
|
71
|
-
PopsCommonConfig {
|
|
72
|
-
/**
|
|
73
|
-
* 排序
|
|
74
|
-
*/
|
|
75
|
-
sort: {
|
|
76
|
-
/**
|
|
77
|
-
* 比较的名字,默认为fileName
|
|
78
|
-
*/
|
|
79
|
-
name: "fileName" | "fileSize" | "latestTime";
|
|
80
|
-
/**
|
|
81
|
-
* 是否降序,默认false(升序)
|
|
82
|
-
* @default false
|
|
83
|
-
*/
|
|
84
|
-
isDesc: boolean;
|
|
85
|
-
/**
|
|
86
|
-
* 触发排序的回调
|
|
87
|
-
* @returns
|
|
88
|
-
* + true 中止内部的排序
|
|
89
|
-
*/
|
|
90
|
-
callback?: (
|
|
91
|
-
targert: HTMLElement,
|
|
92
|
-
event: PointerEvent | MouseEvent,
|
|
93
|
-
sortName: "fileName" | "fileSize" | "latestTime",
|
|
94
|
-
sortDesc: boolean
|
|
95
|
-
) => boolean | undefined | void;
|
|
96
|
-
};
|
|
97
|
-
/**
|
|
98
|
-
* 文件夹信息
|
|
99
|
-
*/
|
|
100
|
-
folder: PopsFolderDataConfig[];
|
|
101
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import type { PopsIframeDetails } from "./types";
|
|
2
|
-
|
|
3
|
-
export const PopsIframeConfig = (): DeepRequired<PopsIframeDetails> => {
|
|
4
|
-
return {
|
|
5
|
-
title: {
|
|
6
|
-
position: "center",
|
|
7
|
-
text: "",
|
|
8
|
-
html: false,
|
|
9
|
-
style: "",
|
|
10
|
-
},
|
|
11
|
-
loading: {
|
|
12
|
-
enable: true,
|
|
13
|
-
icon: true,
|
|
14
|
-
text: "",
|
|
15
|
-
},
|
|
16
|
-
useShadowRoot: true,
|
|
17
|
-
class: "",
|
|
18
|
-
url: window.location.href,
|
|
19
|
-
only: false,
|
|
20
|
-
zIndex: 10000,
|
|
21
|
-
mask: {
|
|
22
|
-
enable: false,
|
|
23
|
-
clickEvent: {
|
|
24
|
-
toClose: false,
|
|
25
|
-
toHide: false,
|
|
26
|
-
},
|
|
27
|
-
clickCallBack: null,
|
|
28
|
-
},
|
|
29
|
-
animation: "pops-anim-fadein-zoom",
|
|
30
|
-
position: "center",
|
|
31
|
-
drag: true,
|
|
32
|
-
dragLimit: true,
|
|
33
|
-
dragExtraDistance: 3,
|
|
34
|
-
dragMoveCallBack() {},
|
|
35
|
-
dragEndCallBack() {},
|
|
36
|
-
width: window.innerWidth < 550 ? "88vw" : "350px",
|
|
37
|
-
height: window.innerHeight < 450 ? "70vh" : "200px",
|
|
38
|
-
topRightButton: "min|max|mise|close",
|
|
39
|
-
sandbox: false,
|
|
40
|
-
forbiddenScroll: false,
|
|
41
|
-
loadEndCallBack() {},
|
|
42
|
-
btn: {
|
|
43
|
-
min: {
|
|
44
|
-
callback() {},
|
|
45
|
-
},
|
|
46
|
-
max: {
|
|
47
|
-
callback() {},
|
|
48
|
-
},
|
|
49
|
-
mise: {
|
|
50
|
-
callback() {},
|
|
51
|
-
},
|
|
52
|
-
close: {
|
|
53
|
-
callback() {},
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
|
|
57
|
-
style: null,
|
|
58
|
-
beforeAppendToPageCallBack() {},
|
|
59
|
-
};
|
|
60
|
-
};
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
.pops[type-value="iframe"] {
|
|
2
|
-
--container-title-height: 55px;
|
|
3
|
-
transition: width 0.35s ease, height 0.35s ease;
|
|
4
|
-
}
|
|
5
|
-
.pops[type-value="iframe"] .pops-content {
|
|
6
|
-
overflow: hidden;
|
|
7
|
-
}
|
|
8
|
-
.pops-loading {
|
|
9
|
-
position: absolute;
|
|
10
|
-
top: 40px;
|
|
11
|
-
right: 0;
|
|
12
|
-
bottom: 0;
|
|
13
|
-
left: 0;
|
|
14
|
-
z-index: 5;
|
|
15
|
-
background-color: rgb(255, 255, 255, var(--pops-bg-opacity));
|
|
16
|
-
}
|
|
17
|
-
.pops-loading:before {
|
|
18
|
-
position: absolute;
|
|
19
|
-
top: 50%;
|
|
20
|
-
left: 50%;
|
|
21
|
-
z-index: 3;
|
|
22
|
-
display: block;
|
|
23
|
-
margin: -20px 0 0 -20px;
|
|
24
|
-
padding: 20px;
|
|
25
|
-
border: 4px solid rgb(221, 221, 221, var(--pops-bd-opacity));
|
|
26
|
-
border-radius: 50%;
|
|
27
|
-
content: "";
|
|
28
|
-
border-top-color: transparent;
|
|
29
|
-
animation: pops-anim-wait-rotate 1.2s linear infinite;
|
|
30
|
-
}
|
|
31
|
-
.pops[type-value="iframe"].pops[type-module="min"] {
|
|
32
|
-
bottom: 0;
|
|
33
|
-
max-width: 200px;
|
|
34
|
-
max-height: 53px;
|
|
35
|
-
position: unset;
|
|
36
|
-
}
|
|
37
|
-
.pops[type-value="iframe"].pops[type-module="min"]
|
|
38
|
-
.pops-header-control[data-type="min"] {
|
|
39
|
-
display: none;
|
|
40
|
-
}
|
|
41
|
-
.pops[type-value="iframe"].pops-iframe-unset-top {
|
|
42
|
-
top: unset !important;
|
|
43
|
-
}
|
|
44
|
-
.pops[type-value="iframe"].pops-iframe-unset-left {
|
|
45
|
-
left: unset !important;
|
|
46
|
-
}
|
|
47
|
-
.pops[type-value="iframe"].pops-iframe-unset-transform {
|
|
48
|
-
transform: none !important;
|
|
49
|
-
}
|
|
50
|
-
.pops[type-value="iframe"].pops-iframe-unset-transition {
|
|
51
|
-
transition: none !important;
|
|
52
|
-
}
|
|
53
|
-
.pops[type-value="iframe"].pops[type-module="max"] {
|
|
54
|
-
width: 100% !important;
|
|
55
|
-
height: 100% !important;
|
|
56
|
-
}
|
|
57
|
-
.pops[type-value="iframe"] iframe[pops] {
|
|
58
|
-
width: 100%;
|
|
59
|
-
height: 100%;
|
|
60
|
-
border: 0;
|
|
61
|
-
}
|
|
62
|
-
.pops-iframe-content-global-loading {
|
|
63
|
-
position: absolute;
|
|
64
|
-
top: 0;
|
|
65
|
-
left: 0;
|
|
66
|
-
z-index: 999999;
|
|
67
|
-
width: 0;
|
|
68
|
-
height: 4px;
|
|
69
|
-
background: linear-gradient(to right, #4995dd, #fff, rgb(202 224 246));
|
|
70
|
-
animation: iframeLoadingChange 2s forwards;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.pops-anim:has(.pops[type-value="iframe"].pops[type-module="min"]) {
|
|
74
|
-
position: unset;
|
|
75
|
-
}
|
|
@@ -1,351 +0,0 @@
|
|
|
1
|
-
import { PopsCore } from "../../PopsCore";
|
|
2
|
-
import { GlobalConfig } from "../../config/GlobalConfig";
|
|
3
|
-
import { PopsElementHandler } from "../../handler/PopsElementHandler";
|
|
4
|
-
import { PopsHandler } from "../../handler/PopsHandler";
|
|
5
|
-
import { PopsCSS } from "../../PopsCSS";
|
|
6
|
-
import { PopsInstData } from "../../PopsInst";
|
|
7
|
-
import type { PopsEventDetails } from "../../types/event";
|
|
8
|
-
import { popsDOMUtils } from "../../utils/PopsDOMUtils";
|
|
9
|
-
import { PopsInstanceUtils } from "../../utils/PopsInstanceUtils";
|
|
10
|
-
import { popsUtils } from "../../utils/PopsUtils";
|
|
11
|
-
import { PopsIframeConfig } from "./config";
|
|
12
|
-
import type { PopsIframeDetails } from "./types";
|
|
13
|
-
import type { PopsType } from "../../types/main";
|
|
14
|
-
|
|
15
|
-
export const PopsIframe = {
|
|
16
|
-
init(details: PopsIframeDetails) {
|
|
17
|
-
const guid = popsUtils.getRandomGUID();
|
|
18
|
-
// 设置当前类型
|
|
19
|
-
const popsType: PopsType = "iframe";
|
|
20
|
-
|
|
21
|
-
let config = PopsIframeConfig();
|
|
22
|
-
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
23
|
-
config = popsUtils.assign(config, details);
|
|
24
|
-
if (config.url == null) {
|
|
25
|
-
throw new Error("config.url不能为空");
|
|
26
|
-
}
|
|
27
|
-
config = PopsHandler.handleOnly(popsType, config);
|
|
28
|
-
|
|
29
|
-
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
|
|
30
|
-
PopsHandler.handleInit($shadowRoot, [
|
|
31
|
-
{
|
|
32
|
-
name: "index",
|
|
33
|
-
css: PopsCSS.index,
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
name: "ninePalaceGridPosition",
|
|
37
|
-
css: PopsCSS.ninePalaceGridPosition,
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
name: "scrollbar",
|
|
41
|
-
css: PopsCSS.scrollbar,
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
name: "anim",
|
|
45
|
-
css: PopsCSS.anim,
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
name: "common",
|
|
49
|
-
css: PopsCSS.common,
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
name: "iframeCSS",
|
|
53
|
-
css: PopsCSS.iframeCSS,
|
|
54
|
-
},
|
|
55
|
-
]);
|
|
56
|
-
|
|
57
|
-
let maskExtraStyle =
|
|
58
|
-
// @ts-ignore
|
|
59
|
-
config.animation != null && config.animation != ""
|
|
60
|
-
? "position:absolute;"
|
|
61
|
-
: "";
|
|
62
|
-
|
|
63
|
-
// 先把z-index提取出来
|
|
64
|
-
let zIndex = PopsHandler.handleZIndex(config.zIndex);
|
|
65
|
-
let maskHTML = PopsElementHandler.createMask(guid, zIndex, maskExtraStyle);
|
|
66
|
-
|
|
67
|
-
let headerBtnHTML = PopsElementHandler.createHeader(popsType, config);
|
|
68
|
-
let iframeLoadingHTML = '<div class="pops-loading"></div>';
|
|
69
|
-
let titleText =
|
|
70
|
-
config.title!.text!.trim() !== "" ? config.title.text : config.url;
|
|
71
|
-
let { headerStyle, headerPStyle } = PopsElementHandler.createHeaderStyle(
|
|
72
|
-
popsType,
|
|
73
|
-
config
|
|
74
|
-
);
|
|
75
|
-
let animHTML = PopsElementHandler.createAnim(
|
|
76
|
-
guid,
|
|
77
|
-
popsType,
|
|
78
|
-
config,
|
|
79
|
-
/*html*/ `
|
|
80
|
-
<div class="pops-title pops-${popsType}-title" style="text-align: ${
|
|
81
|
-
config.title.position
|
|
82
|
-
};${headerStyle}">${
|
|
83
|
-
config.title.html
|
|
84
|
-
? titleText
|
|
85
|
-
: `<p pops class="pops-${popsType}-title-text" style="${headerPStyle}">${titleText}</p>`
|
|
86
|
-
}${headerBtnHTML}</div>
|
|
87
|
-
<div class="pops-content pops-${popsType}-content">
|
|
88
|
-
<div class="pops-${popsType}-content-global-loading"></div>
|
|
89
|
-
<iframe src="${config.url}" pops ${
|
|
90
|
-
config.sandbox
|
|
91
|
-
? "sandbox='allow-forms allow-same-origin allow-scripts'"
|
|
92
|
-
: ""
|
|
93
|
-
}>
|
|
94
|
-
</iframe>
|
|
95
|
-
</div>${config.loading.enable ? iframeLoadingHTML : ""}`,
|
|
96
|
-
"",
|
|
97
|
-
zIndex
|
|
98
|
-
);
|
|
99
|
-
/**
|
|
100
|
-
* 弹窗的主元素,包括动画层
|
|
101
|
-
*/
|
|
102
|
-
|
|
103
|
-
let $anim = PopsElementHandler.parseElement<HTMLDivElement>(animHTML);
|
|
104
|
-
let {
|
|
105
|
-
popsElement: $pops,
|
|
106
|
-
headerCloseBtnElement,
|
|
107
|
-
headerControlsElement,
|
|
108
|
-
titleElement: $title,
|
|
109
|
-
iframeElement: $iframe,
|
|
110
|
-
loadingElement,
|
|
111
|
-
contentLoadingElement: $contentLoading,
|
|
112
|
-
headerMinBtnElement,
|
|
113
|
-
headerMaxBtnElement,
|
|
114
|
-
headerMiseBtnElement,
|
|
115
|
-
} = PopsHandler.handleQueryElement($anim, popsType);
|
|
116
|
-
let $iframeContainer = PopsCore.document.querySelector<HTMLDivElement>(
|
|
117
|
-
".pops-iframe-container"
|
|
118
|
-
);
|
|
119
|
-
if (!$iframeContainer) {
|
|
120
|
-
$iframeContainer = PopsCore.document.createElement("div");
|
|
121
|
-
$iframeContainer.className = "pops-iframe-container";
|
|
122
|
-
$iframeContainer.style.cssText =
|
|
123
|
-
"display: flex;position: fixed;bottom: 0px;flex-flow: wrap-reverse;user-select: none;-webkit-user-select: none;-ms-user-select: none;-moz-user-select: none;";
|
|
124
|
-
popsDOMUtils.appendBody($iframeContainer);
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* 遮罩层元素
|
|
128
|
-
*/
|
|
129
|
-
let $mask: HTMLDivElement | null = null;
|
|
130
|
-
/**
|
|
131
|
-
* 已创建的元素列表
|
|
132
|
-
*/
|
|
133
|
-
let elementList: HTMLElement[] = [$anim];
|
|
134
|
-
|
|
135
|
-
if (config.mask.enable) {
|
|
136
|
-
let _handleMask_ = PopsHandler.handleMask({
|
|
137
|
-
type: popsType,
|
|
138
|
-
guid: guid,
|
|
139
|
-
|
|
140
|
-
config: config,
|
|
141
|
-
animElement: $anim,
|
|
142
|
-
maskHTML: maskHTML,
|
|
143
|
-
});
|
|
144
|
-
$mask = _handleMask_.maskElement;
|
|
145
|
-
elementList.push($mask);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
let eventDetails = PopsHandler.handleEventDetails(
|
|
149
|
-
guid,
|
|
150
|
-
$shadowContainer,
|
|
151
|
-
$shadowRoot,
|
|
152
|
-
popsType,
|
|
153
|
-
$anim,
|
|
154
|
-
|
|
155
|
-
$pops!,
|
|
156
|
-
$mask!,
|
|
157
|
-
config
|
|
158
|
-
) as any as PopsEventDetails & {
|
|
159
|
-
iframeElement: HTMLIFrameElement;
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
eventDetails["iframeElement"] = $iframe!;
|
|
163
|
-
|
|
164
|
-
popsDOMUtils.on($anim, popsDOMUtils.getAnimationEndNameList(), function () {
|
|
165
|
-
/* 动画加载完毕 */
|
|
166
|
-
$anim.style.width = "0%";
|
|
167
|
-
$anim.style.height = "0%";
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
popsDOMUtils.on($iframe, "load", () => {
|
|
171
|
-
/* iframe加载中... */
|
|
172
|
-
loadingElement?.remove();
|
|
173
|
-
$contentLoading!.style.animation = "iframeLoadingChange_85 0.3s forwards";
|
|
174
|
-
popsDOMUtils.on(
|
|
175
|
-
$contentLoading,
|
|
176
|
-
popsDOMUtils.getAnimationEndNameList(),
|
|
177
|
-
() => {
|
|
178
|
-
/* 动画加载完毕就移除 */
|
|
179
|
-
$contentLoading!.remove();
|
|
180
|
-
}
|
|
181
|
-
);
|
|
182
|
-
|
|
183
|
-
if (config.title!.text!.trim() === "" && $iframe!.contentDocument) {
|
|
184
|
-
/* 同域名下的才可以获取网页标题 */
|
|
185
|
-
$title!.querySelector<HTMLElement>("p")!.innerText =
|
|
186
|
-
$iframe!.contentDocument.title;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
config.loadEndCallBack(eventDetails);
|
|
190
|
-
});
|
|
191
|
-
/* 创建到页面中 */
|
|
192
|
-
|
|
193
|
-
popsDOMUtils.append($shadowRoot, elementList);
|
|
194
|
-
if (typeof config.beforeAppendToPageCallBack === "function") {
|
|
195
|
-
config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
$iframeContainer.appendChild($shadowContainer);
|
|
199
|
-
if ($mask != null) {
|
|
200
|
-
$anim.after($mask);
|
|
201
|
-
}
|
|
202
|
-
/* 拖拽 */
|
|
203
|
-
if (config.drag) {
|
|
204
|
-
PopsInstanceUtils.drag($pops!, {
|
|
205
|
-
dragElement: $title!,
|
|
206
|
-
limit: config.dragLimit,
|
|
207
|
-
extraDistance: config.dragExtraDistance,
|
|
208
|
-
moveCallBack: config.dragMoveCallBack,
|
|
209
|
-
endCallBack: config.dragEndCallBack,
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
const TYPE_MODULE = "type-module";
|
|
213
|
-
/* 最小化按钮点击事件 */
|
|
214
|
-
let origin_left = "";
|
|
215
|
-
let origin_top = "";
|
|
216
|
-
let origin_is_max = false;
|
|
217
|
-
popsDOMUtils.on<PointerEvent | MouseEvent>(
|
|
218
|
-
headerMinBtnElement,
|
|
219
|
-
"click",
|
|
220
|
-
(event) => {
|
|
221
|
-
event.preventDefault();
|
|
222
|
-
event.stopPropagation();
|
|
223
|
-
origin_left = $pops.style.left;
|
|
224
|
-
origin_top = $pops.style.top;
|
|
225
|
-
$pops.classList.add("pops-iframe-unset-top");
|
|
226
|
-
$pops.classList.add("pops-iframe-unset-left");
|
|
227
|
-
$pops.classList.add("pops-iframe-unset-transform");
|
|
228
|
-
$pops.style.transitionDuration = "";
|
|
229
|
-
|
|
230
|
-
$pops.setAttribute(TYPE_MODULE, "min");
|
|
231
|
-
headerControlsElement.setAttribute("type", "min");
|
|
232
|
-
// 隐藏放大图标
|
|
233
|
-
headerMaxBtnElement.style.setProperty("display", "none");
|
|
234
|
-
// 显示复位图标
|
|
235
|
-
headerMiseBtnElement.style.setProperty("display", "");
|
|
236
|
-
if (typeof config?.btn?.min?.callback === "function") {
|
|
237
|
-
config.btn.min.callback(eventDetails, event);
|
|
238
|
-
}
|
|
239
|
-
},
|
|
240
|
-
{
|
|
241
|
-
capture: true,
|
|
242
|
-
}
|
|
243
|
-
);
|
|
244
|
-
/* 最大化按钮点击事件 */
|
|
245
|
-
popsDOMUtils.on<MouseEvent | PointerEvent>(
|
|
246
|
-
headerMaxBtnElement,
|
|
247
|
-
"click",
|
|
248
|
-
(event) => {
|
|
249
|
-
event.preventDefault();
|
|
250
|
-
event.stopPropagation();
|
|
251
|
-
if ($pops.getAttribute(TYPE_MODULE) !== "min") {
|
|
252
|
-
origin_left = $pops.style.left;
|
|
253
|
-
origin_top = $pops.style.top;
|
|
254
|
-
}
|
|
255
|
-
origin_is_max = true;
|
|
256
|
-
$pops.style.transitionDuration = "";
|
|
257
|
-
$pops.style.transform = "";
|
|
258
|
-
$pops.removeAttribute(TYPE_MODULE);
|
|
259
|
-
$pops.classList.add("pops-iframe-unset-transition");
|
|
260
|
-
$pops.classList.add("pops-iframe-unset-left");
|
|
261
|
-
$pops.classList.add("pops-iframe-unset-top");
|
|
262
|
-
$pops.classList.add("pops-iframe-unset-transform");
|
|
263
|
-
$pops.classList.remove("pops-iframe-unset-transition");
|
|
264
|
-
$pops.setAttribute(TYPE_MODULE, "max");
|
|
265
|
-
headerControlsElement.setAttribute("type", "max");
|
|
266
|
-
// 隐藏放大图标
|
|
267
|
-
headerMaxBtnElement.style.setProperty("display", "none");
|
|
268
|
-
// 显示复位图标
|
|
269
|
-
headerMiseBtnElement.style.setProperty("display", "");
|
|
270
|
-
if (typeof config?.btn?.max?.callback === "function") {
|
|
271
|
-
config.btn.max.callback(eventDetails, event);
|
|
272
|
-
}
|
|
273
|
-
},
|
|
274
|
-
{
|
|
275
|
-
capture: true,
|
|
276
|
-
}
|
|
277
|
-
);
|
|
278
|
-
/* 先隐藏窗口化按钮 */
|
|
279
|
-
headerMiseBtnElement?.style?.setProperty("display", "none");
|
|
280
|
-
/* 复位按钮点击事件 */
|
|
281
|
-
popsDOMUtils.on<MouseEvent | PointerEvent>(
|
|
282
|
-
headerMiseBtnElement,
|
|
283
|
-
"click",
|
|
284
|
-
(event) => {
|
|
285
|
-
event.preventDefault();
|
|
286
|
-
event.stopPropagation();
|
|
287
|
-
if (origin_is_max && $pops.getAttribute(TYPE_MODULE) === "min") {
|
|
288
|
-
$pops.classList.add("pops-iframe-unset-transition");
|
|
289
|
-
$pops.classList.add("pops-iframe-unset-left");
|
|
290
|
-
$pops.classList.add("pops-iframe-unset-top");
|
|
291
|
-
$pops.classList.add("pops-iframe-unset-transform");
|
|
292
|
-
$pops.classList.remove("pops-iframe-unset-transition");
|
|
293
|
-
$pops.setAttribute(TYPE_MODULE, "max");
|
|
294
|
-
headerControlsElement.setAttribute("type", "max");
|
|
295
|
-
} else {
|
|
296
|
-
origin_is_max = false;
|
|
297
|
-
$pops.style.left = origin_left;
|
|
298
|
-
$pops.style.top = origin_top;
|
|
299
|
-
$pops.style.transitionDuration = "";
|
|
300
|
-
$pops.style.transform = "";
|
|
301
|
-
headerControlsElement.removeAttribute("type");
|
|
302
|
-
$pops.removeAttribute(TYPE_MODULE);
|
|
303
|
-
$pops.classList.remove("pops-iframe-unset-top");
|
|
304
|
-
$pops.classList.remove("pops-iframe-unset-left");
|
|
305
|
-
$pops.classList.remove("pops-iframe-unset-transform");
|
|
306
|
-
|
|
307
|
-
// 显示放大图标
|
|
308
|
-
headerMaxBtnElement.style.setProperty("display", "");
|
|
309
|
-
// 隐藏复位图标
|
|
310
|
-
headerMiseBtnElement.style.setProperty("display", "none");
|
|
311
|
-
}
|
|
312
|
-
if (typeof config?.btn?.mise?.callback === "function") {
|
|
313
|
-
config.btn.mise.callback(eventDetails, event);
|
|
314
|
-
}
|
|
315
|
-
},
|
|
316
|
-
{
|
|
317
|
-
capture: true,
|
|
318
|
-
}
|
|
319
|
-
);
|
|
320
|
-
/* 关闭按钮点击事件 */
|
|
321
|
-
popsDOMUtils.on<MouseEvent | PointerEvent>(
|
|
322
|
-
headerCloseBtnElement,
|
|
323
|
-
"click",
|
|
324
|
-
(event) => {
|
|
325
|
-
event.preventDefault();
|
|
326
|
-
event.stopPropagation();
|
|
327
|
-
PopsInstanceUtils.removeInstance([PopsInstData.iframe], guid, false);
|
|
328
|
-
if (typeof config?.btn?.close?.callback === "function") {
|
|
329
|
-
config.btn.close.callback(eventDetails, event);
|
|
330
|
-
}
|
|
331
|
-
},
|
|
332
|
-
{
|
|
333
|
-
capture: true,
|
|
334
|
-
}
|
|
335
|
-
);
|
|
336
|
-
|
|
337
|
-
PopsHandler.handlePush(popsType, {
|
|
338
|
-
guid: guid,
|
|
339
|
-
animElement: $anim,
|
|
340
|
-
|
|
341
|
-
popsElement: $pops!,
|
|
342
|
-
|
|
343
|
-
maskElement: $mask!,
|
|
344
|
-
$shadowContainer: $shadowContainer,
|
|
345
|
-
$shadowRoot: $shadowRoot,
|
|
346
|
-
});
|
|
347
|
-
|
|
348
|
-
let result = PopsHandler.handleResultDetails(eventDetails);
|
|
349
|
-
return result;
|
|
350
|
-
},
|
|
351
|
-
};
|