mvframe 1.0.11 → 1.0.14

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/store.js CHANGED
@@ -1,23 +1,28 @@
1
- import { createPinia as g, defineStore as h } from "pinia";
1
+ import { createPinia as p, defineStore as h } from "pinia";
2
2
  const T = () => ({
3
- lang: "en_us"
3
+ lang: "en_us",
4
+ /** 路由切换 / 异步页面 chunk 加载期间为 true,由 router guard 维护 */
5
+ pageLoading: !1
4
6
  }), y = {
5
7
  saveData(t, e) {
6
8
  this[t] = e;
7
9
  },
8
10
  setLang(t) {
9
11
  this.lang = t;
12
+ },
13
+ setPageLoading(t) {
14
+ this.pageLoading = !!t;
10
15
  }
11
16
  }, $ = {
12
17
  state: T,
13
18
  actions: y
14
- }, S = () => ({
19
+ }, d = () => ({
15
20
  useTab: !1,
16
21
  // 是否使用tab
17
22
  tabs: [],
18
23
  ctab: {}
19
24
  // current tab
20
- }), d = {
25
+ }), S = {
21
26
  saveData(t, e) {
22
27
  this[t] = e;
23
28
  },
@@ -32,19 +37,19 @@ const T = () => ({
32
37
  return;
33
38
  } else
34
39
  this.closeTab(e, s);
35
- const { fullPath: a, name: i, meta: n, params: c, query: u } = t;
36
- if (i !== "Login") {
40
+ const { fullPath: a, name: n, meta: i, params: c, query: u } = t;
41
+ if (n !== "Login") {
37
42
  const r = a.split("/");
38
43
  let l;
39
- r[r.length - 1] === "Home" ? l = r[r.length - 2] : l = r[r.length - 1], n.icon && (l = n.icon);
44
+ r[r.length - 1] === "Home" ? l = r[r.length - 2] : l = r[r.length - 1], i.icon && (l = i.icon);
40
45
  const b = {
41
- name: i,
42
- meta: n,
46
+ name: n,
47
+ meta: i,
43
48
  path: r,
44
49
  params: c,
45
50
  query: u,
46
51
  icon: l
47
- }, { index: m } = this.tabs.filter1((p) => p.name === this.ctab.name);
52
+ }, { index: m } = this.tabs.filter1((g) => g.name === this.ctab.name);
48
53
  this.tabs.splice(m + 1, 0, b), this.saveCurrentTab(b);
49
54
  }
50
55
  },
@@ -53,20 +58,20 @@ const T = () => ({
53
58
  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 }));
54
59
  },
55
60
  closeRightTab(t, e) {
56
- var i;
61
+ var n;
57
62
  const s = [];
58
63
  let a = !1;
59
- this.tabs.forEach((n, c) => {
60
- e >= c ? s.push(n) : n.name === this.ctab.name && (a = !0);
61
- }), this.tabs = s, a && ((i = globalThis.$router) == null || i.push({ name: t.name }));
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 }));
62
67
  },
63
68
  closeLeftTab(t, e) {
64
- var i;
69
+ var n;
65
70
  const s = [];
66
71
  let a = !1;
67
- this.tabs.forEach((n, c) => {
68
- e <= c ? s.push(n) : n.name === this.ctab.name && (a = !0);
69
- }), this.tabs = s, a && ((i = globalThis.$router) == null || i.push({ name: t.name }));
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 }));
70
75
  },
71
76
  closeOtherTab(t, e) {
72
77
  var s;
@@ -76,8 +81,8 @@ const T = () => ({
76
81
  this.tabs = [];
77
82
  }
78
83
  }, v = {}, w = {
79
- state: S,
80
- actions: d,
84
+ state: d,
85
+ actions: S,
81
86
  getters: v
82
87
  }, O = () => ({
83
88
  type: "",
@@ -88,7 +93,7 @@ const T = () => ({
88
93
  x: 0,
89
94
  y: 0
90
95
  }
91
- }), J = {
96
+ }), L = {
92
97
  saveData(t, e) {
93
98
  this[t] = e;
94
99
  },
@@ -101,28 +106,30 @@ const T = () => ({
101
106
  y: 0
102
107
  }, this.type = "";
103
108
  }
104
- }, N = {}, x = {
109
+ }, N = {}, J = {
105
110
  state: O,
106
- actions: J,
111
+ actions: L,
107
112
  getters: N
108
- }, D = g(), o = {}, E = (t) => {
113
+ }, x = p(), o = {}, D = (t) => {
114
+ const e = t.match(/(?:^|[/\\])([^/\\]+)\.js$/);
115
+ return e ? e[1] : null;
116
+ }, E = (t) => {
109
117
  Object.entries(t).forEach(([e, s]) => {
110
- const a = e.match(/chip\/(.+?)\.js$/);
118
+ const a = D(e);
111
119
  if (!a || !(s != null && s.default)) {
112
120
  console.warn(`Invalid store module: ${e}`);
113
121
  return;
114
122
  }
115
- const i = a[1].replace(/\//g, "_");
116
123
  try {
117
- o[i] = h(i, s.default);
124
+ o[a] = h(a, s.default);
118
125
  } catch (n) {
119
- console.error(`Failed to register store module '${i}':`, n);
126
+ console.error(`Failed to register store module '${a}':`, n);
120
127
  }
121
128
  });
122
129
  };
123
130
  o.init = h("init", $);
124
131
  o.tab = h("tab", w);
125
- o.rmenu = h("rmenu", x);
132
+ o.rmenu = h("rmenu", J);
126
133
  const f = (t) => {
127
134
  try {
128
135
  switch (window.$getType(t)) {
@@ -140,16 +147,16 @@ const f = (t) => {
140
147
  } catch (e) {
141
148
  console.error(`Failed to parse '${t}' from localStorage:`, e);
142
149
  }
143
- }, I = (t, { storeChips: e, useTab: s } = {}) => {
150
+ }, F = (t, { storeChips: e, useTab: s } = {}) => {
144
151
  try {
145
- t.use(D).provide("store", o);
152
+ t.use(x).provide("store", o);
146
153
  } catch (a) {
147
154
  throw new Error("Failed to inject store into app:", a);
148
155
  }
149
156
  return s && (o.tab().saveData("useTab", !0), f(["tabs", "ctab"])), e && E(e), o;
150
157
  };
151
158
  export {
152
- I as a,
153
- D as p,
159
+ F as a,
160
+ x as p,
154
161
  o as s
155
162
  };
package/dist/util.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import { MVFRAME_STORAGE_LANG as U } from "./composition.js";
2
2
  const P = (s) => {
3
- console.info(s);
4
3
  const f = (e) => {
5
4
  if (e.startsWith("/"))
6
5
  return new URL(e, import.meta.url).href;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mvframe",
3
3
  "packageManager": "yarn@4.4.1",
4
- "version": "1.0.11",
4
+ "version": "1.0.14",
5
5
  "author": "matt avis",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",