/**
 * 子操作
 * @author xiufu.wang
 */
import ElDropdownItem from 'mars-pro/packages/dropdown-item';
import baseMixin from './mixins/base';
//pro-sub-action默认样式
const DEFAULT_CLS_FOR_PRO_SUBACTION = {
    'pro-sub-action': true
}
export default {
    name: 'ProSubAction',
    componentName: 'ProSubAction',
    mixins: [baseMixin],
    components: {
        ElDropdownItem
    },
    props: {
        icon: String
    },
    methods: {},
    render() {
        const _datas = {
            props: {
                ...this.$attrs,
                disabled: this.isDisabled || !this.isAllow
            },
            'class': {
                ...DEFAULT_CLS_FOR_PRO_SUBACTION
            },
            nativeOn: {
                click: this.importUrl ? this.handleImportClick : this.debouncedHandleClick,
                mouseenter: this.handleMouseenter,
                mouseleave: this.handleMouseleave
            }
        }
        return (
            <ElDropdownItem {..._datas} ref="buttonRef">
                {this.icon && <i class={this.icon}></i>}
                <span>{this.$slots.default || this.text}</span>
                {
                    this.renderUploader()
                }
                {
                    this.toComponentUrl && this.renderComponentDialog()
                }
            </ElDropdownItem>
        )
    }
}