import { FormCascaderPickerDefaultProps } from './props';
import createComponent from '../createComponent';
import fmtEvent from '../../_util/fmtEvent';
createComponent({
    props: FormCascaderPickerDefaultProps,
    methods: {
        onOk: function (value, option, e) {
            this.emit('onChange', value);
            if (this.props.onOk) {
                this.props.onOk(value, option, fmtEvent(this.props, e));
            }
        },
        onPickerChange: function (value, option, e) {
            if (this.props.onPickerChange) {
                this.props.onPickerChange(value, option, fmtEvent(this.props, e));
            }
        },
        onVisibleChange: function (visible, e) {
            if (this.props.onVisibleChange) {
                this.props.onVisibleChange(visible, fmtEvent(this.props, e));
            }
        },
        onFormat: function (value, option) {
            if (this.props.onFormat) {
                return this.props.onFormat(value, option);
            }
        },
        onDismissPicker: function (e) {
            if (this.props.onCancel) {
                this.props.onCancel(fmtEvent(this.props, e));
            }
        },
        onChange: function (value, options, e) {
            if (this.props.onChange) {
                this.props.onChange(value, options, fmtEvent(this.props, e));
            }
        },
    },
});
