-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Fix min/max width #2855
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix min/max width #2855
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2855 +/- ##
=======================================
Coverage 96.22% 96.22%
=======================================
Files 37 38 +1
Lines 1244 1244
Branches 392 391 -1
=======================================
Hits 1197 1197
Misses 47 47
|
isLastFrozenColumn: false, | ||
rowGroup, | ||
width: rawColumn.width ?? defaultWidth, | ||
minWidth: rawColumn.minWidth ?? defaultMinWidth, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This way we initialize widths once and use them everywhere
https://github.com/adazzle/react-data-grid/blob/main/src/HeaderCell.tsx#L178
key: SELECT_COLUMN_KEY, | ||
name: '', | ||
width: 35, | ||
minWidth: 35, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needed now as the default min width is 80
{ selector: 'typeLike', format: ['PascalCase'] } | ||
], | ||
// TODO: fix | ||
'@typescript-eslint/naming-convention': 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this a bug or needs to be tweaked
const width = isRtl ? right + offset - event.clientX : event.clientX + offset - left; | ||
if (width > 0) { | ||
onColumnResize(column, width); | ||
onColumnResize(column, clampColumnWidth(width, column)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise DataGrid.onColumnResize
is called with wrong width as it does not respect min/max width
@@ -0,0 +1,40 @@ | |||
import type { CSSProperties } from 'react'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved style utils to a separate file
Cherry picked changes from #2839