nice-elements 1.9.5 → 1.9.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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## v1.9.6 (26.10.2023)
4
+
5
+ - added no search prop to nice dropdown
6
+
3
7
  ## v1.9.5 (22.9.2023)
4
8
 
5
9
  - fixed multiple select key only in 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.9.5
3
+ # Nice elements v1.9.6
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.9.5",
3
+ "version": "1.9.6",
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
  };
@@ -2345,6 +2345,7 @@ angular.module('niceElements')
2345
2345
  noDataText: '@',
2346
2346
  selectText: '@',
2347
2347
  searchText: '@',
2348
+ noSearch: '=',
2348
2349
  nullableText: '@',
2349
2350
  selectedText: '@',
2350
2351
  dropdownDistance: '@',
@@ -3682,25 +3683,25 @@ angular.module('niceElements')
3682
3683
  };
3683
3684
  });
3684
3685
 
3685
- 'use strict';
3686
-
3687
- /**
3688
- * @ngdoc directive
3689
- * @name niceElements.directive:niceIcon
3690
- * @description
3691
- * # niceIcon
3692
- */
3693
- angular.module('niceElements')
3694
- .directive('niceIcon', function () {
3695
- return {
3696
- templateUrl: 'src/components/nice-icon/nice-icon.html',
3697
- restrict: 'E',
3698
- replace: true,
3699
- scope: {
3700
- icon: '@',
3701
- size: '=',
3702
- },
3703
- };
3686
+ 'use strict';
3687
+
3688
+ /**
3689
+ * @ngdoc directive
3690
+ * @name niceElements.directive:niceIcon
3691
+ * @description
3692
+ * # niceIcon
3693
+ */
3694
+ angular.module('niceElements')
3695
+ .directive('niceIcon', function () {
3696
+ return {
3697
+ templateUrl: 'src/components/nice-icon/nice-icon.html',
3698
+ restrict: 'E',
3699
+ replace: true,
3700
+ scope: {
3701
+ icon: '@',
3702
+ size: '=',
3703
+ },
3704
+ };
3704
3705
  });
3705
3706
  angular.module('niceElements')
3706
3707
  .directive('niceInput', function () {
@@ -3997,42 +3998,42 @@ angular.module('niceElements')
3997
3998
 
3998
3999
  var messageElements = [];
3999
4000
 
4000
- var notify = function (args, t) {
4001
+ var notify = function(args, t){
4001
4002
 
4002
- if (typeof args !== 'object') {
4003
- args = { message: args };
4003
+ if (typeof args !== 'object'){
4004
+ args = {message:args};
4004
4005
  }
4005
4006
 
4006
4007
  args.template = args.template ? args.template : 'src/components/nice-notification/nice-notification.html';
4007
4008
  args.delay = !angular.isUndefined(args.delay) ? args.delay : delay;
4008
4009
  args.type = t ? t : '';
4009
4010
 
4010
- $http.get(args.template, { cache: $templateCache }).success(function (template) {
4011
+ $http.get(args.template,{cache: $templateCache}).success(function(template) {
4011
4012
 
4012
4013
  var scope = $rootScope.$new();
4013
4014
  scope.message = $sce.trustAsHtml(args.message);
4014
4015
  scope.title = $sce.trustAsHtml(args.title);
4015
- scope.t = args.type.substr(0, 1);
4016
+ scope.t = args.type.substr(0,1);
4016
4017
  scope.delay = args.delay;
4017
4018
 
4018
- if (typeof args.scope === 'object') {
4019
- for (var key in args.scope) {
4019
+ if (typeof args.scope === 'object'){
4020
+ for (var key in args.scope){
4020
4021
  scope[key] = args.scope[key];
4021
4022
  }
4022
4023
  }
4023
4024
 
4024
- var reposite = function () {
4025
+ var reposite = function() {
4025
4026
  var j = 0;
4026
4027
  var k = 0;
4027
4028
  var lastTop = startTop;
4028
4029
  var lastRight = startRight;
4029
- for (var i = messageElements.length - 1; i >= 0; i--) {
4030
+ for(var i = messageElements.length - 1; i >= 0; i --) {
4030
4031
  var element = messageElements[i];
4031
4032
  var elHeight = parseInt(element[0].offsetHeight);
4032
4033
  var elWidth = parseInt(element[0].offsetWidth);
4033
4034
  if ((top + elHeight) > window.innerHeight) {
4034
4035
  lastTop = startTop;
4035
- k++;
4036
+ k ++;
4036
4037
  j = 0;
4037
4038
  }
4038
4039
  var top = lastTop + (j === 0 ? 0 : verticalSpacing);
@@ -4042,22 +4043,22 @@ angular.module('niceElements')
4042
4043
  element.css('right', right + 'px');
4043
4044
 
4044
4045
  lastTop = top + elHeight;
4045
- j++;
4046
+ j ++;
4046
4047
  }
4047
4048
  };
4048
4049
 
4049
4050
  var templateElement = $compile(template)(scope);
4050
4051
  templateElement.addClass(args.type);
4051
- templateElement.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd click', function (e) {
4052
+ templateElement.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd click', function(e){
4052
4053
  e = e.originalEvent || e;
4053
- if (e.type === 'click' || (e.propertyName === 'opacity' && e.elapsedTime >= 0.4)) {
4054
+ if (e.type === 'click' || (e.propertyName === 'opacity' && e.elapsedTime >= 0.4)){
4054
4055
  templateElement.remove();
4055
4056
  messageElements.splice(messageElements.indexOf(templateElement), 1);
4056
4057
  reposite();
4057
4058
  }
4058
4059
  });
4059
4060
 
4060
- $timeout(function () {
4061
+ $timeout(function() {
4061
4062
  templateElement.addClass('killed');
4062
4063
  templateElement.remove();
4063
4064
  messageElements.splice(messageElements.indexOf(templateElement), 1);
@@ -4069,34 +4070,34 @@ angular.module('niceElements')
4069
4070
 
4070
4071
  $timeout(reposite);
4071
4072
 
4072
- }).error(function (data) {
4073
- throw new Error('Template (' + args.template + ') could not be loaded. ' + data);
4073
+ }).error(function(data){
4074
+ throw new Error('Template ('+args.template+') could not be loaded. ' + data);
4074
4075
  });
4075
4076
 
4076
4077
  };
4077
4078
 
4078
- notify.config = function (args) {
4079
- startTop = args.top ? args.top : startTop;
4080
- verticalSpacing = args.verticalSpacing ? args.verticalSpacing : verticalSpacing;
4079
+ notify.config = function(args){
4080
+ startTop = args.top ? args.top : startTop;
4081
+ verticalSpacing = args.verticalSpacing ? args.verticalSpacing : verticalSpacing;
4081
4082
  };
4082
4083
 
4083
- notify.primary = function () {
4084
+ notify.primary = function() {
4084
4085
  this(args, '');
4085
4086
  };
4086
4087
 
4087
- notify.error = function (args) {
4088
+ notify.error = function(args) {
4088
4089
  this(args, 'error');
4089
4090
  };
4090
4091
 
4091
- notify.success = function (args) {
4092
+ notify.success = function(args) {
4092
4093
  this(args, 'success');
4093
4094
  };
4094
4095
 
4095
- notify.info = function (args) {
4096
+ notify.info = function(args) {
4096
4097
  this(args, 'info');
4097
4098
  };
4098
4099
 
4099
- notify.warning = function (args) {
4100
+ notify.warning = function(args) {
4100
4101
  this(args, 'warning');
4101
4102
  };
4102
4103
 
@@ -4527,7 +4528,7 @@ angular.module('niceElements')
4527
4528
  * # niceProgressBar
4528
4529
  */
4529
4530
  angular.module('niceElements')
4530
- .directive('niceProgressBar', function () {
4531
+ .directive('niceProgressBar', function() {
4531
4532
  return {
4532
4533
  restrict: 'E',
4533
4534
  replace: true,
@@ -4542,29 +4543,29 @@ angular.module('niceElements')
4542
4543
  help: '@'
4543
4544
  },
4544
4545
 
4545
- controller: function ($scope, $element, $timeout) {
4546
+ controller: function($scope, $element, $timeout) {
4546
4547
  $scope.width = 0;
4547
- $scope.resize = function () {
4548
- $timeout(function () {
4548
+ $scope.resize = function(){
4549
+ $timeout(function() {
4549
4550
  $scope.width = $element[0].getElementsByClassName("progress")[0].offsetWidth;
4550
- }, 100);
4551
+ },100);
4551
4552
  };
4552
- window.onresize = function () {
4553
+ window.onresize = function() {
4553
4554
  $scope.resize();
4554
4555
  };
4555
4556
  $scope.resize();
4556
4557
 
4558
+
4557
4559
 
4558
-
4559
- $scope.$watch("value", function (valueNew, valueOld) {
4560
+ $scope.$watch("value", function(valueNew, valueOld){
4560
4561
  $scope.calculate();
4561
4562
  });
4562
4563
 
4563
- $scope.$watch("max", function (valueNew, valueOld) {
4564
+ $scope.$watch("max", function(valueNew, valueOld){
4564
4565
  $scope.calculate();
4565
4566
  });
4566
4567
 
4567
- $scope.calculate = function () {
4568
+ $scope.calculate = function(){
4568
4569
  $scope.percentage = ($scope.value / $scope.max) * 100;
4569
4570
  };
4570
4571
 
@@ -5597,24 +5598,24 @@ angular.module('niceElements')
5597
5598
  isInline: '=',
5598
5599
  help: '@'
5599
5600
  },
5600
- controller: function ($scope, gettextCatalog) {
5601
+ controller: function($scope, gettextCatalog) {
5601
5602
  if (!$scope.yes) { $scope.yes = gettextCatalog.getString('Yes', null, "Nice"); }
5602
5603
  if (!$scope.no) { $scope.no = gettextCatalog.getString('No', null, "Nice"); }
5603
5604
  if (!$scope.title) { $scope.title = ''; }
5604
5605
  if (!$scope.fieldWidth) { $scope.fieldWidth = 'col-sm-8'; }
5605
5606
  if (!$scope.labelWidth) { $scope.labelWidth = 'col-sm-4'; }
5606
- if (!angular.isDefined($scope.model) && !angular.isDefined($scope.options)) $scope.model = !angular.isDefined($scope.defaultFalse);
5607
- if (!angular.isDefined($scope.modelValue) && angular.isDefined($scope.options)) $scope.modelValue = $scope.options[0];
5607
+ if(!angular.isDefined($scope.model) && !angular.isDefined($scope.options)) $scope.model = !angular.isDefined($scope.defaultFalse);
5608
+ if(!angular.isDefined($scope.modelValue) && angular.isDefined($scope.options)) $scope.modelValue = $scope.options[0];
5608
5609
 
5609
5610
  $scope.defaultFalse = angular.isDefined($scope.defaultFalse);
5610
5611
  $scope.noMargin = angular.isDefined($scope.noMargin);
5611
5612
 
5612
5613
  $scope.buttonClass = "";
5613
-
5614
+
5614
5615
 
5615
5616
  // ------------------------- Set overlay button position based on passed state in $scope.model -------------------------
5616
- $scope.setButtonPosition = function (state) {
5617
- if (state) {
5617
+ $scope.setButtonPosition = function(state) {
5618
+ if(state) {
5618
5619
  $scope.buttonClass = "yesno-button-yes";
5619
5620
  } else {
5620
5621
  $scope.buttonClass = "yesno-button-no";
@@ -5622,48 +5623,48 @@ angular.module('niceElements')
5622
5623
  };
5623
5624
 
5624
5625
  // ------------------------- Watch for changes from outside -------------------------
5625
- $scope.$watch('model', function (value_new, value_old) {
5626
- if (angular.isDefined($scope.model)) {
5626
+ $scope.$watch('model', function(value_new, value_old){
5627
+ if(angular.isDefined($scope.model)){
5627
5628
  $scope.setButtonLabel($scope.model);
5628
5629
  $scope.setButtonPosition($scope.model);
5629
5630
  }
5630
5631
  });
5631
5632
 
5632
5633
  // ------------------------- Watch for model value -------------------------
5633
- $scope.$watch('modelValue', function (value_new, value_old) {
5634
- if ($scope.options) {
5634
+ $scope.$watch('modelValue', function(value_new, value_old){
5635
+ if($scope.options){
5635
5636
  $scope.model = $scope.modelValue == $scope.options[0];
5636
5637
  }
5637
5638
  });
5638
5639
 
5639
5640
  // ------------------------- Set button label -------------------------
5640
- $scope.setButtonLabel = function (state) {
5641
+ $scope.setButtonLabel = function(state){
5641
5642
  if (state) {
5642
5643
  $scope.state = $scope.yes;
5643
5644
  } else {
5644
5645
  $scope.state = $scope.no;
5645
5646
  }
5646
5647
  };
5647
-
5648
+
5648
5649
  // ------------------------- Set width -------------------------
5649
- $scope.setWidth = function (width, el) {
5650
+ $scope.setWidth = function(width, el){
5650
5651
  el.style.width = width;
5651
5652
  };
5652
-
5653
+
5653
5654
 
5654
5655
  // ------------------------- Switch -------------------------
5655
- $scope.switch = function () {
5656
- if (!$scope.isDisabled) {
5656
+ $scope.switch = function(){
5657
+ if(!$scope.isDisabled){
5657
5658
  $scope.model = !$scope.model;
5658
-
5659
- if ($scope.options) {
5660
- if ($scope.model) {
5659
+
5660
+ if($scope.options){
5661
+ if($scope.model){
5661
5662
  $scope.modelValue = $scope.options[0];
5662
5663
  } else {
5663
5664
  $scope.modelValue = $scope.options[1];
5664
5665
  }
5665
5666
  }
5666
-
5667
+
5667
5668
  if ($scope.onChange) $scope.onChange({ model: $scope.model });
5668
5669
  $scope.formYesno.$setDirty();
5669
5670
  }
@@ -5801,7 +5802,7 @@ angular.module('niceElements')
5801
5802
  };
5802
5803
  });
5803
5804
 
5804
- angular.module('niceElements').run(['$templateCache', function ($templateCache) {
5805
+ angular.module('niceElements').run(['$templateCache', function($templateCache) {
5805
5806
  'use strict';
5806
5807
 
5807
5808
  $templateCache.put('src/components/nice-button-toggle/nice-button-toggle.html',
@@ -6268,7 +6269,7 @@ angular.module('niceElements').run(['$templateCache', function ($templateCache)
6268
6269
  "</button>\n" +
6269
6270
  "<div class=\"nice-dropdown-menu-wrapper\">\n" +
6270
6271
  "<div class=\"nice-dropdown-menu\" ng-if=\"isOpen\">\n" +
6271
- "<div class=\"search-bar\" ng-if=\"searchFunction\">\n" +
6272
+ "<div class=\"search-bar\" ng-if=\"!noSearch && searchFunction\">\n" +
6272
6273
  "<input ng-model=\"internal.search\" ng-model-options=\"{ debounce: 500 }\" ng-change=\"handleSearch()\" placeholder=\"{{ searchText }}\">\n" +
6273
6274
  "<div class=\"count\" ng-if=\"internalList && internalList._metadata && enableLoadMore\">{{ internalList.length }}/{{ internalList._metadata.count }}</div>\n" +
6274
6275
  "<nice-icon ng-if=\"!internal.search\" class=\"icon\" icon=\"icon-search\"></nice-icon>\n" +