From 5961d7f241c9d3f706acec4000b272afa700a943 Mon Sep 17 00:00:00 2001 From: Y Abdelmonem Date: Fri, 10 Aug 2018 15:20:21 +0200 Subject: [PATCH] MDM-15994: Fix broken initial state of searchbar, remove unnecessary watcher, fix wrong search icon animation state --- CHANGELOG.md | 4 ++++ package.json | 2 +- src-relution/mwComponentsBb.js | 13 +++---------- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e645e78..e35cca10 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# v1.23.3 +## Features +- Fix broken initial state of searchbar (#222) + # v1.23.2 ## Features - Make option group body clickable to select option (#214) diff --git a/package.json b/package.json index 94b5398e..5fc5a59a 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "mw-uikit", "description": "A toolbox to build portals with AngularJS 1.5.x that have a lot of forms and list views for example admin portals to manage data.", "author": "Alexander Zarges (http://relution.io)", - "version": "1.23.2", + "version": "1.23.3", "license": "Apache-2.0", "devDependencies": { "angular": "1.5.7", diff --git a/src-relution/mwComponentsBb.js b/src-relution/mwComponentsBb.js index 1e82a2a5..19199099 100644 --- a/src-relution/mwComponentsBb.js +++ b/src-relution/mwComponentsBb.js @@ -42,8 +42,7 @@ angular.module('mwComponentsBb', []) scope.inputSearchId = scope.inputSearchId || 'mw_input_search_field'; var inputEl = el.find('input'), collection, - listCollectionFilter, - canSearch = false; + listCollectionFilter; var setFilterVal = function (val) { if (scope.customUrlParameter) { @@ -64,7 +63,7 @@ angular.module('mwComponentsBb', []) }; scope.search = function () { - if (canSearch && scope.viewModel.searchVal.length >= scope.minLength) { + if (scope.viewModel.searchVal.length >= scope.minLength) { scope.searching = true; //backup searched text to reset after fetch complete in case of search text was empty setFilterVal(scope.viewModel.searchVal); @@ -75,6 +74,7 @@ angular.module('mwComponentsBb', []) }); } else { $q.reject(); + scope.searching = false; } }; @@ -136,16 +136,9 @@ angular.module('mwComponentsBb', []) } }, function (val) { if (val && val !== scope.viewModel.searchVal) { - canSearch = true; scope.viewModel.searchVal = val; } }); - - scope.$watch('viewModel.searchVal', function (val) { - if (val && val.length > 0) { - canSearch = true; - } - }); } }; })