import Button from '../../button';
import React from 'react';
import ReactDOM from 'react-dom';
import Table from '..';
const dataSource = () => {
    const result = [];
    for (let i = 0; i < 5; i++) {
        result.push({
            title: `Quotation for 1PCS Nano ${3 + i}.0 controller compatible`,
            id: 100306660940 + i,
            time: 2000 + i,
            expandable: i !== 2,
        });
    }
    return result;
}, expandedRowRender = (record, rowIndex) => {
    if (rowIndex === 0) {
        return record.title;
    }
    return (React.createElement(Table.StickyLock, { hasBorder: false, dataSource: dataSource() },
        React.createElement(Table.Column, { title: "Id", dataIndex: "id", lock: true, width: 100 }),
        React.createElement(Table.Column, { title: "Title", dataIndex: "title", width: 200 }),
        React.createElement(Table.Column, { title: "Time", dataIndex: "time", width: 200 }),
        React.createElement(Table.Column, { title: "Title", dataIndex: "title", width: 200 }),
        React.createElement(Table.Column, { title: "Title", dataIndex: "title", width: 200 }),
        React.createElement(Table.Column, { title: "Title", dataIndex: "title", width: 200 }),
        React.createElement(Table.Column, { title: "Title", dataIndex: "title", width: 200 })));
}, render = (value, index, record) => {
    return React.createElement("a", null,
        "Remove(",
        record.id,
        ")");
};
class App extends React.Component {
    constructor() {
        super(...arguments);
        this.state = {
            dataSource: dataSource(),
            loading: false,
        };
        this.toggleLoading = () => {
            this.setState({
                loading: !this.state.loading,
            });
        };
    }
    render() {
        return (React.createElement("div", null,
            React.createElement(Button, { onClick: this.toggleLoading }, "Toggle Loading"),
            React.createElement("br", null),
            React.createElement("br", null),
            React.createElement(Table.StickyLock, { loading: this.state.loading, expandedIndexSimulate: true, dataSource: this.state.dataSource, hasBorder: false, 
                // expandedRowIndent 仅在IE下才会生效，非IE模式下为[0,0]且不可修改
                expandedRowIndent: [2, 0], expandedRowRender: expandedRowRender, rowExpandable: record => record.expandable, onRowClick: () => console.log('rowClick') },
                React.createElement(Table.Column, { title: "Id", dataIndex: "id", lock: true, width: 100 }),
                React.createElement(Table.Column, { title: "Title", dataIndex: "title", width: 200 }),
                React.createElement(Table.Column, { title: "Time", dataIndex: "time", width: 200 }),
                React.createElement(Table.Column, { cell: render, width: 300 }))));
    }
}
ReactDOM.render(React.createElement(App, null), document.getElementById('table-demo-31'));
