@mui/x-data-grid-pro
Version:
The Pro plan edition of the MUI X Data Grid components.
26 lines • 1.27 kB
text/typescript
/**
* Grid-level metrics measured from a hidden sample chip rendered by `GridMultiSelectMeasurer`.
* Used by chip cells to size the `+N` overflow chip without hardcoding font/style assumptions.
*/
export interface GridMultiSelectOverflowMetrics {
/**
* Width (in CSS pixels) of the `+N` overflow chip, indexed by digit count.
* `overflowChipWidths[0]` = width for 1-digit "+9", `[1]` = "+99", `[2]` = "+999".
* For `hiddenCount` ≥ 10⁴, the last entry is reused.
*/
overflowChipWidths: number[];
/** Gap between sibling chips, read from the chip row's computed style. */
gap: number;
}
/**
* Per-grid cache for multiSelect runtime data.
* `getOverflowMetrics` / `setOverflowMetrics` / `subscribeOverflowMetrics`: grid-level overflow
* chip metrics produced by the single `GridMultiSelectMeasurer` mounted in the grid root,
* consumed by every multiSelect chip cell (the metrics are identical across columns).
*/
export interface GridMultiSelectInternalCache {
getOverflowMetrics: () => GridMultiSelectOverflowMetrics | null;
setOverflowMetrics: (metrics: GridMultiSelectOverflowMetrics) => void;
subscribeOverflowMetrics: (callback: (metrics: GridMultiSelectOverflowMetrics | null) => void) => () => void;
teardown: () => void;
}