zmdms-webui 1.4.6 → 1.4.8
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/es/applayoutsider/appLayoutSider.d.ts +1 -0
- package/dist/es/applayoutsider/appLayoutSider.js +2 -2
- package/dist/es/applayoutsider/menu/Logo.js +2 -2
- package/dist/es/applayoutsider/menu/SubMenu.js +7 -1
- package/dist/es/applayoutsider/menu/hook.js +11 -2
- package/dist/es/applayoutsider/menu/index.js +2 -2
- package/dist/es/login/index.d.ts +2 -0
- package/dist/es/login/index.js +8 -3
- package/package.json +1 -1
|
@@ -16,7 +16,7 @@ var AppLayoutSider = function (props) {
|
|
|
16
16
|
// 118 宽度改成 134宽度
|
|
17
17
|
_b = props.siderWidth,
|
|
18
18
|
// 118 宽度改成 134宽度
|
|
19
|
-
siderWidth = _b === void 0 ? 134 : _b, _c = props.subMenuWidth, subMenuWidth = _c === void 0 ? 162 : _c, addTab = props.addTab, siderBg = props.siderBg, logo = props.logo, subMenuLogo = props.subMenuLogo, _d = props.isShowSearchInput, isShowSearchInput = _d === void 0 ? true : _d, apps = props.apps, activeTab = props.activeTab, userMenus = props.userMenus, userSubMenus = props.userSubMenus, mergeSystemIds = props.mergeSystemIds, postMergeSystemIds = props.postMergeSystemIds, drawerTitle = props.drawerTitle, selectMainMenu = props.selectMainMenu, menuJoinRule = props.menuJoinRule, renderItem = props.renderItem, defaultVisible = props.defaultVisible, defaultFixed = props.defaultFixed, hideSubMenuBg = props.hideSubMenuBg, menuItemLine = props.menuItemLine, subMenuItemLine = props.subMenuItemLine;
|
|
19
|
+
siderWidth = _b === void 0 ? 134 : _b, _c = props.subMenuWidth, subMenuWidth = _c === void 0 ? 162 : _c, addTab = props.addTab, siderBg = props.siderBg, logo = props.logo, logoStyle = props.logoStyle, subMenuLogo = props.subMenuLogo, _d = props.isShowSearchInput, isShowSearchInput = _d === void 0 ? true : _d, apps = props.apps, activeTab = props.activeTab, userMenus = props.userMenus, userSubMenus = props.userSubMenus, mergeSystemIds = props.mergeSystemIds, postMergeSystemIds = props.postMergeSystemIds, drawerTitle = props.drawerTitle, selectMainMenu = props.selectMainMenu, menuJoinRule = props.menuJoinRule, renderItem = props.renderItem, defaultVisible = props.defaultVisible, defaultFixed = props.defaultFixed, hideSubMenuBg = props.hideSubMenuBg, menuItemLine = props.menuItemLine, subMenuItemLine = props.subMenuItemLine;
|
|
20
20
|
// 当前选中的主菜单item
|
|
21
21
|
var _e = useState([]), mainMenuSelectedKeys = _e[0], setMainMenuSelectedKeys = _e[1];
|
|
22
22
|
// 内部二级菜单管理
|
|
@@ -74,7 +74,7 @@ var AppLayoutSider = function (props) {
|
|
|
74
74
|
menuJoinRule: menuJoinRule,
|
|
75
75
|
getNewPath: getNewPath,
|
|
76
76
|
renderItem: renderItem,
|
|
77
|
-
} }, { children: jsx(Menu, { width: siderWidth, subMenuWidth: subMenuWidth, layoutSiderRef: layoutSiderRef, addTab: addTab, logo: logo, subMenuLogo: subMenuLogo, getPrefixByAppId: getPrefixByAppId, defaultVisible: defaultVisible, defaultFixed: defaultFixed, isShowSearchInput: isShowSearchInput, hideSubMenuBg: hideSubMenuBg, menuItemLine: menuItemLine, subMenuItemLine: subMenuItemLine }) })) })));
|
|
77
|
+
} }, { children: jsx(Menu, { width: siderWidth, subMenuWidth: subMenuWidth, layoutSiderRef: layoutSiderRef, addTab: addTab, logo: logo, logoStyle: logoStyle, subMenuLogo: subMenuLogo, getPrefixByAppId: getPrefixByAppId, defaultVisible: defaultVisible, defaultFixed: defaultFixed, isShowSearchInput: isShowSearchInput, hideSubMenuBg: hideSubMenuBg, menuItemLine: menuItemLine, subMenuItemLine: subMenuItemLine }) })) })));
|
|
78
78
|
};
|
|
79
79
|
AppLayoutSider.displayName = "ZTXK_WEBUI_AppLayoutSider";
|
|
80
80
|
var AppLayoutSider$1 = memo(AppLayoutSider);
|
|
@@ -4,11 +4,11 @@ import { memo } from 'react';
|
|
|
4
4
|
import classNames from '../../node_modules/classnames/index.js';
|
|
5
5
|
|
|
6
6
|
var Logo = function (_a) {
|
|
7
|
-
var logo = _a.logo, showLine = _a.showLine;
|
|
7
|
+
var logo = _a.logo, showLine = _a.showLine, style = _a.style;
|
|
8
8
|
var classes = classNames("zmdms-logo", {
|
|
9
9
|
"zmdms-logo--line": showLine,
|
|
10
10
|
});
|
|
11
|
-
return (jsx("div", __assign({ className: classes }, { children: jsx("img", { src: logo, title: "\u6D59\u6C5F\u4EA4\u901A\u96C6\u56E2", alt: "cico_logo" }) })));
|
|
11
|
+
return (jsx("div", __assign({ className: classes }, { children: jsx("img", { src: logo, title: "\u6D59\u6C5F\u4EA4\u901A\u96C6\u56E2", alt: "cico_logo", style: style }) })));
|
|
12
12
|
};
|
|
13
13
|
var Logo$1 = memo(Logo);
|
|
14
14
|
|
|
@@ -101,6 +101,7 @@ var SubMenu = function (props, ref) {
|
|
|
101
101
|
deep++;
|
|
102
102
|
if (Array.isArray(arr)) {
|
|
103
103
|
filterMenu(arr).forEach(function (menuItem) {
|
|
104
|
+
var _a;
|
|
104
105
|
// 获取当前菜单的系统id
|
|
105
106
|
var system = menuItem.system;
|
|
106
107
|
var prefix = getPrefixByAppId(system);
|
|
@@ -130,7 +131,12 @@ var SubMenu = function (props, ref) {
|
|
|
130
131
|
label: getLabel(),
|
|
131
132
|
title: menuItem.name,
|
|
132
133
|
// key: menuItem.id,
|
|
133
|
-
|
|
134
|
+
// 这里为什么要用newPath 而不是menuItem.id
|
|
135
|
+
// 因为如果要选到叶子节点,是直接拿路由去做匹配
|
|
136
|
+
// 如果这个菜单有子元素,那么这个菜单是不需要跳转的,他的key应该取menuItem.id
|
|
137
|
+
key: newPath === "/" || ((_a = menuItem.children) === null || _a === void 0 ? void 0 : _a.length) > 0
|
|
138
|
+
? menuItem.id
|
|
139
|
+
: newPath,
|
|
134
140
|
// icon: menuItem.source ? (
|
|
135
141
|
// <Icon type={menuItem.source} style={{ fontSize: "18px" }} />
|
|
136
142
|
// ) : null,
|
|
@@ -121,6 +121,7 @@ function useSubMenuOpenKeys(userSubMenus, activeTab, options) {
|
|
|
121
121
|
return;
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
+
// 20250204 菜单逻辑修改
|
|
124
125
|
// 如果当前activeTab直接与一级菜单匹配上,那么说明当前选中的是主菜单带路由
|
|
125
126
|
var currentUserMenu = null;
|
|
126
127
|
userMenus.find(function (userMenu) {
|
|
@@ -183,7 +184,10 @@ function useSubMenuOpenKeys(userSubMenus, activeTab, options) {
|
|
|
183
184
|
// 默认展开所有菜单
|
|
184
185
|
// setOpenKeys([subMenuVal.parentId]);
|
|
185
186
|
if (Array.isArray(value)) {
|
|
186
|
-
|
|
187
|
+
// 要先过滤掉没有子级的菜单,因为没有子级的菜单不需要展开
|
|
188
|
+
setOpenKeys(value
|
|
189
|
+
.filter(function (i) { return Array.isArray(i.children) && i.children.length > 0; })
|
|
190
|
+
.map(function (i) { return i.id; }));
|
|
187
191
|
}
|
|
188
192
|
return true;
|
|
189
193
|
}
|
|
@@ -204,7 +208,11 @@ function useSubMenuOpenKeys(userSubMenus, activeTab, options) {
|
|
|
204
208
|
// setOpenKeys([item.parentId]);
|
|
205
209
|
// 默认展开所有菜单
|
|
206
210
|
if (Array.isArray(value)) {
|
|
207
|
-
setOpenKeys(value
|
|
211
|
+
setOpenKeys(value
|
|
212
|
+
.filter(function (i) {
|
|
213
|
+
return Array.isArray(i.children) && i.children.length > 0;
|
|
214
|
+
})
|
|
215
|
+
.map(function (i) { return i.id; }));
|
|
208
216
|
}
|
|
209
217
|
return true;
|
|
210
218
|
}
|
|
@@ -218,6 +226,7 @@ function useSubMenuOpenKeys(userSubMenus, activeTab, options) {
|
|
|
218
226
|
return "break";
|
|
219
227
|
}
|
|
220
228
|
};
|
|
229
|
+
// 20250204 菜单逻辑修改
|
|
221
230
|
// 遍历二级菜单
|
|
222
231
|
for (var _i = 0, _a = Object.entries(userSubMenus); _i < _a.length; _i++) {
|
|
223
232
|
var _b = _a[_i], key = _b[0], value = _b[1];
|
|
@@ -7,7 +7,7 @@ import MainMenu from './MainMenu.js';
|
|
|
7
7
|
import SubMenu from './SubMenu.js';
|
|
8
8
|
|
|
9
9
|
var MenuCom = function (props) {
|
|
10
|
-
var width = props.width, subMenuWidth = props.subMenuWidth, layoutSiderRef = props.layoutSiderRef, addTab = props.addTab, logo = props.logo, getPrefixByAppId = props.getPrefixByAppId, subMenuLogo = props.subMenuLogo, _a = props.defaultVisible, defaultVisible = _a === void 0 ? true : _a, defaultFixed = props.defaultFixed, isShowSearchInput = props.isShowSearchInput, hideSubMenuBg = props.hideSubMenuBg, menuItemLine = props.menuItemLine, subMenuItemLine = props.subMenuItemLine;
|
|
10
|
+
var width = props.width, subMenuWidth = props.subMenuWidth, layoutSiderRef = props.layoutSiderRef, addTab = props.addTab, logo = props.logo, logoStyle = props.logoStyle, getPrefixByAppId = props.getPrefixByAppId, subMenuLogo = props.subMenuLogo, _a = props.defaultVisible, defaultVisible = _a === void 0 ? true : _a, defaultFixed = props.defaultFixed, isShowSearchInput = props.isShowSearchInput, hideSubMenuBg = props.hideSubMenuBg, menuItemLine = props.menuItemLine, subMenuItemLine = props.subMenuItemLine;
|
|
11
11
|
// 二级菜单是否显示
|
|
12
12
|
var _b = useState(defaultVisible), visible = _b[0], setVisible = _b[1];
|
|
13
13
|
// 二级菜单Ref对象
|
|
@@ -22,7 +22,7 @@ var MenuCom = function (props) {
|
|
|
22
22
|
var _a;
|
|
23
23
|
(_a = subMenu.current) === null || _a === void 0 ? void 0 : _a.setVisible(false);
|
|
24
24
|
}, []);
|
|
25
|
-
return (jsxs("div", __assign({ className: "zmdms-menu", onMouseLeave: onMouseLeave }, { children: [jsx(Logo, { logo: logo, showLine: visible && !hideSubMenuBg }), isShowSearchInput && jsx(SearchInput, {}), jsx(MainMenu, { onMouseEnter: onMouseEnter, addTab: addTab, getPrefixByAppId: getPrefixByAppId, subMenu: subMenu, hideSubMenuBg: hideSubMenuBg, menuItemLine: menuItemLine }), jsx(SubMenu, { ref: subMenu, marginLeft: width, subMenuWidth: subMenuWidth, layoutSiderRef: layoutSiderRef, addTab: addTab, getPrefixByAppId: getPrefixByAppId, subMenuLogo: subMenuLogo, visible: visible, setVisible: setVisible, defaultFixed: defaultFixed, hideSubMenuBg: hideSubMenuBg, subMenuItemLine: subMenuItemLine })] })));
|
|
25
|
+
return (jsxs("div", __assign({ className: "zmdms-menu", onMouseLeave: onMouseLeave }, { children: [jsx(Logo, { logo: logo, showLine: visible && !hideSubMenuBg, style: logoStyle }), isShowSearchInput && jsx(SearchInput, {}), jsx(MainMenu, { onMouseEnter: onMouseEnter, addTab: addTab, getPrefixByAppId: getPrefixByAppId, subMenu: subMenu, hideSubMenuBg: hideSubMenuBg, menuItemLine: menuItemLine }), jsx(SubMenu, { ref: subMenu, marginLeft: width, subMenuWidth: subMenuWidth, layoutSiderRef: layoutSiderRef, addTab: addTab, getPrefixByAppId: getPrefixByAppId, subMenuLogo: subMenuLogo, visible: visible, setVisible: setVisible, defaultFixed: defaultFixed, hideSubMenuBg: hideSubMenuBg, subMenuItemLine: subMenuItemLine })] })));
|
|
26
26
|
};
|
|
27
27
|
var Menu = memo(MenuCom);
|
|
28
28
|
|
package/dist/es/login/index.d.ts
CHANGED
|
@@ -25,6 +25,8 @@ interface IProps {
|
|
|
25
25
|
prefixRender?: React__default.ReactElement;
|
|
26
26
|
/** 后置内容 */
|
|
27
27
|
suffixRender?: React__default.ReactElement;
|
|
28
|
+
/** 登录组件ref */
|
|
29
|
+
loginHandleRef?: React__default.RefObject<any>;
|
|
28
30
|
}
|
|
29
31
|
interface ILoginChildrenProps {
|
|
30
32
|
form: FormInstance<any>;
|
package/dist/es/login/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __assign } from '../_virtual/_tslib.js';
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
-
import { useState, useEffect } from 'react';
|
|
3
|
+
import { useState, useEffect, useImperativeHandle } from 'react';
|
|
4
4
|
import { Form, Checkbox } from 'antd';
|
|
5
5
|
import { decrypt, encrypt } from './utils.js';
|
|
6
6
|
import ForgetPassword from './forget-password.js';
|
|
@@ -14,7 +14,7 @@ var USERNAME_KEY = "PUsvG";
|
|
|
14
14
|
var USERPWS_KEY = "kVhfO";
|
|
15
15
|
var KEY = "simide";
|
|
16
16
|
var Login = function (props) {
|
|
17
|
-
var loginLogo = props.loginLogo, loginBg = props.loginBg, onFinishHandle = props.onFinishHandle, loading = props.loading, customRender = props.customRender, checkUserPhone = props.checkUserPhone, sendCode = props.sendCode, submitRequest = props.submitRequest, captcha = props.captcha, getCaptcha = props.getCaptcha, prefixRender = props.prefixRender, suffixRender = props.suffixRender;
|
|
17
|
+
var loginLogo = props.loginLogo, loginBg = props.loginBg, onFinishHandle = props.onFinishHandle, loading = props.loading, customRender = props.customRender, checkUserPhone = props.checkUserPhone, sendCode = props.sendCode, submitRequest = props.submitRequest, captcha = props.captcha, getCaptcha = props.getCaptcha, prefixRender = props.prefixRender, suffixRender = props.suffixRender, loginHandleRef = props.loginHandleRef;
|
|
18
18
|
var _a = useState(false), open = _a[0], setOpen = _a[1];
|
|
19
19
|
var form = Form.useForm()[0];
|
|
20
20
|
useEffect(function () {
|
|
@@ -53,7 +53,12 @@ var Login = function (props) {
|
|
|
53
53
|
// 内部处理
|
|
54
54
|
onFinishHandle && onFinishHandle(values);
|
|
55
55
|
};
|
|
56
|
-
|
|
56
|
+
useImperativeHandle(loginHandleRef, function () {
|
|
57
|
+
return {
|
|
58
|
+
form: form,
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
return customRender ? (customRender({ form: form, rememberPsd: rememberPsd })) : (jsx("div", __assign({ className: "login-wrap", style: { backgroundImage: "url(".concat(loginBg, ")") } }, { children: jsxs(Form, __assign({ form: form, requiredMark: false, layout: "vertical", className: "login-form", onFinish: onFinish }, { children: [loginLogo ? (jsx("div", __assign({ className: "login-logo" }, { children: jsx("img", { src: loginLogo, title: "\u6D59\u5546\u4E2D\u62D3ERP", alt: "zszt_logo" }) }))) : null, prefixRender, jsx(Item, __assign({ label: "\u8BF7\u8F93\u5165\u60A8\u7684\u8D26\u53F7", name: "username", rules: [
|
|
57
62
|
{
|
|
58
63
|
required: true,
|
|
59
64
|
message: "请输入您的账号",
|