@kigi/components 1.11.3-beta.2 → 1.11.3-beta.3

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-beta.2",
3
+ "version": "1.11.3-beta.3",
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()"
@@ -6,8 +6,7 @@
6
6
  <span ng-show="$ctrl.placeholder && !$ctrl.ngModel"
7
7
  class="place">{{ $ctrl.placeholder }}</span>
8
8
  <span ng-show="$ctrl.ngModel"
9
- class="mbg-select-value">{{ $ctrl.strMountValue ? $ctrl.strMountValue : $ctrl.labelValue ? $ctrl.ngValue ?
10
- $ctrl.inputNgValue :
9
+ class="mbg-select-value">{{ $ctrl.labelValue ? $ctrl.ngValue ? $ctrl.inputNgValue :
11
10
  $ctrl.ngModel[$ctrl.labelValue] : $ctrl.ngModel }}</span>
12
11
  </div>
13
12
  <!-- <mbg-input-text ng-model="$ctrl.inputValue"
@@ -46,8 +46,6 @@ class MbgSelectController {
46
46
  private capitalize
47
47
  private manyFavorite: boolean
48
48
  private executeAfterOnInit: Function
49
- private mountValue
50
- private strMountValue
51
49
 
52
50
  constructor(
53
51
  public $scope,
@@ -571,30 +569,26 @@ class MbgSelectController {
571
569
 
572
570
  updateInputValue() {
573
571
  this.$timeout(() => {
574
- if (this.mountValue) {
575
- this.strMountValue = this.mountValue({ value: this.ngModel })
572
+ if (this.ngValue && this.ngModel) {
573
+ this.executeFetch((data) => {
574
+ const item = (data || []).find((i) => i[this.ngValue] === this.ngModel)
575
+ if (item) {
576
+ this.inputValue = item[this.labelValue]
577
+ this.inputNgValue = item[this.labelValue]
578
+ }
579
+ })
576
580
  } else {
577
- if (this.ngValue && this.ngModel) {
578
- this.executeFetch((data) => {
579
- const item = (data || []).find((i) => i[this.ngValue] === this.ngModel)
580
- if (item) {
581
- this.inputValue = item[this.labelValue]
582
- this.inputNgValue = item[this.labelValue]
583
- }
584
- })
581
+ if (this.labelValue && this.ngModel) {
582
+ this.inputValue = this.ngModel[this.labelValue]
585
583
  } else {
586
- if (this.labelValue && this.ngModel) {
587
- this.inputValue = this.ngModel[this.labelValue]
588
- } else {
589
- if (this.ngModel) {
590
- this.inputValue = this.ngModel
591
- }
592
- }
593
- if (!this.ngModel) {
594
- delete this.inputValue
595
- delete this.inputNgValue
584
+ if (this.ngModel) {
585
+ this.inputValue = this.ngModel
596
586
  }
597
587
  }
588
+ if (!this.ngModel) {
589
+ delete this.inputValue
590
+ delete this.inputNgValue
591
+ }
598
592
  }
599
593
  })
600
594
  }
@@ -710,7 +704,6 @@ const mbgSelect = {
710
704
  capitalize: '=?',
711
705
  manyFavorite: '=?',
712
706
  executeAfterOnInit: '&?',
713
- mountValue: '&?',
714
707
  },
715
708
  controller: MbgSelectController,
716
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')