@kigi/components 1.11.3 → 1.11.5

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.11.3",
3
+ "version": "1.11.5",
4
4
  "description": "@kigi/components",
5
5
  "main": "src/components/index.ts",
6
6
  "scripts": {
@@ -1,7 +1,7 @@
1
1
  <div class="mbg-input-wrapper mbg-input-name-wrapper"
2
2
  ng-if="$ctrl.props">
3
3
  <input type="text"
4
- ng-if="$ctrl.state == 'TO' || $ctrl.state == 'MT' || $ctrl.state == 'AL'"
4
+ ng-if="$ctrl.state == 'TO' || $ctrl.state == 'MT' || $ctrl.state == 'AL' || $ctrl.state == 'GO'"
5
5
  mbg-mask-ie
6
6
  ng-model="$ctrl.ngModel"
7
7
  name="{{$ctrl.name}}"
@@ -17,7 +17,7 @@
17
17
  placeholder="{{ $ctrl.props.placeholder }}" />
18
18
 
19
19
  <input type="text"
20
- ng-if="!$ctrl.state || ($ctrl.state != 'TO' && $ctrl.state != 'MT' && $ctrl.state != 'AL')"
20
+ ng-if="!$ctrl.state || ($ctrl.state != 'TO' && $ctrl.state != 'MT' && $ctrl.state != 'AL' && $ctrl.state != 'GO')"
21
21
  ng-model="$ctrl.ngModel"
22
22
  name="{{$ctrl.name}}"
23
23
  ng-init="$ctrl.onInit()"
@@ -45,6 +45,7 @@ class MbgSelectController {
45
45
  private getCustomModel: Function
46
46
  private capitalize
47
47
  private manyFavorite: boolean
48
+ private executeAfterOnInit: Function
48
49
 
49
50
  constructor(
50
51
  public $scope,
@@ -602,6 +603,9 @@ class MbgSelectController {
602
603
  favorite = MbgCookie.get(this.getFavoriteKey())
603
604
  if (favorite && this.enableFavorite && !this.ngModel) {
604
605
  this.selectOption(favorite)
606
+ if (this.executeAfterOnInit) {
607
+ this.executeAfterOnInit()
608
+ }
605
609
  }
606
610
  }, 300)
607
611
  }
@@ -699,6 +703,7 @@ const mbgSelect = {
699
703
  getCustomModel: '&?',
700
704
  capitalize: '=?',
701
705
  manyFavorite: '=?',
706
+ executeAfterOnInit: '&?',
702
707
  },
703
708
  controller: MbgSelectController,
704
709
  template,
@@ -78,6 +78,8 @@ export class NgMaskIe {
78
78
  return this.validateMT(ngModel)
79
79
  case 'AL':
80
80
  return this.validateAL(ngModel)
81
+ case 'GO':
82
+ return this.validateGO(ngModel)
81
83
  }
82
84
  }
83
85
 
@@ -153,6 +155,32 @@ export class NgMaskIe {
153
155
  return dig == nro[10]
154
156
  }
155
157
 
158
+ validateGO(ie) {
159
+ if (ie.length == 9) {
160
+ let initialValid = ['10', '11', '20', '29']
161
+ let ieArr = [...ie]
162
+ let weights = [9, 8, 7, 6, 5, 4, 3, 2]
163
+ let results = []
164
+ let dig = Number(ieArr[8])
165
+ if (!initialValid.includes(ie.slice(0, 2))) {
166
+ return false
167
+ }
168
+ for (let i = 0; i < weights.length; i++) {
169
+ results.push(weights[i] * Number(ieArr[i]))
170
+ }
171
+
172
+ let sum = results.reduce((acc, value) => acc + value, 0)
173
+ let mod = sum % 11
174
+
175
+ if ((mod == 0 || mod == 1) && dig !== 0) {
176
+ return false
177
+ } else if (dig !== 11 - mod) {
178
+ return false
179
+ }
180
+ return true
181
+ }
182
+ }
183
+
156
184
  setIeValidate(elm, valid) {
157
185
  const form = elm.closest('form')
158
186
  const formName = form.attr('name')