"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
function _export(target, all) {
    for(var name in all)Object.defineProperty(target, name, {
        enumerable: true,
        get: all[name]
    });
}
_export(exports, {
    Col: function() {
        return Col;
    },
    ColItem: function() {
        return ColItem;
    }
});
const _jsxruntime = require("react/jsx-runtime");
const _react = require("react");
const _css = require("../utils/css");
const _colHOC = require("./colHOC");
const ColItem = (props)=>{
    const { col, record, index, style } = props;
    const { align } = col;
    const content = (0, _react.useMemo)(()=>{
        const { col } = props;
        const { dataIndex, formatter, render } = col;
        let value = props.record[dataIndex];
        if (formatter) {
            value = formatter(value, props.record, props.index);
        }
        if (render) {
            return render(value, props.record, props.index);
        }
        return value;
    }, [
        col,
        record
    ]);
    return /*#__PURE__*/ (0, _jsxruntime.jsx)("td", {
        className: (0, _css.cn)("orderly-ui-table-td orderly-py-[2px] orderly-px-1 whitespace-nowrap group-hover:!orderly-bg-base-800", props.justified && "first:orderly-pl-0 last:orderly-pr-0", col.className, align === "right" && "orderly-text-right", col.fixed && "orderly-sticky orderly-z-10"),
        style: {
            backgroundColor: col.fixed ? "var(--table-background-color)" : "transparent",
            ...style
        },
        children: content
    });
};
const Col = (0, _colHOC.withFixedStyle)(ColItem);

//# sourceMappingURL=col.js.map