Skip to content

Commit 753fb7f

Browse files
committed
🎨 Added support to toggle guideline visibility
1 parent 75a5f80 commit 753fb7f

File tree

2 files changed

+22
-11
lines changed

2 files changed

+22
-11
lines changed

src/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<div style="display: flex">
33
<!-- Example of how to customise appearance of tree items -->
4-
<tree-view :treeViewItems="treeViewNodes" @created="customiseTreeView" selectionMode='Multiple'>
4+
<tree-view :treeViewItems="treeViewNodes" @created="customiseTreeView" :hideGuideLines="true">
55
<template v-slot:icon="treeViewItem">
66
<img src="@/assets/folder.svg" alt="folder" v-if="treeViewItem.type === 'folder'" >
77
<img src="@/assets/word.svg" alt="vue-logo" v-else-if="treeViewItem.type === '.doc'" height="18" width="18">

src/components/treeView.vue/treeView.vue

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
@dragleave.stop="removeHoverClass">
1111

1212
<div class="d-flex align-items-center">
13+
<div class="horizontal-dashes" v-if="treeViewItem.parentId && hideGuideLines !== false" />
1314
<span class="chevron-right" v-if="treeViewItem.children && treeViewItem.children.length > 0" @click="toggleVisiblity(treeViewItem.id, $event)"></span>
1415
<div class="icon-area">
1516
<slot name="icon" v-bind="treeViewItem">
@@ -20,7 +21,7 @@
2021
:customisations="getItemCustomisation(treeViewItem.type)" />
2122
</div>
2223

23-
<div class="node-child hide">
24+
<div class="node-child hide" :class="{'hide-guidelines': hideGuideLines}">
2425
<tree-view :treeViewItems="treeViewItem.children" nested
2526
v-if="treeViewItem.children && treeViewItem.children.length > 0" >
2627
<template v-for="(_, slot) of $scopedSlots" v-slot:[slot]="props">
@@ -33,25 +34,27 @@
3334
</template>
3435

3536
<script lang='ts'>
36-
import {Vue, Component, Prop} from 'vue-property-decorator';
37-
import { TreeViewViewModel } from '@/businessLogic/treviewViewModel/treeViewViewModel'
38-
import { CheckedState, Customisations, ItemCheckedChangedEvent, TreeViewCreatedEventPayload, TreeViewItem } from '@/businessLogic/contracts/types';
37+
import {Vue, Component, Prop, Watch} from 'vue-property-decorator';
38+
import { TreeViewModel } from '@/businessLogic/treviewViewModel/treeViewViewModel'
39+
import { CheckedState, Customisations, ItemCheckedChangedEvent, SelectionMode, TreeViewCreatedEventPayload, TreeViewItem } from '@/businessLogic/contracts/types';
3940
import { ItemCustomisations } from "@/businessLogic/itemCustomisations/itemCustomisations";
4041
import { eventManager } from '@/businessLogic/eventHub/explorerEventPublisher';
4142
4243
@Component
4344
export default class TreeView extends Vue {
4445
@Prop({ default: () => { return [] }}) treeViewItems!: TreeViewItem[];
45-
viewModel = TreeViewViewModel;
4646
@Prop({ default: 'Multiple' }) selectionMode!: SelectionMode;
47+
@Prop({ default: false }) hideGuideLines!: boolean;
48+
@Prop({ default: true }) showSearch!: boolean;
49+
50+
viewModel = TreeViewModel;
4751
itemCustomisations = ItemCustomisations;
4852
4953
created(): void {
5054
const payload: TreeViewCreatedEventPayload = {
5155
itemCustomisations: this.itemCustomisations,
5256
eventManager
5357
};
54-
5558
this.$emit("created", payload);
5659
}
5760
@@ -156,7 +159,12 @@ ul {
156159
157160
.icon-area {
158161
width: 16px;
159-
margin-right: .7em;
162+
margin-right: 0.3em;
163+
}
164+
165+
.horizontal-dashes {
166+
width: 1em;
167+
border-top: 1px dashed rgb(192, 192, 192);
160168
}
161169
162170
.node-name {
@@ -165,8 +173,7 @@ ul {
165173
}
166174
167175
.node-child {
168-
margin-left: 32px !important;
169-
padding-left: 10px;
176+
margin-left: 35px !important;
170177
border-left: 1px dashed rgb(192, 192, 192);
171178
display: block;
172179
}
@@ -175,6 +182,10 @@ ul {
175182
display: none;
176183
}
177184
185+
.hide-guidelines {
186+
border-left: none !important;
187+
}
188+
178189
.chevron-right {
179190
box-sizing: border-box;
180191
position: relative;
@@ -202,6 +213,6 @@ ul {
202213
border-right: 2px solid;
203214
transform: rotate(-45deg);
204215
right: 6px;
205-
top: 4px
216+
top: 5px
206217
}
207218
</style>

0 commit comments

Comments
 (0)