@whitesev/pops 4.2.2 → 4.2.3

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.
@@ -178,7 +178,7 @@ declare class PopsUtils {
178
178
  x: number;
179
179
  y: number;
180
180
  }>>, deviation?: number): {
181
- /** 处理了偏移量后的z-index值 */
181
+ /** 处理了偏移量和阈值比较后的z-index值 */
182
182
  zIndex: number;
183
183
  /** 原始z-index值 */
184
184
  originZIndex: number;
@@ -200,7 +200,7 @@ declare class PopsUtils {
200
200
  * Utils.getMaxZIndexNodeInfoFromPoint(20);
201
201
  */
202
202
  getMaxZIndexNodeInfoFromPoint(deviation: IFunction<number>): {
203
- /** 处理了偏移量后的z-index值 */
203
+ /** 处理了偏移量和阈值比较后的z-index值 */
204
204
  zIndex: number;
205
205
  /** 原始z-index值 */
206
206
  originZIndex: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whitesev/pops",
3
- "version": "4.2.2",
3
+ "version": "4.2.3",
4
4
  "description": "弹窗库,包含了alert、confirm、prompt、drawer、folder、loading、iframe、panel、tooltip、searchSuggestion、rightClickMenu组件",
5
5
  "keywords": [
6
6
  "ScriptCat",
@@ -57,8 +57,8 @@
57
57
  "eslint-plugin-compat": "^6.0.2",
58
58
  "eslint-plugin-prettier": "^5.5.4",
59
59
  "globals": "^16.5.0",
60
- "oxfmt": "^0.36.0",
61
- "oxlint": "1.51.0",
60
+ "oxfmt": "^0.37.0",
61
+ "oxlint": "1.52.0",
62
62
  "rollup": "^4.54.0",
63
63
  "rollup-plugin-clear": "^2.0.7",
64
64
  "rollup-plugin-import-css": "^4.1.2",
@@ -8,8 +8,8 @@ export const PopsInstanceUtils = {
8
8
  * 获取pops所有弹窗中的最大的z-index
9
9
  * @param deviation
10
10
  */
11
- getPopsMaxZIndex(deviation: number = 1) {
12
- deviation = Number.isNaN(deviation) ? 1 : deviation;
11
+ getPopsMaxZIndex(deviation: number = 10) {
12
+ deviation = Number.isNaN(deviation) ? 10 : deviation;
13
13
  // 最大值 2147483647
14
14
  // const browserMaxZIndex = Math.pow(2, 31) - 1;
15
15
  // 比较值 2000000000
@@ -25,8 +25,7 @@ export const PopsInstanceUtils = {
25
25
  const inst = instData[index];
26
26
  // 不对position为static和display为none的元素进行获取它们的z-index
27
27
  const $elList = [inst.$anim, inst.$pops, inst.$mask].filter((it) => it instanceof HTMLElement);
28
- const nodeZIndexInfoList = popsUtils.getMaxZIndexNodeInfoFromPoint($elList);
29
- const maxNodeZIndexInfo = nodeZIndexInfoList[0];
28
+ const maxNodeZIndexInfo = popsUtils.getMaxZIndexNodeInfoFromPoint($elList)[0];
30
29
  if (maxNodeZIndexInfo) {
31
30
  const nodeZIndex = maxNodeZIndexInfo.zIndex;
32
31
  if (nodeZIndex > zIndex) {
@@ -436,7 +436,7 @@ class PopsUtils {
436
436
  $el?: IFunction<IArray<HTMLElement> | IArray<{ x: number; y: number }>>,
437
437
  deviation?: number
438
438
  ): {
439
- /** 处理了偏移量后的z-index值 */
439
+ /** 处理了偏移量和阈值比较后的z-index值 */
440
440
  zIndex: number;
441
441
  /** 原始z-index值 */
442
442
  originZIndex: number;
@@ -458,7 +458,7 @@ class PopsUtils {
458
458
  * Utils.getMaxZIndexNodeInfoFromPoint(20);
459
459
  */
460
460
  getMaxZIndexNodeInfoFromPoint(deviation: IFunction<number>): {
461
- /** 处理了偏移量后的z-index值 */
461
+ /** 处理了偏移量和阈值比较后的z-index值 */
462
462
  zIndex: number;
463
463
  /** 原始z-index值 */
464
464
  originZIndex: number;
@@ -475,7 +475,7 @@ class PopsUtils {
475
475
  $el?: IFunction<IArray<HTMLElement> | number | IArray<{ x: number; y: number }>>,
476
476
  deviation?: number
477
477
  ): {
478
- /** 处理了偏移量后的z-index值 */
478
+ /** 处理了偏移量和阈值比较后的z-index值 */
479
479
  zIndex: number;
480
480
  /** 原始z-index值 */
481
481
  originZIndex: number;
@@ -498,6 +498,10 @@ class PopsUtils {
498
498
  if (typeof deviation !== "number" || Number.isNaN(deviation)) {
499
499
  deviation = 10;
500
500
  }
501
+ // 最大值 2147483647
502
+ // const maxZIndex = Math.pow(2, 31) - 1;
503
+ // 比较值 2000000000
504
+ const maxZIndexCompare = 2 * Math.pow(10, 9);
501
505
  /** 坐标偏移 */
502
506
  const positionDistance = 10;
503
507
  const defaultCalcPostion: {
@@ -592,9 +596,14 @@ class PopsUtils {
592
596
  left: maxRect.left,
593
597
  };
594
598
  }
599
+ const calcZIndex = zIndex + deviation;
600
+ if (calcZIndex >= maxZIndexCompare) {
601
+ // 不要超过最大值
602
+ return;
603
+ }
595
604
  return {
596
605
  /** 计算偏移量后的z-index值 */
597
- zIndex: zIndex + deviation,
606
+ zIndex: calcZIndex,
598
607
  /** 获取到的最大的z-index值 */
599
608
  originZIndex: zIndex,
600
609
  /** 拥有最大z-index的元素 */