@whitesev/pops 2.6.1 → 3.0.1
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 +2513 -1534
- package/dist/index.amd.js.map +1 -1
- package/dist/index.amd.min.js +1 -1
- package/dist/index.amd.min.js.map +1 -1
- package/dist/index.cjs.js +2513 -1534
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs.min.js +1 -1
- package/dist/index.cjs.min.js.map +1 -1
- package/dist/index.esm.js +2513 -1534
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/dist/index.iife.js +2513 -1534
- package/dist/index.iife.js.map +1 -1
- package/dist/index.iife.min.js +1 -1
- package/dist/index.iife.min.js.map +1 -1
- package/dist/index.system.js +2513 -1534
- package/dist/index.system.js.map +1 -1
- package/dist/index.system.min.js +1 -1
- package/dist/index.system.min.js.map +1 -1
- package/dist/index.umd.js +2513 -1534
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/dist/types/eslint.config.d.mts +2 -0
- package/dist/types/src/Pops.d.ts +449 -103
- package/dist/types/src/PopsCSS.d.ts +3 -1
- package/dist/types/src/PopsIcon.d.ts +1 -1
- package/dist/types/src/PopsInst.d.ts +2 -2
- package/dist/types/src/components/alert/defaultConfig.d.ts +2 -0
- package/dist/types/src/components/alert/index.d.ts +2 -2
- package/dist/types/src/components/alert/types/index.d.ts +4 -4
- package/dist/types/src/components/confirm/defaultConfig.d.ts +2 -0
- package/dist/types/src/components/confirm/index.d.ts +2 -2
- package/dist/types/src/components/confirm/types/index.d.ts +2 -2
- package/dist/types/src/components/drawer/defaultConfig.d.ts +2 -0
- package/dist/types/src/components/drawer/index.d.ts +2 -2
- package/dist/types/src/components/drawer/types/index.d.ts +2 -2
- package/dist/types/src/components/folder/defaultConfig.d.ts +2 -0
- package/dist/types/src/components/folder/index.d.ts +2 -2
- package/dist/types/src/components/folder/types/index.d.ts +31 -7
- package/dist/types/src/components/iframe/defaultConfig.d.ts +2 -0
- package/dist/types/src/components/iframe/index.d.ts +2 -5
- package/dist/types/src/components/iframe/types/index.d.ts +13 -42
- package/dist/types/src/components/loading/defaultConfig.d.ts +2 -0
- package/dist/types/src/components/loading/index.d.ts +2 -2
- package/dist/types/src/components/loading/types/index.d.ts +4 -4
- package/dist/types/src/components/panel/defaultConfig.d.ts +2 -0
- package/dist/types/src/components/panel/handlerComponents.d.ts +988 -49
- package/dist/types/src/components/panel/index.d.ts +2 -2
- package/dist/types/src/components/panel/types/components-button.d.ts +7 -6
- package/dist/types/src/components/panel/types/components-common.d.ts +7 -7
- package/dist/types/src/components/panel/types/components-container.d.ts +24 -0
- package/dist/types/src/components/panel/types/components-deepMenu.d.ts +14 -14
- package/dist/types/src/components/panel/types/components-input.d.ts +46 -21
- package/dist/types/src/components/panel/types/components-own.d.ts +5 -5
- package/dist/types/src/components/panel/types/components-select.d.ts +95 -36
- package/dist/types/src/components/panel/types/components-selectMultiple.d.ts +15 -20
- package/dist/types/src/components/panel/types/components-slider.d.ts +7 -8
- package/dist/types/src/components/panel/types/components-switch.d.ts +6 -6
- package/dist/types/src/components/panel/types/components-textarea.d.ts +6 -6
- package/dist/types/src/components/panel/types/index.d.ts +36 -28
- package/dist/types/src/components/prompt/defaultConfig.d.ts +2 -0
- package/dist/types/src/components/prompt/index.d.ts +2 -2
- package/dist/types/src/components/prompt/types/index.d.ts +4 -3
- package/dist/types/src/components/rightClickMenu/defaultConfig.d.ts +2 -0
- package/dist/types/src/components/rightClickMenu/index.d.ts +29 -27
- package/dist/types/src/components/rightClickMenu/types/index.d.ts +32 -11
- package/dist/types/src/components/searchSuggestion/defaultConfig.d.ts +2 -0
- package/dist/types/src/components/searchSuggestion/index.d.ts +24 -9
- package/dist/types/src/components/searchSuggestion/types/index.d.ts +15 -13
- package/dist/types/src/components/tooltip/defaultConfig.d.ts +2 -0
- package/dist/types/src/components/tooltip/index.d.ts +6 -21
- package/dist/types/src/components/tooltip/types/index.d.ts +8 -6
- package/dist/types/src/config/GlobalConfig.d.ts +3 -3
- package/dist/types/src/handler/PopsElementHandler.d.ts +6 -6
- package/dist/types/src/handler/PopsHandler.d.ts +18 -18
- package/dist/types/src/types/button.d.ts +4 -97
- package/dist/types/src/types/components.d.ts +8 -8
- package/dist/types/src/types/event.d.ts +0 -30
- package/dist/types/src/types/global.d.ts +4 -0
- package/dist/types/src/types/inst.d.ts +5 -5
- package/dist/types/src/types/main.d.ts +35 -80
- package/dist/types/src/types/mask.d.ts +18 -15
- package/dist/types/src/utils/PopsInstanceUtils.d.ts +15 -15
- package/dist/types/src/utils/PopsUtils.d.ts +4 -0
- package/package.json +12 -12
- package/src/Pops.ts +44 -44
- package/src/PopsAnimation.ts +1 -1
- package/src/PopsCSS.ts +4 -1
- package/src/PopsInst.ts +2 -2
- package/src/components/alert/{config.ts → defaultConfig.ts} +7 -7
- package/src/components/alert/index.ts +16 -18
- package/src/components/alert/types/index.ts +4 -4
- package/src/components/confirm/{config.ts → defaultConfig.ts} +11 -11
- package/src/components/confirm/index.ts +11 -13
- package/src/components/confirm/types/index.ts +3 -3
- package/src/components/drawer/{config.ts → defaultConfig.ts} +10 -10
- package/src/components/drawer/index.ts +18 -17
- package/src/components/drawer/types/index.ts +3 -3
- package/src/components/folder/{config.ts → defaultConfig.ts} +22 -18
- package/src/components/folder/index.ts +61 -60
- package/src/components/folder/types/index.ts +31 -18
- package/src/components/iframe/{config.ts → defaultConfig.ts} +2 -2
- package/src/components/iframe/index.ts +24 -29
- package/src/components/iframe/types/index.ts +13 -56
- package/src/components/loading/{config.ts → defaultConfig.ts} +3 -3
- package/src/components/loading/index.ts +13 -11
- package/src/components/loading/types/index.ts +5 -5
- package/src/components/panel/css/components-select.css +84 -0
- package/src/components/panel/defaultConfig.ts +818 -0
- package/src/components/panel/handlerComponents.ts +1431 -762
- package/src/components/panel/index.css +90 -6
- package/src/components/panel/index.ts +15 -28
- package/src/components/panel/types/components-button.ts +7 -6
- package/src/components/panel/types/components-common.ts +7 -7
- package/src/components/panel/types/components-container.ts +25 -0
- package/src/components/panel/types/components-deepMenu.ts +14 -14
- package/src/components/panel/types/components-input.ts +56 -21
- package/src/components/panel/types/components-own.ts +5 -5
- package/src/components/panel/types/components-select.ts +100 -38
- package/src/components/panel/types/components-selectMultiple.ts +16 -22
- package/src/components/panel/types/components-slider.ts +7 -8
- package/src/components/panel/types/components-switch.ts +6 -6
- package/src/components/panel/types/components-textarea.ts +6 -6
- package/src/components/panel/types/index.ts +45 -38
- package/src/components/prompt/{config.ts → defaultConfig.ts} +10 -10
- package/src/components/prompt/index.ts +13 -15
- package/src/components/prompt/types/index.ts +4 -3
- package/src/components/rightClickMenu/{config.ts → defaultConfig.ts} +20 -19
- package/src/components/rightClickMenu/index.ts +125 -108
- package/src/components/rightClickMenu/types/index.ts +36 -14
- package/src/components/searchSuggestion/{config.ts → defaultConfig.ts} +18 -11
- package/src/components/searchSuggestion/index.ts +130 -155
- package/src/components/searchSuggestion/types/index.ts +17 -15
- package/src/components/tooltip/{config.ts → defaultConfig.ts} +5 -6
- package/src/components/tooltip/index.ts +21 -21
- package/src/components/tooltip/types/index.ts +9 -7
- package/src/config/GlobalConfig.ts +2 -2
- package/src/handler/PopsElementHandler.ts +29 -30
- package/src/handler/PopsHandler.ts +43 -43
- package/src/types/button.d.ts +4 -97
- package/src/types/components.d.ts +8 -8
- package/src/types/event.d.ts +0 -30
- package/src/types/global.d.ts +4 -0
- package/src/types/inst.d.ts +5 -5
- package/src/types/main.d.ts +35 -80
- package/src/types/mask.d.ts +18 -15
- package/src/utils/PopsDOMUtils.ts +34 -34
- package/src/utils/PopsInstanceUtils.ts +129 -139
- package/src/utils/PopsUtils.ts +60 -45
- package/dist/types/src/components/alert/config.d.ts +0 -2
- package/dist/types/src/components/confirm/config.d.ts +0 -2
- package/dist/types/src/components/drawer/config.d.ts +0 -2
- package/dist/types/src/components/folder/config.d.ts +0 -2
- package/dist/types/src/components/iframe/config.d.ts +0 -2
- package/dist/types/src/components/loading/config.d.ts +0 -2
- package/dist/types/src/components/panel/config.d.ts +0 -2
- package/dist/types/src/components/panel/types/components-forms.d.ts +0 -23
- package/dist/types/src/components/prompt/config.d.ts +0 -2
- package/dist/types/src/components/rightClickMenu/config.d.ts +0 -2
- package/dist/types/src/components/searchSuggestion/config.d.ts +0 -2
- package/dist/types/src/components/tooltip/config.d.ts +0 -2
- package/src/components/panel/config.ts +0 -530
- package/src/components/panel/types/components-forms.ts +0 -24
|
@@ -1,10 +1,38 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
PopsTitleConfig,
|
|
3
3
|
PopsDragConfig,
|
|
4
|
-
|
|
4
|
+
PopsGeneralConfig,
|
|
5
5
|
PopsMoreButtonConfig,
|
|
6
6
|
} from "../../../types/components";
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* pops.folder的下载配置选项
|
|
10
|
+
*/
|
|
11
|
+
export type PopsFolderDownloadOption = {
|
|
12
|
+
/**
|
|
13
|
+
* 是否点击触发下载
|
|
14
|
+
*
|
|
15
|
+
* + true:根据设置的`mode`值来选择下载方式
|
|
16
|
+
* + false:不触发下载
|
|
17
|
+
*/
|
|
18
|
+
autoDownload: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* 触发下载后会根据提供的url链接进行下载
|
|
21
|
+
*/
|
|
22
|
+
url: string;
|
|
23
|
+
/**
|
|
24
|
+
* 下载方式
|
|
25
|
+
*
|
|
26
|
+
* + a:使用a标签进行下载
|
|
27
|
+
* + aBlank:使用a标签进行下载(添加属性`target="_blank"`)
|
|
28
|
+
* + iframe:使用iframe进行下载
|
|
29
|
+
* + open:使用window.open进行下载
|
|
30
|
+
* + openBlank:使用window.open进行下载(添加参数`_blank`)
|
|
31
|
+
*
|
|
32
|
+
* @default "aBlank"
|
|
33
|
+
*/
|
|
34
|
+
mode?: "a" | "aBlank" | "iframe" | "open" | "openBlank";
|
|
35
|
+
};
|
|
8
36
|
/**
|
|
9
37
|
* pops.folder的folder配置信息
|
|
10
38
|
*/
|
|
@@ -43,28 +71,13 @@ export interface PopsFolderDataConfig {
|
|
|
43
71
|
clickEvent?: (
|
|
44
72
|
event: MouseEvent | PointerEvent,
|
|
45
73
|
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[];
|
|
74
|
+
) => IPromise<PopsFolderDownloadOption | PopsFolderDataConfig[] | null | undefined | void>;
|
|
62
75
|
}
|
|
63
76
|
|
|
64
77
|
/**
|
|
65
78
|
* pops.folder
|
|
66
79
|
*/
|
|
67
|
-
export interface
|
|
80
|
+
export interface PopsFolderConfig extends PopsTitleConfig, PopsDragConfig, PopsMoreButtonConfig, PopsGeneralConfig {
|
|
68
81
|
/**
|
|
69
82
|
* 排序
|
|
70
83
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PopsIframeConfig } from "./types";
|
|
2
2
|
|
|
3
|
-
export const
|
|
3
|
+
export const PopsIframeDefaultConfig = (): DeepRequired<PopsIframeConfig> => {
|
|
4
4
|
return {
|
|
5
5
|
title: {
|
|
6
6
|
position: "center",
|
|
@@ -4,25 +4,24 @@ import { PopsElementHandler } from "../../handler/PopsElementHandler";
|
|
|
4
4
|
import { PopsHandler } from "../../handler/PopsHandler";
|
|
5
5
|
import { PopsCSS } from "../../PopsCSS";
|
|
6
6
|
import { PopsInstData } from "../../PopsInst";
|
|
7
|
-
import type { PopsEventConfig } from "../../types/event";
|
|
8
7
|
import { popsDOMUtils } from "../../utils/PopsDOMUtils";
|
|
9
8
|
import { PopsInstanceUtils } from "../../utils/PopsInstanceUtils";
|
|
10
9
|
import { popsUtils } from "../../utils/PopsUtils";
|
|
11
|
-
import {
|
|
12
|
-
import type {
|
|
10
|
+
import { PopsIframeDefaultConfig } from "./defaultConfig";
|
|
11
|
+
import type { PopsIframeClickEventConfig, PopsIframeConfig } from "./types";
|
|
13
12
|
import type { PopsType } from "../../types/main";
|
|
14
13
|
|
|
15
14
|
export const PopsIframe = {
|
|
16
|
-
init(
|
|
15
|
+
init(__config__: PopsIframeConfig) {
|
|
17
16
|
const guid = popsUtils.getRandomGUID();
|
|
18
17
|
// 设置当前类型
|
|
19
18
|
const popsType: PopsType = "iframe";
|
|
20
19
|
|
|
21
|
-
let config =
|
|
20
|
+
let config = PopsIframeDefaultConfig();
|
|
22
21
|
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
23
|
-
config = popsUtils.assign(config,
|
|
22
|
+
config = popsUtils.assign(config, __config__);
|
|
24
23
|
if (config.url == null) {
|
|
25
|
-
throw new
|
|
24
|
+
throw new TypeError("config.url must not be null.");
|
|
26
25
|
}
|
|
27
26
|
config = PopsHandler.handleOnly(popsType, config);
|
|
28
27
|
|
|
@@ -61,7 +60,7 @@ export const PopsIframe = {
|
|
|
61
60
|
const maskHTML = PopsElementHandler.createMask(guid, zIndex, maskExtraStyle);
|
|
62
61
|
|
|
63
62
|
const headerBtnHTML = PopsElementHandler.createHeader(popsType, config);
|
|
64
|
-
const iframeLoadingHTML = '<div class="pops-loading"></div>';
|
|
63
|
+
const iframeLoadingHTML = /*html*/ '<div class="pops-loading"></div>';
|
|
65
64
|
const titleText = config.title!.text!.trim() !== "" ? config.title.text : config.url;
|
|
66
65
|
const { headerStyle, headerPStyle } = PopsElementHandler.createHeaderStyle(popsType, config);
|
|
67
66
|
const animHTML = PopsElementHandler.createAnim(
|
|
@@ -143,35 +142,33 @@ export const PopsIframe = {
|
|
|
143
142
|
$anim,
|
|
144
143
|
$pops,
|
|
145
144
|
$mask
|
|
146
|
-
) as
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
evtConfig["iframeElement"] = $iframe!;
|
|
145
|
+
) as PopsIframeClickEventConfig;
|
|
146
|
+
// 赋值额外的$iframe参数
|
|
147
|
+
evtConfig.$iframe = $iframe!;
|
|
151
148
|
|
|
152
149
|
popsDOMUtils.on($anim, popsDOMUtils.getAnimationEndNameList(), function () {
|
|
153
|
-
|
|
150
|
+
// 动画加载完毕
|
|
154
151
|
$anim.style.width = "0%";
|
|
155
152
|
$anim.style.height = "0%";
|
|
156
153
|
});
|
|
157
154
|
|
|
158
155
|
popsDOMUtils.on($iframe, "load", () => {
|
|
159
|
-
|
|
156
|
+
// iframe加载中...
|
|
160
157
|
loadingElement?.remove();
|
|
161
158
|
$contentLoading!.style.animation = "iframeLoadingChange_85 0.3s forwards";
|
|
162
159
|
popsDOMUtils.on($contentLoading, popsDOMUtils.getAnimationEndNameList(), () => {
|
|
163
|
-
|
|
160
|
+
// 动画加载完毕就移除
|
|
164
161
|
$contentLoading!.remove();
|
|
165
162
|
});
|
|
166
163
|
|
|
167
164
|
if (config.title!.text!.trim() === "" && $iframe!.contentDocument) {
|
|
168
|
-
|
|
165
|
+
// 同域名下的才可以获取网页标题
|
|
169
166
|
$title!.querySelector<HTMLElement>("p")!.innerText = $iframe!.contentDocument.title;
|
|
170
167
|
}
|
|
171
168
|
|
|
172
169
|
config.loadEndCallBack(evtConfig);
|
|
173
170
|
});
|
|
174
|
-
|
|
171
|
+
// 创建到页面中
|
|
175
172
|
|
|
176
173
|
popsDOMUtils.append($shadowRoot, $elList);
|
|
177
174
|
if (typeof config.beforeAppendToPageCallBack === "function") {
|
|
@@ -182,7 +179,7 @@ export const PopsIframe = {
|
|
|
182
179
|
if ($mask != null) {
|
|
183
180
|
$anim.after($mask);
|
|
184
181
|
}
|
|
185
|
-
|
|
182
|
+
// 拖拽
|
|
186
183
|
if (config.drag) {
|
|
187
184
|
PopsInstanceUtils.drag($pops!, {
|
|
188
185
|
dragElement: $title!,
|
|
@@ -193,7 +190,7 @@ export const PopsIframe = {
|
|
|
193
190
|
});
|
|
194
191
|
}
|
|
195
192
|
const TYPE_MODULE = "type-module";
|
|
196
|
-
|
|
193
|
+
// 最小化按钮点击事件
|
|
197
194
|
let origin_left = "";
|
|
198
195
|
let origin_top = "";
|
|
199
196
|
let origin_is_max = false;
|
|
@@ -224,7 +221,7 @@ export const PopsIframe = {
|
|
|
224
221
|
capture: true,
|
|
225
222
|
}
|
|
226
223
|
);
|
|
227
|
-
|
|
224
|
+
// 最大化按钮点击事件
|
|
228
225
|
popsDOMUtils.on<MouseEvent | PointerEvent>(
|
|
229
226
|
headerMaxBtnElement,
|
|
230
227
|
"click",
|
|
@@ -258,9 +255,9 @@ export const PopsIframe = {
|
|
|
258
255
|
capture: true,
|
|
259
256
|
}
|
|
260
257
|
);
|
|
261
|
-
|
|
258
|
+
// 先隐藏窗口化按钮
|
|
262
259
|
headerMiseBtnElement?.style?.setProperty("display", "none");
|
|
263
|
-
|
|
260
|
+
// 复位按钮点击事件
|
|
264
261
|
popsDOMUtils.on<MouseEvent | PointerEvent>(
|
|
265
262
|
headerMiseBtnElement,
|
|
266
263
|
"click",
|
|
@@ -300,7 +297,7 @@ export const PopsIframe = {
|
|
|
300
297
|
capture: true,
|
|
301
298
|
}
|
|
302
299
|
);
|
|
303
|
-
|
|
300
|
+
// 关闭按钮点击事件
|
|
304
301
|
popsDOMUtils.on<MouseEvent | PointerEvent>(
|
|
305
302
|
headerCloseBtnElement,
|
|
306
303
|
"click",
|
|
@@ -319,11 +316,9 @@ export const PopsIframe = {
|
|
|
319
316
|
|
|
320
317
|
PopsHandler.handlePush(popsType, {
|
|
321
318
|
guid: guid,
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
maskElement: $mask!,
|
|
319
|
+
$anim: $anim,
|
|
320
|
+
$pops: $pops!,
|
|
321
|
+
$mask: $mask!,
|
|
327
322
|
$shadowContainer: $shadowContainer,
|
|
328
323
|
$shadowRoot: $shadowRoot,
|
|
329
324
|
});
|
|
@@ -1,41 +1,21 @@
|
|
|
1
|
-
import type { PopsTitleConfig, PopsDragConfig,
|
|
1
|
+
import type { PopsTitleConfig, PopsDragConfig, PopsGeneralConfig } from "../../../types/components";
|
|
2
2
|
|
|
3
3
|
import type { PopsEventConfig } from "../../../types/event";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* pops.iframe
|
|
6
|
+
* pops.iframe的按钮点击事件回调的配置参数
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
9
|
-
/**
|
|
10
|
-
* 动画元素(包裹着弹窗元素)
|
|
11
|
-
*/
|
|
12
|
-
animElement: HTMLElement;
|
|
13
|
-
/**
|
|
14
|
-
* 弹窗元素
|
|
15
|
-
*/
|
|
16
|
-
popsElement: HTMLElement;
|
|
17
|
-
/**
|
|
18
|
-
* 遮罩层元素,如果未设置,那么不存在
|
|
19
|
-
*/
|
|
20
|
-
maskElement?: HTMLElement;
|
|
8
|
+
export type PopsIframeClickEventConfig = PopsEventConfig & {
|
|
21
9
|
/**
|
|
22
10
|
* iframe元素
|
|
23
11
|
*/
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
* 使用的方法名
|
|
27
|
-
*/
|
|
28
|
-
function: "iframe";
|
|
29
|
-
/**
|
|
30
|
-
* 唯一id
|
|
31
|
-
*/
|
|
32
|
-
guid: string;
|
|
33
|
-
}
|
|
12
|
+
$iframe: HTMLIFrameElement;
|
|
13
|
+
};
|
|
34
14
|
|
|
35
15
|
/**
|
|
36
16
|
* pops.iframe
|
|
37
17
|
*/
|
|
38
|
-
export interface
|
|
18
|
+
export interface PopsIframeConfig extends PopsTitleConfig, PopsDragConfig, PopsGeneralConfig {
|
|
39
19
|
/**
|
|
40
20
|
* 加载配置
|
|
41
21
|
*/
|
|
@@ -64,12 +44,7 @@ export interface PopsIframeDetails extends PopsTitleConfig, PopsDragConfig, Pops
|
|
|
64
44
|
/**
|
|
65
45
|
* 点击的回调函数
|
|
66
46
|
*/
|
|
67
|
-
callback: (
|
|
68
|
-
eventConfig: PopsEventConfig & {
|
|
69
|
-
iframeElement: HTMLIFrameElement;
|
|
70
|
-
},
|
|
71
|
-
event: MouseEvent | PointerEvent
|
|
72
|
-
) => void;
|
|
47
|
+
callback: (eventConfig: PopsIframeClickEventConfig, event: MouseEvent | PointerEvent) => void;
|
|
73
48
|
};
|
|
74
49
|
/**
|
|
75
50
|
* 最大化
|
|
@@ -78,12 +53,7 @@ export interface PopsIframeDetails extends PopsTitleConfig, PopsDragConfig, Pops
|
|
|
78
53
|
/**
|
|
79
54
|
* 点击的回调函数
|
|
80
55
|
*/
|
|
81
|
-
callback: (
|
|
82
|
-
eventConfig: PopsEventConfig & {
|
|
83
|
-
iframeElement: HTMLIFrameElement;
|
|
84
|
-
},
|
|
85
|
-
event: MouseEvent | PointerEvent
|
|
86
|
-
) => void;
|
|
56
|
+
callback: (eventConfig: PopsIframeClickEventConfig, event: MouseEvent | PointerEvent) => void;
|
|
87
57
|
};
|
|
88
58
|
/**
|
|
89
59
|
* 窗口化
|
|
@@ -92,12 +62,7 @@ export interface PopsIframeDetails extends PopsTitleConfig, PopsDragConfig, Pops
|
|
|
92
62
|
/**
|
|
93
63
|
* 点击的回调函数
|
|
94
64
|
*/
|
|
95
|
-
callback: (
|
|
96
|
-
eventConfig: PopsEventConfig & {
|
|
97
|
-
iframeElement: HTMLIFrameElement;
|
|
98
|
-
},
|
|
99
|
-
event: MouseEvent | PointerEvent
|
|
100
|
-
) => void;
|
|
65
|
+
callback: (eventConfig: PopsIframeClickEventConfig, event: MouseEvent | PointerEvent) => void;
|
|
101
66
|
};
|
|
102
67
|
/**
|
|
103
68
|
* 关闭
|
|
@@ -106,12 +71,7 @@ export interface PopsIframeDetails extends PopsTitleConfig, PopsDragConfig, Pops
|
|
|
106
71
|
/**
|
|
107
72
|
* 点击的回调函数
|
|
108
73
|
*/
|
|
109
|
-
callback: (
|
|
110
|
-
eventConfig: PopsEventConfig & {
|
|
111
|
-
iframeElement: HTMLIFrameElement;
|
|
112
|
-
},
|
|
113
|
-
event: MouseEvent | PointerEvent
|
|
114
|
-
) => void;
|
|
74
|
+
callback: (eventConfig: PopsIframeClickEventConfig, event: MouseEvent | PointerEvent) => void;
|
|
115
75
|
};
|
|
116
76
|
};
|
|
117
77
|
/**
|
|
@@ -121,8 +81,9 @@ export interface PopsIframeDetails extends PopsTitleConfig, PopsDragConfig, Pops
|
|
|
121
81
|
url?: string;
|
|
122
82
|
/**
|
|
123
83
|
* 右上角按钮顺序:最小化、最大化、窗口化、关闭
|
|
84
|
+
* @default "min|max|mise|close"
|
|
124
85
|
*/
|
|
125
|
-
topRightButton:
|
|
86
|
+
topRightButton: string;
|
|
126
87
|
/**
|
|
127
88
|
* 是否启用沙箱,默认false
|
|
128
89
|
* @default false
|
|
@@ -131,9 +92,5 @@ export interface PopsIframeDetails extends PopsTitleConfig, PopsDragConfig, Pops
|
|
|
131
92
|
/**
|
|
132
93
|
* 加载完毕的回调
|
|
133
94
|
*/
|
|
134
|
-
loadEndCallBack?: (
|
|
135
|
-
details: PopsEventConfig & {
|
|
136
|
-
iframeElement: HTMLIFrameElement;
|
|
137
|
-
}
|
|
138
|
-
) => void;
|
|
95
|
+
loadEndCallBack?: (eventConfig: PopsIframeClickEventConfig) => void;
|
|
139
96
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PopsLoadingConfig } from "./types";
|
|
2
2
|
|
|
3
|
-
export const
|
|
3
|
+
export const PopsLoadingDefaultConfig = (): DeepRequired<PopsLoadingConfig> => {
|
|
4
4
|
return {
|
|
5
|
-
parent: document.body,
|
|
5
|
+
$parent: document.body || document.documentElement,
|
|
6
6
|
content: {
|
|
7
7
|
text: "加载中...",
|
|
8
8
|
icon: "loading",
|
|
@@ -4,16 +4,17 @@ import { PopsHandler } from "../../handler/PopsHandler";
|
|
|
4
4
|
import { PopsCSS } from "../../PopsCSS";
|
|
5
5
|
import { popsDOMUtils } from "../../utils/PopsDOMUtils";
|
|
6
6
|
import { popsUtils } from "../../utils/PopsUtils";
|
|
7
|
-
import {
|
|
8
|
-
import type {
|
|
7
|
+
import { PopsLoadingDefaultConfig } from "./defaultConfig";
|
|
8
|
+
import type { PopsLoadingConfig } from "./types";
|
|
9
9
|
|
|
10
10
|
export const PopsLoading = {
|
|
11
|
-
init(
|
|
12
|
-
let config = PopsLoadingConfig();
|
|
13
|
-
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
14
|
-
config = popsUtils.assign(config, details);
|
|
11
|
+
init(__config__: PopsLoadingConfig) {
|
|
15
12
|
const guid = popsUtils.getRandomGUID();
|
|
13
|
+
// 设置当前类型
|
|
16
14
|
const PopsType = "loading";
|
|
15
|
+
let config = PopsLoadingDefaultConfig();
|
|
16
|
+
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
17
|
+
config = popsUtils.assign(config, __config__);
|
|
17
18
|
|
|
18
19
|
config = PopsHandler.handleOnly(PopsType, config);
|
|
19
20
|
|
|
@@ -76,16 +77,17 @@ export const PopsLoading = {
|
|
|
76
77
|
$elList.push($mask);
|
|
77
78
|
}
|
|
78
79
|
const evtConfig = PopsHandler.handleLoadingEventConfig(config, guid, PopsType, $anim, $pops, $mask);
|
|
79
|
-
popsDOMUtils.append(config
|
|
80
|
+
popsDOMUtils.append(config.$parent, $elList);
|
|
80
81
|
if ($mask != null) {
|
|
81
82
|
$anim.after($mask);
|
|
82
83
|
}
|
|
84
|
+
// @ts-ignore
|
|
83
85
|
PopsHandler.handlePush(PopsType, {
|
|
84
86
|
guid: guid,
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
87
|
+
$anim: $anim,
|
|
88
|
+
$pops: $pops!,
|
|
89
|
+
$mask: $mask!,
|
|
90
|
+
});
|
|
89
91
|
|
|
90
92
|
if (config.isAbsolute) {
|
|
91
93
|
// 遮罩层必须是跟随主内容
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PopsGeneralConfig, PopsContentConfig } from "../../../types/components";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* pops.loading
|
|
5
5
|
*/
|
|
6
|
-
export interface
|
|
7
|
-
extends Omit<
|
|
6
|
+
export interface PopsLoadingConfig
|
|
7
|
+
extends Omit<PopsGeneralConfig, "width" | "height" | "position" | "beforeAppendToPageCallBack"> {
|
|
8
8
|
/**
|
|
9
9
|
* 父元素,默认为document.body
|
|
10
|
-
* @default document.body
|
|
10
|
+
* @default document.body || document.documentElement
|
|
11
11
|
*/
|
|
12
|
-
parent?: HTMLElement;
|
|
12
|
+
$parent?: HTMLElement;
|
|
13
13
|
/**
|
|
14
14
|
* 内容配置
|
|
15
15
|
*/
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
.pops {
|
|
2
|
+
max-height: 300px;
|
|
3
|
+
}
|
|
4
|
+
.select-container {
|
|
5
|
+
--el-font-size-base: 14px;
|
|
6
|
+
--el-text-color-regular: #606266;
|
|
7
|
+
--el-color-primary: #409eff;
|
|
8
|
+
--el-fill-color-light: #f5f7fa;
|
|
9
|
+
--el-disable-color: #a8abb2;
|
|
10
|
+
}
|
|
11
|
+
.select-item {
|
|
12
|
+
cursor: pointer;
|
|
13
|
+
font-size: var(--el-font-size-base);
|
|
14
|
+
padding: 0 20px 0 20px;
|
|
15
|
+
position: relative;
|
|
16
|
+
white-space: nowrap;
|
|
17
|
+
overflow: hidden;
|
|
18
|
+
text-overflow: ellipsis;
|
|
19
|
+
color: var(--el-text-color-regular);
|
|
20
|
+
min-height: 34px;
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
justify-content: center;
|
|
24
|
+
align-items: flex-start;
|
|
25
|
+
box-sizing: border-box;
|
|
26
|
+
}
|
|
27
|
+
.select-item[aria-disabled],
|
|
28
|
+
.select-item[disabled] {
|
|
29
|
+
cursor: not-allowed;
|
|
30
|
+
color: var(--el-disable-color);
|
|
31
|
+
background: unset;
|
|
32
|
+
}
|
|
33
|
+
.select-item:hover {
|
|
34
|
+
background-color: var(--el-fill-color-light);
|
|
35
|
+
}
|
|
36
|
+
.select-item.select-item-is-selected:has(.pops-panel-input input) {
|
|
37
|
+
background-color: #e7e7e7;
|
|
38
|
+
}
|
|
39
|
+
.select-item.select-item-is-selected {
|
|
40
|
+
color: var(--el-color-primary);
|
|
41
|
+
font-weight: 700;
|
|
42
|
+
}
|
|
43
|
+
.select-item.select-item-is-selected:not(:has(.pops-panel-input))::after {
|
|
44
|
+
content: "";
|
|
45
|
+
position: absolute;
|
|
46
|
+
top: 50%;
|
|
47
|
+
right: 12px;
|
|
48
|
+
border-top: none;
|
|
49
|
+
border-right: none;
|
|
50
|
+
background-repeat: no-repeat;
|
|
51
|
+
background-position: center;
|
|
52
|
+
background-color: var(--el-color-primary);
|
|
53
|
+
mask: url("data:image/svg+xml;utf8,%3Csvg class='icon' width='200' height='200' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='currentColor' d='M406.656 706.944L195.84 496.256a32 32 0 10-45.248 45.248l256 256 512-512a32 32 0 00-45.248-45.248L406.592 706.944z'%3E%3C/path%3E%3C/svg%3E")
|
|
54
|
+
no-repeat;
|
|
55
|
+
mask-size: 100% 100%;
|
|
56
|
+
-webkit-mask: url("data:image/svg+xml;utf8,%3Csvg class='icon' width='200' height='200' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='currentColor' d='M406.656 706.944L195.84 496.256a32 32 0 10-45.248 45.248l256 256 512-512a32 32 0 00-45.248-45.248L406.592 706.944z'%3E%3C/path%3E%3C/svg%3E")
|
|
57
|
+
no-repeat;
|
|
58
|
+
-webkit-mask-size: 100% 100%;
|
|
59
|
+
transform: translateY(-50%);
|
|
60
|
+
width: 12px;
|
|
61
|
+
height: 12px;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.select-item .pops-panel-input {
|
|
65
|
+
width: 100%;
|
|
66
|
+
margin: 5px 0px;
|
|
67
|
+
}
|
|
68
|
+
.select-item .pops-panel-input:has(.pops-panel-input-valid-error) {
|
|
69
|
+
margin-bottom: 0px;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.select-item .select-item-text {
|
|
73
|
+
white-space: nowrap;
|
|
74
|
+
text-overflow: ellipsis;
|
|
75
|
+
overflow: hidden;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@media (prefers-color-scheme: dark) {
|
|
79
|
+
.select-container {
|
|
80
|
+
--el-text-color-regular: #f2f2f2;
|
|
81
|
+
--el-disable-color: #8d9095;
|
|
82
|
+
--el-fill-color-light: #262727;
|
|
83
|
+
}
|
|
84
|
+
}
|