@whitesev/pops 2.5.5 → 2.6.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.
Files changed (53) hide show
  1. package/dist/index.amd.js +158 -150
  2. package/dist/index.amd.js.map +1 -1
  3. package/dist/index.amd.min.js +1 -1
  4. package/dist/index.amd.min.js.map +1 -1
  5. package/dist/index.cjs.js +158 -150
  6. package/dist/index.cjs.js.map +1 -1
  7. package/dist/index.cjs.min.js +1 -1
  8. package/dist/index.cjs.min.js.map +1 -1
  9. package/dist/index.esm.js +158 -150
  10. package/dist/index.esm.js.map +1 -1
  11. package/dist/index.esm.min.js +1 -1
  12. package/dist/index.esm.min.js.map +1 -1
  13. package/dist/index.iife.js +158 -150
  14. package/dist/index.iife.js.map +1 -1
  15. package/dist/index.iife.min.js +1 -1
  16. package/dist/index.iife.min.js.map +1 -1
  17. package/dist/index.system.js +158 -150
  18. package/dist/index.system.js.map +1 -1
  19. package/dist/index.system.min.js +1 -1
  20. package/dist/index.system.min.js.map +1 -1
  21. package/dist/index.umd.js +158 -150
  22. package/dist/index.umd.js.map +1 -1
  23. package/dist/index.umd.min.js +1 -1
  24. package/dist/index.umd.min.js.map +1 -1
  25. package/dist/types/src/Pops.d.ts +14 -14
  26. package/dist/types/src/components/alert/index.d.ts +1 -1
  27. package/dist/types/src/components/confirm/index.d.ts +1 -1
  28. package/dist/types/src/components/drawer/index.d.ts +1 -1
  29. package/dist/types/src/components/folder/index.d.ts +1 -1
  30. package/dist/types/src/components/iframe/index.d.ts +2 -2
  31. package/dist/types/src/components/iframe/types/index.d.ts +6 -6
  32. package/dist/types/src/components/loading/index.d.ts +1 -1
  33. package/dist/types/src/components/panel/index.d.ts +4 -4
  34. package/dist/types/src/components/prompt/index.d.ts +1 -1
  35. package/dist/types/src/handler/PopsHandler.d.ts +18 -17
  36. package/dist/types/src/types/button.d.ts +4 -4
  37. package/dist/types/src/types/event.d.ts +7 -7
  38. package/dist/types/src/utils/PopsInstanceUtils.d.ts +8 -8
  39. package/package.json +5 -5
  40. package/src/components/alert/index.ts +13 -13
  41. package/src/components/confirm/index.ts +15 -16
  42. package/src/components/drawer/index.ts +22 -22
  43. package/src/components/folder/index.ts +14 -14
  44. package/src/components/iframe/index.ts +19 -20
  45. package/src/components/iframe/types/index.ts +6 -6
  46. package/src/components/loading/index.ts +8 -8
  47. package/src/components/panel/index.css +12 -1
  48. package/src/components/panel/index.ts +11 -11
  49. package/src/components/prompt/index.ts +28 -29
  50. package/src/handler/PopsHandler.ts +70 -68
  51. package/src/types/button.d.ts +4 -4
  52. package/src/types/event.d.ts +7 -7
  53. package/src/utils/PopsInstanceUtils.ts +28 -24
@@ -197,9 +197,9 @@ declare class Pops {
197
197
  };
198
198
  getMaxZIndex(deviation?: number): number;
199
199
  removeInstance(instConfigList: import("./types/inst").PopsInstCommonConfig[][], guid: string, isAll?: boolean): import("./types/inst").PopsInstCommonConfig[][];
200
- 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>;
201
- 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>;
202
- close(popsType: string, instConfigList: import("./types/inst").PopsInstCommonConfig[], guid: string, config: PopsAlertDetails | PopsDrawerDetails | PopsPromptDetails | PopsConfirmDetails | PopsIframeDetails | PopsLoadingDetails | PopsPanelDetails | PopsFolderDetails, animElement: HTMLElement): Promise<void>;
200
+ hide(config: PopsAlertDetails | PopsDrawerDetails | PopsPromptDetails | PopsConfirmDetails | PopsIframeDetails | PopsLoadingDetails | PopsPanelDetails | PopsFolderDetails, popsType: import("./types/main").PopsInstStoreType, instConfigList: import("./types/inst").PopsInstCommonConfig[], guid: string, $anim: HTMLElement, $mask?: HTMLElement): Promise<void>;
201
+ show(config: PopsAlertDetails | PopsDrawerDetails | PopsPromptDetails | PopsConfirmDetails | PopsIframeDetails | PopsLoadingDetails | PopsPanelDetails | PopsFolderDetails, popsType: import("./types/main").PopsInstStoreType, instConfigList: import("./types/inst").PopsInstCommonConfig[], guid: string, $anim: HTMLElement, $mask?: HTMLElement): Promise<void>;
202
+ close(config: PopsAlertDetails | PopsDrawerDetails | PopsPromptDetails | PopsConfirmDetails | PopsIframeDetails | PopsLoadingDetails | PopsPanelDetails | PopsFolderDetails, popsType: string, instConfigList: import("./types/inst").PopsInstCommonConfig[], guid: string, $anim: HTMLElement): Promise<void>;
203
203
  drag(moveElement: HTMLElement, options: {
204
204
  dragElement: HTMLElement;
205
205
  limit: boolean;
@@ -326,27 +326,27 @@ declare class Pops {
326
326
  * 普通信息框
327
327
  * @param details 配置
328
328
  */
329
- alert: (details: PopsAlertDetails) => Omit<import("./types/event").PopsEventDetails, "function" | "type">;
329
+ alert: (details: PopsAlertDetails) => Omit<import("./types/event").PopsEventConfig, "function" | "type">;
330
330
  /**
331
331
  * 询问框
332
332
  * @param details 配置
333
333
  */
334
- confirm: (details: PopsConfirmDetails) => Omit<import("./types/event").PopsEventDetails, "function" | "type">;
334
+ confirm: (details: PopsConfirmDetails) => Omit<import("./types/event").PopsEventConfig, "function" | "type">;
335
335
  /**
336
336
  * 输入框
337
337
  * @param details 配置
338
338
  */
339
- prompt: (details: PopsPromptDetails) => Omit<import("./types/event").PopsEventDetails, "function" | "type">;
339
+ prompt: (details: PopsPromptDetails) => Omit<import("./types/event").PopsEventConfig, "function" | "type">;
340
340
  /**
341
341
  * 加载层
342
342
  * @param details 配置
343
343
  */
344
- loading: (details: PopsLoadingDetails) => Omit<Omit<import("./types/event").PopsEventDetails, "$shadowContainer" | "$shadowRoot">, "function" | "type">;
344
+ loading: (details: PopsLoadingDetails) => Omit<Omit<import("./types/event").PopsEventConfig, "$shadowContainer" | "$shadowRoot">, "function" | "type">;
345
345
  /**
346
346
  * iframe层
347
347
  * @param details 配置
348
348
  */
349
- iframe: (details: PopsIframeDetails) => Omit<import("./types/event").PopsEventDetails & {
349
+ iframe: (details: PopsIframeDetails) => Omit<import("./types/event").PopsEventConfig & {
350
350
  iframeElement: HTMLIFrameElement;
351
351
  }, "function" | "type">;
352
352
  /**
@@ -407,12 +407,12 @@ declare class Pops {
407
407
  * 抽屉
408
408
  * @param details 配置
409
409
  */
410
- drawer: (details: PopsDrawerDetails) => Omit<import("./types/event").PopsEventDetails, "function" | "type">;
410
+ drawer: (details: PopsDrawerDetails) => Omit<import("./types/event").PopsEventConfig, "function" | "type">;
411
411
  /**
412
412
  * 文件夹
413
413
  * @param details 配置
414
414
  */
415
- folder: (details: PopsFolderDetails) => Omit<import("./types/event").PopsEventDetails, "function" | "type">;
415
+ folder: (details: PopsFolderDetails) => Omit<import("./types/event").PopsEventConfig, "function" | "type">;
416
416
  /**
417
417
  * 配置面板
418
418
  * @param details 配置
@@ -426,10 +426,10 @@ declare class Pops {
426
426
  guid: string;
427
427
  $shadowContainer: HTMLDivElement;
428
428
  $shadowRoot: ShadowRoot | HTMLElement;
429
- element: HTMLDivElement;
430
- animElement: HTMLDivElement;
431
- popsElement: HTMLDivElement;
432
- maskElement?: HTMLDivElement | undefined;
429
+ $el: HTMLDivElement;
430
+ $anim: HTMLDivElement;
431
+ $pops: HTMLDivElement;
432
+ $mask?: HTMLDivElement | undefined;
433
433
  mode: import("./types/main").PopsType;
434
434
  };
435
435
  /**
@@ -1,4 +1,4 @@
1
1
  import type { PopsAlertDetails } from "./types";
2
2
  export declare const PopsAlert: {
3
- init(details: PopsAlertDetails): Omit<import("../../types/event").PopsEventDetails, "function" | "type">;
3
+ init(details: PopsAlertDetails): Omit<import("../../types/event").PopsEventConfig, "function" | "type">;
4
4
  };
@@ -1,4 +1,4 @@
1
1
  import type { PopsConfirmDetails } from "./types";
2
2
  export declare const PopsConfirm: {
3
- init(details: PopsConfirmDetails): Omit<import("../../types/event").PopsEventDetails, "function" | "type">;
3
+ init(details: PopsConfirmDetails): Omit<import("../../types/event").PopsEventConfig, "function" | "type">;
4
4
  };
@@ -1,4 +1,4 @@
1
1
  import type { PopsDrawerDetails } from "./types";
2
2
  export declare const PopsDrawer: {
3
- init(details: PopsDrawerDetails): Omit<import("../../types/event").PopsEventDetails, "function" | "type">;
3
+ init(details: PopsDrawerDetails): Omit<import("../../types/event").PopsEventConfig, "function" | "type">;
4
4
  };
@@ -1,4 +1,4 @@
1
1
  import type { PopsFolderDetails } from "./types";
2
2
  export declare const PopsFolder: {
3
- init(details: PopsFolderDetails): Omit<import("../../types/event").PopsEventDetails, "function" | "type">;
3
+ init(details: PopsFolderDetails): Omit<import("../../types/event").PopsEventConfig, "function" | "type">;
4
4
  };
@@ -1,7 +1,7 @@
1
- import type { PopsEventDetails } from "../../types/event";
1
+ import type { PopsEventConfig } from "../../types/event";
2
2
  import type { PopsIframeDetails } from "./types";
3
3
  export declare const PopsIframe: {
4
- init(details: PopsIframeDetails): Omit<PopsEventDetails & {
4
+ init(details: PopsIframeDetails): Omit<PopsEventConfig & {
5
5
  iframeElement: HTMLIFrameElement;
6
6
  }, "function" | "type">;
7
7
  };
@@ -1,5 +1,5 @@
1
1
  import type { PopsTitleConfig, PopsDragConfig, PopsCommonConfig } from "../../../types/components";
2
- import type { PopsEventDetails } from "../../../types/event";
2
+ import type { PopsEventConfig } from "../../../types/event";
3
3
  /**
4
4
  * pops.iframe的按钮的点击回调参数event
5
5
  */
@@ -61,7 +61,7 @@ export interface PopsIframeDetails extends PopsTitleConfig, PopsDragConfig, Pops
61
61
  /**
62
62
  * 点击的回调函数
63
63
  */
64
- callback: (eventDetails: PopsEventDetails & {
64
+ callback: (eventConfig: PopsEventConfig & {
65
65
  iframeElement: HTMLIFrameElement;
66
66
  }, event: MouseEvent | PointerEvent) => void;
67
67
  };
@@ -72,7 +72,7 @@ export interface PopsIframeDetails extends PopsTitleConfig, PopsDragConfig, Pops
72
72
  /**
73
73
  * 点击的回调函数
74
74
  */
75
- callback: (eventDetails: PopsEventDetails & {
75
+ callback: (eventConfig: PopsEventConfig & {
76
76
  iframeElement: HTMLIFrameElement;
77
77
  }, event: MouseEvent | PointerEvent) => void;
78
78
  };
@@ -83,7 +83,7 @@ export interface PopsIframeDetails extends PopsTitleConfig, PopsDragConfig, Pops
83
83
  /**
84
84
  * 点击的回调函数
85
85
  */
86
- callback: (eventDetails: PopsEventDetails & {
86
+ callback: (eventConfig: PopsEventConfig & {
87
87
  iframeElement: HTMLIFrameElement;
88
88
  }, event: MouseEvent | PointerEvent) => void;
89
89
  };
@@ -94,7 +94,7 @@ export interface PopsIframeDetails extends PopsTitleConfig, PopsDragConfig, Pops
94
94
  /**
95
95
  * 点击的回调函数
96
96
  */
97
- callback: (eventDetails: PopsEventDetails & {
97
+ callback: (eventConfig: PopsEventConfig & {
98
98
  iframeElement: HTMLIFrameElement;
99
99
  }, event: MouseEvent | PointerEvent) => void;
100
100
  };
@@ -116,7 +116,7 @@ export interface PopsIframeDetails extends PopsTitleConfig, PopsDragConfig, Pops
116
116
  /**
117
117
  * 加载完毕的回调
118
118
  */
119
- loadEndCallBack?: (details: PopsEventDetails & {
119
+ loadEndCallBack?: (details: PopsEventConfig & {
120
120
  iframeElement: HTMLIFrameElement;
121
121
  }) => void;
122
122
  }
@@ -1,4 +1,4 @@
1
1
  import type { PopsLoadingDetails } from "./types";
2
2
  export declare const PopsLoading: {
3
- init(details: PopsLoadingDetails): Omit<Omit<import("../../types/event").PopsEventDetails, "$shadowContainer" | "$shadowRoot">, "function" | "type">;
3
+ init(details: PopsLoadingDetails): Omit<Omit<import("../../types/event").PopsEventConfig, "$shadowContainer" | "$shadowRoot">, "function" | "type">;
4
4
  };
@@ -10,10 +10,10 @@ export declare const PopsPanel: {
10
10
  guid: string;
11
11
  $shadowContainer: HTMLDivElement;
12
12
  $shadowRoot: ShadowRoot | HTMLElement;
13
- element: HTMLDivElement;
14
- animElement: HTMLDivElement;
15
- popsElement: HTMLDivElement;
16
- maskElement?: HTMLDivElement | undefined;
13
+ $el: HTMLDivElement;
14
+ $anim: HTMLDivElement;
15
+ $pops: HTMLDivElement;
16
+ $mask?: HTMLDivElement | undefined;
17
17
  mode: PopsType;
18
18
  };
19
19
  };
@@ -1,4 +1,4 @@
1
1
  import type { PopsPromptDetails } from "./types/index";
2
2
  export declare const PopsPrompt: {
3
- init(details: PopsPromptDetails): Omit<import("../../types/event").PopsEventDetails, "function" | "type">;
3
+ init(details: PopsPromptDetails): Omit<import("../../types/event").PopsEventConfig, "function" | "type">;
4
4
  };
@@ -7,7 +7,7 @@ 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
9
  import type { PopsCommonConfig } from "../types/components";
10
- import type { PopsEventDetails, PopsHandlerEventDetails } from "../types/event";
10
+ import type { PopsEventConfig, PopsHandlerEventConfig } from "../types/event";
11
11
  import type { PopsInstCommonConfig } from "../types/inst";
12
12
  import type { PopsInstStoreType, PopsType, PopsSupportAnimDetailsType, PopsSupportOnlyDetails } from "../types/main";
13
13
  export declare const PopsHandler: {
@@ -34,9 +34,9 @@ export declare const PopsHandler: {
34
34
  * 处理遮罩层
35
35
  *
36
36
  * + 设置遮罩层的点击事件
37
- * @param details 传递的配置
37
+ * @param config 传递的配置
38
38
  */
39
- handleMask(details?: {
39
+ handleMask(config?: {
40
40
  type: "alert" | "confirm" | "prompt" | "loading" | "iframe" | "drawer" | "folder" | "panel";
41
41
  guid: string;
42
42
  config: Required<PopsAlertDetails> | Required<PopsLoadingDetails> | Required<PopsIframeDetails> | Required<PopsDrawerDetails> | Required<PopsPanelDetails> | Required<PopsFolderDetails>;
@@ -178,34 +178,35 @@ export declare const PopsHandler: {
178
178
  * @param $shadowContainer
179
179
  * @param $shadowRoot
180
180
  * @param mode 当前弹窗类型
181
- * @param animElement 动画层
182
- * @param popsElement 主元素
183
- * @param maskElement 遮罩层
181
+ * @param $anim 动画层
182
+ * @param $pops 主元素
183
+ * @param $mask 遮罩层
184
184
  * @param config 当前配置
185
185
  */
186
- 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;
186
+ handleEventConfig(config: PopsAlertDetails | PopsDrawerDetails | PopsPromptDetails | PopsConfirmDetails | PopsIframeDetails | PopsLoadingDetails | PopsPanelDetails | PopsFolderDetails, guid: string, $shadowContainer: HTMLDivElement, $shadowRoot: ShadowRoot | HTMLElement, mode: PopsInstStoreType, $anim: HTMLDivElement, $pops: HTMLDivElement, $mask?: HTMLDivElement): PopsEventConfig;
187
187
  /**
188
188
  * 获取loading的事件配置
189
189
  * @param guid
190
190
  * @param mode 当前弹窗类型
191
- * @param animElement 动画层
192
- * @param popsElement 主元素
193
- * @param maskElement 遮罩层
191
+ * @param $anim 动画层
192
+ * @param $pops 主元素
193
+ * @param $mask 遮罩层
194
194
  * @param config 当前配置
195
195
  */
196
- handleLoadingEventDetails(guid: string, mode: "loading", animElement: HTMLDivElement, popsElement: HTMLDivElement, maskElement: HTMLDivElement, config: PopsAlertDetails | PopsDrawerDetails | PopsPromptDetails | PopsConfirmDetails | PopsIframeDetails | PopsLoadingDetails | PopsPanelDetails | PopsFolderDetails): Omit<PopsEventDetails, "$shadowContainer" | "$shadowRoot">;
196
+ handleLoadingEventConfig(config: PopsAlertDetails | PopsDrawerDetails | PopsPromptDetails | PopsConfirmDetails | PopsIframeDetails | PopsLoadingDetails | PopsPanelDetails | PopsFolderDetails, guid: string, mode: "loading", $anim: HTMLDivElement, $pops: HTMLDivElement, $mask?: HTMLDivElement): Omit<PopsEventConfig, "$shadowContainer" | "$shadowRoot">;
197
197
  /**
198
- * 处理返回的配置,针对popsHandler.handleEventDetails
198
+ * 处理返回的配置,针对popsHandler.handleEventConfig
199
+ * @param config 配置
199
200
  */
200
- handleResultDetails<T>(details: T): Omit<T, "type" | "function">;
201
+ handleResultConfig<T>(config: T): Omit<T, "type" | "function">;
201
202
  /**
202
203
  * 处理点击事件
203
204
  * @param type 当前按钮类型
204
205
  * @param $btn 按钮元素
205
- * @param eventDetails 事件配置,由popsHandler.handleEventDetails创建的
206
+ * @param eventConfig 事件配置,由popsHandler.handleEventConfig创建的
206
207
  * @param callback 点击回调
207
208
  */
208
- handleClickEvent(type: "cancel" | "close" | "ok" | "other", $btn: HTMLElement, eventDetails: PopsEventDetails, callback: (details: PopsHandlerEventDetails, event: PointerEvent | MouseEvent) => void): void;
209
+ handleClickEvent(type: PopsHandlerEventConfig["type"], $btn: HTMLElement, eventConfig: PopsEventConfig, callback?: (details: PopsHandlerEventConfig, event: PointerEvent | MouseEvent) => void): void;
209
210
  /**
210
211
  * 全局监听键盘事件
211
212
  * @param keyName 键名|键值
@@ -220,10 +221,10 @@ export declare const PopsHandler: {
220
221
  * @param type 触发事件类型
221
222
  * @param inputElement 输入框
222
223
  * @param $btn 按钮元素
223
- * @param eventDetails 事件配置,由popsHandler.handleEventDetails创建的
224
+ * @param eventConfig 事件配置,由popsHandler.handleEventConfig创建的
224
225
  * @param callback 点击回调
225
226
  */
226
- handlePromptClickEvent(type: "ok" | "close" | "cancel" | "other", inputElement: HTMLInputElement | HTMLTextAreaElement, $btn: HTMLElement, eventDetails: PopsEventDetails, callback: (details: PopsEventDetails & {
227
+ handlePromptClickEvent(type: PopsHandlerEventConfig["type"], inputElement: HTMLInputElement | HTMLTextAreaElement, $btn: HTMLElement, eventConfig: PopsEventConfig, callback: (details: PopsEventConfig & {
227
228
  type: any;
228
229
  text: string;
229
230
  }, event: MouseEvent | PointerEvent) => void): void;
@@ -1,4 +1,4 @@
1
- import type { PopsEventDetails, PopsHandlerEventDetails } from "./event";
1
+ import type { PopsEventConfig, PopsHandlerEventConfig } from "./event";
2
2
  import type { PopsIconType } from "./icon";
3
3
  import type { PopsType } from "./main";
4
4
 
@@ -110,7 +110,7 @@ export interface PopsButtonDetails<T = object> {
110
110
  *
111
111
  * 如果传入该值,那么将不会自动关闭弹窗
112
112
  */
113
- callback(eventDetails: PopsHandlerEventDetails & T, event: PointerEvent | MouseEvent): void;
113
+ callback(eventConfig: PopsHandlerEventConfig & T, event: PointerEvent | MouseEvent): void;
114
114
  }
115
115
 
116
116
  /**
@@ -127,7 +127,7 @@ export type PopsButtonDetailsAnyType<T = object> = Omit<PopsButtonDetails<T>, "t
127
127
  /** prompt的点击回调 */
128
128
  export interface PopsPromptButtonDetails extends PopsButtonDetails {
129
129
  callback(
130
- eventDetails: PopsHandlerEventDetails & {
130
+ eventConfig: PopsHandlerEventConfig & {
131
131
  text: string;
132
132
  },
133
133
  event: PointerEvent | MouseEvent
@@ -183,5 +183,5 @@ export interface PopsHeaderCloseButtonDetails {
183
183
  *
184
184
  * 如果传入该值,那么将不会自动关闭弹窗
185
185
  */
186
- callback?: (details: PopsEventDetails, event: PointerEvent | MouseEvent) => void;
186
+ callback?: (details: PopsEventConfig, event: PointerEvent | MouseEvent) => void;
187
187
  }
@@ -4,7 +4,7 @@ import type { PopsType } from "./main";
4
4
  /**
5
5
  * 事件配置
6
6
  */
7
- export interface PopsIframeEventDetails {
7
+ export interface PopsIframeEventConfig {
8
8
  /**
9
9
  * 唯一id
10
10
  */
@@ -33,19 +33,19 @@ export interface PopsIframeEventDetails {
33
33
  /**
34
34
  * 事件配置
35
35
  */
36
- export interface PopsEventDetails {
36
+ export interface PopsEventConfig {
37
37
  /** 最外层包裹的元素 */
38
38
  $shadowContainer: HTMLDivElement;
39
39
  /** ShadowRoot */
40
40
  $shadowRoot: ShadowRoot | HTMLElement;
41
41
  /** -> 动画层 */
42
- element: HTMLDivElement;
42
+ $el: HTMLDivElement;
43
43
  /** 动画层 */
44
- animElement: HTMLDivElement;
44
+ $anim: HTMLDivElement;
45
45
  /** 主元素 */
46
- popsElement: HTMLDivElement;
46
+ $pops: HTMLDivElement;
47
47
  /** 遮罩层 */
48
- maskElement?: HTMLDivElement;
48
+ $mask?: HTMLDivElement;
49
49
  /** 当前弹窗类型 */
50
50
  mode: PopsType;
51
51
  guid: string;
@@ -57,7 +57,7 @@ export interface PopsEventDetails {
57
57
  /**
58
58
  * 处理过的事件配置
59
59
  */
60
- export interface PopsHandlerEventDetails extends PopsEventDetails {
60
+ export interface PopsHandlerEventConfig extends PopsEventConfig {
61
61
  /** 当前按钮类型 */
62
62
  type: "cancel" | "close" | "ok" | "other";
63
63
  }
@@ -55,29 +55,29 @@ export declare const PopsInstanceUtils: {
55
55
  * @param instConfigList
56
56
  * @param guid
57
57
  * @param config
58
- * @param animElement
59
- * @param maskElement
58
+ * @param $anim
59
+ * @param $mask
60
60
  */
61
- hide(popsType: PopsInstStoreType, instConfigList: PopsInstCommonConfig[], guid: string, config: PopsAlertDetails | PopsDrawerDetails | PopsPromptDetails | PopsConfirmDetails | PopsIframeDetails | PopsLoadingDetails | PopsPanelDetails | PopsFolderDetails, animElement: HTMLElement, maskElement: HTMLElement): Promise<void>;
61
+ hide(config: PopsAlertDetails | PopsDrawerDetails | PopsPromptDetails | PopsConfirmDetails | PopsIframeDetails | PopsLoadingDetails | PopsPanelDetails | PopsFolderDetails, popsType: PopsInstStoreType, instConfigList: PopsInstCommonConfig[], guid: string, $anim: HTMLElement, $mask?: HTMLElement): Promise<void>;
62
62
  /**
63
63
  * 显示
64
64
  * @param popsType
65
65
  * @param instConfigList
66
66
  * @param guid
67
67
  * @param config
68
- * @param animElement
69
- * @param maskElement
68
+ * @param $anim
69
+ * @param $mask
70
70
  */
71
- show(popsType: PopsInstStoreType, instConfigList: PopsInstCommonConfig[], guid: string, config: PopsAlertDetails | PopsDrawerDetails | PopsPromptDetails | PopsConfirmDetails | PopsIframeDetails | PopsLoadingDetails | PopsPanelDetails | PopsFolderDetails, animElement: HTMLElement, maskElement?: HTMLElement): Promise<void>;
71
+ show(config: PopsAlertDetails | PopsDrawerDetails | PopsPromptDetails | PopsConfirmDetails | PopsIframeDetails | PopsLoadingDetails | PopsPanelDetails | PopsFolderDetails, popsType: PopsInstStoreType, instConfigList: PopsInstCommonConfig[], guid: string, $anim: HTMLElement, $mask?: HTMLElement): Promise<void>;
72
72
  /**
73
73
  * 关闭
74
74
  * @param popsType
75
75
  * @param instConfigList
76
76
  * @param guid
77
77
  * @param config
78
- * @param animElement
78
+ * @param $anim
79
79
  */
80
- close(popsType: string, instConfigList: PopsInstCommonConfig[], guid: string, config: PopsAlertDetails | PopsDrawerDetails | PopsPromptDetails | PopsConfirmDetails | PopsIframeDetails | PopsLoadingDetails | PopsPanelDetails | PopsFolderDetails, animElement: HTMLElement): Promise<void>;
80
+ close(config: PopsAlertDetails | PopsDrawerDetails | PopsPromptDetails | PopsConfirmDetails | PopsIframeDetails | PopsLoadingDetails | PopsPanelDetails | PopsFolderDetails, popsType: string, instConfigList: PopsInstCommonConfig[], guid: string, $anim: HTMLElement): Promise<void>;
81
81
  /**
82
82
  * 拖拽元素
83
83
  * 说明:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whitesev/pops",
3
- "version": "2.5.5",
3
+ "version": "2.6.0",
4
4
  "description": "弹窗库",
5
5
  "type": "module",
6
6
  "homepage": "https://github.com/WhiteSevs/TamperMonkeyScript/tree/master/lib/pops#readme",
@@ -44,7 +44,7 @@
44
44
  "worker-timers": "^8.0.25"
45
45
  },
46
46
  "devDependencies": {
47
- "@eslint/js": "^9.37.0",
47
+ "@eslint/js": "^9.38.0",
48
48
  "@rollup/plugin-commonjs": "^28.0.8",
49
49
  "@rollup/plugin-json": "^6.1.0",
50
50
  "@rollup/plugin-node-resolve": "^16.0.3",
@@ -52,17 +52,17 @@
52
52
  "@rollup/plugin-typescript": "12.1.4",
53
53
  "browserslist": "^4.26.3",
54
54
  "caniuse-lite": "^1.0.30001751",
55
- "eslint": "^9.37.0",
55
+ "eslint": "^9.38.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
59
  "globals": "^16.4.0",
60
- "rollup": "^4.52.4",
60
+ "rollup": "^4.52.5",
61
61
  "rollup-plugin-clear": "^2.0.7",
62
62
  "rollup-plugin-import-css": "^4.0.2",
63
63
  "tslib": "^2.8.1",
64
64
  "typescript": "^5.9.3",
65
- "typescript-eslint": "^8.46.1"
65
+ "typescript-eslint": "^8.46.2"
66
66
  },
67
67
  "scripts": {
68
68
  "lint": "eslint .",
@@ -89,42 +89,42 @@ export const PopsAlert = {
89
89
  } = PopsHandler.handleQueryElement($anim, popsType);
90
90
 
91
91
  /** 遮罩层元素 */
92
- let $mask: HTMLDivElement | null = null;
92
+ let $mask: HTMLDivElement | undefined = void 0;
93
93
  /** 已创建的元素列表 */
94
- const elementList: HTMLElement[] = [$anim];
94
+ const $elList: HTMLElement[] = [$anim];
95
95
 
96
96
  /* 遮罩层元素 */
97
97
 
98
98
  if (config.mask.enable) {
99
- const _handleMask_ = PopsHandler.handleMask({
99
+ const handleMask = PopsHandler.handleMask({
100
100
  type: popsType,
101
101
  guid: guid,
102
102
  config: config,
103
103
  animElement: $anim,
104
104
  maskHTML: maskHTML,
105
105
  });
106
- $mask = _handleMask_.maskElement;
107
- elementList.push($mask);
106
+ $mask = handleMask.maskElement;
107
+ $elList.push($mask);
108
108
  }
109
109
  /* 处理返回的配置 */
110
- const eventDetails = PopsHandler.handleEventDetails(
110
+ const evtConfig = PopsHandler.handleEventConfig(
111
+ config,
111
112
  guid,
112
113
  $shadowContainer,
113
114
  $shadowRoot,
114
115
  popsType,
115
116
  $anim,
116
- $pops!,
117
- $mask!,
118
- config
117
+ $pops,
118
+ $mask
119
119
  );
120
120
  /* 为顶部右边的关闭按钮添加点击事件 */
121
- PopsHandler.handleClickEvent("close", $headerCloseBtn!, eventDetails, config.btn.close!.callback!);
121
+ PopsHandler.handleClickEvent("close", $headerCloseBtn, evtConfig, config.btn.close?.callback);
122
122
  /* 为底部ok按钮添加点击事件 */
123
- PopsHandler.handleClickEvent("ok", btnOkElement!, eventDetails!, config.btn.ok!.callback!);
123
+ PopsHandler.handleClickEvent("ok", btnOkElement, evtConfig, config.btn.ok?.callback);
124
124
 
125
125
  /* 创建到页面中 */
126
126
 
127
- popsDOMUtils.append($shadowRoot, elementList);
127
+ popsDOMUtils.append($shadowRoot, $elList);
128
128
  if (typeof config.beforeAppendToPageCallBack === "function") {
129
129
  config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
130
130
  }
@@ -157,7 +157,7 @@ export const PopsAlert = {
157
157
  });
158
158
  }
159
159
 
160
- const result = PopsHandler.handleResultDetails(eventDetails);
160
+ const result = PopsHandler.handleResultConfig(evtConfig);
161
161
  return result;
162
162
  },
163
163
  };
@@ -94,43 +94,42 @@ export const PopsConfirm = {
94
94
  /**
95
95
  * 遮罩层元素
96
96
  */
97
- let $mask: HTMLDivElement | null = null;
97
+ let $mask: HTMLDivElement | undefined = void 0;
98
98
  /**
99
99
  * 已创建的元素列表
100
100
  */
101
- const elementList: HTMLElement[] = [$anim];
101
+ const $elList: HTMLElement[] = [$anim];
102
102
 
103
103
  if (config.mask.enable) {
104
104
  // 启用遮罩层
105
- const _handleMask_ = PopsHandler.handleMask({
105
+ const handleMask = PopsHandler.handleMask({
106
106
  type: popsType,
107
107
  guid: guid,
108
108
  config: config,
109
109
  animElement: $anim,
110
110
  maskHTML: maskHTML,
111
111
  });
112
- $mask = _handleMask_.maskElement;
113
- elementList.push($mask);
112
+ $mask = handleMask.maskElement;
113
+ $elList.push($mask);
114
114
  }
115
- const eventDetails = PopsHandler.handleEventDetails(
115
+ const evtConfig = PopsHandler.handleEventConfig(
116
+ config,
116
117
  guid,
117
118
  $shadowContainer,
118
119
  $shadowRoot,
119
120
  popsType,
120
-
121
121
  $anim,
122
- $pops!,
123
- $mask!,
124
- config
122
+ $pops,
123
+ $mask
125
124
  );
126
- PopsHandler.handleClickEvent("close", $btnClose!, eventDetails, config.btn.close!.callback!);
127
- PopsHandler.handleClickEvent("ok", $btnOk!, eventDetails!, config.btn.ok!.callback!);
128
- PopsHandler.handleClickEvent("cancel", $btnCancel!, eventDetails, config.btn.cancel!.callback!);
129
- PopsHandler.handleClickEvent("other", $btnOther!, eventDetails, config.btn.other!.callback!);
125
+ PopsHandler.handleClickEvent("close", $btnClose, evtConfig, config.btn.close.callback);
126
+ PopsHandler.handleClickEvent("ok", $btnOk, evtConfig, config.btn.ok.callback);
127
+ PopsHandler.handleClickEvent("cancel", $btnCancel, evtConfig, config.btn.cancel.callback);
128
+ PopsHandler.handleClickEvent("other", $btnOther, evtConfig, config.btn.other.callback);
130
129
 
131
130
  /* 创建到页面中 */
132
131
 
133
- popsDOMUtils.append($shadowRoot, elementList);
132
+ popsDOMUtils.append($shadowRoot, $elList);
134
133
  if (typeof config.beforeAppendToPageCallBack === "function") {
135
134
  config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
136
135
  }
@@ -160,7 +159,7 @@ export const PopsConfirm = {
160
159
  endCallBack: config.dragEndCallBack,
161
160
  });
162
161
  }
163
- const result = PopsHandler.handleResultDetails(eventDetails);
162
+ const result = PopsHandler.handleResultConfig(evtConfig);
164
163
  return result;
165
164
  },
166
165
  };