@gonsin/gview 2.0.125 → 2.0.127

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.
Files changed (2) hide show
  1. package/dist/index.mjs +31 -15
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -85,7 +85,21 @@ function Zt(t, e, u) {
85
85
  // 标记当前层级
86
86
  isGroup: !o.url
87
87
  // 标记当前是否为分组
88
- }));
88
+ })).filter((o) => {
89
+ const n = Object.keys(o);
90
+ if (n.indexOf("show") > -1) {
91
+ if (typeof o.show < "u")
92
+ return o.show === !0;
93
+ } else if (n.indexOf("whetherShow") > -1 || n.indexOf("menuMold") > -1) {
94
+ if (o.whetherShow !== null)
95
+ return o.whetherShow === !0;
96
+ if (o.menuMold == 1)
97
+ return (o.url ?? "") != "";
98
+ if (o.menuMold == 2)
99
+ return o.children && o.children.length;
100
+ } else
101
+ return o;
102
+ });
89
103
  }
90
104
  function rn(t) {
91
105
  return t.map((e) => (e.children && e.children.length > 0 && (e.children = rn(e.children)), e.url && !e.path && (e.path = e.url), e));
@@ -94,7 +108,7 @@ const Fa = (t) => {
94
108
  const e = [];
95
109
  function u(o, n) {
96
110
  o.forEach((a) => {
97
- const { menuKey: i, edificeKey: M, name: r, title: N, translateTitle: l, url: s, icon: D, level: E } = a;
111
+ const { menuKey: i, edificeKey: M, name: r, title: N, translateTitle: l, url: s, icon: D, level: E, init: d } = a;
98
112
  e.push({
99
113
  menuKey: i,
100
114
  edificeKey: M,
@@ -104,7 +118,8 @@ const Fa = (t) => {
104
118
  translateTitle: l,
105
119
  url: s,
106
120
  icon: D,
107
- level: E
121
+ level: E,
122
+ init: d
108
123
  }), a.children && a.children.length > 0 && u(a.children, r);
109
124
  });
110
125
  }
@@ -876,18 +891,18 @@ const dn = Uu("column", {
876
891
  },
877
892
  setUserPermission(t) {
878
893
  let e = [];
879
- this.userPermission = e, Te.setItem(Co, e);
894
+ !t || !t.length ? e = [] : e = t.map((u) => u.name), this.basePermission && this.basePermission.length && (e = t.filter((u) => u.menuMold == 1 || u.menuMold == 2 ? this.basePermission.includes(u.name) : this.basePermission.includes(u.name) || u.parent && this.basePermission.includes(u.parent)).map((u) => u.name)), this.userPermission = e, Te.setItem(Co, e);
880
895
  },
881
896
  /**
882
897
  * @description 用户登录后初始化配置
883
898
  */
884
899
  async initUserConfig(t) {
885
- var n;
886
- Te.setItem(St, t), this.userConfig = { ...t }, (n = t.userInfo) == null || n.username;
887
- const e = Be(t.userMenu ?? []);
888
- this.setUserPermission(e), this.setSideMenuTree(e, !1), t.userInfo;
889
- const { listHeaderSetting: u } = t.userInfo;
890
- dn().initColumnData(u), this.setUserLoginStatus(!0);
900
+ var a;
901
+ Te.setItem(St, t), this.userConfig = { ...t };
902
+ const e = ((a = t.userInfo) == null ? void 0 : a.username) ?? "", u = Be(t.userMenu ?? []);
903
+ this.setUserPermission(u), this.setSideMenuTree(u, e && e !== "root");
904
+ const { listHeaderSetting: o } = t.userInfo;
905
+ dn().initColumnData(o), this.setUserLoginStatus(!0);
891
906
  },
892
907
  /**
893
908
  * @description: 退出登录时初始化本地存储值
@@ -1229,7 +1244,7 @@ const dn = Uu("column", {
1229
1244
  r.value.length > 1 && (i.subtractTabMenuItemOther({ path: C, itemIdx: _ }), x("other", _));
1230
1245
  }
1231
1246
  function j() {
1232
- i.clearTabMenu(), o.push({ path: N.value, query: pu(N.value) });
1247
+ i.clearTabMenu(), o.push({ path: N.value, query: pu(N.value) }), a.value = null, M.toggleGlobalReload();
1233
1248
  }
1234
1249
  function x(C, _) {
1235
1250
  const O = n.fullPath, { tabMenuList: U } = i, G = U.findIndex((ae) => ae.path === O);
@@ -1945,9 +1960,10 @@ const In = { render: vi }, Ui = { class: "username" }, Qi = /* @__PURE__ */ ne({
1945
1960
  item: {}
1946
1961
  },
1947
1962
  setup(t) {
1948
- return de(), (e, u) => (g(), R("span", {
1949
- title: e.item.title
1950
- }, oe(e.item.title), 9, Yi));
1963
+ const { T: e, i18n: u } = de();
1964
+ S(() => u.global.locale.value.toLowerCase() === "zh-cn");
1965
+ const o = t, n = S(() => o.item.title ?? "");
1966
+ return (a, i) => (g(), R("span", { title: n.value }, oe(n.value), 9, Yi));
1951
1967
  }
1952
1968
  }), Bi = /* @__PURE__ */ ne({
1953
1969
  __name: "GLayoutSideMenuIcon",
@@ -12251,7 +12267,7 @@ const qn = /* @__PURE__ */ tu(Xl, [["__scopeId", "data-v-75fdffa5"]]), lr = /* @
12251
12267
  t.directive(e, Ko[e]);
12252
12268
  });
12253
12269
  }
12254
- }, tM = "@gonsin/gview", oM = "2.0.125", nM = "dist/index.mjs", aM = "dist/types/index.d.ts", iM = [
12270
+ }, tM = "@gonsin/gview", oM = "2.0.127", nM = "dist/index.mjs", aM = "dist/types/index.d.ts", iM = [
12255
12271
  "dist",
12256
12272
  "README.md",
12257
12273
  "CHANGELOG.md"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gonsin/gview",
3
- "version": "2.0.125",
3
+ "version": "2.0.127",
4
4
  "main": "dist/index.mjs",
5
5
  "typings": "dist/types/index.d.ts",
6
6
  "files": [