@campxdev/shared 1.11.37 → 1.11.39
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/package.json
CHANGED
|
@@ -53,6 +53,7 @@ interface TableProps<T> {
|
|
|
53
53
|
onSort?: (sort: any) => void
|
|
54
54
|
dense?: boolean
|
|
55
55
|
showTotal?: boolean
|
|
56
|
+
showNoDataIllustration?: boolean
|
|
56
57
|
sx?: Record<string, SxProps<Theme>>
|
|
57
58
|
totalColumns?: number[]
|
|
58
59
|
showTotalInFirstCellOfTotalRow?: boolean
|
|
@@ -68,6 +69,7 @@ export default function Table<T>({
|
|
|
68
69
|
onSort,
|
|
69
70
|
dense = false,
|
|
70
71
|
showTotal = false,
|
|
72
|
+
showNoDataIllustration = true,
|
|
71
73
|
sx,
|
|
72
74
|
totalColumns,
|
|
73
75
|
showTotalInFirstCellOfTotalRow,
|
|
@@ -258,7 +260,9 @@ export default function Table<T>({
|
|
|
258
260
|
</TableBody>
|
|
259
261
|
) : (
|
|
260
262
|
<>
|
|
261
|
-
|
|
263
|
+
{showNoDataIllustration ? (
|
|
264
|
+
<NoRecordsFound colLength={columns?.length} />
|
|
265
|
+
) : null}
|
|
262
266
|
</>
|
|
263
267
|
)}
|
|
264
268
|
</>
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
IconButton,
|
|
6
6
|
ListItemIcon,
|
|
7
7
|
MenuItem,
|
|
8
|
+
Stack,
|
|
8
9
|
Table,
|
|
9
10
|
TableCell,
|
|
10
11
|
TableHead,
|
|
@@ -12,8 +13,9 @@ import {
|
|
|
12
13
|
TextField,
|
|
13
14
|
Typography,
|
|
14
15
|
} from '@mui/material'
|
|
15
|
-
import { useEffect, useMemo, useState } from 'react'
|
|
16
|
+
import { useCallback, useEffect, useMemo, useState } from 'react'
|
|
16
17
|
import { usePagination, useRowSelect, useTable } from 'react-table'
|
|
18
|
+
import { debounce } from '../../../utils/debounce'
|
|
17
19
|
import TableStats from '../common/TableStats'
|
|
18
20
|
import { SortAscIcon, SortDescIcon, SortIcon } from '../common/icons'
|
|
19
21
|
import {
|
|
@@ -141,6 +143,12 @@ export default function ReactTable({
|
|
|
141
143
|
hooks.visibleColumns.push((columns) => [selectColumn, ...columns])
|
|
142
144
|
},
|
|
143
145
|
)
|
|
146
|
+
const [pageInput, setPageInput] = useState<string>(String(pageIndex + 1))
|
|
147
|
+
|
|
148
|
+
const debouncedHandlePagination = useCallback(
|
|
149
|
+
debounce((e, value) => handlePagination(e, value), 500),
|
|
150
|
+
[],
|
|
151
|
+
)
|
|
144
152
|
|
|
145
153
|
const handleSortClick = (sortBykey) => {
|
|
146
154
|
setSort((prev) => {
|
|
@@ -238,35 +246,38 @@ export default function ReactTable({
|
|
|
238
246
|
page={pageIndex + 1}
|
|
239
247
|
totalCount={pageCount}
|
|
240
248
|
/>
|
|
241
|
-
<
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
249
|
+
<Stack direction={'row'} gap={2} alignItems={'center'}>
|
|
250
|
+
<StyledPagination
|
|
251
|
+
variant="outlined"
|
|
252
|
+
shape="rounded"
|
|
253
|
+
onChange={handlePagination}
|
|
254
|
+
count={Math.ceil(pageCount / pageSize)}
|
|
255
|
+
page={pageIndex + 1}
|
|
256
|
+
/>
|
|
257
|
+
{pagination.handlePageInput && (
|
|
258
|
+
<Box
|
|
259
|
+
sx={{
|
|
260
|
+
'& .MuiBox-root': {
|
|
261
|
+
display: 'flex',
|
|
262
|
+
alignItems: 'center',
|
|
263
|
+
gap: '5px',
|
|
264
|
+
},
|
|
265
|
+
}}
|
|
266
|
+
>
|
|
267
|
+
<TextField
|
|
268
|
+
variant="outlined"
|
|
269
|
+
label={'Page :'}
|
|
270
|
+
size="small"
|
|
271
|
+
value={pageInput}
|
|
272
|
+
onChange={(e) => {
|
|
273
|
+
setPageInput(e.target.value)
|
|
274
|
+
debouncedHandlePagination(e, Number(e.target.value))
|
|
275
|
+
}}
|
|
276
|
+
sx={{ width: '80px' }}
|
|
277
|
+
/>
|
|
278
|
+
</Box>
|
|
279
|
+
)}
|
|
280
|
+
</Stack>
|
|
270
281
|
<Limit pageSize={pageSize} setPageSize={setPageSize} />
|
|
271
282
|
</StyledTableFooter>
|
|
272
283
|
)}
|