/**
 * amis-ui v6.14.0-beta.1
 * Copyright 2018-2025 fex
 */

import { __extends, __assign } from 'tslib';
import React__default from 'react';

/**
 * @file table/BodyCell
 * @author fex
 */
var zIndex = 1;
var BodyCell = /** @class */ (function (_super) {
    __extends(BodyCell, _super);
    function BodyCell() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    BodyCell.prototype.render = function () {
        var _a;
        var _b = this.props, fixed = _b.fixed, selfSticky = _b.selfSticky, rowSpan = _b.rowSpan, colSpan = _b.colSpan, children = _b.children, className = _b.className, column = _b.column, style = _b.style, depth = _b.depth, col = _b.col, Component = _b.wrapperComponent, cx = _b.classnames, testIdBuilder = _b.testIdBuilder;
        var _style = __assign({}, style);
        if (fixed || selfSticky) {
            _style = __assign({ position: 'sticky', zIndex: zIndex }, _style);
        }
        return (React__default.createElement(Component, __assign({ rowSpan: rowSpan && rowSpan > 1 ? rowSpan : null, colSpan: colSpan && colSpan > 1 ? colSpan : null, className: cx('Table-cell', className, (_a = {},
                _a[cx("Table-cell-fix-".concat(fixed))] = fixed,
                _a["Table-cell-self-sticky"] = selfSticky,
                _a["text-".concat(column === null || column === void 0 ? void 0 : column.align)] = column === null || column === void 0 ? void 0 : column.align,
                _a["align-".concat(column === null || column === void 0 ? void 0 : column.vAlign)] = column === null || column === void 0 ? void 0 : column.vAlign,
                _a)), style: _style, "data-depth": depth || null, "data-col": col }, testIdBuilder === null || testIdBuilder === void 0 ? void 0 : testIdBuilder.getTestId()), children));
    };
    BodyCell.defaultProps = {
        fixed: '',
        selfSticky: false,
        wrapperComponent: 'td',
        rowSpan: null,
        colSpan: null
    };
    return BodyCell;
}(React__default.PureComponent));

export { BodyCell as default };
