import { Component, Prop, Vue } from "vue-property-decorator"; // Components import Status from "@/components/Status/index.vue"; import Label from "@/components/Label/index.vue"; import Dropdown from "@/components/Dropdown/index.vue"; import Button from "@/components/Button/index.vue"; import { LoadPatternTblCard,TableColumnInfo,TableRowData } from "@/types"; import tblCardLoading from "./_loading/tblCardLoading.vue"; import TypeRenderer from "../_typeRenderer/index.vue"; @Component({ components: { Status, Label, TypeRenderer, Dropdown, Button, tblCardLoading, }, }) export default class Logic extends Vue { @Prop({ type: Object }) readonly td!: TableRowData[]; @Prop({ type: Array }) readonly columns!: TableColumnInfo[]; @Prop({ type: Boolean }) readonly bordered?: boolean; @Prop({ type: Array }) readonly actions?: []; @Prop({ type: String }) readonly routeName?: string; @Prop({ type: [String, Number] }) readonly linkId!: string | number; @Prop({ type: Object }) readonly params?: any; @Prop({ type: Function }) readonly handleClickFromOutside?: () => void; @Prop({ type: Boolean }) readonly loading?: boolean; @Prop({ type: Boolean }) readonly isCardScreen!: boolean; @Prop({ type: String }) readonly loadPattern!: LoadPatternTblCard; @Prop({ type: Number, default: 5 }) readonly loadingNumber!: number; get headerRight(): TableRowData { return Object.values(this.td)[0]; } get headerLeft(): TableRowData[] { return Object.values(this.td).filter( (obj: TableRowData) => obj.type === 'status' || obj.type === 'actions' || obj.type === 'label', ); } get rendredData(): TableColumnInfo[] { return this.columns.filter( (obj: TableColumnInfo, index: number) => obj.key !== 'status' && obj.key !== 'actions' && index !== 0, ); } linkHandler(): void { this.$router.push({ name: this.routeName, params: { id: this.linkId.toString(), ...this.params } }); } }