Skip to content

Commit

Permalink
fixed search bug
Browse files Browse the repository at this point in the history
  • Loading branch information
undergroundwires committed Jan 11, 2020
1 parent 5b743a6 commit 31364bd
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 21 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

- All notable changes to this project will be documented in this file.

## [Unreleased]
## Unreleased

- Fixed search bug

## [0.4.0] - 2020-01-11

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
@Prop() public initialNodes?: ReadonlyArray<INode>;
public initialLiquourTreeNodes?: ILiquorTreeNewNode[] = null;
public liquorTreeOptions = DefaultOptions;
public liquorTreeOptions = this.getDefaults();
public convertExistingToNode = convertExistingToNode;
public mounted() {
Expand Down Expand Up @@ -98,6 +98,27 @@
}
return (this.$refs.treeElement as any).tree;
}
private getDefaults(): ILiquorTreeOptions {
return {
multiple: true,
checkbox: true,
checkOnSelect: true,
autoCheckChildren: true,
parentSelect: false,
keyboardNavigation: true,
deletion: (node) => !node.children || node.children.length === 0,
filter: {
matcher: (query: string, node: ILiquorTreeExistingNode) => {
if (!this.filterPredicate) {
throw new Error('Cannot filter as predicate is null');
}
return this.filterPredicate(convertExistingToNode(node));
},
emptyText: '🕵️Hmm.. Can not see one 🧐',
},
};
}
}
function recurseDown(
Expand Down Expand Up @@ -132,25 +153,6 @@
}
return result;
}
const DefaultOptions: ILiquorTreeOptions = {
multiple: true,
checkbox: true,
checkOnSelect: true,
autoCheckChildren: true,
parentSelect: false,
keyboardNavigation: true,
deletion: (node) => !node.children || node.children.length === 0,
filter: {
matcher: (query: string, node: ILiquorTreeExistingNode) => {
if (!this.filterPredicate) {
throw new Error('Cannot filter as predicate is null');
}
return this.filterPredicate(convertExistingToNode(node));
},
emptyText: '🕵️Hmm.. Can not see one 🧐',
},
};
</script>


Expand Down

0 comments on commit 31364bd

Please sign in to comment.