nice-elements 1.8.4 → 1.8.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## v1.8.5 (7.6.2023)
4
+
5
+ - added filter again when dropdown is open in nice-dropdown,
6
+ - added clear search button to nice-dropdown,
7
+ - removed keydown and keypress event bind in nice-dropdown,
8
+ - added aria support for nice-dropdown
9
+
3
10
  ## v1.8.4 (2.6.2023)
4
11
 
5
12
  - added filterFunction to nice dropdown,
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ![Nice elements](https://github.com/Klemen1337/angularjs-nice-elements/raw/master/demo/assets/logo.png)
2
2
 
3
- # Nice elements v1.8.4
3
+ # Nice elements v1.8.5
4
4
 
5
5
  Nice elements is an AngularJS v1.5.8 module that contains nice form elements like inputs, choice fields, search, toggle, dropdown, etc.
6
6
 
package/bower.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nice-elements",
3
- "version": "1.8.4",
3
+ "version": "1.8.5",
4
4
  "authors": [
5
5
  "Klemen Kastelic <klemen@olaii.com>"
6
6
  ],
package/dist/nice.js CHANGED
@@ -18,7 +18,7 @@ angular.module('niceElements')
18
18
  label: '@'
19
19
  },
20
20
  link: function postLink(scope, element, attrs) {
21
- if (angular.isDefined(scope.model)){
21
+ if (angular.isDefined(scope.model)) {
22
22
  scope.model = false;
23
23
  }
24
24
  }
@@ -655,14 +655,14 @@ angular.module('niceElements')
655
655
  * # clickOutside
656
656
  */
657
657
  angular.module('niceElements')
658
- .directive('clickOutside', function($document, $parse, $timeout){
658
+ .directive('clickOutside', function ($document, $parse, $timeout) {
659
659
  return {
660
660
  restrict: 'A',
661
661
  link: function ($scope, elem, attr) {
662
662
  $scope.isOpen = false;
663
663
 
664
664
  // watch for is open
665
- attr.$observe('isOpen', function(value){
665
+ attr.$observe('isOpen', function (value) {
666
666
  $scope.isOpen = value == 'true';
667
667
  });
668
668
 
@@ -717,7 +717,7 @@ angular.module('niceElements')
717
717
  // if we have got this far, then we are good to go with processing the command passed in via the click-outside attribute
718
718
  $timeout(function () {
719
719
  fn = $parse(attr['clickOutside']);
720
- fn($scope, {event: e});
720
+ fn($scope, { event: e });
721
721
  });
722
722
  }
723
723
  }
@@ -751,7 +751,7 @@ angular.module('niceElements')
751
751
  });
752
752
  }
753
753
  };
754
- });
754
+ });
755
755
  'use strict';
756
756
 
757
757
  /**
@@ -942,7 +942,7 @@ angular.module('niceElements')
942
942
  */
943
943
  angular.module('niceElements')
944
944
 
945
- .directive('niceDateRange', function() {
945
+ .directive('niceDateRange', function () {
946
946
  return {
947
947
  restrict: 'E',
948
948
  transclude: true,
@@ -962,16 +962,16 @@ angular.module('niceElements')
962
962
  onChange: '&?'
963
963
  },
964
964
 
965
- link: function(scope, attrs){
965
+ link: function (scope, attrs) {
966
966
  if (!attrs.title) { attrs.title = ''; }
967
967
  if (!attrs.fieldWidth) { attrs.fieldWidth = 'col-sm-8'; }
968
968
  if (!attrs.labelWidth) { attrs.labelWidth = 'col-sm-4'; }
969
969
  if (!attrs.format) { attrs.format = 'dd.MM.yyyy'; }
970
970
  attrs.noMargin = angular.isDefined(attrs.noMargin);
971
971
 
972
- if(!angular.isDefined(scope.model)) {
972
+ if (!angular.isDefined(scope.model)) {
973
973
  var model = null;
974
- if(!angular.isDefined(scope.startOfTheYear)){
974
+ if (!angular.isDefined(scope.startOfTheYear)) {
975
975
  model = {
976
976
  startDate: moment().format(),
977
977
  endDate: moment().format()
@@ -987,7 +987,7 @@ angular.module('niceElements')
987
987
  }
988
988
  },
989
989
 
990
- controller: function($scope) {
990
+ controller: function ($scope) {
991
991
  $scope.opts = {
992
992
  locale: {
993
993
  applyClass: 'btn-green',
@@ -1003,7 +1003,7 @@ angular.module('niceElements')
1003
1003
  $scope.opts.ranges[gettextCatalog.getString("Last 30 days", null, "Nice")] = [moment().subtract(30, 'days'), moment()];
1004
1004
  $scope.opts.ranges[gettextCatalog.getString("This month", null, "Nice")] = [moment().startOf('month'), moment().endOf('month')];
1005
1005
 
1006
- if(angular.isDefined($scope.format)) $scope.opts.format = format;
1006
+ if (angular.isDefined($scope.format)) $scope.opts.format = format;
1007
1007
  }
1008
1008
 
1009
1009
  };
@@ -2353,6 +2353,7 @@ angular.module('niceElements')
2353
2353
  enableLoadMore: '@' // Enable load more
2354
2354
  },
2355
2355
  controller: function ($scope, $http, $element, $timeout, gettextCatalog, NiceService) {
2356
+ $scope.id = Math.random().toString(36).substring(7);
2356
2357
  if (!$scope.dropdownDistance) { $scope.dropdownDistance = 5; }
2357
2358
  if (!$scope.objValue) { $scope.objValue = 'value'; }
2358
2359
  if (!$scope.objKey) { $scope.objKey = 'id'; }
@@ -2369,7 +2370,7 @@ angular.module('niceElements')
2369
2370
  $scope.clearOnSelect = $scope.clearOnSelect === 'true' || $scope.clearOnSelect === true;
2370
2371
  $scope.isOpen = false;
2371
2372
  $scope.selected = null;
2372
- $scope.selectedIndex = 0;
2373
+ // $scope.selectedIndex = 0;
2373
2374
  $scope.popper = null;
2374
2375
 
2375
2376
  $scope.internal = {
@@ -2432,6 +2433,7 @@ angular.module('niceElements')
2432
2433
  $scope.popper.update();
2433
2434
  $timeout(function () {
2434
2435
  $scope.isOpen = true;
2436
+ $scope.handleSearch();
2435
2437
  $timeout(function () {
2436
2438
  $scope.popper.update();
2437
2439
  });
@@ -2523,6 +2525,7 @@ angular.module('niceElements')
2523
2525
 
2524
2526
  // ----------------------------------- Search -----------------------------------
2525
2527
  $scope.handleSearch = function () {
2528
+ if (!$scope.searchFunction) return;
2526
2529
  $scope.loading = true;
2527
2530
  $scope.searchFunction($scope.internal.search).then(function (response) {
2528
2531
  if ($scope.filterFunction) $scope.internalList = $scope.filterFunction(response);
@@ -2535,6 +2538,11 @@ angular.module('niceElements')
2535
2538
  });
2536
2539
  };
2537
2540
 
2541
+ $scope.clearSearch = function () {
2542
+ $scope.internal.search = "";
2543
+ $scope.handleSearch();
2544
+ }
2545
+
2538
2546
 
2539
2547
  // ----------------------------------- Item clicked -----------------------------------
2540
2548
  $scope.handleSelected = function (item, index) {
@@ -2652,7 +2660,7 @@ angular.module('niceElements')
2652
2660
  if (i[$scope.objKey] == s) {
2653
2661
  i._selected = true;
2654
2662
  // $scope.selected.push(i);
2655
- $scope.selectedIndex = index;
2663
+ // $scope.selectedIndex = index;
2656
2664
  }
2657
2665
  });
2658
2666
  } else {
@@ -2660,7 +2668,7 @@ angular.module('niceElements')
2660
2668
  if ($scope.selected != null && i[$scope.objKey] == $scope.selected) {
2661
2669
  i._selected = true;
2662
2670
  $scope.selected = i;
2663
- $scope.selectedIndex = index;
2671
+ // $scope.selectedIndex = index;
2664
2672
  $scope.scrollToHover();
2665
2673
  }
2666
2674
  }
@@ -2672,7 +2680,7 @@ angular.module('niceElements')
2672
2680
  if (i[$scope.objKey] == s[$scope.objKey]) {
2673
2681
  i._selected = true;
2674
2682
  // $scope.selected.push(i);
2675
- $scope.selectedIndex = index;
2683
+ // $scope.selectedIndex = index;
2676
2684
  }
2677
2685
  });
2678
2686
  } else {
@@ -2680,7 +2688,7 @@ angular.module('niceElements')
2680
2688
  if ($scope.selected != null && i[$scope.objKey] == $scope.selected[$scope.objKey]) {
2681
2689
  i._selected = true;
2682
2690
  $scope.selected = i;
2683
- $scope.selectedIndex = index;
2691
+ // $scope.selectedIndex = index;
2684
2692
  $scope.scrollToHover();
2685
2693
  }
2686
2694
  }
@@ -2694,48 +2702,48 @@ angular.module('niceElements')
2694
2702
  }
2695
2703
 
2696
2704
  // ----------------------------------- Watch for keydown and keypress -----------------------------------
2697
- $element.bind("keydown keypress", function (event) {
2698
- // Arrow Up
2699
- if (event.keyCode == 38) {
2700
- event.preventDefault();
2701
- $timeout(function () {
2702
- if ($scope.selectedIndex > 0) {
2703
- $scope.selectedIndex -= 1;
2704
- $timeout(function () {
2705
- $scope.scrollToHover();
2706
- });
2707
- }
2708
- });
2709
- }
2710
-
2711
- // Arrow Down
2712
- if (event.keyCode == 40) {
2713
- event.preventDefault();
2714
- $timeout(function () {
2715
- if ($scope.internalList && $scope.selectedIndex < $scope.internalList.length - 1) {
2716
- $scope.selectedIndex += 1;
2717
- $timeout(function () {
2718
- $scope.scrollToHover();
2719
- });
2720
- }
2721
- });
2722
- }
2723
-
2724
- // Enter
2725
- if (event.keyCode == 13) {
2726
- event.preventDefault();
2727
- $timeout(function () {
2728
- $scope.handleSelected($scope.internalList[$scope.selectedIndex], $scope.selectedIndex);
2729
- });
2730
- }
2731
-
2732
- // Escape
2733
- if (event.keyCode == 27) {
2734
- $timeout(function () {
2735
- $scope.close();
2736
- });
2737
- }
2738
- });
2705
+ // $element.bind("keydown keypress", function (event) {
2706
+ // // Arrow Up
2707
+ // if (event.keyCode == 38) {
2708
+ // event.preventDefault();
2709
+ // $timeout(function () {
2710
+ // if ($scope.selectedIndex > 0) {
2711
+ // $scope.selectedIndex -= 1;
2712
+ // $timeout(function () {
2713
+ // $scope.scrollToHover();
2714
+ // });
2715
+ // }
2716
+ // });
2717
+ // }
2718
+
2719
+ // // Arrow Down
2720
+ // if (event.keyCode == 40) {
2721
+ // event.preventDefault();
2722
+ // $timeout(function () {
2723
+ // if ($scope.internalList && $scope.selectedIndex < $scope.internalList.length - 1) {
2724
+ // $scope.selectedIndex += 1;
2725
+ // $timeout(function () {
2726
+ // $scope.scrollToHover();
2727
+ // });
2728
+ // }
2729
+ // });
2730
+ // }
2731
+
2732
+ // // Enter
2733
+ // if (event.keyCode == 13) {
2734
+ // event.preventDefault();
2735
+ // $timeout(function () {
2736
+ // $scope.handleSelected($scope.internalList[$scope.selectedIndex], $scope.selectedIndex);
2737
+ // });
2738
+ // }
2739
+
2740
+ // // Escape
2741
+ // if (event.keyCode == 27) {
2742
+ // $timeout(function () {
2743
+ // $scope.close();
2744
+ // });
2745
+ // }
2746
+ // });
2739
2747
 
2740
2748
  $scope.handleDefault();
2741
2749
 
@@ -3636,25 +3644,25 @@ angular.module('niceElements')
3636
3644
  };
3637
3645
  });
3638
3646
 
3639
- 'use strict';
3640
-
3641
- /**
3642
- * @ngdoc directive
3643
- * @name niceElements.directive:niceIcon
3644
- * @description
3645
- * # niceIcon
3646
- */
3647
- angular.module('niceElements')
3648
- .directive('niceIcon', function () {
3649
- return {
3650
- templateUrl: 'src/components/nice-icon/nice-icon.html',
3651
- restrict: 'E',
3652
- replace: true,
3653
- scope: {
3654
- icon: '@',
3655
- size: '=',
3656
- },
3657
- };
3647
+ 'use strict';
3648
+
3649
+ /**
3650
+ * @ngdoc directive
3651
+ * @name niceElements.directive:niceIcon
3652
+ * @description
3653
+ * # niceIcon
3654
+ */
3655
+ angular.module('niceElements')
3656
+ .directive('niceIcon', function () {
3657
+ return {
3658
+ templateUrl: 'src/components/nice-icon/nice-icon.html',
3659
+ restrict: 'E',
3660
+ replace: true,
3661
+ scope: {
3662
+ icon: '@',
3663
+ size: '=',
3664
+ },
3665
+ };
3658
3666
  });
3659
3667
  angular.module('niceElements')
3660
3668
  .directive('niceInput', function () {
@@ -3894,42 +3902,42 @@ angular.module('niceElements')
3894
3902
 
3895
3903
  var messageElements = [];
3896
3904
 
3897
- var notify = function(args, t){
3905
+ var notify = function (args, t) {
3898
3906
 
3899
- if (typeof args !== 'object'){
3900
- args = {message:args};
3907
+ if (typeof args !== 'object') {
3908
+ args = { message: args };
3901
3909
  }
3902
3910
 
3903
3911
  args.template = args.template ? args.template : 'src/components/nice-notification/nice-notification.html';
3904
3912
  args.delay = !angular.isUndefined(args.delay) ? args.delay : delay;
3905
3913
  args.type = t ? t : '';
3906
3914
 
3907
- $http.get(args.template,{cache: $templateCache}).success(function(template) {
3915
+ $http.get(args.template, { cache: $templateCache }).success(function (template) {
3908
3916
 
3909
3917
  var scope = $rootScope.$new();
3910
3918
  scope.message = $sce.trustAsHtml(args.message);
3911
3919
  scope.title = $sce.trustAsHtml(args.title);
3912
- scope.t = args.type.substr(0,1);
3920
+ scope.t = args.type.substr(0, 1);
3913
3921
  scope.delay = args.delay;
3914
3922
 
3915
- if (typeof args.scope === 'object'){
3916
- for (var key in args.scope){
3923
+ if (typeof args.scope === 'object') {
3924
+ for (var key in args.scope) {
3917
3925
  scope[key] = args.scope[key];
3918
3926
  }
3919
3927
  }
3920
3928
 
3921
- var reposite = function() {
3929
+ var reposite = function () {
3922
3930
  var j = 0;
3923
3931
  var k = 0;
3924
3932
  var lastTop = startTop;
3925
3933
  var lastRight = startRight;
3926
- for(var i = messageElements.length - 1; i >= 0; i --) {
3934
+ for (var i = messageElements.length - 1; i >= 0; i--) {
3927
3935
  var element = messageElements[i];
3928
3936
  var elHeight = parseInt(element[0].offsetHeight);
3929
3937
  var elWidth = parseInt(element[0].offsetWidth);
3930
3938
  if ((top + elHeight) > window.innerHeight) {
3931
3939
  lastTop = startTop;
3932
- k ++;
3940
+ k++;
3933
3941
  j = 0;
3934
3942
  }
3935
3943
  var top = lastTop + (j === 0 ? 0 : verticalSpacing);
@@ -3939,22 +3947,22 @@ angular.module('niceElements')
3939
3947
  element.css('right', right + 'px');
3940
3948
 
3941
3949
  lastTop = top + elHeight;
3942
- j ++;
3950
+ j++;
3943
3951
  }
3944
3952
  };
3945
3953
 
3946
3954
  var templateElement = $compile(template)(scope);
3947
3955
  templateElement.addClass(args.type);
3948
- templateElement.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd click', function(e){
3956
+ templateElement.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd click', function (e) {
3949
3957
  e = e.originalEvent || e;
3950
- if (e.type === 'click' || (e.propertyName === 'opacity' && e.elapsedTime >= 0.4)){
3958
+ if (e.type === 'click' || (e.propertyName === 'opacity' && e.elapsedTime >= 0.4)) {
3951
3959
  templateElement.remove();
3952
3960
  messageElements.splice(messageElements.indexOf(templateElement), 1);
3953
3961
  reposite();
3954
3962
  }
3955
3963
  });
3956
3964
 
3957
- $timeout(function() {
3965
+ $timeout(function () {
3958
3966
  templateElement.addClass('killed');
3959
3967
  templateElement.remove();
3960
3968
  messageElements.splice(messageElements.indexOf(templateElement), 1);
@@ -3966,34 +3974,34 @@ angular.module('niceElements')
3966
3974
 
3967
3975
  $timeout(reposite);
3968
3976
 
3969
- }).error(function(data){
3970
- throw new Error('Template ('+args.template+') could not be loaded. ' + data);
3977
+ }).error(function (data) {
3978
+ throw new Error('Template (' + args.template + ') could not be loaded. ' + data);
3971
3979
  });
3972
3980
 
3973
3981
  };
3974
3982
 
3975
- notify.config = function(args){
3976
- startTop = args.top ? args.top : startTop;
3977
- verticalSpacing = args.verticalSpacing ? args.verticalSpacing : verticalSpacing;
3983
+ notify.config = function (args) {
3984
+ startTop = args.top ? args.top : startTop;
3985
+ verticalSpacing = args.verticalSpacing ? args.verticalSpacing : verticalSpacing;
3978
3986
  };
3979
3987
 
3980
- notify.primary = function() {
3988
+ notify.primary = function () {
3981
3989
  this(args, '');
3982
3990
  };
3983
3991
 
3984
- notify.error = function(args) {
3992
+ notify.error = function (args) {
3985
3993
  this(args, 'error');
3986
3994
  };
3987
3995
 
3988
- notify.success = function(args) {
3996
+ notify.success = function (args) {
3989
3997
  this(args, 'success');
3990
3998
  };
3991
3999
 
3992
- notify.info = function(args) {
4000
+ notify.info = function (args) {
3993
4001
  this(args, 'info');
3994
4002
  };
3995
4003
 
3996
- notify.warning = function(args) {
4004
+ notify.warning = function (args) {
3997
4005
  this(args, 'warning');
3998
4006
  };
3999
4007
 
@@ -4394,7 +4402,7 @@ angular.module('niceElements')
4394
4402
  * # niceProgressBar
4395
4403
  */
4396
4404
  angular.module('niceElements')
4397
- .directive('niceProgressBar', function() {
4405
+ .directive('niceProgressBar', function () {
4398
4406
  return {
4399
4407
  restrict: 'E',
4400
4408
  replace: true,
@@ -4409,29 +4417,29 @@ angular.module('niceElements')
4409
4417
  help: '@'
4410
4418
  },
4411
4419
 
4412
- controller: function($scope, $element, $timeout) {
4420
+ controller: function ($scope, $element, $timeout) {
4413
4421
  $scope.width = 0;
4414
- $scope.resize = function(){
4415
- $timeout(function() {
4422
+ $scope.resize = function () {
4423
+ $timeout(function () {
4416
4424
  $scope.width = $element[0].getElementsByClassName("progress")[0].offsetWidth;
4417
- },100);
4425
+ }, 100);
4418
4426
  };
4419
- window.onresize = function() {
4427
+ window.onresize = function () {
4420
4428
  $scope.resize();
4421
4429
  };
4422
4430
  $scope.resize();
4423
4431
 
4424
-
4425
4432
 
4426
- $scope.$watch("value", function(valueNew, valueOld){
4433
+
4434
+ $scope.$watch("value", function (valueNew, valueOld) {
4427
4435
  $scope.calculate();
4428
4436
  });
4429
4437
 
4430
- $scope.$watch("max", function(valueNew, valueOld){
4438
+ $scope.$watch("max", function (valueNew, valueOld) {
4431
4439
  $scope.calculate();
4432
4440
  });
4433
4441
 
4434
- $scope.calculate = function(){
4442
+ $scope.calculate = function () {
4435
4443
  $scope.percentage = ($scope.value / $scope.max) * 100;
4436
4444
  };
4437
4445
 
@@ -5457,24 +5465,24 @@ angular.module('niceElements')
5457
5465
  isInline: '=',
5458
5466
  help: '@'
5459
5467
  },
5460
- controller: function($scope, gettextCatalog) {
5468
+ controller: function ($scope, gettextCatalog) {
5461
5469
  if (!$scope.yes) { $scope.yes = gettextCatalog.getString('Yes', null, "Nice"); }
5462
5470
  if (!$scope.no) { $scope.no = gettextCatalog.getString('No', null, "Nice"); }
5463
5471
  if (!$scope.title) { $scope.title = ''; }
5464
5472
  if (!$scope.fieldWidth) { $scope.fieldWidth = 'col-sm-8'; }
5465
5473
  if (!$scope.labelWidth) { $scope.labelWidth = 'col-sm-4'; }
5466
- if(!angular.isDefined($scope.model) && !angular.isDefined($scope.options)) $scope.model = !angular.isDefined($scope.defaultFalse);
5467
- if(!angular.isDefined($scope.modelValue) && angular.isDefined($scope.options)) $scope.modelValue = $scope.options[0];
5474
+ if (!angular.isDefined($scope.model) && !angular.isDefined($scope.options)) $scope.model = !angular.isDefined($scope.defaultFalse);
5475
+ if (!angular.isDefined($scope.modelValue) && angular.isDefined($scope.options)) $scope.modelValue = $scope.options[0];
5468
5476
 
5469
5477
  $scope.defaultFalse = angular.isDefined($scope.defaultFalse);
5470
5478
  $scope.noMargin = angular.isDefined($scope.noMargin);
5471
5479
 
5472
5480
  $scope.buttonClass = "";
5473
-
5481
+
5474
5482
 
5475
5483
  // ------------------------- Set overlay button position based on passed state in $scope.model -------------------------
5476
- $scope.setButtonPosition = function(state) {
5477
- if(state) {
5484
+ $scope.setButtonPosition = function (state) {
5485
+ if (state) {
5478
5486
  $scope.buttonClass = "yesno-button-yes";
5479
5487
  } else {
5480
5488
  $scope.buttonClass = "yesno-button-no";
@@ -5482,48 +5490,48 @@ angular.module('niceElements')
5482
5490
  };
5483
5491
 
5484
5492
  // ------------------------- Watch for changes from outside -------------------------
5485
- $scope.$watch('model', function(value_new, value_old){
5486
- if(angular.isDefined($scope.model)){
5493
+ $scope.$watch('model', function (value_new, value_old) {
5494
+ if (angular.isDefined($scope.model)) {
5487
5495
  $scope.setButtonLabel($scope.model);
5488
5496
  $scope.setButtonPosition($scope.model);
5489
5497
  }
5490
5498
  });
5491
5499
 
5492
5500
  // ------------------------- Watch for model value -------------------------
5493
- $scope.$watch('modelValue', function(value_new, value_old){
5494
- if($scope.options){
5501
+ $scope.$watch('modelValue', function (value_new, value_old) {
5502
+ if ($scope.options) {
5495
5503
  $scope.model = $scope.modelValue == $scope.options[0];
5496
5504
  }
5497
5505
  });
5498
5506
 
5499
5507
  // ------------------------- Set button label -------------------------
5500
- $scope.setButtonLabel = function(state){
5508
+ $scope.setButtonLabel = function (state) {
5501
5509
  if (state) {
5502
5510
  $scope.state = $scope.yes;
5503
5511
  } else {
5504
5512
  $scope.state = $scope.no;
5505
5513
  }
5506
5514
  };
5507
-
5515
+
5508
5516
  // ------------------------- Set width -------------------------
5509
- $scope.setWidth = function(width, el){
5517
+ $scope.setWidth = function (width, el) {
5510
5518
  el.style.width = width;
5511
5519
  };
5512
-
5520
+
5513
5521
 
5514
5522
  // ------------------------- Switch -------------------------
5515
- $scope.switch = function(){
5516
- if(!$scope.isDisabled){
5523
+ $scope.switch = function () {
5524
+ if (!$scope.isDisabled) {
5517
5525
  $scope.model = !$scope.model;
5518
-
5519
- if($scope.options){
5520
- if($scope.model){
5526
+
5527
+ if ($scope.options) {
5528
+ if ($scope.model) {
5521
5529
  $scope.modelValue = $scope.options[0];
5522
5530
  } else {
5523
5531
  $scope.modelValue = $scope.options[1];
5524
5532
  }
5525
5533
  }
5526
-
5534
+
5527
5535
  if ($scope.onChange) $scope.onChange({ model: $scope.model });
5528
5536
  $scope.formYesno.$setDirty();
5529
5537
  }
@@ -5585,7 +5593,7 @@ angular.module('niceElements')
5585
5593
  .service('NiceService', function () {
5586
5594
  var service = {
5587
5595
  name: "Nice elements",
5588
- version: "1.8.4",
5596
+ version: "1.8.5",
5589
5597
  getHeader: function () {
5590
5598
  return {};
5591
5599
  }
@@ -5593,7 +5601,7 @@ angular.module('niceElements')
5593
5601
 
5594
5602
  return service;
5595
5603
  })
5596
- angular.module('niceElements').run(['$templateCache', function($templateCache) {
5604
+ angular.module('niceElements').run(['$templateCache', function ($templateCache) {
5597
5605
  'use strict';
5598
5606
 
5599
5607
  $templateCache.put('src/components/nice-button-toggle/nice-button-toggle.html',
@@ -6035,7 +6043,7 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
6035
6043
  "<nice-title title=\"title\" help=\"help\" required=\"required\" label-width=\"labelWidth\"></nice-title>\n" +
6036
6044
  "<div class=\"nice-field col-xs-12\" ng-class=\"[ fieldWidth ? fieldWidth : 'col-sm-8', { 'open': isOpen, 'nice-disabled': isDisabled || emptyList } ]\" click-outside=\"close()\" is-open=\"{{ isOpen }}\">\n" +
6037
6045
  "<div class=\"nice-field-wrapper\">\n" +
6038
- "<button class=\"btn btn-dropdown\" type=\"button\" ng-ref=\"dropdown-button\" ng-click=\"toggle()\" ng-disabled=\"isDisabled || emptyList\">\n" +
6046
+ "<button class=\"btn btn-dropdown\" type=\"button\" ng-ref=\"dropdown-button\" ng-click=\"toggle()\" ng-disabled=\"isDisabled || emptyList\" aria-expanded=\"{{ isOpen }}\" aria-haspopup=\"true\" aria-controls=\"menu\" id=\"nice-dropdown-{{ id }}\">\n" +
6039
6047
  "<div class=\"btn-dropdown-inside\" ng-transclude=\"button\" ng-if=\"selected != null\">\n" +
6040
6048
  "<span ng-if=\"!multiple\">{{ selected[objValue] }}</span>\n" +
6041
6049
  "<span ng-if=\"multiple\">\n" +
@@ -6053,17 +6061,18 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
6053
6061
  "<div class=\"search-bar\" ng-if=\"searchFunction\">\n" +
6054
6062
  "<input ng-model=\"internal.search\" ng-model-options=\"{ debounce: 500 }\" ng-change=\"handleSearch()\" placeholder=\"{{ searchText }}\">\n" +
6055
6063
  "<div class=\"count\" ng-if=\"internalList && internalList._metadata && enableLoadMore\">{{ internalList.length }}/{{ internalList._metadata.count }}</div>\n" +
6056
- "<nice-icon class=\"icon\" icon=\"icon-search\"></nice-icon>\n" +
6064
+ "<nice-icon ng-if=\"!internal.search\" class=\"icon\" icon=\"icon-search\"></nice-icon>\n" +
6065
+ "<nice-icon ng-if=\"internal.search\" class=\"icon icon-trash\" icon=\"icon-trash\" ng-click=\"clearSearch()\"></nice-icon>\n" +
6057
6066
  "</div>\n" +
6058
- "<div class=\"nice-dropdown-items\">\n" +
6059
- "<div class=\"nice-no-data\" ng-if=\"internalList && internalList.length == 0\">{{ noDataText }}</div>\n" +
6060
- "<div class=\"nice-dropdown-item null-item\" ng-if=\"nullable && internalList.length != 0\" ng-click=\"handleSelected(null, -1)\">\n" +
6067
+ "<div class=\"nice-dropdown-items\" aria-labelledby=\"nice-dropdown-{{ id }}\" role=\"listbox\">\n" +
6068
+ "<div role=\"none\" class=\"nice-no-data\" ng-if=\"internalList && internalList.length == 0\">{{ noDataText }}</div>\n" +
6069
+ "<button role=\"option\" class=\"nice-dropdown-item null-item\" ng-if=\"nullable && internalList.length != 0\" ng-click=\"handleSelected(null, -1)\">\n" +
6061
6070
  "{{ nullableText }}\n" +
6062
- "</div>\n" +
6063
- "<div class=\"nice-dropdown-item\" ng-repeat=\"item in internalList\" ng-click=\"handleSelected(item, $index)\" ng-class=\"{ 'selected': item._selected, 'hover': $index == selectedIndex }\">\n" +
6064
- "<div class=\"choice-checkbox\" ng-if=\"multiple\"><i class=\"fa fa-check\"></i></div>\n" +
6071
+ "</button>\n" +
6072
+ "<button role=\"option\" class=\"nice-dropdown-item\" ng-repeat=\"item in internalList\" ng-click=\"handleSelected(item, $index)\" ng-class=\"{ 'selected': item._selected }\">\n" +
6073
+ "<div class=\"choice-checkbox\" ng-if=\"multiple\" role=\"menuitemcheckbox\"><i class=\"fa fa-check\"></i></div>\n" +
6065
6074
  "<div class=\"choice-option\" ng-transclude=\"option\" ng-class=\"{ 'multiple-item': multiple }\">{{ item[objValue] }}</div>\n" +
6066
- "</div>\n" +
6075
+ "</button>\n" +
6067
6076
  "</div>\n" +
6068
6077
  "</div>\n" +
6069
6078
  "</div>\n" +