import { __assign } from "tslib";
import { FormTextareaDefaultProps } from './props';
import { createForm } from '../form';
import fmtEvent from '../../_util/fmtEvent';
Component({
    props: FormTextareaDefaultProps,
    mixins: [createForm({
            methods: {
                setFormData: function (values) {
                    this.setData(__assign(__assign({}, this.data), { formData: __assign(__assign({}, this.data.formData), values) }));
                    this.input.update(this.data.formData.value);
                },
            }
        })],
    methods: {
        handleRef: function (input) {
            this.input = input;
        },
        onChange: function (value, e) {
            this.emit('onChange', value);
            if (this.props.onChange) {
                this.props.onChange(value, fmtEvent(this.props, e));
            }
        },
        onBlur: function (value, e) {
            if (this.props.onBlur) {
                this.props.onBlur(value, fmtEvent(this.props, e));
            }
        },
        onFocus: function (value, e) {
            if (this.props.onFocus) {
                this.props.onFocus(value, fmtEvent(this.props, e));
            }
        },
        onConfirm: function (value, e) {
            if (this.props.onConfirm) {
                this.props.onConfirm(value, fmtEvent(this.props, e));
            }
        },
        onClear: function (value, e) {
            this.emit('onChange', '');
            if (this.props.onChange) {
                this.props.onChange(value, fmtEvent(this.props, e));
            }
        },
    }
});
