import { CSSResult, customElement, html, LitElement, property, TemplateResult } from "lit-element"; import { Table } from "./Table"; import { COMMON_STYLES } from "../../common/styles"; @customElement("pb-table-pagination") export class TablePagination extends LitElement { @property() table?: Table; static get styles(): CSSResult[] { return COMMON_STYLES; } previousHandler(): void { if (!this.table?.data?.pagination.previous) { console.debug("passbook/tables: no previous"); return; } this.table.page = this.table?.data?.pagination.previous; } nextHandler(): void { if (!this.table?.data?.pagination.next) { console.debug("passbook/tables: no next"); return; } this.table.page = this.table?.data?.pagination.next; } render(): TemplateResult { return html`
${this.table?.data?.pagination.start_index} - ${this.table?.data?.pagination.end_index} of ${this.table?.data?.pagination.count}
`; } }