var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
};
import ConfigProvider from '../config-provider';
import React, { Component } from 'react';
import cls from 'classnames';
import hoistNonReactStatics from 'hoist-non-react-statics';
import { Table as NextTable } from '@alifd/next';
import { omitProps } from '../utils/object';
class Table extends Component {
    render() {
        const _a = this.props, { prefix = 'next-', className, size } = _a, otherProps = __rest(_a, ["prefix", "className", "size"]);
        const { hasBorder = false, rowSelection } = this.props;
        let newcolumnProps;
        let newRowSelection;
        if (!hasBorder && rowSelection) { // 修改checkbox间距
            const { columnProps } = rowSelection;
            let newWidth = 30;
            if (columnProps) {
                const date = columnProps();
                const { width = 30 } = date;
                newWidth = width;
                date.width = newWidth;
                newcolumnProps = () => {
                    return (date);
                };
            }
            else {
                newcolumnProps = () => {
                    return ({ width: newWidth });
                };
            }
            newRowSelection = rowSelection;
            newRowSelection.columnProps = newcolumnProps;
        }
        if (size === 'xs' || size === 'large') {
            if (!hasBorder && rowSelection) {
                return (React.createElement(NextTable, Object.assign({ prefix: prefix }, omitProps(otherProps, ['size']), { rowSelection: newRowSelection, hasBorder: hasBorder, className: cls(className, {
                        [`${prefix}xs`]: size === 'xs',
                        [`${prefix}large`]: size === 'large',
                    }) })));
            }
            return (React.createElement(NextTable, Object.assign({}, omitProps(otherProps, ['size']), { prefix: prefix, hasBorder: hasBorder, className: cls(className, {
                    [`${prefix}xs`]: size === 'xs',
                    [`${prefix}large`]: size === 'large',
                }) })));
        }
        if (!hasBorder && rowSelection) { // 修改checkbox间距
            return (React.createElement(NextTable, Object.assign({}, otherProps, { prefix: prefix, size: size, rowSelection: newRowSelection, className: cls(className, {}) })));
        }
        return (React.createElement(NextTable, Object.assign({}, otherProps, { hasBorder: hasBorder, prefix: prefix, size: size, className: cls(className, {}) })));
    }
}
// static Item = NextTab.Item;
Table.Column = NextTable.Column;
Table.ColumnGroup = NextTable.ColumnGroup;
Table.GroupHeader = NextTable.GroupHeader;
Table.GroupFooter = NextTable.GroupFooter;
Table.StickyLock = NextTable.StickyLock;
hoistNonReactStatics(Table, NextTable);
export default ConfigProvider.config(Table);
