@whitesev/pops 2.2.0 → 2.2.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 +108 -100
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +108 -100
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +108 -100
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +108 -100
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +108 -100
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +108 -100
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/Pops.d.ts +16 -16
- package/dist/types/src/PopsInst.d.ts +8 -0
- package/dist/types/src/components/panel/index.d.ts +1 -1
- package/dist/types/src/handler/PopsElementHandler.d.ts +2 -2
- package/dist/types/src/handler/PopsHandler.d.ts +6 -6
- package/dist/types/src/types/button.d.ts +2 -2
- package/dist/types/src/types/event.d.ts +3 -3
- package/dist/types/src/types/{layer.d.ts → inst.d.ts} +7 -5
- package/dist/types/src/types/main.d.ts +8 -33
- package/dist/types/src/utils/PopsInstanceUtils.d.ts +10 -10
- package/package.json +1 -1
- package/src/Pops.ts +2 -2
- package/src/PopsInst.ts +21 -0
- package/src/components/alert/index.ts +2 -2
- package/src/components/iframe/index.ts +2 -2
- package/src/components/rightClickMenu/index.ts +2 -2
- package/src/css/scrollbar.css +9 -5
- package/src/handler/PopsElementHandler.ts +2 -2
- package/src/handler/PopsHandler.ts +30 -30
- package/src/types/button.d.ts +2 -2
- package/src/types/event.d.ts +3 -3
- package/src/types/{layer.d.ts → inst.d.ts} +7 -5
- package/src/types/main.d.ts +8 -33
- package/src/utils/PopsInstanceUtils.ts +84 -81
- package/dist/types/src/PopsLayer.d.ts +0 -5
- package/src/PopsLayer.ts +0 -18
package/dist/types/src/Pops.d.ts
CHANGED
|
@@ -68,17 +68,17 @@ declare class Pops {
|
|
|
68
68
|
[key: string]: CSSKeyframesRule;
|
|
69
69
|
};
|
|
70
70
|
/** 存储已创建的元素 */
|
|
71
|
-
|
|
72
|
-
iframe: import("./types/
|
|
73
|
-
loading: import("./types/
|
|
74
|
-
folder: import("./types/
|
|
75
|
-
alert: import("./types/
|
|
76
|
-
confirm: import("./types/
|
|
77
|
-
prompt: import("./types/
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
rightClickMenu: import("./types/
|
|
71
|
+
instData: {
|
|
72
|
+
iframe: import("./types/inst").PopsInstCommonConfig[];
|
|
73
|
+
loading: import("./types/inst").PopsInstCommonConfig[];
|
|
74
|
+
folder: import("./types/inst").PopsInstCommonConfig[];
|
|
75
|
+
alert: import("./types/inst").PopsInstCommonConfig[];
|
|
76
|
+
confirm: import("./types/inst").PopsInstCommonConfig[];
|
|
77
|
+
prompt: import("./types/inst").PopsInstCommonConfig[];
|
|
78
|
+
tooltip: import("./types/inst").PopsInstCommonConfig[];
|
|
79
|
+
drawer: import("./types/inst").PopsInstCommonConfig[];
|
|
80
|
+
panel: import("./types/inst").PopsInstCommonConfig[];
|
|
81
|
+
rightClickMenu: import("./types/inst").PopsInstCommonConfig[];
|
|
82
82
|
};
|
|
83
83
|
/** 禁止滚动 */
|
|
84
84
|
forbiddenScroll: {
|
|
@@ -189,10 +189,10 @@ declare class Pops {
|
|
|
189
189
|
isOverMaxZIndex: boolean;
|
|
190
190
|
};
|
|
191
191
|
getMaxZIndex(deviation?: number): number;
|
|
192
|
-
removeInstance(
|
|
193
|
-
hide(popsType: import("./types/main").
|
|
194
|
-
show(popsType: import("./types/main").
|
|
195
|
-
close(popsType: string,
|
|
192
|
+
removeInstance(instConfigList: import("./types/inst").PopsInstCommonConfig[][], guid: string, isAll?: boolean): import("./types/inst").PopsInstCommonConfig[][];
|
|
193
|
+
hide(popsType: import("./types/main").PopsInstStoreType, instConfigList: import("./types/inst").PopsInstCommonConfig[], guid: string, config: PopsAlertDetails | PopsDrawerDetails | PopsPromptDetails | PopsConfirmDetails | PopsIframeDetails | PopsLoadingDetails | PopsPanelDetails | PopsFolderDetails, animElement: HTMLElement, maskElement: HTMLElement): Promise<void>;
|
|
194
|
+
show(popsType: import("./types/main").PopsInstStoreType, instConfigList: import("./types/inst").PopsInstCommonConfig[], guid: string, config: PopsAlertDetails | PopsDrawerDetails | PopsPromptDetails | PopsConfirmDetails | PopsIframeDetails | PopsLoadingDetails | PopsPanelDetails | PopsFolderDetails, animElement: HTMLElement, maskElement?: HTMLElement): Promise<void>;
|
|
195
|
+
close(popsType: string, instConfigList: import("./types/inst").PopsInstCommonConfig[], guid: string, config: PopsAlertDetails | PopsDrawerDetails | PopsPromptDetails | PopsConfirmDetails | PopsIframeDetails | PopsLoadingDetails | PopsPanelDetails | PopsFolderDetails, animElement: HTMLElement): Promise<void>;
|
|
196
196
|
drag(moveElement: HTMLElement, options: {
|
|
197
197
|
dragElement: HTMLElement;
|
|
198
198
|
limit: boolean;
|
|
@@ -409,7 +409,7 @@ declare class Pops {
|
|
|
409
409
|
animElement: HTMLDivElement;
|
|
410
410
|
popsElement: HTMLDivElement;
|
|
411
411
|
maskElement?: HTMLDivElement | undefined;
|
|
412
|
-
mode: import("./types/main").
|
|
412
|
+
mode: import("./types/main").PopsType;
|
|
413
413
|
};
|
|
414
414
|
/**
|
|
415
415
|
* 右键菜单
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PopsSupportAnim, PopsSupportBottomBtn, PopsSupportContent, PopsSupportHeaderTitle,
|
|
1
|
+
import type { PopsSupportAnim, PopsSupportBottomBtn, PopsSupportContent, PopsSupportHeaderTitle, PopsSupportAnimType, PopsTypeSupportBottomBtn, PopsTypeSupportContent, PopsTypeSupportHeaderTitle } from "../types/main";
|
|
2
2
|
export declare const PopsElementHandler: {
|
|
3
3
|
/**
|
|
4
4
|
* 获取遮罩层HTML
|
|
@@ -16,7 +16,7 @@ export declare const PopsElementHandler: {
|
|
|
16
16
|
* @param bottomBtnHTML
|
|
17
17
|
* @param zIndex
|
|
18
18
|
*/
|
|
19
|
-
getAnimHTML(guid: string, type:
|
|
19
|
+
getAnimHTML(guid: string, type: PopsSupportAnimType, config: PopsSupportAnim[keyof PopsSupportAnim], html: string | undefined, bottomBtnHTML: string | undefined, zIndex: number): string;
|
|
20
20
|
/**
|
|
21
21
|
* 获取顶部按钮层HTML
|
|
22
22
|
* @param type
|
|
@@ -8,8 +8,8 @@ import type { PopsPanelDetails } from "../components/panel/types";
|
|
|
8
8
|
import type { PopsPromptDetails } from "../components/prompt/types/index";
|
|
9
9
|
import type { PopsCommonConfig } from "../types/components";
|
|
10
10
|
import { PopsEventDetails, PopsHandlerEventDetails } from "../types/event";
|
|
11
|
-
import {
|
|
12
|
-
import type {
|
|
11
|
+
import { PopsInstCommonConfig } from "../types/inst";
|
|
12
|
+
import type { PopsDetails, PopsInstStoreType, PopsType, PopsSupportAnimType } from "../types/main";
|
|
13
13
|
export declare const PopsHandler: {
|
|
14
14
|
/**
|
|
15
15
|
* 创建shadow
|
|
@@ -50,7 +50,7 @@ export declare const PopsHandler: {
|
|
|
50
50
|
* @param animElement
|
|
51
51
|
* @param type
|
|
52
52
|
*/
|
|
53
|
-
handleQueryElement(animElement: HTMLDivElement, type:
|
|
53
|
+
handleQueryElement(animElement: HTMLDivElement, type: PopsSupportAnimType): {
|
|
54
54
|
/**
|
|
55
55
|
* 主元素
|
|
56
56
|
*/
|
|
@@ -163,7 +163,7 @@ export declare const PopsHandler: {
|
|
|
163
163
|
* @param maskElement 遮罩层
|
|
164
164
|
* @param config 当前配置
|
|
165
165
|
*/
|
|
166
|
-
handleEventDetails(guid: string, $shadowContainer: HTMLDivElement, $shadowRoot: ShadowRoot | HTMLElement, mode:
|
|
166
|
+
handleEventDetails(guid: string, $shadowContainer: HTMLDivElement, $shadowRoot: ShadowRoot | HTMLElement, mode: PopsInstStoreType, animElement: HTMLDivElement, popsElement: HTMLDivElement, maskElement: HTMLDivElement, config: PopsAlertDetails | PopsDrawerDetails | PopsPromptDetails | PopsConfirmDetails | PopsIframeDetails | PopsLoadingDetails | PopsPanelDetails | PopsFolderDetails): PopsEventDetails;
|
|
167
167
|
/**
|
|
168
168
|
* 获取loading的事件配置
|
|
169
169
|
* @param guid
|
|
@@ -217,11 +217,11 @@ export declare const PopsHandler: {
|
|
|
217
217
|
* @param type 当前弹窗类型
|
|
218
218
|
* @param config 配置
|
|
219
219
|
*/
|
|
220
|
-
handleOnly<T extends Required<
|
|
220
|
+
handleOnly<T extends Required<PopsDetails[keyof PopsDetails]>>(type: PopsType, config: T): T;
|
|
221
221
|
/**
|
|
222
222
|
* 处理把已创建的元素保存到内部环境中
|
|
223
223
|
* @param type 当前弹窗类型
|
|
224
224
|
* @param value
|
|
225
225
|
*/
|
|
226
|
-
handlePush(type:
|
|
226
|
+
handlePush(type: PopsInstStoreType, value: PopsInstCommonConfig): void;
|
|
227
227
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PopsEventDetails, PopsHandlerEventDetails } from "./event";
|
|
2
2
|
import type { PopsIconType } from "./icon";
|
|
3
|
-
import type {
|
|
3
|
+
import type { PopsType } from "./main";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* 按钮类型
|
|
@@ -51,7 +51,7 @@ export interface PopsBtnCallBackEvent {
|
|
|
51
51
|
/**
|
|
52
52
|
* 调用的方法
|
|
53
53
|
*/
|
|
54
|
-
mode:
|
|
54
|
+
mode: PopsType;
|
|
55
55
|
/**
|
|
56
56
|
* 唯一id
|
|
57
57
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PopsIframeDetails } from "../components/iframe/types";
|
|
2
|
-
import type {
|
|
2
|
+
import type { PopsType } from "./main";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* 事件配置
|
|
@@ -12,7 +12,7 @@ export interface PopsIframeEventDetails {
|
|
|
12
12
|
/**
|
|
13
13
|
* 当前弹窗类型
|
|
14
14
|
*/
|
|
15
|
-
mode:
|
|
15
|
+
mode: PopsType;
|
|
16
16
|
/**
|
|
17
17
|
* 动画层
|
|
18
18
|
*/
|
|
@@ -47,7 +47,7 @@ export interface PopsEventDetails {
|
|
|
47
47
|
/** 遮罩层 */
|
|
48
48
|
maskElement?: HTMLDivElement;
|
|
49
49
|
/** 当前弹窗类型 */
|
|
50
|
-
mode:
|
|
50
|
+
mode: PopsType;
|
|
51
51
|
guid: string;
|
|
52
52
|
close: () => Promise<void>;
|
|
53
53
|
hide: () => Promise<void>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* config
|
|
2
|
+
* config实例配置
|
|
3
3
|
*/
|
|
4
|
-
export interface
|
|
4
|
+
export interface PopsInstConfig {
|
|
5
5
|
/** 固定id */
|
|
6
6
|
guid: string;
|
|
7
7
|
/** 动画元素 */
|
|
@@ -11,12 +11,14 @@ export interface PopsLayerConfig {
|
|
|
11
11
|
/** 遮罩层元素 */
|
|
12
12
|
maskElement?: HTMLDivElement;
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
/**
|
|
15
|
+
* config实例通用配置
|
|
16
|
+
*/
|
|
17
|
+
export interface PopsInstCommonConfig extends PopsInstConfig {
|
|
16
18
|
/** shadow容器 */
|
|
17
19
|
$shadowContainer: HTMLDivElement;
|
|
18
20
|
/** shadow容器的shandowRoot */
|
|
19
21
|
$shadowRoot: ShadowRoot | HTMLElement;
|
|
20
22
|
/** 移除实例前的回调函数 */
|
|
21
|
-
beforeRemoveCallBack?: (
|
|
23
|
+
beforeRemoveCallBack?: (instCommonConfig: PopsInstCommonConfig) => void;
|
|
22
24
|
}
|
|
@@ -22,7 +22,7 @@ export interface PopsUtilsOwnObject<V extends any> {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
/** pops的所有类型配置 10个 */
|
|
25
|
-
export interface
|
|
25
|
+
export interface PopsDetails {
|
|
26
26
|
alert: PopsAlertDetails;
|
|
27
27
|
confirm: PopsConfirmDetails;
|
|
28
28
|
prompt: PopsPromptDetails;
|
|
@@ -35,42 +35,17 @@ export interface PopsAllDetails {
|
|
|
35
35
|
rightClickMenu: PopsRightClickMenuDetails;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
/** pops的类型配置 8个 */
|
|
39
|
-
export interface PopsTypeDetails {
|
|
40
|
-
alert: PopsAlertDetails;
|
|
41
|
-
confirm: PopsConfirmDetails;
|
|
42
|
-
prompt: PopsPromptDetails;
|
|
43
|
-
loading: PopsLoadingDetails;
|
|
44
|
-
iframe: PopsIframeDetails;
|
|
45
|
-
// tooltip: PopsToolTipDetails;
|
|
46
|
-
drawer: PopsDrawerDetails;
|
|
47
|
-
folder: PopsFolderDetails;
|
|
48
|
-
panel: PopsPanelDetails;
|
|
49
|
-
// rightClickMenu: PopsRightClickMenuDetails;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/** pops的类型 8个 */
|
|
53
|
-
export type PopsType = keyof PopsTypeDetails;
|
|
54
|
-
|
|
55
38
|
/** pops所有的类型 10个 */
|
|
56
|
-
export type
|
|
39
|
+
export type PopsType = keyof PopsDetails;
|
|
57
40
|
|
|
58
|
-
/** 存储实例的类型
|
|
59
|
-
export type
|
|
41
|
+
/** 存储实例的类型 10个 */
|
|
42
|
+
export type PopsInstStoreType = PopsType;
|
|
43
|
+
|
|
44
|
+
/** pops弹窗支持动画元素的配置 8个 */
|
|
45
|
+
export type PopsSupportAnim = Omit<PopsDetails, "tooltip" | "rightClickMenu">;
|
|
60
46
|
|
|
61
|
-
/** pops弹窗支持动画元素的配置 */
|
|
62
|
-
export interface PopsSupportAnim {
|
|
63
|
-
alert: PopsAlertDetails;
|
|
64
|
-
confirm: PopsConfirmDetails;
|
|
65
|
-
prompt: PopsPromptDetails;
|
|
66
|
-
loading: PopsLoadingDetails;
|
|
67
|
-
iframe: PopsIframeDetails;
|
|
68
|
-
drawer: PopsDrawerDetails;
|
|
69
|
-
folder: PopsFolderDetails;
|
|
70
|
-
panel: PopsPanelDetails;
|
|
71
|
-
}
|
|
72
47
|
/** pops弹窗支持动画元素的类型 */
|
|
73
|
-
export type
|
|
48
|
+
export type PopsSupportAnimType = keyof PopsSupportAnim;
|
|
74
49
|
|
|
75
50
|
/** pops弹窗支持标题栏的配置 */
|
|
76
51
|
export interface PopsSupportHeaderTitle {
|
|
@@ -6,8 +6,8 @@ import type { PopsIframeDetails } from "../components/iframe/types";
|
|
|
6
6
|
import type { PopsLoadingDetails } from "../components/loading/types";
|
|
7
7
|
import type { PopsPanelDetails } from "../components/panel/types";
|
|
8
8
|
import type { PopsPromptDetails } from "../components/prompt/types/index";
|
|
9
|
-
import type {
|
|
10
|
-
import type {
|
|
9
|
+
import type { PopsInstCommonConfig } from "../types/inst";
|
|
10
|
+
import type { PopsInstStoreType } from "../types/main";
|
|
11
11
|
export declare const PopsInstanceUtils: {
|
|
12
12
|
/**
|
|
13
13
|
* 获取页面中最大的z-index的元素信息
|
|
@@ -44,40 +44,40 @@ export declare const PopsInstanceUtils: {
|
|
|
44
44
|
getMaxZIndex(deviation?: number): number;
|
|
45
45
|
/**
|
|
46
46
|
* 删除配置中对应的对象
|
|
47
|
-
* @param
|
|
47
|
+
* @param instConfigList 配置实例列表
|
|
48
48
|
* @param guid 唯一标识
|
|
49
49
|
* @param isAll 是否全部删除
|
|
50
50
|
*/
|
|
51
|
-
removeInstance(
|
|
51
|
+
removeInstance(instConfigList: PopsInstCommonConfig[][], guid: string, isAll?: boolean): PopsInstCommonConfig[][];
|
|
52
52
|
/**
|
|
53
53
|
* 隐藏
|
|
54
54
|
* @param popsType
|
|
55
|
-
* @param
|
|
55
|
+
* @param instConfigList
|
|
56
56
|
* @param guid
|
|
57
57
|
* @param config
|
|
58
58
|
* @param animElement
|
|
59
59
|
* @param maskElement
|
|
60
60
|
*/
|
|
61
|
-
hide(popsType:
|
|
61
|
+
hide(popsType: PopsInstStoreType, instConfigList: PopsInstCommonConfig[], guid: string, config: PopsAlertDetails | PopsDrawerDetails | PopsPromptDetails | PopsConfirmDetails | PopsIframeDetails | PopsLoadingDetails | PopsPanelDetails | PopsFolderDetails, animElement: HTMLElement, maskElement: HTMLElement): Promise<void>;
|
|
62
62
|
/**
|
|
63
63
|
* 显示
|
|
64
64
|
* @param popsType
|
|
65
|
-
* @param
|
|
65
|
+
* @param instConfigList
|
|
66
66
|
* @param guid
|
|
67
67
|
* @param config
|
|
68
68
|
* @param animElement
|
|
69
69
|
* @param maskElement
|
|
70
70
|
*/
|
|
71
|
-
show(popsType:
|
|
71
|
+
show(popsType: PopsInstStoreType, instConfigList: PopsInstCommonConfig[], guid: string, config: PopsAlertDetails | PopsDrawerDetails | PopsPromptDetails | PopsConfirmDetails | PopsIframeDetails | PopsLoadingDetails | PopsPanelDetails | PopsFolderDetails, animElement: HTMLElement, maskElement?: HTMLElement): Promise<void>;
|
|
72
72
|
/**
|
|
73
73
|
* 关闭
|
|
74
74
|
* @param popsType
|
|
75
|
-
* @param
|
|
75
|
+
* @param instConfigList
|
|
76
76
|
* @param guid
|
|
77
77
|
* @param config
|
|
78
78
|
* @param animElement
|
|
79
79
|
*/
|
|
80
|
-
close(popsType: string,
|
|
80
|
+
close(popsType: string, instConfigList: PopsInstCommonConfig[], guid: string, config: PopsAlertDetails | PopsDrawerDetails | PopsPromptDetails | PopsConfirmDetails | PopsIframeDetails | PopsLoadingDetails | PopsPanelDetails | PopsFolderDetails, animElement: HTMLElement): Promise<void>;
|
|
81
81
|
/**
|
|
82
82
|
* 拖拽元素
|
|
83
83
|
* 说明:
|
package/package.json
CHANGED
package/src/Pops.ts
CHANGED
|
@@ -29,7 +29,7 @@ import { GlobalConfig } from "./GlobalConfig";
|
|
|
29
29
|
import { PopsTooltip } from "./components/tooltip";
|
|
30
30
|
import { PopsCSS } from "./PopsCSS";
|
|
31
31
|
import { PopsIcon } from "./PopsIcon";
|
|
32
|
-
import {
|
|
32
|
+
import { PopsInstData } from "./PopsInst";
|
|
33
33
|
import { PopsAnimation } from "./PopsAnimation";
|
|
34
34
|
|
|
35
35
|
class Pops {
|
|
@@ -43,7 +43,7 @@ class Pops {
|
|
|
43
43
|
/** 当前已配置的动画@keyframes名字映射(初始化时生成) */
|
|
44
44
|
animation: PopsAnimation.$data,
|
|
45
45
|
/** 存储已创建的元素 */
|
|
46
|
-
|
|
46
|
+
instData: PopsInstData,
|
|
47
47
|
/** 禁止滚动 */
|
|
48
48
|
forbiddenScroll: {
|
|
49
49
|
event(event: Event) {
|
package/src/PopsInst.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { PopsInstCommonConfig } from "./types/inst";
|
|
2
|
+
import type { PopsInstStoreType } from "./types/main";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 弹窗实例数据
|
|
6
|
+
*/
|
|
7
|
+
export const PopsInstData: {
|
|
8
|
+
[key in PopsInstStoreType]: PopsInstCommonConfig[];
|
|
9
|
+
} = {
|
|
10
|
+
alert: [],
|
|
11
|
+
confirm: [],
|
|
12
|
+
drawer: [],
|
|
13
|
+
folder: [],
|
|
14
|
+
iframe: [],
|
|
15
|
+
loading: [],
|
|
16
|
+
panel: [],
|
|
17
|
+
prompt: [],
|
|
18
|
+
rightClickMenu: [],
|
|
19
|
+
// 没有 searchSuggestion
|
|
20
|
+
tooltip: [],
|
|
21
|
+
};
|
|
@@ -5,7 +5,7 @@ import { popsDOMUtils } from "../../utils/PopsDOMUtils";
|
|
|
5
5
|
import { PopsInstanceUtils } from "../../utils/PopsInstanceUtils";
|
|
6
6
|
import { popsUtils } from "../../utils/PopsUtils";
|
|
7
7
|
import { PopsAlertConfig } from "./config";
|
|
8
|
-
import type {
|
|
8
|
+
import type { PopsType } from "../../types/main";
|
|
9
9
|
import type { PopsAlertDetails } from "./types";
|
|
10
10
|
import { PopsCSS } from "../../PopsCSS";
|
|
11
11
|
|
|
@@ -13,7 +13,7 @@ export const PopsAlert = {
|
|
|
13
13
|
init(details: PopsAlertDetails) {
|
|
14
14
|
const guid = popsUtils.getRandomGUID();
|
|
15
15
|
// 设置当前类型
|
|
16
|
-
const PopsType:
|
|
16
|
+
const PopsType: PopsType = "alert";
|
|
17
17
|
let config = PopsAlertConfig();
|
|
18
18
|
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
19
19
|
config = popsUtils.assign(config, details);
|
|
@@ -3,7 +3,7 @@ import { GlobalConfig } from "../../GlobalConfig";
|
|
|
3
3
|
import { PopsElementHandler } from "../../handler/PopsElementHandler";
|
|
4
4
|
import { PopsHandler } from "../../handler/PopsHandler";
|
|
5
5
|
import { PopsCSS } from "../../PopsCSS";
|
|
6
|
-
import {
|
|
6
|
+
import { PopsInstData } from "../../PopsInst";
|
|
7
7
|
import type { PopsEventDetails } from "../../types/event";
|
|
8
8
|
import { popsDOMUtils } from "../../utils/PopsDOMUtils";
|
|
9
9
|
import { PopsInstanceUtils } from "../../utils/PopsInstanceUtils";
|
|
@@ -323,7 +323,7 @@ export const PopsIframe = {
|
|
|
323
323
|
(event) => {
|
|
324
324
|
event.preventDefault();
|
|
325
325
|
event.stopPropagation();
|
|
326
|
-
PopsInstanceUtils.removeInstance([
|
|
326
|
+
PopsInstanceUtils.removeInstance([PopsInstData.iframe], guid, false);
|
|
327
327
|
if (typeof config?.btn?.close?.callback === "function") {
|
|
328
328
|
config.btn.close.callback(eventDetails, event);
|
|
329
329
|
}
|
|
@@ -184,8 +184,8 @@ export const PopsRightClickMenu = {
|
|
|
184
184
|
guid: guid,
|
|
185
185
|
animElement: rootElement,
|
|
186
186
|
popsElement: rootElement,
|
|
187
|
-
beforeRemoveCallBack(
|
|
188
|
-
PopsContextMenu.closeAllMenu(
|
|
187
|
+
beforeRemoveCallBack(instCommonConfig) {
|
|
188
|
+
PopsContextMenu.closeAllMenu(instCommonConfig.popsElement);
|
|
189
189
|
},
|
|
190
190
|
});
|
|
191
191
|
}
|
package/src/css/scrollbar.css
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* ::-webkit-scrollbar 是非标准的css */
|
|
2
|
+
/* https://caniuse.com/?search=%20%3A%3A-webkit-scrollbar */
|
|
2
3
|
.pops ::-webkit-scrollbar {
|
|
3
4
|
width: 6px;
|
|
4
5
|
height: 0;
|
|
5
6
|
}
|
|
6
7
|
|
|
8
|
+
/* 滚动条轨道 */
|
|
7
9
|
.pops ::-webkit-scrollbar-track {
|
|
8
10
|
width: 0;
|
|
9
11
|
}
|
|
10
|
-
|
|
11
|
-
background: rgb(178, 178, 178, var(--pops-bg-opacity));
|
|
12
|
-
}
|
|
12
|
+
/* 滚动条滑块 */
|
|
13
13
|
.pops ::-webkit-scrollbar-thumb {
|
|
14
14
|
min-height: 28px;
|
|
15
15
|
border-radius: 2em;
|
|
16
|
-
background: rgb(204, 204, 204, var(--pops-bg-opacity));
|
|
16
|
+
background: rgb(204, 204, 204, var(--pops-bg-opacity, 1));
|
|
17
17
|
background-clip: padding-box;
|
|
18
18
|
}
|
|
19
|
+
/* 滚动条滑块 */
|
|
20
|
+
.pops ::-webkit-scrollbar-thumb:hover {
|
|
21
|
+
background: rgb(178, 178, 178, var(--pops-bg-opacity, 1));
|
|
22
|
+
}
|
|
@@ -7,7 +7,7 @@ import type {
|
|
|
7
7
|
PopsSupportBottomBtn,
|
|
8
8
|
PopsSupportContent,
|
|
9
9
|
PopsSupportHeaderTitle,
|
|
10
|
-
|
|
10
|
+
PopsSupportAnimType,
|
|
11
11
|
PopsTypeSupportBottomBtn,
|
|
12
12
|
PopsTypeSupportContent,
|
|
13
13
|
PopsTypeSupportHeaderTitle,
|
|
@@ -40,7 +40,7 @@ export const PopsElementHandler = {
|
|
|
40
40
|
*/
|
|
41
41
|
getAnimHTML(
|
|
42
42
|
guid: string,
|
|
43
|
-
type:
|
|
43
|
+
type: PopsSupportAnimType,
|
|
44
44
|
config: PopsSupportAnim[keyof PopsSupportAnim],
|
|
45
45
|
html = "",
|
|
46
46
|
bottomBtnHTML = "",
|
|
@@ -8,15 +8,15 @@ import type { PopsPanelDetails } from "../components/panel/types";
|
|
|
8
8
|
import type { PopsPromptDetails } from "../components/prompt/types/index";
|
|
9
9
|
import { PopsCore } from "../PopsCore";
|
|
10
10
|
import { PopsAnimation } from "../PopsAnimation";
|
|
11
|
-
import {
|
|
11
|
+
import { PopsInstData } from "../PopsInst";
|
|
12
12
|
import type { PopsCommonConfig } from "../types/components";
|
|
13
13
|
import { PopsEventDetails, PopsHandlerEventDetails } from "../types/event";
|
|
14
|
-
import {
|
|
14
|
+
import { PopsInstCommonConfig } from "../types/inst";
|
|
15
15
|
import type {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
PopsMode,
|
|
16
|
+
PopsDetails,
|
|
17
|
+
PopsInstStoreType,
|
|
19
18
|
PopsType,
|
|
19
|
+
PopsSupportAnimType,
|
|
20
20
|
} from "../types/main";
|
|
21
21
|
import { popsDOMUtils } from "../utils/PopsDOMUtils";
|
|
22
22
|
import { PopsInstanceUtils } from "../utils/PopsInstanceUtils";
|
|
@@ -145,13 +145,13 @@ export const PopsHandler = {
|
|
|
145
145
|
function clickEvent(event: MouseEvent | PointerEvent) {
|
|
146
146
|
popsDOMUtils.preventEvent(event);
|
|
147
147
|
// 获取该类型实例存储列表
|
|
148
|
-
let
|
|
148
|
+
let targetInst = PopsInstData[details.type];
|
|
149
149
|
function originalRun() {
|
|
150
150
|
if (details.config.mask!.clickEvent!.toClose) {
|
|
151
151
|
/* 关闭 */
|
|
152
152
|
return PopsInstanceUtils.close(
|
|
153
153
|
details.type,
|
|
154
|
-
|
|
154
|
+
targetInst,
|
|
155
155
|
details.guid,
|
|
156
156
|
details.config,
|
|
157
157
|
details.animElement
|
|
@@ -160,7 +160,7 @@ export const PopsHandler = {
|
|
|
160
160
|
/* 隐藏 */
|
|
161
161
|
return PopsInstanceUtils.hide(
|
|
162
162
|
details.type,
|
|
163
|
-
|
|
163
|
+
targetInst,
|
|
164
164
|
details.guid,
|
|
165
165
|
details.config,
|
|
166
166
|
details.animElement,
|
|
@@ -234,7 +234,7 @@ export const PopsHandler = {
|
|
|
234
234
|
* @param animElement
|
|
235
235
|
* @param type
|
|
236
236
|
*/
|
|
237
|
-
handleQueryElement(animElement: HTMLDivElement, type:
|
|
237
|
+
handleQueryElement(animElement: HTMLDivElement, type: PopsSupportAnimType) {
|
|
238
238
|
return {
|
|
239
239
|
/**
|
|
240
240
|
* 主元素
|
|
@@ -408,7 +408,7 @@ export const PopsHandler = {
|
|
|
408
408
|
guid: string,
|
|
409
409
|
$shadowContainer: HTMLDivElement,
|
|
410
410
|
$shadowRoot: ShadowRoot | HTMLElement,
|
|
411
|
-
mode:
|
|
411
|
+
mode: PopsInstStoreType,
|
|
412
412
|
animElement: HTMLDivElement,
|
|
413
413
|
popsElement: HTMLDivElement,
|
|
414
414
|
maskElement: HTMLDivElement,
|
|
@@ -434,7 +434,7 @@ export const PopsHandler = {
|
|
|
434
434
|
close() {
|
|
435
435
|
return PopsInstanceUtils.close(
|
|
436
436
|
mode,
|
|
437
|
-
|
|
437
|
+
PopsInstData[mode],
|
|
438
438
|
guid,
|
|
439
439
|
config,
|
|
440
440
|
animElement
|
|
@@ -443,7 +443,7 @@ export const PopsHandler = {
|
|
|
443
443
|
hide() {
|
|
444
444
|
return PopsInstanceUtils.hide(
|
|
445
445
|
mode,
|
|
446
|
-
|
|
446
|
+
PopsInstData[mode],
|
|
447
447
|
guid,
|
|
448
448
|
config,
|
|
449
449
|
animElement,
|
|
@@ -453,7 +453,7 @@ export const PopsHandler = {
|
|
|
453
453
|
show() {
|
|
454
454
|
return PopsInstanceUtils.show(
|
|
455
455
|
mode,
|
|
456
|
-
|
|
456
|
+
PopsInstData[mode],
|
|
457
457
|
guid,
|
|
458
458
|
config,
|
|
459
459
|
animElement,
|
|
@@ -497,7 +497,7 @@ export const PopsHandler = {
|
|
|
497
497
|
close() {
|
|
498
498
|
return PopsInstanceUtils.close(
|
|
499
499
|
mode,
|
|
500
|
-
|
|
500
|
+
PopsInstData[mode],
|
|
501
501
|
guid,
|
|
502
502
|
config,
|
|
503
503
|
animElement
|
|
@@ -506,7 +506,7 @@ export const PopsHandler = {
|
|
|
506
506
|
hide() {
|
|
507
507
|
return PopsInstanceUtils.hide(
|
|
508
508
|
mode,
|
|
509
|
-
|
|
509
|
+
PopsInstData[mode],
|
|
510
510
|
guid,
|
|
511
511
|
config,
|
|
512
512
|
animElement,
|
|
@@ -516,7 +516,7 @@ export const PopsHandler = {
|
|
|
516
516
|
show() {
|
|
517
517
|
return PopsInstanceUtils.show(
|
|
518
518
|
mode,
|
|
519
|
-
|
|
519
|
+
PopsInstData[mode],
|
|
520
520
|
guid,
|
|
521
521
|
config,
|
|
522
522
|
animElement,
|
|
@@ -660,8 +660,8 @@ export const PopsHandler = {
|
|
|
660
660
|
* @param type 当前弹窗类型
|
|
661
661
|
* @param config 配置
|
|
662
662
|
*/
|
|
663
|
-
handleOnly<T extends Required<
|
|
664
|
-
type:
|
|
663
|
+
handleOnly<T extends Required<PopsDetails[keyof PopsDetails]>>(
|
|
664
|
+
type: PopsType,
|
|
665
665
|
config: T
|
|
666
666
|
): T {
|
|
667
667
|
if (config.only) {
|
|
@@ -670,20 +670,20 @@ export const PopsHandler = {
|
|
|
670
670
|
type === "tooltip" ||
|
|
671
671
|
type === "rightClickMenu"
|
|
672
672
|
) {
|
|
673
|
-
let
|
|
674
|
-
if (
|
|
675
|
-
PopsInstanceUtils.removeInstance([
|
|
673
|
+
let inst = PopsInstData[type as keyof typeof PopsInstData];
|
|
674
|
+
if (inst) {
|
|
675
|
+
PopsInstanceUtils.removeInstance([inst], "", true);
|
|
676
676
|
}
|
|
677
677
|
} else {
|
|
678
678
|
PopsInstanceUtils.removeInstance(
|
|
679
679
|
[
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
680
|
+
PopsInstData.alert,
|
|
681
|
+
PopsInstData.confirm,
|
|
682
|
+
PopsInstData.prompt,
|
|
683
|
+
PopsInstData.iframe,
|
|
684
|
+
PopsInstData.drawer,
|
|
685
|
+
PopsInstData.folder,
|
|
686
|
+
PopsInstData.panel,
|
|
687
687
|
],
|
|
688
688
|
"",
|
|
689
689
|
true
|
|
@@ -707,7 +707,7 @@ export const PopsHandler = {
|
|
|
707
707
|
* @param type 当前弹窗类型
|
|
708
708
|
* @param value
|
|
709
709
|
*/
|
|
710
|
-
handlePush(type:
|
|
711
|
-
|
|
710
|
+
handlePush(type: PopsInstStoreType, value: PopsInstCommonConfig) {
|
|
711
|
+
PopsInstData[type].push(value);
|
|
712
712
|
},
|
|
713
713
|
};
|
package/src/types/button.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PopsEventDetails, PopsHandlerEventDetails } from "./event";
|
|
2
2
|
import type { PopsIconType } from "./icon";
|
|
3
|
-
import type {
|
|
3
|
+
import type { PopsType } from "./main";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* 按钮类型
|
|
@@ -51,7 +51,7 @@ export interface PopsBtnCallBackEvent {
|
|
|
51
51
|
/**
|
|
52
52
|
* 调用的方法
|
|
53
53
|
*/
|
|
54
|
-
mode:
|
|
54
|
+
mode: PopsType;
|
|
55
55
|
/**
|
|
56
56
|
* 唯一id
|
|
57
57
|
*/
|