import type { VNode } from 'vue'; import { Prop, toNative } from 'vue-facing-decorator'; import TsxComponent, { Component } from '../../app/vuetsx'; import { isNullOrEmpty } from '../../common/utils/is-null-or-empty'; export interface DropdownButtonElementArgs { icon?: string; img?: ImageObj; text?: string | VNode; href?: string; disabled?: boolean; hrefBlank?: boolean; clicked?: () => void; isSelected?: boolean; emptySpace?: boolean; } export interface ImageObj { class?: string; src: string; text?: string; } @Component class DropdownButtonElementComponent extends TsxComponent implements DropdownButtonElementArgs { @Prop() icon!: string; @Prop() img!: ImageObj; @Prop() text!: string | VNode; @Prop() href!: string; @Prop() disabled!: boolean; @Prop() hrefBlank!: boolean; @Prop() isSelected!: boolean; @Prop() clicked?: () => void; @Prop() emptySpace!: boolean; raiseClickEvent() { if (this.disabled == true) { return; } if (this.clicked != null) { this.clicked(); } } render(h) { return (
this.raiseClickEvent()}> {!isNullOrEmpty(this.icon) && ( {this.emptySpace != false &&   } )} {this.img != null && ( {this.emptySpace != false &&   } {this.img.text} )} {this.text != null && {this.text}} {this.isSelected && } {this.$slots.default}
); } } const DropdownButtonElement = toNative(DropdownButtonElementComponent); export default DropdownButtonElement;