@base-web-kits/base-tools-web 1.2.5 → 1.2.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/base-tools-web.umd.global.js +7 -20
- package/dist/base-tools-web.umd.global.js.map +1 -1
- package/dist/index.cjs +14 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +640 -0
- package/dist/index.js +25 -209
- package/dist/index.js.map +1 -1
- package/dist/network/download.d.ts +0 -14
- package/dist/network/download.d.ts.map +1 -1
- package/dist/network/request.d.ts.map +1 -1
- package/package.json +1 -12
- package/src/web/async/index.ts +1 -1
- package/src/web/network/download.ts +0 -27
- package/src/web/network/request.ts +4 -7
|
@@ -787,7 +787,6 @@ var baseToolsWeb = (() => {
|
|
|
787
787
|
loadCss: () => loadCss,
|
|
788
788
|
loadJs: () => loadJs,
|
|
789
789
|
lockBodyScroll: () => lockBodyScroll,
|
|
790
|
-
parseAxiosBlob: () => parseAxiosBlob,
|
|
791
790
|
preloadImage: () => preloadImage,
|
|
792
791
|
removeCookie: () => removeCookie,
|
|
793
792
|
removeLocalStorage: () => removeLocalStorage,
|
|
@@ -1002,10 +1001,10 @@ var baseToolsWeb = (() => {
|
|
|
1002
1001
|
div.innerHTML = html;
|
|
1003
1002
|
document.body.appendChild(div);
|
|
1004
1003
|
const selection = window.getSelection();
|
|
1005
|
-
const
|
|
1006
|
-
|
|
1004
|
+
const range = document.createRange();
|
|
1005
|
+
range.selectNodeContents(div);
|
|
1007
1006
|
selection == null ? void 0 : selection.removeAllRanges();
|
|
1008
|
-
selection == null ? void 0 : selection.addRange(
|
|
1007
|
+
selection == null ? void 0 : selection.addRange(range);
|
|
1009
1008
|
const ok = document.execCommand("copy");
|
|
1010
1009
|
document.body.removeChild(div);
|
|
1011
1010
|
selection == null ? void 0 : selection.removeAllRanges();
|
|
@@ -1220,18 +1219,6 @@ var baseToolsWeb = (() => {
|
|
|
1220
1219
|
}
|
|
1221
1220
|
});
|
|
1222
1221
|
}
|
|
1223
|
-
function parseAxiosBlob(res) {
|
|
1224
|
-
return __async(this, null, function* () {
|
|
1225
|
-
const { data, headers, status, statusText, config } = res;
|
|
1226
|
-
if (status < 200 || status >= 300) throw new Error(`${status}\uFF0C${statusText}\uFF1A${config.url}`);
|
|
1227
|
-
if (data.type.includes("application/json")) {
|
|
1228
|
-
const txt = yield data.text();
|
|
1229
|
-
throw JSON.parse(txt);
|
|
1230
|
-
}
|
|
1231
|
-
const fileName = getDispositionFileName(headers["content-disposition"]);
|
|
1232
|
-
return { blob: data, fileName };
|
|
1233
|
-
});
|
|
1234
|
-
}
|
|
1235
1222
|
function getDispositionFileName(disposition) {
|
|
1236
1223
|
var _a;
|
|
1237
1224
|
if (!disposition) return "";
|
|
@@ -1804,7 +1791,7 @@ var baseToolsWeb = (() => {
|
|
|
1804
1791
|
cacheTime,
|
|
1805
1792
|
resMap,
|
|
1806
1793
|
responseType = "json",
|
|
1807
|
-
timeout
|
|
1794
|
+
timeout = 6e4,
|
|
1808
1795
|
onTaskReady
|
|
1809
1796
|
} = config;
|
|
1810
1797
|
const controller = new AbortController();
|
|
@@ -1874,7 +1861,7 @@ var baseToolsWeb = (() => {
|
|
|
1874
1861
|
const timeoutId = setTimeout(() => {
|
|
1875
1862
|
isTimeout = true;
|
|
1876
1863
|
controller.abort();
|
|
1877
|
-
},
|
|
1864
|
+
}, timeout);
|
|
1878
1865
|
try {
|
|
1879
1866
|
const response = yield fetch(fillUrl, {
|
|
1880
1867
|
method,
|
|
@@ -2117,7 +2104,7 @@ var baseToolsWeb = (() => {
|
|
|
2117
2104
|
return new Promise((resolve, reject) => {
|
|
2118
2105
|
var _a;
|
|
2119
2106
|
const xhr = new XMLHttpRequest();
|
|
2120
|
-
const { url, file, name = "file", header, formData, timeout
|
|
2107
|
+
const { url, file, name = "file", header, formData, timeout = 0 } = option;
|
|
2121
2108
|
const fail = (error) => reject(error);
|
|
2122
2109
|
const success = (responseText) => {
|
|
2123
2110
|
resolve(responseText);
|
|
@@ -2155,7 +2142,7 @@ var baseToolsWeb = (() => {
|
|
|
2155
2142
|
if (v !== void 0 && v !== null && v !== "") xhr.setRequestHeader(k, String(v));
|
|
2156
2143
|
});
|
|
2157
2144
|
}
|
|
2158
|
-
xhr.timeout =
|
|
2145
|
+
xhr.timeout = timeout;
|
|
2159
2146
|
const data = new FormData();
|
|
2160
2147
|
if (formData) {
|
|
2161
2148
|
Object.entries(formData).forEach(([k, v]) => {
|