matcha-components 20.110.0 → 20.115.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.
|
@@ -5127,17 +5127,14 @@ class MatchaMaskApplierService {
|
|
|
5127
5127
|
if (!hasDecimalMarker) {
|
|
5128
5128
|
// Sem vírgula: aplicar currencyMode (digitação começando)
|
|
5129
5129
|
shouldApplyCurrencyMode = true;
|
|
5130
|
-
console.log('💰 CurrencyMode: SIM (sem vírgula)');
|
|
5131
5130
|
}
|
|
5132
5131
|
else {
|
|
5133
5132
|
// Com vírgula: verificar se é digitação em andamento ou valor do backend
|
|
5134
5133
|
const parts = processedValue.split(actualDecimalMarker);
|
|
5135
5134
|
const decimalPart = parts[1] || '';
|
|
5136
|
-
console.log('💰 Verificando decimal part:', decimalPart, 'length:', decimalPart.length, 'precision:', precision);
|
|
5137
5135
|
// Se a parte decimal tem mais dígitos que a precisão, é digitação em andamento
|
|
5138
5136
|
// Se tem menos, veio do backend (ex: "10,5" com precisão 2)
|
|
5139
5137
|
shouldApplyCurrencyMode = decimalPart.length > precision;
|
|
5140
|
-
console.log('💰 CurrencyMode:', shouldApplyCurrencyMode ? 'SIM (digitação)' : 'NÃO (backend)');
|
|
5141
5138
|
}
|
|
5142
5139
|
}
|
|
5143
5140
|
if (shouldApplyCurrencyMode) {
|
|
@@ -5731,7 +5728,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImpor
|
|
|
5731
5728
|
type: Injectable
|
|
5732
5729
|
}] });
|
|
5733
5730
|
|
|
5734
|
-
console.log('🎯 MATCHA-MASK VERSION: v105 - CURRENCYMODE SMART DETECTION v2 - ' + new Date().toISOString());
|
|
5731
|
+
// console.log('🎯 MATCHA-MASK VERSION: v105 - CURRENCYMODE SMART DETECTION v2 - ' + new Date().toISOString());
|
|
5735
5732
|
class MatchaMaskService extends MatchaMaskApplierService {
|
|
5736
5733
|
constructor() {
|
|
5737
5734
|
super(...arguments);
|
|
@@ -6835,10 +6832,8 @@ class MatchaMaskCompatibleDirective {
|
|
|
6835
6832
|
// Implementar lógica de teclado se necessário
|
|
6836
6833
|
}
|
|
6837
6834
|
writeValue(value) {
|
|
6838
|
-
console.log('🔵 writeValue chamado - valor:', value, 'tipo:', typeof value);
|
|
6839
6835
|
// Se já estamos escrevendo, não processar novamente (prevenir loop infinito)
|
|
6840
6836
|
if (this._maskService.writingValue) {
|
|
6841
|
-
console.log('⚠️ writeValue ABORTADO - writingValue já é true');
|
|
6842
6837
|
return;
|
|
6843
6838
|
}
|
|
6844
6839
|
this._maskService.writingValue = true;
|
|
@@ -6850,7 +6845,6 @@ class MatchaMaskCompatibleDirective {
|
|
|
6850
6845
|
}
|
|
6851
6846
|
else if (typeof value === 'number') {
|
|
6852
6847
|
inputValue = value.toString();
|
|
6853
|
-
console.log('🔢 Número convertido para string:', inputValue);
|
|
6854
6848
|
}
|
|
6855
6849
|
else {
|
|
6856
6850
|
inputValue = String(value);
|
|
@@ -6864,26 +6858,18 @@ class MatchaMaskCompatibleDirective {
|
|
|
6864
6858
|
if (actualDecimalMarker === ',') {
|
|
6865
6859
|
// Converter ponto para vírgula para que applyMask processe corretamente
|
|
6866
6860
|
inputValue = inputValue.replace('.', ',');
|
|
6867
|
-
console.log('🔄 Converteu ponto para vírgula:', inputValue);
|
|
6868
6861
|
}
|
|
6869
6862
|
}
|
|
6870
6863
|
this._inputValue = inputValue;
|
|
6871
6864
|
// Aplicar máscara se definida
|
|
6872
6865
|
if (this._mask && this._mask.trim() !== '') {
|
|
6873
|
-
console.log('📝 Chamando applyMask com:', inputValue);
|
|
6874
6866
|
const maskedValue = this._maskService.applyMask(inputValue, this._mask);
|
|
6875
|
-
console.log('📝 applyMask retornou:', maskedValue);
|
|
6876
6867
|
// Atualizar o valor do elemento HTML diretamente usando ElementRef
|
|
6877
6868
|
if (this.elementRef && this.elementRef.nativeElement) {
|
|
6878
6869
|
this.elementRef.nativeElement.value = maskedValue;
|
|
6879
|
-
console.log('✅ Elemento HTML atualizado com:', maskedValue);
|
|
6880
|
-
}
|
|
6881
|
-
else {
|
|
6882
|
-
console.log('⚠️ ElementRef não disponível');
|
|
6883
6870
|
}
|
|
6884
6871
|
}
|
|
6885
6872
|
this._maskService.writingValue = false;
|
|
6886
|
-
console.log('✅ writeValue CONCLUÍDO');
|
|
6887
6873
|
}
|
|
6888
6874
|
registerOnChange(fn) {
|
|
6889
6875
|
this.onChange = fn;
|
|
@@ -8792,14 +8778,12 @@ class MatchaSelectComponent {
|
|
|
8792
8778
|
this.setupKeyboardNavigation();
|
|
8793
8779
|
// Escuta eventos customizados das opções
|
|
8794
8780
|
this.elRef.nativeElement.addEventListener('matcha-option-selected', (event) => {
|
|
8795
|
-
console.log('MatchaSelect: Evento matcha-option-selected recebido', event.detail);
|
|
8796
8781
|
const { option, value } = event.detail;
|
|
8797
8782
|
this.selectOption(option);
|
|
8798
8783
|
});
|
|
8799
8784
|
// Escuta evento para fechar este painel quando outro for aberto
|
|
8800
8785
|
this.elRef.nativeElement.addEventListener('matcha-select-close', () => {
|
|
8801
8786
|
if (this.open) {
|
|
8802
|
-
console.log('MatchaSelect: Fechando painel por evento de outro select');
|
|
8803
8787
|
this.closePanel();
|
|
8804
8788
|
}
|
|
8805
8789
|
});
|
|
@@ -8808,7 +8792,6 @@ class MatchaSelectComponent {
|
|
|
8808
8792
|
const target = event.target;
|
|
8809
8793
|
const isInsideSelect = this.elRef.nativeElement.contains(target);
|
|
8810
8794
|
if (!isInsideSelect && this.open) {
|
|
8811
|
-
console.log('MatchaSelect: Fechando painel por click outside');
|
|
8812
8795
|
this.closePanel();
|
|
8813
8796
|
}
|
|
8814
8797
|
});
|
|
@@ -8901,7 +8884,6 @@ class MatchaSelectComponent {
|
|
|
8901
8884
|
bubbles: true
|
|
8902
8885
|
});
|
|
8903
8886
|
this.elRef.nativeElement.dispatchEvent(selectionEvent);
|
|
8904
|
-
console.log('MatchaSelect: Evento de seleção disparado', { value });
|
|
8905
8887
|
}
|
|
8906
8888
|
onTriggerClick() {
|
|
8907
8889
|
if (this.disabled || this.isDisabled)
|
|
@@ -8910,7 +8892,6 @@ class MatchaSelectComponent {
|
|
|
8910
8892
|
}
|
|
8911
8893
|
openPanel() {
|
|
8912
8894
|
if (this.disabled || this.isDisabled) {
|
|
8913
|
-
console.log('MatchaSelect: disabled');
|
|
8914
8895
|
return;
|
|
8915
8896
|
}
|
|
8916
8897
|
// Garantir que o triggerElement está configurado
|
|
@@ -8918,14 +8899,8 @@ class MatchaSelectComponent {
|
|
|
8918
8899
|
this.triggerElement = this.elRef.nativeElement.querySelector('.matcha-select-trigger');
|
|
8919
8900
|
}
|
|
8920
8901
|
if (!this.triggerElement) {
|
|
8921
|
-
console.log('MatchaSelect: triggerElement não encontrado');
|
|
8922
8902
|
return;
|
|
8923
8903
|
}
|
|
8924
|
-
console.log('MatchaSelect: Abrindo painel', {
|
|
8925
|
-
triggerElement: this.triggerElement,
|
|
8926
|
-
panel: this.panel,
|
|
8927
|
-
open: this.open
|
|
8928
|
-
});
|
|
8929
8904
|
// Fechar outros painéis abertos antes de abrir este
|
|
8930
8905
|
this.closeOtherPanels();
|
|
8931
8906
|
this.open = true;
|
|
@@ -8938,10 +8913,6 @@ class MatchaSelectComponent {
|
|
|
8938
8913
|
this.opened.emit();
|
|
8939
8914
|
}
|
|
8940
8915
|
closePanel() {
|
|
8941
|
-
console.log('MatchaSelect: Fechando painel', {
|
|
8942
|
-
open: this.open,
|
|
8943
|
-
stackTrace: new Error().stack
|
|
8944
|
-
});
|
|
8945
8916
|
this.open = false;
|
|
8946
8917
|
this.activeIndex = -1;
|
|
8947
8918
|
this.updateSelectedStates();
|
|
@@ -9059,13 +9030,6 @@ class MatchaSelectComponent {
|
|
|
9059
9030
|
}
|
|
9060
9031
|
// chamado por matcha-option quando clicado
|
|
9061
9032
|
selectOption(option) {
|
|
9062
|
-
console.log('MatchaSelect: Opção selecionada', {
|
|
9063
|
-
option,
|
|
9064
|
-
value: option.value,
|
|
9065
|
-
selected: option.selected,
|
|
9066
|
-
optionsLength: this.options.length,
|
|
9067
|
-
allOptions: this.options.toArray()
|
|
9068
|
-
});
|
|
9069
9033
|
// Armazenar o valor selecionado
|
|
9070
9034
|
this.selectedValue = option.value;
|
|
9071
9035
|
// Armazenar o label (texto interno) da opção selecionada
|
|
@@ -9078,12 +9042,6 @@ class MatchaSelectComponent {
|
|
|
9078
9042
|
o.selected = false;
|
|
9079
9043
|
}
|
|
9080
9044
|
});
|
|
9081
|
-
console.log('MatchaSelect: Após marcar seleção', {
|
|
9082
|
-
selectedOption: option,
|
|
9083
|
-
selected: option.selected,
|
|
9084
|
-
selectedValue: this.selectedValue,
|
|
9085
|
-
allOptions: this.options.toArray().map(o => ({ value: o.value, selected: o.selected }))
|
|
9086
|
-
});
|
|
9087
9045
|
// Notificar a diretiva sobre a seleção antes de fechar o painel
|
|
9088
9046
|
this.notifyDirectiveOfSelection(option.value);
|
|
9089
9047
|
// Emitir evento de mudança de seleção
|
|
@@ -9092,7 +9050,6 @@ class MatchaSelectComponent {
|
|
|
9092
9050
|
this.onChange(option.value);
|
|
9093
9051
|
this.onTouched();
|
|
9094
9052
|
// Fechamos painel automaticamente
|
|
9095
|
-
console.log('MatchaSelect: Fechando painel após seleção');
|
|
9096
9053
|
this.closePanel();
|
|
9097
9054
|
// Forçar detecção de mudanças para garantir que o painel seja fechado
|
|
9098
9055
|
this.cdr.detectChanges();
|
|
@@ -9100,11 +9057,6 @@ class MatchaSelectComponent {
|
|
|
9100
9057
|
getSelectedValue() {
|
|
9101
9058
|
// Usar o valor armazenado se disponível, senão buscar na QueryList
|
|
9102
9059
|
const value = this.selectedValue !== undefined ? this.selectedValue : this.options.find(o => o.selected)?.value;
|
|
9103
|
-
console.log('MatchaSelect: getSelectedValue chamado', {
|
|
9104
|
-
selectedValue: this.selectedValue,
|
|
9105
|
-
value,
|
|
9106
|
-
allOptions: this.options.toArray().map(o => ({ value: o.value, selected: o.selected }))
|
|
9107
|
-
});
|
|
9108
9060
|
return value;
|
|
9109
9061
|
}
|
|
9110
9062
|
getSelectedLabel() {
|
|
@@ -11943,24 +11895,14 @@ class MatchaSelectTriggerDirective {
|
|
|
11943
11895
|
const target = ev.target;
|
|
11944
11896
|
const isInsideTrigger = this.el.nativeElement.contains(target) || this.el.nativeElement === target;
|
|
11945
11897
|
const isInsidePanel = this.select?.elRef?.nativeElement?.contains?.(target);
|
|
11946
|
-
console.log('MatchaSelect: Click outside check', {
|
|
11947
|
-
target: target,
|
|
11948
|
-
triggerElement: this.el.nativeElement,
|
|
11949
|
-
isInsideTrigger,
|
|
11950
|
-
isInsidePanel,
|
|
11951
|
-
shouldClose: !isInsideTrigger && !isInsidePanel,
|
|
11952
|
-
panelOpen: this.select?.open
|
|
11953
|
-
});
|
|
11954
11898
|
// Só fechar se o painel estiver aberto e clicou fora
|
|
11955
11899
|
return this.select?.open && !isInsideTrigger && !isInsidePanel;
|
|
11956
11900
|
})).subscribe(() => {
|
|
11957
|
-
console.log('MatchaSelect: Fechando painel por click outside');
|
|
11958
11901
|
this.select.closePanel();
|
|
11959
11902
|
});
|
|
11960
11903
|
this.subs.add(clickSub);
|
|
11961
11904
|
// Escutar evento de seleção do select
|
|
11962
11905
|
const selectionSub = fromEvent(this.select.elRef.nativeElement, 'matcha-select-selection').subscribe((event) => {
|
|
11963
|
-
console.log('MatchaSelect: Evento de seleção recebido na diretiva', event.detail);
|
|
11964
11906
|
const { value } = event.detail;
|
|
11965
11907
|
if (value !== undefined) {
|
|
11966
11908
|
this.writeValueToInput(value);
|
|
@@ -11972,10 +11914,6 @@ class MatchaSelectTriggerDirective {
|
|
|
11972
11914
|
this.subs.unsubscribe();
|
|
11973
11915
|
}
|
|
11974
11916
|
writeValueToInput(value) {
|
|
11975
|
-
console.log('MatchaSelect: writeValueToInput chamado', {
|
|
11976
|
-
value,
|
|
11977
|
-
input: this.el.nativeElement
|
|
11978
|
-
});
|
|
11979
11917
|
const input = this.el.nativeElement;
|
|
11980
11918
|
input.value = value == null ? '' : value;
|
|
11981
11919
|
// Dispatch múltiplos eventos para garantir compatibilidade com Angular Forms
|
|
@@ -11985,7 +11923,6 @@ class MatchaSelectTriggerDirective {
|
|
|
11985
11923
|
input.dispatchEvent(inputEvent);
|
|
11986
11924
|
input.dispatchEvent(changeEvent);
|
|
11987
11925
|
input.dispatchEvent(blurEvent);
|
|
11988
|
-
console.log('MatchaSelect: Valor escrito no input', input.value);
|
|
11989
11926
|
}
|
|
11990
11927
|
onClick() {
|
|
11991
11928
|
// Abrir painel quando clicar no trigger
|