import { r as registerInstance, c as createEvent, h, g as getElement, H as Host } from './materials-6a67d110.js';
var Sort = /** @class */ (function () {
    function Sort(columnName, sortDirection) {
        this.columnName = columnName;
        this.sortDirection = sortDirection;
    }
    return Sort;
}());
var SortDirection;
(function (SortDirection) {
    SortDirection["ASC"] = "ASC";
    SortDirection["DESC"] = "DESC";
})(SortDirection || (SortDirection = {}));
var DatatableHeaderColumn = /** @class */ (function () {
    function DatatableHeaderColumn(hostRef) {
        registerInstance(this, hostRef);
        this.align = 'start';
        this.direction = SortDirection.ASC;
        this.sort = createEvent(this, "sort", 7);
    }
    DatatableHeaderColumn.prototype.sortData = function () {
        if (this.sortable) {
            this.sort.emit(new Sort(this.value, this.direction));
            this.direction = this.direction === SortDirection.DESC ? SortDirection.ASC : SortDirection.DESC;
        }
    };
    DatatableHeaderColumn.prototype.getColumnClasses = function () {
        return {
            'header-column': true,
            'non-sortable-column': !this.sortable,
            'sortable-column': this.sortable,
            'sorted': this.sortable && this.sorted,
        };
    };
    DatatableHeaderColumn.prototype.render = function () {
        var _this = this;
        return (h(Host, { class: {
                'align-start': this.align === 'start',
                'align-end': this.align === 'end',
                'align-center': this.align === 'center',
                'sortable': this.sortable
            }, style: {
                'flex': this.width ? "0 0 " + this.width : null,
                'width': this.width ? this.width : null
            } }, h("div", { class: this.getColumnClasses(), title: this.description ? this.description : this.label, onClick: function () { return _this.sortData(); } }, h("div", { class: "label" }, this.label), this.sortable && h("materials-icon", { class: "sort-direction", name: this.direction === SortDirection.DESC ? 'arrow_upward' : 'arrow_downward' }))));
    };
    Object.defineProperty(DatatableHeaderColumn.prototype, "host", {
        get: function () { return getElement(this); },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(DatatableHeaderColumn, "style", {
        get: function () { return ":host{width:100%;line-height:48px;font-family:Roboto,sans-serif;font-size:12px;font-weight:700;color:var(--mdc-theme-on-surface);opacity:.6;height:48px;cursor:default;display:-ms-flexbox;display:flex;-ms-flex:1;flex:1}:host(.align-end) .header-column{padding-right:24px;-ms-flex-direction:row-reverse;flex-direction:row-reverse}:host(.align-end) .label{text-align:end}:host(.align-center){position:relative}:host(.align-center),:host(.align-center) .header-column{-ms-flex-pack:center;justify-content:center}:host(.align-center) .header-column .label{text-align:center}:host(.align-center) .header-column .sort-direction{position:absolute;right:0}.header-column{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;width:100%}.header-column .label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.sort-direction{color:#5f595c}.sortable-column:hover{cursor:pointer;color:#000}.sortable-column materials-icon{opacity:0;display:inline-block}.sortable-column:hover materials-icon{opacity:1;-webkit-transition:opacity .25s linear;transition:opacity .25s linear}.sortable-column.sorted{color:#000!important}.sortable-column.sorted materials-icon{opacity:1!important}"; },
        enumerable: true,
        configurable: true
    });
    return DatatableHeaderColumn;
}());
export { DatatableHeaderColumn as materials_datatable_header_column };
