Skip to content

Commit af480e7

Browse files
committed
Make the entire tree node clickable.
Use native checkbox instead of `x-check` component.
1 parent 1a32f94 commit af480e7

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

addon/components/x-tree-node.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ export default Component.extend({
99
layout,
1010
classNameBindings: ['model.isSelected:tree-highlight'],
1111

12+
click() {
13+
this.attrs.select(this.get('model'));
14+
},
15+
1216
mouseEnter(event) {
1317
let { hover } = this.attrs;
1418
if (hover) {

addon/styles/x-tree.css

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@
1212
list-style: none;
1313
}
1414

15-
.tree-node span {
16-
cursor: pointer;
17-
}
18-
1915
.tree-node .toggle-icon {
2016
color: #a5d4fd;
2117
cursor: pointer;
@@ -32,4 +28,5 @@
3228
.tree-node .tree-highlight {
3329
background-color: #f2f9fc;
3430
color: #333;
31+
cursor: pointer;
3532
}
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{{#if model.checkable}}
2-
{{x-check value=model.id checked=model.isChecked action=(action 'toggleCheck')}}
2+
<input type="checkbox" checked={{model.isChecked}}
3+
onclick={{action 'toggleCheck' bubbles=false}}>
34
{{/if}}
4-
<span class="toggle-icon" {{action 'toggleExpand'}}>
5+
<span class="toggle-icon" {{action 'toggleExpand' bubbles=false}}>
56
{{#if model.children.length}}
67
{{#if model.isExpanded}}
78
&#x25BC;
@@ -12,6 +13,5 @@
1213
&nbsp;&nbsp;
1314
{{/if}}
1415
</span>
15-
<span {{action select model}}>
16-
{{model.name}}
17-
</span>
16+
17+
{{model.name}}

0 commit comments

Comments
 (0)