nice-elements 1.11.2 → 1.12.0

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,10 @@
1
1
  # Changelog
2
2
 
3
+ ## v1.12.0 (10.3.2025)
4
+
5
+ - created nice-alert component,
6
+ - added handle decimal numbers in nice input component
7
+
3
8
  ## v1.11.2 (20.2.2025)
4
9
 
5
10
  - 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.0
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.0",
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,34 @@
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
+ },
25
+ controller: function ($scope) {
26
+ if (!$scope.type) $scope.type = "error";
27
+ if (!$scope.icon) $scope.icon = "icon-alert-triangle";
28
+ }
29
+ };
30
+ });
31
+
32
+
5
33
  /**
6
34
  * @ngdoc directive
7
35
  * @name niceElements.directive:niceButtonToggle
@@ -3821,11 +3849,6 @@ angular.module('niceElements')
3821
3849
  multilanguageField: '@?', // Multiple languages field name
3822
3850
  autocomplete: "@?"
3823
3851
  },
3824
-
3825
- link: function (scope, element, attrs) {
3826
-
3827
- },
3828
-
3829
3852
  controller: function ($scope, $attrs, $rootScope, $element, ngDialog) {
3830
3853
  if (!$attrs.type) { $attrs.type = 'text'; }
3831
3854
  if (!$attrs.title) { $attrs.title = ''; }
@@ -3939,9 +3962,9 @@ angular.module('niceElements')
3939
3962
  if ($scope.onChange) {
3940
3963
  $timeout(function () {
3941
3964
  $scope.onChange({ model: $scope.model });
3942
- })
3965
+ });
3943
3966
  }
3944
- }
3967
+ };
3945
3968
  $scope.id = Math.random().toString(36).substring(7);
3946
3969
 
3947
3970
  // Handle multiple language field if empty
@@ -3978,13 +4001,13 @@ angular.module('niceElements')
3978
4001
  const filteredFields = {};
3979
4002
  angular.forEach(newFields, function (value, key) {
3980
4003
  if (value != '') filteredFields[key] = value;
3981
- })
4004
+ });
3982
4005
  if (!$scope.multilanguage) $scope.multilanguage = {};
3983
4006
  if (!$scope.multilanguage[$scope.multilanguageField]) $scope.multilanguage[$scope.multilanguageField] = {};
3984
4007
  $scope.multilanguage[$scope.multilanguageField] = filteredFields;
3985
4008
  $scope.numberOfLanguages = Object.keys($scope.multilanguage[$scope.multilanguageField]).length;
3986
4009
  };
3987
- }
4010
+ };
3988
4011
 
3989
4012
  $scope.keypress = function (event) {
3990
4013
  if ($scope.numbersOnly) {
@@ -3996,9 +4019,17 @@ angular.module('niceElements')
3996
4019
  }
3997
4020
  }
3998
4021
 
3999
- if ($scope.type == "number" || $scope.type == "integer") {
4022
+ if ($scope.type == "decimal" || $scope.type == "number" || $scope.type == "integer") {
4023
+ // Handle decimal numbers
4024
+ if ($scope.type == "number" || $scope.type == "decimal") {
4025
+ $scope.model = String($scope.model).replace(",", "."); // Replace , with .
4026
+ if (isNaN($scope.model)) { // If parsed float is NaN
4027
+ $scope.model = String(parseFloat($scope.model) || "");
4028
+ }
4029
+ }
4030
+
4000
4031
  if (event.charCode == 46 || event.charCode == 44) { // Handle "." and "," key (only one allowed)
4001
- if ($scope.type == "number") {
4032
+ if ($scope.type == "number" || $scope.type == "decimal") {
4002
4033
  if (String($scope.model).indexOf(".") >= 0) {
4003
4034
  event.preventDefault();
4004
4035
  return false;
@@ -6190,7 +6221,7 @@ angular.module('niceElements')
6190
6221
  .service('NiceService', function ($rootScope) {
6191
6222
  const service = {
6192
6223
  name: "Nice elements",
6193
- version: "1.11.2",
6224
+ version: "1.12.0",
6194
6225
  getHeader: function () {
6195
6226
  return {};
6196
6227
  },
@@ -6272,6 +6303,17 @@ angular.module('niceElements')
6272
6303
  angular.module('niceElements').run(['$templateCache', function($templateCache) {
6273
6304
  'use strict';
6274
6305
 
6306
+ $templateCache.put('src/components/nice-alert/nice-alert.html',
6307
+ "<div class=\"nice-alert\" ng-class=\"['nice-alert-' + type, { 'nice-alert-fit': fitContent }]\">\n" +
6308
+ "<nice-icon class=\"nice-alert-icon\" icon=\"{{ icon }}\" ng-if=\"icon\"></nice-icon>\n" +
6309
+ "<div class=\"nice-alert-body\">\n" +
6310
+ "<div class=\"nice-alert-title\" ng-if=\"niceTitle\">{{ niceTitle }}</div>\n" +
6311
+ "<div class=\"nice-alert-message\" ng-transclude>{{ message }}</div>\n" +
6312
+ "</div>\n" +
6313
+ "</div>"
6314
+ );
6315
+
6316
+
6275
6317
  $templateCache.put('src/components/nice-button-toggle/nice-button-toggle.html',
6276
6318
  "<div class=\"nice-component nice-button-toggle row\">\n" +
6277
6319
  "<div class=\"col-xs-offset-4 col-xs-8\">\n" +