mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 00:12:15 +00:00
Allow treemenu entries to become draggables
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
import drop from '../../../directives/drop.js';
|
||||
import draggable from '../../../directives/draggable.js';
|
||||
|
||||
export default {
|
||||
directives: {
|
||||
drop
|
||||
drop,
|
||||
draggable
|
||||
},
|
||||
emits: [
|
||||
'drop'
|
||||
@@ -37,6 +39,16 @@ export default {
|
||||
const effect = allowed.shift();
|
||||
|
||||
return { effect, allowed };
|
||||
},
|
||||
dragConfig() {
|
||||
if (!this.node.data?.draggable)
|
||||
return null;
|
||||
|
||||
let config = [ ...this.node.data.draggable ];
|
||||
const effect = config.shift();
|
||||
const value = JSON.parse(config.shift());
|
||||
|
||||
return { effect, value };
|
||||
}
|
||||
},
|
||||
template: /* html */`
|
||||
@@ -44,6 +56,7 @@ export default {
|
||||
class="treemenu-entry d-flex align-items-center w-100 h-100"
|
||||
:title="title"
|
||||
v-drop:[dropConfig]="(evt, data) => $emit('drop', { drop: node.data, drag: data })"
|
||||
v-draggable:[dragConfig?.effect]="dragConfig?.value"
|
||||
>
|
||||
{{ name }}
|
||||
</span>`
|
||||
|
||||
Reference in New Issue
Block a user