mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-26 23:30:09 +08:00
fix: move connection columns control
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
import { ViewColumnRounded } from '@mui/icons-material'
|
import { Box } from '@mui/material'
|
||||||
import { Box, IconButton, Tooltip } from '@mui/material'
|
|
||||||
import {
|
import {
|
||||||
ColumnDef,
|
ColumnDef,
|
||||||
ColumnOrderState,
|
ColumnOrderState,
|
||||||
@@ -128,20 +127,6 @@ const SX_RESIZE_HANDLE: React.ComponentProps<typeof Box>['sx'] = {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
const SX_ICON_BTN: React.ComponentProps<typeof IconButton>['sx'] = {
|
|
||||||
position: 'absolute',
|
|
||||||
top: 4,
|
|
||||||
right: 4,
|
|
||||||
zIndex: 3,
|
|
||||||
backgroundColor: (theme) =>
|
|
||||||
theme.palette.mode === 'dark'
|
|
||||||
? theme.palette.background.default
|
|
||||||
: theme.palette.background.paper,
|
|
||||||
'&:hover': {
|
|
||||||
backgroundColor: (theme) => theme.palette.action.hover,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
const SX_HEADER_ROW: React.ComponentProps<typeof Box>['sx'] = {
|
const SX_HEADER_ROW: React.ComponentProps<typeof Box>['sx'] = {
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
borderBottom: (theme) => `1px solid ${theme.palette.divider}`,
|
borderBottom: (theme) => `1px solid ${theme.palette.divider}`,
|
||||||
@@ -311,7 +296,6 @@ interface Props {
|
|||||||
connections: IConnectionsItem[]
|
connections: IConnectionsItem[]
|
||||||
onShowDetail: (data: IConnectionsItem) => void
|
onShowDetail: (data: IConnectionsItem) => void
|
||||||
columnManagerOpen: boolean
|
columnManagerOpen: boolean
|
||||||
onOpenColumnManager: () => void
|
|
||||||
onCloseColumnManager: () => void
|
onCloseColumnManager: () => void
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -320,7 +304,6 @@ export const ConnectionTable = (props: Props) => {
|
|||||||
connections,
|
connections,
|
||||||
onShowDetail: rawOnShowDetail,
|
onShowDetail: rawOnShowDetail,
|
||||||
columnManagerOpen,
|
columnManagerOpen,
|
||||||
onOpenColumnManager,
|
|
||||||
onCloseColumnManager,
|
onCloseColumnManager,
|
||||||
} = props
|
} = props
|
||||||
const onShowDetailRef = useRef(rawOnShowDetail)
|
const onShowDetailRef = useRef(rawOnShowDetail)
|
||||||
@@ -633,15 +616,6 @@ export const ConnectionTable = (props: Props) => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Box sx={SX_OUTER}>
|
<Box sx={SX_OUTER}>
|
||||||
<Tooltip title={t('connections.components.columnManager.title')}>
|
|
||||||
<IconButton
|
|
||||||
size="small"
|
|
||||||
onClick={onOpenColumnManager}
|
|
||||||
sx={SX_ICON_BTN}
|
|
||||||
>
|
|
||||||
<ViewColumnRounded fontSize="small" />
|
|
||||||
</IconButton>
|
|
||||||
</Tooltip>
|
|
||||||
<Box ref={tableContainerRef} sx={SX_SCROLL_CONTAINER}>
|
<Box ref={tableContainerRef} sx={SX_SCROLL_CONTAINER}>
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import {
|
|||||||
DeleteForeverRounded,
|
DeleteForeverRounded,
|
||||||
TableChartRounded,
|
TableChartRounded,
|
||||||
TableRowsRounded,
|
TableRowsRounded,
|
||||||
|
ViewColumnRounded,
|
||||||
} from '@mui/icons-material'
|
} from '@mui/icons-material'
|
||||||
import {
|
import {
|
||||||
Box,
|
Box,
|
||||||
@@ -10,6 +11,7 @@ import {
|
|||||||
Fab,
|
Fab,
|
||||||
IconButton,
|
IconButton,
|
||||||
MenuItem,
|
MenuItem,
|
||||||
|
Tooltip,
|
||||||
Zoom,
|
Zoom,
|
||||||
} from '@mui/material'
|
} from '@mui/material'
|
||||||
import { useLockFn } from 'ahooks'
|
import { useLockFn } from 'ahooks'
|
||||||
@@ -228,6 +230,18 @@ const ConnectionsPage = () => {
|
|||||||
>
|
>
|
||||||
<BaseSearchBox onSearch={handleSearch} />
|
<BaseSearchBox onSearch={handleSearch} />
|
||||||
</Box>
|
</Box>
|
||||||
|
{isTableLayout && hasTableData && (
|
||||||
|
<Tooltip title={t('connections.components.columnManager.title')}>
|
||||||
|
<IconButton
|
||||||
|
size="small"
|
||||||
|
aria-label={t('connections.components.columnManager.title')}
|
||||||
|
onClick={() => setIsColumnManagerOpen(true)}
|
||||||
|
sx={{ flex: '0 0 auto' }}
|
||||||
|
>
|
||||||
|
<ViewColumnRounded fontSize="small" />
|
||||||
|
</IconButton>
|
||||||
|
</Tooltip>
|
||||||
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
{!hasTableData ? (
|
{!hasTableData ? (
|
||||||
@@ -239,7 +253,6 @@ const ConnectionsPage = () => {
|
|||||||
detailRef.current?.open(detail, connectionsType === 'closed')
|
detailRef.current?.open(detail, connectionsType === 'closed')
|
||||||
}
|
}
|
||||||
columnManagerOpen={isTableLayout && isColumnManagerOpen}
|
columnManagerOpen={isTableLayout && isColumnManagerOpen}
|
||||||
onOpenColumnManager={() => setIsColumnManagerOpen(true)}
|
|
||||||
onCloseColumnManager={() => setIsColumnManagerOpen(false)}
|
onCloseColumnManager={() => setIsColumnManagerOpen(false)}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
Reference in New Issue
Block a user