@whitesev/utils 1.7.0 → 1.8.0
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/README.md +2 -0
- package/dist/index.amd.js +20 -10
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +20 -10
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +20 -10
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +20 -10
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +20 -10
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +20 -10
- package/dist/index.umd.js.map +1 -1
- package/package.json +4 -1
package/dist/index.esm.js
CHANGED
|
@@ -3433,7 +3433,7 @@ class Utils {
|
|
|
3433
3433
|
UtilsCore.init(option);
|
|
3434
3434
|
}
|
|
3435
3435
|
/** 版本号 */
|
|
3436
|
-
version = "2024.
|
|
3436
|
+
version = "2024.7.20";
|
|
3437
3437
|
addStyle(cssText) {
|
|
3438
3438
|
if (typeof cssText !== "string") {
|
|
3439
3439
|
throw new Error("Utils.addStyle 参数cssText 必须为String类型");
|
|
@@ -4127,21 +4127,31 @@ class Utils {
|
|
|
4127
4127
|
}
|
|
4128
4128
|
}
|
|
4129
4129
|
getMaxZIndex(deviation = 1) {
|
|
4130
|
-
let nodeIndexList = [];
|
|
4131
4130
|
deviation = Number.isNaN(deviation) ? 1 : deviation;
|
|
4132
|
-
|
|
4131
|
+
// 最大值2147483647
|
|
4132
|
+
let maxZIndex = Math.pow(2, 31) - 1;
|
|
4133
|
+
// 比较值2000000000
|
|
4134
|
+
let maxZIndexCompare = 2 * Math.pow(10, 9);
|
|
4135
|
+
// 当前页面最大的z-index
|
|
4136
|
+
let zIndex = 0;
|
|
4137
|
+
document.querySelectorAll("*").forEach((element, index) => {
|
|
4133
4138
|
let nodeStyle = window.getComputedStyle(element);
|
|
4134
4139
|
/* 不对position为static和display为none的元素进行获取它们的z-index */
|
|
4135
4140
|
if (nodeStyle.position !== "static" && nodeStyle.display !== "none") {
|
|
4136
|
-
|
|
4141
|
+
let nodeZIndex = parseInt(nodeStyle.zIndex);
|
|
4142
|
+
if (!isNaN(nodeZIndex)) {
|
|
4143
|
+
if (nodeZIndex > zIndex) {
|
|
4144
|
+
zIndex = nodeZIndex;
|
|
4145
|
+
}
|
|
4146
|
+
}
|
|
4137
4147
|
}
|
|
4138
4148
|
});
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
return
|
|
4149
|
+
zIndex += deviation;
|
|
4150
|
+
if (zIndex >= maxZIndexCompare) {
|
|
4151
|
+
// 最好不要超过最大值
|
|
4152
|
+
zIndex = maxZIndex;
|
|
4153
|
+
}
|
|
4154
|
+
return zIndex;
|
|
4145
4155
|
}
|
|
4146
4156
|
getMinValue(...args) {
|
|
4147
4157
|
let result = [...args];
|