nice-elements 1.11.2 → 1.12.1

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,15 @@
1
1
  # Changelog
2
2
 
3
+ ## v1.12.1 (20.3.2025)
4
+
5
+ - fixed nice toggle if model is undefined set it to false,
6
+ - added iconCenter prop to nice alert
7
+
8
+ ## v1.12.0 (10.3.2025)
9
+
10
+ - created nice-alert component,
11
+ - added handle decimal numbers in nice input component
12
+
3
13
  ## v1.11.2 (20.2.2025)
4
14
 
5
15
  - worked on nice calendar popup
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.11.2
3
+ # Nice elements v1.12.1
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,10 +1,18 @@
1
1
  {
2
2
  "name": "nice-elements",
3
- "version": "1.11.2",
4
- "authors": ["Klemen Kastelic <klemen@olaii.com>"],
3
+ "version": "1.12.1",
4
+ "authors": [
5
+ "Klemen Kastelic <klemen@olaii.com>"
6
+ ],
5
7
  "description": "Nice elements",
6
8
  "keywords": [],
7
9
  "license": "MIT",
8
10
  "main": "dist/nice.js",
9
- "ignore": ["**/.*", "node_modules", "bower_components", "test", "tests"]
10
- }
11
+ "ignore": [
12
+ "**/.*",
13
+ "node_modules",
14
+ "bower_components",
15
+ "test",
16
+ "tests"
17
+ ]
18
+ }
package/dist/nice.js CHANGED
@@ -2,6 +2,35 @@
2
2
 
3
3
  angular.module('niceElements', []);
4
4
 
5
+ /**
6
+ * @ngdoc directive
7
+ * @name niceElements.directive:niceAlert
8
+ * @description
9
+ * # niceAlert
10
+ */
11
+ angular.module('niceElements')
12
+ .directive('niceAlert', function () {
13
+ return {
14
+ templateUrl: 'src/components/nice-alert/nice-alert.html',
15
+ restrict: 'E',
16
+ transclude: true,
17
+ replace: true,
18
+ scope: {
19
+ icon: '@?',
20
+ type: '@?',
21
+ niceTitle: '@?',
22
+ message: '@?',
23
+ fitContent: '=?',
24
+ iconCenter: '@?'
25
+ },
26
+ controller: function ($scope) {
27
+ if (!$scope.type) $scope.type = "error";
28
+ if (!$scope.icon) $scope.icon = "icon-alert-triangle";
29
+ }
30
+ };
31
+ });
32
+
33
+
5
34
  /**
6
35
  * @ngdoc directive
7
36
  * @name niceElements.directive:niceButtonToggle
@@ -3821,11 +3850,6 @@ angular.module('niceElements')
3821
3850
  multilanguageField: '@?', // Multiple languages field name
3822
3851
  autocomplete: "@?"
3823
3852
  },
3824
-
3825
- link: function (scope, element, attrs) {
3826
-
3827
- },
3828
-
3829
3853
  controller: function ($scope, $attrs, $rootScope, $element, ngDialog) {
3830
3854
  if (!$attrs.type) { $attrs.type = 'text'; }
3831
3855
  if (!$attrs.title) { $attrs.title = ''; }
@@ -3939,9 +3963,9 @@ angular.module('niceElements')
3939
3963
  if ($scope.onChange) {
3940
3964
  $timeout(function () {
3941
3965
  $scope.onChange({ model: $scope.model });
3942
- })
3966
+ });
3943
3967
  }
3944
- }
3968
+ };
3945
3969
  $scope.id = Math.random().toString(36).substring(7);
3946
3970
 
3947
3971
  // Handle multiple language field if empty
@@ -3978,13 +4002,13 @@ angular.module('niceElements')
3978
4002
  const filteredFields = {};
3979
4003
  angular.forEach(newFields, function (value, key) {
3980
4004
  if (value != '') filteredFields[key] = value;
3981
- })
4005
+ });
3982
4006
  if (!$scope.multilanguage) $scope.multilanguage = {};
3983
4007
  if (!$scope.multilanguage[$scope.multilanguageField]) $scope.multilanguage[$scope.multilanguageField] = {};
3984
4008
  $scope.multilanguage[$scope.multilanguageField] = filteredFields;
3985
4009
  $scope.numberOfLanguages = Object.keys($scope.multilanguage[$scope.multilanguageField]).length;
3986
4010
  };
3987
- }
4011
+ };
3988
4012
 
3989
4013
  $scope.keypress = function (event) {
3990
4014
  if ($scope.numbersOnly) {
@@ -3996,9 +4020,17 @@ angular.module('niceElements')
3996
4020
  }
3997
4021
  }
3998
4022
 
3999
- if ($scope.type == "number" || $scope.type == "integer") {
4023
+ if ($scope.type == "decimal" || $scope.type == "number" || $scope.type == "integer") {
4024
+ // Handle decimal numbers
4025
+ if ($scope.type == "number" || $scope.type == "decimal") {
4026
+ $scope.model = String($scope.model).replace(",", "."); // Replace , with .
4027
+ if (isNaN($scope.model)) { // If parsed float is NaN
4028
+ $scope.model = String(parseFloat($scope.model) || "");
4029
+ }
4030
+ }
4031
+
4000
4032
  if (event.charCode == 46 || event.charCode == 44) { // Handle "." and "," key (only one allowed)
4001
- if ($scope.type == "number") {
4033
+ if ($scope.type == "number" || $scope.type == "decimal") {
4002
4034
  if (String($scope.model).indexOf(".") >= 0) {
4003
4035
  event.preventDefault();
4004
4036
  return false;
@@ -5616,6 +5648,7 @@ angular.module('niceElements')
5616
5648
  if (!$scope.title) { $scope.title = ''; }
5617
5649
  if (!$scope.fieldWidth) { $scope.fieldWidth = 'col-sm-8'; }
5618
5650
  if (!$scope.labelWidth) { $scope.labelWidth = 'col-sm-4'; }
5651
+ if (!angular.isDefined($scope.model)) $scope.model = false;
5619
5652
 
5620
5653
  // ------------------------- Switch -------------------------
5621
5654
  $scope.toggle = function () {
@@ -6190,7 +6223,7 @@ angular.module('niceElements')
6190
6223
  .service('NiceService', function ($rootScope) {
6191
6224
  const service = {
6192
6225
  name: "Nice elements",
6193
- version: "1.11.2",
6226
+ version: "1.12.0",
6194
6227
  getHeader: function () {
6195
6228
  return {};
6196
6229
  },
@@ -6272,6 +6305,17 @@ angular.module('niceElements')
6272
6305
  angular.module('niceElements').run(['$templateCache', function($templateCache) {
6273
6306
  'use strict';
6274
6307
 
6308
+ $templateCache.put('src/components/nice-alert/nice-alert.html',
6309
+ "<div class=\"nice-alert\" ng-class=\"['nice-alert-' + type, { 'nice-alert-fit': fitContent, 'nice-icon-center': iconCenter }]\">\n" +
6310
+ "<nice-icon class=\"nice-alert-icon\" icon=\"{{ icon }}\" ng-if=\"icon\"></nice-icon>\n" +
6311
+ "<div class=\"nice-alert-body\">\n" +
6312
+ "<div class=\"nice-alert-title\" ng-if=\"niceTitle\">{{ niceTitle }}</div>\n" +
6313
+ "<div class=\"nice-alert-message\" ng-transclude>{{ message }}</div>\n" +
6314
+ "</div>\n" +
6315
+ "</div>"
6316
+ );
6317
+
6318
+
6275
6319
  $templateCache.put('src/components/nice-button-toggle/nice-button-toggle.html',
6276
6320
  "<div class=\"nice-component nice-button-toggle row\">\n" +
6277
6321
  "<div class=\"col-xs-offset-4 col-xs-8\">\n" +