Skip to content

Commit

Permalink
Merge pull request #251 from AyHaski/feature/change-expand-icon-and-s…
Browse files Browse the repository at this point in the history
…how-dividers

Feature/change expand icon and show dividers
  • Loading branch information
suusan2go authored Sep 12, 2020
2 parents 6b964d6 + 5ea5f0d commit 2d25810
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ Name | Type | Default | Description
--- | ---- | ---- | ---
value | Object | [] | items for treeview. `item-key`, `item-text`, `item-children` are not customizable currently. `value` can be like `{ id: 1, name: "test", children: []}` .
group | string | null | group name for vuedraggable. If this props not provided, drag and drop are enabled only in children.
expand-icon | string | 'mdi-menu-down' |mdi string for the expand icon.

### Events
Name | Value | Description
Expand Down
5 changes: 5 additions & 0 deletions src/DraggableTreeview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
:key="item.id"
:group="group"
:value="item"
:expand-icon="expandIcon"
@input="updateItem"
>
<template v-slot:prepend="{ item, open }">
Expand Down Expand Up @@ -48,6 +49,10 @@ export default Vue.extend({
type: String,
default: null,
},
expandIcon: {
type: String,
default: "mdi-menu-down"
}
},
data() {
return {
Expand Down
20 changes: 14 additions & 6 deletions src/DraggableTreeviewNode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@
<i
v-if="hasChildren"
role="button"
class="v-icon notranslate v-treeview-node__toggle v-icon--link mdi mdi-menu-down"
:class="{
'v-treeview-node__toggle--open': open,
'theme--dark': isDark,
'theme--light': !isDark,
}"
class="v-icon notranslate v-treeview-node__toggle v-icon--link mdi"
:class="[
{
'v-treeview-node__toggle--open': open,
'theme--dark': isDark,
'theme--light': !isDark
},
expandIcon
]"
/>
<slot name="prepend" v-bind="{ item: value, open }" />
<div class="v-treeview-node__label">
Expand All @@ -44,6 +47,7 @@
:group="group"
:value="child"
:level="level + 1"
:expand-icon="expandIcon"
@input="updateChildValue"
>
<template v-slot:prepend="{ item, open }">
Expand Down Expand Up @@ -97,6 +101,10 @@ export default Vue.extend({
type: String,
default: null,
},
expandIcon: {
type: String,
default: "mdi-menu-down"
},
},
data() {
return {
Expand Down

0 comments on commit 2d25810

Please sign in to comment.