-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
add possibility to inject header-row-renderer + typescript type declarations #600
Changes from all commits
6673565
ee8d428
bfda390
20c5572
eda5e8d
d0f2f3e
d5fb07b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** @flow */ | ||
import React from 'react' | ||
import type { HeaderRowRendererParams } from './types' | ||
|
||
export default function defaultHeaderRowRenderer ({ | ||
className, | ||
style, | ||
height, | ||
width, | ||
scrollbarWidth, | ||
columns | ||
}: HeaderRowRendererParams) { | ||
return <div | ||
className={className} | ||
style={{ | ||
...style, | ||
height: height, | ||
overflow: 'hidden', | ||
paddingRight: scrollbarWidth, | ||
width: width | ||
}} | ||
> | ||
{columns} | ||
</div> | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
/** @flow */ | ||
|
||
export type CellDataGetterParams = { | ||
columnData: ?any, | ||
dataKey: string, | ||
|
@@ -14,6 +13,15 @@ export type CellRendererParams = { | |
rowIndex: number | ||
}; | ||
|
||
export type HeaderRowRendererParams = { | ||
className: string, | ||
columns: any[], | ||
style: any, | ||
scrollbarWidth: number, | ||
height: number, | ||
width: number | ||
}; | ||
|
||
export type HeaderRendererParams = { | ||
columnData: ?any, | ||
dataKey: string, | ||
|
@@ -25,7 +33,7 @@ export type HeaderRendererParams = { | |
|
||
export type RowRendererParams = { | ||
className: string, | ||
columns: Array, | ||
columns: any[], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm, why was this change required? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm I think it just slipped in when I implemented the new types, or perhaps I tried to find an easy to implement more specific type information for this array ;). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed! I just wanted to ask in case there was a difference I was unaware of. 😄 |
||
index: number, | ||
isScrolling: boolean, | ||
onRowClick: ?Function, | ||
|
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.
I think the
style
parameter passed should have all of the values preset, just like we pre-append a customrowClass
. This is more inline with what we do for other *renderer props. Users can then override (if they want) specific styles or just pass them through as-is by default.I'll make this change myself before merging, just commenting to let you know my rationale.
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.
ok good to know