matcha-components 20.95.0 → 20.97.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.
|
@@ -5940,10 +5940,15 @@ class MatchaMaskService extends MatchaMaskApplierService {
|
|
|
5940
5940
|
(newInputValue !== this.currentValue && this.writingValue) ||
|
|
5941
5941
|
(this.previousValue === this.currentValue && justPasted);
|
|
5942
5942
|
}
|
|
5943
|
+
// DEBUG: Verificar se formControlResult está sendo chamado
|
|
5944
|
+
console.log('=== applyMask DEBUG ===');
|
|
5945
|
+
console.log('result:', result);
|
|
5946
|
+
console.log('_emitValue:', this._emitValue);
|
|
5947
|
+
console.log('previousValue:', this.previousValue);
|
|
5948
|
+
console.log('currentValue:', this.currentValue);
|
|
5943
5949
|
// Propagate the input value back to the Angular model
|
|
5944
|
-
// Sempre emitir quando currencyMode está ativo para garantir que o valor limpo seja enviado
|
|
5945
5950
|
// eslint-disable-next-line no-unused-expressions,@typescript-eslint/no-unused-expressions
|
|
5946
|
-
|
|
5951
|
+
this._emitValue ? this.formControlResult(result) : '';
|
|
5947
5952
|
// Handle hidden input and showMaskTyped
|
|
5948
5953
|
if (!this.showMaskTyped || (this.showMaskTyped && this.hiddenInput)) {
|
|
5949
5954
|
if (this.hiddenInput) {
|
|
@@ -6216,46 +6221,39 @@ class MatchaMaskService extends MatchaMaskApplierService {
|
|
|
6216
6221
|
: (v) => v;
|
|
6217
6222
|
this.writingValue = false;
|
|
6218
6223
|
this.maskChanged = false;
|
|
6219
|
-
//
|
|
6224
|
+
// Para máscaras de separador, garantir que isNumberValue é true
|
|
6225
|
+
// Isso assegura a conversão correta para número
|
|
6226
|
+
if (this.maskExpression.startsWith("separator" /* MaskExpression.SEPARATOR */)) {
|
|
6227
|
+
this.isNumberValue = true;
|
|
6228
|
+
}
|
|
6220
6229
|
console.log('=== formControlResult DEBUG ===');
|
|
6221
6230
|
console.log('inputValue:', inputValue);
|
|
6222
|
-
console.log('dropSpecialCharacters:', this.dropSpecialCharacters);
|
|
6223
|
-
console.log('prefix:', this.prefix);
|
|
6224
6231
|
console.log('isNumberValue:', this.isNumberValue);
|
|
6232
|
+
console.log('dropSpecialCharacters:', this.dropSpecialCharacters);
|
|
6225
6233
|
if (Array.isArray(this.dropSpecialCharacters)) {
|
|
6226
|
-
const
|
|
6227
|
-
const
|
|
6228
|
-
const
|
|
6229
|
-
const
|
|
6230
|
-
const
|
|
6231
|
-
const finalValue = outputTransformFn(
|
|
6232
|
-
console.log('Array
|
|
6233
|
-
console.log('Array path - afterRemoveSuffix:', afterRemoveSuffix);
|
|
6234
|
-
console.log('Array path - afterRemoveMask:', afterRemoveMask);
|
|
6235
|
-
console.log('Array path - afterCheckSymbols:', afterCheckSymbols);
|
|
6236
|
-
console.log('Array path - afterToNumber:', afterToNumber);
|
|
6237
|
-
console.log('Array path - finalValue:', finalValue);
|
|
6234
|
+
const afterPrefix = this._removePrefix(inputValue);
|
|
6235
|
+
const afterSuffix = this._removeSuffix(afterPrefix);
|
|
6236
|
+
const afterMask = this._removeMask(afterSuffix, this.dropSpecialCharacters);
|
|
6237
|
+
const afterSymbols = this._checkSymbols(afterMask);
|
|
6238
|
+
const afterNumber = this._toNumber(afterSymbols);
|
|
6239
|
+
const finalValue = outputTransformFn(afterNumber);
|
|
6240
|
+
console.log('Array: afterPrefix:', afterPrefix, 'afterSuffix:', afterSuffix, 'afterMask:', afterMask, 'afterSymbols:', afterSymbols, 'afterNumber:', afterNumber, 'final:', finalValue, 'type:', typeof finalValue);
|
|
6238
6241
|
this.onChange(finalValue);
|
|
6239
6242
|
}
|
|
6240
6243
|
else if (this.dropSpecialCharacters ||
|
|
6241
6244
|
(!this.dropSpecialCharacters && this.prefix === inputValue)) {
|
|
6242
|
-
const
|
|
6243
|
-
const
|
|
6244
|
-
const
|
|
6245
|
-
const
|
|
6246
|
-
const finalValue = outputTransformFn(
|
|
6247
|
-
console.log('Boolean
|
|
6248
|
-
console.log('Boolean path - afterRemoveSuffix:', afterRemoveSuffix);
|
|
6249
|
-
console.log('Boolean path - afterCheckSymbols:', afterCheckSymbols);
|
|
6250
|
-
console.log('Boolean path - afterToNumber:', afterToNumber);
|
|
6251
|
-
console.log('Boolean path - finalValue:', finalValue, 'type:', typeof finalValue);
|
|
6245
|
+
const afterPrefix = this._removePrefix(inputValue);
|
|
6246
|
+
const afterSuffix = this._removeSuffix(afterPrefix);
|
|
6247
|
+
const afterSymbols = this._checkSymbols(afterSuffix);
|
|
6248
|
+
const afterNumber = this._toNumber(afterSymbols);
|
|
6249
|
+
const finalValue = outputTransformFn(afterNumber);
|
|
6250
|
+
console.log('Boolean: afterPrefix:', afterPrefix, 'afterSuffix:', afterSuffix, 'afterSymbols:', afterSymbols, 'afterNumber:', afterNumber, 'final:', finalValue, 'type:', typeof finalValue);
|
|
6252
6251
|
this.onChange(finalValue);
|
|
6253
6252
|
}
|
|
6254
6253
|
else {
|
|
6255
|
-
const
|
|
6256
|
-
const finalValue = outputTransformFn(
|
|
6257
|
-
console.log('Else
|
|
6258
|
-
console.log('Else path - finalValue:', finalValue);
|
|
6254
|
+
const afterNumber = this._toNumber(inputValue);
|
|
6255
|
+
const finalValue = outputTransformFn(afterNumber);
|
|
6256
|
+
console.log('Else: afterNumber:', afterNumber, 'final:', finalValue);
|
|
6259
6257
|
this.onChange(finalValue);
|
|
6260
6258
|
}
|
|
6261
6259
|
}
|
|
@@ -6303,13 +6301,17 @@ class MatchaMaskService extends MatchaMaskApplierService {
|
|
|
6303
6301
|
? this.specialCharacters.filter((v) => {
|
|
6304
6302
|
return this.dropSpecialCharacters.includes(v);
|
|
6305
6303
|
})
|
|
6306
|
-
: this.specialCharacters;
|
|
6304
|
+
: [...this.specialCharacters]; // Criar cópia para não modificar o original
|
|
6307
6305
|
if (!this.deletedSpecialCharacter &&
|
|
6308
6306
|
this._checkPatternForSpace() &&
|
|
6309
6307
|
result.includes(" " /* MaskExpression.WHITE_SPACE */) &&
|
|
6310
6308
|
this.maskExpression.includes("*" /* MaskExpression.SYMBOL_STAR */)) {
|
|
6311
6309
|
specialCharacters = specialCharacters.filter((char) => char !== " " /* MaskExpression.WHITE_SPACE */);
|
|
6312
6310
|
}
|
|
6311
|
+
// Para máscaras de separador, NÃO remover o decimalMarker - ele será convertido para ponto depois
|
|
6312
|
+
if (this.maskExpression.startsWith("separator" /* MaskExpression.SEPARATOR */)) {
|
|
6313
|
+
specialCharacters = specialCharacters.filter((char) => !this._compareOrIncludes(char, this.decimalMarker, null));
|
|
6314
|
+
}
|
|
6313
6315
|
return this._removeMask(result, specialCharacters);
|
|
6314
6316
|
}
|
|
6315
6317
|
_regExpForRemove(specialCharactersForRemove) {
|
|
@@ -6725,23 +6727,22 @@ class MatchaMaskCompatibleDirective {
|
|
|
6725
6727
|
// Implementar lógica de foco se necessário
|
|
6726
6728
|
}
|
|
6727
6729
|
onModelChange(value) {
|
|
6730
|
+
// Ignorar se estamos no meio de uma operação de escrita
|
|
6728
6731
|
if (this._maskService.writingValue) {
|
|
6729
6732
|
return;
|
|
6730
6733
|
}
|
|
6731
|
-
//
|
|
6732
|
-
|
|
6733
|
-
|
|
6734
|
-
|
|
6735
|
-
// O applyMask internamente chama formControlResult que já cuida de:
|
|
6736
|
-
// 1. Remover prefixo/sufixo
|
|
6737
|
-
// 2. Remover separadores especiais
|
|
6738
|
-
// 3. Converter para número
|
|
6739
|
-
// 4. Chamar onChange com o valor limpo
|
|
6740
|
-
if (this._mask && this._mask.trim() !== '') {
|
|
6741
|
-
this._maskService.applyMask(stringValue, this._mask);
|
|
6742
|
-
// NÃO chamar onChange aqui - formControlResult já fez isso com o valor limpo
|
|
6734
|
+
// Se o valor é um número, significa que veio do formControlResult (já processado)
|
|
6735
|
+
// Não precisamos reprocessar para evitar loop infinito
|
|
6736
|
+
if (typeof value === 'number') {
|
|
6737
|
+
return;
|
|
6743
6738
|
}
|
|
6744
|
-
|
|
6739
|
+
// Converter para string
|
|
6740
|
+
const stringValue = value || '';
|
|
6741
|
+
this._inputValue = stringValue;
|
|
6742
|
+
// Para máscaras, não chamar applyMask aqui pois isso criaria um loop
|
|
6743
|
+
// O onInput já cuida de aplicar a máscara durante a digitação
|
|
6744
|
+
// O writeValue cuida de formatar valores vindos do backend
|
|
6745
|
+
if (!this._mask || this._mask.trim() === '') {
|
|
6745
6746
|
this._maskService.onChange(stringValue);
|
|
6746
6747
|
}
|
|
6747
6748
|
}
|