@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.
package/dist/index.cjs.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const version = "4.2.2";
3
+ const version = "4.2.3";
4
4
 
5
5
  const GlobalConfig = {
6
6
  config: {},
@@ -675,6 +675,10 @@ class PopsUtils {
675
675
  if (typeof deviation !== "number" || Number.isNaN(deviation)) {
676
676
  deviation = 10;
677
677
  }
678
+ // 最大值 2147483647
679
+ // const maxZIndex = Math.pow(2, 31) - 1;
680
+ // 比较值 2000000000
681
+ const maxZIndexCompare = 2 * Math.pow(10, 9);
678
682
  /** 坐标偏移 */
679
683
  const positionDistance = 10;
680
684
  const defaultCalcPostion = [];
@@ -769,9 +773,14 @@ class PopsUtils {
769
773
  left: maxRect.left,
770
774
  };
771
775
  }
776
+ const calcZIndex = zIndex + deviation;
777
+ if (calcZIndex >= maxZIndexCompare) {
778
+ // 不要超过最大值
779
+ return;
780
+ }
772
781
  return {
773
782
  /** 计算偏移量后的z-index值 */
774
- zIndex: zIndex + deviation,
783
+ zIndex: calcZIndex,
775
784
  /** 获取到的最大的z-index值 */
776
785
  originZIndex: zIndex,
777
786
  /** 拥有最大z-index的元素 */
@@ -3181,8 +3190,8 @@ const PopsInstanceUtils = {
3181
3190
  * 获取pops所有弹窗中的最大的z-index
3182
3191
  * @param deviation
3183
3192
  */
3184
- getPopsMaxZIndex(deviation = 1) {
3185
- deviation = Number.isNaN(deviation) ? 1 : deviation;
3193
+ getPopsMaxZIndex(deviation = 10) {
3194
+ deviation = Number.isNaN(deviation) ? 10 : deviation;
3186
3195
  // 最大值 2147483647
3187
3196
  // const browserMaxZIndex = Math.pow(2, 31) - 1;
3188
3197
  // 比较值 2000000000
@@ -3197,8 +3206,7 @@ const PopsInstanceUtils = {
3197
3206
  const inst = instData[index];
3198
3207
  // 不对position为static和display为none的元素进行获取它们的z-index
3199
3208
  const $elList = [inst.$anim, inst.$pops, inst.$mask].filter((it) => it instanceof HTMLElement);
3200
- const nodeZIndexInfoList = popsUtils.getMaxZIndexNodeInfoFromPoint($elList);
3201
- const maxNodeZIndexInfo = nodeZIndexInfoList[0];
3209
+ const maxNodeZIndexInfo = popsUtils.getMaxZIndexNodeInfoFromPoint($elList)[0];
3202
3210
  if (maxNodeZIndexInfo) {
3203
3211
  const nodeZIndex = maxNodeZIndexInfo.zIndex;
3204
3212
  if (nodeZIndex > zIndex) {