matcha-components 20.108.0 → 20.110.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.
|
@@ -5116,7 +5116,31 @@ class MatchaMaskApplierService {
|
|
|
5116
5116
|
}
|
|
5117
5117
|
}
|
|
5118
5118
|
// Modo moeda: dígitos entram pela direita (ex: 1 → 0,01, 12 → 0,12, 123 → 1,23)
|
|
5119
|
+
// IMPORTANTE: Detectar se devemos aplicar currencyMode
|
|
5120
|
+
// - Se não tem vírgula: aplicar (digitação começando)
|
|
5121
|
+
// - Se tem vírgula mas a parte decimal tem precisão diferente: aplicar (digitação em andamento)
|
|
5122
|
+
// - Se tem vírgula e parte decimal com precisão correta E poucos dígitos totais: NÃO aplicar (veio do backend)
|
|
5123
|
+
const actualDecimalMarker = typeof decimalMarker === 'string' ? decimalMarker : ',';
|
|
5124
|
+
const hasDecimalMarker = processedValue.includes(actualDecimalMarker);
|
|
5125
|
+
let shouldApplyCurrencyMode = false;
|
|
5119
5126
|
if (this.currencyMode && precision > 0) {
|
|
5127
|
+
if (!hasDecimalMarker) {
|
|
5128
|
+
// Sem vírgula: aplicar currencyMode (digitação começando)
|
|
5129
|
+
shouldApplyCurrencyMode = true;
|
|
5130
|
+
console.log('💰 CurrencyMode: SIM (sem vírgula)');
|
|
5131
|
+
}
|
|
5132
|
+
else {
|
|
5133
|
+
// Com vírgula: verificar se é digitação em andamento ou valor do backend
|
|
5134
|
+
const parts = processedValue.split(actualDecimalMarker);
|
|
5135
|
+
const decimalPart = parts[1] || '';
|
|
5136
|
+
console.log('💰 Verificando decimal part:', decimalPart, 'length:', decimalPart.length, 'precision:', precision);
|
|
5137
|
+
// Se a parte decimal tem mais dígitos que a precisão, é digitação em andamento
|
|
5138
|
+
// Se tem menos, veio do backend (ex: "10,5" com precisão 2)
|
|
5139
|
+
shouldApplyCurrencyMode = decimalPart.length > precision;
|
|
5140
|
+
console.log('💰 CurrencyMode:', shouldApplyCurrencyMode ? 'SIM (digitação)' : 'NÃO (backend)');
|
|
5141
|
+
}
|
|
5142
|
+
}
|
|
5143
|
+
if (shouldApplyCurrencyMode) {
|
|
5120
5144
|
// Extrair apenas dígitos e sinal negativo
|
|
5121
5145
|
const hasMinus = processedValue.startsWith("-" /* MaskExpression.MINUS */) ||
|
|
5122
5146
|
(this.allowNegativeNumbers && processedValue.includes("-" /* MaskExpression.MINUS */));
|
|
@@ -5707,7 +5731,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImpor
|
|
|
5707
5731
|
type: Injectable
|
|
5708
5732
|
}] });
|
|
5709
5733
|
|
|
5710
|
-
console.log('🎯 MATCHA-MASK VERSION:
|
|
5734
|
+
console.log('🎯 MATCHA-MASK VERSION: v105 - CURRENCYMODE SMART DETECTION v2 - ' + new Date().toISOString());
|
|
5711
5735
|
class MatchaMaskService extends MatchaMaskApplierService {
|
|
5712
5736
|
constructor() {
|
|
5713
5737
|
super(...arguments);
|