/* eslint-disable @angular-eslint/no-input-rename */
import { ChangeDetectionStrategy, Component, Input, ViewEncapsulation } from '@angular/core';
import { detectChanges } from '@angular-ru/cdk/utils';
import { AbstractModalViewLayerDirective } from '../../directives/abstract-modal-view-layer.directive';
import { MINIMAL_TIMEOUT } from '../../table-builder.properties';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
function NgxContextMenuComponent_div_0_Template(rf, ctx) { if (rf & 1) {
    const _r3 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "div", 2);
    i0.ɵɵlistener("click", function NgxContextMenuComponent_div_0_Template_div_click_0_listener($event) { i0.ɵɵrestoreView(_r3); const ctx_r2 = i0.ɵɵnextContext(); return ctx_r2.close($event); })("contextmenu", function NgxContextMenuComponent_div_0_Template_div_contextmenu_0_listener($event) { i0.ɵɵrestoreView(_r3); const ctx_r4 = i0.ɵɵnextContext(); return ctx_r4.close($event); });
    i0.ɵɵelementEnd();
} }
const _c0 = function (a0, a1, a2, a3, a4, a5, a6) { return { "width.px": a0, opacity: a1, "max-height.px": a2, "min-height.px": a3, "top.px": a4, "left.px": a5, visibility: a6 }; };
function NgxContextMenuComponent_div_1_Template(rf, ctx) { if (rf & 1) {
    const _r7 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "div", 3);
    i0.ɵɵelementStart(1, "div", 4, 5);
    i0.ɵɵlistener("contextmenu", function NgxContextMenuComponent_div_1_Template_div_contextmenu_1_listener($event) { i0.ɵɵrestoreView(_r7); const ctx_r6 = i0.ɵɵnextContext(); return ctx_r6.close($event); });
    i0.ɵɵprojection(3);
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const _r5 = i0.ɵɵreference(2);
    const ctx_r1 = i0.ɵɵnextContext();
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngStyle", i0.ɵɵpureFunction7(1, _c0, ctx_r1.width, ctx_r1.isShowed ? 1 : 0, ctx_r1.isRendered ? ctx_r1.maxHeight : 0, ctx_r1.isRendered ? ctx_r1.minHeight : 0, (ctx_r1.state == null ? null : ctx_r1.state.position == null ? null : ctx_r1.state.position.top) - ctx_r1.overflowY, (ctx_r1.state == null ? null : ctx_r1.state.position == null ? null : ctx_r1.state.position.left) - ctx_r1.overflowX, ctx_r1.isRendered && ((_r5 == null ? null : _r5.offsetHeight) || 0 > 10) ? "visible" : "hidden"));
} }
const _c1 = ["*"];
const SIZE = 300;
const MAX_HEIGHT = 400;
export class NgxContextMenuComponent extends AbstractModalViewLayerDirective {
    constructor() {
        super(...arguments);
        this.width = SIZE;
        this.height = SIZE;
        this.maxHeight = MAX_HEIGHT;
    }
    get state() {
        return this.contextMenu.state;
    }
    ngOnInit() {
        this.subscription = this.contextMenu.events$.subscribe(() => this.update());
    }
    close(event) {
        this.isShowed = false;
        detectChanges(this.cd);
        this.ngZone.runOutsideAngular(() => {
            // eslint-disable-next-line no-restricted-properties
            window.setTimeout(() => {
                this.contextMenu.close();
                event.preventDefault();
            }, MINIMAL_TIMEOUT);
        });
    }
}
/** @nocollapse */ /** @nocollapse */ NgxContextMenuComponent.ɵfac = /** @pureOrBreakMyCode */ function () { let ɵNgxContextMenuComponent_BaseFactory; return function NgxContextMenuComponent_Factory(t) { return (ɵNgxContextMenuComponent_BaseFactory || (ɵNgxContextMenuComponent_BaseFactory = i0.ɵɵgetInheritedFactory(NgxContextMenuComponent)))(t || NgxContextMenuComponent); }; }();
/** @nocollapse */ /** @nocollapse */ NgxContextMenuComponent.ɵcmp = /** @pureOrBreakMyCode */ i0.ɵɵdefineComponent({ type: NgxContextMenuComponent, selectors: [["ngx-context-menu"]], 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__context-menu", 4, "ngIf"], [1, "table-grid__background-flat", 3, "click", "contextmenu"], [1, "table-grid__context-menu"], [1, "context-menu", 3, "ngStyle", "contextmenu"], ["menu", ""]], template: function NgxContextMenuComponent_Template(rf, ctx) { if (rf & 1) {
        i0.ɵɵprojectionDef();
        i0.ɵɵtemplate(0, NgxContextMenuComponent_div_0_Template, 1, 0, "div", 0);
        i0.ɵɵtemplate(1, NgxContextMenuComponent_div_1_Template, 4, 9, "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: ["@keyframes delayedShow{to{visibility:visible}}.table-grid__context-menu .context-menu{display:flex;position:fixed;z-index:100;border:1px solid #dcdcdc;flex-direction:column;visibility:hidden;transition:opacity .3s;min-height:0;max-height:0;overflow:visible;overflow:initial;background:white;box-shadow:rgba(60,64,67,.3) 0 1px 2px,rgba(60,64,67,.15) 0 1px 3px 1px;box-sizing:border-box;border-radius:4px;opacity:0;font-family:Lucida Grande,sans-serif}.table-grid__context-menu .context-menu__item{margin-top:0;height:48px;line-height:16px;font-size:14px;font-weight:500;display:flex;flex-flow:row;box-sizing:border-box;padding:0 16px 0 23px;align-items:center;justify-content:space-between}.table-grid__context-menu .context-menu__item .content{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;text-align:left}.table-grid__context-menu .context-menu__item .content.align-center{display:flex;justify-content:center;align-content:center}.table-grid__context-menu .context-menu__item:not(.context-menu__title):hover{cursor:pointer;background:#ecf1f7}.table-grid__context-menu .context-menu__item:not(.context-menu__title):hover>ngx-menu-content{color:#1771e6}.table-grid__context-menu .context-menu__item ngx-menu-content:not(.icon-place){overflow:hidden;min-width:35px;text-align:center}.table-grid__context-menu .context-menu__item ngx-menu-content:not(.icon-place):not(.content-phrase){margin:auto auto auto 10px}.table-grid__context-menu .context-menu__item--disable{opacity:.5;pointer-events:none}.table-grid__context-menu .context-menu__item:hover>.context-menu__sub-menu-place>.sub-menu__tree{visibility:visible;transition-delay:.3s;opacity:1}.table-grid__context-menu .context-menu .sub-menu__tree--content{max-height:350px;overflow:auto}.table-grid__context-menu .context-menu__sub-menu-place{margin-left:auto;line-height:15px}.table-grid__context-menu .context-menu__sub-menu-place .sub-menu__tree{opacity:0;visibility:hidden;position:fixed;background:#fff;z-index:100000;border:1px solid #dcdcdc;box-shadow:rgba(60,64,67,.3) 0 1px 2px,rgba(60,64,67,.15) 0 1px 3px 1px;transition:visibility .1s linear,opacity .1s linear}.table-grid__context-menu .context-menu__sub-menu-place .sub-menu__arrow-icon{height:25px;width:25px;margin-right:15px}.table-grid__context-menu .context-menu .context-menu__sub-hidden{display:none}.table-grid__context-menu .context-menu__icon-place{width:25px;margin-right:5px}.table-grid__context-menu .context-menu__icon-place img{max-width:25px;max-height:25px}.table-grid__context-menu .context-menu__title{color:rgba(0,0,0,.54)}.table-grid__context-menu .context-menu__divider{display:block;margin:0;border-top-width:1px;border-top-style:solid;border-top-color:rgba(0,0,0,.12)}\n"], encapsulation: 2, changeDetection: 0 });
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(NgxContextMenuComponent, [{
        type: Component,
        args: [{
                selector: 'ngx-context-menu',
                templateUrl: './ngx-context-menu.component.html',
                styleUrls: ['./ngx-context-menu.component.scss'],
                changeDetection: ChangeDetectionStrategy.OnPush,
                encapsulation: ViewEncapsulation.None
            }]
    }], null, { width: [{
            type: Input
        }], height: [{
            type: Input
        }], maxHeight: [{
            type: Input,
            args: ['max-height']
        }] }); })();
//# sourceMappingURL=data:application/json;base64, 