import { __assign, __extends } from "tslib";
import { jsx as _jsx } from "react/jsx-runtime";
import { PureComponent } from 'react';
import classnames from 'classnames';
import Cell from './Cell';
import noop from '../utils/noop';
var Row = (function (_super) {
    __extends(Row, _super);
    function Row() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.onMouseEnter = function () {
            var _a = _this.props, rowIndex = _a.rowIndex, onRowMouseEnter = _a.onRowMouseEnter;
            onRowMouseEnter(rowIndex);
        };
        return _this;
    }
    Row.prototype.render = function () {
        var _a;
        var _b = this.props, prefix = _b.prefix, columns = _b.columns, data = _b.data, rowIndex = _b.rowIndex, rowClassName = _b.rowClassName, mouseOverRowIndex = _b.mouseOverRowIndex, onRowClick = _b.onRowClick, fixed = _b.fixed, hasFixedColumn = _b.hasFixedColumn, fixedColumnsBodyRowsHeight = _b.fixedColumnsBodyRowsHeight, row = _b.row, _c = _b.rowProps, rowProps = _c === void 0 ? noop : _c, disableHoverHighlight = _b.disableHoverHighlight;
        var BodyRow = row || 'tr';
        var cells = [];
        var className = typeof rowClassName === 'function'
            ? rowClassName(data, rowIndex)
            : rowClassName;
        var height = fixed && fixedColumnsBodyRowsHeight[rowIndex]
            ? fixedColumnsBodyRowsHeight[rowIndex]
            : undefined;
        (columns || []).forEach(function (column, columnIndex) {
            var pos = {
                row: rowIndex,
                column: columnIndex,
                fixed: fixed,
            };
            cells.push(_jsx(Cell, { column: column, data: data, pos: pos, columnIndex: columnIndex, prefix: prefix }, columnIndex));
        });
        var supportMouseEnter = hasFixedColumn && !disableHoverHighlight;
        return (_jsx(BodyRow, __assign({ className: classnames(prefix + "-grid-tr", className, (_a = {},
                _a[prefix + "-grid-tr__disable-highlight"] = disableHoverHighlight,
                _a[prefix + "-grid-tr__mouseover"] = mouseOverRowIndex === rowIndex,
                _a)), onClick: function (e) { return onRowClick(data, rowIndex, e); }, onMouseEnter: supportMouseEnter ? this.onMouseEnter : null, style: { height: height } }, rowProps(data, rowIndex), { "data-zv": "v10.0.11" }, { children: cells }), void 0));
    };
    return Row;
}(PureComponent));
export default Row;
