@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,719 +0,0 @@
|
|
|
1
|
-
import type { PopsAlertDetails } from "../components/alert/types";
|
|
2
|
-
import type { PopsConfirmDetails } from "../components/confirm/types";
|
|
3
|
-
import type { PopsDrawerDetails } from "../components/drawer/types";
|
|
4
|
-
import type { PopsFolderDetails } from "../components/folder/types";
|
|
5
|
-
import type { PopsIframeDetails } from "../components/iframe/types";
|
|
6
|
-
import type { PopsLoadingDetails } from "../components/loading/types";
|
|
7
|
-
import type { PopsPanelDetails } from "../components/panel/types";
|
|
8
|
-
import type { PopsPromptDetails } from "../components/prompt/types/index";
|
|
9
|
-
import { PopsCore } from "../PopsCore";
|
|
10
|
-
import { PopsAnimation } from "../PopsAnimation";
|
|
11
|
-
import { PopsInstData } from "../PopsInst";
|
|
12
|
-
import type { PopsCommonConfig } from "../types/components";
|
|
13
|
-
import { PopsEventDetails, PopsHandlerEventDetails } from "../types/event";
|
|
14
|
-
import { PopsInstCommonConfig } from "../types/inst";
|
|
15
|
-
import type {
|
|
16
|
-
PopsInstStoreType,
|
|
17
|
-
PopsType,
|
|
18
|
-
PopsSupportAnimDetailsType,
|
|
19
|
-
PopsSupportOnlyDetails,
|
|
20
|
-
} from "../types/main";
|
|
21
|
-
import { popsDOMUtils } from "../utils/PopsDOMUtils";
|
|
22
|
-
import { PopsInstanceUtils } from "../utils/PopsInstanceUtils";
|
|
23
|
-
import { popsUtils } from "../utils/PopsUtils";
|
|
24
|
-
|
|
25
|
-
export const PopsHandler = {
|
|
26
|
-
/**
|
|
27
|
-
* 创建shadow
|
|
28
|
-
*/
|
|
29
|
-
handlerShadow(config: Pick<PopsCommonConfig, "useShadowRoot">) {
|
|
30
|
-
let $shadowContainer = document.createElement("div");
|
|
31
|
-
$shadowContainer.className = "pops-shadow-container";
|
|
32
|
-
if (config.useShadowRoot) {
|
|
33
|
-
let $shadowRoot = $shadowContainer.attachShadow({ mode: "open" });
|
|
34
|
-
return {
|
|
35
|
-
$shadowContainer,
|
|
36
|
-
$shadowRoot,
|
|
37
|
-
};
|
|
38
|
-
} else {
|
|
39
|
-
return {
|
|
40
|
-
$shadowContainer,
|
|
41
|
-
$shadowRoot: $shadowContainer,
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
/**
|
|
46
|
-
* 处理初始化
|
|
47
|
-
* @param $styleParent style元素的父元素
|
|
48
|
-
* @param css 添加进ShadowRoot的CSS
|
|
49
|
-
*/
|
|
50
|
-
handleInit(
|
|
51
|
-
$styleParent?: ShadowRoot | HTMLElement,
|
|
52
|
-
css?:
|
|
53
|
-
| string
|
|
54
|
-
| string[]
|
|
55
|
-
| {
|
|
56
|
-
name?: string;
|
|
57
|
-
css: string;
|
|
58
|
-
}[]
|
|
59
|
-
) {
|
|
60
|
-
PopsAnimation.init();
|
|
61
|
-
if (!arguments.length) {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
if ($styleParent == null) {
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
if (css == null) {
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
if (typeof css === "string") {
|
|
72
|
-
if (css.trim() === "") {
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
css = [
|
|
76
|
-
{
|
|
77
|
-
css: css,
|
|
78
|
-
},
|
|
79
|
-
];
|
|
80
|
-
} else {
|
|
81
|
-
css = css.map((item) => {
|
|
82
|
-
if (typeof item === "string") {
|
|
83
|
-
return {
|
|
84
|
-
css: item,
|
|
85
|
-
};
|
|
86
|
-
} else {
|
|
87
|
-
return item;
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
for (const cssItem of css) {
|
|
92
|
-
let $css = popsDOMUtils.createElement(
|
|
93
|
-
"style",
|
|
94
|
-
{},
|
|
95
|
-
{
|
|
96
|
-
"data-type": "PopsHandler.handleInit",
|
|
97
|
-
}
|
|
98
|
-
);
|
|
99
|
-
$css.textContent = cssItem.css;
|
|
100
|
-
if (typeof cssItem.name === "string") {
|
|
101
|
-
$css.setAttribute("data-name", cssItem.name);
|
|
102
|
-
}
|
|
103
|
-
$styleParent.appendChild($css);
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
/**
|
|
107
|
-
* 处理遮罩层
|
|
108
|
-
*
|
|
109
|
-
* + 设置遮罩层的点击事件
|
|
110
|
-
* @param details 传递的配置
|
|
111
|
-
*/
|
|
112
|
-
handleMask(
|
|
113
|
-
details = {} as {
|
|
114
|
-
type:
|
|
115
|
-
| "alert"
|
|
116
|
-
| "confirm"
|
|
117
|
-
| "prompt"
|
|
118
|
-
| "loading"
|
|
119
|
-
| "iframe"
|
|
120
|
-
| "drawer"
|
|
121
|
-
| "folder"
|
|
122
|
-
| "panel";
|
|
123
|
-
guid: string;
|
|
124
|
-
config:
|
|
125
|
-
| Required<PopsAlertDetails>
|
|
126
|
-
| Required<PopsLoadingDetails>
|
|
127
|
-
| Required<PopsIframeDetails>
|
|
128
|
-
| Required<PopsDrawerDetails>
|
|
129
|
-
| Required<PopsPanelDetails>
|
|
130
|
-
| Required<PopsFolderDetails>;
|
|
131
|
-
animElement: HTMLElement;
|
|
132
|
-
maskHTML: string;
|
|
133
|
-
}
|
|
134
|
-
) {
|
|
135
|
-
let result = {
|
|
136
|
-
maskElement: popsDOMUtils.parseTextToDOM<HTMLDivElement>(
|
|
137
|
-
details.maskHTML
|
|
138
|
-
),
|
|
139
|
-
};
|
|
140
|
-
let isMaskClick = false;
|
|
141
|
-
/**
|
|
142
|
-
* 点击其它区域的事件
|
|
143
|
-
* @param event
|
|
144
|
-
*/
|
|
145
|
-
function clickEvent(event: MouseEvent | PointerEvent) {
|
|
146
|
-
popsDOMUtils.preventEvent(event);
|
|
147
|
-
// 获取该类型实例存储列表
|
|
148
|
-
let targetInst = PopsInstData[details.type];
|
|
149
|
-
function originalRun() {
|
|
150
|
-
if (details.config.mask!.clickEvent!.toClose) {
|
|
151
|
-
/* 关闭 */
|
|
152
|
-
return PopsInstanceUtils.close(
|
|
153
|
-
details.type,
|
|
154
|
-
targetInst,
|
|
155
|
-
details.guid,
|
|
156
|
-
details.config,
|
|
157
|
-
details.animElement
|
|
158
|
-
);
|
|
159
|
-
} else if (details.config.mask!.clickEvent!.toHide) {
|
|
160
|
-
/* 隐藏 */
|
|
161
|
-
return PopsInstanceUtils.hide(
|
|
162
|
-
details.type,
|
|
163
|
-
targetInst,
|
|
164
|
-
details.guid,
|
|
165
|
-
details.config,
|
|
166
|
-
details.animElement,
|
|
167
|
-
result.maskElement
|
|
168
|
-
);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
if (typeof details.config.mask.clickCallBack === "function") {
|
|
172
|
-
details.config.mask.clickCallBack(originalRun, details.config);
|
|
173
|
-
} else {
|
|
174
|
-
originalRun();
|
|
175
|
-
}
|
|
176
|
-
return false;
|
|
177
|
-
}
|
|
178
|
-
// 判断是否启用了遮罩层点击动作
|
|
179
|
-
if (
|
|
180
|
-
details.config.mask.clickEvent!.toClose ||
|
|
181
|
-
details.config.mask.clickEvent!.toHide
|
|
182
|
-
) {
|
|
183
|
-
/**
|
|
184
|
-
* 判断点击的元素是否是动画层的元素
|
|
185
|
-
* @param element
|
|
186
|
-
* @returns
|
|
187
|
-
*/
|
|
188
|
-
function isAnimElement(element: HTMLElement) {
|
|
189
|
-
return Boolean(
|
|
190
|
-
element?.localName?.toLowerCase() === "div" &&
|
|
191
|
-
element.className &&
|
|
192
|
-
element.className === "pops-anim" &&
|
|
193
|
-
element.hasAttribute("anim")
|
|
194
|
-
);
|
|
195
|
-
}
|
|
196
|
-
/* 判断按下的元素是否是pops-anim */
|
|
197
|
-
popsDOMUtils.on(
|
|
198
|
-
details.animElement,
|
|
199
|
-
["touchstart", "mousedown"],
|
|
200
|
-
void 0,
|
|
201
|
-
(event) => {
|
|
202
|
-
let $click = event.composedPath()[0] as HTMLElement;
|
|
203
|
-
isMaskClick = isAnimElement($click);
|
|
204
|
-
}
|
|
205
|
-
);
|
|
206
|
-
/* 如果有动画层,在动画层上监听点击事件 */
|
|
207
|
-
popsDOMUtils.on<MouseEvent | PointerEvent>(
|
|
208
|
-
details.animElement,
|
|
209
|
-
"click",
|
|
210
|
-
void 0,
|
|
211
|
-
(event) => {
|
|
212
|
-
let $click = event.composedPath()[0] as HTMLElement;
|
|
213
|
-
if (isAnimElement($click) && isMaskClick) {
|
|
214
|
-
return clickEvent(event);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
);
|
|
218
|
-
/* 在遮罩层监听点击事件 */
|
|
219
|
-
/* 如果有动画层,那么该点击事件触发不了 */
|
|
220
|
-
popsDOMUtils.on<MouseEvent | PointerEvent>(
|
|
221
|
-
result.maskElement,
|
|
222
|
-
"click",
|
|
223
|
-
void 0,
|
|
224
|
-
(event) => {
|
|
225
|
-
isMaskClick = true;
|
|
226
|
-
clickEvent(event);
|
|
227
|
-
}
|
|
228
|
-
);
|
|
229
|
-
}
|
|
230
|
-
return result;
|
|
231
|
-
},
|
|
232
|
-
/**
|
|
233
|
-
* 处理获取元素
|
|
234
|
-
* @param animElement
|
|
235
|
-
* @param type
|
|
236
|
-
*/
|
|
237
|
-
handleQueryElement(
|
|
238
|
-
animElement: HTMLDivElement,
|
|
239
|
-
type: PopsSupportAnimDetailsType
|
|
240
|
-
) {
|
|
241
|
-
return {
|
|
242
|
-
/**
|
|
243
|
-
* 主元素
|
|
244
|
-
*/
|
|
245
|
-
popsElement:
|
|
246
|
-
animElement.querySelector<HTMLDivElement>(".pops[type-value")!,
|
|
247
|
-
/**
|
|
248
|
-
* 确认按钮
|
|
249
|
-
*/
|
|
250
|
-
btnOkElement: animElement.querySelector<HTMLDivElement>(
|
|
251
|
-
`.pops-${type}-btn-ok`
|
|
252
|
-
)!,
|
|
253
|
-
/**
|
|
254
|
-
* 取消按钮
|
|
255
|
-
*/
|
|
256
|
-
btnCancelElement: animElement.querySelector<HTMLDivElement>(
|
|
257
|
-
`.pops-${type}-btn-cancel`
|
|
258
|
-
)!,
|
|
259
|
-
/**
|
|
260
|
-
* 其它按钮
|
|
261
|
-
*/
|
|
262
|
-
btnOtherElement: animElement.querySelector<HTMLDivElement>(
|
|
263
|
-
`.pops-${type}-btn-other`
|
|
264
|
-
)!,
|
|
265
|
-
/**
|
|
266
|
-
* 标题元素
|
|
267
|
-
*/
|
|
268
|
-
titleElement: animElement.querySelector<HTMLDivElement>(
|
|
269
|
-
`.pops-${type}-title`
|
|
270
|
-
)!,
|
|
271
|
-
/**
|
|
272
|
-
* 输入框元素
|
|
273
|
-
*/
|
|
274
|
-
inputElement: animElement.querySelector<HTMLTextAreaElement>(
|
|
275
|
-
`.pops-${type}-content textarea[pops]`
|
|
276
|
-
)
|
|
277
|
-
? animElement.querySelector<HTMLTextAreaElement>(
|
|
278
|
-
`.pops-${type}-content textarea[pops]`
|
|
279
|
-
)!
|
|
280
|
-
: animElement.querySelector<HTMLInputElement>(
|
|
281
|
-
`.pops-${type}-content input[pops]`
|
|
282
|
-
)!,
|
|
283
|
-
/**
|
|
284
|
-
* 顶部按钮控制层元素
|
|
285
|
-
*/
|
|
286
|
-
headerControlsElement: animElement.querySelector<HTMLDivElement>(
|
|
287
|
-
".pops-header-controls"
|
|
288
|
-
)!,
|
|
289
|
-
/**
|
|
290
|
-
* iframe元素
|
|
291
|
-
*/
|
|
292
|
-
iframeElement:
|
|
293
|
-
animElement.querySelector<HTMLIFrameElement>("iframe[pops]")!,
|
|
294
|
-
/**
|
|
295
|
-
* 加载中元素
|
|
296
|
-
*/
|
|
297
|
-
loadingElement:
|
|
298
|
-
animElement.querySelector<HTMLDivElement>(".pops-loading")!,
|
|
299
|
-
/**
|
|
300
|
-
* 内容元素
|
|
301
|
-
*/
|
|
302
|
-
contentElement: animElement.querySelector<HTMLDivElement>(
|
|
303
|
-
`.pops-${type}-content`
|
|
304
|
-
)!,
|
|
305
|
-
/**
|
|
306
|
-
* 内容侧边栏容器元素
|
|
307
|
-
*/
|
|
308
|
-
contentAsideElement: animElement.querySelector<HTMLDivElement>(
|
|
309
|
-
`.pops-${type}-content aside.pops-${type}-aside`
|
|
310
|
-
)!,
|
|
311
|
-
/**
|
|
312
|
-
* 内容主要区域容器元素
|
|
313
|
-
*/
|
|
314
|
-
contentSectionContainerElement: animElement.querySelector<HTMLDivElement>(
|
|
315
|
-
`.pops-${type}-content section.pops-${type}-container`
|
|
316
|
-
)!,
|
|
317
|
-
/**
|
|
318
|
-
* 内容加载中元素
|
|
319
|
-
*/
|
|
320
|
-
contentLoadingElement: animElement.querySelector<HTMLDivElement>(
|
|
321
|
-
`.pops-${type}-content-global-loading`
|
|
322
|
-
)!,
|
|
323
|
-
/**
|
|
324
|
-
* 顶部缩小按钮
|
|
325
|
-
*/
|
|
326
|
-
headerMinBtnElement: animElement.querySelector<HTMLDivElement>(
|
|
327
|
-
".pops-header-control[data-type='min']"
|
|
328
|
-
)!,
|
|
329
|
-
/**
|
|
330
|
-
* 顶部放大按钮
|
|
331
|
-
*/
|
|
332
|
-
headerMaxBtnElement: animElement.querySelector<HTMLDivElement>(
|
|
333
|
-
".pops-header-control[data-type='max']"
|
|
334
|
-
)!,
|
|
335
|
-
/**
|
|
336
|
-
* 顶部恢复原样按钮
|
|
337
|
-
*/
|
|
338
|
-
headerMiseBtnElement: animElement.querySelector<HTMLDivElement>(
|
|
339
|
-
".pops-header-control[data-type='mise']"
|
|
340
|
-
)!,
|
|
341
|
-
/**
|
|
342
|
-
* 顶部关闭按钮
|
|
343
|
-
*/
|
|
344
|
-
headerCloseBtnElement: animElement.querySelector<HTMLDivElement>(
|
|
345
|
-
".pops-header-control[data-type='close']"
|
|
346
|
-
)!,
|
|
347
|
-
/**
|
|
348
|
-
* 文件夹列表元素
|
|
349
|
-
*/
|
|
350
|
-
folderListElement:
|
|
351
|
-
animElement.querySelector<HTMLDivElement>(".pops-folder-list")!,
|
|
352
|
-
/**
|
|
353
|
-
* 文件夹列表顶部元素
|
|
354
|
-
*/
|
|
355
|
-
folderListHeaderElement: animElement.querySelector<HTMLDivElement>(
|
|
356
|
-
".pops-folder-list .pops-folder-list-table__header-div"
|
|
357
|
-
)!,
|
|
358
|
-
/**
|
|
359
|
-
* 文件夹列表行元素
|
|
360
|
-
*/
|
|
361
|
-
folderListHeaderRowElement:
|
|
362
|
-
animElement.querySelector<HTMLTableRowElement>(
|
|
363
|
-
".pops-folder-list .pops-folder-list-table__header-div .pops-folder-list-table__header-row"
|
|
364
|
-
)!,
|
|
365
|
-
/**
|
|
366
|
-
* 文件夹列表tbody元素
|
|
367
|
-
*/
|
|
368
|
-
folderListBodyElement: animElement.querySelector<HTMLTableElement>(
|
|
369
|
-
".pops-folder-list .pops-folder-list-table__body-div tbody"
|
|
370
|
-
)!,
|
|
371
|
-
/**
|
|
372
|
-
* 文件夹列表primary元素
|
|
373
|
-
*/
|
|
374
|
-
folderFileListBreadcrumbPrimaryElement:
|
|
375
|
-
animElement.querySelector<HTMLDivElement>(
|
|
376
|
-
".pops-folder-list .pops-folder-file-list-breadcrumb-primary"
|
|
377
|
-
)!,
|
|
378
|
-
/**
|
|
379
|
-
* 文件夹排序按钮-文件名
|
|
380
|
-
*/
|
|
381
|
-
folderListSortFileNameElement: animElement.querySelector<HTMLDivElement>(
|
|
382
|
-
'.pops-folder-list-table__sort[data-sort="fileName"]'
|
|
383
|
-
)!,
|
|
384
|
-
/**
|
|
385
|
-
* 文件夹排序按钮-修改时间
|
|
386
|
-
*/
|
|
387
|
-
folderListSortLatestTimeElement:
|
|
388
|
-
animElement.querySelector<HTMLDivElement>(
|
|
389
|
-
'.pops-folder-list-table__sort[data-sort="latestTime"]'
|
|
390
|
-
)!,
|
|
391
|
-
/**
|
|
392
|
-
* 文件夹排序按钮-文件大小
|
|
393
|
-
*/
|
|
394
|
-
folderListSortFileSizeElement: animElement.querySelector<HTMLDivElement>(
|
|
395
|
-
'.pops-folder-list-table__sort[data-sort="fileSize"]'
|
|
396
|
-
)!,
|
|
397
|
-
};
|
|
398
|
-
},
|
|
399
|
-
/**
|
|
400
|
-
* 获取事件配置
|
|
401
|
-
* @param guid
|
|
402
|
-
* @param $shadowContainer
|
|
403
|
-
* @param $shadowRoot
|
|
404
|
-
* @param mode 当前弹窗类型
|
|
405
|
-
* @param animElement 动画层
|
|
406
|
-
* @param popsElement 主元素
|
|
407
|
-
* @param maskElement 遮罩层
|
|
408
|
-
* @param config 当前配置
|
|
409
|
-
*/
|
|
410
|
-
handleEventDetails(
|
|
411
|
-
guid: string,
|
|
412
|
-
$shadowContainer: HTMLDivElement,
|
|
413
|
-
$shadowRoot: ShadowRoot | HTMLElement,
|
|
414
|
-
mode: PopsInstStoreType,
|
|
415
|
-
animElement: HTMLDivElement,
|
|
416
|
-
popsElement: HTMLDivElement,
|
|
417
|
-
maskElement: HTMLDivElement,
|
|
418
|
-
config:
|
|
419
|
-
| PopsAlertDetails
|
|
420
|
-
| PopsDrawerDetails
|
|
421
|
-
| PopsPromptDetails
|
|
422
|
-
| PopsConfirmDetails
|
|
423
|
-
| PopsIframeDetails
|
|
424
|
-
| PopsLoadingDetails
|
|
425
|
-
| PopsPanelDetails
|
|
426
|
-
| PopsFolderDetails
|
|
427
|
-
): PopsEventDetails {
|
|
428
|
-
return {
|
|
429
|
-
$shadowContainer: $shadowContainer,
|
|
430
|
-
$shadowRoot: $shadowRoot,
|
|
431
|
-
element: animElement,
|
|
432
|
-
animElement: animElement,
|
|
433
|
-
popsElement: popsElement,
|
|
434
|
-
maskElement: maskElement,
|
|
435
|
-
mode: mode,
|
|
436
|
-
guid: guid,
|
|
437
|
-
close() {
|
|
438
|
-
return PopsInstanceUtils.close(
|
|
439
|
-
mode,
|
|
440
|
-
PopsInstData[mode],
|
|
441
|
-
guid,
|
|
442
|
-
config,
|
|
443
|
-
animElement
|
|
444
|
-
);
|
|
445
|
-
},
|
|
446
|
-
hide() {
|
|
447
|
-
return PopsInstanceUtils.hide(
|
|
448
|
-
mode,
|
|
449
|
-
PopsInstData[mode],
|
|
450
|
-
guid,
|
|
451
|
-
config,
|
|
452
|
-
animElement,
|
|
453
|
-
maskElement
|
|
454
|
-
);
|
|
455
|
-
},
|
|
456
|
-
show() {
|
|
457
|
-
return PopsInstanceUtils.show(
|
|
458
|
-
mode,
|
|
459
|
-
PopsInstData[mode],
|
|
460
|
-
guid,
|
|
461
|
-
config,
|
|
462
|
-
animElement,
|
|
463
|
-
maskElement
|
|
464
|
-
);
|
|
465
|
-
},
|
|
466
|
-
};
|
|
467
|
-
},
|
|
468
|
-
/**
|
|
469
|
-
* 获取loading的事件配置
|
|
470
|
-
* @param guid
|
|
471
|
-
* @param mode 当前弹窗类型
|
|
472
|
-
* @param animElement 动画层
|
|
473
|
-
* @param popsElement 主元素
|
|
474
|
-
* @param maskElement 遮罩层
|
|
475
|
-
* @param config 当前配置
|
|
476
|
-
*/
|
|
477
|
-
handleLoadingEventDetails(
|
|
478
|
-
guid: string,
|
|
479
|
-
mode: "loading",
|
|
480
|
-
animElement: HTMLDivElement,
|
|
481
|
-
popsElement: HTMLDivElement,
|
|
482
|
-
maskElement: HTMLDivElement,
|
|
483
|
-
config:
|
|
484
|
-
| PopsAlertDetails
|
|
485
|
-
| PopsDrawerDetails
|
|
486
|
-
| PopsPromptDetails
|
|
487
|
-
| PopsConfirmDetails
|
|
488
|
-
| PopsIframeDetails
|
|
489
|
-
| PopsLoadingDetails
|
|
490
|
-
| PopsPanelDetails
|
|
491
|
-
| PopsFolderDetails
|
|
492
|
-
): Omit<PopsEventDetails, "$shadowContainer" | "$shadowRoot"> {
|
|
493
|
-
return {
|
|
494
|
-
element: animElement,
|
|
495
|
-
animElement: animElement,
|
|
496
|
-
popsElement: popsElement,
|
|
497
|
-
maskElement: maskElement,
|
|
498
|
-
mode: mode,
|
|
499
|
-
guid: guid,
|
|
500
|
-
close() {
|
|
501
|
-
return PopsInstanceUtils.close(
|
|
502
|
-
mode,
|
|
503
|
-
PopsInstData[mode],
|
|
504
|
-
guid,
|
|
505
|
-
config,
|
|
506
|
-
animElement
|
|
507
|
-
);
|
|
508
|
-
},
|
|
509
|
-
hide() {
|
|
510
|
-
return PopsInstanceUtils.hide(
|
|
511
|
-
mode,
|
|
512
|
-
PopsInstData[mode],
|
|
513
|
-
guid,
|
|
514
|
-
config,
|
|
515
|
-
animElement,
|
|
516
|
-
maskElement
|
|
517
|
-
);
|
|
518
|
-
},
|
|
519
|
-
show() {
|
|
520
|
-
return PopsInstanceUtils.show(
|
|
521
|
-
mode,
|
|
522
|
-
PopsInstData[mode],
|
|
523
|
-
guid,
|
|
524
|
-
config,
|
|
525
|
-
animElement,
|
|
526
|
-
maskElement
|
|
527
|
-
);
|
|
528
|
-
},
|
|
529
|
-
};
|
|
530
|
-
},
|
|
531
|
-
/**
|
|
532
|
-
* 处理返回的配置,针对popsHandler.handleEventDetails
|
|
533
|
-
*/
|
|
534
|
-
handleResultDetails<T extends any>(details: T): Omit<T, "type" | "function"> {
|
|
535
|
-
let resultDetails = Object.assign({}, details);
|
|
536
|
-
popsUtils.delete(resultDetails, "type");
|
|
537
|
-
popsUtils.delete(resultDetails, "function");
|
|
538
|
-
return resultDetails;
|
|
539
|
-
},
|
|
540
|
-
/**
|
|
541
|
-
* 处理点击事件
|
|
542
|
-
* @param type 当前按钮类型
|
|
543
|
-
* @param $btn 按钮元素
|
|
544
|
-
* @param eventDetails 事件配置,由popsHandler.handleEventDetails创建的
|
|
545
|
-
* @param callback 点击回调
|
|
546
|
-
*/
|
|
547
|
-
handleClickEvent(
|
|
548
|
-
type: "cancel" | "close" | "ok" | "other",
|
|
549
|
-
$btn: HTMLElement,
|
|
550
|
-
eventDetails: PopsEventDetails,
|
|
551
|
-
callback: (
|
|
552
|
-
details: PopsHandlerEventDetails,
|
|
553
|
-
event: PointerEvent | MouseEvent
|
|
554
|
-
) => void
|
|
555
|
-
) {
|
|
556
|
-
popsDOMUtils.on<PointerEvent | MouseEvent>(
|
|
557
|
-
$btn,
|
|
558
|
-
"click",
|
|
559
|
-
(event) => {
|
|
560
|
-
let extraParam = {
|
|
561
|
-
type: type,
|
|
562
|
-
};
|
|
563
|
-
callback(Object.assign(eventDetails, extraParam), event);
|
|
564
|
-
},
|
|
565
|
-
{
|
|
566
|
-
capture: true,
|
|
567
|
-
}
|
|
568
|
-
);
|
|
569
|
-
},
|
|
570
|
-
/**
|
|
571
|
-
* 全局监听键盘事件
|
|
572
|
-
* @param keyName 键名|键值
|
|
573
|
-
* @param otherKeyList 组合按键,数组类型,包含ctrl、shift、alt和meta(win键或mac的cmd键)
|
|
574
|
-
* @param callback 回调函数
|
|
575
|
-
*/
|
|
576
|
-
handleKeyboardEvent(
|
|
577
|
-
keyName: string | number,
|
|
578
|
-
otherKeyList: string[] = [],
|
|
579
|
-
callback: (event: KeyboardEvent) => void
|
|
580
|
-
) {
|
|
581
|
-
let keyboardEvent = function (event: KeyboardEvent) {
|
|
582
|
-
let _keyName = event.code || event.key;
|
|
583
|
-
let _keyValue = event.charCode || event.keyCode || event.which;
|
|
584
|
-
if (otherKeyList.includes("ctrl") && !event.ctrlKey) {
|
|
585
|
-
return;
|
|
586
|
-
}
|
|
587
|
-
if (otherKeyList.includes("alt") && !event.altKey) {
|
|
588
|
-
return;
|
|
589
|
-
}
|
|
590
|
-
if (otherKeyList.includes("meta") && !event.metaKey) {
|
|
591
|
-
return;
|
|
592
|
-
}
|
|
593
|
-
if (otherKeyList.includes("shift") && !event.shiftKey) {
|
|
594
|
-
return;
|
|
595
|
-
}
|
|
596
|
-
if (typeof keyName === "string" && keyName === _keyName) {
|
|
597
|
-
callback && callback(event);
|
|
598
|
-
} else if (typeof keyName === "number" && keyName === _keyValue) {
|
|
599
|
-
callback && callback(event);
|
|
600
|
-
}
|
|
601
|
-
};
|
|
602
|
-
popsDOMUtils.on(PopsCore.globalThis, "keydown", keyboardEvent, {
|
|
603
|
-
capture: true,
|
|
604
|
-
});
|
|
605
|
-
return {
|
|
606
|
-
removeKeyboardEvent() {
|
|
607
|
-
popsDOMUtils.off(globalThis, "keydown", keyboardEvent, {
|
|
608
|
-
capture: true,
|
|
609
|
-
});
|
|
610
|
-
},
|
|
611
|
-
};
|
|
612
|
-
},
|
|
613
|
-
/**
|
|
614
|
-
* 处理prompt的点击事件
|
|
615
|
-
* @param type 触发事件类型
|
|
616
|
-
* @param inputElement 输入框
|
|
617
|
-
* @param $btn 按钮元素
|
|
618
|
-
* @param eventDetails 事件配置,由popsHandler.handleEventDetails创建的
|
|
619
|
-
* @param callback 点击回调
|
|
620
|
-
*/
|
|
621
|
-
handlePromptClickEvent(
|
|
622
|
-
type: "ok" | "close" | "cancel" | "other",
|
|
623
|
-
inputElement: HTMLInputElement | HTMLTextAreaElement,
|
|
624
|
-
$btn: HTMLElement,
|
|
625
|
-
eventDetails: PopsEventDetails,
|
|
626
|
-
callback: (
|
|
627
|
-
details: PopsEventDetails & {
|
|
628
|
-
type: any;
|
|
629
|
-
text: string;
|
|
630
|
-
},
|
|
631
|
-
event: MouseEvent | PointerEvent
|
|
632
|
-
) => void
|
|
633
|
-
) {
|
|
634
|
-
popsDOMUtils.on<MouseEvent | PointerEvent>(
|
|
635
|
-
$btn,
|
|
636
|
-
"click",
|
|
637
|
-
(event) => {
|
|
638
|
-
// 额外参数
|
|
639
|
-
let extraParam = {
|
|
640
|
-
type: type,
|
|
641
|
-
text: inputElement.value,
|
|
642
|
-
};
|
|
643
|
-
callback(Object.assign(eventDetails, extraParam), event);
|
|
644
|
-
},
|
|
645
|
-
{
|
|
646
|
-
capture: true,
|
|
647
|
-
}
|
|
648
|
-
);
|
|
649
|
-
},
|
|
650
|
-
/**
|
|
651
|
-
* 把配置的z-index配置转为数字
|
|
652
|
-
* @param zIndex
|
|
653
|
-
*/
|
|
654
|
-
handleZIndex(zIndex: number | (() => number)): number {
|
|
655
|
-
if (typeof zIndex === "function") {
|
|
656
|
-
return zIndex();
|
|
657
|
-
} else {
|
|
658
|
-
return zIndex;
|
|
659
|
-
}
|
|
660
|
-
},
|
|
661
|
-
/**
|
|
662
|
-
* 处理config.only
|
|
663
|
-
* @param type 当前弹窗类型
|
|
664
|
-
* @param config 配置
|
|
665
|
-
*/
|
|
666
|
-
handleOnly<
|
|
667
|
-
T extends Required<PopsSupportOnlyDetails[keyof PopsSupportOnlyDetails]>
|
|
668
|
-
>(type: PopsType, config: T): T {
|
|
669
|
-
if (config.only) {
|
|
670
|
-
// .loading
|
|
671
|
-
// .tooltip
|
|
672
|
-
// .rightClickMenu
|
|
673
|
-
// 单独处理
|
|
674
|
-
if (
|
|
675
|
-
type === "loading" ||
|
|
676
|
-
type === "tooltip" ||
|
|
677
|
-
type === "rightClickMenu"
|
|
678
|
-
) {
|
|
679
|
-
let inst = PopsInstData[type as keyof typeof PopsInstData];
|
|
680
|
-
if (inst) {
|
|
681
|
-
PopsInstanceUtils.removeInstance([inst], "", true);
|
|
682
|
-
}
|
|
683
|
-
} else {
|
|
684
|
-
PopsInstanceUtils.removeInstance(
|
|
685
|
-
[
|
|
686
|
-
PopsInstData.alert,
|
|
687
|
-
PopsInstData.confirm,
|
|
688
|
-
PopsInstData.prompt,
|
|
689
|
-
PopsInstData.iframe,
|
|
690
|
-
PopsInstData.drawer,
|
|
691
|
-
PopsInstData.folder,
|
|
692
|
-
PopsInstData.panel,
|
|
693
|
-
],
|
|
694
|
-
"",
|
|
695
|
-
true
|
|
696
|
-
);
|
|
697
|
-
}
|
|
698
|
-
} else {
|
|
699
|
-
// 对配置进行处理
|
|
700
|
-
// 选择配置的z-index和已有的pops实例的最大z-index值
|
|
701
|
-
let originZIndex = config.zIndex;
|
|
702
|
-
config.zIndex = () => {
|
|
703
|
-
const { zIndex: maxZIndex } = PopsInstanceUtils.getPopsMaxZIndex(
|
|
704
|
-
PopsHandler.handleZIndex(originZIndex) + 100
|
|
705
|
-
);
|
|
706
|
-
return maxZIndex;
|
|
707
|
-
};
|
|
708
|
-
}
|
|
709
|
-
return config;
|
|
710
|
-
},
|
|
711
|
-
/**
|
|
712
|
-
* 处理把已创建的元素保存到内部环境中
|
|
713
|
-
* @param type 当前弹窗类型
|
|
714
|
-
* @param value
|
|
715
|
-
*/
|
|
716
|
-
handlePush(type: PopsInstStoreType, value: PopsInstCommonConfig) {
|
|
717
|
-
PopsInstData[type].push(value);
|
|
718
|
-
},
|
|
719
|
-
};
|
package/src/svg/arrowLeft.svg
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024">
|
|
2
|
-
<path
|
|
3
|
-
d="M609.408 149.376 277.76 489.6a32 32 0 0 0 0 44.672l331.648 340.352a29.12 29.12 0 0 0 41.728 0 30.592 30.592 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.592 30.592 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0z"></path>
|
|
4
|
-
</svg>
|
package/src/svg/arrowRight.svg
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024">
|
|
2
|
-
<path
|
|
3
|
-
d="M340.864 149.312a30.592 30.592 0 0 0 0 42.752L652.736 512 340.864 831.872a30.592 30.592 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z"></path>
|
|
4
|
-
</svg>
|