import React from 'react';
import ReactDOM from 'react-dom';
import Upload from '..';
import { Button, Icon } from '../..';
class App extends React.Component {
    constructor() {
        super(...arguments);
        this.saveUploaderRef = ref => {
            if (!ref.typeahead)
                return;
            this.uploaderRef = ref.typeahead.getInstance();
        };
        this.onSubmit = () => {
            if (!this.uploaderRef)
                return;
            this.uploaderRef.startUpload();
        };
    }
    beforeUpload(info, options) {
        console.log('beforeUpload callback : ', info, options);
        return options;
    }
    render() {
        return (React.createElement("div", null,
            React.createElement(Upload, { action: "https://www.easy-mock.com/mock/5b713974309d0d7d107a74a3/alifd/upload", autoUpload: false, ref: this.saveUploaderRef, listType: "image", beforeUpload: this.beforeUpload, useDataURL: true },
                React.createElement(Button, { style: { marginBottom: 8 } },
                    React.createElement(Icon, { type: "upload" }),
                    "Select File")),
            React.createElement("br", null),
            React.createElement(Button, { type: "primary", onClick: this.onSubmit }, "Upload")));
    }
}
ReactDOM.render(React.createElement(App, null), document.getElementById('upload-demo-8'));
