import { __assign } from "tslib";
import { Component, triggerEvent } from '../../_util/simply';
import { resolveEventValue } from '../../_util/platform';
import { FormTextareaDefaultProps } from './props';
import { createForm } from '../form';
Component(FormTextareaDefaultProps, {
    handleRef: function (input) {
        this.input = input;
    },
    onChange: function (value, e) {
        this.emit('onChange', resolveEventValue(value));
        triggerEvent(this, 'change', resolveEventValue(value), e);
    },
    onBlur: function (value, e) {
        triggerEvent(this, 'blur', resolveEventValue(value), e);
    },
    onFocus: function (value, e) {
        triggerEvent(this, 'focus', resolveEventValue(value), e);
    },
    onConfirm: function (value, e) {
        triggerEvent(this, 'confirm', resolveEventValue(value), e);
    },
    onClear: function (value, e) {
        this.emit('onChange', '');
        triggerEvent(this, 'change', resolveEventValue(value), e);
    },
}, null, [
    createForm({
        methods: {
            setFormData: function (values) {
                this.setData(__assign(__assign({}, this.data), { formData: __assign(__assign({}, this.data.formData), values) }));
                this.input && this.input.update(this.data.formData.value);
            },
        },
    }),
]);
