Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ts/WoltLabSuite/Core/Component/GridView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ export class GridView {

this.#table.addEventListener("interaction:remove", (event) => {
(event.target as HTMLElement).remove();
this.#state.removeSelection(parseInt((event.target as HTMLElement).dataset.objectId!));
this.#checkEmptyTable();
});

Expand Down
10 changes: 10 additions & 0 deletions ts/WoltLabSuite/Core/Component/GridView/Selection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,16 @@ export class Selection extends EventTarget {
this.#updateSelectionBar();
}

removeSelection(objectId: number): void {
const selectedIds = this.getSelectedIds();
if (selectedIds.indexOf(objectId) !== -1) {
selectedIds.splice(selectedIds.indexOf(objectId), 1);
window.localStorage.setItem(this.#getStorageKey(), JSON.stringify(selectedIds));
}

this.#change();
}

#initBulkInteractions(): void {
if (!this.#bulkInteractionButton) {
return;
Expand Down
4 changes: 4 additions & 0 deletions ts/WoltLabSuite/Core/Component/GridView/State.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@ export class State extends EventTarget {
this.#selection.resetSelection();
}

removeSelection(objectId: number): void {
this.#selection.removeSelection(objectId);
}

refreshSelection(): void {
this.#selection.refresh();
}
Expand Down
1 change: 1 addition & 0 deletions ts/WoltLabSuite/Core/Component/ListView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export class ListView {

this.#viewElement.addEventListener("interaction:remove", (event) => {
(event.target as HTMLElement).remove();
this.#state.removeSelection(parseInt((event.target as HTMLElement).dataset.objectId!));
this.#checkEmptyList();
});

Expand Down
10 changes: 10 additions & 0 deletions ts/WoltLabSuite/Core/Component/ListView/Selection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,16 @@ export class Selection extends EventTarget {
this.#updateSelectionBar();
}

removeSelection(objectId: number): void {
const selectedIds = this.getSelectedIds();
if (selectedIds.indexOf(objectId) !== -1) {
selectedIds.splice(selectedIds.indexOf(objectId), 1);
window.localStorage.setItem(this.#getStorageKey(), JSON.stringify(selectedIds));
}

this.#change();
}

#initBulkInteractions(): void {
if (!this.#bulkInteractionButton) {
return;
Expand Down
4 changes: 4 additions & 0 deletions ts/WoltLabSuite/Core/Component/ListView/State.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,10 @@ export class State extends EventTarget {
this.#selection.resetSelection();
}

removeSelection(objectId: number): void {
this.#selection.removeSelection(objectId);
}

refreshSelection(): void {
this.#selection.refresh();
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.