tntd 1.4.23 → 1.4.26
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 +22 -21
- package/components/QueryForm/Field/SelectInput.js +1 -0
- package/dist/stats.json +5057 -5057
- package/dist/tntd.js +1 -1
- package/es/ArrayInput/icon.js +11 -3
- package/es/ArrayInput/index.js +67 -57
- package/es/AuthContext.js +13 -3
- package/es/Columns/index.js +24 -12
- package/es/DevelopmentLogin/LoginModal.js +29 -22
- package/es/DevelopmentLogin/index.js +29 -13
- package/es/Ellipsis/Svg/CopySVG.js +11 -2
- package/es/Ellipsis/Svg/TickSVG.js +11 -2
- package/es/Ellipsis/index.js +33 -25
- package/es/Handle/README.md +20 -0
- package/es/Handle/index.js +46 -29
- package/es/Icon/fonts/iconfont.js +2 -0
- package/es/Icon/iconList.js +8 -1
- package/es/Icon/index.js +25 -5
- package/es/Img/Contain.js +21 -8
- package/es/Img/Cover.js +29 -11
- package/es/Img/index.js +22 -8
- package/es/Layout/ActionsContext.js +12 -2
- package/es/Layout/AppList.js +58 -42
- package/es/Layout/Application.js +44 -24
- package/es/Layout/Avatar.js +45 -23
- package/es/Layout/CompatibleLanguage.js +51 -29
- package/es/Layout/EnterpriseLayout/Avatar.js +54 -32
- package/es/Layout/EnterpriseLayout/Language.js +39 -15
- package/es/Layout/EnterpriseLayout/Theme.js +31 -15
- package/es/Layout/EnterpriseLayout/index.js +24 -9
- package/es/Layout/GlobalNavigation/NavigationPopup.js +53 -29
- package/es/Layout/GlobalNavigation/index.js +51 -23
- package/es/Layout/Header.js +40 -19
- package/es/Layout/HeaderActions.js +43 -19
- package/es/Layout/HeaderNavs.js +35 -12
- package/es/Layout/HeaderTabs.js +50 -25
- package/es/Layout/Iconfont.js +16 -4
- package/es/Layout/Language.js +38 -14
- package/es/Layout/Layout.js +58 -32
- package/es/Layout/Logo.js +26 -12
- package/es/Layout/OrgAppList.js +52 -36
- package/es/Layout/SideMenu.js +57 -32
- package/es/Layout/Theme.js +39 -21
- package/es/Layout/createActions.js +19 -6
- package/es/Layout/images/index.js +95 -58
- package/es/Layout/index.js +70 -28
- package/es/Layout/paaslayout/CompactSideMenu.js +35 -17
- package/es/Layout/paaslayout/Header.js +31 -17
- package/es/Layout/paaslayout/Logo.js +19 -9
- package/es/Layout/paaslayout/SideMenu.js +29 -12
- package/es/Layout/paaslayout/index.js +58 -32
- package/es/Layout/storage.js +71 -21
- package/es/LoadingButton/index.js +17 -8
- package/es/Modal/index.js +29 -16
- package/es/Page/Box.js +18 -8
- package/es/Page/index.js +47 -29
- package/es/Page/utils.js +12 -1
- package/es/QueryForm/Field/Checkbox.js +13 -5
- package/es/QueryForm/Field/Select.js +28 -12
- package/es/QueryForm/Field/SelectInput.js +35 -19
- package/es/QueryForm/Field/fieldsMap.js +36 -23
- package/es/QueryForm/Field/index.js +25 -12
- package/es/QueryForm/createActions.js +20 -7
- package/es/QueryForm/index.js +66 -50
- package/es/QueryForm/useForm.js +16 -4
- package/es/QueryListScene/List.js +43 -30
- package/es/QueryListScene/QueryForm.js +21 -9
- package/es/QueryListScene/QueryListScene.js +29 -16
- package/es/QueryListScene/Title.js +17 -5
- package/es/QueryListScene/Toolbar.js +16 -4
- package/es/QueryListScene/createActions.js +26 -13
- package/es/QueryListScene/index.js +40 -19
- package/es/QueryListScene/useActions.js +16 -4
- package/es/Select/DropDownWrap.js +18 -6
- package/es/Select/index.js +28 -15
- package/es/Table/ResizableTable/index.js +32 -18
- package/es/Table/index.js +30 -11
- package/es/Title/index.js +18 -5
- package/es/index.js +193 -20
- package/es/locale.js +27 -8
- package/es/utils/checkAuth.js +15 -4
- package/es/utils/findMenuInfoByPath.js +16 -5
- package/es/utils/index.js +70 -10
- package/lib/ArrayInput/index.js +12 -28
- package/lib/Columns/index.js +4 -10
- package/lib/DevelopmentLogin/LoginModal.js +9 -23
- package/lib/Ellipsis/index.js +4 -10
- package/lib/Handle/README.md +20 -0
- package/lib/Handle/index.js +9 -19
- package/lib/Layout/AppList.js +12 -30
- package/lib/Layout/Application.js +3 -5
- package/lib/Layout/Avatar.js +6 -12
- package/lib/Layout/CompatibleLanguage.js +3 -5
- package/lib/Layout/EnterpriseLayout/Avatar.js +8 -18
- package/lib/Layout/EnterpriseLayout/Theme.js +3 -5
- package/lib/Layout/HeaderActions.js +5 -7
- package/lib/Layout/Layout.js +7 -9
- package/lib/Layout/OrgAppList.js +7 -19
- package/lib/Layout/SideMenu.js +7 -9
- package/lib/Layout/Theme.js +3 -5
- package/lib/Layout/paaslayout/index.js +8 -10
- package/lib/LoadingButton/index.js +2 -6
- package/lib/Modal/index.js +3 -5
- package/lib/Page/Box.js +3 -5
- package/lib/QueryForm/Field/Checkbox.js +2 -6
- package/lib/QueryForm/Field/Select.js +4 -8
- package/lib/QueryForm/Field/SelectInput.js +7 -14
- package/lib/QueryForm/Field/fieldsMap.js +8 -18
- package/lib/QueryForm/Field/index.js +3 -7
- package/lib/QueryForm/index.js +13 -27
- package/lib/QueryListScene/List.js +5 -7
- package/lib/Select/index.js +8 -14
- package/lib/Table/ResizableTable/index.js +3 -5
- package/lib/Table/index.js +5 -7
- package/package.json +1 -1
- package/es/Layout/checkAuth.js +0 -29
- package/es/Layout/utils.js +0 -136
- package/lib/Layout/EnterpriseLayout/Header.js +0 -113
- package/lib/Layout/EnterpriseLayout/HeaderActions.js +0 -104
- package/lib/Layout/checkAuth.js +0 -39
- package/lib/Layout/utils.js +0 -166
package/es/Layout/AppList.js
CHANGED
|
@@ -1,15 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var
|
|
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 _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; }
|
|
13
31
|
|
|
14
32
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
|
|
15
33
|
|
|
@@ -61,36 +79,32 @@ function _templateObject() {
|
|
|
61
79
|
|
|
62
80
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
63
81
|
|
|
64
|
-
|
|
65
|
-
|
|
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
|
|
82
|
+
var Option = _antd.Select.Option;
|
|
83
|
+
var MenuList = (0, _styledComponents["default"])(_antd.Menu)(_templateObject()); // 新版UI
|
|
72
84
|
|
|
73
|
-
var AppsSelect =
|
|
85
|
+
var AppsSelect = (0, _styledComponents["default"])(_antd.Select)(_templateObject2(), function (props) {
|
|
74
86
|
return "".concat(props.theme.blueBgColor, " !important");
|
|
75
87
|
});
|
|
76
|
-
var AppTreeSelect =
|
|
77
|
-
|
|
88
|
+
var AppTreeSelect = (0, _styledComponents["default"])(_antd.TreeSelect)(_templateObject3());
|
|
89
|
+
|
|
90
|
+
var SwitchAppMenu = _styledComponents["default"].a(_templateObject4(), function (props) {
|
|
78
91
|
return "".concat(props.theme.headerHeight, "px");
|
|
79
92
|
}, function (props) {
|
|
80
93
|
return "".concat(props.theme.size === 'large' ? 16 : 14, "px");
|
|
81
94
|
});
|
|
82
|
-
|
|
95
|
+
|
|
96
|
+
var _default = (0, _styledComponents.withTheme)(function (props) {
|
|
83
97
|
var selectedKey = props.selectedKey,
|
|
84
98
|
_props$items = props.items,
|
|
85
99
|
items = _props$items === void 0 ? [] : _props$items,
|
|
86
100
|
onChange = props.onChange;
|
|
87
101
|
|
|
88
102
|
var getInitialSelectedApp = function getInitialSelectedApp() {
|
|
89
|
-
var currentAppStore = getCurrentAppStore();
|
|
103
|
+
var currentAppStore = (0, _storage.getCurrentAppStore)();
|
|
90
104
|
|
|
91
105
|
var findAppByKey = function findAppByKey(selectedKey) {
|
|
92
106
|
var findApp;
|
|
93
|
-
traverseTree(items, function (item) {
|
|
107
|
+
(0, _utils.traverseTree)(items, function (item) {
|
|
94
108
|
if (item.key === selectedKey) {
|
|
95
109
|
findApp = item;
|
|
96
110
|
return false;
|
|
@@ -99,33 +113,33 @@ export default withTheme(function (props) {
|
|
|
99
113
|
return findApp;
|
|
100
114
|
};
|
|
101
115
|
|
|
102
|
-
var currentApp = findAppByKey(selectedKey || get(currentAppStore, 'key'));
|
|
116
|
+
var currentApp = findAppByKey(selectedKey || (0, _lodash.get)(currentAppStore, 'key'));
|
|
103
117
|
return currentApp || items[0];
|
|
104
118
|
};
|
|
105
119
|
|
|
106
120
|
var changeApp = function changeApp(app) {
|
|
107
121
|
setSelectedApp(app);
|
|
108
|
-
setCurrentAppStore(app);
|
|
122
|
+
(0, _storage.setCurrentAppStore)(app);
|
|
109
123
|
onChange && onChange(app);
|
|
110
124
|
};
|
|
111
125
|
|
|
112
|
-
var _useState = useState(),
|
|
126
|
+
var _useState = (0, _react.useState)(),
|
|
113
127
|
_useState2 = _slicedToArray(_useState, 2),
|
|
114
128
|
searchValue = _useState2[0],
|
|
115
129
|
setSearchValue = _useState2[1];
|
|
116
130
|
|
|
117
|
-
var _useState3 = useState(getInitialSelectedApp()),
|
|
131
|
+
var _useState3 = (0, _react.useState)(getInitialSelectedApp()),
|
|
118
132
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
119
133
|
selectedApp = _useState4[0],
|
|
120
134
|
setSelectedApp = _useState4[1];
|
|
121
135
|
|
|
122
136
|
var Menus = React.createElement(MenuList, {
|
|
123
|
-
selectedKeys: [get(selectedApp, 'key')]
|
|
124
|
-
}, React.createElement(
|
|
137
|
+
selectedKeys: [(0, _lodash.get)(selectedApp, 'key')]
|
|
138
|
+
}, React.createElement(_antd.Menu.Item, {
|
|
125
139
|
className: "app-search-warp",
|
|
126
140
|
key: "search",
|
|
127
141
|
disabled: true
|
|
128
|
-
}, React.createElement(
|
|
142
|
+
}, React.createElement(_antd.Input, {
|
|
129
143
|
allowClear: true,
|
|
130
144
|
placeholder: "\u8F93\u5165\u5173\u952E\u8BCD\u641C\u7D22",
|
|
131
145
|
value: searchValue,
|
|
@@ -145,12 +159,12 @@ export default withTheme(function (props) {
|
|
|
145
159
|
|
|
146
160
|
return true;
|
|
147
161
|
}).map(function (item) {
|
|
148
|
-
return React.createElement(
|
|
162
|
+
return React.createElement(_antd.Menu.Item, {
|
|
149
163
|
key: item.key,
|
|
150
164
|
onClick: changeApp.bind(_this, item)
|
|
151
165
|
}, item.name);
|
|
152
166
|
}));
|
|
153
|
-
useEffect(function () {
|
|
167
|
+
(0, _react.useEffect)(function () {
|
|
154
168
|
var newApp = getInitialSelectedApp();
|
|
155
169
|
|
|
156
170
|
if ((newApp == null ? void 0 : newApp.key) !== (selectedApp == null ? void 0 : selectedApp.key)) {
|
|
@@ -173,8 +187,8 @@ export default withTheme(function (props) {
|
|
|
173
187
|
dropdownStyle: {
|
|
174
188
|
maxHeight: 560
|
|
175
189
|
},
|
|
176
|
-
value: get(selectedApp, 'key'),
|
|
177
|
-
treeData: traverseTree(items, function (item) {
|
|
190
|
+
value: (0, _lodash.get)(selectedApp, 'key'),
|
|
191
|
+
treeData: (0, _utils.traverseTree)(items, function (item) {
|
|
178
192
|
item.title = item.name;
|
|
179
193
|
item.value = item.key;
|
|
180
194
|
item.selectable = !item.children;
|
|
@@ -182,7 +196,7 @@ export default withTheme(function (props) {
|
|
|
182
196
|
}),
|
|
183
197
|
onChange: function onChange(appKey) {
|
|
184
198
|
var findItem;
|
|
185
|
-
traverseTree(items, function (node) {
|
|
199
|
+
(0, _utils.traverseTree)(items, function (node) {
|
|
186
200
|
if (node.key === appKey) {
|
|
187
201
|
findItem = node;
|
|
188
202
|
return false;
|
|
@@ -202,7 +216,7 @@ export default withTheme(function (props) {
|
|
|
202
216
|
placeholder: "\u8BF7\u9009\u62E9",
|
|
203
217
|
showSearch: true,
|
|
204
218
|
optionFilterProp: "children",
|
|
205
|
-
value: get(selectedApp, 'key'),
|
|
219
|
+
value: (0, _lodash.get)(selectedApp, 'key'),
|
|
206
220
|
onChange: function onChange(appKey) {
|
|
207
221
|
changeApp(items.find(function (_ref2) {
|
|
208
222
|
var key = _ref2.key;
|
|
@@ -224,10 +238,12 @@ export default withTheme(function (props) {
|
|
|
224
238
|
}));
|
|
225
239
|
}
|
|
226
240
|
|
|
227
|
-
return React.createElement(
|
|
241
|
+
return React.createElement(_antd.Dropdown, {
|
|
228
242
|
overlay: Menus,
|
|
229
243
|
trigger: ['click']
|
|
230
|
-
}, React.createElement(SwitchAppMenu, null, React.createElement("span", null, get(selectedApp, 'name', '请选择')), React.createElement(
|
|
244
|
+
}, React.createElement(SwitchAppMenu, null, React.createElement("span", null, (0, _lodash.get)(selectedApp, 'name', '请选择')), React.createElement(_Icon["default"], {
|
|
231
245
|
type: "caret-down"
|
|
232
246
|
})));
|
|
233
|
-
});
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
exports["default"] = _default;
|
package/es/Layout/Application.js
CHANGED
|
@@ -1,7 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
import _Popover from "antd/lib/popover";
|
|
1
|
+
"use strict";
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
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 }; }
|
|
5
27
|
|
|
6
28
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
|
|
7
29
|
|
|
@@ -53,24 +75,20 @@ function _templateObject() {
|
|
|
53
75
|
|
|
54
76
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
55
77
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
var App = styled.li(_templateObject());
|
|
64
|
-
var AppList = styled.ul(_templateObject2());
|
|
65
|
-
var AppItem = styled.li(_templateObject3());
|
|
66
|
-
var AppContentWrapper = styled.div(_templateObject4());
|
|
78
|
+
var App = _styledComponents["default"].li(_templateObject());
|
|
79
|
+
|
|
80
|
+
var AppList = _styledComponents["default"].ul(_templateObject2());
|
|
81
|
+
|
|
82
|
+
var AppItem = _styledComponents["default"].li(_templateObject3());
|
|
83
|
+
|
|
84
|
+
var AppContentWrapper = _styledComponents["default"].div(_templateObject4());
|
|
67
85
|
|
|
68
86
|
var AppContent = function AppContent(props) {
|
|
69
87
|
var language = props.language,
|
|
70
88
|
apps = props.apps,
|
|
71
89
|
onChange = props.onChange;
|
|
72
90
|
|
|
73
|
-
var _useState = useState(props.appKey),
|
|
91
|
+
var _useState = (0, _react.useState)(props.appKey),
|
|
74
92
|
_useState2 = _slicedToArray(_useState, 2),
|
|
75
93
|
appKey = _useState2[0],
|
|
76
94
|
setAppKey = _useState2[1];
|
|
@@ -81,35 +99,37 @@ var AppContent = function AppContent(props) {
|
|
|
81
99
|
};
|
|
82
100
|
|
|
83
101
|
return React.createElement(AppContentWrapper, null, React.createElement(AppList, null, apps.sort(function (a, b) {
|
|
84
|
-
return get(
|
|
102
|
+
return (0, _lodash.get)(_logoIcon.systemMap, "".concat(a.appKey, ".sort"), 1) - (0, _lodash.get)(_logoIcon.systemMap, "".concat(b.appKey, ".sort"), 1);
|
|
85
103
|
}).map(function (_ref) {
|
|
86
104
|
var key = _ref.appKey;
|
|
87
105
|
return React.createElement(AppItem, {
|
|
88
106
|
key: key,
|
|
89
|
-
className:
|
|
107
|
+
className: (0, _classnames["default"])({
|
|
90
108
|
active: appKey === key
|
|
91
109
|
}),
|
|
92
110
|
onClick: changeApp.bind(_this, key)
|
|
93
111
|
}, React.createElement("img", {
|
|
94
|
-
src: get(
|
|
112
|
+
src: (0, _lodash.get)(_logoIcon.systemMap, "".concat(key, ".logo"), _images.defaultLogo),
|
|
95
113
|
onError: function onError(e) {
|
|
96
114
|
e.target.onerror = null;
|
|
97
|
-
e.target.src = defaultLogo;
|
|
115
|
+
e.target.src = _images.defaultLogo;
|
|
98
116
|
}
|
|
99
|
-
}), React.createElement("div", null, get(
|
|
117
|
+
}), React.createElement("div", null, (0, _lodash.get)(_logoIcon.systemMap, "".concat(key, ".").concat({
|
|
100
118
|
cn: 'name',
|
|
101
119
|
en: 'enName'
|
|
102
120
|
}[language || 'cn']), key)));
|
|
103
121
|
})));
|
|
104
122
|
};
|
|
105
123
|
|
|
106
|
-
|
|
107
|
-
return React.createElement(App, null, React.createElement(
|
|
124
|
+
var _default = function _default(props) {
|
|
125
|
+
return React.createElement(App, null, React.createElement(_antd.Popover, {
|
|
108
126
|
placement: "bottomRight",
|
|
109
127
|
title: null,
|
|
110
128
|
content: React.createElement(AppContent, props),
|
|
111
129
|
trigger: "click"
|
|
112
|
-
}, React.createElement(
|
|
130
|
+
}, React.createElement(_Iconfont["default"], {
|
|
113
131
|
type: "application"
|
|
114
132
|
})));
|
|
115
|
-
}
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
exports["default"] = _default;
|
package/es/Layout/Avatar.js
CHANGED
|
@@ -1,7 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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 _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; }
|
|
5
29
|
|
|
6
30
|
function _templateObject3() {
|
|
7
31
|
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"]);
|
|
@@ -35,15 +59,11 @@ function _templateObject() {
|
|
|
35
59
|
|
|
36
60
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
37
61
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
import { clearLoginCookie } from './storage';
|
|
44
|
-
var Avatar = styled.li(_templateObject());
|
|
45
|
-
var GlobalStyle = createGlobalStyle(_templateObject2());
|
|
46
|
-
var UserInfoWrapper = styled.div(_templateObject3());
|
|
62
|
+
var Avatar = _styledComponents["default"].li(_templateObject());
|
|
63
|
+
|
|
64
|
+
var GlobalStyle = (0, _styledComponents.createGlobalStyle)(_templateObject2());
|
|
65
|
+
|
|
66
|
+
var UserInfoWrapper = _styledComponents["default"].div(_templateObject3());
|
|
47
67
|
|
|
48
68
|
var UserInfoContent = function UserInfoContent(props) {
|
|
49
69
|
var userInfo = props.userInfo,
|
|
@@ -57,7 +77,7 @@ var UserInfoContent = function UserInfoContent(props) {
|
|
|
57
77
|
return true;
|
|
58
78
|
} : _props$onPersonalSett;
|
|
59
79
|
|
|
60
|
-
var _useContext = useContext(
|
|
80
|
+
var _useContext = (0, _react.useContext)(_ActionsContext["default"]),
|
|
61
81
|
getText = _useContext.getText;
|
|
62
82
|
|
|
63
83
|
return React.createElement(UserInfoWrapper, {
|
|
@@ -76,41 +96,43 @@ var UserInfoContent = function UserInfoContent(props) {
|
|
|
76
96
|
href: "/bridge/userCenter?currentTab=2"
|
|
77
97
|
}, getText('changePwd'))), React.createElement("div", {
|
|
78
98
|
className: "user-info-footer"
|
|
79
|
-
}, React.createElement(
|
|
99
|
+
}, React.createElement(_antd.Button, {
|
|
80
100
|
className: "user-info-footer-signout",
|
|
81
101
|
onClick: function onClick() {
|
|
82
102
|
if (onLogout) {
|
|
83
103
|
onLogout();
|
|
84
|
-
clearLoginCookie();
|
|
104
|
+
(0, _storage.clearLoginCookie)();
|
|
85
105
|
} else {
|
|
86
|
-
clearLoginCookie();
|
|
106
|
+
(0, _storage.clearLoginCookie)();
|
|
87
107
|
window.location.href = "/user/login?callbackUrl=".concat(window.encodeURI(location.href));
|
|
88
108
|
}
|
|
89
109
|
}
|
|
90
110
|
}, React.createElement("a", null, getText('signOut')))));
|
|
91
111
|
};
|
|
92
112
|
|
|
93
|
-
|
|
113
|
+
var _default = function _default(props) {
|
|
94
114
|
var _images$empty2;
|
|
95
115
|
|
|
96
116
|
var _props$userInfo = props.userInfo,
|
|
97
117
|
userInfo = _props$userInfo === void 0 ? {} : _props$userInfo;
|
|
98
118
|
var avatar = userInfo.avatar;
|
|
99
|
-
return React.createElement(Avatar, null, React.createElement(
|
|
119
|
+
return React.createElement(Avatar, null, React.createElement(_antd.Popover, {
|
|
100
120
|
popupClassName: "tnt-layout-personal-popover",
|
|
101
121
|
placement: "bottomRight",
|
|
102
122
|
title: null,
|
|
103
123
|
content: React.createElement(UserInfoContent, props),
|
|
104
124
|
trigger: "click"
|
|
105
125
|
}, avatar ? React.createElement("img", {
|
|
106
|
-
src: avatar.indexOf('base64') > 0 ? avatar : get(
|
|
126
|
+
src: avatar.indexOf('base64') > 0 ? avatar : (0, _lodash.get)(_images["default"][avatar], 'default', _images["default"][avatar]),
|
|
107
127
|
onError: function onError(e) {
|
|
108
128
|
var _images$empty;
|
|
109
129
|
|
|
110
130
|
e.target.onerror = null;
|
|
111
|
-
e.target.src = ((_images$empty =
|
|
131
|
+
e.target.src = ((_images$empty = _images["default"].empty) == null ? void 0 : _images$empty["default"]) || _images["default"].empty;
|
|
112
132
|
}
|
|
113
133
|
}) : React.createElement("img", {
|
|
114
|
-
src: ((_images$empty2 =
|
|
134
|
+
src: ((_images$empty2 = _images["default"].empty) == null ? void 0 : _images$empty2["default"]) || _images["default"].empty
|
|
115
135
|
})), React.createElement(GlobalStyle, null));
|
|
116
|
-
}
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
exports["default"] = _default;
|
|
@@ -1,7 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
import _Popover from "antd/lib/popover";
|
|
1
|
+
"use strict";
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
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 }; }
|
|
5
27
|
|
|
6
28
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
|
|
7
29
|
|
|
@@ -53,13 +75,6 @@ function _templateObject() {
|
|
|
53
75
|
|
|
54
76
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
55
77
|
|
|
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';
|
|
63
78
|
var languages = [{
|
|
64
79
|
value: 'cn',
|
|
65
80
|
name: '中文'
|
|
@@ -71,16 +86,21 @@ var languagesMap = languages.reduce(function (acc, cur) {
|
|
|
71
86
|
acc[cur.value] = cur;
|
|
72
87
|
return acc;
|
|
73
88
|
}, {});
|
|
74
|
-
|
|
75
|
-
var
|
|
76
|
-
|
|
77
|
-
var
|
|
89
|
+
|
|
90
|
+
var LanguageSwitch = _styledComponents["default"].div(_templateObject());
|
|
91
|
+
|
|
92
|
+
var Theme = _styledComponents["default"].li(_templateObject2());
|
|
93
|
+
|
|
94
|
+
var ThemeSwitch = _styledComponents["default"].div(_templateObject3());
|
|
95
|
+
|
|
96
|
+
var ThemeContentWrapper = _styledComponents["default"].div(_templateObject4());
|
|
97
|
+
|
|
78
98
|
var themes = [{
|
|
79
99
|
value: 'themeS1',
|
|
80
|
-
img:
|
|
100
|
+
img: _images["default"].themeSymbol1
|
|
81
101
|
}, {
|
|
82
102
|
value: 'themeS2',
|
|
83
|
-
img:
|
|
103
|
+
img: _images["default"].themeSymbol2
|
|
84
104
|
}];
|
|
85
105
|
|
|
86
106
|
var ThemeContent = function ThemeContent(props) {
|
|
@@ -95,35 +115,35 @@ var ThemeContent = function ThemeContent(props) {
|
|
|
95
115
|
themeVisible = _ref$theme === void 0 ? true : _ref$theme;
|
|
96
116
|
|
|
97
117
|
var getTheme = function getTheme() {
|
|
98
|
-
var theme = getThemeStore() || props.theme || 'themeS2';
|
|
118
|
+
var theme = (0, _storage.getThemeStore)() || props.theme || 'themeS2';
|
|
99
119
|
return themes.some(function (_ref2) {
|
|
100
120
|
var value = _ref2.value;
|
|
101
121
|
return value === theme;
|
|
102
122
|
}) ? theme : 'themeS2';
|
|
103
123
|
};
|
|
104
124
|
|
|
105
|
-
var _useState = useState(getTheme()),
|
|
125
|
+
var _useState = (0, _react.useState)(getTheme()),
|
|
106
126
|
_useState2 = _slicedToArray(_useState, 2),
|
|
107
127
|
theme = _useState2[0],
|
|
108
128
|
setTheme = _useState2[1];
|
|
109
129
|
|
|
110
130
|
var changeTheme = function changeTheme(theme) {
|
|
111
131
|
setTheme(theme);
|
|
112
|
-
setThemeStore(theme);
|
|
132
|
+
(0, _storage.setThemeStore)(theme);
|
|
113
133
|
onThemeChange(theme);
|
|
114
134
|
};
|
|
115
135
|
|
|
116
136
|
var getLanguage = function getLanguage() {
|
|
117
|
-
var lang = getLanguageStore() || props.language;
|
|
137
|
+
var lang = (0, _storage.getLanguageStore)() || props.language;
|
|
118
138
|
|
|
119
139
|
if (!languagesMap[lang]) {
|
|
120
|
-
lang = get(languages, '0.value');
|
|
140
|
+
lang = (0, _lodash.get)(languages, '0.value');
|
|
121
141
|
}
|
|
122
142
|
|
|
123
143
|
return lang;
|
|
124
144
|
};
|
|
125
145
|
|
|
126
|
-
var _useState3 = useState(getLanguage()),
|
|
146
|
+
var _useState3 = (0, _react.useState)(getLanguage()),
|
|
127
147
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
128
148
|
_useState4$ = _useState4[0],
|
|
129
149
|
language = _useState4$ === void 0 ? 'cn' : _useState4$,
|
|
@@ -131,7 +151,7 @@ var ThemeContent = function ThemeContent(props) {
|
|
|
131
151
|
|
|
132
152
|
var changeLanguage = function changeLanguage(language) {
|
|
133
153
|
setLanguage(language);
|
|
134
|
-
setLanguageStore(language);
|
|
154
|
+
(0, _storage.setLanguageStore)(language);
|
|
135
155
|
onLanguageChange(language);
|
|
136
156
|
};
|
|
137
157
|
|
|
@@ -143,7 +163,7 @@ var ThemeContent = function ThemeContent(props) {
|
|
|
143
163
|
onClick: changeTheme.bind(_this, value)
|
|
144
164
|
}, React.createElement("img", {
|
|
145
165
|
src: img
|
|
146
|
-
}), theme === value && React.createElement(
|
|
166
|
+
}), theme === value && React.createElement(_Icon["default"], {
|
|
147
167
|
type: "check1"
|
|
148
168
|
}));
|
|
149
169
|
})), themeVisible && languageVisible && React.createElement("div", {
|
|
@@ -152,7 +172,7 @@ var ThemeContent = function ThemeContent(props) {
|
|
|
152
172
|
var value = _ref4.value,
|
|
153
173
|
name = _ref4.name;
|
|
154
174
|
return React.createElement("div", {
|
|
155
|
-
className:
|
|
175
|
+
className: (0, _classnames["default"])({
|
|
156
176
|
active: value === language
|
|
157
177
|
}),
|
|
158
178
|
key: value,
|
|
@@ -161,19 +181,21 @@ var ThemeContent = function ThemeContent(props) {
|
|
|
161
181
|
})));
|
|
162
182
|
};
|
|
163
183
|
|
|
164
|
-
|
|
184
|
+
var _default = function _default(props) {
|
|
165
185
|
var config = props.config;
|
|
166
186
|
|
|
167
187
|
if ((config == null ? void 0 : config.language) === false && (config == null ? void 0 : config.theme) === false) {
|
|
168
188
|
return null;
|
|
169
189
|
}
|
|
170
190
|
|
|
171
|
-
return React.createElement(Theme, null, React.createElement(
|
|
191
|
+
return React.createElement(Theme, null, React.createElement(_antd.Popover, {
|
|
172
192
|
placement: "bottomRight",
|
|
173
193
|
title: null,
|
|
174
194
|
content: React.createElement(ThemeContent, props),
|
|
175
195
|
trigger: "click"
|
|
176
|
-
}, React.createElement(
|
|
196
|
+
}, React.createElement(_Icon["default"], {
|
|
177
197
|
type: "daxiaoxie"
|
|
178
198
|
})));
|
|
179
|
-
}
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
exports["default"] = _default;
|