STopMenu.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547
  1. import { ref as bn, computed as Ft, reactive as mn, watch as Vt, onMounted as wn, openBlock as vn, createElementBlock as Tn, createElementVNode as An, createVNode as kt, withCtx as Sn } from "vue";
  2. import { useRouter as Cn } from "vue-router";
  3. import { c7 as xn, c6 as F, n as Kn, ad as Wt, c$ as On, cE as jn } from "./index2.js";
  4. var V = { exports: {} };
  5. V.exports;
  6. (function(p, h) {
  7. var C = 200, w = "__lodash_hash_undefined__", _ = 9007199254740991, s = "[object Arguments]", I = "[object Array]", $ = "[object Boolean]", P = "[object Date]", k = "[object Error]", o = "[object Function]", c = "[object GeneratorFunction]", i = "[object Map]", d = "[object Number]", g = "[object Object]", ot = "[object Promise]", at = "[object RegExp]", R = "[object Set]", st = "[object String]", it = "[object Symbol]", W = "[object WeakMap]", ct = "[object ArrayBuffer]", B = "[object DataView]", ut = "[object Float32Array]", ft = "[object Float64Array]", lt = "[object Int8Array]", pt = "[object Int16Array]", ht = "[object Int32Array]", dt = "[object Uint8Array]", _t = "[object Uint8ClampedArray]", gt = "[object Uint16Array]", yt = "[object Uint32Array]", qt = /[\\^$.*+?()[\]{}|]/g, zt = /\w*$/, Jt = /^\[object .+?Constructor\]$/, Xt = /^(?:0|[1-9]\d*)$/, a = {};
  8. a[s] = a[I] = a[ct] = a[B] = a[$] = a[P] = a[ut] = a[ft] = a[lt] = a[pt] = a[ht] = a[i] = a[d] = a[g] = a[at] = a[R] = a[st] = a[it] = a[dt] = a[_t] = a[gt] = a[yt] = !0, a[k] = a[o] = a[W] = !1;
  9. var Yt = typeof F == "object" && F && F.Object === Object && F, Zt = typeof self == "object" && self && self.Object === Object && self, y = Yt || Zt || Function("return this")(), bt = h && !h.nodeType && h, mt = bt && !0 && p && !p.nodeType && p, Qt = mt && mt.exports === bt;
  10. function te(t, e) {
  11. return t.set(e[0], e[1]), t;
  12. }
  13. function ee(t, e) {
  14. return t.add(e), t;
  15. }
  16. function ne(t, e) {
  17. for (var n = -1, r = t ? t.length : 0; ++n < r && e(t[n], n, t) !== !1; )
  18. ;
  19. return t;
  20. }
  21. function re(t, e) {
  22. for (var n = -1, r = e.length, u = t.length; ++n < r; )
  23. t[u + n] = e[n];
  24. return t;
  25. }
  26. function wt(t, e, n, r) {
  27. for (var u = -1, f = t ? t.length : 0; ++u < f; )
  28. n = e(n, t[u], u, t);
  29. return n;
  30. }
  31. function oe(t, e) {
  32. for (var n = -1, r = Array(t); ++n < t; )
  33. r[n] = e(n);
  34. return r;
  35. }
  36. function ae(t, e) {
  37. return t == null ? void 0 : t[e];
  38. }
  39. function vt(t) {
  40. var e = !1;
  41. if (t != null && typeof t.toString != "function")
  42. try {
  43. e = !!(t + "");
  44. } catch (n) {
  45. }
  46. return e;
  47. }
  48. function Tt(t) {
  49. var e = -1, n = Array(t.size);
  50. return t.forEach(function(r, u) {
  51. n[++e] = [u, r];
  52. }), n;
  53. }
  54. function q(t, e) {
  55. return function(n) {
  56. return t(e(n));
  57. };
  58. }
  59. function At(t) {
  60. var e = -1, n = Array(t.size);
  61. return t.forEach(function(r) {
  62. n[++e] = r;
  63. }), n;
  64. }
  65. var se = Array.prototype, ie = Function.prototype, G = Object.prototype, z = y["__core-js_shared__"], St = function() {
  66. var t = /[^.]+$/.exec(z && z.keys && z.keys.IE_PROTO || "");
  67. return t ? "Symbol(src)_1." + t : "";
  68. }(), Ct = ie.toString, v = G.hasOwnProperty, U = G.toString, ce = RegExp(
  69. "^" + Ct.call(v).replace(qt, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
  70. ), xt = Qt ? y.Buffer : void 0, Kt = y.Symbol, Ot = y.Uint8Array, ue = q(Object.getPrototypeOf, Object), fe = Object.create, le = G.propertyIsEnumerable, pe = se.splice, jt = Object.getOwnPropertySymbols, he = xt ? xt.isBuffer : void 0, de = q(Object.keys, Object), J = O(y, "DataView"), E = O(y, "Map"), X = O(y, "Promise"), Y = O(y, "Set"), Z = O(y, "WeakMap"), M = O(Object, "create"), _e = S(J), ge = S(E), ye = S(X), be = S(Y), me = S(Z), Et = Kt ? Kt.prototype : void 0, Mt = Et ? Et.valueOf : void 0;
  71. function T(t) {
  72. var e = -1, n = t ? t.length : 0;
  73. for (this.clear(); ++e < n; ) {
  74. var r = t[e];
  75. this.set(r[0], r[1]);
  76. }
  77. }
  78. function we() {
  79. this.__data__ = M ? M(null) : {};
  80. }
  81. function ve(t) {
  82. return this.has(t) && delete this.__data__[t];
  83. }
  84. function Te(t) {
  85. var e = this.__data__;
  86. if (M) {
  87. var n = e[t];
  88. return n === w ? void 0 : n;
  89. }
  90. return v.call(e, t) ? e[t] : void 0;
  91. }
  92. function Ae(t) {
  93. var e = this.__data__;
  94. return M ? e[t] !== void 0 : v.call(e, t);
  95. }
  96. function Se(t, e) {
  97. var n = this.__data__;
  98. return n[t] = M && e === void 0 ? w : e, this;
  99. }
  100. T.prototype.clear = we, T.prototype.delete = ve, T.prototype.get = Te, T.prototype.has = Ae, T.prototype.set = Se;
  101. function b(t) {
  102. var e = -1, n = t ? t.length : 0;
  103. for (this.clear(); ++e < n; ) {
  104. var r = t[e];
  105. this.set(r[0], r[1]);
  106. }
  107. }
  108. function Ce() {
  109. this.__data__ = [];
  110. }
  111. function xe(t) {
  112. var e = this.__data__, n = H(e, t);
  113. if (n < 0)
  114. return !1;
  115. var r = e.length - 1;
  116. return n == r ? e.pop() : pe.call(e, n, 1), !0;
  117. }
  118. function Ke(t) {
  119. var e = this.__data__, n = H(e, t);
  120. return n < 0 ? void 0 : e[n][1];
  121. }
  122. function Oe(t) {
  123. return H(this.__data__, t) > -1;
  124. }
  125. function je(t, e) {
  126. var n = this.__data__, r = H(n, t);
  127. return r < 0 ? n.push([t, e]) : n[r][1] = e, this;
  128. }
  129. b.prototype.clear = Ce, b.prototype.delete = xe, b.prototype.get = Ke, b.prototype.has = Oe, b.prototype.set = je;
  130. function x(t) {
  131. var e = -1, n = t ? t.length : 0;
  132. for (this.clear(); ++e < n; ) {
  133. var r = t[e];
  134. this.set(r[0], r[1]);
  135. }
  136. }
  137. function Ee() {
  138. this.__data__ = {
  139. hash: new T(),
  140. map: new (E || b)(),
  141. string: new T()
  142. };
  143. }
  144. function Me(t) {
  145. return L(this, t).delete(t);
  146. }
  147. function Ie(t) {
  148. return L(this, t).get(t);
  149. }
  150. function $e(t) {
  151. return L(this, t).has(t);
  152. }
  153. function Pe(t, e) {
  154. return L(this, t).set(t, e), this;
  155. }
  156. x.prototype.clear = Ee, x.prototype.delete = Me, x.prototype.get = Ie, x.prototype.has = $e, x.prototype.set = Pe;
  157. function K(t) {
  158. this.__data__ = new b(t);
  159. }
  160. function Re() {
  161. this.__data__ = new b();
  162. }
  163. function Be(t) {
  164. return this.__data__.delete(t);
  165. }
  166. function Ge(t) {
  167. return this.__data__.get(t);
  168. }
  169. function Ue(t) {
  170. return this.__data__.has(t);
  171. }
  172. function He(t, e) {
  173. var n = this.__data__;
  174. if (n instanceof b) {
  175. var r = n.__data__;
  176. if (!E || r.length < C - 1)
  177. return r.push([t, e]), this;
  178. n = this.__data__ = new x(r);
  179. }
  180. return n.set(t, e), this;
  181. }
  182. K.prototype.clear = Re, K.prototype.delete = Be, K.prototype.get = Ge, K.prototype.has = Ue, K.prototype.set = He;
  183. function Le(t, e) {
  184. var n = et(t) || ln(t) ? oe(t.length, String) : [], r = n.length, u = !!r;
  185. for (var f in t)
  186. v.call(t, f) && !(u && (f == "length" || sn(f, r))) && n.push(f);
  187. return n;
  188. }
  189. function It(t, e, n) {
  190. var r = t[e];
  191. (!(v.call(t, e) && Bt(r, n)) || n === void 0 && !(e in t)) && (t[e] = n);
  192. }
  193. function H(t, e) {
  194. for (var n = t.length; n--; )
  195. if (Bt(t[n][0], e))
  196. return n;
  197. return -1;
  198. }
  199. function Ne(t, e) {
  200. return t && $t(e, nt(e), t);
  201. }
  202. function Q(t, e, n, r, u, f, m) {
  203. var l;
  204. if (r && (l = f ? r(t, u, f, m) : r(t)), l !== void 0)
  205. return l;
  206. if (!N(t))
  207. return t;
  208. var Ht = et(t);
  209. if (Ht) {
  210. if (l = rn(t), !e)
  211. return tn(t, l);
  212. } else {
  213. var j = A(t), Lt = j == o || j == c;
  214. if (hn(t))
  215. return qe(t, e);
  216. if (j == g || j == s || Lt && !f) {
  217. if (vt(t))
  218. return f ? t : {};
  219. if (l = on(Lt ? {} : t), !e)
  220. return en(t, Ne(l, t));
  221. } else {
  222. if (!a[j])
  223. return f ? t : {};
  224. l = an(t, j, Q, e);
  225. }
  226. }
  227. m || (m = new K());
  228. var Nt = m.get(t);
  229. if (Nt)
  230. return Nt;
  231. if (m.set(t, l), !Ht)
  232. var Dt = n ? nn(t) : nt(t);
  233. return ne(Dt || t, function(rt, D) {
  234. Dt && (D = rt, rt = t[D]), It(l, D, Q(rt, e, n, r, D, t, m));
  235. }), l;
  236. }
  237. function De(t) {
  238. return N(t) ? fe(t) : {};
  239. }
  240. function Fe(t, e, n) {
  241. var r = e(t);
  242. return et(t) ? r : re(r, n(t));
  243. }
  244. function Ve(t) {
  245. return U.call(t);
  246. }
  247. function ke(t) {
  248. if (!N(t) || un(t))
  249. return !1;
  250. var e = Ut(t) || vt(t) ? ce : Jt;
  251. return e.test(S(t));
  252. }
  253. function We(t) {
  254. if (!Rt(t))
  255. return de(t);
  256. var e = [];
  257. for (var n in Object(t))
  258. v.call(t, n) && n != "constructor" && e.push(n);
  259. return e;
  260. }
  261. function qe(t, e) {
  262. if (e)
  263. return t.slice();
  264. var n = new t.constructor(t.length);
  265. return t.copy(n), n;
  266. }
  267. function tt(t) {
  268. var e = new t.constructor(t.byteLength);
  269. return new Ot(e).set(new Ot(t)), e;
  270. }
  271. function ze(t, e) {
  272. var n = e ? tt(t.buffer) : t.buffer;
  273. return new t.constructor(n, t.byteOffset, t.byteLength);
  274. }
  275. function Je(t, e, n) {
  276. var r = e ? n(Tt(t), !0) : Tt(t);
  277. return wt(r, te, new t.constructor());
  278. }
  279. function Xe(t) {
  280. var e = new t.constructor(t.source, zt.exec(t));
  281. return e.lastIndex = t.lastIndex, e;
  282. }
  283. function Ye(t, e, n) {
  284. var r = e ? n(At(t), !0) : At(t);
  285. return wt(r, ee, new t.constructor());
  286. }
  287. function Ze(t) {
  288. return Mt ? Object(Mt.call(t)) : {};
  289. }
  290. function Qe(t, e) {
  291. var n = e ? tt(t.buffer) : t.buffer;
  292. return new t.constructor(n, t.byteOffset, t.length);
  293. }
  294. function tn(t, e) {
  295. var n = -1, r = t.length;
  296. for (e || (e = Array(r)); ++n < r; )
  297. e[n] = t[n];
  298. return e;
  299. }
  300. function $t(t, e, n, r) {
  301. n || (n = {});
  302. for (var u = -1, f = e.length; ++u < f; ) {
  303. var m = e[u], l = void 0;
  304. It(n, m, l === void 0 ? t[m] : l);
  305. }
  306. return n;
  307. }
  308. function en(t, e) {
  309. return $t(t, Pt(t), e);
  310. }
  311. function nn(t) {
  312. return Fe(t, nt, Pt);
  313. }
  314. function L(t, e) {
  315. var n = t.__data__;
  316. return cn(e) ? n[typeof e == "string" ? "string" : "hash"] : n.map;
  317. }
  318. function O(t, e) {
  319. var n = ae(t, e);
  320. return ke(n) ? n : void 0;
  321. }
  322. var Pt = jt ? q(jt, Object) : gn, A = Ve;
  323. (J && A(new J(new ArrayBuffer(1))) != B || E && A(new E()) != i || X && A(X.resolve()) != ot || Y && A(new Y()) != R || Z && A(new Z()) != W) && (A = function(t) {
  324. var e = U.call(t), n = e == g ? t.constructor : void 0, r = n ? S(n) : void 0;
  325. if (r)
  326. switch (r) {
  327. case _e:
  328. return B;
  329. case ge:
  330. return i;
  331. case ye:
  332. return ot;
  333. case be:
  334. return R;
  335. case me:
  336. return W;
  337. }
  338. return e;
  339. });
  340. function rn(t) {
  341. var e = t.length, n = t.constructor(e);
  342. return e && typeof t[0] == "string" && v.call(t, "index") && (n.index = t.index, n.input = t.input), n;
  343. }
  344. function on(t) {
  345. return typeof t.constructor == "function" && !Rt(t) ? De(ue(t)) : {};
  346. }
  347. function an(t, e, n, r) {
  348. var u = t.constructor;
  349. switch (e) {
  350. case ct:
  351. return tt(t);
  352. case $:
  353. case P:
  354. return new u(+t);
  355. case B:
  356. return ze(t, r);
  357. case ut:
  358. case ft:
  359. case lt:
  360. case pt:
  361. case ht:
  362. case dt:
  363. case _t:
  364. case gt:
  365. case yt:
  366. return Qe(t, r);
  367. case i:
  368. return Je(t, r, n);
  369. case d:
  370. case st:
  371. return new u(t);
  372. case at:
  373. return Xe(t);
  374. case R:
  375. return Ye(t, r, n);
  376. case it:
  377. return Ze(t);
  378. }
  379. }
  380. function sn(t, e) {
  381. return e = e == null ? _ : e, !!e && (typeof t == "number" || Xt.test(t)) && t > -1 && t % 1 == 0 && t < e;
  382. }
  383. function cn(t) {
  384. var e = typeof t;
  385. return e == "string" || e == "number" || e == "symbol" || e == "boolean" ? t !== "__proto__" : t === null;
  386. }
  387. function un(t) {
  388. return !!St && St in t;
  389. }
  390. function Rt(t) {
  391. var e = t && t.constructor, n = typeof e == "function" && e.prototype || G;
  392. return t === n;
  393. }
  394. function S(t) {
  395. if (t != null) {
  396. try {
  397. return Ct.call(t);
  398. } catch (e) {
  399. }
  400. try {
  401. return t + "";
  402. } catch (e) {
  403. }
  404. }
  405. return "";
  406. }
  407. function fn(t) {
  408. return Q(t, !0, !0);
  409. }
  410. function Bt(t, e) {
  411. return t === e || t !== t && e !== e;
  412. }
  413. function ln(t) {
  414. return pn(t) && v.call(t, "callee") && (!le.call(t, "callee") || U.call(t) == s);
  415. }
  416. var et = Array.isArray;
  417. function Gt(t) {
  418. return t != null && dn(t.length) && !Ut(t);
  419. }
  420. function pn(t) {
  421. return _n(t) && Gt(t);
  422. }
  423. var hn = he || yn;
  424. function Ut(t) {
  425. var e = N(t) ? U.call(t) : "";
  426. return e == o || e == c;
  427. }
  428. function dn(t) {
  429. return typeof t == "number" && t > -1 && t % 1 == 0 && t <= _;
  430. }
  431. function N(t) {
  432. var e = typeof t;
  433. return !!t && (e == "object" || e == "function");
  434. }
  435. function _n(t) {
  436. return !!t && typeof t == "object";
  437. }
  438. function nt(t) {
  439. return Gt(t) ? Le(t) : We(t);
  440. }
  441. function gn() {
  442. return [];
  443. }
  444. function yn() {
  445. return !1;
  446. }
  447. p.exports = fn;
  448. })(V, V.exports);
  449. var En = V.exports;
  450. const Mn = /* @__PURE__ */ xn(En);
  451. function In(p) {
  452. if (!p) return null;
  453. p = Mn(p);
  454. let h = Array.isArray(p) ? p.concat() : [p];
  455. for (; h.length; ) {
  456. const C = h.length;
  457. for (let w = 0; w < C; w++) {
  458. const _ = h.shift();
  459. !_.children || !_.children.length || (_.children.forEach((s) => {
  460. s.path[0] !== "/" && !s.path.startsWith("http") && (s.path = _.path.replace(/(\w*)[/]*$/, `$1/${s.path}`));
  461. }), h = h.concat(_.children));
  462. }
  463. }
  464. return p;
  465. }
  466. const $n = { class: "s-menu-top-common" }, Pn = { class: "menu-wrap" }, Rn = {
  467. __name: "STopMenu",
  468. setup(p) {
  469. const h = Cn(), C = Wt(), w = bn(""), _ = Ft(() => {
  470. const o = window.$menuTheme;
  471. return !o || !o.token ? {} : { components: { Menu: o.token } };
  472. }), s = mn({
  473. collapsed: !1,
  474. selectedKeys: [],
  475. openKeys: [],
  476. preOpenKeys: []
  477. });
  478. Vt(
  479. () => s.openKeys,
  480. (o, c) => {
  481. s.preOpenKeys = c;
  482. }
  483. );
  484. const I = (o) => o.map((i) => {
  485. const d = {
  486. key: i.path,
  487. // icon: item.icon ? () => h(item.icon) : null,
  488. icon: null,
  489. label: window.$l(i.name || i.meta.title),
  490. title: window.$l(i.name || i),
  491. path: i.path
  492. };
  493. return i.children && (d.children = I(i.children)), d;
  494. }), $ = Ft(() => {
  495. const o = In(C.dynamics.find((i) => i.path === "/")), c = o && o.children || [];
  496. return I([...c].filter((i) => {
  497. var d;
  498. return !((d = i.meta) != null && d.hidden);
  499. }));
  500. }), P = (o) => {
  501. h.push(o.key), s.selectedKeys = [o.key], window.$utils.ls.set("selectedKeys", s.selectedKeys);
  502. }, k = (o) => {
  503. const c = o.filter((g) => !s.preOpenKeys.includes(g)), i = c[c.length - 1];
  504. s.openKeys = [i], Wt().setMenuOpenKeys(s.openKeys);
  505. };
  506. return wn(() => {
  507. w.value = window.$utils.env.VITE_APP_MENU_THEME || "light";
  508. const o = location.pathname;
  509. window.$utils.ls.set("selectedKeys", [o]), s.selectedKeys = window.$utils.ls.get("selectedKeys") || [];
  510. const c = C.openKeys || [];
  511. s.openKeys = c;
  512. }), Vt(
  513. () => {
  514. var o;
  515. return (o = h.currentRoute.value) == null ? void 0 : o.path;
  516. },
  517. (o) => {
  518. o && (s.selectedKeys = [o], window.$utils.ls.set("selectedKeys", s.selectedKeys));
  519. }
  520. ), (o, c) => {
  521. const i = jn, d = On;
  522. return vn(), Tn("div", $n, [
  523. An("div", Pn, [
  524. kt(d, { theme: _.value }, {
  525. default: Sn(() => [
  526. kt(i, {
  527. openKeys: s.openKeys,
  528. "onUpdate:openKeys": c[0] || (c[0] = (g) => s.openKeys = g),
  529. selectedKeys: s.selectedKeys,
  530. "onUpdate:selectedKeys": c[1] || (c[1] = (g) => s.selectedKeys = g),
  531. mode: "horizontal",
  532. theme: w.value,
  533. items: $.value,
  534. onSelect: P,
  535. onOpenChange: k
  536. }, null, 8, ["openKeys", "selectedKeys", "theme", "items"])
  537. ]),
  538. _: 1
  539. }, 8, ["theme"])
  540. ])
  541. ]);
  542. };
  543. }
  544. }, Hn = /* @__PURE__ */ Kn(Rn, [["__scopeId", "data-v-4cab84cd"]]);
  545. export {
  546. Hn as default
  547. };