/**
 * DevExtreme (esm/renovation/ui/grids/data_grid_next/widgets/header_cell.js)
 * Version: 22.1.3 (build 22180-0310)
 * Build date: Wed Jun 29 2022
 *
 * Copyright (c) 2012 - 2022 Developer Express Inc. ALL RIGHTS RESERVED
 * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
 */
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
import _extends from "@babel/runtime/helpers/esm/extends";
var _excluded = ["column", "columnIndex", "countColumn", "headerTemplate"];
import {
    createVNode,
    createComponentVNode,
    normalizeProps
} from "inferno";
import {
    BaseInfernoComponent
} from "@devextreme/runtime/inferno";
import {
    combineClasses
} from "../../../../utils/combine_classes";
import CLASSES from "../classes";
export var viewFunction = _ref => {
    var {
        classes: classes,
        props: {
            column: column,
            columnIndex: columnIndex,
            headerTemplate: HeaderTemplate
        }
    } = _ref;
    return createVNode(1, "td", classes, createVNode(1, "div", "".concat(CLASSES.textContent, " ").concat(CLASSES.textContentAlignmentLeft), HeaderTemplate ? HeaderTemplate({}) : column.dataField, 0, {
        role: "presentation"
    }), 2, {
        "aria-selected": "false",
        role: "columnheader",
        id: "dx-col-".concat(columnIndex + 1),
        "aria-label": "ColumnInternal ".concat(column.dataField),
        "aria-sort": "none",
        tabIndex: 0
    })
};
export var HeaderCellProps = {
    column: Object.freeze({}),
    columnIndex: 0,
    countColumn: 0
};
var getTemplate = TemplateProp => TemplateProp && (TemplateProp.defaultProps ? props => normalizeProps(createComponentVNode(2, TemplateProp, _extends({}, props))) : TemplateProp);
export class HeaderCell extends BaseInfernoComponent {
    constructor(props) {
        super(props);
        this.state = {}
    }
    get classes() {
        var {
            columnIndex: columnIndex,
            countColumn: countColumn
        } = this.props;
        var classesMap = {
            [CLASSES.action]: true,
            [CLASSES.cellFocusDisabled]: true,
            [CLASSES.firstChild]: 0 === columnIndex,
            [CLASSES.lastChild]: columnIndex === countColumn - 1
        };
        if (this.props.column.headerCssClass) {
            classesMap[this.props.column.headerCssClass] = true
        }
        return combineClasses(classesMap)
    }
    get restAttributes() {
        var _this$props = this.props,
            restProps = _objectWithoutPropertiesLoose(_this$props, _excluded);
        return restProps
    }
    render() {
        var props = this.props;
        return viewFunction({
            props: _extends({}, props, {
                headerTemplate: getTemplate(props.headerTemplate)
            }),
            classes: this.classes,
            restAttributes: this.restAttributes
        })
    }
}
HeaderCell.defaultProps = HeaderCellProps;
