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; }