@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/index.cjs CHANGED
@@ -34,6 +34,7 @@ var __copyProps = (to, from, except, desc) => {
34
34
  }
35
35
  return to;
36
36
  };
37
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
37
38
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
38
39
  // If the importer is in node compatibility mode or this is not an ESM
39
40
  // file that has been converted to a CommonJS file using a Babel-
@@ -108,7 +109,6 @@ __export(index_exports, {
108
109
  loadCss: () => loadCss,
109
110
  loadJs: () => loadJs,
110
111
  lockBodyScroll: () => lockBodyScroll,
111
- parseAxiosBlob: () => parseAxiosBlob,
112
112
  preloadImage: () => preloadImage,
113
113
  removeCookie: () => removeCookie,
114
114
  removeLocalStorage: () => removeLocalStorage,
@@ -324,10 +324,10 @@ function execCopyFromHtml(html) {
324
324
  div.innerHTML = html;
325
325
  document.body.appendChild(div);
326
326
  const selection = window.getSelection();
327
- const range2 = document.createRange();
328
- range2.selectNodeContents(div);
327
+ const range = document.createRange();
328
+ range.selectNodeContents(div);
329
329
  selection == null ? void 0 : selection.removeAllRanges();
330
- selection == null ? void 0 : selection.addRange(range2);
330
+ selection == null ? void 0 : selection.addRange(range);
331
331
  const ok = document.execCommand("copy");
332
332
  document.body.removeChild(div);
333
333
  selection == null ? void 0 : selection.removeAllRanges();
@@ -542,18 +542,6 @@ function download(url, fileName = "") {
542
542
  }
543
543
  });
544
544
  }
545
- function parseAxiosBlob(res) {
546
- return __async(this, null, function* () {
547
- const { data, headers, status, statusText, config } = res;
548
- if (status < 200 || status >= 300) throw new Error(`${status}\uFF0C${statusText}\uFF1A${config.url}`);
549
- if (data.type.includes("application/json")) {
550
- const txt = yield data.text();
551
- throw JSON.parse(txt);
552
- }
553
- const fileName = getDispositionFileName(headers["content-disposition"]);
554
- return { blob: data, fileName };
555
- });
556
- }
557
545
  function getDispositionFileName(disposition) {
558
546
  var _a;
559
547
  if (!disposition) return "";
@@ -672,7 +660,8 @@ function toDayjs(t, fmt) {
672
660
  }
673
661
 
674
662
  // src/ts/es-toolkit/index.ts
675
- var import_es_toolkit = require("es-toolkit");
663
+ var es_toolkit_exports = {};
664
+ __reExport(es_toolkit_exports, require("es-toolkit"));
676
665
 
677
666
  // src/ts/object/index.ts
678
667
  var import_compat = require("es-toolkit/compat");
@@ -717,7 +706,7 @@ function request(config) {
717
706
  cacheTime,
718
707
  resMap,
719
708
  responseType = "json",
720
- timeout: timeout2 = 6e4,
709
+ timeout = 6e4,
721
710
  onTaskReady
722
711
  } = config;
723
712
  const controller = new AbortController();
@@ -737,7 +726,7 @@ function request(config) {
737
726
  const execute = () => __async(null, null, function* () {
738
727
  var _a, _b, _c, _d, _e, _f, _g, _h;
739
728
  const isGet = method === "GET";
740
- const isObjectData = (0, import_es_toolkit.isPlainObject)(data);
729
+ const isObjectData = (0, es_toolkit_exports.isPlainObject)(data);
741
730
  const isArrayData = !isObjectData && Array.isArray(data);
742
731
  const fillData = isObjectData ? filterRequestData(data) : data;
743
732
  const fillHeader = filterRequestHeader(header);
@@ -787,7 +776,7 @@ function request(config) {
787
776
  const timeoutId = setTimeout(() => {
788
777
  isTimeout = true;
789
778
  controller.abort();
790
- }, timeout2);
779
+ }, timeout);
791
780
  try {
792
781
  const response = yield fetch(fillUrl, {
793
782
  method,
@@ -882,7 +871,7 @@ function logRequestInfo(options) {
882
871
  duration: endTime - startTime
883
872
  }, logExtra);
884
873
  if (status === "success") {
885
- info.res = (0, import_es_toolkit.cloneDeep)(res);
874
+ info.res = (0, es_toolkit_exports.cloneDeep)(res);
886
875
  log("info", info);
887
876
  } else {
888
877
  info.e = e;
@@ -1000,9 +989,9 @@ function enhanceWebApi(webApi, apiName) {
1000
989
  const logData = __spreadValues({ name: fname, status: "success", option }, logExtra);
1001
990
  if (resMap) {
1002
991
  logData.res = res;
1003
- logData.resMap = (0, import_es_toolkit.cloneDeep)(finalRes);
992
+ logData.resMap = (0, es_toolkit_exports.cloneDeep)(finalRes);
1004
993
  } else {
1005
- logData.res = (0, import_es_toolkit.cloneDeep)(res);
994
+ logData.res = (0, es_toolkit_exports.cloneDeep)(res);
1006
995
  }
1007
996
  log == null ? void 0 : log("info", logData);
1008
997
  }
@@ -1030,7 +1019,7 @@ function upload(option, config) {
1030
1019
  return new Promise((resolve, reject) => {
1031
1020
  var _a;
1032
1021
  const xhr = new XMLHttpRequest();
1033
- const { url, file, name = "file", header, formData, timeout: timeout2 = 0 } = option;
1022
+ const { url, file, name = "file", header, formData, timeout = 0 } = option;
1034
1023
  const fail = (error) => reject(error);
1035
1024
  const success = (responseText) => {
1036
1025
  resolve(responseText);
@@ -1068,7 +1057,7 @@ function upload(option, config) {
1068
1057
  if (v !== void 0 && v !== null && v !== "") xhr.setRequestHeader(k, String(v));
1069
1058
  });
1070
1059
  }
1071
- xhr.timeout = timeout2;
1060
+ xhr.timeout = timeout;
1072
1061
  const data = new FormData();
1073
1062
  if (formData) {
1074
1063
  Object.entries(formData).forEach(([k, v]) => {
@@ -1191,7 +1180,6 @@ function getUrlParams(url = window.location.href) {
1191
1180
  loadCss,
1192
1181
  loadJs,
1193
1182
  lockBodyScroll,
1194
- parseAxiosBlob,
1195
1183
  preloadImage,
1196
1184
  removeCookie,
1197
1185
  removeLocalStorage,