import { Component, Output, EventEmitter, ContentChildren, QueryList, forwardRef, ViewChild, } from "@angular/core"; import { ChipHostDirective } from "./chip-host"; import { SamFilterDrawerItemComponent } from "./filter-drawer-item"; @Component({ selector: "sam-filter-drawer", templateUrl: "filter-drawer.template.html", standalone: false, }) export class SamFilterDrawerComponent { /** * Event emitter for the 'clear' event */ @Output() public clear = new EventEmitter(); @ViewChild(forwardRef(() => ChipHostDirective), { static: true }) public chips: ChipHostDirective; @ContentChildren(forwardRef(() => SamFilterDrawerItemComponent)) public items: QueryList; public get showClear(): boolean { if (!this.usingDirective) { return this.items.length > 0; } else { return this._showClear; } } public set showClear(value: boolean) { this._showClear = value; } public usingDirective = false; private _showClear = false; }