nice-elements 1.4.1 → 1.4.2

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.
@@ -0,0 +1,4 @@
1
+ {
2
+ "editor.formatOnSave": true,
3
+ "html.format.wrapLineLength": 0
4
+ }
package/CHANGELOG.md CHANGED
@@ -1,8 +1,15 @@
1
1
  # Changelog
2
2
 
3
- ## v1.4.0 (1.12.2021)
3
+ ## v1.4.2 (22.4.2022)
4
+
5
+ - created nice-tooltip component,
6
+ - fixed nice-yesno state not visible,
7
+ - worked on demo project
8
+
9
+ ## v1.4.1 (1.12.2021)
4
10
 
5
11
  - added more translation tags
12
+
6
13
  ## v1.4.0 (1.12.2021)
7
14
 
8
15
  - added translation tags,
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # MIT License
2
2
 
3
- Copyright (c) 2021 Klemen Kastelic
3
+ Copyright (c) 2022 Klemen Kastelic
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,39 +1,37 @@
1
- # Nice elements v1.4.1
2
- Nice elements is an AngularJS v1.5.8 module that contains nice form elements like inputs, choice fields, search, toggle, dropdown, etc.
1
+ # Nice elements v1.4.2
3
2
 
3
+ Nice elements is an AngularJS v1.5.8 module that contains nice form elements like inputs, choice fields, search, toggle, dropdown, etc.
4
4
 
5
5
  ---
6
6
 
7
-
8
7
  ## How to build
9
8
 
10
- ```
9
+ ```bash
11
10
  grunt build
12
11
  ```
13
12
 
14
13
  It should compile all the js and html files into `dist/nice.js`, and all the styles into `dist/style.css`.
15
14
 
16
-
17
15
  ---
18
16
 
19
-
20
17
  ## How to run develop?
21
18
 
22
- ```
19
+ ```bash
23
20
  node server.js
24
21
  or
25
22
  npm run serve
26
23
  ```
27
24
 
28
- A demo project from `demo` directory will be available on [http://localhost:3031]().
29
-
25
+ A demo project from `demo` directory will be available on [http://localhost:3031](http://localhost:3031).
30
26
 
31
27
  ---
32
28
 
33
29
  ## LICENSE
30
+
34
31
  See [LICENSE.md](./LICENSE.md)
35
32
 
36
33
  ---
37
34
 
38
35
  ## CHANGELOG
39
- See [CHANGELOG.md](./CHANGELOG.md)
36
+
37
+ See [CHANGELOG.md](./CHANGELOG.md)
package/bower.json CHANGED
@@ -1,18 +1,10 @@
1
1
  {
2
2
  "name": "nice-elements",
3
- "version": "1.4.1",
4
- "authors": [
5
- "Klemen Kastelic <klemen@olaii.com>"
6
- ],
3
+ "version": "1.4.2",
4
+ "authors": ["Klemen Kastelic <klemen@olaii.com>"],
7
5
  "description": "Nice elements",
8
6
  "keywords": [],
9
7
  "license": "MIT",
10
8
  "main": "dist/nice.js",
11
- "ignore": [
12
- "**/.*",
13
- "node_modules",
14
- "bower_components",
15
- "test",
16
- "tests"
17
- ]
9
+ "ignore": ["**/.*", "node_modules", "bower_components", "test", "tests"]
18
10
  }
package/dist/nice.js CHANGED
@@ -3674,7 +3674,7 @@ angular.module('niceElements')
3674
3674
 
3675
3675
  // Link form object with valid object
3676
3676
  if ($scope.valid) {
3677
- $scope.valid = $scope.form;
3677
+ $scope.valid = $scope.forma;
3678
3678
  }
3679
3679
 
3680
3680
  // Fix min
@@ -3718,9 +3718,9 @@ angular.module('niceElements')
3718
3718
  // Check canAdd or canSubtract
3719
3719
  $scope.check = function() {
3720
3720
  if ($scope.required && ($scope.model == undefined || $scope.model == null)) {
3721
- $scope.form.$setValidity("noValue", false);
3721
+ $scope.niceNumberForm.$setValidity("no-value", false);
3722
3722
  } else {
3723
- $scope.form.$setValidity("noValue", null);
3723
+ $scope.niceNumberForm.$setValidity("no-value", null);
3724
3724
  }
3725
3725
 
3726
3726
  if ($scope.min && parseFloat($scope.model) <= $scope.min) {
@@ -3738,9 +3738,9 @@ angular.module('niceElements')
3738
3738
  }
3739
3739
 
3740
3740
  if ($scope.preventZero && parseFloat($scope.model) == 0) {
3741
- $scope.form.$setValidity("zero", false);
3741
+ $scope.niceNumberForm.$setValidity("zero", false);
3742
3742
  } else {
3743
- $scope.form.$setValidity("zero", null);
3743
+ $scope.niceNumberForm.$setValidity("zero", null);
3744
3744
  }
3745
3745
 
3746
3746
  if ($scope.onChange) $scope.onChange({ model: $scope.model });
@@ -3771,11 +3771,11 @@ angular.module('niceElements')
3771
3771
  if ($scope.max) {
3772
3772
  if (result <= parseFloat($scope.max)) {
3773
3773
  $scope.model = result;
3774
- $scope.form.$setDirty();
3774
+ $scope.niceNumberForm.$setDirty();
3775
3775
  }
3776
3776
  } else {
3777
3777
  $scope.model = result;
3778
- $scope.form.$setDirty();
3778
+ $scope.niceNumberForm.$setDirty();
3779
3779
  }
3780
3780
  $scope.check();
3781
3781
  };
@@ -3786,7 +3786,7 @@ angular.module('niceElements')
3786
3786
  var result = new Decimal($scope.model != undefined ? $scope.model : $scope.defaultValue).minus($scope.step).toNumber();
3787
3787
  if (result >= Number($scope.min)) {
3788
3788
  $scope.model = result;
3789
- $scope.form.$setDirty();
3789
+ $scope.niceNumberForm.$setDirty();
3790
3790
  }
3791
3791
  $scope.check();
3792
3792
  };
@@ -4563,6 +4563,27 @@ angular.module('niceElements')
4563
4563
  });
4564
4564
  'use strict';
4565
4565
 
4566
+ /**
4567
+ * @ngdoc directive
4568
+ * @name niceElements.directive:niceTooltip
4569
+ * @description
4570
+ * # niceTooltip
4571
+ */
4572
+ angular.module('niceElements')
4573
+ .directive('niceTooltip', function() {
4574
+ return {
4575
+ restrict: 'EA',
4576
+ link: function(scope, element, attrs) {
4577
+ var html = element.html();
4578
+ element.addClass("nice-tooltip");
4579
+ html = html + "<span class='nice-tooltip-window'>" + attrs.niceTooltip + "</span>"
4580
+ element.html(html);
4581
+ }
4582
+ };
4583
+ });
4584
+
4585
+ 'use strict';
4586
+
4566
4587
  /**
4567
4588
  * @ngdoc directive
4568
4589
  * @name niceElements.directive:niceUpload
@@ -4715,18 +4736,17 @@ angular.module('niceElements')
4715
4736
  isInline: '=',
4716
4737
  help: '@'
4717
4738
  },
4718
- controller: function($scope, $attrs, gettextCatalog) {
4719
- if (!$attrs.yes) { $attrs.yes = gettextCatalog.getString('Yes', null, "Nice"); }
4720
- if (!$attrs.no) { $attrs.no = gettextCatalog.getString('No', null, "Nice"); }
4721
- if (!$attrs.title) { $attrs.title = ''; }
4722
- if (!$attrs.fieldWidth) { $attrs.fieldWidth = 'col-sm-8'; }
4723
- if (!$attrs.labelWidth) { $attrs.labelWidth = 'col-sm-4'; }
4739
+ controller: function($scope, gettextCatalog) {
4740
+ if (!$scope.yes) { $scope.yes = gettextCatalog.getString('Yes', null, "Nice"); }
4741
+ if (!$scope.no) { $scope.no = gettextCatalog.getString('No', null, "Nice"); }
4742
+ if (!$scope.title) { $scope.title = ''; }
4743
+ if (!$scope.fieldWidth) { $scope.fieldWidth = 'col-sm-8'; }
4744
+ if (!$scope.labelWidth) { $scope.labelWidth = 'col-sm-4'; }
4724
4745
  if(!angular.isDefined($scope.model) && !angular.isDefined($scope.options)) $scope.model = !angular.isDefined($scope.defaultFalse);
4725
4746
  if(!angular.isDefined($scope.modelValue) && angular.isDefined($scope.options)) $scope.modelValue = $scope.options[0];
4726
4747
 
4727
- $attrs.defaultFalse = angular.isDefined($attrs.defaultFalse);
4728
- $attrs.noMargin = angular.isDefined($attrs.noMargin);
4729
- $attrs.isDisabled = angular.isDefined($attrs.isDisabled);
4748
+ $scope.defaultFalse = angular.isDefined($scope.defaultFalse);
4749
+ $scope.noMargin = angular.isDefined($scope.noMargin);
4730
4750
 
4731
4751
  $scope.buttonClass = "";
4732
4752
 
@@ -5459,14 +5479,14 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
5459
5479
 
5460
5480
 
5461
5481
  $templateCache.put('src/components/nice-number/nice-number.html',
5462
- "<div class=\"nice-component nice-number\" ng-form=\"form\" ng-class=\"{ 'margin-bottom-0' : noMargin, 'nice-component-inline': isInline }\">\n" +
5482
+ "<div class=\"nice-component nice-number\" ng-form=\"niceNumberForm\" ng-class=\"{ 'margin-bottom-0' : noMargin, 'nice-component-inline': isInline }\">\n" +
5463
5483
  "<div ng-class=\"{'row' : !disableRow}\">\n" +
5464
5484
  "<div class=\"nice-title col-xs-12\" ng-class=\"labelWidth ? labelWidth : 'col-sm-4'\" ng-if=\"title\">\n" +
5465
5485
  "<div class=\"nice-title-text\">{{ title }}<span ng-if=\"required\">*</span></div>\n" +
5466
5486
  "<nice-help class=\"nice-title-help\" ng-if=\"help\" text=\"{{ help }}\"></nice-help>\n" +
5467
5487
  "</div>\n" +
5468
5488
  "<div class=\"nice-field col-xs-12\" ng-class=\"fieldWidth ? fieldWidth : 'col-sm-8'\">\n" +
5469
- "<div class=\"input-group\" ng-class=\"{'has-warning': !disabled && form.$invalid && form.$dirty}\">\n" +
5489
+ "<div class=\"input-group\" ng-class=\"{'has-warning': !disabled && niceNumberForm.$invalid && niceNumberForm.$dirty}\">\n" +
5470
5490
  "<span class=\"input-group-btn\">\n" +
5471
5491
  "<button class=\"btn btn-default\" type=\"button\" ng-disabled=\"!canSubstract\" ng-click=\"subtract()\">-</button>\n" +
5472
5492
  "</span>\n" +
@@ -5475,12 +5495,20 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
5475
5495
  "<button class=\"btn btn-default\" type=\"button\" ng-disabled=\"!canAdd\" ng-click=\"add()\">+</button>\n" +
5476
5496
  "</span>\n" +
5477
5497
  "</div>\n" +
5478
- "<div class=\"error-messages\" ng-if=\"form.$error && !hideError\" ng-class=\"{ 'floating-error': floatingError }\">\n" +
5479
- "<div class=\"error-message\" ng-if=\"form.$dirty && form.$error.number\" translate translate-context=\"Nice\">This field requires a number</div>\n" +
5480
- "<div class=\"error-message\" ng-if=\"form.$error.min\"><translate translate-context=\"Nice\">Minimum value is</translate>{{ min }}</div>\n" +
5481
- "<div class=\"error-message\" ng-if=\"form.$error.max\"><translate translate-context=\"Nice\">Maximum value is</translate>{{ max }}</div>\n" +
5482
- "<div class=\"error-message\" ng-if=\"form.$error.zero\"><translate translate-context=\"Nice\">0 is not allowed</translate></div>\n" +
5483
- "<div class=\"error-message\" ng-if=\"form.$error.noValue && !form.$error.zero && !form.$error.min && !form.$error.max\"><translate translate-context=\"Nice\">Value is missing</translate></div>\n" +
5498
+ "<div class=\"error-messages\" ng-if=\"niceNumberForm.$error && !hideError\" ng-class=\"{ 'floating-error': floatingError }\">\n" +
5499
+ "<div class=\"error-message\" ng-if=\"niceNumberForm.$dirty && niceNumberForm.$error.number\" translate translate-context=\"Nice\">This field requires a number</div>\n" +
5500
+ "<div class=\"error-message\" ng-if=\"niceNumberForm.$error.min\">\n" +
5501
+ "<translate translate-context=\"Nice\">Minimum value is</translate>{{ min }}\n" +
5502
+ "</div>\n" +
5503
+ "<div class=\"error-message\" ng-if=\"niceNumberForm.$error.max\">\n" +
5504
+ "<translate translate-context=\"Nice\">Maximum value is</translate>{{ max }}\n" +
5505
+ "</div>\n" +
5506
+ "<div class=\"error-message\" ng-if=\"niceNumberForm.$error.zero\">\n" +
5507
+ "<translate translate-context=\"Nice\">0 is not allowed</translate>\n" +
5508
+ "</div>\n" +
5509
+ "<div class=\"error-message\" ng-if=\"niceNumberForm.$error.no-value && !niceNumberForm.$error.zero && !niceNumberForm.$error.min && !niceNumberForm.$error.max\">\n" +
5510
+ "<translate translate-context=\"Nice\">Value is missing</translate>\n" +
5511
+ "</div>\n" +
5484
5512
  "</div>\n" +
5485
5513
  "</div>\n" +
5486
5514
  "</div>\n" +