@whitesev/pops 2.2.0 → 2.2.2

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 (48) hide show
  1. package/dist/index.amd.js +364 -357
  2. package/dist/index.amd.js.map +1 -1
  3. package/dist/index.cjs.js +364 -357
  4. package/dist/index.cjs.js.map +1 -1
  5. package/dist/index.esm.js +364 -357
  6. package/dist/index.esm.js.map +1 -1
  7. package/dist/index.iife.js +364 -357
  8. package/dist/index.iife.js.map +1 -1
  9. package/dist/index.system.js +364 -357
  10. package/dist/index.system.js.map +1 -1
  11. package/dist/index.umd.js +364 -357
  12. package/dist/index.umd.js.map +1 -1
  13. package/dist/types/src/Pops.d.ts +17 -17
  14. package/dist/types/src/PopsInst.d.ts +8 -0
  15. package/dist/types/src/components/panel/index.d.ts +2 -1
  16. package/dist/types/src/components/searchSuggestion/index.d.ts +1 -1
  17. package/dist/types/src/handler/PopsElementHandler.d.ts +6 -6
  18. package/dist/types/src/handler/PopsHandler.d.ts +6 -6
  19. package/dist/types/src/types/button.d.ts +2 -2
  20. package/dist/types/src/types/components.d.ts +5 -5
  21. package/dist/types/src/types/event.d.ts +3 -3
  22. package/dist/types/src/types/{layer.d.ts → inst.d.ts} +7 -5
  23. package/dist/types/src/types/main.d.ts +36 -58
  24. package/dist/types/src/utils/PopsInstanceUtils.d.ts +10 -10
  25. package/package.json +1 -1
  26. package/src/Pops.ts +2 -2
  27. package/src/PopsInst.ts +21 -0
  28. package/src/components/alert/index.ts +16 -16
  29. package/src/components/confirm/index.ts +16 -15
  30. package/src/components/drawer/index.ts +16 -15
  31. package/src/components/folder/index.ts +141 -152
  32. package/src/components/iframe/index.ts +16 -15
  33. package/src/components/panel/index.ts +19 -18
  34. package/src/components/prompt/index.ts +15 -14
  35. package/src/components/rightClickMenu/index.ts +19 -18
  36. package/src/components/searchSuggestion/index.ts +21 -20
  37. package/src/components/tooltip/index.ts +3 -2
  38. package/src/css/scrollbar.css +9 -5
  39. package/src/handler/PopsElementHandler.ts +18 -18
  40. package/src/handler/PopsHandler.ts +38 -32
  41. package/src/types/button.d.ts +2 -2
  42. package/src/types/components.d.ts +5 -5
  43. package/src/types/event.d.ts +3 -3
  44. package/src/types/{layer.d.ts → inst.d.ts} +7 -5
  45. package/src/types/main.d.ts +36 -58
  46. package/src/utils/PopsInstanceUtils.ts +84 -81
  47. package/dist/types/src/PopsLayer.d.ts +0 -5
  48. package/src/PopsLayer.ts +0 -18
@@ -68,17 +68,17 @@ declare class Pops {
68
68
  [key: string]: CSSKeyframesRule;
69
69
  };
70
70
  /** 存储已创建的元素 */
71
- layer: {
72
- iframe: import("./types/layer").PopsLayerCommonConfig[];
73
- loading: import("./types/layer").PopsLayerCommonConfig[];
74
- folder: import("./types/layer").PopsLayerCommonConfig[];
75
- alert: import("./types/layer").PopsLayerCommonConfig[];
76
- confirm: import("./types/layer").PopsLayerCommonConfig[];
77
- prompt: import("./types/layer").PopsLayerCommonConfig[];
78
- drawer: import("./types/layer").PopsLayerCommonConfig[];
79
- panel: import("./types/layer").PopsLayerCommonConfig[];
80
- tooltip: import("./types/layer").PopsLayerCommonConfig[];
81
- rightClickMenu: import("./types/layer").PopsLayerCommonConfig[];
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(moreLayerConfigList: import("./types/layer").PopsLayerCommonConfig[][], guid: string, isAll?: boolean): import("./types/layer").PopsLayerCommonConfig[][];
193
- hide(popsType: import("./types/main").PopsLayerMode, layerConfigList: import("./types/layer").PopsLayerCommonConfig[], guid: string, config: PopsAlertDetails | PopsDrawerDetails | PopsPromptDetails | PopsConfirmDetails | PopsIframeDetails | PopsLoadingDetails | PopsPanelDetails | PopsFolderDetails, animElement: HTMLElement, maskElement: HTMLElement): Promise<void>;
194
- show(popsType: import("./types/main").PopsLayerMode, layerConfigList: import("./types/layer").PopsLayerCommonConfig[], guid: string, config: PopsAlertDetails | PopsDrawerDetails | PopsPromptDetails | PopsConfirmDetails | PopsIframeDetails | PopsLoadingDetails | PopsPanelDetails | PopsFolderDetails, animElement: HTMLElement, maskElement?: HTMLElement): Promise<void>;
195
- close(popsType: string, layerConfigList: import("./types/layer").PopsLayerCommonConfig[], guid: string, config: PopsAlertDetails | PopsDrawerDetails | PopsPromptDetails | PopsConfirmDetails | PopsIframeDetails | PopsLoadingDetails | PopsPanelDetails | PopsFolderDetails, animElement: HTMLElement): Promise<void>;
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").PopsMode;
412
+ mode: import("./types/main").PopsType;
413
413
  };
414
414
  /**
415
415
  * 右键菜单
@@ -21093,7 +21093,7 @@ declare class Pops {
21093
21093
  * searchSuggestion.setAllEvent();
21094
21094
  */
21095
21095
  searchSuggestion: <T = any>(details: PopsSearchSuggestionDetails<T>) => {
21096
- selfDocument: ShadowRoot | Document | (ShadowRoot | Document)[];
21096
+ selfDocument: Document | ShadowRoot | (Document | ShadowRoot)[];
21097
21097
  $el: {
21098
21098
  root: HTMLElement;
21099
21099
  $hintULContainer: HTMLUListElement;
@@ -0,0 +1,8 @@
1
+ import type { PopsInstCommonConfig } from "./types/inst";
2
+ import type { PopsInstStoreType } from "./types/main";
3
+ /**
4
+ * 弹窗实例数据
5
+ */
6
+ export declare const PopsInstData: {
7
+ [key in PopsInstStoreType]: PopsInstCommonConfig[];
8
+ };
@@ -1,4 +1,5 @@
1
1
  import type { PopsPanelDetails, PopsPanelEventType } from "./types";
2
+ import type { PopsType } from "../../types/main";
2
3
  export declare const PopsPanel: {
3
4
  init(details: PopsPanelDetails): {
4
5
  addEventListener: <K extends keyof PopsPanelEventType>(event: K, listener: (evt: CustomEvent<PopsPanelEventType[K]>) => void, options?: boolean | EventListenerOptions) => void;
@@ -13,6 +14,6 @@ export declare const PopsPanel: {
13
14
  animElement: HTMLDivElement;
14
15
  popsElement: HTMLDivElement;
15
16
  maskElement?: HTMLDivElement | undefined;
16
- mode: import("../../types/main").PopsMode;
17
+ mode: PopsType;
17
18
  };
18
19
  };
@@ -4,7 +4,7 @@ export declare const PopsSearchSuggestion: {
4
4
  /**
5
5
  * 当前的环境,可以是document,可以是shadowroot,默认是document
6
6
  */
7
- selfDocument: ShadowRoot | Document | (ShadowRoot | Document)[];
7
+ selfDocument: Document | ShadowRoot | (Document | ShadowRoot)[];
8
8
  $el: {
9
9
  /** 根元素 */
10
10
  root: HTMLElement;
@@ -1,4 +1,4 @@
1
- import type { PopsSupportAnim, PopsSupportBottomBtn, PopsSupportContent, PopsSupportHeaderTitle, PopsTypeSupportAnim, PopsTypeSupportBottomBtn, PopsTypeSupportContent, PopsTypeSupportHeaderTitle } from "../types/main";
1
+ import type { PopsSupportAnimDetails, PopsSupportBottomBtnDetails, PopsSupportContentDetails, PopsSupportHeaderTitleDetails, PopsSupportAnimDetailsType, PopsSupportBottomBtnDetailsType, PopsSupportContentDetailsType, PopsSupportHeaderTitleDetailsType } from "../types/main";
2
2
  export declare const PopsElementHandler: {
3
3
  /**
4
4
  * 获取遮罩层HTML
@@ -16,25 +16,25 @@ export declare const PopsElementHandler: {
16
16
  * @param bottomBtnHTML
17
17
  * @param zIndex
18
18
  */
19
- getAnimHTML(guid: string, type: PopsTypeSupportAnim, config: PopsSupportAnim[keyof PopsSupportAnim], html: string | undefined, bottomBtnHTML: string | undefined, zIndex: number): string;
19
+ getAnimHTML(guid: string, type: PopsSupportAnimDetailsType, config: PopsSupportAnimDetails[keyof PopsSupportAnimDetails], html: string | undefined, bottomBtnHTML: string | undefined, zIndex: number): string;
20
20
  /**
21
21
  * 获取顶部按钮层HTML
22
22
  * @param type
23
23
  * @param config
24
24
  */
25
- getHeaderBtnHTML(type: PopsTypeSupportHeaderTitle, config: PopsSupportHeaderTitle[keyof PopsSupportHeaderTitle]): string;
25
+ getHeaderBtnHTML(type: PopsSupportHeaderTitleDetailsType, config: PopsSupportHeaderTitleDetails[keyof PopsSupportHeaderTitleDetails]): string;
26
26
  /**
27
27
  * 获取底部按钮层HTML
28
28
  * @param type
29
29
  * @param config
30
30
  */
31
- getBottomBtnHTML(type: PopsTypeSupportBottomBtn, config: Omit<PopsSupportBottomBtn[keyof PopsSupportBottomBtn], "content">): string;
31
+ getBottomBtnHTML(type: PopsSupportBottomBtnDetailsType, config: Omit<PopsSupportBottomBtnDetails[keyof PopsSupportBottomBtnDetails], "content">): string;
32
32
  /**
33
33
  * 获取标题style
34
34
  * @param type 弹窗类型
35
35
  * @param config 弹窗配置
36
36
  */
37
- getHeaderStyle(type: PopsTypeSupportHeaderTitle, config: PopsSupportHeaderTitle[keyof PopsSupportHeaderTitle]): {
37
+ getHeaderStyle(type: PopsSupportHeaderTitleDetailsType, config: PopsSupportHeaderTitleDetails[keyof PopsSupportHeaderTitleDetails]): {
38
38
  headerStyle: string;
39
39
  headerPStyle: string;
40
40
  };
@@ -43,7 +43,7 @@ export declare const PopsElementHandler: {
43
43
  * @param type 弹窗类型
44
44
  * @param config 弹窗配置
45
45
  */
46
- getContentStyle(type: PopsTypeSupportContent, config: PopsSupportContent[keyof PopsSupportContent]): {
46
+ getContentStyle(type: PopsSupportContentDetailsType, config: PopsSupportContentDetails[keyof PopsSupportContentDetails]): {
47
47
  contentStyle: string;
48
48
  contentPStyle: string;
49
49
  };
@@ -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 { PopsLayerCommonConfig } from "../types/layer";
12
- import type { PopsAllDetails, PopsLayerMode, PopsMode, PopsType } from "../types/main";
11
+ import { PopsInstCommonConfig } from "../types/inst";
12
+ import type { PopsInstStoreType, PopsType, PopsSupportAnimDetailsType, PopsSupportOnlyDetails } 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: PopsType): {
53
+ handleQueryElement(animElement: HTMLDivElement, type: PopsSupportAnimDetailsType): {
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: PopsLayerMode, animElement: HTMLDivElement, popsElement: HTMLDivElement, maskElement: HTMLDivElement, config: PopsAlertDetails | PopsDrawerDetails | PopsPromptDetails | PopsConfirmDetails | PopsIframeDetails | PopsLoadingDetails | PopsPanelDetails | PopsFolderDetails): PopsEventDetails;
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<PopsAllDetails[keyof PopsAllDetails]>>(type: PopsMode, config: T): T;
220
+ handleOnly<T extends Required<PopsSupportOnlyDetails[keyof PopsSupportOnlyDetails]>>(type: PopsType, config: T): T;
221
221
  /**
222
222
  * 处理把已创建的元素保存到内部环境中
223
223
  * @param type 当前弹窗类型
224
224
  * @param value
225
225
  */
226
- handlePush(type: PopsLayerMode, value: PopsLayerCommonConfig): void;
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 { PopsMode } from "./main";
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: PopsMode;
54
+ mode: PopsType;
55
55
  /**
56
56
  * 唯一id
57
57
  */
@@ -21,17 +21,17 @@ export interface PopsTitleConfig {
21
21
  */
22
22
  text?: string;
23
23
  /**
24
- * 文字的位置
24
+ * 标题文字的位置
25
25
  * @default "left"
26
26
  */
27
27
  position?: PopsTextAlign;
28
28
  /**
29
- * 文字是否是html
29
+ * 标题文字是否是html
30
30
  * @default false
31
31
  */
32
32
  html?: boolean;
33
33
  /**
34
- * 文字的自定义CSS
34
+ * 自定义CSS
35
35
  */
36
36
  style?: string;
37
37
  };
@@ -47,12 +47,12 @@ export interface PopsContentConfig {
47
47
  */
48
48
  text?: string;
49
49
  /**
50
- * 文字是否是html
50
+ * 内容文字是否是html
51
51
  * @default false
52
52
  */
53
53
  html?: boolean;
54
54
  /**
55
- * 文字的自定义CSS
55
+ * 自定义CSS
56
56
  */
57
57
  style?: string;
58
58
  };
@@ -1,5 +1,5 @@
1
1
  import type { PopsIframeDetails } from "../components/iframe/types";
2
- import type { PopsMode } from "./main";
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: PopsMode;
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: PopsMode;
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 PopsLayerConfig {
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
- export interface PopsLayerCommonConfig extends PopsLayerConfig {
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?: (layerCommonConfig: PopsLayerCommonConfig) => void;
23
+ beforeRemoveCallBack?: (instCommonConfig: PopsInstCommonConfig) => void;
22
24
  }
@@ -16,13 +16,14 @@ import type { PopsPanelTextAreaDetails } from "../components/panel/types/compone
16
16
  import type { PopsPromptDetails } from "../components/prompt/types/index";
17
17
  import { PopsRightClickMenuDetails } from "../components/rightClickMenu/types";
18
18
  import { PopsToolTipDetails } from "../components/tooltip/types/index";
19
+ import type { PopsSearchSuggestionDetails } from "../components/searchSuggestion/types";
19
20
 
20
21
  export interface PopsUtilsOwnObject<V extends any> {
21
22
  [key: string]: V | PopsUtilsOwnObject<V>;
22
23
  }
23
24
 
24
- /** pops的所有类型配置 10个 */
25
- export interface PopsAllDetails {
25
+ /** pops所有的类型配置 11个*/
26
+ export interface PopsDetails {
26
27
  alert: PopsAlertDetails;
27
28
  confirm: PopsConfirmDetails;
28
29
  prompt: PopsPromptDetails;
@@ -33,78 +34,55 @@ export interface PopsAllDetails {
33
34
  folder: PopsFolderDetails;
34
35
  panel: PopsPanelDetails;
35
36
  rightClickMenu: PopsRightClickMenuDetails;
37
+ searchSuggestion: PopsSearchSuggestionDetails;
36
38
  }
37
39
 
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
- }
40
+ /** pops的类型 */
41
+ export type PopsType = keyof PopsDetails;
51
42
 
52
- /** pops的类型 8个 */
53
- export type PopsType = keyof PopsTypeDetails;
43
+ /** pops中支持only的配置 */
44
+ export type PopsSupportOnlyDetails = Omit<PopsDetails, "searchSuggestion">;
54
45
 
55
- /** pops所有的类型 10个 */
56
- export type PopsMode = PopsType | "tooltip" | "rightClickMenu";
46
+ /** 存储实例的类型 */
47
+ export type PopsInstStoreType = keyof Omit<PopsDetails, "searchSuggestion">;
57
48
 
58
- /** 存储实例的类型 9个 */
59
- export type PopsLayerMode = PopsType | "tooltip" | "rightClickMenu";
49
+ /** pops弹窗支持动画元素的配置 8个 */
50
+ export type PopsSupportAnimDetails = Omit<
51
+ PopsDetails,
52
+ "tooltip" | "rightClickMenu" | "searchSuggestion"
53
+ >;
60
54
 
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
55
  /** pops弹窗支持动画元素的类型 */
73
- export type PopsTypeSupportAnim = keyof PopsSupportAnim;
56
+ export type PopsSupportAnimDetailsType = keyof PopsSupportAnimDetails;
74
57
 
75
58
  /** pops弹窗支持标题栏的配置 */
76
- export interface PopsSupportHeaderTitle {
77
- alert: PopsAlertDetails;
78
- confirm: PopsConfirmDetails;
79
- prompt: PopsPromptDetails;
80
- iframe: PopsIframeDetails;
81
- drawer: PopsDrawerDetails;
82
- folder: PopsFolderDetails;
83
- panel: PopsPanelDetails;
84
- }
59
+ export type PopsSupportHeaderTitleDetails = Pick<
60
+ PopsDetails,
61
+ "alert" | "confirm" | "prompt" | "iframe" | "drawer" | "folder" | "panel"
62
+ >;
63
+
85
64
  /** pops弹窗支持标题栏的类型 */
86
- export type PopsTypeSupportHeaderTitle = keyof PopsSupportHeaderTitle;
65
+ export type PopsSupportHeaderTitleDetailsType =
66
+ keyof PopsSupportHeaderTitleDetails;
87
67
 
88
68
  /** pops支持底部按钮的配置 */
89
- export interface PopsSupportBottomBtn {
90
- alert: PopsAlertDetails;
91
- confirm: PopsConfirmDetails;
92
- prompt: PopsPromptDetails;
93
- drawer: PopsDrawerDetails;
94
- }
69
+ export type PopsSupportBottomBtnDetails = Pick<
70
+ PopsDetails,
71
+ "alert" | "confirm" | "prompt" | "drawer"
72
+ >;
73
+
95
74
  /** pops支持底部按钮的类型 */
96
- export type PopsTypeSupportBottomBtn = keyof PopsSupportHeaderTitle;
75
+ export type PopsSupportBottomBtnDetailsType =
76
+ keyof PopsSupportHeaderTitleDetails;
97
77
 
98
78
  /** pops支持中间内容的配置 */
99
- export interface PopsSupportContent {
100
- alert: PopsAlertDetails;
101
- confirm: PopsConfirmDetails;
102
- prompt: PopsPromptDetails;
103
- drawer: PopsDrawerDetails;
104
- loading: PopsLoadingDetails;
105
- }
79
+ export type PopsSupportContentDetails = Pick<
80
+ PopsDetails,
81
+ "alert" | "confirm" | "prompt" | "drawer" | "loading"
82
+ >;
83
+
106
84
  /** pops支持中间内容的类型 */
107
- export type PopsTypeSupportContent = keyof PopsSupportContent;
85
+ export type PopsSupportContentDetailsType = keyof PopsSupportContentDetails;
108
86
 
109
87
  /** panel的各种类型的配置项 */
110
88
  export type PopsPanelFormsTotalDetails =
@@ -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 { PopsLayerCommonConfig } from "../types/layer";
10
- import type { PopsLayerMode } from "../types/main";
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 moreLayerConfigList 配置实例列表
47
+ * @param instConfigList 配置实例列表
48
48
  * @param guid 唯一标识
49
49
  * @param isAll 是否全部删除
50
50
  */
51
- removeInstance(moreLayerConfigList: PopsLayerCommonConfig[][], guid: string, isAll?: boolean): PopsLayerCommonConfig[][];
51
+ removeInstance(instConfigList: PopsInstCommonConfig[][], guid: string, isAll?: boolean): PopsInstCommonConfig[][];
52
52
  /**
53
53
  * 隐藏
54
54
  * @param popsType
55
- * @param layerConfigList
55
+ * @param instConfigList
56
56
  * @param guid
57
57
  * @param config
58
58
  * @param animElement
59
59
  * @param maskElement
60
60
  */
61
- hide(popsType: PopsLayerMode, layerConfigList: PopsLayerCommonConfig[], guid: string, config: PopsAlertDetails | PopsDrawerDetails | PopsPromptDetails | PopsConfirmDetails | PopsIframeDetails | PopsLoadingDetails | PopsPanelDetails | PopsFolderDetails, animElement: HTMLElement, maskElement: HTMLElement): Promise<void>;
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 layerConfigList
65
+ * @param instConfigList
66
66
  * @param guid
67
67
  * @param config
68
68
  * @param animElement
69
69
  * @param maskElement
70
70
  */
71
- show(popsType: PopsLayerMode, layerConfigList: PopsLayerCommonConfig[], guid: string, config: PopsAlertDetails | PopsDrawerDetails | PopsPromptDetails | PopsConfirmDetails | PopsIframeDetails | PopsLoadingDetails | PopsPanelDetails | PopsFolderDetails, animElement: HTMLElement, maskElement?: HTMLElement): Promise<void>;
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 layerConfigList
75
+ * @param instConfigList
76
76
  * @param guid
77
77
  * @param config
78
78
  * @param animElement
79
79
  */
80
- close(popsType: string, layerConfigList: PopsLayerCommonConfig[], guid: string, config: PopsAlertDetails | PopsDrawerDetails | PopsPromptDetails | PopsConfirmDetails | PopsIframeDetails | PopsLoadingDetails | PopsPanelDetails | PopsFolderDetails, animElement: HTMLElement): Promise<void>;
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whitesev/pops",
3
- "version": "2.2.0",
3
+ "version": "2.2.2",
4
4
  "type": "module",
5
5
  "description": "弹窗库",
6
6
  "main": "dist/index.cjs.js",
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 { PopsLayerData } from "./PopsLayer";
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
- layer: PopsLayerData,
46
+ instData: PopsInstData,
47
47
  /** 禁止滚动 */
48
48
  forbiddenScroll: {
49
49
  event(event: Event) {
@@ -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 { PopsMode } from "../../types/main";
8
+ import type { PopsType } from "../../types/main";
9
9
  import type { PopsAlertDetails } from "./types";
10
10
  import { PopsCSS } from "../../PopsCSS";
11
11
 
@@ -13,11 +13,11 @@ export const PopsAlert = {
13
13
  init(details: PopsAlertDetails) {
14
14
  const guid = popsUtils.getRandomGUID();
15
15
  // 设置当前类型
16
- const PopsType: PopsMode = "alert";
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);
20
- config = PopsHandler.handleOnly(PopsType, config);
20
+ config = PopsHandler.handleOnly(popsType, config);
21
21
 
22
22
  const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
23
23
  PopsHandler.handleInit($shadowRoot, [
@@ -54,32 +54,32 @@ export const PopsAlert = {
54
54
  // 先把z-index提取出来
55
55
  let zIndex = PopsHandler.handleZIndex(config.zIndex);
56
56
  let maskHTML = PopsElementHandler.getMaskHTML(guid, zIndex);
57
- let headerBtnHTML = PopsElementHandler.getHeaderBtnHTML(PopsType, config);
58
- let bottomBtnHTML = PopsElementHandler.getBottomBtnHTML(PopsType, config);
57
+ let headerBtnHTML = PopsElementHandler.getHeaderBtnHTML(popsType, config);
58
+ let bottomBtnHTML = PopsElementHandler.getBottomBtnHTML(popsType, config);
59
59
  let { headerStyle, headerPStyle } = PopsElementHandler.getHeaderStyle(
60
- PopsType,
60
+ popsType,
61
61
  config
62
62
  );
63
63
  let { contentStyle, contentPStyle } = PopsElementHandler.getContentStyle(
64
- PopsType,
64
+ popsType,
65
65
  config
66
66
  );
67
67
  let animHTML = PopsElementHandler.getAnimHTML(
68
68
  guid,
69
- PopsType,
69
+ popsType,
70
70
  config,
71
71
  /*html*/ `
72
- <div class="pops-title pops-${PopsType}-title" style="text-align: ${
72
+ <div class="pops-title pops-${popsType}-title" style="text-align: ${
73
73
  config.title.position
74
74
  };${headerStyle}">${
75
75
  config.title.html
76
76
  ? config.title.text
77
- : `<p pops class="pops-${PopsType}-title-text" style="${headerPStyle}">${config.title.text}</p>`
77
+ : `<p pops class="pops-${popsType}-title-text" style="${headerPStyle}">${config.title.text}</p>`
78
78
  }${headerBtnHTML}</div>
79
- <div class="pops-content pops-${PopsType}-content" style="${contentStyle}">${
79
+ <div class="pops-content pops-${popsType}-content" style="${contentStyle}">${
80
80
  config.content.html
81
81
  ? config.content.text
82
- : `<p pops class="pops-${PopsType}-content-text" style="${contentPStyle}">${config.content.text}</p>`
82
+ : `<p pops class="pops-${popsType}-content-text" style="${contentPStyle}">${config.content.text}</p>`
83
83
  }</div>${bottomBtnHTML}`,
84
84
  bottomBtnHTML,
85
85
  zIndex
@@ -94,7 +94,7 @@ export const PopsAlert = {
94
94
  headerCloseBtnElement: $headerCloseBtn,
95
95
  btnOkElement,
96
96
  titleElement: $title,
97
- } = PopsHandler.handleQueryElement($anim, PopsType);
97
+ } = PopsHandler.handleQueryElement($anim, popsType);
98
98
 
99
99
  /** 遮罩层元素 */
100
100
  let $mask: HTMLDivElement | null = null;
@@ -105,7 +105,7 @@ export const PopsAlert = {
105
105
 
106
106
  if (config.mask.enable) {
107
107
  let _handleMask_ = PopsHandler.handleMask({
108
- type: PopsType,
108
+ type: popsType,
109
109
  guid: guid,
110
110
  config: config,
111
111
  animElement: $anim,
@@ -119,7 +119,7 @@ export const PopsAlert = {
119
119
  guid,
120
120
  $shadowContainer,
121
121
  $shadowRoot,
122
- PopsType,
122
+ popsType,
123
123
  $anim,
124
124
  $pops!,
125
125
  $mask!,
@@ -153,7 +153,7 @@ export const PopsAlert = {
153
153
  $anim.after($mask);
154
154
  }
155
155
  /* 保存 */
156
- PopsHandler.handlePush(PopsType, {
156
+ PopsHandler.handlePush(popsType, {
157
157
  guid: guid,
158
158
 
159
159
  animElement: $anim,