import { defineVxeComponent } from '../../ui/src/comp';
import XEUtils from 'xe-utils';
import { getConfig, createEvent } from '../../ui';
function createReactData() {
    return {};
}
function createInternalData() {
    return {};
}
export default {
    name: 'VxeTableTransfer',
    props: {
        modelValue: Array,
        options: Array,
        size: {
            type: String,
            default: () => getConfig().tableTransfer.size || getConfig().size
        }
    },
    data() {
        const xID = XEUtils.uniqueId();
        const reactData = createReactData();
        return Object.assign(Object.assign({}, {}), { xID,
            reactData });
    },
    methods: {
        //
        // Method
        //
        dispatchEvent(type, params, evnt) {
            const $xeTableTransfer = this;
            $xeTableTransfer.$emit(type, createEvent(evnt, { $tableTransfer: $xeTableTransfer }, params));
        },
        emitModel(value) {
            const $xeTableTransfer = this;
            const { _events } = $xeTableTransfer;
            if (_events && _events.modelValue) {
                $xeTableTransfer.$emit('modelValue', value);
            }
            else {
                $xeTableTransfer.$emit('model-value', value);
            }
        },
        //
        // Render
        //
        renderVN(h) {
            const $xeTableTransfer = this;
            const slots = $xeTableTransfer.$scopedSlots;
            const defaultSlot = slots.default;
            return h('div', {
                ref: 'refElem',
                class: 'vxe-table-transfer'
            }, defaultSlot ? defaultSlot({}) : []);
        }
    },
    created() {
        const $xeUpload = this;
        $xeUpload.internalData = createInternalData();
    },
    beforeDestroy() {
        const $xeUpload = this;
        const reactData = $xeUpload.reactData;
        const internalData = $xeUpload.internalData;
        XEUtils.assign(reactData, createReactData());
        XEUtils.assign(internalData, createInternalData());
    },
    render(h) {
        return this.renderVN(h);
    }
};
