mvframe 1.1.21 → 1.1.22

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.
@@ -4,10 +4,10 @@ import j from "axios";
4
4
  const Y = "lang", Se = (e, t) => {
5
5
  var i, a;
6
6
  const n = typeof window < "u", r = () => {
7
- var d;
7
+ var m;
8
8
  if (!n)
9
9
  return { innerWidth: 1920, innerHeight: 1080 };
10
- const s = window, l = typeof navigator < "u" ? s.navigator : {}, u = s.screen || {}, f = s.visualViewport, h = {
10
+ const s = window, l = typeof navigator < "u" ? s.navigator : {}, u = s.screen || {}, h = s.visualViewport, d = {
11
11
  innerWidth: s.innerWidth,
12
12
  innerHeight: s.innerHeight,
13
13
  outerWidth: s.outerWidth,
@@ -17,14 +17,14 @@ const Y = "lang", Se = (e, t) => {
17
17
  availWidth: u.availWidth ?? s.innerWidth,
18
18
  availHeight: u.availHeight ?? s.innerHeight,
19
19
  devicePixelRatio: s.devicePixelRatio || 1,
20
- bodyHeight: s.innerHeight - ((d = t.pinia) != null && d.useTab ? 36 : 0) - 64 - 32,
20
+ bodyHeight: s.innerHeight - ((m = t.pinia) != null && m.useTab ? 36 : 0) - 64 - 32,
21
21
  drawerHeight: parseInt(s.innerHeight * 0.9),
22
22
  pageHeight: s.innerHeight - 64 - 32,
23
23
  pageWidth: s.innerWidth
24
24
  };
25
- f && (h.visualViewportWidth = f.width, h.visualViewportHeight = f.height, h.visualViewportScale = f.scale);
25
+ h && (d.visualViewportWidth = h.width, d.visualViewportHeight = h.height, d.visualViewportScale = h.scale);
26
26
  const c = l.userAgent || "";
27
- return h.env = {
27
+ return d.env = {
28
28
  userAgent: c,
29
29
  language: l.language || "",
30
30
  languages: l.languages ? [...l.languages] : [],
@@ -36,7 +36,7 @@ const Y = "lang", Se = (e, t) => {
36
36
  isMobile: /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Mobile/i.test(
37
37
  c
38
38
  )
39
- }, console.info(h), h;
39
+ }, console.info(d), d;
40
40
  }, o = () => {
41
41
  var l;
42
42
  const s = r();
@@ -49,23 +49,23 @@ const Y = "lang", Se = (e, t) => {
49
49
  passive: !0
50
50
  }));
51
51
  }, $e = (e, t) => {
52
- var u, f, h;
52
+ var u, h, d;
53
53
  const n = t || {}, r = Array.isArray(n.use) && n.use.length > 0 ? n.use : z;
54
54
  globalThis.$config = globalThis.$config || {}, globalThis.$config.langUse = r.filter(
55
55
  (c) => c && c.use !== !1 && c.value
56
56
  ), (u = e == null ? void 0 : e.config) != null && u.globalProperties && (e.config.globalProperties.$config = globalThis.$config);
57
- const i = (typeof localStorage < "u" ? localStorage.getItem(Y) : null) || ((f = globalThis.$config) == null ? void 0 : f.lang) || "en_us", a = Object.assign(
57
+ const i = (typeof localStorage < "u" ? localStorage.getItem(Y) : null) || ((h = globalThis.$config) == null ? void 0 : h.lang) || "en_us", a = Object.assign(
58
58
  {},
59
59
  D(i),
60
- ((h = globalThis.$config) == null ? void 0 : h.langMaps) || {},
60
+ ((d = globalThis.$config) == null ? void 0 : d.langMaps) || {},
61
61
  n.langMaps || {}
62
- ), s = (c, d) => !d || globalThis.$getType(d) !== "Object" ? c : String(c).replace(
62
+ ), s = (c, m) => !m || globalThis.$getType(m) !== "Object" ? c : String(c).replace(
63
63
  /\{([A-Za-z0-9_.$-]+)\}/g,
64
- (m, C) => Object.prototype.hasOwnProperty.call(d, C) ? d[C] : m
65
- ), l = (c, d) => {
64
+ (g, C) => Object.prototype.hasOwnProperty.call(m, C) ? m[C] : g
65
+ ), l = (c, m) => {
66
66
  if (c) {
67
- const m = a[c] || c;
68
- return s(m, d);
67
+ const g = a[c] || c;
68
+ return s(g, m);
69
69
  } else
70
70
  return c ?? "";
71
71
  };
@@ -132,18 +132,18 @@ const Y = "lang", Se = (e, t) => {
132
132
  url: s,
133
133
  init: l,
134
134
  response: u = "blob",
135
- openIn: f = "self",
136
- expectExcel: h,
135
+ openIn: h = "self",
136
+ expectExcel: d,
137
137
  filename: c,
138
- name: d,
139
- error: m = () => {
138
+ name: m,
139
+ error: g = () => {
140
140
  },
141
141
  // 避免 legacy 字段渗入后续逻辑
142
142
  type: C,
143
143
  data: Te,
144
144
  headers: we,
145
145
  ...Me
146
- } = t, M = c ?? d;
146
+ } = t, M = c ?? m;
147
147
  try {
148
148
  if (n === "inline") {
149
149
  if (o instanceof Blob) {
@@ -151,31 +151,31 @@ const Y = "lang", Se = (e, t) => {
151
151
  return;
152
152
  }
153
153
  if (r == null) {
154
- m(new Error("content or blob is required for inline"));
154
+ g(new Error("content or blob is required for inline"));
155
155
  return;
156
156
  }
157
- const g = typeof r == "string" ? r : String(r), R = i ? "\uFEFF" + g : g, v = a || (i ? "text/csv;charset=utf-8" : "text/plain;charset=utf-8");
157
+ const f = typeof r == "string" ? r : String(r), R = i ? "\uFEFF" + f : f, v = a || (i ? "text/csv;charset=utf-8" : "text/plain;charset=utf-8");
158
158
  S(new Blob([R], { type: v }), M);
159
159
  return;
160
160
  }
161
161
  if (n === "fetch") {
162
162
  if (!s) {
163
- m(new Error("url is required for fetch"));
163
+ g(new Error("url is required for fetch"));
164
164
  return;
165
165
  }
166
- const g = await fetch(s, l);
167
- if (!g.ok) {
168
- m(new Error(`fetch failed: ${g.status}`));
166
+ const f = await fetch(s, l);
167
+ if (!f.ok) {
168
+ g(new Error(`fetch failed: ${f.status}`));
169
169
  return;
170
170
  }
171
171
  if (u === "text") {
172
- const v = await g.text(), W = i ? "\uFEFF" + v : v, q = a || (i ? "text/csv;charset=utf-8" : "text/plain;charset=utf-8");
172
+ const v = await f.text(), W = i ? "\uFEFF" + v : v, q = a || (i ? "text/csv;charset=utf-8" : "text/plain;charset=utf-8");
173
173
  S(new Blob([W], { type: q }), M);
174
174
  return;
175
175
  }
176
- const R = await g.blob();
177
- if (h && !Z(R)) {
178
- m(new Error("excel does not exist"));
176
+ const R = await f.blob();
177
+ if (d && !Z(R)) {
178
+ g(new Error("excel does not exist"));
179
179
  return;
180
180
  }
181
181
  S(R, M);
@@ -183,15 +183,15 @@ const Y = "lang", Se = (e, t) => {
183
183
  }
184
184
  if (n === "open") {
185
185
  if (!s) {
186
- m(new Error("url is required for open"));
186
+ g(new Error("url is required for open"));
187
187
  return;
188
188
  }
189
- f === "blank" ? window.open(s, "_blank", "noopener,noreferrer") : window.location.href = s;
189
+ h === "blank" ? window.open(s, "_blank", "noopener,noreferrer") : window.location.href = s;
190
190
  return;
191
191
  }
192
- m(new Error(`unknown source: ${n}`));
193
- } catch (g) {
194
- m(g instanceof Error ? g : new Error(String(g)));
192
+ g(new Error(`unknown source: ${n}`));
193
+ } catch (f) {
194
+ g(f instanceof Error ? f : new Error(String(f)));
195
195
  }
196
196
  };
197
197
  function ee(e, t, n) {
@@ -503,22 +503,23 @@ function k({
503
503
  url: t,
504
504
  ex: n,
505
505
  method: r = "post",
506
- emptyString: o = !1
506
+ emptyString: o = !1,
507
+ useToken: i = !0
507
508
  }) {
508
- const i = {}, a = [void 0, null];
509
- o === !1 && a.push("");
510
- for (let u in e)
511
- a.indexOf(e[u]) === -1 && (i[u] = e[u]);
512
- const { login: s } = window.$store.launch(), { access_token: l } = s.info || {};
509
+ const a = {}, s = [void 0, null];
510
+ o === !1 && s.push("");
511
+ for (let h in e)
512
+ s.indexOf(e[h]) === -1 && (a[h] = e[h]);
513
+ const { login: l } = window.$store.launch(), { access_token: u } = l.info || {};
513
514
  return _({
514
515
  headers: {
515
516
  "Content-Type": "application/json",
516
- token: l != null ? String(l) : ""
517
+ token: i && u != null ? String(u) : ""
517
518
  },
518
519
  baseURL: P("VITE_APP_AIURL"),
519
520
  url: t,
520
521
  method: r,
521
- data: i,
522
+ data: a,
522
523
  ex: n
523
524
  });
524
525
  }
package/dist/vendor.js CHANGED
@@ -13948,7 +13948,7 @@ const Yr = (a, o = {}) => {
13948
13948
  }, Wr = {
13949
13949
  name: "Matt Avias Frame",
13950
13950
  copyright: "©2026",
13951
- version: "1.1.21",
13951
+ version: "1.1.22",
13952
13952
  author: "Matt Avias",
13953
13953
  date: "2026-02-26",
13954
13954
  /** 默认语言 key,与 `$getLang`、localStorage `lang` 一致;业务在 app.use(mvframe, { config }) 里覆盖 */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mvframe",
3
3
  "packageManager": "yarn@4.4.1",
4
- "version": "1.1.21",
4
+ "version": "1.1.22",
5
5
  "author": "matt avis",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",