@base-web-kits/base-tools-web 1.2.9 → 1.3.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/dist/base-tools-web.umd.global.js +7 -7
- package/dist/base-tools-web.umd.global.js.map +1 -1
- package/dist/index.cjs +7 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/dist/network/uploadFile.d.ts +2 -2
- package/dist/network/uploadFile.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/web/network/uploadFile.ts +9 -9
|
@@ -2104,7 +2104,7 @@ var baseToolsWeb = (() => {
|
|
|
2104
2104
|
return new Promise((resolve, reject) => {
|
|
2105
2105
|
var _a;
|
|
2106
2106
|
const xhr = new XMLHttpRequest();
|
|
2107
|
-
const { url, file, name = "file", header,
|
|
2107
|
+
const { url, file, name = "file", header, data, timeout = 0 } = option;
|
|
2108
2108
|
const fail = (error) => reject(error);
|
|
2109
2109
|
const success = (responseText) => {
|
|
2110
2110
|
resolve(responseText);
|
|
@@ -2143,14 +2143,14 @@ var baseToolsWeb = (() => {
|
|
|
2143
2143
|
});
|
|
2144
2144
|
}
|
|
2145
2145
|
xhr.timeout = timeout;
|
|
2146
|
-
const
|
|
2147
|
-
if (
|
|
2148
|
-
Object.entries(
|
|
2149
|
-
if (v !== void 0 && v !== null)
|
|
2146
|
+
const formData = new FormData();
|
|
2147
|
+
if (data) {
|
|
2148
|
+
Object.entries(data).forEach(([k, v]) => {
|
|
2149
|
+
if (v !== void 0 && v !== null) formData.append(k, String(v));
|
|
2150
2150
|
});
|
|
2151
2151
|
}
|
|
2152
|
-
|
|
2153
|
-
xhr.send(
|
|
2152
|
+
formData.append(name, file);
|
|
2153
|
+
xhr.send(formData);
|
|
2154
2154
|
});
|
|
2155
2155
|
}
|
|
2156
2156
|
function uploadFile(option, config) {
|