import './demo4.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 = {
            checkedKeys: [],
            checkStrictly: false,
        };
        this.handleCheck = this.handleCheck.bind(this);
        this.handleCheckStrictly = this.handleCheckStrictly.bind(this);
    }
    handleCheck(keys, info) {
        console.log(keys, info);
        this.setState({
            checkedKeys: keys,
        });
    }
    handleCheckStrictly() {
        this.setState({
            checkStrictly: !this.state.checkStrictly,
            checkedKeys: [],
        });
    }
    render() {
        const { checkedKeys, checkStrictly } = this.state;
        return (React.createElement("div", { className: "control-check-demo" },
            React.createElement("label", { className: "strictly-check" },
                React.createElement(Checkbox, { checked: checkStrictly, onChange: this.handleCheckStrictly }),
                React.createElement("span", { className: "strictly-text" }, "\u53D6\u6D88\u9009\u4E2D\u5173\u8054")),
            React.createElement(Tree, { defaultExpandAll: true, checkable: true, checkStrictly: checkStrictly, checkedKeys: checkedKeys, onCheck: this.handleCheck, dataSource: data })));
    }
}
ReactDOM.render(React.createElement(Demo, null), document.getElementById('tree-demo-4'));
