@kigi/components 1.60.0 → 1.61.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kigi/components",
3
- "version": "1.60.0",
3
+ "version": "1.61.0",
4
4
  "description": "@kigi/components",
5
5
  "main": "src/components/index.ts",
6
6
  "scripts": {
@@ -6,6 +6,7 @@ class MbgInputNumberController {
6
6
  private ngModel
7
7
  private ngRequired
8
8
  private ngDisabled
9
+ private maxLength
9
10
  private props
10
11
 
11
12
  constructor(public $scope, public $element, public $attrs, public $compile, public $timeout) {}
@@ -33,6 +34,9 @@ class MbgInputNumberController {
33
34
  if (this.props.allowNegative) {
34
35
  this.enableNegative()
35
36
  }
37
+ if (this.$attrs && this.$attrs.maxlength) {
38
+ this.maxLength = this.$attrs.maxlength
39
+ }
36
40
  })
37
41
  }
38
42
 
@@ -14,6 +14,8 @@ class MbgInputTextController {
14
14
  private capitalize
15
15
  private focusableElements
16
16
  private nextIndex
17
+ private onlyNumbers = false
18
+
17
19
 
18
20
  constructor(public $scope, public $element, public $attrs) {
19
21
  if ($attrs.ngRequired === '') {
@@ -43,6 +45,9 @@ class MbgInputTextController {
43
45
  }
44
46
 
45
47
  onChange($event) {
48
+ if (this.onlyNumbers && this.ngModel) {
49
+ this.ngModel = String(this.ngModel).replace(/[^0-9]/g, '').replace(/^0+(\d)/, '$1');
50
+ }
46
51
  if (this.capitalize) {
47
52
  this.ngModel = this.capitalizeBool(this.ngModel)
48
53
  }
@@ -88,6 +93,7 @@ const mbgInputText = {
88
93
  ngKeydown: '&?',
89
94
  capitalize: '=?',
90
95
  maxLength: '@?',
96
+ onlyNumbers: '<?'
91
97
  },
92
98
  template,
93
99
  controller: MbgInputTextController,