@kigi/components 1.7.1 → 1.8.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,34 +1,34 @@
|
|
|
1
1
|
<div class="mbg-input-wrapper mbg-input-name-wrapper"
|
|
2
2
|
ng-if="$ctrl.props">
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
3
|
+
<input type="text"
|
|
4
|
+
ng-if="$ctrl.state == 'TO' || $ctrl.state == 'MT'"
|
|
5
|
+
mbg-mask-ie
|
|
6
|
+
ng-model="$ctrl.ngModel"
|
|
7
|
+
name="{{$ctrl.name}}"
|
|
8
|
+
ng-init="$ctrl.onInit()"
|
|
9
|
+
ng-change="$ctrl.onChangeTO()"
|
|
10
|
+
ng-required="$ctrl.ngRequired"
|
|
11
|
+
ng-disabled="$ctrl.ngDisabled"
|
|
12
|
+
ng-blur="$ctrl.ngBlur({ $event })"
|
|
13
|
+
ng-focus="$ctrl.ngFocus({ $event })"
|
|
14
|
+
ng-keyup="$ctrl.ngKeyup({ $event })"
|
|
15
|
+
ng-keypress="$ctrl.ngKeypress({ $event })"
|
|
16
|
+
ng-keydown="$ctrl.ngKeydown({ $event })"
|
|
17
|
+
placeholder="{{ $ctrl.props.placeholder }}" />
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
</div>
|
|
19
|
+
<input type="text"
|
|
20
|
+
ng-if="!$ctrl.state || ($ctrl.state != 'TO' && $ctrl.state != 'MT')"
|
|
21
|
+
ng-model="$ctrl.ngModel"
|
|
22
|
+
name="{{$ctrl.name}}"
|
|
23
|
+
ng-init="$ctrl.onInit()"
|
|
24
|
+
ng-change="$ctrl.onChange()"
|
|
25
|
+
ng-required="$ctrl.ngRequired"
|
|
26
|
+
ng-disabled="$ctrl.ngDisabled"
|
|
27
|
+
ng-blur="$ctrl.ngBlur({ $event })"
|
|
28
|
+
ng-focus="$ctrl.ngFocus({ $event })"
|
|
29
|
+
ng-keyup="$ctrl.ngKeyup({ $event })"
|
|
30
|
+
ng-keypress="$ctrl.ngKeypress({ $event })"
|
|
31
|
+
ng-keydown="$ctrl.ngKeydown({ $event })"
|
|
32
|
+
placeholder="{{ $ctrl.props.placeholder }}"
|
|
33
|
+
ui-br-ie-mask="$ctrl.state" />
|
|
34
|
+
</div>
|
|
@@ -32,6 +32,13 @@
|
|
|
32
32
|
ng-show="$ctrl.count">
|
|
33
33
|
<span>{{$ctrl.data.length}} / {{$ctrl.count}}</span>
|
|
34
34
|
</div>
|
|
35
|
+
<div class="row m-b-24 m-t-14" ng-show="$ctrl.pagination.data.length > 0">
|
|
36
|
+
<div class="col-md-12">
|
|
37
|
+
<mbg-pagination active-page="$ctrl.pagination.page" page-size="$ctrl.pagination.pageSize"
|
|
38
|
+
on-change="$ctrl.fetch()" count="$ctrl.pagination.count" page-range-displayed="10">
|
|
39
|
+
</mbg-pagination>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
35
42
|
</div>
|
|
36
43
|
<div class="col-md-6 full-height">
|
|
37
44
|
<mbg-input-search ng-model="$ctrl.inputValueResult"
|
|
@@ -17,6 +17,7 @@ export class MbgSelectMultiListController {
|
|
|
17
17
|
private placeholderLeft: string
|
|
18
18
|
private placeholderRight: string
|
|
19
19
|
private inputValueResult: string
|
|
20
|
+
private pagination
|
|
20
21
|
|
|
21
22
|
constructor(
|
|
22
23
|
public $scope,
|
|
@@ -167,6 +168,7 @@ const mbgSelectMultiList = {
|
|
|
167
168
|
titleRight: '@?',
|
|
168
169
|
data: '=?',
|
|
169
170
|
isLoading: '=?',
|
|
171
|
+
pagination: '=?',
|
|
170
172
|
},
|
|
171
173
|
template,
|
|
172
174
|
controller: MbgSelectMultiListController,
|
|
@@ -21,7 +21,11 @@ export class NgMaskIe {
|
|
|
21
21
|
|
|
22
22
|
link(scope, elm, attrs, ngModelController) {
|
|
23
23
|
scope.$watch(attrs.ngModel, (data) => {
|
|
24
|
-
const
|
|
24
|
+
const state =
|
|
25
|
+
scope.$parent && scope.$parent.$parent && scope.$parent.$parent.$ctrl
|
|
26
|
+
? scope.$parent.$parent.$ctrl.state
|
|
27
|
+
: null
|
|
28
|
+
const valid = this.validade(data, state)
|
|
25
29
|
const form = elm.closest('form')
|
|
26
30
|
const formName = form.attr('name')
|
|
27
31
|
const formScope = form.scope()
|
|
@@ -65,28 +69,56 @@ export class NgMaskIe {
|
|
|
65
69
|
})
|
|
66
70
|
}
|
|
67
71
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
72
|
+
validade(ngModel, state) {
|
|
73
|
+
switch (state) {
|
|
74
|
+
case 'TO':
|
|
75
|
+
if (ngModel && (ngModel.length === 11 || ngModel.length === 9)) {
|
|
76
|
+
const digit = ngModel[ngModel.length - 1]
|
|
77
|
+
let total = 0
|
|
78
|
+
let indexCalc = 0
|
|
79
|
+
for (let index = 9; index >= 2; index--) {
|
|
80
|
+
total += ngModel[indexCalc] * index
|
|
81
|
+
if (ngModel.length === 11 && indexCalc === 1) {
|
|
82
|
+
indexCalc = indexCalc + 3
|
|
83
|
+
} else {
|
|
84
|
+
indexCalc++
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
const result = total - Math.floor(total / 11) * 11
|
|
88
|
+
if (result < 2) {
|
|
89
|
+
return Number(digit) === 0
|
|
90
|
+
} else {
|
|
91
|
+
return Number(digit) === 11 - result
|
|
92
|
+
}
|
|
77
93
|
} else {
|
|
78
|
-
|
|
94
|
+
return false
|
|
79
95
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
96
|
+
case 'MT':
|
|
97
|
+
return this.validadeMT(ngModel)
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
validadeMT(model, plusZero = '') {
|
|
102
|
+
const lengthZero = plusZero.length
|
|
103
|
+
model = `${plusZero}${model}`
|
|
104
|
+
if (model.length != 11 && lengthZero < 2) return this.validadeMT(model, `0`)
|
|
105
|
+
var nro = new Array(11)
|
|
106
|
+
for (var i = 0; i <= 10; i++) nro[i] = parseInt(model[i])
|
|
107
|
+
let b = 3
|
|
108
|
+
let soma = 0,
|
|
109
|
+
dig = 0
|
|
110
|
+
for (i = 0; i <= 9; i++) {
|
|
111
|
+
soma += nro[i] * b
|
|
112
|
+
b--
|
|
113
|
+
if (b == 1) b = 9
|
|
114
|
+
}
|
|
115
|
+
i = soma % 11
|
|
116
|
+
if (i <= 1) {
|
|
117
|
+
dig = 0
|
|
87
118
|
} else {
|
|
88
|
-
|
|
119
|
+
dig = 11 - i
|
|
89
120
|
}
|
|
121
|
+
return dig == nro[10]
|
|
90
122
|
}
|
|
91
123
|
|
|
92
124
|
setIeValidade(elm, valid) {
|