import { useState, useCallback } from 'react';

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

export { useTableColumn };
//# sourceMappingURL=useTableColumn.js.map
