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