nice-elements 1.10.1 → 1.10.3

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,16 @@
1
1
  # Changelog
2
2
 
3
+ ## v1.10.3 (4.4.2024)
4
+
5
+ - fixed nice button default type,
6
+ - fixed disabled button states,
7
+ - happy birthday Bine!
8
+
9
+ ## v1.10.2 (3.4.2024)
10
+
11
+ - worked on nice-toggle component style,
12
+ - added isBlock and titleRight props to nice-toggle component
13
+
3
14
  ## v1.10.1 (22.3.2024)
4
15
 
5
16
  - added html bind to nice table column,
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.1
3
+ # Nice elements v1.10.3
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.1",
3
+ "version": "1.10.3",
4
4
  "authors": ["Klemen Kastelic <klemen@olaii.com>"],
5
5
  "description": "Nice elements",
6
6
  "keywords": [],
package/dist/nice.js CHANGED
@@ -46,11 +46,11 @@ angular.module('niceElements')
46
46
  niceClick: '&',
47
47
  niceDisabled: '=',
48
48
  addClass: '@',
49
- type: '@?'
49
+ niceType: '@?'
50
50
  },
51
51
  controller: function ($q, $scope, $transclude) {
52
52
  if ($scope.addClass != undefined) console.warn("[NICE ELEMENTS] Nice button: add-class attribute is deprecated")
53
- if (!$scope.type) $scope.type = "button";
53
+ if (!$scope.niceType) $scope.niceType = "button";
54
54
  $scope.showSlot = $transclude().length > 0;
55
55
  $scope.loading = false;
56
56
 
@@ -5486,79 +5486,36 @@ angular.module('niceElements')
5486
5486
  isDisabled: '=',
5487
5487
  fieldWidth: '@',
5488
5488
  labelWidth: '@',
5489
- defaultFalse: '@',
5490
5489
  noMargin: '@',
5491
5490
  onChange: '&?',
5492
5491
  isInline: '=',
5492
+ isBlock: '=',
5493
+ titleRight: '=',
5493
5494
  help: '@'
5494
5495
  },
5495
- controller: function ($scope) {
5496
+ controller: function ($scope, $timeout) {
5496
5497
  if (!$scope.title) { $scope.title = ''; }
5497
5498
  if (!$scope.fieldWidth) { $scope.fieldWidth = 'col-sm-8'; }
5498
5499
  if (!$scope.labelWidth) { $scope.labelWidth = 'col-sm-4'; }
5499
5500
 
5500
- // ------------------------- Set overlay button position based on passed state in $scope.model -------------------------
5501
- $scope.setButtonPosition = function (state) {
5502
- if (state) {
5503
- $scope.buttonClass = "yesno-button-yes";
5504
- } else {
5505
- $scope.buttonClass = "yesno-button-no";
5506
- }
5507
- };
5508
-
5509
- // ------------------------- Watch for changes from outside -------------------------
5510
- $scope.$watch('model', function (value_new, value_old) {
5511
- if (angular.isDefined($scope.model)) {
5512
- $scope.setButtonLabel($scope.model);
5513
- $scope.setButtonPosition($scope.model);
5514
- }
5515
- });
5516
-
5517
- // ------------------------- Watch for model value -------------------------
5518
- $scope.$watch('modelValue', function (value_new, value_old) {
5519
- if ($scope.options) {
5520
- $scope.model = $scope.modelValue == $scope.options[0];
5521
- }
5522
- });
5523
-
5524
- // ------------------------- Set button label -------------------------
5525
- $scope.setButtonLabel = function (state) {
5526
- if (state) {
5527
- $scope.state = $scope.yes;
5528
- } else {
5529
- $scope.state = $scope.no;
5530
- }
5531
- };
5532
-
5533
- // ------------------------- Set width -------------------------
5534
- $scope.setWidth = function (width, el) {
5535
- el.style.width = width;
5536
- };
5537
-
5538
-
5539
5501
  // ------------------------- Switch -------------------------
5540
- $scope.switch = function () {
5541
- if (!$scope.isDisabled) {
5542
- $scope.model = !$scope.model;
5502
+ $scope.toggle = function () {
5503
+ if ($scope.isDisabled) return;
5504
+ $scope.model = !$scope.model;
5543
5505
 
5544
- if ($scope.options) {
5545
- if ($scope.model) {
5546
- $scope.modelValue = $scope.options[0];
5547
- } else {
5548
- $scope.modelValue = $scope.options[1];
5549
- }
5506
+ if ($scope.options) {
5507
+ if ($scope.model) {
5508
+ $scope.modelValue = $scope.options[0];
5509
+ } else {
5510
+ $scope.modelValue = $scope.options[1];
5550
5511
  }
5512
+ }
5551
5513
 
5514
+ $timeout(function() {
5552
5515
  if ($scope.onChange) $scope.onChange({ model: $scope.model });
5553
5516
  $scope.formToggle.$setDirty();
5554
- }
5517
+ });
5555
5518
  };
5556
-
5557
- // Call it first time
5558
- $scope.setButtonPosition($scope.model);
5559
-
5560
- // Set label based on state passed in $scope.model
5561
- $scope.setButtonLabel($scope.model);
5562
5519
  }
5563
5520
  };
5564
5521
  });
@@ -5946,7 +5903,7 @@ angular.module('niceElements')
5946
5903
  .service('NiceService', function () {
5947
5904
  var service = {
5948
5905
  name: "Nice elements",
5949
- version: "1.10.1",
5906
+ version: "1.10.3",
5950
5907
  getHeader: function () {
5951
5908
  return {};
5952
5909
  }
@@ -6039,7 +5996,7 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
6039
5996
 
6040
5997
 
6041
5998
  $templateCache.put('src/components/nice-button/nice-button.html',
6042
- "<button type=\"{{ type }}\" class=\"nice-component nice-button btn btn-primary\" ng-class=\"{ 'margin-bottom-0' : noMargin }\" ng-click=\"click()\" ng-disabled=\"niceDisabled == true\">\n" +
5999
+ "<button type=\"{{ niceType }}\" class=\"nice-component nice-button btn btn-primary\" ng-class=\"{ 'margin-bottom-0' : noMargin }\" ng-click=\"click()\" ng-disabled=\"niceDisabled == true\">\n" +
6043
6000
  "<nice-icon icon=\"{{ icon }}\" ng-if=\"icon\" ng-class=\"{ 'opacity-0': loading }\"></nice-icon>\n" +
6044
6001
  "<span ng-if=\"showSlot\" ng-transclude ng-class=\"{ 'opacity-0': loading }\"></span>\n" +
6045
6002
  "<nice-loader ng-if=\"loading\" fulldiv=\"true\" class=\"nice-button-loader\"></nice-loader>\n" +
@@ -8016,11 +7973,11 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
8016
7973
 
8017
7974
 
8018
7975
  $templateCache.put('src/components/nice-toggle/nice-toggle.html',
8019
- "<div class=\"nice-component nice-toggle\" ng-class=\"{ 'margin-bottom-0' : noMargin, 'nice-component-inline': isInline, 'active': model }\" ng-form=\"formToggle\">\n" +
7976
+ "<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" +
8020
7977
  "<div class=\"row\">\n" +
8021
7978
  "<nice-title text=\"title\" help=\"help\" required=\"required\" label-width=\"labelWidth\"></nice-title>\n" +
8022
7979
  "<div class=\"nice-field col-xs-12\" ng-class=\"[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]\">\n" +
8023
- "<button type=\"button\" class=\"nice-toggle-field\" ng-click=\"switch()\" ng-disabled=\"isDisabled\">\n" +
7980
+ "<button type=\"button\" class=\"nice-toggle-field\" ng-click=\"toggle()\" ng-disabled=\"isDisabled\">\n" +
8024
7981
  "<div class=\"nice-toggle-field-handle\">{{ state }}</div>\n" +
8025
7982
  "</button>\n" +
8026
7983
  "</div>\n" +