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
|
@@ -4,52 +4,91 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
+
|
|
7
8
|
var _react = require("react");
|
|
9
|
+
|
|
8
10
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
11
|
+
|
|
9
12
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
+
|
|
10
14
|
var _Iconfont = _interopRequireDefault(require("../Iconfont"));
|
|
11
|
-
|
|
15
|
+
|
|
12
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
-
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
function
|
|
17
|
-
|
|
17
|
+
|
|
18
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
|
|
19
|
+
|
|
20
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
|
|
21
|
+
|
|
22
|
+
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; }
|
|
23
|
+
|
|
18
24
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
25
|
+
|
|
26
|
+
function _templateObject2() {
|
|
27
|
+
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"]);
|
|
28
|
+
|
|
29
|
+
_templateObject2 = function _templateObject2() {
|
|
30
|
+
return data;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
return data;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function _templateObject() {
|
|
37
|
+
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"]);
|
|
38
|
+
|
|
39
|
+
_templateObject = function _templateObject() {
|
|
40
|
+
return data;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
return data;
|
|
44
|
+
}
|
|
45
|
+
|
|
19
46
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
20
|
-
|
|
21
|
-
var
|
|
47
|
+
|
|
48
|
+
var SideMenu = _styledComponents["default"].ul(_templateObject());
|
|
49
|
+
|
|
50
|
+
var SubMenu = _styledComponents["default"].ul(_templateObject2());
|
|
51
|
+
|
|
22
52
|
var _default = function _default(props) {
|
|
23
53
|
var language = props.language,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
54
|
+
_props$menus = props.menus,
|
|
55
|
+
menus = _props$menus === void 0 ? [] : _props$menus,
|
|
56
|
+
formatMenuPath = props.formatMenuPath,
|
|
57
|
+
changeRouter = props.changeRouter,
|
|
58
|
+
selectedKey = props.selectedKey,
|
|
59
|
+
onBeforeChange = props.onBeforeChange,
|
|
60
|
+
onChange = props.onChange,
|
|
61
|
+
onSelect = props.onSelect;
|
|
62
|
+
|
|
32
63
|
var _useState = (0, _react.useState)(selectedKey),
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
64
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
65
|
+
activeMenu = _useState2[0],
|
|
66
|
+
setActiveMenu = _useState2[1];
|
|
67
|
+
|
|
36
68
|
var defaultBeforeChange = function defaultBeforeChange(_ref) {
|
|
37
69
|
var data = _ref.data;
|
|
38
70
|
return !isNewTabMenu(data);
|
|
39
71
|
};
|
|
72
|
+
|
|
40
73
|
var defaultSelect = function defaultSelect(_ref2) {
|
|
41
74
|
var _window$location$path;
|
|
75
|
+
|
|
42
76
|
var data = _ref2.data;
|
|
77
|
+
|
|
43
78
|
var _ref3 = data || {},
|
|
44
|
-
|
|
79
|
+
path = _ref3.path;
|
|
80
|
+
|
|
45
81
|
var formatPath = formatMenuPath || function (path) {
|
|
46
82
|
return path;
|
|
47
83
|
};
|
|
84
|
+
|
|
48
85
|
if (isNewTabMenu(data)) {
|
|
49
86
|
openInNewTab(formatPath(data == null ? void 0 : data.path, data));
|
|
50
87
|
return;
|
|
51
88
|
}
|
|
89
|
+
|
|
52
90
|
var routerPrefix = (_window$location$path = window.location.pathname.match(/(^\/[^\/]+)/i)) == null ? void 0 : _window$location$path[1];
|
|
91
|
+
|
|
53
92
|
if (window.location.pathname.startsWith(routerPrefix)) {
|
|
54
93
|
var forwardPath = formatPath(path, data);
|
|
55
94
|
changeRouter ? changeRouter(forwardPath, data) : window.history.pushState(data, data == null ? void 0 : data.name, forwardPath);
|
|
@@ -57,33 +96,38 @@ var _default = function _default(props) {
|
|
|
57
96
|
window.location.href = formatPath(path, data);
|
|
58
97
|
}
|
|
59
98
|
};
|
|
99
|
+
|
|
60
100
|
var selectMenu = function selectMenu() {
|
|
61
101
|
var param = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
62
102
|
var finalBeforeChange = onBeforeChange || defaultBeforeChange;
|
|
63
103
|
var finalSelect = onSelect || defaultSelect;
|
|
104
|
+
|
|
64
105
|
if (param.key !== activeMenu) {
|
|
65
106
|
if (finalBeforeChange(param, activeMenu)) {
|
|
66
107
|
setActiveMenu(param.key);
|
|
67
108
|
onChange && onChange(param);
|
|
68
109
|
}
|
|
69
110
|
}
|
|
111
|
+
|
|
70
112
|
finalSelect(param);
|
|
71
113
|
};
|
|
114
|
+
|
|
72
115
|
var MenuItem = function MenuItem(_ref4) {
|
|
73
116
|
var item = _ref4.item;
|
|
74
117
|
var code = item.code,
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
118
|
+
groupName = item.groupName,
|
|
119
|
+
enName = item.enName,
|
|
120
|
+
_item$children = item.children,
|
|
121
|
+
children = _item$children === void 0 ? [] : _item$children;
|
|
122
|
+
|
|
79
123
|
var SubMenuItem = function SubMenuItem(_ref5) {
|
|
80
124
|
var menu = _ref5.menu;
|
|
81
125
|
var code = menu.code,
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
return
|
|
126
|
+
menuName = menu.menuName,
|
|
127
|
+
enName = menu.enName,
|
|
128
|
+
icon = menu.icon,
|
|
129
|
+
path = menu.path;
|
|
130
|
+
return React.createElement("li", {
|
|
87
131
|
key: code,
|
|
88
132
|
onClick: function onClick(evt) {
|
|
89
133
|
return selectMenu({
|
|
@@ -95,43 +139,47 @@ var _default = function _default(props) {
|
|
|
95
139
|
className: (0, _classnames["default"])({
|
|
96
140
|
active: code === activeMenu
|
|
97
141
|
})
|
|
98
|
-
},
|
|
142
|
+
}, React.createElement("a", {
|
|
99
143
|
href: path,
|
|
100
144
|
onClick: function onClick(evt) {
|
|
101
145
|
return evt.preventDefault();
|
|
102
146
|
}
|
|
103
|
-
}, icon instanceof _react.Component ? icon :
|
|
147
|
+
}, icon instanceof _react.Component ? icon : React.createElement(_Iconfont["default"], {
|
|
104
148
|
type: icon
|
|
105
|
-
}),
|
|
149
|
+
}), React.createElement("span", null, {
|
|
106
150
|
cn: menuName,
|
|
107
151
|
en: enName
|
|
108
152
|
}[language])));
|
|
109
153
|
};
|
|
154
|
+
|
|
110
155
|
if (groupName && children.length) {
|
|
111
|
-
return
|
|
156
|
+
return React.createElement("li", {
|
|
112
157
|
key: code
|
|
113
|
-
},
|
|
158
|
+
}, React.createElement("span", null, {
|
|
114
159
|
cn: groupName,
|
|
115
160
|
en: enName
|
|
116
|
-
}[language]),
|
|
117
|
-
return
|
|
161
|
+
}[language]), React.createElement(SubMenu, null, children.map(function (subItem) {
|
|
162
|
+
return React.createElement(SubMenuItem, {
|
|
118
163
|
menu: subItem,
|
|
119
164
|
key: subItem == null ? void 0 : subItem.code
|
|
120
165
|
});
|
|
121
166
|
})));
|
|
122
167
|
}
|
|
123
|
-
|
|
168
|
+
|
|
169
|
+
return React.createElement(SubMenuItem, {
|
|
124
170
|
menu: item
|
|
125
171
|
});
|
|
126
172
|
};
|
|
173
|
+
|
|
127
174
|
(0, _react.useEffect)(function () {
|
|
128
175
|
setActiveMenu(selectedKey);
|
|
129
176
|
}, [selectedKey]);
|
|
130
|
-
return
|
|
131
|
-
return
|
|
177
|
+
return React.createElement(SideMenu, null, menus.map(function (menu) {
|
|
178
|
+
return React.createElement(MenuItem, {
|
|
132
179
|
item: menu,
|
|
133
180
|
key: menu.code
|
|
134
181
|
});
|
|
135
182
|
}));
|
|
136
183
|
};
|
|
184
|
+
|
|
137
185
|
exports["default"] = _default;
|
|
@@ -1,92 +1,126 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) {
|
|
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); }
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports["default"] = void 0;
|
|
9
|
+
|
|
8
10
|
require("antd/lib/layout/style");
|
|
11
|
+
|
|
9
12
|
var _layout = _interopRequireDefault(require("antd/lib/layout"));
|
|
13
|
+
|
|
10
14
|
var _react = require("react");
|
|
15
|
+
|
|
11
16
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
17
|
+
|
|
12
18
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
19
|
+
|
|
13
20
|
var _lodash = require("lodash");
|
|
21
|
+
|
|
14
22
|
var _utils = require("../../utils");
|
|
23
|
+
|
|
15
24
|
var _HeaderNavs = _interopRequireDefault(require("../HeaderNavs"));
|
|
25
|
+
|
|
16
26
|
var _Header = _interopRequireDefault(require("./Header"));
|
|
27
|
+
|
|
17
28
|
var _SideMenu = _interopRequireDefault(require("./SideMenu"));
|
|
29
|
+
|
|
18
30
|
var _CompactSideMenu = _interopRequireDefault(require("./CompactSideMenu"));
|
|
31
|
+
|
|
19
32
|
var _storage = require("../storage");
|
|
20
|
-
|
|
21
|
-
function _getRequireWildcardCache(
|
|
22
|
-
|
|
33
|
+
|
|
34
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
35
|
+
|
|
36
|
+
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; }
|
|
37
|
+
|
|
23
38
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
24
|
-
|
|
25
|
-
function
|
|
26
|
-
|
|
27
|
-
function
|
|
28
|
-
|
|
29
|
-
function
|
|
30
|
-
|
|
31
|
-
function
|
|
32
|
-
|
|
33
|
-
function
|
|
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
|
+
|
|
34
52
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
53
|
+
|
|
54
|
+
function _templateObject() {
|
|
55
|
+
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"]);
|
|
56
|
+
|
|
57
|
+
_templateObject = function _templateObject() {
|
|
58
|
+
return data;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
return data;
|
|
62
|
+
}
|
|
63
|
+
|
|
35
64
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
65
|
+
|
|
36
66
|
var Content = _layout["default"].Content,
|
|
37
|
-
|
|
38
|
-
var TNTPaasLayout = (0, _styledComponents["default"])(_layout["default"])(_templateObject
|
|
67
|
+
Sider = _layout["default"].Sider;
|
|
68
|
+
var TNTPaasLayout = (0, _styledComponents["default"])(_layout["default"])(_templateObject(), function (props) {
|
|
39
69
|
return props.theme.lightBgColor;
|
|
40
70
|
});
|
|
71
|
+
|
|
41
72
|
var noop = function noop() {
|
|
42
73
|
return true;
|
|
43
74
|
};
|
|
75
|
+
|
|
44
76
|
var _default = (0, _styledComponents.withTheme)(function (props) {
|
|
45
77
|
var appKey = props.appKey,
|
|
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
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
78
|
+
logo = props.logo,
|
|
79
|
+
name = props.name,
|
|
80
|
+
enName = props.enName,
|
|
81
|
+
isInIframe = props.isInIframe,
|
|
82
|
+
isEmptyLayout = props.isEmptyLayout,
|
|
83
|
+
selectedAppKey = props.selectedAppKey,
|
|
84
|
+
appList = props.appList,
|
|
85
|
+
_props$config = props.config,
|
|
86
|
+
config = _props$config === void 0 ? {} : _props$config,
|
|
87
|
+
extraHeaderActions = props.extraHeaderActions,
|
|
88
|
+
headerNavs = props.headerNavs,
|
|
89
|
+
sideMenu = props.sideMenu,
|
|
90
|
+
selectedMenuKey = props.selectedMenuKey,
|
|
91
|
+
_props$menuAlignMode = props.menuAlignMode,
|
|
92
|
+
menuAlignMode = _props$menuAlignMode === void 0 ? 'side' : _props$menuAlignMode,
|
|
93
|
+
_props$menus = props.menus,
|
|
94
|
+
menus = _props$menus === void 0 ? [] : _props$menus,
|
|
95
|
+
formatMenuPath = props.formatMenuPath,
|
|
96
|
+
changeRouter = props.changeRouter,
|
|
97
|
+
_props$onLogoClick = props.onLogoClick,
|
|
98
|
+
onLogoClick = _props$onLogoClick === void 0 ? noop : _props$onLogoClick,
|
|
99
|
+
_props$onThemeChange = props.onThemeChange,
|
|
100
|
+
_onThemeChange = _props$onThemeChange === void 0 ? noop : _props$onThemeChange,
|
|
101
|
+
_props$onLanguageChan = props.onLanguageChange,
|
|
102
|
+
_onLanguageChange = _props$onLanguageChan === void 0 ? noop : _props$onLanguageChan,
|
|
103
|
+
_props$onApplicationC = props.onApplicationChange,
|
|
104
|
+
_onApplicationChange = _props$onApplicationC === void 0 ? noop : _props$onApplicationC,
|
|
105
|
+
_props$onAppChange = props.onAppChange,
|
|
106
|
+
onAppChange = _props$onAppChange === void 0 ? noop : _props$onAppChange,
|
|
107
|
+
onLogout = props.onLogout,
|
|
108
|
+
_props$onBeforeMenuCh = props.onBeforeMenuChange,
|
|
109
|
+
onBeforeMenuChange = _props$onBeforeMenuCh === void 0 ? noop : _props$onBeforeMenuCh,
|
|
110
|
+
_props$onMenuChange = props.onMenuChange,
|
|
111
|
+
onMenuChange = _props$onMenuChange === void 0 ? noop : _props$onMenuChange,
|
|
112
|
+
_props$onMenuSelect = props.onMenuSelect,
|
|
113
|
+
onMenuSelect = _props$onMenuSelect === void 0 ? noop : _props$onMenuSelect,
|
|
114
|
+
_props$onHeaderNavCha = props.onHeaderNavChange,
|
|
115
|
+
onHeaderNavChange = _props$onHeaderNavCha === void 0 ? noop : _props$onHeaderNavCha;
|
|
116
|
+
|
|
84
117
|
var _useState = (0, _react.useState)(props.userInfo || {}),
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
// theme === 'default' ? 'themeS2' : theme;
|
|
118
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
119
|
+
userInfo = _useState2[0],
|
|
120
|
+
setUserInfo = _useState2[1];
|
|
121
|
+
|
|
122
|
+
var theme = (0, _storage.getThemeStore)() || userInfo.theme || 'themeS2'; // theme === 'default' ? 'themeS2' : theme;
|
|
123
|
+
|
|
90
124
|
theme = ['default', 'themeS3'].includes(theme) ? 'themeS2' : theme;
|
|
91
125
|
var language = (0, _storage.getLanguageStore)() || userInfo.lang || 'cn';
|
|
92
126
|
var menusMapByApp = menus.reduce(function (acc, menu) {
|
|
@@ -94,24 +128,31 @@ var _default = (0, _styledComponents.withTheme)(function (props) {
|
|
|
94
128
|
var singleGroupMap = subMenus.reduce(function (acc, subMenu) {
|
|
95
129
|
var path = subMenu.path;
|
|
96
130
|
var appKey = !/^http/i.test(path) ? path == null ? void 0 : path.match(/\/([^\/]+)/)[1] : '';
|
|
131
|
+
|
|
97
132
|
if (appKey) {
|
|
98
|
-
acc[appKey] = acc[appKey] || _objectSpread(
|
|
133
|
+
acc[appKey] = acc[appKey] || _objectSpread({}, menu, {
|
|
99
134
|
children: []
|
|
100
135
|
});
|
|
101
136
|
acc[appKey].children.push(subMenu);
|
|
102
137
|
}
|
|
138
|
+
|
|
103
139
|
return acc;
|
|
104
140
|
}, {});
|
|
141
|
+
|
|
105
142
|
for (var _appKey in singleGroupMap) {
|
|
106
143
|
acc[_appKey] = acc[_appKey] || [];
|
|
144
|
+
|
|
107
145
|
acc[_appKey].push(singleGroupMap[_appKey]);
|
|
108
146
|
}
|
|
147
|
+
|
|
109
148
|
return acc;
|
|
110
149
|
}, {});
|
|
150
|
+
|
|
111
151
|
var _useState3 = (0, _react.useState)(appKey),
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
152
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
153
|
+
currentAppKey = _useState4[0],
|
|
154
|
+
setCurrentAppKey = _useState4[1];
|
|
155
|
+
|
|
115
156
|
var apps = (0, _lodash.reduce)(menusMapByApp, function (acc, value, key) {
|
|
116
157
|
acc.push({
|
|
117
158
|
appKey: key,
|
|
@@ -122,22 +163,23 @@ var _default = (0, _styledComponents.withTheme)(function (props) {
|
|
|
122
163
|
var isMenusTop = menuAlignMode === 'top';
|
|
123
164
|
var headerNavMenus = headerNavs;
|
|
124
165
|
var currentSystemMenus = menusMapByApp[currentAppKey] || [];
|
|
166
|
+
|
|
125
167
|
var _useState5 = (0, _react.useState)((0, _lodash.get)(currentSystemMenus, '0.code')),
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
168
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
169
|
+
currentHeaderNavKey = _useState6[0],
|
|
170
|
+
setCurrentHeaderNavKey = _useState6[1];
|
|
171
|
+
|
|
129
172
|
var sideMenus = isMenusTop ? (0, _lodash.get)(currentSystemMenus.find(function (_ref) {
|
|
130
173
|
var code = _ref.code;
|
|
131
174
|
return currentHeaderNavKey === code;
|
|
132
175
|
}), 'children', []) : currentSystemMenus;
|
|
133
|
-
var FinalSideMenu = isMenusTop ? _CompactSideMenu["default"] : _SideMenu["default"];
|
|
176
|
+
var FinalSideMenu = isMenusTop ? _CompactSideMenu["default"] : _SideMenu["default"]; // 一级菜单放在顶部(Header里面菜单作为一级导航)
|
|
134
177
|
|
|
135
|
-
// 一级菜单放在顶部(Header里面菜单作为一级导航)
|
|
136
178
|
if (isMenusTop) {
|
|
137
|
-
headerNavMenus =
|
|
179
|
+
headerNavMenus = React.createElement(_HeaderNavs["default"], {
|
|
138
180
|
selectedKey: currentHeaderNavKey,
|
|
139
181
|
navs: currentSystemMenus.map(function (item) {
|
|
140
|
-
return _objectSpread(
|
|
182
|
+
return _objectSpread({}, item, {
|
|
141
183
|
key: item.code,
|
|
142
184
|
name: item.groupName
|
|
143
185
|
});
|
|
@@ -148,6 +190,7 @@ var _default = (0, _styledComponents.withTheme)(function (props) {
|
|
|
148
190
|
}
|
|
149
191
|
});
|
|
150
192
|
}
|
|
193
|
+
|
|
151
194
|
(0, _react.useEffect)(function () {
|
|
152
195
|
setUserInfo(props.userInfo);
|
|
153
196
|
}, [props.userInfo]);
|
|
@@ -156,7 +199,7 @@ var _default = (0, _styledComponents.withTheme)(function (props) {
|
|
|
156
199
|
setCurrentHeaderNavKey((0, _lodash.get)((0, _utils.getSelectedMenuInfo)(selectedMenuKey, menus), 'menu.code'));
|
|
157
200
|
}
|
|
158
201
|
}, [menus, selectedMenuKey]);
|
|
159
|
-
return
|
|
202
|
+
return React.createElement(TNTPaasLayout, {
|
|
160
203
|
className: (0, _classnames["default"])("tnt-".concat(theme, " ").concat(props.className || ''), {
|
|
161
204
|
'large-size': props.theme.size === 'large',
|
|
162
205
|
compatible: props.theme.compatible,
|
|
@@ -164,7 +207,7 @@ var _default = (0, _styledComponents.withTheme)(function (props) {
|
|
|
164
207
|
isEmptyLayout: isEmptyLayout,
|
|
165
208
|
noAppList: !appList
|
|
166
209
|
})
|
|
167
|
-
},
|
|
210
|
+
}, React.createElement(_Header["default"], {
|
|
168
211
|
logo: logo,
|
|
169
212
|
name: name,
|
|
170
213
|
enName: enName,
|
|
@@ -181,28 +224,29 @@ var _default = (0, _styledComponents.withTheme)(function (props) {
|
|
|
181
224
|
onLogoClick: onLogoClick,
|
|
182
225
|
onAppChange: onAppChange,
|
|
183
226
|
onThemeChange: function onThemeChange(theme) {
|
|
184
|
-
setUserInfo(_objectSpread(
|
|
227
|
+
setUserInfo(_objectSpread({}, userInfo, {
|
|
185
228
|
theme: theme
|
|
186
229
|
}));
|
|
187
230
|
_onThemeChange && _onThemeChange(theme);
|
|
188
231
|
},
|
|
189
232
|
onLanguageChange: function onLanguageChange(lang) {
|
|
190
|
-
setUserInfo(_objectSpread(
|
|
233
|
+
setUserInfo(_objectSpread({}, userInfo, {
|
|
191
234
|
lang: lang
|
|
192
235
|
}));
|
|
193
236
|
_onLanguageChange && _onLanguageChange(lang);
|
|
194
237
|
},
|
|
195
238
|
onApplicationChange: function onApplicationChange(appKey) {
|
|
196
239
|
setCurrentAppKey(appKey);
|
|
240
|
+
|
|
197
241
|
_onApplicationChange(appKey);
|
|
198
242
|
},
|
|
199
243
|
onLogout: onLogout
|
|
200
|
-
}, headerNavMenus),
|
|
244
|
+
}, headerNavMenus), React.createElement(_layout["default"], null, !(0, _lodash.isUndefined)(sideMenu) ? sideMenu : React.createElement(Sider, {
|
|
201
245
|
breakpoint: "md",
|
|
202
246
|
className: "tnt-layout-sider",
|
|
203
247
|
width: 220,
|
|
204
248
|
trigger: null
|
|
205
|
-
},
|
|
249
|
+
}, React.createElement(FinalSideMenu, {
|
|
206
250
|
language: language,
|
|
207
251
|
selectedKey: selectedMenuKey,
|
|
208
252
|
menus: sideMenus,
|
|
@@ -211,8 +255,9 @@ var _default = (0, _styledComponents.withTheme)(function (props) {
|
|
|
211
255
|
onBeforeChange: onBeforeMenuChange,
|
|
212
256
|
onChange: onMenuChange,
|
|
213
257
|
onSelect: onMenuSelect
|
|
214
|
-
})),
|
|
258
|
+
})), React.createElement(Content, {
|
|
215
259
|
className: "tnt-layout-content"
|
|
216
260
|
}, props.children)));
|
|
217
261
|
});
|
|
262
|
+
|
|
218
263
|
exports["default"] = _default;
|