matcha-components 20.111.0 → 20.116.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.
|
@@ -5117,13 +5117,13 @@ class MatchaMaskApplierService {
|
|
|
5117
5117
|
}
|
|
5118
5118
|
// Modo moeda: dígitos entram pela direita (ex: 1 → 0,01, 12 → 0,12, 123 → 1,23)
|
|
5119
5119
|
// IMPORTANTE: Detectar se devemos aplicar currencyMode
|
|
5120
|
-
// -
|
|
5121
|
-
// -
|
|
5122
|
-
// - Se tem vírgula e parte decimal com precisão correta E poucos dígitos totais: NÃO aplicar (veio do backend)
|
|
5120
|
+
// - NÃO aplicar se estamos em writeValue (valor vindo do backend/programático)
|
|
5121
|
+
// - Aplicar apenas durante digitação do usuário (onInput)
|
|
5123
5122
|
const actualDecimalMarker = typeof decimalMarker === 'string' ? decimalMarker : ',';
|
|
5124
5123
|
const hasDecimalMarker = processedValue.includes(actualDecimalMarker);
|
|
5125
5124
|
let shouldApplyCurrencyMode = false;
|
|
5126
|
-
|
|
5125
|
+
// NUNCA aplicar currencyMode quando writingValue = true (writeValue do backend)
|
|
5126
|
+
if (this.currencyMode && precision > 0 && !this.writingValue) {
|
|
5127
5127
|
if (!hasDecimalMarker) {
|
|
5128
5128
|
// Sem vírgula: aplicar currencyMode (digitação começando)
|
|
5129
5129
|
shouldApplyCurrencyMode = true;
|
|
@@ -5728,7 +5728,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImpor
|
|
|
5728
5728
|
type: Injectable
|
|
5729
5729
|
}] });
|
|
5730
5730
|
|
|
5731
|
-
// console.log('🎯 MATCHA-MASK VERSION:
|
|
5731
|
+
// console.log('🎯 MATCHA-MASK VERSION: v106 - CURRENCYMODE FIX BACKEND VALUES - ' + new Date().toISOString());
|
|
5732
5732
|
class MatchaMaskService extends MatchaMaskApplierService {
|
|
5733
5733
|
constructor() {
|
|
5734
5734
|
super(...arguments);
|
|
@@ -8778,14 +8778,12 @@ class MatchaSelectComponent {
|
|
|
8778
8778
|
this.setupKeyboardNavigation();
|
|
8779
8779
|
// Escuta eventos customizados das opções
|
|
8780
8780
|
this.elRef.nativeElement.addEventListener('matcha-option-selected', (event) => {
|
|
8781
|
-
console.log('MatchaSelect: Evento matcha-option-selected recebido', event.detail);
|
|
8782
8781
|
const { option, value } = event.detail;
|
|
8783
8782
|
this.selectOption(option);
|
|
8784
8783
|
});
|
|
8785
8784
|
// Escuta evento para fechar este painel quando outro for aberto
|
|
8786
8785
|
this.elRef.nativeElement.addEventListener('matcha-select-close', () => {
|
|
8787
8786
|
if (this.open) {
|
|
8788
|
-
console.log('MatchaSelect: Fechando painel por evento de outro select');
|
|
8789
8787
|
this.closePanel();
|
|
8790
8788
|
}
|
|
8791
8789
|
});
|
|
@@ -8794,7 +8792,6 @@ class MatchaSelectComponent {
|
|
|
8794
8792
|
const target = event.target;
|
|
8795
8793
|
const isInsideSelect = this.elRef.nativeElement.contains(target);
|
|
8796
8794
|
if (!isInsideSelect && this.open) {
|
|
8797
|
-
console.log('MatchaSelect: Fechando painel por click outside');
|
|
8798
8795
|
this.closePanel();
|
|
8799
8796
|
}
|
|
8800
8797
|
});
|
|
@@ -8887,7 +8884,6 @@ class MatchaSelectComponent {
|
|
|
8887
8884
|
bubbles: true
|
|
8888
8885
|
});
|
|
8889
8886
|
this.elRef.nativeElement.dispatchEvent(selectionEvent);
|
|
8890
|
-
console.log('MatchaSelect: Evento de seleção disparado', { value });
|
|
8891
8887
|
}
|
|
8892
8888
|
onTriggerClick() {
|
|
8893
8889
|
if (this.disabled || this.isDisabled)
|
|
@@ -8896,7 +8892,6 @@ class MatchaSelectComponent {
|
|
|
8896
8892
|
}
|
|
8897
8893
|
openPanel() {
|
|
8898
8894
|
if (this.disabled || this.isDisabled) {
|
|
8899
|
-
console.log('MatchaSelect: disabled');
|
|
8900
8895
|
return;
|
|
8901
8896
|
}
|
|
8902
8897
|
// Garantir que o triggerElement está configurado
|
|
@@ -8904,14 +8899,8 @@ class MatchaSelectComponent {
|
|
|
8904
8899
|
this.triggerElement = this.elRef.nativeElement.querySelector('.matcha-select-trigger');
|
|
8905
8900
|
}
|
|
8906
8901
|
if (!this.triggerElement) {
|
|
8907
|
-
console.log('MatchaSelect: triggerElement não encontrado');
|
|
8908
8902
|
return;
|
|
8909
8903
|
}
|
|
8910
|
-
console.log('MatchaSelect: Abrindo painel', {
|
|
8911
|
-
triggerElement: this.triggerElement,
|
|
8912
|
-
panel: this.panel,
|
|
8913
|
-
open: this.open
|
|
8914
|
-
});
|
|
8915
8904
|
// Fechar outros painéis abertos antes de abrir este
|
|
8916
8905
|
this.closeOtherPanels();
|
|
8917
8906
|
this.open = true;
|
|
@@ -8924,10 +8913,6 @@ class MatchaSelectComponent {
|
|
|
8924
8913
|
this.opened.emit();
|
|
8925
8914
|
}
|
|
8926
8915
|
closePanel() {
|
|
8927
|
-
console.log('MatchaSelect: Fechando painel', {
|
|
8928
|
-
open: this.open,
|
|
8929
|
-
stackTrace: new Error().stack
|
|
8930
|
-
});
|
|
8931
8916
|
this.open = false;
|
|
8932
8917
|
this.activeIndex = -1;
|
|
8933
8918
|
this.updateSelectedStates();
|
|
@@ -9045,13 +9030,6 @@ class MatchaSelectComponent {
|
|
|
9045
9030
|
}
|
|
9046
9031
|
// chamado por matcha-option quando clicado
|
|
9047
9032
|
selectOption(option) {
|
|
9048
|
-
console.log('MatchaSelect: Opção selecionada', {
|
|
9049
|
-
option,
|
|
9050
|
-
value: option.value,
|
|
9051
|
-
selected: option.selected,
|
|
9052
|
-
optionsLength: this.options.length,
|
|
9053
|
-
allOptions: this.options.toArray()
|
|
9054
|
-
});
|
|
9055
9033
|
// Armazenar o valor selecionado
|
|
9056
9034
|
this.selectedValue = option.value;
|
|
9057
9035
|
// Armazenar o label (texto interno) da opção selecionada
|
|
@@ -9064,12 +9042,6 @@ class MatchaSelectComponent {
|
|
|
9064
9042
|
o.selected = false;
|
|
9065
9043
|
}
|
|
9066
9044
|
});
|
|
9067
|
-
console.log('MatchaSelect: Após marcar seleção', {
|
|
9068
|
-
selectedOption: option,
|
|
9069
|
-
selected: option.selected,
|
|
9070
|
-
selectedValue: this.selectedValue,
|
|
9071
|
-
allOptions: this.options.toArray().map(o => ({ value: o.value, selected: o.selected }))
|
|
9072
|
-
});
|
|
9073
9045
|
// Notificar a diretiva sobre a seleção antes de fechar o painel
|
|
9074
9046
|
this.notifyDirectiveOfSelection(option.value);
|
|
9075
9047
|
// Emitir evento de mudança de seleção
|
|
@@ -9078,7 +9050,6 @@ class MatchaSelectComponent {
|
|
|
9078
9050
|
this.onChange(option.value);
|
|
9079
9051
|
this.onTouched();
|
|
9080
9052
|
// Fechamos painel automaticamente
|
|
9081
|
-
console.log('MatchaSelect: Fechando painel após seleção');
|
|
9082
9053
|
this.closePanel();
|
|
9083
9054
|
// Forçar detecção de mudanças para garantir que o painel seja fechado
|
|
9084
9055
|
this.cdr.detectChanges();
|
|
@@ -9086,11 +9057,6 @@ class MatchaSelectComponent {
|
|
|
9086
9057
|
getSelectedValue() {
|
|
9087
9058
|
// Usar o valor armazenado se disponível, senão buscar na QueryList
|
|
9088
9059
|
const value = this.selectedValue !== undefined ? this.selectedValue : this.options.find(o => o.selected)?.value;
|
|
9089
|
-
console.log('MatchaSelect: getSelectedValue chamado', {
|
|
9090
|
-
selectedValue: this.selectedValue,
|
|
9091
|
-
value,
|
|
9092
|
-
allOptions: this.options.toArray().map(o => ({ value: o.value, selected: o.selected }))
|
|
9093
|
-
});
|
|
9094
9060
|
return value;
|
|
9095
9061
|
}
|
|
9096
9062
|
getSelectedLabel() {
|
|
@@ -11929,24 +11895,14 @@ class MatchaSelectTriggerDirective {
|
|
|
11929
11895
|
const target = ev.target;
|
|
11930
11896
|
const isInsideTrigger = this.el.nativeElement.contains(target) || this.el.nativeElement === target;
|
|
11931
11897
|
const isInsidePanel = this.select?.elRef?.nativeElement?.contains?.(target);
|
|
11932
|
-
console.log('MatchaSelect: Click outside check', {
|
|
11933
|
-
target: target,
|
|
11934
|
-
triggerElement: this.el.nativeElement,
|
|
11935
|
-
isInsideTrigger,
|
|
11936
|
-
isInsidePanel,
|
|
11937
|
-
shouldClose: !isInsideTrigger && !isInsidePanel,
|
|
11938
|
-
panelOpen: this.select?.open
|
|
11939
|
-
});
|
|
11940
11898
|
// Só fechar se o painel estiver aberto e clicou fora
|
|
11941
11899
|
return this.select?.open && !isInsideTrigger && !isInsidePanel;
|
|
11942
11900
|
})).subscribe(() => {
|
|
11943
|
-
console.log('MatchaSelect: Fechando painel por click outside');
|
|
11944
11901
|
this.select.closePanel();
|
|
11945
11902
|
});
|
|
11946
11903
|
this.subs.add(clickSub);
|
|
11947
11904
|
// Escutar evento de seleção do select
|
|
11948
11905
|
const selectionSub = fromEvent(this.select.elRef.nativeElement, 'matcha-select-selection').subscribe((event) => {
|
|
11949
|
-
console.log('MatchaSelect: Evento de seleção recebido na diretiva', event.detail);
|
|
11950
11906
|
const { value } = event.detail;
|
|
11951
11907
|
if (value !== undefined) {
|
|
11952
11908
|
this.writeValueToInput(value);
|
|
@@ -11958,10 +11914,6 @@ class MatchaSelectTriggerDirective {
|
|
|
11958
11914
|
this.subs.unsubscribe();
|
|
11959
11915
|
}
|
|
11960
11916
|
writeValueToInput(value) {
|
|
11961
|
-
console.log('MatchaSelect: writeValueToInput chamado', {
|
|
11962
|
-
value,
|
|
11963
|
-
input: this.el.nativeElement
|
|
11964
|
-
});
|
|
11965
11917
|
const input = this.el.nativeElement;
|
|
11966
11918
|
input.value = value == null ? '' : value;
|
|
11967
11919
|
// Dispatch múltiplos eventos para garantir compatibilidade com Angular Forms
|
|
@@ -11971,7 +11923,6 @@ class MatchaSelectTriggerDirective {
|
|
|
11971
11923
|
input.dispatchEvent(inputEvent);
|
|
11972
11924
|
input.dispatchEvent(changeEvent);
|
|
11973
11925
|
input.dispatchEvent(blurEvent);
|
|
11974
|
-
console.log('MatchaSelect: Valor escrito no input', input.value);
|
|
11975
11926
|
}
|
|
11976
11927
|
onClick() {
|
|
11977
11928
|
// Abrir painel quando clicar no trigger
|