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/Language.js
CHANGED
|
@@ -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 } 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,15 +69,13 @@ 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
76
|
return React.createElement(Language, {
|
|
99
77
|
onClick: switchLanguage
|
|
100
|
-
}, React.createElement(
|
|
78
|
+
}, React.createElement(Iconfont, {
|
|
101
79
|
type: "flag-".concat(language)
|
|
102
|
-
}), React.createElement("span", null,
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
exports["default"] = _default;
|
|
80
|
+
}), React.createElement("span", null, get(languagesMap[language], 'name')));
|
|
81
|
+
});
|
package/es/Layout/Layout.js
CHANGED
|
@@ -1,37 +1,5 @@
|
|
|
1
|
-
|
|
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 _classnames = _interopRequireDefault(require("classnames"));
|
|
15
|
-
|
|
16
|
-
var _lodash = require("lodash");
|
|
17
|
-
|
|
18
|
-
var _antd = require("antd");
|
|
19
|
-
|
|
20
|
-
var _Icon = _interopRequireDefault(require("../Icon"));
|
|
21
|
-
|
|
22
|
-
var _Header = _interopRequireDefault(require("./Header"));
|
|
23
|
-
|
|
24
|
-
var _Logo = _interopRequireDefault(require("./Logo"));
|
|
25
|
-
|
|
26
|
-
var _SideMenu = _interopRequireDefault(require("./SideMenu"));
|
|
27
|
-
|
|
28
|
-
var _storage = require("./storage");
|
|
29
|
-
|
|
30
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
31
|
-
|
|
32
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
33
|
-
|
|
34
|
-
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/layout/style";
|
|
2
|
+
import _Layout from "antd/lib/layout";
|
|
35
3
|
|
|
36
4
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
37
5
|
|
|
@@ -59,15 +27,23 @@ function _templateObject() {
|
|
|
59
27
|
|
|
60
28
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
61
29
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
30
|
+
import { useState, useEffect } from 'react';
|
|
31
|
+
import styled, { withTheme } from 'styled-components';
|
|
32
|
+
import cn from 'classnames';
|
|
33
|
+
import { isUndefined } from 'lodash';
|
|
34
|
+
import Icon from '../Icon';
|
|
35
|
+
import Header from './Header';
|
|
36
|
+
import Logo from './Logo';
|
|
37
|
+
import SideMenu from './SideMenu';
|
|
38
|
+
import { getSideMenuStore, setSideMenuStore, getLanguageStore, getThemeStore } from './storage';
|
|
39
|
+
var Content = _Layout.Content,
|
|
40
|
+
Sider = _Layout.Sider;
|
|
41
|
+
var TNTLayout = styled(_Layout)(_templateObject(), function (props) {
|
|
65
42
|
return props.theme.primaryTextColor;
|
|
66
43
|
}, function (props) {
|
|
67
44
|
return props.theme.lightBgColor;
|
|
68
45
|
});
|
|
69
|
-
|
|
70
|
-
var _default = (0, _styledComponents.withTheme)(function (props) {
|
|
46
|
+
export default withTheme(function (props) {
|
|
71
47
|
var type = props.type,
|
|
72
48
|
logo = props.logo,
|
|
73
49
|
name = props.name,
|
|
@@ -113,17 +89,17 @@ var _default = (0, _styledComponents.withTheme)(function (props) {
|
|
|
113
89
|
extendMap = _props$extendMap === void 0 ? {} : _props$extendMap,
|
|
114
90
|
AvatarCustom = props.AvatarCustom;
|
|
115
91
|
|
|
116
|
-
var _getSideMenuStore =
|
|
92
|
+
var _getSideMenuStore = getSideMenuStore(),
|
|
117
93
|
storeCollapsed = _getSideMenuStore.collapsed,
|
|
118
94
|
_getSideMenuStore$ope = _getSideMenuStore.openKeys,
|
|
119
95
|
openKeys = _getSideMenuStore$ope === void 0 ? [] : _getSideMenuStore$ope;
|
|
120
96
|
|
|
121
|
-
var _useState =
|
|
97
|
+
var _useState = useState(isUndefined(storeCollapsed) ? props.collapsed : storeCollapsed),
|
|
122
98
|
_useState2 = _slicedToArray(_useState, 2),
|
|
123
99
|
collapsed = _useState2[0],
|
|
124
100
|
setCollapsed = _useState2[1];
|
|
125
101
|
|
|
126
|
-
var _useState3 =
|
|
102
|
+
var _useState3 = useState(function () {
|
|
127
103
|
openKeys = collapsed ? [] : openKeys;
|
|
128
104
|
openKeys = openKeys instanceof Array ? openKeys : [];
|
|
129
105
|
return openKeys;
|
|
@@ -132,31 +108,31 @@ var _default = (0, _styledComponents.withTheme)(function (props) {
|
|
|
132
108
|
openMenuKeys = _useState4[0],
|
|
133
109
|
setOpenMenuKeys = _useState4[1];
|
|
134
110
|
|
|
135
|
-
var _useState5 =
|
|
111
|
+
var _useState5 = useState(props.userInfo || {}),
|
|
136
112
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
137
113
|
userInfo = _useState6[0],
|
|
138
114
|
setUserInfo = _useState6[1];
|
|
139
115
|
|
|
140
|
-
var theme =
|
|
141
|
-
var language =
|
|
116
|
+
var theme = getThemeStore() || (extendMap == null ? void 0 : extendMap.defaultTheme) || userInfo.theme || 'themeS2';
|
|
117
|
+
var language = getLanguageStore() || userInfo.lang || 'cn';
|
|
142
118
|
theme = theme === 'default' ? 'themeS2' : theme;
|
|
143
119
|
|
|
144
120
|
var collapseChangeHandle = function collapseChangeHandle() {
|
|
145
|
-
var _getSideMenuStore2 =
|
|
121
|
+
var _getSideMenuStore2 = getSideMenuStore(),
|
|
146
122
|
_getSideMenuStore2$be = _getSideMenuStore2.beforeOpenKeys,
|
|
147
123
|
beforeOpenKeys = _getSideMenuStore2$be === void 0 ? [] : _getSideMenuStore2$be;
|
|
148
124
|
|
|
149
125
|
var newCollapsed = !collapsed; // 菜单收起:记住当前展开子菜单到store,并收起子菜单
|
|
150
126
|
|
|
151
127
|
if (newCollapsed) {
|
|
152
|
-
|
|
128
|
+
setSideMenuStore({
|
|
153
129
|
collapsed: newCollapsed,
|
|
154
130
|
beforeOpenKeys: openMenuKeys
|
|
155
131
|
});
|
|
156
132
|
setOpenMenuKeys([]);
|
|
157
133
|
} else {
|
|
158
134
|
// 菜单展开:恢复子菜单展开项,并更新到store
|
|
159
|
-
|
|
135
|
+
setSideMenuStore({
|
|
160
136
|
collapsed: newCollapsed,
|
|
161
137
|
openKeys: beforeOpenKeys
|
|
162
138
|
});
|
|
@@ -167,11 +143,11 @@ var _default = (0, _styledComponents.withTheme)(function (props) {
|
|
|
167
143
|
onCollapseChange && onCollapseChange(newCollapsed);
|
|
168
144
|
};
|
|
169
145
|
|
|
170
|
-
|
|
146
|
+
useEffect(function () {
|
|
171
147
|
setUserInfo(props.userInfo);
|
|
172
148
|
}, [props.userInfo]);
|
|
173
149
|
return React.createElement(TNTLayout, {
|
|
174
|
-
className: (
|
|
150
|
+
className: cn("tnt-layout tnt-".concat(theme, " ").concat(props.className || ''), {
|
|
175
151
|
'large-size': props.theme.size === 'large',
|
|
176
152
|
compatible: props.theme.compatible,
|
|
177
153
|
isInIframe: isInIframe,
|
|
@@ -188,14 +164,14 @@ var _default = (0, _styledComponents.withTheme)(function (props) {
|
|
|
188
164
|
collapsed: collapsed,
|
|
189
165
|
width: 220,
|
|
190
166
|
trigger: null
|
|
191
|
-
}, React.createElement(
|
|
167
|
+
}, React.createElement(Logo, {
|
|
192
168
|
language: language,
|
|
193
169
|
logo: logo,
|
|
194
170
|
name: name,
|
|
195
171
|
enName: enName,
|
|
196
172
|
collapsed: collapsed,
|
|
197
173
|
onClick: onLogoClick
|
|
198
|
-
}), React.createElement(
|
|
174
|
+
}), React.createElement(SideMenu, {
|
|
199
175
|
language: language,
|
|
200
176
|
selectedKey: selectedMenuKey,
|
|
201
177
|
menuAlignMode: menuAlignMode,
|
|
@@ -204,7 +180,7 @@ var _default = (0, _styledComponents.withTheme)(function (props) {
|
|
|
204
180
|
openKeys: openMenuKeys,
|
|
205
181
|
onOpenChange: function onOpenChange(keys) {
|
|
206
182
|
if (!collapsed) {
|
|
207
|
-
|
|
183
|
+
setSideMenuStore({
|
|
208
184
|
openKeys: keys,
|
|
209
185
|
beforeOpenKeys: keys
|
|
210
186
|
});
|
|
@@ -220,9 +196,9 @@ var _default = (0, _styledComponents.withTheme)(function (props) {
|
|
|
220
196
|
}), collapseIconPlacement === 'bottom' && React.createElement("div", {
|
|
221
197
|
className: "tnt-layout-menu-collapse",
|
|
222
198
|
onClick: collapseChangeHandle
|
|
223
|
-
}, React.createElement(
|
|
199
|
+
}, React.createElement(Icon, {
|
|
224
200
|
type: "menu-".concat(collapsed ? 'unfold' : 'fold')
|
|
225
|
-
}))), React.createElement(Content, null, React.createElement(
|
|
201
|
+
}))), React.createElement(Content, null, React.createElement(Header, {
|
|
226
202
|
type: type,
|
|
227
203
|
userInfo: userInfo,
|
|
228
204
|
config: config,
|
|
@@ -258,6 +234,4 @@ var _default = (0, _styledComponents.withTheme)(function (props) {
|
|
|
258
234
|
onChangePassword: onChangePassword,
|
|
259
235
|
onLogout: onLogout
|
|
260
236
|
}, headerNavs), props.children));
|
|
261
|
-
});
|
|
262
|
-
|
|
263
|
-
exports["default"] = _default;
|
|
237
|
+
});
|
package/es/Layout/Logo.js
CHANGED
|
@@ -1,20 +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 _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
11
|
-
|
|
12
|
-
var _images = require("./images");
|
|
13
|
-
|
|
14
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
15
|
-
|
|
16
|
-
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; }
|
|
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 _templateObject() {
|
|
@@ -29,7 +12,13 @@ function _templateObject() {
|
|
|
29
12
|
|
|
30
13
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
31
14
|
|
|
32
|
-
|
|
15
|
+
/**
|
|
16
|
+
* @file Logo
|
|
17
|
+
* @author zhangyou
|
|
18
|
+
*/
|
|
19
|
+
import styled, { withTheme } from 'styled-components';
|
|
20
|
+
import { logoImgMap } from './images';
|
|
21
|
+
var Logo = styled.div(_templateObject(), function (props) {
|
|
33
22
|
return "".concat(props.theme.headerHeight, "px");
|
|
34
23
|
}, function (props) {
|
|
35
24
|
return "".concat(props.theme.headerHeight, "px");
|
|
@@ -39,7 +28,6 @@ var Logo = _styledComponents["default"].div(_templateObject(), function (props)
|
|
|
39
28
|
return "".concat(props.theme.blueBgColor, " !important");
|
|
40
29
|
}); // JS判断字符串长度(英文占1个字符,中文汉字占2个字符)
|
|
41
30
|
|
|
42
|
-
|
|
43
31
|
var getStrLen = function getStrLen() {
|
|
44
32
|
var str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
45
33
|
var len = 0;
|
|
@@ -58,7 +46,7 @@ var getStrLen = function getStrLen() {
|
|
|
58
46
|
return len;
|
|
59
47
|
};
|
|
60
48
|
|
|
61
|
-
|
|
49
|
+
export default withTheme(function (props) {
|
|
62
50
|
var _logo$props;
|
|
63
51
|
|
|
64
52
|
var logo = props.logo,
|
|
@@ -80,7 +68,7 @@ var _default = (0, _styledComponents.withTheme)(function (props) {
|
|
|
80
68
|
return React.createElement("img", _extends({
|
|
81
69
|
onError: function onError(e) {
|
|
82
70
|
e.target.onerror = null;
|
|
83
|
-
e.target.src =
|
|
71
|
+
e.target.src = logoImgMap["default"];
|
|
84
72
|
}
|
|
85
73
|
}, props));
|
|
86
74
|
};
|
|
@@ -88,13 +76,11 @@ var _default = (0, _styledComponents.withTheme)(function (props) {
|
|
|
88
76
|
return React.createElement(Logo, _extends({}, props, {
|
|
89
77
|
fontSize: fontSize
|
|
90
78
|
}), typeof logo === 'string' ? React.createElement(LogoImg, {
|
|
91
|
-
src:
|
|
79
|
+
src: logoImgMap[logo] || logoImgMap["default"]
|
|
92
80
|
}) : logo && logo.type === 'img' ? React.createElement(LogoImg, _extends({}, logo.props, {
|
|
93
|
-
src: ((_logo$props = logo.props) == null ? void 0 : _logo$props.src) ||
|
|
81
|
+
src: ((_logo$props = logo.props) == null ? void 0 : _logo$props.src) || logoImgMap["default"]
|
|
94
82
|
})) : logo, collapsed ? '' : {
|
|
95
83
|
cn: name,
|
|
96
84
|
en: enName
|
|
97
85
|
}[language]);
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
exports["default"] = _default;
|
|
86
|
+
});
|
package/es/Layout/OrgAppList.js
CHANGED
|
@@ -1,27 +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 _storage = require("./storage");
|
|
19
|
-
|
|
20
|
-
var _utils = require("../utils");
|
|
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; }
|
|
1
|
+
import "antd/lib/tree-select/style";
|
|
2
|
+
import _TreeSelect from "antd/lib/tree-select";
|
|
3
|
+
import "antd/lib/select/style";
|
|
4
|
+
import _Select from "antd/lib/select";
|
|
5
|
+
import "antd/lib/input/style";
|
|
6
|
+
import _Input from "antd/lib/input";
|
|
25
7
|
|
|
26
8
|
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); }
|
|
27
9
|
|
|
@@ -71,19 +53,23 @@ function _templateObject() {
|
|
|
71
53
|
|
|
72
54
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
73
55
|
|
|
74
|
-
|
|
75
|
-
|
|
56
|
+
import { useState, useEffect } from 'react';
|
|
57
|
+
import styled, { withTheme, createGlobalStyle } from 'styled-components';
|
|
58
|
+
import { get } from 'lodash';
|
|
59
|
+
import { getCurrentAppStore, setCurrentAppStore, getCurrentOrgStore, setCurrentOrgStore, getCurrentOrgTreeStore, setCurrentOrgTreeStore } from './storage';
|
|
60
|
+
import { traverseTree } from '../utils';
|
|
61
|
+
var InputGroup = _Input.Group;
|
|
62
|
+
var Option = _Select.Option; // 机构+应用UI
|
|
76
63
|
|
|
77
|
-
var OrgAppsInputGroup = (
|
|
64
|
+
var OrgAppsInputGroup = styled(InputGroup)(_templateObject(), function (props) {
|
|
78
65
|
return "".concat(props.theme.blueBgColor, " !important");
|
|
79
66
|
}); // 只展示机构
|
|
80
67
|
|
|
81
|
-
var AppTreeSelect = (
|
|
68
|
+
var AppTreeSelect = styled(_TreeSelect)(_templateObject2(), function (props) {
|
|
82
69
|
return "".concat(props.theme.blueBgColor, " !important");
|
|
83
70
|
});
|
|
84
|
-
var GlobalStyle =
|
|
85
|
-
|
|
86
|
-
var _default = (0, _styledComponents.withTheme)(function (props) {
|
|
71
|
+
var GlobalStyle = createGlobalStyle(_templateObject3());
|
|
72
|
+
export default withTheme(function (props) {
|
|
87
73
|
var orgAppShow = props.orgAppShow,
|
|
88
74
|
selectedOrgKey = props.selectedOrgKey,
|
|
89
75
|
orgList = props.orgList,
|
|
@@ -94,7 +80,7 @@ var _default = (0, _styledComponents.withTheme)(function (props) {
|
|
|
94
80
|
orgAppList = _props$orgAppList === void 0 ? [] : _props$orgAppList,
|
|
95
81
|
onAppChange = props.onAppChange,
|
|
96
82
|
headerTabs = props.headerTabs;
|
|
97
|
-
var orgListFormatData =
|
|
83
|
+
var orgListFormatData = traverseTree([orgList], function (item) {
|
|
98
84
|
item.title = item.name;
|
|
99
85
|
item.value = item.uuid;
|
|
100
86
|
item.key = item.uuid;
|
|
@@ -103,7 +89,7 @@ var _default = (0, _styledComponents.withTheme)(function (props) {
|
|
|
103
89
|
var getInitialSelected = function getInitialSelected(selectedKey, currentStore, dataList, type) {
|
|
104
90
|
var findByKey = function findByKey(selectedKey) {
|
|
105
91
|
var find;
|
|
106
|
-
|
|
92
|
+
traverseTree(dataList, function (item) {
|
|
107
93
|
if (item.key === selectedKey) {
|
|
108
94
|
find = item;
|
|
109
95
|
return false;
|
|
@@ -112,7 +98,7 @@ var _default = (0, _styledComponents.withTheme)(function (props) {
|
|
|
112
98
|
return find;
|
|
113
99
|
};
|
|
114
100
|
|
|
115
|
-
var current = findByKey(selectedKey ||
|
|
101
|
+
var current = findByKey(selectedKey || get(currentStore, 'key'));
|
|
116
102
|
|
|
117
103
|
if (type) {
|
|
118
104
|
return current;
|
|
@@ -132,26 +118,26 @@ var _default = (0, _styledComponents.withTheme)(function (props) {
|
|
|
132
118
|
value: res.uuid
|
|
133
119
|
};
|
|
134
120
|
});
|
|
135
|
-
|
|
121
|
+
setCurrentOrgTreeStore(temp);
|
|
136
122
|
return temp;
|
|
137
123
|
}
|
|
138
124
|
}; // 初始化值
|
|
139
125
|
// 机构
|
|
140
126
|
|
|
141
127
|
|
|
142
|
-
var _useState =
|
|
128
|
+
var _useState = useState(getInitialSelected(selectedOrgKey, getCurrentOrgStore(), orgListFormatData)),
|
|
143
129
|
_useState2 = _slicedToArray(_useState, 2),
|
|
144
130
|
selectedOrg = _useState2[0],
|
|
145
131
|
setSelectedOrg = _useState2[1]; // 机构树
|
|
146
132
|
|
|
147
133
|
|
|
148
|
-
var _useState3 =
|
|
134
|
+
var _useState3 = useState(getInitialSelectedTree(getCurrentOrgTreeStore(), orgListFormatData)),
|
|
149
135
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
150
136
|
selectedOrgTree = _useState4[0],
|
|
151
137
|
setSelectedOrgTree = _useState4[1]; // 应用
|
|
152
138
|
|
|
153
139
|
|
|
154
|
-
var _useState5 =
|
|
140
|
+
var _useState5 = useState(getInitialSelected(selectedAppKey, getCurrentAppStore(), orgAppList, 'default')),
|
|
155
141
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
156
142
|
selectedApp = _useState6[0],
|
|
157
143
|
setSelectedApp = _useState6[1]; // org变化事件
|
|
@@ -160,7 +146,7 @@ var _default = (0, _styledComponents.withTheme)(function (props) {
|
|
|
160
146
|
var changeOrg = function changeOrg() {
|
|
161
147
|
var org = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
162
148
|
setSelectedOrg(org);
|
|
163
|
-
|
|
149
|
+
setCurrentOrgStore({
|
|
164
150
|
name: org == null ? void 0 : org.name,
|
|
165
151
|
key: org == null ? void 0 : org.key,
|
|
166
152
|
code: org == null ? void 0 : org.code
|
|
@@ -181,27 +167,27 @@ var _default = (0, _styledComponents.withTheme)(function (props) {
|
|
|
181
167
|
}
|
|
182
168
|
|
|
183
169
|
setSelectedOrgTree(val);
|
|
184
|
-
|
|
170
|
+
setCurrentOrgTreeStore(val);
|
|
185
171
|
onOrgChange && onOrgChange(val);
|
|
186
172
|
}; // app变化事件
|
|
187
173
|
|
|
188
174
|
|
|
189
175
|
var changeApp = function changeApp(app) {
|
|
190
176
|
setSelectedApp(app);
|
|
191
|
-
|
|
177
|
+
setCurrentAppStore(app);
|
|
192
178
|
onAppChange && onAppChange(app);
|
|
193
179
|
};
|
|
194
180
|
|
|
195
|
-
|
|
181
|
+
useEffect(function () {
|
|
196
182
|
// 监听org机构
|
|
197
|
-
var newOrg = getInitialSelected(selectedOrgKey,
|
|
183
|
+
var newOrg = getInitialSelected(selectedOrgKey, getCurrentOrgStore(), orgListFormatData);
|
|
198
184
|
|
|
199
185
|
if ((newOrg == null ? void 0 : newOrg.key) !== (selectedOrg == null ? void 0 : selectedOrg.key)) {
|
|
200
186
|
changeOrg(newOrg);
|
|
201
187
|
} // 监听应用
|
|
202
188
|
|
|
203
189
|
|
|
204
|
-
var newApp = getInitialSelected(selectedAppKey,
|
|
190
|
+
var newApp = getInitialSelected(selectedAppKey, getCurrentAppStore(), orgAppList);
|
|
205
191
|
|
|
206
192
|
if ((newApp == null ? void 0 : newApp.key) !== (selectedApp == null ? void 0 : selectedApp.key)) {
|
|
207
193
|
changeApp(newApp);
|
|
@@ -242,7 +228,7 @@ var _default = (0, _styledComponents.withTheme)(function (props) {
|
|
|
242
228
|
dropdownClassName: 'org-tree-select',
|
|
243
229
|
onChange: function onChange(orgKey) {
|
|
244
230
|
var findItem;
|
|
245
|
-
|
|
231
|
+
traverseTree(orgListFormatData, function (node) {
|
|
246
232
|
if (node.key === orgKey) {
|
|
247
233
|
findItem = node;
|
|
248
234
|
return false;
|
|
@@ -250,7 +236,7 @@ var _default = (0, _styledComponents.withTheme)(function (props) {
|
|
|
250
236
|
});
|
|
251
237
|
changeOrg(findItem);
|
|
252
238
|
},
|
|
253
|
-
value:
|
|
239
|
+
value: get(selectedOrg, 'key')
|
|
254
240
|
};
|
|
255
241
|
}
|
|
256
242
|
|
|
@@ -278,7 +264,7 @@ var _default = (0, _styledComponents.withTheme)(function (props) {
|
|
|
278
264
|
|
|
279
265
|
return React.createElement(OrgAppsInputGroup, {
|
|
280
266
|
compact: true
|
|
281
|
-
}, React.createElement(
|
|
267
|
+
}, React.createElement(_TreeSelect, _extends({
|
|
282
268
|
placeholder: "\u9009\u62E9\u673A\u6784",
|
|
283
269
|
searchPlaceholder: "\u673A\u6784\u540D\u79F0",
|
|
284
270
|
treeNodeFilterProp: "title",
|
|
@@ -295,7 +281,7 @@ var _default = (0, _styledComponents.withTheme)(function (props) {
|
|
|
295
281
|
overflow: 'auto',
|
|
296
282
|
width: 320
|
|
297
283
|
}
|
|
298
|
-
}, orgTreeConfigProp)), React.createElement(GlobalStyle, null), React.createElement(
|
|
284
|
+
}, orgTreeConfigProp)), React.createElement(GlobalStyle, null), React.createElement(_Select, {
|
|
299
285
|
placeholder: "\u8BF7\u9009\u62E9",
|
|
300
286
|
showSearch: true,
|
|
301
287
|
optionFilterProp: "children",
|
|
@@ -305,7 +291,7 @@ var _default = (0, _styledComponents.withTheme)(function (props) {
|
|
|
305
291
|
return key === appKey;
|
|
306
292
|
}));
|
|
307
293
|
},
|
|
308
|
-
value:
|
|
294
|
+
value: get(selectedApp, 'key'),
|
|
309
295
|
style: {
|
|
310
296
|
width: 130,
|
|
311
297
|
height: 28,
|
|
@@ -320,6 +306,4 @@ var _default = (0, _styledComponents.withTheme)(function (props) {
|
|
|
320
306
|
title: name
|
|
321
307
|
}, name);
|
|
322
308
|
})));
|
|
323
|
-
});
|
|
324
|
-
|
|
325
|
-
exports["default"] = _default;
|
|
309
|
+
});
|