@teamias/pro-layout 0.0.19 → 0.0.20

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.
@@ -10,6 +10,7 @@ import { useEffect } from 'react';
10
10
  import ReactDom from 'react-dom';
11
11
  import { MemoryRouter } from 'react-router-dom';
12
12
  import { PlaceholderElement } from "./pages/PlaceholderElement";
13
+ import { pageComponentMap } from "./testData";
13
14
  import { jsx as _jsx } from "react/jsx-runtime";
14
15
  var BasicProLayout = function BasicProLayout() {
15
16
  return /*#__PURE__*/_jsx(RexProConfigProvider, {
@@ -65,9 +66,8 @@ var BasicProLayout = function BasicProLayout() {
65
66
  children: /*#__PURE__*/_jsx(MemoryRouter, {
66
67
  children: /*#__PURE__*/_jsx(ProLayoutBusiness, {
67
68
  basename: "/",
68
- projectId: "2"
69
- // pageComponentMap={pageComponentMap}
70
- ,
69
+ projectId: "2",
70
+ pageComponentMap: pageComponentMap,
71
71
  renderMenuItem: function renderMenuItem(item, type) {
72
72
  return /*#__PURE__*/_jsx(MenuItem, {
73
73
  item: item,
@@ -1,5 +1,5 @@
1
1
  export declare const pageComponentMap: {
2
- '/': {
2
+ '/3': {
3
3
  element: import("react/jsx-runtime").JSX.Element;
4
4
  };
5
5
  '/menu/page1': {
@@ -3,7 +3,7 @@ import { Level1 } from "./pages/Level1";
3
3
  import { Level2 } from "./pages/Level2";
4
4
  import { jsx as _jsx } from "react/jsx-runtime";
5
5
  export var pageComponentMap = {
6
- '/': {
6
+ '/3': {
7
7
  element: /*#__PURE__*/_jsx(Home, {})
8
8
  },
9
9
  '/menu/page1': {
@@ -21,25 +21,20 @@ export var AvatarItem = function AvatarItem(_ref) {
21
21
  return _regeneratorRuntime().wrap(function _callee$(_context) {
22
22
  while (1) switch (_context.prev = _context.next) {
23
23
  case 0:
24
- _context.prev = 0;
25
- _context.next = 3;
26
- return onLogout();
27
- case 3:
28
- // setLocalStorageItem(LOCAL_STORAGE.ACCESS_TOKEN, '');
29
- localStorage.clear();
30
- sessionStorage.clear();
31
- updateData({}, 'replace');
32
- _context.next = 11;
33
- break;
34
- case 8:
35
- _context.prev = 8;
36
- _context.t0 = _context["catch"](0);
37
- console.error(_context.t0);
38
- case 11:
24
+ try {
25
+ onLogout();
26
+ // setLocalStorageItem(LOCAL_STORAGE.ACCESS_TOKEN, '');
27
+ localStorage.clear();
28
+ sessionStorage.clear();
29
+ updateData({}, 'replace');
30
+ } catch (error) {
31
+ console.error(error);
32
+ }
33
+ case 1:
39
34
  case "end":
40
35
  return _context.stop();
41
36
  }
42
- }, _callee, null, [[0, 8]]);
37
+ }, _callee);
43
38
  }));
44
39
  function onOk() {
45
40
  return _onOk.apply(this, arguments);
@@ -17,7 +17,7 @@ export declare class KeepAliveClass {
17
17
  updateAllComponent(type?: 'all' | 'pagesHook' | 'context'): Promise<void>;
18
18
  /** 获取页面数据 */
19
19
  getPages(): (import("react-router-dom").Location & {
20
- pageStatus: 200 | 403 | 404;
20
+ pageStatus: 404 | 403 | 200;
21
21
  pageTitle: string;
22
22
  intlMenuConfig?: {
23
23
  id: string;
@@ -45,7 +45,7 @@ export declare class KeepAliveClass {
45
45
  useLifeCycle: (callback: IPageLifeCycleCallback) => void;
46
46
  /** 获取缓存页面数组 */
47
47
  useKeepAlivePages: () => (import("react-router-dom").Location & {
48
- pageStatus: 200 | 403 | 404;
48
+ pageStatus: 404 | 403 | 200;
49
49
  pageTitle: string;
50
50
  intlMenuConfig?: {
51
51
  id: string;
@@ -23,6 +23,7 @@ import { Button, Result } from 'antd';
23
23
  import { useEffect, useRef, useState } from 'react';
24
24
  import { createPortal } from 'react-dom';
25
25
  import { ErrorBoundary } from 'react-error-boundary';
26
+ import { useDebounceEffect } from 'ahooks';
26
27
  import { useAccessRouter } from "../../hooks";
27
28
  import { NoFoundPage } from "../NoFoundPage";
28
29
  import { useCacheTabsLayout } from "./modules/useCacheTabsLayout";
@@ -173,6 +174,7 @@ export var KeepAliveClass = /*#__PURE__*/function () {
173
174
  var _useState3 = useState({}),
174
175
  _useState4 = _slicedToArray(_useState3, 2),
175
176
  update = _useState4[1];
177
+ var divRef = useRef(null);
176
178
  var _useRef2 = useRef({
177
179
  divId: "auto-refresh-keep-alive-item-".concat(Date.now(), "-").concat(Math.random().toString(36).substring(2)),
178
180
  div: document.createElement('div'),
@@ -204,28 +206,31 @@ export var KeepAliveClass = /*#__PURE__*/function () {
204
206
  }
205
207
  cache.count += 1;
206
208
  });
207
- useEffect(function () {
209
+ useDebounceEffect(function () {
208
210
  cache.portal = cache.portal || /*#__PURE__*/createPortal(children, cache.div);
209
211
  // update({});
210
212
  if (cache.show) {
211
- var _document$getElementB;
213
+ var _ref2;
212
214
  // debugger;
213
- (_document$getElementB = document.getElementById(cache.divId)) === null || _document$getElementB === void 0 || (_document$getElementB = _document$getElementB.parentElement) === null || _document$getElementB === void 0 || _document$getElementB.appendChild(cache.div);
215
+ (_ref2 = divRef.current || document.getElementById(cache.divId)) === null || _ref2 === void 0 || (_ref2 = _ref2.parentElement) === null || _ref2 === void 0 || _ref2.appendChild(cache.div);
214
216
  } else {
215
217
  cache.div.remove();
216
218
  }
217
219
  update({});
218
- }, [cache.show]);
220
+ }, [cache.show, divRef.current], {
221
+ wait: 0
222
+ });
219
223
  return /*#__PURE__*/_jsxs(_Fragment, {
220
224
  children: [/*#__PURE__*/_jsx("div", {
225
+ ref: divRef,
221
226
  id: cache.divId
222
227
  }), cache.portal]
223
228
  });
224
229
  });
225
230
  /** 页面挂载组件 */
226
- _defineProperty(this, "KeepAliveItem", function (_ref2) {
227
- var activate = _ref2.activate,
228
- idKey = _ref2.idKey;
231
+ _defineProperty(this, "KeepAliveItem", function (_ref3) {
232
+ var activate = _ref3.activate,
233
+ idKey = _ref3.idKey;
229
234
  var _useAccessRouter3 = useAccessRouter(),
230
235
  page = _useAccessRouter3.page;
231
236
  var _useState5 = useState({}),
@@ -262,8 +267,8 @@ export var KeepAliveClass = /*#__PURE__*/function () {
262
267
  useEffect(function () {
263
268
  if (activate && _this.contentDom) {
264
269
  cache.portal = cache.portal || /*#__PURE__*/createPortal( /*#__PURE__*/_jsx(ErrorBoundary, {
265
- fallbackRender: function fallbackRender(_ref3) {
266
- var error = _ref3.error;
270
+ fallbackRender: function fallbackRender(_ref4) {
271
+ var error = _ref4.error;
267
272
  return /*#__PURE__*/_jsx(_Fragment, {
268
273
  children: /*#__PURE__*/_jsx(Result, {
269
274
  status: "error",
@@ -48,6 +48,7 @@ export var Login = function Login(_ref) {
48
48
  "data-lang": true,
49
49
  children: renderSelectLang()
50
50
  }), /*#__PURE__*/_jsxs(Row, {
51
+ wrap: false,
51
52
  justify: "center",
52
53
  className: "content",
53
54
  children: [/*#__PURE__*/_jsx(Col, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamias/pro-layout",
3
- "version": "0.0.19",
3
+ "version": "0.0.20",
4
4
  "description": "A react library developed with dumi",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",