matcha-components 20.159.0 → 20.161.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.
|
@@ -372,6 +372,7 @@ class MatchaAccordionItemComponent {
|
|
|
372
372
|
this._isOpen = false;
|
|
373
373
|
this._clickableHeader = true;
|
|
374
374
|
this.opened = new EventEmitter();
|
|
375
|
+
this.isOpenChange = new EventEmitter();
|
|
375
376
|
this.toggleRequested = new EventEmitter();
|
|
376
377
|
}
|
|
377
378
|
set stretch(value) {
|
|
@@ -390,7 +391,12 @@ class MatchaAccordionItemComponent {
|
|
|
390
391
|
return this._clickableHeader;
|
|
391
392
|
}
|
|
392
393
|
set isOpen(value) {
|
|
393
|
-
|
|
394
|
+
const newValue = value != null && `${value}` !== 'false';
|
|
395
|
+
if (this._isOpen !== newValue) {
|
|
396
|
+
this._isOpen = newValue;
|
|
397
|
+
this.isOpenChange.emit(this._isOpen);
|
|
398
|
+
this.opened.emit(this._isOpen);
|
|
399
|
+
}
|
|
394
400
|
}
|
|
395
401
|
get isOpen() {
|
|
396
402
|
return this._isOpen;
|
|
@@ -402,20 +408,19 @@ class MatchaAccordionItemComponent {
|
|
|
402
408
|
this.opened.emit(this.isOpen);
|
|
403
409
|
}
|
|
404
410
|
ngOnChanges(changes) {
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
}
|
|
411
|
+
// O setter já lida com a emissão de mudanças,
|
|
412
|
+
// mas mantemos o gancho se necessário para outros inputs no futuro.
|
|
408
413
|
}
|
|
409
414
|
toggleAccordion() {
|
|
410
415
|
// Emite evento para o accordion pai controlar o estado
|
|
411
416
|
this.toggleRequested.emit();
|
|
412
417
|
}
|
|
413
418
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaAccordionItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
414
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.0", type: MatchaAccordionItemComponent, isStandalone: false, selector: "matcha-accordion-item", inputs: { stretch: "stretch", clickableHeader: "clickableHeader", isOpen: "isOpen" }, outputs: { opened: "opened", toggleRequested: "toggleRequested" }, host: { properties: { "class.stretch": "this.stretchClass", "class.is-open": "this.isOpenClass" } }, usesOnChanges: true, ngImport: i0, template: "<div class=\"accordion-item flex-column overflow-hidden\">\n <div class=\"accordion-header d-flex\">\n <div class=\"d-flex accordion-header-wrapper\"\n [class.cursor-pointer]=\"clickableHeader\"\n (click)=\"clickableHeader ? toggleAccordion() : null\">\n <ng-content select=\"matcha-accordion-header\"></ng-content>\n </div>\n </div>\n <div class=\"accordion-content overflow-hidden\" [@expandCollapse]=\"isOpen ? '*' : 'void'\">\n <ng-content select=\"matcha-accordion-content\"></ng-content>\n <ng-content></ng-content>\n </div>\n</div>\n", styles: [""], animations: [...createAnimations] }); }
|
|
419
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.0", type: MatchaAccordionItemComponent, isStandalone: false, selector: "matcha-accordion-item", inputs: { stretch: "stretch", clickableHeader: "clickableHeader", isOpen: "isOpen" }, outputs: { opened: "opened", isOpenChange: "isOpenChange", toggleRequested: "toggleRequested" }, host: { properties: { "class.stretch": "this.stretchClass", "class.is-open": "this.isOpenClass" } }, exportAs: ["matchaAccordionItem"], usesOnChanges: true, ngImport: i0, template: "<div class=\"accordion-item flex-column overflow-hidden\">\n <div class=\"accordion-header d-flex\">\n <div class=\"d-flex accordion-header-wrapper\"\n [class.cursor-pointer]=\"clickableHeader\"\n (click)=\"clickableHeader ? toggleAccordion() : null\">\n <ng-content select=\"matcha-accordion-header\"></ng-content>\n </div>\n </div>\n <div class=\"accordion-content overflow-hidden\" [@expandCollapse]=\"isOpen ? '*' : 'void'\">\n <ng-content select=\"matcha-accordion-content\"></ng-content>\n <ng-content></ng-content>\n </div>\n</div>\n", styles: [""], animations: [...createAnimations] }); }
|
|
415
420
|
}
|
|
416
421
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaAccordionItemComponent, decorators: [{
|
|
417
422
|
type: Component,
|
|
418
|
-
args: [{ selector: 'matcha-accordion-item', standalone: false, animations: [...createAnimations], template: "<div class=\"accordion-item flex-column overflow-hidden\">\n <div class=\"accordion-header d-flex\">\n <div class=\"d-flex accordion-header-wrapper\"\n [class.cursor-pointer]=\"clickableHeader\"\n (click)=\"clickableHeader ? toggleAccordion() : null\">\n <ng-content select=\"matcha-accordion-header\"></ng-content>\n </div>\n </div>\n <div class=\"accordion-content overflow-hidden\" [@expandCollapse]=\"isOpen ? '*' : 'void'\">\n <ng-content select=\"matcha-accordion-content\"></ng-content>\n <ng-content></ng-content>\n </div>\n</div>\n" }]
|
|
423
|
+
args: [{ selector: 'matcha-accordion-item', standalone: false, animations: [...createAnimations], exportAs: 'matchaAccordionItem', template: "<div class=\"accordion-item flex-column overflow-hidden\">\n <div class=\"accordion-header d-flex\">\n <div class=\"d-flex accordion-header-wrapper\"\n [class.cursor-pointer]=\"clickableHeader\"\n (click)=\"clickableHeader ? toggleAccordion() : null\">\n <ng-content select=\"matcha-accordion-header\"></ng-content>\n </div>\n </div>\n <div class=\"accordion-content overflow-hidden\" [@expandCollapse]=\"isOpen ? '*' : 'void'\">\n <ng-content select=\"matcha-accordion-content\"></ng-content>\n <ng-content></ng-content>\n </div>\n</div>\n" }]
|
|
419
424
|
}], propDecorators: { stretch: [{
|
|
420
425
|
type: Input
|
|
421
426
|
}], stretchClass: [{
|
|
@@ -430,6 +435,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImpor
|
|
|
430
435
|
args: ['class.is-open']
|
|
431
436
|
}], opened: [{
|
|
432
437
|
type: Output
|
|
438
|
+
}], isOpenChange: [{
|
|
439
|
+
type: Output
|
|
433
440
|
}], toggleRequested: [{
|
|
434
441
|
type: Output
|
|
435
442
|
}] } });
|
|
@@ -8562,7 +8569,7 @@ class MatchaOptionComponent {
|
|
|
8562
8569
|
return this.elRef.nativeElement.textContent?.trim() || '';
|
|
8563
8570
|
}
|
|
8564
8571
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaOptionComponent, deps: [{ token: MATCHA_OPTION_PARENT, optional: true }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
8565
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.0", type: MatchaOptionComponent, isStandalone: false, selector: "matcha-option", inputs: { value: "value", disabled: "disabled" }, outputs: { optionClick: "optionClick", optionSelect: "optionSelect" }, host: { attributes: { "role": "option", "tabindex": "0" }, listeners: { "click": "onClick()", "keydown": "onKeydown($event)" }, properties: { "attr.disabled": "this.disabledAttr", "class.matcha-disabled": "this.disabledClass", "attr.aria-selected": "this.selected" }, classAttribute: "matcha-option" }, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true }); }
|
|
8572
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.0", type: MatchaOptionComponent, isStandalone: false, selector: "matcha-option", inputs: { value: "value", disabled: "disabled" }, outputs: { optionClick: "optionClick", optionSelect: "optionSelect" }, host: { attributes: { "role": "option", "tabindex": "0" }, listeners: { "click": "onClick()", "keydown": "onKeydown($event)" }, properties: { "attr.disabled": "this.disabledAttr", "class.matcha-option-disabled": "this.disabledClass", "attr.aria-selected": "this.selected" }, classAttribute: "matcha-option" }, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true }); }
|
|
8566
8573
|
}
|
|
8567
8574
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaOptionComponent, decorators: [{
|
|
8568
8575
|
type: Component,
|
|
@@ -8590,7 +8597,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImpor
|
|
|
8590
8597
|
args: ['attr.disabled']
|
|
8591
8598
|
}], disabledClass: [{
|
|
8592
8599
|
type: HostBinding,
|
|
8593
|
-
args: ['class.matcha-disabled']
|
|
8600
|
+
args: ['class.matcha-option-disabled']
|
|
8594
8601
|
}], selected: [{
|
|
8595
8602
|
type: HostBinding,
|
|
8596
8603
|
args: ['attr.aria-selected']
|
|
@@ -12209,24 +12216,14 @@ class MatchaAutocompleteTriggerDirective {
|
|
|
12209
12216
|
const target = ev.target;
|
|
12210
12217
|
const isInsideInput = this.el.nativeElement.contains(target) || this.el.nativeElement === target;
|
|
12211
12218
|
const isInsidePanel = this.panel?.elRef?.nativeElement?.contains?.(target);
|
|
12212
|
-
console.log('MatchaAutocomplete: Click outside check', {
|
|
12213
|
-
target: target,
|
|
12214
|
-
inputElement: this.el.nativeElement,
|
|
12215
|
-
isInsideInput,
|
|
12216
|
-
isInsidePanel,
|
|
12217
|
-
shouldClose: !isInsideInput && !isInsidePanel,
|
|
12218
|
-
panelOpen: this.panel?.open
|
|
12219
|
-
});
|
|
12220
12219
|
// Só fechar se o painel estiver aberto e clicou fora
|
|
12221
12220
|
return this.panel?.open && !isInsideInput && !isInsidePanel;
|
|
12222
12221
|
})).subscribe(() => {
|
|
12223
|
-
console.log('MatchaAutocomplete: Fechando painel por click outside');
|
|
12224
12222
|
this.panel.closePanel();
|
|
12225
12223
|
});
|
|
12226
12224
|
this.subs.add(clickSub);
|
|
12227
12225
|
// Escutar evento de seleção do autocomplete
|
|
12228
12226
|
const selectionSub = fromEvent(this.panel.elRef.nativeElement, 'matcha-autocomplete-selection').subscribe((event) => {
|
|
12229
|
-
console.log('MatchaAutocomplete: Evento de seleção recebido na diretiva', event.detail);
|
|
12230
12227
|
const { value, displayText } = event.detail;
|
|
12231
12228
|
if (value !== undefined) {
|
|
12232
12229
|
// Usar displayText se fornecido, senão usar o valor diretamente
|
|
@@ -12237,7 +12234,6 @@ class MatchaAutocompleteTriggerDirective {
|
|
|
12237
12234
|
this.subs.add(selectionSub);
|
|
12238
12235
|
// Escutar evento de limpeza
|
|
12239
12236
|
const clearSub = fromEvent(this.panel.elRef.nativeElement, 'matcha-autocomplete-clear').subscribe(() => {
|
|
12240
|
-
console.log('MatchaAutocomplete: Evento de limpeza recebido na diretiva');
|
|
12241
12237
|
this.clearInput();
|
|
12242
12238
|
});
|
|
12243
12239
|
this.subs.add(clearSub);
|
|
@@ -12268,11 +12264,9 @@ class MatchaAutocompleteTriggerDirective {
|
|
|
12268
12264
|
// Observar mudanças no FormControl para sincronizar o input com displayWith
|
|
12269
12265
|
if (this.ngControl && this.ngControl.control) {
|
|
12270
12266
|
const controlValueSub = this.ngControl.control.valueChanges.subscribe((value) => {
|
|
12271
|
-
console.log('MatchaAutocomplete: FormControl valor mudou', value);
|
|
12272
12267
|
// Se o valor é um objeto, usar displayWith para exibir no input
|
|
12273
12268
|
if (value && typeof value === 'object') {
|
|
12274
12269
|
const displayText = this.panel.getDisplayValue(value);
|
|
12275
|
-
console.log('MatchaAutocomplete: Atualizando input com displayWith', { value, displayText });
|
|
12276
12270
|
// Atualizar apenas o input visual, sem disparar eventos do FormControl
|
|
12277
12271
|
const input = this.el.nativeElement;
|
|
12278
12272
|
if (input.value !== displayText) {
|
|
@@ -12297,18 +12291,11 @@ class MatchaAutocompleteTriggerDirective {
|
|
|
12297
12291
|
}
|
|
12298
12292
|
}
|
|
12299
12293
|
writeValueToInput(displayText, actualValue) {
|
|
12300
|
-
console.log('MatchaAutocomplete: writeValueToInput chamado', {
|
|
12301
|
-
displayText,
|
|
12302
|
-
actualValue,
|
|
12303
|
-
input: this.el.nativeElement,
|
|
12304
|
-
hasNgControl: !!this.ngControl
|
|
12305
|
-
});
|
|
12306
12294
|
const input = this.el.nativeElement;
|
|
12307
12295
|
// Se há ngControl e actualValue é um objeto (não string), atualizar FormControl diretamente
|
|
12308
12296
|
if (this.ngControl && this.ngControl.control && actualValue !== undefined) {
|
|
12309
12297
|
// Se actualValue é um objeto, atualizar o FormControl com o objeto completo
|
|
12310
12298
|
if (typeof actualValue === 'object' && actualValue !== null) {
|
|
12311
|
-
console.log('MatchaAutocomplete: Atualizando FormControl com objeto', actualValue);
|
|
12312
12299
|
// Usar setValue com emitEvent: false para evitar loop infinito, depois emitir manualmente
|
|
12313
12300
|
this.ngControl.control.setValue(actualValue, { emitEvent: false });
|
|
12314
12301
|
// Atualizar o input visual com o displayText
|
|
@@ -12339,17 +12326,12 @@ class MatchaAutocompleteTriggerDirective {
|
|
|
12339
12326
|
setTimeout(() => {
|
|
12340
12327
|
this.updateClearButtonVisibility();
|
|
12341
12328
|
}, 0);
|
|
12342
|
-
console.log('MatchaAutocomplete: Valor escrito no input', {
|
|
12343
|
-
inputValue: input.value,
|
|
12344
|
-
formControlValue: this.ngControl?.control?.value
|
|
12345
|
-
});
|
|
12346
12329
|
}
|
|
12347
12330
|
clearInput() {
|
|
12348
12331
|
const input = this.el.nativeElement;
|
|
12349
12332
|
input.value = '';
|
|
12350
12333
|
// Se há ngControl, limpar o FormControl diretamente
|
|
12351
12334
|
if (this.ngControl && this.ngControl.control) {
|
|
12352
|
-
console.log('MatchaAutocomplete: Limpando FormControl');
|
|
12353
12335
|
this.ngControl.control.setValue(null, { emitEvent: true });
|
|
12354
12336
|
}
|
|
12355
12337
|
else {
|
|
@@ -12363,9 +12345,6 @@ class MatchaAutocompleteTriggerDirective {
|
|
|
12363
12345
|
}
|
|
12364
12346
|
// Atualizar visibilidade do botão
|
|
12365
12347
|
this.updateClearButtonVisibility();
|
|
12366
|
-
console.log('MatchaAutocomplete: Input limpo', {
|
|
12367
|
-
formControlValue: this.ngControl?.control?.value
|
|
12368
|
-
});
|
|
12369
12348
|
}
|
|
12370
12349
|
onClick() {
|
|
12371
12350
|
// Abrir painel quando clicar no input
|
|
@@ -12403,7 +12382,6 @@ class MatchaAutocompleteTriggerDirective {
|
|
|
12403
12382
|
const exactMatch = this.panel.findOptionByText(currentValue);
|
|
12404
12383
|
if (exactMatch) {
|
|
12405
12384
|
// Match exato encontrado - selecionar automaticamente
|
|
12406
|
-
console.log('MatchaAutocomplete: Match exato encontrado no blur, selecionando automaticamente');
|
|
12407
12385
|
this.panel.selectOption(exactMatch);
|
|
12408
12386
|
// Emitir evento de auto-seleção
|
|
12409
12387
|
this.panel.autoSelected.emit(exactMatch.value);
|
|
@@ -12412,14 +12390,12 @@ class MatchaAutocompleteTriggerDirective {
|
|
|
12412
12390
|
}
|
|
12413
12391
|
else {
|
|
12414
12392
|
// Nenhum match exato - limpar o campo
|
|
12415
|
-
console.log('MatchaAutocomplete: Nenhum match exato encontrado no blur, limpando campo');
|
|
12416
12393
|
this.panel.clearSelection();
|
|
12417
12394
|
}
|
|
12418
12395
|
}
|
|
12419
12396
|
else if (currentValue === '' || !currentValue) {
|
|
12420
12397
|
// Campo vazio - limpar seleção se houver
|
|
12421
12398
|
if (this.panel.hasSelection()) {
|
|
12422
|
-
console.log('MatchaAutocomplete: Campo vazio no blur, limpando seleção');
|
|
12423
12399
|
this.panel.clearSelection();
|
|
12424
12400
|
}
|
|
12425
12401
|
}
|