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