tntd 1.4.7 → 1.4.10
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/components/DevelopmentLogin/LoginModal.js +2 -2
- package/components/Layout/HeaderTabs.js +98 -73
- package/dist/1.tntd.js +1 -1
- package/dist/stats.json +98 -98
- package/dist/tntd.js +1 -1
- package/es/DevelopmentLogin/LoginModal.js +2 -2
- package/es/Layout/HeaderTabs.js +19 -15
- package/lib/ArrayInput/icon.js +31 -27
- package/lib/ArrayInput/index.js +298 -211
- package/lib/AuthContext.js +13 -2
- package/lib/Columns/index.js +100 -71
- package/lib/DevelopmentLogin/LoginModal.js +141 -79
- package/lib/DevelopmentLogin/index.js +55 -28
- package/lib/Ellipsis/Svg/CopySVG.js +71 -23
- package/lib/Ellipsis/Svg/TickSVG.js +49 -17
- package/lib/Ellipsis/index.js +154 -148
- package/lib/Handle/index.js +109 -72
- package/lib/Icon/fonts/iconfont.js +43 -1
- package/lib/Icon/iconList.js +8 -119
- package/lib/Icon/index.js +45 -13
- package/lib/Img/Contain.js +81 -49
- package/lib/Img/Cover.js +136 -88
- package/lib/Img/index.js +89 -36
- package/lib/Layout/ActionsContext.js +11 -2
- package/lib/Layout/AppList.js +256 -262
- package/lib/Layout/Application.js +135 -119
- package/lib/Layout/Avatar.js +137 -137
- package/lib/Layout/CompatibleLanguage.js +195 -214
- package/lib/Layout/EnterpriseLayout/Avatar.js +168 -156
- package/lib/Layout/EnterpriseLayout/Language.js +100 -75
- package/lib/Layout/EnterpriseLayout/Theme.js +94 -96
- package/lib/Layout/EnterpriseLayout/index.js +45 -32
- package/lib/Layout/GlobalNavigation/NavigationPopup.js +407 -335
- package/lib/Layout/GlobalNavigation/index.js +158 -110
- package/lib/Layout/Header.js +116 -165
- package/lib/Layout/HeaderActions.js +129 -132
- package/lib/Layout/HeaderNavs.js +113 -90
- package/lib/Layout/HeaderTabs.js +282 -312
- package/lib/Layout/Iconfont.js +15 -2
- package/lib/Layout/Language.js +102 -63
- package/lib/Layout/Layout.js +261 -272
- package/lib/Layout/Logo.js +87 -132
- package/lib/Layout/OrgAppList.js +319 -440
- package/lib/Layout/SideMenu.js +343 -429
- package/lib/Layout/Theme.js +124 -95
- package/lib/Layout/checkAuth.js +35 -21
- package/lib/Layout/createActions.js +51 -38
- package/lib/Layout/images/index.js +41 -33
- package/lib/Layout/index.js +161 -110
- package/lib/Layout/paaslayout/CompactSideMenu.js +178 -200
- package/lib/Layout/paaslayout/Header.js +90 -84
- package/lib/Layout/paaslayout/Logo.js +32 -27
- package/lib/Layout/paaslayout/SideMenu.js +174 -161
- package/lib/Layout/paaslayout/index.js +261 -240
- package/lib/Layout/storage.js +78 -20
- package/lib/Layout/utils.js +143 -93
- package/lib/LoadingButton/index.js +67 -25
- package/lib/Modal/index.js +108 -83
- package/lib/Page/Box.js +81 -56
- package/lib/Page/index.js +173 -151
- package/lib/Page/utils.js +30 -12
- package/lib/QueryForm/Field/Checkbox.js +33 -11
- package/lib/QueryForm/Field/Select.js +99 -63
- package/lib/QueryForm/Field/SelectInput.js +114 -69
- package/lib/QueryForm/Field/fieldsMap.js +52 -30
- package/lib/QueryForm/Field/index.js +158 -76
- package/lib/QueryForm/createActions.js +65 -50
- package/lib/QueryForm/index.js +383 -304
- package/lib/QueryForm/useForm.js +17 -6
- package/lib/QueryListScene/List.js +366 -290
- package/lib/QueryListScene/QueryForm.js +161 -93
- package/lib/QueryListScene/QueryListScene.js +87 -33
- package/lib/QueryListScene/Title.js +20 -10
- package/lib/QueryListScene/Toolbar.js +31 -8
- package/lib/QueryListScene/createActions.js +79 -64
- package/lib/QueryListScene/index.js +40 -23
- package/lib/QueryListScene/useActions.js +17 -6
- package/lib/Select/DropDownWrap.js +124 -60
- package/lib/Select/index.js +561 -425
- package/lib/Table/ResizableTable/index.js +121 -77
- package/lib/Table/index.js +51 -19
- package/lib/Title/index.js +52 -34
- package/lib/index.js +159 -19
- package/lib/locale.js +63 -48
- package/package.json +1 -1
package/lib/Layout/SideMenu.js
CHANGED
|
@@ -1,453 +1,367 @@
|
|
|
1
|
-
|
|
2
|
-
import styled, { withTheme } from 'styled-components';
|
|
3
|
-
import { Menu } from 'antd';
|
|
4
|
-
import { get } from 'lodash';
|
|
5
|
-
import ActionsContext from './ActionsContext';
|
|
6
|
-
import { getSelectedMenuInfo, isGroupMenu, isNewTabMenu, openInNewTab, traverseTree } from './utils';
|
|
7
|
-
import { setSideMenuStore } from './storage';
|
|
8
|
-
import Iconfont from './Iconfont';
|
|
9
|
-
|
|
10
|
-
const color = 'rgba(255,255,255,.85)';
|
|
11
|
-
const compatibleColor = '#a1d7ff';
|
|
12
|
-
const { SubMenu, Item: MenuItem } = Menu;
|
|
13
|
-
const TNTMenu = styled(Menu)`
|
|
14
|
-
background: none !important;
|
|
15
|
-
&.ant-menu.ant-menu-root {
|
|
16
|
-
position: relative;
|
|
17
|
-
transition: none !important;
|
|
18
|
-
padding-top: 10px;
|
|
19
|
-
border-right: none;
|
|
20
|
-
text-rendering: optimizeLegibility;
|
|
21
|
-
-webkit-font-smoothing: antialiased;
|
|
22
|
-
-moz-osx-font-smoothing: grayscale;
|
|
23
|
-
height: calc(100vh - ${props => `${props.theme.headerHeight}px`});
|
|
24
|
-
overflow-y: auto;
|
|
25
|
-
overflow-x: hidden;
|
|
26
|
-
.collapseIconPlacementBottom & {
|
|
27
|
-
padding-bottom: 36px;
|
|
28
|
-
}
|
|
29
|
-
.tnt-themeS1 & {
|
|
30
|
-
overflow-x: unset;
|
|
31
|
-
box-shadow: 10px 0 10px -5px rgba(0,0,0,0.10);
|
|
32
|
-
z-index: 2;
|
|
33
|
-
}
|
|
34
|
-
scrollbar-width: none;
|
|
35
|
-
-ms-overflow-style: none;
|
|
1
|
+
"use strict";
|
|
36
2
|
|
|
37
|
-
|
|
38
|
-
display: none;
|
|
39
|
-
}
|
|
40
|
-
&::-moz-scrollbar {
|
|
41
|
-
display: none;
|
|
42
|
-
}
|
|
3
|
+
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
43
4
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
}
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
50
9
|
|
|
51
|
-
|
|
52
|
-
& > .ant-menu-item {
|
|
53
|
-
& > .tnt-icon:first-child {
|
|
54
|
-
padding-left: 8px;
|
|
55
|
-
}
|
|
56
|
-
a {
|
|
57
|
-
visibility: hidden;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
/** 一级结点是菜单样式结束 */
|
|
10
|
+
require("antd/lib/menu/style");
|
|
62
11
|
|
|
63
|
-
|
|
64
|
-
.ant-menu-submenu-title:active {
|
|
65
|
-
background: none;
|
|
66
|
-
}
|
|
12
|
+
var _menu = _interopRequireDefault(require("antd/lib/menu"));
|
|
67
13
|
|
|
68
|
-
|
|
69
|
-
background: #212635;
|
|
70
|
-
border-radius: 0 0 2px 2px;
|
|
71
|
-
.compatible & {
|
|
72
|
-
background: #07408d !important;
|
|
73
|
-
}
|
|
74
|
-
.tnt-themeS1 & {
|
|
75
|
-
background: #fff !important;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// 蓝色系列 菜单展开区域颜色
|
|
79
|
-
.tnt-themeS3 & {
|
|
80
|
-
background: #07408D !important;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
.ant-menu-submenu.ant-menu-submenu-active,
|
|
84
|
-
.ant-menu-submenu.ant-menu-submenu-selected {
|
|
85
|
-
background: rgba(47,129,247,.25) !important;
|
|
86
|
-
.tnt-themeS1 & {
|
|
87
|
-
background: ${props => props.theme.dividerColor} !important;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// 蓝色系 一级菜单的选中效果
|
|
91
|
-
.tnt-themeS3 & {
|
|
92
|
-
background: #204085 !important;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
& > .ant-menu-submenu .ant-menu-submenu.ant-menu-submenu-active,
|
|
96
|
-
& > .ant-menu-submenu .ant-menu-submenu.ant-menu-submenu-selected {
|
|
97
|
-
background: none !important;
|
|
98
|
-
.tnt-themeS1 & {
|
|
99
|
-
background: ${props => props.theme.dividerColor} !important;
|
|
100
|
-
}
|
|
101
|
-
// 蓝色系 子级菜单级的选中效果
|
|
102
|
-
.tnt-themeS3 & {
|
|
103
|
-
background: #204085 !important;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
.ant-menu-item {
|
|
107
|
-
margin: 0;
|
|
108
|
-
font-size: 14px;
|
|
109
|
-
padding-left: 54px !important;
|
|
110
|
-
height: ${({ size }) => size === 'large' ? '40px' : '36px'};
|
|
111
|
-
line-height: ${({ size }) => size === 'large' ? '40px' : '36px'};
|
|
112
|
-
}
|
|
14
|
+
var _react = require("react");
|
|
113
15
|
|
|
114
|
-
|
|
115
|
-
padding-left: 24px !important;
|
|
116
|
-
width: 100%;
|
|
16
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
117
17
|
|
|
118
|
-
|
|
119
|
-
margin-right: 12px;
|
|
120
|
-
}
|
|
121
|
-
& > a {
|
|
122
|
-
display: inline-block;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
18
|
+
var _lodash = require("lodash");
|
|
125
19
|
|
|
126
|
-
|
|
127
|
-
position: relative;
|
|
128
|
-
color: ${props => props.theme.compatible ? compatibleColor : color};
|
|
129
|
-
.tnt-themeS1 & {
|
|
130
|
-
color: ${props => props.theme.primaryTextColor};
|
|
131
|
-
}
|
|
132
|
-
height: ${({ size }) => size === 'large' ? '40px' : '36px'};
|
|
133
|
-
line-height: ${({ size }) => size === 'large' ? '40px' : '36px'};
|
|
134
|
-
.tnt-icon {
|
|
135
|
-
.tnt-themeS1 & {
|
|
136
|
-
color: ${props => props.theme.lightIconColor};
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
& > .tnt-icon {
|
|
140
|
-
position: absolute;
|
|
141
|
-
right: 20px;
|
|
142
|
-
top: 1px;
|
|
143
|
-
font-size: 10px;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
// 蓝色系主题
|
|
147
|
-
.tnt-themeS3 & {
|
|
148
|
-
color: #FFF;
|
|
149
|
-
}
|
|
150
|
-
.tnt-icon {
|
|
151
|
-
.tnt-themeS3 & {
|
|
152
|
-
color: #FFF;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
20
|
+
var _ActionsContext = _interopRequireDefault(require("./ActionsContext"));
|
|
156
21
|
|
|
157
|
-
|
|
158
|
-
margin-top: 0;
|
|
159
|
-
margin-bottom: 0;
|
|
160
|
-
padding-left: 54px !important;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
22
|
+
var _utils = require("./utils");
|
|
163
23
|
|
|
164
|
-
|
|
165
|
-
color: ${props => props.theme.compatible ? compatibleColor : color};
|
|
166
|
-
}
|
|
24
|
+
var _storage = require("./storage");
|
|
167
25
|
|
|
168
|
-
|
|
169
|
-
color: ${props => props.theme.compatible ? compatibleColor : color};
|
|
170
|
-
.tnt-themeS1 & {
|
|
171
|
-
color: ${props => props.theme.primaryTextColor};
|
|
172
|
-
}
|
|
173
|
-
&:hover {
|
|
174
|
-
color: #fff;
|
|
175
|
-
.tnt-themeS1 & {
|
|
176
|
-
color: ${props => props.theme.primaryColor};
|
|
177
|
-
}
|
|
178
|
-
}
|
|
26
|
+
var _Iconfont = _interopRequireDefault(require("./Iconfont"));
|
|
179
27
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
28
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
29
|
+
|
|
30
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
31
|
+
|
|
32
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
33
|
+
|
|
34
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
35
|
+
|
|
36
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
37
|
+
|
|
38
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
39
|
+
|
|
40
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
41
|
+
|
|
42
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
43
|
+
|
|
44
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
45
|
+
|
|
46
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
|
|
47
|
+
|
|
48
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
|
|
49
|
+
|
|
50
|
+
function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
51
|
+
|
|
52
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
53
|
+
|
|
54
|
+
function _templateObject2() {
|
|
55
|
+
var data = _taggedTemplateLiteral(["\n font-size: 14px;\n .large-size & {\n font-size: 15px;\n }\n color: rgba(255,255,255,.85);\n .compatible & {\n color: #A1D7FF;\n }\n .tnt-themeS1 & {\n color: ", ";\n }\n .tnt-icon {\n margin-right: 12px;\n font-size: 16px;\n position: relative;\n top: 1px;\n\n .large-size & {\n font-size: 18px;\n top: auto;\n }\n .tnt-themeS1 & {\n /* color: #7e8081; */\n color: ", ";\n }\n }\n"]);
|
|
56
|
+
|
|
57
|
+
_templateObject2 = function _templateObject2() {
|
|
58
|
+
return data;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
return data;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function _templateObject() {
|
|
65
|
+
var data = _taggedTemplateLiteral(["\n background: none !important;\n &.ant-menu.ant-menu-root {\n position: relative;\n transition: none !important;\n padding-top: 10px;\n border-right: none;\n text-rendering: optimizeLegibility;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n height: calc(100vh - ", ");\n overflow-y: auto;\n overflow-x: hidden;\n .collapseIconPlacementBottom & {\n padding-bottom: 36px;\n }\n .tnt-themeS1 & {\n overflow-x: unset;\n box-shadow: 10px 0 10px -5px rgba(0,0,0,0.10);\n z-index: 2;\n }\n scrollbar-width: none;\n -ms-overflow-style: none;\n\n &::-webkit-scrollbar {\n display: none;\n }\n &::-moz-scrollbar {\n display: none;\n }\n\n /** \u4E00\u7EA7\u7ED3\u70B9\u662F\u83DC\u5355\u6837\u5F0F\u5F00\u59CB */\n & > .ant-menu-item {\n & > .tnt-icon:first-child {\n font-size: 16px\n }\n }\n\n .ant-layout-sider-collapsed & {\n & > .ant-menu-item {\n & > .tnt-icon:first-child {\n padding-left: 8px;\n }\n a {\n visibility: hidden;\n }\n }\n }\n /** \u4E00\u7EA7\u7ED3\u70B9\u662F\u83DC\u5355\u6837\u5F0F\u7ED3\u675F */\n\n .ant-menu-item:active,\n .ant-menu-submenu-title:active {\n background: none;\n }\n\n .ant-menu-submenu .ant-menu-sub {\n background: #212635;\n border-radius: 0 0 2px 2px;\n .compatible & {\n background: #07408d !important;\n }\n .tnt-themeS1 & {\n background: #fff !important;\n }\n\n // \u84DD\u8272\u7CFB\u5217 \u83DC\u5355\u5C55\u5F00\u533A\u57DF\u989C\u8272\n .tnt-themeS3 & {\n background: #07408D !important;\n }\n }\n .ant-menu-submenu.ant-menu-submenu-active,\n .ant-menu-submenu.ant-menu-submenu-selected {\n background: rgba(47,129,247,.25) !important;\n .tnt-themeS1 & {\n background: ", " !important;\n }\n\n // \u84DD\u8272\u7CFB \u4E00\u7EA7\u83DC\u5355\u7684\u9009\u4E2D\u6548\u679C\n .tnt-themeS3 & {\n background: #204085 !important;\n }\n }\n & > .ant-menu-submenu .ant-menu-submenu.ant-menu-submenu-active,\n & > .ant-menu-submenu .ant-menu-submenu.ant-menu-submenu-selected {\n background: none !important;\n .tnt-themeS1 & {\n background: ", " !important;\n }\n // \u84DD\u8272\u7CFB \u5B50\u7EA7\u83DC\u5355\u7EA7\u7684\u9009\u4E2D\u6548\u679C\n .tnt-themeS3 & {\n background: #204085 !important;\n }\n }\n .ant-menu-item {\n margin: 0;\n font-size: 14px;\n padding-left: 54px !important;\n height: ", ";\n line-height: ", ";\n }\n\n & > .ant-menu-item {\n padding-left: 24px !important;\n width: 100%;\n\n & > .tnt-icon {\n margin-right: 12px;\n }\n & > a {\n display: inline-block;\n }\n }\n\n .ant-menu-submenu-title {\n position: relative;\n color: ", ";\n .tnt-themeS1 & {\n color: ", ";\n }\n height: ", ";\n line-height: ", ";\n .tnt-icon {\n .tnt-themeS1 & {\n color: ", ";\n }\n }\n & > .tnt-icon {\n position: absolute;\n right: 20px;\n top: 1px;\n font-size: 10px;\n }\n\n // \u84DD\u8272\u7CFB\u4E3B\u9898\n .tnt-themeS3 & {\n color: #FFF;\n }\n .tnt-icon {\n .tnt-themeS3 & {\n color: #FFF;\n }\n }\n }\n\n & > .ant-menu-submenu .ant-menu-submenu .ant-menu-submenu-title {\n margin-top: 0;\n margin-bottom: 0;\n padding-left: 54px !important;\n }\n }\n\n &.ant-menu .menu-arrow-right {\n color: ", ";\n }\n\n .ant-menu-item, .ant-menu-item > a {\n color: ", ";\n .tnt-themeS1 & {\n color: ", ";\n }\n &:hover {\n color: #fff;\n .tnt-themeS1 & {\n color: ", ";\n }\n }\n\n // \u84DD\u8272\u7CFB\u5217\n .tnt-themeS3 & {\n color: #fff;\n }\n &:hover {\n .tnt-themeS3 & {\n color: #fff;\n }\n }\n }\n & > .ant-menu-item.ant-menu-item-selected,\n &.ant-menu:not(.ant-menu-horizontal) .ant-menu-item-selected {\n color: rgba(255,255,255,.85);\n background-color: ", ";\n .compatible & {\n background-color: #013479;\n }\n & > a {\n .tnt-themeS1 & {\n color: #fff;\n }\n }\n .tnt-themeS1 & {\n color: #fff;\n background-color: ", ";\n }\n\n // \u84DD\u8272\u7CFB \u5B50\u9879\u9009\u4E2D\u989C\u8272\n .tnt-themeS3 & {\n color: #fff;\n background: #013479;\n &::after{\n content:\"\";\n display:none;\n }\n }\n }\n .ant-menu-submenu.ant-menu-submenu-selected {\n .tnt-themeS2 & {\n background: #141825;\n }\n .tnt-themeS2.compatible & {\n background: rgba(47,129,247,.25) !important;\n }\n }\n"]);
|
|
66
|
+
|
|
67
|
+
_templateObject = function _templateObject() {
|
|
68
|
+
return data;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
return data;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
75
|
+
|
|
76
|
+
var color = 'rgba(255,255,255,.85)';
|
|
77
|
+
var compatibleColor = '#a1d7ff';
|
|
78
|
+
var SubMenu = _menu["default"].SubMenu,
|
|
79
|
+
MenuItem = _menu["default"].Item;
|
|
80
|
+
var TNTMenu = (0, _styledComponents["default"])(_menu["default"])(_templateObject(), function (props) {
|
|
81
|
+
return "".concat(props.theme.headerHeight, "px");
|
|
82
|
+
}, function (props) {
|
|
83
|
+
return props.theme.dividerColor;
|
|
84
|
+
}, function (props) {
|
|
85
|
+
return props.theme.dividerColor;
|
|
86
|
+
}, function (_ref) {
|
|
87
|
+
var size = _ref.size;
|
|
88
|
+
return size === 'large' ? '40px' : '36px';
|
|
89
|
+
}, function (_ref2) {
|
|
90
|
+
var size = _ref2.size;
|
|
91
|
+
return size === 'large' ? '40px' : '36px';
|
|
92
|
+
}, function (props) {
|
|
93
|
+
return props.theme.compatible ? compatibleColor : color;
|
|
94
|
+
}, function (props) {
|
|
95
|
+
return props.theme.primaryTextColor;
|
|
96
|
+
}, function (_ref3) {
|
|
97
|
+
var size = _ref3.size;
|
|
98
|
+
return size === 'large' ? '40px' : '36px';
|
|
99
|
+
}, function (_ref4) {
|
|
100
|
+
var size = _ref4.size;
|
|
101
|
+
return size === 'large' ? '40px' : '36px';
|
|
102
|
+
}, function (props) {
|
|
103
|
+
return props.theme.lightIconColor;
|
|
104
|
+
}, function (props) {
|
|
105
|
+
return props.theme.compatible ? compatibleColor : color;
|
|
106
|
+
}, function (props) {
|
|
107
|
+
return props.theme.compatible ? compatibleColor : color;
|
|
108
|
+
}, function (props) {
|
|
109
|
+
return props.theme.primaryTextColor;
|
|
110
|
+
}, function (props) {
|
|
111
|
+
return props.theme.primaryColor;
|
|
112
|
+
}, function (props) {
|
|
113
|
+
return props.theme.primaryColor;
|
|
114
|
+
}, function (props) {
|
|
115
|
+
return props.theme.primaryColor;
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
var MenuTitle = _styledComponents["default"].span(_templateObject2(), function (props) {
|
|
119
|
+
return props.theme.primaryTextColor;
|
|
120
|
+
}, function (props) {
|
|
121
|
+
return "".concat(props.theme.iconColor);
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
var _default = (0, _styledComponents.withTheme)(function (props) {
|
|
125
|
+
var actions = (0, _react.useContext)(_ActionsContext["default"]);
|
|
126
|
+
var language = props.language,
|
|
127
|
+
_props$menus = props.menus,
|
|
128
|
+
menus = _props$menus === void 0 ? [] : _props$menus,
|
|
129
|
+
formatMenuPath = props.formatMenuPath,
|
|
130
|
+
changeRouter = props.changeRouter,
|
|
131
|
+
selectedKey = props.selectedKey,
|
|
132
|
+
openKeys = props.openKeys,
|
|
133
|
+
onSelect = props.onSelect,
|
|
134
|
+
onBeforeChange = props.onBeforeChange,
|
|
135
|
+
onChange = props.onChange,
|
|
136
|
+
onOpenChange = props.onOpenChange,
|
|
137
|
+
collapsed = props.collapsed;
|
|
138
|
+
|
|
139
|
+
var _getSelectedMenuInfo = (0, _utils.getSelectedMenuInfo)(selectedKey, menus),
|
|
140
|
+
subMenu = _getSelectedMenuInfo.subMenu,
|
|
141
|
+
parentMenus = _getSelectedMenuInfo.parentMenus;
|
|
142
|
+
|
|
143
|
+
var _useState = (0, _react.useState)([(0, _lodash.get)(subMenu, 'code')]),
|
|
144
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
145
|
+
selectedKeys = _useState2[0],
|
|
146
|
+
setSelectedKeys = _useState2[1];
|
|
147
|
+
|
|
148
|
+
var onSelectMenu = function onSelectMenu(param) {
|
|
149
|
+
var _ref5 = (0, _utils.getSelectedMenuInfo)(param.key, menus) || {},
|
|
150
|
+
subMenu = _ref5.subMenu,
|
|
151
|
+
parentMenus = _ref5.parentMenus;
|
|
152
|
+
|
|
153
|
+
var params = _objectSpread({}, param, {
|
|
154
|
+
data: subMenu
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
var defaultBeforeChange = function defaultBeforeChange(_ref6) {
|
|
158
|
+
var data = _ref6.data;
|
|
159
|
+
return !(0, _utils.isNewTabMenu)(data);
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
var defaultSelect = function defaultSelect(_ref7) {
|
|
163
|
+
var _window$location$path;
|
|
164
|
+
|
|
165
|
+
var data = _ref7.data;
|
|
166
|
+
|
|
167
|
+
var _ref8 = data || {},
|
|
168
|
+
path = _ref8.path;
|
|
169
|
+
|
|
170
|
+
var formatPath = formatMenuPath || function (path) {
|
|
171
|
+
return path;
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
if ((0, _utils.isNewTabMenu)(data)) {
|
|
175
|
+
(0, _utils.openInNewTab)(formatPath(data == null ? void 0 : data.path, data));
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
var routerPrefix = (_window$location$path = window.location.pathname.match(/(^\/[^\/]+)/i)) == null ? void 0 : _window$location$path[1];
|
|
180
|
+
|
|
181
|
+
if (path == null ? void 0 : path.startsWith(routerPrefix)) {
|
|
182
|
+
var forwardPath = formatPath(path, data);
|
|
183
|
+
changeRouter ? changeRouter(forwardPath, data) : window.history.pushState(data, data == null ? void 0 : data.name, forwardPath);
|
|
184
|
+
} else {
|
|
185
|
+
window.location.href = formatPath(path, data);
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
var finalSelect = onSelect || defaultSelect;
|
|
190
|
+
|
|
191
|
+
if (param.key !== (0, _lodash.get)(selectedKeys, '0')) {
|
|
192
|
+
var finalBeforeChange = onBeforeChange || defaultBeforeChange;
|
|
193
|
+
|
|
194
|
+
if (finalBeforeChange(params, (0, _lodash.get)(selectedKeys, '0'))) {
|
|
195
|
+
// SideMenu菜单收起状态
|
|
196
|
+
if (collapsed) {
|
|
197
|
+
var newOpenKeys = parentMenus == null ? void 0 : parentMenus.map(function (_ref9) {
|
|
198
|
+
var code = _ref9.code;
|
|
199
|
+
return code;
|
|
200
|
+
}).reverse();
|
|
201
|
+
onOpenChange(newOpenKeys);
|
|
202
|
+
(0, _storage.setSideMenuStore)({
|
|
203
|
+
openKeys: newOpenKeys,
|
|
204
|
+
beforeOpenKeys: newOpenKeys
|
|
205
|
+
});
|
|
188
206
|
}
|
|
207
|
+
|
|
208
|
+
setSelectedKeys([param.key]);
|
|
209
|
+
onChange && onChange(params);
|
|
210
|
+
}
|
|
189
211
|
}
|
|
190
|
-
& > .ant-menu-item.ant-menu-item-selected,
|
|
191
|
-
&.ant-menu:not(.ant-menu-horizontal) .ant-menu-item-selected {
|
|
192
|
-
color: rgba(255,255,255,.85);
|
|
193
|
-
background-color: ${props => props.theme.primaryColor};
|
|
194
|
-
.compatible & {
|
|
195
|
-
background-color: #013479;
|
|
196
|
-
}
|
|
197
|
-
& > a {
|
|
198
|
-
.tnt-themeS1 & {
|
|
199
|
-
color: #fff;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
.tnt-themeS1 & {
|
|
203
|
-
color: #fff;
|
|
204
|
-
background-color: ${props => props.theme.primaryColor};
|
|
205
|
-
}
|
|
206
212
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
}
|
|
213
|
+
actions.setSelectedMenuKey(param.key);
|
|
214
|
+
setSelectedKeys([param.key]);
|
|
215
|
+
finalSelect(params);
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
var getExpandIcon = function getExpandIcon(code) {
|
|
219
|
+
if (props.theme.compatible) {
|
|
220
|
+
return openKeys.includes(code) ? 'minus' : 'plus';
|
|
216
221
|
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
222
|
+
|
|
223
|
+
return openKeys.includes(code) ? 'up' : 'down';
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
var onOpenKeysChange = function onOpenKeysChange(keys) {
|
|
227
|
+
var openKey = keys.find(function (key) {
|
|
228
|
+
return !openKeys.includes(key);
|
|
229
|
+
}); // const closeKey = openKeys.find(key => !keys.includes(key));
|
|
230
|
+
|
|
231
|
+
var newOpenKeys = keys;
|
|
232
|
+
|
|
233
|
+
var findParentGroupKey = function findParentGroupKey(key, openKeys) {
|
|
234
|
+
var parentGroupKey;
|
|
235
|
+
(0, _utils.traverseTree)(menus, function (node, pnode) {
|
|
236
|
+
if (node.code === key) {
|
|
237
|
+
if (pnode && openKeys.includes(pnode == null ? void 0 : pnode.code)) {
|
|
238
|
+
parentGroupKey = pnode == null ? void 0 : pnode.code;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
return false;
|
|
223
242
|
}
|
|
243
|
+
});
|
|
244
|
+
return parentGroupKey;
|
|
245
|
+
}; // 展开openKey
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
if (openKey) {
|
|
249
|
+
// 父子关系展开
|
|
250
|
+
var parentGroupKey = findParentGroupKey(openKey, openKeys);
|
|
251
|
+
|
|
252
|
+
if (parentGroupKey) {
|
|
253
|
+
newOpenKeys = keys.length > 2 ? [parentGroupKey, openKey] : keys;
|
|
254
|
+
} else {
|
|
255
|
+
newOpenKeys = [openKey];
|
|
256
|
+
}
|
|
257
|
+
} else {
|
|
258
|
+
// 收起closeKey
|
|
259
|
+
newOpenKeys = keys;
|
|
224
260
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
.
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
261
|
+
|
|
262
|
+
onOpenChange(newOpenKeys);
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
(0, _react.useEffect)(function () {
|
|
266
|
+
setSelectedKeys([selectedKey]);
|
|
267
|
+
|
|
268
|
+
if (selectedKey && !collapsed && (parentMenus == null ? void 0 : parentMenus.length)) {
|
|
269
|
+
onOpenChange(parentMenus == null ? void 0 : parentMenus.map(function (_ref10) {
|
|
270
|
+
var code = _ref10.code;
|
|
271
|
+
return code;
|
|
272
|
+
}).reverse());
|
|
237
273
|
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
274
|
+
|
|
275
|
+
actions.setSelectedMenuKey(selectedKey);
|
|
276
|
+
}, [selectedKey]);
|
|
277
|
+
actions.off('menuSelect', onSelectMenu);
|
|
278
|
+
actions.on('menuSelect', onSelectMenu);
|
|
279
|
+
return React.createElement(TNTMenu, {
|
|
280
|
+
mode: "inline",
|
|
281
|
+
defaultSelectedKeys: [],
|
|
282
|
+
openKeys: openKeys,
|
|
283
|
+
selectedKeys: selectedKeys,
|
|
284
|
+
onOpenChange: onOpenKeysChange
|
|
285
|
+
}, menus == null ? void 0 : menus.map(function (menu) {
|
|
286
|
+
var MenuLink = function MenuLink(_ref11) {
|
|
287
|
+
var menuName = _ref11.menuName,
|
|
288
|
+
enName = _ref11.enName,
|
|
289
|
+
path = _ref11.path;
|
|
290
|
+
return React.createElement("a", {
|
|
291
|
+
href: path,
|
|
292
|
+
onClick: function onClick(evt) {
|
|
293
|
+
return evt.preventDefault();
|
|
247
294
|
}
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
295
|
+
}, {
|
|
296
|
+
cn: menuName,
|
|
297
|
+
en: enName
|
|
298
|
+
}[language]);
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
if ((0, _utils.isGroupMenu)(menu)) {
|
|
302
|
+
var _menu$children;
|
|
303
|
+
|
|
304
|
+
var getSubMenuProps = function getSubMenuProps(_ref12) {
|
|
305
|
+
var code = _ref12.code,
|
|
306
|
+
groupIcon = _ref12.groupIcon,
|
|
307
|
+
groupName = _ref12.groupName,
|
|
308
|
+
enName = _ref12.enName;
|
|
309
|
+
var isSubGroup = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
310
|
+
return {
|
|
311
|
+
key: code,
|
|
312
|
+
title: React.createElement(MenuTitle, {
|
|
313
|
+
style: collapsed && isSubGroup ? {
|
|
314
|
+
color: props.theme.primaryTextColor
|
|
315
|
+
} : {}
|
|
316
|
+
}, !isSubGroup && React.createElement(_Iconfont["default"], {
|
|
317
|
+
type: groupIcon
|
|
318
|
+
}), collapsed && !isSubGroup ? '' : {
|
|
319
|
+
cn: groupName,
|
|
320
|
+
en: enName
|
|
321
|
+
}[language]),
|
|
322
|
+
expandIcon: collapsed ? null : React.createElement(_Iconfont["default"]
|
|
323
|
+
/* */
|
|
324
|
+
, {
|
|
325
|
+
type: getExpandIcon(code)
|
|
326
|
+
})
|
|
327
|
+
};
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
return React.createElement(SubMenu, _extends({}, getSubMenuProps(menu), {
|
|
331
|
+
onClick: onSelectMenu
|
|
332
|
+
}), menu == null ? void 0 : (_menu$children = menu.children) == null ? void 0 : _menu$children.map(function (menu) {
|
|
333
|
+
if ((0, _utils.isGroupMenu)(menu)) {
|
|
334
|
+
var _menu$children2;
|
|
335
|
+
|
|
336
|
+
return React.createElement(SubMenu, _extends({}, getSubMenuProps(menu, true), {
|
|
337
|
+
onClick: onSelectMenu
|
|
338
|
+
}), menu == null ? void 0 : (_menu$children2 = menu.children) == null ? void 0 : _menu$children2.map(function (_ref13) {
|
|
339
|
+
var code = _ref13.code,
|
|
340
|
+
menu = _objectWithoutProperties(_ref13, ["code"]);
|
|
341
|
+
|
|
342
|
+
return React.createElement(MenuItem, {
|
|
343
|
+
key: code
|
|
344
|
+
}, React.createElement(MenuLink, _extends({}, menu, {
|
|
345
|
+
style: {
|
|
346
|
+
paddingLeft: '24px'
|
|
347
|
+
}
|
|
348
|
+
})));
|
|
349
|
+
}));
|
|
251
350
|
}
|
|
351
|
+
|
|
352
|
+
return React.createElement(MenuItem, {
|
|
353
|
+
key: menu == null ? void 0 : menu.code
|
|
354
|
+
}, React.createElement(MenuLink, menu));
|
|
355
|
+
}));
|
|
252
356
|
}
|
|
253
|
-
`;
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
export default withTheme(
|
|
257
|
-
props => {
|
|
258
|
-
const actions = useContext(ActionsContext);
|
|
259
|
-
const { language, menus = [], formatMenuPath, changeRouter, selectedKey, openKeys, onSelect, onBeforeChange, onChange, onOpenChange, collapsed } = props;
|
|
260
|
-
const { subMenu, parentMenus } = getSelectedMenuInfo(selectedKey, menus);
|
|
261
|
-
const [selectedKeys, setSelectedKeys] = useState([get(subMenu, 'code')]);
|
|
262
|
-
const onSelectMenu = param => {
|
|
263
|
-
const { subMenu, parentMenus } = getSelectedMenuInfo(param.key, menus) || {};
|
|
264
|
-
const params = {
|
|
265
|
-
...param,
|
|
266
|
-
data: subMenu
|
|
267
|
-
};
|
|
268
|
-
const defaultBeforeChange = ({ data }) => !isNewTabMenu(data);
|
|
269
|
-
const defaultSelect = ({ data }) => {
|
|
270
|
-
const { path } = data || {};
|
|
271
|
-
const formatPath = formatMenuPath || (path => path);
|
|
272
|
-
|
|
273
|
-
if (isNewTabMenu(data)) {
|
|
274
|
-
openInNewTab(formatPath(data?.path, data));
|
|
275
|
-
return;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
const routerPrefix = window.location.pathname.match(/(^\/[^\/]+)/i)?.[1];
|
|
279
|
-
|
|
280
|
-
if (path?.startsWith(routerPrefix)) {
|
|
281
|
-
const forwardPath = formatPath(path, data);
|
|
282
|
-
changeRouter ? changeRouter(forwardPath, data) : window.history.pushState(data, data?.name, forwardPath);
|
|
283
|
-
} else {
|
|
284
|
-
window.location.href = formatPath(path, data);
|
|
285
|
-
}
|
|
286
|
-
};
|
|
287
|
-
const finalSelect = onSelect || defaultSelect;
|
|
288
|
-
|
|
289
|
-
if (param.key !== get(selectedKeys, '0')) {
|
|
290
|
-
const finalBeforeChange = onBeforeChange || defaultBeforeChange;
|
|
291
|
-
|
|
292
|
-
if (finalBeforeChange(params, get(selectedKeys, '0'))) {
|
|
293
|
-
// SideMenu菜单收起状态
|
|
294
|
-
if (collapsed) {
|
|
295
|
-
const newOpenKeys = parentMenus?.map(({ code }) => code).reverse();
|
|
296
|
-
|
|
297
|
-
onOpenChange(newOpenKeys);
|
|
298
|
-
setSideMenuStore({
|
|
299
|
-
openKeys: newOpenKeys,
|
|
300
|
-
beforeOpenKeys: newOpenKeys
|
|
301
|
-
});
|
|
302
|
-
}
|
|
303
|
-
setSelectedKeys([param.key]);
|
|
304
|
-
onChange && onChange(params);
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
actions.setSelectedMenuKey(param.key);
|
|
308
|
-
setSelectedKeys([param.key]);
|
|
309
|
-
|
|
310
|
-
finalSelect(params);
|
|
311
|
-
};
|
|
312
|
-
const getExpandIcon = code => {
|
|
313
|
-
if (props.theme.compatible) {
|
|
314
|
-
return openKeys.includes(code) ? 'minus' : 'plus';
|
|
315
|
-
}
|
|
316
357
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
let parentGroupKey;
|
|
326
|
-
|
|
327
|
-
traverseTree(menus, (node, pnode) => {
|
|
328
|
-
if (node.code === key) {
|
|
329
|
-
if (pnode && openKeys.includes(pnode?.code)) {
|
|
330
|
-
parentGroupKey = pnode?.code;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
return false;
|
|
334
|
-
}
|
|
335
|
-
});
|
|
336
|
-
|
|
337
|
-
return parentGroupKey;
|
|
338
|
-
};
|
|
339
|
-
|
|
340
|
-
// 展开openKey
|
|
341
|
-
if (openKey) {
|
|
342
|
-
// 父子关系展开
|
|
343
|
-
const parentGroupKey = findParentGroupKey(openKey, openKeys);
|
|
344
|
-
if (parentGroupKey) {
|
|
345
|
-
newOpenKeys = keys.length > 2 ? [parentGroupKey, openKey] : keys;
|
|
346
|
-
} else {
|
|
347
|
-
newOpenKeys = [openKey];
|
|
348
|
-
}
|
|
349
|
-
} else { // 收起closeKey
|
|
350
|
-
newOpenKeys = keys;
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
onOpenChange(newOpenKeys);
|
|
354
|
-
};
|
|
358
|
+
return React.createElement(MenuItem, {
|
|
359
|
+
key: menu.code,
|
|
360
|
+
onClick: onSelectMenu
|
|
361
|
+
}, React.createElement(_Iconfont["default"], {
|
|
362
|
+
type: menu.icon
|
|
363
|
+
}), React.createElement(MenuLink, menu));
|
|
364
|
+
}));
|
|
365
|
+
});
|
|
355
366
|
|
|
356
|
-
|
|
357
|
-
setSelectedKeys([selectedKey]);
|
|
358
|
-
if (selectedKey && !collapsed && parentMenus?.length) {
|
|
359
|
-
onOpenChange(parentMenus?.map(({ code }) => code).reverse());
|
|
360
|
-
}
|
|
361
|
-
actions.setSelectedMenuKey(selectedKey);
|
|
362
|
-
}, [selectedKey]);
|
|
363
|
-
|
|
364
|
-
actions.off('menuSelect', onSelectMenu);
|
|
365
|
-
actions.on('menuSelect', onSelectMenu);
|
|
366
|
-
|
|
367
|
-
return (
|
|
368
|
-
<TNTMenu
|
|
369
|
-
mode="inline"
|
|
370
|
-
defaultSelectedKeys={[]}
|
|
371
|
-
openKeys={openKeys}
|
|
372
|
-
selectedKeys={selectedKeys}
|
|
373
|
-
onOpenChange={onOpenKeysChange}
|
|
374
|
-
>
|
|
375
|
-
{
|
|
376
|
-
menus?.map(menu => {
|
|
377
|
-
const MenuLink = ({ menuName, enName, path }) => (
|
|
378
|
-
<a href={path} onClick={evt => evt.preventDefault()}>
|
|
379
|
-
{
|
|
380
|
-
{
|
|
381
|
-
cn: menuName,
|
|
382
|
-
en: enName
|
|
383
|
-
}[language]
|
|
384
|
-
}
|
|
385
|
-
</a>
|
|
386
|
-
);
|
|
387
|
-
|
|
388
|
-
if (isGroupMenu(menu)) {
|
|
389
|
-
const getSubMenuProps = ({ code, groupIcon, groupName, enName }, isSubGroup = false) => ({
|
|
390
|
-
key: code,
|
|
391
|
-
title: (
|
|
392
|
-
<MenuTitle style={(collapsed && isSubGroup) ? { color: props.theme.primaryTextColor } : {}}>
|
|
393
|
-
{!isSubGroup && <Iconfont type={groupIcon} />}
|
|
394
|
-
{
|
|
395
|
-
(collapsed && !isSubGroup) ? '' : {
|
|
396
|
-
cn: groupName,
|
|
397
|
-
en: enName
|
|
398
|
-
}[language]
|
|
399
|
-
}
|
|
400
|
-
</MenuTitle>
|
|
401
|
-
),
|
|
402
|
-
expandIcon: collapsed ? null : (
|
|
403
|
-
<Iconfont/* */ type={getExpandIcon(code)} />
|
|
404
|
-
)
|
|
405
|
-
});
|
|
406
|
-
|
|
407
|
-
return (
|
|
408
|
-
<SubMenu
|
|
409
|
-
{...getSubMenuProps(menu)}
|
|
410
|
-
onClick={onSelectMenu}
|
|
411
|
-
>
|
|
412
|
-
{
|
|
413
|
-
menu?.children?.map(menu => {
|
|
414
|
-
if (isGroupMenu(menu)) {
|
|
415
|
-
return (
|
|
416
|
-
<SubMenu
|
|
417
|
-
{...getSubMenuProps(menu, true)}
|
|
418
|
-
onClick={onSelectMenu}
|
|
419
|
-
>
|
|
420
|
-
{
|
|
421
|
-
menu?.children?.map(({ code, ...menu }) => (
|
|
422
|
-
<MenuItem key={code}>
|
|
423
|
-
<MenuLink {...menu} style={{ paddingLeft: '24px' }}/>
|
|
424
|
-
</MenuItem>
|
|
425
|
-
))
|
|
426
|
-
}
|
|
427
|
-
</SubMenu>
|
|
428
|
-
);
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
return (
|
|
432
|
-
<MenuItem key={menu?.code}>
|
|
433
|
-
<MenuLink {...menu} />
|
|
434
|
-
</MenuItem>
|
|
435
|
-
);
|
|
436
|
-
})
|
|
437
|
-
}
|
|
438
|
-
</SubMenu>
|
|
439
|
-
);
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
return (
|
|
443
|
-
<MenuItem key={menu.code} onClick={onSelectMenu}>
|
|
444
|
-
<Iconfont type={menu.icon} />
|
|
445
|
-
<MenuLink {...menu} />
|
|
446
|
-
</MenuItem>
|
|
447
|
-
);
|
|
448
|
-
})
|
|
449
|
-
}
|
|
450
|
-
</TNTMenu>
|
|
451
|
-
);
|
|
452
|
-
}
|
|
453
|
-
);
|
|
367
|
+
exports["default"] = _default;
|