@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.
Files changed (184) hide show
  1. package/dist/index.amd.js +1233 -1092
  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 +1233 -1092
  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 +1233 -1092
  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 +1233 -1092
  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 +1233 -1092
  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 +1233 -1092
  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/eslint.config.d.mts +2 -0
  26. package/dist/types/src/Pops.d.ts +98 -103
  27. package/dist/types/src/PopsInst.d.ts +2 -2
  28. package/dist/types/src/components/alert/defaultConfig.d.ts +2 -0
  29. package/dist/types/src/components/alert/index.d.ts +2 -2
  30. package/dist/types/src/components/alert/types/index.d.ts +4 -4
  31. package/dist/types/src/components/confirm/defaultConfig.d.ts +2 -0
  32. package/dist/types/src/components/confirm/index.d.ts +2 -2
  33. package/dist/types/src/components/confirm/types/index.d.ts +2 -2
  34. package/dist/types/src/components/drawer/defaultConfig.d.ts +2 -0
  35. package/dist/types/src/components/drawer/index.d.ts +2 -2
  36. package/dist/types/src/components/drawer/types/index.d.ts +2 -2
  37. package/dist/types/src/components/folder/defaultConfig.d.ts +2 -0
  38. package/dist/types/src/components/folder/index.d.ts +2 -2
  39. package/dist/types/src/components/folder/types/index.d.ts +31 -7
  40. package/dist/types/src/components/iframe/defaultConfig.d.ts +2 -0
  41. package/dist/types/src/components/iframe/index.d.ts +2 -5
  42. package/dist/types/src/components/iframe/types/index.d.ts +13 -42
  43. package/dist/types/src/components/loading/defaultConfig.d.ts +2 -0
  44. package/dist/types/src/components/loading/index.d.ts +2 -2
  45. package/dist/types/src/components/loading/types/index.d.ts +4 -4
  46. package/dist/types/src/components/panel/defaultConfig.d.ts +2 -0
  47. package/dist/types/src/components/panel/handlerComponents.d.ts +47 -43
  48. package/dist/types/src/components/panel/index.d.ts +3 -3
  49. package/dist/types/src/components/panel/types/components-button.d.ts +7 -6
  50. package/dist/types/src/components/panel/types/components-common.d.ts +7 -7
  51. package/dist/types/src/components/panel/types/components-container.d.ts +24 -0
  52. package/dist/types/src/components/panel/types/components-deepMenu.d.ts +13 -13
  53. package/dist/types/src/components/panel/types/components-input.d.ts +6 -6
  54. package/dist/types/src/components/panel/types/components-own.d.ts +2 -2
  55. package/dist/types/src/components/panel/types/components-select.d.ts +9 -9
  56. package/dist/types/src/components/panel/types/components-selectMultiple.d.ts +8 -8
  57. package/dist/types/src/components/panel/types/components-slider.d.ts +7 -7
  58. package/dist/types/src/components/panel/types/components-switch.d.ts +6 -6
  59. package/dist/types/src/components/panel/types/components-textarea.d.ts +6 -6
  60. package/dist/types/src/components/panel/types/index.d.ts +36 -28
  61. package/dist/types/src/components/prompt/defaultConfig.d.ts +2 -0
  62. package/dist/types/src/components/prompt/index.d.ts +2 -2
  63. package/dist/types/src/components/prompt/types/index.d.ts +4 -3
  64. package/dist/types/src/components/rightClickMenu/defaultConfig.d.ts +2 -0
  65. package/dist/types/src/components/rightClickMenu/index.d.ts +29 -27
  66. package/dist/types/src/components/rightClickMenu/types/index.d.ts +32 -11
  67. package/dist/types/src/components/searchSuggestion/defaultConfig.d.ts +2 -0
  68. package/dist/types/src/components/searchSuggestion/index.d.ts +21 -6
  69. package/dist/types/src/components/searchSuggestion/types/index.d.ts +15 -13
  70. package/dist/types/src/components/tooltip/defaultConfig.d.ts +2 -0
  71. package/dist/types/src/components/tooltip/index.d.ts +6 -21
  72. package/dist/types/src/components/tooltip/types/index.d.ts +8 -6
  73. package/dist/types/src/config/GlobalConfig.d.ts +3 -3
  74. package/dist/types/src/handler/PopsElementHandler.d.ts +6 -6
  75. package/dist/types/src/handler/PopsHandler.d.ts +18 -18
  76. package/dist/types/src/types/button.d.ts +4 -97
  77. package/dist/types/src/types/components.d.ts +8 -8
  78. package/dist/types/src/types/event.d.ts +0 -30
  79. package/dist/types/src/types/global.d.ts +2 -0
  80. package/dist/types/src/types/inst.d.ts +5 -5
  81. package/dist/types/src/types/main.d.ts +35 -80
  82. package/dist/types/src/types/mask.d.ts +18 -15
  83. package/dist/types/src/utils/PopsInstanceUtils.d.ts +15 -15
  84. package/dist/types/src/utils/PopsUtils.d.ts +4 -0
  85. package/package.json +10 -10
  86. package/src/Pops.ts +44 -44
  87. package/src/PopsAnimation.ts +1 -1
  88. package/src/PopsInst.ts +2 -2
  89. package/src/components/alert/{config.ts → defaultConfig.ts} +7 -7
  90. package/src/components/alert/index.ts +16 -18
  91. package/src/components/alert/types/index.ts +4 -4
  92. package/src/components/confirm/{config.ts → defaultConfig.ts} +11 -11
  93. package/src/components/confirm/index.ts +11 -13
  94. package/src/components/confirm/types/index.ts +3 -3
  95. package/src/components/drawer/{config.ts → defaultConfig.ts} +10 -10
  96. package/src/components/drawer/index.ts +18 -17
  97. package/src/components/drawer/types/index.ts +3 -3
  98. package/src/components/folder/{config.ts → defaultConfig.ts} +22 -18
  99. package/src/components/folder/index.ts +61 -60
  100. package/src/components/folder/types/index.ts +31 -18
  101. package/src/components/iframe/{config.ts → defaultConfig.ts} +2 -2
  102. package/src/components/iframe/index.ts +24 -29
  103. package/src/components/iframe/types/index.ts +13 -56
  104. package/src/components/loading/{config.ts → defaultConfig.ts} +3 -3
  105. package/src/components/loading/index.ts +13 -11
  106. package/src/components/loading/types/index.ts +5 -5
  107. package/src/components/panel/{config.ts → defaultConfig.ts} +115 -37
  108. package/src/components/panel/handlerComponents.ts +446 -428
  109. package/src/components/panel/index.css +11 -3
  110. package/src/components/panel/index.ts +15 -28
  111. package/src/components/panel/types/components-button.ts +7 -6
  112. package/src/components/panel/types/components-common.ts +7 -7
  113. package/src/components/panel/types/components-container.ts +25 -0
  114. package/src/components/panel/types/components-deepMenu.ts +13 -13
  115. package/src/components/panel/types/components-input.ts +6 -6
  116. package/src/components/panel/types/components-own.ts +2 -2
  117. package/src/components/panel/types/components-select.ts +11 -11
  118. package/src/components/panel/types/components-selectMultiple.ts +8 -9
  119. package/src/components/panel/types/components-slider.ts +7 -7
  120. package/src/components/panel/types/components-switch.ts +6 -6
  121. package/src/components/panel/types/components-textarea.ts +6 -6
  122. package/src/components/panel/types/index.ts +45 -38
  123. package/src/components/prompt/{config.ts → defaultConfig.ts} +10 -10
  124. package/src/components/prompt/index.ts +13 -15
  125. package/src/components/prompt/types/index.ts +4 -3
  126. package/src/components/rightClickMenu/{config.ts → defaultConfig.ts} +20 -19
  127. package/src/components/rightClickMenu/index.ts +125 -108
  128. package/src/components/rightClickMenu/types/index.ts +36 -14
  129. package/src/components/searchSuggestion/{config.ts → defaultConfig.ts} +18 -11
  130. package/src/components/searchSuggestion/index.ts +116 -96
  131. package/src/components/searchSuggestion/types/index.ts +17 -15
  132. package/src/components/tooltip/{config.ts → defaultConfig.ts} +5 -6
  133. package/src/components/tooltip/index.ts +21 -21
  134. package/src/components/tooltip/types/index.ts +9 -7
  135. package/src/config/GlobalConfig.ts +2 -2
  136. package/src/css/common.css +6 -0
  137. package/src/handler/PopsElementHandler.ts +29 -30
  138. package/src/handler/PopsHandler.ts +43 -43
  139. package/src/svg/cpu.svg +7 -7
  140. package/src/svg/delete.svg +4 -4
  141. package/src/svg/documentCopy.svg +4 -4
  142. package/src/svg/edit.svg +7 -7
  143. package/src/svg/eleme.svg +4 -4
  144. package/src/svg/elemePlus.svg +4 -4
  145. package/src/svg/headset.svg +4 -4
  146. package/src/svg/hide.svg +7 -7
  147. package/src/svg/keyboard.svg +7 -7
  148. package/src/svg/loading.svg +4 -4
  149. package/src/svg/max.svg +4 -4
  150. package/src/svg/min.svg +2 -4
  151. package/src/svg/mise.svg +4 -4
  152. package/src/svg/monitor.svg +4 -4
  153. package/src/svg/next.svg +4 -4
  154. package/src/svg/picture.svg +7 -7
  155. package/src/svg/prev.svg +4 -4
  156. package/src/svg/search.svg +4 -4
  157. package/src/svg/share.svg +4 -4
  158. package/src/svg/upload.svg +4 -4
  159. package/src/svg/videoPause.svg +4 -4
  160. package/src/svg/videoPlay.svg +4 -4
  161. package/src/svg/view.svg +4 -4
  162. package/src/types/button.d.ts +4 -97
  163. package/src/types/components.d.ts +8 -8
  164. package/src/types/event.d.ts +0 -30
  165. package/src/types/global.d.ts +2 -0
  166. package/src/types/inst.d.ts +5 -5
  167. package/src/types/main.d.ts +35 -80
  168. package/src/types/mask.d.ts +18 -15
  169. package/src/utils/PopsDOMUtils.ts +34 -34
  170. package/src/utils/PopsInstanceUtils.ts +129 -139
  171. package/src/utils/PopsUtils.ts +60 -45
  172. package/dist/types/src/components/alert/config.d.ts +0 -2
  173. package/dist/types/src/components/confirm/config.d.ts +0 -2
  174. package/dist/types/src/components/drawer/config.d.ts +0 -2
  175. package/dist/types/src/components/folder/config.d.ts +0 -2
  176. package/dist/types/src/components/iframe/config.d.ts +0 -2
  177. package/dist/types/src/components/loading/config.d.ts +0 -2
  178. package/dist/types/src/components/panel/config.d.ts +0 -2
  179. package/dist/types/src/components/panel/types/components-forms.d.ts +0 -23
  180. package/dist/types/src/components/prompt/config.d.ts +0 -2
  181. package/dist/types/src/components/rightClickMenu/config.d.ts +0 -2
  182. package/dist/types/src/components/searchSuggestion/config.d.ts +0 -2
  183. package/dist/types/src/components/tooltip/config.d.ts +0 -2
  184. package/src/components/panel/types/components-forms.ts +0 -24
@@ -1,12 +1,12 @@
1
- import type { PopsAlertDetails } from "../components/alert/types";
2
- import type { PopsConfirmDetails } from "../components/confirm/types";
3
- import type { PopsDrawerDetails } from "../components/drawer/types";
4
- import type { PopsFolderDetails } from "../components/folder/types";
5
- import type { PopsIframeDetails } from "../components/iframe/types";
6
- import type { PopsLoadingDetails } from "../components/loading/types";
7
- import type { PopsPanelDetails } from "../components/panel/types";
8
- import type { PopsPromptDetails } from "../components/prompt/types/index";
9
- import type { PopsInstCommonConfig } from "../types/inst";
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: PopsInstCommonConfig[][], guid: string, isAll?: boolean): PopsInstCommonConfig[][];
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: PopsAlertDetails | PopsDrawerDetails | PopsPromptDetails | PopsConfirmDetails | PopsIframeDetails | PopsLoadingDetails | PopsPanelDetails | PopsFolderDetails, popsType: PopsInstStoreType, instConfigList: PopsInstCommonConfig[], guid: string, $anim: HTMLElement, $mask?: HTMLElement): Promise<void>;
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: PopsAlertDetails | PopsDrawerDetails | PopsPromptDetails | PopsConfirmDetails | PopsIframeDetails | PopsLoadingDetails | PopsPanelDetails | PopsFolderDetails, popsType: PopsInstStoreType, instConfigList: PopsInstCommonConfig[], guid: string, $anim: HTMLElement, $mask?: HTMLElement): Promise<void>;
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: PopsAlertDetails | PopsDrawerDetails | PopsPromptDetails | PopsConfirmDetails | PopsIframeDetails | PopsLoadingDetails | PopsPanelDetails | PopsFolderDetails, popsType: string, instConfigList: PopsInstCommonConfig[], guid: string, $anim: HTMLElement): Promise<void>;
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 moveElement 需要拖拽的元素
86
+ * @param $move 需要拖拽的元素
87
87
  * @param options 配置
88
88
  */
89
- drag(moveElement: HTMLElement, options: {
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": "2.6.0",
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.38.0",
48
- "@rollup/plugin-commonjs": "^28.0.8",
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.1.4",
53
- "browserslist": "^4.26.3",
54
- "caniuse-lite": "^1.0.30001751",
55
- "eslint": "^9.38.0",
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.4.0",
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.0.2",
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 { PopsAlertDetails } from "./components/alert/types";
2
+ import type { PopsAlertConfig } from "./components/alert/types";
3
3
  import { PopsConfirm } from "./components/confirm";
4
- import type { PopsConfirmDetails } from "./components/confirm/types";
4
+ import type { PopsConfirmConfig } from "./components/confirm/types";
5
5
  import { PopsDrawer } from "./components/drawer";
6
- import type { PopsDrawerDetails } from "./components/drawer/types";
6
+ import type { PopsDrawerConfig } from "./components/drawer/types";
7
7
  import { PopsFolder } from "./components/folder";
8
- import type { PopsFolderDetails } from "./components/folder/types";
8
+ import type { PopsFolderConfig } from "./components/folder/types";
9
9
  import { PopsIframe } from "./components/iframe";
10
- import type { PopsIframeDetails } from "./components/iframe/types";
10
+ import type { PopsIframeConfig } from "./components/iframe/types";
11
11
  import { PopsLoading } from "./components/loading";
12
- import type { PopsLoadingDetails } from "./components/loading/types";
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 { PopsPanelDetails } from "./components/panel/types";
15
+ import type { PopsPanelConfig } from "./components/panel/types";
16
16
  import { PopsPrompt } from "./components/prompt";
17
- import type { PopsPromptDetails } from "./components/prompt/types/index";
17
+ import type { PopsPromptConfig } from "./components/prompt/types/index";
18
18
  import { PopsRightClickMenu } from "./components/rightClickMenu";
19
- import type { PopsRightClickMenuDetails } from "./components/rightClickMenu/types";
19
+ import type { PopsRightClickMenuConfig } from "./components/rightClickMenu/types";
20
20
  import { PopsSearchSuggestion } from "./components/searchSuggestion";
21
- import type { PopsSearchSuggestionDetails } from "./components/searchSuggestion/types/index";
21
+ import type { PopsSearchSuggestionConfig } from "./components/searchSuggestion/types/index";
22
22
  import { PopsTooltip } from "./components/tooltip";
23
- import type { PopsToolTipDetails } from "./components/tooltip/types/index";
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 details 配置
93
+ * @param config 配置
94
94
  */
95
- alert = (details: PopsAlertDetails) => {
96
- const dialog = PopsAlert.init(details);
95
+ alert = (config: PopsAlertConfig) => {
96
+ const dialog = PopsAlert.init(config);
97
97
  return dialog;
98
98
  };
99
99
 
100
100
  /**
101
101
  * 询问框
102
- * @param details 配置
102
+ * @param config 配置
103
103
  */
104
- confirm = (details: PopsConfirmDetails) => {
105
- const dialog = PopsConfirm.init(details);
104
+ confirm = (config: PopsConfirmConfig) => {
105
+ const dialog = PopsConfirm.init(config);
106
106
  return dialog;
107
107
  };
108
108
 
109
109
  /**
110
110
  * 输入框
111
- * @param details 配置
111
+ * @param config 配置
112
112
  */
113
- prompt = (details: PopsPromptDetails) => {
114
- const dialog = PopsPrompt.init(details);
113
+ prompt = (config: PopsPromptConfig) => {
114
+ const dialog = PopsPrompt.init(config);
115
115
  return dialog;
116
116
  };
117
117
 
118
118
  /**
119
119
  * 加载层
120
- * @param details 配置
120
+ * @param config 配置
121
121
  */
122
- loading = (details: PopsLoadingDetails) => {
123
- const popsLoading = PopsLoading.init(details);
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 details 配置
129
+ * @param config 配置
130
130
  */
131
- iframe = (details: PopsIframeDetails) => {
132
- const dialog = PopsIframe.init(details);
131
+ iframe = (config: PopsIframeConfig) => {
132
+ const dialog = PopsIframe.init(config);
133
133
  return dialog;
134
134
  };
135
135
 
136
136
  /**
137
137
  * 提示框
138
- * @param details 配置
138
+ * @param config 配置
139
139
  */
140
- tooltip = (details: PopsToolTipDetails) => {
141
- const popsTooltip = PopsTooltip.init(details);
140
+ tooltip = (config: PopsToolTipConfig) => {
141
+ const popsTooltip = PopsTooltip.init(config);
142
142
  return popsTooltip;
143
143
  };
144
144
 
145
145
  /**
146
146
  * 抽屉
147
- * @param details 配置
147
+ * @param config 配置
148
148
  */
149
- drawer = (details: PopsDrawerDetails) => {
150
- const dialog = PopsDrawer.init(details);
149
+ drawer = (config: PopsDrawerConfig) => {
150
+ const dialog = PopsDrawer.init(config);
151
151
  return dialog;
152
152
  };
153
153
 
154
154
  /**
155
155
  * 文件夹
156
- * @param details 配置
156
+ * @param config 配置
157
157
  */
158
- folder = (details: PopsFolderDetails) => {
159
- const dialog = PopsFolder.init(details);
158
+ folder = (config: PopsFolderConfig) => {
159
+ const dialog = PopsFolder.init(config);
160
160
  return dialog;
161
161
  };
162
162
 
163
163
  /**
164
164
  * 配置面板
165
- * @param details 配置
165
+ * @param config 配置
166
166
  */
167
- panel = (details: PopsPanelDetails) => {
168
- const dialog = PopsPanel.init(details);
167
+ panel = (config: PopsPanelConfig) => {
168
+ const dialog = PopsPanel.init(config);
169
169
  return dialog;
170
170
  };
171
171
 
172
172
  /**
173
173
  * 右键菜单
174
- * @param details 配置
174
+ * @param config 配置
175
175
  */
176
- rightClickMenu = (details: PopsRightClickMenuDetails) => {
177
- const popsRightClickMenu = PopsRightClickMenu.init(details);
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 details 配置
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>(details: PopsSearchSuggestionDetails<T>) => {
199
- const popsSearchSuggestion = PopsSearchSuggestion.init<T>(details);
198
+ searchSuggestion = <T = any>(config: PopsSearchSuggestionConfig<T>) => {
199
+ const popsSearchSuggestion = PopsSearchSuggestion.init<T>(config);
200
200
  return popsSearchSuggestion;
201
201
  };
202
202
  }
@@ -11,7 +11,7 @@ export const PopsAnimation = {
11
11
  init() {
12
12
  if (!this.$flag.isInit) {
13
13
  this.$flag.isInit = true;
14
- /* 处理获取当前所有的动画名 */
14
+ // 处理获取当前所有的动画名
15
15
  const $style = popsDOMUtils.createElement("style", {
16
16
  innerHTML: PopsCSS.anim,
17
17
  });
package/src/PopsInst.ts CHANGED
@@ -1,11 +1,11 @@
1
- import type { PopsInstCommonConfig } from "./types/inst";
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]: PopsInstCommonConfig[];
8
+ [key in PopsInstStoreType]: PopsInstGeneralConfig[];
9
9
  } = {
10
10
  alert: [],
11
11
  confirm: [],
@@ -1,6 +1,6 @@
1
- import type { PopsAlertDetails } from "./types";
1
+ import type { PopsAlertConfig } from "./types";
2
2
 
3
- export const PopsAlertConfig = (): DeepRequired<PopsAlertDetails> => {
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 (details: any) {
27
- details.close();
26
+ callback: function (eventConfig) {
27
+ eventConfig.close();
28
28
  },
29
29
  },
30
30
  close: {
31
31
  enable: true,
32
- callback: function (details: any) {
33
- details.close();
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<PopsAlertDetails>;
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 { PopsAlertConfig } from "./config";
7
+ import { PopsAlertDefaultConfig } from "./defaultConfig";
8
8
  import type { PopsType } from "../../types/main";
9
- import type { PopsAlertDetails } from "./types";
9
+ import type { PopsAlertConfig } from "./types";
10
10
  import { PopsCSS } from "../../PopsCSS";
11
11
 
12
12
  export const PopsAlert = {
13
- init(details: PopsAlertDetails) {
13
+ init(__config__: PopsAlertConfig) {
14
14
  const guid = popsUtils.getRandomGUID();
15
15
  // 设置当前类型
16
16
  const popsType: PopsType = "alert";
17
- let config = PopsAlertConfig();
17
+
18
+ let config = PopsAlertDefaultConfig();
18
19
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
19
- config = popsUtils.assign(config, details);
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
- /* 为底部ok按钮添加点击事件 */
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
- animElement: $anim,
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
- PopsCommonConfig,
5
+ PopsGeneralConfig,
6
6
  PopsButtonConfig,
7
7
  } from "../../../types/components";
8
- import type { PopsButtonDetails, PopsButtonDetailsAnyType } from "../../../types/button";
8
+ import type { PopsGlobalButtonConfig, PopsButtonConfigAnyType } from "../../../types/button";
9
9
 
10
10
  /**
11
11
  * pops.alert
12
12
  */
13
- export interface PopsAlertDetails extends PopsTitleConfig, PopsContentConfig, PopsDragConfig, PopsCommonConfig {
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<PopsButtonDetails | PopsButtonDetailsAnyType>;
21
+ ok?: Partial<PopsGlobalButtonConfig | PopsButtonConfigAnyType>;
22
22
  };
23
23
  }
@@ -1,6 +1,6 @@
1
- import type { PopsConfirmDetails } from "./types";
1
+ import type { PopsConfirmConfig } from "./types";
2
2
 
3
- export const PopsConfirmConfig = (): DeepRequired<PopsConfirmDetails> => {
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(detail: any) {
30
- detail.close();
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(detail: any) {
42
- detail.close();
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(detail: any) {
54
- detail.close();
53
+ callback(eventConfig) {
54
+ eventConfig.close();
55
55
  },
56
56
  },
57
57
  close: {
58
58
  enable: true,
59
- callback(detail: any) {
60
- detail.close();
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<PopsConfirmDetails>;
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 { PopsConfirmConfig } from "./config";
10
- import type { PopsConfirmDetails } from "./types";
9
+ import { PopsConfirmDefaultConfig } from "./defaultConfig";
10
+ import type { PopsConfirmConfig } from "./types";
11
11
 
12
12
  export const PopsConfirm = {
13
- init(details: PopsConfirmDetails) {
13
+ init(__config__: PopsConfirmConfig) {
14
14
  const guid = popsUtils.getRandomGUID();
15
15
  // 设置当前类型
16
16
  const popsType: PopsType = "confirm";
17
- let config = PopsConfirmConfig();
17
+
18
+ let config = PopsConfirmDefaultConfig();
18
19
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
19
- config = popsUtils.assign(config, details);
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
- animElement: $anim,
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
- PopsCommonConfig,
5
+ PopsGeneralConfig,
6
6
  PopsMoreButtonConfig,
7
7
  } from "../../../types/components";
8
8
 
9
9
  /**
10
10
  * pops.confirm
11
11
  */
12
- export interface PopsConfirmDetails
12
+ export interface PopsConfirmConfig
13
13
  extends PopsTitleConfig,
14
14
  PopsContentConfig,
15
15
  PopsMoreButtonConfig,
16
16
  PopsDragConfig,
17
- PopsCommonConfig {}
17
+ PopsGeneralConfig {}
@@ -1,6 +1,6 @@
1
- import type { PopsDrawerDetails } from "./types";
1
+ import type { PopsDrawerConfig } from "./types";
2
2
 
3
- export const PopsDrawerConfig = (): DeepRequired<PopsDrawerDetails> => {
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(detail: any) {
31
- detail.close();
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(detail: any) {
43
- detail.close();
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(detail: any) {
55
- detail.close();
54
+ callback(eventConfig) {
55
+ eventConfig.close();
56
56
  },
57
57
  },
58
58
  close: {
59
59
  enable: true,
60
- callback(detail: any) {
61
- detail.close();
60
+ callback(eventConfig) {
61
+ eventConfig.close();
62
62
  },
63
63
  },
64
64
  },