nice-elements 1.8.4 → 1.8.6

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/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,13 +2370,17 @@ 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 = {
2376
2377
  search: ""
2377
2378
  };
2378
2379
 
2380
+ if ($scope.list) {
2381
+ $scope.originalList = angular.copy($scope.list);
2382
+ }
2383
+
2379
2384
  // Setup popper
2380
2385
  // https://popper.js.org/docs/v2/constructors/
2381
2386
  $scope.setupPopper = function () {
@@ -2430,6 +2435,7 @@ angular.module('niceElements')
2430
2435
 
2431
2436
  $scope.open = function () {
2432
2437
  $scope.popper.update();
2438
+ if ($scope.filterFunction) $scope.internalList = $scope.filterFunction($scope.originalList);
2433
2439
  $timeout(function () {
2434
2440
  $scope.isOpen = true;
2435
2441
  $timeout(function () {
@@ -2505,6 +2511,13 @@ angular.module('niceElements')
2505
2511
  };
2506
2512
 
2507
2513
 
2514
+ $scope.handleNewInternalList = function (items) {
2515
+ $scope.originalList = angular.copy(items);
2516
+ if ($scope.filterFunction) $scope.internalList = $scope.filterFunction($scope.originalList);
2517
+ else $scope.internalList = items;
2518
+ }
2519
+
2520
+
2508
2521
  // ----------------------------------- Scroll to hover -----------------------------------
2509
2522
  $scope.scrollToHover = function (notSmooth) {
2510
2523
  var dropdownMenu = $element[0].getElementsByClassName("nice-dropdown-menu")[0];
@@ -2523,10 +2536,10 @@ angular.module('niceElements')
2523
2536
 
2524
2537
  // ----------------------------------- Search -----------------------------------
2525
2538
  $scope.handleSearch = function () {
2539
+ if (!$scope.searchFunction) return;
2526
2540
  $scope.loading = true;
2527
2541
  $scope.searchFunction($scope.internal.search).then(function (response) {
2528
- if ($scope.filterFunction) $scope.internalList = $scope.filterFunction(response);
2529
- else $scope.internalList = response;
2542
+ $scope.handleNewInternalList(response);
2530
2543
  $scope.loading = false;
2531
2544
  $scope.handleDefault();
2532
2545
  }, function (error) {
@@ -2535,6 +2548,11 @@ angular.module('niceElements')
2535
2548
  });
2536
2549
  };
2537
2550
 
2551
+ $scope.clearSearch = function () {
2552
+ $scope.internal.search = "";
2553
+ $scope.handleSearch();
2554
+ }
2555
+
2538
2556
 
2539
2557
  // ----------------------------------- Item clicked -----------------------------------
2540
2558
  $scope.handleSelected = function (item, index) {
@@ -2628,8 +2646,7 @@ angular.module('niceElements')
2628
2646
 
2629
2647
  // ----------------------------------- Watch for list change -----------------------------------
2630
2648
  $scope.$watchCollection('list', function (value_new, value_old) {
2631
- if ($scope.filterFunction) $scope.internalList = $scope.filterFunction(angular.copy($scope.list));
2632
- else $scope.internalList = angular.copy($scope.list);
2649
+ $scope.handleNewInternalList(angular.copy($scope.list));
2633
2650
  $scope.handleDefault();
2634
2651
  });
2635
2652
 
@@ -2652,7 +2669,7 @@ angular.module('niceElements')
2652
2669
  if (i[$scope.objKey] == s) {
2653
2670
  i._selected = true;
2654
2671
  // $scope.selected.push(i);
2655
- $scope.selectedIndex = index;
2672
+ // $scope.selectedIndex = index;
2656
2673
  }
2657
2674
  });
2658
2675
  } else {
@@ -2660,7 +2677,7 @@ angular.module('niceElements')
2660
2677
  if ($scope.selected != null && i[$scope.objKey] == $scope.selected) {
2661
2678
  i._selected = true;
2662
2679
  $scope.selected = i;
2663
- $scope.selectedIndex = index;
2680
+ // $scope.selectedIndex = index;
2664
2681
  $scope.scrollToHover();
2665
2682
  }
2666
2683
  }
@@ -2672,7 +2689,7 @@ angular.module('niceElements')
2672
2689
  if (i[$scope.objKey] == s[$scope.objKey]) {
2673
2690
  i._selected = true;
2674
2691
  // $scope.selected.push(i);
2675
- $scope.selectedIndex = index;
2692
+ // $scope.selectedIndex = index;
2676
2693
  }
2677
2694
  });
2678
2695
  } else {
@@ -2680,7 +2697,7 @@ angular.module('niceElements')
2680
2697
  if ($scope.selected != null && i[$scope.objKey] == $scope.selected[$scope.objKey]) {
2681
2698
  i._selected = true;
2682
2699
  $scope.selected = i;
2683
- $scope.selectedIndex = index;
2700
+ // $scope.selectedIndex = index;
2684
2701
  $scope.scrollToHover();
2685
2702
  }
2686
2703
  }
@@ -2694,48 +2711,48 @@ angular.module('niceElements')
2694
2711
  }
2695
2712
 
2696
2713
  // ----------------------------------- 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
- });
2714
+ // $element.bind("keydown keypress", function (event) {
2715
+ // // Arrow Up
2716
+ // if (event.keyCode == 38) {
2717
+ // event.preventDefault();
2718
+ // $timeout(function () {
2719
+ // if ($scope.selectedIndex > 0) {
2720
+ // $scope.selectedIndex -= 1;
2721
+ // $timeout(function () {
2722
+ // $scope.scrollToHover();
2723
+ // });
2724
+ // }
2725
+ // });
2726
+ // }
2727
+
2728
+ // // Arrow Down
2729
+ // if (event.keyCode == 40) {
2730
+ // event.preventDefault();
2731
+ // $timeout(function () {
2732
+ // if ($scope.internalList && $scope.selectedIndex < $scope.internalList.length - 1) {
2733
+ // $scope.selectedIndex += 1;
2734
+ // $timeout(function () {
2735
+ // $scope.scrollToHover();
2736
+ // });
2737
+ // }
2738
+ // });
2739
+ // }
2740
+
2741
+ // // Enter
2742
+ // if (event.keyCode == 13) {
2743
+ // event.preventDefault();
2744
+ // $timeout(function () {
2745
+ // $scope.handleSelected($scope.internalList[$scope.selectedIndex], $scope.selectedIndex);
2746
+ // });
2747
+ // }
2748
+
2749
+ // // Escape
2750
+ // if (event.keyCode == 27) {
2751
+ // $timeout(function () {
2752
+ // $scope.close();
2753
+ // });
2754
+ // }
2755
+ // });
2739
2756
 
2740
2757
  $scope.handleDefault();
2741
2758
 
@@ -3636,25 +3653,25 @@ angular.module('niceElements')
3636
3653
  };
3637
3654
  });
3638
3655
 
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
- };
3656
+ 'use strict';
3657
+
3658
+ /**
3659
+ * @ngdoc directive
3660
+ * @name niceElements.directive:niceIcon
3661
+ * @description
3662
+ * # niceIcon
3663
+ */
3664
+ angular.module('niceElements')
3665
+ .directive('niceIcon', function () {
3666
+ return {
3667
+ templateUrl: 'src/components/nice-icon/nice-icon.html',
3668
+ restrict: 'E',
3669
+ replace: true,
3670
+ scope: {
3671
+ icon: '@',
3672
+ size: '=',
3673
+ },
3674
+ };
3658
3675
  });
3659
3676
  angular.module('niceElements')
3660
3677
  .directive('niceInput', function () {
@@ -3894,42 +3911,42 @@ angular.module('niceElements')
3894
3911
 
3895
3912
  var messageElements = [];
3896
3913
 
3897
- var notify = function(args, t){
3914
+ var notify = function (args, t) {
3898
3915
 
3899
- if (typeof args !== 'object'){
3900
- args = {message:args};
3916
+ if (typeof args !== 'object') {
3917
+ args = { message: args };
3901
3918
  }
3902
3919
 
3903
3920
  args.template = args.template ? args.template : 'src/components/nice-notification/nice-notification.html';
3904
3921
  args.delay = !angular.isUndefined(args.delay) ? args.delay : delay;
3905
3922
  args.type = t ? t : '';
3906
3923
 
3907
- $http.get(args.template,{cache: $templateCache}).success(function(template) {
3924
+ $http.get(args.template, { cache: $templateCache }).success(function (template) {
3908
3925
 
3909
3926
  var scope = $rootScope.$new();
3910
3927
  scope.message = $sce.trustAsHtml(args.message);
3911
3928
  scope.title = $sce.trustAsHtml(args.title);
3912
- scope.t = args.type.substr(0,1);
3929
+ scope.t = args.type.substr(0, 1);
3913
3930
  scope.delay = args.delay;
3914
3931
 
3915
- if (typeof args.scope === 'object'){
3916
- for (var key in args.scope){
3932
+ if (typeof args.scope === 'object') {
3933
+ for (var key in args.scope) {
3917
3934
  scope[key] = args.scope[key];
3918
3935
  }
3919
3936
  }
3920
3937
 
3921
- var reposite = function() {
3938
+ var reposite = function () {
3922
3939
  var j = 0;
3923
3940
  var k = 0;
3924
3941
  var lastTop = startTop;
3925
3942
  var lastRight = startRight;
3926
- for(var i = messageElements.length - 1; i >= 0; i --) {
3943
+ for (var i = messageElements.length - 1; i >= 0; i--) {
3927
3944
  var element = messageElements[i];
3928
3945
  var elHeight = parseInt(element[0].offsetHeight);
3929
3946
  var elWidth = parseInt(element[0].offsetWidth);
3930
3947
  if ((top + elHeight) > window.innerHeight) {
3931
3948
  lastTop = startTop;
3932
- k ++;
3949
+ k++;
3933
3950
  j = 0;
3934
3951
  }
3935
3952
  var top = lastTop + (j === 0 ? 0 : verticalSpacing);
@@ -3939,22 +3956,22 @@ angular.module('niceElements')
3939
3956
  element.css('right', right + 'px');
3940
3957
 
3941
3958
  lastTop = top + elHeight;
3942
- j ++;
3959
+ j++;
3943
3960
  }
3944
3961
  };
3945
3962
 
3946
3963
  var templateElement = $compile(template)(scope);
3947
3964
  templateElement.addClass(args.type);
3948
- templateElement.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd click', function(e){
3965
+ templateElement.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd click', function (e) {
3949
3966
  e = e.originalEvent || e;
3950
- if (e.type === 'click' || (e.propertyName === 'opacity' && e.elapsedTime >= 0.4)){
3967
+ if (e.type === 'click' || (e.propertyName === 'opacity' && e.elapsedTime >= 0.4)) {
3951
3968
  templateElement.remove();
3952
3969
  messageElements.splice(messageElements.indexOf(templateElement), 1);
3953
3970
  reposite();
3954
3971
  }
3955
3972
  });
3956
3973
 
3957
- $timeout(function() {
3974
+ $timeout(function () {
3958
3975
  templateElement.addClass('killed');
3959
3976
  templateElement.remove();
3960
3977
  messageElements.splice(messageElements.indexOf(templateElement), 1);
@@ -3966,34 +3983,34 @@ angular.module('niceElements')
3966
3983
 
3967
3984
  $timeout(reposite);
3968
3985
 
3969
- }).error(function(data){
3970
- throw new Error('Template ('+args.template+') could not be loaded. ' + data);
3986
+ }).error(function (data) {
3987
+ throw new Error('Template (' + args.template + ') could not be loaded. ' + data);
3971
3988
  });
3972
3989
 
3973
3990
  };
3974
3991
 
3975
- notify.config = function(args){
3976
- startTop = args.top ? args.top : startTop;
3977
- verticalSpacing = args.verticalSpacing ? args.verticalSpacing : verticalSpacing;
3992
+ notify.config = function (args) {
3993
+ startTop = args.top ? args.top : startTop;
3994
+ verticalSpacing = args.verticalSpacing ? args.verticalSpacing : verticalSpacing;
3978
3995
  };
3979
3996
 
3980
- notify.primary = function() {
3997
+ notify.primary = function () {
3981
3998
  this(args, '');
3982
3999
  };
3983
4000
 
3984
- notify.error = function(args) {
4001
+ notify.error = function (args) {
3985
4002
  this(args, 'error');
3986
4003
  };
3987
4004
 
3988
- notify.success = function(args) {
4005
+ notify.success = function (args) {
3989
4006
  this(args, 'success');
3990
4007
  };
3991
4008
 
3992
- notify.info = function(args) {
4009
+ notify.info = function (args) {
3993
4010
  this(args, 'info');
3994
4011
  };
3995
4012
 
3996
- notify.warning = function(args) {
4013
+ notify.warning = function (args) {
3997
4014
  this(args, 'warning');
3998
4015
  };
3999
4016
 
@@ -4264,6 +4281,36 @@ angular.module('niceElements')
4264
4281
 
4265
4282
  'use strict';
4266
4283
 
4284
+ /**
4285
+ * @ngdoc directive
4286
+ * @name niceElements.directive:nicePill
4287
+ * @description
4288
+ * # nicePill
4289
+ */
4290
+ angular.module('niceElements')
4291
+ .directive('nicePill', function () {
4292
+ return {
4293
+ templateUrl: 'src/components/nice-pill/nice-pill.html',
4294
+ restrict: 'E',
4295
+ transclude: true,
4296
+ scope: {
4297
+ model: '=',
4298
+ valueKey: '@',
4299
+ canDelete: '@',
4300
+ onDelete: '=?',
4301
+ },
4302
+ controller: function ($scope) {
4303
+ if (!$scope.valueKey) $scope.valueKey = "value";
4304
+
4305
+ $scope.handleDelete = function () {
4306
+ $scope.onDelete($scope.model)
4307
+ }
4308
+ }
4309
+ };
4310
+ });
4311
+
4312
+ 'use strict';
4313
+
4267
4314
  /**
4268
4315
  * @ngdoc directive
4269
4316
  * @name niceElements.directive:nicePopup
@@ -4394,7 +4441,7 @@ angular.module('niceElements')
4394
4441
  * # niceProgressBar
4395
4442
  */
4396
4443
  angular.module('niceElements')
4397
- .directive('niceProgressBar', function() {
4444
+ .directive('niceProgressBar', function () {
4398
4445
  return {
4399
4446
  restrict: 'E',
4400
4447
  replace: true,
@@ -4409,29 +4456,29 @@ angular.module('niceElements')
4409
4456
  help: '@'
4410
4457
  },
4411
4458
 
4412
- controller: function($scope, $element, $timeout) {
4459
+ controller: function ($scope, $element, $timeout) {
4413
4460
  $scope.width = 0;
4414
- $scope.resize = function(){
4415
- $timeout(function() {
4461
+ $scope.resize = function () {
4462
+ $timeout(function () {
4416
4463
  $scope.width = $element[0].getElementsByClassName("progress")[0].offsetWidth;
4417
- },100);
4464
+ }, 100);
4418
4465
  };
4419
- window.onresize = function() {
4466
+ window.onresize = function () {
4420
4467
  $scope.resize();
4421
4468
  };
4422
4469
  $scope.resize();
4423
4470
 
4424
-
4425
4471
 
4426
- $scope.$watch("value", function(valueNew, valueOld){
4472
+
4473
+ $scope.$watch("value", function (valueNew, valueOld) {
4427
4474
  $scope.calculate();
4428
4475
  });
4429
4476
 
4430
- $scope.$watch("max", function(valueNew, valueOld){
4477
+ $scope.$watch("max", function (valueNew, valueOld) {
4431
4478
  $scope.calculate();
4432
4479
  });
4433
4480
 
4434
- $scope.calculate = function(){
4481
+ $scope.calculate = function () {
4435
4482
  $scope.percentage = ($scope.value / $scope.max) * 100;
4436
4483
  };
4437
4484
 
@@ -5457,24 +5504,24 @@ angular.module('niceElements')
5457
5504
  isInline: '=',
5458
5505
  help: '@'
5459
5506
  },
5460
- controller: function($scope, gettextCatalog) {
5507
+ controller: function ($scope, gettextCatalog) {
5461
5508
  if (!$scope.yes) { $scope.yes = gettextCatalog.getString('Yes', null, "Nice"); }
5462
5509
  if (!$scope.no) { $scope.no = gettextCatalog.getString('No', null, "Nice"); }
5463
5510
  if (!$scope.title) { $scope.title = ''; }
5464
5511
  if (!$scope.fieldWidth) { $scope.fieldWidth = 'col-sm-8'; }
5465
5512
  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];
5513
+ if (!angular.isDefined($scope.model) && !angular.isDefined($scope.options)) $scope.model = !angular.isDefined($scope.defaultFalse);
5514
+ if (!angular.isDefined($scope.modelValue) && angular.isDefined($scope.options)) $scope.modelValue = $scope.options[0];
5468
5515
 
5469
5516
  $scope.defaultFalse = angular.isDefined($scope.defaultFalse);
5470
5517
  $scope.noMargin = angular.isDefined($scope.noMargin);
5471
5518
 
5472
5519
  $scope.buttonClass = "";
5473
-
5520
+
5474
5521
 
5475
5522
  // ------------------------- Set overlay button position based on passed state in $scope.model -------------------------
5476
- $scope.setButtonPosition = function(state) {
5477
- if(state) {
5523
+ $scope.setButtonPosition = function (state) {
5524
+ if (state) {
5478
5525
  $scope.buttonClass = "yesno-button-yes";
5479
5526
  } else {
5480
5527
  $scope.buttonClass = "yesno-button-no";
@@ -5482,48 +5529,48 @@ angular.module('niceElements')
5482
5529
  };
5483
5530
 
5484
5531
  // ------------------------- Watch for changes from outside -------------------------
5485
- $scope.$watch('model', function(value_new, value_old){
5486
- if(angular.isDefined($scope.model)){
5532
+ $scope.$watch('model', function (value_new, value_old) {
5533
+ if (angular.isDefined($scope.model)) {
5487
5534
  $scope.setButtonLabel($scope.model);
5488
5535
  $scope.setButtonPosition($scope.model);
5489
5536
  }
5490
5537
  });
5491
5538
 
5492
5539
  // ------------------------- Watch for model value -------------------------
5493
- $scope.$watch('modelValue', function(value_new, value_old){
5494
- if($scope.options){
5540
+ $scope.$watch('modelValue', function (value_new, value_old) {
5541
+ if ($scope.options) {
5495
5542
  $scope.model = $scope.modelValue == $scope.options[0];
5496
5543
  }
5497
5544
  });
5498
5545
 
5499
5546
  // ------------------------- Set button label -------------------------
5500
- $scope.setButtonLabel = function(state){
5547
+ $scope.setButtonLabel = function (state) {
5501
5548
  if (state) {
5502
5549
  $scope.state = $scope.yes;
5503
5550
  } else {
5504
5551
  $scope.state = $scope.no;
5505
5552
  }
5506
5553
  };
5507
-
5554
+
5508
5555
  // ------------------------- Set width -------------------------
5509
- $scope.setWidth = function(width, el){
5556
+ $scope.setWidth = function (width, el) {
5510
5557
  el.style.width = width;
5511
5558
  };
5512
-
5559
+
5513
5560
 
5514
5561
  // ------------------------- Switch -------------------------
5515
- $scope.switch = function(){
5516
- if(!$scope.isDisabled){
5562
+ $scope.switch = function () {
5563
+ if (!$scope.isDisabled) {
5517
5564
  $scope.model = !$scope.model;
5518
-
5519
- if($scope.options){
5520
- if($scope.model){
5565
+
5566
+ if ($scope.options) {
5567
+ if ($scope.model) {
5521
5568
  $scope.modelValue = $scope.options[0];
5522
5569
  } else {
5523
5570
  $scope.modelValue = $scope.options[1];
5524
5571
  }
5525
5572
  }
5526
-
5573
+
5527
5574
  if ($scope.onChange) $scope.onChange({ model: $scope.model });
5528
5575
  $scope.formYesno.$setDirty();
5529
5576
  }
@@ -5585,7 +5632,7 @@ angular.module('niceElements')
5585
5632
  .service('NiceService', function () {
5586
5633
  var service = {
5587
5634
  name: "Nice elements",
5588
- version: "1.8.4",
5635
+ version: "1.8.6",
5589
5636
  getHeader: function () {
5590
5637
  return {};
5591
5638
  }
@@ -5593,7 +5640,7 @@ angular.module('niceElements')
5593
5640
 
5594
5641
  return service;
5595
5642
  })
5596
- angular.module('niceElements').run(['$templateCache', function($templateCache) {
5643
+ angular.module('niceElements').run(['$templateCache', function ($templateCache) {
5597
5644
  'use strict';
5598
5645
 
5599
5646
  $templateCache.put('src/components/nice-button-toggle/nice-button-toggle.html',
@@ -6035,7 +6082,7 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
6035
6082
  "<nice-title title=\"title\" help=\"help\" required=\"required\" label-width=\"labelWidth\"></nice-title>\n" +
6036
6083
  "<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
6084
  "<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" +
6085
+ "<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
6086
  "<div class=\"btn-dropdown-inside\" ng-transclude=\"button\" ng-if=\"selected != null\">\n" +
6040
6087
  "<span ng-if=\"!multiple\">{{ selected[objValue] }}</span>\n" +
6041
6088
  "<span ng-if=\"multiple\">\n" +
@@ -6053,17 +6100,18 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
6053
6100
  "<div class=\"search-bar\" ng-if=\"searchFunction\">\n" +
6054
6101
  "<input ng-model=\"internal.search\" ng-model-options=\"{ debounce: 500 }\" ng-change=\"handleSearch()\" placeholder=\"{{ searchText }}\">\n" +
6055
6102
  "<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" +
6103
+ "<nice-icon ng-if=\"!internal.search\" class=\"icon\" icon=\"icon-search\"></nice-icon>\n" +
6104
+ "<nice-icon ng-if=\"internal.search\" class=\"icon icon-trash\" icon=\"icon-trash\" ng-click=\"clearSearch()\"></nice-icon>\n" +
6057
6105
  "</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" +
6106
+ "<div class=\"nice-dropdown-items\" aria-labelledby=\"nice-dropdown-{{ id }}\" role=\"listbox\">\n" +
6107
+ "<div role=\"none\" class=\"nice-no-data\" ng-if=\"internalList && internalList.length == 0\">{{ noDataText }}</div>\n" +
6108
+ "<button role=\"option\" class=\"nice-dropdown-item null-item\" ng-if=\"nullable && internalList.length != 0\" ng-click=\"handleSelected(null, -1)\">\n" +
6061
6109
  "{{ 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" +
6110
+ "</button>\n" +
6111
+ "<button role=\"option\" class=\"nice-dropdown-item\" ng-repeat=\"item in internalList\" ng-click=\"handleSelected(item, $index)\" ng-class=\"{ 'selected': item._selected }\">\n" +
6112
+ "<div class=\"choice-checkbox\" ng-if=\"multiple\" role=\"menuitemcheckbox\"><i class=\"fa fa-check\"></i></div>\n" +
6065
6113
  "<div class=\"choice-option\" ng-transclude=\"option\" ng-class=\"{ 'multiple-item': multiple }\">{{ item[objValue] }}</div>\n" +
6066
- "</div>\n" +
6114
+ "</button>\n" +
6067
6115
  "</div>\n" +
6068
6116
  "</div>\n" +
6069
6117
  "</div>\n" +
@@ -6312,6 +6360,14 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
6312
6360
  );
6313
6361
 
6314
6362
 
6363
+ $templateCache.put('src/components/nice-pill/nice-pill.html',
6364
+ "<div class=\"nice-pill\">\n" +
6365
+ "<div class=\"nice-pill-inner\" ng-transclude></div>\n" +
6366
+ "<nice-button class=\"nice-pill-remove btn-primary-naked\" icon=\"icon-x\" nice-click=\"handleDelete()\" ng-if=\"onDelete\"></nice-button>\n" +
6367
+ "</div>"
6368
+ );
6369
+
6370
+
6315
6371
  $templateCache.put('src/components/nice-popup/nice-popup.html',
6316
6372
  "<div class=\"nice-popup\" click-outside=\"close()\">\n" +
6317
6373
  "<div class=\"nice-popup-target\" ng-transclude=\"target\" ng-click=\"toggle()\"></div>\n" +