import { Component, Input, Output, EventEmitter } from '@angular/core';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
import * as i2 from "@angular/material/list";
import * as i3 from "@angular/material/tooltip";
import * as i4 from "@angular/material/icon";
import * as i5 from "../../../axo-utils/search-pipe";
function AttributesSelectionLayoutComponent_mat_selection_list_1_ng_container_2_mat_list_option_1_Template(rf, ctx) { if (rf & 1) {
    const _r7 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "mat-list-option", 5);
    i0.ɵɵlistener("selectedChange", function AttributesSelectionLayoutComponent_mat_selection_list_1_ng_container_2_mat_list_option_1_Template_mat_list_option_selectedChange_0_listener($event) { i0.ɵɵrestoreView(_r7); const attribute_r3 = i0.ɵɵnextContext().$implicit; return attribute_r3.isSelected = $event; });
    i0.ɵɵelementStart(1, "span", 6);
    i0.ɵɵelement(2, "mat-icon", 7);
    i0.ɵɵtext(3);
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const attribute_r3 = i0.ɵɵnextContext().$implicit;
    i0.ɵɵproperty("value", attribute_r3)("selected", attribute_r3.isSelected);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("matTooltip", attribute_r3.label);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("svgIcon", attribute_r3.enlightenType.matIcon);
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate1(" ", attribute_r3.label, "");
} }
function AttributesSelectionLayoutComponent_mat_selection_list_1_ng_container_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵtemplate(1, AttributesSelectionLayoutComponent_mat_selection_list_1_ng_container_2_mat_list_option_1_Template, 4, 5, "mat-list-option", 4);
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    const attribute_r3 = ctx.$implicit;
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", !attribute_r3.isHidden);
} }
function AttributesSelectionLayoutComponent_mat_selection_list_1_Template(rf, ctx) { if (rf & 1) {
    const _r10 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "mat-selection-list", 1, 2);
    i0.ɵɵlistener("selectionChange", function AttributesSelectionLayoutComponent_mat_selection_list_1_Template_mat_selection_list_selectionChange_0_listener($event) { i0.ɵɵrestoreView(_r10); const ctx_r9 = i0.ɵɵnextContext(); return ctx_r9.attributeSelectionChange($event); });
    i0.ɵɵtemplate(2, AttributesSelectionLayoutComponent_mat_selection_list_1_ng_container_2_Template, 2, 1, "ng-container", 3);
    i0.ɵɵpipe(3, "search");
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("ngForOf", i0.ɵɵpipeBind2(3, 1, ctx_r0.attributes, ctx_r0.searchedTerm));
} }
export class AttributesSelectionLayoutComponent {
    // **------------< Component Variables >----------*>
    /**
     * Constructor
     */
    constructor() {
        this.searchedTerm = '';
        // <----------< Output Emitter>-------------------->
        this.attributeSelected = new EventEmitter();
        this.attributeDeselected = new EventEmitter();
    }
    // On Init Life cycle hook
    ngOnInit() {
    }
    /***
     * attributeSelectionChange get called on checkbox selection change.
     * @param event
     */
    attributeSelectionChange(event) {
        if (event.option.selected) {
            this.attributeSelected.emit(event.option.value);
        }
        else {
            this.attributeDeselected.emit(event.option.value);
        }
    }
}
AttributesSelectionLayoutComponent.ɵfac = function AttributesSelectionLayoutComponent_Factory(t) { return new (t || AttributesSelectionLayoutComponent)(); };
AttributesSelectionLayoutComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: AttributesSelectionLayoutComponent, selectors: [["lib-attributes-selection-layout"]], inputs: { attributes: "attributes", searchedTerm: "searchedTerm", selectedAttribute: "selectedAttribute" }, outputs: { attributeSelected: "attributeSelected", attributeDeselected: "attributeDeselected" }, decls: 3, vars: 4, consts: [[3, "selectionChange", 4, "ngIf"], [3, "selectionChange"], ["filters", ""], [4, "ngFor", "ngForOf"], ["checkboxPosition", "after", "color", "primary", 3, "value", "selected", "selectedChange", 4, "ngIf"], ["checkboxPosition", "after", "color", "primary", 3, "value", "selected", "selectedChange"], [1, "list-field", 3, "matTooltip"], [1, "svg-icon", "mr-2", 3, "svgIcon"]], template: function AttributesSelectionLayoutComponent_Template(rf, ctx) { if (rf & 1) {
        i0.ɵɵelementStart(0, "div");
        i0.ɵɵtemplate(1, AttributesSelectionLayoutComponent_mat_selection_list_1_Template, 4, 4, "mat-selection-list", 0);
        i0.ɵɵpipe(2, "search");
        i0.ɵɵelementEnd();
    } if (rf & 2) {
        let tmp_0_0;
        i0.ɵɵadvance(1);
        i0.ɵɵproperty("ngIf", ((tmp_0_0 = i0.ɵɵpipeBind2(2, 1, ctx.attributes, ctx.searchedTerm)) == null ? null : tmp_0_0.length) > 0);
    } }, directives: [i1.NgIf, i2.MatSelectionList, i1.NgForOf, i2.MatListOption, i3.MatTooltip, i4.MatIcon], pipes: [i5.SearchPipe], styles: [""] });
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AttributesSelectionLayoutComponent, [{
        type: Component,
        args: [{ selector: 'lib-attributes-selection-layout', template: "<div>\n    <mat-selection-list #filters *ngIf=\"(attributes | search: searchedTerm)?.length > 0\"\n    (selectionChange)=\"attributeSelectionChange($event)\">\n        <ng-container *ngFor=\"let attribute of attributes| search: searchedTerm\">\n            <mat-list-option *ngIf=\"!attribute.isHidden\" checkboxPosition=\"after\"   [value]='attribute' [(selected)]=\"attribute.isSelected\" color=\"primary\">\n                <span class=\"list-field\" [matTooltip]=\"attribute.label\" ><mat-icon class=\"svg-icon mr-2\" [svgIcon]=\"attribute.enlightenType.matIcon\"></mat-icon> {{attribute.label}}</span>\n            </mat-list-option>\n        </ng-container>\n    </mat-selection-list>\n</div>\n", styles: [""] }]
    }], function () { return []; }, { attributes: [{
            type: Input
        }], searchedTerm: [{
            type: Input
        }], selectedAttribute: [{
            type: Input
        }], attributeSelected: [{
            type: Output
        }], attributeDeselected: [{
            type: Output
        }] }); })();
//# sourceMappingURL=data:application/json;base64, 