zmdms-webui 1.0.4 → 1.0.5

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.
@@ -1,6 +1,6 @@
1
1
  import { __assign } from '../../_virtual/_tslib.js';
2
2
  import { jsxs, jsx } from 'react/jsx-runtime';
3
- import { memo, forwardRef, useContext, useMemo, useRef, useState, useCallback, useImperativeHandle } from 'react';
3
+ import { memo, forwardRef, useContext, useMemo, useRef, useEffect, useState, useCallback, useImperativeHandle } from 'react';
4
4
  import { Link } from 'react-router-dom';
5
5
  import { useSubMenuOpenKeys } from './hook.js';
6
6
  import { LayoutMenuContext } from '../LayoutSiderContext.js';
@@ -40,6 +40,17 @@ var SubMenu = function (props, ref) {
40
40
  selectMainMenu: selectMainMenu,
41
41
  isClickSubMenu: isClickSubMenu,
42
42
  }), subMenuOpenKeys = _c.subMenuOpenKeys, onSubMenuOpenChange = _c.onSubMenuOpenChange;
43
+ // 如果是搜索或者收藏 把二级菜单都展开
44
+ useEffect(function () {
45
+ if (mainMenuSelectedKeys && mainMenuSelectedKeys.length > 0) {
46
+ var mainSelectedKey = mainMenuSelectedKeys[0];
47
+ if (mainSelectedKey === MENU_SEARCH_KEY ||
48
+ mainSelectedKey === MENU_COLLECT_KEY) {
49
+ var openKeys = subMenus.map(function (subMenu) { return subMenu.id; });
50
+ onSubMenuOpenChange(openKeys);
51
+ }
52
+ }
53
+ }, [mainMenuSelectedKeys, onSubMenuOpenChange, subMenus]);
43
54
  // 二级菜单是否显示
44
55
  // 提升到父组件
45
56
  // const [visible, setVisible] = useState<boolean>(defaultVisible);
@@ -1,4 +1,4 @@
1
- import { useRef, useState, useEffect } from 'react';
1
+ import { useRef, useState, useEffect, useCallback } from 'react';
2
2
  import isEqual from 'lodash/isEqual';
3
3
 
4
4
  // 需要打开的主菜单
@@ -85,9 +85,9 @@ function useSubMenuOpenKeys(userSubMenus, activeTab, options) {
85
85
  var getPrefixByAppId = options.getPrefixByAppId, setMainMenuSelectedKeys = options.setMainMenuSelectedKeys, selectMainMenu = options.selectMainMenu, isClickSubMenu = options.isClickSubMenu;
86
86
  // 展开指定的二级菜单
87
87
  var _a = useState([]), openKeys = _a[0], setOpenKeys = _a[1];
88
- var onOpenChange = function (openKeys) {
88
+ var onOpenChange = useCallback(function (openKeys) {
89
89
  setOpenKeys(openKeys);
90
- };
90
+ }, []);
91
91
  // 选中的页签 需要展开指定的父级菜单
92
92
  useEffect(function () {
93
93
  if (isClickSubMenu.current) {
package/package.json CHANGED
@@ -1,126 +1,126 @@
1
- {
2
- "name": "zmdms-webui",
3
- "version": "1.0.4",
4
- "private": false,
5
- "main": "dist/index.es.js",
6
- "module": "dist/index.es.js",
7
- "unpkg": "dist/index.umd.js",
8
- "types": "dist/index.build.d.ts",
9
- "type": "module",
10
- "license": "MIT",
11
- "peerDependencies": {
12
- "ahooks": ">=3.7.8",
13
- "antd": ">=4.24.8",
14
- "dayjs": ">=1.11.7",
15
- "html2canvas": ">=1.4.1",
16
- "jspdf": ">=2.5.1",
17
- "lodash": ">=4.17.21",
18
- "print-js": ">=1.6.0",
19
- "react": ">=16.8.0",
20
- "react-dom": ">=16.8.0",
21
- "react-resizable": "^3.0.5",
22
- "react-router-dom": ">=6",
23
- "zmdms-utils": ">=0.0.1"
24
- },
25
- "sideEffects": [
26
- "dist/es/**/style/*",
27
- "*.less",
28
- "src/styles/*.less"
29
- ],
30
- "scripts": {
31
- "start": "react-scripts start",
32
- "clean": "rimraf ./dist",
33
- "build": "npm run clean && npm run build-es && npm run build-css",
34
- "build-es": "rollup --config ./rollup/rollup.esm.config.js",
35
- "build-umd": "rollup --config ./rollup/rollup.umd.config.js",
36
- "build-css": "rollup --config ./rollup/rollup.css.config.js",
37
- "test": "react-scripts test",
38
- "eject": "react-scripts eject"
39
- },
40
- "eslintConfig": {
41
- "extends": [
42
- "react-app",
43
- "react-app/jest"
44
- ]
45
- },
46
- "browserslist": {
47
- "production": [
48
- ">0.2%",
49
- "not dead",
50
- "not op_mini all"
51
- ],
52
- "development": [
53
- "last 1 chrome version",
54
- "last 1 firefox version",
55
- "last 1 safari version"
56
- ]
57
- },
58
- "files": [
59
- "dist"
60
- ],
61
- "devDependencies": {
62
- "@rollup/plugin-commonjs": "^24.0.1",
63
- "@rollup/plugin-json": "^6.0.0",
64
- "@rollup/plugin-node-resolve": "^15.0.1",
65
- "@rollup/plugin-replace": "^5.0.2",
66
- "@rollup/plugin-terser": "^0.4.0",
67
- "@rollup/plugin-url": "^8.0.1",
68
- "@testing-library/jest-dom": "^5.16.5",
69
- "@testing-library/react": "^13.4.0",
70
- "@testing-library/user-event": "^13.5.0",
71
- "@types/jest": "^27.5.2",
72
- "@types/lodash": "^4.14.195",
73
- "@types/node": "^16.18.14",
74
- "@types/react": "^18.0.28",
75
- "@types/react-dom": "^18.0.11",
76
- "@types/react-resizable": "^3.0.4",
77
- "@types/react-router-dom": "^5.3.3",
78
- "@welldone-software/why-did-you-render": "^7.0.1",
79
- "ahooks": "^3.7.8",
80
- "antd": "^4.24.15",
81
- "autoprefixer": "^10.4.14",
82
- "axios": "^1.4.0",
83
- "crypto-js": "^4.1.1",
84
- "dayjs": "^1.11.7",
85
- "html2canvas": "^1.4.1",
86
- "http-proxy-middleware": "^2.0.6",
87
- "i18next": "^22.4.12",
88
- "jspdf": "^2.5.1",
89
- "less": "^4.1.3",
90
- "less-loader": "10.2.0",
91
- "lodash": "^4.17.21",
92
- "postcss": "^8.4.21",
93
- "print-js": "^1.6.0",
94
- "qiankun": "^2.10.8",
95
- "react": "^18.2.0",
96
- "react-dom": "^18.2.0",
97
- "react-i18next": "^12.2.0",
98
- "react-resizable": "^3.0.5",
99
- "react-router-dom": "^6.9.0",
100
- "react-scripts": "5.0.1",
101
- "rimraf": "^4.4.0",
102
- "rollup": "^3.19.0",
103
- "rollup-plugin-copy": "^3.4.0",
104
- "rollup-plugin-delete": "^2.0.0",
105
- "rollup-plugin-dts": "^5.3.0",
106
- "rollup-plugin-peer-deps-external": "^2.2.4",
107
- "rollup-plugin-postcss": "^4.0.2",
108
- "rollup-plugin-typescript2": "^0.34.1",
109
- "rollup-plugin-visualizer": "^5.9.0",
110
- "sass": "^1.58.3",
111
- "typescript": "^4.9.5",
112
- "web-vitals": "^2.1.4",
113
- "zmdms-utils": "^0.0.56"
114
- },
115
- "resolutions": {
116
- "rc-virtual-list": "3.11.3"
117
- },
118
- "dependencies": {
119
- "antd-img-crop": "^4.12.2",
120
- "immutability-helper": "^3.1.1",
121
- "react-dnd": "^16.0.1",
122
- "react-dnd-html5-backend": "^16.0.1",
123
- "screenfull": "^6.0.2",
124
- "virtuallist-antd": "^0.8.0-beta.1"
125
- }
1
+ {
2
+ "name": "zmdms-webui",
3
+ "version": "1.0.5",
4
+ "private": false,
5
+ "main": "dist/index.es.js",
6
+ "module": "dist/index.es.js",
7
+ "unpkg": "dist/index.umd.js",
8
+ "types": "dist/index.build.d.ts",
9
+ "type": "module",
10
+ "license": "MIT",
11
+ "peerDependencies": {
12
+ "ahooks": ">=3.7.8",
13
+ "antd": ">=4.24.8",
14
+ "dayjs": ">=1.11.7",
15
+ "html2canvas": ">=1.4.1",
16
+ "jspdf": ">=2.5.1",
17
+ "lodash": ">=4.17.21",
18
+ "print-js": ">=1.6.0",
19
+ "react": ">=16.8.0",
20
+ "react-dom": ">=16.8.0",
21
+ "react-resizable": "^3.0.5",
22
+ "react-router-dom": ">=6",
23
+ "zmdms-utils": ">=0.0.1"
24
+ },
25
+ "sideEffects": [
26
+ "dist/es/**/style/*",
27
+ "*.less",
28
+ "src/styles/*.less"
29
+ ],
30
+ "scripts": {
31
+ "start": "react-scripts start",
32
+ "clean": "rimraf ./dist",
33
+ "build": "npm run clean && npm run build-es && npm run build-css",
34
+ "build-es": "rollup --config ./rollup/rollup.esm.config.js",
35
+ "build-umd": "rollup --config ./rollup/rollup.umd.config.js",
36
+ "build-css": "rollup --config ./rollup/rollup.css.config.js",
37
+ "test": "react-scripts test",
38
+ "eject": "react-scripts eject"
39
+ },
40
+ "eslintConfig": {
41
+ "extends": [
42
+ "react-app",
43
+ "react-app/jest"
44
+ ]
45
+ },
46
+ "browserslist": {
47
+ "production": [
48
+ ">0.2%",
49
+ "not dead",
50
+ "not op_mini all"
51
+ ],
52
+ "development": [
53
+ "last 1 chrome version",
54
+ "last 1 firefox version",
55
+ "last 1 safari version"
56
+ ]
57
+ },
58
+ "files": [
59
+ "dist"
60
+ ],
61
+ "devDependencies": {
62
+ "@rollup/plugin-commonjs": "^24.0.1",
63
+ "@rollup/plugin-json": "^6.0.0",
64
+ "@rollup/plugin-node-resolve": "^15.0.1",
65
+ "@rollup/plugin-replace": "^5.0.2",
66
+ "@rollup/plugin-terser": "^0.4.0",
67
+ "@rollup/plugin-url": "^8.0.1",
68
+ "@testing-library/jest-dom": "^5.16.5",
69
+ "@testing-library/react": "^13.4.0",
70
+ "@testing-library/user-event": "^13.5.0",
71
+ "@types/jest": "^27.5.2",
72
+ "@types/lodash": "^4.14.195",
73
+ "@types/node": "^16.18.14",
74
+ "@types/react": "^18.0.28",
75
+ "@types/react-dom": "^18.0.11",
76
+ "@types/react-resizable": "^3.0.4",
77
+ "@types/react-router-dom": "^5.3.3",
78
+ "@welldone-software/why-did-you-render": "^7.0.1",
79
+ "ahooks": "^3.7.8",
80
+ "antd": "^4.24.15",
81
+ "autoprefixer": "^10.4.14",
82
+ "axios": "^1.4.0",
83
+ "crypto-js": "^4.1.1",
84
+ "dayjs": "^1.11.7",
85
+ "html2canvas": "^1.4.1",
86
+ "http-proxy-middleware": "^2.0.6",
87
+ "i18next": "^22.4.12",
88
+ "jspdf": "^2.5.1",
89
+ "less": "^4.1.3",
90
+ "less-loader": "10.2.0",
91
+ "lodash": "^4.17.21",
92
+ "postcss": "^8.4.21",
93
+ "print-js": "^1.6.0",
94
+ "qiankun": "^2.10.8",
95
+ "react": "^18.2.0",
96
+ "react-dom": "^18.2.0",
97
+ "react-i18next": "^12.2.0",
98
+ "react-resizable": "^3.0.5",
99
+ "react-router-dom": "^6.9.0",
100
+ "react-scripts": "5.0.1",
101
+ "rimraf": "^4.4.0",
102
+ "rollup": "^3.19.0",
103
+ "rollup-plugin-copy": "^3.4.0",
104
+ "rollup-plugin-delete": "^2.0.0",
105
+ "rollup-plugin-dts": "^5.3.0",
106
+ "rollup-plugin-peer-deps-external": "^2.2.4",
107
+ "rollup-plugin-postcss": "^4.0.2",
108
+ "rollup-plugin-typescript2": "^0.34.1",
109
+ "rollup-plugin-visualizer": "^5.9.0",
110
+ "sass": "^1.58.3",
111
+ "typescript": "^4.9.5",
112
+ "web-vitals": "^2.1.4",
113
+ "zmdms-utils": "^0.0.56"
114
+ },
115
+ "resolutions": {
116
+ "rc-virtual-list": "3.11.3"
117
+ },
118
+ "dependencies": {
119
+ "antd-img-crop": "^4.12.2",
120
+ "immutability-helper": "^3.1.1",
121
+ "react-dnd": "^16.0.1",
122
+ "react-dnd-html5-backend": "^16.0.1",
123
+ "screenfull": "^6.0.2",
124
+ "virtuallist-antd": "^0.8.0-beta.1"
125
+ }
126
126
  }