import { Prop, toNative } from 'vue-facing-decorator'; import { globalState } from '../../app/global-state'; import TsxComponent, { Component } from '../../app/vuetsx'; import { PortalUtils } from '../../common/utils/utils'; interface CollapseArgs { cssClass?: string; } @Component class CollapseComponent extends TsxComponent implements CollapseArgs { @Prop() cssClass?: string; uuid: string = null; mounted() { this.uuid = `clp-${PortalUtils.randomString(6)}`; } toggle() { if (!globalState.windowExists) { return; } this.getInnerButton()?.click(); } isShown(): boolean { if (!globalState.windowExists) { return false; } return this.getInnerButton().getAttribute('aria-expanded') == 'true'; } private getInnerButton() { return document.getElementById(`${this.uuid}-btn`); } render(h) { return (
{this.$slots.default}
); } } const Collapse = toNative(CollapseComponent); export default Collapse;