nice-elements 1.12.11 → 1.12.12

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.12.12 (6.1.2026)
4
+
5
+ - added addButtonDisabled prop to nice dropdown
6
+
3
7
  ## v1.12.11 (19.12.2025)
4
8
 
5
9
  - added nice checkbox indeterminate prop,
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.12.11
3
+ # Nice elements v1.12.12
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.12.11",
3
+ "version": "1.12.12",
4
4
  "authors": [
5
5
  "Klemen Kastelic <klemen@olaii.com>"
6
6
  ],
package/dist/nice.js CHANGED
@@ -171,7 +171,7 @@ angular.module('niceElements')
171
171
  label: '@'
172
172
  },
173
173
  link: function postLink(scope, element, attrs) {
174
- if (angular.isDefined(scope.model)){
174
+ if (angular.isDefined(scope.model)) {
175
175
  scope.model = false;
176
176
  }
177
177
  }
@@ -320,7 +320,7 @@ angular.module('niceElements')
320
320
  scope.endDateMinute = moment(scope.endDate).minutes();
321
321
  }
322
322
  }
323
-
323
+
324
324
  scope.month = angular.copy(moment(scope.startDate));
325
325
  const start = angular.copy(moment(scope.startDate));
326
326
  _removeTimeWithDate(start.date(0));
@@ -464,7 +464,7 @@ angular.module('niceElements')
464
464
 
465
465
  // ------------------ Check if dates are equal without time ------------------
466
466
  scope.isSameDay = function (date1, date2) {
467
- if(!date1 || !date2) return false;
467
+ if (!date1 || !date2) return false;
468
468
  const d1 = _removeTime(angular.copy(date1));
469
469
  const d2 = _removeTime(angular.copy(date2));
470
470
  return d1.isSame(d2);
@@ -473,7 +473,7 @@ angular.module('niceElements')
473
473
 
474
474
  // ------------------ Check if date is between start and end date ------------------
475
475
  scope.isBetweenRange = function (date) {
476
- if(!scope.endDate || !scope.startDate) return false;
476
+ if (!scope.endDate || !scope.startDate) return false;
477
477
  return (date.isBefore(moment(scope.endDate)) && date.isAfter(moment(scope.startDate)));
478
478
  };
479
479
 
@@ -2474,6 +2474,7 @@ angular.module('niceElements')
2474
2474
  labelWidth: '@',
2475
2475
  loading: '=?',
2476
2476
  addButtonFunction: '=?',
2477
+ addButtonDisabled: '=?',
2477
2478
  objValue: '@', // Optional - default is 'value'
2478
2479
  objKey: '@?', // Optional - default is 'id'. Used only when returnOnlyKey=true.
2479
2480
  selectedIsKey: '@?',
@@ -3856,25 +3857,25 @@ angular.module('niceElements')
3856
3857
  };
3857
3858
  });
3858
3859
 
3859
- 'use strict';
3860
-
3861
- /**
3862
- * @ngdoc directive
3863
- * @name niceElements.directive:niceIcon
3864
- * @description
3865
- * # niceIcon
3866
- */
3867
- angular.module('niceElements')
3868
- .directive('niceIcon', function () {
3869
- return {
3870
- templateUrl: 'src/components/nice-icon/nice-icon.html',
3871
- restrict: 'E',
3872
- replace: true,
3873
- scope: {
3874
- icon: '@',
3875
- size: '=',
3876
- },
3877
- };
3860
+ 'use strict';
3861
+
3862
+ /**
3863
+ * @ngdoc directive
3864
+ * @name niceElements.directive:niceIcon
3865
+ * @description
3866
+ * # niceIcon
3867
+ */
3868
+ angular.module('niceElements')
3869
+ .directive('niceIcon', function () {
3870
+ return {
3871
+ templateUrl: 'src/components/nice-icon/nice-icon.html',
3872
+ restrict: 'E',
3873
+ replace: true,
3874
+ scope: {
3875
+ icon: '@',
3876
+ size: '=',
3877
+ },
3878
+ };
3878
3879
  });
3879
3880
  angular.module('niceElements')
3880
3881
  .directive('niceInput', function ($timeout) {
@@ -4524,11 +4525,11 @@ angular.module('niceElements')
4524
4525
  * @description
4525
4526
  * # niceOnScroll
4526
4527
  */
4527
- angular.module('niceElements').directive('niceOnScroll', function() {
4528
+ angular.module('niceElements').directive('niceOnScroll', function () {
4528
4529
  return {
4529
4530
  restrict: 'A',
4530
- link: function(scope, element, attrs) {
4531
- element.on('scroll', function() {
4531
+ link: function (scope, element, attrs) {
4532
+ element.on('scroll', function () {
4532
4533
  scope.$apply(attrs.niceOnScroll);
4533
4534
  });
4534
4535
  }
@@ -4792,7 +4793,7 @@ angular.module('niceElements')
4792
4793
  * # niceProgressBar
4793
4794
  */
4794
4795
  angular.module('niceElements')
4795
- .directive('niceProgressBar', function() {
4796
+ .directive('niceProgressBar', function () {
4796
4797
  return {
4797
4798
  restrict: 'E',
4798
4799
  replace: true,
@@ -4808,29 +4809,29 @@ angular.module('niceElements')
4808
4809
  help: '@'
4809
4810
  },
4810
4811
 
4811
- controller: function($scope, $element, $timeout) {
4812
+ controller: function ($scope, $element, $timeout) {
4812
4813
  $scope.width = 0;
4813
- $scope.resize = function(){
4814
- $timeout(function() {
4814
+ $scope.resize = function () {
4815
+ $timeout(function () {
4815
4816
  $scope.width = $element[0].getElementsByClassName("progress")[0].offsetWidth;
4816
- },100);
4817
+ }, 100);
4817
4818
  };
4818
- window.onresize = function() {
4819
+ window.onresize = function () {
4819
4820
  $scope.resize();
4820
4821
  };
4821
4822
  $scope.resize();
4822
4823
 
4823
-
4824
4824
 
4825
- $scope.$watch("value", function(valueNew, valueOld){
4825
+
4826
+ $scope.$watch("value", function (valueNew, valueOld) {
4826
4827
  $scope.calculate();
4827
4828
  });
4828
4829
 
4829
- $scope.$watch("max", function(valueNew, valueOld){
4830
+ $scope.$watch("max", function (valueNew, valueOld) {
4830
4831
  $scope.calculate();
4831
4832
  });
4832
4833
 
4833
- $scope.calculate = function(){
4834
+ $scope.calculate = function () {
4834
4835
  $scope.percentage = ($scope.value / $scope.max) * 100;
4835
4836
  };
4836
4837
 
@@ -5491,7 +5492,7 @@ angular.module('niceElements')
5491
5492
  controller: function ($scope, $transclude) {
5492
5493
  $scope.hasActions = $transclude().length > 0;
5493
5494
 
5494
- $scope.setOrder = function(key) {
5495
+ $scope.setOrder = function (key) {
5495
5496
  if (!$scope.canOrder) return;
5496
5497
  if ($scope.order == "!" + key) {
5497
5498
  $scope.order = null;
@@ -5503,18 +5504,18 @@ angular.module('niceElements')
5503
5504
  if ($scope.orderChanged) $scope.orderChanged($scope.order);
5504
5505
  }
5505
5506
 
5506
- $scope.rowStyle = function(column, row) {
5507
+ $scope.rowStyle = function (column, row) {
5507
5508
  if (!column.valueStyle) return;
5508
5509
  return column.valueStyle(row[column.key], row);
5509
- }
5510
-
5511
- $scope.rowClass = function(column, row) {
5510
+ }
5511
+
5512
+ $scope.rowClass = function (column, row) {
5512
5513
  if (!column.valueClass) return;
5513
5514
  return column.valueClass(row[column.key], row);
5514
5515
  }
5515
-
5516
- $scope.handleFreeze = function(column, isFirst, isLast, index) {
5517
- return {
5516
+
5517
+ $scope.handleFreeze = function (column, isFirst, isLast, index) {
5518
+ return {
5518
5519
  'nice-table-freeze-left': ($scope.freezeFirst && isFirst) || column.freeze,
5519
5520
  'nice-table-freeze-right': $scope.freezeLast && isLast && !$scope.hasActions
5520
5521
  }
@@ -5963,21 +5964,21 @@ angular.module('niceElements')
5963
5964
  if (!$scope.rowHeight) $scope.rowHeight = 50;
5964
5965
 
5965
5966
  // ------------------------- Prepare data -------------------------
5966
- $scope.prepareData = function() {
5967
+ $scope.prepareData = function () {
5967
5968
  $scope.items = Array.from($scope.data, (data, index) => ({
5968
5969
  id: index + 1,
5969
5970
  height: Number($scope.rowHeight), // Default placeholder height
5970
5971
  offsetTop: index * Number($scope.rowHeight), // Approximate offset
5971
5972
  data: data
5972
5973
  }));
5973
-
5974
+
5974
5975
  $scope.totalContentHeight = $scope.items.length * Number($scope.rowHeight); // Initial placeholder height * number of items
5975
5976
  if ($scope.hasAppend) $scope.totalContentHeight += Number($scope.rowHeight);
5976
5977
  $scope.onScroll();
5977
5978
  };
5978
5979
 
5979
5980
  // ------------------------- On scroll -------------------------
5980
- $scope.onScroll = function() {
5981
+ $scope.onScroll = function () {
5981
5982
  const container = $element[0].getBoundingClientRect();
5982
5983
  const scrollTop = $element[0].scrollTop;
5983
5984
  const viewportHeight = container.height;
@@ -5985,20 +5986,20 @@ angular.module('niceElements')
5985
5986
  const startIndex = $scope.items.findIndex(item => item.offsetTop + item.height > scrollTop);
5986
5987
  let endIndex = $scope.items.findIndex(item => item.offsetTop > scrollTop + viewportHeight);
5987
5988
  if (endIndex == -1) endIndex = $scope.items.length - 1;
5988
-
5989
+
5989
5990
  $scope.visibleItems = $scope.items.slice(startIndex, endIndex + 1);
5990
5991
  };
5991
5992
 
5992
5993
  // ------------------------- Watch for changes from outside -------------------------
5993
5994
  $scope.$watchCollection('data', function () {
5994
- $timeout(function() {
5995
+ $timeout(function () {
5995
5996
  $scope.prepareData();
5996
5997
  });
5997
5998
  });
5998
5999
 
5999
- // ------------------------- Watch for element resize -------------------------
6000
- new ResizeObserver(function() {
6001
- $timeout(function() {
6000
+ // ------------------------- Watch for element resize -------------------------
6001
+ new ResizeObserver(function () {
6002
+ $timeout(function () {
6002
6003
  $scope.onScroll();
6003
6004
  });
6004
6005
  }).observe($element[0]);
@@ -6431,7 +6432,7 @@ angular.module('niceElements')
6431
6432
  .service('NiceService', function ($rootScope) {
6432
6433
  const service = {
6433
6434
  name: "Nice elements",
6434
- version: "1.12.11",
6435
+ version: "1.12.12",
6435
6436
  getHeader: function () {
6436
6437
  return {};
6437
6438
  },
@@ -6510,7 +6511,7 @@ angular.module('niceElements')
6510
6511
  };
6511
6512
  });
6512
6513
 
6513
- angular.module('niceElements').run(['$templateCache', function($templateCache) {
6514
+ angular.module('niceElements').run(['$templateCache', function ($templateCache) {
6514
6515
  'use strict';
6515
6516
 
6516
6517
  $templateCache.put('src/components/nice-alert/nice-alert.html',
@@ -7155,7 +7156,7 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
7155
7156
  "\n" +
7156
7157
  "\n" +
7157
7158
  " \n" +
7158
- " <button type=\"button\" class=\"btn btn-primary btn-icon add-btn\" ng-if=\"addButtonFunction && !isDisabled\" ng-click=\"handleAddButton($event)\" ng-disabled=\"isDisabled\">\n" +
7159
+ " <button type=\"button\" class=\"btn btn-primary btn-icon add-btn\" ng-if=\"addButtonFunction\" ng-click=\"handleAddButton($event)\" ng-disabled=\"addButtonDisabled || isDisabled\">\n" +
7159
7160
  " <nice-icon icon=\"icon-plus\"></nice-icon>\n" +
7160
7161
  " </button>\n" +
7161
7162
  " </div>\n" +