web/elements: add bulk delete form
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
@ -123,6 +123,9 @@ export abstract class Table<T> extends LitElement {
|
||||
@property({ attribute: false })
|
||||
selectedElements: T[] = [];
|
||||
|
||||
@property({ type: Boolean })
|
||||
paginated = true;
|
||||
|
||||
@property({ type: Boolean })
|
||||
expandable = false;
|
||||
|
||||
@ -326,6 +329,33 @@ export abstract class Table<T> extends LitElement {
|
||||
return html``;
|
||||
}
|
||||
|
||||
renderToolbarContainer(): TemplateResult {
|
||||
return html`<div class="pf-c-toolbar">
|
||||
<div class="pf-c-toolbar__content">
|
||||
<div class="pf-m-search-filter">${this.renderSearch()}</div>
|
||||
<div class="pf-c-toolbar__bulk-select">${this.renderToolbar()}</div>
|
||||
<div class="pf-c-toolbar__group">${this.renderToolbarAfter()}</div>
|
||||
<div class="pf-c-toolbar__group">${this.renderToolbarSelected()}</div>
|
||||
${this.paginated
|
||||
? html`<ak-table-pagination
|
||||
class="pf-c-toolbar__item pf-m-pagination"
|
||||
.pages=${this.data?.pagination}
|
||||
.pageChangeHandler=${(page: number) => {
|
||||
this.page = page;
|
||||
this.dispatchEvent(
|
||||
new CustomEvent(EVENT_REFRESH, {
|
||||
bubbles: true,
|
||||
composed: true,
|
||||
}),
|
||||
);
|
||||
}}
|
||||
>
|
||||
</ak-table-pagination>`
|
||||
: html``}
|
||||
</div>
|
||||
</div>`;
|
||||
}
|
||||
|
||||
firstUpdated(): void {
|
||||
this.fetch();
|
||||
}
|
||||
@ -338,28 +368,7 @@ export abstract class Table<T> extends LitElement {
|
||||
})}
|
||||
</ak-chip-group>`
|
||||
: html``}
|
||||
<div class="pf-c-toolbar">
|
||||
<div class="pf-c-toolbar__content">
|
||||
<div class="pf-m-search-filter">${this.renderSearch()}</div>
|
||||
<div class="pf-c-toolbar__bulk-select">${this.renderToolbar()}</div>
|
||||
<div class="pf-c-toolbar__group">${this.renderToolbarAfter()}</div>
|
||||
<div class="pf-c-toolbar__group">${this.renderToolbarSelected()}</div>
|
||||
<ak-table-pagination
|
||||
class="pf-c-toolbar__item pf-m-pagination"
|
||||
.pages=${this.data?.pagination}
|
||||
.pageChangeHandler=${(page: number) => {
|
||||
this.page = page;
|
||||
this.dispatchEvent(
|
||||
new CustomEvent(EVENT_REFRESH, {
|
||||
bubbles: true,
|
||||
composed: true,
|
||||
}),
|
||||
);
|
||||
}}
|
||||
>
|
||||
</ak-table-pagination>
|
||||
</div>
|
||||
</div>
|
||||
${this.renderToolbarContainer()}
|
||||
<table class="pf-c-table pf-m-compact pf-m-grid-md pf-m-expandable">
|
||||
<thead>
|
||||
<tr role="row">
|
||||
@ -384,22 +393,24 @@ export abstract class Table<T> extends LitElement {
|
||||
</thead>
|
||||
${this.isLoading || !this.data ? this.renderLoading() : this.renderRows()}
|
||||
</table>
|
||||
<div class="pf-c-pagination pf-m-bottom">
|
||||
<ak-table-pagination
|
||||
class="pf-c-toolbar__item pf-m-pagination"
|
||||
.pages=${this.data?.pagination}
|
||||
.pageChangeHandler=${(page: number) => {
|
||||
this.page = page;
|
||||
this.dispatchEvent(
|
||||
new CustomEvent(EVENT_REFRESH, {
|
||||
bubbles: true,
|
||||
composed: true,
|
||||
}),
|
||||
);
|
||||
}}
|
||||
>
|
||||
</ak-table-pagination>
|
||||
</div>`;
|
||||
${this.paginated
|
||||
? html` <div class="pf-c-pagination pf-m-bottom">
|
||||
<ak-table-pagination
|
||||
class="pf-c-toolbar__item pf-m-pagination"
|
||||
.pages=${this.data?.pagination}
|
||||
.pageChangeHandler=${(page: number) => {
|
||||
this.page = page;
|
||||
this.dispatchEvent(
|
||||
new CustomEvent(EVENT_REFRESH, {
|
||||
bubbles: true,
|
||||
composed: true,
|
||||
}),
|
||||
);
|
||||
}}
|
||||
>
|
||||
</ak-table-pagination>
|
||||
</div>`
|
||||
: html``}`;
|
||||
}
|
||||
|
||||
render(): TemplateResult {
|
||||
|
Reference in New Issue
Block a user