Skip to content

Commit

Permalink
Ensure result views are refreshed when checking/unchecking all in man…
Browse files Browse the repository at this point in the history
…age mode
  • Loading branch information
latonv committed Dec 30, 2023
1 parent d60368e commit c657f97
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/collection-browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -645,8 +645,8 @@ export class CollectionBrowser
showSelectAll
showUnselectAll
@removeItems=${this.handleRemoveItems}
@selectAll=${this.dataSource.checkAllTiles}
@unselectAll=${this.dataSource.uncheckAllTiles}
@selectAll=${() => this.dataSource.checkAllTiles()}
@unselectAll=${() => this.dataSource.uncheckAllTiles()}
@cancel=${() => {
this.isManageView = false;
this.dataSource.uncheckAllTiles();
Expand Down
16 changes: 10 additions & 6 deletions src/data-source/collection-browser-data-source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,9 @@ export class CollectionBrowserDataSource
return this.pages[pageNum]?.[indexOnPage];
}

/**
* @inheritdoc
*/
indexOf(tile: TileModel): number {
return Object.values(this.pages).flat().indexOf(tile);
}
Expand Down Expand Up @@ -401,26 +404,27 @@ export class CollectionBrowserDataSource
])
);
this.host.requestUpdate();
this.host.refreshVisibleResults();
}

/**
* @inheritdoc
*/
checkAllTiles(): void {
checkAllTiles = (): void => {
this.map(model => ({ ...model, checked: true }));
}
};

/**
* @inheritdoc
*/
uncheckAllTiles(): void {
uncheckAllTiles = (): void => {
this.map(model => ({ ...model, checked: false }));
}
};

/**
* @inheritdoc
*/
removeCheckedTiles(): void {
removeCheckedTiles = (): void => {
// To make sure our data source remains page-aligned, we will offset our data source by
// the number of removed tiles, so that we can just add the offset when the infinite
// scroller queries for cell contents.
Expand Down Expand Up @@ -458,7 +462,7 @@ export class CollectionBrowserDataSource
this.pages = newPages;
this.numTileModels -= numChecked;
this.host.requestUpdate();
}
};

/**
* @inheritdoc
Expand Down

0 comments on commit c657f97

Please sign in to comment.