Skip to content

Commit

Permalink
Merge 500f631 into 57a86a4
Browse files Browse the repository at this point in the history
  • Loading branch information
rthewhite committed Nov 2, 2015
2 parents 57a86a4 + 500f631 commit fe1366f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "anglue",
"version": "1.3.1",
"version": "1.3.2",
"authors": [
"Tommy Maintz <tommy.maintz@gmail.com>"
],
Expand Down
11 changes: 8 additions & 3 deletions dist/amd/behaviors/filterable-store.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/amd/behaviors/filterable-store.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 9 additions & 3 deletions src/behaviors/filterable-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export class FilterableStoreBehavior extends Behavior {
constructor(instance, {collection, transformerWeight} = {}) {
super(...arguments);

this.searchText = null;
this.collection = collection || 'items';
this.transformerWeight = transformerWeight || 25;
this.filters = new Map();
Expand Down Expand Up @@ -49,11 +50,15 @@ export class FilterableStoreBehavior extends Behavior {
this.doFilter();
}

onChangeSearch(expression) {
this.onChangeFilter('__search', expression);
onChangeSearch(searchText) {
if (angular.isString(searchText) && searchText.trim().length > 0) {
this.searchText = searchText.trim();
this.onChangeFilter('__search', searchText);
}
}

onClearSearch() {
this.searchText = null;
this.onClearFilter('__search');
}

Expand Down Expand Up @@ -112,7 +117,8 @@ export function FilterableStore(config) {
`${changeFilterHandlerName}:onChangeFilter`,
`${clearFilterHandlerName}:onClearFilter`,
`${changeSearchHandlerName}:onChangeSearch`,
`${clearSearchHandlerName}:onClearSearch`
`${clearSearchHandlerName}:onClearSearch`,
'searchText'
]
});
};
Expand Down

0 comments on commit fe1366f

Please sign in to comment.