Upgrade HideScrollbar
This commit is contained in:
@@ -52,13 +52,13 @@ export interface HideScrollbarElement {
|
|||||||
const HideScrollbar = forwardRef<HideScrollbarElement, HideScrollbarProps>(
|
const HideScrollbar = forwardRef<HideScrollbarElement, HideScrollbarProps>(
|
||||||
(
|
(
|
||||||
{
|
{
|
||||||
isPreventScroll,
|
isPreventScroll = false,
|
||||||
isPreventVerticalScroll,
|
isPreventVerticalScroll = false,
|
||||||
isPreventHorizontalScroll,
|
isPreventHorizontalScroll = false,
|
||||||
isShowVerticalScrollbar,
|
isShowVerticalScrollbar = true,
|
||||||
isHiddenVerticalScrollbarWhenFull,
|
isHiddenVerticalScrollbarWhenFull = true,
|
||||||
isShowHorizontalScrollbar,
|
isShowHorizontalScrollbar = true,
|
||||||
isHiddenHorizontalScrollbarWhenFull,
|
isHiddenHorizontalScrollbarWhenFull = true,
|
||||||
minWidth,
|
minWidth,
|
||||||
minHeight,
|
minHeight,
|
||||||
scrollbarWidth,
|
scrollbarWidth,
|
||||||
@@ -536,20 +536,21 @@ const HideScrollbar = forwardRef<HideScrollbarElement, HideScrollbarProps>(
|
|||||||
{children}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{isShowVerticalScrollbar &&
|
||||||
|
(!isHiddenVerticalScrollbarWhenFull || verticalScrollbarLength < 100) && (
|
||||||
<div
|
<div
|
||||||
hidden={
|
|
||||||
!isShowVerticalScrollbar ||
|
|
||||||
((isHiddenVerticalScrollbarWhenFull ?? true) &&
|
|
||||||
verticalScrollbarLength >= 100)
|
|
||||||
}
|
|
||||||
className={`scrollbar vertical-scrollbar${
|
className={`scrollbar vertical-scrollbar${
|
||||||
verticalScrollbarAutoHide ? ' hide' : ''
|
verticalScrollbarAutoHide ? ' hide' : ''
|
||||||
}`}
|
}`}
|
||||||
style={{
|
style={{
|
||||||
height: maskRef.current ? maskRef.current?.clientHeight - 1 : undefined,
|
height: maskRef.current
|
||||||
|
? maskRef.current?.clientHeight - 1
|
||||||
|
: undefined,
|
||||||
top: maskRef.current?.clientTop,
|
top: maskRef.current?.clientTop,
|
||||||
left: maskRef.current
|
left: maskRef.current
|
||||||
? maskRef.current?.clientLeft + maskRef.current?.clientWidth - 1
|
? maskRef.current?.clientLeft +
|
||||||
|
maskRef.current?.clientWidth -
|
||||||
|
1
|
||||||
: undefined
|
: undefined
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -575,20 +576,23 @@ const HideScrollbar = forwardRef<HideScrollbarElement, HideScrollbarProps>(
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
|
{isShowHorizontalScrollbar &&
|
||||||
|
(!isHiddenHorizontalScrollbarWhenFull ||
|
||||||
|
horizontalScrollbarLength < 100) && (
|
||||||
<div
|
<div
|
||||||
hidden={
|
|
||||||
!isShowHorizontalScrollbar ||
|
|
||||||
((isHiddenHorizontalScrollbarWhenFull ?? true) &&
|
|
||||||
horizontalScrollbarLength >= 100)
|
|
||||||
}
|
|
||||||
className={`scrollbar horizontal-scrollbar${
|
className={`scrollbar horizontal-scrollbar${
|
||||||
horizontalScrollbarAutoHide ? ' hide' : ''
|
horizontalScrollbarAutoHide ? ' hide' : ''
|
||||||
}`}
|
}`}
|
||||||
style={{
|
style={{
|
||||||
width: maskRef.current ? maskRef.current?.clientWidth - 1 : undefined,
|
width: maskRef.current
|
||||||
|
? maskRef.current?.clientWidth - 1
|
||||||
|
: undefined,
|
||||||
left: maskRef.current?.clientLeft,
|
left: maskRef.current?.clientLeft,
|
||||||
top: maskRef.current
|
top: maskRef.current
|
||||||
? maskRef.current?.clientTop + maskRef.current?.clientHeight - 1
|
? maskRef.current?.clientTop +
|
||||||
|
maskRef.current?.clientHeight -
|
||||||
|
1
|
||||||
: undefined
|
: undefined
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -614,6 +618,7 @@ const HideScrollbar = forwardRef<HideScrollbarElement, HideScrollbarProps>(
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user