|
@@ -7,10 +7,10 @@ interface Props {
|
|
|
autoHide?: boolean;
|
|
autoHide?: boolean;
|
|
|
autoHideTimeout?: number;
|
|
autoHideTimeout?: number;
|
|
|
autoHideDuration?: number;
|
|
autoHideDuration?: number;
|
|
|
- autoMaxHeight?: string;
|
|
|
|
|
|
|
+ autoHeightMax?: string;
|
|
|
hideTracksWhenNotNeeded?: boolean;
|
|
hideTracksWhenNotNeeded?: boolean;
|
|
|
scrollTop?: number;
|
|
scrollTop?: number;
|
|
|
- setScrollTop: (value: React.MouseEvent<HTMLElement>) => void;
|
|
|
|
|
|
|
+ setScrollTop: (event: any) => void;
|
|
|
autoHeightMin?: number | string;
|
|
autoHeightMin?: number | string;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -20,13 +20,13 @@ interface Props {
|
|
|
export class CustomScrollbar extends PureComponent<Props> {
|
|
export class CustomScrollbar extends PureComponent<Props> {
|
|
|
static defaultProps: Partial<Props> = {
|
|
static defaultProps: Partial<Props> = {
|
|
|
customClassName: 'custom-scrollbars',
|
|
customClassName: 'custom-scrollbars',
|
|
|
- autoHide: true,
|
|
|
|
|
|
|
+ autoHide: false,
|
|
|
autoHideTimeout: 200,
|
|
autoHideTimeout: 200,
|
|
|
autoHideDuration: 200,
|
|
autoHideDuration: 200,
|
|
|
- autoMaxHeight: '100%',
|
|
|
|
|
- hideTracksWhenNotNeeded: false,
|
|
|
|
|
setScrollTop: () => {},
|
|
setScrollTop: () => {},
|
|
|
- autoHeightMin: '0'
|
|
|
|
|
|
|
+ hideTracksWhenNotNeeded: false,
|
|
|
|
|
+ autoHeightMin: '0',
|
|
|
|
|
+ autoHeightMax: '100%',
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
private ref: React.RefObject<Scrollbars>;
|
|
private ref: React.RefObject<Scrollbars>;
|
|
@@ -45,7 +45,7 @@ export class CustomScrollbar extends PureComponent<Props> {
|
|
|
} else {
|
|
} else {
|
|
|
ref.scrollTop(this.props.scrollTop);
|
|
ref.scrollTop(this.props.scrollTop);
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
componentDidMount() {
|
|
@@ -57,16 +57,30 @@ export class CustomScrollbar extends PureComponent<Props> {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
render() {
|
|
|
- const { customClassName, children, autoMaxHeight } = this.props;
|
|
|
|
|
|
|
+ const {
|
|
|
|
|
+ customClassName,
|
|
|
|
|
+ children,
|
|
|
|
|
+ autoHeightMax,
|
|
|
|
|
+ autoHeightMin,
|
|
|
|
|
+ setScrollTop,
|
|
|
|
|
+ autoHide,
|
|
|
|
|
+ autoHideTimeout,
|
|
|
|
|
+ hideTracksWhenNotNeeded,
|
|
|
|
|
+ } = this.props;
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
<Scrollbars
|
|
<Scrollbars
|
|
|
ref={this.ref}
|
|
ref={this.ref}
|
|
|
className={customClassName}
|
|
className={customClassName}
|
|
|
|
|
+ onScroll={setScrollTop}
|
|
|
autoHeight={true}
|
|
autoHeight={true}
|
|
|
|
|
+ autoHide={autoHide}
|
|
|
|
|
+ autoHideTimeout={autoHideTimeout}
|
|
|
|
|
+ hideTracksWhenNotNeeded={hideTracksWhenNotNeeded}
|
|
|
// These autoHeightMin & autoHeightMax options affect firefox and chrome differently.
|
|
// These autoHeightMin & autoHeightMax options affect firefox and chrome differently.
|
|
|
// Before these where set to inhert but that caused problems with cut of legends in firefox
|
|
// Before these where set to inhert but that caused problems with cut of legends in firefox
|
|
|
- autoHeightMax={autoMaxHeight}
|
|
|
|
|
|
|
+ autoHeightMax={autoHeightMax}
|
|
|
|
|
+ autoHeightMin={autoHeightMin}
|
|
|
renderTrackHorizontal={props => <div {...props} className="track-horizontal" />}
|
|
renderTrackHorizontal={props => <div {...props} className="track-horizontal" />}
|
|
|
renderTrackVertical={props => <div {...props} className="track-vertical" />}
|
|
renderTrackVertical={props => <div {...props} className="track-vertical" />}
|
|
|
renderThumbHorizontal={props => <div {...props} className="thumb-horizontal" />}
|
|
renderThumbHorizontal={props => <div {...props} className="thumb-horizontal" />}
|