import { Tooltip } from 'bootstrap'; import { Prop, toNative } from 'vue-facing-decorator'; import TsxComponent, { Component } from '../../app/vuetsx'; import { isNullOrEmpty } from '../../common/utils/is-null-or-empty'; import { AlertLayout } from './alert-layout'; interface AlertArgs { cssClass?: string; layout?: AlertLayout; tooltip?: string; } @Component class AlertComponent extends TsxComponent implements AlertArgs { @Prop() cssClass!: string; @Prop() layout!: AlertLayout; @Prop() tooltip!: string; getCssClass(): string { return ( this.getParsedLayout() + (this.cssClass != null ? ` ${this.cssClass}` : '') ); } getParsedLayout() { return this.layout ?? AlertLayout.Primary; } mounted() { if (!isNullOrEmpty(this.tooltip)) { new Tooltip(this.$el); } } render(h) { return ( ); } } const Alert = toNative(AlertComponent); export default Alert;