'use strict';

var React = require('react');

const useTableColumn = () => {
    const [columns, setColumns] = React.useState([]);
    const addFilterColumn = React.useCallback((column) => {
        const uniqeColumns = new Set([...columns, column]);
        setColumns(Array.from(uniqeColumns));
    }, [columns]);
    const removeFilterColumn = React.useCallback((column) => {
        const data = [...columns];
        const index = data.indexOf(column);
        if (index > -1) {
            data.splice(index, 1);
        }
        setColumns(data);
    }, [columns]);
    const resetColumns = React.useCallback(() => setColumns([]), []);
    return {
        filteredColumns: columns,
        addFilterColumn,
        removeFilterColumn,
        resetColumns,
    };
};

exports.useTableColumn = useTableColumn;
//# sourceMappingURL=useTableColumn.cjs.map
