"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "withFixedStyle", {
    enumerable: true,
    get: function() {
        return withFixedStyle;
    }
});
const _jsxruntime = require("react/jsx-runtime");
const _react = require("react");
const _tableContext = require("./tableContext");
const withFixedStyle = (WrappedComponent)=>{
    return (props)=>{
        const { col, index } = props;
        const { getLeftFixedColumnsWidth, getRightFixedColumnsWidth } = (0, _react.useContext)(_tableContext.TableContext);
        const styles = (0, _react.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__*/ (0, _jsxruntime.jsx)(WrappedComponent, {
            ...props,
            style: styles
        });
    };
};

//# sourceMappingURL=colHOC.js.map