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
package/es/Layout/AppList.js
CHANGED
|
@@ -1,33 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
var _antd = require("antd");
|
|
15
|
-
|
|
16
|
-
var _lodash = require("lodash");
|
|
17
|
-
|
|
18
|
-
var _Icon = _interopRequireDefault(require("../Icon"));
|
|
19
|
-
|
|
20
|
-
var _storage = require("./storage");
|
|
21
|
-
|
|
22
|
-
var _utils = require("../utils");
|
|
23
|
-
|
|
24
|
-
var _this = void 0;
|
|
25
|
-
|
|
26
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
27
|
-
|
|
28
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
29
|
-
|
|
30
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
1
|
+
import "antd/lib/dropdown/style";
|
|
2
|
+
import _Dropdown from "antd/lib/dropdown";
|
|
3
|
+
import "antd/lib/input/style";
|
|
4
|
+
import _Input from "antd/lib/input";
|
|
5
|
+
import "antd/lib/tree-select/style";
|
|
6
|
+
import _TreeSelect from "antd/lib/tree-select";
|
|
7
|
+
import "antd/lib/menu/style";
|
|
8
|
+
import _Menu from "antd/lib/menu";
|
|
9
|
+
import "antd/lib/select/style";
|
|
10
|
+
import _Select from "antd/lib/select";
|
|
11
|
+
|
|
12
|
+
var _this = this;
|
|
31
13
|
|
|
32
14
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
|
|
33
15
|
|
|
@@ -79,32 +61,36 @@ function _templateObject() {
|
|
|
79
61
|
|
|
80
62
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
81
63
|
|
|
82
|
-
|
|
83
|
-
|
|
64
|
+
import { useState, useEffect } from 'react';
|
|
65
|
+
import styled, { withTheme } from 'styled-components';
|
|
66
|
+
import { get } from 'lodash';
|
|
67
|
+
import Icon from '../Icon';
|
|
68
|
+
import { getCurrentAppStore, setCurrentAppStore } from './storage';
|
|
69
|
+
import { traverseTree } from '../utils';
|
|
70
|
+
var Option = _Select.Option;
|
|
71
|
+
var MenuList = styled(_Menu)(_templateObject()); // 新版UI
|
|
84
72
|
|
|
85
|
-
var AppsSelect = (
|
|
73
|
+
var AppsSelect = styled(_Select)(_templateObject2(), function (props) {
|
|
86
74
|
return "".concat(props.theme.blueBgColor, " !important");
|
|
87
75
|
});
|
|
88
|
-
var AppTreeSelect = (
|
|
89
|
-
|
|
90
|
-
var SwitchAppMenu = _styledComponents["default"].a(_templateObject4(), function (props) {
|
|
76
|
+
var AppTreeSelect = styled(_TreeSelect)(_templateObject3());
|
|
77
|
+
var SwitchAppMenu = styled.a(_templateObject4(), function (props) {
|
|
91
78
|
return "".concat(props.theme.headerHeight, "px");
|
|
92
79
|
}, function (props) {
|
|
93
80
|
return "".concat(props.theme.size === 'large' ? 16 : 14, "px");
|
|
94
81
|
});
|
|
95
|
-
|
|
96
|
-
var _default = (0, _styledComponents.withTheme)(function (props) {
|
|
82
|
+
export default withTheme(function (props) {
|
|
97
83
|
var selectedKey = props.selectedKey,
|
|
98
84
|
_props$items = props.items,
|
|
99
85
|
items = _props$items === void 0 ? [] : _props$items,
|
|
100
86
|
onChange = props.onChange;
|
|
101
87
|
|
|
102
88
|
var getInitialSelectedApp = function getInitialSelectedApp() {
|
|
103
|
-
var currentAppStore =
|
|
89
|
+
var currentAppStore = getCurrentAppStore();
|
|
104
90
|
|
|
105
91
|
var findAppByKey = function findAppByKey(selectedKey) {
|
|
106
92
|
var findApp;
|
|
107
|
-
|
|
93
|
+
traverseTree(items, function (item) {
|
|
108
94
|
if (item.key === selectedKey) {
|
|
109
95
|
findApp = item;
|
|
110
96
|
return false;
|
|
@@ -113,33 +99,33 @@ var _default = (0, _styledComponents.withTheme)(function (props) {
|
|
|
113
99
|
return findApp;
|
|
114
100
|
};
|
|
115
101
|
|
|
116
|
-
var currentApp = findAppByKey(selectedKey ||
|
|
102
|
+
var currentApp = findAppByKey(selectedKey || get(currentAppStore, 'key'));
|
|
117
103
|
return currentApp || items[0];
|
|
118
104
|
};
|
|
119
105
|
|
|
120
106
|
var changeApp = function changeApp(app) {
|
|
121
107
|
setSelectedApp(app);
|
|
122
|
-
|
|
108
|
+
setCurrentAppStore(app);
|
|
123
109
|
onChange && onChange(app);
|
|
124
110
|
};
|
|
125
111
|
|
|
126
|
-
var _useState =
|
|
112
|
+
var _useState = useState(),
|
|
127
113
|
_useState2 = _slicedToArray(_useState, 2),
|
|
128
114
|
searchValue = _useState2[0],
|
|
129
115
|
setSearchValue = _useState2[1];
|
|
130
116
|
|
|
131
|
-
var _useState3 =
|
|
117
|
+
var _useState3 = useState(getInitialSelectedApp()),
|
|
132
118
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
133
119
|
selectedApp = _useState4[0],
|
|
134
120
|
setSelectedApp = _useState4[1];
|
|
135
121
|
|
|
136
122
|
var Menus = React.createElement(MenuList, {
|
|
137
|
-
selectedKeys: [
|
|
138
|
-
}, React.createElement(
|
|
123
|
+
selectedKeys: [get(selectedApp, 'key')]
|
|
124
|
+
}, React.createElement(_Menu.Item, {
|
|
139
125
|
className: "app-search-warp",
|
|
140
126
|
key: "search",
|
|
141
127
|
disabled: true
|
|
142
|
-
}, React.createElement(
|
|
128
|
+
}, React.createElement(_Input, {
|
|
143
129
|
allowClear: true,
|
|
144
130
|
placeholder: "\u8F93\u5165\u5173\u952E\u8BCD\u641C\u7D22",
|
|
145
131
|
value: searchValue,
|
|
@@ -159,12 +145,12 @@ var _default = (0, _styledComponents.withTheme)(function (props) {
|
|
|
159
145
|
|
|
160
146
|
return true;
|
|
161
147
|
}).map(function (item) {
|
|
162
|
-
return React.createElement(
|
|
148
|
+
return React.createElement(_Menu.Item, {
|
|
163
149
|
key: item.key,
|
|
164
150
|
onClick: changeApp.bind(_this, item)
|
|
165
151
|
}, item.name);
|
|
166
152
|
}));
|
|
167
|
-
|
|
153
|
+
useEffect(function () {
|
|
168
154
|
var newApp = getInitialSelectedApp();
|
|
169
155
|
|
|
170
156
|
if ((newApp == null ? void 0 : newApp.key) !== (selectedApp == null ? void 0 : selectedApp.key)) {
|
|
@@ -187,8 +173,8 @@ var _default = (0, _styledComponents.withTheme)(function (props) {
|
|
|
187
173
|
dropdownStyle: {
|
|
188
174
|
maxHeight: 560
|
|
189
175
|
},
|
|
190
|
-
value:
|
|
191
|
-
treeData:
|
|
176
|
+
value: get(selectedApp, 'key'),
|
|
177
|
+
treeData: traverseTree(items, function (item) {
|
|
192
178
|
item.title = item.name;
|
|
193
179
|
item.value = item.key;
|
|
194
180
|
item.selectable = !item.children;
|
|
@@ -196,7 +182,7 @@ var _default = (0, _styledComponents.withTheme)(function (props) {
|
|
|
196
182
|
}),
|
|
197
183
|
onChange: function onChange(appKey) {
|
|
198
184
|
var findItem;
|
|
199
|
-
|
|
185
|
+
traverseTree(items, function (node) {
|
|
200
186
|
if (node.key === appKey) {
|
|
201
187
|
findItem = node;
|
|
202
188
|
return false;
|
|
@@ -216,7 +202,7 @@ var _default = (0, _styledComponents.withTheme)(function (props) {
|
|
|
216
202
|
placeholder: "\u8BF7\u9009\u62E9",
|
|
217
203
|
showSearch: true,
|
|
218
204
|
optionFilterProp: "children",
|
|
219
|
-
value:
|
|
205
|
+
value: get(selectedApp, 'key'),
|
|
220
206
|
onChange: function onChange(appKey) {
|
|
221
207
|
changeApp(items.find(function (_ref2) {
|
|
222
208
|
var key = _ref2.key;
|
|
@@ -238,12 +224,10 @@ var _default = (0, _styledComponents.withTheme)(function (props) {
|
|
|
238
224
|
}));
|
|
239
225
|
}
|
|
240
226
|
|
|
241
|
-
return React.createElement(
|
|
227
|
+
return React.createElement(_Dropdown, {
|
|
242
228
|
overlay: Menus,
|
|
243
229
|
trigger: ['click']
|
|
244
|
-
}, React.createElement(SwitchAppMenu, null, React.createElement("span", null,
|
|
230
|
+
}, React.createElement(SwitchAppMenu, null, React.createElement("span", null, get(selectedApp, 'name', '请选择')), React.createElement(Icon, {
|
|
245
231
|
type: "caret-down"
|
|
246
232
|
})));
|
|
247
|
-
});
|
|
248
|
-
|
|
249
|
-
exports["default"] = _default;
|
|
233
|
+
});
|
package/es/Layout/Application.js
CHANGED
|
@@ -1,29 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import "antd/lib/popover/style";
|
|
2
|
+
import _Popover from "antd/lib/popover";
|
|
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 _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
-
|
|
14
|
-
var _antd = require("antd");
|
|
15
|
-
|
|
16
|
-
var _lodash = require("lodash");
|
|
17
|
-
|
|
18
|
-
var _logoIcon = require("@tntx/logo-icon");
|
|
19
|
-
|
|
20
|
-
var _Iconfont = _interopRequireDefault(require("./Iconfont"));
|
|
21
|
-
|
|
22
|
-
var _images = require("./images");
|
|
23
|
-
|
|
24
|
-
var _this = void 0;
|
|
25
|
-
|
|
26
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
4
|
+
var _this = this;
|
|
27
5
|
|
|
28
6
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
|
|
29
7
|
|
|
@@ -75,20 +53,24 @@ function _templateObject() {
|
|
|
75
53
|
|
|
76
54
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
77
55
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
56
|
+
import { useState } from 'react';
|
|
57
|
+
import styled from 'styled-components';
|
|
58
|
+
import cn from 'classnames';
|
|
59
|
+
import { get } from 'lodash';
|
|
60
|
+
import { systemMap as applicationsMap } from '@tntx/logo-icon';
|
|
61
|
+
import Iconfont from './Iconfont';
|
|
62
|
+
import { defaultLogo } from './images';
|
|
63
|
+
var App = styled.li(_templateObject());
|
|
64
|
+
var AppList = styled.ul(_templateObject2());
|
|
65
|
+
var AppItem = styled.li(_templateObject3());
|
|
66
|
+
var AppContentWrapper = styled.div(_templateObject4());
|
|
85
67
|
|
|
86
68
|
var AppContent = function AppContent(props) {
|
|
87
69
|
var language = props.language,
|
|
88
70
|
apps = props.apps,
|
|
89
71
|
onChange = props.onChange;
|
|
90
72
|
|
|
91
|
-
var _useState =
|
|
73
|
+
var _useState = useState(props.appKey),
|
|
92
74
|
_useState2 = _slicedToArray(_useState, 2),
|
|
93
75
|
appKey = _useState2[0],
|
|
94
76
|
setAppKey = _useState2[1];
|
|
@@ -99,37 +81,35 @@ var AppContent = function AppContent(props) {
|
|
|
99
81
|
};
|
|
100
82
|
|
|
101
83
|
return React.createElement(AppContentWrapper, null, React.createElement(AppList, null, apps.sort(function (a, b) {
|
|
102
|
-
return
|
|
84
|
+
return get(applicationsMap, "".concat(a.appKey, ".sort"), 1) - get(applicationsMap, "".concat(b.appKey, ".sort"), 1);
|
|
103
85
|
}).map(function (_ref) {
|
|
104
86
|
var key = _ref.appKey;
|
|
105
87
|
return React.createElement(AppItem, {
|
|
106
88
|
key: key,
|
|
107
|
-
className: (
|
|
89
|
+
className: cn({
|
|
108
90
|
active: appKey === key
|
|
109
91
|
}),
|
|
110
92
|
onClick: changeApp.bind(_this, key)
|
|
111
93
|
}, React.createElement("img", {
|
|
112
|
-
src:
|
|
94
|
+
src: get(applicationsMap, "".concat(key, ".logo"), defaultLogo),
|
|
113
95
|
onError: function onError(e) {
|
|
114
96
|
e.target.onerror = null;
|
|
115
|
-
e.target.src =
|
|
97
|
+
e.target.src = defaultLogo;
|
|
116
98
|
}
|
|
117
|
-
}), React.createElement("div", null,
|
|
99
|
+
}), React.createElement("div", null, get(applicationsMap, "".concat(key, ".").concat({
|
|
118
100
|
cn: 'name',
|
|
119
101
|
en: 'enName'
|
|
120
102
|
}[language || 'cn']), key)));
|
|
121
103
|
})));
|
|
122
104
|
};
|
|
123
105
|
|
|
124
|
-
|
|
125
|
-
return React.createElement(App, null, React.createElement(
|
|
106
|
+
export default (function (props) {
|
|
107
|
+
return React.createElement(App, null, React.createElement(_Popover, {
|
|
126
108
|
placement: "bottomRight",
|
|
127
109
|
title: null,
|
|
128
110
|
content: React.createElement(AppContent, props),
|
|
129
111
|
trigger: "click"
|
|
130
|
-
}, React.createElement(
|
|
112
|
+
}, React.createElement(Iconfont, {
|
|
131
113
|
type: "application"
|
|
132
114
|
})));
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
exports["default"] = _default;
|
|
115
|
+
});
|
package/es/Layout/Avatar.js
CHANGED
|
@@ -1,31 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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 _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 _storage = require("./storage");
|
|
23
|
-
|
|
24
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
25
|
-
|
|
26
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
27
|
-
|
|
28
|
-
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/button/style";
|
|
4
|
+
import _Button from "antd/lib/button";
|
|
29
5
|
|
|
30
6
|
function _templateObject3() {
|
|
31
7
|
var data = _taggedTemplateLiteral(["\n min-width: 235px;\n z-index: 1;\n background-color: #fff;\n border-radius: 4px;\n\n .isInIframe & {\n display: none;\n }\n \n .user-info-body {\n padding: 30px 20px 20px 24px;\n line-height: 16px;\n .user-info-body-username {\n margin-top: 0px;\n font-size: 16px;\n color: #333;\n font-weight: normal;\n margin-bottom: 10px;\n line-height: 16px;\n }\n .user-info-body-account {\n margin-top: 0px;\n color: #666;\n margin-bottom: 14px;\n line-height: 16px;\n }\n a {\n margin-right: 16px;\n }\n }\n .user-info-footer {\n border-top: 1px solid #ccc;\n background-color: #f5f5f5;\n padding: 8px 20px;\n text-align: right;\n .user-info-footer-signout:hover {\n box-shadow: 0 2px 8px rgba(0, 0, 0, .1);\n border-color: #d9d9d9;\n color: rgba(0, 0, 0, 0.65);\n }\n }\n"]);
|
|
@@ -59,11 +35,15 @@ function _templateObject() {
|
|
|
59
35
|
|
|
60
36
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
61
37
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
38
|
+
import { useContext } from 'react';
|
|
39
|
+
import styled, { createGlobalStyle } from 'styled-components';
|
|
40
|
+
import { get } from 'lodash';
|
|
41
|
+
import images from './images';
|
|
42
|
+
import ActionsContext from './ActionsContext';
|
|
43
|
+
import { clearLoginCookie } from './storage';
|
|
44
|
+
var Avatar = styled.li(_templateObject());
|
|
45
|
+
var GlobalStyle = createGlobalStyle(_templateObject2());
|
|
46
|
+
var UserInfoWrapper = styled.div(_templateObject3());
|
|
67
47
|
|
|
68
48
|
var UserInfoContent = function UserInfoContent(props) {
|
|
69
49
|
var userInfo = props.userInfo,
|
|
@@ -77,7 +57,7 @@ var UserInfoContent = function UserInfoContent(props) {
|
|
|
77
57
|
return true;
|
|
78
58
|
} : _props$onPersonalSett;
|
|
79
59
|
|
|
80
|
-
var _useContext =
|
|
60
|
+
var _useContext = useContext(ActionsContext),
|
|
81
61
|
getText = _useContext.getText;
|
|
82
62
|
|
|
83
63
|
return React.createElement(UserInfoWrapper, {
|
|
@@ -96,43 +76,41 @@ var UserInfoContent = function UserInfoContent(props) {
|
|
|
96
76
|
href: "/bridge/userCenter?currentTab=2"
|
|
97
77
|
}, getText('changePwd'))), React.createElement("div", {
|
|
98
78
|
className: "user-info-footer"
|
|
99
|
-
}, React.createElement(
|
|
79
|
+
}, React.createElement(_Button, {
|
|
100
80
|
className: "user-info-footer-signout",
|
|
101
81
|
onClick: function onClick() {
|
|
102
82
|
if (onLogout) {
|
|
103
83
|
onLogout();
|
|
104
|
-
|
|
84
|
+
clearLoginCookie();
|
|
105
85
|
} else {
|
|
106
|
-
|
|
86
|
+
clearLoginCookie();
|
|
107
87
|
window.location.href = "/user/login?callbackUrl=".concat(window.encodeURI(location.href));
|
|
108
88
|
}
|
|
109
89
|
}
|
|
110
90
|
}, React.createElement("a", null, getText('signOut')))));
|
|
111
91
|
};
|
|
112
92
|
|
|
113
|
-
|
|
93
|
+
export default (function (props) {
|
|
114
94
|
var _images$empty2;
|
|
115
95
|
|
|
116
96
|
var _props$userInfo = props.userInfo,
|
|
117
97
|
userInfo = _props$userInfo === void 0 ? {} : _props$userInfo;
|
|
118
98
|
var avatar = userInfo.avatar;
|
|
119
|
-
return React.createElement(Avatar, null, React.createElement(
|
|
99
|
+
return React.createElement(Avatar, null, React.createElement(_Popover, {
|
|
120
100
|
popupClassName: "tnt-layout-personal-popover",
|
|
121
101
|
placement: "bottomRight",
|
|
122
102
|
title: null,
|
|
123
103
|
content: React.createElement(UserInfoContent, props),
|
|
124
104
|
trigger: "click"
|
|
125
105
|
}, avatar ? React.createElement("img", {
|
|
126
|
-
src: avatar.indexOf('base64') > 0 ? avatar :
|
|
106
|
+
src: avatar.indexOf('base64') > 0 ? avatar : get(images[avatar], 'default', images[avatar]),
|
|
127
107
|
onError: function onError(e) {
|
|
128
108
|
var _images$empty;
|
|
129
109
|
|
|
130
110
|
e.target.onerror = null;
|
|
131
|
-
e.target.src = ((_images$empty =
|
|
111
|
+
e.target.src = ((_images$empty = images.empty) == null ? void 0 : _images$empty["default"]) || images.empty;
|
|
132
112
|
}
|
|
133
113
|
}) : React.createElement("img", {
|
|
134
|
-
src: ((_images$empty2 =
|
|
114
|
+
src: ((_images$empty2 = images.empty) == null ? void 0 : _images$empty2["default"]) || images.empty
|
|
135
115
|
})), React.createElement(GlobalStyle, null));
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
exports["default"] = _default;
|
|
116
|
+
});
|
|
@@ -1,29 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import "antd/lib/popover/style";
|
|
2
|
+
import _Popover from "antd/lib/popover";
|
|
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 _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
-
|
|
14
|
-
var _antd = require("antd");
|
|
15
|
-
|
|
16
|
-
var _lodash = require("lodash");
|
|
17
|
-
|
|
18
|
-
var _Icon = _interopRequireDefault(require("../Icon"));
|
|
19
|
-
|
|
20
|
-
var _images = _interopRequireDefault(require("./images"));
|
|
21
|
-
|
|
22
|
-
var _storage = require("./storage");
|
|
23
|
-
|
|
24
|
-
var _this = void 0;
|
|
25
|
-
|
|
26
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
4
|
+
var _this = this;
|
|
27
5
|
|
|
28
6
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
|
|
29
7
|
|
|
@@ -75,6 +53,13 @@ function _templateObject() {
|
|
|
75
53
|
|
|
76
54
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
77
55
|
|
|
56
|
+
import { useState } from 'react';
|
|
57
|
+
import styled from 'styled-components';
|
|
58
|
+
import cn from 'classnames';
|
|
59
|
+
import { get } from 'lodash';
|
|
60
|
+
import Icon from '../Icon';
|
|
61
|
+
import images from './images';
|
|
62
|
+
import { setThemeStore, getThemeStore, setLanguageStore, getLanguageStore } from './storage';
|
|
78
63
|
var languages = [{
|
|
79
64
|
value: 'cn',
|
|
80
65
|
name: '中文'
|
|
@@ -86,21 +71,16 @@ var languagesMap = languages.reduce(function (acc, cur) {
|
|
|
86
71
|
acc[cur.value] = cur;
|
|
87
72
|
return acc;
|
|
88
73
|
}, {});
|
|
89
|
-
|
|
90
|
-
var
|
|
91
|
-
|
|
92
|
-
var
|
|
93
|
-
|
|
94
|
-
var ThemeSwitch = _styledComponents["default"].div(_templateObject3());
|
|
95
|
-
|
|
96
|
-
var ThemeContentWrapper = _styledComponents["default"].div(_templateObject4());
|
|
97
|
-
|
|
74
|
+
var LanguageSwitch = styled.div(_templateObject());
|
|
75
|
+
var Theme = styled.li(_templateObject2());
|
|
76
|
+
var ThemeSwitch = styled.div(_templateObject3());
|
|
77
|
+
var ThemeContentWrapper = styled.div(_templateObject4());
|
|
98
78
|
var themes = [{
|
|
99
79
|
value: 'themeS1',
|
|
100
|
-
img:
|
|
80
|
+
img: images.themeSymbol1
|
|
101
81
|
}, {
|
|
102
82
|
value: 'themeS2',
|
|
103
|
-
img:
|
|
83
|
+
img: images.themeSymbol2
|
|
104
84
|
}];
|
|
105
85
|
|
|
106
86
|
var ThemeContent = function ThemeContent(props) {
|
|
@@ -115,35 +95,35 @@ var ThemeContent = function ThemeContent(props) {
|
|
|
115
95
|
themeVisible = _ref$theme === void 0 ? true : _ref$theme;
|
|
116
96
|
|
|
117
97
|
var getTheme = function getTheme() {
|
|
118
|
-
var theme =
|
|
98
|
+
var theme = getThemeStore() || props.theme || 'themeS2';
|
|
119
99
|
return themes.some(function (_ref2) {
|
|
120
100
|
var value = _ref2.value;
|
|
121
101
|
return value === theme;
|
|
122
102
|
}) ? theme : 'themeS2';
|
|
123
103
|
};
|
|
124
104
|
|
|
125
|
-
var _useState =
|
|
105
|
+
var _useState = useState(getTheme()),
|
|
126
106
|
_useState2 = _slicedToArray(_useState, 2),
|
|
127
107
|
theme = _useState2[0],
|
|
128
108
|
setTheme = _useState2[1];
|
|
129
109
|
|
|
130
110
|
var changeTheme = function changeTheme(theme) {
|
|
131
111
|
setTheme(theme);
|
|
132
|
-
|
|
112
|
+
setThemeStore(theme);
|
|
133
113
|
onThemeChange(theme);
|
|
134
114
|
};
|
|
135
115
|
|
|
136
116
|
var getLanguage = function getLanguage() {
|
|
137
|
-
var lang =
|
|
117
|
+
var lang = getLanguageStore() || props.language;
|
|
138
118
|
|
|
139
119
|
if (!languagesMap[lang]) {
|
|
140
|
-
lang =
|
|
120
|
+
lang = get(languages, '0.value');
|
|
141
121
|
}
|
|
142
122
|
|
|
143
123
|
return lang;
|
|
144
124
|
};
|
|
145
125
|
|
|
146
|
-
var _useState3 =
|
|
126
|
+
var _useState3 = useState(getLanguage()),
|
|
147
127
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
148
128
|
_useState4$ = _useState4[0],
|
|
149
129
|
language = _useState4$ === void 0 ? 'cn' : _useState4$,
|
|
@@ -151,7 +131,7 @@ var ThemeContent = function ThemeContent(props) {
|
|
|
151
131
|
|
|
152
132
|
var changeLanguage = function changeLanguage(language) {
|
|
153
133
|
setLanguage(language);
|
|
154
|
-
|
|
134
|
+
setLanguageStore(language);
|
|
155
135
|
onLanguageChange(language);
|
|
156
136
|
};
|
|
157
137
|
|
|
@@ -163,7 +143,7 @@ var ThemeContent = function ThemeContent(props) {
|
|
|
163
143
|
onClick: changeTheme.bind(_this, value)
|
|
164
144
|
}, React.createElement("img", {
|
|
165
145
|
src: img
|
|
166
|
-
}), theme === value && React.createElement(
|
|
146
|
+
}), theme === value && React.createElement(Icon, {
|
|
167
147
|
type: "check1"
|
|
168
148
|
}));
|
|
169
149
|
})), themeVisible && languageVisible && React.createElement("div", {
|
|
@@ -172,7 +152,7 @@ var ThemeContent = function ThemeContent(props) {
|
|
|
172
152
|
var value = _ref4.value,
|
|
173
153
|
name = _ref4.name;
|
|
174
154
|
return React.createElement("div", {
|
|
175
|
-
className: (
|
|
155
|
+
className: cn({
|
|
176
156
|
active: value === language
|
|
177
157
|
}),
|
|
178
158
|
key: value,
|
|
@@ -181,21 +161,19 @@ var ThemeContent = function ThemeContent(props) {
|
|
|
181
161
|
})));
|
|
182
162
|
};
|
|
183
163
|
|
|
184
|
-
|
|
164
|
+
export default (function (props) {
|
|
185
165
|
var config = props.config;
|
|
186
166
|
|
|
187
167
|
if ((config == null ? void 0 : config.language) === false && (config == null ? void 0 : config.theme) === false) {
|
|
188
168
|
return null;
|
|
189
169
|
}
|
|
190
170
|
|
|
191
|
-
return React.createElement(Theme, null, React.createElement(
|
|
171
|
+
return React.createElement(Theme, null, React.createElement(_Popover, {
|
|
192
172
|
placement: "bottomRight",
|
|
193
173
|
title: null,
|
|
194
174
|
content: React.createElement(ThemeContent, props),
|
|
195
175
|
trigger: "click"
|
|
196
|
-
}, React.createElement(
|
|
176
|
+
}, React.createElement(Icon, {
|
|
197
177
|
type: "daxiaoxie"
|
|
198
178
|
})));
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
exports["default"] = _default;
|
|
179
|
+
});
|