@whitesev/utils 1.3.5 → 1.3.7
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/dist/index.amd.js +28 -1
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +28 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +28 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +28 -1
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +28 -1
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +28 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/src/Utils.d.ts +18 -0
- package/dist/src/UtilsCore.d.ts +1 -1
- package/package.json +1 -1
- package/src/Utils.ts +37 -1
- package/src/UtilsCore.ts +1 -2
package/dist/index.iife.js
CHANGED
|
@@ -3171,8 +3171,11 @@ var Utils = (function () {
|
|
|
3171
3171
|
|
|
3172
3172
|
/// <reference path="./ajaxHooker/index.d.ts" />
|
|
3173
3173
|
class Utils {
|
|
3174
|
+
constructor(option) {
|
|
3175
|
+
UtilsCore.init(option);
|
|
3176
|
+
}
|
|
3174
3177
|
/** 版本号 */
|
|
3175
|
-
version = "2024.5
|
|
3178
|
+
version = "2024.6.5";
|
|
3176
3179
|
addStyle(cssText) {
|
|
3177
3180
|
if (typeof cssText !== "string") {
|
|
3178
3181
|
throw new Error("Utils.addStyle 参数cssText 必须为String类型");
|
|
@@ -6049,6 +6052,30 @@ var Utils = (function () {
|
|
|
6049
6052
|
});
|
|
6050
6053
|
}
|
|
6051
6054
|
}
|
|
6055
|
+
/**
|
|
6056
|
+
* 创建一个新的Utils实例
|
|
6057
|
+
* @param option
|
|
6058
|
+
* @returns
|
|
6059
|
+
*/
|
|
6060
|
+
createUtils(option) {
|
|
6061
|
+
return new Utils(option);
|
|
6062
|
+
}
|
|
6063
|
+
/**
|
|
6064
|
+
* 将对象转换为FormData
|
|
6065
|
+
*/
|
|
6066
|
+
toFormData(data) {
|
|
6067
|
+
const formData = new FormData();
|
|
6068
|
+
Object.keys(data).forEach((key) => {
|
|
6069
|
+
let value = data[key];
|
|
6070
|
+
if (value instanceof File) {
|
|
6071
|
+
formData.append(key, value, value.name);
|
|
6072
|
+
}
|
|
6073
|
+
else {
|
|
6074
|
+
formData.append(key, value);
|
|
6075
|
+
}
|
|
6076
|
+
});
|
|
6077
|
+
return formData;
|
|
6078
|
+
}
|
|
6052
6079
|
}
|
|
6053
6080
|
let utils = new Utils();
|
|
6054
6081
|
|