zmdms-webui 3.4.0 → 3.4.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.
@@ -63,6 +63,8 @@ interface ILayoutSiderProps {
63
63
  filterMenuHandle?: (menus: any) => any[];
64
64
  /** 二级菜单最大下探层级,默认 3 */
65
65
  maxDeepIndex?: number;
66
+ /** 是否持久化二级菜单固定状态,刷新后保持 */
67
+ persist?: boolean;
66
68
  }
67
69
  declare const _default: React__default.NamedExoticComponent<ILayoutSiderProps>;
68
70
 
@@ -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, 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, openOnlyHasSubmenus = props.openOnlyHasSubmenus, hideSubMenuBg = props.hideSubMenuBg, menuItemLine = props.menuItemLine, subMenuItemLine = props.subMenuItemLine, bottomContainer = props.bottomContainer, onLogoClick = props.onLogoClick, filterMenuHandle = props.filterMenuHandle, logoTitle = props.logoTitle, maxDeepIndex = props.maxDeepIndex;
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, openOnlyHasSubmenus = props.openOnlyHasSubmenus, hideSubMenuBg = props.hideSubMenuBg, menuItemLine = props.menuItemLine, subMenuItemLine = props.subMenuItemLine, bottomContainer = props.bottomContainer, onLogoClick = props.onLogoClick, filterMenuHandle = props.filterMenuHandle, logoTitle = props.logoTitle, maxDeepIndex = props.maxDeepIndex, persist = props.persist;
20
20
  // 当前选中的主菜单item
21
21
  var _e = useState([]), mainMenuSelectedKeys = _e[0], setMainMenuSelectedKeys = _e[1];
22
22
  // 内部二级菜单管理
@@ -75,7 +75,7 @@ var AppLayoutSider = function (props) {
75
75
  getNewPath: getNewPath,
76
76
  renderItem: renderItem,
77
77
  filterMenuHandle: filterMenuHandle,
78
- } }, { children: jsx(Menu, { width: siderWidth, subMenuWidth: subMenuWidth, layoutSiderRef: layoutSiderRef, addTab: addTab, logo: logo, logoStyle: logoStyle, subMenuLogo: subMenuLogo, getPrefixByAppId: getPrefixByAppId, defaultVisible: defaultVisible, openOnlyHasSubmenus: openOnlyHasSubmenus, defaultFixed: defaultFixed, isShowSearchInput: isShowSearchInput, hideSubMenuBg: hideSubMenuBg, menuItemLine: menuItemLine, subMenuItemLine: subMenuItemLine, bottomContainer: bottomContainer, onLogoClick: onLogoClick, logoTitle: logoTitle, maxDeepIndex: maxDeepIndex }) })) })));
78
+ } }, { children: jsx(Menu, { width: siderWidth, subMenuWidth: subMenuWidth, layoutSiderRef: layoutSiderRef, addTab: addTab, logo: logo, logoStyle: logoStyle, subMenuLogo: subMenuLogo, getPrefixByAppId: getPrefixByAppId, defaultVisible: defaultVisible, openOnlyHasSubmenus: openOnlyHasSubmenus, defaultFixed: defaultFixed, isShowSearchInput: isShowSearchInput, hideSubMenuBg: hideSubMenuBg, menuItemLine: menuItemLine, subMenuItemLine: subMenuItemLine, bottomContainer: bottomContainer, onLogoClick: onLogoClick, logoTitle: logoTitle, maxDeepIndex: maxDeepIndex, persist: persist }) })) })));
79
79
  };
80
80
  AppLayoutSider.displayName = "ZTXK_WEBUI_AppLayoutSider";
81
81
  var AppLayoutSider$1 = memo(AppLayoutSider);
@@ -7,14 +7,14 @@ import { LayoutMenuContext } from '../LayoutSiderContext.js';
7
7
  import classNames from '../../node_modules/classnames/index.js';
8
8
  import { filterMenu } from './MainMenu.js';
9
9
  import { useMount } from 'ahooks';
10
- import { MENU_SEARCH_KEY, MENU_COLLECT_KEY } from './constants.js';
10
+ import { MENU_SEARCH_KEY, MENU_COLLECT_KEY, SUB_MENU_FIXED_STORAGE_KEY } from './constants.js';
11
11
  import ButtonCom from '../../button/button.js';
12
12
  import SwapOutlined from '../../node_modules/@ant-design/icons/es/icons/SwapOutlined.js';
13
13
  import { Drawer, Menu } from 'antd';
14
14
 
15
15
  var defaultSubMenu = [];
16
16
  var SubMenu = function (props, ref) {
17
- var marginLeft = props.marginLeft, subMenuWidth = props.subMenuWidth, layoutSiderRef = props.layoutSiderRef, addTab = props.addTab, getPrefixByAppId = props.getPrefixByAppId, subMenuLogo = props.subMenuLogo, visible = props.visible, setVisible = props.setVisible, _a = props.defaultFixed, defaultFixed = _a === void 0 ? false : _a, hideSubMenuBg = props.hideSubMenuBg, subMenuItemLine = props.subMenuItemLine, openOnlyHasSubmenus = props.openOnlyHasSubmenus, _b = props.maxDeepIndex, maxDeepIndex = _b === void 0 ? 3 : _b;
17
+ var marginLeft = props.marginLeft, subMenuWidth = props.subMenuWidth, layoutSiderRef = props.layoutSiderRef, addTab = props.addTab, getPrefixByAppId = props.getPrefixByAppId, subMenuLogo = props.subMenuLogo, visible = props.visible, setVisible = props.setVisible, _a = props.defaultFixed, defaultFixed = _a === void 0 ? false : _a, hideSubMenuBg = props.hideSubMenuBg, subMenuItemLine = props.subMenuItemLine, openOnlyHasSubmenus = props.openOnlyHasSubmenus, _b = props.maxDeepIndex, maxDeepIndex = _b === void 0 ? 3 : _b, persist = props.persist;
18
18
  var _c = useContext(LayoutMenuContext), mainMenuSelectedKeys = _c.mainMenuSelectedKeys, setMainMenuSelectedKeys = _c.setMainMenuSelectedKeys, activeTab = _c.activeTab, userMenus = _c.userMenus, userSubMenus = _c.userSubMenus, innerUserSubMenus = _c.innerUserSubMenus, drawerTitle = _c.drawerTitle, selectMainMenu = _c.selectMainMenu, getNewPath = _c.getNewPath, renderItem = _c.renderItem, filterMenuHandle = _c.filterMenuHandle;
19
19
  // 二级菜单当前选中项
20
20
  var subMenusSelectedKeys = useMemo(function () {
@@ -57,20 +57,39 @@ var SubMenu = function (props, ref) {
57
57
  // 提升到父组件
58
58
  // const [visible, setVisible] = useState<boolean>(defaultVisible);
59
59
  // 二级菜单是否固定
60
- var _e = useState(defaultFixed), isFixed = _e[0], setIsFixed = _e[1];
60
+ var _e = useState(function () {
61
+ if (persist) {
62
+ try {
63
+ return localStorage.getItem(SUB_MENU_FIXED_STORAGE_KEY) === "true";
64
+ }
65
+ catch (_a) {
66
+ // ignore
67
+ }
68
+ }
69
+ return !!defaultFixed;
70
+ }), isFixed = _e[0], setIsFixed = _e[1];
61
71
  useMount(function () {
62
- layoutSiderRef.current.style.marginRight = defaultFixed
72
+ layoutSiderRef.current.style.marginRight = isFixed
63
73
  ? "".concat(subMenuWidth, "px")
64
74
  : 0;
65
75
  });
66
76
  var onToggleSubMenuFixed = useCallback(function () {
67
77
  setIsFixed(function (preFixed) {
68
- layoutSiderRef.current.style.marginRight = !preFixed
78
+ var nextFixed = !preFixed;
79
+ layoutSiderRef.current.style.marginRight = nextFixed
69
80
  ? "".concat(subMenuWidth, "px")
70
81
  : 0;
71
- return !preFixed;
82
+ if (persist) {
83
+ try {
84
+ localStorage.setItem(SUB_MENU_FIXED_STORAGE_KEY, String(nextFixed));
85
+ }
86
+ catch (_a) {
87
+ // ignore
88
+ }
89
+ }
90
+ return nextFixed;
72
91
  });
73
- }, [layoutSiderRef, subMenuWidth]);
92
+ }, [layoutSiderRef, subMenuWidth, persist]);
74
93
  // 底部按钮
75
94
  var footerDom = (jsxs(ButtonCom, __assign({ type: "link", onClick: onToggleSubMenuFixed }, { children: [jsx(SwapOutlined, { style: { fontSize: "14px", color: hideSubMenuBg ? "#4285f4" : "#fff" } }), isFixed ? "浮动" : "固定"] })));
76
95
  var hasMenuData = useRef(false);
@@ -1,4 +1,6 @@
1
1
  var MENU_SEARCH_KEY = "menu_search_key";
2
- var MENU_COLLECT_KEY = "menu_collect_key";
2
+ var MENU_COLLECT_KEY = "menu_collect_key";
3
+ /** 二级菜单固定状态的本地存储 key */
4
+ var SUB_MENU_FIXED_STORAGE_KEY = "zmdms_submenu_fixed";
3
5
 
4
- export { MENU_COLLECT_KEY, MENU_SEARCH_KEY };
6
+ export { MENU_COLLECT_KEY, MENU_SEARCH_KEY, SUB_MENU_FIXED_STORAGE_KEY };
@@ -5,11 +5,22 @@ import Logo from './Logo.js';
5
5
  import SearchInput from './SearchInput.js';
6
6
  import MainMenu from './MainMenu.js';
7
7
  import SubMenu from './SubMenu.js';
8
+ import { SUB_MENU_FIXED_STORAGE_KEY } from './constants.js';
8
9
 
9
10
  var MenuCom = function (props) {
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 ? false : _a, openOnlyHasSubmenus = props.openOnlyHasSubmenus, defaultFixed = props.defaultFixed, isShowSearchInput = props.isShowSearchInput, hideSubMenuBg = props.hideSubMenuBg, menuItemLine = props.menuItemLine, subMenuItemLine = props.subMenuItemLine, bottomContainer = props.bottomContainer, onLogoClick = props.onLogoClick, logoTitle = props.logoTitle, maxDeepIndex = props.maxDeepIndex;
11
+ 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 ? false : _a, openOnlyHasSubmenus = props.openOnlyHasSubmenus, defaultFixed = props.defaultFixed, isShowSearchInput = props.isShowSearchInput, hideSubMenuBg = props.hideSubMenuBg, menuItemLine = props.menuItemLine, subMenuItemLine = props.subMenuItemLine, bottomContainer = props.bottomContainer, onLogoClick = props.onLogoClick, logoTitle = props.logoTitle, maxDeepIndex = props.maxDeepIndex, persist = props.persist;
11
12
  // 二级菜单是否显示
12
- var _b = useState(defaultVisible), visible = _b[0], setVisible = _b[1];
13
+ var _b = useState(function () {
14
+ if (persist) {
15
+ try {
16
+ return localStorage.getItem(SUB_MENU_FIXED_STORAGE_KEY) === "true";
17
+ }
18
+ catch (_a) {
19
+ // ignore
20
+ }
21
+ }
22
+ return defaultVisible;
23
+ }), visible = _b[0], setVisible = _b[1];
13
24
  // 二级菜单Ref对象
14
25
  var subMenu = useRef({});
15
26
  // 一级菜单mouseEnter事件
@@ -27,7 +38,7 @@ var MenuCom = function (props) {
27
38
  var _a;
28
39
  (_a = subMenu.current) === null || _a === void 0 ? void 0 : _a.setVisible(false);
29
40
  }, []);
30
- return (jsxs("div", __assign({ className: "zmdms-menu", onMouseLeave: onMouseLeave }, { children: [jsx(Logo, { logo: logo, showLine: visible && !hideSubMenuBg, style: logoStyle, onClick: onLogoClick, logoTitle: logoTitle }), isShowSearchInput && jsx(SearchInput, { setVisible: setVisible }), 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, openOnlyHasSubmenus: openOnlyHasSubmenus, maxDeepIndex: maxDeepIndex }), bottomContainer] })));
41
+ return (jsxs("div", __assign({ className: "zmdms-menu", onMouseLeave: onMouseLeave }, { children: [jsx(Logo, { logo: logo, showLine: visible && !hideSubMenuBg, style: logoStyle, onClick: onLogoClick, logoTitle: logoTitle }), isShowSearchInput && jsx(SearchInput, { setVisible: setVisible }), 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, openOnlyHasSubmenus: openOnlyHasSubmenus, maxDeepIndex: maxDeepIndex, persist: persist }), bottomContainer] })));
31
42
  };
32
43
  var Menu = memo(MenuCom);
33
44
 
@@ -134,6 +134,8 @@ function getFormatter(formatterType, currencySymbol, isFocusRef, precision) {
134
134
  return getValue(value, isFocusRef, precision);
135
135
  },
136
136
  parser: function (value) {
137
+ // 移除千分符(兼容粘贴带千分符的数字)
138
+ value = value.replace(/,/g, "");
137
139
  // 替换 。号
138
140
  value = value.replace(/。/g, ".");
139
141
  // 替换多个小数点
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zmdms-webui",
3
- "version": "3.4.0",
3
+ "version": "3.4.2",
4
4
  "private": false,
5
5
  "main": "dist/index.es.js",
6
6
  "module": "dist/index.es.js",