tntd 1.4.26 → 1.4.28
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/babel.config.js +20 -20
- package/dist/stats.json +90 -90
- package/es/ArrayInput/icon.js +3 -11
- package/es/ArrayInput/index.js +57 -67
- package/es/AuthContext.js +3 -13
- package/es/Columns/index.js +12 -24
- package/es/DevelopmentLogin/LoginModal.js +22 -29
- package/es/DevelopmentLogin/index.js +13 -29
- package/es/Ellipsis/Svg/CopySVG.js +2 -11
- package/es/Ellipsis/Svg/TickSVG.js +2 -11
- package/es/Ellipsis/index.js +25 -33
- package/es/Handle/index.js +29 -46
- package/es/Icon/fonts/iconfont.js +0 -2
- package/es/Icon/iconList.js +1 -8
- package/es/Icon/index.js +5 -25
- package/es/Img/Contain.js +8 -21
- package/es/Img/Cover.js +11 -29
- package/es/Img/index.js +8 -22
- package/es/Layout/ActionsContext.js +2 -12
- package/es/Layout/AppList.js +42 -58
- package/es/Layout/Application.js +24 -44
- package/es/Layout/Avatar.js +23 -45
- package/es/Layout/CompatibleLanguage.js +29 -51
- package/es/Layout/EnterpriseLayout/Avatar.js +32 -54
- package/es/Layout/EnterpriseLayout/Language.js +15 -39
- package/es/Layout/EnterpriseLayout/Theme.js +15 -31
- package/es/Layout/EnterpriseLayout/index.js +9 -24
- package/es/Layout/GlobalNavigation/NavigationPopup.js +29 -53
- package/es/Layout/GlobalNavigation/index.js +23 -51
- package/es/Layout/Header.js +19 -40
- package/es/Layout/HeaderActions.js +19 -43
- package/es/Layout/HeaderNavs.js +12 -35
- package/es/Layout/HeaderTabs.js +25 -50
- package/es/Layout/Iconfont.js +4 -16
- package/es/Layout/Language.js +14 -38
- package/es/Layout/Layout.js +32 -58
- package/es/Layout/Logo.js +12 -26
- package/es/Layout/OrgAppList.js +36 -52
- package/es/Layout/SideMenu.js +32 -57
- package/es/Layout/Theme.js +21 -39
- package/es/Layout/createActions.js +6 -19
- package/es/Layout/images/index.js +58 -95
- package/es/Layout/index.js +28 -70
- package/es/Layout/paaslayout/CompactSideMenu.js +17 -35
- package/es/Layout/paaslayout/Header.js +17 -31
- package/es/Layout/paaslayout/Logo.js +9 -19
- package/es/Layout/paaslayout/SideMenu.js +12 -29
- package/es/Layout/paaslayout/index.js +32 -58
- package/es/Layout/storage.js +21 -71
- package/es/LoadingButton/index.js +8 -17
- package/es/Modal/index.js +16 -29
- package/es/Page/Box.js +8 -18
- package/es/Page/index.js +29 -47
- package/es/Page/utils.js +1 -12
- package/es/QueryForm/Field/Checkbox.js +5 -13
- package/es/QueryForm/Field/Select.js +12 -28
- package/es/QueryForm/Field/SelectInput.js +18 -33
- package/es/QueryForm/Field/fieldsMap.js +23 -36
- package/es/QueryForm/Field/index.js +12 -25
- package/es/QueryForm/createActions.js +7 -20
- package/es/QueryForm/index.js +50 -66
- package/es/QueryForm/useForm.js +4 -16
- package/es/QueryListScene/List.js +30 -43
- package/es/QueryListScene/QueryForm.js +9 -21
- package/es/QueryListScene/QueryListScene.js +16 -29
- package/es/QueryListScene/Title.js +5 -17
- package/es/QueryListScene/Toolbar.js +4 -16
- package/es/QueryListScene/createActions.js +13 -26
- package/es/QueryListScene/index.js +19 -40
- package/es/QueryListScene/useActions.js +4 -16
- package/es/Select/DropDownWrap.js +6 -18
- package/es/Select/index.js +15 -28
- package/es/Table/ResizableTable/index.js +18 -32
- package/es/Table/index.js +11 -30
- package/es/Title/index.js +5 -18
- package/es/index.js +20 -193
- package/es/locale.js +8 -27
- package/es/utils/checkAuth.js +4 -15
- package/es/utils/findMenuInfoByPath.js +5 -16
- package/es/utils/index.js +10 -70
- package/lib/ArrayInput/index.js +28 -12
- package/lib/Columns/index.js +10 -4
- package/lib/DevelopmentLogin/LoginModal.js +23 -9
- package/lib/Ellipsis/index.js +10 -4
- package/lib/Handle/index.js +19 -9
- package/lib/Layout/AppList.js +30 -12
- package/lib/Layout/Application.js +5 -3
- package/lib/Layout/Avatar.js +12 -6
- package/lib/Layout/CompatibleLanguage.js +5 -3
- package/lib/Layout/EnterpriseLayout/Avatar.js +18 -8
- package/lib/Layout/EnterpriseLayout/Theme.js +5 -3
- package/lib/Layout/HeaderActions.js +7 -5
- package/lib/Layout/Layout.js +9 -7
- package/lib/Layout/OrgAppList.js +19 -7
- package/lib/Layout/SideMenu.js +9 -7
- package/lib/Layout/Theme.js +5 -3
- package/lib/Layout/paaslayout/index.js +10 -8
- package/lib/LoadingButton/index.js +6 -2
- package/lib/Modal/index.js +5 -3
- package/lib/Page/Box.js +5 -3
- package/lib/QueryForm/Field/Checkbox.js +6 -2
- package/lib/QueryForm/Field/Select.js +8 -4
- package/lib/QueryForm/Field/SelectInput.js +13 -5
- package/lib/QueryForm/Field/fieldsMap.js +18 -8
- package/lib/QueryForm/Field/index.js +7 -3
- package/lib/QueryForm/index.js +27 -13
- package/lib/QueryListScene/List.js +7 -5
- package/lib/Select/index.js +14 -8
- package/lib/Table/ResizableTable/index.js +5 -3
- package/lib/Table/index.js +7 -5
- package/package.json +1 -1
|
@@ -1,35 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
});
|
|
8
|
-
exports["default"] = void 0;
|
|
9
|
-
|
|
10
|
-
var _react = require("react");
|
|
11
|
-
|
|
12
|
-
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
13
|
-
|
|
14
|
-
var _antd = require("antd");
|
|
15
|
-
|
|
16
|
-
var _lodash = require("lodash");
|
|
17
|
-
|
|
18
|
-
var _images = _interopRequireDefault(require("../images"));
|
|
19
|
-
|
|
20
|
-
var _ActionsContext = _interopRequireDefault(require("../ActionsContext"));
|
|
21
|
-
|
|
22
|
-
var _Language = _interopRequireDefault(require("./Language"));
|
|
23
|
-
|
|
24
|
-
var _Theme = _interopRequireDefault(require("./Theme"));
|
|
25
|
-
|
|
26
|
-
var _storage = require("../storage");
|
|
27
|
-
|
|
28
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
29
|
-
|
|
30
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
31
|
-
|
|
32
|
-
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; }
|
|
1
|
+
import "antd/lib/popover/style";
|
|
2
|
+
import _Popover from "antd/lib/popover";
|
|
3
|
+
import "antd/lib/row/style";
|
|
4
|
+
import _Row from "antd/lib/row";
|
|
5
|
+
import "antd/lib/divider/style";
|
|
6
|
+
import _Divider from "antd/lib/divider";
|
|
33
7
|
|
|
34
8
|
function _templateObject3() {
|
|
35
9
|
var data = _taggedTemplateLiteral(["\n width: 330px;\n z-index: 1;\n background-color: #fff;\n border-radius: 4px;\n box-shadow: 0px 0px 6px 0px rgba(0,0,0,0.1);\n .isInIframe & {\n display: none;\n }\n\n .user-info-body {\n padding: 20px 15px;\n line-height: 16px;\n list-style: none;\n margin: 0;\n .user-info-body-username {\n margin-top: 0px;\n font-family: PingFangSC-Regular;\n font-weight: normal;\n font-size: 14px;\n color: ", ";\n line-height: 14px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n .user-info-body-account {\n margin-top: 0px;\n font-family: PingFangSC-Regular;\n font-size: 12px;\n color: #8B919E;\n margin-bottom: 14px;\n line-height: 14px;\n margin-left: 10px;\n }\n }\n .user-info-footer {\n border-top: ", ";\n background-color: #fff;\n height: 36px;\n line-height: 36px;\n padding: 0 15px;\n font-size: 12px;\n color: ", ";\n a{\n flex: 1;\n text-align:center;\n color: ", ";\n }\n }\n"]);
|
|
@@ -63,11 +37,17 @@ function _templateObject() {
|
|
|
63
37
|
|
|
64
38
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
65
39
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
40
|
+
import { useContext } from 'react';
|
|
41
|
+
import styled, { createGlobalStyle } from 'styled-components';
|
|
42
|
+
import { get } from 'lodash';
|
|
43
|
+
import images from '../images';
|
|
44
|
+
import ActionsContext from '../ActionsContext';
|
|
45
|
+
import Language from './Language';
|
|
46
|
+
import Theme from './Theme';
|
|
47
|
+
import { getLanguageStore, clearLoginCookie } from '../storage';
|
|
48
|
+
var Avatar = styled.li(_templateObject());
|
|
49
|
+
var GlobalStyle = createGlobalStyle(_templateObject2());
|
|
50
|
+
var UserInfoWrapper = styled.div(_templateObject3(), function (props) {
|
|
71
51
|
return "".concat(props.theme.primaryTextColor);
|
|
72
52
|
}, function (props) {
|
|
73
53
|
return "1px solid ".concat(props.theme.dividerColor);
|
|
@@ -93,7 +73,7 @@ var UserInfoContent = function UserInfoContent(props) {
|
|
|
93
73
|
onLanguageChange = props.onLanguageChange,
|
|
94
74
|
onThemeChange = props.onThemeChange;
|
|
95
75
|
|
|
96
|
-
var _useContext =
|
|
76
|
+
var _useContext = useContext(ActionsContext),
|
|
97
77
|
getText = _useContext.getText;
|
|
98
78
|
|
|
99
79
|
var _ref = config || {},
|
|
@@ -108,13 +88,13 @@ var UserInfoContent = function UserInfoContent(props) {
|
|
|
108
88
|
className: "user-info-body-username"
|
|
109
89
|
}, userInfo.userName || getText('nameNull'), React.createElement("span", {
|
|
110
90
|
className: "user-info-body-account"
|
|
111
|
-
}, userInfo.account)), language && React.createElement(
|
|
91
|
+
}, userInfo.account)), language && React.createElement(Language, {
|
|
112
92
|
language: userInfo.lang,
|
|
113
93
|
onChange: onLanguageChange
|
|
114
|
-
}), React.createElement(
|
|
94
|
+
}), React.createElement(Theme, {
|
|
115
95
|
theme: userInfo.theme,
|
|
116
96
|
onChange: onThemeChange
|
|
117
|
-
})), React.createElement(
|
|
97
|
+
})), React.createElement(_Row, {
|
|
118
98
|
className: "user-info-footer",
|
|
119
99
|
type: "flex",
|
|
120
100
|
justify: "space-between",
|
|
@@ -122,53 +102,51 @@ var UserInfoContent = function UserInfoContent(props) {
|
|
|
122
102
|
}, React.createElement("a", {
|
|
123
103
|
onClick: onPersonalSetting,
|
|
124
104
|
href: "/bridge/userCenter?currentTab=1"
|
|
125
|
-
}, getText('personalSettings')), React.createElement(
|
|
105
|
+
}, getText('personalSettings')), React.createElement(_Divider, {
|
|
126
106
|
type: "vertical"
|
|
127
107
|
}), React.createElement("a", {
|
|
128
108
|
onClick: onChangePassword,
|
|
129
109
|
href: "/bridge/userCenter?currentTab=2",
|
|
130
|
-
style:
|
|
110
|
+
style: getLanguageStore() === 'en' ? {
|
|
131
111
|
flex: 2
|
|
132
112
|
} : {}
|
|
133
|
-
}, getText('changePwd')), React.createElement(
|
|
113
|
+
}, getText('changePwd')), React.createElement(_Divider, {
|
|
134
114
|
type: "vertical"
|
|
135
115
|
}), React.createElement("a", {
|
|
136
116
|
className: "user-info-footer-signout",
|
|
137
117
|
onClick: function onClick() {
|
|
138
118
|
if (onLogout) {
|
|
139
119
|
onLogout();
|
|
140
|
-
|
|
120
|
+
clearLoginCookie();
|
|
141
121
|
} else {
|
|
142
|
-
|
|
122
|
+
clearLoginCookie();
|
|
143
123
|
window.location.href = "/user/login?callbackUrl=".concat(window.encodeURI(location.href));
|
|
144
124
|
}
|
|
145
125
|
}
|
|
146
126
|
}, getText('signOut'))));
|
|
147
127
|
};
|
|
148
128
|
|
|
149
|
-
|
|
129
|
+
export default (function (props) {
|
|
150
130
|
var _images$empty2;
|
|
151
131
|
|
|
152
132
|
var _props$userInfo = props.userInfo,
|
|
153
133
|
userInfo = _props$userInfo === void 0 ? {} : _props$userInfo;
|
|
154
134
|
var avatar = userInfo.avatar;
|
|
155
|
-
return React.createElement(Avatar, null, React.createElement(
|
|
135
|
+
return React.createElement(Avatar, null, React.createElement(_Popover, {
|
|
156
136
|
popupClassName: "tnt-layout-personal-popover",
|
|
157
137
|
placement: "bottomRight",
|
|
158
138
|
title: null,
|
|
159
139
|
content: React.createElement(UserInfoContent, props),
|
|
160
140
|
trigger: "click"
|
|
161
141
|
}, avatar ? React.createElement("img", {
|
|
162
|
-
src: avatar.indexOf('base64') > 0 ? avatar :
|
|
142
|
+
src: avatar.indexOf('base64') > 0 ? avatar : get(images[avatar], 'default', images[avatar]),
|
|
163
143
|
onError: function onError(e) {
|
|
164
144
|
var _images$empty;
|
|
165
145
|
|
|
166
146
|
e.target.onerror = null;
|
|
167
|
-
e.target.src = ((_images$empty =
|
|
147
|
+
e.target.src = ((_images$empty = images.empty) == null ? void 0 : _images$empty["default"]) || images.empty;
|
|
168
148
|
}
|
|
169
149
|
}) : React.createElement("img", {
|
|
170
|
-
src: ((_images$empty2 =
|
|
150
|
+
src: ((_images$empty2 = images.empty) == null ? void 0 : _images$empty2["default"]) || images.empty
|
|
171
151
|
})), React.createElement(GlobalStyle, null));
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
exports["default"] = _default;
|
|
152
|
+
});
|
|
@@ -1,28 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
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
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports["default"] = void 0;
|
|
9
|
-
|
|
10
|
-
var _react = require("react");
|
|
11
|
-
|
|
12
|
-
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
13
|
-
|
|
14
|
-
var _lodash = require("lodash");
|
|
15
|
-
|
|
16
|
-
var _Iconfont = _interopRequireDefault(require("../Iconfont"));
|
|
17
|
-
|
|
18
|
-
var _storage = require("../storage");
|
|
19
|
-
|
|
20
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
21
|
-
|
|
22
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
23
|
-
|
|
24
|
-
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; }
|
|
25
|
-
|
|
26
1
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
|
|
27
2
|
|
|
28
3
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
|
|
@@ -43,6 +18,11 @@ function _templateObject() {
|
|
|
43
18
|
|
|
44
19
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
45
20
|
|
|
21
|
+
import { useState, useMemo } from 'react';
|
|
22
|
+
import styled, { withTheme } from 'styled-components';
|
|
23
|
+
import { get } from 'lodash';
|
|
24
|
+
import Iconfont from '../Iconfont';
|
|
25
|
+
import { setLanguageStore, getLanguageStore } from '../storage';
|
|
46
26
|
var languages = [{
|
|
47
27
|
value: 'cn',
|
|
48
28
|
name: '中文'
|
|
@@ -54,8 +34,7 @@ var languagesMap = languages.reduce(function (acc, cur) {
|
|
|
54
34
|
acc[cur.value] = cur;
|
|
55
35
|
return acc;
|
|
56
36
|
}, {});
|
|
57
|
-
|
|
58
|
-
var Language = _styledComponents["default"].li(_templateObject(), function (_ref) {
|
|
37
|
+
var Language = styled.li(_templateObject(), function (_ref) {
|
|
59
38
|
var size = _ref.theme.size;
|
|
60
39
|
return size === 'large' ? '14px' : '12px';
|
|
61
40
|
}, function (_ref2) {
|
|
@@ -68,21 +47,20 @@ var Language = _styledComponents["default"].li(_templateObject(), function (_ref
|
|
|
68
47
|
var size = _ref4.theme.size;
|
|
69
48
|
return size === 'large' ? '-3px' : '-2px';
|
|
70
49
|
});
|
|
71
|
-
|
|
72
|
-
var _default = (0, _styledComponents.withTheme)(function (props) {
|
|
50
|
+
export default withTheme(function (props) {
|
|
73
51
|
var onChange = props.onChange;
|
|
74
52
|
|
|
75
53
|
var getLanguage = function getLanguage() {
|
|
76
|
-
var lang =
|
|
54
|
+
var lang = getLanguageStore() || props.language;
|
|
77
55
|
|
|
78
56
|
if (!languagesMap[lang]) {
|
|
79
|
-
lang =
|
|
57
|
+
lang = get(languages, '0.value');
|
|
80
58
|
}
|
|
81
59
|
|
|
82
60
|
return lang;
|
|
83
61
|
};
|
|
84
62
|
|
|
85
|
-
var _useState =
|
|
63
|
+
var _useState = useState(getLanguage()),
|
|
86
64
|
_useState2 = _slicedToArray(_useState, 2),
|
|
87
65
|
_useState2$ = _useState2[0],
|
|
88
66
|
language = _useState2$ === void 0 ? 'cn' : _useState2$,
|
|
@@ -91,18 +69,16 @@ var _default = (0, _styledComponents.withTheme)(function (props) {
|
|
|
91
69
|
var switchLanguage = function switchLanguage() {
|
|
92
70
|
var lang = language === 'cn' ? 'en' : 'cn';
|
|
93
71
|
setLanguage(lang);
|
|
94
|
-
|
|
72
|
+
setLanguageStore(lang);
|
|
95
73
|
onChange && onChange(lang);
|
|
96
74
|
};
|
|
97
75
|
|
|
98
|
-
var otherLanguage =
|
|
76
|
+
var otherLanguage = useMemo(function () {
|
|
99
77
|
return language === 'cn' ? 'en' : 'cn';
|
|
100
78
|
}, [language]);
|
|
101
79
|
return React.createElement(Language, {
|
|
102
80
|
onClick: switchLanguage
|
|
103
|
-
}, React.createElement(
|
|
81
|
+
}, React.createElement(Iconfont, {
|
|
104
82
|
type: "flag-".concat(otherLanguage)
|
|
105
|
-
}), React.createElement("span", null,
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
exports["default"] = _default;
|
|
83
|
+
}), React.createElement("span", null, get(languagesMap[otherLanguage], 'name')));
|
|
84
|
+
});
|
|
@@ -1,23 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import "antd/lib/row/style";
|
|
2
|
+
import _Row from "antd/lib/row";
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
|
|
10
|
-
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
11
|
-
|
|
12
|
-
var _antd = require("antd");
|
|
13
|
-
|
|
14
|
-
var _Iconfont = _interopRequireDefault(require("../Iconfont"));
|
|
15
|
-
|
|
16
|
-
var _storage = require("../storage");
|
|
17
|
-
|
|
18
|
-
var _this = void 0;
|
|
19
|
-
|
|
20
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
4
|
+
var _this = this;
|
|
21
5
|
|
|
22
6
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
|
|
23
7
|
|
|
@@ -39,8 +23,11 @@ function _templateObject() {
|
|
|
39
23
|
|
|
40
24
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
41
25
|
|
|
42
|
-
|
|
43
|
-
|
|
26
|
+
import { useState } from 'react';
|
|
27
|
+
import styled from 'styled-components';
|
|
28
|
+
import Iconfont from '../Iconfont';
|
|
29
|
+
import { setThemeStore, getThemeStore, getLanguageStore } from '../storage';
|
|
30
|
+
var Theme = styled.li(_templateObject());
|
|
44
31
|
var themes = [{
|
|
45
32
|
value: 'themeS3',
|
|
46
33
|
label: '科技蓝',
|
|
@@ -54,30 +41,29 @@ var themes = [{
|
|
|
54
41
|
label: '极致白',
|
|
55
42
|
enLabel: 'White'
|
|
56
43
|
}];
|
|
57
|
-
|
|
58
|
-
var _default = function _default(props) {
|
|
44
|
+
export default (function (props) {
|
|
59
45
|
var onChange = props.onChange;
|
|
60
46
|
|
|
61
47
|
var getTheme = function getTheme() {
|
|
62
|
-
var theme =
|
|
48
|
+
var theme = getThemeStore() || props.theme || 'themeS3';
|
|
63
49
|
return themes.some(function (_ref) {
|
|
64
50
|
var value = _ref.value;
|
|
65
51
|
return value === theme;
|
|
66
52
|
}) ? theme : 'themeS3';
|
|
67
53
|
};
|
|
68
54
|
|
|
69
|
-
var _useState =
|
|
55
|
+
var _useState = useState(getTheme()),
|
|
70
56
|
_useState2 = _slicedToArray(_useState, 2),
|
|
71
57
|
theme = _useState2[0],
|
|
72
58
|
setTheme = _useState2[1];
|
|
73
59
|
|
|
74
60
|
var changeTheme = function changeTheme(theme) {
|
|
75
61
|
setTheme(theme);
|
|
76
|
-
|
|
62
|
+
setThemeStore(theme);
|
|
77
63
|
onChange(theme);
|
|
78
64
|
};
|
|
79
65
|
|
|
80
|
-
return React.createElement(Theme, null, React.createElement(
|
|
66
|
+
return React.createElement(Theme, null, React.createElement(_Row, {
|
|
81
67
|
type: "flex",
|
|
82
68
|
justify: "space-between",
|
|
83
69
|
className: "user-info-body-theme-row"
|
|
@@ -88,10 +74,8 @@ var _default = function _default(props) {
|
|
|
88
74
|
return React.createElement("div", {
|
|
89
75
|
className: value,
|
|
90
76
|
onClick: changeTheme.bind(_this, value)
|
|
91
|
-
},
|
|
77
|
+
}, getLanguageStore() === 'en' ? enLabel : label, theme === value && React.createElement("span", {
|
|
92
78
|
className: "icon-checked-wrap"
|
|
93
79
|
}));
|
|
94
80
|
})));
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
exports["default"] = _default;
|
|
81
|
+
});
|
|
@@ -1,20 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
|
|
8
|
-
var _styledComponents = require("styled-components");
|
|
9
|
-
|
|
10
|
-
var _Layout = _interopRequireDefault(require("../Layout"));
|
|
11
|
-
|
|
12
|
-
var _Avatar = _interopRequireDefault(require("./Avatar"));
|
|
13
|
-
|
|
14
|
-
var _storage = require("../storage");
|
|
15
|
-
|
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
17
|
-
|
|
18
1
|
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); }
|
|
19
2
|
|
|
20
3
|
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; }
|
|
@@ -23,13 +6,17 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
23
6
|
|
|
24
7
|
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; }
|
|
25
8
|
|
|
26
|
-
|
|
9
|
+
import { withTheme } from 'styled-components';
|
|
10
|
+
import Layout from '../Layout';
|
|
11
|
+
import Avatar from './Avatar';
|
|
12
|
+
import { getThemeStore } from '../storage';
|
|
13
|
+
export default withTheme(function (props) {
|
|
27
14
|
var _props$userInfo = props.userInfo,
|
|
28
15
|
userInfo = _props$userInfo === void 0 ? {} : _props$userInfo,
|
|
29
16
|
_props$extendMap = props.extendMap,
|
|
30
17
|
extendMap = _props$extendMap === void 0 ? {} : _props$extendMap; // 企业级的默认蓝色主题
|
|
31
18
|
|
|
32
|
-
var theme =
|
|
19
|
+
var theme = getThemeStore() || (extendMap == null ? void 0 : extendMap.defaultTheme) || userInfo.theme || 'themeS3';
|
|
33
20
|
theme = theme === 'default' ? 'themeS3' : theme;
|
|
34
21
|
|
|
35
22
|
var newProps = _objectSpread({}, props, {
|
|
@@ -38,9 +25,7 @@ var _default = (0, _styledComponents.withTheme)(function (props) {
|
|
|
38
25
|
})
|
|
39
26
|
});
|
|
40
27
|
|
|
41
|
-
return React.createElement(
|
|
42
|
-
AvatarCustom:
|
|
28
|
+
return React.createElement(Layout, _extends({}, newProps, {
|
|
29
|
+
AvatarCustom: Avatar
|
|
43
30
|
}));
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
exports["default"] = _default;
|
|
31
|
+
});
|
|
@@ -1,26 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
|
|
10
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
-
|
|
12
|
-
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
13
|
-
|
|
14
|
-
var _lodash = require("lodash");
|
|
15
|
-
|
|
16
|
-
var _utils = require("../../utils");
|
|
17
|
-
|
|
18
|
-
var _Iconfont = _interopRequireDefault(require("../Iconfont"));
|
|
19
|
-
|
|
20
|
-
var _locale = require("../../locale");
|
|
21
|
-
|
|
22
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
23
|
-
|
|
24
1
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
|
|
25
2
|
|
|
26
3
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
|
|
@@ -101,7 +78,14 @@ function _templateObject() {
|
|
|
101
78
|
|
|
102
79
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
103
80
|
|
|
104
|
-
|
|
81
|
+
import { useState, useEffect } from 'react';
|
|
82
|
+
import cn from 'classnames';
|
|
83
|
+
import styled from 'styled-components';
|
|
84
|
+
import { debounce } from 'lodash';
|
|
85
|
+
import { traverseTree, hasLevel3 } from '../../utils';
|
|
86
|
+
import Icon from '../Iconfont';
|
|
87
|
+
import { getText } from '../../locale';
|
|
88
|
+
var SearchArea = styled.div(_templateObject(), function (props) {
|
|
105
89
|
return props.theme.secondaryTextColor;
|
|
106
90
|
}, function (props) {
|
|
107
91
|
return props.theme.primaryColor;
|
|
@@ -110,8 +94,7 @@ var SearchArea = _styledComponents["default"].div(_templateObject(), function (p
|
|
|
110
94
|
}, function (props) {
|
|
111
95
|
return props.theme.borderColor;
|
|
112
96
|
});
|
|
113
|
-
|
|
114
|
-
var ApplicationTabs = _styledComponents["default"].ul(_templateObject2(), function (props) {
|
|
97
|
+
var ApplicationTabs = styled.ul(_templateObject2(), function (props) {
|
|
115
98
|
return props.theme.borderColor;
|
|
116
99
|
}, function (props) {
|
|
117
100
|
return props.theme.primaryTextColor;
|
|
@@ -120,24 +103,19 @@ var ApplicationTabs = _styledComponents["default"].ul(_templateObject2(), functi
|
|
|
120
103
|
}, function (props) {
|
|
121
104
|
return props.theme.primaryColor;
|
|
122
105
|
});
|
|
123
|
-
|
|
124
|
-
var GroupMenus = _styledComponents["default"].div(_templateObject3(), function (props) {
|
|
106
|
+
var GroupMenus = styled.div(_templateObject3(), function (props) {
|
|
125
107
|
return props.isLevel3 ? 'calc(100% - 80px)' : 'calc(100% - 50px)';
|
|
126
108
|
});
|
|
127
|
-
|
|
128
|
-
var
|
|
129
|
-
|
|
130
|
-
var MenuList = _styledComponents["default"].ul(_templateObject5());
|
|
131
|
-
|
|
132
|
-
var MenuItem = _styledComponents["default"].li(_templateObject6(), function (props) {
|
|
109
|
+
var GroupMenuItem = styled.div(_templateObject4());
|
|
110
|
+
var MenuList = styled.ul(_templateObject5());
|
|
111
|
+
var MenuItem = styled.li(_templateObject6(), function (props) {
|
|
133
112
|
return props.theme.secondaryTextColor;
|
|
134
113
|
}, function (props) {
|
|
135
114
|
return props.theme.secondaryColor;
|
|
136
115
|
}, function (props) {
|
|
137
116
|
return props.theme.primaryColor;
|
|
138
117
|
});
|
|
139
|
-
|
|
140
|
-
var ListBox = _styledComponents["default"].ul(_templateObject7(), function (props) {
|
|
118
|
+
var ListBox = styled.ul(_templateObject7(), function (props) {
|
|
141
119
|
return props.theme.primaryTextColor;
|
|
142
120
|
}, function (props) {
|
|
143
121
|
return props.theme.secondaryColor;
|
|
@@ -160,7 +138,7 @@ var SearchList = function SearchList(_ref) {
|
|
|
160
138
|
}));
|
|
161
139
|
};
|
|
162
140
|
|
|
163
|
-
|
|
141
|
+
export default (function (_ref2) {
|
|
164
142
|
var theme = _ref2.theme,
|
|
165
143
|
_ref2$menus = _ref2.menus,
|
|
166
144
|
menus = _ref2$menus === void 0 ? [] : _ref2$menus,
|
|
@@ -169,20 +147,20 @@ var _default = function _default(_ref2) {
|
|
|
169
147
|
popupRef = _ref2.popupRef,
|
|
170
148
|
containerRef = _ref2.containerRef;
|
|
171
149
|
|
|
172
|
-
var _useState =
|
|
150
|
+
var _useState = useState(false),
|
|
173
151
|
_useState2 = _slicedToArray(_useState, 2),
|
|
174
152
|
active = _useState2[0],
|
|
175
153
|
setActive = _useState2[1];
|
|
176
154
|
|
|
177
|
-
var _useState3 =
|
|
155
|
+
var _useState3 = useState(),
|
|
178
156
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
179
157
|
searchValue = _useState4[0],
|
|
180
158
|
setSearchValue = _useState4[1];
|
|
181
159
|
|
|
182
160
|
var language = actions == null ? void 0 : actions.getLanguage();
|
|
183
|
-
var isLevel3 =
|
|
161
|
+
var isLevel3 = hasLevel3(menus);
|
|
184
162
|
|
|
185
|
-
var _useState5 =
|
|
163
|
+
var _useState5 = useState(isLevel3 ? menus == null ? void 0 : menus[0] : null),
|
|
186
164
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
187
165
|
activeTopMenu = _useState6[0],
|
|
188
166
|
setActiveTopMenu = _useState6[1];
|
|
@@ -274,7 +252,7 @@ var _default = function _default(_ref2) {
|
|
|
274
252
|
|
|
275
253
|
var groupMenus = calcGroupMenus((activeTopMenu == null ? void 0 : activeTopMenu.children) || menus);
|
|
276
254
|
|
|
277
|
-
var _useState7 =
|
|
255
|
+
var _useState7 = useState([]),
|
|
278
256
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
279
257
|
searchedMenus = _useState8[0],
|
|
280
258
|
setSearchedMenus = _useState8[1];
|
|
@@ -289,14 +267,14 @@ var _default = function _default(_ref2) {
|
|
|
289
267
|
close();
|
|
290
268
|
};
|
|
291
269
|
|
|
292
|
-
var debounceSearch =
|
|
270
|
+
var debounceSearch = debounce(function (evt) {
|
|
293
271
|
var _evt$target$value;
|
|
294
272
|
|
|
295
273
|
var value = (_evt$target$value = evt.target.value) == null ? void 0 : _evt$target$value.trim();
|
|
296
274
|
var matchedMenus = [];
|
|
297
275
|
|
|
298
276
|
if (value) {
|
|
299
|
-
|
|
277
|
+
traverseTree(menus, function (node) {
|
|
300
278
|
var _node$menuName;
|
|
301
279
|
|
|
302
280
|
if (node.path && (node == null ? void 0 : (_node$menuName = node.menuName) == null ? void 0 : _node$menuName.includes(value))) {
|
|
@@ -318,7 +296,7 @@ var _default = function _default(_ref2) {
|
|
|
318
296
|
setActiveTopMenu(menu);
|
|
319
297
|
};
|
|
320
298
|
|
|
321
|
-
|
|
299
|
+
useEffect(function () {
|
|
322
300
|
var clickOutside = function clickOutside(evt) {
|
|
323
301
|
var clientX = evt.clientX,
|
|
324
302
|
clientY = evt.clientY,
|
|
@@ -356,10 +334,10 @@ var _default = function _default(_ref2) {
|
|
|
356
334
|
}, []);
|
|
357
335
|
return React.createElement(React.Fragment, null, React.createElement(SearchArea, {
|
|
358
336
|
theme: theme,
|
|
359
|
-
className: (
|
|
337
|
+
className: cn({
|
|
360
338
|
active: active
|
|
361
339
|
})
|
|
362
|
-
}, React.createElement(
|
|
340
|
+
}, React.createElement(Icon, {
|
|
363
341
|
type: "search"
|
|
364
342
|
}), React.createElement("input", {
|
|
365
343
|
placeholder: actions == null ? void 0 : actions.getText('menuSearch'),
|
|
@@ -371,7 +349,7 @@ var _default = function _default(_ref2) {
|
|
|
371
349
|
onBlur: function onBlur() {
|
|
372
350
|
return setActive(false);
|
|
373
351
|
}
|
|
374
|
-
}), React.createElement(
|
|
352
|
+
}), React.createElement(Icon, {
|
|
375
353
|
type: "close",
|
|
376
354
|
onClick: close
|
|
377
355
|
}), (searchedMenus == null ? void 0 : searchedMenus.length) > 0 && React.createElement(SearchList, {
|
|
@@ -382,7 +360,7 @@ var _default = function _default(_ref2) {
|
|
|
382
360
|
theme: theme
|
|
383
361
|
}, menus == null ? void 0 : menus.map(function (menu) {
|
|
384
362
|
return React.createElement("li", {
|
|
385
|
-
className: (
|
|
363
|
+
className: cn({
|
|
386
364
|
active: menu.code === (activeTopMenu == null ? void 0 : activeTopMenu.code)
|
|
387
365
|
}),
|
|
388
366
|
onClick: function onClick() {
|
|
@@ -399,7 +377,7 @@ var _default = function _default(_ref2) {
|
|
|
399
377
|
}, React.createElement("h5", null, group == null ? void 0 : group[language === 'cn' ? 'groupName' : 'enName']), React.createElement(MenuList, null, (group.children || []).map(function (menu) {
|
|
400
378
|
return React.createElement(MenuItem, {
|
|
401
379
|
key: menu.code,
|
|
402
|
-
className: (
|
|
380
|
+
className: cn({
|
|
403
381
|
active: selectedMenuKey === menu.code
|
|
404
382
|
}),
|
|
405
383
|
theme: theme,
|
|
@@ -415,6 +393,4 @@ var _default = function _default(_ref2) {
|
|
|
415
393
|
})));
|
|
416
394
|
}));
|
|
417
395
|
})));
|
|
418
|
-
};
|
|
419
|
-
|
|
420
|
-
exports["default"] = _default;
|
|
396
|
+
});
|