@whitesev/pops 1.5.5 → 1.5.8
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.
- package/dist/index.amd.js +50 -11
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +50 -11
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +50 -11
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +50 -11
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +50 -11
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +50 -11
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/components/folder/indexType.d.ts +5 -5
- package/dist/types/src/components/prompt/indexType.d.ts +7 -0
- package/dist/types/src/types/components.d.ts +18 -1
- package/dist/types/src/types/layer.d.ts +2 -0
- package/dist/types/src/types/main.d.ts +1 -1
- package/dist/types/src/types/mask.d.ts +4 -1
- package/package.json +1 -1
- package/src/Pops.ts +2 -1
- package/src/components/folder/index.ts +2 -1
- package/src/components/folder/indexType.ts +21 -10
- package/src/components/prompt/index.ts +6 -2
- package/src/components/prompt/indexType.ts +7 -0
- package/src/components/rightClickMenu/index.ts +20 -4
- package/src/handler/PopsHandler.ts +5 -6
- package/src/types/components.d.ts +18 -1
- package/src/types/layer.d.ts +2 -0
- package/src/types/main.d.ts +1 -1
- package/src/types/mask.d.ts +4 -1
- package/src/utils/PopsInstanceUtils.ts +15 -5
|
@@ -10,9 +10,9 @@ export interface PopsFolderDataConfig {
|
|
|
10
10
|
/**
|
|
11
11
|
* 文件大小,如果是文件夹的话,为0
|
|
12
12
|
*/
|
|
13
|
-
fileSize: number;
|
|
13
|
+
fileSize: number | string;
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* 文件类型,如果是文件夹,填入空字符串
|
|
16
16
|
*/
|
|
17
17
|
fileType: string;
|
|
18
18
|
/**
|
|
@@ -34,11 +34,11 @@ export interface PopsFolderDataConfig {
|
|
|
34
34
|
/**
|
|
35
35
|
* 点击事件
|
|
36
36
|
*/
|
|
37
|
-
clickEvent
|
|
37
|
+
clickEvent?: (event: MouseEvent | PointerEvent, config: PopsFolderDataConfig) => Promise<{
|
|
38
38
|
autoDownload: boolean;
|
|
39
39
|
url: string;
|
|
40
40
|
mode: "a" | "aBlank" | "iframe" | "open" | "openBlank";
|
|
41
|
-
}> | null;
|
|
41
|
+
} | null | undefined | void | PopsFolderDataConfig[]> | null | undefined | void | PopsFolderDataConfig[];
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
44
|
* pops.folder
|
|
@@ -59,7 +59,7 @@ export interface PopsFolderDetails extends PopsTitleConfig, PopsDragConfig, Pops
|
|
|
59
59
|
/**
|
|
60
60
|
* 触发排序的回调,如果返回true,则中止内部的排序
|
|
61
61
|
*/
|
|
62
|
-
callback
|
|
62
|
+
callback?: (targert: HTMLElement, event: PointerEvent | MouseEvent, sortName: "fileName" | "fileSize" | "latestTime", sortDesc: boolean) => boolean | undefined | void;
|
|
63
63
|
};
|
|
64
64
|
/**
|
|
65
65
|
* 文件夹信息
|
|
@@ -19,12 +19,19 @@ export interface PopsPromptDetails extends PopsTitleConfig, PopsDragConfig, Pops
|
|
|
19
19
|
password?: boolean;
|
|
20
20
|
/**
|
|
21
21
|
* 是否支持多行输入
|
|
22
|
+
* @default false
|
|
22
23
|
*/
|
|
23
24
|
row?: boolean;
|
|
24
25
|
/**
|
|
25
26
|
* 是否自动获取焦点
|
|
27
|
+
* @default true
|
|
26
28
|
*/
|
|
27
29
|
focus?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* 是否自动选择输入框的所有文字
|
|
32
|
+
* @default false
|
|
33
|
+
*/
|
|
34
|
+
select?: boolean;
|
|
28
35
|
/**
|
|
29
36
|
* 输入框内的提示文字
|
|
30
37
|
*/
|
|
@@ -22,10 +22,12 @@ export interface PopsTitleConfig {
|
|
|
22
22
|
text?: string;
|
|
23
23
|
/**
|
|
24
24
|
* 文字的位置
|
|
25
|
+
* @default "left"
|
|
25
26
|
*/
|
|
26
27
|
position?: PopsTextAlign;
|
|
27
28
|
/**
|
|
28
29
|
* 文字是否是html
|
|
30
|
+
* @default false
|
|
29
31
|
*/
|
|
30
32
|
html?: boolean;
|
|
31
33
|
/**
|
|
@@ -46,6 +48,7 @@ export interface PopsContentConfig {
|
|
|
46
48
|
text?: string;
|
|
47
49
|
/**
|
|
48
50
|
* 文字是否是html
|
|
51
|
+
* @default false
|
|
49
52
|
*/
|
|
50
53
|
html?: boolean;
|
|
51
54
|
/**
|
|
@@ -60,7 +63,8 @@ export interface PopsContentConfig {
|
|
|
60
63
|
export interface PopsButtonConfig {
|
|
61
64
|
btn?: {
|
|
62
65
|
/**
|
|
63
|
-
*
|
|
66
|
+
* 按钮的位置
|
|
67
|
+
* @default "flex-end"
|
|
64
68
|
*/
|
|
65
69
|
position?: PopsJustifyContent;
|
|
66
70
|
/**
|
|
@@ -76,14 +80,17 @@ export interface PopsMoreButtonConfig<T = {}> {
|
|
|
76
80
|
btn?: PopsButtonConfig["btn"] & {
|
|
77
81
|
/**
|
|
78
82
|
* 是否合并按钮
|
|
83
|
+
* @default false
|
|
79
84
|
*/
|
|
80
85
|
merge?: boolean;
|
|
81
86
|
/**
|
|
82
87
|
* 是否对合并的按钮逆反
|
|
88
|
+
* @default false
|
|
83
89
|
*/
|
|
84
90
|
mergeReverse?: boolean;
|
|
85
91
|
/**
|
|
86
92
|
* 是否逆反
|
|
93
|
+
* @default false
|
|
87
94
|
*/
|
|
88
95
|
reverse?: boolean;
|
|
89
96
|
/**
|
|
@@ -106,14 +113,17 @@ export interface PopsMoreButtonConfig<T = {}> {
|
|
|
106
113
|
export interface PopsDragConfig {
|
|
107
114
|
/**
|
|
108
115
|
* 是否可以按钮标题栏进行拖拽,默认false
|
|
116
|
+
* @default false
|
|
109
117
|
*/
|
|
110
118
|
drag?: boolean;
|
|
111
119
|
/**
|
|
112
120
|
* 是否限制拖拽在浏览器窗口内移动,默认true
|
|
121
|
+
* @default true
|
|
113
122
|
*/
|
|
114
123
|
dragLimit?: boolean;
|
|
115
124
|
/**
|
|
116
125
|
* 当启用dragLimit时,该参数为弹窗在窗口中的距离边际的距离,默认为3(px)
|
|
126
|
+
* @default 3
|
|
117
127
|
*/
|
|
118
128
|
dragExtraDistance?: number;
|
|
119
129
|
/**
|
|
@@ -149,26 +159,32 @@ export interface PopsCommonConfig {
|
|
|
149
159
|
class?: string;
|
|
150
160
|
/**
|
|
151
161
|
* 是否是唯一的,默认false
|
|
162
|
+
* @default false
|
|
152
163
|
*/
|
|
153
164
|
only?: boolean;
|
|
154
165
|
/**
|
|
155
166
|
* 宽度,默认350px
|
|
167
|
+
* @default 350
|
|
156
168
|
*/
|
|
157
169
|
width: string;
|
|
158
170
|
/**
|
|
159
171
|
* 高度,默认200px
|
|
172
|
+
* @default 200
|
|
160
173
|
*/
|
|
161
174
|
height: string;
|
|
162
175
|
/**
|
|
163
176
|
* 位置,默认center
|
|
177
|
+
* @default "center"
|
|
164
178
|
*/
|
|
165
179
|
position?: PopsPosition;
|
|
166
180
|
/**
|
|
167
181
|
* 动画,默认pops-anim-fadein-zoom
|
|
182
|
+
* @default "pops-anim-fadein-zoom"
|
|
168
183
|
*/
|
|
169
184
|
animation?: PopsAnimation;
|
|
170
185
|
/**
|
|
171
186
|
* z-index显示层级,默认10000
|
|
187
|
+
* @default 10000
|
|
172
188
|
*/
|
|
173
189
|
zIndex?: number | (() => number);
|
|
174
190
|
/**
|
|
@@ -179,6 +195,7 @@ export interface PopsCommonConfig {
|
|
|
179
195
|
* 是否禁用页面滚动,默认false
|
|
180
196
|
*
|
|
181
197
|
* 暂时不会生效
|
|
198
|
+
* @default false
|
|
182
199
|
*/
|
|
183
200
|
forbiddenScroll?: boolean;
|
|
184
201
|
/**
|
|
@@ -48,7 +48,7 @@ export type PopsType = keyof PopsTypeDetails;
|
|
|
48
48
|
export type PopsMode = PopsType | "tooltip" | "rightClickMenu";
|
|
49
49
|
|
|
50
50
|
/** 存储实例的类型 9个 */
|
|
51
|
-
export type PopsLayerMode = PopsType | "tooltip";
|
|
51
|
+
export type PopsLayerMode = PopsType | "tooltip" | "rightClickMenu";
|
|
52
52
|
|
|
53
53
|
/** pops弹窗支持动画元素的配置 */
|
|
54
54
|
export interface PopsSupportAnim {
|
|
@@ -4,15 +4,18 @@
|
|
|
4
4
|
export interface PopsMaskDetails {
|
|
5
5
|
/**
|
|
6
6
|
* 是否启用遮罩层,默认false
|
|
7
|
+
* @default false
|
|
7
8
|
*/
|
|
8
9
|
enable?: boolean;
|
|
9
10
|
clickEvent?: {
|
|
10
11
|
/**
|
|
11
12
|
* 点击遮罩层是否触发关闭事件
|
|
13
|
+
* @default false
|
|
12
14
|
*/
|
|
13
15
|
toClose?: boolean;
|
|
14
16
|
/**
|
|
15
17
|
* 点击遮罩层是否触发隐藏事件
|
|
18
|
+
* @default false
|
|
16
19
|
*/
|
|
17
20
|
toHide?: boolean;
|
|
18
21
|
};
|
|
@@ -22,7 +25,7 @@ export interface PopsMaskDetails {
|
|
|
22
25
|
* @param config 配置信息
|
|
23
26
|
*/
|
|
24
27
|
clickCallBack?: (
|
|
25
|
-
originalRun: (
|
|
28
|
+
originalRun: () => void,
|
|
26
29
|
config:
|
|
27
30
|
| PopsAlertDetails
|
|
28
31
|
| PopsDrawerDetails
|
package/package.json
CHANGED
package/src/Pops.ts
CHANGED
|
@@ -80,7 +80,7 @@ class Pops {
|
|
|
80
80
|
/** 配置 */
|
|
81
81
|
config = {
|
|
82
82
|
/** 版本号 */
|
|
83
|
-
version: "2024.9.
|
|
83
|
+
version: "2024.9.16",
|
|
84
84
|
cssText: {
|
|
85
85
|
/** 主CSS */
|
|
86
86
|
index: indexCSS,
|
|
@@ -163,6 +163,7 @@ class Pops {
|
|
|
163
163
|
drawer: [],
|
|
164
164
|
folder: [],
|
|
165
165
|
panel: [],
|
|
166
|
+
rightClickMenu: [],
|
|
166
167
|
} as any as {
|
|
167
168
|
[key in PopsLayerMode]: PopsLayerCommonConfig[];
|
|
168
169
|
},
|
|
@@ -778,7 +778,9 @@ export class PopsFolder {
|
|
|
778
778
|
if (typeof _config_.clickEvent === "function") {
|
|
779
779
|
let downloadInfo = await _config_.clickEvent(event, _config_)!;
|
|
780
780
|
if (
|
|
781
|
+
downloadInfo != null &&
|
|
781
782
|
typeof downloadInfo === "object" &&
|
|
783
|
+
!Array.isArray(downloadInfo) &&
|
|
782
784
|
typeof downloadInfo.url === "string" &&
|
|
783
785
|
downloadInfo.url.trim() !== ""
|
|
784
786
|
) {
|
|
@@ -851,7 +853,6 @@ export class PopsFolder {
|
|
|
851
853
|
sortName: "fileName" | "fileSize" | "latestTime" = "fileName",
|
|
852
854
|
isDesc = false
|
|
853
855
|
) {
|
|
854
|
-
console.log(folderDataConfigList, sortName, isDesc);
|
|
855
856
|
if (sortName === "fileName") {
|
|
856
857
|
// 如果是以文件名排序,文件夹优先放前面
|
|
857
858
|
let onlyFolderDataConfigList = folderDataConfigList.filter((value) => {
|
|
@@ -16,9 +16,9 @@ export interface PopsFolderDataConfig {
|
|
|
16
16
|
/**
|
|
17
17
|
* 文件大小,如果是文件夹的话,为0
|
|
18
18
|
*/
|
|
19
|
-
fileSize: number;
|
|
19
|
+
fileSize: number | string;
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* 文件类型,如果是文件夹,填入空字符串
|
|
22
22
|
*/
|
|
23
23
|
fileType: string;
|
|
24
24
|
/**
|
|
@@ -40,14 +40,25 @@ export interface PopsFolderDataConfig {
|
|
|
40
40
|
/**
|
|
41
41
|
* 点击事件
|
|
42
42
|
*/
|
|
43
|
-
clickEvent
|
|
43
|
+
clickEvent?: (
|
|
44
44
|
event: MouseEvent | PointerEvent,
|
|
45
45
|
config: PopsFolderDataConfig
|
|
46
|
-
) =>
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
) =>
|
|
47
|
+
| Promise<
|
|
48
|
+
| {
|
|
49
|
+
autoDownload: boolean;
|
|
50
|
+
url: string;
|
|
51
|
+
mode: "a" | "aBlank" | "iframe" | "open" | "openBlank";
|
|
52
|
+
}
|
|
53
|
+
| null
|
|
54
|
+
| undefined
|
|
55
|
+
| void
|
|
56
|
+
| PopsFolderDataConfig[]
|
|
57
|
+
>
|
|
58
|
+
| null
|
|
59
|
+
| undefined
|
|
60
|
+
| void
|
|
61
|
+
| PopsFolderDataConfig[];
|
|
51
62
|
}
|
|
52
63
|
|
|
53
64
|
/**
|
|
@@ -73,12 +84,12 @@ export interface PopsFolderDetails
|
|
|
73
84
|
/**
|
|
74
85
|
* 触发排序的回调,如果返回true,则中止内部的排序
|
|
75
86
|
*/
|
|
76
|
-
callback
|
|
87
|
+
callback?: (
|
|
77
88
|
targert: HTMLElement,
|
|
78
89
|
event: PointerEvent | MouseEvent,
|
|
79
90
|
sortName: "fileName" | "fileSize" | "latestTime",
|
|
80
91
|
sortDesc: boolean
|
|
81
|
-
) => boolean;
|
|
92
|
+
) => boolean | undefined | void;
|
|
82
93
|
};
|
|
83
94
|
/**
|
|
84
95
|
* 文件夹信息
|
|
@@ -27,6 +27,7 @@ export class PopsPrompt {
|
|
|
27
27
|
},
|
|
28
28
|
content: {
|
|
29
29
|
text: "",
|
|
30
|
+
select: false,
|
|
30
31
|
password: false,
|
|
31
32
|
row: false,
|
|
32
33
|
focus: true,
|
|
@@ -288,9 +289,12 @@ export class PopsPrompt {
|
|
|
288
289
|
}
|
|
289
290
|
/* 设置自动获取焦点 */
|
|
290
291
|
if (config.content.focus) {
|
|
291
|
-
$input
|
|
292
|
+
$input.focus();
|
|
293
|
+
}
|
|
294
|
+
/* 设置自动选中所有文字 */
|
|
295
|
+
if (config.content.select) {
|
|
296
|
+
$input.select();
|
|
292
297
|
}
|
|
293
|
-
|
|
294
298
|
return PopsHandler.handleResultDetails(eventDetails);
|
|
295
299
|
}
|
|
296
300
|
}
|
|
@@ -29,12 +29,19 @@ export interface PopsPromptDetails
|
|
|
29
29
|
password?: boolean;
|
|
30
30
|
/**
|
|
31
31
|
* 是否支持多行输入
|
|
32
|
+
* @default false
|
|
32
33
|
*/
|
|
33
34
|
row?: boolean;
|
|
34
35
|
/**
|
|
35
36
|
* 是否自动获取焦点
|
|
37
|
+
* @default true
|
|
36
38
|
*/
|
|
37
39
|
focus?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* 是否自动选择输入框的所有文字
|
|
42
|
+
* @default false
|
|
43
|
+
*/
|
|
44
|
+
select?: boolean;
|
|
38
45
|
/**
|
|
39
46
|
* 输入框内的提示文字
|
|
40
47
|
*/
|
|
@@ -255,13 +255,24 @@ export class PopsRightClickMenu {
|
|
|
255
255
|
if (config.preventDefault) {
|
|
256
256
|
popsDOMUtils.preventEvent(event);
|
|
257
257
|
}
|
|
258
|
+
PopsHandler.handleOnly(PopsType, config);
|
|
258
259
|
if (PopsContextMenu.rootElement) {
|
|
259
260
|
PopsContextMenu.closeAllMenu(PopsContextMenu.rootElement);
|
|
260
261
|
}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
262
|
+
let rootElement = PopsContextMenu.showMenu(event, config.data);
|
|
263
|
+
PopsContextMenu.rootElement = rootElement;
|
|
264
|
+
if (config.only) {
|
|
265
|
+
PopsHandler.handlePush(PopsType, {
|
|
266
|
+
$shadowRoot: $shadowRoot,
|
|
267
|
+
$shadowContainer: $shadowContainer,
|
|
268
|
+
guid: guid,
|
|
269
|
+
animElement: rootElement as HTMLDivElement,
|
|
270
|
+
popsElement: rootElement as HTMLDivElement,
|
|
271
|
+
beforeRemoveCallBack(layerCommonConfig) {
|
|
272
|
+
PopsContextMenu.closeAllMenu(layerCommonConfig.popsElement);
|
|
273
|
+
},
|
|
274
|
+
});
|
|
275
|
+
}
|
|
265
276
|
},
|
|
266
277
|
/**
|
|
267
278
|
* 添加contextmenu事件
|
|
@@ -337,6 +348,9 @@ export class PopsRightClickMenu {
|
|
|
337
348
|
* @param rootElement
|
|
338
349
|
*/
|
|
339
350
|
closeAllMenu(rootElement: HTMLElement) {
|
|
351
|
+
if (rootElement == null) {
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
340
354
|
if ((rootElement as any)?.["__menuData__"]?.root) {
|
|
341
355
|
rootElement = (rootElement as any)?.["__menuData__"]?.root;
|
|
342
356
|
}
|
|
@@ -725,7 +739,9 @@ export class PopsRightClickMenu {
|
|
|
725
739
|
},
|
|
726
740
|
};
|
|
727
741
|
|
|
742
|
+
// 添加右键菜单事件
|
|
728
743
|
PopsContextMenu.addContextMenuEvent(config.target, config.targetSelector!);
|
|
744
|
+
// 添加全局点击检测
|
|
729
745
|
PopsContextMenu.addWindowCheckClickListener();
|
|
730
746
|
|
|
731
747
|
return {
|
|
@@ -631,11 +631,10 @@ export const PopsHandler = {
|
|
|
631
631
|
type === "tooltip" ||
|
|
632
632
|
type === "rightClickMenu"
|
|
633
633
|
) {
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
"",
|
|
637
|
-
|
|
638
|
-
);
|
|
634
|
+
let layer = pops.config.layer[type as keyof typeof pops.config.layer];
|
|
635
|
+
if (layer) {
|
|
636
|
+
PopsInstanceUtils.removeInstance([layer], "", true);
|
|
637
|
+
}
|
|
639
638
|
} else {
|
|
640
639
|
PopsInstanceUtils.removeInstance(
|
|
641
640
|
[
|
|
@@ -662,7 +661,7 @@ export const PopsHandler = {
|
|
|
662
661
|
);
|
|
663
662
|
return maxZIndex;
|
|
664
663
|
};
|
|
665
|
-
}else{
|
|
664
|
+
} else {
|
|
666
665
|
const { zIndex: maxZIndex } = PopsInstanceUtils.getPopsMaxZIndex(
|
|
667
666
|
PopsHandler.handleZIndex(config.zIndex) + 100
|
|
668
667
|
);
|
|
@@ -22,10 +22,12 @@ export interface PopsTitleConfig {
|
|
|
22
22
|
text?: string;
|
|
23
23
|
/**
|
|
24
24
|
* 文字的位置
|
|
25
|
+
* @default "left"
|
|
25
26
|
*/
|
|
26
27
|
position?: PopsTextAlign;
|
|
27
28
|
/**
|
|
28
29
|
* 文字是否是html
|
|
30
|
+
* @default false
|
|
29
31
|
*/
|
|
30
32
|
html?: boolean;
|
|
31
33
|
/**
|
|
@@ -46,6 +48,7 @@ export interface PopsContentConfig {
|
|
|
46
48
|
text?: string;
|
|
47
49
|
/**
|
|
48
50
|
* 文字是否是html
|
|
51
|
+
* @default false
|
|
49
52
|
*/
|
|
50
53
|
html?: boolean;
|
|
51
54
|
/**
|
|
@@ -60,7 +63,8 @@ export interface PopsContentConfig {
|
|
|
60
63
|
export interface PopsButtonConfig {
|
|
61
64
|
btn?: {
|
|
62
65
|
/**
|
|
63
|
-
*
|
|
66
|
+
* 按钮的位置
|
|
67
|
+
* @default "flex-end"
|
|
64
68
|
*/
|
|
65
69
|
position?: PopsJustifyContent;
|
|
66
70
|
/**
|
|
@@ -76,14 +80,17 @@ export interface PopsMoreButtonConfig<T = {}> {
|
|
|
76
80
|
btn?: PopsButtonConfig["btn"] & {
|
|
77
81
|
/**
|
|
78
82
|
* 是否合并按钮
|
|
83
|
+
* @default false
|
|
79
84
|
*/
|
|
80
85
|
merge?: boolean;
|
|
81
86
|
/**
|
|
82
87
|
* 是否对合并的按钮逆反
|
|
88
|
+
* @default false
|
|
83
89
|
*/
|
|
84
90
|
mergeReverse?: boolean;
|
|
85
91
|
/**
|
|
86
92
|
* 是否逆反
|
|
93
|
+
* @default false
|
|
87
94
|
*/
|
|
88
95
|
reverse?: boolean;
|
|
89
96
|
/**
|
|
@@ -106,14 +113,17 @@ export interface PopsMoreButtonConfig<T = {}> {
|
|
|
106
113
|
export interface PopsDragConfig {
|
|
107
114
|
/**
|
|
108
115
|
* 是否可以按钮标题栏进行拖拽,默认false
|
|
116
|
+
* @default false
|
|
109
117
|
*/
|
|
110
118
|
drag?: boolean;
|
|
111
119
|
/**
|
|
112
120
|
* 是否限制拖拽在浏览器窗口内移动,默认true
|
|
121
|
+
* @default true
|
|
113
122
|
*/
|
|
114
123
|
dragLimit?: boolean;
|
|
115
124
|
/**
|
|
116
125
|
* 当启用dragLimit时,该参数为弹窗在窗口中的距离边际的距离,默认为3(px)
|
|
126
|
+
* @default 3
|
|
117
127
|
*/
|
|
118
128
|
dragExtraDistance?: number;
|
|
119
129
|
/**
|
|
@@ -149,26 +159,32 @@ export interface PopsCommonConfig {
|
|
|
149
159
|
class?: string;
|
|
150
160
|
/**
|
|
151
161
|
* 是否是唯一的,默认false
|
|
162
|
+
* @default false
|
|
152
163
|
*/
|
|
153
164
|
only?: boolean;
|
|
154
165
|
/**
|
|
155
166
|
* 宽度,默认350px
|
|
167
|
+
* @default 350
|
|
156
168
|
*/
|
|
157
169
|
width: string;
|
|
158
170
|
/**
|
|
159
171
|
* 高度,默认200px
|
|
172
|
+
* @default 200
|
|
160
173
|
*/
|
|
161
174
|
height: string;
|
|
162
175
|
/**
|
|
163
176
|
* 位置,默认center
|
|
177
|
+
* @default "center"
|
|
164
178
|
*/
|
|
165
179
|
position?: PopsPosition;
|
|
166
180
|
/**
|
|
167
181
|
* 动画,默认pops-anim-fadein-zoom
|
|
182
|
+
* @default "pops-anim-fadein-zoom"
|
|
168
183
|
*/
|
|
169
184
|
animation?: PopsAnimation;
|
|
170
185
|
/**
|
|
171
186
|
* z-index显示层级,默认10000
|
|
187
|
+
* @default 10000
|
|
172
188
|
*/
|
|
173
189
|
zIndex?: number | (() => number);
|
|
174
190
|
/**
|
|
@@ -179,6 +195,7 @@ export interface PopsCommonConfig {
|
|
|
179
195
|
* 是否禁用页面滚动,默认false
|
|
180
196
|
*
|
|
181
197
|
* 暂时不会生效
|
|
198
|
+
* @default false
|
|
182
199
|
*/
|
|
183
200
|
forbiddenScroll?: boolean;
|
|
184
201
|
/**
|
package/src/types/layer.d.ts
CHANGED
package/src/types/main.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ export type PopsType = keyof PopsTypeDetails;
|
|
|
48
48
|
export type PopsMode = PopsType | "tooltip" | "rightClickMenu";
|
|
49
49
|
|
|
50
50
|
/** 存储实例的类型 9个 */
|
|
51
|
-
export type PopsLayerMode = PopsType | "tooltip";
|
|
51
|
+
export type PopsLayerMode = PopsType | "tooltip" | "rightClickMenu";
|
|
52
52
|
|
|
53
53
|
/** pops弹窗支持动画元素的配置 */
|
|
54
54
|
export interface PopsSupportAnim {
|
package/src/types/mask.d.ts
CHANGED
|
@@ -4,15 +4,18 @@
|
|
|
4
4
|
export interface PopsMaskDetails {
|
|
5
5
|
/**
|
|
6
6
|
* 是否启用遮罩层,默认false
|
|
7
|
+
* @default false
|
|
7
8
|
*/
|
|
8
9
|
enable?: boolean;
|
|
9
10
|
clickEvent?: {
|
|
10
11
|
/**
|
|
11
12
|
* 点击遮罩层是否触发关闭事件
|
|
13
|
+
* @default false
|
|
12
14
|
*/
|
|
13
15
|
toClose?: boolean;
|
|
14
16
|
/**
|
|
15
17
|
* 点击遮罩层是否触发隐藏事件
|
|
18
|
+
* @default false
|
|
16
19
|
*/
|
|
17
20
|
toHide?: boolean;
|
|
18
21
|
};
|
|
@@ -22,7 +25,7 @@ export interface PopsMaskDetails {
|
|
|
22
25
|
* @param config 配置信息
|
|
23
26
|
*/
|
|
24
27
|
clickCallBack?: (
|
|
25
|
-
originalRun: (
|
|
28
|
+
originalRun: () => void,
|
|
26
29
|
config:
|
|
27
30
|
| PopsAlertDetails
|
|
28
31
|
| PopsDrawerDetails
|
|
@@ -84,17 +84,27 @@ export const PopsInstanceUtils = {
|
|
|
84
84
|
guid: string,
|
|
85
85
|
isAll = false
|
|
86
86
|
) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
87
|
+
/**
|
|
88
|
+
* 移除元素实例
|
|
89
|
+
* @param layerCommonConfig
|
|
90
|
+
*/
|
|
91
|
+
function removeItem(layerCommonConfig: PopsLayerCommonConfig) {
|
|
92
|
+
if (typeof layerCommonConfig.beforeRemoveCallBack === "function") {
|
|
93
|
+
// 调用移除签的回调
|
|
94
|
+
layerCommonConfig.beforeRemoveCallBack(layerCommonConfig);
|
|
95
|
+
}
|
|
96
|
+
layerCommonConfig?.animElement?.remove();
|
|
97
|
+
layerCommonConfig?.popsElement?.remove();
|
|
98
|
+
layerCommonConfig?.maskElement?.remove();
|
|
99
|
+
layerCommonConfig?.$shadowContainer?.remove();
|
|
92
100
|
}
|
|
93
101
|
// [ layer[], layer[],...]
|
|
94
102
|
moreLayerConfigList.forEach((layerConfigList) => {
|
|
95
103
|
// layer[]
|
|
96
104
|
layerConfigList.forEach((layerConfigItem, index) => {
|
|
105
|
+
// 移除全部或者guid相同
|
|
97
106
|
if (isAll || layerConfigItem["guid"] === guid) {
|
|
107
|
+
// 判断是否有动画
|
|
98
108
|
if (
|
|
99
109
|
pops.config.animation.hasOwnProperty(
|
|
100
110
|
layerConfigItem.animElement.getAttribute("anim") as string
|