@arcblock/ux 2.1.20 → 2.1.21
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, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcblock/ux",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.21",
|
|
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": "ee49a5560e16fa5791cef6ab0cc5930c4f1c2cf5",
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@arcblock/icons": "^2.1.
|
|
58
|
-
"@arcblock/react-hooks": "^2.1.
|
|
57
|
+
"@arcblock/icons": "^2.1.21",
|
|
58
|
+
"@arcblock/react-hooks": "^2.1.21",
|
|
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}>
|