matcha-components 20.109.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,12 +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: aplicar currencyMode se o valor NÃO tem o decimalMarker
5120
- // Se tem o decimalMarker, significa que veio formatado do backend (ex: 10,50)
5121
- const hasDecimalMarker = typeof decimalMarker === 'string'
5122
- ? processedValue.includes(decimalMarker)
5123
- : decimalMarker.some((marker) => processedValue.includes(marker));
5124
- if (this.currencyMode && precision > 0 && !hasDecimalMarker) {
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;
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) {
5125
5144
  // Extrair apenas dígitos e sinal negativo
5126
5145
  const hasMinus = processedValue.startsWith("-" /* MaskExpression.MINUS */) ||
5127
5146
  (this.allowNegativeNumbers && processedValue.includes("-" /* MaskExpression.MINUS */));
@@ -5712,7 +5731,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImpor
5712
5731
  type: Injectable
5713
5732
  }] });
5714
5733
 
5715
- console.log('🎯 MATCHA-MASK VERSION: v103 - CURRENCYMODE DECIMAL FIX - ' + new Date().toISOString());
5734
+ console.log('🎯 MATCHA-MASK VERSION: v105 - CURRENCYMODE SMART DETECTION v2 - ' + new Date().toISOString());
5716
5735
  class MatchaMaskService extends MatchaMaskApplierService {
5717
5736
  constructor() {
5718
5737
  super(...arguments);