mirror of
https://github.com/Sea-Haven-Industries/seahaven-ap.git
synced 2026-10-07 16:18:53 +00:00
13 lines
450 B
TypeScript
13 lines
450 B
TypeScript
import type { GridRowId, GridRowSelectionModel } from "@mui/x-data-grid";
|
|
|
|
/** Resolve selected row count for MUI DataGrid v8 include/exclude selection models. */
|
|
export function countSelectedRows(
|
|
selection: GridRowSelectionModel,
|
|
rowIds: readonly GridRowId[],
|
|
): number {
|
|
if (selection.type === "include") {
|
|
return rowIds.filter((id) => selection.ids.has(id)).length;
|
|
}
|
|
|
|
return rowIds.filter((id) => !selection.ids.has(id)).length;
|
|
}
|