matcha-components 20.47.0 → 20.48.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.
|
@@ -7867,6 +7867,10 @@ class MatchaOptionComponent {
|
|
|
7867
7867
|
get nativeElement() {
|
|
7868
7868
|
return this.elRef.nativeElement;
|
|
7869
7869
|
}
|
|
7870
|
+
// Método público para obter o texto interno da opção
|
|
7871
|
+
getTextContent() {
|
|
7872
|
+
return this.elRef.nativeElement.textContent?.trim() || '';
|
|
7873
|
+
}
|
|
7870
7874
|
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 }); }
|
|
7871
7875
|
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.aria-selected": "this.selected" }, classAttribute: "matcha-option" }, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true }); }
|
|
7872
7876
|
}
|
|
@@ -8334,6 +8338,7 @@ class MatchaSelectComponent {
|
|
|
8334
8338
|
this.cdr = cdr;
|
|
8335
8339
|
// Armazenar o valor selecionado independente da QueryList
|
|
8336
8340
|
this.selectedValue = undefined;
|
|
8341
|
+
this.selectedLabel = '';
|
|
8337
8342
|
// Configurações do painel
|
|
8338
8343
|
this.placement = 'auto';
|
|
8339
8344
|
this.maxHeight = 280;
|
|
@@ -8577,6 +8582,8 @@ class MatchaSelectComponent {
|
|
|
8577
8582
|
return;
|
|
8578
8583
|
// Atualizar o valor selecionado
|
|
8579
8584
|
this.selectedValue = option.value;
|
|
8585
|
+
// Armazenar o label (texto interno) da opção selecionada
|
|
8586
|
+
this.selectedLabel = option.getTextContent();
|
|
8580
8587
|
// Marcar a opção como selecionada
|
|
8581
8588
|
option.selected = true;
|
|
8582
8589
|
// Marcar todas as outras como não selecionadas
|
|
@@ -8643,6 +8650,8 @@ class MatchaSelectComponent {
|
|
|
8643
8650
|
});
|
|
8644
8651
|
// Armazenar o valor selecionado
|
|
8645
8652
|
this.selectedValue = option.value;
|
|
8653
|
+
// Armazenar o label (texto interno) da opção selecionada
|
|
8654
|
+
this.selectedLabel = option.getTextContent();
|
|
8646
8655
|
// Marcar a opção como selecionada diretamente
|
|
8647
8656
|
option.selected = true;
|
|
8648
8657
|
// Marcar todas as outras como não selecionadas
|
|
@@ -8680,6 +8689,10 @@ class MatchaSelectComponent {
|
|
|
8680
8689
|
});
|
|
8681
8690
|
return value;
|
|
8682
8691
|
}
|
|
8692
|
+
getSelectedLabel() {
|
|
8693
|
+
// Retorna o label armazenado ou placeholder
|
|
8694
|
+
return this.selectedLabel || '';
|
|
8695
|
+
}
|
|
8683
8696
|
// Método para definir valor programaticamente
|
|
8684
8697
|
setValue(value) {
|
|
8685
8698
|
this.selectedValue = value;
|
|
@@ -8688,12 +8701,23 @@ class MatchaSelectComponent {
|
|
|
8688
8701
|
// Método para limpar seleção
|
|
8689
8702
|
clearSelection() {
|
|
8690
8703
|
this.selectedValue = undefined;
|
|
8704
|
+
this.selectedLabel = '';
|
|
8691
8705
|
this.options.forEach(o => o.selected = false);
|
|
8692
8706
|
this.cdr.detectChanges();
|
|
8693
8707
|
}
|
|
8694
8708
|
// ControlValueAccessor implementation
|
|
8695
8709
|
writeValue(value) {
|
|
8696
8710
|
this.selectedValue = value;
|
|
8711
|
+
// Atualizar o label quando o valor é definido programaticamente
|
|
8712
|
+
if (value !== undefined && value !== null) {
|
|
8713
|
+
const selectedOption = this.options?.find(o => o.value === value);
|
|
8714
|
+
if (selectedOption) {
|
|
8715
|
+
this.selectedLabel = selectedOption.getTextContent();
|
|
8716
|
+
}
|
|
8717
|
+
}
|
|
8718
|
+
else {
|
|
8719
|
+
this.selectedLabel = '';
|
|
8720
|
+
}
|
|
8697
8721
|
this.cdr.detectChanges();
|
|
8698
8722
|
}
|
|
8699
8723
|
registerOnChange(fn) {
|
|
@@ -8713,7 +8737,7 @@ class MatchaSelectComponent {
|
|
|
8713
8737
|
useExisting: forwardRef(() => MatchaSelectComponent),
|
|
8714
8738
|
multi: true
|
|
8715
8739
|
}
|
|
8716
|
-
], queries: [{ propertyName: "options", predicate: MatchaOptionComponent, descendants: true }], viewQueries: [{ propertyName: "panel", first: true, predicate: MatchaPanelComponent, descendants: true }], ngImport: i0, template: "<div class=\"matcha-select-container\" [class.matcha-select-disabled]=\"disabled || isDisabled\">\n <div\n class=\"matcha-select-trigger\"\n [class.matcha-select-open]=\"open\"\n [class.matcha-select-disabled]=\"disabled || isDisabled\"\n (click)=\"onTriggerClick()\"\n [attr.tabindex]=\"(disabled || isDisabled) ? -1 : 0\"\n role=\"combobox\"\n [attr.aria-expanded]=\"open\"\n [attr.aria-haspopup]=\"true\"\n [attr.aria-disabled]=\"disabled || isDisabled\">\n\n <span class=\"matcha-select-value\" [class.matcha-select-placeholder]=\"!selectedValue\">\n {{
|
|
8740
|
+
], queries: [{ propertyName: "options", predicate: MatchaOptionComponent, descendants: true }], viewQueries: [{ propertyName: "panel", first: true, predicate: MatchaPanelComponent, descendants: true }], ngImport: i0, template: "<div class=\"matcha-select-container\" [class.matcha-select-disabled]=\"disabled || isDisabled\">\n <div\n class=\"matcha-select-trigger\"\n [class.matcha-select-open]=\"open\"\n [class.matcha-select-disabled]=\"disabled || isDisabled\"\n (click)=\"onTriggerClick()\"\n [attr.tabindex]=\"(disabled || isDisabled) ? -1 : 0\"\n role=\"combobox\"\n [attr.aria-expanded]=\"open\"\n [attr.aria-haspopup]=\"true\"\n [attr.aria-disabled]=\"disabled || isDisabled\">\n\n <span class=\"matcha-select-value\" [class.matcha-select-placeholder]=\"!selectedValue\">\n {{ getSelectedLabel() || placeholder }}\n </span>\n\n <span class=\"matcha-select-arrow\" [class.matcha-select-arrow-open]=\"open\">\n <span class=\"i-matcha-arrow-down\"></span>\n </span>\n </div>\n\n <matcha-panel\n #panel\n [placement]=\"placement\"\n [maxHeight]=\"maxHeight\"\n [minWidth]=\"minWidth\"\n [open]=\"open\">\n <ng-content></ng-content>\n </matcha-panel>\n</div>\n", styles: [""], dependencies: [{ kind: "component", type: MatchaPanelComponent, selector: "matcha-panel", inputs: ["placement", "maxHeight", "minWidth", "offset", "triggerElement", "open"], outputs: ["opened", "closed"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
8717
8741
|
}
|
|
8718
8742
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaSelectComponent, decorators: [{
|
|
8719
8743
|
type: Component,
|
|
@@ -8723,7 +8747,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImpor
|
|
|
8723
8747
|
useExisting: forwardRef(() => MatchaSelectComponent),
|
|
8724
8748
|
multi: true
|
|
8725
8749
|
}
|
|
8726
|
-
], template: "<div class=\"matcha-select-container\" [class.matcha-select-disabled]=\"disabled || isDisabled\">\n <div\n class=\"matcha-select-trigger\"\n [class.matcha-select-open]=\"open\"\n [class.matcha-select-disabled]=\"disabled || isDisabled\"\n (click)=\"onTriggerClick()\"\n [attr.tabindex]=\"(disabled || isDisabled) ? -1 : 0\"\n role=\"combobox\"\n [attr.aria-expanded]=\"open\"\n [attr.aria-haspopup]=\"true\"\n [attr.aria-disabled]=\"disabled || isDisabled\">\n\n <span class=\"matcha-select-value\" [class.matcha-select-placeholder]=\"!selectedValue\">\n {{
|
|
8750
|
+
], template: "<div class=\"matcha-select-container\" [class.matcha-select-disabled]=\"disabled || isDisabled\">\n <div\n class=\"matcha-select-trigger\"\n [class.matcha-select-open]=\"open\"\n [class.matcha-select-disabled]=\"disabled || isDisabled\"\n (click)=\"onTriggerClick()\"\n [attr.tabindex]=\"(disabled || isDisabled) ? -1 : 0\"\n role=\"combobox\"\n [attr.aria-expanded]=\"open\"\n [attr.aria-haspopup]=\"true\"\n [attr.aria-disabled]=\"disabled || isDisabled\">\n\n <span class=\"matcha-select-value\" [class.matcha-select-placeholder]=\"!selectedValue\">\n {{ getSelectedLabel() || placeholder }}\n </span>\n\n <span class=\"matcha-select-arrow\" [class.matcha-select-arrow-open]=\"open\">\n <span class=\"i-matcha-arrow-down\"></span>\n </span>\n </div>\n\n <matcha-panel\n #panel\n [placement]=\"placement\"\n [maxHeight]=\"maxHeight\"\n [minWidth]=\"minWidth\"\n [open]=\"open\">\n <ng-content></ng-content>\n </matcha-panel>\n</div>\n" }]
|
|
8727
8751
|
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }], propDecorators: { options: [{
|
|
8728
8752
|
type: ContentChildren,
|
|
8729
8753
|
args: [MatchaOptionComponent, { descendants: true }]
|