@whitesev/pops 2.4.6 → 2.4.7
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 +578 -571
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +578 -571
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +578 -571
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +578 -571
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +578 -571
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +578 -571
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/types/PopsDOMUtilsEventType.d.ts +252 -252
- package/dist/types/src/types/animation.d.ts +19 -19
- package/dist/types/src/types/button.d.ts +187 -187
- package/dist/types/src/types/components.d.ts +210 -210
- package/dist/types/src/types/event.d.ts +63 -63
- package/dist/types/src/types/global.d.ts +25 -25
- 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 +111 -111
- package/dist/types/src/types/mask.d.ts +49 -49
- package/dist/types/src/types/position.d.ts +60 -60
- package/index.ts +3 -0
- package/package.json +4 -2
- package/src/Pops.ts +206 -0
- package/src/PopsAnimation.ts +32 -0
- package/src/PopsCSS.ts +51 -0
- package/src/PopsCore.ts +64 -0
- package/src/PopsIcon.ts +95 -0
- package/src/PopsInst.ts +21 -0
- package/src/components/alert/config.ts +62 -0
- package/src/components/alert/index.css +0 -0
- package/src/components/alert/index.ts +163 -0
- package/src/components/alert/types/index.ts +23 -0
- package/src/components/confirm/config.ts +90 -0
- package/src/components/confirm/index.css +0 -0
- package/src/components/confirm/index.ts +166 -0
- package/src/components/confirm/types/index.ts +17 -0
- package/src/components/drawer/config.ts +89 -0
- package/src/components/drawer/index.css +37 -0
- package/src/components/drawer/index.ts +237 -0
- package/src/components/drawer/types/index.ts +61 -0
- package/src/components/folder/config.ts +147 -0
- package/src/components/folder/folderIcon.ts +28 -0
- package/src/components/folder/index.css +303 -0
- package/src/components/folder/index.ts +929 -0
- package/src/components/folder/types/index.ts +97 -0
- package/src/components/iframe/config.ts +60 -0
- package/src/components/iframe/index.css +76 -0
- package/src/components/iframe/index.ts +334 -0
- package/src/components/iframe/types/index.ts +139 -0
- package/src/components/loading/config.ts +29 -0
- package/src/components/loading/index.css +66 -0
- package/src/components/loading/index.ts +99 -0
- package/src/components/loading/types/index.ts +34 -0
- package/src/components/panel/config.ts +519 -0
- package/src/components/panel/handlerComponents.ts +2900 -0
- package/src/components/panel/index.css +1222 -0
- package/src/components/panel/index.ts +207 -0
- package/src/components/panel/types/components-button.ts +68 -0
- package/src/components/panel/types/components-common.ts +50 -0
- package/src/components/panel/types/components-deepMenu.ts +84 -0
- package/src/components/panel/types/components-forms.ts +44 -0
- package/src/components/panel/types/components-input.ts +78 -0
- package/src/components/panel/types/components-own.ts +30 -0
- package/src/components/panel/types/components-select.ts +93 -0
- package/src/components/panel/types/components-selectMultiple.ts +130 -0
- package/src/components/panel/types/components-slider.ts +77 -0
- package/src/components/panel/types/components-switch.ts +56 -0
- package/src/components/panel/types/components-textarea.ts +68 -0
- package/src/components/panel/types/index.ts +177 -0
- package/src/components/prompt/config.ts +94 -0
- package/src/components/prompt/index.css +34 -0
- package/src/components/prompt/index.ts +216 -0
- package/src/components/prompt/types/index.ts +55 -0
- package/src/components/rightClickMenu/config.ts +98 -0
- package/src/components/rightClickMenu/index.css +112 -0
- package/src/components/rightClickMenu/index.ts +602 -0
- package/src/components/rightClickMenu/types/index.ts +97 -0
- package/src/components/searchSuggestion/config.ts +56 -0
- package/src/components/searchSuggestion/index.ts +856 -0
- package/src/components/searchSuggestion/types/index.ts +239 -0
- package/src/components/tooltip/config.ts +34 -0
- package/src/components/tooltip/index.css +199 -0
- package/src/components/tooltip/index.ts +604 -0
- package/src/components/tooltip/types/index.ts +117 -0
- package/src/config/CommonCSSClassName.ts +17 -0
- package/src/config/GlobalConfig.ts +63 -0
- package/src/css/animation.css +987 -0
- package/src/css/button.css +551 -0
- package/src/css/common.css +48 -0
- package/src/css/index.css +253 -0
- package/src/css/ninePalaceGridPosition.css +50 -0
- package/src/css/scrollbar.css +22 -0
- package/src/handler/PopsElementHandler.ts +304 -0
- package/src/handler/PopsHandler.ts +589 -0
- package/src/svg/arrowLeft.svg +4 -0
- package/src/svg/arrowRight.svg +4 -0
- package/src/svg/chromeFilled.svg +11 -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 +252 -0
- package/src/types/animation.d.ts +19 -0
- package/src/types/button.d.ts +187 -0
- package/src/types/components.d.ts +210 -0
- package/src/types/event.d.ts +63 -0
- package/src/types/global.d.ts +25 -0
- package/src/types/icon.d.ts +32 -0
- package/src/types/inst.d.ts +24 -0
- package/src/types/main.d.ts +111 -0
- package/src/types/mask.d.ts +49 -0
- package/src/types/position.d.ts +60 -0
- package/src/utils/PopsDOMUtils.ts +2408 -0
- package/src/utils/PopsDOMUtilsEventsConfig.ts +4 -0
- package/src/utils/PopsInstanceUtils.ts +688 -0
- package/src/utils/PopsMathUtils.ts +71 -0
- package/src/utils/PopsSafeUtils.ts +22 -0
- package/src/utils/PopsUtils.ts +406 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { PopsLoadingDetails } from "./types";
|
|
2
|
+
|
|
3
|
+
export const PopsLoadingConfig = (): DeepRequired<PopsLoadingDetails> => {
|
|
4
|
+
return {
|
|
5
|
+
parent: document.body,
|
|
6
|
+
content: {
|
|
7
|
+
text: "加载中...",
|
|
8
|
+
icon: "loading",
|
|
9
|
+
style: "",
|
|
10
|
+
},
|
|
11
|
+
useShadowRoot: true,
|
|
12
|
+
class: "",
|
|
13
|
+
only: false,
|
|
14
|
+
zIndex: 10000,
|
|
15
|
+
mask: {
|
|
16
|
+
enable: false,
|
|
17
|
+
clickEvent: {
|
|
18
|
+
toClose: false,
|
|
19
|
+
toHide: false,
|
|
20
|
+
},
|
|
21
|
+
clickCallBack: null,
|
|
22
|
+
},
|
|
23
|
+
animation: "pops-anim-fadein-zoom",
|
|
24
|
+
forbiddenScroll: false,
|
|
25
|
+
isAbsolute: false,
|
|
26
|
+
style: null,
|
|
27
|
+
addIndexCSS: true,
|
|
28
|
+
};
|
|
29
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
.pops[type-value="loading"] {
|
|
2
|
+
--loading-bd-color: rgba(0, 0, 0, 0.2);
|
|
3
|
+
--loading-bg-color: rgb(255, 255, 255, var(--pops-bg-opacity));
|
|
4
|
+
--loading-box-shadow-color: rgb(0 0 0 / 50%);
|
|
5
|
+
--loading-icon-color: rgba(100, 149, 237, 0.1);
|
|
6
|
+
--loading-icon-bd-top-color: rgb(100, 149, 237, var(--pops-bd-opacity));
|
|
7
|
+
}
|
|
8
|
+
.pops[type-value="loading"] {
|
|
9
|
+
position: absolute;
|
|
10
|
+
top: 272.5px;
|
|
11
|
+
top: 50%;
|
|
12
|
+
left: 26px;
|
|
13
|
+
left: 50%;
|
|
14
|
+
display: flex;
|
|
15
|
+
overflow: hidden;
|
|
16
|
+
padding: 10px 15px;
|
|
17
|
+
max-width: 100%;
|
|
18
|
+
max-height: 100%;
|
|
19
|
+
min-width: 0;
|
|
20
|
+
min-height: 0;
|
|
21
|
+
border: 1px solid var(--loading-bd-color);
|
|
22
|
+
border-radius: 5px;
|
|
23
|
+
background-color: var(--loading-bg-color);
|
|
24
|
+
box-shadow: 0 0 5px var(--loading-box-shadow-color);
|
|
25
|
+
vertical-align: middle;
|
|
26
|
+
transition: all 0.35s;
|
|
27
|
+
transform: translate(-50%, -50%);
|
|
28
|
+
-webkit-user-select: none;
|
|
29
|
+
-moz-user-select: none;
|
|
30
|
+
-ms-user-select: none;
|
|
31
|
+
user-select: none;
|
|
32
|
+
flex-direction: column;
|
|
33
|
+
align-items: center;
|
|
34
|
+
justify-content: center;
|
|
35
|
+
align-content: center;
|
|
36
|
+
}
|
|
37
|
+
.pops[type-value="loading"]:before {
|
|
38
|
+
float: left;
|
|
39
|
+
display: inline-block;
|
|
40
|
+
width: 2em;
|
|
41
|
+
height: 2em;
|
|
42
|
+
border: 0.3em solid var(--loading-icon-color);
|
|
43
|
+
border-top: 0.3em solid var(--loading-icon-bd-top-color);
|
|
44
|
+
border-radius: 50%;
|
|
45
|
+
content: " ";
|
|
46
|
+
vertical-align: middle;
|
|
47
|
+
font-size: inherit;
|
|
48
|
+
animation: pops-anim-wait-rotate 1.2s linear infinite;
|
|
49
|
+
}
|
|
50
|
+
.pops[type-value="loading"] .pops-loading-content {
|
|
51
|
+
position: static;
|
|
52
|
+
top: 0;
|
|
53
|
+
bottom: 0;
|
|
54
|
+
float: left;
|
|
55
|
+
overflow: hidden;
|
|
56
|
+
width: auto;
|
|
57
|
+
font-size: inherit;
|
|
58
|
+
line-height: normal;
|
|
59
|
+
align-content: center;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@media (prefers-color-scheme: dark) {
|
|
63
|
+
.pops[type-value="loading"] {
|
|
64
|
+
--loading-bg-color: #222222;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { GlobalConfig } from "../../config/GlobalConfig";
|
|
2
|
+
import { PopsElementHandler } from "../../handler/PopsElementHandler";
|
|
3
|
+
import { PopsHandler } from "../../handler/PopsHandler";
|
|
4
|
+
import { PopsCSS } from "../../PopsCSS";
|
|
5
|
+
import { popsDOMUtils } from "../../utils/PopsDOMUtils";
|
|
6
|
+
import { popsUtils } from "../../utils/PopsUtils";
|
|
7
|
+
import { PopsLoadingConfig } from "./config";
|
|
8
|
+
import type { PopsLoadingDetails } from "./types";
|
|
9
|
+
|
|
10
|
+
export const PopsLoading = {
|
|
11
|
+
init(details: PopsLoadingDetails) {
|
|
12
|
+
let config = PopsLoadingConfig();
|
|
13
|
+
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
14
|
+
config = popsUtils.assign(config, details);
|
|
15
|
+
const guid = popsUtils.getRandomGUID();
|
|
16
|
+
const PopsType = "loading";
|
|
17
|
+
|
|
18
|
+
config = PopsHandler.handleOnly(PopsType, config);
|
|
19
|
+
|
|
20
|
+
// 先把z-index提取出来
|
|
21
|
+
const zIndex = PopsHandler.handleZIndex(config.zIndex);
|
|
22
|
+
const maskHTML = PopsElementHandler.createMask(guid, zIndex);
|
|
23
|
+
|
|
24
|
+
const { contentPStyle } = PopsElementHandler.createContentStyle("loading", config);
|
|
25
|
+
const animHTML = PopsElementHandler.createAnim(
|
|
26
|
+
guid,
|
|
27
|
+
PopsType,
|
|
28
|
+
config,
|
|
29
|
+
/*html*/ `
|
|
30
|
+
<div class="pops-content pops-${PopsType}-content">${
|
|
31
|
+
config.addIndexCSS
|
|
32
|
+
? /*html*/ `
|
|
33
|
+
<style data-model-name="index">${PopsCSS.index}</style>
|
|
34
|
+
<style data-model-name="anim">${PopsCSS.anim}</style>
|
|
35
|
+
<style data-model-name="common">${PopsCSS.common}</style>
|
|
36
|
+
`
|
|
37
|
+
: ""
|
|
38
|
+
}
|
|
39
|
+
<style data-model-name="loadingCSS">
|
|
40
|
+
${PopsCSS.loadingCSS}
|
|
41
|
+
</style>
|
|
42
|
+
${config.style != null ? `<style>${config.style}</style>` : ""}
|
|
43
|
+
<p pops class="pops-${PopsType}-content-text" style="${contentPStyle}">${config.content.text}</p>
|
|
44
|
+
</div>`,
|
|
45
|
+
"",
|
|
46
|
+
zIndex
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* 弹窗的主元素,包括动画层
|
|
51
|
+
*/
|
|
52
|
+
|
|
53
|
+
const $anim = PopsElementHandler.parseElement<HTMLDivElement>(animHTML);
|
|
54
|
+
|
|
55
|
+
const { popsElement: $pops } = PopsHandler.handleQueryElement($anim, PopsType);
|
|
56
|
+
/**
|
|
57
|
+
* 遮罩层元素
|
|
58
|
+
*/
|
|
59
|
+
let $mask: HTMLDivElement | null = null;
|
|
60
|
+
/**
|
|
61
|
+
* 已创建的元素列表
|
|
62
|
+
*/
|
|
63
|
+
const elementList: HTMLElement[] = [$anim];
|
|
64
|
+
|
|
65
|
+
if (config.mask.enable) {
|
|
66
|
+
// 创建遮罩层
|
|
67
|
+
const _handleMask_ = PopsHandler.handleMask({
|
|
68
|
+
type: PopsType,
|
|
69
|
+
guid: guid,
|
|
70
|
+
|
|
71
|
+
config: config,
|
|
72
|
+
animElement: $anim,
|
|
73
|
+
maskHTML: maskHTML,
|
|
74
|
+
});
|
|
75
|
+
$mask = _handleMask_.maskElement;
|
|
76
|
+
elementList.push($mask);
|
|
77
|
+
}
|
|
78
|
+
const eventDetails = PopsHandler.handleLoadingEventDetails(guid, PopsType, $anim, $pops!, $mask!, config);
|
|
79
|
+
popsDOMUtils.append(config.parent, elementList);
|
|
80
|
+
if ($mask != null) {
|
|
81
|
+
$anim.after($mask);
|
|
82
|
+
}
|
|
83
|
+
PopsHandler.handlePush(PopsType, {
|
|
84
|
+
guid: guid,
|
|
85
|
+
animElement: $anim,
|
|
86
|
+
popsElement: $pops!,
|
|
87
|
+
maskElement: $mask!,
|
|
88
|
+
} as any);
|
|
89
|
+
|
|
90
|
+
if (config.isAbsolute) {
|
|
91
|
+
// 遮罩层必须是跟随主内容
|
|
92
|
+
// 即设置主内容position: relative,mask:position: absolute
|
|
93
|
+
popsDOMUtils.css($anim, "position", "absolute !important");
|
|
94
|
+
$mask && popsDOMUtils.css($mask, "position", "absolute !important");
|
|
95
|
+
}
|
|
96
|
+
const result = PopsHandler.handleResultDetails(eventDetails);
|
|
97
|
+
return result;
|
|
98
|
+
},
|
|
99
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { PopsCommonConfig, PopsContentConfig } from "../../../types/components";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* pops.loading
|
|
5
|
+
*/
|
|
6
|
+
export interface PopsLoadingDetails
|
|
7
|
+
extends Omit<PopsCommonConfig, "width" | "height" | "position" | "beforeAppendToPageCallBack"> {
|
|
8
|
+
/**
|
|
9
|
+
* 父元素,默认为document.body
|
|
10
|
+
* @default document.body
|
|
11
|
+
*/
|
|
12
|
+
parent?: HTMLElement;
|
|
13
|
+
/**
|
|
14
|
+
* 内容配置
|
|
15
|
+
*/
|
|
16
|
+
content: Omit<PopsContentConfig["content"], "html"> & {
|
|
17
|
+
/**
|
|
18
|
+
* 图标
|
|
19
|
+
*/
|
|
20
|
+
icon?: string;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* (可选)添加主CSS,默认为true,当页面中存在anim覆盖时,可能会有一些样式问题,取消添加该CSS即可解决
|
|
24
|
+
* @default true
|
|
25
|
+
*/
|
|
26
|
+
addIndexCSS?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* 为pops-anim和pops-mask设置position: absolute(需要自行设置parent的position为relative)
|
|
29
|
+
*
|
|
30
|
+
* 它们默认的position为fixed
|
|
31
|
+
* @default false
|
|
32
|
+
*/
|
|
33
|
+
isAbsolute?: boolean;
|
|
34
|
+
}
|