Skip to content

Commit 205bf18

Browse files
committed
Added "depth" as computed property + css var of cursor
1 parent 3c5bdd1 commit 205bf18

File tree

4 files changed

+21
-16
lines changed

4 files changed

+21
-16
lines changed

dist/sl-vue-tree.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/sl-vue-tree.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/sl-vue-tree.js

+4
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ export default {
8787
return this.getParent().cursorPosition;
8888
},
8989

90+
depth() {
91+
return this.gaps.length
92+
},
93+
9094
nodes() {
9195
if (this.isRoot) {
9296
const nodeModels = this.copy(this.currentValue);

src/sl-vue-tree.vue

+15-14
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@
1414
<div
1515
class="sl-vue-tree-cursor sl-vue-tree-cursor_before"
1616
@dragover.prevent
17-
:style="{ visibility:
18-
cursorPosition &&
19-
cursorPosition.node.pathStr === node.pathStr &&
20-
cursorPosition.placement === 'before' ?
21-
'visible' :
22-
'hidden'
23-
}"
17+
:style="{
18+
'visibility': cursorPosition &&
19+
cursorPosition.node.pathStr === node.pathStr &&
20+
cursorPosition.placement === 'before' ?
21+
'visible' :
22+
'hidden',
23+
'--depth': depth
24+
}"
2425
>
2526
<!-- suggested place for node insertion -->
2627
</div>
@@ -121,13 +122,13 @@
121122
class="sl-vue-tree-cursor sl-vue-tree-cursor_after"
122123
@dragover.prevent
123124
:style="{
124-
visibility:
125-
cursorPosition &&
126-
cursorPosition.node.pathStr === node.pathStr &&
127-
cursorPosition.placement === 'after' ?
128-
'visible' :
129-
'hidden'
130-
}"
125+
'visibility': cursorPosition &&
126+
cursorPosition.node.pathStr === node.pathStr &&
127+
cursorPosition.placement === 'after' ?
128+
'visible' :
129+
'hidden',
130+
'--depth': depth
131+
}"
131132
>
132133
<!-- suggested place for node insertion -->
133134
</div>

0 commit comments

Comments
 (0)