@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,30 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
PopsTitleConfig,
|
|
3
|
-
PopsContentConfig,
|
|
4
|
-
PopsDragConfig,
|
|
5
|
-
PopsCommonConfig,
|
|
6
|
-
PopsButtonConfig,
|
|
7
|
-
} from "../../../types/components";
|
|
8
|
-
import type {
|
|
9
|
-
PopsButtonDetails,
|
|
10
|
-
PopsButtonDetailsAnyType,
|
|
11
|
-
} from "../../../types/button";
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* pops.alert
|
|
15
|
-
*/
|
|
16
|
-
export interface PopsAlertDetails
|
|
17
|
-
extends PopsTitleConfig,
|
|
18
|
-
PopsContentConfig,
|
|
19
|
-
PopsDragConfig,
|
|
20
|
-
PopsCommonConfig {
|
|
21
|
-
/**
|
|
22
|
-
* 按钮配置
|
|
23
|
-
*/
|
|
24
|
-
btn?: Partial<PopsButtonConfig["btn"]> & {
|
|
25
|
-
/**
|
|
26
|
-
* 确定按钮
|
|
27
|
-
*/
|
|
28
|
-
ok?: Partial<PopsButtonDetails | PopsButtonDetailsAnyType>;
|
|
29
|
-
};
|
|
30
|
-
}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import type { PopsConfirmDetails } from "./types";
|
|
2
|
-
|
|
3
|
-
export const PopsConfirmConfig = (): DeepRequired<PopsConfirmDetails> => {
|
|
4
|
-
return {
|
|
5
|
-
title: {
|
|
6
|
-
text: "默认标题",
|
|
7
|
-
position: "left",
|
|
8
|
-
html: false,
|
|
9
|
-
style: "",
|
|
10
|
-
},
|
|
11
|
-
content: {
|
|
12
|
-
text: "默认内容",
|
|
13
|
-
html: false,
|
|
14
|
-
style: "",
|
|
15
|
-
},
|
|
16
|
-
btn: {
|
|
17
|
-
merge: false,
|
|
18
|
-
mergeReverse: false,
|
|
19
|
-
reverse: false,
|
|
20
|
-
position: "flex-end",
|
|
21
|
-
ok: {
|
|
22
|
-
enable: true,
|
|
23
|
-
size: void 0 as any,
|
|
24
|
-
icon: void 0 as any,
|
|
25
|
-
rightIcon: false,
|
|
26
|
-
iconIsLoading: false,
|
|
27
|
-
text: "确定",
|
|
28
|
-
type: "primary",
|
|
29
|
-
callback(detail: any) {
|
|
30
|
-
detail.close();
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
cancel: {
|
|
34
|
-
enable: true,
|
|
35
|
-
size: void 0 as any,
|
|
36
|
-
icon: void 0 as any,
|
|
37
|
-
rightIcon: false,
|
|
38
|
-
iconIsLoading: false,
|
|
39
|
-
text: "关闭",
|
|
40
|
-
type: "default",
|
|
41
|
-
callback(detail: any) {
|
|
42
|
-
detail.close();
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
other: {
|
|
46
|
-
enable: false,
|
|
47
|
-
size: void 0 as any,
|
|
48
|
-
icon: void 0 as any,
|
|
49
|
-
rightIcon: false,
|
|
50
|
-
iconIsLoading: false,
|
|
51
|
-
text: "其它按钮",
|
|
52
|
-
type: "default",
|
|
53
|
-
callback(detail: any) {
|
|
54
|
-
detail.close();
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
close: {
|
|
58
|
-
enable: true,
|
|
59
|
-
callback(detail: any) {
|
|
60
|
-
detail.close();
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
useShadowRoot: true,
|
|
65
|
-
class: "",
|
|
66
|
-
only: false,
|
|
67
|
-
width: window.innerWidth < 550 ? "88vw" : "350px",
|
|
68
|
-
height: window.innerHeight < 450 ? "70vh" : "200px",
|
|
69
|
-
position: "center",
|
|
70
|
-
animation: "pops-anim-fadein-zoom",
|
|
71
|
-
zIndex: 10000,
|
|
72
|
-
mask: {
|
|
73
|
-
enable: false,
|
|
74
|
-
clickEvent: {
|
|
75
|
-
toClose: false,
|
|
76
|
-
toHide: false,
|
|
77
|
-
},
|
|
78
|
-
clickCallBack: null,
|
|
79
|
-
},
|
|
80
|
-
drag: false,
|
|
81
|
-
dragLimit: true,
|
|
82
|
-
dragExtraDistance: 3,
|
|
83
|
-
dragMoveCallBack() {},
|
|
84
|
-
dragEndCallBack() {},
|
|
85
|
-
forbiddenScroll: false,
|
|
86
|
-
|
|
87
|
-
style: null,
|
|
88
|
-
beforeAppendToPageCallBack() {},
|
|
89
|
-
} as DeepRequired<PopsConfirmDetails>;
|
|
90
|
-
};
|
|
File without changes
|
|
@@ -1,192 +0,0 @@
|
|
|
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 type { PopsType } from "../../types/main";
|
|
6
|
-
import { popsDOMUtils } from "../../utils/PopsDOMUtils";
|
|
7
|
-
import { PopsInstanceUtils } from "../../utils/PopsInstanceUtils";
|
|
8
|
-
import { popsUtils } from "../../utils/PopsUtils";
|
|
9
|
-
import { PopsConfirmConfig } from "./config";
|
|
10
|
-
import type { PopsConfirmDetails } from "./types";
|
|
11
|
-
|
|
12
|
-
export const PopsConfirm = {
|
|
13
|
-
init(details: PopsConfirmDetails) {
|
|
14
|
-
const guid = popsUtils.getRandomGUID();
|
|
15
|
-
// 设置当前类型
|
|
16
|
-
const popsType: PopsType = "confirm";
|
|
17
|
-
let config = PopsConfirmConfig();
|
|
18
|
-
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
19
|
-
config = popsUtils.assign(config, details);
|
|
20
|
-
config = PopsHandler.handleOnly(popsType, config);
|
|
21
|
-
|
|
22
|
-
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
|
|
23
|
-
PopsHandler.handleInit($shadowRoot, [
|
|
24
|
-
{
|
|
25
|
-
name: "index",
|
|
26
|
-
css: PopsCSS.index,
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
name: "ninePalaceGridPosition",
|
|
30
|
-
css: PopsCSS.ninePalaceGridPosition,
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
name: "scrollbar",
|
|
34
|
-
css: PopsCSS.scrollbar,
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
name: "button",
|
|
38
|
-
css: PopsCSS.button,
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
name: "anim",
|
|
42
|
-
css: PopsCSS.anim,
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
name: "common",
|
|
46
|
-
css: PopsCSS.common,
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
name: "confirmCSS",
|
|
50
|
-
css: PopsCSS.confirmCSS,
|
|
51
|
-
},
|
|
52
|
-
]);
|
|
53
|
-
|
|
54
|
-
// 先把z-index提取出来
|
|
55
|
-
let zIndex = PopsHandler.handleZIndex(config.zIndex);
|
|
56
|
-
let maskHTML = PopsElementHandler.createMask(guid, zIndex);
|
|
57
|
-
|
|
58
|
-
let headerBtnHTML = PopsElementHandler.createHeader(popsType, config);
|
|
59
|
-
let bottomBtnHTML = PopsElementHandler.createBottom(popsType, config);
|
|
60
|
-
let { headerStyle, headerPStyle } = PopsElementHandler.createHeaderStyle(
|
|
61
|
-
popsType,
|
|
62
|
-
config
|
|
63
|
-
);
|
|
64
|
-
let { contentStyle, contentPStyle } = PopsElementHandler.createContentStyle(
|
|
65
|
-
popsType,
|
|
66
|
-
config
|
|
67
|
-
);
|
|
68
|
-
let animHTML = PopsElementHandler.createAnim(
|
|
69
|
-
guid,
|
|
70
|
-
popsType,
|
|
71
|
-
config,
|
|
72
|
-
/*html*/ `
|
|
73
|
-
<div class="pops-title pops-${popsType}-title" style="text-align: ${
|
|
74
|
-
config.title.position
|
|
75
|
-
};${headerStyle}">${
|
|
76
|
-
config.title.html
|
|
77
|
-
? config.title.text
|
|
78
|
-
: `<p pops class="pops-${popsType}-title-text" style="${headerPStyle}">${config.title.text}</p>`
|
|
79
|
-
}${headerBtnHTML}</div>
|
|
80
|
-
<div class="pops-content pops-${popsType}-content" style="${contentStyle}">${
|
|
81
|
-
config.content.html
|
|
82
|
-
? config.content.text
|
|
83
|
-
: `<p pops class="pops-${popsType}-content-text" style="${contentPStyle}">${config.content.text}</p>`
|
|
84
|
-
}</div>${bottomBtnHTML}`,
|
|
85
|
-
bottomBtnHTML,
|
|
86
|
-
zIndex
|
|
87
|
-
);
|
|
88
|
-
/**
|
|
89
|
-
* 弹窗的主元素,包括动画层
|
|
90
|
-
*/
|
|
91
|
-
let $anim = PopsElementHandler.parseElement<HTMLDivElement>(animHTML);
|
|
92
|
-
let {
|
|
93
|
-
popsElement: $pops,
|
|
94
|
-
titleElement: $title,
|
|
95
|
-
headerCloseBtnElement: $btnClose,
|
|
96
|
-
btnOkElement: $btnOk,
|
|
97
|
-
btnCancelElement: $btnCancel,
|
|
98
|
-
btnOtherElement: $btnOther,
|
|
99
|
-
} = PopsHandler.handleQueryElement($anim, popsType);
|
|
100
|
-
/**
|
|
101
|
-
* 遮罩层元素
|
|
102
|
-
*/
|
|
103
|
-
let $mask: HTMLDivElement | null = null;
|
|
104
|
-
/**
|
|
105
|
-
* 已创建的元素列表
|
|
106
|
-
*/
|
|
107
|
-
let elementList: HTMLElement[] = [$anim];
|
|
108
|
-
|
|
109
|
-
if (config.mask.enable) {
|
|
110
|
-
// 启用遮罩层
|
|
111
|
-
let _handleMask_ = PopsHandler.handleMask({
|
|
112
|
-
type: popsType,
|
|
113
|
-
guid: guid,
|
|
114
|
-
config: config,
|
|
115
|
-
animElement: $anim,
|
|
116
|
-
maskHTML: maskHTML,
|
|
117
|
-
});
|
|
118
|
-
$mask = _handleMask_.maskElement;
|
|
119
|
-
elementList.push($mask);
|
|
120
|
-
}
|
|
121
|
-
let eventDetails = PopsHandler.handleEventDetails(
|
|
122
|
-
guid,
|
|
123
|
-
$shadowContainer,
|
|
124
|
-
$shadowRoot,
|
|
125
|
-
popsType,
|
|
126
|
-
|
|
127
|
-
$anim,
|
|
128
|
-
$pops!,
|
|
129
|
-
$mask!,
|
|
130
|
-
config
|
|
131
|
-
);
|
|
132
|
-
PopsHandler.handleClickEvent(
|
|
133
|
-
"close",
|
|
134
|
-
$btnClose!,
|
|
135
|
-
eventDetails,
|
|
136
|
-
config.btn.close!.callback!
|
|
137
|
-
);
|
|
138
|
-
PopsHandler.handleClickEvent(
|
|
139
|
-
"ok",
|
|
140
|
-
$btnOk!,
|
|
141
|
-
eventDetails!,
|
|
142
|
-
config.btn.ok!.callback!
|
|
143
|
-
);
|
|
144
|
-
PopsHandler.handleClickEvent(
|
|
145
|
-
"cancel",
|
|
146
|
-
$btnCancel!,
|
|
147
|
-
eventDetails,
|
|
148
|
-
config.btn.cancel!.callback!
|
|
149
|
-
);
|
|
150
|
-
PopsHandler.handleClickEvent(
|
|
151
|
-
"other",
|
|
152
|
-
$btnOther!,
|
|
153
|
-
eventDetails,
|
|
154
|
-
config.btn.other!.callback!
|
|
155
|
-
);
|
|
156
|
-
|
|
157
|
-
/* 创建到页面中 */
|
|
158
|
-
|
|
159
|
-
popsDOMUtils.append($shadowRoot, elementList);
|
|
160
|
-
if (typeof config.beforeAppendToPageCallBack === "function") {
|
|
161
|
-
config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
popsDOMUtils.appendBody($shadowContainer);
|
|
165
|
-
if ($mask != null) {
|
|
166
|
-
$anim.after($mask);
|
|
167
|
-
}
|
|
168
|
-
PopsHandler.handlePush(popsType, {
|
|
169
|
-
guid: guid,
|
|
170
|
-
|
|
171
|
-
animElement: $anim,
|
|
172
|
-
|
|
173
|
-
popsElement: $pops!,
|
|
174
|
-
|
|
175
|
-
maskElement: $mask!,
|
|
176
|
-
$shadowContainer: $shadowContainer,
|
|
177
|
-
$shadowRoot: $shadowRoot,
|
|
178
|
-
});
|
|
179
|
-
/* 拖拽 */
|
|
180
|
-
if (config.drag) {
|
|
181
|
-
PopsInstanceUtils.drag($pops!, {
|
|
182
|
-
dragElement: $title!,
|
|
183
|
-
limit: config.dragLimit,
|
|
184
|
-
extraDistance: config.dragExtraDistance,
|
|
185
|
-
moveCallBack: config.dragMoveCallBack,
|
|
186
|
-
endCallBack: config.dragEndCallBack,
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
let result = PopsHandler.handleResultDetails(eventDetails);
|
|
190
|
-
return result;
|
|
191
|
-
},
|
|
192
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
PopsTitleConfig,
|
|
3
|
-
PopsContentConfig,
|
|
4
|
-
PopsDragConfig,
|
|
5
|
-
PopsCommonConfig,
|
|
6
|
-
PopsMoreButtonConfig,
|
|
7
|
-
} from "../../../types/components";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* pops.confirm
|
|
11
|
-
*/
|
|
12
|
-
export interface PopsConfirmDetails
|
|
13
|
-
extends PopsTitleConfig,
|
|
14
|
-
PopsContentConfig,
|
|
15
|
-
PopsMoreButtonConfig,
|
|
16
|
-
PopsDragConfig,
|
|
17
|
-
PopsCommonConfig {}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import type { PopsDrawerDetails } from "./types";
|
|
2
|
-
|
|
3
|
-
export const PopsDrawerConfig = (): DeepRequired<PopsDrawerDetails> => {
|
|
4
|
-
return {
|
|
5
|
-
title: {
|
|
6
|
-
enable: true,
|
|
7
|
-
position: "center",
|
|
8
|
-
text: "默认标题",
|
|
9
|
-
html: false,
|
|
10
|
-
style: "",
|
|
11
|
-
},
|
|
12
|
-
content: {
|
|
13
|
-
text: "默认内容",
|
|
14
|
-
html: false,
|
|
15
|
-
style: "",
|
|
16
|
-
},
|
|
17
|
-
btn: {
|
|
18
|
-
merge: false,
|
|
19
|
-
mergeReverse: false,
|
|
20
|
-
reverse: false,
|
|
21
|
-
position: "flex-end",
|
|
22
|
-
ok: {
|
|
23
|
-
enable: true,
|
|
24
|
-
size: void 0 as any,
|
|
25
|
-
icon: void 0 as any,
|
|
26
|
-
rightIcon: false,
|
|
27
|
-
iconIsLoading: false,
|
|
28
|
-
text: "确定",
|
|
29
|
-
type: "primary",
|
|
30
|
-
callback(detail: any) {
|
|
31
|
-
detail.close();
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
cancel: {
|
|
35
|
-
enable: true,
|
|
36
|
-
size: void 0 as any,
|
|
37
|
-
icon: void 0 as any,
|
|
38
|
-
rightIcon: false,
|
|
39
|
-
iconIsLoading: false,
|
|
40
|
-
text: "关闭",
|
|
41
|
-
type: "default",
|
|
42
|
-
callback(detail: any) {
|
|
43
|
-
detail.close();
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
other: {
|
|
47
|
-
enable: false,
|
|
48
|
-
size: void 0 as any,
|
|
49
|
-
icon: void 0 as any,
|
|
50
|
-
rightIcon: false,
|
|
51
|
-
iconIsLoading: false,
|
|
52
|
-
text: "其它按钮",
|
|
53
|
-
type: "default",
|
|
54
|
-
callback(detail: any) {
|
|
55
|
-
detail.close();
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
close: {
|
|
59
|
-
enable: true,
|
|
60
|
-
callback(detail: any) {
|
|
61
|
-
detail.close();
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
mask: {
|
|
66
|
-
enable: true,
|
|
67
|
-
clickEvent: {
|
|
68
|
-
toClose: true,
|
|
69
|
-
toHide: false,
|
|
70
|
-
},
|
|
71
|
-
clickCallBack: null,
|
|
72
|
-
},
|
|
73
|
-
useShadowRoot: true,
|
|
74
|
-
class: "",
|
|
75
|
-
zIndex: 10000,
|
|
76
|
-
only: false,
|
|
77
|
-
direction: "right",
|
|
78
|
-
size: "30%",
|
|
79
|
-
lockScroll: false,
|
|
80
|
-
closeOnPressEscape: true,
|
|
81
|
-
openDelay: 0,
|
|
82
|
-
closeDelay: 0,
|
|
83
|
-
borderRadius: 0,
|
|
84
|
-
|
|
85
|
-
style: null,
|
|
86
|
-
beforeAppendToPageCallBack() {},
|
|
87
|
-
forbiddenScroll: false,
|
|
88
|
-
};
|
|
89
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
.pops[type-value="drawer"] {
|
|
2
|
-
position: fixed;
|
|
3
|
-
box-sizing: border-box;
|
|
4
|
-
display: flex;
|
|
5
|
-
flex-direction: column;
|
|
6
|
-
box-shadow: 0px 16px 48px 16px rgba(0, 0, 0, 0.08),
|
|
7
|
-
0px 12px 32px rgba(0, 0, 0, 0.12), 0px 8px 16px -8px rgba(0, 0, 0, 0.16);
|
|
8
|
-
overflow: hidden;
|
|
9
|
-
transition: all 0.3s;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.pops[type-value="drawer"][direction="top"] {
|
|
13
|
-
width: 100%;
|
|
14
|
-
left: 0;
|
|
15
|
-
right: 0;
|
|
16
|
-
top: 0;
|
|
17
|
-
}
|
|
18
|
-
.pops[type-value="drawer"][direction="bottom"] {
|
|
19
|
-
width: 100%;
|
|
20
|
-
left: 0;
|
|
21
|
-
right: 0;
|
|
22
|
-
bottom: 0;
|
|
23
|
-
}
|
|
24
|
-
.pops[type-value="drawer"][direction="left"] {
|
|
25
|
-
height: 100%;
|
|
26
|
-
top: 0;
|
|
27
|
-
bottom: 0;
|
|
28
|
-
left: 0;
|
|
29
|
-
}
|
|
30
|
-
.pops[type-value="drawer"][direction="right"] {
|
|
31
|
-
height: 100%;
|
|
32
|
-
top: 0;
|
|
33
|
-
bottom: 0;
|
|
34
|
-
right: 0;
|
|
35
|
-
}
|
|
@@ -1,260 +0,0 @@
|
|
|
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 type { PopsType } from "../../types/main";
|
|
6
|
-
import { popsDOMUtils } from "../../utils/PopsDOMUtils";
|
|
7
|
-
import { popsUtils } from "../../utils/PopsUtils";
|
|
8
|
-
import { PopsDrawerConfig } from "./config";
|
|
9
|
-
import type { PopsDrawerDetails } from "./types";
|
|
10
|
-
|
|
11
|
-
export const PopsDrawer = {
|
|
12
|
-
init(details: PopsDrawerDetails) {
|
|
13
|
-
const guid = popsUtils.getRandomGUID();
|
|
14
|
-
// 设置当前类型
|
|
15
|
-
const popsType: PopsType = "drawer";
|
|
16
|
-
let config = PopsDrawerConfig();
|
|
17
|
-
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
18
|
-
config = popsUtils.assign(config, details);
|
|
19
|
-
config = PopsHandler.handleOnly(popsType, config);
|
|
20
|
-
|
|
21
|
-
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
|
|
22
|
-
PopsHandler.handleInit($shadowRoot, [
|
|
23
|
-
{
|
|
24
|
-
name: "index",
|
|
25
|
-
css: PopsCSS.index,
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
name: "ninePalaceGridPosition",
|
|
29
|
-
css: PopsCSS.ninePalaceGridPosition,
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
name: "scrollbar",
|
|
33
|
-
css: PopsCSS.scrollbar,
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
name: "button",
|
|
37
|
-
css: PopsCSS.button,
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
name: "anim",
|
|
41
|
-
css: PopsCSS.anim,
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
name: "common",
|
|
45
|
-
css: PopsCSS.common,
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
name: "drawerCSS",
|
|
49
|
-
css: PopsCSS.drawerCSS,
|
|
50
|
-
},
|
|
51
|
-
]);
|
|
52
|
-
|
|
53
|
-
// 先把z-index提取出来
|
|
54
|
-
let zIndex = PopsHandler.handleZIndex(config.zIndex);
|
|
55
|
-
let maskHTML = PopsElementHandler.createMask(guid, zIndex);
|
|
56
|
-
|
|
57
|
-
let headerBtnHTML = PopsElementHandler.createHeader(popsType, config);
|
|
58
|
-
let bottomBtnHTML = PopsElementHandler.createBottom(popsType, config);
|
|
59
|
-
let { headerStyle, headerPStyle } = PopsElementHandler.createHeaderStyle(
|
|
60
|
-
popsType,
|
|
61
|
-
config
|
|
62
|
-
);
|
|
63
|
-
let { contentStyle, contentPStyle } = PopsElementHandler.createContentStyle(
|
|
64
|
-
popsType,
|
|
65
|
-
config
|
|
66
|
-
);
|
|
67
|
-
let animHTML = PopsElementHandler.createAnim(
|
|
68
|
-
guid,
|
|
69
|
-
popsType,
|
|
70
|
-
config,
|
|
71
|
-
/*html*/ `
|
|
72
|
-
${
|
|
73
|
-
config.title.enable
|
|
74
|
-
? /*html*/ `<div class="pops-title pops-${popsType}-title" style="${headerStyle}">${
|
|
75
|
-
config.title.html
|
|
76
|
-
? config.title.text
|
|
77
|
-
: /*html*/ `<p pops class="pops-${popsType}-title-text" style="width: 100%;text-align: ${config.title.position};${headerPStyle}">${config.title.text}</p>`
|
|
78
|
-
}${headerBtnHTML}</div>`
|
|
79
|
-
: ""
|
|
80
|
-
}
|
|
81
|
-
<div class="pops-content pops-${popsType}-content" style="${contentStyle}">${
|
|
82
|
-
config.content.html
|
|
83
|
-
? config.content.text
|
|
84
|
-
: `<p pops class="pops-${popsType}-content-text" style="${contentPStyle}">${config.content.text}</p>`
|
|
85
|
-
}</div>${bottomBtnHTML}`,
|
|
86
|
-
bottomBtnHTML,
|
|
87
|
-
zIndex
|
|
88
|
-
);
|
|
89
|
-
/**
|
|
90
|
-
* 弹窗的主元素,包括动画层
|
|
91
|
-
*/
|
|
92
|
-
let $anim = PopsElementHandler.parseElement<HTMLDivElement>(animHTML);
|
|
93
|
-
let {
|
|
94
|
-
popsElement,
|
|
95
|
-
headerCloseBtnElement,
|
|
96
|
-
btnCancelElement,
|
|
97
|
-
btnOkElement,
|
|
98
|
-
btnOtherElement,
|
|
99
|
-
} = PopsHandler.handleQueryElement($anim, popsType);
|
|
100
|
-
let $pops = popsElement!;
|
|
101
|
-
let $headerCloseBtn = headerCloseBtnElement!;
|
|
102
|
-
let $btnCancel = btnCancelElement!;
|
|
103
|
-
let $btnOk = btnOkElement!;
|
|
104
|
-
let $btnOther = btnOtherElement!;
|
|
105
|
-
/**
|
|
106
|
-
* 遮罩层元素
|
|
107
|
-
*/
|
|
108
|
-
let $mask: HTMLDivElement | null = null;
|
|
109
|
-
/**
|
|
110
|
-
* 已创建的元素列表
|
|
111
|
-
*/
|
|
112
|
-
let elementList: HTMLElement[] = [$anim];
|
|
113
|
-
|
|
114
|
-
if (config.mask.enable) {
|
|
115
|
-
let _handleMask_ = PopsHandler.handleMask({
|
|
116
|
-
type: popsType,
|
|
117
|
-
guid: guid,
|
|
118
|
-
config: config,
|
|
119
|
-
animElement: $anim,
|
|
120
|
-
maskHTML: maskHTML,
|
|
121
|
-
});
|
|
122
|
-
$mask = _handleMask_.maskElement;
|
|
123
|
-
elementList.push($mask);
|
|
124
|
-
}
|
|
125
|
-
let eventDetails = PopsHandler.handleEventDetails(
|
|
126
|
-
guid,
|
|
127
|
-
$shadowContainer,
|
|
128
|
-
$shadowRoot,
|
|
129
|
-
popsType,
|
|
130
|
-
$anim,
|
|
131
|
-
$pops,
|
|
132
|
-
$mask!,
|
|
133
|
-
config
|
|
134
|
-
);
|
|
135
|
-
/* 处理方向 */
|
|
136
|
-
|
|
137
|
-
$pops.setAttribute("direction", config.direction);
|
|
138
|
-
|
|
139
|
-
/* 处理border-radius */
|
|
140
|
-
/* 处理动画前的宽高 */
|
|
141
|
-
if (config.direction === "top") {
|
|
142
|
-
$pops.style.setProperty("height", "0");
|
|
143
|
-
|
|
144
|
-
$pops.style.setProperty(
|
|
145
|
-
"border-radius",
|
|
146
|
-
`0px 0px ${config.borderRadius}px ${config.borderRadius}px`
|
|
147
|
-
);
|
|
148
|
-
} else if (config.direction === "bottom") {
|
|
149
|
-
$pops.style.setProperty("height", "0");
|
|
150
|
-
|
|
151
|
-
$pops.style.setProperty(
|
|
152
|
-
"border-radius",
|
|
153
|
-
`${config.borderRadius}px ${config.borderRadius}px 0px 0px`
|
|
154
|
-
);
|
|
155
|
-
} else if (config.direction === "left") {
|
|
156
|
-
$pops.style.setProperty("width", "0");
|
|
157
|
-
|
|
158
|
-
$pops.style.setProperty(
|
|
159
|
-
"border-radius",
|
|
160
|
-
`0px ${config.borderRadius}px 0px ${config.borderRadius}px`
|
|
161
|
-
);
|
|
162
|
-
} else if (config.direction === "right") {
|
|
163
|
-
$pops.style.setProperty("width", "0");
|
|
164
|
-
|
|
165
|
-
$pops.style.setProperty(
|
|
166
|
-
"border-radius",
|
|
167
|
-
`${config.borderRadius}px 0px ${config.borderRadius}px 0px`
|
|
168
|
-
);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
/* 按下Esc键触发关闭 */
|
|
172
|
-
if (config.closeOnPressEscape) {
|
|
173
|
-
PopsHandler.handleKeyboardEvent("Escape", [], function () {
|
|
174
|
-
eventDetails.close();
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
/* 待处理的点击事件列表 */
|
|
178
|
-
let needHandleClickEventList = [
|
|
179
|
-
{
|
|
180
|
-
type: "close",
|
|
181
|
-
ele: $headerCloseBtn,
|
|
182
|
-
},
|
|
183
|
-
{
|
|
184
|
-
type: "cancel",
|
|
185
|
-
ele: $btnCancel,
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
type: "ok",
|
|
189
|
-
ele: $btnOk,
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
type: "other",
|
|
193
|
-
ele: $btnOther,
|
|
194
|
-
},
|
|
195
|
-
];
|
|
196
|
-
needHandleClickEventList.forEach((item) => {
|
|
197
|
-
PopsHandler.handleClickEvent(
|
|
198
|
-
item.type as "close" | "cancel" | "ok" | "other",
|
|
199
|
-
item.ele,
|
|
200
|
-
eventDetails,
|
|
201
|
-
(_eventDetails_) => {
|
|
202
|
-
if (typeof (config.btn as any)[item.type].callback === "function") {
|
|
203
|
-
(config.btn as any)[item.type].callback(_eventDetails_);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
);
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
/* 先隐藏,然后根据config.openDelay来显示 */
|
|
210
|
-
elementList.forEach((element) => {
|
|
211
|
-
element.style.setProperty("display", "none");
|
|
212
|
-
if (["top"].includes(config.direction)) {
|
|
213
|
-
$pops.style.setProperty("height", config.size.toString());
|
|
214
|
-
|
|
215
|
-
$pops.style.setProperty("transform", "translateY(-100%)");
|
|
216
|
-
} else if (["bottom"].includes(config.direction)) {
|
|
217
|
-
$pops.style.setProperty("height", config.size.toString());
|
|
218
|
-
|
|
219
|
-
$pops.style.setProperty("transform", "translateY(100%)");
|
|
220
|
-
} else if (["left"].includes(config.direction)) {
|
|
221
|
-
$pops.style.setProperty("width", config.size.toString());
|
|
222
|
-
|
|
223
|
-
$pops.style.setProperty("transform", "translateX(-100%)");
|
|
224
|
-
} else if (["right"].includes(config.direction)) {
|
|
225
|
-
$pops.style.setProperty("width", config.size.toString());
|
|
226
|
-
|
|
227
|
-
$pops.style.setProperty("transform", "translateX(100%)");
|
|
228
|
-
}
|
|
229
|
-
element.style.setProperty("display", "");
|
|
230
|
-
});
|
|
231
|
-
/* 创建到页面中 */
|
|
232
|
-
|
|
233
|
-
popsDOMUtils.append($shadowRoot, elementList);
|
|
234
|
-
if (typeof config.beforeAppendToPageCallBack === "function") {
|
|
235
|
-
config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
popsDOMUtils.appendBody($shadowContainer);
|
|
239
|
-
popsUtils.setTimeout(() => {
|
|
240
|
-
popsUtils.setTimeout(() => {
|
|
241
|
-
$pops.style.setProperty("transform", "");
|
|
242
|
-
}, config.openDelay);
|
|
243
|
-
}, 50);
|
|
244
|
-
|
|
245
|
-
if ($mask != null) {
|
|
246
|
-
$anim.after($mask);
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
PopsHandler.handlePush(popsType, {
|
|
250
|
-
guid: guid,
|
|
251
|
-
animElement: $anim,
|
|
252
|
-
popsElement: $pops,
|
|
253
|
-
maskElement: $mask!,
|
|
254
|
-
$shadowContainer: $shadowContainer,
|
|
255
|
-
$shadowRoot: $shadowRoot,
|
|
256
|
-
});
|
|
257
|
-
let result = PopsHandler.handleResultDetails(eventDetails);
|
|
258
|
-
return result;
|
|
259
|
-
},
|
|
260
|
-
};
|