matcha-components 20.64.0 → 20.65.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.
|
@@ -9647,6 +9647,24 @@ class MatchaChipComponent {
|
|
|
9647
9647
|
/** Evento emitido quando o chip é destruído */
|
|
9648
9648
|
this.destroyed = new EventEmitter();
|
|
9649
9649
|
}
|
|
9650
|
+
ngAfterViewInit() {
|
|
9651
|
+
this._setupChipRemoveDirective();
|
|
9652
|
+
}
|
|
9653
|
+
_setupChipRemoveDirective() {
|
|
9654
|
+
// Usa event delegation para capturar cliques em elementos com matchaChipRemove
|
|
9655
|
+
this._elementRef.nativeElement.addEventListener('click', (event) => {
|
|
9656
|
+
const target = event.target;
|
|
9657
|
+
if (target && target.hasAttribute('matchaChipRemove')) {
|
|
9658
|
+
event.stopPropagation();
|
|
9659
|
+
if (this.removable && !this.disabled) {
|
|
9660
|
+
this.remove();
|
|
9661
|
+
}
|
|
9662
|
+
}
|
|
9663
|
+
});
|
|
9664
|
+
}
|
|
9665
|
+
hasCustomRemoveIcon() {
|
|
9666
|
+
return this._elementRef.nativeElement.querySelector('[matchaChipRemove]') !== null;
|
|
9667
|
+
}
|
|
9650
9668
|
/** Manipula o clique no chip */
|
|
9651
9669
|
_handleClick(event) {
|
|
9652
9670
|
if (this.disabled) {
|
|
@@ -9699,11 +9717,11 @@ class MatchaChipComponent {
|
|
|
9699
9717
|
this.destroyed.emit(this);
|
|
9700
9718
|
}
|
|
9701
9719
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: MatchaChipComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
9702
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.7", type: MatchaChipComponent, isStandalone: false, selector: "matcha-chip", inputs: { color: "color", selected: "selected", selectable: "selectable", removable: "removable", disabled: "disabled", value: "value" }, outputs: { selectedChange: "selectedChange", removed: "removed", destroyed: "destroyed" }, host: { listeners: { "click": "_handleClick($event)", "keydown": "_handleKeydown($event)" }, properties: { "class": "this.hostClasses" } }, ngImport: i0, template: "<span class=\"matcha-chip-content fs-14 fw-700 lh-20 color-label\">\n <ng-content></ng-content>\n</span>\n<ng-container *ngIf=\"removable\">\n <matcha-divider direction=\"vertical\" gap=\"0\"></matcha-divider>\n <button \n
|
|
9720
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.7", type: MatchaChipComponent, isStandalone: false, selector: "matcha-chip", inputs: { color: "color", selected: "selected", selectable: "selectable", removable: "removable", disabled: "disabled", value: "value" }, outputs: { selectedChange: "selectedChange", removed: "removed", destroyed: "destroyed" }, host: { listeners: { "click": "_handleClick($event)", "keydown": "_handleKeydown($event)" }, properties: { "class": "this.hostClasses" } }, ngImport: i0, template: "<span class=\"matcha-chip-content fs-14 fw-700 lh-20 color-label\">\n <ng-content></ng-content>\n</span>\n<ng-container *ngIf=\"removable && !hasCustomRemoveIcon()\">\n <matcha-divider direction=\"vertical\" gap=\"0\"></matcha-divider>\n <button \n type=\"button\"\n class=\"matcha-chip-remove d-flex align-items-center justify-content-center w-20 h-20 min-w-20 radius-full cursor-pointer border-0 background-transparent p-0 m-0\"\n [disabled]=\"disabled\"\n (click)=\"remove(); $event.stopPropagation()\"\n tabindex=\"-1\"\n aria-label=\"Remove\">\n <matcha-icon name=\"close\" class=\"fs-14\" color=\"label\"></matcha-icon>\n </button>\n</ng-container>\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: MatchaDividerComponent, selector: "matcha-divider", inputs: ["gap", "gap-sm", "gap-md", "gap-lg", "gap-xl", "direction"] }, { kind: "component", type: MatchaIconComponent, selector: "matcha-icon", inputs: ["name", "size", "color", "class", "loading"] }] }); }
|
|
9703
9721
|
}
|
|
9704
9722
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: MatchaChipComponent, decorators: [{
|
|
9705
9723
|
type: Component,
|
|
9706
|
-
args: [{ selector: 'matcha-chip', standalone: false, template: "<span class=\"matcha-chip-content fs-14 fw-700 lh-20 color-label\">\n <ng-content></ng-content>\n</span>\n<ng-container *ngIf=\"removable\">\n <matcha-divider direction=\"vertical\" gap=\"0\"></matcha-divider>\n <button \n
|
|
9724
|
+
args: [{ selector: 'matcha-chip', standalone: false, template: "<span class=\"matcha-chip-content fs-14 fw-700 lh-20 color-label\">\n <ng-content></ng-content>\n</span>\n<ng-container *ngIf=\"removable && !hasCustomRemoveIcon()\">\n <matcha-divider direction=\"vertical\" gap=\"0\"></matcha-divider>\n <button \n type=\"button\"\n class=\"matcha-chip-remove d-flex align-items-center justify-content-center w-20 h-20 min-w-20 radius-full cursor-pointer border-0 background-transparent p-0 m-0\"\n [disabled]=\"disabled\"\n (click)=\"remove(); $event.stopPropagation()\"\n tabindex=\"-1\"\n aria-label=\"Remove\">\n <matcha-icon name=\"close\" class=\"fs-14\" color=\"label\"></matcha-icon>\n </button>\n</ng-container>\n" }]
|
|
9707
9725
|
}], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { color: [{
|
|
9708
9726
|
type: Input
|
|
9709
9727
|
}], selected: [{
|
|
@@ -9797,7 +9815,11 @@ class MatchaChipListComponent {
|
|
|
9797
9815
|
const selectedChangeSub = chip.selectedChange.subscribe(() => {
|
|
9798
9816
|
this._onChipSelectionChange(chip);
|
|
9799
9817
|
});
|
|
9800
|
-
|
|
9818
|
+
// Listener para remoção
|
|
9819
|
+
const removedSub = chip.removed.subscribe(() => {
|
|
9820
|
+
this._onChipRemoved(chip, index);
|
|
9821
|
+
});
|
|
9822
|
+
this._chipSubscriptions.push(selectedChangeSub, removedSub);
|
|
9801
9823
|
});
|
|
9802
9824
|
}
|
|
9803
9825
|
/** Limpa as subscrições dos chips */
|
|
@@ -9821,6 +9843,10 @@ class MatchaChipListComponent {
|
|
|
9821
9843
|
this._updateValue();
|
|
9822
9844
|
this.onTouched();
|
|
9823
9845
|
}
|
|
9846
|
+
/** Manipula a remoção de um chip */
|
|
9847
|
+
_onChipRemoved(chip, index) {
|
|
9848
|
+
this._updateValue();
|
|
9849
|
+
}
|
|
9824
9850
|
/** Atualiza o valor baseado nos chips selecionados */
|
|
9825
9851
|
_updateValue() {
|
|
9826
9852
|
if (this.multiple) {
|