@@ -42,18 +42,26 @@ const FlexWrapper = styled.div`
4242 height: 100%;
4343 display: flex;
4444 align-items: center;
45- justify-content: center;
46- flex-wrap: 'wrap'};
45+ // justify-content: center;
4746` ;
4847
49- const ListOrientationWrapper = styled . div < { $isHorizontal : boolean , $autoHeight : boolean } > `
48+ const ListOrientationWrapper = styled . div < {
49+ $isHorizontal : boolean ,
50+ $autoHeight : boolean ,
51+ $isGrid : boolean ,
52+ } > `
5053 height: ${ ( props ) => ( props . $autoHeight ? "auto" : "100%" ) } ;
5154 display: flex;
52- flex-direction: ${ ( props ) => ( props . $isHorizontal ? "row" : "column" ) } ;
55+ flex-direction: ${ ( props ) => ( props . $isHorizontal && ! props . $isGrid ? "row" : "column" ) } ;
5356 height: 100%;
5457` ;
5558
56- const MinHorizontalWidthContext = createContext ( {
59+ type MinHorizontalWidthContextType = {
60+ horizontalWidth : string ,
61+ minHorizontalWidth ?: string ,
62+ }
63+
64+ const MinHorizontalWidthContext = createContext < MinHorizontalWidthContextType > ( {
5765 horizontalWidth : '100%' ,
5866 minHorizontalWidth : '100px' ,
5967} ) ;
@@ -63,11 +71,12 @@ const ContainerInListView = (props: ContainerBaseProps ) => {
6371 horizontalWidth,
6472 minHorizontalWidth
6573 } = useContext ( MinHorizontalWidthContext ) ;
74+
6675 return (
6776 < div
6877 style = { {
6978 width : horizontalWidth ,
70- minWidth : minHorizontalWidth ,
79+ minWidth : minHorizontalWidth || '0px' ,
7180 } }
7281 >
7382 < InnerGrid
@@ -88,7 +97,7 @@ type ListItemProps = {
8897 scrollContainerRef ?: RefObject < HTMLDivElement > ;
8998 minHeight ?: string ;
9099 unMountFn ?: ( ) => void ;
91- minHorizontalWidth : string ;
100+ minHorizontalWidth ? : string ;
92101 horizontalWidth : string ;
93102} ;
94103
@@ -130,9 +139,9 @@ function ListItem({
130139 style = { {
131140 height : "100%" ,
132141 // in case of horizontal mode, minHorizontalWidth is 0px
133- width : minHorizontalWidth !== '0px' ? minHorizontalWidth : '100%' ,
142+ width : minHorizontalWidth || '100%' ,
134143 backgroundColor : "transparent" ,
135- flex : "auto" ,
144+ // flex: "auto",
136145 } }
137146 autoHeight = { autoHeight }
138147 isDroppable = { itemIdx === offset }
@@ -249,7 +258,7 @@ export function ListView(props: Props) {
249258 minHeight = { minHeight }
250259 unMountFn = { unMountFn }
251260 horizontalWidth = { `${ 100 / noOfColumns } %` }
252- minHorizontalWidth = { horizontal ? minHorizontalWidth : '0px' }
261+ minHorizontalWidth = { horizontal ? minHorizontalWidth : undefined }
253262 />
254263 ) ;
255264 } ) }
@@ -270,7 +279,13 @@ export function ListView(props: Props) {
270279 < BodyWrapper ref = { ref } $autoHeight = { autoHeight } >
271280 < ScrollBar style = { { height : autoHeight ? "auto" : "100%" , margin : "0px" , padding : "0px" } } hideScrollbar = { ! scrollbars } >
272281 < > { < ReactResizeDetector onResize = { ( width ?: number , height ?: number ) => { if ( height ) setListHeight ( height ) ; } } observerOptions = { { box : "border-box" } } >
273- < ListOrientationWrapper $isHorizontal = { horizontal } $autoHeight = { autoHeight } > { renders } </ ListOrientationWrapper >
282+ < ListOrientationWrapper
283+ $isHorizontal = { horizontal }
284+ $isGrid = { noOfColumns > 1 }
285+ $autoHeight = { autoHeight }
286+ >
287+ { renders }
288+ </ ListOrientationWrapper >
274289 </ ReactResizeDetector > } </ >
275290 </ ScrollBar >
276291 </ BodyWrapper >
0 commit comments