import { ChangeDetectionStrategy, Component, ContentChild, Input, ViewEncapsulation } from '@angular/core';
import { fadeInLinearAnimation } from '@angular-ru/cdk/animations';
import { AbstractModalViewLayerDirective } from '../../directives/abstract-modal-view-layer.directive';
import { NgxFilterDirective } from '../../directives/ngx-filter.directive';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
function NgxFilterComponent_div_0_Template(rf, ctx) { if (rf & 1) {
    const _r3 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "div", 2);
    i0.ɵɵlistener("click", function NgxFilterComponent_div_0_Template_div_click_0_listener() { i0.ɵɵrestoreView(_r3); const ctx_r2 = i0.ɵɵnextContext(); return ctx_r2.close(); })("contextmenu", function NgxFilterComponent_div_0_Template_div_contextmenu_0_listener() { i0.ɵɵrestoreView(_r3); const ctx_r4 = i0.ɵɵnextContext(); return ctx_r4.close(); });
    i0.ɵɵelementEnd();
} }
const _c0 = function (a0, a1, a2, a3, a4, a5) { return { "width.px": a0, "min-height.px": a1, "max-height.px": a2, "top.px": a3, "left.px": a4, visibility: a5 }; };
function NgxFilterComponent_div_1_Template(rf, ctx) { if (rf & 1) {
    const _r6 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "div", 3);
    i0.ɵɵelementStart(1, "div", 4);
    i0.ɵɵlistener("contextmenu", function NgxFilterComponent_div_1_Template_div_contextmenu_1_listener() { i0.ɵɵrestoreView(_r6); const ctx_r5 = i0.ɵɵnextContext(); return ctx_r5.close(); });
    i0.ɵɵelementStart(2, "div", 5);
    i0.ɵɵlistener("click", function NgxFilterComponent_div_1_Template_div_click_2_listener() { i0.ɵɵrestoreView(_r6); const ctx_r7 = i0.ɵɵnextContext(); return ctx_r7.closeFilter(); });
    i0.ɵɵelementEnd();
    i0.ɵɵprojection(3);
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext();
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngStyle", i0.ɵɵpureFunction6(1, _c0, ctx_r1.width, ctx_r1.height, ctx_r1.maxHeight, (ctx_r1.state == null ? null : ctx_r1.state.position == null ? null : ctx_r1.state.position.top) + ctx_r1.leftX - ctx_r1.overflowY, (ctx_r1.state == null ? null : ctx_r1.state.position == null ? null : ctx_r1.state.position.left) - ctx_r1.topY - ctx_r1.overflowX, (ctx_r1.state == null ? null : ctx_r1.state.position) ? "visible" : "hidden"));
} }
const _c1 = ["*"];
const FILTER_WIDTH = 300;
const FILTER_MIN_LEFT_X = 10;
const FILTER_MIN_TOP_Y = 50;
export class NgxFilterComponent extends AbstractModalViewLayerDirective {
    constructor() {
        super(...arguments);
        this.width = FILTER_WIDTH;
        this.height = null;
        // eslint-disable-next-line @angular-eslint/no-input-rename
        this.maxHeight = null;
        this.leftX = FILTER_MIN_LEFT_X;
        this.topY = FILTER_MIN_TOP_Y;
    }
    get state() {
        return this.filterable.state;
    }
    closeFilter() {
        this.filterable.closeFilter();
    }
    close() {
        this.closeFilter();
    }
    ngOnInit() {
        this.subscription = this.filterable.filterOpenEvents$.subscribe(() => this.update());
    }
}
/** @nocollapse */ /** @nocollapse */ NgxFilterComponent.ɵfac = /** @pureOrBreakMyCode */ function () { let ɵNgxFilterComponent_BaseFactory; return function NgxFilterComponent_Factory(t) { return (ɵNgxFilterComponent_BaseFactory || (ɵNgxFilterComponent_BaseFactory = i0.ɵɵgetInheritedFactory(NgxFilterComponent)))(t || NgxFilterComponent); }; }();
/** @nocollapse */ /** @nocollapse */ NgxFilterComponent.ɵcmp = /** @pureOrBreakMyCode */ i0.ɵɵdefineComponent({ type: NgxFilterComponent, selectors: [["ngx-filter"]], contentQueries: function NgxFilterComponent_ContentQueries(rf, ctx, dirIndex) { if (rf & 1) {
        i0.ɵɵcontentQuery(dirIndex, NgxFilterDirective, 5);
    } if (rf & 2) {
        let _t;
        i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.filter = _t.first);
    } }, inputs: { width: "width", height: "height", maxHeight: ["max-height", "maxHeight"] }, features: [i0.ɵɵInheritDefinitionFeature], ngContentSelectors: _c1, decls: 2, vars: 2, consts: [["class", "table-grid__background-flat", 3, "click", "contextmenu", 4, "ngIf"], ["class", "table-grid__filter-menu", 4, "ngIf"], [1, "table-grid__background-flat", 3, "click", "contextmenu"], [1, "table-grid__filter-menu"], [1, "filter-menu", 3, "ngStyle", "contextmenu"], [1, "table-close__button", 3, "click"]], template: function NgxFilterComponent_Template(rf, ctx) { if (rf & 1) {
        i0.ɵɵprojectionDef();
        i0.ɵɵtemplate(0, NgxFilterComponent_div_0_Template, 1, 0, "div", 0);
        i0.ɵɵtemplate(1, NgxFilterComponent_div_1_Template, 4, 8, "div", 1);
    } if (rf & 2) {
        i0.ɵɵproperty("ngIf", ctx.state == null ? null : ctx.state.opened);
        i0.ɵɵadvance(1);
        i0.ɵɵproperty("ngIf", ctx.state == null ? null : ctx.state.opened);
    } }, directives: [i1.NgIf, i1.NgStyle], styles: [".table-grid__filter-menu .filter-menu{display:flex;position:fixed;background:#fff;z-index:10000;border:1px solid #dcdcdc;box-shadow:1px 1px 2px #9c9c9c;flex-direction:column}.table-grid__filter-menu .filter-menu .table-close__button{top:-10px;right:-10px}\n"], encapsulation: 2, data: { animation: [fadeInLinearAnimation] }, changeDetection: 0 });
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(NgxFilterComponent, [{
        type: Component,
        args: [{
                selector: 'ngx-filter',
                templateUrl: './ngx-filter.component.html',
                styleUrls: ['./ngx-filter.component.scss'],
                changeDetection: ChangeDetectionStrategy.OnPush,
                encapsulation: ViewEncapsulation.None,
                animations: [fadeInLinearAnimation]
            }]
    }], null, { width: [{
            type: Input
        }], height: [{
            type: Input
        }], maxHeight: [{
            type: Input,
            args: ['max-height']
        }], filter: [{
            type: ContentChild,
            args: [NgxFilterDirective, { static: false }]
        }] }); })();
//# sourceMappingURL=data:application/json;base64, 