trithuc-mvc-react 3.2.0 → 3.2.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.
@@ -360,7 +360,7 @@ const DataTableSM = ({ multipleActions = [], page, setPage = () => {}, disableEd
360
360
  </Grid>
361
361
  )}
362
362
 
363
- <Grid>
363
+ <Grid size={12}>
364
364
  <TablePaginationCustom
365
365
  count={total}
366
366
  rowsPerPage={rowsPerPage}
@@ -54,10 +54,9 @@ export const FilterGod = ({ tableName, filters, filterButtons, elementSize = "sm
54
54
 
55
55
  <AccordionDetails>
56
56
  <Grid container spacing={1}>
57
- {filters.map(({ field, size, ...rest }) => {
57
+ {filters.map(({ field, label, size, ...rest }) => {
58
58
  if (rest.type === "date-range") {
59
- const [label1, label2] = Array.isArray(field.label) ? field.label : ["Từ ngày", "Đến ngày"];
60
-
59
+ const [label1, label2] = Array.isArray(label) ? label : ["Từ ngày", "Đến ngày"];
61
60
  const handleClear = (key) => {
62
61
  setDataSearch((prev) => ({
63
62
  ...prev,
@@ -8,37 +8,77 @@ function defaultLabelDisplayedRows({ from, to, count }) {
8
8
  function TablePaginationCustom({ count, rowsPerPage, page, onPageChange, onRowsPerPageChange, ...rest }) {
9
9
  const theme = useTheme();
10
10
  const matchsDownMD = useMediaQuery(theme.breakpoints.down("md"));
11
-
12
- return (
13
- <Box sx={{ overflowX: "auto", width: "100%" }}>
14
- <TablePagination
15
- {...rest}
16
- rowsPerPageOptions={[5, 10, 20, 25, 50, 100]}
17
- component="div"
18
- count={count}
19
- rowsPerPage={rowsPerPage}
20
- page={page}
21
- onPageChange={onPageChange}
22
- onRowsPerPageChange={onRowsPerPageChange}
23
- showFirstButton
24
- showLastButton
25
- labelRowsPerPage={matchsDownMD ? "Số hàng" : "Số bản ghi trên trang:"}
26
- labelDisplayedRows={defaultLabelDisplayedRows}
27
- sx={{
28
- "& .MuiTablePagination-toolbar": {
29
- paddingLeft: matchsDownMD ? "3px" : "10px",
30
- paddingRight: matchsDownMD ? "3px" : "10px",
31
- fontSize: matchsDownMD ? "0.65rem" : "0.8rem" // Giảm kích thước font khi trên màn hình nhỏ
32
- },
33
- "& .MuiTablePagination-selectLabel, & .MuiTablePagination-displayedRows": {
34
- fontSize: matchsDownMD ? "0.65rem" : "0.8rem"
35
- },
36
- "& .MuiTablePagination-select": {
37
- minWidth: matchsDownMD ? "50px" : "70px"
38
- }
39
- }}
40
- />
41
- </Box>
11
+ const isSmallScreen = useMediaQuery(theme.breakpoints.down("sm"));
12
+ return !isSmallScreen ? (
13
+ <TablePagination
14
+ {...rest}
15
+ rowsPerPageOptions={[5, 10, 20, 25, 50, 100]}
16
+ component="div"
17
+ count={count}
18
+ rowsPerPage={rowsPerPage}
19
+ page={page}
20
+ onPageChange={onPageChange}
21
+ onRowsPerPageChange={onRowsPerPageChange}
22
+ showFirstButton
23
+ showLastButton
24
+ labelRowsPerPage={matchsDownMD ? "Số hàng" : "Số bản ghi trên trang:"}
25
+ labelDisplayedRows={defaultLabelDisplayedRows}
26
+ sx={{
27
+ width: "100%",
28
+ "& .MuiTablePagination-toolbar": {
29
+ justifyContent: "flex-end",
30
+ flexWrap: "wrap", // Cho nó xuống dòng nếu thiếu chỗ
31
+ paddingLeft: "8px",
32
+ paddingRight: "8px"
33
+ },
34
+ "& .MuiTablePagination-selectLabel, & .MuiTablePagination-displayedRows": {
35
+ fontSize: "0.7rem"
36
+ },
37
+ "& .MuiTablePagination-select": {
38
+ minWidth: "60px"
39
+ }
40
+ }}
41
+ />
42
+ ) : (
43
+ <TablePagination
44
+ {...rest}
45
+ rowsPerPageOptions={[5, 10, 20, 25, 50, 100]}
46
+ component="div"
47
+ count={count}
48
+ rowsPerPage={rowsPerPage}
49
+ page={page}
50
+ onPageChange={onPageChange}
51
+ onRowsPerPageChange={onRowsPerPageChange}
52
+ showFirstButton
53
+ showLastButton
54
+ labelRowsPerPage={matchsDownMD ? "Số hàng" : "Số bản ghi trên trang:"}
55
+ labelDisplayedRows={defaultLabelDisplayedRows}
56
+ sx={{
57
+ width: "100%",
58
+ overflowX: "auto",
59
+ "& .MuiTablePagination-toolbar": {
60
+ display: "flex",
61
+ flexWrap: "wrap", // Cho xuống dòng nếu không đủ chỗ
62
+ justifyContent: "space-between",
63
+ paddingLeft: "6px",
64
+ paddingRight: "6px",
65
+ gap: "4px", // Giảm khoảng cách
66
+ minHeight: "auto"
67
+ },
68
+ "& .MuiTablePagination-selectLabel, & .MuiTablePagination-displayedRows": {
69
+ fontSize: "0.65rem"
70
+ },
71
+ "& .MuiTablePagination-select": {
72
+ fontSize: "0.65rem",
73
+ minWidth: "50px"
74
+ },
75
+ "& .MuiTablePagination-actions > button": {
76
+ fontSize: "0.7rem",
77
+ minWidth: "24px",
78
+ padding: "2px"
79
+ }
80
+ }}
81
+ />
42
82
  );
43
83
  }
44
84
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trithuc-mvc-react",
3
- "version": "3.2.0",
3
+ "version": "3.2.1",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"