@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.
- package/dist/markdowns/example1/BasicProLayoutBusiness/index.js +3 -3
- package/dist/markdowns/example1/BasicProLayoutBusiness/testData.d.ts +1 -1
- package/dist/markdowns/example1/BasicProLayoutBusiness/testData.js +1 -1
- package/dist/pro-layout/components/AvatarItem.js +11 -16
- package/dist/pro-layout/components/KeepAlive/KeepAliveClass.d.ts +2 -2
- package/dist/pro-layout/components/KeepAlive/KeepAliveClass.js +14 -9
- package/dist/pro-layout/components/Login/index.js +1 -0
- package/package.json +1 -1
|
@@ -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
|
-
|
|
70
|
-
,
|
|
69
|
+
projectId: "2",
|
|
70
|
+
pageComponentMap: pageComponentMap,
|
|
71
71
|
renderMenuItem: function renderMenuItem(item, type) {
|
|
72
72
|
return /*#__PURE__*/_jsx(MenuItem, {
|
|
73
73
|
item: item,
|
|
@@ -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
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
|
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:
|
|
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:
|
|
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
|
-
|
|
209
|
+
useDebounceEffect(function () {
|
|
208
210
|
cache.portal = cache.portal || /*#__PURE__*/createPortal(children, cache.div);
|
|
209
211
|
// update({});
|
|
210
212
|
if (cache.show) {
|
|
211
|
-
var
|
|
213
|
+
var _ref2;
|
|
212
214
|
// debugger;
|
|
213
|
-
(
|
|
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 (
|
|
227
|
-
var activate =
|
|
228
|
-
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(
|
|
266
|
-
var 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",
|