import type { TableWrapperChannel } from '../table-wrapper/table-wrapper-channel'; import { Inject, Prop, toNative } from 'vue-facing-decorator'; import TsxComponent, { Component } from '../../app/vuetsx'; import { isNullOrEmpty } from '../../common/utils/is-null-or-empty'; import { PortalUtils } from '../../common/utils/utils'; import { TABLE_WRAPPER_KEY } from '../table-wrapper/table-wrapper-channel'; interface DataTableUpperButtonsWrapperArgs { hasCheckbox?: boolean; cssClass?: string; } @Component class DataTableUpperButtonsWrapperComponent extends TsxComponent implements DataTableUpperButtonsWrapperArgs { @Prop() hasCheckbox?: boolean; @Prop() cssClass?: string; @Inject({ from: TABLE_WRAPPER_KEY, default: null }) tableWrapper!: TableWrapperChannel | null; private getCssClass(): string { let builder = 'table-upper-buttons-wrap'; if (this.hasCheckbox) { builder += ' wrap-has-checkbox'; } if (this.tableWrapper?.massOperations) { builder += ' table-upper-buttons-wrap--mass-operations'; } if (!isNullOrEmpty(this.cssClass)) { builder += ` ${this.cssClass}`; } return builder; } private render(h) { if (PortalUtils.isIOS()) { return (
{this.$slots.default?.()}
); } else { return
{this.$slots.default?.()}
; } } } const DataTableUpperButtonsWrapper = toNative(DataTableUpperButtonsWrapperComponent); export default DataTableUpperButtonsWrapper;