@whitesev/pops 2.0.4 → 2.0.6

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.
@@ -20,4 +20,11 @@ export interface PopsLoadingDetails extends Omit<PopsCommonConfig, "width" | "he
20
20
  * (可选)添加主CSS,默认为true,当页面中存在anim覆盖时,可能会有一些样式问题,取消添加该CSS即可解决
21
21
  */
22
22
  addIndexCSS?: boolean;
23
+ /**
24
+ * 为pops-anim和pops-mask设置position: absolute(需要自行设置parent的position为relative)
25
+ *
26
+ * 它们默认的position为fixed
27
+ * @default false
28
+ */
29
+ isAbsolute?: boolean;
23
30
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whitesev/pops",
3
- "version": "2.0.4",
3
+ "version": "2.0.6",
4
4
  "description": "弹窗库",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -22,7 +22,7 @@ export const PopsLoadingConfig = (): DeepRequired<PopsLoadingDetails> => {
22
22
  },
23
23
  animation: "pops-anim-fadein-zoom",
24
24
  forbiddenScroll: false,
25
-
25
+ isAbsolute: false,
26
26
  style: null,
27
27
  addIndexCSS: true,
28
28
  };
@@ -79,9 +79,6 @@ export class PopsLoading {
79
79
  maskHTML: maskHTML,
80
80
  });
81
81
  $mask = _handleMask_.maskElement;
82
- // 遮罩层必须是跟随主内容
83
- // 即设置主内容position: relative,mask:position: absolute
84
- popsDOMUtils.css($mask, "position", "absolute !important");
85
82
  elementList.push($mask);
86
83
  }
87
84
  let eventDetails = PopsHandler.handleLoadingEventDetails(
@@ -103,6 +100,12 @@ export class PopsLoading {
103
100
  maskElement: $mask!,
104
101
  } as any);
105
102
 
103
+ if (config.isAbsolute) {
104
+ // 遮罩层必须是跟随主内容
105
+ // 即设置主内容position: relative,mask:position: absolute
106
+ popsDOMUtils.css($anim, "position", "absolute !important");
107
+ $mask && popsDOMUtils.css($mask, "position", "absolute !important");
108
+ }
106
109
  return PopsHandler.handleResultDetails(eventDetails);
107
110
  }
108
111
  }
@@ -28,4 +28,11 @@ export interface PopsLoadingDetails
28
28
  * (可选)添加主CSS,默认为true,当页面中存在anim覆盖时,可能会有一些样式问题,取消添加该CSS即可解决
29
29
  */
30
30
  addIndexCSS?: boolean;
31
+ /**
32
+ * 为pops-anim和pops-mask设置position: absolute(需要自行设置parent的position为relative)
33
+ *
34
+ * 它们默认的position为fixed
35
+ * @default false
36
+ */
37
+ isAbsolute?: boolean;
31
38
  }