@whitesev/utils 2.3.4 → 2.3.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.
package/dist/index.cjs.js CHANGED
@@ -3952,7 +3952,7 @@ class Utils {
3952
3952
  this.windowApi = new WindowApi(option);
3953
3953
  }
3954
3954
  /** 版本号 */
3955
- version = "2024.9.28";
3955
+ version = "2024.10.13";
3956
3956
  addStyle(cssText) {
3957
3957
  if (typeof cssText !== "string") {
3958
3958
  throw new Error("Utils.addStyle 参数cssText 必须为String类型");
@@ -4648,7 +4648,7 @@ class Utils {
4648
4648
  return Math.max(...newResult);
4649
4649
  }
4650
4650
  }
4651
- getMaxZIndexNodeInfo(deviation = 1) {
4651
+ getMaxZIndexNodeInfo(deviation = 1, target = this.windowApi.document, ignoreCallBack) {
4652
4652
  deviation = Number.isNaN(deviation) ? 1 : deviation;
4653
4653
  const UtilsContext = this;
4654
4654
  // 最大值2147483647
@@ -4673,6 +4673,12 @@ class Utils {
4673
4673
  * @param $ele
4674
4674
  */
4675
4675
  function queryMaxZIndex($ele) {
4676
+ if (typeof ignoreCallBack === "function") {
4677
+ let ignoreResult = ignoreCallBack($ele);
4678
+ if (typeof ignoreResult === "boolean" && !ignoreResult) {
4679
+ return;
4680
+ }
4681
+ }
4676
4682
  /** 元素的样式 */
4677
4683
  const nodeStyle = UtilsContext.windowApi.window.getComputedStyle($ele);
4678
4684
  /* 不对position为static和display为none的元素进行获取它们的z-index */
@@ -4693,7 +4699,7 @@ class Utils {
4693
4699
  }
4694
4700
  }
4695
4701
  }
4696
- this.windowApi.document.querySelectorAll("*").forEach(($ele, index) => {
4702
+ target.querySelectorAll("*").forEach(($ele, index) => {
4697
4703
  queryMaxZIndex($ele);
4698
4704
  });
4699
4705
  zIndex += deviation;
@@ -4706,8 +4712,8 @@ class Utils {
4706
4712
  zIndex: zIndex,
4707
4713
  };
4708
4714
  }
4709
- getMaxZIndex(deviation = 1) {
4710
- return this.getMaxZIndexNodeInfo(deviation).zIndex;
4715
+ getMaxZIndex(deviation = 1, target = this.windowApi.document, ignoreCallBack) {
4716
+ return this.getMaxZIndexNodeInfo(deviation, target, ignoreCallBack).zIndex;
4711
4717
  }
4712
4718
  getMinValue(...args) {
4713
4719
  let result = [...args];