@vtj/utils 0.12.42 → 0.12.44
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 +8 -8
- package/dist/index.iife.js +4 -4
- package/dist/index.mjs +60 -59
- package/dist/index.umd.js +4 -4
- package/package.json +1 -1
- package/types/version.d.ts +2 -2
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
|
3
|
+
var v = (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,12 +15,12 @@ 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.
|
18
|
+
* @version 0.12.44
|
19
19
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
20
20
|
*/
|
21
|
-
const Qs = "0.12.
|
21
|
+
const Qs = "0.12.44";
|
22
22
|
/**
|
23
|
-
* @vue/shared v3.5.
|
23
|
+
* @vue/shared v3.5.17
|
24
24
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
25
25
|
* @license MIT
|
26
26
|
**/
|
@@ -66,8 +66,9 @@ function An() {
|
|
66
66
|
pe = e === void 0 ? !0 : e;
|
67
67
|
}
|
68
68
|
class _t {
|
69
|
+
// TODO isolatedDeclarations "__v_skip"
|
69
70
|
constructor(t) {
|
70
|
-
this.computed = t, this.version = 0, this.activeLink = void 0, this.subs = void 0, this.map = void 0, this.key = void 0, this.sc = 0;
|
71
|
+
this.computed = t, this.version = 0, this.activeLink = void 0, this.subs = void 0, this.map = void 0, this.key = void 0, this.sc = 0, this.__v_skip = !0;
|
71
72
|
}
|
72
73
|
track(t) {
|
73
74
|
}
|
@@ -273,7 +274,7 @@ function X(e, t, n = []) {
|
|
273
274
|
const Pn = /* @__PURE__ */ wn("__proto__,__v_isRef,__isVue"), Ot = new Set(
|
274
275
|
/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((e) => e !== "arguments" && e !== "caller").map((e) => Symbol[e]).filter(re)
|
275
276
|
);
|
276
|
-
function
|
277
|
+
function vn(e) {
|
277
278
|
re(e) || (e = String(e));
|
278
279
|
const t = R(this);
|
279
280
|
return x(t, "has", e), t.hasOwnProperty(e);
|
@@ -301,7 +302,7 @@ class Tt {
|
|
301
302
|
if (i && (u = xn[n]))
|
302
303
|
return u;
|
303
304
|
if (n === "hasOwnProperty")
|
304
|
-
return
|
305
|
+
return vn;
|
305
306
|
}
|
306
307
|
const a = Reflect.get(
|
307
308
|
t,
|
@@ -311,10 +312,10 @@ class Tt {
|
|
311
312
|
// its class methods
|
312
313
|
W(t) ? t : r
|
313
314
|
);
|
314
|
-
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 ?
|
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
316
|
}
|
316
317
|
}
|
317
|
-
class
|
318
|
+
class jn extends Tt {
|
318
319
|
constructor(t = !1) {
|
319
320
|
super(!1, t);
|
320
321
|
}
|
@@ -362,7 +363,7 @@ class Ln extends Tt {
|
|
362
363
|
return !0;
|
363
364
|
}
|
364
365
|
}
|
365
|
-
const Nn = /* @__PURE__ */ new
|
366
|
+
const Nn = /* @__PURE__ */ new jn(), Un = /* @__PURE__ */ new Ln(), Be = (e) => e, ae = (e) => Reflect.getPrototypeOf(e);
|
366
367
|
function Fn(e, t, n) {
|
367
368
|
return function(...r) {
|
368
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;
|
@@ -494,7 +495,7 @@ function Hn(e) {
|
|
494
495
|
return e.__v_skip || !Object.isExtensible(e) ? 0 : qn(Sn(e));
|
495
496
|
}
|
496
497
|
function Pt(e) {
|
497
|
-
return z(e) ? e :
|
498
|
+
return z(e) ? e : jt(
|
498
499
|
e,
|
499
500
|
!1,
|
500
501
|
Nn,
|
@@ -502,8 +503,8 @@ function Pt(e) {
|
|
502
503
|
xt
|
503
504
|
);
|
504
505
|
}
|
505
|
-
function
|
506
|
-
return
|
506
|
+
function vt(e) {
|
507
|
+
return jt(
|
507
508
|
e,
|
508
509
|
!0,
|
509
510
|
Un,
|
@@ -511,7 +512,7 @@ function jt(e) {
|
|
511
512
|
Ct
|
512
513
|
);
|
513
514
|
}
|
514
|
-
function
|
515
|
+
function jt(e, t, n, r, s) {
|
515
516
|
if (!we(e) || e.__v_raw && !(t && e.__v_isReactive))
|
516
517
|
return e;
|
517
518
|
const o = Hn(e);
|
@@ -539,7 +540,7 @@ function R(e) {
|
|
539
540
|
const t = e && e.__v_raw;
|
540
541
|
return t ? R(t) : e;
|
541
542
|
}
|
542
|
-
const A = (e) => we(e) ? Pt(e) : e, Me = (e) => we(e) ?
|
543
|
+
const A = (e) => we(e) ? Pt(e) : e, Me = (e) => we(e) ? vt(e) : e;
|
543
544
|
function W(e) {
|
544
545
|
return e ? e.__v_isRef === !0 : !1;
|
545
546
|
}
|
@@ -725,7 +726,7 @@ const Ar = (e) => {
|
|
725
726
|
}))(`axios@${Math.random()}`, []) : (n) => setTimeout(n))(
|
726
727
|
typeof setImmediate == "function",
|
727
728
|
C(I.postMessage)
|
728
|
-
), Pr = typeof queueMicrotask < "u" ? queueMicrotask.bind(I) : typeof process < "u" && process.nextTick || It,
|
729
|
+
), Pr = typeof queueMicrotask < "u" ? queueMicrotask.bind(I) : typeof process < "u" && process.nextTick || It, vr = (e) => e != null && C(e[ye]), l = {
|
729
730
|
isArray: K,
|
730
731
|
isArrayBuffer: Ut,
|
731
732
|
isBuffer: Kn,
|
@@ -782,7 +783,7 @@ const Ar = (e) => {
|
|
782
783
|
isThenable: Cr,
|
783
784
|
setImmediate: It,
|
784
785
|
asap: Pr,
|
785
|
-
isIterable:
|
786
|
+
isIterable: vr
|
786
787
|
};
|
787
788
|
function w(e, t, n, r, s) {
|
788
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);
|
@@ -834,7 +835,7 @@ w.from = (e, t, n, r, s, o) => {
|
|
834
835
|
return u !== Error.prototype;
|
835
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;
|
836
837
|
};
|
837
|
-
const
|
838
|
+
const jr = null;
|
838
839
|
function ke(e) {
|
839
840
|
return l.isPlainObject(e) || l.isArray(e);
|
840
841
|
}
|
@@ -879,10 +880,10 @@ function Se(e, t, n) {
|
|
879
880
|
if (l.endsWith(g, "{}"))
|
880
881
|
g = r ? g : g.slice(0, -2), h = JSON.stringify(h);
|
881
882
|
else if (l.isArray(h) && Lr(h) || (l.isFileList(h) || l.endsWith(g, "[]")) && (y = l.toArray(h)))
|
882
|
-
return g = Ht(g), y.forEach(function(b,
|
883
|
+
return g = Ht(g), y.forEach(function(b, j) {
|
883
884
|
!(l.isUndefined(b) || b === null) && t.append(
|
884
885
|
// eslint-disable-next-line no-nested-ternary
|
885
|
-
i === !0 ? st([g],
|
886
|
+
i === !0 ? st([g], j, o) : i === null ? g : g + "[]",
|
886
887
|
c(b)
|
887
888
|
);
|
888
889
|
}), !1;
|
@@ -1191,7 +1192,7 @@ function Xr(e) {
|
|
1191
1192
|
return t;
|
1192
1193
|
}
|
1193
1194
|
const Yr = (e) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());
|
1194
|
-
function
|
1195
|
+
function ve(e, t, n, r, s) {
|
1195
1196
|
if (l.isFunction(r))
|
1196
1197
|
return r.call(this, t, n);
|
1197
1198
|
if (s && (t = n), !!l.isString(t)) {
|
@@ -1265,7 +1266,7 @@ let P = class {
|
|
1265
1266
|
has(t, n) {
|
1266
1267
|
if (t = Y(t), t) {
|
1267
1268
|
const r = l.findKey(this, t);
|
1268
|
-
return !!(r && this[r] !== void 0 && (!n ||
|
1269
|
+
return !!(r && this[r] !== void 0 && (!n || ve(this, this[r], r, n)));
|
1269
1270
|
}
|
1270
1271
|
return !1;
|
1271
1272
|
}
|
@@ -1275,7 +1276,7 @@ let P = class {
|
|
1275
1276
|
function o(i) {
|
1276
1277
|
if (i = Y(i), i) {
|
1277
1278
|
const a = l.findKey(r, i);
|
1278
|
-
a && (!n ||
|
1279
|
+
a && (!n || ve(r, r[a], a, n)) && (delete r[a], s = !0);
|
1279
1280
|
}
|
1280
1281
|
}
|
1281
1282
|
return l.isArray(t) ? t.forEach(o) : o(t), s;
|
@@ -1285,7 +1286,7 @@ let P = class {
|
|
1285
1286
|
let r = n.length, s = !1;
|
1286
1287
|
for (; r--; ) {
|
1287
1288
|
const o = n[r];
|
1288
|
-
(!t ||
|
1289
|
+
(!t || ve(this, this[o], o, t, !0)) && (delete this[o], s = !0);
|
1289
1290
|
}
|
1290
1291
|
return s;
|
1291
1292
|
}
|
@@ -1352,7 +1353,7 @@ l.reduceDescriptors(P.prototype, ({ value: e }, t) => {
|
|
1352
1353
|
};
|
1353
1354
|
});
|
1354
1355
|
l.freezeMethods(P);
|
1355
|
-
function
|
1356
|
+
function je(e, t) {
|
1356
1357
|
const n = this || oe, r = t || n, s = P.from(r.headers);
|
1357
1358
|
let o = r.data;
|
1358
1359
|
return l.forEach(e, function(a) {
|
@@ -1599,16 +1600,16 @@ const Yt = (e) => {
|
|
1599
1600
|
}, p.onerror = function() {
|
1600
1601
|
r(new w("Network Error", w.ERR_NETWORK, e, p)), p = null;
|
1601
1602
|
}, p.ontimeout = function() {
|
1602
|
-
let
|
1603
|
+
let j = s.timeout ? "timeout of " + s.timeout + "ms exceeded" : "timeout exceeded";
|
1603
1604
|
const T = s.transitional || Wt;
|
1604
|
-
s.timeoutErrorMessage && (
|
1605
|
-
|
1605
|
+
s.timeoutErrorMessage && (j = s.timeoutErrorMessage), r(new w(
|
1606
|
+
j,
|
1606
1607
|
T.clarifyTimeoutError ? w.ETIMEDOUT : w.ECONNABORTED,
|
1607
1608
|
e,
|
1608
1609
|
p
|
1609
1610
|
)), p = null;
|
1610
|
-
}, o === void 0 && i.setContentType(null), "setRequestHeader" in p && l.forEach(i.toJSON(), function(
|
1611
|
-
p.setRequestHeader(T,
|
1611
|
+
}, o === void 0 && i.setContentType(null), "setRequestHeader" in p && l.forEach(i.toJSON(), function(j, T) {
|
1612
|
+
p.setRequestHeader(T, j);
|
1612
1613
|
}), 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) => {
|
1613
1614
|
p && (r(!b || b.type ? new V(null, e, p) : b), p.abort(), p = null);
|
1614
1615
|
}, s.cancelToken && s.cancelToken.subscribe(f), s.signal && (s.signal.aborted ? f() : s.signal.addEventListener("abort", f)));
|
@@ -1808,10 +1809,10 @@ const ps = async (e) => {
|
|
1808
1809
|
);
|
1809
1810
|
}
|
1810
1811
|
c = c || "text";
|
1811
|
-
let
|
1812
|
+
let j = await ge[l.findKey(ge, c) || "text"](S, e);
|
1812
1813
|
return !b && g && g(), await new Promise((T, F) => {
|
1813
1814
|
Vt(T, F, {
|
1814
|
-
data:
|
1815
|
+
data: j,
|
1815
1816
|
headers: P.from(S.headers),
|
1816
1817
|
status: S.status,
|
1817
1818
|
statusText: S.statusText,
|
@@ -1828,7 +1829,7 @@ const ps = async (e) => {
|
|
1828
1829
|
) : w.from(y, y && y.code, e, h);
|
1829
1830
|
}
|
1830
1831
|
}), $e = {
|
1831
|
-
http:
|
1832
|
+
http: jr,
|
1832
1833
|
xhr: as,
|
1833
1834
|
fetch: gs
|
1834
1835
|
};
|
@@ -1877,17 +1878,17 @@ function Le(e) {
|
|
1877
1878
|
throw new V(null, e);
|
1878
1879
|
}
|
1879
1880
|
function pt(e) {
|
1880
|
-
return Le(e), e.headers = P.from(e.headers), e.data =
|
1881
|
+
return Le(e), e.headers = P.from(e.headers), e.data = je.call(
|
1881
1882
|
e,
|
1882
1883
|
e.transformRequest
|
1883
1884
|
), ["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) {
|
1884
|
-
return Le(e), r.data =
|
1885
|
+
return Le(e), r.data = je.call(
|
1885
1886
|
e,
|
1886
1887
|
e.transformResponse,
|
1887
1888
|
r
|
1888
1889
|
), r.headers = P.from(r.headers), r;
|
1889
1890
|
}, function(r) {
|
1890
|
-
return Kt(r) || (Le(e), r && r.response && (r.response.data =
|
1891
|
+
return Kt(r) || (Le(e), r && r.response && (r.response.data = je.call(
|
1891
1892
|
e,
|
1892
1893
|
e.transformResponse,
|
1893
1894
|
r.response
|
@@ -2266,13 +2267,13 @@ const {
|
|
2266
2267
|
}, _s = ["put", "post", "patch"], gt = "Local-Request-Id", Os = 100, Ts = 300;
|
2267
2268
|
let As = class {
|
2268
2269
|
constructor(t = {}) {
|
2269
|
-
|
2270
|
-
|
2271
|
-
|
2272
|
-
|
2273
|
-
|
2274
|
-
|
2275
|
-
|
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");
|
2276
2277
|
this.settings = Object.assign({ type: "form" }, t.settings || {});
|
2277
2278
|
const n = Te(t, [
|
2278
2279
|
"settings",
|
@@ -2517,15 +2518,15 @@ function Oo(e, t) {
|
|
2517
2518
|
return n.lastModified = Date.now(), n.lastModifiedDate = /* @__PURE__ */ new Date(), n.name = t, n;
|
2518
2519
|
}
|
2519
2520
|
const To = (e) => ne ? window.requestAnimationFrame(e) : setTimeout(e, 16), Ao = (e) => ne ? window.cancelAnimationFrame(e) : clearTimeout(e);
|
2520
|
-
class
|
2521
|
+
class vs {
|
2521
2522
|
constructor(t = {}) {
|
2522
|
-
|
2523
|
+
v(this, "options", {
|
2523
2524
|
type: "cache",
|
2524
2525
|
expired: 0,
|
2525
2526
|
prefix: "__VTJ_"
|
2526
2527
|
});
|
2527
|
-
|
2528
|
-
|
2528
|
+
v(this, "caches", {});
|
2529
|
+
v(this, "types");
|
2529
2530
|
this.types = {
|
2530
2531
|
local: ne ? window.localStorage : this.caches,
|
2531
2532
|
session: ne ? window.sessionStorage : this.caches,
|
@@ -2565,16 +2566,16 @@ class js {
|
|
2565
2566
|
r === this.caches ? this.caches = {} : r.clear();
|
2566
2567
|
}
|
2567
2568
|
}
|
2568
|
-
const xo = new
|
2569
|
+
const xo = new vs();
|
2569
2570
|
function rn(e) {
|
2570
2571
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
2571
2572
|
}
|
2572
|
-
var Q = { exports: {} },
|
2573
|
+
var Q = { exports: {} }, js = Q.exports, wt;
|
2573
2574
|
function Ls() {
|
2574
2575
|
return wt || (wt = 1, function(e, t) {
|
2575
2576
|
(function(n, r) {
|
2576
2577
|
r(t, e);
|
2577
|
-
})(
|
2578
|
+
})(js, function(n, r) {
|
2578
2579
|
var s = {
|
2579
2580
|
timeout: 5e3,
|
2580
2581
|
jsonpCallback: "callback"
|
@@ -2597,12 +2598,12 @@ function Ls() {
|
|
2597
2598
|
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;
|
2598
2599
|
return new Promise(function(g, p) {
|
2599
2600
|
var y = f.jsonpCallbackFunction || o(), S = E + "_" + y;
|
2600
|
-
window[y] = function(
|
2601
|
+
window[y] = function(j) {
|
2601
2602
|
g({
|
2602
2603
|
ok: !0,
|
2603
2604
|
// keep consistent with fetch API
|
2604
2605
|
json: function() {
|
2605
|
-
return Promise.resolve(
|
2606
|
+
return Promise.resolve(j);
|
2606
2607
|
}
|
2607
2608
|
}), h && clearTimeout(h), a(S), i(y);
|
2608
2609
|
}, d += d.indexOf("?") === -1 ? "?" : "&";
|
@@ -2700,7 +2701,7 @@ function Bs() {
|
|
2700
2701
|
}
|
2701
2702
|
var Ms = Bs();
|
2702
2703
|
const Is = /* @__PURE__ */ rn(Ms);
|
2703
|
-
function
|
2704
|
+
function vo(e, t = {}) {
|
2704
2705
|
return new Promise((n, r) => {
|
2705
2706
|
const { library: s } = t;
|
2706
2707
|
Is(e, t, (o, i) => {
|
@@ -2742,8 +2743,8 @@ const $s = {
|
|
2742
2743
|
};
|
2743
2744
|
class Js {
|
2744
2745
|
constructor(t) {
|
2745
|
-
|
2746
|
-
|
2746
|
+
v(this, "config");
|
2747
|
+
v(this, "options");
|
2747
2748
|
this.options = { ...$s, ...t };
|
2748
2749
|
const n = typeof location < "u" ? location : {}, r = (/__(?:logConf|logLevel)__=([^#/&]*)/.exec(
|
2749
2750
|
n.href
|
@@ -2773,7 +2774,7 @@ class Js {
|
|
2773
2774
|
function Ws(e) {
|
2774
2775
|
return new Js(e);
|
2775
2776
|
}
|
2776
|
-
const
|
2777
|
+
const jo = Ws({ level: "log", bizName: "VTJ" });
|
2777
2778
|
/*! js-cookie v3.0.5 | MIT */
|
2778
2779
|
function le(e) {
|
2779
2780
|
for (var t = 1; t < arguments.length; t++) {
|
@@ -2949,7 +2950,7 @@ export {
|
|
2949
2950
|
gt as LOCAL_REQUEST_ID,
|
2950
2951
|
Js as Logger,
|
2951
2952
|
As as Request,
|
2952
|
-
|
2953
|
+
vs as Storage,
|
2953
2954
|
Qs as VTJ_UTILS_VERSION,
|
2954
2955
|
_ as axios,
|
2955
2956
|
Oo as blobToFile,
|
@@ -2969,8 +2970,8 @@ export {
|
|
2969
2970
|
Ws as getLogger,
|
2970
2971
|
ne as isClient,
|
2971
2972
|
Po as jsonp,
|
2972
|
-
|
2973
|
-
|
2973
|
+
vo as loadScript,
|
2974
|
+
jo as logger,
|
2974
2975
|
To as rAF,
|
2975
2976
|
Cs as request,
|
2976
2977
|
xo as storage,
|