var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
import React from 'react';
import PropTypes from 'prop-types';
import { ColumnFilter } from './components/ColumnFilter';
import { useStyles } from './styles';
export var withFilter = function (_a) {
    var filter = _a.filter, onFilter = _a.onFilter, filterable = _a.filterable, filterOptions = _a.filterOptions, dataTypeDefinition = _a.dataTypeDefinition;
    return function (HeadCellRenderer) {
        var HeadCellRendererWithFilter = function (props) {
            var columnId = props.headCellData.id;
            var styles = useStyles();
            var columnFilter = filterable ? (React.createElement(ColumnFilter, { columnId: columnId, dataTypeDefinition: dataTypeDefinition, filter: filter, filterOptionsData: filterOptions, onFilter: onFilter })) : (React.createElement("div", { className: styles.columnFilter }));
            return React.createElement(HeadCellRenderer, __assign({}, props, { columnFilter: columnFilter }));
        };
        HeadCellRendererWithFilter.propTypes = {
            headCellData: PropTypes.shape({
                id: PropTypes.string
            })
        };
        return HeadCellRendererWithFilter;
    };
};
