tntd 1.4.19 → 1.4.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/Layout/Avatar.js +4 -4
- package/components/Layout/EnterpriseLayout/Avatar.js +10 -7
- package/components/Layout/EnterpriseLayout/Language.js +5 -3
- package/components/Layout/EnterpriseLayout/Theme.js +6 -7
- package/components/Layout/EnterpriseLayout/index.js +1 -1
- package/components/Layout/HeaderActions.js +13 -10
- package/components/Layout/HeaderTabs.js +13 -14
- package/components/Layout/Layout.js +2 -0
- package/components/Layout/index.js +2 -1
- package/components/Layout/storage.js +12 -2
- package/components/Page/index.js +2 -2
- package/components/locale.js +7 -2
- package/dist/1.tntd.js +1 -12
- package/dist/stats.json +28424 -27998
- package/dist/tntd.css +1 -1
- package/dist/tntd.js +13 -7
- package/es/ArrayInput/icon.js +5 -5
- package/es/ArrayInput/index.js +76 -108
- package/es/AuthContext.js +1 -1
- package/es/Columns/index.js +31 -38
- package/es/DevelopmentLogin/LoginModal.js +32 -45
- package/es/DevelopmentLogin/index.js +13 -17
- package/es/Ellipsis/Svg/CopySVG.js +13 -13
- package/es/Ellipsis/Svg/TickSVG.js +8 -8
- package/es/Ellipsis/index.js +58 -69
- package/es/Handle/index.js +25 -35
- package/es/Icon/fonts/iconfont.js +7 -12
- package/es/Icon/index.js +10 -13
- package/es/Img/Contain.js +24 -29
- package/es/Img/Cover.js +40 -54
- package/es/Img/index.js +36 -45
- package/es/Layout/ActionsContext.js +3 -2
- package/es/Layout/AppList.js +37 -92
- package/es/Layout/Application.js +26 -72
- package/es/Layout/Avatar.js +32 -69
- package/es/Layout/CompatibleLanguage.js +39 -94
- package/es/Layout/EnterpriseLayout/Avatar.js +49 -79
- package/es/Layout/EnterpriseLayout/Language.js +19 -34
- package/es/Layout/EnterpriseLayout/Theme.js +23 -37
- package/es/Layout/EnterpriseLayout/index.js +14 -16
- package/es/Layout/GlobalNavigation/NavigationPopup.js +59 -170
- package/es/Layout/GlobalNavigation/index.js +20 -54
- package/es/Layout/Header.js +25 -46
- package/es/Layout/HeaderActions.js +52 -63
- package/es/Layout/HeaderNavs.js +20 -47
- package/es/Layout/HeaderTabs.js +61 -115
- package/es/Layout/Iconfont.js +1 -1
- package/es/Layout/Language.js +14 -32
- package/es/Layout/Layout.js +88 -108
- package/es/Layout/Logo.js +16 -32
- package/es/Layout/OrgAppList.js +62 -107
- package/es/Layout/SideMenu.js +63 -124
- package/es/Layout/Theme.js +23 -61
- package/es/Layout/index.js +29 -36
- package/es/Layout/paaslayout/CompactSideMenu.js +35 -74
- package/es/Layout/paaslayout/Header.js +22 -45
- package/es/Layout/paaslayout/Logo.js +3 -13
- package/es/Layout/paaslayout/SideMenu.js +39 -78
- package/es/Layout/paaslayout/index.js +75 -102
- package/es/Layout/storage.js +26 -9
- package/es/LoadingButton/index.js +15 -24
- package/es/Modal/index.js +38 -46
- package/es/Page/Box.js +34 -41
- package/es/Page/index.js +54 -68
- package/es/Page/utils.js +0 -5
- package/es/QueryForm/Field/Checkbox.js +5 -9
- package/es/QueryForm/Field/Select.js +31 -41
- package/es/QueryForm/Field/SelectInput.js +26 -41
- package/es/QueryForm/Field/fieldsMap.js +0 -1
- package/es/QueryForm/Field/index.js +41 -71
- package/es/QueryForm/createActions.js +6 -7
- package/es/QueryForm/index.js +76 -135
- package/es/QueryListScene/List.js +74 -128
- package/es/QueryListScene/QueryForm.js +46 -81
- package/es/QueryListScene/QueryListScene.js +25 -40
- package/es/QueryListScene/Title.js +3 -3
- package/es/QueryListScene/Toolbar.js +11 -12
- package/es/Select/DropDownWrap.js +29 -50
- package/es/Select/index.js +135 -231
- package/es/Table/ResizableTable/index.js +26 -40
- package/es/Table/index.js +18 -16
- package/es/Title/index.js +21 -23
- package/es/locale.js +9 -7
- package/es/utils/checkAuth.js +3 -5
- package/es/utils/findMenuInfoByPath.js +0 -4
- package/es/utils/index.js +12 -23
- package/lib/ArrayInput/icon.js +6 -6
- package/lib/ArrayInput/index.js +78 -127
- package/lib/AuthContext.js +1 -4
- package/lib/Columns/index.js +31 -47
- package/lib/DevelopmentLogin/LoginModal.js +32 -58
- package/lib/DevelopmentLogin/index.js +16 -27
- package/lib/Ellipsis/Svg/CopySVG.js +13 -15
- package/lib/Ellipsis/Svg/TickSVG.js +8 -10
- package/lib/Ellipsis/index.js +57 -80
- package/lib/Handle/index.js +25 -47
- package/lib/Icon/fonts/iconfont.js +7 -12
- package/lib/Icon/index.js +11 -20
- package/lib/Img/Contain.js +24 -34
- package/lib/Img/Cover.js +42 -65
- package/lib/Img/index.js +36 -51
- package/lib/Layout/ActionsContext.js +1 -4
- package/lib/Layout/AppList.js +40 -118
- package/lib/Layout/Application.js +26 -86
- package/lib/Layout/Avatar.js +35 -89
- package/lib/Layout/CompatibleLanguage.js +39 -110
- package/lib/Layout/EnterpriseLayout/Avatar.js +52 -101
- package/lib/Layout/EnterpriseLayout/Language.js +21 -49
- package/lib/Layout/EnterpriseLayout/Theme.js +22 -46
- package/lib/Layout/EnterpriseLayout/index.js +14 -23
- package/lib/Layout/GlobalNavigation/NavigationPopup.js +59 -186
- package/lib/Layout/GlobalNavigation/index.js +23 -74
- package/lib/Layout/Header.js +28 -63
- package/lib/Layout/HeaderActions.js +48 -74
- package/lib/Layout/HeaderNavs.js +23 -61
- package/lib/Layout/HeaderTabs.js +58 -126
- package/lib/Layout/Iconfont.js +1 -5
- package/lib/Layout/Language.js +17 -48
- package/lib/Layout/Layout.js +90 -128
- package/lib/Layout/Logo.js +19 -43
- package/lib/Layout/OrgAppList.js +64 -127
- package/lib/Layout/SideMenu.js +65 -143
- package/lib/Layout/Theme.js +23 -73
- package/lib/Layout/createActions.js +0 -5
- package/lib/Layout/images/index.js +0 -28
- package/lib/Layout/index.js +33 -57
- package/lib/Layout/paaslayout/CompactSideMenu.js +35 -84
- package/lib/Layout/paaslayout/Header.js +22 -55
- package/lib/Layout/paaslayout/Logo.js +3 -19
- package/lib/Layout/paaslayout/SideMenu.js +39 -87
- package/lib/Layout/paaslayout/index.js +77 -122
- package/lib/Layout/storage.js +29 -35
- package/lib/LoadingButton/index.js +15 -29
- package/lib/Modal/index.js +38 -53
- package/lib/Page/Box.js +34 -45
- package/lib/Page/index.js +54 -78
- package/lib/Page/utils.js +1 -9
- package/lib/QueryForm/Field/Checkbox.js +5 -13
- package/lib/QueryForm/Field/Select.js +33 -53
- package/lib/QueryForm/Field/SelectInput.js +28 -56
- package/lib/QueryForm/Field/fieldsMap.js +1 -15
- package/lib/QueryForm/Field/index.js +43 -81
- package/lib/QueryForm/createActions.js +6 -12
- package/lib/QueryForm/index.js +78 -157
- package/lib/QueryForm/useForm.js +0 -5
- package/lib/QueryListScene/List.js +76 -140
- package/lib/QueryListScene/QueryForm.js +46 -86
- package/lib/QueryListScene/QueryListScene.js +25 -46
- package/lib/QueryListScene/Title.js +3 -7
- package/lib/QueryListScene/Toolbar.js +11 -16
- package/lib/QueryListScene/createActions.js +0 -5
- package/lib/QueryListScene/index.js +0 -10
- package/lib/QueryListScene/useActions.js +0 -5
- package/lib/Select/DropDownWrap.js +31 -56
- package/lib/Select/index.js +135 -241
- package/lib/Table/ResizableTable/index.js +26 -48
- package/lib/Table/index.js +17 -28
- package/lib/Title/index.js +21 -28
- package/lib/index.js +35 -56
- package/lib/locale.js +11 -12
- package/lib/utils/checkAuth.js +4 -9
- package/lib/utils/findMenuInfoByPath.js +1 -8
- package/lib/utils/index.js +15 -42
- package/package.json +2 -2
- 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
|
@@ -1,79 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
|
|
4
|
-
|
|
5
|
-
function
|
|
6
|
-
|
|
1
|
+
var _templateObject, _templateObject2;
|
|
2
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
3
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
5
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
6
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
7
7
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
8
|
-
|
|
9
|
-
function _templateObject2() {
|
|
10
|
-
var data = _taggedTemplateLiteral(["\n background: #fff;\n list-style: none;\n font-size: 14px;\n color: #17233D;\n margin: 10px 0 0;\n padding: 0;\n li {\n position: relative;\n line-height: 38px;\n cursor: pointer;\n padding-left: 20px;\n & > a {\n color: #17233D;\n & > span {\n padding-left: 10px;\n }\n }\n &.active {\n background: #EAEDF8;\n &:before {\n position: absolute;\n left: 0;\n top: 0;\n content: '';\n width: 4px;\n height: 100%;\n background-color: #4C79FF;\n }\n }\n }\n"]);
|
|
11
|
-
|
|
12
|
-
_templateObject2 = function _templateObject2() {
|
|
13
|
-
return data;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
return data;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function _templateObject() {
|
|
20
|
-
var data = _taggedTemplateLiteral(["\n background: #fff;\n list-style: none;\n margin: 0;\n padding: 0;\n text-rendering: optimizeLegibility;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n .isInIframe & {\n display: none;\n }\n \n & > li {\n font-size: 14px;\n letter-spacing: 0;\n margin-top: 20px;\n &:first-child {\n margin-top: 30px;\n }\n & > span {\n line-height: 38px;\n opacity: 0.4;\n display: inline-block;\n width: calc(100% - 20px);\n color: #17233D;\n border-bottom: 1px solid #B2BECD;\n margin-left: 20px;\n }\n }\n"]);
|
|
21
|
-
|
|
22
|
-
_templateObject = function _templateObject() {
|
|
23
|
-
return data;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
return data;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
8
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
30
|
-
|
|
31
9
|
import { useState, useEffect, Component } from 'react';
|
|
32
10
|
import styled from 'styled-components';
|
|
33
11
|
import cn from 'classnames';
|
|
34
12
|
import Iconfont from '../Iconfont';
|
|
35
|
-
var SideMenu = styled.ul(_templateObject());
|
|
36
|
-
var SubMenu = styled.ul(_templateObject2());
|
|
13
|
+
var SideMenu = styled.ul(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background: #fff;\n list-style: none;\n margin: 0;\n padding: 0;\n text-rendering: optimizeLegibility;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n .isInIframe & {\n display: none;\n }\n \n & > li {\n font-size: 14px;\n letter-spacing: 0;\n margin-top: 20px;\n &:first-child {\n margin-top: 30px;\n }\n & > span {\n line-height: 38px;\n opacity: 0.4;\n display: inline-block;\n width: calc(100% - 20px);\n color: #17233D;\n border-bottom: 1px solid #B2BECD;\n margin-left: 20px;\n }\n }\n"])));
|
|
14
|
+
var SubMenu = styled.ul(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n background: #fff;\n list-style: none;\n font-size: 14px;\n color: #17233D;\n margin: 10px 0 0;\n padding: 0;\n li {\n position: relative;\n line-height: 38px;\n cursor: pointer;\n padding-left: 20px;\n & > a {\n color: #17233D;\n & > span {\n padding-left: 10px;\n }\n }\n &.active {\n background: #EAEDF8;\n &:before {\n position: absolute;\n left: 0;\n top: 0;\n content: '';\n width: 4px;\n height: 100%;\n background-color: #4C79FF;\n }\n }\n }\n"])));
|
|
37
15
|
export default (function (props) {
|
|
38
16
|
var language = props.language,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
17
|
+
_props$menus = props.menus,
|
|
18
|
+
menus = _props$menus === void 0 ? [] : _props$menus,
|
|
19
|
+
formatMenuPath = props.formatMenuPath,
|
|
20
|
+
changeRouter = props.changeRouter,
|
|
21
|
+
selectedKey = props.selectedKey,
|
|
22
|
+
onBeforeChange = props.onBeforeChange,
|
|
23
|
+
onChange = props.onChange,
|
|
24
|
+
onSelect = props.onSelect;
|
|
48
25
|
var _useState = useState(selectedKey),
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
26
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
27
|
+
activeMenu = _useState2[0],
|
|
28
|
+
setActiveMenu = _useState2[1];
|
|
53
29
|
var defaultBeforeChange = function defaultBeforeChange(_ref) {
|
|
54
30
|
var data = _ref.data;
|
|
55
31
|
return !isNewTabMenu(data);
|
|
56
32
|
};
|
|
57
|
-
|
|
58
33
|
var defaultSelect = function defaultSelect(_ref2) {
|
|
59
34
|
var _window$location$path;
|
|
60
|
-
|
|
61
35
|
var data = _ref2.data;
|
|
62
|
-
|
|
63
36
|
var _ref3 = data || {},
|
|
64
|
-
|
|
65
|
-
|
|
37
|
+
path = _ref3.path;
|
|
66
38
|
var formatPath = formatMenuPath || function (path) {
|
|
67
39
|
return path;
|
|
68
40
|
};
|
|
69
|
-
|
|
70
41
|
if (isNewTabMenu(data)) {
|
|
71
42
|
openInNewTab(formatPath(data == null ? void 0 : data.path, data));
|
|
72
43
|
return;
|
|
73
44
|
}
|
|
74
|
-
|
|
75
45
|
var routerPrefix = (_window$location$path = window.location.pathname.match(/(^\/[^\/]+)/i)) == null ? void 0 : _window$location$path[1];
|
|
76
|
-
|
|
77
46
|
if (window.location.pathname.startsWith(routerPrefix)) {
|
|
78
47
|
var forwardPath = formatPath(path, data);
|
|
79
48
|
changeRouter ? changeRouter(forwardPath, data) : window.history.pushState(data, data == null ? void 0 : data.name, forwardPath);
|
|
@@ -81,38 +50,33 @@ export default (function (props) {
|
|
|
81
50
|
window.location.href = formatPath(path, data);
|
|
82
51
|
}
|
|
83
52
|
};
|
|
84
|
-
|
|
85
53
|
var selectMenu = function selectMenu() {
|
|
86
54
|
var param = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
87
55
|
var finalBeforeChange = onBeforeChange || defaultBeforeChange;
|
|
88
56
|
var finalSelect = onSelect || defaultSelect;
|
|
89
|
-
|
|
90
57
|
if (param.key !== activeMenu) {
|
|
91
58
|
if (finalBeforeChange(param, activeMenu)) {
|
|
92
59
|
setActiveMenu(param.key);
|
|
93
60
|
onChange && onChange(param);
|
|
94
61
|
}
|
|
95
62
|
}
|
|
96
|
-
|
|
97
63
|
finalSelect(param);
|
|
98
64
|
};
|
|
99
|
-
|
|
100
65
|
var MenuItem = function MenuItem(_ref4) {
|
|
101
66
|
var item = _ref4.item;
|
|
102
67
|
var code = item.code,
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
68
|
+
groupName = item.groupName,
|
|
69
|
+
enName = item.enName,
|
|
70
|
+
_item$children = item.children,
|
|
71
|
+
children = _item$children === void 0 ? [] : _item$children;
|
|
108
72
|
var SubMenuItem = function SubMenuItem(_ref5) {
|
|
109
73
|
var menu = _ref5.menu;
|
|
110
74
|
var code = menu.code,
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
return React.createElement("li", {
|
|
75
|
+
menuName = menu.menuName,
|
|
76
|
+
enName = menu.enName,
|
|
77
|
+
icon = menu.icon,
|
|
78
|
+
path = menu.path;
|
|
79
|
+
return /*#__PURE__*/React.createElement("li", {
|
|
116
80
|
key: code,
|
|
117
81
|
onClick: function onClick(evt) {
|
|
118
82
|
return selectMenu({
|
|
@@ -124,43 +88,40 @@ export default (function (props) {
|
|
|
124
88
|
className: cn({
|
|
125
89
|
active: code === activeMenu
|
|
126
90
|
})
|
|
127
|
-
}, React.createElement("a", {
|
|
91
|
+
}, /*#__PURE__*/React.createElement("a", {
|
|
128
92
|
href: path,
|
|
129
93
|
onClick: function onClick(evt) {
|
|
130
94
|
return evt.preventDefault();
|
|
131
95
|
}
|
|
132
|
-
}, icon instanceof Component ? icon : React.createElement(Iconfont, {
|
|
96
|
+
}, icon instanceof Component ? icon : /*#__PURE__*/React.createElement(Iconfont, {
|
|
133
97
|
type: icon
|
|
134
|
-
}), React.createElement("span", null, {
|
|
98
|
+
}), /*#__PURE__*/React.createElement("span", null, {
|
|
135
99
|
cn: menuName,
|
|
136
100
|
en: enName
|
|
137
101
|
}[language])));
|
|
138
102
|
};
|
|
139
|
-
|
|
140
103
|
if (groupName && children.length) {
|
|
141
|
-
return React.createElement("li", {
|
|
104
|
+
return /*#__PURE__*/React.createElement("li", {
|
|
142
105
|
key: code
|
|
143
|
-
}, React.createElement("span", null, {
|
|
106
|
+
}, /*#__PURE__*/React.createElement("span", null, {
|
|
144
107
|
cn: groupName,
|
|
145
108
|
en: enName
|
|
146
|
-
}[language]), React.createElement(SubMenu, null, children.map(function (subItem) {
|
|
147
|
-
return React.createElement(SubMenuItem, {
|
|
109
|
+
}[language]), /*#__PURE__*/React.createElement(SubMenu, null, children.map(function (subItem) {
|
|
110
|
+
return /*#__PURE__*/React.createElement(SubMenuItem, {
|
|
148
111
|
menu: subItem,
|
|
149
112
|
key: subItem == null ? void 0 : subItem.code
|
|
150
113
|
});
|
|
151
114
|
})));
|
|
152
115
|
}
|
|
153
|
-
|
|
154
|
-
return React.createElement(SubMenuItem, {
|
|
116
|
+
return /*#__PURE__*/React.createElement(SubMenuItem, {
|
|
155
117
|
menu: item
|
|
156
118
|
});
|
|
157
119
|
};
|
|
158
|
-
|
|
159
120
|
useEffect(function () {
|
|
160
121
|
setActiveMenu(selectedKey);
|
|
161
122
|
}, [selectedKey]);
|
|
162
|
-
return React.createElement(SideMenu, null, menus.map(function (menu) {
|
|
163
|
-
return React.createElement(MenuItem, {
|
|
123
|
+
return /*#__PURE__*/React.createElement(SideMenu, null, menus.map(function (menu) {
|
|
124
|
+
return /*#__PURE__*/React.createElement(MenuItem, {
|
|
164
125
|
item: menu,
|
|
165
126
|
key: menu.code
|
|
166
127
|
});
|
|
@@ -1,32 +1,19 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
1
2
|
import "antd/lib/layout/style";
|
|
2
3
|
import _Layout from "antd/lib/layout";
|
|
3
|
-
|
|
4
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
5
|
-
|
|
6
|
-
function
|
|
7
|
-
|
|
8
|
-
function
|
|
9
|
-
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
15
|
-
|
|
4
|
+
var _templateObject;
|
|
5
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
6
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
7
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
9
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
10
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
11
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
13
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
14
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
16
15
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
17
|
-
|
|
18
|
-
function _templateObject() {
|
|
19
|
-
var data = _taggedTemplateLiteral(["\n position: relative;\n height: 100vh;\n overflow: hidden;\n & > .ant-layout {\n flex-direction: row;\n & > .ant-layout-content {\n overflow-x: hidden;\n flex: 1;\n }\n }\n .tnt-layout-sider {\n overflow-x: hidden;\n background: #fff !important;\n box-shadow: 0 1px 10px 0 rgba(0,0,0,0.10);\n z-index: 8;\n }\n &.isInIframe, &.isEmptyLayout {\n .tnt-layout-sider {\n display: none;\n }\n }\n &.tnt-themeS1 .tnt-layout-sider {\n background: #fff !important;\n }\n .tnt-layout-content {\n background: ", ";\n }\n"]);
|
|
20
|
-
|
|
21
|
-
_templateObject = function _templateObject() {
|
|
22
|
-
return data;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
return data;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
16
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
29
|
-
|
|
30
17
|
import { useState, useEffect } from 'react';
|
|
31
18
|
import styled, { withTheme } from 'styled-components';
|
|
32
19
|
import cn from 'classnames';
|
|
@@ -38,63 +25,59 @@ import SideMenu from './SideMenu';
|
|
|
38
25
|
import CompactSideMenu from './CompactSideMenu';
|
|
39
26
|
import { getLanguageStore, getThemeStore } from '../storage';
|
|
40
27
|
var Content = _Layout.Content,
|
|
41
|
-
|
|
42
|
-
var TNTPaasLayout = styled(_Layout)(_templateObject(), function (props) {
|
|
28
|
+
Sider = _Layout.Sider;
|
|
29
|
+
var TNTPaasLayout = styled(_Layout)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n height: 100vh;\n overflow: hidden;\n & > .ant-layout {\n flex-direction: row;\n & > .ant-layout-content {\n overflow-x: hidden;\n flex: 1;\n }\n }\n .tnt-layout-sider {\n overflow-x: hidden;\n background: #fff !important;\n box-shadow: 0 1px 10px 0 rgba(0,0,0,0.10);\n z-index: 8;\n }\n &.isInIframe, &.isEmptyLayout {\n .tnt-layout-sider {\n display: none;\n }\n }\n &.tnt-themeS1 .tnt-layout-sider {\n background: #fff !important;\n }\n .tnt-layout-content {\n background: ", ";\n }\n"])), function (props) {
|
|
43
30
|
return props.theme.lightBgColor;
|
|
44
31
|
});
|
|
45
|
-
|
|
46
32
|
var noop = function noop() {
|
|
47
33
|
return true;
|
|
48
34
|
};
|
|
49
|
-
|
|
50
35
|
export default withTheme(function (props) {
|
|
51
36
|
var appKey = props.appKey,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
37
|
+
logo = props.logo,
|
|
38
|
+
name = props.name,
|
|
39
|
+
enName = props.enName,
|
|
40
|
+
isInIframe = props.isInIframe,
|
|
41
|
+
isEmptyLayout = props.isEmptyLayout,
|
|
42
|
+
selectedAppKey = props.selectedAppKey,
|
|
43
|
+
appList = props.appList,
|
|
44
|
+
_props$config = props.config,
|
|
45
|
+
config = _props$config === void 0 ? {} : _props$config,
|
|
46
|
+
extraHeaderActions = props.extraHeaderActions,
|
|
47
|
+
headerNavs = props.headerNavs,
|
|
48
|
+
sideMenu = props.sideMenu,
|
|
49
|
+
selectedMenuKey = props.selectedMenuKey,
|
|
50
|
+
_props$menuAlignMode = props.menuAlignMode,
|
|
51
|
+
menuAlignMode = _props$menuAlignMode === void 0 ? 'side' : _props$menuAlignMode,
|
|
52
|
+
_props$menus = props.menus,
|
|
53
|
+
menus = _props$menus === void 0 ? [] : _props$menus,
|
|
54
|
+
formatMenuPath = props.formatMenuPath,
|
|
55
|
+
changeRouter = props.changeRouter,
|
|
56
|
+
_props$onLogoClick = props.onLogoClick,
|
|
57
|
+
onLogoClick = _props$onLogoClick === void 0 ? noop : _props$onLogoClick,
|
|
58
|
+
_props$onThemeChange = props.onThemeChange,
|
|
59
|
+
_onThemeChange = _props$onThemeChange === void 0 ? noop : _props$onThemeChange,
|
|
60
|
+
_props$onLanguageChan = props.onLanguageChange,
|
|
61
|
+
_onLanguageChange = _props$onLanguageChan === void 0 ? noop : _props$onLanguageChan,
|
|
62
|
+
_props$onApplicationC = props.onApplicationChange,
|
|
63
|
+
_onApplicationChange = _props$onApplicationC === void 0 ? noop : _props$onApplicationC,
|
|
64
|
+
_props$onAppChange = props.onAppChange,
|
|
65
|
+
onAppChange = _props$onAppChange === void 0 ? noop : _props$onAppChange,
|
|
66
|
+
onLogout = props.onLogout,
|
|
67
|
+
_props$onBeforeMenuCh = props.onBeforeMenuChange,
|
|
68
|
+
onBeforeMenuChange = _props$onBeforeMenuCh === void 0 ? noop : _props$onBeforeMenuCh,
|
|
69
|
+
_props$onMenuChange = props.onMenuChange,
|
|
70
|
+
onMenuChange = _props$onMenuChange === void 0 ? noop : _props$onMenuChange,
|
|
71
|
+
_props$onMenuSelect = props.onMenuSelect,
|
|
72
|
+
onMenuSelect = _props$onMenuSelect === void 0 ? noop : _props$onMenuSelect,
|
|
73
|
+
_props$onHeaderNavCha = props.onHeaderNavChange,
|
|
74
|
+
onHeaderNavChange = _props$onHeaderNavCha === void 0 ? noop : _props$onHeaderNavCha;
|
|
91
75
|
var _useState = useState(props.userInfo || {}),
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
76
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
77
|
+
userInfo = _useState2[0],
|
|
78
|
+
setUserInfo = _useState2[1];
|
|
79
|
+
var theme = getThemeStore() || userInfo.theme || 'themeS2';
|
|
80
|
+
// theme === 'default' ? 'themeS2' : theme;
|
|
98
81
|
theme = ['default', 'themeS3'].includes(theme) ? 'themeS2' : theme;
|
|
99
82
|
var language = getLanguageStore() || userInfo.lang || 'cn';
|
|
100
83
|
var menusMapByApp = menus.reduce(function (acc, menu) {
|
|
@@ -102,31 +85,24 @@ export default withTheme(function (props) {
|
|
|
102
85
|
var singleGroupMap = subMenus.reduce(function (acc, subMenu) {
|
|
103
86
|
var path = subMenu.path;
|
|
104
87
|
var appKey = !/^http/i.test(path) ? path == null ? void 0 : path.match(/\/([^\/]+)/)[1] : '';
|
|
105
|
-
|
|
106
88
|
if (appKey) {
|
|
107
|
-
acc[appKey] = acc[appKey] || _objectSpread({}, menu, {
|
|
89
|
+
acc[appKey] = acc[appKey] || _objectSpread(_objectSpread({}, menu), {}, {
|
|
108
90
|
children: []
|
|
109
91
|
});
|
|
110
92
|
acc[appKey].children.push(subMenu);
|
|
111
93
|
}
|
|
112
|
-
|
|
113
94
|
return acc;
|
|
114
95
|
}, {});
|
|
115
|
-
|
|
116
96
|
for (var _appKey in singleGroupMap) {
|
|
117
97
|
acc[_appKey] = acc[_appKey] || [];
|
|
118
|
-
|
|
119
98
|
acc[_appKey].push(singleGroupMap[_appKey]);
|
|
120
99
|
}
|
|
121
|
-
|
|
122
100
|
return acc;
|
|
123
101
|
}, {});
|
|
124
|
-
|
|
125
102
|
var _useState3 = useState(appKey),
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
103
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
104
|
+
currentAppKey = _useState4[0],
|
|
105
|
+
setCurrentAppKey = _useState4[1];
|
|
130
106
|
var apps = reduce(menusMapByApp, function (acc, value, key) {
|
|
131
107
|
acc.push({
|
|
132
108
|
appKey: key,
|
|
@@ -137,23 +113,22 @@ export default withTheme(function (props) {
|
|
|
137
113
|
var isMenusTop = menuAlignMode === 'top';
|
|
138
114
|
var headerNavMenus = headerNavs;
|
|
139
115
|
var currentSystemMenus = menusMapByApp[currentAppKey] || [];
|
|
140
|
-
|
|
141
116
|
var _useState5 = useState(get(currentSystemMenus, '0.code')),
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
117
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
118
|
+
currentHeaderNavKey = _useState6[0],
|
|
119
|
+
setCurrentHeaderNavKey = _useState6[1];
|
|
146
120
|
var sideMenus = isMenusTop ? get(currentSystemMenus.find(function (_ref) {
|
|
147
121
|
var code = _ref.code;
|
|
148
122
|
return currentHeaderNavKey === code;
|
|
149
123
|
}), 'children', []) : currentSystemMenus;
|
|
150
|
-
var FinalSideMenu = isMenusTop ? CompactSideMenu : SideMenu;
|
|
124
|
+
var FinalSideMenu = isMenusTop ? CompactSideMenu : SideMenu;
|
|
151
125
|
|
|
126
|
+
// 一级菜单放在顶部(Header里面菜单作为一级导航)
|
|
152
127
|
if (isMenusTop) {
|
|
153
|
-
headerNavMenus = React.createElement(HeaderNavs, {
|
|
128
|
+
headerNavMenus = /*#__PURE__*/React.createElement(HeaderNavs, {
|
|
154
129
|
selectedKey: currentHeaderNavKey,
|
|
155
130
|
navs: currentSystemMenus.map(function (item) {
|
|
156
|
-
return _objectSpread({}, item, {
|
|
131
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
157
132
|
key: item.code,
|
|
158
133
|
name: item.groupName
|
|
159
134
|
});
|
|
@@ -164,7 +139,6 @@ export default withTheme(function (props) {
|
|
|
164
139
|
}
|
|
165
140
|
});
|
|
166
141
|
}
|
|
167
|
-
|
|
168
142
|
useEffect(function () {
|
|
169
143
|
setUserInfo(props.userInfo);
|
|
170
144
|
}, [props.userInfo]);
|
|
@@ -173,7 +147,7 @@ export default withTheme(function (props) {
|
|
|
173
147
|
setCurrentHeaderNavKey(get(getSelectedMenuInfo(selectedMenuKey, menus), 'menu.code'));
|
|
174
148
|
}
|
|
175
149
|
}, [menus, selectedMenuKey]);
|
|
176
|
-
return React.createElement(TNTPaasLayout, {
|
|
150
|
+
return /*#__PURE__*/React.createElement(TNTPaasLayout, {
|
|
177
151
|
className: cn("tnt-".concat(theme, " ").concat(props.className || ''), {
|
|
178
152
|
'large-size': props.theme.size === 'large',
|
|
179
153
|
compatible: props.theme.compatible,
|
|
@@ -181,7 +155,7 @@ export default withTheme(function (props) {
|
|
|
181
155
|
isEmptyLayout: isEmptyLayout,
|
|
182
156
|
noAppList: !appList
|
|
183
157
|
})
|
|
184
|
-
}, React.createElement(Header, {
|
|
158
|
+
}, /*#__PURE__*/React.createElement(Header, {
|
|
185
159
|
logo: logo,
|
|
186
160
|
name: name,
|
|
187
161
|
enName: enName,
|
|
@@ -198,29 +172,28 @@ export default withTheme(function (props) {
|
|
|
198
172
|
onLogoClick: onLogoClick,
|
|
199
173
|
onAppChange: onAppChange,
|
|
200
174
|
onThemeChange: function onThemeChange(theme) {
|
|
201
|
-
setUserInfo(_objectSpread({}, userInfo, {
|
|
175
|
+
setUserInfo(_objectSpread(_objectSpread({}, userInfo), {}, {
|
|
202
176
|
theme: theme
|
|
203
177
|
}));
|
|
204
178
|
_onThemeChange && _onThemeChange(theme);
|
|
205
179
|
},
|
|
206
180
|
onLanguageChange: function onLanguageChange(lang) {
|
|
207
|
-
setUserInfo(_objectSpread({}, userInfo, {
|
|
181
|
+
setUserInfo(_objectSpread(_objectSpread({}, userInfo), {}, {
|
|
208
182
|
lang: lang
|
|
209
183
|
}));
|
|
210
184
|
_onLanguageChange && _onLanguageChange(lang);
|
|
211
185
|
},
|
|
212
186
|
onApplicationChange: function onApplicationChange(appKey) {
|
|
213
187
|
setCurrentAppKey(appKey);
|
|
214
|
-
|
|
215
188
|
_onApplicationChange(appKey);
|
|
216
189
|
},
|
|
217
190
|
onLogout: onLogout
|
|
218
|
-
}, headerNavMenus), React.createElement(_Layout, null, !isUndefined(sideMenu) ? sideMenu : React.createElement(Sider, {
|
|
191
|
+
}, headerNavMenus), /*#__PURE__*/React.createElement(_Layout, null, !isUndefined(sideMenu) ? sideMenu : /*#__PURE__*/React.createElement(Sider, {
|
|
219
192
|
breakpoint: "md",
|
|
220
193
|
className: "tnt-layout-sider",
|
|
221
194
|
width: 220,
|
|
222
195
|
trigger: null
|
|
223
|
-
}, React.createElement(FinalSideMenu, {
|
|
196
|
+
}, /*#__PURE__*/React.createElement(FinalSideMenu, {
|
|
224
197
|
language: language,
|
|
225
198
|
selectedKey: selectedMenuKey,
|
|
226
199
|
menus: sideMenus,
|
|
@@ -229,7 +202,7 @@ export default withTheme(function (props) {
|
|
|
229
202
|
onBeforeChange: onBeforeMenuChange,
|
|
230
203
|
onChange: onMenuChange,
|
|
231
204
|
onSelect: onMenuSelect
|
|
232
|
-
})), React.createElement(Content, {
|
|
205
|
+
})), /*#__PURE__*/React.createElement(Content, {
|
|
233
206
|
className: "tnt-layout-content"
|
|
234
207
|
}, props.children)));
|
|
235
208
|
});
|
package/es/Layout/storage.js
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
3
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
4
|
-
|
|
5
|
-
function
|
|
6
|
-
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
|
+
import Cookies from 'universal-cookie';
|
|
7
8
|
import { safeParseJSON } from '../utils';
|
|
9
|
+
var cookies = new Cookies();
|
|
8
10
|
export var getSideMenuStore = function getSideMenuStore() {
|
|
9
11
|
return safeParseJSON(localStorage.getItem('sideMenu'), {});
|
|
10
12
|
};
|
|
11
13
|
export var setSideMenuStore = function setSideMenuStore() {
|
|
12
14
|
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
13
|
-
localStorage.setItem('sideMenu', JSON.stringify(_objectSpread({}, getSideMenuStore(),
|
|
15
|
+
localStorage.setItem('sideMenu', JSON.stringify(_objectSpread(_objectSpread({}, getSideMenuStore()), params)));
|
|
14
16
|
};
|
|
15
17
|
export var setCurrentAppStore = function setCurrentAppStore() {
|
|
16
18
|
var currentApp = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -33,15 +35,30 @@ export var setCurrentOrgTreeStore = function setCurrentOrgTreeStore() {
|
|
|
33
35
|
export var getCurrentOrgTreeStore = function getCurrentOrgTreeStore() {
|
|
34
36
|
return safeParseJSON(localStorage.getItem('currentOrgTree'), []);
|
|
35
37
|
};
|
|
38
|
+
|
|
39
|
+
// export const setLanguageStore = lang => localStorage.setItem('lang', lang);
|
|
40
|
+
// export const getLanguageStore = () => localStorage.getItem('lang');
|
|
36
41
|
export var setLanguageStore = function setLanguageStore(lang) {
|
|
37
|
-
return
|
|
42
|
+
return cookies.set('lang', lang, {
|
|
43
|
+
path: '/'
|
|
44
|
+
});
|
|
38
45
|
};
|
|
39
46
|
export var getLanguageStore = function getLanguageStore() {
|
|
40
|
-
return
|
|
47
|
+
return cookies.get('lang', {
|
|
48
|
+
path: '/'
|
|
49
|
+
});
|
|
41
50
|
};
|
|
42
51
|
export var setThemeStore = function setThemeStore(theme) {
|
|
43
52
|
return localStorage.setItem('theme', theme);
|
|
44
53
|
};
|
|
45
54
|
export var getThemeStore = function getThemeStore() {
|
|
46
55
|
return localStorage.getItem('theme');
|
|
56
|
+
};
|
|
57
|
+
export var clearLoginCookie = function clearLoginCookie() {
|
|
58
|
+
cookies.remove('_td_token_', {
|
|
59
|
+
path: '/'
|
|
60
|
+
});
|
|
61
|
+
cookies.remove('_uid_', {
|
|
62
|
+
path: '/'
|
|
63
|
+
});
|
|
47
64
|
};
|
|
@@ -1,40 +1,32 @@
|
|
|
1
1
|
import "antd/lib/button/style";
|
|
2
2
|
import _Button from "antd/lib/button";
|
|
3
|
-
|
|
4
|
-
function _extends() { _extends = Object.assign
|
|
5
|
-
|
|
6
|
-
function
|
|
7
|
-
|
|
8
|
-
function
|
|
9
|
-
|
|
10
|
-
function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
11
|
-
|
|
3
|
+
var _excluded = ["loadingText", "loading", "onClick", "children"];
|
|
4
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
|
|
5
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
9
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
12
10
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
-
|
|
14
11
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
15
|
-
|
|
16
12
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
17
|
-
|
|
18
13
|
import { useState, useEffect } from "react";
|
|
19
14
|
export default (function (_ref) {
|
|
20
15
|
var loadingText = _ref.loadingText,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
16
|
+
pLoading = _ref.loading,
|
|
17
|
+
onClick = _ref.onClick,
|
|
18
|
+
children = _ref.children,
|
|
19
|
+
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
26
20
|
var _useState = useState(pLoading),
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
21
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
22
|
+
loading = _useState2[0],
|
|
23
|
+
setLoading = _useState2[1];
|
|
31
24
|
var doClick = function doClick(evt) {
|
|
32
25
|
if (!loading) {
|
|
33
26
|
setLoading(true);
|
|
34
27
|
var returnVal = onClick && onClick(evt, function () {
|
|
35
28
|
return setLoading(false);
|
|
36
29
|
});
|
|
37
|
-
|
|
38
30
|
if (returnVal instanceof Promise) {
|
|
39
31
|
returnVal.then(function () {
|
|
40
32
|
return setLoading(false);
|
|
@@ -44,11 +36,10 @@ export default (function (_ref) {
|
|
|
44
36
|
}
|
|
45
37
|
}
|
|
46
38
|
};
|
|
47
|
-
|
|
48
39
|
useEffect(function () {
|
|
49
40
|
setLoading(pLoading);
|
|
50
41
|
}, [pLoading]);
|
|
51
|
-
return React.createElement(_Button, _extends({}, otherProps, {
|
|
42
|
+
return /*#__PURE__*/React.createElement(_Button, _extends({}, otherProps, {
|
|
52
43
|
loading: loading,
|
|
53
44
|
onClick: doClick
|
|
54
45
|
}), loading ? loadingText || children : children);
|