nice-elements 1.10.7 → 1.10.9

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,13 @@
1
1
  # Changelog
2
2
 
3
+ ## v1.10.9 (14.10.2024)
4
+
5
+ - added inverted prop to nice toggle component
6
+
7
+ ## v1.10.8 (9.10.2024)
8
+
9
+ - fixed nice choice firefox drag to select - OLA-1134
10
+
3
11
  ## v1.10.7 (3.10.2024)
4
12
 
5
13
  - added development tag to olaii-logo icon if DEPLOY is not production,
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.10.7
3
+ # Nice elements v1.10.9
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.10.7",
3
+ "version": "1.10.9",
4
4
  "authors": ["Klemen Kastelic <klemen@olaii.com>"],
5
5
  "description": "Nice elements",
6
6
  "keywords": [],
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
  }
@@ -545,7 +545,8 @@ angular.module('niceElements')
545
545
  };
546
546
 
547
547
  $scope.itemHover = function (event, item) {
548
- if (event.which == 1) {
548
+ if ($scope.isDisabled) return;
549
+ if (event.buttons == 1 && $scope.multiple) {
549
550
  $scope.toggle(item);
550
551
  }
551
552
  }
@@ -660,14 +661,14 @@ angular.module('niceElements')
660
661
  * # clickOutside
661
662
  */
662
663
  angular.module('niceElements')
663
- .directive('clickOutside', function ($document, $parse, $timeout) {
664
+ .directive('clickOutside', function($document, $parse, $timeout){
664
665
  return {
665
666
  restrict: 'A',
666
667
  link: function ($scope, elem, attr) {
667
668
  $scope.isOpen = false;
668
669
 
669
670
  // watch for is open
670
- attr.$observe('isOpen', function (value) {
671
+ attr.$observe('isOpen', function(value){
671
672
  $scope.isOpen = value == 'true';
672
673
  });
673
674
 
@@ -722,7 +723,7 @@ angular.module('niceElements')
722
723
  // if we have got this far, then we are good to go with processing the command passed in via the click-outside attribute
723
724
  $timeout(function () {
724
725
  fn = $parse(attr['clickOutside']);
725
- fn($scope, { event: e });
726
+ fn($scope, {event: e});
726
727
  });
727
728
  }
728
729
  }
@@ -756,7 +757,7 @@ angular.module('niceElements')
756
757
  });
757
758
  }
758
759
  };
759
- });
760
+ });
760
761
  'use strict';
761
762
 
762
763
  /**
@@ -2819,10 +2820,10 @@ angular.module('niceElements')
2819
2820
  if ($scope.searchFunction) {
2820
2821
  $scope.handleSearch();
2821
2822
  }
2822
-
2823
-
2823
+
2824
+
2824
2825
  // ----------------------------------- Handle add button function -----------------------------------
2825
- $scope.handleAddButton = function ($event) {
2826
+ $scope.handleAddButton = function($event) {
2826
2827
  let element = $event.target;
2827
2828
  while (true) {
2828
2829
  if (element.nodeName == 'BUTTON') {
@@ -3877,7 +3878,7 @@ angular.module('niceElements')
3877
3878
  }
3878
3879
 
3879
3880
  $scope.$watch('model', function (value_new, value_old) {
3880
- if ($scope.type == "number" && value_old && value_old[value_old.length - 1] == ".") {
3881
+ if ($scope.type == "number" && value_old && value_old[value_old.length-1] == ".") {
3881
3882
 
3882
3883
  } else {
3883
3884
  $scope.internalModel = angular.copy($scope.model);
@@ -3905,9 +3906,9 @@ angular.module('niceElements')
3905
3906
  }
3906
3907
  });
3907
3908
 
3908
- $scope.handleChange = function () {
3909
+ $scope.handleChange = function() {
3909
3910
  if ($scope.onChange) {
3910
- $timeout(function () {
3911
+ $timeout(function() {
3911
3912
  $scope.onChange({ model: $scope.model });
3912
3913
  })
3913
3914
  }
@@ -4103,42 +4104,42 @@ angular.module('niceElements')
4103
4104
 
4104
4105
  var messageElements = [];
4105
4106
 
4106
- var notify = function (args, t) {
4107
+ var notify = function(args, t){
4107
4108
 
4108
- if (typeof args !== 'object') {
4109
- args = { message: args };
4109
+ if (typeof args !== 'object'){
4110
+ args = {message:args};
4110
4111
  }
4111
4112
 
4112
4113
  args.template = args.template ? args.template : 'src/components/nice-notification/nice-notification.html';
4113
4114
  args.delay = !angular.isUndefined(args.delay) ? args.delay : delay;
4114
4115
  args.type = t ? t : '';
4115
4116
 
4116
- $http.get(args.template, { cache: $templateCache }).success(function (template) {
4117
+ $http.get(args.template,{cache: $templateCache}).success(function(template) {
4117
4118
 
4118
4119
  var scope = $rootScope.$new();
4119
4120
  scope.message = $sce.trustAsHtml(args.message);
4120
4121
  scope.title = $sce.trustAsHtml(args.title);
4121
- scope.t = args.type.substr(0, 1);
4122
+ scope.t = args.type.substr(0,1);
4122
4123
  scope.delay = args.delay;
4123
4124
 
4124
- if (typeof args.scope === 'object') {
4125
- for (var key in args.scope) {
4125
+ if (typeof args.scope === 'object'){
4126
+ for (var key in args.scope){
4126
4127
  scope[key] = args.scope[key];
4127
4128
  }
4128
4129
  }
4129
4130
 
4130
- var reposite = function () {
4131
+ var reposite = function() {
4131
4132
  var j = 0;
4132
4133
  var k = 0;
4133
4134
  var lastTop = startTop;
4134
4135
  var lastRight = startRight;
4135
- for (var i = messageElements.length - 1; i >= 0; i--) {
4136
+ for(var i = messageElements.length - 1; i >= 0; i --) {
4136
4137
  var element = messageElements[i];
4137
4138
  var elHeight = parseInt(element[0].offsetHeight);
4138
4139
  var elWidth = parseInt(element[0].offsetWidth);
4139
4140
  if ((top + elHeight) > window.innerHeight) {
4140
4141
  lastTop = startTop;
4141
- k++;
4142
+ k ++;
4142
4143
  j = 0;
4143
4144
  }
4144
4145
  var top = lastTop + (j === 0 ? 0 : verticalSpacing);
@@ -4148,22 +4149,22 @@ angular.module('niceElements')
4148
4149
  element.css('right', right + 'px');
4149
4150
 
4150
4151
  lastTop = top + elHeight;
4151
- j++;
4152
+ j ++;
4152
4153
  }
4153
4154
  };
4154
4155
 
4155
4156
  var templateElement = $compile(template)(scope);
4156
4157
  templateElement.addClass(args.type);
4157
- templateElement.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd click', function (e) {
4158
+ templateElement.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd click', function(e){
4158
4159
  e = e.originalEvent || e;
4159
- if (e.type === 'click' || (e.propertyName === 'opacity' && e.elapsedTime >= 0.4)) {
4160
+ if (e.type === 'click' || (e.propertyName === 'opacity' && e.elapsedTime >= 0.4)){
4160
4161
  templateElement.remove();
4161
4162
  messageElements.splice(messageElements.indexOf(templateElement), 1);
4162
4163
  reposite();
4163
4164
  }
4164
4165
  });
4165
4166
 
4166
- $timeout(function () {
4167
+ $timeout(function() {
4167
4168
  templateElement.addClass('killed');
4168
4169
  templateElement.remove();
4169
4170
  messageElements.splice(messageElements.indexOf(templateElement), 1);
@@ -4175,34 +4176,34 @@ angular.module('niceElements')
4175
4176
 
4176
4177
  $timeout(reposite);
4177
4178
 
4178
- }).error(function (data) {
4179
- throw new Error('Template (' + args.template + ') could not be loaded. ' + data);
4179
+ }).error(function(data){
4180
+ throw new Error('Template ('+args.template+') could not be loaded. ' + data);
4180
4181
  });
4181
4182
 
4182
4183
  };
4183
4184
 
4184
- notify.config = function (args) {
4185
- startTop = args.top ? args.top : startTop;
4186
- verticalSpacing = args.verticalSpacing ? args.verticalSpacing : verticalSpacing;
4185
+ notify.config = function(args){
4186
+ startTop = args.top ? args.top : startTop;
4187
+ verticalSpacing = args.verticalSpacing ? args.verticalSpacing : verticalSpacing;
4187
4188
  };
4188
4189
 
4189
- notify.primary = function () {
4190
+ notify.primary = function() {
4190
4191
  this(args, '');
4191
4192
  };
4192
4193
 
4193
- notify.error = function (args) {
4194
+ notify.error = function(args) {
4194
4195
  this(args, 'error');
4195
4196
  };
4196
4197
 
4197
- notify.success = function (args) {
4198
+ notify.success = function(args) {
4198
4199
  this(args, 'success');
4199
4200
  };
4200
4201
 
4201
- notify.info = function (args) {
4202
+ notify.info = function(args) {
4202
4203
  this(args, 'info');
4203
4204
  };
4204
4205
 
4205
- notify.warning = function (args) {
4206
+ notify.warning = function(args) {
4206
4207
  this(args, 'warning');
4207
4208
  };
4208
4209
 
@@ -4344,7 +4345,7 @@ angular.module('niceElements')
4344
4345
  $scope.$watch("model", function (oldModel, newModel) {
4345
4346
  $scope.check();
4346
4347
  if ($scope.onChange && oldModel != newModel) {
4347
- $timeout(function () {
4348
+ $timeout(function() {
4348
4349
  $scope.onChange({ model: $scope.model });
4349
4350
  })
4350
4351
  }
@@ -4638,7 +4639,7 @@ angular.module('niceElements')
4638
4639
  * # niceProgressBar
4639
4640
  */
4640
4641
  angular.module('niceElements')
4641
- .directive('niceProgressBar', function () {
4642
+ .directive('niceProgressBar', function() {
4642
4643
  return {
4643
4644
  restrict: 'E',
4644
4645
  replace: true,
@@ -4654,29 +4655,29 @@ angular.module('niceElements')
4654
4655
  help: '@'
4655
4656
  },
4656
4657
 
4657
- controller: function ($scope, $element, $timeout) {
4658
+ controller: function($scope, $element, $timeout) {
4658
4659
  $scope.width = 0;
4659
- $scope.resize = function () {
4660
- $timeout(function () {
4660
+ $scope.resize = function(){
4661
+ $timeout(function() {
4661
4662
  $scope.width = $element[0].getElementsByClassName("progress")[0].offsetWidth;
4662
- }, 100);
4663
+ },100);
4663
4664
  };
4664
- window.onresize = function () {
4665
+ window.onresize = function() {
4665
4666
  $scope.resize();
4666
4667
  };
4667
4668
  $scope.resize();
4668
4669
 
4670
+
4669
4671
 
4670
-
4671
- $scope.$watch("value", function (valueNew, valueOld) {
4672
+ $scope.$watch("value", function(valueNew, valueOld){
4672
4673
  $scope.calculate();
4673
4674
  });
4674
4675
 
4675
- $scope.$watch("max", function (valueNew, valueOld) {
4676
+ $scope.$watch("max", function(valueNew, valueOld){
4676
4677
  $scope.calculate();
4677
4678
  });
4678
4679
 
4679
- $scope.calculate = function () {
4680
+ $scope.calculate = function(){
4680
4681
  $scope.percentage = ($scope.value / $scope.max) * 100;
4681
4682
  };
4682
4683
 
@@ -5329,7 +5330,7 @@ angular.module('niceElements')
5329
5330
  controller: function ($scope, $transclude) {
5330
5331
  $scope.hasActions = $transclude().length > 0;
5331
5332
 
5332
- $scope.setOrder = function (key) {
5333
+ $scope.setOrder = function(key) {
5333
5334
  if (!$scope.canOrder) return;
5334
5335
  if ($scope.order == "!" + key) {
5335
5336
  $scope.order = null;
@@ -5341,18 +5342,18 @@ angular.module('niceElements')
5341
5342
  if ($scope.orderChanged) $scope.orderChanged($scope.order);
5342
5343
  }
5343
5344
 
5344
- $scope.rowStyle = function (column, row) {
5345
+ $scope.rowStyle = function(column, row) {
5345
5346
  if (!column.valueStyle) return;
5346
5347
  return column.valueStyle(row[column.key], row);
5347
- }
5348
-
5349
- $scope.rowClass = function (column, row) {
5348
+ }
5349
+
5350
+ $scope.rowClass = function(column, row) {
5350
5351
  if (!column.valueClass) return;
5351
5352
  return column.valueClass(row[column.key], row);
5352
5353
  }
5353
-
5354
- $scope.handleFreeze = function (column, isFirst, isLast, index) {
5355
- return {
5354
+
5355
+ $scope.handleFreeze = function(column, isFirst, isLast, index) {
5356
+ return {
5356
5357
  'nice-table-freeze-left': ($scope.freezeFirst && isFirst) || column.freeze,
5357
5358
  'nice-table-freeze-right': $scope.freezeLast && isLast && !$scope.hasActions
5358
5359
  }
@@ -5551,7 +5552,8 @@ angular.module('niceElements')
5551
5552
  isBlock: '=',
5552
5553
  titleRight: '=',
5553
5554
  help: '@',
5554
- required: '='
5555
+ required: '=',
5556
+ inverted: '='
5555
5557
  },
5556
5558
  controller: function ($scope, $timeout) {
5557
5559
  if (!$scope.title) { $scope.title = ''; }
@@ -5968,7 +5970,7 @@ angular.module('niceElements')
5968
5970
  .service('NiceService', function ($rootScope) {
5969
5971
  var service = {
5970
5972
  name: "Nice elements",
5971
- version: "1.10.7",
5973
+ version: "1.10.9",
5972
5974
  getHeader: function () {
5973
5975
  return {};
5974
5976
  },
@@ -6047,7 +6049,7 @@ angular.module('niceElements')
6047
6049
  };
6048
6050
  });
6049
6051
 
6050
- angular.module('niceElements').run(['$templateCache', function ($templateCache) {
6052
+ angular.module('niceElements').run(['$templateCache', function($templateCache) {
6051
6053
  'use strict';
6052
6054
 
6053
6055
  $templateCache.put('src/components/nice-button-toggle/nice-button-toggle.html',
@@ -6183,8 +6185,8 @@ angular.module('niceElements').run(['$templateCache', function ($templateCache)
6183
6185
  "<nice-title text=\"title || niceTitle\" help=\"help\" required=\"required\" label-width=\"labelWidth\"></nice-title>\n" +
6184
6186
  "<div class=\"nice-field col-xs-12\" ng-class=\"fieldWidth ? fieldWidth : 'col-sm-8'\">\n" +
6185
6187
  "<ul class=\"list-unstyled\" ng-class=\"{ 'disabled': isDisabled }\">\n" +
6186
- "<li ng-repeat=\"item in internalList\" ng-class=\"{ 'selected' : isItemSelected(item) }\" ng-click=\"toggle(item)\">\n" +
6187
- "<button type=\"button\" class=\"choice-checkbox\" type=\"button\" ng-class=\"{'circle' : !multiple }\" ng-mouseenter=\"itemHover($event, item)\" ng-disabled=\"isDisabled\">\n" +
6188
+ "<li ng-repeat=\"item in internalList\" ng-class=\"{ 'selected' : isItemSelected(item) }\" ng-mouseenter=\"itemHover($event, item)\" ng-mousedown=\"toggle(item)\">\n" +
6189
+ "<button type=\"button\" class=\"choice-checkbox\" type=\"button\" ng-class=\"{'circle' : !multiple }\" ng-disabled=\"isDisabled\">\n" +
6188
6190
  "<nice-icon ng-if=\"multiple\" icon=\"icon-check\"></nice-icon>\n" +
6189
6191
  "<div ng-if=\"!multiple\" class=\"multiple-circle\"></div>\n" +
6190
6192
  "</button>\n" +
@@ -8056,7 +8058,7 @@ angular.module('niceElements').run(['$templateCache', function ($templateCache)
8056
8058
 
8057
8059
 
8058
8060
  $templateCache.put('src/components/nice-toggle/nice-toggle.html',
8059
- "<div class=\"nice-component nice-toggle\" ng-class=\"{ 'margin-bottom-0': noMargin, 'title-right': titleRight, 'nice-component-inline': isInline, 'nice-component-block': isBlock, 'active': model }\" ng-form=\"formToggle\">\n" +
8061
+ "<div class=\"nice-component nice-toggle\" ng-class=\"{ 'margin-bottom-0': noMargin, 'title-right': titleRight, 'nice-component-inline': isInline, 'nice-component-block': isBlock, 'active': inverted ? !model : model }\" ng-form=\"formToggle\">\n" +
8060
8062
  "<div class=\"row\">\n" +
8061
8063
  "<nice-title text=\"title || niceTitle\" help=\"help\" required=\"required\" label-width=\"labelWidth\"></nice-title>\n" +
8062
8064
  "<div class=\"nice-field col-xs-12\" ng-class=\"[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]\">\n" +
@@ -8151,5 +8153,5 @@ angular.module('niceElements').run(['$templateCache', function ($templateCache)
8151
8153
  "</div>\n" +
8152
8154
  "</div>"
8153
8155
  );
8154
-
8155
- }]);
8156
+
8157
+ }]);