import * as tslib_1 from "tslib";
import { Directive, Input, ElementRef, Renderer2 } from '@angular/core';
var NbRowDirective = /** @class */ (function () {
    function NbRowDirective(_elementRef, _renderer) {
        this._elementRef = _elementRef;
        this._renderer = _renderer;
        this._classList = [];
        this._prefixCls = 'nb-row';
        this._align = 'top';
        this._justify = 'start';
        this._el = this._elementRef.nativeElement;
    }
    Object.defineProperty(NbRowDirective.prototype, "nbType", {
        get: function () {
            return this._type;
        },
        set: function (value) {
            this._type = value;
            this.setClassMap();
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(NbRowDirective.prototype, "nbAlign", {
        get: function () {
            return this._align;
        },
        set: function (value) {
            this._align = value;
            this.setClassMap();
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(NbRowDirective.prototype, "nbJustify", {
        get: function () {
            return this._justify;
        },
        set: function (value) {
            this._justify = value;
            this.setClassMap();
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(NbRowDirective.prototype, "nbGutter", {
        get: function () {
            return this._gutter;
        },
        set: function (value) {
            this._gutter = value;
            this.setStyle();
        },
        enumerable: true,
        configurable: true
    });
    NbRowDirective.prototype.setStyle = function () {
        this._renderer.setStyle(this._el, 'margin-left', "-" + this._gutter / 2 + "px");
        this._renderer.setStyle(this._el, 'margin-right', "-" + this._gutter / 2 + "px");
    };
    NbRowDirective.prototype.setClassMap = function () {
        var _this = this;
        this._classList.forEach(function (_className) {
            _this._renderer.removeClass(_this._el, _className);
        });
        this._classList = [
            (!this.nbType) && this._prefixCls,
            this.nbType && this._prefixCls + "-" + this.nbType,
            this.nbType && this.nbAlign && this._prefixCls + "-" + this.nbType + "-" + this.nbAlign,
            this.nbType && this.nbJustify && this._prefixCls + "-" + this.nbType + "-" + this.nbJustify
        ].filter(function (item) {
            return !!item;
        });
        this._classList.forEach(function (_className) {
            _this._renderer.addClass(_this._el, _className);
        });
    };
    NbRowDirective.prototype.ngOnInit = function () {
        this.setClassMap();
    };
    tslib_1.__decorate([
        Input(),
        tslib_1.__metadata("design:type", Object),
        tslib_1.__metadata("design:paramtypes", [Object])
    ], NbRowDirective.prototype, "nbType", null);
    tslib_1.__decorate([
        Input(),
        tslib_1.__metadata("design:type", String),
        tslib_1.__metadata("design:paramtypes", [String])
    ], NbRowDirective.prototype, "nbAlign", null);
    tslib_1.__decorate([
        Input(),
        tslib_1.__metadata("design:type", String),
        tslib_1.__metadata("design:paramtypes", [String])
    ], NbRowDirective.prototype, "nbJustify", null);
    tslib_1.__decorate([
        Input(),
        tslib_1.__metadata("design:type", Number),
        tslib_1.__metadata("design:paramtypes", [Number])
    ], NbRowDirective.prototype, "nbGutter", null);
    NbRowDirective = tslib_1.__decorate([
        Directive({
            selector: '[nbRow]'
        }),
        tslib_1.__metadata("design:paramtypes", [ElementRef,
            Renderer2])
    ], NbRowDirective);
    return NbRowDirective;
}());
export { NbRowDirective };
//# sourceMappingURL=row.directive.js.map