@whitesev/pops 2.6.0 → 3.0.0
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 +1233 -1092
- 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 +1233 -1092
- 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 +1233 -1092
- 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 +1233 -1092
- 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 +1233 -1092
- 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 +1233 -1092
- 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 +98 -103
- 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 +47 -43
- package/dist/types/src/components/panel/index.d.ts +3 -3
- 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 +13 -13
- package/dist/types/src/components/panel/types/components-input.d.ts +6 -6
- package/dist/types/src/components/panel/types/components-own.d.ts +2 -2
- package/dist/types/src/components/panel/types/components-select.d.ts +9 -9
- package/dist/types/src/components/panel/types/components-selectMultiple.d.ts +8 -8
- package/dist/types/src/components/panel/types/components-slider.d.ts +7 -7
- 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 +21 -6
- 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 +2 -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 +10 -10
- package/src/Pops.ts +44 -44
- package/src/PopsAnimation.ts +1 -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/{config.ts → defaultConfig.ts} +115 -37
- package/src/components/panel/handlerComponents.ts +446 -428
- package/src/components/panel/index.css +11 -3
- 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 +13 -13
- package/src/components/panel/types/components-input.ts +6 -6
- package/src/components/panel/types/components-own.ts +2 -2
- package/src/components/panel/types/components-select.ts +11 -11
- package/src/components/panel/types/components-selectMultiple.ts +8 -9
- package/src/components/panel/types/components-slider.ts +7 -7
- 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 +116 -96
- 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/css/common.css +6 -0
- package/src/handler/PopsElementHandler.ts +29 -30
- package/src/handler/PopsHandler.ts +43 -43
- package/src/svg/cpu.svg +7 -7
- package/src/svg/delete.svg +4 -4
- package/src/svg/documentCopy.svg +4 -4
- package/src/svg/edit.svg +7 -7
- package/src/svg/eleme.svg +4 -4
- package/src/svg/elemePlus.svg +4 -4
- package/src/svg/headset.svg +4 -4
- package/src/svg/hide.svg +7 -7
- package/src/svg/keyboard.svg +7 -7
- package/src/svg/loading.svg +4 -4
- package/src/svg/max.svg +4 -4
- package/src/svg/min.svg +2 -4
- package/src/svg/mise.svg +4 -4
- package/src/svg/monitor.svg +4 -4
- package/src/svg/next.svg +4 -4
- package/src/svg/picture.svg +7 -7
- package/src/svg/prev.svg +4 -4
- package/src/svg/search.svg +4 -4
- package/src/svg/share.svg +4 -4
- package/src/svg/upload.svg +4 -4
- package/src/svg/videoPause.svg +4 -4
- package/src/svg/videoPlay.svg +4 -4
- package/src/svg/view.svg +4 -4
- 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 +2 -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/types/components-forms.ts +0 -24
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
8
|
-
import type {
|
|
9
|
-
import type {
|
|
1
|
+
import type { PopsAlertConfig } from "../components/alert/types";
|
|
2
|
+
import type { PopsConfirmConfig } from "../components/confirm/types";
|
|
3
|
+
import type { PopsDrawerConfig } from "../components/drawer/types";
|
|
4
|
+
import type { PopsFolderConfig } from "../components/folder/types";
|
|
5
|
+
import type { PopsIframeConfig } from "../components/iframe/types";
|
|
6
|
+
import type { PopsLoadingConfig } from "../components/loading/types";
|
|
7
|
+
import type { PopsPanelConfig } from "../components/panel/types";
|
|
8
|
+
import type { PopsPromptConfig } from "../components/prompt/types/index";
|
|
9
|
+
import type { PopsInstGeneralConfig } from "../types/inst";
|
|
10
10
|
import type { PopsInstStoreType } from "../types/main";
|
|
11
11
|
export declare const PopsInstanceUtils: {
|
|
12
12
|
/**
|
|
@@ -48,7 +48,7 @@ export declare const PopsInstanceUtils: {
|
|
|
48
48
|
* @param guid 唯一标识
|
|
49
49
|
* @param isAll 是否全部删除
|
|
50
50
|
*/
|
|
51
|
-
removeInstance(instConfigList:
|
|
51
|
+
removeInstance(instConfigList: PopsInstGeneralConfig[][], guid: string, isAll?: boolean): PopsInstGeneralConfig[][];
|
|
52
52
|
/**
|
|
53
53
|
* 隐藏
|
|
54
54
|
* @param popsType
|
|
@@ -58,7 +58,7 @@ export declare const PopsInstanceUtils: {
|
|
|
58
58
|
* @param $anim
|
|
59
59
|
* @param $mask
|
|
60
60
|
*/
|
|
61
|
-
hide(config:
|
|
61
|
+
hide(config: PopsAlertConfig | PopsDrawerConfig | PopsPromptConfig | PopsConfirmConfig | PopsIframeConfig | PopsLoadingConfig | PopsPanelConfig | PopsFolderConfig, popsType: PopsInstStoreType, instConfigList: PopsInstGeneralConfig[], guid: string, $anim: HTMLElement, $mask?: HTMLElement): Promise<void>;
|
|
62
62
|
/**
|
|
63
63
|
* 显示
|
|
64
64
|
* @param popsType
|
|
@@ -68,7 +68,7 @@ export declare const PopsInstanceUtils: {
|
|
|
68
68
|
* @param $anim
|
|
69
69
|
* @param $mask
|
|
70
70
|
*/
|
|
71
|
-
show(config:
|
|
71
|
+
show(config: PopsAlertConfig | PopsDrawerConfig | PopsPromptConfig | PopsConfirmConfig | PopsIframeConfig | PopsLoadingConfig | PopsPanelConfig | PopsFolderConfig, popsType: PopsInstStoreType, instConfigList: PopsInstGeneralConfig[], guid: string, $anim: HTMLElement, $mask?: HTMLElement): Promise<void>;
|
|
72
72
|
/**
|
|
73
73
|
* 关闭
|
|
74
74
|
* @param popsType
|
|
@@ -77,16 +77,16 @@ export declare const PopsInstanceUtils: {
|
|
|
77
77
|
* @param config
|
|
78
78
|
* @param $anim
|
|
79
79
|
*/
|
|
80
|
-
close(config:
|
|
80
|
+
close(config: PopsAlertConfig | PopsDrawerConfig | PopsPromptConfig | PopsConfirmConfig | PopsIframeConfig | PopsLoadingConfig | PopsPanelConfig | PopsFolderConfig, popsType: string, instConfigList: PopsInstGeneralConfig[], guid: string, $anim: HTMLElement): Promise<void>;
|
|
81
81
|
/**
|
|
82
82
|
* 拖拽元素
|
|
83
83
|
* 说明:
|
|
84
84
|
* + 元素的position为absolute或者fixed
|
|
85
85
|
* + 会为元素的
|
|
86
|
-
* @param
|
|
86
|
+
* @param $move 需要拖拽的元素
|
|
87
87
|
* @param options 配置
|
|
88
88
|
*/
|
|
89
|
-
drag(
|
|
89
|
+
drag($move: HTMLElement, options: {
|
|
90
90
|
dragElement: HTMLElement;
|
|
91
91
|
limit: boolean;
|
|
92
92
|
triggerClick?: boolean;
|
|
@@ -134,6 +134,10 @@ declare class PopsUtils {
|
|
|
134
134
|
* 配合 .setInterval 使用
|
|
135
135
|
*/
|
|
136
136
|
clearInterval(timeId: number | undefined): void;
|
|
137
|
+
/**
|
|
138
|
+
* 覆盖对象中的数组新值
|
|
139
|
+
*/
|
|
140
|
+
setArray<T>(target: T, key: keyof T, newArr: any[]): void;
|
|
137
141
|
}
|
|
138
142
|
declare const popsUtils: PopsUtils;
|
|
139
143
|
export { popsUtils };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@whitesev/pops",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
|
+
"description": "弹窗库,包含了alert、confirm、prompt、drawer、loading、iframe、rightClickMenu等组件",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"homepage": "https://github.com/WhiteSevs/TamperMonkeyScript/tree/master/lib/pops#readme",
|
|
7
7
|
"bugs": {
|
|
@@ -44,22 +44,22 @@
|
|
|
44
44
|
"worker-timers": "^8.0.25"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@eslint/js": "^9.
|
|
48
|
-
"@rollup/plugin-commonjs": "^
|
|
47
|
+
"@eslint/js": "^9.39.0",
|
|
48
|
+
"@rollup/plugin-commonjs": "^29.0.0",
|
|
49
49
|
"@rollup/plugin-json": "^6.1.0",
|
|
50
50
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
51
51
|
"@rollup/plugin-terser": "^0.4.4",
|
|
52
|
-
"@rollup/plugin-typescript": "12.
|
|
53
|
-
"browserslist": "^4.
|
|
54
|
-
"caniuse-lite": "^1.0.
|
|
55
|
-
"eslint": "^9.
|
|
52
|
+
"@rollup/plugin-typescript": "12.3.0",
|
|
53
|
+
"browserslist": "^4.27.0",
|
|
54
|
+
"caniuse-lite": "^1.0.30001753",
|
|
55
|
+
"eslint": "^9.39.0",
|
|
56
56
|
"eslint-config-prettier": "^10.1.8",
|
|
57
57
|
"eslint-plugin-compat": "^6.0.2",
|
|
58
58
|
"eslint-plugin-prettier": "^5.5.4",
|
|
59
|
-
"globals": "^16.
|
|
59
|
+
"globals": "^16.5.0",
|
|
60
60
|
"rollup": "^4.52.5",
|
|
61
61
|
"rollup-plugin-clear": "^2.0.7",
|
|
62
|
-
"rollup-plugin-import-css": "^4.
|
|
62
|
+
"rollup-plugin-import-css": "^4.1.1",
|
|
63
63
|
"tslib": "^2.8.1",
|
|
64
64
|
"typescript": "^5.9.3",
|
|
65
65
|
"typescript-eslint": "^8.46.2"
|
package/src/Pops.ts
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import { PopsAlert } from "./components/alert";
|
|
2
|
-
import type {
|
|
2
|
+
import type { PopsAlertConfig } from "./components/alert/types";
|
|
3
3
|
import { PopsConfirm } from "./components/confirm";
|
|
4
|
-
import type {
|
|
4
|
+
import type { PopsConfirmConfig } from "./components/confirm/types";
|
|
5
5
|
import { PopsDrawer } from "./components/drawer";
|
|
6
|
-
import type {
|
|
6
|
+
import type { PopsDrawerConfig } from "./components/drawer/types";
|
|
7
7
|
import { PopsFolder } from "./components/folder";
|
|
8
|
-
import type {
|
|
8
|
+
import type { PopsFolderConfig } from "./components/folder/types";
|
|
9
9
|
import { PopsIframe } from "./components/iframe";
|
|
10
|
-
import type {
|
|
10
|
+
import type { PopsIframeConfig } from "./components/iframe/types";
|
|
11
11
|
import { PopsLoading } from "./components/loading";
|
|
12
|
-
import type {
|
|
12
|
+
import type { PopsLoadingConfig } from "./components/loading/types";
|
|
13
13
|
import { PopsPanel } from "./components/panel";
|
|
14
14
|
import { PanelHandlerComponents } from "./components/panel/handlerComponents";
|
|
15
|
-
import type {
|
|
15
|
+
import type { PopsPanelConfig } from "./components/panel/types";
|
|
16
16
|
import { PopsPrompt } from "./components/prompt";
|
|
17
|
-
import type {
|
|
17
|
+
import type { PopsPromptConfig } from "./components/prompt/types/index";
|
|
18
18
|
import { PopsRightClickMenu } from "./components/rightClickMenu";
|
|
19
|
-
import type {
|
|
19
|
+
import type { PopsRightClickMenuConfig } from "./components/rightClickMenu/types";
|
|
20
20
|
import { PopsSearchSuggestion } from "./components/searchSuggestion";
|
|
21
|
-
import type {
|
|
21
|
+
import type { PopsSearchSuggestionConfig } from "./components/searchSuggestion/types/index";
|
|
22
22
|
import { PopsTooltip } from "./components/tooltip";
|
|
23
|
-
import type {
|
|
23
|
+
import type { PopsToolTipConfig } from "./components/tooltip/types/index";
|
|
24
24
|
import { GlobalConfig } from "./config/GlobalConfig";
|
|
25
25
|
import { PopsAnimation } from "./PopsAnimation";
|
|
26
26
|
import { PopsCore } from "./PopsCore";
|
|
@@ -90,91 +90,91 @@ class Pops {
|
|
|
90
90
|
GlobalConfig = GlobalConfig;
|
|
91
91
|
/**
|
|
92
92
|
* 普通信息框
|
|
93
|
-
* @param
|
|
93
|
+
* @param config 配置
|
|
94
94
|
*/
|
|
95
|
-
alert = (
|
|
96
|
-
const dialog = PopsAlert.init(
|
|
95
|
+
alert = (config: PopsAlertConfig) => {
|
|
96
|
+
const dialog = PopsAlert.init(config);
|
|
97
97
|
return dialog;
|
|
98
98
|
};
|
|
99
99
|
|
|
100
100
|
/**
|
|
101
101
|
* 询问框
|
|
102
|
-
* @param
|
|
102
|
+
* @param config 配置
|
|
103
103
|
*/
|
|
104
|
-
confirm = (
|
|
105
|
-
const dialog = PopsConfirm.init(
|
|
104
|
+
confirm = (config: PopsConfirmConfig) => {
|
|
105
|
+
const dialog = PopsConfirm.init(config);
|
|
106
106
|
return dialog;
|
|
107
107
|
};
|
|
108
108
|
|
|
109
109
|
/**
|
|
110
110
|
* 输入框
|
|
111
|
-
* @param
|
|
111
|
+
* @param config 配置
|
|
112
112
|
*/
|
|
113
|
-
prompt = (
|
|
114
|
-
const dialog = PopsPrompt.init(
|
|
113
|
+
prompt = (config: PopsPromptConfig) => {
|
|
114
|
+
const dialog = PopsPrompt.init(config);
|
|
115
115
|
return dialog;
|
|
116
116
|
};
|
|
117
117
|
|
|
118
118
|
/**
|
|
119
119
|
* 加载层
|
|
120
|
-
* @param
|
|
120
|
+
* @param config 配置
|
|
121
121
|
*/
|
|
122
|
-
loading = (
|
|
123
|
-
const popsLoading = PopsLoading.init(
|
|
122
|
+
loading = (config: PopsLoadingConfig) => {
|
|
123
|
+
const popsLoading = PopsLoading.init(config);
|
|
124
124
|
return popsLoading;
|
|
125
125
|
};
|
|
126
126
|
|
|
127
127
|
/**
|
|
128
128
|
* iframe层
|
|
129
|
-
* @param
|
|
129
|
+
* @param config 配置
|
|
130
130
|
*/
|
|
131
|
-
iframe = (
|
|
132
|
-
const dialog = PopsIframe.init(
|
|
131
|
+
iframe = (config: PopsIframeConfig) => {
|
|
132
|
+
const dialog = PopsIframe.init(config);
|
|
133
133
|
return dialog;
|
|
134
134
|
};
|
|
135
135
|
|
|
136
136
|
/**
|
|
137
137
|
* 提示框
|
|
138
|
-
* @param
|
|
138
|
+
* @param config 配置
|
|
139
139
|
*/
|
|
140
|
-
tooltip = (
|
|
141
|
-
const popsTooltip = PopsTooltip.init(
|
|
140
|
+
tooltip = (config: PopsToolTipConfig) => {
|
|
141
|
+
const popsTooltip = PopsTooltip.init(config);
|
|
142
142
|
return popsTooltip;
|
|
143
143
|
};
|
|
144
144
|
|
|
145
145
|
/**
|
|
146
146
|
* 抽屉
|
|
147
|
-
* @param
|
|
147
|
+
* @param config 配置
|
|
148
148
|
*/
|
|
149
|
-
drawer = (
|
|
150
|
-
const dialog = PopsDrawer.init(
|
|
149
|
+
drawer = (config: PopsDrawerConfig) => {
|
|
150
|
+
const dialog = PopsDrawer.init(config);
|
|
151
151
|
return dialog;
|
|
152
152
|
};
|
|
153
153
|
|
|
154
154
|
/**
|
|
155
155
|
* 文件夹
|
|
156
|
-
* @param
|
|
156
|
+
* @param config 配置
|
|
157
157
|
*/
|
|
158
|
-
folder = (
|
|
159
|
-
const dialog = PopsFolder.init(
|
|
158
|
+
folder = (config: PopsFolderConfig) => {
|
|
159
|
+
const dialog = PopsFolder.init(config);
|
|
160
160
|
return dialog;
|
|
161
161
|
};
|
|
162
162
|
|
|
163
163
|
/**
|
|
164
164
|
* 配置面板
|
|
165
|
-
* @param
|
|
165
|
+
* @param config 配置
|
|
166
166
|
*/
|
|
167
|
-
panel = (
|
|
168
|
-
const dialog = PopsPanel.init(
|
|
167
|
+
panel = (config: PopsPanelConfig) => {
|
|
168
|
+
const dialog = PopsPanel.init(config);
|
|
169
169
|
return dialog;
|
|
170
170
|
};
|
|
171
171
|
|
|
172
172
|
/**
|
|
173
173
|
* 右键菜单
|
|
174
|
-
* @param
|
|
174
|
+
* @param config 配置
|
|
175
175
|
*/
|
|
176
|
-
rightClickMenu = (
|
|
177
|
-
const popsRightClickMenu = PopsRightClickMenu.init(
|
|
176
|
+
rightClickMenu = (config: PopsRightClickMenuConfig) => {
|
|
177
|
+
const popsRightClickMenu = PopsRightClickMenu.init(config);
|
|
178
178
|
return popsRightClickMenu;
|
|
179
179
|
};
|
|
180
180
|
|
|
@@ -182,7 +182,7 @@ class Pops {
|
|
|
182
182
|
* 搜索建议
|
|
183
183
|
*
|
|
184
184
|
* 注意:调用后需要主动调用.init()和.setAllEvent()进行初始化
|
|
185
|
-
* @param
|
|
185
|
+
* @param config 配置
|
|
186
186
|
* @example
|
|
187
187
|
* let $input = document.querySelector("#input");
|
|
188
188
|
* let searchSuggestion = pops.searchSuggestion({
|
|
@@ -195,8 +195,8 @@ class Pops {
|
|
|
195
195
|
* searchSuggestion.init();
|
|
196
196
|
* searchSuggestion.setAllEvent();
|
|
197
197
|
*/
|
|
198
|
-
searchSuggestion = <T = any>(
|
|
199
|
-
const popsSearchSuggestion = PopsSearchSuggestion.init<T>(
|
|
198
|
+
searchSuggestion = <T = any>(config: PopsSearchSuggestionConfig<T>) => {
|
|
199
|
+
const popsSearchSuggestion = PopsSearchSuggestion.init<T>(config);
|
|
200
200
|
return popsSearchSuggestion;
|
|
201
201
|
};
|
|
202
202
|
}
|
package/src/PopsAnimation.ts
CHANGED
package/src/PopsInst.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PopsInstGeneralConfig } from "./types/inst";
|
|
2
2
|
import type { PopsInstStoreType } from "./types/main";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* 弹窗实例数据
|
|
6
6
|
*/
|
|
7
7
|
export const PopsInstData: {
|
|
8
|
-
[key in PopsInstStoreType]:
|
|
8
|
+
[key in PopsInstStoreType]: PopsInstGeneralConfig[];
|
|
9
9
|
} = {
|
|
10
10
|
alert: [],
|
|
11
11
|
confirm: [],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PopsAlertConfig } from "./types";
|
|
2
2
|
|
|
3
|
-
export const
|
|
3
|
+
export const PopsAlertDefaultConfig = (): DeepRequired<PopsAlertConfig> => {
|
|
4
4
|
return {
|
|
5
5
|
title: {
|
|
6
6
|
text: "默认标题",
|
|
@@ -23,14 +23,14 @@ export const PopsAlertConfig = (): DeepRequired<PopsAlertDetails> => {
|
|
|
23
23
|
iconIsLoading: false,
|
|
24
24
|
text: "确定",
|
|
25
25
|
type: "primary",
|
|
26
|
-
callback: function (
|
|
27
|
-
|
|
26
|
+
callback: function (eventConfig) {
|
|
27
|
+
eventConfig.close();
|
|
28
28
|
},
|
|
29
29
|
},
|
|
30
30
|
close: {
|
|
31
31
|
enable: true,
|
|
32
|
-
callback: function (
|
|
33
|
-
|
|
32
|
+
callback: function (eventConfig) {
|
|
33
|
+
eventConfig.close();
|
|
34
34
|
},
|
|
35
35
|
},
|
|
36
36
|
},
|
|
@@ -58,5 +58,5 @@ export const PopsAlertConfig = (): DeepRequired<PopsAlertDetails> => {
|
|
|
58
58
|
forbiddenScroll: false,
|
|
59
59
|
style: null,
|
|
60
60
|
beforeAppendToPageCallBack() {},
|
|
61
|
-
} as DeepRequired<
|
|
61
|
+
} as DeepRequired<PopsAlertConfig>;
|
|
62
62
|
};
|
|
@@ -4,19 +4,20 @@ import { PopsHandler } from "../../handler/PopsHandler";
|
|
|
4
4
|
import { popsDOMUtils } from "../../utils/PopsDOMUtils";
|
|
5
5
|
import { PopsInstanceUtils } from "../../utils/PopsInstanceUtils";
|
|
6
6
|
import { popsUtils } from "../../utils/PopsUtils";
|
|
7
|
-
import {
|
|
7
|
+
import { PopsAlertDefaultConfig } from "./defaultConfig";
|
|
8
8
|
import type { PopsType } from "../../types/main";
|
|
9
|
-
import type {
|
|
9
|
+
import type { PopsAlertConfig } from "./types";
|
|
10
10
|
import { PopsCSS } from "../../PopsCSS";
|
|
11
11
|
|
|
12
12
|
export const PopsAlert = {
|
|
13
|
-
init(
|
|
13
|
+
init(__config__: PopsAlertConfig) {
|
|
14
14
|
const guid = popsUtils.getRandomGUID();
|
|
15
15
|
// 设置当前类型
|
|
16
16
|
const popsType: PopsType = "alert";
|
|
17
|
-
|
|
17
|
+
|
|
18
|
+
let config = PopsAlertDefaultConfig();
|
|
18
19
|
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
19
|
-
config = popsUtils.assign(config,
|
|
20
|
+
config = popsUtils.assign(config, __config__);
|
|
20
21
|
config = PopsHandler.handleOnly(popsType, config);
|
|
21
22
|
|
|
22
23
|
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
|
|
@@ -93,7 +94,7 @@ export const PopsAlert = {
|
|
|
93
94
|
/** 已创建的元素列表 */
|
|
94
95
|
const $elList: HTMLElement[] = [$anim];
|
|
95
96
|
|
|
96
|
-
|
|
97
|
+
// 遮罩层元素
|
|
97
98
|
|
|
98
99
|
if (config.mask.enable) {
|
|
99
100
|
const handleMask = PopsHandler.handleMask({
|
|
@@ -106,7 +107,7 @@ export const PopsAlert = {
|
|
|
106
107
|
$mask = handleMask.maskElement;
|
|
107
108
|
$elList.push($mask);
|
|
108
109
|
}
|
|
109
|
-
|
|
110
|
+
// 处理返回的配置
|
|
110
111
|
const evtConfig = PopsHandler.handleEventConfig(
|
|
111
112
|
config,
|
|
112
113
|
guid,
|
|
@@ -117,12 +118,12 @@ export const PopsAlert = {
|
|
|
117
118
|
$pops,
|
|
118
119
|
$mask
|
|
119
120
|
);
|
|
120
|
-
|
|
121
|
+
// 为顶部右边的关闭按钮添加点击事件
|
|
121
122
|
PopsHandler.handleClickEvent("close", $headerCloseBtn, evtConfig, config.btn.close?.callback);
|
|
122
|
-
|
|
123
|
+
// 为底部ok按钮添加点击事件
|
|
123
124
|
PopsHandler.handleClickEvent("ok", btnOkElement, evtConfig, config.btn.ok?.callback);
|
|
124
125
|
|
|
125
|
-
|
|
126
|
+
// 创建到页面中
|
|
126
127
|
|
|
127
128
|
popsDOMUtils.append($shadowRoot, $elList);
|
|
128
129
|
if (typeof config.beforeAppendToPageCallBack === "function") {
|
|
@@ -134,19 +135,16 @@ export const PopsAlert = {
|
|
|
134
135
|
// 添加遮罩层
|
|
135
136
|
$anim.after($mask);
|
|
136
137
|
}
|
|
137
|
-
|
|
138
|
+
// 保存
|
|
138
139
|
PopsHandler.handlePush(popsType, {
|
|
139
140
|
guid: guid,
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
popsElement: $pops!,
|
|
144
|
-
|
|
145
|
-
maskElement: $mask!,
|
|
141
|
+
$anim: $anim,
|
|
142
|
+
$pops: $pops!,
|
|
143
|
+
$mask: $mask!,
|
|
146
144
|
$shadowContainer: $shadowContainer,
|
|
147
145
|
$shadowRoot: $shadowRoot,
|
|
148
146
|
});
|
|
149
|
-
|
|
147
|
+
// 拖拽
|
|
150
148
|
if (config.drag) {
|
|
151
149
|
PopsInstanceUtils.drag($pops!, {
|
|
152
150
|
dragElement: $title!,
|
|
@@ -2,15 +2,15 @@ import type {
|
|
|
2
2
|
PopsTitleConfig,
|
|
3
3
|
PopsContentConfig,
|
|
4
4
|
PopsDragConfig,
|
|
5
|
-
|
|
5
|
+
PopsGeneralConfig,
|
|
6
6
|
PopsButtonConfig,
|
|
7
7
|
} from "../../../types/components";
|
|
8
|
-
import type {
|
|
8
|
+
import type { PopsGlobalButtonConfig, PopsButtonConfigAnyType } from "../../../types/button";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* pops.alert
|
|
12
12
|
*/
|
|
13
|
-
export interface
|
|
13
|
+
export interface PopsAlertConfig extends PopsTitleConfig, PopsContentConfig, PopsDragConfig, PopsGeneralConfig {
|
|
14
14
|
/**
|
|
15
15
|
* 按钮配置
|
|
16
16
|
*/
|
|
@@ -18,6 +18,6 @@ export interface PopsAlertDetails extends PopsTitleConfig, PopsContentConfig, Po
|
|
|
18
18
|
/**
|
|
19
19
|
* 确定按钮
|
|
20
20
|
*/
|
|
21
|
-
ok?: Partial<
|
|
21
|
+
ok?: Partial<PopsGlobalButtonConfig | PopsButtonConfigAnyType>;
|
|
22
22
|
};
|
|
23
23
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PopsConfirmConfig } from "./types";
|
|
2
2
|
|
|
3
|
-
export const
|
|
3
|
+
export const PopsConfirmDefaultConfig = (): DeepRequired<PopsConfirmConfig> => {
|
|
4
4
|
return {
|
|
5
5
|
title: {
|
|
6
6
|
text: "默认标题",
|
|
@@ -26,8 +26,8 @@ export const PopsConfirmConfig = (): DeepRequired<PopsConfirmDetails> => {
|
|
|
26
26
|
iconIsLoading: false,
|
|
27
27
|
text: "确定",
|
|
28
28
|
type: "primary",
|
|
29
|
-
callback(
|
|
30
|
-
|
|
29
|
+
callback(eventConfig) {
|
|
30
|
+
eventConfig.close();
|
|
31
31
|
},
|
|
32
32
|
},
|
|
33
33
|
cancel: {
|
|
@@ -38,8 +38,8 @@ export const PopsConfirmConfig = (): DeepRequired<PopsConfirmDetails> => {
|
|
|
38
38
|
iconIsLoading: false,
|
|
39
39
|
text: "关闭",
|
|
40
40
|
type: "default",
|
|
41
|
-
callback(
|
|
42
|
-
|
|
41
|
+
callback(eventConfig) {
|
|
42
|
+
eventConfig.close();
|
|
43
43
|
},
|
|
44
44
|
},
|
|
45
45
|
other: {
|
|
@@ -50,14 +50,14 @@ export const PopsConfirmConfig = (): DeepRequired<PopsConfirmDetails> => {
|
|
|
50
50
|
iconIsLoading: false,
|
|
51
51
|
text: "其它按钮",
|
|
52
52
|
type: "default",
|
|
53
|
-
callback(
|
|
54
|
-
|
|
53
|
+
callback(eventConfig) {
|
|
54
|
+
eventConfig.close();
|
|
55
55
|
},
|
|
56
56
|
},
|
|
57
57
|
close: {
|
|
58
58
|
enable: true,
|
|
59
|
-
callback(
|
|
60
|
-
|
|
59
|
+
callback(eventConfig) {
|
|
60
|
+
eventConfig.close();
|
|
61
61
|
},
|
|
62
62
|
},
|
|
63
63
|
},
|
|
@@ -86,5 +86,5 @@ export const PopsConfirmConfig = (): DeepRequired<PopsConfirmDetails> => {
|
|
|
86
86
|
|
|
87
87
|
style: null,
|
|
88
88
|
beforeAppendToPageCallBack() {},
|
|
89
|
-
} as DeepRequired<
|
|
89
|
+
} as DeepRequired<PopsConfirmConfig>;
|
|
90
90
|
};
|
|
@@ -6,17 +6,18 @@ import type { PopsType } from "../../types/main";
|
|
|
6
6
|
import { popsDOMUtils } from "../../utils/PopsDOMUtils";
|
|
7
7
|
import { PopsInstanceUtils } from "../../utils/PopsInstanceUtils";
|
|
8
8
|
import { popsUtils } from "../../utils/PopsUtils";
|
|
9
|
-
import {
|
|
10
|
-
import type {
|
|
9
|
+
import { PopsConfirmDefaultConfig } from "./defaultConfig";
|
|
10
|
+
import type { PopsConfirmConfig } from "./types";
|
|
11
11
|
|
|
12
12
|
export const PopsConfirm = {
|
|
13
|
-
init(
|
|
13
|
+
init(__config__: PopsConfirmConfig) {
|
|
14
14
|
const guid = popsUtils.getRandomGUID();
|
|
15
15
|
// 设置当前类型
|
|
16
16
|
const popsType: PopsType = "confirm";
|
|
17
|
-
|
|
17
|
+
|
|
18
|
+
let config = PopsConfirmDefaultConfig();
|
|
18
19
|
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
19
|
-
config = popsUtils.assign(config,
|
|
20
|
+
config = popsUtils.assign(config, __config__);
|
|
20
21
|
config = PopsHandler.handleOnly(popsType, config);
|
|
21
22
|
|
|
22
23
|
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
|
|
@@ -127,7 +128,7 @@ export const PopsConfirm = {
|
|
|
127
128
|
PopsHandler.handleClickEvent("cancel", $btnCancel, evtConfig, config.btn.cancel.callback);
|
|
128
129
|
PopsHandler.handleClickEvent("other", $btnOther, evtConfig, config.btn.other.callback);
|
|
129
130
|
|
|
130
|
-
|
|
131
|
+
// 创建到页面中
|
|
131
132
|
|
|
132
133
|
popsDOMUtils.append($shadowRoot, $elList);
|
|
133
134
|
if (typeof config.beforeAppendToPageCallBack === "function") {
|
|
@@ -140,16 +141,13 @@ export const PopsConfirm = {
|
|
|
140
141
|
}
|
|
141
142
|
PopsHandler.handlePush(popsType, {
|
|
142
143
|
guid: guid,
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
popsElement: $pops!,
|
|
147
|
-
|
|
148
|
-
maskElement: $mask!,
|
|
144
|
+
$anim: $anim,
|
|
145
|
+
$pops: $pops!,
|
|
146
|
+
$mask: $mask!,
|
|
149
147
|
$shadowContainer: $shadowContainer,
|
|
150
148
|
$shadowRoot: $shadowRoot,
|
|
151
149
|
});
|
|
152
|
-
|
|
150
|
+
// 拖拽
|
|
153
151
|
if (config.drag) {
|
|
154
152
|
PopsInstanceUtils.drag($pops!, {
|
|
155
153
|
dragElement: $title!,
|
|
@@ -2,16 +2,16 @@ import type {
|
|
|
2
2
|
PopsTitleConfig,
|
|
3
3
|
PopsContentConfig,
|
|
4
4
|
PopsDragConfig,
|
|
5
|
-
|
|
5
|
+
PopsGeneralConfig,
|
|
6
6
|
PopsMoreButtonConfig,
|
|
7
7
|
} from "../../../types/components";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* pops.confirm
|
|
11
11
|
*/
|
|
12
|
-
export interface
|
|
12
|
+
export interface PopsConfirmConfig
|
|
13
13
|
extends PopsTitleConfig,
|
|
14
14
|
PopsContentConfig,
|
|
15
15
|
PopsMoreButtonConfig,
|
|
16
16
|
PopsDragConfig,
|
|
17
|
-
|
|
17
|
+
PopsGeneralConfig {}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PopsDrawerConfig } from "./types";
|
|
2
2
|
|
|
3
|
-
export const
|
|
3
|
+
export const PopsDrawerDefaultConfig = (): DeepRequired<PopsDrawerConfig> => {
|
|
4
4
|
return {
|
|
5
5
|
title: {
|
|
6
6
|
enable: true,
|
|
@@ -27,8 +27,8 @@ export const PopsDrawerConfig = (): DeepRequired<PopsDrawerDetails> => {
|
|
|
27
27
|
iconIsLoading: false,
|
|
28
28
|
text: "确定",
|
|
29
29
|
type: "primary",
|
|
30
|
-
callback(
|
|
31
|
-
|
|
30
|
+
callback(eventConfig) {
|
|
31
|
+
eventConfig.close();
|
|
32
32
|
},
|
|
33
33
|
},
|
|
34
34
|
cancel: {
|
|
@@ -39,8 +39,8 @@ export const PopsDrawerConfig = (): DeepRequired<PopsDrawerDetails> => {
|
|
|
39
39
|
iconIsLoading: false,
|
|
40
40
|
text: "关闭",
|
|
41
41
|
type: "default",
|
|
42
|
-
callback(
|
|
43
|
-
|
|
42
|
+
callback(eventConfig) {
|
|
43
|
+
eventConfig.close();
|
|
44
44
|
},
|
|
45
45
|
},
|
|
46
46
|
other: {
|
|
@@ -51,14 +51,14 @@ export const PopsDrawerConfig = (): DeepRequired<PopsDrawerDetails> => {
|
|
|
51
51
|
iconIsLoading: false,
|
|
52
52
|
text: "其它按钮",
|
|
53
53
|
type: "default",
|
|
54
|
-
callback(
|
|
55
|
-
|
|
54
|
+
callback(eventConfig) {
|
|
55
|
+
eventConfig.close();
|
|
56
56
|
},
|
|
57
57
|
},
|
|
58
58
|
close: {
|
|
59
59
|
enable: true,
|
|
60
|
-
callback(
|
|
61
|
-
|
|
60
|
+
callback(eventConfig) {
|
|
61
|
+
eventConfig.close();
|
|
62
62
|
},
|
|
63
63
|
},
|
|
64
64
|
},
|