import 'whatwg-fetch';
import CascaderSelect from '..';
import React from 'react';
import ReactDOM from 'react-dom';
class Demo extends React.Component {
    constructor(props) {
        super(props);
        this.valueRender = item => {
            if (item.label) {
                return item.label;
            }
            return item.value === '432988' ? '不存在的值' : item.value;
        };
        this.state = {
            data: [],
        };
        this.handleChange = this.handleChange.bind(this);
    }
    componentDidMount() {
        fetch('https://os.alipayobjects.com/rmsportal/ODDwqcDFTLAguOvWEolX.json')
            .then(response => response.json())
            .then(data => {
            data[1].disabled = true;
            this.setState({ data });
        })
            .catch(e => console.log(e));
    }
    handleChange(value, data, extra) {
        console.log(value, data, extra);
    } // 正常的item
    // value在 dataSouce里不存在时渲染。
    render() {
        return (React.createElement(CascaderSelect, { valueRender: this.valueRender, defaultValue: "432988", dataSource: this.state.data, onChange: this.handleChange }));
    }
}
ReactDOM.render(React.createElement(Demo, null), document.getElementById('cascader-select-demo-12'));
