@teamias/pro-layout 0.0.1

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 (68) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +0 -0
  3. package/dist/index.d.ts +1 -0
  4. package/dist/index.js +1 -0
  5. package/dist/markdowns/example1/BasicRexProLayout/index.d.ts +3 -0
  6. package/dist/markdowns/example1/BasicRexProLayout/index.js +83 -0
  7. package/dist/markdowns/example1/BasicRexProLayout/pages/Home.d.ts +1 -0
  8. package/dist/markdowns/example1/BasicRexProLayout/pages/Home.js +21 -0
  9. package/dist/markdowns/example1/BasicRexProLayout/pages/Level1.d.ts +1 -0
  10. package/dist/markdowns/example1/BasicRexProLayout/pages/Level1.js +21 -0
  11. package/dist/markdowns/example1/BasicRexProLayout/pages/Level2.d.ts +1 -0
  12. package/dist/markdowns/example1/BasicRexProLayout/pages/Level2.js +21 -0
  13. package/dist/markdowns/example1/BasicRexProLayout/testData.d.ts +53 -0
  14. package/dist/markdowns/example1/BasicRexProLayout/testData.js +82 -0
  15. package/dist/pro-layout/assets/login-bg.png +0 -0
  16. package/dist/pro-layout/assets/logo.png +0 -0
  17. package/dist/pro-layout/components/AvatarItem.d.ts +3 -0
  18. package/dist/pro-layout/components/AvatarItem.js +93 -0
  19. package/dist/pro-layout/components/Collapsed.d.ts +5 -0
  20. package/dist/pro-layout/components/Collapsed.js +23 -0
  21. package/dist/pro-layout/components/DocumentTitle.d.ts +4 -0
  22. package/dist/pro-layout/components/DocumentTitle.js +24 -0
  23. package/dist/pro-layout/components/KeepAlive/KeepAliveClass.d.ts +44 -0
  24. package/dist/pro-layout/components/KeepAlive/KeepAliveClass.js +448 -0
  25. package/dist/pro-layout/components/KeepAlive/index.d.ts +13 -0
  26. package/dist/pro-layout/components/KeepAlive/index.js +17 -0
  27. package/dist/pro-layout/components/KeepAlive/modules/useCacheTabsLayout.d.ts +26 -0
  28. package/dist/pro-layout/components/KeepAlive/modules/useCacheTabsLayout.js +75 -0
  29. package/dist/pro-layout/components/KeepAlive/types.d.ts +25 -0
  30. package/dist/pro-layout/components/KeepAlive/types.js +9 -0
  31. package/dist/pro-layout/components/Login/Account.d.ts +1 -0
  32. package/dist/pro-layout/components/Login/Account.js +41 -0
  33. package/dist/pro-layout/components/Login/index.d.ts +3 -0
  34. package/dist/pro-layout/components/Login/index.js +127 -0
  35. package/dist/pro-layout/components/Login/style.d.ts +2 -0
  36. package/dist/pro-layout/components/Login/style.js +5 -0
  37. package/dist/pro-layout/components/Menu/index.d.ts +8 -0
  38. package/dist/pro-layout/components/Menu/index.js +142 -0
  39. package/dist/pro-layout/components/Menu/style.d.ts +7 -0
  40. package/dist/pro-layout/components/Menu/style.js +19 -0
  41. package/dist/pro-layout/components/NoFoundPage/index.d.ts +4 -0
  42. package/dist/pro-layout/components/NoFoundPage/index.js +45 -0
  43. package/dist/pro-layout/components/PageLoading.d.ts +2 -0
  44. package/dist/pro-layout/components/PageLoading.js +14 -0
  45. package/dist/pro-layout/components/SystemId.d.ts +3 -0
  46. package/dist/pro-layout/components/SystemId.js +17 -0
  47. package/dist/pro-layout/components/TabsLayout/index.d.ts +2 -0
  48. package/dist/pro-layout/components/TabsLayout/index.js +193 -0
  49. package/dist/pro-layout/constant/index.d.ts +20 -0
  50. package/dist/pro-layout/constant/index.js +19 -0
  51. package/dist/pro-layout/context/index.d.ts +6 -0
  52. package/dist/pro-layout/context/index.js +84 -0
  53. package/dist/pro-layout/core/index.d.ts +4 -0
  54. package/dist/pro-layout/core/index.js +222 -0
  55. package/dist/pro-layout/hooks/index.d.ts +14 -0
  56. package/dist/pro-layout/hooks/index.js +65 -0
  57. package/dist/pro-layout/index.d.ts +4 -0
  58. package/dist/pro-layout/index.js +4 -0
  59. package/dist/pro-layout/style/index.d.ts +27 -0
  60. package/dist/pro-layout/style/index.js +57 -0
  61. package/dist/pro-layout/types/index.d.ts +154 -0
  62. package/dist/pro-layout/types/index.js +1 -0
  63. package/dist/pro-layout/utils/index.d.ts +25 -0
  64. package/dist/pro-layout/utils/index.js +63 -0
  65. package/dist/pro-layout/utils/menu.d.ts +15 -0
  66. package/dist/pro-layout/utils/menu.js +122 -0
  67. package/dist/types/svg.d.ts +24 -0
  68. package/package.json +108 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) cloudovo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
File without changes
@@ -0,0 +1 @@
1
+ export * from './pro-layout';
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ export * from "./pro-layout";
@@ -0,0 +1,3 @@
1
+ import 'antd/dist/reset.css';
2
+ declare const _default: () => import("react/jsx-runtime").JSX.Element;
3
+ export default _default;
@@ -0,0 +1,83 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
3
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
4
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
5
+ import { ProLayoutMemo } from "../../..";
6
+ import 'antd/dist/reset.css';
7
+ import { sleep } from 'radash';
8
+ import { useEffect } from 'react';
9
+ import ReactDom from 'react-dom';
10
+ import { MemoryRouter } from 'react-router-dom';
11
+ import { menuData, pageComponentMap } from "./testData";
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ var BasicProLayout = function BasicProLayout() {
14
+ return /*#__PURE__*/_jsx(MemoryRouter, {
15
+ children: /*#__PURE__*/_jsx(ProLayoutMemo, {
16
+ basename: "/",
17
+ projectId: "demo-project",
18
+ pageComponentMap: pageComponentMap,
19
+ requestUserInfoMenuData: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
20
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
21
+ while (1) switch (_context.prev = _context.next) {
22
+ case 0:
23
+ _context.next = 2;
24
+ return sleep(100);
25
+ case 2:
26
+ return _context.abrupt("return", {
27
+ userInfo: {
28
+ id: '1',
29
+ username: 'demo-user'
30
+ },
31
+ menuData: menuData
32
+ });
33
+ case 3:
34
+ case "end":
35
+ return _context.stop();
36
+ }
37
+ }, _callee);
38
+ })),
39
+ onLogin: ( /*#__PURE__*/function () {
40
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
41
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
42
+ while (1) switch (_context2.prev = _context2.next) {
43
+ case 0:
44
+ return _context2.abrupt("return", {
45
+ token: 'demo-token',
46
+ userInfo: {
47
+ id: '1',
48
+ username: 'demo-user'
49
+ }
50
+ });
51
+ case 1:
52
+ case "end":
53
+ return _context2.stop();
54
+ }
55
+ }, _callee2);
56
+ }));
57
+ return function (_x) {
58
+ return _ref2.apply(this, arguments);
59
+ };
60
+ }()),
61
+ onLogout: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
62
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
63
+ while (1) switch (_context3.prev = _context3.next) {
64
+ case 0:
65
+ console.log('退出');
66
+ case 1:
67
+ case "end":
68
+ return _context3.stop();
69
+ }
70
+ }, _callee3);
71
+ }))
72
+ })
73
+ });
74
+ };
75
+ export default (function () {
76
+ useEffect(function () {
77
+ var dom = document.getElementById('pro-layout');
78
+ ReactDom.render( /*#__PURE__*/_jsx(BasicProLayout, {}), dom);
79
+ }, []);
80
+ return /*#__PURE__*/_jsx("div", {
81
+ id: "pro-layout"
82
+ });
83
+ });
@@ -0,0 +1 @@
1
+ export declare const Home: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,21 @@
1
+ import { useStateData } from '@teamias/rex-design';
2
+ import { Button } from 'antd';
3
+ import { jsxs as _jsxs } from "react/jsx-runtime";
4
+ import { Fragment as _Fragment } from "react/jsx-runtime";
5
+ export var Home = function Home() {
6
+ var _useStateData = useStateData(function () {
7
+ return {
8
+ count: 0
9
+ };
10
+ }),
11
+ state = _useStateData.state,
12
+ setState = _useStateData.setState;
13
+ return /*#__PURE__*/_jsxs(_Fragment, {
14
+ children: ["\u9996\u9875", /*#__PURE__*/_jsxs(Button, {
15
+ onClick: function onClick() {
16
+ return setState('count', state.count + 1);
17
+ },
18
+ children: ["Count: ", state.count]
19
+ })]
20
+ });
21
+ };
@@ -0,0 +1 @@
1
+ export declare const Level1: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,21 @@
1
+ import { useStateData } from '@teamias/rex-design';
2
+ import { Button } from 'antd';
3
+ import { jsxs as _jsxs } from "react/jsx-runtime";
4
+ import { Fragment as _Fragment } from "react/jsx-runtime";
5
+ export var Level1 = function Level1() {
6
+ var _useStateData = useStateData(function () {
7
+ return {
8
+ count: 0
9
+ };
10
+ }),
11
+ state = _useStateData.state,
12
+ setState = _useStateData.setState;
13
+ return /*#__PURE__*/_jsxs(_Fragment, {
14
+ children: ["\u4E00\u7EA7", /*#__PURE__*/_jsxs(Button, {
15
+ onClick: function onClick() {
16
+ return setState('count', state.count + 1);
17
+ },
18
+ children: ["Count: ", state.count]
19
+ })]
20
+ });
21
+ };
@@ -0,0 +1 @@
1
+ export declare const Level2: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,21 @@
1
+ import { useStateData } from '@teamias/rex-design';
2
+ import { Button } from 'antd';
3
+ import { jsxs as _jsxs } from "react/jsx-runtime";
4
+ import { Fragment as _Fragment } from "react/jsx-runtime";
5
+ export var Level2 = function Level2() {
6
+ var _useStateData = useStateData(function () {
7
+ return {
8
+ count: 0
9
+ };
10
+ }),
11
+ state = _useStateData.state,
12
+ setState = _useStateData.setState;
13
+ return /*#__PURE__*/_jsxs(_Fragment, {
14
+ children: ["\u4E8C\u7EA7", /*#__PURE__*/_jsxs(Button, {
15
+ onClick: function onClick() {
16
+ return setState('count', state.count + 1);
17
+ },
18
+ children: ["Count: ", state.count]
19
+ })]
20
+ });
21
+ };
@@ -0,0 +1,53 @@
1
+ export declare const pageComponentMap: {
2
+ '/': {
3
+ element: import("react/jsx-runtime").JSX.Element;
4
+ };
5
+ '/menu/page1': {
6
+ element: import("react/jsx-runtime").JSX.Element;
7
+ };
8
+ '/menu/page2': {
9
+ element: import("react/jsx-runtime").JSX.Element;
10
+ };
11
+ };
12
+ export declare const menuData: ({
13
+ id: string;
14
+ app_id: number;
15
+ title: string;
16
+ icon: string;
17
+ type: 1;
18
+ routing: string;
19
+ component: string;
20
+ pid: string;
21
+ permission: string;
22
+ hidden: 0;
23
+ menu_type: "menu";
24
+ status_text: string;
25
+ children?: undefined;
26
+ } | {
27
+ id: string;
28
+ app_id: number;
29
+ title: string;
30
+ icon: string;
31
+ type: 4;
32
+ routing: string;
33
+ component: string;
34
+ pid: string;
35
+ permission: string;
36
+ hidden: 0;
37
+ menu_type: "dir";
38
+ status_text: string;
39
+ children: {
40
+ id: string;
41
+ app_id: number;
42
+ title: string;
43
+ icon: string;
44
+ type: 1;
45
+ routing: string;
46
+ component: string;
47
+ pid: string;
48
+ permission: string;
49
+ hidden: 0;
50
+ menu_type: "menu";
51
+ status_text: string;
52
+ }[];
53
+ })[];
@@ -0,0 +1,82 @@
1
+ import { Home } from "./pages/Home";
2
+ import { Level1 } from "./pages/Level1";
3
+ import { Level2 } from "./pages/Level2";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ export var pageComponentMap = {
6
+ '/': {
7
+ element: /*#__PURE__*/_jsx(Home, {})
8
+ },
9
+ '/menu/page1': {
10
+ element: /*#__PURE__*/_jsx(Level1, {})
11
+ },
12
+ '/menu/page2': {
13
+ element: /*#__PURE__*/_jsx(Level2, {})
14
+ }
15
+ };
16
+ export var menuData = [{
17
+ id: '83',
18
+ app_id: 2,
19
+ title: '首页',
20
+ icon: '',
21
+ type: 1,
22
+ routing: '/',
23
+ component: '',
24
+ pid: '82',
25
+ permission: '',
26
+ hidden: 0,
27
+ menu_type: 'menu',
28
+ status_text: ''
29
+ }, {
30
+ id: '81',
31
+ app_id: 2,
32
+ title: '菜单',
33
+ icon: '',
34
+ type: 4,
35
+ routing: '/menu',
36
+ component: '',
37
+ pid: '0',
38
+ permission: '',
39
+ hidden: 0,
40
+ menu_type: 'dir',
41
+ status_text: '',
42
+ children: [{
43
+ id: '831',
44
+ app_id: 2,
45
+ title: '一级',
46
+ icon: '',
47
+ type: 1,
48
+ routing: '/page1',
49
+ component: '',
50
+ pid: '82',
51
+ permission: '',
52
+ hidden: 0,
53
+ menu_type: 'menu',
54
+ status_text: ''
55
+ }, {
56
+ id: '842',
57
+ app_id: 2,
58
+ title: '二级',
59
+ icon: '',
60
+ type: 1,
61
+ routing: '/page2',
62
+ component: '',
63
+ pid: '82',
64
+ permission: '',
65
+ hidden: 0,
66
+ menu_type: 'menu',
67
+ status_text: ''
68
+ }, {
69
+ id: '843',
70
+ app_id: 2,
71
+ title: '低代码页',
72
+ icon: '',
73
+ type: 1,
74
+ routing: '/page3',
75
+ component: '',
76
+ pid: '82',
77
+ permission: '',
78
+ hidden: 0,
79
+ menu_type: 'menu',
80
+ status_text: ''
81
+ }]
82
+ }];
Binary file
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { IProLayoutProps } from '../types';
3
+ export declare const AvatarItem: FC<Pick<IProLayoutProps, 'onLogout'>>;
@@ -0,0 +1,93 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
3
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
4
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
5
+ import { LogoutOutlined, UserOutlined } from '@ant-design/icons';
6
+ import { Avatar, Dropdown, Modal } from 'antd';
7
+ import { LOCAL_STORAGE } from "../constant";
8
+ import { useLayoutContext } from "../context";
9
+ import { setLocalStorageItem } from "../utils";
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ import { jsxs as _jsxs } from "react/jsx-runtime";
12
+ export var AvatarItem = function AvatarItem(_ref) {
13
+ var onLogout = _ref.onLogout;
14
+ var _useLayoutContext = useLayoutContext(),
15
+ userInfo = _useLayoutContext.userInfo,
16
+ updateData = _useLayoutContext.updateData;
17
+ var logOutClick = function logOutClick() {
18
+ Modal.confirm({
19
+ title: '温馨提示',
20
+ content: '确认要退出系统?',
21
+ onOk: function () {
22
+ var _onOk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
23
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
24
+ while (1) switch (_context.prev = _context.next) {
25
+ case 0:
26
+ _context.prev = 0;
27
+ _context.next = 3;
28
+ return onLogout();
29
+ case 3:
30
+ setLocalStorageItem(LOCAL_STORAGE.ACCESS_TOKEN, '');
31
+ updateData({}, 'replace');
32
+ _context.next = 10;
33
+ break;
34
+ case 7:
35
+ _context.prev = 7;
36
+ _context.t0 = _context["catch"](0);
37
+ console.error(_context.t0);
38
+ case 10:
39
+ case "end":
40
+ return _context.stop();
41
+ }
42
+ }, _callee, null, [[0, 7]]);
43
+ }));
44
+ function onOk() {
45
+ return _onOk.apply(this, arguments);
46
+ }
47
+ return onOk;
48
+ }()
49
+ });
50
+ };
51
+ return /*#__PURE__*/_jsx(Dropdown, {
52
+ menu: {
53
+ onClick: function onClick(event) {
54
+ switch (event.key) {
55
+ // 退出登录
56
+ case 'logout':
57
+ logOutClick();
58
+ break;
59
+ }
60
+ },
61
+ items: [
62
+ // {
63
+ // key: 'personalCenter',
64
+ // icon: <Icons size={16} type="iconify" name="ri:shield-user-line" />,
65
+ // label: formatMessage({id: 'pages.personal-center'}),
66
+ // },
67
+ // {
68
+ // type: 'divider',
69
+ // },
70
+ {
71
+ key: 'logout',
72
+ icon: /*#__PURE__*/_jsx(LogoutOutlined, {}),
73
+ label: '退出登录'
74
+ }]
75
+ },
76
+ children: /*#__PURE__*/_jsxs("span", {
77
+ children: [/*#__PURE__*/_jsx(Avatar, {
78
+ icon: /*#__PURE__*/_jsx(UserOutlined, {
79
+ style: {
80
+ color: '#1677ff'
81
+ }
82
+ }),
83
+ style: {
84
+ background: '#fff',
85
+ boxShadow: 'rgb(22 119 255 / 24%) 0px 0px 6px 1px'
86
+ },
87
+ size: "small"
88
+ }), /*#__PURE__*/_jsx("span", {
89
+ children: userInfo === null || userInfo === void 0 ? void 0 : userInfo.username
90
+ })]
91
+ })
92
+ });
93
+ };
@@ -0,0 +1,5 @@
1
+ import { FC } from 'react';
2
+ export declare const Collapsed: FC<{
3
+ value: boolean;
4
+ onChange: (val: boolean) => void;
5
+ }>;
@@ -0,0 +1,23 @@
1
+ import { MenuFoldOutlined, MenuUnfoldOutlined } from '@ant-design/icons';
2
+ import { Button } from 'antd';
3
+ import { useLayoutContext } from "../context";
4
+ import { Fragment as _Fragment } from "react/jsx-runtime";
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ export var Collapsed = function Collapsed(_ref) {
7
+ var value = _ref.value,
8
+ onChange = _ref.onChange;
9
+ var _useLayoutContext = useLayoutContext(),
10
+ hideMenu = _useLayoutContext.hideMenu;
11
+ if (hideMenu) return /*#__PURE__*/_jsx(_Fragment, {});
12
+ return /*#__PURE__*/_jsx(Button, {
13
+ type: "link",
14
+ size: "small",
15
+ style: {
16
+ padding: 0
17
+ },
18
+ onClick: function onClick() {
19
+ return onChange(!value);
20
+ },
21
+ children: !value ? /*#__PURE__*/_jsx(MenuFoldOutlined, {}) : /*#__PURE__*/_jsx(MenuUnfoldOutlined, {})
22
+ });
23
+ };
@@ -0,0 +1,4 @@
1
+ import { FC } from 'react';
2
+ export declare const DocumentTitle: FC<{
3
+ title?: string;
4
+ }>;
@@ -0,0 +1,24 @@
1
+ import { useEffect } from 'react';
2
+ import { useAccessRouter } from "../hooks";
3
+ import { Fragment as _Fragment } from "react/jsx-runtime";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ export var DocumentTitle = function DocumentTitle(_ref) {
6
+ var title = _ref.title;
7
+ var _useAccessRouter = useAccessRouter(),
8
+ _useAccessRouter$loca = _useAccessRouter.location,
9
+ pageStatus = _useAccessRouter$loca.pageStatus,
10
+ pathname = _useAccessRouter$loca.pathname,
11
+ pageTitle = _useAccessRouter$loca.pageTitle;
12
+ useEffect(function () {
13
+ if (title) {
14
+ document.title = title;
15
+ return;
16
+ }
17
+ // if ([403, 404].includes(pageStatus)) {
18
+ // document.title = pageStatus + '';
19
+ // return;
20
+ // }
21
+ document.title = pageTitle;
22
+ }, [pathname, pageStatus, pageTitle, title]);
23
+ return /*#__PURE__*/_jsx(_Fragment, {});
24
+ };
@@ -0,0 +1,44 @@
1
+ import { IPageLifeCycleCallback } from './types';
2
+ export declare class KeepAliveClass {
3
+ static instance: KeepAliveClass;
4
+ id: string;
5
+ /** 容器dom */
6
+ private contentDom?;
7
+ /** 容器组件更新 */
8
+ private contentUpdate?;
9
+ /** 收集获取pages的组件,进行更新触发 */
10
+ private pagesHookUpdate;
11
+ /** keep-alive 存储数据 */
12
+ private keepAliveData;
13
+ /** 获取实例,并初始化 */
14
+ static getInstance(): KeepAliveClass;
15
+ private constructor();
16
+ /** 更新所有 */
17
+ updateAllComponent(type?: 'all' | 'pagesHook' | 'context'): Promise<void>;
18
+ /** 获取页面数据 */
19
+ getPages(): (import("react-router-dom").Location & {
20
+ pageStatus: 200 | 404 | 403;
21
+ pageTitle: string;
22
+ })[];
23
+ /** 关闭页面 */
24
+ closePage(assignKey: string): number;
25
+ /** 关闭所有页面 */
26
+ closeAllPage(retainKeys?: string[]): void;
27
+ /** 关闭其他页面(除了当前路径的保留,可以传入参数保留额外的) */
28
+ closeOtherPage(isRetainCurrentKey?: boolean, retainKeys?: string[]): void;
29
+ /** 刷新页面 */
30
+ refreshPage(assignKey: string): Promise<void>;
31
+ /** hooks 回调页面 初次加载 或 再次加载,以及参数的变化 */
32
+ useLifeCycle: (callback: IPageLifeCycleCallback) => void;
33
+ /** 获取缓存页面数组 */
34
+ useKeepAlivePages: () => (import("react-router-dom").Location & {
35
+ pageStatus: 200 | 404 | 403;
36
+ pageTitle: string;
37
+ })[];
38
+ /** 更新当前路由页面 */
39
+ updateCurrentPage(index?: number): void;
40
+ /** 根渲染容器组件 */
41
+ Content: () => import("react/jsx-runtime").JSX.Element;
42
+ /** 页面挂载组件 */
43
+ private KeepAliveItem;
44
+ }