@teamias/pro-layout 0.0.1 → 0.0.2

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 (41) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.js +2 -1
  3. package/dist/markdowns/example1/{BasicRexProLayout → BasicProLayout}/index.d.ts +0 -1
  4. package/dist/markdowns/example1/{BasicRexProLayout → BasicProLayout}/index.js +3 -1
  5. package/dist/markdowns/example1/BasicProLayoutBusiness/index.d.ts +2 -0
  6. package/dist/markdowns/example1/BasicProLayoutBusiness/index.js +85 -0
  7. package/dist/markdowns/example1/BasicProLayoutBusiness/pages/Home.d.ts +1 -0
  8. package/dist/markdowns/example1/BasicProLayoutBusiness/pages/Home.js +21 -0
  9. package/dist/markdowns/example1/BasicProLayoutBusiness/pages/Level1.d.ts +1 -0
  10. package/dist/markdowns/example1/BasicProLayoutBusiness/pages/Level1.js +21 -0
  11. package/dist/markdowns/example1/BasicProLayoutBusiness/pages/Level2.d.ts +1 -0
  12. package/dist/markdowns/example1/BasicProLayoutBusiness/pages/Level2.js +21 -0
  13. package/dist/markdowns/example1/BasicProLayoutBusiness/testData.d.ts +53 -0
  14. package/dist/markdowns/example1/BasicProLayoutBusiness/testData.js +82 -0
  15. package/dist/markdowns/example1/RoleSelectDemo/index.d.ts +3 -0
  16. package/dist/markdowns/example1/RoleSelectDemo/index.js +151 -0
  17. package/dist/pro-layout/components/KeepAlive/KeepAliveClass.d.ts +2 -2
  18. package/dist/pro-layout/components/KeepAlive/index.d.ts +1 -1
  19. package/dist/pro-layout/components/Login/index.js +5 -5
  20. package/dist/pro-layout/components/TabsLayout/index.js +5 -12
  21. package/dist/pro-layout/core/index.js +27 -9
  22. package/dist/pro-layout/hooks/index.js +6 -1
  23. package/dist/pro-layout/index.d.ts +7 -1
  24. package/dist/pro-layout/index.js +30 -2
  25. package/dist/pro-layout/style/index.js +2 -2
  26. package/dist/pro-layout/types/index.d.ts +16 -4
  27. package/dist/pro-layout-business/components/RoleSelect.d.ts +1 -0
  28. package/dist/pro-layout-business/components/RoleSelect.js +202 -0
  29. package/dist/pro-layout-business/hooks/use-service.d.ts +36 -0
  30. package/dist/pro-layout-business/hooks/use-service.js +34 -0
  31. package/dist/pro-layout-business/index.d.ts +7 -0
  32. package/dist/pro-layout-business/index.js +81 -0
  33. package/package.json +1 -1
  34. /package/dist/markdowns/example1/{BasicRexProLayout → BasicProLayout}/pages/Home.d.ts +0 -0
  35. /package/dist/markdowns/example1/{BasicRexProLayout → BasicProLayout}/pages/Home.js +0 -0
  36. /package/dist/markdowns/example1/{BasicRexProLayout → BasicProLayout}/pages/Level1.d.ts +0 -0
  37. /package/dist/markdowns/example1/{BasicRexProLayout → BasicProLayout}/pages/Level1.js +0 -0
  38. /package/dist/markdowns/example1/{BasicRexProLayout → BasicProLayout}/pages/Level2.d.ts +0 -0
  39. /package/dist/markdowns/example1/{BasicRexProLayout → BasicProLayout}/pages/Level2.js +0 -0
  40. /package/dist/markdowns/example1/{BasicRexProLayout → BasicProLayout}/testData.d.ts +0 -0
  41. /package/dist/markdowns/example1/{BasicRexProLayout → BasicProLayout}/testData.js +0 -0
@@ -2,14 +2,11 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2
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
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
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
- /*
6
- * @Description: 自定义多标签页
7
- * @Version: 2.0
8
- */
9
- import { Icons, useStateData } from '@teamias/rex-design';
5
+ import { useStateData } from '@teamias/rex-design';
10
6
  import { Badge, Dropdown, Space, Tabs, message } from 'antd';
11
7
  import { eq } from 'lodash-es';
12
8
  import { useEffect } from 'react';
9
+ import { SwapOutlined, SyncOutlined } from '@ant-design/icons';
13
10
  import { useLocation, useNavigate } from 'react-router-dom';
14
11
  import { TABS_LAYOUT } from "../../constant";
15
12
  import { useLayoutContext } from "../../context";
@@ -87,11 +84,7 @@ export var TabsLayout = function TabsLayout() {
87
84
  var renderMenuItem = function renderMenuItem(key, label, icon) {
88
85
  return {
89
86
  label: label,
90
- icon: /*#__PURE__*/_jsx(Icons, {
91
- type: "iconify",
92
- name: icon,
93
- size: 16
94
- }),
87
+ icon: icon,
95
88
  key: key
96
89
  };
97
90
  };
@@ -168,7 +161,7 @@ export var TabsLayout = function TabsLayout() {
168
161
  menu: {
169
162
  items: [
170
163
  // 重新加载
171
- renderMenuItem(TABS_LAYOUT.REFRESH, '重新加载', 'ri:refresh-line'), {
164
+ renderMenuItem(TABS_LAYOUT.REFRESH, '重新加载', /*#__PURE__*/_jsx(SyncOutlined, {})), {
172
165
  type: 'divider'
173
166
  },
174
167
  // 关闭右侧
@@ -177,7 +170,7 @@ export var TabsLayout = function TabsLayout() {
177
170
  // renderMenuItem(TABS_LAYOUT.LEFT, 'ri:skip-left-line'),
178
171
  // {type: 'divider'},
179
172
  // 关闭其它
180
- renderMenuItem(TABS_LAYOUT.OTHERS, '关闭其它', 'ri:arrow-left-right-line')],
173
+ renderMenuItem(TABS_LAYOUT.OTHERS, '关闭其它', /*#__PURE__*/_jsx(SwapOutlined, {}))],
181
174
  onClick: function onClick(_ref4) {
182
175
  var key = _ref4.key;
183
176
  return handleClickMenu(key, pathname);
@@ -34,6 +34,7 @@ var InlineProLayout = function InlineProLayout(_ref) {
34
34
  childrens = _ref.childrens,
35
35
  projectTitle = _ref.projectTitle,
36
36
  loginBgImg = _ref.loginBgImg,
37
+ renderTopRightContent = _ref.renderTopRightContent,
37
38
  requestUserInfoMenuData = _ref.requestUserInfoMenuData,
38
39
  renderSelectLang = _ref.renderSelectLang,
39
40
  onLogin = _ref.onLogin,
@@ -131,14 +132,27 @@ var InlineProLayout = function InlineProLayout(_ref) {
131
132
  style: {
132
133
  height: layoutContext.headerHeight
133
134
  },
134
- children: [/*#__PURE__*/_jsx(TabsLayout, {}), /*#__PURE__*/_jsx(TopHoverBox, {
135
- children: /*#__PURE__*/_jsx(AvatarItem, {
136
- onLogout: onLogout
137
- })
138
- }), renderSelectLang && /*#__PURE__*/_jsx(TopHoverBox, {
139
- "data-lang": true,
140
- children: renderSelectLang()
141
- })]
135
+ children: [/*#__PURE__*/_jsx(TabsLayout, {}), function () {
136
+ var rawAvatarNode = /*#__PURE__*/_jsx(TopHoverBox, {
137
+ children: /*#__PURE__*/_jsx(AvatarItem, {
138
+ onLogout: onLogout
139
+ })
140
+ });
141
+ var rawSelectLang = renderSelectLang ? /*#__PURE__*/_jsx(TopHoverBox, {
142
+ "data-lang": true,
143
+ children: renderSelectLang()
144
+ }) : undefined;
145
+ if (renderTopRightContent) {
146
+ return renderTopRightContent({
147
+ PackageHoverBox: TopHoverBox,
148
+ rawAvatarNode: rawAvatarNode,
149
+ rawSelectLang: rawSelectLang
150
+ });
151
+ }
152
+ return /*#__PURE__*/_jsxs(_Fragment, {
153
+ children: [rawAvatarNode, rawSelectLang || /*#__PURE__*/_jsx(_Fragment, {})]
154
+ });
155
+ }()]
142
156
  })]
143
157
  }), /*#__PURE__*/_jsxs(Main, {
144
158
  children: [/*#__PURE__*/_jsx(Aside, {
@@ -190,8 +204,10 @@ export var ProLayout = function ProLayout(_ref4) {
190
204
  childrens = _ref4.childrens,
191
205
  pageComponentMap = _ref4.pageComponentMap,
192
206
  access = _ref4.access,
193
- requestUserInfoMenuData = _ref4.requestUserInfoMenuData,
207
+ placeholderElement = _ref4.placeholderElement,
208
+ renderTopRightContent = _ref4.renderTopRightContent,
194
209
  renderSelectLang = _ref4.renderSelectLang,
210
+ requestUserInfoMenuData = _ref4.requestUserInfoMenuData,
195
211
  onLogin = _ref4.onLogin,
196
212
  onLogout = _ref4.onLogout;
197
213
  return useMemo(function () {
@@ -206,8 +222,10 @@ export var ProLayout = function ProLayout(_ref4) {
206
222
  collapsed: collapsed,
207
223
  access: access,
208
224
  basename: basename,
225
+ placeholderElement: placeholderElement,
209
226
  children: /*#__PURE__*/_jsx(InlineProLayout, {
210
227
  renderSelectLang: renderSelectLang,
228
+ renderTopRightContent: renderTopRightContent,
211
229
  projectTitle: projectTitle,
212
230
  smallLogoImg: smallLogoImg,
213
231
  loginBgImg: loginBgImg,
@@ -3,6 +3,7 @@ import { NoFoundPage } from "../components/NoFoundPage";
3
3
  import { useLayoutContext } from "../context";
4
4
 
5
5
  /** 这里初始化获取后,除了initialState 变化,会发生更新,其余的 pathname 不会变化 */
6
+ import { Fragment as _Fragment } from "react/jsx-runtime";
6
7
  import { jsx as _jsx } from "react/jsx-runtime";
7
8
  export var useApiRouter = function useApiRouter() {
8
9
  var _layoutContext$routeM;
@@ -34,7 +35,11 @@ export var useAccessRouter = function useAccessRouter() {
34
35
  // 路由不存在, 但有菜单, 使用默认页面
35
36
  if (!currentPage && fullPathDataMap[location.pathname]) {
36
37
  // TODO: 需要注入低代码功能
37
- // currentPage = { element: <BasicEngineApi /> };
38
+ currentPage = {
39
+ element: layoutContext.placeholderElement || /*#__PURE__*/_jsx(_Fragment, {
40
+ children: "\u8BF7\u521B\u5EFA\u8DEF\u7531\u5BF9\u5E94\u7684\u7EC4\u4EF6"
41
+ })
42
+ };
38
43
  // currentPage = { element: <>低代码页面</> };
39
44
  }
40
45
 
@@ -1,4 +1,10 @@
1
- export { useLayoutContext } from './context';
1
+ export { PageLoading } from './components/PageLoading';
2
+ export { LayoutContextProvide, useLayoutContext } from './context';
2
3
  export * from './core';
3
4
  export * from './hooks';
4
5
  export * from './types';
6
+ export { KeepAliveRoot, keepAliveControl, useKeepAlivePages, useLifeCycle } from './components/KeepAlive';
7
+ export { ELifeCycleType } from './components/KeepAlive/types';
8
+ export type { IPageData, IPageLifeCycleCallback } from './components/KeepAlive/types';
9
+ export { useAccessRouter, useApiRouter } from './hooks';
10
+ export { LOCAL_STORAGE } from './constant';
@@ -1,4 +1,32 @@
1
- export { useLayoutContext } from "./context";
1
+ export { PageLoading } from "./components/PageLoading";
2
+ export { LayoutContextProvide, useLayoutContext } from "./context";
2
3
  export * from "./core";
3
4
  export * from "./hooks";
4
- export * from "./types";
5
+ export * from "./types";
6
+
7
+ // KeepAlive 相关(非常实用)
8
+ export { KeepAliveRoot, keepAliveControl, useKeepAlivePages, useLifeCycle } from "./components/KeepAlive";
9
+ export { ELifeCycleType } from "./components/KeepAlive/types";
10
+ // Hooks
11
+ export { useAccessRouter, useApiRouter } from "./hooks";
12
+
13
+ // 工具函数
14
+ // export {
15
+ // getLocalStorageItem,
16
+ // getSessionStorageItem,
17
+ // removeLocalStorageItem,
18
+ // removeSessionStorageItem,
19
+ // setLocalStorageItem,
20
+ // setSessionStorageItem,
21
+ // } from './utils';
22
+ // export { handleMenuData } from './utils/menu';
23
+
24
+ // 组件
25
+ // export { AvatarItem } from './components/AvatarItem';
26
+ // export { Login } from './components/Login';
27
+ // export { Menu } from './components/Menu';
28
+ // export { NoFoundPage } from './components/NoFoundPage';
29
+ // export { TabsLayout } from './components/TabsLayout';
30
+
31
+ // 常量
32
+ export { LOCAL_STORAGE } from "./constant";
@@ -42,7 +42,7 @@ export var TopBox = styled.div.attrs({
42
42
  }).withConfig({
43
43
  displayName: "TopBox",
44
44
  componentId: "pro-layout-aaf4__sc-12ppwnu-5"
45
- })(["display:flex;align-items:flex-end;overflow:hidden;margin-left:-1px;position:sticky;top:0;z-index:2;width:100%;background:#001529;.ant-tabs{flex:1;width:0;color:#fff;}.ant-tabs-nav{margin:0;}.ant-tabs-nav::before{content:initial;}.ant-tabs-tab-remove{display:none;}.ant-tabs-tab{margin:0 6px !important;border-bottom:none !important;color:#fff;border-color:transparent !important;}.ant-tabs-tab-active{.ant-tabs-tab-remove{display:block;}}.ant-tabs-tab:first-child{margin-left:0 !important;}.ant-tabs-ink-bar,.ant-tabs-content-holder{display:none;}.ant-tabs-nav-more{padding:0 6px !important;color:#fff !important;}"]);
45
+ })(["display:flex;align-items:flex-end;overflow:hidden;margin-left:-1px;position:sticky;top:0;z-index:2;width:100%;background:#001529;font-size:14px;.ant-tabs{flex:1;width:0;color:#fff;}.ant-tabs-nav{margin:0;}.ant-tabs-nav::before{content:initial;}.ant-tabs-tab-remove{display:none;}.ant-tabs-tab{margin:0 6px !important;border-bottom:none !important;color:#fff;border-color:transparent !important;}.ant-tabs-tab-active{.ant-tabs-tab-remove{display:block;}}.ant-tabs-tab:first-child{margin-left:0 !important;}.ant-tabs-ink-bar,.ant-tabs-content-holder{display:none;}.ant-tabs-nav-more{padding:0 6px !important;color:#fff !important;}"]);
46
46
  export var ContentBox = styled.div.attrs({
47
47
  className: 'pro-content-box'
48
48
  }).withConfig({
@@ -54,4 +54,4 @@ export var TopHoverBox = styled.div.attrs({
54
54
  }).withConfig({
55
55
  displayName: "TopHoverBox",
56
56
  componentId: "pro-layout-aaf4__sc-12ppwnu-7"
57
- })(["padding-inline:8px;display:flex;align-items:center;gap:8px;border-radius:6px;cursor:pointer;height:40px;overflow:hidden;.ant-dropdown-trigger{display:flex;align-items:center;gap:8px;}&[data-lang]:has(.ant-dropdown-trigger){padding:0;}&[data-lang] .ant-dropdown-trigger{padding-inline:8px !important;height:40px;}&:hover{background:rgba(0,0,0,0.06);}"]);
57
+ })(["padding-inline:8px;display:flex;align-items:center;gap:8px;border-radius:6px;cursor:pointer;height:40px;overflow:hidden;.ant-dropdown-trigger{display:flex;align-items:center;gap:8px;}&[data-lang]:has(.ant-dropdown-trigger){padding:0;}&[data-lang] .ant-dropdown-trigger{padding-inline:8px !important;height:40px;}&:hover{background:rgba(255,255,255,0.04);}> div,> span{height:100%;display:flex;align-items:center;}"]);
@@ -1,5 +1,5 @@
1
- import { ReactNode } from 'react';
2
- export interface IProLayoutProps extends Pick<TLayoutContext, 'projectId' | 'pageComponentMap' | 'access' | 'basename'> {
1
+ import { FC, ReactNode } from 'react';
2
+ export interface IProLayoutProps extends Pick<TLayoutContext, 'projectId' | 'pageComponentMap' | 'access' | 'basename' | 'placeholderElement'> {
3
3
  /** title */
4
4
  projectTitle?: string;
5
5
  /** logo img */
@@ -37,6 +37,15 @@ export interface IProLayoutProps extends Pick<TLayoutContext, 'projectId' | 'pag
37
37
  };
38
38
  /** 渲染多语言选择控件 */
39
39
  renderSelectLang?: () => ReactNode;
40
+ /** 渲染左上角内容 */
41
+ renderTopRightContent?: (data: {
42
+ PackageHoverBox: FC<{
43
+ children?: ReactNode;
44
+ }>;
45
+ rawAvatarNode: ReactNode;
46
+ /** 前提需要实现 renderSelectLang */
47
+ rawSelectLang?: ReactNode;
48
+ }) => ReactNode;
40
49
  /** 用户信息+菜单数据 */
41
50
  requestUserInfoMenuData: () => Promise<Pick<TLayoutContext, 'userInfo'> & {
42
51
  menuData: TApiMenuManagement[];
@@ -51,6 +60,8 @@ export interface IProLayoutProps extends Pick<TLayoutContext, 'projectId' | 'pag
51
60
  }
52
61
  /** context 数据 */
53
62
  export type TLayoutContext = {
63
+ /** 存在路由,但没有组件时候,提供的占位元素 */
64
+ placeholderElement?: ReactNode;
54
65
  /** 路由基础路径 */
55
66
  basename: string;
56
67
  /** 项目 id */
@@ -144,11 +155,12 @@ export type TApiMenuManagement = {
144
155
  /** 菜单类型 */
145
156
  menu_type: 'dir' | 'menu' | 'button';
146
157
  };
147
- type TApiUserInfo = {
158
+ export type TApiUserInfo = {
148
159
  /** 用户名 */
149
160
  username?: string;
150
161
  /** 用户ID */
151
162
  id?: string;
163
+ job_id?: number;
164
+ model_id?: string | number;
152
165
  [key: string]: any;
153
166
  };
154
- export {};
@@ -0,0 +1 @@
1
+ export declare const RoleSelect: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,202 @@
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 { useLayoutContext } from "../../pro-layout/context";
6
+ import { ProjectOutlined, RightOutlined, SearchOutlined } from '@ant-design/icons';
7
+ import { useStateData } from '@teamias/rex-design';
8
+ import { useDebounceEffect } from 'ahooks';
9
+ import { Empty, Flex, Input, Menu, Modal, Popover, Spin } from 'antd';
10
+ import { useEffect, useMemo } from 'react';
11
+ import styled from 'styled-components';
12
+ import { useService } from "../hooks/use-service";
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ import { jsxs as _jsxs } from "react/jsx-runtime";
15
+ import { Fragment as _Fragment } from "react/jsx-runtime";
16
+ export var RoleSelect = function RoleSelect() {
17
+ var service = useService();
18
+ var _useLayoutContext = useLayoutContext(),
19
+ userInfo = _useLayoutContext.userInfo;
20
+ var _useStateData = useStateData(function () {
21
+ return {
22
+ loading: false,
23
+ searchText: '',
24
+ modelId: userInfo !== null && userInfo !== void 0 && userInfo.model_id ? [String(userInfo.model_id)] : [],
25
+ jobId: userInfo !== null && userInfo !== void 0 && userInfo.job_id ? [String(userInfo.job_id)] : [],
26
+ rawDataMap: {},
27
+ modelList: [],
28
+ jobList: [],
29
+ searchList: []
30
+ };
31
+ }),
32
+ state = _useStateData.state,
33
+ update = _useStateData.update;
34
+ var findLabel = useMemo(function () {
35
+ if (state.loading) return '';
36
+ var jobId = state.jobId[0];
37
+ if (!jobId) {
38
+ return '未选择角色';
39
+ }
40
+ for (var _i = 0, _Object$values = Object.values(state.rawDataMap); _i < _Object$values.length; _i++) {
41
+ var model = _Object$values[_i];
42
+ var job = model.childs.find(function (ii) {
43
+ return String(ii.id) === jobId;
44
+ });
45
+ if (job) {
46
+ return job.title;
47
+ }
48
+ }
49
+ return '未知角色';
50
+ }, [state.jobId, state.rawDataMap, state.loading]);
51
+ var updateDataAndJobList = function updateDataAndJobList(modelId) {
52
+ state.modelId = modelId;
53
+ state.jobList = state.rawDataMap[modelId[0]].childs.map(function (ii) {
54
+ return {
55
+ label: ii.title,
56
+ key: String(ii.id)
57
+ };
58
+ });
59
+ // state.jobId = state.jobList.length ? [state.jobList[0].key] : [];
60
+ update();
61
+ };
62
+ var getData = /*#__PURE__*/function () {
63
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
64
+ var res, data;
65
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
66
+ while (1) switch (_context.prev = _context.next) {
67
+ case 0:
68
+ state.loading = true;
69
+ update();
70
+ _context.prev = 2;
71
+ _context.next = 5;
72
+ return service.getCanJobsApi();
73
+ case 5:
74
+ res = _context.sent;
75
+ data = Array.isArray(res.data) ? res.data : [res.data];
76
+ state.rawDataMap = data.reduce(function (acc, item) {
77
+ acc[String(item.id)] = item;
78
+ return acc;
79
+ }, {});
80
+ state.modelList = data.map(function (ii) {
81
+ return {
82
+ label: /*#__PURE__*/_jsxs(Flex, {
83
+ justify: "space-between",
84
+ align: "center",
85
+ style: {
86
+ width: '100%'
87
+ },
88
+ children: [ii.title, /*#__PURE__*/_jsx(RightOutlined, {
89
+ style: {
90
+ zoom: 0.8
91
+ }
92
+ })]
93
+ }),
94
+ key: String(ii.id)
95
+ };
96
+ });
97
+ updateDataAndJobList(state.modelId);
98
+ _context.next = 15;
99
+ break;
100
+ case 12:
101
+ _context.prev = 12;
102
+ _context.t0 = _context["catch"](2);
103
+ console.error(_context.t0);
104
+ case 15:
105
+ state.loading = false;
106
+ update();
107
+ case 17:
108
+ case "end":
109
+ return _context.stop();
110
+ }
111
+ }, _callee, null, [[2, 12]]);
112
+ }));
113
+ return function getData() {
114
+ return _ref.apply(this, arguments);
115
+ };
116
+ }();
117
+ useEffect(function () {
118
+ getData();
119
+ }, []);
120
+ useDebounceEffect(function () {
121
+ if (!state.searchText) {
122
+ state.searchList = state.jobList;
123
+ update();
124
+ return;
125
+ }
126
+ var keyword = state.searchText.toLowerCase();
127
+ state.searchList = state.jobList.filter(function (ii) {
128
+ return ii.label.toLowerCase().includes(keyword);
129
+ });
130
+ update();
131
+ }, [state.searchText, state.jobList], {
132
+ wait: 16
133
+ });
134
+ return /*#__PURE__*/_jsx(Popover, {
135
+ placement: "bottomRight",
136
+ styles: {
137
+ body: {
138
+ padding: 6
139
+ }
140
+ },
141
+ content: /*#__PURE__*/_jsx(Spin, {
142
+ spinning: state.loading,
143
+ children: /*#__PURE__*/_jsx(BoxDiv, {
144
+ children: state.modelList.length === 0 ? /*#__PURE__*/_jsx(Empty, {
145
+ description: "\u6682\u65E0\u53EF\u5207\u6362\u89D2\u8272",
146
+ style: {
147
+ margin: 'auto'
148
+ }
149
+ }) : /*#__PURE__*/_jsxs(_Fragment, {
150
+ children: [/*#__PURE__*/_jsx(Menu, {
151
+ className: "left",
152
+ selectedKeys: state.modelId,
153
+ items: state.modelList,
154
+ onSelect: function onSelect(key) {
155
+ updateDataAndJobList(key.selectedKeys);
156
+ }
157
+ }), /*#__PURE__*/_jsxs("div", {
158
+ className: "right",
159
+ children: [/*#__PURE__*/_jsx("div", {
160
+ className: "input-box",
161
+ children: /*#__PURE__*/_jsx(Input, {
162
+ placeholder: "\u641C\u7D22...",
163
+ prefix: /*#__PURE__*/_jsx(SearchOutlined, {}),
164
+ value: state.searchText,
165
+ onChange: function onChange(e) {
166
+ state.searchText = e.target.value || '';
167
+ update();
168
+ }
169
+ })
170
+ }), /*#__PURE__*/_jsx(Menu, {
171
+ selectedKeys: state.jobId,
172
+ items: state.searchList,
173
+ onSelect: function onSelect(info) {
174
+ console.log(info);
175
+
176
+ // state.jobId = key.selectedKeys;
177
+ // update();
178
+ Modal.confirm({
179
+ title: '切换角色确认',
180
+ content: '切换角色后需要刷新页面,是否确认?',
181
+ onOk: function onOk() {
182
+ service.toggleJobApi(state.modelId[0], Number(info.selectedKeys[0])).then(function () {
183
+ window.location.reload();
184
+ });
185
+ }
186
+ });
187
+ }
188
+ })]
189
+ })]
190
+ })
191
+ })
192
+ }),
193
+ children: /*#__PURE__*/_jsxs(Flex, {
194
+ gap: 4,
195
+ children: [/*#__PURE__*/_jsx(ProjectOutlined, {}), findLabel]
196
+ })
197
+ });
198
+ };
199
+ var BoxDiv = styled.div.withConfig({
200
+ displayName: "BoxDiv",
201
+ componentId: "pro-layout-aaf4__sc-15rr1b5-0"
202
+ })(["width:420px;height:300px;max-height:300px;display:flex;.left{width:160px;max-height:inherit;overflow:auto;}.right{flex:1;max-height:inherit;overflow:auto;position:relative;.input-box{width:auto;position:sticky;top:0;padding:5px;margin-bottom:5px;background-color:#fff;z-index:2;}.ant-menu{border:none;}}"]);
@@ -0,0 +1,36 @@
1
+ import { TApiMenuManagement, TApiUserInfo } from "../..";
2
+ export declare const useService: () => {
3
+ /** 登录接口 */
4
+ loginApi: (params: {
5
+ username?: string;
6
+ password?: string;
7
+ }) => Promise<{
8
+ data: {
9
+ token: string;
10
+ userInfo: TApiUserInfo;
11
+ };
12
+ }>;
13
+ /** 退出接口 */
14
+ logoutApi: () => Promise<unknown>;
15
+ /** 获取用户信息接口 */
16
+ getUserInfoApi: () => Promise<{
17
+ data: TApiUserInfo;
18
+ }>;
19
+ /** 获取菜单数据接口 */
20
+ getMenuDataApi: () => Promise<{
21
+ data: TApiMenuManagement[];
22
+ }>;
23
+ /** 获取可用角色接口 */
24
+ getCanJobsApi: () => Promise<{
25
+ data: {
26
+ id: string;
27
+ title: string;
28
+ childs: {
29
+ id: number;
30
+ title: string;
31
+ }[];
32
+ }[];
33
+ }>;
34
+ /** 切换角色接口 */
35
+ toggleJobApi: (model_id: string, job_id: number) => Promise<unknown>;
36
+ };
@@ -0,0 +1,34 @@
1
+ import { useRexProConfigProvider } from '@teamias/rex-design';
2
+ export var useService = function useService() {
3
+ var _useRexProConfigProvi = useRexProConfigProvider(),
4
+ apiClient = _useRexProConfigProvi.apiClient;
5
+ return {
6
+ /** 登录接口 */
7
+ loginApi: function loginApi(params) {
8
+ return apiClient('/grpc/auth/login', params);
9
+ },
10
+ /** 退出接口 */
11
+ logoutApi: function logoutApi() {
12
+ return apiClient('/grpc/auth/logout');
13
+ },
14
+ /** 获取用户信息接口 */
15
+ getUserInfoApi: function getUserInfoApi() {
16
+ return apiClient('/grpc/auth/user_info');
17
+ },
18
+ /** 获取菜单数据接口 */
19
+ getMenuDataApi: function getMenuDataApi() {
20
+ return apiClient('/grpc/menu/tree');
21
+ },
22
+ /** 获取可用角色接口 */
23
+ getCanJobsApi: function getCanJobsApi() {
24
+ return apiClient('/grpc/auth/canjobs');
25
+ },
26
+ /** 切换角色接口 */
27
+ toggleJobApi: function toggleJobApi(model_id, job_id) {
28
+ return apiClient('/grpc/auth/do_job', {
29
+ model_id: model_id,
30
+ job_id: job_id
31
+ });
32
+ }
33
+ };
34
+ };
@@ -0,0 +1,7 @@
1
+ import { ProLayout } from "..";
2
+ import { GetProps } from 'antd';
3
+ import { FC } from 'react';
4
+ import { RoleSelect } from './components/RoleSelect';
5
+ export declare const ProLayoutBusiness: FC<IProLayoutBusinessProps>;
6
+ export { RoleSelect };
7
+ type IProLayoutBusinessProps = Omit<GetProps<typeof ProLayout>, 'renderTopRightContent' | 'requestUserInfoMenuData' | 'onLogin' | 'onLogout'>;