@whitesev/utils 1.6.1 → 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 +52 -34
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +52 -34
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +52 -34
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +52 -34
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +52 -34
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +52 -34
- package/dist/index.umd.js.map +1 -1
- package/dist/src/Dictionary.d.ts +1 -1
- package/package.json +13 -2
- package/index.ts +0 -3
- package/rollup.config.js +0 -57
- package/src/AjaxHookerType.ts +0 -155
- package/src/ColorConversion.ts +0 -130
- package/src/Dictionary.ts +0 -152
- package/src/Event.ts +0 -189
- package/src/GBKEncoder.ts +0 -120
- package/src/Hooks.ts +0 -87
- package/src/Httpx.ts +0 -2402
- package/src/LockFunction.ts +0 -67
- package/src/Log.ts +0 -284
- package/src/Progress.ts +0 -143
- package/src/TryCatch.ts +0 -107
- package/src/Utils.ts +0 -4917
- package/src/UtilsCommon.ts +0 -20
- package/src/UtilsCore.ts +0 -47
- package/src/UtilsGMCookie.ts +0 -261
- package/src/UtilsGMMenu.ts +0 -530
- package/src/VueObject.ts +0 -128
- package/src/ajaxHooker/ajaxHooker.js +0 -566
- package/src/indexedDB.ts +0 -419
- package/tsconfig.json +0 -31
package/dist/index.system.js
CHANGED
|
@@ -1568,11 +1568,13 @@ System.register('Utils', [], (function (exports) {
|
|
|
1568
1568
|
* @private
|
|
1569
1569
|
*/
|
|
1570
1570
|
beforeRequestCallBack(details) {
|
|
1571
|
-
if (
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1571
|
+
if (details.allowInterceptConfig) {
|
|
1572
|
+
// 首先配置得存在,不然默认允许拦截
|
|
1573
|
+
if (typeof details.allowInterceptConfig.beforeRequest === "boolean" &&
|
|
1574
|
+
!details.allowInterceptConfig.beforeRequest) {
|
|
1575
|
+
// 设置了禁止拦截
|
|
1576
|
+
return details;
|
|
1577
|
+
}
|
|
1576
1578
|
}
|
|
1577
1579
|
for (let index = 0; index < this.$config.configList.length; index++) {
|
|
1578
1580
|
let item = this.$config.configList[index];
|
|
@@ -1635,11 +1637,14 @@ System.register('Utils', [], (function (exports) {
|
|
|
1635
1637
|
* @param details 请求的配置
|
|
1636
1638
|
*/
|
|
1637
1639
|
successResponseCallBack(response, details) {
|
|
1638
|
-
if (
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1640
|
+
if (details.allowInterceptConfig) {
|
|
1641
|
+
// 首先配置得存在,不然默认允许拦截
|
|
1642
|
+
if (typeof details.allowInterceptConfig.afterResponseSuccess ===
|
|
1643
|
+
"boolean" &&
|
|
1644
|
+
!details.allowInterceptConfig.afterResponseSuccess) {
|
|
1645
|
+
// 设置了禁止拦截
|
|
1646
|
+
return details;
|
|
1647
|
+
}
|
|
1643
1648
|
}
|
|
1644
1649
|
for (let index = 0; index < this.$config.configList.length; index++) {
|
|
1645
1650
|
let item = this.$config.configList[index];
|
|
@@ -1656,11 +1661,14 @@ System.register('Utils', [], (function (exports) {
|
|
|
1656
1661
|
* @param data 配置
|
|
1657
1662
|
*/
|
|
1658
1663
|
errorResponseCallBack(data) {
|
|
1659
|
-
if (
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
+
if (data.details.allowInterceptConfig) {
|
|
1665
|
+
// 首先配置得存在,不然默认允许拦截
|
|
1666
|
+
if (typeof data.details.allowInterceptConfig.afterResponseError ===
|
|
1667
|
+
"boolean" &&
|
|
1668
|
+
!data.details.allowInterceptConfig.afterResponseError) {
|
|
1669
|
+
// 设置了禁止拦截
|
|
1670
|
+
return data;
|
|
1671
|
+
}
|
|
1664
1672
|
}
|
|
1665
1673
|
for (let index = 0; index < this.$config.configList.length; index++) {
|
|
1666
1674
|
let item = this.$config.configList[index];
|
|
@@ -3281,14 +3289,14 @@ System.register('Utils', [], (function (exports) {
|
|
|
3281
3289
|
};
|
|
3282
3290
|
|
|
3283
3291
|
class UtilsDictionary {
|
|
3284
|
-
items = {};
|
|
3292
|
+
#items = {};
|
|
3285
3293
|
constructor() { }
|
|
3286
3294
|
/**
|
|
3287
3295
|
* 检查是否有某一个键
|
|
3288
3296
|
* @param key 键
|
|
3289
3297
|
*/
|
|
3290
3298
|
has(key) {
|
|
3291
|
-
return this
|
|
3299
|
+
return this.#items.hasOwnProperty(key);
|
|
3292
3300
|
}
|
|
3293
3301
|
/**
|
|
3294
3302
|
* 检查已有的键中是否以xx开头
|
|
@@ -3312,7 +3320,7 @@ System.register('Utils', [], (function (exports) {
|
|
|
3312
3320
|
let result = null;
|
|
3313
3321
|
for (const keyName of allKeys) {
|
|
3314
3322
|
if (keyName.startsWith(key)) {
|
|
3315
|
-
result = this
|
|
3323
|
+
result = this.#items[keyName];
|
|
3316
3324
|
break;
|
|
3317
3325
|
}
|
|
3318
3326
|
}
|
|
@@ -3327,7 +3335,7 @@ System.register('Utils', [], (function (exports) {
|
|
|
3327
3335
|
if (key === void 0) {
|
|
3328
3336
|
throw new Error("Utils.Dictionary().set 参数 key 不能为空");
|
|
3329
3337
|
}
|
|
3330
|
-
this
|
|
3338
|
+
this.#items[key] = val;
|
|
3331
3339
|
}
|
|
3332
3340
|
/**
|
|
3333
3341
|
* 删除某一个键
|
|
@@ -3335,7 +3343,7 @@ System.register('Utils', [], (function (exports) {
|
|
|
3335
3343
|
*/
|
|
3336
3344
|
delete(key) {
|
|
3337
3345
|
if (this.has(key)) {
|
|
3338
|
-
Reflect.deleteProperty(this
|
|
3346
|
+
Reflect.deleteProperty(this.#items, key);
|
|
3339
3347
|
return true;
|
|
3340
3348
|
}
|
|
3341
3349
|
return false;
|
|
@@ -3363,8 +3371,8 @@ System.register('Utils', [], (function (exports) {
|
|
|
3363
3371
|
* 清空字典
|
|
3364
3372
|
*/
|
|
3365
3373
|
clear() {
|
|
3366
|
-
this
|
|
3367
|
-
this
|
|
3374
|
+
this.#items = void 0;
|
|
3375
|
+
this.#items = {};
|
|
3368
3376
|
}
|
|
3369
3377
|
/**
|
|
3370
3378
|
* 获取字典的长度
|
|
@@ -3382,14 +3390,14 @@ System.register('Utils', [], (function (exports) {
|
|
|
3382
3390
|
* 返回字典本身
|
|
3383
3391
|
*/
|
|
3384
3392
|
getItems() {
|
|
3385
|
-
return this
|
|
3393
|
+
return this.#items;
|
|
3386
3394
|
}
|
|
3387
3395
|
/**
|
|
3388
3396
|
* 合并另一个字典
|
|
3389
3397
|
* @param data 需要合并的字典
|
|
3390
3398
|
*/
|
|
3391
3399
|
concat(data) {
|
|
3392
|
-
this
|
|
3400
|
+
this.#items = utils.assign(this.#items, data.getItems());
|
|
3393
3401
|
}
|
|
3394
3402
|
forEach(callbackfn) {
|
|
3395
3403
|
for (const key in this.getItems()) {
|
|
@@ -3430,7 +3438,7 @@ System.register('Utils', [], (function (exports) {
|
|
|
3430
3438
|
UtilsCore.init(option);
|
|
3431
3439
|
}
|
|
3432
3440
|
/** 版本号 */
|
|
3433
|
-
version = "2024.
|
|
3441
|
+
version = "2024.7.20";
|
|
3434
3442
|
addStyle(cssText) {
|
|
3435
3443
|
if (typeof cssText !== "string") {
|
|
3436
3444
|
throw new Error("Utils.addStyle 参数cssText 必须为String类型");
|
|
@@ -4124,21 +4132,31 @@ System.register('Utils', [], (function (exports) {
|
|
|
4124
4132
|
}
|
|
4125
4133
|
}
|
|
4126
4134
|
getMaxZIndex(deviation = 1) {
|
|
4127
|
-
let nodeIndexList = [];
|
|
4128
4135
|
deviation = Number.isNaN(deviation) ? 1 : deviation;
|
|
4129
|
-
|
|
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) => {
|
|
4130
4143
|
let nodeStyle = window.getComputedStyle(element);
|
|
4131
4144
|
/* 不对position为static和display为none的元素进行获取它们的z-index */
|
|
4132
4145
|
if (nodeStyle.position !== "static" && nodeStyle.display !== "none") {
|
|
4133
|
-
|
|
4146
|
+
let nodeZIndex = parseInt(nodeStyle.zIndex);
|
|
4147
|
+
if (!isNaN(nodeZIndex)) {
|
|
4148
|
+
if (nodeZIndex > zIndex) {
|
|
4149
|
+
zIndex = nodeZIndex;
|
|
4150
|
+
}
|
|
4151
|
+
}
|
|
4134
4152
|
}
|
|
4135
4153
|
});
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
return
|
|
4154
|
+
zIndex += deviation;
|
|
4155
|
+
if (zIndex >= maxZIndexCompare) {
|
|
4156
|
+
// 最好不要超过最大值
|
|
4157
|
+
zIndex = maxZIndex;
|
|
4158
|
+
}
|
|
4159
|
+
return zIndex;
|
|
4142
4160
|
}
|
|
4143
4161
|
getMinValue(...args) {
|
|
4144
4162
|
let result = [...args];
|