forked from adazzle/react-data-grid
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add invisible cells to measure column widths regardless of column spa…
…nning (adazzle#3024) * Add invisible cells to measure column widths regardless of column spanning * rm log * tweak comment * fix odd subpixel rendering * tweaked comment * typo * add layer
- Loading branch information
Showing
8 changed files
with
53 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { css } from '@linaria/core'; | ||
import type { CalculatedColumn } from '../types'; | ||
|
||
const measuringCellClassname = css` | ||
@layer rdg.MeasuringCell { | ||
contain: strict; | ||
grid-row: 1; | ||
visibility: hidden; | ||
} | ||
`; | ||
|
||
export function renderMeasuringCells<R, SR>({ | ||
viewportColumns | ||
}: { | ||
viewportColumns: readonly CalculatedColumn<R, SR>[]; | ||
}) { | ||
return ( | ||
<> | ||
{viewportColumns.map(({ key, idx, minWidth, maxWidth }) => ( | ||
<div | ||
key={key} | ||
className={measuringCellClassname} | ||
style={{ gridColumnStart: idx + 1, minWidth, maxWidth }} | ||
data-measuring-cell-key={key} | ||
/> | ||
))} | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters