import { jsx as _jsx } from "react/jsx-runtime";
import { useContext, useMemo } from "react";
import { TableContext } from "./tableContext";
export const withFixedStyle = (WrappedComponent)=>{
    return (props)=>{
        const { col, index } = props;
        const { getLeftFixedColumnsWidth, getRightFixedColumnsWidth } = useContext(TableContext);
        const styles = useMemo(()=>{
            const styles = {};
            if (col.fixed && col.fixed === "left") {
                styles["left"] = `${getLeftFixedColumnsWidth(index)}px`;
            }
            if (col.fixed && col.fixed === "right") {
                styles["right"] = `${getRightFixedColumnsWidth(index)}px`;
            }
            return styles;
        }, [
            index,
            col.fixed
        ]);
        return /*#__PURE__*/ _jsx(WrappedComponent, {
            ...props,
            style: styles
        });
    };
};

//# sourceMappingURL=colHOC.js.map