tntd 1.4.32 → 1.4.33-beta.1
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/Ellipsis/index.js +47 -15
- package/components/QueryListScene/QueryForm.js +4 -4
- package/components/QueryListScene/createActions.js +4 -4
- package/dist/1.tntd.js +1 -1
- package/dist/stats.json +24089 -23289
- package/dist/tntd.css +1 -1
- package/dist/tntd.js +7 -10
- package/es/ArrayInput/icon.js +5 -5
- package/es/ArrayInput/index.js +79 -111
- package/es/AuthContext.js +1 -1
- package/es/Columns/index.js +33 -40
- package/es/DevelopmentLogin/LoginModal.js +33 -46
- package/es/DevelopmentLogin/index.js +14 -18
- package/es/Ellipsis/Svg/CopySVG.js +13 -13
- package/es/Ellipsis/Svg/TickSVG.js +8 -8
- package/es/Ellipsis/index.js +100 -79
- package/es/Handle/index.js +46 -64
- package/es/Icon/fonts/iconfont.js +7 -12
- package/es/Icon/index.js +12 -15
- package/es/Img/Contain.js +26 -31
- package/es/Img/Cover.js +43 -57
- package/es/Img/index.js +39 -48
- package/es/Layout/ActionsContext.js +3 -2
- package/es/Layout/AppList.js +39 -94
- package/es/Layout/Application.js +28 -74
- package/es/Layout/Avatar.js +30 -67
- package/es/Layout/CompatibleLanguage.js +41 -96
- package/es/Layout/EnterpriseLayout/Avatar.js +39 -77
- package/es/Layout/EnterpriseLayout/Language.js +16 -34
- package/es/Layout/EnterpriseLayout/Theme.js +18 -36
- package/es/Layout/EnterpriseLayout/index.js +14 -16
- package/es/Layout/GlobalNavigation/NavigationPopup.js +61 -172
- package/es/Layout/GlobalNavigation/index.js +22 -56
- package/es/Layout/Header.js +26 -47
- package/es/Layout/HeaderActions.js +45 -59
- package/es/Layout/HeaderNavs.js +24 -51
- package/es/Layout/HeaderTabs.js +53 -106
- package/es/Layout/Iconfont.js +1 -1
- package/es/Layout/Language.js +16 -34
- package/es/Layout/Layout.js +88 -110
- package/es/Layout/Logo.js +17 -33
- package/es/Layout/OrgAppList.js +64 -109
- package/es/Layout/SideMenu.js +67 -128
- package/es/Layout/Theme.js +25 -63
- package/es/Layout/index.js +28 -37
- package/es/Layout/paaslayout/CompactSideMenu.js +37 -76
- package/es/Layout/paaslayout/Header.js +23 -46
- package/es/Layout/paaslayout/Logo.js +4 -14
- package/es/Layout/paaslayout/SideMenu.js +41 -80
- package/es/Layout/paaslayout/index.js +77 -104
- package/es/Layout/storage.js +10 -9
- package/es/LoadingButton/index.js +18 -27
- package/es/Modal/index.js +42 -51
- package/es/Page/Box.js +36 -43
- package/es/Page/index.js +56 -71
- package/es/Page/utils.js +0 -5
- package/es/QueryForm/Field/Checkbox.js +7 -11
- package/es/QueryForm/Field/Select.js +34 -44
- package/es/QueryForm/Field/SelectInput.js +31 -46
- package/es/QueryForm/Field/fieldsMap.js +0 -1
- package/es/QueryForm/Field/index.js +46 -78
- package/es/QueryForm/createActions.js +6 -7
- package/es/QueryForm/index.js +79 -140
- package/es/QueryListScene/List.js +83 -139
- package/es/QueryListScene/QueryForm.js +54 -91
- package/es/QueryListScene/QueryListScene.js +29 -47
- package/es/QueryListScene/Title.js +3 -3
- package/es/QueryListScene/Toolbar.js +13 -14
- package/es/QueryListScene/createActions.js +4 -4
- package/es/Select/DropDownWrap.js +32 -55
- package/es/Select/index.js +140 -232
- package/es/Table/ResizableTable/index.js +29 -43
- package/es/Table/index.js +20 -19
- package/es/Title/index.js +23 -25
- package/es/locale.js +1 -5
- package/es/utils/checkAuth.js +6 -8
- package/es/utils/findMenuInfoByPath.js +0 -4
- package/es/utils/index.js +17 -27
- package/lib/ArrayInput/icon.js +7 -9
- package/lib/ArrayInput/index.js +82 -131
- package/lib/AuthContext.js +2 -6
- package/lib/Columns/index.js +36 -54
- package/lib/DevelopmentLogin/LoginModal.js +36 -63
- package/lib/DevelopmentLogin/index.js +21 -31
- package/lib/Ellipsis/Svg/CopySVG.js +15 -18
- package/lib/Ellipsis/Svg/TickSVG.js +10 -13
- package/lib/Ellipsis/index.js +105 -93
- package/lib/Handle/index.js +51 -87
- package/lib/Icon/fonts/iconfont.js +7 -12
- package/lib/Icon/iconList.js +1 -2
- package/lib/Icon/index.js +16 -26
- package/lib/Img/Contain.js +29 -40
- package/lib/Img/Cover.js +48 -72
- package/lib/Img/index.js +42 -58
- package/lib/Layout/ActionsContext.js +1 -5
- package/lib/Layout/AppList.js +45 -124
- package/lib/Layout/Application.js +31 -92
- package/lib/Layout/Avatar.js +36 -91
- package/lib/Layout/CompatibleLanguage.js +44 -116
- package/lib/Layout/EnterpriseLayout/Avatar.js +45 -105
- package/lib/Layout/EnterpriseLayout/Language.js +22 -54
- package/lib/Layout/EnterpriseLayout/Theme.js +21 -50
- package/lib/Layout/EnterpriseLayout/index.js +17 -27
- package/lib/Layout/GlobalNavigation/NavigationPopup.js +64 -192
- package/lib/Layout/GlobalNavigation/index.js +28 -80
- package/lib/Layout/Header.js +36 -68
- package/lib/Layout/HeaderActions.js +51 -81
- package/lib/Layout/HeaderNavs.js +30 -70
- package/lib/Layout/HeaderTabs.js +58 -127
- package/lib/Layout/Iconfont.js +4 -9
- package/lib/Layout/Language.js +22 -54
- package/lib/Layout/Layout.js +93 -134
- package/lib/Layout/Logo.js +26 -47
- package/lib/Layout/OrgAppList.js +69 -133
- package/lib/Layout/SideMenu.js +72 -151
- package/lib/Layout/Theme.js +28 -79
- package/lib/Layout/createActions.js +3 -9
- package/lib/Layout/images/index.js +5 -36
- package/lib/Layout/index.js +35 -63
- package/lib/Layout/paaslayout/CompactSideMenu.js +40 -90
- package/lib/Layout/paaslayout/Header.js +30 -60
- package/lib/Layout/paaslayout/Logo.js +11 -24
- package/lib/Layout/paaslayout/SideMenu.js +44 -93
- package/lib/Layout/paaslayout/index.js +82 -128
- package/lib/Layout/storage.js +26 -68
- package/lib/LoadingButton/index.js +21 -36
- package/lib/Modal/index.js +45 -62
- package/lib/Page/Box.js +38 -50
- package/lib/Page/index.js +58 -84
- package/lib/Page/utils.js +5 -16
- package/lib/QueryForm/Field/Checkbox.js +10 -19
- package/lib/QueryForm/Field/Select.js +39 -60
- package/lib/QueryForm/Field/SelectInput.js +36 -65
- package/lib/QueryForm/Field/fieldsMap.js +6 -23
- package/lib/QueryForm/Field/index.js +50 -91
- package/lib/QueryForm/createActions.js +9 -16
- package/lib/QueryForm/index.js +83 -165
- package/lib/QueryForm/useForm.js +1 -6
- package/lib/QueryListScene/List.js +89 -153
- package/lib/QueryListScene/QueryForm.js +58 -101
- package/lib/QueryListScene/QueryListScene.js +31 -56
- package/lib/QueryListScene/Title.js +6 -11
- package/lib/QueryListScene/Toolbar.js +16 -22
- package/lib/QueryListScene/createActions.js +7 -13
- package/lib/QueryListScene/index.js +5 -19
- package/lib/QueryListScene/useActions.js +1 -6
- package/lib/Select/DropDownWrap.js +35 -63
- package/lib/Select/index.js +142 -245
- package/lib/Table/ResizableTable/index.js +31 -54
- package/lib/Table/index.js +21 -34
- package/lib/Title/index.js +26 -34
- package/lib/index.js +36 -57
- package/lib/locale.js +9 -25
- package/lib/utils/checkAuth.js +9 -16
- package/lib/utils/findMenuInfoByPath.js +3 -12
- package/lib/utils/index.js +26 -60
- package/package.json +3 -2
|
@@ -1,79 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
|
|
4
|
-
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
function _arrayWithHoles(
|
|
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
|
-
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
30
|
-
|
|
1
|
+
var _templateObject, _templateObject2;
|
|
2
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _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(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
5
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
6
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
7
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
8
|
+
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
|
|
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(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
1
2
|
import "antd/lib/layout/style";
|
|
2
3
|
import _Layout from "antd/lib/layout";
|
|
3
|
-
|
|
4
|
-
function ownKeys(
|
|
5
|
-
|
|
6
|
-
function
|
|
7
|
-
|
|
8
|
-
function
|
|
9
|
-
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
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
|
-
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
29
|
-
|
|
4
|
+
var _templateObject;
|
|
5
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
8
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
9
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
10
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _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(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
13
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
14
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
15
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
16
|
+
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
|
|
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,9 +1,9 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
3
|
-
function _objectSpread(
|
|
4
|
-
|
|
5
|
-
function
|
|
6
|
-
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
7
|
import Cookies from 'universal-cookie';
|
|
8
8
|
import { safeParseJSON } from '../utils';
|
|
9
9
|
var cookies = new Cookies();
|
|
@@ -12,7 +12,7 @@ export var getSideMenuStore = function getSideMenuStore() {
|
|
|
12
12
|
};
|
|
13
13
|
export var setSideMenuStore = function setSideMenuStore() {
|
|
14
14
|
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
15
|
-
localStorage.setItem('sideMenu', JSON.stringify(_objectSpread({}, getSideMenuStore(),
|
|
15
|
+
localStorage.setItem('sideMenu', JSON.stringify(_objectSpread(_objectSpread({}, getSideMenuStore()), params)));
|
|
16
16
|
};
|
|
17
17
|
export var setCurrentAppStore = function setCurrentAppStore() {
|
|
18
18
|
var currentApp = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -34,9 +34,10 @@ export var setCurrentOrgTreeStore = function setCurrentOrgTreeStore() {
|
|
|
34
34
|
};
|
|
35
35
|
export var getCurrentOrgTreeStore = function getCurrentOrgTreeStore() {
|
|
36
36
|
return safeParseJSON(localStorage.getItem('currentOrgTree'), []);
|
|
37
|
-
};
|
|
38
|
-
// export const getLanguageStore = () => localStorage.getItem('lang');
|
|
37
|
+
};
|
|
39
38
|
|
|
39
|
+
// export const setLanguageStore = lang => localStorage.setItem('lang', lang);
|
|
40
|
+
// export const getLanguageStore = () => localStorage.getItem('lang');
|
|
40
41
|
export var setLanguageStore = function setLanguageStore(lang) {
|
|
41
42
|
return cookies.set('lang', lang, {
|
|
42
43
|
path: '/'
|
|
@@ -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
|
|
11
|
-
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
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
|
-
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
|
-
|
|
3
|
+
var _excluded = ["loadingText", "loading", "onClick", "children"];
|
|
4
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
5
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _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(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
8
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
9
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
10
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
11
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
12
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
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);
|