nice-elements 1.10.4 → 1.10.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.
Files changed (34) hide show
  1. package/CHANGELOG.md +8 -1
  2. package/README.md +1 -1
  3. package/bower.json +1 -1
  4. package/dist/nice.js +142 -114
  5. package/dist/nice.min.js +1 -1
  6. package/dist/style.css +13 -2
  7. package/dist/style.css.map +1 -1
  8. package/dist/style.min.css +1 -1
  9. package/eslint.config.mjs +28 -0
  10. package/package.json +4 -1
  11. package/src/components/nice-calendar/nice-calendar.js +2 -1
  12. package/src/components/nice-comment/nice-comment.html +1 -1
  13. package/src/components/nice-comment/nice-comment.js +2 -1
  14. package/src/components/nice-date/nice-date.html +2 -1
  15. package/src/components/nice-date/nice-date.js +2 -1
  16. package/src/components/nice-date-input/nice-date-input.js +2 -1
  17. package/src/components/nice-date-range/nice-date-range.js +8 -7
  18. package/src/components/nice-datetime-picker/nice-datetime-picker.js +2 -1
  19. package/src/components/nice-datetimerange-picker/nice-datetimerange-picker.js +2 -1
  20. package/src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.js +2 -1
  21. package/src/components/nice-dropdown/nice-dropdown.html +2 -1
  22. package/src/components/nice-dropdown/nice-dropdown.js +12 -6
  23. package/src/components/nice-dropdown/nice-dropdown.scss +13 -1
  24. package/src/components/nice-dropdown-date/nice-dropdown-date.js +9 -8
  25. package/src/components/nice-dtp/nice-dtp.js +2 -1
  26. package/src/components/nice-label/nice-label.js +2 -1
  27. package/src/components/nice-quantity/nice-quantity.js +1 -0
  28. package/src/components/nice-slot/nice-slot.js +2 -1
  29. package/src/components/nice-time-picker/nice-time-picker.js +2 -1
  30. package/src/components/nice-toggle/nice-toggle.js +3 -2
  31. package/src/components/nice-upload/nice-upload.html +1 -1
  32. package/src/components/nice-upload/nice-upload.js +2 -1
  33. package/src/components/nice-yesno/nice-yesno.js +22 -21
  34. package/src/services/nice-service.js +5 -2
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
  }
@@ -95,7 +95,8 @@ angular.module('niceElements')
95
95
  isDisabled: '=',
96
96
  help: '@',
97
97
  isInline: '=',
98
- onChange: '&?'
98
+ onChange: '&?',
99
+ required: '='
99
100
  },
100
101
  link: function (scope, element) {
101
102
  // ------------------ Init default values ------------------
@@ -658,14 +659,14 @@ angular.module('niceElements')
658
659
  * # clickOutside
659
660
  */
660
661
  angular.module('niceElements')
661
- .directive('clickOutside', function($document, $parse, $timeout){
662
+ .directive('clickOutside', function ($document, $parse, $timeout) {
662
663
  return {
663
664
  restrict: 'A',
664
665
  link: function ($scope, elem, attr) {
665
666
  $scope.isOpen = false;
666
667
 
667
668
  // watch for is open
668
- attr.$observe('isOpen', function(value){
669
+ attr.$observe('isOpen', function (value) {
669
670
  $scope.isOpen = value == 'true';
670
671
  });
671
672
 
@@ -720,7 +721,7 @@ angular.module('niceElements')
720
721
  // if we have got this far, then we are good to go with processing the command passed in via the click-outside attribute
721
722
  $timeout(function () {
722
723
  fn = $parse(attr['clickOutside']);
723
- fn($scope, {event: e});
724
+ fn($scope, { event: e });
724
725
  });
725
726
  }
726
727
  }
@@ -754,7 +755,7 @@ angular.module('niceElements')
754
755
  });
755
756
  }
756
757
  };
757
- });
758
+ });
758
759
  'use strict';
759
760
 
760
761
  /**
@@ -780,7 +781,8 @@ angular.module('niceElements')
780
781
  labelWidth: '@',
781
782
  help: '@',
782
783
  isInline: '=',
783
- rows: '@'
784
+ rows: '@',
785
+ required: '='
784
786
  },
785
787
  link: function postLink(scope, element, attrs) {
786
788
  if (scope.model == null) { scope.model = ''; }
@@ -854,7 +856,8 @@ angular.module('niceElements')
854
856
  isDisabled: '=',
855
857
  help: '@',
856
858
  isInline: '=',
857
- onChange: '&?'
859
+ onChange: '&?',
860
+ required: '='
858
861
  },
859
862
  controller: function ($scope, $timeout) {
860
863
  $scope.formatDate = "DD.MM.YYYY";
@@ -947,7 +950,7 @@ angular.module('niceElements')
947
950
  */
948
951
  angular.module('niceElements')
949
952
 
950
- .directive('niceDateRange', function() {
953
+ .directive('niceDateRange', function () {
951
954
  return {
952
955
  restrict: 'E',
953
956
  transclude: true,
@@ -965,19 +968,20 @@ angular.module('niceElements')
965
968
  startOfTheYear: '@',
966
969
  help: '@',
967
970
  isInline: '=',
968
- onChange: '&?'
971
+ onChange: '&?',
972
+ required: '='
969
973
  },
970
974
 
971
- link: function(scope, attrs){
975
+ link: function (scope, attrs) {
972
976
  if (!attrs.title) { attrs.title = ''; }
973
977
  if (!attrs.fieldWidth) { attrs.fieldWidth = 'col-sm-8'; }
974
978
  if (!attrs.labelWidth) { attrs.labelWidth = 'col-sm-4'; }
975
979
  if (!attrs.format) { attrs.format = 'dd.MM.yyyy'; }
976
980
  attrs.noMargin = angular.isDefined(attrs.noMargin);
977
981
 
978
- if(!angular.isDefined(scope.model)) {
982
+ if (!angular.isDefined(scope.model)) {
979
983
  var model = null;
980
- if(!angular.isDefined(scope.startOfTheYear)){
984
+ if (!angular.isDefined(scope.startOfTheYear)) {
981
985
  model = {
982
986
  startDate: moment().format(),
983
987
  endDate: moment().format()
@@ -993,7 +997,7 @@ angular.module('niceElements')
993
997
  }
994
998
  },
995
999
 
996
- controller: function($scope) {
1000
+ controller: function ($scope) {
997
1001
  $scope.opts = {
998
1002
  locale: {
999
1003
  applyClass: 'btn-green',
@@ -1009,7 +1013,7 @@ angular.module('niceElements')
1009
1013
  $scope.opts.ranges[gettextCatalog.getString("Last 30 days", null, "Nice")] = [moment().subtract(30, 'days'), moment()];
1010
1014
  $scope.opts.ranges[gettextCatalog.getString("This month", null, "Nice")] = [moment().startOf('month'), moment().endOf('month')];
1011
1015
 
1012
- if(angular.isDefined($scope.format)) $scope.opts.format = format;
1016
+ if (angular.isDefined($scope.format)) $scope.opts.format = format;
1013
1017
  }
1014
1018
 
1015
1019
  };
@@ -1046,7 +1050,8 @@ angular.module('niceElements')
1046
1050
  nextDate: '=',
1047
1051
  isDisabled: '=',
1048
1052
  isInline: '=',
1049
- onChange: '&?'
1053
+ onChange: '&?',
1054
+ required: '='
1050
1055
  },
1051
1056
  controller: function ($scope, $element, $timeout, gettextCatalog) {
1052
1057
  $scope.isOpen = false;
@@ -1379,7 +1384,8 @@ angular.module('niceElements').directive('niceDatetimePicker', function () {
1379
1384
  isDisabled: '=',
1380
1385
  help: '@',
1381
1386
  isInline: '=',
1382
- onChange: '&?'
1387
+ onChange: '&?',
1388
+ required: '='
1383
1389
  },
1384
1390
  controller: function ($scope, gettextCatalog) {
1385
1391
  console.warn("[NICE ELEMENTS] nice-datetime-picker component is deprecated!");
@@ -1460,7 +1466,8 @@ angular.module('niceElements')
1460
1466
  isDisabled: '=',
1461
1467
  help: '@',
1462
1468
  isInline: '=',
1463
- onChange: '&?'
1469
+ onChange: '&?',
1470
+ required: '='
1464
1471
  },
1465
1472
  templateUrl: 'src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.html',
1466
1473
  controller: function ($element, $timeout, $scope) {
@@ -1643,7 +1650,8 @@ angular.module('niceElements')
1643
1650
  isDisabled: '=',
1644
1651
  help: '@',
1645
1652
  isInline: '=',
1646
- onChange: '&?'
1653
+ onChange: '&?',
1654
+ required: '='
1647
1655
  },
1648
1656
  templateUrl: 'src/components/nice-datetimerange-picker/nice-datetimerange-picker.html',
1649
1657
  link: {
@@ -1882,7 +1890,8 @@ angular.module('niceElements')
1882
1890
  mature: '@',
1883
1891
  help: '@',
1884
1892
  isInline: '=',
1885
- onChange: '&?'
1893
+ onChange: '&?',
1894
+ required: '='
1886
1895
  },
1887
1896
  link: function ($scope) {
1888
1897
  $scope.days = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31];
@@ -1903,10 +1912,10 @@ angular.module('niceElements')
1903
1912
 
1904
1913
 
1905
1914
  // Set the years drop down from attributes or defaults
1906
- var currentYear = parseInt($scope.startingYear, 10) || new Date().getFullYear();
1907
- var numYears = parseInt($scope.numYears, 10) || 100;
1908
- var oldestYear = currentYear - numYears;
1909
- var newestYear = currentYear;
1915
+ const currentYear = parseInt($scope.startingYear, 10) || new Date().getFullYear();
1916
+ const numYears = parseInt($scope.numYears, 10) || 100;
1917
+ const oldestYear = currentYear - numYears;
1918
+ let newestYear = currentYear;
1910
1919
 
1911
1920
 
1912
1921
  // If mature
@@ -1940,7 +1949,7 @@ angular.module('niceElements')
1940
1949
 
1941
1950
  // validate that the date selected is accurate
1942
1951
  $scope.checkDate = function () {
1943
- var date = moment($scope.dateFields.day + "." + ($scope.dateFields.month + 1) + "." + $scope.dateFields.year, "D.M.YYYY");
1952
+ const date = moment($scope.dateFields.day + "." + ($scope.dateFields.month + 1) + "." + $scope.dateFields.year, "D.M.YYYY");
1944
1953
 
1945
1954
  if (date.isValid()) {
1946
1955
  // Format
@@ -1967,14 +1976,14 @@ angular.module('niceElements')
1967
1976
 
1968
1977
  // Set current date
1969
1978
  if (!$scope.model) {
1970
- var date = moment();
1979
+ const date = moment();
1971
1980
  $scope.dateFields.day = date.get('date');
1972
1981
  $scope.dateFields.month = date.get('month');
1973
1982
  $scope.dateFields.year = date.get('year');
1974
1983
  if ($scope.mature) $scope.dateFields.year -= 18;
1975
1984
  $scope.checkDate();
1976
1985
  } else {
1977
- var date = moment($scope.model);
1986
+ const date = moment($scope.model);
1978
1987
  $scope.dateFields.day = date.get('date');
1979
1988
  $scope.dateFields.month = date.get('month');
1980
1989
  $scope.dateFields.year = date.get('year');
@@ -2514,15 +2523,21 @@ angular.module('niceElements')
2514
2523
 
2515
2524
  // ----------------------------------- Focus input -----------------------------------
2516
2525
  $scope.focusInput = function () {
2517
- var input = $element[0].getElementsByTagName('input')[0];
2518
- if (input) {
2519
- $timeout(function () {
2520
- input.focus();
2521
- });
2522
- }
2526
+ $timeout(function () {
2527
+ const input = $element[0].getElementsByClassName("search-bar-input")[0];
2528
+ if (input) input.focus();
2529
+ });
2523
2530
  };
2524
2531
 
2525
2532
 
2533
+ // $scope.onInputFocus = function () {
2534
+ // $timeout(function () {
2535
+ // const input = $element[0].getElementsByClassName("btn-dropdown")[0];
2536
+ // if (input) input.focus();
2537
+ // });
2538
+ // }
2539
+
2540
+
2526
2541
  // ------------------- On blur -------------------
2527
2542
  $scope.onBlur = function () {
2528
2543
  $scope.close();
@@ -2841,7 +2856,8 @@ angular.module('niceElements')
2841
2856
  noMargin: '@', // default: false, if noMargin==true then entire directive can be injected inside other divs
2842
2857
  fieldWidth: '@', // default: 'col-sm-8', bootstrap classes that defines width of field
2843
2858
  labelWidth: '@', // default: 'col-sm-4', bootstrap classes that defines width of label
2844
- closed: '='
2859
+ closed: '=',
2860
+ required: '='
2845
2861
  },
2846
2862
  templateUrl: 'src/components/nice-dtp/nice-dtp.html',
2847
2863
  controller: function ($scope, $element, $attrs, gettextCatalog) {
@@ -3846,7 +3862,7 @@ angular.module('niceElements')
3846
3862
  }
3847
3863
 
3848
3864
  $scope.$watch('model', function (value_new, value_old) {
3849
- if ($scope.type == "number" && value_old && value_old[value_old.length-1] == ".") {
3865
+ if ($scope.type == "number" && value_old && value_old[value_old.length - 1] == ".") {
3850
3866
 
3851
3867
  } else {
3852
3868
  $scope.internalModel = angular.copy($scope.model);
@@ -3874,9 +3890,9 @@ angular.module('niceElements')
3874
3890
  }
3875
3891
  });
3876
3892
 
3877
- $scope.handleChange = function() {
3893
+ $scope.handleChange = function () {
3878
3894
  if ($scope.onChange) {
3879
- $timeout(function() {
3895
+ $timeout(function () {
3880
3896
  $scope.onChange({ model: $scope.model });
3881
3897
  })
3882
3898
  }
@@ -3984,7 +4000,8 @@ angular.module('niceElements')
3984
4000
  title: '@',
3985
4001
  noMargin: '@',
3986
4002
  isInline: '=',
3987
- help: '@'
4003
+ help: '@',
4004
+ required: '='
3988
4005
  },
3989
4006
  link: function postLink(scope, element, attrs) {
3990
4007
  if (!attrs.fieldWidth) { attrs.fieldWidth = 'col-sm-8'; }
@@ -4071,42 +4088,42 @@ angular.module('niceElements')
4071
4088
 
4072
4089
  var messageElements = [];
4073
4090
 
4074
- var notify = function(args, t){
4091
+ var notify = function (args, t) {
4075
4092
 
4076
- if (typeof args !== 'object'){
4077
- args = {message:args};
4093
+ if (typeof args !== 'object') {
4094
+ args = { message: args };
4078
4095
  }
4079
4096
 
4080
4097
  args.template = args.template ? args.template : 'src/components/nice-notification/nice-notification.html';
4081
4098
  args.delay = !angular.isUndefined(args.delay) ? args.delay : delay;
4082
4099
  args.type = t ? t : '';
4083
4100
 
4084
- $http.get(args.template,{cache: $templateCache}).success(function(template) {
4101
+ $http.get(args.template, { cache: $templateCache }).success(function (template) {
4085
4102
 
4086
4103
  var scope = $rootScope.$new();
4087
4104
  scope.message = $sce.trustAsHtml(args.message);
4088
4105
  scope.title = $sce.trustAsHtml(args.title);
4089
- scope.t = args.type.substr(0,1);
4106
+ scope.t = args.type.substr(0, 1);
4090
4107
  scope.delay = args.delay;
4091
4108
 
4092
- if (typeof args.scope === 'object'){
4093
- for (var key in args.scope){
4109
+ if (typeof args.scope === 'object') {
4110
+ for (var key in args.scope) {
4094
4111
  scope[key] = args.scope[key];
4095
4112
  }
4096
4113
  }
4097
4114
 
4098
- var reposite = function() {
4115
+ var reposite = function () {
4099
4116
  var j = 0;
4100
4117
  var k = 0;
4101
4118
  var lastTop = startTop;
4102
4119
  var lastRight = startRight;
4103
- for(var i = messageElements.length - 1; i >= 0; i --) {
4120
+ for (var i = messageElements.length - 1; i >= 0; i--) {
4104
4121
  var element = messageElements[i];
4105
4122
  var elHeight = parseInt(element[0].offsetHeight);
4106
4123
  var elWidth = parseInt(element[0].offsetWidth);
4107
4124
  if ((top + elHeight) > window.innerHeight) {
4108
4125
  lastTop = startTop;
4109
- k ++;
4126
+ k++;
4110
4127
  j = 0;
4111
4128
  }
4112
4129
  var top = lastTop + (j === 0 ? 0 : verticalSpacing);
@@ -4116,22 +4133,22 @@ angular.module('niceElements')
4116
4133
  element.css('right', right + 'px');
4117
4134
 
4118
4135
  lastTop = top + elHeight;
4119
- j ++;
4136
+ j++;
4120
4137
  }
4121
4138
  };
4122
4139
 
4123
4140
  var templateElement = $compile(template)(scope);
4124
4141
  templateElement.addClass(args.type);
4125
- templateElement.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd click', function(e){
4142
+ templateElement.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd click', function (e) {
4126
4143
  e = e.originalEvent || e;
4127
- if (e.type === 'click' || (e.propertyName === 'opacity' && e.elapsedTime >= 0.4)){
4144
+ if (e.type === 'click' || (e.propertyName === 'opacity' && e.elapsedTime >= 0.4)) {
4128
4145
  templateElement.remove();
4129
4146
  messageElements.splice(messageElements.indexOf(templateElement), 1);
4130
4147
  reposite();
4131
4148
  }
4132
4149
  });
4133
4150
 
4134
- $timeout(function() {
4151
+ $timeout(function () {
4135
4152
  templateElement.addClass('killed');
4136
4153
  templateElement.remove();
4137
4154
  messageElements.splice(messageElements.indexOf(templateElement), 1);
@@ -4143,34 +4160,34 @@ angular.module('niceElements')
4143
4160
 
4144
4161
  $timeout(reposite);
4145
4162
 
4146
- }).error(function(data){
4147
- throw new Error('Template ('+args.template+') could not be loaded. ' + data);
4163
+ }).error(function (data) {
4164
+ throw new Error('Template (' + args.template + ') could not be loaded. ' + data);
4148
4165
  });
4149
4166
 
4150
4167
  };
4151
4168
 
4152
- notify.config = function(args){
4153
- startTop = args.top ? args.top : startTop;
4154
- verticalSpacing = args.verticalSpacing ? args.verticalSpacing : verticalSpacing;
4169
+ notify.config = function (args) {
4170
+ startTop = args.top ? args.top : startTop;
4171
+ verticalSpacing = args.verticalSpacing ? args.verticalSpacing : verticalSpacing;
4155
4172
  };
4156
4173
 
4157
- notify.primary = function() {
4174
+ notify.primary = function () {
4158
4175
  this(args, '');
4159
4176
  };
4160
4177
 
4161
- notify.error = function(args) {
4178
+ notify.error = function (args) {
4162
4179
  this(args, 'error');
4163
4180
  };
4164
4181
 
4165
- notify.success = function(args) {
4182
+ notify.success = function (args) {
4166
4183
  this(args, 'success');
4167
4184
  };
4168
4185
 
4169
- notify.info = function(args) {
4186
+ notify.info = function (args) {
4170
4187
  this(args, 'info');
4171
4188
  };
4172
4189
 
4173
- notify.warning = function(args) {
4190
+ notify.warning = function (args) {
4174
4191
  this(args, 'warning');
4175
4192
  };
4176
4193
 
@@ -4312,7 +4329,7 @@ angular.module('niceElements')
4312
4329
  $scope.$watch("model", function (oldModel, newModel) {
4313
4330
  $scope.check();
4314
4331
  if ($scope.onChange && oldModel != newModel) {
4315
- $timeout(function() {
4332
+ $timeout(function () {
4316
4333
  $scope.onChange({ model: $scope.model });
4317
4334
  })
4318
4335
  }
@@ -4606,7 +4623,7 @@ angular.module('niceElements')
4606
4623
  * # niceProgressBar
4607
4624
  */
4608
4625
  angular.module('niceElements')
4609
- .directive('niceProgressBar', function() {
4626
+ .directive('niceProgressBar', function () {
4610
4627
  return {
4611
4628
  restrict: 'E',
4612
4629
  replace: true,
@@ -4622,29 +4639,29 @@ angular.module('niceElements')
4622
4639
  help: '@'
4623
4640
  },
4624
4641
 
4625
- controller: function($scope, $element, $timeout) {
4642
+ controller: function ($scope, $element, $timeout) {
4626
4643
  $scope.width = 0;
4627
- $scope.resize = function(){
4628
- $timeout(function() {
4644
+ $scope.resize = function () {
4645
+ $timeout(function () {
4629
4646
  $scope.width = $element[0].getElementsByClassName("progress")[0].offsetWidth;
4630
- },100);
4647
+ }, 100);
4631
4648
  };
4632
- window.onresize = function() {
4649
+ window.onresize = function () {
4633
4650
  $scope.resize();
4634
4651
  };
4635
4652
  $scope.resize();
4636
4653
 
4637
-
4638
4654
 
4639
- $scope.$watch("value", function(valueNew, valueOld){
4655
+
4656
+ $scope.$watch("value", function (valueNew, valueOld) {
4640
4657
  $scope.calculate();
4641
4658
  });
4642
4659
 
4643
- $scope.$watch("max", function(valueNew, valueOld){
4660
+ $scope.$watch("max", function (valueNew, valueOld) {
4644
4661
  $scope.calculate();
4645
4662
  });
4646
4663
 
4647
- $scope.calculate = function(){
4664
+ $scope.calculate = function () {
4648
4665
  $scope.percentage = ($scope.value / $scope.max) * 100;
4649
4666
  };
4650
4667
 
@@ -4679,6 +4696,7 @@ angular.module('niceElements')
4679
4696
  isDisabled: '=',
4680
4697
  isInline: '=',
4681
4698
  help: '@',
4699
+ required: '='
4682
4700
  },
4683
4701
  controller: function ($scope) {
4684
4702
  $scope.min = Number($scope.min) || 0;
@@ -5238,7 +5256,8 @@ angular.module('niceElements')
5238
5256
  title: '@',
5239
5257
  noMargin: '@',
5240
5258
  isInline: '=',
5241
- help: '@'
5259
+ help: '@',
5260
+ required: '='
5242
5261
  },
5243
5262
  link: function postLink(scope, element, attrs) {
5244
5263
  if (!attrs.fieldWidth) { attrs.fieldWidth = 'col-sm-8'; }
@@ -5295,7 +5314,7 @@ angular.module('niceElements')
5295
5314
  controller: function ($scope, $transclude) {
5296
5315
  $scope.hasActions = $transclude().length > 0;
5297
5316
 
5298
- $scope.setOrder = function(key) {
5317
+ $scope.setOrder = function (key) {
5299
5318
  if (!$scope.canOrder) return;
5300
5319
  if ($scope.order == "!" + key) {
5301
5320
  $scope.order = null;
@@ -5307,18 +5326,18 @@ angular.module('niceElements')
5307
5326
  if ($scope.orderChanged) $scope.orderChanged($scope.order);
5308
5327
  }
5309
5328
 
5310
- $scope.rowStyle = function(column, row) {
5329
+ $scope.rowStyle = function (column, row) {
5311
5330
  if (!column.valueStyle) return;
5312
5331
  return column.valueStyle(row[column.key], row);
5313
- }
5314
-
5315
- $scope.rowClass = function(column, row) {
5332
+ }
5333
+
5334
+ $scope.rowClass = function (column, row) {
5316
5335
  if (!column.valueClass) return;
5317
5336
  return column.valueClass(row[column.key], row);
5318
5337
  }
5319
-
5320
- $scope.handleFreeze = function(column, isFirst, isLast, index) {
5321
- return {
5338
+
5339
+ $scope.handleFreeze = function (column, isFirst, isLast, index) {
5340
+ return {
5322
5341
  'nice-table-freeze-left': ($scope.freezeFirst && isFirst) || column.freeze,
5323
5342
  'nice-table-freeze-right': $scope.freezeLast && isLast && !$scope.hasActions
5324
5343
  }
@@ -5347,7 +5366,8 @@ angular.module('niceElements')
5347
5366
  labelWidth: '@',
5348
5367
  onChange: '&?',
5349
5368
  isInline: '=',
5350
- help: '@'
5369
+ help: '@',
5370
+ required: '='
5351
5371
  },
5352
5372
  restrict: 'E',
5353
5373
  templateUrl: 'src/components/nice-time-picker/nice-time-picker.html',
@@ -5515,7 +5535,8 @@ angular.module('niceElements')
5515
5535
  isInline: '=',
5516
5536
  isBlock: '=',
5517
5537
  titleRight: '=',
5518
- help: '@'
5538
+ help: '@',
5539
+ required: '='
5519
5540
  },
5520
5541
  controller: function ($scope, $timeout) {
5521
5542
  if (!$scope.title) { $scope.title = ''; }
@@ -5535,7 +5556,7 @@ angular.module('niceElements')
5535
5556
  }
5536
5557
  }
5537
5558
 
5538
- $timeout(function() {
5559
+ $timeout(function () {
5539
5560
  if ($scope.onChange) $scope.onChange({ model: $scope.model });
5540
5561
  $scope.formToggle.$setDirty();
5541
5562
  });
@@ -5599,7 +5620,8 @@ angular.module('niceElements')
5599
5620
  isDisabled: '=',
5600
5621
  isInline: '=',
5601
5622
  help: '@',
5602
- maxFileSize: '@'
5623
+ maxFileSize: '@',
5624
+ required: '=',
5603
5625
  },
5604
5626
 
5605
5627
  link: function (scope, element, attrs) {
@@ -5800,26 +5822,27 @@ angular.module('niceElements')
5800
5822
  noMargin: '@',
5801
5823
  onChange: '&?',
5802
5824
  isInline: '=',
5803
- help: '@'
5825
+ help: '@',
5826
+ required: '='
5804
5827
  },
5805
- controller: function($scope, gettextCatalog) {
5828
+ controller: function ($scope, gettextCatalog) {
5806
5829
  if (!$scope.yes) { $scope.yes = gettextCatalog.getString('Yes', null, "Nice"); }
5807
5830
  if (!$scope.no) { $scope.no = gettextCatalog.getString('No', null, "Nice"); }
5808
5831
  if (!$scope.title) { $scope.title = ''; }
5809
5832
  if (!$scope.fieldWidth) { $scope.fieldWidth = 'col-sm-8'; }
5810
5833
  if (!$scope.labelWidth) { $scope.labelWidth = 'col-sm-4'; }
5811
- if(!angular.isDefined($scope.model) && !angular.isDefined($scope.options)) $scope.model = !angular.isDefined($scope.defaultFalse);
5812
- if(!angular.isDefined($scope.modelValue) && angular.isDefined($scope.options)) $scope.modelValue = $scope.options[0];
5834
+ if (!angular.isDefined($scope.model) && !angular.isDefined($scope.options)) $scope.model = !angular.isDefined($scope.defaultFalse);
5835
+ if (!angular.isDefined($scope.modelValue) && angular.isDefined($scope.options)) $scope.modelValue = $scope.options[0];
5813
5836
 
5814
5837
  $scope.defaultFalse = angular.isDefined($scope.defaultFalse);
5815
5838
  $scope.noMargin = angular.isDefined($scope.noMargin);
5816
5839
 
5817
5840
  $scope.buttonClass = "";
5818
-
5841
+
5819
5842
 
5820
5843
  // ------------------------- Set overlay button position based on passed state in $scope.model -------------------------
5821
- $scope.setButtonPosition = function(state) {
5822
- if(state) {
5844
+ $scope.setButtonPosition = function (state) {
5845
+ if (state) {
5823
5846
  $scope.buttonClass = "yesno-button-yes";
5824
5847
  } else {
5825
5848
  $scope.buttonClass = "yesno-button-no";
@@ -5827,48 +5850,48 @@ angular.module('niceElements')
5827
5850
  };
5828
5851
 
5829
5852
  // ------------------------- Watch for changes from outside -------------------------
5830
- $scope.$watch('model', function(value_new, value_old){
5831
- if(angular.isDefined($scope.model)){
5853
+ $scope.$watch('model', function (value_new, value_old) {
5854
+ if (angular.isDefined($scope.model)) {
5832
5855
  $scope.setButtonLabel($scope.model);
5833
5856
  $scope.setButtonPosition($scope.model);
5834
5857
  }
5835
5858
  });
5836
5859
 
5837
5860
  // ------------------------- Watch for model value -------------------------
5838
- $scope.$watch('modelValue', function(value_new, value_old){
5839
- if($scope.options){
5861
+ $scope.$watch('modelValue', function (value_new, value_old) {
5862
+ if ($scope.options) {
5840
5863
  $scope.model = $scope.modelValue == $scope.options[0];
5841
5864
  }
5842
5865
  });
5843
5866
 
5844
5867
  // ------------------------- Set button label -------------------------
5845
- $scope.setButtonLabel = function(state){
5868
+ $scope.setButtonLabel = function (state) {
5846
5869
  if (state) {
5847
5870
  $scope.state = $scope.yes;
5848
5871
  } else {
5849
5872
  $scope.state = $scope.no;
5850
5873
  }
5851
5874
  };
5852
-
5875
+
5853
5876
  // ------------------------- Set width -------------------------
5854
- $scope.setWidth = function(width, el){
5877
+ $scope.setWidth = function (width, el) {
5855
5878
  el.style.width = width;
5856
5879
  };
5857
-
5880
+
5858
5881
 
5859
5882
  // ------------------------- Switch -------------------------
5860
- $scope.switch = function(){
5861
- if(!$scope.isDisabled){
5883
+ $scope.switch = function () {
5884
+ if (!$scope.isDisabled) {
5862
5885
  $scope.model = !$scope.model;
5863
-
5864
- if($scope.options){
5865
- if($scope.model){
5886
+
5887
+ if ($scope.options) {
5888
+ if ($scope.model) {
5866
5889
  $scope.modelValue = $scope.options[0];
5867
5890
  } else {
5868
5891
  $scope.modelValue = $scope.options[1];
5869
5892
  }
5870
5893
  }
5871
-
5894
+
5872
5895
  if ($scope.onChange) $scope.onChange({ model: $scope.model });
5873
5896
  $scope.formYesno.$setDirty();
5874
5897
  }
@@ -5927,12 +5950,15 @@ angular.module('niceElements').filter('niceHighlight', function () {
5927
5950
  * Service in the niceElements.
5928
5951
  */
5929
5952
  angular.module('niceElements')
5930
- .service('NiceService', function () {
5953
+ .service('NiceService', function ($rootScope) {
5931
5954
  var service = {
5932
5955
  name: "Nice elements",
5933
- version: "1.10.4",
5956
+ version: "1.10.5",
5934
5957
  getHeader: function () {
5935
5958
  return {};
5959
+ },
5960
+ toast: function (message, type) {
5961
+ $rootScope.$broadcast('toast', message, type);
5936
5962
  }
5937
5963
  };
5938
5964
 
@@ -6006,7 +6032,7 @@ angular.module('niceElements')
6006
6032
  };
6007
6033
  });
6008
6034
 
6009
- angular.module('niceElements').run(['$templateCache', function($templateCache) {
6035
+ angular.module('niceElements').run(['$templateCache', function ($templateCache) {
6010
6036
  'use strict';
6011
6037
 
6012
6038
  $templateCache.put('src/components/nice-button-toggle/nice-button-toggle.html',
@@ -6161,7 +6187,7 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
6161
6187
  "<div class=\"row\">\n" +
6162
6188
  "<nice-title text=\"title || niceTitle\" help=\"help\" required=\"required\" label-width=\"labelWidth\"></nice-title>\n" +
6163
6189
  "<div class=\"nice-field col-xs-12\" ng-class=\"[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]\" ng-click=\"edit()\">\n" +
6164
- "<textarea ng-class=\"{'editing': editing}\" class=\"form-control\" ng-model=\"model\" placeholder=\"{{placeholder}}\" rows=\"{{rows}}\" ng-blur=\"save()\" ng-disabled=\"isDisabled\"></textarea>\n" +
6190
+ "<textarea ng-class=\"{'editing': editing}\" class=\"form-control\" ng-model=\"model\" placeholder=\"{{placeholder}}\" rows=\"{{rows}}\" ng-blur=\"save()\" ng-required=\"required\" ng-disabled=\"isDisabled\"></textarea>\n" +
6165
6191
  "</div>\n" +
6166
6192
  "</div>\n" +
6167
6193
  "</div>"
@@ -6247,7 +6273,8 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
6247
6273
  "<div class=\"nice-date-header\">\n" +
6248
6274
  "<span>\n" +
6249
6275
  "<select class=\"year-picker\" ng-model=\"innerDate.year\" ng-change=\"handleDateChange()\" ng-options=\"year for year in years\" ng-disabled=\"isDisabled\">\n" +
6250
- "</select>,\n" +
6276
+ "</select>\n" +
6277
+ "<span>,</span>\n" +
6251
6278
  "<select class=\"month-picker\" ng-model=\"innerDate.month\" ng-change=\"handleDateChange()\" ng-options=\"month.value as month.name for month in months\" ng-disabled=\"isDisabled\">\n" +
6252
6279
  "</select>\n" +
6253
6280
  "</span>\n" +
@@ -6486,6 +6513,7 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
6486
6513
  "<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" +
6487
6514
  "<div class=\"nice-field-wrapper\">\n" +
6488
6515
  "<button type=\"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" +
6516
+ "<input class=\"hidden-input\" ng-model=\"model\" ng-required=\"required\" ng-disabled=\"disabled\" tabindex=\"-1\">\n" +
6489
6517
  "<div class=\"btn-dropdown-inside\" ng-transclude=\"button\" ng-if=\"selected != null\">\n" +
6490
6518
  "<span ng-if=\"!multiple\">{{ selected[objValue] }}</span>\n" +
6491
6519
  "<span ng-if=\"multiple\">\n" +
@@ -6501,7 +6529,7 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
6501
6529
  "<div class=\"nice-dropdown-menu-wrapper\">\n" +
6502
6530
  "<div class=\"nice-dropdown-menu\" ng-if=\"isOpen\">\n" +
6503
6531
  "<div class=\"search-bar\" ng-if=\"!noSearch && searchFunction\">\n" +
6504
- "<input ng-model=\"internal.search\" ng-model-options=\"{ debounce: 500 }\" ng-change=\"handleSearch()\" placeholder=\"{{ searchText }}\">\n" +
6532
+ "<input class=\"search-bar-input\" ng-model=\"internal.search\" ng-model-options=\"{ debounce: 500 }\" ng-change=\"handleSearch()\" placeholder=\"{{ searchText }}\">\n" +
6505
6533
  "<div class=\"count\" ng-if=\"internalList && internalList._metadata && enableLoadMore\">{{ internalList.length }}/{{ internalList._metadata.count }}</div>\n" +
6506
6534
  "<nice-icon ng-if=\"!internal.search\" class=\"icon\" icon=\"icon-search\"></nice-icon>\n" +
6507
6535
  "<nice-icon ng-if=\"internal.search\" class=\"icon\" icon=\"icon-x\" ng-click=\"clearSearch()\"></nice-icon>\n" +
@@ -8028,7 +8056,7 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
8028
8056
  "</div>\n" +
8029
8057
  "<img ng-if=\"imageSource\" data-ng-src=\"{{ imageSource }}\">\n" +
8030
8058
  "</div>\n" +
8031
- "<input class=\"input-file\" type=\"file\" accept=\"{{ accept }}\" ng-model=\"file\" ng-disabled=\"isDisabled || loading\">\n" +
8059
+ "<input class=\"input-file\" type=\"file\" accept=\"{{ accept }}\" ng-model=\"file\" ng-required=\"required\" ng-disabled=\"isDisabled || loading\">\n" +
8032
8060
  "<nice-loader fulldiv=\"true\" ng-if=\"loading\"></nice-loader>\n" +
8033
8061
  "</div>\n" +
8034
8062
  "</div>\n" +