tntd 1.4.20 → 1.4.22
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/Handle/README.md +0 -20
- package/components/Handle/index.js +44 -7
- package/components/locale.js +8 -2
- package/dist/1.tntd.js +1 -1
- package/dist/stats.json +24430 -24390
- package/dist/tntd.css +1 -1
- package/dist/tntd.js +13 -8
- package/es/ArrayInput/icon.js +5 -5
- package/es/ArrayInput/index.js +108 -76
- package/es/AuthContext.js +1 -1
- package/es/Columns/index.js +38 -31
- package/es/DevelopmentLogin/LoginModal.js +45 -32
- package/es/DevelopmentLogin/index.js +17 -13
- package/es/Ellipsis/Svg/CopySVG.js +13 -13
- package/es/Ellipsis/Svg/TickSVG.js +8 -8
- package/es/Ellipsis/index.js +69 -58
- package/es/Handle/README.md +0 -20
- package/es/Handle/index.js +100 -33
- package/es/Icon/fonts/iconfont.js +12 -7
- package/es/Icon/index.js +13 -10
- package/es/Img/Contain.js +29 -24
- package/es/Img/Cover.js +54 -40
- package/es/Img/index.js +45 -36
- package/es/Layout/ActionsContext.js +2 -3
- package/es/Layout/AppList.js +92 -37
- package/es/Layout/Application.js +72 -26
- package/es/Layout/Avatar.js +66 -29
- package/es/Layout/CompatibleLanguage.js +94 -39
- package/es/Layout/EnterpriseLayout/Avatar.js +76 -38
- package/es/Layout/EnterpriseLayout/Language.js +32 -14
- package/es/Layout/EnterpriseLayout/Theme.js +34 -16
- package/es/Layout/EnterpriseLayout/index.js +16 -14
- package/es/Layout/GlobalNavigation/NavigationPopup.js +170 -59
- package/es/Layout/GlobalNavigation/index.js +54 -20
- package/es/Layout/Header.js +46 -25
- package/es/Layout/HeaderActions.js +56 -42
- package/es/Layout/HeaderNavs.js +47 -20
- package/es/Layout/HeaderTabs.js +102 -49
- package/es/Layout/Iconfont.js +1 -1
- package/es/Layout/Language.js +32 -14
- package/es/Layout/Layout.js +108 -86
- package/es/Layout/Logo.js +32 -16
- package/es/Layout/OrgAppList.js +107 -62
- package/es/Layout/SideMenu.js +124 -63
- package/es/Layout/Theme.js +61 -23
- package/es/Layout/checkAuth.js +29 -0
- package/es/Layout/index.js +34 -26
- package/es/Layout/paaslayout/CompactSideMenu.js +74 -35
- package/es/Layout/paaslayout/Header.js +45 -22
- package/es/Layout/paaslayout/Logo.js +13 -3
- package/es/Layout/paaslayout/SideMenu.js +78 -39
- package/es/Layout/paaslayout/index.js +102 -75
- package/es/Layout/storage.js +9 -10
- package/es/Layout/utils.js +136 -0
- package/es/LoadingButton/index.js +24 -15
- package/es/Modal/index.js +46 -38
- package/es/Page/Box.js +41 -34
- package/es/Page/index.js +67 -52
- package/es/Page/utils.js +5 -0
- package/es/QueryForm/Field/Checkbox.js +9 -5
- package/es/QueryForm/Field/Select.js +41 -31
- package/es/QueryForm/Field/SelectInput.js +41 -26
- package/es/QueryForm/Field/fieldsMap.js +1 -0
- package/es/QueryForm/Field/index.js +71 -41
- package/es/QueryForm/createActions.js +7 -6
- package/es/QueryForm/index.js +135 -76
- package/es/QueryListScene/List.js +128 -74
- package/es/QueryListScene/QueryForm.js +81 -46
- package/es/QueryListScene/QueryListScene.js +40 -25
- package/es/QueryListScene/Title.js +3 -3
- package/es/QueryListScene/Toolbar.js +12 -11
- package/es/Select/DropDownWrap.js +50 -29
- package/es/Select/index.js +231 -135
- package/es/Table/ResizableTable/index.js +40 -26
- package/es/Table/index.js +16 -18
- package/es/Title/index.js +23 -21
- package/es/locale.js +11 -3
- package/es/utils/checkAuth.js +5 -3
- package/es/utils/findMenuInfoByPath.js +4 -0
- package/es/utils/index.js +23 -12
- package/lib/ArrayInput/icon.js +6 -6
- package/lib/ArrayInput/index.js +127 -78
- package/lib/AuthContext.js +4 -1
- package/lib/Columns/index.js +47 -31
- package/lib/DevelopmentLogin/LoginModal.js +58 -32
- package/lib/DevelopmentLogin/index.js +27 -16
- package/lib/Ellipsis/Svg/CopySVG.js +15 -13
- package/lib/Ellipsis/Svg/TickSVG.js +10 -8
- package/lib/Ellipsis/index.js +80 -57
- package/lib/Handle/README.md +0 -20
- package/lib/Handle/index.js +119 -33
- package/lib/Icon/fonts/iconfont.js +12 -7
- package/lib/Icon/index.js +20 -11
- package/lib/Img/Contain.js +34 -24
- package/lib/Img/Cover.js +65 -42
- package/lib/Img/index.js +51 -36
- package/lib/Layout/ActionsContext.js +4 -1
- package/lib/Layout/AppList.js +118 -40
- package/lib/Layout/Application.js +86 -26
- package/lib/Layout/Avatar.js +86 -32
- package/lib/Layout/CompatibleLanguage.js +110 -39
- package/lib/Layout/EnterpriseLayout/Avatar.js +100 -41
- package/lib/Layout/EnterpriseLayout/Header.js +113 -0
- package/lib/Layout/EnterpriseLayout/HeaderActions.js +104 -0
- package/lib/Layout/EnterpriseLayout/Language.js +48 -17
- package/lib/Layout/EnterpriseLayout/Theme.js +44 -16
- package/lib/Layout/EnterpriseLayout/index.js +23 -14
- package/lib/Layout/GlobalNavigation/NavigationPopup.js +186 -59
- package/lib/Layout/GlobalNavigation/index.js +74 -23
- package/lib/Layout/Header.js +63 -28
- package/lib/Layout/HeaderActions.js +74 -45
- package/lib/Layout/HeaderNavs.js +61 -23
- package/lib/Layout/HeaderTabs.js +118 -51
- package/lib/Layout/Iconfont.js +5 -1
- package/lib/Layout/Language.js +48 -17
- package/lib/Layout/Layout.js +128 -88
- package/lib/Layout/Logo.js +43 -19
- package/lib/Layout/OrgAppList.js +127 -64
- package/lib/Layout/SideMenu.js +143 -65
- package/lib/Layout/Theme.js +73 -23
- package/lib/Layout/checkAuth.js +39 -0
- package/lib/Layout/createActions.js +5 -0
- package/lib/Layout/images/index.js +28 -0
- package/lib/Layout/index.js +55 -30
- package/lib/Layout/paaslayout/CompactSideMenu.js +84 -35
- package/lib/Layout/paaslayout/Header.js +55 -22
- package/lib/Layout/paaslayout/Logo.js +19 -3
- package/lib/Layout/paaslayout/SideMenu.js +87 -39
- package/lib/Layout/paaslayout/index.js +122 -77
- package/lib/Layout/storage.js +40 -11
- package/lib/Layout/utils.js +166 -0
- package/lib/LoadingButton/index.js +29 -15
- package/lib/Modal/index.js +53 -38
- package/lib/Page/Box.js +45 -34
- package/lib/Page/index.js +77 -52
- package/lib/Page/utils.js +9 -1
- package/lib/QueryForm/Field/Checkbox.js +13 -5
- package/lib/QueryForm/Field/Select.js +53 -33
- package/lib/QueryForm/Field/SelectInput.js +56 -28
- package/lib/QueryForm/Field/fieldsMap.js +15 -1
- package/lib/QueryForm/Field/index.js +81 -43
- package/lib/QueryForm/createActions.js +12 -6
- package/lib/QueryForm/index.js +157 -78
- package/lib/QueryForm/useForm.js +5 -0
- package/lib/QueryListScene/List.js +140 -76
- package/lib/QueryListScene/QueryForm.js +86 -46
- package/lib/QueryListScene/QueryListScene.js +46 -25
- package/lib/QueryListScene/Title.js +7 -3
- package/lib/QueryListScene/Toolbar.js +16 -11
- package/lib/QueryListScene/createActions.js +5 -0
- package/lib/QueryListScene/index.js +10 -0
- package/lib/QueryListScene/useActions.js +5 -0
- package/lib/Select/DropDownWrap.js +56 -31
- package/lib/Select/index.js +241 -135
- package/lib/Table/ResizableTable/index.js +48 -26
- package/lib/Table/index.js +28 -17
- package/lib/Title/index.js +28 -21
- package/lib/index.js +56 -35
- package/lib/locale.js +19 -4
- package/lib/utils/checkAuth.js +9 -4
- package/lib/utils/findMenuInfoByPath.js +8 -1
- package/lib/utils/index.js +42 -15
- package/package.json +2 -2
|
@@ -1,48 +1,79 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance
|
|
4
|
-
|
|
5
|
-
function
|
|
6
|
-
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
|
|
2
|
+
|
|
3
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
|
|
4
|
+
|
|
5
|
+
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; }
|
|
6
|
+
|
|
7
7
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
8
|
+
|
|
9
|
+
function _templateObject2() {
|
|
10
|
+
var data = _taggedTemplateLiteral(["\n background: #fff;\n list-style: none;\n font-size: 14px;\n color: #17233D;\n margin: 10px 0 0;\n padding: 0;\n li {\n position: relative;\n line-height: 38px;\n cursor: pointer;\n padding-left: 20px;\n & > a {\n color: #17233D;\n & > span {\n padding-left: 10px;\n }\n }\n &.active {\n background: #EAEDF8;\n &:before {\n position: absolute;\n left: 0;\n top: 0;\n content: '';\n width: 4px;\n height: 100%;\n background-color: #4C79FF;\n }\n }\n }\n"]);
|
|
11
|
+
|
|
12
|
+
_templateObject2 = function _templateObject2() {
|
|
13
|
+
return data;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
return data;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function _templateObject() {
|
|
20
|
+
var data = _taggedTemplateLiteral(["\n background: #fff;\n list-style: none;\n margin: 0;\n padding: 0;\n text-rendering: optimizeLegibility;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n .isInIframe & {\n display: none;\n }\n \n & > li {\n font-size: 14px;\n letter-spacing: 0;\n margin-top: 20px;\n &:first-child {\n margin-top: 30px;\n }\n & > span {\n line-height: 38px;\n opacity: 0.4;\n display: inline-block;\n width: calc(100% - 20px);\n color: #17233D;\n border-bottom: 1px solid #B2BECD;\n margin-left: 20px;\n }\n }\n"]);
|
|
21
|
+
|
|
22
|
+
_templateObject = function _templateObject() {
|
|
23
|
+
return data;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
|
|
8
29
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
30
|
+
|
|
9
31
|
import { useState, useEffect, Component } from 'react';
|
|
10
32
|
import styled from 'styled-components';
|
|
11
33
|
import cn from 'classnames';
|
|
12
34
|
import Iconfont from '../Iconfont';
|
|
13
|
-
var SideMenu = styled.ul(_templateObject
|
|
14
|
-
var SubMenu = styled.ul(_templateObject2
|
|
35
|
+
var SideMenu = styled.ul(_templateObject());
|
|
36
|
+
var SubMenu = styled.ul(_templateObject2());
|
|
15
37
|
export default (function (props) {
|
|
16
38
|
var language = props.language,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
39
|
+
_props$menus = props.menus,
|
|
40
|
+
menus = _props$menus === void 0 ? [] : _props$menus,
|
|
41
|
+
formatMenuPath = props.formatMenuPath,
|
|
42
|
+
changeRouter = props.changeRouter,
|
|
43
|
+
selectedKey = props.selectedKey,
|
|
44
|
+
onBeforeChange = props.onBeforeChange,
|
|
45
|
+
onChange = props.onChange,
|
|
46
|
+
onSelect = props.onSelect;
|
|
47
|
+
|
|
25
48
|
var _useState = useState(selectedKey),
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
49
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
50
|
+
activeMenu = _useState2[0],
|
|
51
|
+
setActiveMenu = _useState2[1];
|
|
52
|
+
|
|
29
53
|
var defaultBeforeChange = function defaultBeforeChange(_ref) {
|
|
30
54
|
var data = _ref.data;
|
|
31
55
|
return !isNewTabMenu(data);
|
|
32
56
|
};
|
|
57
|
+
|
|
33
58
|
var defaultSelect = function defaultSelect(_ref2) {
|
|
34
59
|
var _window$location$path;
|
|
60
|
+
|
|
35
61
|
var data = _ref2.data;
|
|
62
|
+
|
|
36
63
|
var _ref3 = data || {},
|
|
37
|
-
|
|
64
|
+
path = _ref3.path;
|
|
65
|
+
|
|
38
66
|
var formatPath = formatMenuPath || function (path) {
|
|
39
67
|
return path;
|
|
40
68
|
};
|
|
69
|
+
|
|
41
70
|
if (isNewTabMenu(data)) {
|
|
42
71
|
openInNewTab(formatPath(data == null ? void 0 : data.path, data));
|
|
43
72
|
return;
|
|
44
73
|
}
|
|
74
|
+
|
|
45
75
|
var routerPrefix = (_window$location$path = window.location.pathname.match(/(^\/[^\/]+)/i)) == null ? void 0 : _window$location$path[1];
|
|
76
|
+
|
|
46
77
|
if (window.location.pathname.startsWith(routerPrefix)) {
|
|
47
78
|
var forwardPath = formatPath(path, data);
|
|
48
79
|
changeRouter ? changeRouter(forwardPath, data) : window.history.pushState(data, data == null ? void 0 : data.name, forwardPath);
|
|
@@ -50,33 +81,38 @@ export default (function (props) {
|
|
|
50
81
|
window.location.href = formatPath(path, data);
|
|
51
82
|
}
|
|
52
83
|
};
|
|
84
|
+
|
|
53
85
|
var selectMenu = function selectMenu() {
|
|
54
86
|
var param = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
55
87
|
var finalBeforeChange = onBeforeChange || defaultBeforeChange;
|
|
56
88
|
var finalSelect = onSelect || defaultSelect;
|
|
89
|
+
|
|
57
90
|
if (param.key !== activeMenu) {
|
|
58
91
|
if (finalBeforeChange(param, activeMenu)) {
|
|
59
92
|
setActiveMenu(param.key);
|
|
60
93
|
onChange && onChange(param);
|
|
61
94
|
}
|
|
62
95
|
}
|
|
96
|
+
|
|
63
97
|
finalSelect(param);
|
|
64
98
|
};
|
|
99
|
+
|
|
65
100
|
var MenuItem = function MenuItem(_ref4) {
|
|
66
101
|
var item = _ref4.item;
|
|
67
102
|
var code = item.code,
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
103
|
+
groupName = item.groupName,
|
|
104
|
+
enName = item.enName,
|
|
105
|
+
_item$children = item.children,
|
|
106
|
+
children = _item$children === void 0 ? [] : _item$children;
|
|
107
|
+
|
|
72
108
|
var SubMenuItem = function SubMenuItem(_ref5) {
|
|
73
109
|
var menu = _ref5.menu;
|
|
74
110
|
var code = menu.code,
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
return
|
|
111
|
+
menuName = menu.menuName,
|
|
112
|
+
enName = menu.enName,
|
|
113
|
+
icon = menu.icon,
|
|
114
|
+
path = menu.path;
|
|
115
|
+
return React.createElement("li", {
|
|
80
116
|
key: code,
|
|
81
117
|
onClick: function onClick(evt) {
|
|
82
118
|
return selectMenu({
|
|
@@ -88,40 +124,43 @@ export default (function (props) {
|
|
|
88
124
|
className: cn({
|
|
89
125
|
active: code === activeMenu
|
|
90
126
|
})
|
|
91
|
-
},
|
|
127
|
+
}, React.createElement("a", {
|
|
92
128
|
href: path,
|
|
93
129
|
onClick: function onClick(evt) {
|
|
94
130
|
return evt.preventDefault();
|
|
95
131
|
}
|
|
96
|
-
}, icon instanceof Component ? icon :
|
|
132
|
+
}, icon instanceof Component ? icon : React.createElement(Iconfont, {
|
|
97
133
|
type: icon
|
|
98
|
-
}),
|
|
134
|
+
}), React.createElement("span", null, {
|
|
99
135
|
cn: menuName,
|
|
100
136
|
en: enName
|
|
101
137
|
}[language])));
|
|
102
138
|
};
|
|
139
|
+
|
|
103
140
|
if (groupName && children.length) {
|
|
104
|
-
return
|
|
141
|
+
return React.createElement("li", {
|
|
105
142
|
key: code
|
|
106
|
-
},
|
|
143
|
+
}, React.createElement("span", null, {
|
|
107
144
|
cn: groupName,
|
|
108
145
|
en: enName
|
|
109
|
-
}[language]),
|
|
110
|
-
return
|
|
146
|
+
}[language]), React.createElement(SubMenu, null, children.map(function (subItem) {
|
|
147
|
+
return React.createElement(SubMenuItem, {
|
|
111
148
|
menu: subItem,
|
|
112
149
|
key: subItem == null ? void 0 : subItem.code
|
|
113
150
|
});
|
|
114
151
|
})));
|
|
115
152
|
}
|
|
116
|
-
|
|
153
|
+
|
|
154
|
+
return React.createElement(SubMenuItem, {
|
|
117
155
|
menu: item
|
|
118
156
|
});
|
|
119
157
|
};
|
|
158
|
+
|
|
120
159
|
useEffect(function () {
|
|
121
160
|
setActiveMenu(selectedKey);
|
|
122
161
|
}, [selectedKey]);
|
|
123
|
-
return
|
|
124
|
-
return
|
|
162
|
+
return React.createElement(SideMenu, null, menus.map(function (menu) {
|
|
163
|
+
return React.createElement(MenuItem, {
|
|
125
164
|
item: menu,
|
|
126
165
|
key: menu.code
|
|
127
166
|
});
|
|
@@ -1,19 +1,32 @@
|
|
|
1
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
1
|
import "antd/lib/layout/style";
|
|
3
2
|
import _Layout from "antd/lib/layout";
|
|
4
|
-
|
|
5
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly
|
|
6
|
-
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
function
|
|
12
|
-
|
|
13
|
-
function
|
|
14
|
-
|
|
3
|
+
|
|
4
|
+
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; }
|
|
5
|
+
|
|
6
|
+
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; }
|
|
7
|
+
|
|
8
|
+
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; }
|
|
9
|
+
|
|
10
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
|
|
11
|
+
|
|
12
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
|
|
13
|
+
|
|
14
|
+
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; }
|
|
15
|
+
|
|
15
16
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
17
|
+
|
|
18
|
+
function _templateObject() {
|
|
19
|
+
var data = _taggedTemplateLiteral(["\n position: relative;\n height: 100vh;\n overflow: hidden;\n & > .ant-layout {\n flex-direction: row;\n & > .ant-layout-content {\n overflow-x: hidden;\n flex: 1;\n }\n }\n .tnt-layout-sider {\n overflow-x: hidden;\n background: #fff !important;\n box-shadow: 0 1px 10px 0 rgba(0,0,0,0.10);\n z-index: 8;\n }\n &.isInIframe, &.isEmptyLayout {\n .tnt-layout-sider {\n display: none;\n }\n }\n &.tnt-themeS1 .tnt-layout-sider {\n background: #fff !important;\n }\n .tnt-layout-content {\n background: ", ";\n }\n"]);
|
|
20
|
+
|
|
21
|
+
_templateObject = function _templateObject() {
|
|
22
|
+
return data;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
return data;
|
|
26
|
+
}
|
|
27
|
+
|
|
16
28
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
29
|
+
|
|
17
30
|
import { useState, useEffect } from 'react';
|
|
18
31
|
import styled, { withTheme } from 'styled-components';
|
|
19
32
|
import cn from 'classnames';
|
|
@@ -25,59 +38,63 @@ import SideMenu from './SideMenu';
|
|
|
25
38
|
import CompactSideMenu from './CompactSideMenu';
|
|
26
39
|
import { getLanguageStore, getThemeStore } from '../storage';
|
|
27
40
|
var Content = _Layout.Content,
|
|
28
|
-
|
|
29
|
-
var TNTPaasLayout = styled(_Layout)(_templateObject
|
|
41
|
+
Sider = _Layout.Sider;
|
|
42
|
+
var TNTPaasLayout = styled(_Layout)(_templateObject(), function (props) {
|
|
30
43
|
return props.theme.lightBgColor;
|
|
31
44
|
});
|
|
45
|
+
|
|
32
46
|
var noop = function noop() {
|
|
33
47
|
return true;
|
|
34
48
|
};
|
|
49
|
+
|
|
35
50
|
export default withTheme(function (props) {
|
|
36
51
|
var appKey = props.appKey,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
52
|
+
logo = props.logo,
|
|
53
|
+
name = props.name,
|
|
54
|
+
enName = props.enName,
|
|
55
|
+
isInIframe = props.isInIframe,
|
|
56
|
+
isEmptyLayout = props.isEmptyLayout,
|
|
57
|
+
selectedAppKey = props.selectedAppKey,
|
|
58
|
+
appList = props.appList,
|
|
59
|
+
_props$config = props.config,
|
|
60
|
+
config = _props$config === void 0 ? {} : _props$config,
|
|
61
|
+
extraHeaderActions = props.extraHeaderActions,
|
|
62
|
+
headerNavs = props.headerNavs,
|
|
63
|
+
sideMenu = props.sideMenu,
|
|
64
|
+
selectedMenuKey = props.selectedMenuKey,
|
|
65
|
+
_props$menuAlignMode = props.menuAlignMode,
|
|
66
|
+
menuAlignMode = _props$menuAlignMode === void 0 ? 'side' : _props$menuAlignMode,
|
|
67
|
+
_props$menus = props.menus,
|
|
68
|
+
menus = _props$menus === void 0 ? [] : _props$menus,
|
|
69
|
+
formatMenuPath = props.formatMenuPath,
|
|
70
|
+
changeRouter = props.changeRouter,
|
|
71
|
+
_props$onLogoClick = props.onLogoClick,
|
|
72
|
+
onLogoClick = _props$onLogoClick === void 0 ? noop : _props$onLogoClick,
|
|
73
|
+
_props$onThemeChange = props.onThemeChange,
|
|
74
|
+
_onThemeChange = _props$onThemeChange === void 0 ? noop : _props$onThemeChange,
|
|
75
|
+
_props$onLanguageChan = props.onLanguageChange,
|
|
76
|
+
_onLanguageChange = _props$onLanguageChan === void 0 ? noop : _props$onLanguageChan,
|
|
77
|
+
_props$onApplicationC = props.onApplicationChange,
|
|
78
|
+
_onApplicationChange = _props$onApplicationC === void 0 ? noop : _props$onApplicationC,
|
|
79
|
+
_props$onAppChange = props.onAppChange,
|
|
80
|
+
onAppChange = _props$onAppChange === void 0 ? noop : _props$onAppChange,
|
|
81
|
+
onLogout = props.onLogout,
|
|
82
|
+
_props$onBeforeMenuCh = props.onBeforeMenuChange,
|
|
83
|
+
onBeforeMenuChange = _props$onBeforeMenuCh === void 0 ? noop : _props$onBeforeMenuCh,
|
|
84
|
+
_props$onMenuChange = props.onMenuChange,
|
|
85
|
+
onMenuChange = _props$onMenuChange === void 0 ? noop : _props$onMenuChange,
|
|
86
|
+
_props$onMenuSelect = props.onMenuSelect,
|
|
87
|
+
onMenuSelect = _props$onMenuSelect === void 0 ? noop : _props$onMenuSelect,
|
|
88
|
+
_props$onHeaderNavCha = props.onHeaderNavChange,
|
|
89
|
+
onHeaderNavChange = _props$onHeaderNavCha === void 0 ? noop : _props$onHeaderNavCha;
|
|
90
|
+
|
|
75
91
|
var _useState = useState(props.userInfo || {}),
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
// theme === 'default' ? 'themeS2' : theme;
|
|
92
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
93
|
+
userInfo = _useState2[0],
|
|
94
|
+
setUserInfo = _useState2[1];
|
|
95
|
+
|
|
96
|
+
var theme = getThemeStore() || userInfo.theme || 'themeS2'; // theme === 'default' ? 'themeS2' : theme;
|
|
97
|
+
|
|
81
98
|
theme = ['default', 'themeS3'].includes(theme) ? 'themeS2' : theme;
|
|
82
99
|
var language = getLanguageStore() || userInfo.lang || 'cn';
|
|
83
100
|
var menusMapByApp = menus.reduce(function (acc, menu) {
|
|
@@ -85,24 +102,31 @@ export default withTheme(function (props) {
|
|
|
85
102
|
var singleGroupMap = subMenus.reduce(function (acc, subMenu) {
|
|
86
103
|
var path = subMenu.path;
|
|
87
104
|
var appKey = !/^http/i.test(path) ? path == null ? void 0 : path.match(/\/([^\/]+)/)[1] : '';
|
|
105
|
+
|
|
88
106
|
if (appKey) {
|
|
89
|
-
acc[appKey] = acc[appKey] || _objectSpread(
|
|
107
|
+
acc[appKey] = acc[appKey] || _objectSpread({}, menu, {
|
|
90
108
|
children: []
|
|
91
109
|
});
|
|
92
110
|
acc[appKey].children.push(subMenu);
|
|
93
111
|
}
|
|
112
|
+
|
|
94
113
|
return acc;
|
|
95
114
|
}, {});
|
|
115
|
+
|
|
96
116
|
for (var _appKey in singleGroupMap) {
|
|
97
117
|
acc[_appKey] = acc[_appKey] || [];
|
|
118
|
+
|
|
98
119
|
acc[_appKey].push(singleGroupMap[_appKey]);
|
|
99
120
|
}
|
|
121
|
+
|
|
100
122
|
return acc;
|
|
101
123
|
}, {});
|
|
124
|
+
|
|
102
125
|
var _useState3 = useState(appKey),
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
126
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
127
|
+
currentAppKey = _useState4[0],
|
|
128
|
+
setCurrentAppKey = _useState4[1];
|
|
129
|
+
|
|
106
130
|
var apps = reduce(menusMapByApp, function (acc, value, key) {
|
|
107
131
|
acc.push({
|
|
108
132
|
appKey: key,
|
|
@@ -113,22 +137,23 @@ export default withTheme(function (props) {
|
|
|
113
137
|
var isMenusTop = menuAlignMode === 'top';
|
|
114
138
|
var headerNavMenus = headerNavs;
|
|
115
139
|
var currentSystemMenus = menusMapByApp[currentAppKey] || [];
|
|
140
|
+
|
|
116
141
|
var _useState5 = useState(get(currentSystemMenus, '0.code')),
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
142
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
143
|
+
currentHeaderNavKey = _useState6[0],
|
|
144
|
+
setCurrentHeaderNavKey = _useState6[1];
|
|
145
|
+
|
|
120
146
|
var sideMenus = isMenusTop ? get(currentSystemMenus.find(function (_ref) {
|
|
121
147
|
var code = _ref.code;
|
|
122
148
|
return currentHeaderNavKey === code;
|
|
123
149
|
}), 'children', []) : currentSystemMenus;
|
|
124
|
-
var FinalSideMenu = isMenusTop ? CompactSideMenu : SideMenu;
|
|
150
|
+
var FinalSideMenu = isMenusTop ? CompactSideMenu : SideMenu; // 一级菜单放在顶部(Header里面菜单作为一级导航)
|
|
125
151
|
|
|
126
|
-
// 一级菜单放在顶部(Header里面菜单作为一级导航)
|
|
127
152
|
if (isMenusTop) {
|
|
128
|
-
headerNavMenus =
|
|
153
|
+
headerNavMenus = React.createElement(HeaderNavs, {
|
|
129
154
|
selectedKey: currentHeaderNavKey,
|
|
130
155
|
navs: currentSystemMenus.map(function (item) {
|
|
131
|
-
return _objectSpread(
|
|
156
|
+
return _objectSpread({}, item, {
|
|
132
157
|
key: item.code,
|
|
133
158
|
name: item.groupName
|
|
134
159
|
});
|
|
@@ -139,6 +164,7 @@ export default withTheme(function (props) {
|
|
|
139
164
|
}
|
|
140
165
|
});
|
|
141
166
|
}
|
|
167
|
+
|
|
142
168
|
useEffect(function () {
|
|
143
169
|
setUserInfo(props.userInfo);
|
|
144
170
|
}, [props.userInfo]);
|
|
@@ -147,7 +173,7 @@ export default withTheme(function (props) {
|
|
|
147
173
|
setCurrentHeaderNavKey(get(getSelectedMenuInfo(selectedMenuKey, menus), 'menu.code'));
|
|
148
174
|
}
|
|
149
175
|
}, [menus, selectedMenuKey]);
|
|
150
|
-
return
|
|
176
|
+
return React.createElement(TNTPaasLayout, {
|
|
151
177
|
className: cn("tnt-".concat(theme, " ").concat(props.className || ''), {
|
|
152
178
|
'large-size': props.theme.size === 'large',
|
|
153
179
|
compatible: props.theme.compatible,
|
|
@@ -155,7 +181,7 @@ export default withTheme(function (props) {
|
|
|
155
181
|
isEmptyLayout: isEmptyLayout,
|
|
156
182
|
noAppList: !appList
|
|
157
183
|
})
|
|
158
|
-
},
|
|
184
|
+
}, React.createElement(Header, {
|
|
159
185
|
logo: logo,
|
|
160
186
|
name: name,
|
|
161
187
|
enName: enName,
|
|
@@ -172,28 +198,29 @@ export default withTheme(function (props) {
|
|
|
172
198
|
onLogoClick: onLogoClick,
|
|
173
199
|
onAppChange: onAppChange,
|
|
174
200
|
onThemeChange: function onThemeChange(theme) {
|
|
175
|
-
setUserInfo(_objectSpread(
|
|
201
|
+
setUserInfo(_objectSpread({}, userInfo, {
|
|
176
202
|
theme: theme
|
|
177
203
|
}));
|
|
178
204
|
_onThemeChange && _onThemeChange(theme);
|
|
179
205
|
},
|
|
180
206
|
onLanguageChange: function onLanguageChange(lang) {
|
|
181
|
-
setUserInfo(_objectSpread(
|
|
207
|
+
setUserInfo(_objectSpread({}, userInfo, {
|
|
182
208
|
lang: lang
|
|
183
209
|
}));
|
|
184
210
|
_onLanguageChange && _onLanguageChange(lang);
|
|
185
211
|
},
|
|
186
212
|
onApplicationChange: function onApplicationChange(appKey) {
|
|
187
213
|
setCurrentAppKey(appKey);
|
|
214
|
+
|
|
188
215
|
_onApplicationChange(appKey);
|
|
189
216
|
},
|
|
190
217
|
onLogout: onLogout
|
|
191
|
-
}, headerNavMenus),
|
|
218
|
+
}, headerNavMenus), React.createElement(_Layout, null, !isUndefined(sideMenu) ? sideMenu : React.createElement(Sider, {
|
|
192
219
|
breakpoint: "md",
|
|
193
220
|
className: "tnt-layout-sider",
|
|
194
221
|
width: 220,
|
|
195
222
|
trigger: null
|
|
196
|
-
},
|
|
223
|
+
}, React.createElement(FinalSideMenu, {
|
|
197
224
|
language: language,
|
|
198
225
|
selectedKey: selectedMenuKey,
|
|
199
226
|
menus: sideMenus,
|
|
@@ -202,7 +229,7 @@ export default withTheme(function (props) {
|
|
|
202
229
|
onBeforeChange: onBeforeMenuChange,
|
|
203
230
|
onChange: onMenuChange,
|
|
204
231
|
onSelect: onMenuSelect
|
|
205
|
-
})),
|
|
232
|
+
})), React.createElement(Content, {
|
|
206
233
|
className: "tnt-layout-content"
|
|
207
234
|
}, props.children)));
|
|
208
235
|
});
|
package/es/Layout/storage.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
3
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source =
|
|
4
|
-
|
|
5
|
-
function
|
|
6
|
-
|
|
1
|
+
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; }
|
|
2
|
+
|
|
3
|
+
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; }
|
|
4
|
+
|
|
5
|
+
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; }
|
|
6
|
+
|
|
7
7
|
import Cookies from 'universal-cookie';
|
|
8
8
|
import { safeParseJSON } from '../utils';
|
|
9
9
|
var cookies = new Cookies();
|
|
@@ -12,7 +12,7 @@ export var getSideMenuStore = function getSideMenuStore() {
|
|
|
12
12
|
};
|
|
13
13
|
export var setSideMenuStore = function setSideMenuStore() {
|
|
14
14
|
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
15
|
-
localStorage.setItem('sideMenu', JSON.stringify(_objectSpread(
|
|
15
|
+
localStorage.setItem('sideMenu', JSON.stringify(_objectSpread({}, getSideMenuStore(), {}, params)));
|
|
16
16
|
};
|
|
17
17
|
export var setCurrentAppStore = function setCurrentAppStore() {
|
|
18
18
|
var currentApp = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -34,10 +34,9 @@ export var setCurrentOrgTreeStore = function setCurrentOrgTreeStore() {
|
|
|
34
34
|
};
|
|
35
35
|
export var getCurrentOrgTreeStore = function getCurrentOrgTreeStore() {
|
|
36
36
|
return safeParseJSON(localStorage.getItem('currentOrgTree'), []);
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
// export const setLanguageStore = lang => localStorage.setItem('lang', lang);
|
|
37
|
+
}; // export const setLanguageStore = lang => localStorage.setItem('lang', lang);
|
|
40
38
|
// export const getLanguageStore = () => localStorage.getItem('lang');
|
|
39
|
+
|
|
41
40
|
export var setLanguageStore = function setLanguageStore(lang) {
|
|
42
41
|
return cookies.set('lang', lang, {
|
|
43
42
|
path: '/'
|