From 9ef551f9049fcf66afc55edeffbeea1e82961586 Mon Sep 17 00:00:00 2001 From: Philipp Drebes Date: Tue, 26 Jul 2016 13:34:04 +0200 Subject: [PATCH 1/3] fix(tabindex): change the behavior of tabindex Change the tabindex so that it can be set from outside. The change also allows to interact with the select after tabbing in. Before it was not possible to type without clicking on the element first. --- src/bootstrap/match.tpl.html | 3 +-- src/bootstrap/select.tpl.html | 2 +- src/uiSelectDirective.js | 2 ++ 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/bootstrap/match.tpl.html b/src/bootstrap/match.tpl.html index 1dc23cd98..cf8bbc638 100644 --- a/src/bootstrap/match.tpl.html +++ b/src/bootstrap/match.tpl.html @@ -1,6 +1,5 @@
-
- Date: Tue, 26 Jul 2016 13:55:51 +0200 Subject: [PATCH 2/3] feat: add validation method which will be executed on blur Add property to add custom validation methods, that will be executed on blur. Acts as workaround for ng-blur when tabbing out of text input. --- src/bootstrap/select.tpl.html | 3 ++- src/uiSelectController.js | 2 ++ src/uiSelectDirective.js | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/bootstrap/select.tpl.html b/src/bootstrap/select.tpl.html index f541032d4..56c0dcc5a 100644 --- a/src/bootstrap/select.tpl.html +++ b/src/bootstrap/select.tpl.html @@ -8,7 +8,8 @@ class="form-control ui-select-search" placeholder="{{$select.placeholder}}" ng-model="$select.search" - ng-show="$select.searchEnabled && $select.open"> + ng-show="$select.searchEnabled && $select.open" + ng-blur="$select.inputBlur()">
diff --git a/src/uiSelectController.js b/src/uiSelectController.js index cbebb0017..64a2d15c6 100644 --- a/src/uiSelectController.js +++ b/src/uiSelectController.js @@ -43,6 +43,8 @@ uis.controller('uiSelectCtrl', ctrl.clickTriggeredSelect = false; ctrl.$filter = $filter; ctrl.$element = $element; + ctrl.customValidation = undefined; + ctrl.inputBlur = function () { if (ctrl.customValidation) $scope.$eval(ctrl.customValidation) }; // Use $injector to check for $animate and store a reference to it ctrl.$animate = (function () { diff --git a/src/uiSelectDirective.js b/src/uiSelectDirective.js index 2de58375c..67a52a54e 100644 --- a/src/uiSelectDirective.js +++ b/src/uiSelectDirective.js @@ -76,6 +76,10 @@ uis.directive('uiSelect', }); } + attrs.$observe('validation', function () { + $select.customValidation = attrs.validation; + }); + scope.$watch(function () { return scope.$eval(attrs.searchEnabled); }, function(newVal) { $select.searchEnabled = newVal !== undefined ? newVal : uiSelectConfig.searchEnabled; }); From 65f6bdb0b0e2e336c79e765be2001ed1f255ad09 Mon Sep 17 00:00:00 2001 From: Philipp Drebes Date: Tue, 26 Jul 2016 14:16:23 +0200 Subject: [PATCH 3/3] style: add missing semicolon --- src/uiSelectController.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uiSelectController.js b/src/uiSelectController.js index 64a2d15c6..66995a2e7 100644 --- a/src/uiSelectController.js +++ b/src/uiSelectController.js @@ -44,7 +44,7 @@ uis.controller('uiSelectCtrl', ctrl.$filter = $filter; ctrl.$element = $element; ctrl.customValidation = undefined; - ctrl.inputBlur = function () { if (ctrl.customValidation) $scope.$eval(ctrl.customValidation) }; + ctrl.inputBlur = function () { if (ctrl.customValidation) $scope.$eval(ctrl.customValidation); }; // Use $injector to check for $animate and store a reference to it ctrl.$animate = (function () {