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