import React from 'react';
import ReactDOM from 'react-dom';
import Select from '..';
const provinceData = ['Zhejiang', 'Hubei', 'Jiangsu'];
const cityData = {
    Zhejiang: ['Hangzhou', 'Ningbo', 'Wenzhou'],
    Hubei: ['Wuhan', 'Yichang', 'Jingzhou'],
    Jiangsu: ['Nanjing', 'Suzhou', 'Zhenjiang'],
};
class Demo extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            data: [],
            disabled: true,
            province: '',
            city: '',
        };
        this.handleProvinceChange = this.handleProvinceChange.bind(this);
        this.handleCityChange = this.handleCityChange.bind(this);
    }
    handleProvinceChange(value) {
        const data = cityData[value];
        this.setState({ data, province: value, city: '', disabled: !data });
    }
    handleCityChange(value) {
        this.setState({ city: value });
        console.log(this.state.province, value);
    }
    render() {
        const { data, disabled, province, city } = this.state;
        return (React.createElement("div", null,
            React.createElement(Select, { placeholder: "Select Province", dataSource: provinceData, value: province, onChange: this.handleProvinceChange, style: { marginRight: 8 } }),
            React.createElement(Select, { placeholder: "Select City", dataSource: data, value: city, onChange: this.handleCityChange, disabled: disabled })));
    }
}
ReactDOM.render(React.createElement(Demo, null), document.getElementById('select-demo-5'));
