@arcblock/ux 2.1.19 → 2.1.22
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.
|
@@ -21,6 +21,8 @@ var _Clear = _interopRequireDefault(require("@mui/icons-material/Clear"));
|
|
|
21
21
|
|
|
22
22
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
23
23
|
|
|
24
|
+
var _DatatableContext = require("./DatatableContext");
|
|
25
|
+
|
|
24
26
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
27
|
|
|
26
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -37,6 +39,9 @@ function TableSearch(_ref) {
|
|
|
37
39
|
const [inputMode, setInputMode] = (0, _react.useState)(false);
|
|
38
40
|
const [innerSearchText, setInnerSearchText] = (0, _react.useState)('');
|
|
39
41
|
const inputTimer = (0, _react.useRef)(null);
|
|
42
|
+
const {
|
|
43
|
+
loading
|
|
44
|
+
} = (0, _DatatableContext.useDatatableContext)();
|
|
40
45
|
const searchDebounceTime = options.serverSide && options.searchDebounceTime;
|
|
41
46
|
|
|
42
47
|
const clickSearchIcon = () => {
|
|
@@ -63,6 +68,7 @@ function TableSearch(_ref) {
|
|
|
63
68
|
const clickClose = () => {
|
|
64
69
|
setInputMode(false);
|
|
65
70
|
searchClose();
|
|
71
|
+
setInnerSearchText('');
|
|
66
72
|
onSearchOpen(false);
|
|
67
73
|
};
|
|
68
74
|
|
|
@@ -80,15 +86,20 @@ function TableSearch(_ref) {
|
|
|
80
86
|
onClick: clickSearchIcon,
|
|
81
87
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Search.default, {})
|
|
82
88
|
})
|
|
83
|
-
}), /*#__PURE__*/(0, _jsxRuntime.
|
|
89
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
84
90
|
className: "toolbar-search-area ".concat(inputMode ? 'toolbar-btn-show' : ''),
|
|
85
|
-
children: inputMode && /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
|
|
91
|
+
children: [inputMode && !loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
|
|
86
92
|
variant: "standard",
|
|
87
93
|
spacing: 2,
|
|
88
94
|
onChange: onChange,
|
|
89
95
|
value: searchDebounceTime ? innerSearchText : searchText || '',
|
|
90
96
|
autoFocus: true
|
|
91
|
-
})
|
|
97
|
+
}), loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
|
|
98
|
+
disabled: true,
|
|
99
|
+
variant: "standard",
|
|
100
|
+
spacing: 2,
|
|
101
|
+
value: searchDebounceTime ? innerSearchText : searchText || ''
|
|
102
|
+
})]
|
|
92
103
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
93
104
|
className: "toolbar-search-close ".concat(inputMode ? 'toolbar-btn-show' : ''),
|
|
94
105
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, {
|
|
@@ -36,7 +36,7 @@ var _sidebar = _interopRequireDefault(require("./sidebar"));
|
|
|
36
36
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
37
37
|
|
|
38
38
|
const _excluded = ["closeMenu"],
|
|
39
|
-
_excluded2 = ["children", "title", "headerProps", "links"],
|
|
39
|
+
_excluded2 = ["children", "title", "headerProps", "links", "fullWidth"],
|
|
40
40
|
_excluded3 = ["legacy"];
|
|
41
41
|
|
|
42
42
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -72,7 +72,8 @@ function Dashboard(_ref2) {
|
|
|
72
72
|
children,
|
|
73
73
|
title,
|
|
74
74
|
headerProps,
|
|
75
|
-
links
|
|
75
|
+
links,
|
|
76
|
+
fullWidth
|
|
76
77
|
} = _ref2,
|
|
77
78
|
rest = _objectWithoutProperties(_ref2, _excluded2);
|
|
78
79
|
|
|
@@ -124,10 +125,13 @@ function Dashboard(_ref2) {
|
|
|
124
125
|
})
|
|
125
126
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
126
127
|
className: "dashboard-main",
|
|
127
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Container.default, {
|
|
128
|
-
className: "dashboard-content"
|
|
128
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Container.default, _objectSpread(_objectSpread({
|
|
129
|
+
className: "dashboard-content"
|
|
130
|
+
}, fullWidth && {
|
|
131
|
+
maxWidth: false
|
|
132
|
+
}), {}, {
|
|
129
133
|
children: children
|
|
130
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Footer.default, {
|
|
134
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Footer.default, {
|
|
131
135
|
className: "dashboard-footer"
|
|
132
136
|
})]
|
|
133
137
|
})]
|
|
@@ -139,17 +143,19 @@ Dashboard.propTypes = {
|
|
|
139
143
|
children: _propTypes.default.any.isRequired,
|
|
140
144
|
title: _propTypes.default.string,
|
|
141
145
|
links: _propTypes.default.array.isRequired,
|
|
142
|
-
headerProps: _propTypes.default.object
|
|
146
|
+
headerProps: _propTypes.default.object,
|
|
147
|
+
fullWidth: _propTypes.default.bool
|
|
143
148
|
};
|
|
144
149
|
Dashboard.defaultProps = {
|
|
145
150
|
title: 'Home',
|
|
146
|
-
headerProps: {}
|
|
151
|
+
headerProps: {},
|
|
152
|
+
fullWidth: false
|
|
147
153
|
};
|
|
148
154
|
|
|
149
155
|
const Wrapper = _styledComponents.default.div.withConfig({
|
|
150
156
|
displayName: "dashboard__Wrapper",
|
|
151
157
|
componentId: "sc-arvc7q-0"
|
|
152
|
-
})(["&.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
|
|
158
|
+
})(["&.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;&:hover{overflow-y:auto;}}.dashboard-main{display:flex;flex-direction:column;overflow:auto;flex:1;}.dashboard-content{flex:1;}.dashboard-footer{padding-left:30px;}"]);
|
|
153
159
|
|
|
154
160
|
const StyledUxHeader = (0, _styledComponents.default)(_Header.ResponsiveHeader).withConfig({
|
|
155
161
|
displayName: "dashboard__StyledUxHeader",
|
|
@@ -83,7 +83,7 @@ const gradient = 'linear-gradient(32deg, rgba(144, 255, 230, 0.1), rgba(144, 255
|
|
|
83
83
|
const Root = _styledComponents.default.div.withConfig({
|
|
84
84
|
displayName: "sidebar__Root",
|
|
85
85
|
componentId: "sc-gaosgy-0"
|
|
86
|
-
})(["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:
|
|
86
|
+
})(["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:22px 24px;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);
|
|
87
87
|
|
|
88
88
|
var _default = Sidebar;
|
|
89
89
|
exports.default = _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcblock/ux",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.22",
|
|
4
4
|
"description": "Common used react components for arcblock products",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -52,10 +52,10 @@
|
|
|
52
52
|
"react": ">=18.1.0",
|
|
53
53
|
"react-ga": "^2.7.0"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "bc296a11385c44672b18f3bb90db599a8fe05e24",
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@arcblock/icons": "^2.1.
|
|
58
|
-
"@arcblock/react-hooks": "^2.1.
|
|
57
|
+
"@arcblock/icons": "^2.1.22",
|
|
58
|
+
"@arcblock/react-hooks": "^2.1.22",
|
|
59
59
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
60
60
|
"@emotion/react": "^11.9.0",
|
|
61
61
|
"@emotion/styled": "^11.8.1",
|
|
@@ -6,11 +6,13 @@ import SearchIcon from '@mui/icons-material/Search';
|
|
|
6
6
|
import TextField from '@mui/material/TextField';
|
|
7
7
|
import ClearIcon from '@mui/icons-material/Clear';
|
|
8
8
|
import styled from 'styled-components';
|
|
9
|
+
import { useDatatableContext } from './DatatableContext';
|
|
9
10
|
|
|
10
11
|
export default function TableSearch({ search, options, searchText, searchTextUpdate, searchClose, onSearchOpen }) {
|
|
11
12
|
const [inputMode, setInputMode] = useState(false);
|
|
12
13
|
const [innerSearchText, setInnerSearchText] = useState('');
|
|
13
14
|
const inputTimer = useRef(null);
|
|
15
|
+
const { loading } = useDatatableContext();
|
|
14
16
|
|
|
15
17
|
const searchDebounceTime = options.serverSide && options.searchDebounceTime;
|
|
16
18
|
|
|
@@ -35,6 +37,7 @@ export default function TableSearch({ search, options, searchText, searchTextUpd
|
|
|
35
37
|
const clickClose = () => {
|
|
36
38
|
setInputMode(false);
|
|
37
39
|
searchClose();
|
|
40
|
+
setInnerSearchText('');
|
|
38
41
|
onSearchOpen(false);
|
|
39
42
|
};
|
|
40
43
|
|
|
@@ -57,7 +60,7 @@ export default function TableSearch({ search, options, searchText, searchTextUpd
|
|
|
57
60
|
)}
|
|
58
61
|
|
|
59
62
|
<div className={`toolbar-search-area ${inputMode ? 'toolbar-btn-show' : ''}`}>
|
|
60
|
-
{inputMode && (
|
|
63
|
+
{inputMode && !loading && (
|
|
61
64
|
<TextField
|
|
62
65
|
variant="standard"
|
|
63
66
|
spacing={2}
|
|
@@ -66,6 +69,15 @@ export default function TableSearch({ search, options, searchText, searchTextUpd
|
|
|
66
69
|
autoFocus
|
|
67
70
|
/>
|
|
68
71
|
)}
|
|
72
|
+
{/* loading完成后没办法使用focus方法,所以改用两个 TextField */}
|
|
73
|
+
{loading && (
|
|
74
|
+
<TextField
|
|
75
|
+
disabled
|
|
76
|
+
variant="standard"
|
|
77
|
+
spacing={2}
|
|
78
|
+
value={searchDebounceTime ? innerSearchText : searchText || ''}
|
|
79
|
+
/>
|
|
80
|
+
)}
|
|
69
81
|
</div>
|
|
70
82
|
<div className={`toolbar-search-close ${inputMode ? 'toolbar-btn-show' : ''}`}>
|
|
71
83
|
<IconButton onClick={clickClose}>
|
|
@@ -25,7 +25,7 @@ function NavMenuWrapper({ closeMenu, ...rest }) {
|
|
|
25
25
|
return <NavMenu {...rest} />;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
function Dashboard({ children, title, headerProps, links, ...rest }) {
|
|
28
|
+
function Dashboard({ children, title, headerProps, links, fullWidth, ...rest }) {
|
|
29
29
|
const theme = useTheme();
|
|
30
30
|
const location = useLocation();
|
|
31
31
|
const navItems = useMemo(
|
|
@@ -66,7 +66,9 @@ function Dashboard({ children, title, headerProps, links, ...rest }) {
|
|
|
66
66
|
</Box>
|
|
67
67
|
</Hidden>
|
|
68
68
|
<Box className="dashboard-main">
|
|
69
|
-
<Container className="dashboard-content"
|
|
69
|
+
<Container className="dashboard-content" {...(fullWidth && { maxWidth: false })}>
|
|
70
|
+
{children}
|
|
71
|
+
</Container>
|
|
70
72
|
<Footer className="dashboard-footer" />
|
|
71
73
|
</Box>
|
|
72
74
|
</Box>
|
|
@@ -79,11 +81,13 @@ Dashboard.propTypes = {
|
|
|
79
81
|
title: PropTypes.string,
|
|
80
82
|
links: PropTypes.array.isRequired,
|
|
81
83
|
headerProps: PropTypes.object,
|
|
84
|
+
fullWidth: PropTypes.bool,
|
|
82
85
|
};
|
|
83
86
|
|
|
84
87
|
Dashboard.defaultProps = {
|
|
85
88
|
title: 'Home',
|
|
86
89
|
headerProps: {},
|
|
90
|
+
fullWidth: false,
|
|
87
91
|
};
|
|
88
92
|
|
|
89
93
|
const Wrapper = styled.div`
|
|
@@ -100,7 +104,6 @@ const Wrapper = styled.div`
|
|
|
100
104
|
box-sizing: border-box;
|
|
101
105
|
flex: 0 0 auto;
|
|
102
106
|
width: 104px;
|
|
103
|
-
padding: 0 24px;
|
|
104
107
|
&:hover {
|
|
105
108
|
overflow-y: auto;
|
|
106
109
|
}
|