mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-19 02:12:10 +08:00
feat(proxy): support dragging to swap proxy group header sections
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { DragDropProvider } from '@dnd-kit/react'
|
||||
import { ExpandMoreRounded } from '@mui/icons-material'
|
||||
import {
|
||||
Alert,
|
||||
@@ -35,6 +36,10 @@ import { ProxyChain } from './proxy-chain'
|
||||
import { type ProxyChainItem, rebindProxyChainItems } from './proxy-chain-model'
|
||||
import { ProxyRender } from './proxy-render'
|
||||
import type { HeadState } from './use-head-state'
|
||||
import {
|
||||
PROXY_GROUP_HEADER_SENSORS,
|
||||
useProxyGroupHeaderLayout,
|
||||
} from './use-proxy-group-header-layout'
|
||||
import type { IRenderItem } from './use-render-list'
|
||||
|
||||
// ---- Types ----
|
||||
@@ -315,6 +320,7 @@ export function ProxyGroupsChain(props: ProxyGroupsChainProps) {
|
||||
onScrollToTop,
|
||||
} = props
|
||||
const { proxyView } = useProxiesData()
|
||||
const { onDragEnd: onHeaderDragEnd } = useProxyGroupHeaderLayout()
|
||||
|
||||
// Chain-specific state
|
||||
const [proxyChain, setProxyChain] = useState<ProxyChainItem[]>(() => {
|
||||
@@ -455,20 +461,25 @@ export function ProxyGroupsChain(props: ProxyGroupsChainProps) {
|
||||
|
||||
// Render virtual list for chain mode
|
||||
const renderProxyList = (height: string) => (
|
||||
<ProxyVirtualList
|
||||
parentRef={parentRef}
|
||||
height={height}
|
||||
totalSize={totalSize}
|
||||
virtualItems={virtualItems}
|
||||
renderList={renderList}
|
||||
activeStickyIndex={activeStickyIndex}
|
||||
isChainMode
|
||||
measureElement={measureElement}
|
||||
onLocation={onLocation}
|
||||
onCheckAll={onCheckAll}
|
||||
onHeadState={onHeadState}
|
||||
onChangeProxy={handleChangeProxy}
|
||||
/>
|
||||
<DragDropProvider
|
||||
sensors={PROXY_GROUP_HEADER_SENSORS}
|
||||
onDragEnd={onHeaderDragEnd}
|
||||
>
|
||||
<ProxyVirtualList
|
||||
parentRef={parentRef}
|
||||
height={height}
|
||||
totalSize={totalSize}
|
||||
virtualItems={virtualItems}
|
||||
renderList={renderList}
|
||||
activeStickyIndex={activeStickyIndex}
|
||||
isChainMode
|
||||
measureElement={measureElement}
|
||||
onLocation={onLocation}
|
||||
onCheckAll={onCheckAll}
|
||||
onHeadState={onHeadState}
|
||||
onChangeProxy={handleChangeProxy}
|
||||
/>
|
||||
</DragDropProvider>
|
||||
)
|
||||
|
||||
const showRuleHeader = mode === 'rule' && availableGroups.length > 0
|
||||
|
||||
Reference in New Issue
Block a user