@campxdev/shared 1.11.35 → 1.11.36
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
|
@@ -48,6 +48,7 @@ interface TableProps<T> {
|
|
|
48
48
|
totalCount: number
|
|
49
49
|
onChange: (v: number) => void
|
|
50
50
|
onChangeLimit?: (v: number) => void
|
|
51
|
+
handlePageInput?: (v: number) => void
|
|
51
52
|
}
|
|
52
53
|
onSort?: (sort: any) => void
|
|
53
54
|
dense?: boolean
|
|
@@ -274,6 +275,7 @@ export default function Table<T>({
|
|
|
274
275
|
totalCount={pagination.totalCount ?? 0}
|
|
275
276
|
handlePagination={pagination.onChange}
|
|
276
277
|
handlePageLimit={pagination.onChangeLimit}
|
|
278
|
+
handlePageInput={pagination.handlePageInput}
|
|
277
279
|
/>
|
|
278
280
|
)}
|
|
279
281
|
</>
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { Box,
|
|
1
|
+
import { Box, Stack } from '@mui/material'
|
|
2
2
|
import DropDownButton from '../../DropDownButton/DropDownButton'
|
|
3
|
-
import {
|
|
3
|
+
import { TextField } from '../../Input'
|
|
4
4
|
import TableStats from '../common/TableStats'
|
|
5
|
+
import { StyledPagination, StyledTableFooter } from '../common/styles'
|
|
5
6
|
|
|
6
7
|
interface TableFooterProps {
|
|
7
8
|
totalCount: number
|
|
@@ -9,6 +10,7 @@ interface TableFooterProps {
|
|
|
9
10
|
handlePagination: (v: number) => void
|
|
10
11
|
page: number
|
|
11
12
|
handlePageLimit?: (v: number) => void
|
|
13
|
+
handlePageInput?: (v: number) => void
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
export default function TableFooter({
|
|
@@ -17,6 +19,7 @@ export default function TableFooter({
|
|
|
17
19
|
handlePagination,
|
|
18
20
|
page,
|
|
19
21
|
handlePageLimit,
|
|
22
|
+
handlePageInput,
|
|
20
23
|
}: TableFooterProps) {
|
|
21
24
|
const onChange = (v: number) => {
|
|
22
25
|
handlePagination(v)
|
|
@@ -24,13 +27,36 @@ export default function TableFooter({
|
|
|
24
27
|
return (
|
|
25
28
|
<StyledTableFooter>
|
|
26
29
|
<TableStats limit={limit} totalCount={totalCount} page={page} />
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
<Stack direction={'row'} gap={2} alignItems={'center'}>
|
|
31
|
+
<StyledPagination
|
|
32
|
+
page={page}
|
|
33
|
+
count={Math.ceil(totalCount / limit)}
|
|
34
|
+
onChange={(e, v) => onChange(v)}
|
|
35
|
+
variant="outlined"
|
|
36
|
+
shape="rounded"
|
|
37
|
+
/>
|
|
38
|
+
|
|
39
|
+
{handlePageInput && (
|
|
40
|
+
<Box
|
|
41
|
+
sx={{
|
|
42
|
+
'& .MuiBox-root': {
|
|
43
|
+
display: 'flex',
|
|
44
|
+
alignItems: 'center',
|
|
45
|
+
gap: '5px',
|
|
46
|
+
},
|
|
47
|
+
}}
|
|
48
|
+
>
|
|
49
|
+
<TextField
|
|
50
|
+
variant="outlined"
|
|
51
|
+
label={'Page :'}
|
|
52
|
+
size="small"
|
|
53
|
+
value={page}
|
|
54
|
+
onChange={(e) => handlePageInput(Number(e.target.value))}
|
|
55
|
+
sx={{ width: '80px' }}
|
|
56
|
+
/>
|
|
57
|
+
</Box>
|
|
58
|
+
)}
|
|
59
|
+
</Stack>
|
|
34
60
|
{handlePageLimit ? (
|
|
35
61
|
<LimitField handlePageLimit={handlePageLimit} limit={limit} />
|
|
36
62
|
) : (
|
|
@@ -13,14 +13,9 @@ import {
|
|
|
13
13
|
} from '@mui/material'
|
|
14
14
|
import { useEffect, useMemo, useState } from 'react'
|
|
15
15
|
import { usePagination, useRowSelect, useTable } from 'react-table'
|
|
16
|
-
import
|
|
16
|
+
import TableFooter from '../BasicTable/TableFooter'
|
|
17
17
|
import { SortAscIcon, SortDescIcon, SortIcon } from '../common/icons'
|
|
18
|
-
import {
|
|
19
|
-
StyledLimitBox,
|
|
20
|
-
StyledLimitMenu,
|
|
21
|
-
StyledPagination,
|
|
22
|
-
StyledTableFooter,
|
|
23
|
-
} from '../common/styles'
|
|
18
|
+
import { StyledLimitBox, StyledLimitMenu } from '../common/styles'
|
|
24
19
|
import { ColumnProps, Sort, TableProps } from '../common/types'
|
|
25
20
|
import BatchActionsHeader from './BatchActionsHeader'
|
|
26
21
|
import { RenderTableBody } from './RenderTableBody'
|
|
@@ -231,21 +226,14 @@ export default function ReactTable({
|
|
|
231
226
|
/>
|
|
232
227
|
</Table>
|
|
233
228
|
{pagination && dataSource && !loading && (
|
|
234
|
-
<
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
shape="rounded"
|
|
243
|
-
onChange={handlePagination}
|
|
244
|
-
count={Math.ceil(pageCount / pageSize)}
|
|
245
|
-
page={pageIndex + 1}
|
|
246
|
-
/>
|
|
247
|
-
<Limit pageSize={pageSize} setPageSize={setPageSize} />
|
|
248
|
-
</StyledTableFooter>
|
|
229
|
+
<TableFooter
|
|
230
|
+
page={pagination.page + 1}
|
|
231
|
+
limit={pagination.limit}
|
|
232
|
+
totalCount={pagination.totalCount ?? 0}
|
|
233
|
+
handlePagination={pagination.onChange}
|
|
234
|
+
handlePageLimit={pagination.onChangeLimit}
|
|
235
|
+
handlePageInput={pagination.handlePageInput}
|
|
236
|
+
/>
|
|
249
237
|
)}
|
|
250
238
|
</>
|
|
251
239
|
)
|