web/elements: add new API to store attributes in URL, use for table and tabs

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer
2021-11-18 21:01:58 +01:00
parent c363b1cfde
commit 465898c7d0
6 changed files with 83 additions and 13 deletions

View File

@ -19,6 +19,7 @@ import { groupBy } from "../../utils";
import "../EmptyState";
import "../chips/Chip";
import "../chips/ChipGroup";
import { getURLParams, updateURLParams } from "../router/RouteMatch";
import "./TablePagination";
import "./TableSearch";
@ -355,6 +356,9 @@ export abstract class Table<T> extends LitElement {
composed: true,
}),
);
updateURLParams({
search: value,
});
}}
>
</ak-table-search>`;
@ -393,6 +397,10 @@ export abstract class Table<T> extends LitElement {
}
firstUpdated(): void {
const params = getURLParams();
if ("search" in params) {
this.search = params.search;
}
this.fetch();
}