import React from 'react';
import ReactDOM from 'react-dom';
import Table from '..';
const dataSource = j => {
    const result = [];
    for (let i = 0; i < j; i++) {
        result.push({
            title: {
                name: `Quotation for 1PCS Nano ${3 + i}.0 controller compatible`,
            },
            id: `100306660940${i}`,
            time: 2000 + i,
            time2: 2000 + i,
            index: i,
        });
    }
    return result;
};
const render = (value, index, record) => {
    return React.createElement("a", null,
        "Remove(",
        record.id,
        ")");
};
class App extends React.Component {
    constructor() {
        super(...arguments);
        this.state = {
            rowSelection: {
                onChange: this.onChange.bind(this),
                onSelect(selected, record, records) {
                    console.log('onSelect', selected, record, records);
                },
                onSelectAll(selected, records) {
                    console.log('onSelectAll', selected, records);
                },
                selectedRowKeys: [100306660940, 100306660941],
                getProps: record => {
                    return {
                        disabled: record.id === 100306660941,
                    };
                },
            },
            openRowKeys: [],
        };
        this.onBodyScroll = start => {
            this.setState({
                scrollToRow: start,
            });
        };
        this.onRowMouseEnter = () => {
            //   this.setState({
            //     openRowKeys: [i]
            //   })
        };
    }
    onChange(ids, records) {
        const { rowSelection } = this.state;
        rowSelection.selectedRowKeys = ids;
        console.log('onChange', ids, records);
        this.setState({ rowSelection });
    }
    render() {
        return (React.createElement(Table.StickyLock, { dataSource: dataSource(200), maxBodyHeight: 400, useVirtual: true, 
            // scrollToRow={this.state.scrollToRow}
            // @ts-ignore
            onBodyScroll: this.onBodyScroll, expandedRowRender: () => (React.createElement("div", null,
                React.createElement("button", null, "1"))), hasExpandedRowCtrl: false, expandedRowIndent: [0, 0], rowSelection: this.state.rowSelection, onRowMouseEnter: this.onRowMouseEnter, openRowKeys: this.state.openRowKeys, primaryKey: "index" },
            React.createElement(Table.Column, { title: "Id1", dataIndex: "id", width: 100, lock: true }),
            React.createElement(Table.Column, { title: "Index", dataIndex: "index", width: 200 }),
            React.createElement(Table.Column, { title: "Time", dataIndex: "time", width: 200 }),
            React.createElement(Table.Column, { title: "Time2", dataIndex: "time2", width: 200 }),
            React.createElement(Table.Column, { cell: render, width: 200, lock: "left" })));
    }
}
ReactDOM.render(React.createElement(App, null), document.getElementById('table-demo-30'));
