import { __decorate } from "tslib";
import { attr, observable, ViewTemplate } from '@ni/fast-element';
import { DesignSystem, FoundationElement } from '@ni/fast-foundation';
import { styles } from './styles';
import { template } from './template';
/**
 * A styled cell that is used within the nimble-table-row.
 * @internal
 */
export class TableCell extends FoundationElement {
    constructor() {
        super(...arguments);
        this.hasActionMenu = false;
        this.menuOpen = false;
        this.nestingLevel = 0;
    }
    /** @internal */
    get cellView() {
        return this.cellViewContainer
            .firstElementChild;
    }
    onActionMenuBeforeToggle(event) {
        this.$emit('cell-action-menu-beforetoggle', event.detail);
    }
    onActionMenuToggle(event) {
        this.menuOpen = event.detail.newState;
        this.$emit('cell-action-menu-toggle', event.detail);
    }
    onActionMenuBlur() {
        this.$emit('cell-action-menu-blur', this);
    }
    onCellViewFocusIn() {
        this.$emit('cell-view-focus-in', this);
    }
    onCellFocusIn() {
        this.$emit('cell-focus-in', this);
    }
    onCellBlur() {
        this.$emit('cell-blur', this);
    }
}
__decorate([
    observable
], TableCell.prototype, "cellState", void 0);
__decorate([
    observable
], TableCell.prototype, "column", void 0);
__decorate([
    observable
], TableCell.prototype, "recordId", void 0);
__decorate([
    attr({ attribute: 'column-id' })
], TableCell.prototype, "columnId", void 0);
__decorate([
    attr({ attribute: 'has-action-menu', mode: 'boolean' })
], TableCell.prototype, "hasActionMenu", void 0);
__decorate([
    attr({ attribute: 'menu-open', mode: 'boolean' })
], TableCell.prototype, "menuOpen", void 0);
__decorate([
    attr({ attribute: 'action-menu-label' })
], TableCell.prototype, "actionMenuLabel", void 0);
__decorate([
    observable
], TableCell.prototype, "cellViewTemplate", void 0);
__decorate([
    observable
], TableCell.prototype, "cellViewContainer", void 0);
__decorate([
    observable
], TableCell.prototype, "nestingLevel", void 0);
const nimbleTableCell = TableCell.compose({
    baseName: 'table-cell',
    template,
    styles
});
DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleTableCell());
export const tableCellTag = 'nimble-table-cell';
//# sourceMappingURL=index.js.map