@vtj/utils 0.12.53 → 0.12.54

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.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  var cn = Object.defineProperty;
2
2
  var ln = (e, t, n) => t in e ? cn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var v = (e, t, n) => ln(e, typeof t != "symbol" ? t + "" : t, n);
3
+ var j = (e, t, n) => ln(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  import { omit as Te, merge as G, debounce as un, throttle as fn, isUrl as dn, pathToRegexpCompile as hn, uuid as pn, rURL as mn, template as gn } from "@vtj/base";
5
5
  export * from "@vtj/base";
6
6
  (function() {
@@ -15,10 +15,10 @@ export * from "@vtj/base";
15
15
  * Copyright (c) 2025, VTJ.PRO All rights reserved.
16
16
  * @name @vtj/utils
17
17
  * @author CHC chenhuachun1549@dingtalk.com
18
- * @version 0.12.53
18
+ * @version 0.12.54
19
19
  * @license <a href="https://vtj.pro/license.html">MIT License</a>
20
20
  */
21
- const Qs = "0.12.53";
21
+ const Qs = "0.12.54";
22
22
  /**
23
23
  * @vue/shared v3.5.17
24
24
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
@@ -274,7 +274,7 @@ function X(e, t, n = []) {
274
274
  const Pn = /* @__PURE__ */ wn("__proto__,__v_isRef,__isVue"), Ot = new Set(
275
275
  /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((e) => e !== "arguments" && e !== "caller").map((e) => Symbol[e]).filter(re)
276
276
  );
277
- function vn(e) {
277
+ function jn(e) {
278
278
  re(e) || (e = String(e));
279
279
  const t = R(this);
280
280
  return x(t, "has", e), t.hasOwnProperty(e);
@@ -302,7 +302,7 @@ class Tt {
302
302
  if (i && (u = xn[n]))
303
303
  return u;
304
304
  if (n === "hasOwnProperty")
305
- return vn;
305
+ return jn;
306
306
  }
307
307
  const a = Reflect.get(
308
308
  t,
@@ -312,10 +312,10 @@ class Tt {
312
312
  // its class methods
313
313
  W(t) ? t : r
314
314
  );
315
- return (re(n) ? Ot.has(n) : Pn(n)) || (s || x(t, "get", n), o) ? a : W(a) ? i && Ke(n) ? a : a.value : we(a) ? s ? vt(a) : Pt(a) : a;
315
+ return (re(n) ? Ot.has(n) : Pn(n)) || (s || x(t, "get", n), o) ? a : W(a) ? i && Ke(n) ? a : a.value : we(a) ? s ? jt(a) : Pt(a) : a;
316
316
  }
317
317
  }
318
- class jn extends Tt {
318
+ class vn extends Tt {
319
319
  constructor(t = !1) {
320
320
  super(!1, t);
321
321
  }
@@ -363,7 +363,7 @@ class Ln extends Tt {
363
363
  return !0;
364
364
  }
365
365
  }
366
- const Nn = /* @__PURE__ */ new jn(), Un = /* @__PURE__ */ new Ln(), Be = (e) => e, ae = (e) => Reflect.getPrototypeOf(e);
366
+ const Nn = /* @__PURE__ */ new vn(), Un = /* @__PURE__ */ new Ln(), Be = (e) => e, ae = (e) => Reflect.getPrototypeOf(e);
367
367
  function Fn(e, t, n) {
368
368
  return function(...r) {
369
369
  const s = this.__v_raw, o = R(s), i = ue(o), a = e === "entries" || e === Symbol.iterator && i, u = e === "keys" && i, c = s[e](...r), f = n ? Be : t ? Me : A;
@@ -495,7 +495,7 @@ function Hn(e) {
495
495
  return e.__v_skip || !Object.isExtensible(e) ? 0 : qn(Sn(e));
496
496
  }
497
497
  function Pt(e) {
498
- return z(e) ? e : jt(
498
+ return z(e) ? e : vt(
499
499
  e,
500
500
  !1,
501
501
  Nn,
@@ -503,8 +503,8 @@ function Pt(e) {
503
503
  xt
504
504
  );
505
505
  }
506
- function vt(e) {
507
- return jt(
506
+ function jt(e) {
507
+ return vt(
508
508
  e,
509
509
  !0,
510
510
  Un,
@@ -512,7 +512,7 @@ function vt(e) {
512
512
  Ct
513
513
  );
514
514
  }
515
- function jt(e, t, n, r, s) {
515
+ function vt(e, t, n, r, s) {
516
516
  if (!we(e) || e.__v_raw && !(t && e.__v_isReactive))
517
517
  return e;
518
518
  const o = Hn(e);
@@ -540,7 +540,7 @@ function R(e) {
540
540
  const t = e && e.__v_raw;
541
541
  return t ? R(t) : e;
542
542
  }
543
- const A = (e) => we(e) ? Pt(e) : e, Me = (e) => we(e) ? vt(e) : e;
543
+ const A = (e) => we(e) ? Pt(e) : e, Me = (e) => we(e) ? jt(e) : e;
544
544
  function W(e) {
545
545
  return e ? e.__v_isRef === !0 : !1;
546
546
  }
@@ -726,7 +726,7 @@ const Ar = (e) => {
726
726
  }))(`axios@${Math.random()}`, []) : (n) => setTimeout(n))(
727
727
  typeof setImmediate == "function",
728
728
  C(I.postMessage)
729
- ), Pr = typeof queueMicrotask < "u" ? queueMicrotask.bind(I) : typeof process < "u" && process.nextTick || It, vr = (e) => e != null && C(e[ye]), l = {
729
+ ), Pr = typeof queueMicrotask < "u" ? queueMicrotask.bind(I) : typeof process < "u" && process.nextTick || It, jr = (e) => e != null && C(e[ye]), l = {
730
730
  isArray: K,
731
731
  isArrayBuffer: Ut,
732
732
  isBuffer: Kn,
@@ -783,7 +783,7 @@ const Ar = (e) => {
783
783
  isThenable: Cr,
784
784
  setImmediate: It,
785
785
  asap: Pr,
786
- isIterable: vr
786
+ isIterable: jr
787
787
  };
788
788
  function w(e, t, n, r, s) {
789
789
  Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack, this.message = e, this.name = "AxiosError", t && (this.code = t), n && (this.config = n), r && (this.request = r), s && (this.response = s, this.status = s.status ? s.status : null);
@@ -835,7 +835,7 @@ w.from = (e, t, n, r, s, o) => {
835
835
  return u !== Error.prototype;
836
836
  }, (a) => a !== "isAxiosError"), w.call(i, e.message, t, n, r, s), i.cause = e, i.name = e.name, o && Object.assign(i, o), i;
837
837
  };
838
- const jr = null;
838
+ const vr = null;
839
839
  function ke(e) {
840
840
  return l.isPlainObject(e) || l.isArray(e);
841
841
  }
@@ -870,6 +870,8 @@ function Se(e, t, n) {
870
870
  if (h === null) return "";
871
871
  if (l.isDate(h))
872
872
  return h.toISOString();
873
+ if (l.isBoolean(h))
874
+ return h.toString();
873
875
  if (!u && l.isBlob(h))
874
876
  throw new w("Blob is not supported. Use a Buffer instead.");
875
877
  return l.isArrayBuffer(h) || l.isTypedArray(h) ? u && typeof Blob == "function" ? new Blob([h]) : Buffer.from(h) : h;
@@ -880,10 +882,10 @@ function Se(e, t, n) {
880
882
  if (l.endsWith(g, "{}"))
881
883
  g = r ? g : g.slice(0, -2), h = JSON.stringify(h);
882
884
  else if (l.isArray(h) && Lr(h) || (l.isFileList(h) || l.endsWith(g, "[]")) && (y = l.toArray(h)))
883
- return g = Ht(g), y.forEach(function(b, j) {
885
+ return g = Ht(g), y.forEach(function(b, v) {
884
886
  !(l.isUndefined(b) || b === null) && t.append(
885
887
  // eslint-disable-next-line no-nested-ternary
886
- i === !0 ? st([g], j, o) : i === null ? g : g + "[]",
888
+ i === !0 ? st([g], v, o) : i === null ? g : g + "[]",
887
889
  c(b)
888
890
  );
889
891
  }), !1;
@@ -1192,7 +1194,7 @@ function Xr(e) {
1192
1194
  return t;
1193
1195
  }
1194
1196
  const Yr = (e) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());
1195
- function ve(e, t, n, r, s) {
1197
+ function je(e, t, n, r, s) {
1196
1198
  if (l.isFunction(r))
1197
1199
  return r.call(this, t, n);
1198
1200
  if (s && (t = n), !!l.isString(t)) {
@@ -1266,7 +1268,7 @@ let P = class {
1266
1268
  has(t, n) {
1267
1269
  if (t = Y(t), t) {
1268
1270
  const r = l.findKey(this, t);
1269
- return !!(r && this[r] !== void 0 && (!n || ve(this, this[r], r, n)));
1271
+ return !!(r && this[r] !== void 0 && (!n || je(this, this[r], r, n)));
1270
1272
  }
1271
1273
  return !1;
1272
1274
  }
@@ -1276,7 +1278,7 @@ let P = class {
1276
1278
  function o(i) {
1277
1279
  if (i = Y(i), i) {
1278
1280
  const a = l.findKey(r, i);
1279
- a && (!n || ve(r, r[a], a, n)) && (delete r[a], s = !0);
1281
+ a && (!n || je(r, r[a], a, n)) && (delete r[a], s = !0);
1280
1282
  }
1281
1283
  }
1282
1284
  return l.isArray(t) ? t.forEach(o) : o(t), s;
@@ -1286,7 +1288,7 @@ let P = class {
1286
1288
  let r = n.length, s = !1;
1287
1289
  for (; r--; ) {
1288
1290
  const o = n[r];
1289
- (!t || ve(this, this[o], o, t, !0)) && (delete this[o], s = !0);
1291
+ (!t || je(this, this[o], o, t, !0)) && (delete this[o], s = !0);
1290
1292
  }
1291
1293
  return s;
1292
1294
  }
@@ -1353,7 +1355,7 @@ l.reduceDescriptors(P.prototype, ({ value: e }, t) => {
1353
1355
  };
1354
1356
  });
1355
1357
  l.freezeMethods(P);
1356
- function je(e, t) {
1358
+ function ve(e, t) {
1357
1359
  const n = this || oe, r = t || n, s = P.from(r.headers);
1358
1360
  let o = r.data;
1359
1361
  return l.forEach(e, function(a) {
@@ -1600,16 +1602,16 @@ const Yt = (e) => {
1600
1602
  }, p.onerror = function() {
1601
1603
  r(new w("Network Error", w.ERR_NETWORK, e, p)), p = null;
1602
1604
  }, p.ontimeout = function() {
1603
- let j = s.timeout ? "timeout of " + s.timeout + "ms exceeded" : "timeout exceeded";
1605
+ let v = s.timeout ? "timeout of " + s.timeout + "ms exceeded" : "timeout exceeded";
1604
1606
  const T = s.transitional || Wt;
1605
- s.timeoutErrorMessage && (j = s.timeoutErrorMessage), r(new w(
1606
- j,
1607
+ s.timeoutErrorMessage && (v = s.timeoutErrorMessage), r(new w(
1608
+ v,
1607
1609
  T.clarifyTimeoutError ? w.ETIMEDOUT : w.ECONNABORTED,
1608
1610
  e,
1609
1611
  p
1610
1612
  )), p = null;
1611
- }, o === void 0 && i.setContentType(null), "setRequestHeader" in p && l.forEach(i.toJSON(), function(j, T) {
1612
- p.setRequestHeader(T, j);
1613
+ }, o === void 0 && i.setContentType(null), "setRequestHeader" in p && l.forEach(i.toJSON(), function(v, T) {
1614
+ p.setRequestHeader(T, v);
1613
1615
  }), l.isUndefined(s.withCredentials) || (p.withCredentials = !!s.withCredentials), a && a !== "json" && (p.responseType = s.responseType), c && ([m, h] = me(c, !0), p.addEventListener("progress", m)), u && p.upload && ([d, E] = me(u), p.upload.addEventListener("progress", d), p.upload.addEventListener("loadend", E)), (s.cancelToken || s.signal) && (f = (b) => {
1614
1616
  p && (r(!b || b.type ? new V(null, e, p) : b), p.abort(), p = null);
1615
1617
  }, s.cancelToken && s.cancelToken.subscribe(f), s.signal && (s.signal.aborted ? f() : s.signal.addEventListener("abort", f)));
@@ -1790,7 +1792,7 @@ const ps = async (e) => {
1790
1792
  duplex: "half",
1791
1793
  credentials: y ? d : void 0
1792
1794
  });
1793
- let S = await fetch(h);
1795
+ let S = await fetch(h, m);
1794
1796
  const b = He && (c === "stream" || c === "response");
1795
1797
  if (He && (a || b && g)) {
1796
1798
  const T = {};
@@ -1809,10 +1811,10 @@ const ps = async (e) => {
1809
1811
  );
1810
1812
  }
1811
1813
  c = c || "text";
1812
- let j = await ge[l.findKey(ge, c) || "text"](S, e);
1814
+ let v = await ge[l.findKey(ge, c) || "text"](S, e);
1813
1815
  return !b && g && g(), await new Promise((T, F) => {
1814
1816
  Vt(T, F, {
1815
- data: j,
1817
+ data: v,
1816
1818
  headers: P.from(S.headers),
1817
1819
  status: S.status,
1818
1820
  statusText: S.statusText,
@@ -1829,7 +1831,7 @@ const ps = async (e) => {
1829
1831
  ) : w.from(y, y && y.code, e, h);
1830
1832
  }
1831
1833
  }), $e = {
1832
- http: jr,
1834
+ http: vr,
1833
1835
  xhr: as,
1834
1836
  fetch: gs
1835
1837
  };
@@ -1878,24 +1880,24 @@ function Le(e) {
1878
1880
  throw new V(null, e);
1879
1881
  }
1880
1882
  function pt(e) {
1881
- return Le(e), e.headers = P.from(e.headers), e.data = je.call(
1883
+ return Le(e), e.headers = P.from(e.headers), e.data = ve.call(
1882
1884
  e,
1883
1885
  e.transformRequest
1884
1886
  ), ["post", "put", "patch"].indexOf(e.method) !== -1 && e.headers.setContentType("application/x-www-form-urlencoded", !1), Zt.getAdapter(e.adapter || oe.adapter)(e).then(function(r) {
1885
- return Le(e), r.data = je.call(
1887
+ return Le(e), r.data = ve.call(
1886
1888
  e,
1887
1889
  e.transformResponse,
1888
1890
  r
1889
1891
  ), r.headers = P.from(r.headers), r;
1890
1892
  }, function(r) {
1891
- return Kt(r) || (Le(e), r && r.response && (r.response.data = je.call(
1893
+ return Kt(r) || (Le(e), r && r.response && (r.response.data = ve.call(
1892
1894
  e,
1893
1895
  e.transformResponse,
1894
1896
  r.response
1895
1897
  ), r.response.headers = P.from(r.response.headers))), Promise.reject(r);
1896
1898
  });
1897
1899
  }
1898
- const en = "1.9.0", Oe = {};
1900
+ const en = "1.10.0", Oe = {};
1899
1901
  ["object", "boolean", "number", "function", "string", "symbol"].forEach((e, t) => {
1900
1902
  Oe[e] = function(r) {
1901
1903
  return typeof r === e || "a" + (t < 1 ? "n " : " ") + e;
@@ -2267,13 +2269,13 @@ const {
2267
2269
  }, _s = ["put", "post", "patch"], gt = "Local-Request-Id", Os = 100, Ts = 300;
2268
2270
  let As = class {
2269
2271
  constructor(t = {}) {
2270
- v(this, "axios");
2271
- v(this, "settings");
2272
- v(this, "records", {});
2273
- v(this, "isLoading", !1);
2274
- v(this, "stopSkipWarn");
2275
- v(this, "showLoading");
2276
- v(this, "showError");
2272
+ j(this, "axios");
2273
+ j(this, "settings");
2274
+ j(this, "records", {});
2275
+ j(this, "isLoading", !1);
2276
+ j(this, "stopSkipWarn");
2277
+ j(this, "showLoading");
2278
+ j(this, "showError");
2277
2279
  this.settings = Object.assign({ type: "form" }, t.settings || {});
2278
2280
  const n = Te(t, [
2279
2281
  "settings",
@@ -2518,15 +2520,15 @@ function Oo(e, t) {
2518
2520
  return n.lastModified = Date.now(), n.lastModifiedDate = /* @__PURE__ */ new Date(), n.name = t, n;
2519
2521
  }
2520
2522
  const To = (e) => ne ? window.requestAnimationFrame(e) : setTimeout(e, 16), Ao = (e) => ne ? window.cancelAnimationFrame(e) : clearTimeout(e);
2521
- class vs {
2523
+ class js {
2522
2524
  constructor(t = {}) {
2523
- v(this, "options", {
2525
+ j(this, "options", {
2524
2526
  type: "cache",
2525
2527
  expired: 0,
2526
2528
  prefix: "__VTJ_"
2527
2529
  });
2528
- v(this, "caches", {});
2529
- v(this, "types");
2530
+ j(this, "caches", {});
2531
+ j(this, "types");
2530
2532
  this.types = {
2531
2533
  local: ne ? window.localStorage : this.caches,
2532
2534
  session: ne ? window.sessionStorage : this.caches,
@@ -2566,16 +2568,16 @@ class vs {
2566
2568
  r === this.caches ? this.caches = {} : r.clear();
2567
2569
  }
2568
2570
  }
2569
- const xo = new vs();
2571
+ const xo = new js();
2570
2572
  function rn(e) {
2571
2573
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
2572
2574
  }
2573
- var Q = { exports: {} }, js = Q.exports, wt;
2575
+ var Q = { exports: {} }, vs = Q.exports, wt;
2574
2576
  function Ls() {
2575
2577
  return wt || (wt = 1, function(e, t) {
2576
2578
  (function(n, r) {
2577
2579
  r(t, e);
2578
- })(js, function(n, r) {
2580
+ })(vs, function(n, r) {
2579
2581
  var s = {
2580
2582
  timeout: 5e3,
2581
2583
  jsonpCallback: "callback"
@@ -2598,12 +2600,12 @@ function Ls() {
2598
2600
  var f = arguments.length <= 1 || arguments[1] === void 0 ? {} : arguments[1], d = c, m = f.timeout || s.timeout, E = f.jsonpCallback || s.jsonpCallback, h = void 0;
2599
2601
  return new Promise(function(g, p) {
2600
2602
  var y = f.jsonpCallbackFunction || o(), S = E + "_" + y;
2601
- window[y] = function(j) {
2603
+ window[y] = function(v) {
2602
2604
  g({
2603
2605
  ok: !0,
2604
2606
  // keep consistent with fetch API
2605
2607
  json: function() {
2606
- return Promise.resolve(j);
2608
+ return Promise.resolve(v);
2607
2609
  }
2608
2610
  }), h && clearTimeout(h), a(S), i(y);
2609
2611
  }, d += d.indexOf("?") === -1 ? "?" : "&";
@@ -2701,7 +2703,7 @@ function Bs() {
2701
2703
  }
2702
2704
  var Ms = Bs();
2703
2705
  const Is = /* @__PURE__ */ rn(Ms);
2704
- function vo(e, t = {}) {
2706
+ function jo(e, t = {}) {
2705
2707
  return new Promise((n, r) => {
2706
2708
  const { library: s } = t;
2707
2709
  Is(e, t, (o, i) => {
@@ -2743,8 +2745,8 @@ const $s = {
2743
2745
  };
2744
2746
  class Js {
2745
2747
  constructor(t) {
2746
- v(this, "config");
2747
- v(this, "options");
2748
+ j(this, "config");
2749
+ j(this, "options");
2748
2750
  this.options = { ...$s, ...t };
2749
2751
  const n = typeof location < "u" ? location : {}, r = (/__(?:logConf|logLevel)__=([^#/&]*)/.exec(
2750
2752
  n.href
@@ -2774,7 +2776,7 @@ class Js {
2774
2776
  function Ws(e) {
2775
2777
  return new Js(e);
2776
2778
  }
2777
- const jo = Ws({ level: "log", bizName: "VTJ" });
2779
+ const vo = Ws({ level: "log", bizName: "VTJ" });
2778
2780
  /*! js-cookie v3.0.5 | MIT */
2779
2781
  function le(e) {
2780
2782
  for (var t = 1; t < arguments.length; t++) {
@@ -2950,7 +2952,7 @@ export {
2950
2952
  gt as LOCAL_REQUEST_ID,
2951
2953
  Js as Logger,
2952
2954
  As as Request,
2953
- vs as Storage,
2955
+ js as Storage,
2954
2956
  Qs as VTJ_UTILS_VERSION,
2955
2957
  _ as axios,
2956
2958
  Oo as blobToFile,
@@ -2970,8 +2972,8 @@ export {
2970
2972
  Ws as getLogger,
2971
2973
  ne as isClient,
2972
2974
  Po as jsonp,
2973
- vo as loadScript,
2974
- jo as logger,
2975
+ jo as loadScript,
2976
+ vo as logger,
2975
2977
  To as rAF,
2976
2978
  Cs as request,
2977
2979
  xo as storage,