diff --git a/frontend/src/components/ui/overflow-dropdown.ts b/frontend/src/components/ui/overflow-dropdown.ts index 1bc0ea8f78..fa9446924a 100644 --- a/frontend/src/components/ui/overflow-dropdown.ts +++ b/frontend/src/components/ui/overflow-dropdown.ts @@ -31,6 +31,9 @@ export class OverflowDropdown extends TailwindElement { @property({ type: Boolean }) raised = false; + @property({ type: String }) + size?: "x-small" | "small" | "medium"; + @state() private hasMenuItems?: boolean; @@ -47,7 +50,7 @@ export class OverflowDropdown extends TailwindElement { hoist distance=${ifDefined(this.raised ? "4" : undefined)} > - + { const page = parsePage(params.get(this.name)); - if (this.page !== page) { + if (this._page !== page) { this.dispatchEvent( new CustomEvent("page-change", { detail: { page: page, pages: this.pages }, composed: true, }), ); - this.page = page; + this._page = page; } }); @state() - page = 1; + private _page = 1; + + @property({ type: Number }) + set page(page: number) { + if (page !== this._page) { + this.setPage(page); + } + } + + get page() { + return this._page; + } @property({ type: String }) name = "page"; @@ -174,7 +185,7 @@ export class Pagination extends LitElement { private pages = 0; connectedCallback() { - this.inputValue = `${this.page}`; + this.inputValue = `${this._page}`; super.connectedCallback(); } @@ -186,14 +197,14 @@ export class Pagination extends LitElement { const parsedPage = parseFloat( this.searchParams.searchParams.get(this.name) ?? "1", ); - if (parsedPage != this.page) { + if (parsedPage != this._page) { const page = parsePage(this.searchParams.searchParams.get(this.name)); const constrainedPage = Math.max(1, Math.min(this.pages, page)); this.onPageChange(constrainedPage); } - if (changedProperties.get("page") && this.page) { - this.inputValue = `${this.page}`; + if (changedProperties.get("page") && this._page) { + this.inputValue = `${this._page}`; } } @@ -208,7 +219,7 @@ export class Pagination extends LitElement {