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