import Button from '../../button';
import Field from '..';
import Input from '../../input';
import React from 'react';
import ReactDOM from 'react-dom';
class Demo extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            show: true,
            show2: true,
        };
        this.field = new Field(this);
        this.field2 = new Field(this, { autoUnmount: false });
    }
    render() {
        return (React.createElement("div", null,
            this.state.show ? (React.createElement(Input, Object.assign({}, this.field.init('name', { initValue: 'autoUnmount = true' })))) : null,
            React.createElement(Button, { onClick: () => {
                    console.log('value auto delete', this.field.getValues());
                }, style: { marginLeft: 4 } }, "print"),
            React.createElement(Button, { onClick: () => this.setState({ show: false }), warning: true, style: { marginLeft: 4 } }, "delete"),
            React.createElement("br", null),
            React.createElement("br", null),
            this.state.show2 ? (React.createElement(Input, Object.assign({}, this.field2.init('name2', { initValue: 'autoUnmount = false' })))) : null,
            React.createElement(Button, { onClick: () => {
                    console.log('value always exist', this.field2.getValues());
                }, style: { marginLeft: 4 } }, "print"),
            React.createElement(Button, { onClick: () => this.setState({ show2: false }), warning: true, style: { marginLeft: 4 } }, "delete")));
    }
}
ReactDOM.render(React.createElement(Demo, null), document.getElementById('field-demo-9'));
