mirror of
https://github.com/MetaCubeX/metacubexd.git
synced 2024-11-24 09:45:35 +08:00
feat(connection): drag handle, closes #320
This commit is contained in:
parent
22de2b95d6
commit
dc8fddb08a
@ -1,6 +1,6 @@
|
|||||||
import { createForm } from '@felte/solid'
|
import { createForm } from '@felte/solid'
|
||||||
import { validator } from '@felte/validator-zod'
|
import { validator } from '@felte/validator-zod'
|
||||||
import { IconNetwork, IconX } from '@tabler/icons-solidjs'
|
import { IconMenuOrder, IconNetwork, IconX } from '@tabler/icons-solidjs'
|
||||||
import type {
|
import type {
|
||||||
DragEventHandler,
|
DragEventHandler,
|
||||||
Draggable,
|
Draggable,
|
||||||
@ -13,6 +13,7 @@ import {
|
|||||||
SortableProvider,
|
SortableProvider,
|
||||||
closestCenter,
|
closestCenter,
|
||||||
createSortable,
|
createSortable,
|
||||||
|
transformStyle,
|
||||||
useDragDropContext,
|
useDragDropContext,
|
||||||
} from '@thisbeyond/solid-dnd'
|
} from '@thisbeyond/solid-dnd'
|
||||||
import { uniq } from 'lodash'
|
import { uniq } from 'lodash'
|
||||||
@ -152,15 +153,23 @@ export const ConnectionsSettingsModal = (props: {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
use:sortable
|
ref={sortable.ref}
|
||||||
class="sortable"
|
|
||||||
classList={{
|
classList={{
|
||||||
'opacity-25': sortable.isActiveDraggable,
|
'opacity-25': sortable.isActiveDraggable,
|
||||||
'transition-transform': !!state.active.draggable,
|
'transition-transform': !!state.active.draggable,
|
||||||
}}
|
}}
|
||||||
|
style={transformStyle(sortable.transform)}
|
||||||
>
|
>
|
||||||
<div class="flex cursor-grab justify-between py-2">
|
<div class="flex justify-between py-2">
|
||||||
<span class="select-none">{t(key)}</span>
|
<div class="flex items-center gap-2">
|
||||||
|
<Button
|
||||||
|
class="btn-ghost btn-sm cursor-grab"
|
||||||
|
icon={<IconMenuOrder size={24} />}
|
||||||
|
{...sortable.dragActivators}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<span>{t(key)}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
|
Loading…
Reference in New Issue
Block a user