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