matcha-components 20.104.0 → 20.106.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.
|
@@ -5707,8 +5707,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImpor
|
|
|
5707
5707
|
type: Injectable
|
|
5708
5708
|
}] });
|
|
5709
5709
|
|
|
5710
|
-
// DEBUG: Versão da biblioteca - remover após debug
|
|
5711
|
-
console.log('🎯 MATCHA-MASK VERSION: v100 - ' + new Date().toISOString());
|
|
5712
5710
|
class MatchaMaskService extends MatchaMaskApplierService {
|
|
5713
5711
|
constructor() {
|
|
5714
5712
|
super(...arguments);
|
|
@@ -5746,6 +5744,8 @@ class MatchaMaskService extends MatchaMaskApplierService {
|
|
|
5746
5744
|
applyMask(inputValue, maskExpression, position = 0, justPasted = false, backspaced = false,
|
|
5747
5745
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
5748
5746
|
cb = () => { }) {
|
|
5747
|
+
// Armazenar maskExpression como propriedade da classe para uso posterior
|
|
5748
|
+
this.maskExpression = maskExpression;
|
|
5749
5749
|
// Converter automaticamente número, boolean ou object para string (retrocompatível)
|
|
5750
5750
|
// Isso previne o erro "indexOf is not a function" quando números são passados
|
|
5751
5751
|
let processedInputValue;
|
|
@@ -5942,16 +5942,9 @@ class MatchaMaskService extends MatchaMaskApplierService {
|
|
|
5942
5942
|
(newInputValue !== this.currentValue && this.writingValue) ||
|
|
5943
5943
|
(this.previousValue === this.currentValue && justPasted);
|
|
5944
5944
|
}
|
|
5945
|
-
console.log('=== applyMask EMIT CHECK ===');
|
|
5946
|
-
console.log('result:', result);
|
|
5947
|
-
console.log('previousValue:', this.previousValue);
|
|
5948
|
-
console.log('currentValue:', this.currentValue);
|
|
5949
|
-
console.log('_emitValue:', this._emitValue);
|
|
5950
|
-
console.log('maskExpression:', this.maskExpression);
|
|
5951
|
-
console.log('dropSpecialCharacters:', this.dropSpecialCharacters);
|
|
5952
5945
|
// Propagate the input value back to the Angular model
|
|
5953
5946
|
// eslint-disable-next-line no-unused-expressions,@typescript-eslint/no-unused-expressions
|
|
5954
|
-
this._emitValue ? this.formControlResult(result) :
|
|
5947
|
+
this._emitValue ? this.formControlResult(result) : '';
|
|
5955
5948
|
// Handle hidden input and showMaskTyped
|
|
5956
5949
|
if (!this.showMaskTyped || (this.showMaskTyped && this.hiddenInput)) {
|
|
5957
5950
|
if (this.hiddenInput) {
|
|
@@ -6226,47 +6219,31 @@ class MatchaMaskService extends MatchaMaskApplierService {
|
|
|
6226
6219
|
this.maskChanged = false;
|
|
6227
6220
|
// Para máscaras de separador (currency), fazer conversão direta para número
|
|
6228
6221
|
if (this.maskExpression.startsWith("separator" /* MaskExpression.SEPARATOR */) && this.dropSpecialCharacters) {
|
|
6229
|
-
console.log('=== formControlResult CURRENCY DEBUG ===');
|
|
6230
|
-
console.log('maskExpression:', this.maskExpression);
|
|
6231
|
-
console.log('dropSpecialCharacters:', this.dropSpecialCharacters);
|
|
6232
|
-
console.log('inputValue:', inputValue);
|
|
6233
|
-
console.log('prefix:', this.prefix);
|
|
6234
|
-
console.log('thousandSeparator:', this.thousandSeparator);
|
|
6235
|
-
console.log('decimalMarker:', this.decimalMarker);
|
|
6236
6222
|
// Remover prefixo e sufixo
|
|
6237
6223
|
let cleanValue = inputValue;
|
|
6238
6224
|
if (this.prefix) {
|
|
6239
6225
|
cleanValue = cleanValue.replace(this.prefix, '');
|
|
6240
|
-
console.log('after removePrefix:', cleanValue);
|
|
6241
6226
|
}
|
|
6242
6227
|
if (this.suffix) {
|
|
6243
6228
|
cleanValue = cleanValue.replace(this.suffix, '');
|
|
6244
|
-
console.log('after removeSuffix:', cleanValue);
|
|
6245
6229
|
}
|
|
6246
6230
|
// Remover separador de milhares
|
|
6247
6231
|
if (this.thousandSeparator) {
|
|
6248
6232
|
cleanValue = cleanValue.split(this.thousandSeparator).join('');
|
|
6249
|
-
console.log('after removeThousand:', cleanValue);
|
|
6250
6233
|
}
|
|
6251
6234
|
// Converter decimal marker para ponto
|
|
6252
6235
|
const markers = Array.isArray(this.decimalMarker)
|
|
6253
6236
|
? this.decimalMarker
|
|
6254
6237
|
: [this.decimalMarker];
|
|
6255
|
-
console.log('markers to replace:', markers);
|
|
6256
6238
|
for (const marker of markers) {
|
|
6257
6239
|
if (marker && marker !== '.') {
|
|
6258
6240
|
cleanValue = cleanValue.replace(marker, '.');
|
|
6259
|
-
console.log('after replaceMarker ' + marker + ':', cleanValue);
|
|
6260
6241
|
}
|
|
6261
6242
|
}
|
|
6262
6243
|
// Converter para número
|
|
6263
6244
|
const numValue = parseFloat(cleanValue);
|
|
6264
6245
|
const finalValue = isNaN(numValue) ? 0 : numValue;
|
|
6265
|
-
console.log('numValue:', numValue, 'type:', typeof numValue);
|
|
6266
|
-
console.log('finalValue:', finalValue, 'type:', typeof finalValue);
|
|
6267
|
-
console.log('onChange exists:', typeof this.onChange);
|
|
6268
6246
|
this.onChange(outputTransformFn(finalValue));
|
|
6269
|
-
console.log('onChange called with:', finalValue);
|
|
6270
6247
|
return;
|
|
6271
6248
|
}
|
|
6272
6249
|
// Para máscaras de separador, garantir que isNumberValue é true
|