@kigi/components 1.63.4-beta.1 → 1.63.5-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
|
@@ -26,7 +26,6 @@ export class NgMaskIe {
|
|
|
26
26
|
scope.$watch(attrs.ngModel, (data) => {
|
|
27
27
|
const state = getState()
|
|
28
28
|
const valid = this.validate(data, state)
|
|
29
|
-
console.log('[mbg-mask-ie] watch — data:', data, '| state:', state, '| valid:', valid)
|
|
30
29
|
|
|
31
30
|
ngModelController.$setValidity('ie', !!valid)
|
|
32
31
|
|
|
@@ -82,7 +81,6 @@ export class NgMaskIe {
|
|
|
82
81
|
}
|
|
83
82
|
|
|
84
83
|
validate(ngModel, state) {
|
|
85
|
-
console.log('[mbg-mask-ie] validate — ngModel:', ngModel, '| state:', state)
|
|
86
84
|
switch (state) {
|
|
87
85
|
case 'TO':
|
|
88
86
|
return this.validateTO(ngModel)
|
|
@@ -214,26 +212,20 @@ export class NgMaskIe {
|
|
|
214
212
|
}
|
|
215
213
|
|
|
216
214
|
validateRS(ie) {
|
|
217
|
-
console.log('[validateRS] ie recebido:', ie)
|
|
218
215
|
const digits = (ie || '').replace(/\D/g, '')
|
|
219
|
-
console.log('[validateRS] digits (só números):', digits, '| length:', digits.length)
|
|
220
216
|
const padded = digits.length === 9 ? '0' + digits : digits
|
|
221
|
-
console.log('[validateRS] padded:', padded, '| length:', padded.length)
|
|
222
217
|
if (padded.length !== 10) {
|
|
223
|
-
console.log('[validateRS] INVÁLIDO — length esperado 10, recebido:', padded.length)
|
|
224
218
|
return false
|
|
225
219
|
}
|
|
226
220
|
const weights = [2, 9, 8, 7, 6, 5, 4, 3, 2]
|
|
227
221
|
let sum = 0
|
|
228
222
|
for (let i = 0; i < weights.length; i++) {
|
|
229
223
|
const partial = parseInt(padded[i]) * weights[i]
|
|
230
|
-
console.log(`[validateRS] i=${i} dígito=${padded[i]} peso=${weights[i]} parcial=${partial}`)
|
|
231
224
|
sum += partial
|
|
232
225
|
}
|
|
233
226
|
const remainder = sum % 11
|
|
234
227
|
const dv = remainder < 2 ? 0 : 11 - remainder
|
|
235
228
|
const dvIe = parseInt(padded[9])
|
|
236
|
-
console.log('[validateRS] soma:', sum, '| resto:', remainder, '| dv calculado:', dv, '| dv do IE:', dvIe, '| VÁLIDO:', dv === dvIe)
|
|
237
229
|
return dv === dvIe
|
|
238
230
|
}
|
|
239
231
|
|