import './demo3.css';
import Checkbox from '../../checkbox';
import React from 'react';
import ReactDOM from 'react-dom';
import Tree from '..';
const data = [
    {
        label: 'Component',
        key: '1',
        children: [
            {
                label: 'Form',
                key: '2',
                selectable: false,
                children: [
                    {
                        label: 'Input',
                        key: '4',
                    },
                    {
                        label: 'Select',
                        key: '5',
                        disabled: true,
                    },
                ],
            },
            {
                label: 'Display',
                key: '3',
                children: [
                    {
                        label: 'Table',
                        key: '6',
                    },
                ],
            },
        ],
    },
];
class Demo extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            selectedKeys: [],
            multiple: false,
        };
        this.handleSelect = this.handleSelect.bind(this);
        this.handleCheck = this.handleCheck.bind(this);
    }
    handleSelect(keys, info) {
        console.log(keys, info);
        this.setState({
            selectedKeys: keys,
        });
    }
    handleCheck() {
        this.setState({
            multiple: !this.state.multiple,
            selectedKeys: [],
        });
    }
    render() {
        const { multiple, selectedKeys } = this.state;
        return (React.createElement("div", { className: "control-select-demo" },
            React.createElement("label", { className: "multiple-check" },
                React.createElement(Checkbox, { checked: multiple, onChange: this.handleCheck }),
                React.createElement("span", { className: "multiple-text" }, "\u591A\u9009")),
            React.createElement(Tree, { defaultExpandAll: true, multiple: multiple, selectedKeys: selectedKeys, onSelect: this.handleSelect, dataSource: data })));
    }
}
ReactDOM.render(React.createElement(Demo, null), document.getElementById('tree-demo-3'));
