mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 13:17:08 +00:00
Return also labels from <dougal-context-menu/>.
Keeping in mind that the input model is a tree and labels may be at any level in the tree, not just in the leaves.
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
<dougal-context-menu v-if="item.items"
|
||||
:value="showSubmenu"
|
||||
:items="item.items"
|
||||
:labels="labels.concat(item.labels||[])"
|
||||
@input="selected"
|
||||
submenu>
|
||||
<template v-slot:activator="{ on, attrs }">
|
||||
@@ -56,6 +57,7 @@ export default {
|
||||
|
||||
props: {
|
||||
value: { type: [ MouseEvent, Object, Boolean ] },
|
||||
labels: { type: [ Array ], default: () => [] },
|
||||
absolute: { type: Boolean, default: false },
|
||||
submenu: { type: Boolean, default: false },
|
||||
items: { type: Array, default: () => [] }
|
||||
@@ -97,7 +99,12 @@ export default {
|
||||
|
||||
selected (item) {
|
||||
this.show = false;
|
||||
this.$emit('input', item);
|
||||
if (typeof item === 'object' && item !== null) {
|
||||
const labels = this.labels.concat(item.labels??[]);
|
||||
this.$emit('input', {...item, labels});
|
||||
} else {
|
||||
this.$emit('input', item);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user