import Button from '../../button';
import React from 'react';
import ReactDOM from 'react-dom';
import Table from '..';
const onRowClick = function (record, index, e) {
    console.log(record, index, e);
}, dataSource = () => {
    const result = [];
    for (let i = 0; i < 100; i++) {
        result.push({
            title: {
                name: `Quotation for 1PCS Nano ${3 + i}.0 controller compatible`,
            },
            id: 100306660940 + i,
            time: 2000 + i,
        });
    }
    return result;
}, render = (value, index, record) => {
    return React.createElement("a", null,
        "Remove(",
        record.id,
        ")");
};
class App extends React.Component {
    constructor() {
        super(...arguments);
        this.state = {
            dataSource: [],
            cols: [
                React.createElement(Table.Column, { title: "Title", dataIndex: "title.name", width: 200, key: "name1" }),
                React.createElement(Table.ColumnGroup, { title: "abc", key: "name-group" },
                    React.createElement(Table.Column, { title: "Title", dataIndex: "title.name", width: 100, key: "name2" }),
                    React.createElement(Table.Column, { title: "Title", dataIndex: "title.name", width: 400, key: "name3" })),
                React.createElement(Table.Column, { title: "Time", dataIndex: "time", width: 500, key: "time" }),
            ],
            loading: true,
        };
        this.reduceCol = () => {
            this.setState({
                cols: [
                    React.createElement(Table.Column, { title: "Title", dataIndex: "title.name", width: 400, key: "name1" }),
                    React.createElement(Table.Column, { title: "Time", dataIndex: "time", width: 100, key: "time", lock: true }),
                ],
            });
        };
    }
    componentDidMount() {
        setTimeout(() => {
            this.setState({
                dataSource: dataSource(),
                loading: false,
            });
        }, 200);
    }
    render() {
        return (React.createElement("div", null,
            React.createElement("p", null,
                React.createElement(Button, { onClick: this.reduceCol }, "Reduce Cols")),
            React.createElement(Table.StickyLock, { dataSource: this.state.dataSource, onRowClick: onRowClick, fixedHeader: true, loading: this.state.loading },
                React.createElement(Table.Column, { title: "Id-Id-Id-Id-Id-Id-Id-Id-Id-Id-Id-Id", dataIndex: "id", lock: true, width: 140 }),
                this.state.cols,
                React.createElement(Table.Column, { cell: render, width: 200 }))));
    }
}
ReactDOM.render(React.createElement(App, null), document.getElementById('table-demo-17'));
