@kigi/components 1.60.0 → 1.61.0-beta.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kigi/components",
3
- "version": "1.60.0",
3
+ "version": "1.61.0-beta.1",
4
4
  "description": "@kigi/components",
5
5
  "main": "src/components/index.ts",
6
6
  "scripts": {
@@ -100,4 +100,4 @@
100
100
  "webpack": "^2.5.1",
101
101
  "webpack-dev-server": "^2.6.1"
102
102
  }
103
- }
103
+ }
@@ -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
 
@@ -1,18 +1,18 @@
1
1
  <div class="mbg-input-wrapper mb-input-phone-wrapper"
2
2
  ng-if="$ctrl.props"
3
3
  mbg-autocomplete-off>
4
- <input type="text"
5
- ng-class="{'input-phone': $ctrl.inputPhone}"
6
- ng-model="$ctrl.ngModel"
7
- ng-change="$ctrl.onChange()"
8
- placeholder="{{ $ctrl.props.placeholder }}"
9
- ng-required="$ctrl.ngRequired"
10
- ng-disabled="$ctrl.ngDisabled"
11
- ng-blur="$ctrl.ngBlur({ $event })"
12
- ng-focus="$ctrl.ngFocus({ $event })"
13
- ng-keyup="$ctrl.ngKeyup({ $event })"
14
- ng-keypress="$ctrl.ngKeypress({ $event })"
15
- ng-keydown="$ctrl.ngKeydown({ $event })"
16
- ui-br-phone-number-mask="'{{$ctrl.phoneNumberMask}}'"
17
- maxlength="{{$ctrl.enableCountryCode ? 19 : 15}}" />
4
+ <input type="text"
5
+ ng-class="{'input-phone': $ctrl.inputPhone}"
6
+ ng-model="$ctrl.ngModel"
7
+ ng-change="$ctrl.onChange()"
8
+ placeholder="{{ $ctrl.props.placeholder }}"
9
+ ng-required="$ctrl.ngRequired"
10
+ ng-disabled="$ctrl.ngDisabled"
11
+ ng-blur="$ctrl.ngBlur({ $event })"
12
+ ng-focus="$ctrl.ngFocus({ $event })"
13
+ ng-keyup="$ctrl.ngKeyup({ $event })"
14
+ ng-keypress="$ctrl.ngKeypress({ $event })"
15
+ ng-keydown="$ctrl.ngKeydown({ $event })"
16
+ ui-br-phone-number-mask="'{{$ctrl.phoneNumberMask}}'"
17
+ maxlength="{{$ctrl.maxLength}}" />
18
18
  </div>
@@ -9,9 +9,11 @@ class MbgInputPhoneController {
9
9
  private props
10
10
  private enableCountryCode: string
11
11
  private phoneNumberMask: string
12
+ private maxLength: number
12
13
 
13
14
  constructor(public $scope, public $element, public $attrs) {
14
15
  this.phoneNumberMask = this.enableCountryCode ? 'countryCode' : 'areaCode'
16
+ this.maxLength = this.maxLength ? this.maxLength : this.enableCountryCode ? 19 : 15
15
17
  if ($attrs.ngRequired === '') {
16
18
  this.ngRequired = true
17
19
  }
@@ -45,6 +47,7 @@ const mbgInputPhone = {
45
47
  ngKeydown: '&?',
46
48
  enableCountryCode: '=?',
47
49
  inputPhone: '=?',
50
+ maxLength: '=?',
48
51
  },
49
52
  template,
50
53
  controller: MbgInputPhoneController,
@@ -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,