nice-elements 1.13.7 → 1.14.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.
Files changed (35) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +1 -1
  3. package/bower.json +1 -1
  4. package/dist/nice.js +2760 -5123
  5. package/dist/nice.min.js +1 -1
  6. package/dist/style.css +413 -983
  7. package/dist/style.css.map +1 -59
  8. package/dist/style.min.css +2 -2
  9. package/package.json +6 -6
  10. package/src/components/nice-comment/nice-comment.js +11 -11
  11. package/src/components/nice-comment/nice-comment.scss +0 -2
  12. package/src/components/nice-date/nice-date.js +12 -2
  13. package/src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.js +9 -2
  14. package/src/components/nice-dropdown/nice-dropdown.js +16 -15
  15. package/src/components/nice-help/nice-help.html +3 -4
  16. package/src/components/nice-help/nice-help.js +10 -37
  17. package/src/components/nice-help/nice-help.scss +59 -27
  18. package/src/components/nice-input/nice-input.html +11 -1
  19. package/src/components/nice-input/nice-input.js +38 -10
  20. package/src/components/nice-input/nice-input.scss +11 -0
  21. package/src/components/nice-notification/nice-notification.html +9 -4
  22. package/src/components/nice-notification/nice-notification.js +66 -46
  23. package/src/components/nice-notification/nice-notification.scss +97 -19
  24. package/src/components/nice-number/nice-number.html +35 -4
  25. package/src/components/nice-number/nice-number.js +40 -7
  26. package/src/components/nice-popup/nice-popup.js +10 -5
  27. package/src/components/nice-search2/nice-search2.js +15 -5
  28. package/src/components/nice-toggle/nice-toggle.html +18 -2
  29. package/src/components/nice-toggle/nice-toggle.js +4 -1
  30. package/src/components/nice-toggle/nice-toggle.scss +31 -0
  31. package/src/components/nice-view/_nice-view.scss +22 -0
  32. package/src/components/nice-virtual-scroll/nice-virtual-scroll.js +15 -3
  33. package/src/directives/nice-click-outside.js +24 -18
  34. package/src/directives/nice-tooltip/nice-tooltip.js +14 -4
  35. package/src/services/nice-service.js +14 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nice-elements",
3
- "version": "1.13.7",
3
+ "version": "1.14.0",
4
4
  "description": "Nice elements used in olaii angular 1.x webapps.",
5
5
  "main": "dist/nice.js",
6
6
  "license": "MIT",
@@ -10,11 +10,11 @@
10
10
  },
11
11
  "dependencies": {
12
12
  "@olaii/ng-infinite-scroll": "1.3.1",
13
- "angular-infinite-scroll": "3.1.1",
14
13
  "@popperjs/core": "2.11.6",
15
14
  "angular": "1.5.8",
16
15
  "angular-animate": "1.5.8",
17
16
  "angular-gettext": "2.4.2",
17
+ "angular-infinite-scroll": "3.1.1",
18
18
  "angular-route": "1.5.8",
19
19
  "angular-sanitize": "1.5.8",
20
20
  "angular-touch": "1.5.8",
@@ -27,10 +27,10 @@
27
27
  "ng-dialog": "0.5.6"
28
28
  },
29
29
  "devDependencies": {
30
- "@eslint/js": "^9.2.0",
31
- "eslint": "^9.2.0",
32
- "globals": "^15.2.0",
30
+ "@eslint/js": "9.2.0",
31
+ "eslint": "9.2.0",
33
32
  "express": "4.17.1",
33
+ "globals": "15.2.0",
34
34
  "grunt": "1.6.1",
35
35
  "grunt-angular-templates": "1.2.0",
36
36
  "grunt-contrib-clean": "2.0.0",
@@ -40,6 +40,6 @@
40
40
  "grunt-contrib-uglify": "5.0.1",
41
41
  "grunt-sass": "3.1.0",
42
42
  "load-grunt-tasks": "5.1.0",
43
- "node-sass": "9.0.0"
43
+ "sass": "1.107.1"
44
44
  }
45
45
  }
@@ -45,21 +45,21 @@ angular.module('niceElements')
45
45
  });
46
46
  };
47
47
 
48
- textareas[0].addEventListener('keydown', autosize);
49
- autosize();
50
-
48
+ // Resize to fit the content. Runs outside Angular: it only touches the
49
+ // textarea's style, so it never triggers a digest.
51
50
  function autosize() {
52
51
  const el = textareas[0];
53
- $timeout(function () {
54
- el.style.cssText = 'height:auto; padding:0';
52
+ el.style.height = 'auto';
53
+ el.style.height = (el.scrollHeight + 2) + 'px';
54
+ }
55
55
 
56
- // for box-sizing other than "content-box" use:
57
- el.style.cssText = '-moz-box-sizing:content-box';
56
+ // 'input' fires after the value changes (typing, paste, cut), so no timeout is needed
57
+ textareas[0].addEventListener('input', autosize);
58
58
 
59
- // Fix height
60
- el.style.cssText = 'height:' + (el.scrollHeight + 2) + 'px';
61
- });
62
- }
59
+ // Also fit when the model is set from outside; wait for ngModel to render it
60
+ scope.$watch('model', function () {
61
+ $timeout(autosize, 0, false);
62
+ });
63
63
  },
64
64
  controller: function ($scope) {
65
65
  $scope.editing = false;
@@ -27,13 +27,11 @@
27
27
 
28
28
  border-radius: $nice-border-radius;
29
29
  border-color: transparent;
30
- color: $nice-base-color;
31
30
  -webkit-user-select: none;
32
31
  padding: 6px 0px;
33
32
 
34
33
  &.editing {
35
34
  padding: 6px;
36
- color: $nice-font-color;
37
35
  -webkit-user-select: initial;
38
36
  }
39
37
  }
@@ -114,10 +114,17 @@ angular.module('niceElements')
114
114
  });
115
115
  };
116
116
 
117
- $timeout(function () {
117
+ const setupTimer = $timeout(function () {
118
118
  if (!$scope.inline) $scope.setupPopper();
119
119
  }, 100);
120
120
 
121
+ // Popper adds scroll/resize listeners to window; remove them with the component
122
+ $scope.$on('$destroy', function () {
123
+ $timeout.cancel(setupTimer);
124
+ if ($scope.popper) $scope.popper.destroy();
125
+ $scope.popper = null;
126
+ });
127
+
121
128
 
122
129
  // ------------------ Time changes ------------------
123
130
  $scope.timeChange = function () {
@@ -332,7 +339,10 @@ angular.module('niceElements')
332
339
 
333
340
 
334
341
  // ------------------ Watch for model change ------------------
335
- $scope.$watchGroup(["model", 'minDate', 'maxDate', 'nextDate'], function () {
342
+ // Watch timestamp so in-place moment mutations (e.g. model.add(1, "day")) are detected too
343
+ $scope.$watchGroup([function () {
344
+ return $scope.model ? moment($scope.model).valueOf() : $scope.model;
345
+ }, 'minDate', 'maxDate', 'nextDate'], function () {
336
346
  $scope.bootstrap();
337
347
  });
338
348
 
@@ -83,10 +83,17 @@ angular.module('niceElements')
83
83
  });
84
84
  };
85
85
 
86
- $timeout(function () {
86
+ const setupTimer = $timeout(function () {
87
87
  $scope.setupPopper();
88
88
  });
89
89
 
90
+ // Popper adds scroll/resize listeners to window; remove them with the component
91
+ $scope.$on('$destroy', function () {
92
+ $timeout.cancel(setupTimer);
93
+ if ($scope.popper) $scope.popper.destroy();
94
+ $scope.popper = null;
95
+ });
96
+
90
97
 
91
98
  $scope.format = function () {
92
99
  $scope.modelFormat = $scope.startDate.format($scope.formatString) + " - " + $scope.endDate.format($scope.formatString);
@@ -96,7 +103,7 @@ angular.module('niceElements')
96
103
  $scope.open = function () {
97
104
  if (!$scope.isDisabled) {
98
105
  $scope.isOpen = true;
99
- $scope.popper.update();
106
+ if ($scope.popper) $scope.popper.update();
100
107
  }
101
108
  };
102
109
 
@@ -91,8 +91,6 @@ angular.module('niceElements')
91
91
  $scope.popper = Popper.createPopper(button, tooltip, {
92
92
  strategy: 'fixed',
93
93
  placement: $scope.placement,
94
- scroll: true,
95
- resize: true,
96
94
  modifiers: [
97
95
  {
98
96
  name: 'offset',
@@ -122,10 +120,17 @@ angular.module('niceElements')
122
120
  });
123
121
  };
124
122
 
125
- $timeout(function () {
123
+ const setupTimer = $timeout(function () {
126
124
  $scope.setupPopper();
127
125
  });
128
126
 
127
+ // Popper adds scroll/resize listeners to window; remove them with the component
128
+ $scope.$on('$destroy', function () {
129
+ $timeout.cancel(setupTimer);
130
+ if ($scope.popper) $scope.popper.destroy();
131
+ $scope.popper = null;
132
+ });
133
+
129
134
 
130
135
  // ----------------------------------- Open -----------------------------------
131
136
  $scope.toggle = function () {
@@ -142,13 +147,13 @@ angular.module('niceElements')
142
147
  };
143
148
 
144
149
  $scope.open = function () {
145
- $scope.popper.update();
150
+ if ($scope.popper) $scope.popper.update();
146
151
  if ($scope.filterFunction) $scope.internalList = $scope.filterFunction($scope.originalList, $scope.model);
147
152
  $timeout(function () {
148
153
  $scope.isOpen = true;
149
154
  if ($scope.onOpen) $scope.onOpen();
150
155
  $timeout(function () {
151
- $scope.popper.update();
156
+ if ($scope.popper) $scope.popper.update();
152
157
  });
153
158
  });
154
159
  $timeout(function () {
@@ -504,16 +509,12 @@ angular.module('niceElements')
504
509
 
505
510
  // ----------------------------------- Handle add button function -----------------------------------
506
511
  $scope.handleAddButton = function ($event) {
507
- let element = $event.target;
508
- while (true) {
509
- if (element.nodeName == 'BUTTON') {
510
- element.blur();
511
- break;
512
- }
513
- element = element.parentElement;
514
- }
515
- $scope.addButtonFunction();
516
- }
512
+ // Blur the clicked button. closest() stops at the root instead of
513
+ // walking past it (the old loop crashed if no <button> was found).
514
+ const button = $event && $event.target && $event.target.closest ? $event.target.closest('button') : null;
515
+ if (button) button.blur();
516
+ if ($scope.addButtonFunction) $scope.addButtonFunction();
517
+ };
517
518
  }
518
519
  };
519
520
  });
@@ -1,7 +1,6 @@
1
- <div class="nice-help" ng-mouseover="onHover()">
1
+ <div class="nice-help" ng-class="'nice-help-' + placement" style="anchor-name: --nice-help-{{ id }}">
2
2
  <nice-icon icon="icon-help-circle" class="nice-help-button"></nice-icon>
3
- <div class="nice-help-popup">
3
+ <div class="nice-help-popup" role="tooltip" style="position-anchor: --nice-help-{{ id }}">
4
4
  <span ng-bind-html="text">{{ text }}</span>
5
- <div data-popper-arrow class="nice-help-arrow"></div>
6
5
  </div>
7
- </div>
6
+ </div>
@@ -5,6 +5,8 @@
5
5
  * @name niceElements.directive:niceHelp
6
6
  * @description
7
7
  * # niceHelp
8
+ * Help icon with a hover popup. Positioning is pure CSS (anchor positioning,
9
+ * with an absolute-position fallback), so there are no JS listeners to clean up.
8
10
  */
9
11
  angular.module('niceElements')
10
12
  .directive('niceHelp', function () {
@@ -14,45 +16,16 @@ angular.module('niceElements')
14
16
  replace: true,
15
17
  scope: {
16
18
  text: '@',
17
- placement: '@', // Describes the preferred placement of the popper
19
+ placement: '@', // top (default) | bottom | left | right
18
20
  },
19
- controller: function ($scope, $element, $timeout) {
20
- if (!$scope.placement) { $scope.placement = "top"; }
21
+ controller: function ($scope) {
22
+ const placements = ['top', 'bottom', 'left', 'right'];
23
+ // Popper-style values like "top-start" map to their base side
24
+ const side = ($scope.placement || 'top').split('-')[0];
25
+ $scope.placement = placements.indexOf(side) >= 0 ? side : 'top';
21
26
 
22
- // Setup popper
23
- // https://popper.js.org/docs/v2/constructors/
24
- $scope.setupPopper = function () {
25
- const button = $element[0].getElementsByClassName('nice-help-button')[0];
26
- const tooltip = $element[0].getElementsByClassName('nice-help-popup')[0];
27
- $scope.popper = Popper.createPopper(button, tooltip, {
28
- strategy: 'fixed',
29
- placement: $scope.placement,
30
- scroll: true,
31
- resize: true,
32
- modifiers: [
33
- {
34
- name: 'offset',
35
- options: {
36
- offset: [0, 5],
37
- },
38
- },
39
- {
40
- name: 'arrow',
41
- options: {
42
- padding: 2,
43
- },
44
- }
45
- ],
46
- });
47
- };
48
-
49
- // $timeout(function () {
50
- // $scope.setupPopper();
51
- // });
52
-
53
- $scope.onHover = function () {
54
- $scope.setupPopper();
55
- }
27
+ // Unique anchor name so each popup attaches to its own icon
28
+ $scope.id = Math.random().toString(36).substring(2, 9);
56
29
  }
57
30
  };
58
31
  });
@@ -1,5 +1,5 @@
1
1
  .nice-help {
2
- $nice-help-popup-color: #3e3e3e;
2
+ $nice-help-offset: 6px;
3
3
  position: relative;
4
4
  display: inline-block;
5
5
 
@@ -15,7 +15,8 @@
15
15
  display: block;
16
16
  }
17
17
 
18
- &:hover {
18
+ &:hover,
19
+ &:focus-within {
19
20
  .nice-help-popup {
20
21
  display: block;
21
22
  }
@@ -24,8 +25,8 @@
24
25
  .nice-help-popup {
25
26
  display: none;
26
27
  z-index: 9999;
27
- background: $nice-help-popup-color;
28
- color: white;
28
+ background: var(--nice-help-popup-bg);
29
+ color: var(--nice-help-popup-color);
29
30
  max-width: 200px;
30
31
  width: max-content;
31
32
  border-radius: $nice-border-radius;
@@ -34,46 +35,77 @@
34
35
  padding: 7px 10px;
35
36
  font-weight: normal;
36
37
  text-align: center;
38
+ white-space: normal;
37
39
 
38
40
  a {
39
41
  color: $nice-base-color;
40
42
  text-transform: none;
41
43
  }
44
+ }
42
45
 
43
- .nice-help-arrow,
44
- .nice-help-arrow::before {
45
- position: absolute;
46
- width: 8px;
47
- height: 8px;
48
- background: inherit;
46
+ // ---------- Native anchor positioning ----------
47
+ // Fixed + anchored: escapes overflow:hidden parents (tables, modals)
48
+ // and flips automatically when there is no room, like Popper did.
49
+ @supports (position-area: top) {
50
+ .nice-help-popup {
51
+ position: fixed;
52
+ margin: 0;
53
+ position-try-fallbacks: flip-block, flip-inline;
54
+ }
55
+
56
+ &.nice-help-top .nice-help-popup {
57
+ position-area: top;
58
+ margin-bottom: $nice-help-offset;
59
+ }
60
+
61
+ &.nice-help-bottom .nice-help-popup {
62
+ position-area: bottom;
63
+ margin-top: $nice-help-offset;
64
+ }
65
+
66
+ &.nice-help-left .nice-help-popup {
67
+ position-area: left;
68
+ margin-right: $nice-help-offset;
49
69
  }
50
70
 
51
- .nice-help-arrow {
52
- visibility: hidden;
71
+ &.nice-help-right .nice-help-popup {
72
+ position-area: right;
73
+ margin-left: $nice-help-offset;
53
74
  }
75
+ }
54
76
 
55
- .nice-help-arrow::before {
56
- visibility: visible;
57
- content: "";
58
- transform: rotate(45deg);
77
+ // ---------- Fallback for browsers without anchor positioning ----------
78
+ @supports not (position-area: top) {
79
+ .nice-help-popup {
80
+ position: absolute;
59
81
  }
60
82
 
61
- &[data-popper-placement^="top"]>.nice-help-arrow {
62
- bottom: -2px;
63
- margin-left: -4px;
83
+ &.nice-help-top .nice-help-popup {
84
+ bottom: 100%;
85
+ left: 50%;
86
+ transform: translateX(-50%);
87
+ margin-bottom: $nice-help-offset;
64
88
  }
65
89
 
66
- &[data-popper-placement^="bottom"]>.nice-help-arrow {
67
- top: -2px;
68
- margin-left: -4px;
90
+ &.nice-help-bottom .nice-help-popup {
91
+ top: 100%;
92
+ left: 50%;
93
+ transform: translateX(-50%);
94
+ margin-top: $nice-help-offset;
69
95
  }
70
96
 
71
- &[data-popper-placement^="left"]>.nice-help-arrow {
72
- right: 1px;
97
+ &.nice-help-left .nice-help-popup {
98
+ right: 100%;
99
+ top: 50%;
100
+ transform: translateY(-50%);
101
+ margin-right: $nice-help-offset;
73
102
  }
74
103
 
75
- &[data-popper-placement^="right"]>.nice-help-arrow {
76
- left: -6px;
104
+ &.nice-help-right .nice-help-popup {
105
+ left: 100%;
106
+ top: 50%;
107
+ transform: translateY(-50%);
108
+ margin-left: $nice-help-offset;
77
109
  }
78
110
  }
79
- }
111
+ }
@@ -1,4 +1,11 @@
1
- <ng-form class="nice-component nice-input" ng-class="{ 'margin-bottom-0' : noMargin, 'nice-component-inline': isInline }" name="forma">
1
+ <ng-form
2
+ class="nice-component nice-input"
3
+ ng-class="[
4
+ 'nice-input-type-' + type,
5
+ { 'margin-bottom-0' : noMargin, 'nice-component-inline': isInline }
6
+ ]"
7
+ name="forma"
8
+ >
2
9
  <div class="row">
3
10
  <!------------------------- Title ------------------------->
4
11
  <nice-title text="title || niceTitle" help="help" required="required" description="description" label-width="labelWidth"></nice-title>
@@ -56,6 +63,9 @@
56
63
  />
57
64
 
58
65
  <div class="input-group-addon" ng-if="symbol">{{ symbol }}</div>
66
+ <button type="button" class="input-group-btn" ng-if="type=='password'" ng-click="togglePasswordType()">
67
+ <nice-icon icon="icon-eye"></nice-icon>
68
+ </button>
59
69
  <button type="button" class="input-group-btn" ng-if="!multilanguageDisabled && multilanguageField" ng-click="openMultilanguage()">
60
70
  <nice-icon icon="icon-translate"></nice-icon>
61
71
  <div class="nice-input-addon-bubble" ng-if="numberOfLanguages > 0">{{ numberOfLanguages }}</div>
@@ -45,7 +45,7 @@ angular.module('niceElements')
45
45
  autocomplete: "@?",
46
46
  disableTrim: "@?"
47
47
  },
48
- controller: function ($scope, $attrs, $rootScope, $element, ngDialog) {
48
+ controller: function ($scope, $attrs, $rootScope, $element, ngDialog, NiceService) {
49
49
  if (!$attrs.type) { $attrs.type = 'text'; }
50
50
  if (!$attrs.title) { $attrs.title = ''; }
51
51
  if (!$attrs.regex) { $attrs.regex = null; }
@@ -83,6 +83,9 @@ angular.module('niceElements')
83
83
  $scope.inputMode = "numeric";
84
84
  }
85
85
 
86
+ // Decimal.js model is kept as Decimal (same constructor), input works with string
87
+ $scope.decimalConstructor = NiceService.isDecimal($scope.model) ? $scope.model.constructor : null;
88
+
86
89
  // Set internal type
87
90
  $scope.internalType = $scope.type;
88
91
  if ($scope.type == "percent") {
@@ -92,7 +95,9 @@ angular.module('niceElements')
92
95
  } else if ($scope.type == "number") {
93
96
  $scope.internalType = "text";
94
97
  $scope.inputMode = "decimal";
95
- if ($scope.model != null) {
98
+ if ($scope.decimalConstructor) {
99
+ // Keep Decimal
100
+ } else if ($scope.model != null) {
96
101
  $scope.model = Number($scope.model);
97
102
  } else {
98
103
  $scope.model = null;
@@ -104,15 +109,13 @@ angular.module('niceElements')
104
109
  } else if ($scope.type == "email") {
105
110
  $scope.inputMode = "email";
106
111
  $scope.regexexp = new RegExp("^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$");
107
- } else {
108
- $scope.internalType = "text";
109
112
  }
110
113
 
111
114
  if (angular.isDefined($scope.valid)) {
112
115
  $scope.valid = $scope.forma;
113
116
  }
114
117
 
115
- if ($scope.model && angular.isDefined($scope.minDecimalsCutZeros) && $scope.type == 'number') {
118
+ if ($scope.model && !$scope.decimalConstructor && angular.isDefined($scope.minDecimalsCutZeros) && $scope.type == 'number') {
116
119
  $scope.model = Number($scope.model);
117
120
  if ($scope.model.toString().split('.').length < 2 || $scope.model.toString().split('.')[1].length < parseInt($scope.minDecimalsCutZeros)) {
118
121
  $scope.model = Number((Number($scope.model)).toFixed(parseInt($scope.minDecimalsCutZeros)));
@@ -128,7 +131,14 @@ angular.module('niceElements')
128
131
  }
129
132
 
130
133
  $scope.$watch('model', function (value_new, value_old) {
131
- if ($scope.type == "number" && value_old && value_old[value_old.length - 1] == ".") {
134
+ if ($scope.type == "number" && NiceService.isDecimal($scope.model)) {
135
+ $scope.decimalConstructor = $scope.model.constructor;
136
+ // Don't overwrite what user is typing (e.g. "1." or "1.50") if it has the same value
137
+ const internal = NiceService.parseDecimal($scope.internalModel, $scope.decimalConstructor);
138
+ if (!internal || !internal.equals($scope.model)) {
139
+ $scope.internalModel = $scope.model.toFixed();
140
+ }
141
+ } else if ($scope.type == "number" && value_old && value_old[value_old.length - 1] == ".") {
132
142
  // IGNORE
133
143
  } else {
134
144
  $scope.internalModel = angular.copy($scope.model);
@@ -141,7 +151,19 @@ angular.module('niceElements')
141
151
  });
142
152
 
143
153
  $scope.$watch('internalModel', function (value_new, value_old) {
144
- if ($scope.type == "number" && value_new) {
154
+ if ($scope.type == "number" && $scope.decimalConstructor) {
155
+ if (angular.isString(value_new) && value_new.indexOf(',') >= 0) {
156
+ $scope.internalModel = value_new.replace(',', '.');
157
+ return;
158
+ }
159
+ const value = NiceService.parseDecimal(value_new, $scope.decimalConstructor);
160
+ if (value === undefined) return; // Incomplete number, e.g. "-"
161
+ const isSame = value === null ? $scope.model == null : NiceService.isDecimal($scope.model) && value.equals($scope.model);
162
+ if (!isSame) {
163
+ $scope.model = value;
164
+ $scope.handleChange();
165
+ }
166
+ } else if ($scope.type == "number" && value_new) {
145
167
  if (typeof value_new != "number") {
146
168
  $scope.internalModel = value_new.replace(',', '.');
147
169
  $scope.model = angular.copy($scope.internalModel);
@@ -207,6 +229,10 @@ angular.module('niceElements')
207
229
  };
208
230
  };
209
231
 
232
+ $scope.togglePasswordType = function () {
233
+ $scope.internalType = $scope.internalType == 'password' ? 'text' : 'password';
234
+ };
235
+
210
236
  $scope.keypress = function (event) {
211
237
  if ($scope.numbersOnly) {
212
238
  if ((event.charCode >= 48 && event.charCode <= 58) || event.charCode == 0) { // Allow only numbers
@@ -219,16 +245,18 @@ angular.module('niceElements')
219
245
 
220
246
  if ($scope.type == "decimal" || $scope.type == "number" || $scope.type == "integer") {
221
247
  // Handle decimal numbers
222
- if ($scope.type == "number" || $scope.type == "decimal") {
248
+ if (($scope.type == "number" || $scope.type == "decimal") && !$scope.decimalConstructor) {
223
249
  $scope.model = String($scope.model).replace(",", "."); // Replace , with .
224
250
  if (isNaN($scope.model)) { // If parsed float is NaN
225
251
  $scope.model = String(parseFloat($scope.model) || "");
226
252
  }
227
253
  }
254
+ // Decimal model isn't a string, check the typed value instead
255
+ const current = $scope.decimalConstructor ? String($scope.internalModel != null ? $scope.internalModel : "") : String($scope.model);
228
256
 
229
257
  if (event.charCode == 46 || event.charCode == 44) { // Handle "." and "," key (only one allowed)
230
258
  if ($scope.type == "number" || $scope.type == "decimal") {
231
- if (String($scope.model).indexOf(".") >= 0) {
259
+ if (current.indexOf(".") >= 0) {
232
260
  event.preventDefault();
233
261
  return false;
234
262
  }
@@ -237,7 +265,7 @@ angular.module('niceElements')
237
265
  return false;
238
266
  }
239
267
  } else if (event.charCode == 45) {
240
- if (String($scope.model).indexOf("-") >= 0) {
268
+ if (current.indexOf("-") >= 0) {
241
269
  event.preventDefault();
242
270
  return false;
243
271
  }
@@ -46,6 +46,17 @@
46
46
  border-right: 1px solid var(--nice-border-color) !important;
47
47
  }
48
48
 
49
+ &.nice-input-type-number {
50
+ input {
51
+ padding-right: 0;
52
+ }
53
+
54
+ .input-group-addon {
55
+ line-height: 31px;
56
+ padding-left: 4px;
57
+ }
58
+ }
59
+
49
60
 
50
61
  .input-group {
51
62
  margin-bottom: 0px;
@@ -1,4 +1,9 @@
1
- <div class="notification">
2
- <h3 ng-show="title" ng-bind-html="title"></h3>
3
- <div class="message" ng-bind-html="message"></div>
4
- </div>
1
+ <div class="notification" ng-class="{ 'has-icon': icon }">
2
+ <div class="notification-inner">
3
+ <nice-icon ng-if="icon" class="notification-icon" icon="{{ icon }}"></nice-icon>
4
+ <div class="notification-content">
5
+ <div class="notification-title" ng-show="title" ng-bind-html="title"></div>
6
+ <div class="notification-message" ng-bind-html="message"></div>
7
+ </div>
8
+ </div>
9
+ </div>