Skip to content

Commit 09df159

Browse files
committed
Fixed non triState checkboxes
1 parent 4ab4906 commit 09df159

File tree

4 files changed

+22
-8
lines changed

4 files changed

+22
-8
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
<a name="8.0.4"></a>
2+
# 8.0.4 (2018-22-12)
3+
* Fixed non triState checkboxes
4+
* Fixed checkboxes example to switch expander and checkbox
5+
16
<a name="8.0.3"></a>
27
# 8.0.3 (2018-20-12)
38
* Fixed Warning on state bind

example/cli/src/styles.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,13 @@
11
/* You can add global styles to this file, and also import other style files */
22
@import '~angular-tree-component/dist/angular-tree-component.css';
3+
.reverse tree-node-expander {
4+
order: 0;
5+
}
6+
.reverse tree-node-checkbox {
7+
order: 1;
8+
}
9+
.reverse .node-content-wrapper {
10+
order: 2;
11+
}
12+
.root1Class { color: blue }
13+
.root2Class { color: red }

lib/models/tree-node.model.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,12 @@ export class TreeNode implements ITreeNode {
1616
@computed get isActive() { return this.treeModel.isActive(this); };
1717
@computed get isFocused() { return this.treeModel.isNodeFocused(this); };
1818
@computed get isSelected() {
19-
if (this.treeModel.options.useTriState) {
20-
if (this.isLeaf || !this.children) {
21-
return this.treeModel.isSelected(this);
22-
} else {
23-
return some(this.children, (node: TreeNode) => node.isSelected);
24-
}
19+
if (this.isLeaf || !this.children) {
20+
return this.treeModel.isSelected(this);
2521
} else {
26-
return this.treeModel.isSelected(this);
22+
const method = this.treeModel.options.useTriState ? some : every;
23+
24+
return method(this.children, (node: TreeNode) => node.isSelected);
2725
}
2826
};
2927
@computed get isAllSelected() {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-tree-component",
3-
"version": "8.0.3",
3+
"version": "8.0.4",
44
"description": "A simple yet powerful tree component for Angular2",
55
"author": "Adam Klein <adam@500tech.com>",
66
"homepage": "https://github.com/500tech/angular-tree-component",

0 commit comments

Comments
 (0)