@whitesev/pops 2.0.6 → 2.0.7

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 (56) hide show
  1. package/dist/index.amd.js +127 -74
  2. package/dist/index.amd.js.map +1 -1
  3. package/dist/index.cjs.js +127 -74
  4. package/dist/index.cjs.js.map +1 -1
  5. package/dist/index.esm.js +127 -74
  6. package/dist/index.esm.js.map +1 -1
  7. package/dist/index.iife.js +127 -74
  8. package/dist/index.iife.js.map +1 -1
  9. package/dist/index.system.js +127 -74
  10. package/dist/index.system.js.map +1 -1
  11. package/dist/index.umd.js +127 -74
  12. package/dist/index.umd.js.map +1 -1
  13. package/dist/types/src/Pops.d.ts +20411 -15
  14. package/dist/types/src/components/alert/index.d.ts +3 -3
  15. package/dist/types/src/components/confirm/index.d.ts +3 -3
  16. package/dist/types/src/components/drawer/index.d.ts +3 -3
  17. package/dist/types/src/components/drawer/indexType.d.ts +10 -2
  18. package/dist/types/src/components/folder/index.d.ts +3 -3
  19. package/dist/types/src/components/folder/indexType.d.ts +4 -1
  20. package/dist/types/src/components/iframe/index.d.ts +6 -3
  21. package/dist/types/src/components/iframe/indexType.d.ts +2 -0
  22. package/dist/types/src/components/loading/index.d.ts +3 -3
  23. package/dist/types/src/components/loading/indexType.d.ts +3 -1
  24. package/dist/types/src/components/panel/index.d.ts +3 -3
  25. package/dist/types/src/components/panel/indexType.d.ts +1 -0
  26. package/dist/types/src/components/panel/sliderType.d.ts +14 -4
  27. package/dist/types/src/components/prompt/index.d.ts +3 -3
  28. package/dist/types/src/components/prompt/indexType.d.ts +1 -0
  29. package/dist/types/src/components/rightClickMenu/index.d.ts +20315 -3
  30. package/dist/types/src/components/rightClickMenu/indexType.d.ts +6 -2
  31. package/dist/types/src/components/searchSuggestion/index.d.ts +141 -3
  32. package/dist/types/src/components/searchSuggestion/indexType.d.ts +0 -108
  33. package/dist/types/src/components/tooltip/index.d.ts +51 -3
  34. package/package.json +1 -1
  35. package/src/Pops.ts +25 -24
  36. package/src/components/alert/index.ts +6 -5
  37. package/src/components/confirm/index.ts +6 -5
  38. package/src/components/drawer/index.ts +6 -5
  39. package/src/components/drawer/indexType.ts +10 -2
  40. package/src/components/folder/index.ts +6 -5
  41. package/src/components/folder/indexType.ts +4 -1
  42. package/src/components/iframe/index.ts +4 -4
  43. package/src/components/iframe/indexType.ts +2 -0
  44. package/src/components/loading/index.ts +6 -5
  45. package/src/components/loading/indexType.ts +3 -1
  46. package/src/components/panel/PanelHandleContentDetails.ts +62 -29
  47. package/src/components/panel/index.ts +6 -5
  48. package/src/components/panel/indexType.ts +1 -0
  49. package/src/components/panel/sliderType.ts +14 -4
  50. package/src/components/prompt/index.ts +6 -5
  51. package/src/components/prompt/indexType.ts +1 -0
  52. package/src/components/rightClickMenu/index.ts +4 -5
  53. package/src/components/rightClickMenu/indexType.ts +6 -7
  54. package/src/components/searchSuggestion/index.ts +4 -4
  55. package/src/components/searchSuggestion/indexType.ts +0 -109
  56. package/src/components/tooltip/index.ts +9 -9
@@ -37,9 +37,10 @@ export interface PopsRightClickMenuDataDetails {
37
37
  */
38
38
  export interface PopsRightClickMenuDetails extends Pick<PopsCommonConfig, "useShadowRoot" | "beforeAppendToPageCallBack" | "zIndex" | "style" | "only"> {
39
39
  /**
40
- * 目标,默认为document.documentElement G
40
+ * 目标元素
41
+ * @default document.documentElement
41
42
  */
42
- target?: HTMLElement | (typeof globalThis & Window) | Window | EventTarget | Node;
43
+ target?: HTMLElement | Window | EventTarget | Node;
43
44
  /**
44
45
  * 目标的子元素选择器,默认为空
45
46
  */
@@ -50,14 +51,17 @@ export interface PopsRightClickMenuDetails extends Pick<PopsCommonConfig, "useSh
50
51
  data: PopsRightClickMenuDataDetails[];
51
52
  /**
52
53
  * 自定义className,默认为空
54
+ * @default ""
53
55
  */
54
56
  className?: string;
55
57
  /**
56
58
  * 是否启用动画,默认true
59
+ * @default true
57
60
  */
58
61
  isAnimation?: boolean;
59
62
  /**
60
63
  * 是否阻止默认contextmenu事件
64
+ * @default false
61
65
  */
62
66
  preventDefault?: boolean;
63
67
  }
@@ -1,4 +1,142 @@
1
1
  import type { PopsSearchSuggestionDetails } from "./indexType";
2
- export declare class PopsSearchSuggestion {
3
- constructor(details: PopsSearchSuggestionDetails);
4
- }
2
+ export declare const PopsSearchSuggestion: {
3
+ init(details: PopsSearchSuggestionDetails): {
4
+ /**
5
+ * 当前的环境,可以是document,可以是shadowroot,默认是document
6
+ */
7
+ selfDocument: Document | ShadowRoot | (Document | ShadowRoot)[];
8
+ $el: {
9
+ /** 根元素 */
10
+ root: HTMLElement;
11
+ /** ul元素 */
12
+ $hintULContainer: HTMLUListElement;
13
+ /** 动态更新CSS */
14
+ $dynamicCSS: HTMLStyleElement;
15
+ };
16
+ $data: {
17
+ /** 是否结果为空 */
18
+ isEmpty: boolean;
19
+ };
20
+ /**
21
+ * 初始化
22
+ */
23
+ init(parentElement?: HTMLElement): void;
24
+ /** 初始化元素变量 */
25
+ initEl(): void;
26
+ /**
27
+ * 获取显示出搜索建议框的html
28
+ */
29
+ getSearchSelectElement(): HTMLDivElement;
30
+ /** 动态获取CSS */
31
+ getDynamicCSS(): string;
32
+ /**
33
+ * 获取显示出搜索建议框的每一项的html
34
+ * @param data 当前项的值
35
+ * @param index 当前项的下标
36
+ */
37
+ getSearchItemLiElement(data: any, index: number): HTMLLIElement;
38
+ /**
39
+ * 获取data-value值
40
+ * @param data
41
+ */
42
+ getItemDataValue(data: any): any;
43
+ /**
44
+ * 设置搜索建议框每一项的点击事件
45
+ * @param liElement
46
+ */
47
+ setSearchItemClickEvent(liElement: HTMLLIElement): void;
48
+ /**
49
+ * 设置搜索建议框每一项的选中事件
50
+ * @param liElement
51
+ */
52
+ setSearchItemSelectEvent(liElement: HTMLLIElement): void;
53
+ /**
54
+ * 监听输入框内容改变
55
+ */
56
+ setInputChangeEvent(option?: AddEventListenerOptions): void;
57
+ /**
58
+ * 移除输入框内容改变的监听
59
+ */
60
+ removeInputChangeEvent(option?: AddEventListenerOptions): void;
61
+ /**
62
+ * 显示搜索建议框的事件
63
+ */
64
+ showEvent(): void;
65
+ /**
66
+ * 设置显示搜索建议框的事件
67
+ */
68
+ setShowEvent(option?: AddEventListenerOptions): void;
69
+ /**
70
+ * 移除显示搜索建议框的事件
71
+ */
72
+ removeShowEvent(option?: AddEventListenerOptions): void;
73
+ /**
74
+ * 隐藏搜索建议框的事件
75
+ * @param event
76
+ */
77
+ hideEvent(event: PointerEvent | MouseEvent): void;
78
+ /**
79
+ * 设置隐藏搜索建议框的事件
80
+ */
81
+ setHideEvent(option?: AddEventListenerOptions): void;
82
+ /**
83
+ * 移除隐藏搜索建议框的事件
84
+ */
85
+ removeHideEvent(option?: AddEventListenerOptions): void;
86
+ /**
87
+ * 设置所有监听
88
+ */
89
+ setAllEvent(option?: AddEventListenerOptions): void;
90
+ /**
91
+ * 移除所有监听
92
+ */
93
+ removeAllEvent(option?: AddEventListenerOptions): void;
94
+ /**
95
+ * 获取删除按钮的html
96
+ */
97
+ getDeleteIconHTML(size?: number, fill?: string): string;
98
+ /**
99
+ * 设置当前正在搜索中的提示
100
+ */
101
+ setPromptsInSearch(): void;
102
+ /**
103
+ * 移除正在搜索中的提示
104
+ */
105
+ removePromptsInSearch(): void;
106
+ /**
107
+ * 清空所有的搜索结果
108
+ */
109
+ clearAllSearchItemLi(): void;
110
+ /**
111
+ * 更新搜索建议框的位置(top、left)
112
+ * 因为目标元素可能是动态隐藏的
113
+ */
114
+ changeHintULElementPosition(target?: HTMLElement): void;
115
+ /**
116
+ * 更新搜索建议框的width
117
+ * 因为目标元素可能是动态隐藏的
118
+ */
119
+ changeHintULElementWidth(target?: HTMLElement): void;
120
+ /**
121
+ * 动态更新CSS
122
+ */
123
+ updateDynamicCSS(): void;
124
+ /**
125
+ * 更新页面显示的搜索结果
126
+ * @param data
127
+ */
128
+ update(data?: any[]): void;
129
+ /**
130
+ * 清空当前的搜索结果并显示无结果
131
+ */
132
+ clear(): void;
133
+ /**
134
+ * 隐藏搜索建议框
135
+ */
136
+ hide(): void;
137
+ /**
138
+ * 显示搜索建议框
139
+ */
140
+ show(): void;
141
+ };
142
+ };
@@ -131,111 +131,3 @@ export interface PopsSearchSuggestionDetails<T = any> extends Pick<PopsCommonCon
131
131
  */
132
132
  selectCallBack?: (event: MouseEvent, liElement: HTMLLIElement, data: T) => void;
133
133
  }
134
- /**
135
- * pops.searchSuggestion的函数返回值
136
- */
137
- export interface PopsSearchSuggestionResult<T = any> {
138
- $el: {
139
- /** 根元素 */
140
- root: HTMLElement;
141
- /** ul元素 */
142
- $hintULContainer: HTMLUListElement;
143
- /** 动态更新CSS */
144
- $dynamicCSS: HTMLStyleElement;
145
- };
146
- /**
147
- * 初始化
148
- */
149
- init: () => void;
150
- /**
151
- * 获取显示出搜索建议框的html
152
- */
153
- getSearchSelectElement: () => HTMLElement;
154
- /**
155
- * 获取显示出搜索建议框的每一项的html
156
- */
157
- getSearchItemLiElement: (data: T, index: number) => HTMLElement;
158
- /**
159
- * 获取data-value值
160
- */
161
- getItemDataValue: (data: T) => T;
162
- /**
163
- * 设置搜索建议框每一项的点击事件
164
- */
165
- setSearchItemClickEvent: (liElement: HTMLLIElement) => void;
166
- /**
167
- * 监听输入框内容改变
168
- */
169
- setInputChangeEvent: (option?: AddEventListenerOptions) => void;
170
- /**
171
- * 移除输入框内容改变的监听
172
- */
173
- removeInputChangeEvent: (option?: AddEventListenerOptions) => void;
174
- /**
175
- * 设置显示搜索建议框的事件
176
- */
177
- setShowEvent: (option?: AddEventListenerOptions) => void;
178
- /**
179
- * 移除显示搜索建议框的事件
180
- */
181
- removeShowEvent: (option?: AddEventListenerOptions) => void;
182
- /**
183
- * 设置隐藏搜索建议框的事件
184
- */
185
- setHideEvent: (option?: AddEventListenerOptions) => void;
186
- /**
187
- * 移除隐藏搜索建议框的事件
188
- */
189
- removeHideEvent: (option?: AddEventListenerOptions) => void;
190
- /**
191
- * 设置所有监听
192
- */
193
- setAllEvent: (option?: AddEventListenerOptions) => void;
194
- /**
195
- * 移除所有监听
196
- */
197
- removeAllEvent: (option?: AddEventListenerOptions) => void;
198
- /**
199
- * 获取删除按钮的html
200
- */
201
- getDeleteIconHTML: (size: number, fill: string) => void;
202
- /**
203
- * 设置当前正在搜索中的提示
204
- */
205
- setPromptsInSearch: () => void;
206
- /**
207
- * 移除正在搜索中的提示
208
- */
209
- removePromptsInSearch: () => void;
210
- /**
211
- * 清空所有的搜索结果
212
- */
213
- clearAllSearchItemLi: () => void;
214
- /**
215
- * 修改搜索建议框的位置(top、left)
216
- * 因为目标元素可能是动态隐藏的
217
- */
218
- changeHintULElementPosition: () => void;
219
- /**
220
- * 修改搜索建议框的width
221
- * 因为目标元素可能是动态隐藏的
222
- */
223
- changeHintULElementWidth: () => void;
224
- updateDynamicCSS: () => void;
225
- /**
226
- * 更新页面显示的搜索结果
227
- */
228
- update: (data: T[]) => void;
229
- /**
230
- * 清空当前的搜索结果并显示无结果
231
- */
232
- clear: () => void;
233
- /**
234
- * 隐藏搜索建议框
235
- */
236
- hide: () => void;
237
- /**
238
- * 显示搜索建议框
239
- */
240
- show: () => void;
241
- }
@@ -171,7 +171,55 @@ export type PopsTooltipResult<T extends PopsToolTipDetails> = {
171
171
  $shadowRoot: ShadowRoot;
172
172
  toolTip: typeof ToolTip.prototype;
173
173
  };
174
- export declare class PopsTooltip {
175
- constructor(details: PopsToolTipDetails);
176
- }
174
+ export declare const PopsTooltip: {
175
+ init(details: PopsToolTipDetails): {
176
+ guid: string;
177
+ config: {
178
+ target: HTMLElement;
179
+ content: string | (() => string);
180
+ position: import("./indexType").PopsTooltipPosition;
181
+ className: string;
182
+ isFixed: boolean;
183
+ alwaysShow: boolean;
184
+ delayCloseTime: number;
185
+ triggerShowEventName: string;
186
+ triggerCloseEventName: string;
187
+ eventOption: {
188
+ once: boolean;
189
+ passive: boolean;
190
+ signal: {
191
+ readonly aborted: boolean;
192
+ onabort: ((this: AbortSignal, ev: Event) => any) | null;
193
+ readonly reason: any;
194
+ throwIfAborted: () => void;
195
+ addEventListener: {
196
+ <K extends keyof AbortSignalEventMap>(type: K, listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
197
+ (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
198
+ };
199
+ removeEventListener: {
200
+ <K extends keyof AbortSignalEventMap>(type: K, listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
201
+ (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
202
+ };
203
+ dispatchEvent: (event: Event) => boolean;
204
+ };
205
+ capture: boolean;
206
+ };
207
+ showBeforeCallBack: ($toolTip: HTMLElement) => false | void;
208
+ showAfterCallBack: ($toolTip: HTMLElement) => void;
209
+ closeBeforeCallBack: ($toolTip: HTMLElement) => false | void;
210
+ closeAfterCallBack: ($toolTip: HTMLElement) => void;
211
+ showArrow: boolean;
212
+ arrowDistance: number;
213
+ otherDistance: number;
214
+ useShadowRoot: boolean;
215
+ only: boolean;
216
+ zIndex: number | (() => number);
217
+ style: string | null;
218
+ beforeAppendToPageCallBack: ($shadowRoot: ShadowRoot | HTMLElement, $shadowContainer: HTMLDivElement) => void;
219
+ };
220
+ $shadowContainer: HTMLDivElement;
221
+ $shadowRoot: HTMLDivElement | ShadowRoot;
222
+ toolTip: ToolTip;
223
+ };
224
+ };
177
225
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whitesev/pops",
3
- "version": "2.0.6",
3
+ "version": "2.0.7",
4
4
  "description": "弹窗库",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
package/src/Pops.ts CHANGED
@@ -63,28 +63,24 @@ import { PopsDrawer } from "./components/drawer";
63
63
  import type { PopsDrawerDetails } from "./components/drawer/indexType";
64
64
  import type { PopsFolderDetails } from "./components/folder/indexType";
65
65
  import { PopsFolder } from "./components/folder";
66
- import type { PopsEventDetails } from "./types/event";
67
66
  import type { PopsPanelDetails } from "./components/panel/indexType";
68
67
  import { PopsPanel } from "./components/panel";
69
68
  import { PopsRightClickMenu } from "./components/rightClickMenu";
70
69
  import type { PopsRightClickMenuDetails } from "./components/rightClickMenu/indexType";
71
70
  import type { PopsIcon } from "./types/icon";
72
- import type {
73
- PopsSearchSuggestionDetails,
74
- PopsSearchSuggestionResult,
75
- } from "./components/searchSuggestion/indexType";
71
+ import type { PopsSearchSuggestionDetails } from "./components/searchSuggestion/indexType";
76
72
  import { PopsSearchSuggestion } from "./components/searchSuggestion";
77
73
  import { PopsMathFloatUtils } from "./utils/PopsMathUtils";
78
74
  import { PanelHandleContentDetails } from "./components/panel/PanelHandleContentDetails";
79
75
  import { GlobalConfig } from "./GlobalConfig";
80
- import { PopsTooltip, type PopsTooltipResult } from "./components/tooltip";
76
+ import { PopsTooltip } from "./components/tooltip";
81
77
  import { PopsSafeUtils } from "./utils/PopsSafeUtils";
82
78
 
83
79
  class Pops {
84
80
  /** 配置 */
85
81
  config = {
86
82
  /** 版本号 */
87
- version: "2025.5.12",
83
+ version: "2025.5.25",
88
84
  cssText: {
89
85
  /** 主CSS */
90
86
  index: indexCSS,
@@ -240,7 +236,8 @@ class Pops {
240
236
  * @param details 配置
241
237
  */
242
238
  alert = (details: PopsAlertDetails) => {
243
- return new PopsAlert(details) as PopsEventDetails;
239
+ let dialog = PopsAlert.init(details);
240
+ return dialog;
244
241
  };
245
242
 
246
243
  /**
@@ -248,7 +245,8 @@ class Pops {
248
245
  * @param details 配置
249
246
  */
250
247
  confirm = (details: PopsConfirmDetails) => {
251
- return new PopsConfirm(details) as PopsEventDetails;
248
+ let dialog = PopsConfirm.init(details);
249
+ return dialog;
252
250
  };
253
251
 
254
252
  /**
@@ -256,7 +254,8 @@ class Pops {
256
254
  * @param details 配置
257
255
  */
258
256
  prompt = (details: PopsPromptDetails) => {
259
- return new PopsPrompt(details) as PopsEventDetails;
257
+ let dialog = PopsPrompt.init(details);
258
+ return dialog;
260
259
  };
261
260
 
262
261
  /**
@@ -264,10 +263,8 @@ class Pops {
264
263
  * @param details 配置
265
264
  */
266
265
  loading = (details: PopsLoadingDetails) => {
267
- return new PopsLoading(details) as Omit<
268
- PopsEventDetails,
269
- "$shadowContainer" | "$shadowRoot"
270
- >;
266
+ let popsLoading = PopsLoading.init(details);
267
+ return popsLoading;
271
268
  };
272
269
 
273
270
  /**
@@ -275,17 +272,16 @@ class Pops {
275
272
  * @param details 配置
276
273
  */
277
274
  iframe = (details: PopsIframeDetails) => {
278
- return new PopsIframe(details) as PopsEventDetails & {
279
- iframeElement: HTMLIFrameElement;
280
- };
275
+ let dialog = PopsIframe.init(details);
276
+ return dialog;
281
277
  };
282
278
 
283
279
  /**
284
280
  * 提示框
285
281
  * @param details 配置
286
282
  */
287
- tooltip = <T extends PopsToolTipDetails = PopsToolTipDetails>(details: T) => {
288
- let popsTooltip = new PopsTooltip(details) as PopsTooltipResult<T>;
283
+ tooltip = (details: PopsToolTipDetails) => {
284
+ let popsTooltip = PopsTooltip.init(details);
289
285
  return popsTooltip;
290
286
  };
291
287
 
@@ -294,7 +290,8 @@ class Pops {
294
290
  * @param details 配置
295
291
  */
296
292
  drawer = (details: PopsDrawerDetails) => {
297
- return new PopsDrawer(details) as PopsEventDetails;
293
+ let dialog = PopsDrawer.init(details);
294
+ return dialog;
298
295
  };
299
296
 
300
297
  /**
@@ -302,7 +299,8 @@ class Pops {
302
299
  * @param details 配置
303
300
  */
304
301
  folder = (details: PopsFolderDetails) => {
305
- return new PopsFolder(details) as PopsEventDetails;
302
+ let dialog = PopsFolder.init(details);
303
+ return dialog;
306
304
  };
307
305
 
308
306
  /**
@@ -310,7 +308,8 @@ class Pops {
310
308
  * @param details 配置
311
309
  */
312
310
  panel = (details: PopsPanelDetails) => {
313
- return new PopsPanel(details) as PopsEventDetails;
311
+ let dialog = PopsPanel.init(details);
312
+ return dialog;
314
313
  };
315
314
 
316
315
  /**
@@ -318,7 +317,8 @@ class Pops {
318
317
  * @param details 配置
319
318
  */
320
319
  rightClickMenu = (details: PopsRightClickMenuDetails) => {
321
- return new PopsRightClickMenu(details) as PopsEventDetails;
320
+ let popsRightClickMenu = PopsRightClickMenu.init(details);
321
+ return popsRightClickMenu;
322
322
  };
323
323
 
324
324
  /**
@@ -326,7 +326,8 @@ class Pops {
326
326
  * @param details 配置
327
327
  */
328
328
  searchSuggestion = <T = any>(details: PopsSearchSuggestionDetails<T>) => {
329
- return new PopsSearchSuggestion(details) as PopsSearchSuggestionResult<T>;
329
+ let popsSearchSuggestion = PopsSearchSuggestion.init(details);
330
+ return popsSearchSuggestion;
330
331
  };
331
332
  }
332
333
 
@@ -9,8 +9,8 @@ import { PopsAlertConfig } from "./config";
9
9
  import type { PopsMode } from "../../types/main";
10
10
  import type { PopsAlertDetails } from "./indexType";
11
11
 
12
- export class PopsAlert {
13
- constructor(details: PopsAlertDetails) {
12
+ export const PopsAlert = {
13
+ init(details: PopsAlertDetails) {
14
14
  const guid = popsUtils.getRandomGUID();
15
15
  // 设置当前类型
16
16
  const PopsType: PopsMode = "alert";
@@ -154,6 +154,7 @@ export class PopsAlert {
154
154
  });
155
155
  }
156
156
 
157
- return PopsHandler.handleResultDetails(eventDetails);
158
- }
159
- }
157
+ let result = PopsHandler.handleResultDetails(eventDetails);
158
+ return result;
159
+ },
160
+ };
@@ -8,8 +8,8 @@ import { popsUtils } from "../../utils/PopsUtils";
8
8
  import { PopsConfirmConfig } from "./config";
9
9
  import type { PopsConfirmDetails } from "./indexType";
10
10
 
11
- export class PopsConfirm {
12
- constructor(details: PopsConfirmDetails) {
11
+ export const PopsConfirm = {
12
+ init(details: PopsConfirmDetails) {
13
13
  const guid = popsUtils.getRandomGUID();
14
14
  // 设置当前类型
15
15
  const PopsType = "confirm";
@@ -164,6 +164,7 @@ export class PopsConfirm {
164
164
  endCallBack: config.dragEndCallBack,
165
165
  });
166
166
  }
167
- return PopsHandler.handleResultDetails(eventDetails);
168
- }
169
- }
167
+ let result = PopsHandler.handleResultDetails(eventDetails);
168
+ return result;
169
+ },
170
+ };
@@ -7,8 +7,8 @@ import { popsUtils } from "../../utils/PopsUtils";
7
7
  import { PopsDrawerConfig } from "./config";
8
8
  import type { PopsDrawerDetails } from "./indexType";
9
9
 
10
- export class PopsDrawer {
11
- constructor(details: PopsDrawerDetails) {
10
+ export const PopsDrawer = {
11
+ init(details: PopsDrawerDetails) {
12
12
  const guid = popsUtils.getRandomGUID();
13
13
  // 设置当前类型
14
14
  const PopsType = "drawer";
@@ -233,6 +233,7 @@ export class PopsDrawer {
233
233
  $shadowContainer: $shadowContainer,
234
234
  $shadowRoot: $shadowRoot,
235
235
  });
236
- return PopsHandler.handleResultDetails(eventDetails);
237
- }
238
- }
236
+ let result = PopsHandler.handleResultDetails(eventDetails);
237
+ return result;
238
+ },
239
+ };
@@ -18,36 +18,44 @@ export interface PopsDrawerDetails
18
18
  */
19
19
  title?: Partial<PopsTitleConfig["title"]> & {
20
20
  /**
21
- * 是否启用,默认true
21
+ * 是否启用
22
+ * @default true
22
23
  */
23
24
  enable: boolean;
24
25
  };
25
26
  /**
26
- * 打开的方向,默认为right
27
+ * 打开的方向
28
+ * @default "right"
27
29
  */
28
30
  direction?: "top" | "bottom" | "left" | "right";
29
31
  /**
30
32
  * 窗体的大小; 当使用 number 类型时; 以像素为单位,默认为30%
33
+ * @default "30%"
31
34
  */
32
35
  size?: string | number;
33
36
  /**
34
37
  * 是否在 Drawer 出现时将 body 滚动锁定,默认为false
38
+ * @default false
35
39
  */
36
40
  lockScroll?: boolean;
37
41
  /**
38
42
  * 是否可以通过按下 ESC 关闭 Drawer,默认为true
43
+ * @default true'
39
44
  */
40
45
  closeOnPressEscape?: boolean;
41
46
  /**
42
47
  * 打开的延时时间,单位毫秒,默认为0
48
+ * @default 0
43
49
  */
44
50
  openDelay?: number;
45
51
  /**
46
52
  * 关闭的延时时间,单位毫秒,默认为0
53
+ * @default 0
47
54
  */
48
55
  closeDelay?: number;
49
56
  /**
50
57
  * border-radius,根据direction自动适应,默认为5
58
+ * @default 5
51
59
  */
52
60
  borderRadius?: number;
53
61
  }
@@ -10,8 +10,8 @@ import { PopsFolderConfig } from "./config";
10
10
  import { Folder_ICON } from "./folderIcon";
11
11
  import type { PopsFolderDataConfig, PopsFolderDetails } from "./indexType";
12
12
 
13
- export class PopsFolder {
14
- constructor(details: PopsFolderDetails) {
13
+ export const PopsFolder = {
14
+ init(details: PopsFolderDetails) {
15
15
  const guid = popsUtils.getRandomGUID();
16
16
  // 设置当前类型
17
17
  const PopsType = "folder";
@@ -1034,6 +1034,7 @@ export class PopsFolder {
1034
1034
  $shadowContainer: $shadowContainer,
1035
1035
  $shadowRoot: $shadowRoot,
1036
1036
  });
1037
- return PopsHandler.handleResultDetails(eventDetails);
1038
- }
1039
- }
1037
+ let result = PopsHandler.handleResultDetails(eventDetails);
1038
+ return result;
1039
+ },
1040
+ };
@@ -79,10 +79,13 @@ export interface PopsFolderDetails
79
79
  name: "fileName" | "fileSize" | "latestTime";
80
80
  /**
81
81
  * 是否降序,默认false(升序)
82
+ * @default false
82
83
  */
83
84
  isDesc: boolean;
84
85
  /**
85
- * 触发排序的回调,如果返回true,则中止内部的排序
86
+ * 触发排序的回调
87
+ * @returns
88
+ * + true 中止内部的排序
86
89
  */
87
90
  callback?: (
88
91
  targert: HTMLElement,
@@ -10,8 +10,8 @@ import { popsUtils } from "../../utils/PopsUtils";
10
10
  import { PopsIframeConfig } from "./config";
11
11
  import type { PopsIframeDetails } from "./indexType";
12
12
 
13
- export class PopsIframe {
14
- constructor(details: PopsIframeDetails) {
13
+ export const PopsIframe = {
14
+ init(details: PopsIframeDetails) {
15
15
  const guid = popsUtils.getRandomGUID();
16
16
  // 设置当前类型
17
17
  const PopsType = "iframe";
@@ -331,5 +331,5 @@ export class PopsIframe {
331
331
 
332
332
  let result = PopsHandler.handleResultDetails(eventDetails);
333
333
  return result;
334
- }
335
- }
334
+ },
335
+ };