@allahjs/umi-plugin-layout-lite 0.1.1 → 0.1.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.
- package/dist/Layout.js +14 -14
- package/package.json +52 -52
package/dist/Layout.js
CHANGED
|
@@ -6,11 +6,10 @@ import { Result, Button, Spin } from 'antd';
|
|
|
6
6
|
|
|
7
7
|
const Exception = props => {
|
|
8
8
|
var _a, _b;
|
|
9
|
-
return (
|
|
10
|
-
(((_a = props.route) === null || _a === void 0 ? void 0 : _a.unaccessible) &&
|
|
11
|
-
(props.unAccessible || props.noAccessible)) ||
|
|
9
|
+
return (!props.route && (props.noFound || props.notFound)) ||
|
|
10
|
+
(((_a = props.route) === null || _a === void 0 ? void 0 : _a.unaccessible) && (props.unAccessible || props.noAccessible)) ||
|
|
12
11
|
((!props.route || ((_b = props.route) === null || _b === void 0 ? void 0 : _b.unaccessible)) && (jsx(Result, { status: props.route ? '403' : '404', title: props.route ? '403' : '404', subTitle: props.route ? '抱歉,你无权访问该页面' : '抱歉,你访问的页面不存在', extra: jsx(Button, { type: "primary", onClick: () => history.push('/'), children: "\u8FD4\u56DE\u9996\u9875" }) }))) ||
|
|
13
|
-
props.children
|
|
12
|
+
props.children;
|
|
14
13
|
};
|
|
15
14
|
function getRightRenderContent(opts) {
|
|
16
15
|
if (opts.runtimeConfig.rightRender) {
|
|
@@ -102,24 +101,25 @@ function LayoutLite(props) {
|
|
|
102
101
|
event.stopPropagation();
|
|
103
102
|
event.preventDefault();
|
|
104
103
|
navigate('/');
|
|
104
|
+
}, menuProps: {
|
|
105
|
+
onClick: e => {
|
|
106
|
+
if (e.key) {
|
|
107
|
+
navigate(e.key.replace('/*', ''));
|
|
108
|
+
}
|
|
109
|
+
},
|
|
105
110
|
}, menuItemRender: (menuItemProps, defaultDom) => {
|
|
106
|
-
if (menuItemProps.isUrl
|
|
107
|
-
return defaultDom;
|
|
111
|
+
if (menuItemProps.isUrl) {
|
|
112
|
+
return (jsx("a", { href: menuItemProps.path, target: menuItemProps.target, children: defaultDom }));
|
|
108
113
|
}
|
|
109
|
-
|
|
110
|
-
return (jsx(Link, { to: menuItemProps.path.replace('/*', ''), target: menuItemProps.target, children: defaultDom }));
|
|
111
|
-
}
|
|
112
|
-
return defaultDom;
|
|
114
|
+
return jsx("div", { children: defaultDom });
|
|
113
115
|
}, itemRender: (currentRoute, _, routes) => {
|
|
114
|
-
const label = currentRoute.title
|
|
116
|
+
const label = currentRoute.title;
|
|
115
117
|
const lastRoute = routes[routes.length - 1];
|
|
116
118
|
if (lastRoute && (lastRoute.path === currentRoute.path || lastRoute.linkPath === currentRoute.path)) {
|
|
117
119
|
return jsx("span", { children: label });
|
|
118
120
|
}
|
|
119
121
|
return jsx(Link, { to: currentRoute.path || '/', children: label });
|
|
120
|
-
}, actionsRender: renderRightActions, ...runtimeConfig, children: jsx(Exception, { route: matchedRoute, noFound: runtimeConfig === null || runtimeConfig === void 0 ? void 0 : runtimeConfig.noFound, notFound: runtimeConfig === null || runtimeConfig === void 0 ? void 0 : runtimeConfig.notFound, unAccessible: runtimeConfig === null || runtimeConfig === void 0 ? void 0 : runtimeConfig.unAccessible, noAccessible: runtimeConfig === null || runtimeConfig === void 0 ? void 0 : runtimeConfig.noAccessible, children: runtimeConfig.childrenRender
|
|
121
|
-
? runtimeConfig.childrenRender(jsx(Outlet, {}), props)
|
|
122
|
-
: jsx(Outlet, {}) }) }));
|
|
122
|
+
}, actionsRender: renderRightActions, ...runtimeConfig, children: jsx(Exception, { route: matchedRoute, noFound: runtimeConfig === null || runtimeConfig === void 0 ? void 0 : runtimeConfig.noFound, notFound: runtimeConfig === null || runtimeConfig === void 0 ? void 0 : runtimeConfig.notFound, unAccessible: runtimeConfig === null || runtimeConfig === void 0 ? void 0 : runtimeConfig.unAccessible, noAccessible: runtimeConfig === null || runtimeConfig === void 0 ? void 0 : runtimeConfig.noAccessible, children: runtimeConfig.childrenRender ? runtimeConfig.childrenRender(jsx(Outlet, {}), props) : jsx(Outlet, {}) }) }));
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
export { LayoutLite as default };
|
package/package.json
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
2
|
+
"name": "@allahjs/umi-plugin-layout-lite",
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "A lightweight Umi layout plugin with ProLayout and rightContentRender compatibility.",
|
|
5
|
+
"repository": "https://github.com/allah-prime/umi-plugin-layout-lite",
|
|
6
|
+
"main": "dist/index.cjs",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"README.md"
|
|
11
|
+
],
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./dist/index.cjs",
|
|
16
|
+
"require": "./dist/index.cjs"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "rimraf dist && rollup -c",
|
|
21
|
+
"prepublishOnly": "npm run build"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"umi",
|
|
25
|
+
"umijs",
|
|
26
|
+
"plugin",
|
|
27
|
+
"layout",
|
|
28
|
+
"prolayout",
|
|
29
|
+
"antd"
|
|
30
|
+
],
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"@ant-design/icons": ">=6",
|
|
33
|
+
"@ant-design/pro-components": ">=3.0.0-0",
|
|
34
|
+
"@umijs/max": ">=4",
|
|
35
|
+
"antd": ">=6",
|
|
36
|
+
"react": ">=18",
|
|
37
|
+
"react-dom": ">=18",
|
|
38
|
+
"umi": ">=4"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@rollup/plugin-commonjs": "^28.0.9",
|
|
42
|
+
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
43
|
+
"@rollup/plugin-typescript": "^12.3.0",
|
|
44
|
+
"@types/node": "^24.3.0",
|
|
45
|
+
"@types/react": "^19.2.0",
|
|
46
|
+
"rimraf": "^6.0.1",
|
|
47
|
+
"rollup": "^4.50.1",
|
|
48
|
+
"rollup-plugin-dts": "^6.2.3",
|
|
49
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
50
|
+
"tslib": "^2.8.1",
|
|
51
|
+
"typescript": "^5.9.0"
|
|
52
|
+
},
|
|
53
|
+
"license": "MIT"
|
|
54
54
|
}
|