@whitesev/utils 2.3.5 → 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.umd.js CHANGED
@@ -3956,7 +3956,7 @@
3956
3956
  this.windowApi = new WindowApi(option);
3957
3957
  }
3958
3958
  /** 版本号 */
3959
- version = "2024.9.28";
3959
+ version = "2024.10.13";
3960
3960
  addStyle(cssText) {
3961
3961
  if (typeof cssText !== "string") {
3962
3962
  throw new Error("Utils.addStyle 参数cssText 必须为String类型");
@@ -4652,7 +4652,7 @@
4652
4652
  return Math.max(...newResult);
4653
4653
  }
4654
4654
  }
4655
- getMaxZIndexNodeInfo(deviation = 1) {
4655
+ getMaxZIndexNodeInfo(deviation = 1, target = this.windowApi.document, ignoreCallBack) {
4656
4656
  deviation = Number.isNaN(deviation) ? 1 : deviation;
4657
4657
  const UtilsContext = this;
4658
4658
  // 最大值2147483647
@@ -4677,6 +4677,12 @@
4677
4677
  * @param $ele
4678
4678
  */
4679
4679
  function queryMaxZIndex($ele) {
4680
+ if (typeof ignoreCallBack === "function") {
4681
+ let ignoreResult = ignoreCallBack($ele);
4682
+ if (typeof ignoreResult === "boolean" && !ignoreResult) {
4683
+ return;
4684
+ }
4685
+ }
4680
4686
  /** 元素的样式 */
4681
4687
  const nodeStyle = UtilsContext.windowApi.window.getComputedStyle($ele);
4682
4688
  /* 不对position为static和display为none的元素进行获取它们的z-index */
@@ -4697,7 +4703,7 @@
4697
4703
  }
4698
4704
  }
4699
4705
  }
4700
- this.windowApi.document.querySelectorAll("*").forEach(($ele, index) => {
4706
+ target.querySelectorAll("*").forEach(($ele, index) => {
4701
4707
  queryMaxZIndex($ele);
4702
4708
  });
4703
4709
  zIndex += deviation;
@@ -4710,8 +4716,8 @@
4710
4716
  zIndex: zIndex,
4711
4717
  };
4712
4718
  }
4713
- getMaxZIndex(deviation = 1) {
4714
- return this.getMaxZIndexNodeInfo(deviation).zIndex;
4719
+ getMaxZIndex(deviation = 1, target = this.windowApi.document, ignoreCallBack) {
4720
+ return this.getMaxZIndexNodeInfo(deviation, target, ignoreCallBack).zIndex;
4715
4721
  }
4716
4722
  getMinValue(...args) {
4717
4723
  let result = [...args];