nice-elements 1.7.7 → 1.7.8

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.7.8 (10.2.2023)
4
+
5
+ - worked on nice-quantity component
6
+
3
7
  ## v1.7.7 (10.1.2023)
4
8
 
5
9
  - fixed nice-checkbox shrink problem,
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.7.7
3
+ # Nice elements v1.7.8
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.7.7",
3
+ "version": "1.7.8",
4
4
  "authors": [
5
5
  "Klemen Kastelic <klemen@olaii.com>"
6
6
  ],
package/dist/nice.js CHANGED
@@ -4382,7 +4382,8 @@ angular.module('niceElements')
4382
4382
  scope: {
4383
4383
  title: '@',
4384
4384
  model: '=',
4385
- max: '=',
4385
+ min: '=?',
4386
+ max: '=?',
4386
4387
  onChange: '&?',
4387
4388
  noMargin: '@',
4388
4389
  fieldWidth: '@',
@@ -4392,32 +4393,29 @@ angular.module('niceElements')
4392
4393
  help: '@',
4393
4394
  },
4394
4395
  controller: function ($scope) {
4395
- if (!$scope.model) {
4396
- $scope.model = 0;
4397
- }
4396
+ $scope.min = Number($scope.min) || 0;
4397
+ $scope.max = Number($scope.max) || Infinity;
4398
+ if (!$scope.model) $scope.model = Number($scope.min);
4398
4399
 
4399
4400
  $scope.add = function () {
4400
- if ($scope.max) {
4401
- if ($scope.max >= $scope.model + 1) {
4402
- $scope.model += 1;
4403
- if ($scope.onChange) $scope.onChange({ model: $scope.model });
4404
- }
4405
- } else {
4406
- $scope.model += 1;
4407
- if ($scope.onChange) $scope.onChange({ model: $scope.model });
4408
- }
4401
+ $scope.model += 1;
4402
+ $scope.handleChange();
4409
4403
  };
4410
4404
 
4411
4405
  $scope.sub = function () {
4412
- if ($scope.model - 1 >= 0) {
4413
- $scope.model -= 1;
4414
- if ($scope.onChange) $scope.onChange({ model: $scope.model });
4415
- }
4406
+ $scope.model -= 1;
4407
+ $scope.handleChange();
4416
4408
  };
4417
4409
 
4418
4410
  $scope.handleChange = function () {
4419
- if ($scope.model) {
4411
+ if ($scope.model != undefined) {
4420
4412
  $scope.model = Number($scope.model);
4413
+ if ($scope.model < $scope.min) $scope.model = angular.copy($scope.min);
4414
+ if ($scope.model > $scope.max) $scope.model = angular.copy($scope.max);
4415
+ if ($scope.onChange) $scope.onChange({ model: $scope.model });
4416
+ } else {
4417
+ $scope.model = angular.copy($scope.min);
4418
+ $scope.handleChange();
4421
4419
  }
4422
4420
  };
4423
4421
  }
@@ -6211,11 +6209,11 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
6211
6209
  "<nice-title title=\"title\" help=\"help\" required=\"required\" label-width=\"labelWidth\"></nice-title>\n" +
6212
6210
  "<div class=\"nice-field col-xs-12\" ng-class=\"[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]\">\n" +
6213
6211
  "<div class=\"input-group\">\n" +
6214
- "<button class=\"btn btn-default btn-left\" ng-click=\"sub()\" type=\"button\" ng-disabled=\"isDisabled\" tabindex=\"-1\">\n" +
6212
+ "<button class=\"btn btn-default btn-left\" ng-click=\"sub()\" type=\"button\" ng-disabled=\"model <= min || isDisabled\" tabindex=\"-1\">\n" +
6215
6213
  "<nice-icon icon=\"icon-minus\"></nice-icon>\n" +
6216
6214
  "</button>\n" +
6217
- "<input class=\"value form-control\" ng-model=\"model\" type=\"number\" ng-change=\"handleChange()\" ng-disabled=\"isDisabled\">\n" +
6218
- "<button class=\"btn btn-default btn-right\" ng-click=\"add()\" type=\"button\" ng-disabled=\"isDisabled\" tabindex=\"-1\">\n" +
6215
+ "<input class=\"value form-control\" ng-model=\"model\" type=\"number\" min=\"{{ min }}\" max=\"{{ max }}\" ng-change=\"handleChange()\" ng-disabled=\"isDisabled\">\n" +
6216
+ "<button class=\"btn btn-default btn-right\" ng-click=\"add()\" type=\"button\" ng-disabled=\"model >= max || isDisabled\" tabindex=\"-1\">\n" +
6219
6217
  "<nice-icon icon=\"icon-plus\"></nice-icon>\n" +
6220
6218
  "</button>\n" +
6221
6219
  "</div>\n" +