Add more types to MultiGrid component
parent
14e1b26b61
commit
3cc66e1a0d
|
@ -4,22 +4,27 @@ import classnames from 'classnames'
|
|||
import {Scrollbars} from 'react-custom-scrollbars'
|
||||
import {ErrorHandling} from 'src/shared/decorators/errors'
|
||||
|
||||
interface DefaultProps {
|
||||
autoHide: boolean
|
||||
autoHeight: boolean
|
||||
maxHeight: number
|
||||
setScrollTop: (value: React.MouseEvent<JSX.Element>) => void
|
||||
style: React.CSSProperties
|
||||
}
|
||||
|
||||
interface Props {
|
||||
autoHide?: boolean
|
||||
autoHeight?: boolean
|
||||
maxHeight?: number
|
||||
className?: string
|
||||
setScrollTop?: (value: React.MouseEvent<JSX.Element>) => void
|
||||
style?: React.CSSProperties
|
||||
scrollTop?: number
|
||||
scrollLeft?: number
|
||||
}
|
||||
|
||||
@ErrorHandling
|
||||
class FancyScrollbar extends Component<Props> {
|
||||
class FancyScrollbar extends Component<Props & Partial<DefaultProps>> {
|
||||
public static defaultProps = {
|
||||
autoHide: true,
|
||||
autoHeight: false,
|
||||
maxHeight: null,
|
||||
style: {},
|
||||
setScrollTop: () => {},
|
||||
}
|
||||
|
||||
|
@ -32,11 +37,11 @@ class FancyScrollbar extends Component<Props> {
|
|||
|
||||
public updateScroll() {
|
||||
const ref = this.ref.current
|
||||
if (ref && _.isNumber(this.props.scrollTop)) {
|
||||
if (ref && !_.isNil(this.props.scrollTop)) {
|
||||
ref.scrollTop(this.props.scrollTop)
|
||||
}
|
||||
|
||||
if (ref && _.isNumber(this.props.scrollLeft)) {
|
||||
if (ref && !_.isNil(this.props.scrollLeft)) {
|
||||
ref.scrollLeft(this.props.scrollLeft)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ interface IndexParam {
|
|||
index: number
|
||||
}
|
||||
|
||||
export default class CellMeasurerCacheDecorator {
|
||||
class CellMeasurerCacheDecorator {
|
||||
private cellMeasurerCache: CellMeasurerCache
|
||||
private columnIndexOffset: number
|
||||
private rowIndexOffset: number
|
||||
|
@ -101,3 +101,5 @@ export default class CellMeasurerCacheDecorator {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default CellMeasurerCacheDecorator
|
||||
|
|
|
@ -31,7 +31,7 @@ interface Props {
|
|||
scrollToRow?: () => {}
|
||||
onSectionRendered?: () => {}
|
||||
scrollToColumn?: () => {}
|
||||
cellRenderer?: (arg: object) => {}
|
||||
cellRenderer?: (arg: object) => JSX.Element
|
||||
}
|
||||
|
||||
interface State {
|
||||
|
@ -321,7 +321,10 @@ class MultiGrid extends React.PureComponent<Props, State> {
|
|||
)
|
||||
}
|
||||
|
||||
public cellRendererBottomLeftGrid = ({rowIndex, ...rest}) => {
|
||||
public cellRendererBottomLeftGrid = ({
|
||||
rowIndex,
|
||||
...rest
|
||||
}: Partial<Props> & {rowIndex: number; key: string}): JSX.Element => {
|
||||
const {cellRenderer, fixedRowCount, rowCount} = this.props
|
||||
|
||||
if (rowIndex === rowCount - fixedRowCount) {
|
||||
|
|
Loading…
Reference in New Issue