-
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Allow dropping into collapsed groups and folders. Closes #407. - Allows dragging and dropping between top-level and child groups. - Removes the "Convert to Child/Top-Level" group menu items since they're not needed anymore.
- Loading branch information
Showing
14 changed files
with
848 additions
and
725 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import type {Directive} from "vue"; | ||
|
||
import { | ||
makeDraggable, | ||
makeDroppable, | ||
type DNDLifecycle, | ||
type DraggableOptions, | ||
type DroppableOptions, | ||
} from "./dnd.js"; | ||
|
||
const draggableElements = new WeakMap< | ||
HTMLElement, | ||
DNDLifecycle<DraggableOptions> | ||
>(); | ||
const droppableElements = new WeakMap< | ||
HTMLElement, | ||
DNDLifecycle<DroppableOptions> | ||
>(); | ||
|
||
export const vDraggable: Directive< | ||
HTMLElement, | ||
DraggableOptions, | ||
never, | ||
never | ||
> = { | ||
mounted(el, binding) { | ||
draggableElements.set(el, makeDraggable(el, binding.value)); | ||
}, | ||
updated(el, binding) { | ||
const l = draggableElements.get(el); | ||
if (l) l.update(binding.value); | ||
}, | ||
unmounted(el) { | ||
const l = draggableElements.get(el); | ||
if (l) l.cancel(); | ||
draggableElements.delete(el); | ||
}, | ||
}; | ||
|
||
export const vDroppable: Directive< | ||
HTMLElement, | ||
DroppableOptions, | ||
never, | ||
never | ||
> = { | ||
mounted(el, binding) { | ||
droppableElements.set(el, makeDroppable(el, binding.value)); | ||
}, | ||
updated(el, binding) { | ||
const l = droppableElements.get(el); | ||
if (l) l.update(binding.value); | ||
}, | ||
unmounted(el) { | ||
const l = droppableElements.get(el); | ||
if (l) l.cancel(); | ||
droppableElements.delete(el); | ||
}, | ||
}; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.