import { Component, HostBinding, HostListener, Optional, Host, Input, ViewEncapsulation, Output, EventEmitter } from '@angular/core';
import { NzLayoutComponent } from './nz-layout.component';
var NzSiderComponent = (function () {
    function NzSiderComponent(nzLayoutComponent) {
        this.nzLayoutComponent = nzLayoutComponent;
        this._dimensionMap = {
            xl: 1600,
            lg: 1200,
            md: 992,
            sm: 768,
            xs: 480,
        };
        this._below = false;
        this.nzWidth = '200';
        this.nzTrigger = true;
        this.nzCollapsedWidth = 64;
        this.nzCollapsed = false;
        this._collapsible = false;
        this.nzCollapsedChange = new EventEmitter();
        this._nzLayoutSider = true;
        if (this.nzLayoutComponent) {
            this.nzLayoutComponent.hasSider = true;
        }
    }
    Object.defineProperty(NzSiderComponent.prototype, "nzCollapsible", {
        get: function () {
            return this._collapsible;
        },
        set: function (value) {
            if (value === '') {
                this._collapsible = true;
            }
            else {
                this._collapsible = value;
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(NzSiderComponent.prototype, "setZeroClass", {
        get: function () {
            return this.nzCollapsed && (this.nzCollapsedWidth === 0);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(NzSiderComponent.prototype, "setFlex", {
        get: function () {
            if (this.nzCollapsed) {
                return "0 0 " + this.nzCollapsedWidth + "px";
            }
            else {
                return "0 0 " + this.nzWidth + "px";
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(NzSiderComponent.prototype, "setWidth", {
        get: function () {
            if (this.nzCollapsed) {
                return this.nzCollapsedWidth;
            }
            else {
                return this.nzWidth;
            }
        },
        enumerable: true,
        configurable: true
    });
    NzSiderComponent.prototype.onWindowResize = function (e) {
        if (this.nzBreakpoint) {
            if (window.innerWidth < this._dimensionMap[this.nzBreakpoint]) {
                this._below = true;
                this.nzCollapsed = true;
                this.nzCollapsedChange.emit(true);
            }
            else {
                this._below = false;
                this.nzCollapsed = false;
                this.nzCollapsedChange.emit(false);
            }
        }
    };
    NzSiderComponent.prototype.toggleCollapse = function () {
        this.nzCollapsed = !this.nzCollapsed;
        this.nzCollapsedChange.emit(this.nzCollapsed);
    };
    Object.defineProperty(NzSiderComponent.prototype, "_isZeroTrigger", {
        get: function () {
            return this.nzCollapsible && this.nzTrigger && (this.nzCollapsedWidth === 0) && ((this.nzBreakpoint && this._below) || (!this.nzBreakpoint));
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(NzSiderComponent.prototype, "_isSiderTrgger", {
        get: function () {
            return this.nzCollapsible && this.nzTrigger && (this.nzCollapsedWidth !== 0);
        },
        enumerable: true,
        configurable: true
    });
    return NzSiderComponent;
}());
export { NzSiderComponent };
NzSiderComponent.decorators = [
    { type: Component, args: [{
                selector: 'nz-sider',
                encapsulation: ViewEncapsulation.None,
                template: "\n    <ng-content></ng-content>\n    <span class=\"ant-layout-sider-zero-width-trigger\" *ngIf=\"_isZeroTrigger\" (click)=\"toggleCollapse()\">\n      <i class=\"anticon anticon-bars\"></i>\n    </span>\n    <div class=\"ant-layout-sider-trigger\" *ngIf=\"_isSiderTrgger\" (click)=\"toggleCollapse()\">\n      <i class=\"anticon\" [class.anticon-left]=\"!nzCollapsed\" [class.anticon-right]=\"nzCollapsed\"></i>\n    </div>\n  "
            },] },
];
/** @nocollapse */
NzSiderComponent.ctorParameters = function () { return [
    { type: NzLayoutComponent, decorators: [{ type: Optional }, { type: Host },] },
]; };
NzSiderComponent.propDecorators = {
    'nzWidth': [{ type: Input },],
    'nzTrigger': [{ type: Input },],
    'nzCollapsedWidth': [{ type: Input },],
    'nzBreakpoint': [{ type: Input },],
    'nzCollapsed': [{ type: Input }, { type: HostBinding, args: ['class.ant-layout-sider-collapsed',] },],
    'nzCollapsible': [{ type: Input },],
    'nzCollapsedChange': [{ type: Output },],
    '_nzLayoutSider': [{ type: HostBinding, args: ['class.ant-layout-sider',] },],
    'setZeroClass': [{ type: HostBinding, args: ['class.ant-layout-sider-zero-width',] },],
    'setFlex': [{ type: HostBinding, args: ['style.flex',] },],
    'setWidth': [{ type: HostBinding, args: ['style.width.px',] },],
    'onWindowResize': [{ type: HostListener, args: ['window:resize', ['$event'],] },],
};
