import * as tslib_1 from "tslib";
import { Component, ViewEncapsulation, ChangeDetectionStrategy, EventEmitter, Input, Output } from '@angular/core';
import { OnChange } from '../core/decorators';
/**
 * table td component
 */
var TableTdComponent = /** @class */ (function () {
    function TableTdComponent() {
        /**
         * when edit, emits a `edit` event
         */
        this.edit = new EventEmitter();
        /**
         * whether the cell is editable
         * @default false
         */
        this.editable = false;
        /**
         * whether the cell is editing
         * @default false
         */
        this.editing = false;
    }
    /**
     * @docs-private
     */
    TableTdComponent.prototype.onEdit = function () {
        this.editing = true;
        this.edit.emit();
    };
    tslib_1.__decorate([
        Output(),
        tslib_1.__metadata("design:type", EventEmitter)
    ], TableTdComponent.prototype, "edit", void 0);
    tslib_1.__decorate([
        OnChange(true),
        Input(),
        tslib_1.__metadata("design:type", Boolean)
    ], TableTdComponent.prototype, "editable", void 0);
    tslib_1.__decorate([
        Input(),
        tslib_1.__metadata("design:type", Boolean)
    ], TableTdComponent.prototype, "editing", void 0);
    TableTdComponent = tslib_1.__decorate([
        Component({
            selector: 'td[nb-td]',
            template: "\n        <div class=\"nb-table-td-wrapper\">\n            <ng-content></ng-content>\n            <i title=\"edit\" class=\"iconfont icon-edit\" *ngIf=\"editable && !editing\" (click)=\"onEdit()\"></i>\n        </div>\n    ",
            host: {
                'class': 'nb-table-td',
                '[class.nb-table-td-edit]': 'editable'
            },
            preserveWhitespaces: false,
            encapsulation: ViewEncapsulation.None,
            changeDetection: ChangeDetectionStrategy.OnPush,
            exportAs: 'nbTd'
        })
    ], TableTdComponent);
    return TableTdComponent;
}());
export { TableTdComponent };
//# sourceMappingURL=table-td.js.map