@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
@@ -4,25 +4,24 @@ import { PopsElementHandler } from "../../handler/PopsElementHandler";
4
4
  import { PopsHandler } from "../../handler/PopsHandler";
5
5
  import { PopsCSS } from "../../PopsCSS";
6
6
  import { PopsInstData } from "../../PopsInst";
7
- import type { PopsEventConfig } from "../../types/event";
8
7
  import { popsDOMUtils } from "../../utils/PopsDOMUtils";
9
8
  import { PopsInstanceUtils } from "../../utils/PopsInstanceUtils";
10
9
  import { popsUtils } from "../../utils/PopsUtils";
11
- import { PopsIframeConfig } from "./config";
12
- import type { PopsIframeDetails } from "./types";
10
+ import { PopsIframeDefaultConfig } from "./defaultConfig";
11
+ import type { PopsIframeClickEventConfig, PopsIframeConfig } from "./types";
13
12
  import type { PopsType } from "../../types/main";
14
13
 
15
14
  export const PopsIframe = {
16
- init(details: PopsIframeDetails) {
15
+ init(__config__: PopsIframeConfig) {
17
16
  const guid = popsUtils.getRandomGUID();
18
17
  // 设置当前类型
19
18
  const popsType: PopsType = "iframe";
20
19
 
21
- let config = PopsIframeConfig();
20
+ let config = PopsIframeDefaultConfig();
22
21
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
23
- config = popsUtils.assign(config, details);
22
+ config = popsUtils.assign(config, __config__);
24
23
  if (config.url == null) {
25
- throw new Error("config.url不能为空");
24
+ throw new TypeError("config.url must not be null.");
26
25
  }
27
26
  config = PopsHandler.handleOnly(popsType, config);
28
27
 
@@ -61,7 +60,7 @@ export const PopsIframe = {
61
60
  const maskHTML = PopsElementHandler.createMask(guid, zIndex, maskExtraStyle);
62
61
 
63
62
  const headerBtnHTML = PopsElementHandler.createHeader(popsType, config);
64
- const iframeLoadingHTML = '<div class="pops-loading"></div>';
63
+ const iframeLoadingHTML = /*html*/ '<div class="pops-loading"></div>';
65
64
  const titleText = config.title!.text!.trim() !== "" ? config.title.text : config.url;
66
65
  const { headerStyle, headerPStyle } = PopsElementHandler.createHeaderStyle(popsType, config);
67
66
  const animHTML = PopsElementHandler.createAnim(
@@ -143,35 +142,33 @@ export const PopsIframe = {
143
142
  $anim,
144
143
  $pops,
145
144
  $mask
146
- ) as any as PopsEventConfig & {
147
- iframeElement: HTMLIFrameElement;
148
- };
149
-
150
- evtConfig["iframeElement"] = $iframe!;
145
+ ) as PopsIframeClickEventConfig;
146
+ // 赋值额外的$iframe参数
147
+ evtConfig.$iframe = $iframe!;
151
148
 
152
149
  popsDOMUtils.on($anim, popsDOMUtils.getAnimationEndNameList(), function () {
153
- /* 动画加载完毕 */
150
+ // 动画加载完毕
154
151
  $anim.style.width = "0%";
155
152
  $anim.style.height = "0%";
156
153
  });
157
154
 
158
155
  popsDOMUtils.on($iframe, "load", () => {
159
- /* iframe加载中... */
156
+ // iframe加载中...
160
157
  loadingElement?.remove();
161
158
  $contentLoading!.style.animation = "iframeLoadingChange_85 0.3s forwards";
162
159
  popsDOMUtils.on($contentLoading, popsDOMUtils.getAnimationEndNameList(), () => {
163
- /* 动画加载完毕就移除 */
160
+ // 动画加载完毕就移除
164
161
  $contentLoading!.remove();
165
162
  });
166
163
 
167
164
  if (config.title!.text!.trim() === "" && $iframe!.contentDocument) {
168
- /* 同域名下的才可以获取网页标题 */
165
+ // 同域名下的才可以获取网页标题
169
166
  $title!.querySelector<HTMLElement>("p")!.innerText = $iframe!.contentDocument.title;
170
167
  }
171
168
 
172
169
  config.loadEndCallBack(evtConfig);
173
170
  });
174
- /* 创建到页面中 */
171
+ // 创建到页面中
175
172
 
176
173
  popsDOMUtils.append($shadowRoot, $elList);
177
174
  if (typeof config.beforeAppendToPageCallBack === "function") {
@@ -182,7 +179,7 @@ export const PopsIframe = {
182
179
  if ($mask != null) {
183
180
  $anim.after($mask);
184
181
  }
185
- /* 拖拽 */
182
+ // 拖拽
186
183
  if (config.drag) {
187
184
  PopsInstanceUtils.drag($pops!, {
188
185
  dragElement: $title!,
@@ -193,7 +190,7 @@ export const PopsIframe = {
193
190
  });
194
191
  }
195
192
  const TYPE_MODULE = "type-module";
196
- /* 最小化按钮点击事件 */
193
+ // 最小化按钮点击事件
197
194
  let origin_left = "";
198
195
  let origin_top = "";
199
196
  let origin_is_max = false;
@@ -224,7 +221,7 @@ export const PopsIframe = {
224
221
  capture: true,
225
222
  }
226
223
  );
227
- /* 最大化按钮点击事件 */
224
+ // 最大化按钮点击事件
228
225
  popsDOMUtils.on<MouseEvent | PointerEvent>(
229
226
  headerMaxBtnElement,
230
227
  "click",
@@ -258,9 +255,9 @@ export const PopsIframe = {
258
255
  capture: true,
259
256
  }
260
257
  );
261
- /* 先隐藏窗口化按钮 */
258
+ // 先隐藏窗口化按钮
262
259
  headerMiseBtnElement?.style?.setProperty("display", "none");
263
- /* 复位按钮点击事件 */
260
+ // 复位按钮点击事件
264
261
  popsDOMUtils.on<MouseEvent | PointerEvent>(
265
262
  headerMiseBtnElement,
266
263
  "click",
@@ -300,7 +297,7 @@ export const PopsIframe = {
300
297
  capture: true,
301
298
  }
302
299
  );
303
- /* 关闭按钮点击事件 */
300
+ // 关闭按钮点击事件
304
301
  popsDOMUtils.on<MouseEvent | PointerEvent>(
305
302
  headerCloseBtnElement,
306
303
  "click",
@@ -319,11 +316,9 @@ export const PopsIframe = {
319
316
 
320
317
  PopsHandler.handlePush(popsType, {
321
318
  guid: guid,
322
- animElement: $anim,
323
-
324
- popsElement: $pops!,
325
-
326
- maskElement: $mask!,
319
+ $anim: $anim,
320
+ $pops: $pops!,
321
+ $mask: $mask!,
327
322
  $shadowContainer: $shadowContainer,
328
323
  $shadowRoot: $shadowRoot,
329
324
  });
@@ -1,41 +1,21 @@
1
- import type { PopsTitleConfig, PopsDragConfig, PopsCommonConfig } from "../../../types/components";
1
+ import type { PopsTitleConfig, PopsDragConfig, PopsGeneralConfig } from "../../../types/components";
2
2
 
3
3
  import type { PopsEventConfig } from "../../../types/event";
4
4
 
5
5
  /**
6
- * pops.iframe的按钮的点击回调参数event
6
+ * pops.iframe的按钮点击事件回调的配置参数
7
7
  */
8
- export interface PopsBtnIframeCallBackEvent {
9
- /**
10
- * 动画元素(包裹着弹窗元素)
11
- */
12
- animElement: HTMLElement;
13
- /**
14
- * 弹窗元素
15
- */
16
- popsElement: HTMLElement;
17
- /**
18
- * 遮罩层元素,如果未设置,那么不存在
19
- */
20
- maskElement?: HTMLElement;
8
+ export type PopsIframeClickEventConfig = PopsEventConfig & {
21
9
  /**
22
10
  * iframe元素
23
11
  */
24
- iframePopsElement: HTMLIFrameElement;
25
- /**
26
- * 使用的方法名
27
- */
28
- function: "iframe";
29
- /**
30
- * 唯一id
31
- */
32
- guid: string;
33
- }
12
+ $iframe: HTMLIFrameElement;
13
+ };
34
14
 
35
15
  /**
36
16
  * pops.iframe
37
17
  */
38
- export interface PopsIframeDetails extends PopsTitleConfig, PopsDragConfig, PopsCommonConfig {
18
+ export interface PopsIframeConfig extends PopsTitleConfig, PopsDragConfig, PopsGeneralConfig {
39
19
  /**
40
20
  * 加载配置
41
21
  */
@@ -64,12 +44,7 @@ export interface PopsIframeDetails extends PopsTitleConfig, PopsDragConfig, Pops
64
44
  /**
65
45
  * 点击的回调函数
66
46
  */
67
- callback: (
68
- eventConfig: PopsEventConfig & {
69
- iframeElement: HTMLIFrameElement;
70
- },
71
- event: MouseEvent | PointerEvent
72
- ) => void;
47
+ callback: (eventConfig: PopsIframeClickEventConfig, event: MouseEvent | PointerEvent) => void;
73
48
  };
74
49
  /**
75
50
  * 最大化
@@ -78,12 +53,7 @@ export interface PopsIframeDetails extends PopsTitleConfig, PopsDragConfig, Pops
78
53
  /**
79
54
  * 点击的回调函数
80
55
  */
81
- callback: (
82
- eventConfig: PopsEventConfig & {
83
- iframeElement: HTMLIFrameElement;
84
- },
85
- event: MouseEvent | PointerEvent
86
- ) => void;
56
+ callback: (eventConfig: PopsIframeClickEventConfig, event: MouseEvent | PointerEvent) => void;
87
57
  };
88
58
  /**
89
59
  * 窗口化
@@ -92,12 +62,7 @@ export interface PopsIframeDetails extends PopsTitleConfig, PopsDragConfig, Pops
92
62
  /**
93
63
  * 点击的回调函数
94
64
  */
95
- callback: (
96
- eventConfig: PopsEventConfig & {
97
- iframeElement: HTMLIFrameElement;
98
- },
99
- event: MouseEvent | PointerEvent
100
- ) => void;
65
+ callback: (eventConfig: PopsIframeClickEventConfig, event: MouseEvent | PointerEvent) => void;
101
66
  };
102
67
  /**
103
68
  * 关闭
@@ -106,12 +71,7 @@ export interface PopsIframeDetails extends PopsTitleConfig, PopsDragConfig, Pops
106
71
  /**
107
72
  * 点击的回调函数
108
73
  */
109
- callback: (
110
- eventConfig: PopsEventConfig & {
111
- iframeElement: HTMLIFrameElement;
112
- },
113
- event: MouseEvent | PointerEvent
114
- ) => void;
74
+ callback: (eventConfig: PopsIframeClickEventConfig, event: MouseEvent | PointerEvent) => void;
115
75
  };
116
76
  };
117
77
  /**
@@ -121,8 +81,9 @@ export interface PopsIframeDetails extends PopsTitleConfig, PopsDragConfig, Pops
121
81
  url?: string;
122
82
  /**
123
83
  * 右上角按钮顺序:最小化、最大化、窗口化、关闭
84
+ * @default "min|max|mise|close"
124
85
  */
125
- topRightButton: "min|max|mise|close";
86
+ topRightButton: string;
126
87
  /**
127
88
  * 是否启用沙箱,默认false
128
89
  * @default false
@@ -131,9 +92,5 @@ export interface PopsIframeDetails extends PopsTitleConfig, PopsDragConfig, Pops
131
92
  /**
132
93
  * 加载完毕的回调
133
94
  */
134
- loadEndCallBack?: (
135
- details: PopsEventConfig & {
136
- iframeElement: HTMLIFrameElement;
137
- }
138
- ) => void;
95
+ loadEndCallBack?: (eventConfig: PopsIframeClickEventConfig) => void;
139
96
  }
@@ -1,8 +1,8 @@
1
- import type { PopsLoadingDetails } from "./types";
1
+ import type { PopsLoadingConfig } from "./types";
2
2
 
3
- export const PopsLoadingConfig = (): DeepRequired<PopsLoadingDetails> => {
3
+ export const PopsLoadingDefaultConfig = (): DeepRequired<PopsLoadingConfig> => {
4
4
  return {
5
- parent: document.body,
5
+ $parent: document.body || document.documentElement,
6
6
  content: {
7
7
  text: "加载中...",
8
8
  icon: "loading",
@@ -4,16 +4,17 @@ import { PopsHandler } from "../../handler/PopsHandler";
4
4
  import { PopsCSS } from "../../PopsCSS";
5
5
  import { popsDOMUtils } from "../../utils/PopsDOMUtils";
6
6
  import { popsUtils } from "../../utils/PopsUtils";
7
- import { PopsLoadingConfig } from "./config";
8
- import type { PopsLoadingDetails } from "./types";
7
+ import { PopsLoadingDefaultConfig } from "./defaultConfig";
8
+ import type { PopsLoadingConfig } from "./types";
9
9
 
10
10
  export const PopsLoading = {
11
- init(details: PopsLoadingDetails) {
12
- let config = PopsLoadingConfig();
13
- config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
14
- config = popsUtils.assign(config, details);
11
+ init(__config__: PopsLoadingConfig) {
15
12
  const guid = popsUtils.getRandomGUID();
13
+ // 设置当前类型
16
14
  const PopsType = "loading";
15
+ let config = PopsLoadingDefaultConfig();
16
+ config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
17
+ config = popsUtils.assign(config, __config__);
17
18
 
18
19
  config = PopsHandler.handleOnly(PopsType, config);
19
20
 
@@ -76,16 +77,17 @@ export const PopsLoading = {
76
77
  $elList.push($mask);
77
78
  }
78
79
  const evtConfig = PopsHandler.handleLoadingEventConfig(config, guid, PopsType, $anim, $pops, $mask);
79
- popsDOMUtils.append(config.parent, $elList);
80
+ popsDOMUtils.append(config.$parent, $elList);
80
81
  if ($mask != null) {
81
82
  $anim.after($mask);
82
83
  }
84
+ // @ts-ignore
83
85
  PopsHandler.handlePush(PopsType, {
84
86
  guid: guid,
85
- animElement: $anim,
86
- popsElement: $pops!,
87
- maskElement: $mask!,
88
- } as any);
87
+ $anim: $anim,
88
+ $pops: $pops!,
89
+ $mask: $mask!,
90
+ });
89
91
 
90
92
  if (config.isAbsolute) {
91
93
  // 遮罩层必须是跟随主内容
@@ -1,15 +1,15 @@
1
- import type { PopsCommonConfig, PopsContentConfig } from "../../../types/components";
1
+ import type { PopsGeneralConfig, PopsContentConfig } from "../../../types/components";
2
2
 
3
3
  /**
4
4
  * pops.loading
5
5
  */
6
- export interface PopsLoadingDetails
7
- extends Omit<PopsCommonConfig, "width" | "height" | "position" | "beforeAppendToPageCallBack"> {
6
+ export interface PopsLoadingConfig
7
+ extends Omit<PopsGeneralConfig, "width" | "height" | "position" | "beforeAppendToPageCallBack"> {
8
8
  /**
9
9
  * 父元素,默认为document.body
10
- * @default document.body
10
+ * @default document.body || document.documentElement
11
11
  */
12
- parent?: HTMLElement;
12
+ $parent?: HTMLElement;
13
13
  /**
14
14
  * 内容配置
15
15
  */
@@ -1,7 +1,7 @@
1
1
  import { popsDOMUtils } from "../../utils/PopsDOMUtils";
2
- import type { PopsPanelDetails } from "./types";
2
+ import type { PopsPanelConfig } from "./types";
3
3
 
4
- export const PopsPanelConfig = (): DeepRequired<PopsPanelDetails> => {
4
+ export const PopsPanelDefaultConfig = (): DeepRequired<PopsPanelConfig> => {
5
5
  return {
6
6
  title: {
7
7
  text: "默认标题",
@@ -14,18 +14,18 @@ export const PopsPanelConfig = (): DeepRequired<PopsPanelDetails> => {
14
14
  id: "whitesev-panel-config-1",
15
15
  title: "菜单配置1",
16
16
  headerTitle: "菜单配置1",
17
- isDefault: false,
17
+ isDefault: true,
18
18
  attributes: {
19
19
  "data-test": "test",
20
20
  "data-test-2": "test2",
21
21
  },
22
- forms: [
22
+ views: [
23
23
  {
24
24
  className: "forms-1",
25
25
  text: "区域设置",
26
- type: "forms",
26
+ type: "container",
27
27
  attributes: {},
28
- forms: [
28
+ views: [
29
29
  {
30
30
  className: "panel-switch",
31
31
  text: "switch",
@@ -141,12 +141,12 @@ export const PopsPanelConfig = (): DeepRequired<PopsPanelDetails> => {
141
141
  id: "whitesev-panel-config-2",
142
142
  title: "菜单配置2",
143
143
  headerTitle: "菜单配置2",
144
- isDefault: true,
144
+ isDefault: false,
145
145
  attributes: {
146
146
  "data-value": "value",
147
147
  "data-value-2": "value2",
148
148
  },
149
- forms: [
149
+ views: [
150
150
  {
151
151
  className: "panel-input",
152
152
  text: "input",
@@ -167,7 +167,6 @@ export const PopsPanelConfig = (): DeepRequired<PopsPanelDetails> => {
167
167
  className: "panel-input-password",
168
168
  text: "input-password",
169
169
  type: "input",
170
- // @ts-ignore
171
170
  props: {},
172
171
  attributes: {},
173
172
  getValue() {
@@ -184,7 +183,6 @@ export const PopsPanelConfig = (): DeepRequired<PopsPanelDetails> => {
184
183
  className: "panel-textarea",
185
184
  text: "textarea",
186
185
  type: "textarea",
187
- // @ts-ignore
188
186
  props: {},
189
187
  attributes: {},
190
188
  getValue() {
@@ -196,12 +194,94 @@ export const PopsPanelConfig = (): DeepRequired<PopsPanelDetails> => {
196
194
  },
197
195
  placeholder: "请输入内容",
198
196
  },
197
+ {
198
+ className: "panel-select-disabled",
199
+ text: "select-disabled",
200
+ type: "select",
201
+ disabled: true,
202
+ props: {},
203
+ attributes: {},
204
+ getValue() {
205
+ return 50;
206
+ },
207
+ callback(event, isSelectedValue, isSelectedText) {
208
+ console.log(`select当前选项:${isSelectedValue},当前选项文本:${isSelectedText}`);
209
+ },
210
+ data: [
211
+ {
212
+ value: "all",
213
+ text: "所有",
214
+ disable() {
215
+ return false;
216
+ },
217
+ views: [],
218
+ },
219
+ {
220
+ value: "text",
221
+ text: "文本",
222
+ disable() {
223
+ return false;
224
+ },
225
+ views: [],
226
+ },
227
+ {
228
+ value: "html",
229
+ text: "超文本",
230
+ disable() {
231
+ return false;
232
+ },
233
+ views: [],
234
+ },
235
+ ],
236
+ },
237
+ {
238
+ className: "panel-select-multiple-disabled",
239
+ type: "select-multiple",
240
+ text: "select-multiple-disabled",
241
+ disabled: true,
242
+ props: {},
243
+
244
+ attributes: {},
245
+ placeholder: "请至少选择一个选项",
246
+ getValue() {
247
+ return ["select-1", "select-2"];
248
+ },
249
+ callback(selectInfo) {
250
+ console.log(`select值改变,多选信息`, selectInfo);
251
+ },
252
+ clickCallBack(event, isSelectedInfo) {
253
+ console.log("点击", event, isSelectedInfo);
254
+ },
255
+ closeIconClickCallBack(event, data) {
256
+ console.log("点击关闭图标的事件", data);
257
+ },
258
+ data: [
259
+ {
260
+ value: "select-1",
261
+ text: "单选1",
262
+ isHTML: false,
263
+ },
264
+ {
265
+ value: "select-2",
266
+ text: "单选2",
267
+ isHTML: false,
268
+ },
269
+ {
270
+ value: "select-3",
271
+ text: "单选3",
272
+ isHTML: false,
273
+ },
274
+ {
275
+ value: "select-4",
276
+ text: "单选4",
277
+ isHTML: false,
278
+ },
279
+ ],
280
+ },
199
281
  {
200
282
  className: "panel-select",
201
283
  text: "select",
202
284
  type: "select",
203
- disabled: true,
204
- // @ts-ignore
205
285
  props: {},
206
286
  attributes: {},
207
287
  getValue() {
@@ -217,7 +297,7 @@ export const PopsPanelConfig = (): DeepRequired<PopsPanelDetails> => {
217
297
  disable() {
218
298
  return false;
219
299
  },
220
- forms: [],
300
+ views: [],
221
301
  },
222
302
  {
223
303
  value: "text",
@@ -225,7 +305,7 @@ export const PopsPanelConfig = (): DeepRequired<PopsPanelDetails> => {
225
305
  disable() {
226
306
  return false;
227
307
  },
228
- forms: [],
308
+ views: [],
229
309
  },
230
310
  {
231
311
  value: "html",
@@ -233,7 +313,7 @@ export const PopsPanelConfig = (): DeepRequired<PopsPanelDetails> => {
233
313
  disable() {
234
314
  return false;
235
315
  },
236
- forms: [],
316
+ views: [],
237
317
  },
238
318
  ],
239
319
  },
@@ -241,8 +321,6 @@ export const PopsPanelConfig = (): DeepRequired<PopsPanelDetails> => {
241
321
  className: "panel-select-multiple",
242
322
  type: "select-multiple",
243
323
  text: "select-multiple",
244
- disabled: true,
245
- // @ts-ignore
246
324
  props: {},
247
325
 
248
326
  attributes: {},
@@ -307,9 +385,9 @@ export const PopsPanelConfig = (): DeepRequired<PopsPanelDetails> => {
307
385
  ],
308
386
  },
309
387
  {
310
- type: "forms",
388
+ type: "container",
311
389
  text: "deep菜单",
312
- forms: [
390
+ views: [
313
391
  {
314
392
  type: "deepMenu",
315
393
  className: "panel-deepMenu",
@@ -317,20 +395,20 @@ export const PopsPanelConfig = (): DeepRequired<PopsPanelDetails> => {
317
395
  description: "二级菜单",
318
396
  rightText: "自定义配置",
319
397
  arrowRightIcon: true,
320
- afterAddToUListCallBack(formConfig, container) {
321
- console.log(formConfig, container);
398
+ afterAddToUListCallBack(viewConfig, container) {
399
+ console.log(viewConfig, container);
322
400
  },
323
- clickCallBack(event, formConfig) {
324
- console.log("进入子配置", event, formConfig);
401
+ clickCallBack(event, viewConfig) {
402
+ console.log("进入子配置", event, viewConfig);
325
403
  },
326
- forms: [
404
+ views: [
327
405
  {
328
406
  className: "forms-1",
329
407
  text: "区域设置",
330
- type: "forms",
408
+ type: "container",
331
409
  attributes: {},
332
410
  props: {},
333
- forms: [
411
+ views: [
334
412
  {
335
413
  className: "panel-switch",
336
414
  text: "switch",
@@ -420,24 +498,24 @@ export const PopsPanelConfig = (): DeepRequired<PopsPanelDetails> => {
420
498
  description: "二级菜单",
421
499
  rightText: "自定义配置",
422
500
  arrowRightIcon: true,
423
- afterAddToUListCallBack(formConfig, container) {
424
- console.log(formConfig, container);
501
+ afterAddToUListCallBack(viewConfig, container) {
502
+ console.log(viewConfig, container);
425
503
  },
426
- clickCallBack(event, formConfig) {
427
- console.log("进入子配置", event, formConfig);
504
+ clickCallBack(event, viewConfig) {
505
+ console.log("进入子配置", event, viewConfig);
428
506
  },
429
- forms: [],
507
+ views: [],
430
508
  },
431
509
  ],
432
510
  },
433
511
  {
434
- type: "forms",
512
+ type: "container",
435
513
  isFold: true,
436
514
  text: "折叠菜单",
437
- afterAddToUListCallBack(formConfig, container) {
438
- console.log(formConfig, container);
515
+ afterAddToUListCallBack(viewConfig, container) {
516
+ console.log(viewConfig, container);
439
517
  },
440
- forms: [
518
+ views: [
441
519
  {
442
520
  className: "panel-switch",
443
521
  text: "switch",
@@ -469,7 +547,7 @@ export const PopsPanelConfig = (): DeepRequired<PopsPanelDetails> => {
469
547
  },
470
548
  // @ts-ignore
471
549
  props: {},
472
- forms: [],
550
+ views: [],
473
551
  clickFirstCallback: function () {
474
552
  return false;
475
553
  },
@@ -484,7 +562,7 @@ export const PopsPanelConfig = (): DeepRequired<PopsPanelDetails> => {
484
562
  },
485
563
  // @ts-ignore
486
564
  props: {},
487
- forms: [],
565
+ views: [],
488
566
  clickFirstCallback: function () {
489
567
  return false;
490
568
  },