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