@arcblock/ux 2.1.15 → 2.1.18
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/lib/Datatable/TableSearch.js +17 -2
- package/lib/Datatable/index.js +4 -2
- package/lib/Header/header.js +4 -3
- package/lib/Header/responsive-header.js +1 -1
- package/lib/Layout/dashboard/index.js +121 -100
- package/lib/Layout/dashboard/sidebar.js +23 -64
- package/lib/Layout/{dashboard → dashboard-legacy}/header.js +1 -1
- package/lib/Layout/dashboard-legacy/index.js +154 -0
- package/lib/Layout/dashboard-legacy/sidebar.js +117 -0
- package/lib/NavMenu/nav-menu.js +1 -3
- package/package.json +4 -4
- package/src/Datatable/TableSearch.js +16 -3
- package/src/Datatable/index.js +6 -2
- package/src/Header/header.js +9 -3
- package/src/Header/responsive-header.js +1 -1
- package/src/Layout/dashboard/index.js +117 -116
- package/src/Layout/dashboard/sidebar.js +69 -84
- package/src/Layout/{dashboard → dashboard-legacy}/header.js +0 -0
- package/src/Layout/dashboard-legacy/index.js +150 -0
- package/src/Layout/dashboard-legacy/sidebar.js +120 -0
- package/src/NavMenu/nav-menu.js +1 -3
|
@@ -37,6 +37,9 @@ function TableSearch(_ref) {
|
|
|
37
37
|
onSearchOpen
|
|
38
38
|
} = _ref;
|
|
39
39
|
const [inputMode, setInputMode] = (0, _react.useState)(false);
|
|
40
|
+
const [innerSearchText, setInnerSearchText] = (0, _react.useState)('');
|
|
41
|
+
const inputTimer = (0, _react.useRef)(null);
|
|
42
|
+
const searchDebounceTime = options.serverSide && options.searchDebounceTime;
|
|
40
43
|
|
|
41
44
|
const clickSearchIcon = () => {
|
|
42
45
|
setInputMode(true);
|
|
@@ -44,7 +47,19 @@ function TableSearch(_ref) {
|
|
|
44
47
|
};
|
|
45
48
|
|
|
46
49
|
const onChange = event => {
|
|
47
|
-
|
|
50
|
+
const {
|
|
51
|
+
value
|
|
52
|
+
} = event.currentTarget;
|
|
53
|
+
|
|
54
|
+
if (searchDebounceTime) {
|
|
55
|
+
clearTimeout(inputTimer.current);
|
|
56
|
+
setInnerSearchText(value);
|
|
57
|
+
inputTimer.current = setTimeout(() => {
|
|
58
|
+
searchTextUpdate(value);
|
|
59
|
+
}, searchDebounceTime);
|
|
60
|
+
} else {
|
|
61
|
+
searchTextUpdate(value);
|
|
62
|
+
}
|
|
48
63
|
};
|
|
49
64
|
|
|
50
65
|
const clickClose = () => {
|
|
@@ -69,7 +84,7 @@ function TableSearch(_ref) {
|
|
|
69
84
|
variant: "standard",
|
|
70
85
|
spacing: 2,
|
|
71
86
|
onChange: onChange,
|
|
72
|
-
value: searchText || '',
|
|
87
|
+
value: searchDebounceTime ? innerSearchText : searchText || '',
|
|
73
88
|
autoFocus: true
|
|
74
89
|
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
75
90
|
className: "toolbar-search-close ".concat(inputMode ? 'toolbar-btn-show' : '')
|
package/lib/Datatable/index.js
CHANGED
|
@@ -17,6 +17,8 @@ var _isObject = _interopRequireDefault(require("lodash/isObject"));
|
|
|
17
17
|
|
|
18
18
|
var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
|
|
19
19
|
|
|
20
|
+
var _Empty = _interopRequireDefault(require("../Empty"));
|
|
21
|
+
|
|
20
22
|
var _CustomToolbar = _interopRequireDefault(require("./CustomToolbar"));
|
|
21
23
|
|
|
22
24
|
var _DatatableContext = require("./DatatableContext");
|
|
@@ -140,7 +142,7 @@ function ReDatatable(_ref2) {
|
|
|
140
142
|
(0, _react.useEffect)(() => setDisabled(disabled), [disabled]);
|
|
141
143
|
let textLabels = {
|
|
142
144
|
body: {
|
|
143
|
-
noMatch:
|
|
145
|
+
noMatch: /*#__PURE__*/_react.default.createElement(_Empty.default, null, "Sorry, no matching records found"),
|
|
144
146
|
toolTip: 'Sort'
|
|
145
147
|
},
|
|
146
148
|
pagination: {
|
|
@@ -176,7 +178,7 @@ function ReDatatable(_ref2) {
|
|
|
176
178
|
if (locale === 'zh') {
|
|
177
179
|
textLabels = {
|
|
178
180
|
body: {
|
|
179
|
-
noMatch:
|
|
181
|
+
noMatch: /*#__PURE__*/_react.default.createElement(_Empty.default, null, "\u5BF9\u4E0D\u8D77\uFF0C\u6CA1\u6709\u627E\u5230\u5339\u914D\u7684\u8BB0\u5F55"),
|
|
180
182
|
toolTip: '排序'
|
|
181
183
|
},
|
|
182
184
|
pagination: {
|
package/lib/Header/header.js
CHANGED
|
@@ -64,9 +64,10 @@ function Header(_ref) {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
Header.propTypes = {
|
|
67
|
+
// logo img/svg, 可以包裹一个 a 标签
|
|
67
68
|
logo: _propTypes.default.node,
|
|
68
|
-
// 相当于 Title
|
|
69
|
-
brand: _propTypes.default.
|
|
69
|
+
// 相当于 Title, 可以包裹一个 a 标签
|
|
70
|
+
brand: _propTypes.default.node,
|
|
70
71
|
// brand 右侧的内容区域, 可显示一个 badge 或 tag
|
|
71
72
|
brandAddon: _propTypes.default.node,
|
|
72
73
|
// brand 下方的描述
|
|
@@ -90,7 +91,7 @@ Header.defaultProps = {
|
|
|
90
91
|
const Root = _styledComponents.default.div.withConfig({
|
|
91
92
|
displayName: "header__Root",
|
|
92
93
|
componentId: "sc-15qnwg1-0"
|
|
93
|
-
})(["position:relative;z-index:", ";font-size:14px;background:", ";.header-container{display:flex;align-items:center;height:64px;}.header-logo{display:inline-flex;position:relative;height:40px;margin-right:16px;img,svg{width:auto;height:100%;}> a{height:100%;line-height:1;}> a::before{position:absolute;top:0;right:0;bottom:0;left:0;background-color:transparent;content:'';}}.header-brand{display:flex;flex-direction:column;flex-shrink:0;margin-right:16px
|
|
94
|
+
})(["position:relative;z-index:", ";font-size:14px;background:", ";.header-container{display:flex;align-items:center;height:64px;}.header-logo{display:inline-flex;position:relative;height:40px;margin-right:16px;img,svg{width:auto;height:100%;}> a{height:100%;line-height:1;}> a::before{position:absolute;top:0;right:0;bottom:0;left:0;background-color:transparent;content:'';}}.header-brand{display:flex;flex-direction:column;flex-shrink:0;margin-right:16px;a{color:inherit;text-decoration:none;}.header-brand-title{display:flex;align-items:center;h2{margin:0;font-size:16px;}.header-brand-addon{margin-left:8px;}}.header-brand-desc{color:#9397a1;}}.header-addons{display:flex;align-items:center;> *:last-child{padding-right:0;}}", "{.header-brand{margin-right:12px;.header-brand-title{h2{font-size:14px;}}}}", "{.header-container{height:56px;}.header-menu{display:inline-block;}.header-logo{height:32px;}.header-brand{display:none;}}"], props => props.$theme.zIndex.appBar, props => props.$theme.palette.common.white, props => props.$theme.breakpoints.down('lg'), props => props.$theme.breakpoints.down('md'));
|
|
94
95
|
|
|
95
96
|
var _default = Header;
|
|
96
97
|
exports.default = _default;
|
|
@@ -92,7 +92,7 @@ function ResponsiveHeader(_ref) {
|
|
|
92
92
|
open: drawerOpen,
|
|
93
93
|
onClose: () => setDrawerOpen(false),
|
|
94
94
|
ModalProps: {
|
|
95
|
-
disablePortal:
|
|
95
|
+
disablePortal: false,
|
|
96
96
|
keepMounted: true
|
|
97
97
|
}
|
|
98
98
|
}, /*#__PURE__*/_react.default.createElement(Sidebar, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -3,31 +3,39 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default =
|
|
6
|
+
exports.default = void 0;
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
|
|
12
|
+
var _reactRouterDom = require("react-router-dom");
|
|
13
|
+
|
|
12
14
|
var _reactHelmet = _interopRequireDefault(require("react-helmet"));
|
|
13
15
|
|
|
14
16
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
15
17
|
|
|
18
|
+
var _useTheme = _interopRequireDefault(require("@mui/styles/useTheme"));
|
|
19
|
+
|
|
16
20
|
var _Container = _interopRequireDefault(require("@mui/material/Container"));
|
|
17
21
|
|
|
18
|
-
var
|
|
22
|
+
var _Hidden = _interopRequireDefault(require("@mui/material/Hidden"));
|
|
19
23
|
|
|
20
|
-
var
|
|
24
|
+
var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
|
21
25
|
|
|
22
|
-
var
|
|
26
|
+
var _dashboardLegacy = _interopRequireDefault(require("../dashboard-legacy"));
|
|
23
27
|
|
|
24
|
-
var
|
|
28
|
+
var _Header = require("../../Header");
|
|
25
29
|
|
|
26
|
-
var
|
|
30
|
+
var _NavMenu = _interopRequireDefault(require("../../NavMenu"));
|
|
27
31
|
|
|
28
32
|
var _Footer = _interopRequireDefault(require("../../Footer"));
|
|
29
33
|
|
|
30
|
-
|
|
34
|
+
var _sidebar = _interopRequireDefault(require("./sidebar"));
|
|
35
|
+
|
|
36
|
+
const _excluded = ["closeMenu"],
|
|
37
|
+
_excluded2 = ["children", "title", "headerProps", "links"],
|
|
38
|
+
_excluded3 = ["legacy"];
|
|
31
39
|
|
|
32
40
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
33
41
|
|
|
@@ -35,120 +43,133 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
35
43
|
|
|
36
44
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && 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; }
|
|
37
45
|
|
|
46
|
+
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; }
|
|
47
|
+
|
|
48
|
+
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; }
|
|
49
|
+
|
|
50
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
51
|
+
|
|
38
52
|
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; }
|
|
39
53
|
|
|
40
54
|
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; }
|
|
41
55
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
function Dashboard(_ref) {
|
|
56
|
+
// 监听 location 变化并关闭 header 中的 menu (确保 drawer - disablePortal:false, keepMounted:true)
|
|
57
|
+
// 直接监听 menu 中 link 点击来触发 closeMenu 会有问题 (Suspense & lazy)
|
|
58
|
+
// eslint-disable-next-line react/prop-types
|
|
59
|
+
function NavMenuWrapper(_ref) {
|
|
48
60
|
let {
|
|
49
|
-
|
|
50
|
-
title,
|
|
51
|
-
brand,
|
|
52
|
-
description,
|
|
53
|
-
brandAddon,
|
|
54
|
-
headerAddon,
|
|
55
|
-
images,
|
|
56
|
-
links,
|
|
57
|
-
prefix,
|
|
58
|
-
fullWidth,
|
|
59
|
-
contentLayout,
|
|
60
|
-
className,
|
|
61
|
-
homeUrl,
|
|
62
|
-
logo
|
|
61
|
+
closeMenu
|
|
63
62
|
} = _ref,
|
|
64
63
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
65
64
|
|
|
66
|
-
const
|
|
67
|
-
const {
|
|
68
|
-
width
|
|
69
|
-
} = (0, _useWindowSize.default)();
|
|
70
|
-
const [drawerMode, setDrawerMode] = (0, _react.useState)(width >= breakpoint ? 'permanent' : 'temporary');
|
|
71
|
-
const [drawerOpen, setDrawerOpen] = (0, _react.useState)(drawerMode === 'permanent');
|
|
65
|
+
const location = (0, _reactRouterDom.useLocation)();
|
|
72
66
|
(0, _react.useEffect)(() => {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
67
|
+
closeMenu();
|
|
68
|
+
}, [location]);
|
|
69
|
+
return /*#__PURE__*/_react.default.createElement(_NavMenu.default, rest);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function Dashboard(_ref2) {
|
|
73
|
+
let {
|
|
74
|
+
children,
|
|
75
|
+
title,
|
|
76
|
+
headerProps,
|
|
77
|
+
links
|
|
78
|
+
} = _ref2,
|
|
79
|
+
rest = _objectWithoutProperties(_ref2, _excluded2);
|
|
80
|
+
|
|
81
|
+
const theme = (0, _useTheme.default)();
|
|
82
|
+
const location = (0, _reactRouterDom.useLocation)();
|
|
83
|
+
const navItems = (0, _react.useMemo)(() => links.map(link => _objectSpread(_objectSpread({}, link), {}, {
|
|
84
|
+
label: /*#__PURE__*/_react.default.createElement(_reactRouterDom.Link, {
|
|
85
|
+
to: link.url
|
|
86
|
+
}, link.title),
|
|
87
|
+
active: !!(0, _reactRouterDom.matchPath)(location.pathname, {
|
|
88
|
+
path: link.url,
|
|
89
|
+
exact: false
|
|
90
|
+
})
|
|
91
|
+
})), [location, links]);
|
|
92
|
+
return /*#__PURE__*/_react.default.createElement(Wrapper, Object.assign({}, rest, {
|
|
93
|
+
className: "dashboard ".concat(rest.className)
|
|
94
|
+
}), /*#__PURE__*/_react.default.createElement(_reactHelmet.default, {
|
|
95
|
+
title: title,
|
|
96
|
+
key: title
|
|
97
|
+
}), /*#__PURE__*/_react.default.createElement(StyledUxHeader, headerProps, _ref3 => {
|
|
98
|
+
let {
|
|
99
|
+
isMobile,
|
|
100
|
+
closeMenu
|
|
101
|
+
} = _ref3;
|
|
102
|
+
|
|
103
|
+
if (isMobile) {
|
|
104
|
+
return /*#__PURE__*/_react.default.createElement(NavMenuWrapper, {
|
|
105
|
+
mode: "inline",
|
|
106
|
+
items: navItems,
|
|
107
|
+
closeMenu: closeMenu,
|
|
108
|
+
bgColor: "transparent",
|
|
109
|
+
activeTextColor: theme.palette.primary.main
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return null;
|
|
96
114
|
}), /*#__PURE__*/_react.default.createElement(_Box.default, {
|
|
97
115
|
display: "flex",
|
|
98
|
-
className: "
|
|
99
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
paper: 'drawerPaper'
|
|
104
|
-
},
|
|
105
|
-
open: drawerOpen,
|
|
106
|
-
onClose: onToggleDrawer,
|
|
107
|
-
ModalProps: {
|
|
108
|
-
disablePortal: true,
|
|
109
|
-
keepMounted: true
|
|
110
|
-
}
|
|
116
|
+
className: "dashboard-body"
|
|
117
|
+
}, /*#__PURE__*/_react.default.createElement(_Hidden.default, {
|
|
118
|
+
mdDown: true
|
|
119
|
+
}, /*#__PURE__*/_react.default.createElement(_Box.default, {
|
|
120
|
+
className: "dashboard-sidebar"
|
|
111
121
|
}, /*#__PURE__*/_react.default.createElement(_sidebar.default, {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
prefix: prefix,
|
|
116
|
-
logo: logo
|
|
117
|
-
})), /*#__PURE__*/_react.default.createElement(_Box.default, {
|
|
118
|
-
className: "dashboard__main"
|
|
122
|
+
links: links
|
|
123
|
+
}))), /*#__PURE__*/_react.default.createElement(_Box.default, {
|
|
124
|
+
className: "dashboard-main"
|
|
119
125
|
}, /*#__PURE__*/_react.default.createElement(_Container.default, {
|
|
120
|
-
|
|
121
|
-
className: "dashboard__content"
|
|
126
|
+
className: "dashboard-content"
|
|
122
127
|
}, children), /*#__PURE__*/_react.default.createElement(_Footer.default, {
|
|
123
|
-
className: "
|
|
128
|
+
className: "dashboard-footer"
|
|
124
129
|
}))));
|
|
125
130
|
}
|
|
126
131
|
|
|
127
132
|
Dashboard.propTypes = {
|
|
128
133
|
children: _propTypes.default.any.isRequired,
|
|
129
134
|
title: _propTypes.default.string,
|
|
130
|
-
brand: _propTypes.default.string.isRequired,
|
|
131
135
|
links: _propTypes.default.array.isRequired,
|
|
132
|
-
|
|
133
|
-
brandAddon: _propTypes.default.object,
|
|
134
|
-
description: _propTypes.default.any.isRequired,
|
|
135
|
-
headerAddon: _propTypes.default.any,
|
|
136
|
-
prefix: _propTypes.default.string,
|
|
137
|
-
// 兼容旧版的设置,新版使用 fullWidth 进行设置
|
|
138
|
-
contentLayout: _propTypes.default.oneOf(['row', 'column']),
|
|
139
|
-
fullWidth: _propTypes.default.bool,
|
|
140
|
-
className: _propTypes.default.string,
|
|
141
|
-
homeUrl: _propTypes.default.string,
|
|
142
|
-
logo: _propTypes.default.any
|
|
136
|
+
headerProps: _propTypes.default.object
|
|
143
137
|
};
|
|
144
138
|
Dashboard.defaultProps = {
|
|
145
139
|
title: 'Home',
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
140
|
+
headerProps: {}
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
const Wrapper = _styledComponents.default.div.withConfig({
|
|
144
|
+
displayName: "dashboard__Wrapper",
|
|
145
|
+
componentId: "sc-arvc7q-0"
|
|
146
|
+
})(["&.dashboard{display:flex;flex-direction:column;height:100vh;}.dashboard-body{overflow:hidden;flex:1;}.dashboard-sidebar{box-sizing:border-box;flex:0 0 auto;width:104px;padding:0 24px;&:hover{overflow-y:auto;}}.dashboard-main{display:flex;flex-direction:column;overflow:auto;flex:1;}.dashboard-content{flex:1;}.dashboard-footer{padding-left:30px;}"]);
|
|
147
|
+
|
|
148
|
+
const StyledUxHeader = (0, _styledComponents.default)(_Header.ResponsiveHeader).withConfig({
|
|
149
|
+
displayName: "dashboard__StyledUxHeader",
|
|
150
|
+
componentId: "sc-arvc7q-1"
|
|
151
|
+
})([".header-container{max-width:100%;}.header-logo{display:flex;justify-content:center;width:56px;}"]); // 兼容旧版 dashboard
|
|
152
|
+
|
|
153
|
+
function DashboardWrapper(_ref4) {
|
|
154
|
+
let {
|
|
155
|
+
legacy
|
|
156
|
+
} = _ref4,
|
|
157
|
+
rest = _objectWithoutProperties(_ref4, _excluded3);
|
|
158
|
+
|
|
159
|
+
if (legacy) {
|
|
160
|
+
return /*#__PURE__*/_react.default.createElement(_dashboardLegacy.default, rest);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return /*#__PURE__*/_react.default.createElement(Dashboard, rest);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
DashboardWrapper.propTypes = _objectSpread(_objectSpread({}, Dashboard.propTypes), {}, {
|
|
167
|
+
legacy: _propTypes.default.bool
|
|
168
|
+
});
|
|
169
|
+
DashboardWrapper.defaultProps = _objectSpread(_objectSpread({}, Dashboard.defaultProps), {}, {
|
|
170
|
+
legacy: true
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
var _default = (0, _reactRouterDom.withRouter)(DashboardWrapper);
|
|
174
|
+
|
|
175
|
+
exports.default = _default;
|
|
@@ -11,21 +11,13 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
11
11
|
|
|
12
12
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
13
13
|
|
|
14
|
-
var _withTheme = _interopRequireDefault(require("@mui/styles/withTheme"));
|
|
15
|
-
|
|
16
14
|
var _reactRouterDom = require("react-router-dom");
|
|
17
15
|
|
|
18
|
-
var _Button = _interopRequireDefault(require("@mui/material/Button"));
|
|
19
|
-
|
|
20
16
|
var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
|
21
17
|
|
|
22
18
|
var _colors = require("@mui/material/colors");
|
|
23
19
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
var _Logo = _interopRequireDefault(require("../../Logo"));
|
|
27
|
-
|
|
28
|
-
const _excluded = ["location", "theme", "images", "links", "prefix", "addons", "logo"];
|
|
20
|
+
const _excluded = ["links", "addons"];
|
|
29
21
|
|
|
30
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
23
|
|
|
@@ -35,51 +27,31 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
35
27
|
|
|
36
28
|
function Sidebar(_ref) {
|
|
37
29
|
let {
|
|
38
|
-
location,
|
|
39
|
-
theme,
|
|
40
|
-
images,
|
|
41
30
|
links,
|
|
42
|
-
|
|
43
|
-
addons,
|
|
44
|
-
logo
|
|
31
|
+
addons
|
|
45
32
|
} = _ref,
|
|
46
33
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
47
34
|
|
|
48
|
-
|
|
49
|
-
const pattern = new RegExp("/".concat(name));
|
|
50
|
-
return pattern.test(location.pathname);
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
return /*#__PURE__*/_react.default.createElement(MenuItems, rest, /*#__PURE__*/_react.default.createElement(_reactRouterDom.Link, {
|
|
54
|
-
to: "/",
|
|
55
|
-
className: "sidebar-logo"
|
|
56
|
-
}, logo || /*#__PURE__*/_react.default.createElement(_Logo.default, {
|
|
57
|
-
showText: false,
|
|
58
|
-
size: 20
|
|
59
|
-
})), links.map(_ref2 => {
|
|
35
|
+
return /*#__PURE__*/_react.default.createElement(Root, rest, /*#__PURE__*/_react.default.createElement("ul", null, links.map(_ref2 => {
|
|
60
36
|
let {
|
|
61
37
|
url,
|
|
62
|
-
|
|
38
|
+
icon,
|
|
63
39
|
title,
|
|
64
40
|
showBadge
|
|
65
41
|
} = _ref2;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
color: selected ? '#00c2c4' : theme.typography.color.main,
|
|
76
|
-
prefix: prefix,
|
|
77
|
-
showBadge: showBadge
|
|
78
|
-
}), /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
42
|
+
return /*#__PURE__*/_react.default.createElement("li", {
|
|
43
|
+
key: url
|
|
44
|
+
}, /*#__PURE__*/_react.default.createElement(_reactRouterDom.NavLink, {
|
|
45
|
+
to: url,
|
|
46
|
+
className: "layout-sidebar-link",
|
|
47
|
+
activeClassName: "layout-sidebar-link--active"
|
|
48
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
49
|
+
className: "layout-sidebar-icon ".concat(showBadge ? 'layout-sidebar-badge' : '')
|
|
50
|
+
}, icon), /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
79
51
|
component: "span",
|
|
80
|
-
className: "
|
|
81
|
-
}, title));
|
|
82
|
-
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
52
|
+
className: "layout-sidebar-link-text"
|
|
53
|
+
}, title)));
|
|
54
|
+
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
83
55
|
style: {
|
|
84
56
|
flex: 1
|
|
85
57
|
}
|
|
@@ -87,31 +59,18 @@ function Sidebar(_ref) {
|
|
|
87
59
|
}
|
|
88
60
|
|
|
89
61
|
Sidebar.propTypes = {
|
|
90
|
-
location: _propTypes.default.object.isRequired,
|
|
91
|
-
theme: _propTypes.default.object.isRequired,
|
|
92
|
-
images: _propTypes.default.object.isRequired,
|
|
93
62
|
links: _propTypes.default.array.isRequired,
|
|
94
|
-
|
|
95
|
-
addons: _propTypes.default.any,
|
|
96
|
-
logo: _propTypes.default.any
|
|
63
|
+
addons: _propTypes.default.any
|
|
97
64
|
};
|
|
98
65
|
Sidebar.defaultProps = {
|
|
99
|
-
|
|
100
|
-
addons: null,
|
|
101
|
-
logo: null
|
|
66
|
+
addons: null
|
|
102
67
|
};
|
|
103
|
-
|
|
104
|
-
const MenuItems = /*#__PURE__*/_react.default.memo(_styledComponents.default.div.withConfig({
|
|
105
|
-
displayName: "sidebar__MenuItems",
|
|
106
|
-
componentId: "sc-gaosgy-0"
|
|
107
|
-
})(["flex:1;display:flex;flex-direction:column;&& .sidebar-logo{display:none;border-bottom:1px solid #eee;background:", ";position:sticky;top:0;z-index:1;padding:10px 0;text-align:center;font-size:0;}", "{&& .sidebar-logo{display:block;}}"], props => props.theme.palette.background.default, props => props.theme.breakpoints.down('md')));
|
|
108
|
-
|
|
109
68
|
const gradient = 'linear-gradient(32deg, rgba(144, 255, 230, 0.1), rgba(144, 255, 230, 0))';
|
|
110
|
-
const MenuItem = (0, _styledComponents.default)(_Button.default).withConfig({
|
|
111
|
-
displayName: "sidebar__MenuItem",
|
|
112
|
-
componentId: "sc-gaosgy-1"
|
|
113
|
-
})(["&&{display:flex;flex-direction:column;justify-content:center;align-items:center;width:100%;transition:all 200ms ease-in-out;background:", ";padding:24px 0;border-left:2px solid ", ";border-radius:0;&:hover{background:", ";border-left-color:", ";}.menu-title{margin-top:8px;font-size:12px;font-weight:500;text-align:center;text-transform:capitalize;letter-spacing:normal;width:80%;color:", ";}}"], props => props.selected ? gradient : '', props => props.selected ? _colors.teal.A700 : 'transparent', gradient, _colors.teal.A700, props => props.theme.palette.text.primary);
|
|
114
69
|
|
|
115
|
-
|
|
70
|
+
const Root = _styledComponents.default.div.withConfig({
|
|
71
|
+
displayName: "sidebar__Root",
|
|
72
|
+
componentId: "sc-gaosgy-0"
|
|
73
|
+
})(["display:flex;flex-direction:column;ul{list-style:none;margin:0;padding:0;}.layout-sidebar-link{display:flex;flex-direction:column;align-items:center;padding:16px 0;color:", ";text-decoration:none;&:hover,&.layout-sidebar-link--active{color:", ";background:", ";border-left-color:", ";}}.layout-sidebar-icon{display:inline-block;width:32px;height:32px;> img,> svg{width:32px;height:32px;}}.layout-sidebar-badge{position:relative;&:after{content:'';position:absolute;width:10px;height:10px;border-radius:10px;background-color:#fe4e44;right:-2px;top:0;box-shadow:0px 1px 4px rgba(0,0,0,0.3),0px 0px 20px rgba(0,0,0,0.1);}}.layout-sidebar-link-text{margin-top:8px;font-size:12px;font-weight:500;text-align:center;text-transform:capitalize;letter-spacing:normal;}"], props => props.theme.palette.text.secondary, props => props.theme.palette.primary.main, gradient, _colors.teal.A700);
|
|
116
74
|
|
|
75
|
+
var _default = Sidebar;
|
|
117
76
|
exports.default = _default;
|
|
@@ -39,7 +39,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
39
39
|
|
|
40
40
|
const StyledAppBar = (0, _styledComponents.default)(_AppBar.default).withConfig({
|
|
41
41
|
displayName: "header__StyledAppBar",
|
|
42
|
-
componentId: "sc-
|
|
42
|
+
componentId: "sc-9jjwz7-0"
|
|
43
43
|
})(["&&{z-index:", ";background:", ";box-shadow:none;top:0;height:auto;}.header-toolbar{background:", ";color:", ";margin:", "px 0;}.header-link{display:flex;text-decoration:none;flex-shrink:1;overflow:hidden;}.header-logo{margin-right:20px;}.header-title{display:flex;flex-direction:column;justify-content:center;align-items:flex-start;}.header-title__primary{font-size:24px;font-weight:800;color:", ";text-transform:uppercase;display:flex;align-items:center;}.header-title__secondary{font-size:14px;line-height:1.71;color:", ";}.header-addons{display:flex;justify-content:center;align-items:center;flex-shrink:9999999;.user-addon{.header-avatar{width:32px;border-radius:16px;height:auto;}}}.header-menu{display:none;}", "{.header-title{display:none;}.header-title__primary{font-size:20px;}.header-menu{display:block;}}"], props => props.theme.zIndex.drawer, props => props.theme.palette.background.default, props => props.theme.palette.background.default, props => props.theme.palette.text.primary, props => props.theme.spacing(1), props => props.theme.typography.color.main, props => props.theme.typography.color.gray, props => props.theme.breakpoints.down('md'));
|
|
44
44
|
/*
|
|
45
45
|
自定义 logo 相关:
|