nice-elements 1.9.8 → 1.9.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nice-elements",
3
- "version": "1.9.8",
3
+ "version": "1.9.10",
4
4
  "description": "Nice elements used in olaii angular 1.x webapps.",
5
5
  "main": "dist/nice.js",
6
6
  "license": "MIT",
@@ -14,7 +14,7 @@
14
14
  }">
15
15
 
16
16
  <textarea ng-if="textArea" class="form-control" ng-model="$parent.model" id="{{ id }}" tabindex="{{ tabIndex }}" placeholder="{{ placeholder }}" rows="{{textAreaLines}}" max="{{ max }}" min="{{ min }}" ng-minlength="minlength" ng-maxlength="maxlength" ng-required="required" ng-pattern="regexexp" ng-disabled="isDisabled"></textarea>
17
- <input ng-if="!textArea" class="form-control" type="{{ internalType }}" ng-model="$parent.model" name="{{ name }}" id="{{ id }}" tabindex="{{ tabIndex }}" placeholder="{{ placeholder }}" max="{{ max }}" min="{{ min }}" ng-minlength="minlength" ng-maxlength="maxlength" ng-required="required" ng-keypress="keypress($event)" ng-pattern="regexexp" ng-disabled="isDisabled" />
17
+ <input ng-if="!textArea" class="form-control" type="{{ internalType }}" inputmode="{{ inputMode }}" ng-model="$parent.model" name="{{ name }}" id="{{ id }}" tabindex="{{ tabIndex }}" placeholder="{{ placeholder }}" max="{{ max }}" min="{{ min }}" ng-minlength="minlength" ng-maxlength="maxlength" ng-required="required" ng-keypress="keypress($event)" ng-pattern="regexexp" ng-disabled="isDisabled" />
18
18
 
19
19
  <div class="input-group-addon" ng-if="symbol">{{ symbol }}</div>
20
20
  <button class="input-group-btn" ng-if="multilanguageField" ng-click="openMultilanguage()">
@@ -59,6 +59,7 @@ angular.module('niceElements')
59
59
  attrs.textArea = angular.isDefined(attrs.textArea);
60
60
  attrs.noMargin = angular.isDefined(attrs.noMargin);
61
61
  attrs.required = attrs.required === 'true';
62
+ scope.inputMode = null;
62
63
  //attrs.required = angular.isDefined(attrs.required);
63
64
 
64
65
  if (!scope.textArea) {
@@ -72,13 +73,19 @@ angular.module('niceElements')
72
73
  if (input) input.focus();
73
74
  }
74
75
 
76
+ if (scope.numbersOnly) {
77
+ scope.inputMode = "numeric";
78
+ }
79
+
75
80
  // Set internal type
76
81
  scope.internalType = attrs.type;
77
82
  if (attrs.type == "percent") {
78
83
  scope.internalType = "percent";
84
+ scope.inputMode = "decimal";
79
85
  attrs.symbol = '%';
80
86
  } else if (attrs.type == "number") {
81
- scope.internalType = "number";
87
+ scope.internalType = "text";
88
+ scope.inputMode = "decimal";
82
89
  if (scope.model) {
83
90
  scope.model = Number(scope.model);
84
91
  } else {
@@ -86,8 +93,10 @@ angular.module('niceElements')
86
93
  }
87
94
  } else if (attrs.type == "integer") {
88
95
  scope.internalType = "text";
96
+ scope.inputMode = "numeric";
89
97
  scope.model = Number(scope.model);
90
98
  } else if (attrs.type == "email") {
99
+ scope.inputMode = "email";
91
100
  // TODO: get rid of the errors
92
101
  scope.regexexp = new RegExp('^[_a-zA-Z0-9]+(.[_a-zA-Z0-9]+)*@[a-zA-Z0-9]+(.[a-zA-Z0-9]+)+(.[a-zA-Z]{2,4})');
93
102
  }
@@ -96,7 +105,7 @@ angular.module('niceElements')
96
105
  scope.valid = scope.form;
97
106
  }
98
107
 
99
- if (angular.isDefined(attrs.minDecimalsCutZeros) && attrs.type == 'number') {
108
+ if (scope.model && angular.isDefined(attrs.minDecimalsCutZeros) && attrs.type == 'number') {
100
109
  scope.model = Number(scope.model);
101
110
  if (scope.model.toString().split('.').length < 2 || scope.model.toString().split('.')[1].length < parseInt(attrs.minDecimalsCutZeros)) {
102
111
  scope.model = Number((Number(scope.model)).toFixed(parseInt(attrs.minDecimalsCutZeros)));
@@ -10,7 +10,7 @@ angular.module('niceElements')
10
10
  .service('NiceService', function () {
11
11
  var service = {
12
12
  name: "Nice elements",
13
- version: "1.9.8",
13
+ version: "1.9.10",
14
14
  getHeader: function () {
15
15
  return {};
16
16
  }