STopMenu.js 15 KB

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