mvframe 1.0.20 → 1.0.60

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.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import "./util.js";
2
2
  import "./directive.js";
3
3
  import "./store-shared.js";
4
- import { h as m, i as o, g as n, a as r, m as g, b as l, c as u, n as L, p as M, u as c } from "./vendor.js";
4
+ import { j as m, k as o, g as n, a as r, m as g, b as l, c as u, n as L, p as M, u as c } from "./vendor.js";
5
5
  import "./composition.js";
6
6
  export {
7
7
  m as builtinLocales,
package/dist/lodash.js CHANGED
@@ -1,4 +1,4 @@
1
- import { e as f, d as Cr } from "./vendor.js";
1
+ import { f, d as Cr } from "./vendor.js";
2
2
  var d, ye;
3
3
  function le() {
4
4
  if (ye) return d;
package/dist/maps.js CHANGED
@@ -1,10 +1,11 @@
1
- import { f as p, a as e, m, b as t, c as g, p as M, u as f } from "./vendor.js";
1
+ import { h as p, a as e, i as m, m as t, b as g, c as u, p as M, u as h } from "./vendor.js";
2
2
  export {
3
3
  p as default,
4
4
  e as getMaps,
5
- m as mapLang,
6
- t as mapLangPath,
7
- g as mergeMaps,
5
+ m as mapJumpKeys,
6
+ t as mapLang,
7
+ g as mapLangPath,
8
+ u as mergeMaps,
8
9
  M as patchMaps,
9
- f as useMap
10
+ h as useMap
10
11
  };
@@ -1,9 +1,9 @@
1
- import { createPinia as p, defineStore as h } from "pinia";
2
- const T = () => ({
1
+ import { createPinia as w, defineStore as g } from "pinia";
2
+ const O = () => ({
3
3
  lang: "en_us",
4
4
  /** 路由切换 / 异步页面 chunk 加载期间为 true,由 router guard 维护 */
5
5
  pageLoading: !1
6
- }), y = {
6
+ }), q = {
7
7
  saveData(t, e) {
8
8
  this[t] = e;
9
9
  },
@@ -13,16 +13,16 @@ const T = () => ({
13
13
  setPageLoading(t) {
14
14
  this.pageLoading = !!t;
15
15
  }
16
- }, $ = {
17
- state: T,
18
- actions: y
19
- }, d = () => ({
16
+ }, E = {
17
+ state: O,
18
+ actions: q
19
+ }, m = (t) => t && typeof t == "object" ? t : {}, p = (t) => t && typeof t == "object" ? t : {}, L = () => ({
20
20
  useTab: !1,
21
21
  // 是否使用tab
22
22
  tabs: [],
23
23
  ctab: {}
24
24
  // current tab
25
- }), S = {
25
+ }), N = {
26
26
  saveData(t, e) {
27
27
  this[t] = e;
28
28
  },
@@ -31,26 +31,40 @@ const T = () => ({
31
31
  },
32
32
  saveTab(t) {
33
33
  const { data: e, index: s } = this.tabs.filter1((r) => r.name === t.name);
34
- if (e)
35
- if (JSON.stringify(e.params) === JSON.stringify(t.params) && JSON.stringify(e.query) === JSON.stringify(t.query)) {
34
+ if (e) {
35
+ const r = JSON.stringify(m(e.params)) === JSON.stringify(m(t.params)), h = JSON.stringify(p(e.query)) === JSON.stringify(p(t.query));
36
+ if (r && h) {
36
37
  this.saveCurrentTab(e);
37
38
  return;
38
- } else
39
- this.closeTab(e, s);
40
- const { fullPath: a, name: n, meta: i, params: c, query: u } = t;
41
- if (n !== "Login") {
39
+ }
40
+ const { fullPath: u, name: y, meta: c, params: S, query: v } = t, l = u.split("/");
41
+ let f;
42
+ l[l.length - 1] === "Home" ? f = l[l.length - 2] : f = l[l.length - 1], c != null && c.icon && (f = c.icon);
43
+ const T = {
44
+ name: y,
45
+ meta: c ?? e.meta,
46
+ path: l,
47
+ params: m(S),
48
+ query: p(v),
49
+ icon: f
50
+ };
51
+ this.tabs.splice(s, 1, T), this.saveCurrentTab(T);
52
+ return;
53
+ }
54
+ const { fullPath: a, name: i, meta: n, params: b, query: $ } = t;
55
+ if (i !== "Login") {
42
56
  const r = a.split("/");
43
- let l;
44
- r[r.length - 1] === "Home" ? l = r[r.length - 2] : l = r[r.length - 1], i.icon && (l = i.icon);
45
- const b = {
46
- name: n,
47
- meta: i,
57
+ let h;
58
+ r[r.length - 1] === "Home" ? h = r[r.length - 2] : h = r[r.length - 1], n != null && n.icon && (h = n.icon);
59
+ const u = {
60
+ name: i,
61
+ meta: n,
48
62
  path: r,
49
- params: c,
50
- query: u,
51
- icon: l
52
- }, { index: m } = this.tabs.filter1((g) => g.name === this.ctab.name);
53
- this.tabs.splice(m + 1, 0, b), this.saveCurrentTab(b);
63
+ params: m(b),
64
+ query: p($),
65
+ icon: h
66
+ }, { index: y } = this.tabs.filter1((c) => c.name === this.ctab.name);
67
+ this.tabs.splice(y + 1, 0, u), this.saveCurrentTab(u);
54
68
  }
55
69
  },
56
70
  closeTab(t, e) {
@@ -58,20 +72,20 @@ const T = () => ({
58
72
  this.tabs.splice(e, 1), t.name === this.ctab.name && ((s = globalThis.$router) == null || s.push({ name: this.tabs[e - 1 > 0 ? e - 1 : 0].name }));
59
73
  },
60
74
  closeRightTab(t, e) {
61
- var n;
75
+ var i;
62
76
  const s = [];
63
77
  let a = !1;
64
- this.tabs.forEach((i, c) => {
65
- e >= c ? s.push(i) : i.name === this.ctab.name && (a = !0);
66
- }), this.tabs = s, a && ((n = globalThis.$router) == null || n.push({ name: t.name }));
78
+ this.tabs.forEach((n, b) => {
79
+ e >= b ? s.push(n) : n.name === this.ctab.name && (a = !0);
80
+ }), this.tabs = s, a && ((i = globalThis.$router) == null || i.push({ name: t.name }));
67
81
  },
68
82
  closeLeftTab(t, e) {
69
- var n;
83
+ var i;
70
84
  const s = [];
71
85
  let a = !1;
72
- this.tabs.forEach((i, c) => {
73
- e <= c ? s.push(i) : i.name === this.ctab.name && (a = !0);
74
- }), this.tabs = s, a && ((n = globalThis.$router) == null || n.push({ name: t.name }));
86
+ this.tabs.forEach((n, b) => {
87
+ e <= b ? s.push(n) : n.name === this.ctab.name && (a = !0);
88
+ }), this.tabs = s, a && ((i = globalThis.$router) == null || i.push({ name: t.name }));
75
89
  },
76
90
  closeOtherTab(t, e) {
77
91
  var s;
@@ -80,11 +94,11 @@ const T = () => ({
80
94
  closeAllTab() {
81
95
  this.tabs = [];
82
96
  }
83
- }, v = {}, w = {
84
- state: d,
85
- actions: S,
86
- getters: v
87
- }, O = () => ({
97
+ }, J = {}, j = {
98
+ state: L,
99
+ actions: N,
100
+ getters: J
101
+ }, x = () => ({
88
102
  type: "",
89
103
  visible: !1,
90
104
  options: [],
@@ -93,7 +107,7 @@ const T = () => ({
93
107
  x: 0,
94
108
  y: 0
95
109
  }
96
- }), L = {
110
+ }), C = {
97
111
  saveData(t, e) {
98
112
  this[t] = e;
99
113
  },
@@ -106,35 +120,35 @@ const T = () => ({
106
120
  y: 0
107
121
  }, this.type = "";
108
122
  }
109
- }, N = {}, J = {
110
- state: O,
111
- actions: L,
112
- getters: N
113
- }, x = p(), o = {}, D = (t) => {
123
+ }, D = {}, P = {
124
+ state: x,
125
+ actions: C,
126
+ getters: D
127
+ }, F = w(), o = {}, I = (t) => {
114
128
  const e = t.match(/(?:^|[/\\])([^/\\]+)\.js$/);
115
129
  return e ? e[1] : null;
116
- }, E = (t) => {
130
+ }, A = (t) => {
117
131
  Object.entries(t).forEach(([e, s]) => {
118
- const a = D(e);
132
+ const a = I(e);
119
133
  if (!a || !(s != null && s.default)) {
120
134
  console.warn(`Invalid store module: ${e}`);
121
135
  return;
122
136
  }
123
137
  try {
124
- o[a] = h(a, s.default);
125
- } catch (n) {
126
- console.error(`Failed to register store module '${a}':`, n);
138
+ o[a] = g(a, s.default);
139
+ } catch (i) {
140
+ console.error(`Failed to register store module '${a}':`, i);
127
141
  }
128
142
  });
129
143
  };
130
- o.init = h("init", $);
131
- o.tab = h("tab", w);
132
- o.rmenu = h("rmenu", J);
133
- const f = (t) => {
144
+ o.init = g("init", E);
145
+ o.tab = g("tab", j);
146
+ o.rmenu = g("rmenu", P);
147
+ const d = (t) => {
134
148
  try {
135
149
  switch (window.$getType(t)) {
136
150
  case "Array":
137
- t.forEach(f);
151
+ t.forEach(d);
138
152
  break;
139
153
  case "String":
140
154
  const s = localStorage.getItem(t);
@@ -147,16 +161,16 @@ const f = (t) => {
147
161
  } catch (e) {
148
162
  console.error(`Failed to parse '${t}' from localStorage:`, e);
149
163
  }
150
- }, F = (t, { storeChips: e, useTab: s } = {}) => {
164
+ }, B = (t, { storeChips: e, useTab: s } = {}) => {
151
165
  try {
152
- t.use(x).provide("store", o);
166
+ t.use(F).provide("store", o);
153
167
  } catch (a) {
154
168
  throw new Error("Failed to inject store into app:", a);
155
169
  }
156
- return s && (o.tab().saveData("useTab", !0), f(["tabs", "ctab"])), e && E(e), o;
170
+ return s && (o.tab().saveData("useTab", !0), d(["tabs", "ctab"])), e && A(e), o;
157
171
  };
158
172
  export {
159
- F as a,
160
- x as p,
173
+ B as a,
174
+ F as p,
161
175
  o as s
162
176
  };
package/dist/util.js CHANGED
@@ -1,85 +1,88 @@
1
1
  import { MVFRAME_STORAGE_LANG as N } from "./composition.js";
2
- import { d as f, i as I, q as P } from "./dayjs.js";
3
- f.extend(I);
4
- f.extend(P);
5
- const Y = (s) => {
2
+ import { e as P } from "./vendor.js";
3
+ import { d as f, i as j, q as R } from "./dayjs.js";
4
+ f.extend(j);
5
+ f.extend(R);
6
+ const Q = (s) => {
6
7
  globalThis.$d = f;
7
- const u = (e) => {
8
+ const u = P();
9
+ s.config.globalProperties.$message = u, globalThis.$message = u;
10
+ const g = (e) => {
8
11
  if (e.startsWith("/"))
9
12
  return new URL(e, import.meta.url).href;
10
13
  if (e)
11
14
  return new URL((/* @__PURE__ */ Object.assign({}))[`/src/assets/img/${e}`], import.meta.url).href;
12
15
  throw new Error("please provide an image url with getImg");
13
16
  };
14
- s.config.globalProperties.$getImg = u, globalThis.$getImg = u, globalThis.$getLang = () => {
17
+ s.config.globalProperties.$getImg = g, globalThis.$getImg = g, globalThis.$getLang = () => {
15
18
  var e;
16
19
  return localStorage.getItem(N) || ((e = globalThis.$config) == null ? void 0 : e.lang) || "en_us";
17
20
  }, globalThis.token = "WQpvrYIEnSzAxhOWrbUpGvElhGztdOjOGOdbrSlhUYlrQArOdpMhY1vYMSA7l4xMOUl9MAl1I6AvSrQ8vlE0bpChQ0UWMMlYt0hQC0M0pSz0rUhvlIllSWzMESnAMUlt";
18
- const $ = (e) => Number(e.match(/\d+(\.\d+)?/g).join(""));
19
- globalThis.$md5 = (e) => $(e);
20
- const y = (e, r = 0) => {
21
+ const y = (e) => Number(e.match(/\d+(\.\d+)?/g).join(""));
22
+ globalThis.$md5 = (e) => y(e);
23
+ const T = (e, r = 0) => {
21
24
  let o = parseInt(Math.random() * e);
22
25
  return o += r, o;
23
26
  };
24
- globalThis.$rn = y;
25
- const T = (e, r) => {
27
+ globalThis.$rn = T;
28
+ const C = (e, r) => {
26
29
  let o = [];
27
30
  for (let t = 0; t < e; t++)
28
31
  o.push(r(t));
29
32
  return o;
30
33
  };
31
- globalThis.$fd = T;
32
- const g = (e, r = !1) => e.substr(0, 1).toUpperCase() + (r ? e.substr(1, e.length).toLowerCase() : e.substr(1, e.length));
33
- s.config.globalProperties.$toUpperCamel = g, globalThis.$toUpperCamel = g;
34
- const p = (e, r = 2) => {
34
+ globalThis.$fd = C;
35
+ const p = (e, r = !1) => e.substr(0, 1).toUpperCase() + (r ? e.substr(1, e.length).toLowerCase() : e.substr(1, e.length));
36
+ s.config.globalProperties.$toUpperCamel = p, globalThis.$toUpperCamel = p;
37
+ const b = (e, r = 2) => {
35
38
  const o = globalThis.$getType(e);
36
39
  let t;
37
40
  o === "Number" ? (e = e.toFixed(r), t = String(e), e = String(Math.abs(e))) : o === "String" && (t = e, e = String(Math.abs(Number(e))));
38
- const n = e.split(".");
39
- let l = n[0].split("");
40
- l = l.reverse();
41
+ const l = e.split(".");
42
+ let n = l[0].split("");
43
+ n = n.reverse();
41
44
  let a = [];
42
- l.forEach((U, m) => {
43
- m !== 0 && m % 3 === 0 && a.push(","), a.push(U);
45
+ n.forEach((I, $) => {
46
+ $ !== 0 && $ % 3 === 0 && a.push(","), a.push(I);
44
47
  });
45
48
  let i = a.reverse().join("");
46
- return globalThis.$getType(r) === "Number" && r > 0 && (i += ".", n[1] ? i += n[1].padEnd(r, 0).substr(0, r) : i += "0".padEnd(r, "0")), Number(t) !== Number(e) ? `-${i}` : i;
49
+ return globalThis.$getType(r) === "Number" && r > 0 && (i += ".", l[1] ? i += l[1].padEnd(r, 0).substr(0, r) : i += "0".padEnd(r, "0")), Number(t) !== Number(e) ? `-${i}` : i;
47
50
  };
48
- globalThis.$fa = p, s.config.globalProperties.$fa = p;
49
- const C = (e, r) => {
50
- var n, l;
51
+ globalThis.$fa = b, s.config.globalProperties.$fa = b;
52
+ const M = (e, r) => {
53
+ var l, n;
51
54
  const o = r == null ? void 0 : r[e];
52
55
  if (o != null)
53
56
  return o;
54
- const t = (l = (n = globalThis.$config) == null ? void 0 : n.table) == null ? void 0 : l.summaryMetric;
57
+ const t = (n = (l = globalThis.$config) == null ? void 0 : l.table) == null ? void 0 : n.summaryMetric;
55
58
  return t == null ? null : typeof t == "function" ? t(e) ?? null : t[e] ?? null;
56
- }, b = ({ prop: e, currency: r, value: o, obj: t }) => {
57
- const n = C(e, t);
58
- if (n == null || typeof n != "object")
59
+ }, h = ({ prop: e, currency: r, value: o, obj: t }) => {
60
+ const l = M(e, t);
61
+ if (l == null || typeof l != "object")
59
62
  return globalThis.$fa(o, 2);
60
- if (n.unit === "currency") {
61
- const l = r ?? n.currency;
62
- return l ? `${l} ${globalThis.$fa(o, n == null ? void 0 : n.precision)}` : globalThis.$fa(o, n == null ? void 0 : n.precision);
63
+ if (l.unit === "currency") {
64
+ const n = r ?? l.currency;
65
+ return n ? `${n} ${globalThis.$fa(o, l == null ? void 0 : l.precision)}` : globalThis.$fa(o, l == null ? void 0 : l.precision);
63
66
  }
64
- return n.unit === "%" ? `${globalThis.$fa(o, n == null ? void 0 : n.precision)}%` : globalThis.$fa(o, n == null ? void 0 : n.precision);
67
+ return l.unit === "%" ? `${globalThis.$fa(o, l == null ? void 0 : l.precision)}%` : globalThis.$fa(o, l == null ? void 0 : l.precision);
65
68
  };
66
- globalThis.$fu = b, s.config.globalProperties.$fu = b;
69
+ globalThis.$fu = h, s.config.globalProperties.$fu = h;
67
70
  const k = (e = () => {
68
71
  }, r = 2) => {
69
72
  const o = Math.max(0, Number(r) || 2) * 100;
70
- return new Promise((t, n) => {
73
+ return new Promise((t, l) => {
71
74
  setTimeout(() => {
72
75
  try {
73
- const l = e();
74
- l != null && typeof l.then == "function" ? Promise.resolve(l).then((a) => t(a === void 0 ? !0 : a)).catch(n) : t(l === void 0 ? !0 : l);
75
- } catch (l) {
76
- n(l);
76
+ const n = e();
77
+ n != null && typeof n.then == "function" ? Promise.resolve(n).then((a) => t(a === void 0 ? !0 : a)).catch(l) : t(n === void 0 ? !0 : n);
78
+ } catch (n) {
79
+ l(n);
77
80
  }
78
81
  }, o);
79
82
  });
80
83
  };
81
84
  globalThis.$pm = k;
82
- const M = (e = () => {
85
+ const x = (e = () => {
83
86
  }, r = 500) => {
84
87
  let o;
85
88
  return function(...t) {
@@ -88,7 +91,7 @@ const Y = (s) => {
88
91
  }, r);
89
92
  };
90
93
  };
91
- globalThis.$db = M, Number.prototype.toFixedNumber = function(e) {
94
+ globalThis.$db = x, Number.prototype.toFixedNumber = function(e) {
92
95
  return Number(this.toFixed(e));
93
96
  }, Array.prototype.filter1 = function(e) {
94
97
  if (!e || typeof e != "function")
@@ -104,47 +107,46 @@ const Y = (s) => {
104
107
  data: r
105
108
  };
106
109
  }, globalThis.$getType = (e) => Object.prototype.toString.call(e).slice(8, -1);
107
- const h = (e) => {
108
- var o;
109
- const r = (o = s.config.globalProperties) == null ? void 0 : o.$message;
110
- r != null && r.success && r.success({ message: e, center: !0, duration: 5e3 });
110
+ const m = (e) => {
111
+ var r;
112
+ (r = globalThis.$message) != null && r.success && globalThis.$message.success({ message: e, duration: 5e3 });
111
113
  }, d = (e, r) => {
112
- var n;
114
+ var l;
113
115
  if (!e) {
114
116
  console.info("No Value");
115
117
  return;
116
118
  }
117
- const o = ((n = globalThis.$l) == null ? void 0 : n.call(globalThis, "Copied")) || "Copied";
119
+ const o = ((l = globalThis.$l) == null ? void 0 : l.call(globalThis, "Copied")) || "Copied";
118
120
  let t;
119
121
  if (r ? globalThis.$getType(r) !== "Boolean" ? t = `${o} ${r}: ${e}` : t = `${o}: ${e}` : t = o, navigator.clipboard && globalThis.isSecureContext)
120
- navigator.clipboard.writeText(e).then(() => h(t));
122
+ navigator.clipboard.writeText(e).then(() => m(t));
121
123
  else {
122
- let l = document.createElement("textarea");
123
- l.value = e, l.style.position = "fixed", l.style.opacity = 0, document.body.appendChild(l), l.select(), document.execCommand("Copy"), l.remove(), h(t);
124
+ let n = document.createElement("textarea");
125
+ n.value = e, n.style.position = "fixed", n.style.opacity = 0, document.body.appendChild(n), n.select(), document.execCommand("Copy"), n.remove(), m(t);
124
126
  }
125
127
  };
126
128
  globalThis.$copy = d, s.config.globalProperties.$copy = d;
127
- const x = (e) => e < 1e3 ? e : e < 1e6 ? parseInt(e / 1e3) + "k" : parseInt(e / 1e6) + "m";
128
- globalThis.$sc = x;
129
- const F = {
129
+ const F = (e) => e < 1e3 ? e : e < 1e6 ? parseInt(e / 1e3) + "k" : parseInt(e / 1e6) + "m";
130
+ globalThis.$sc = F;
131
+ const O = {
130
132
  cpa: "avgCPA",
131
133
  cpt: "avgCPT"
132
- }, O = (e, r = F) => {
134
+ }, w = (e, r = O) => {
133
135
  const o = r[e.name];
134
136
  o && (e.name = o);
135
137
  };
136
- globalThis.$nr = O;
137
- const w = (e, r) => (Object.keys(e).forEach((o) => {
138
+ globalThis.$nr = w;
139
+ const A = (e, r) => (Object.keys(e).forEach((o) => {
138
140
  objMap[o] && (e[objMap[o]] = e[o], delete e[o]);
139
141
  }), e);
140
- globalThis.$nro = w;
141
- const A = (e) => {
142
+ globalThis.$nro = A;
143
+ const S = (e) => {
142
144
  let r = 0;
143
145
  return Object.keys(e).forEach((o) => {
144
146
  (globalThis.$getType(e[o]) === "Array" && e[o].length !== 0 || e[o]) && r++;
145
147
  }), r;
146
148
  };
147
- globalThis.$pc = A;
149
+ globalThis.$pc = S;
148
150
  const c = {
149
151
  info: {
150
152
  tag: "background-color:#0085FF; color:#f1f7ff; border-radius: 2px 0 0 2px;",
@@ -166,7 +168,7 @@ const Y = (s) => {
166
168
  tag: "background-color:#20c997; color:#f6fffc; border-radius: 2px 0 0 2px;",
167
169
  style: "background-color:#f6fffc; color:#20c997;"
168
170
  }
169
- }, S = (e) => {
171
+ }, E = (e) => {
170
172
  let r = !1;
171
173
  for (let o in e)
172
174
  if (globalThis.$getType(e[o]) === "Object") {
@@ -174,11 +176,11 @@ const Y = (s) => {
174
176
  break;
175
177
  }
176
178
  return r;
177
- }, E = ["info", "log", "warn", "error", "success"];
178
- globalThis.$c = {}, E.forEach((e) => {
179
+ }, U = ["info", "log", "warn", "error", "success"];
180
+ globalThis.$c = {}, U.forEach((e) => {
179
181
  globalThis.$c[e] = (...r) => {
180
182
  const o = e.toUpperCase();
181
- S(r) ? (console.groupCollapsed(`%c ${o} `, `${c[e].tag}`), console[e](r), console.groupEnd()) : console.info(
183
+ E(r) ? (console.groupCollapsed(`%c ${o} `, `${c[e].tag}`), console[e](r), console.groupEnd()) : console.info(
182
184
  `%c ${o} %c┆${r}┆`,
183
185
  `${c[e].tag}`,
184
186
  `${c[e].style}`
@@ -193,12 +195,12 @@ const Y = (s) => {
193
195
  let o = r === "Array" ? [] : {};
194
196
  for (let t in e)
195
197
  if (Object.prototype.hasOwnProperty.call(e, t)) {
196
- const n = window.$getType(e[t]);
197
- n === "Object" || n === "Array" ? o[t] = window.$deepClone(e[t]) : o[t] = e[t];
198
+ const l = window.$getType(e[t]);
199
+ l === "Object" || l === "Array" ? o[t] = window.$deepClone(e[t]) : o[t] = e[t];
198
200
  }
199
201
  return o;
200
202
  };
201
203
  };
202
204
  export {
203
- Y as u
205
+ Q as u
204
206
  };