@@ -42,18 +42,26 @@ const FlexWrapper = styled.div`
42
42
height: 100%;
43
43
display: flex;
44
44
align-items: center;
45
- justify-content: center;
46
- flex-wrap: 'wrap'};
45
+ // justify-content: center;
47
46
` ;
48
47
49
- const ListOrientationWrapper = styled . div < { $isHorizontal : boolean , $autoHeight : boolean } > `
48
+ const ListOrientationWrapper = styled . div < {
49
+ $isHorizontal : boolean ,
50
+ $autoHeight : boolean ,
51
+ $isGrid : boolean ,
52
+ } > `
50
53
height: ${ ( props ) => ( props . $autoHeight ? "auto" : "100%" ) } ;
51
54
display: flex;
52
- flex-direction: ${ ( props ) => ( props . $isHorizontal ? "row" : "column" ) } ;
55
+ flex-direction: ${ ( props ) => ( props . $isHorizontal && ! props . $isGrid ? "row" : "column" ) } ;
53
56
height: 100%;
54
57
` ;
55
58
56
- const MinHorizontalWidthContext = createContext ( {
59
+ type MinHorizontalWidthContextType = {
60
+ horizontalWidth : string ,
61
+ minHorizontalWidth ?: string ,
62
+ }
63
+
64
+ const MinHorizontalWidthContext = createContext < MinHorizontalWidthContextType > ( {
57
65
horizontalWidth : '100%' ,
58
66
minHorizontalWidth : '100px' ,
59
67
} ) ;
@@ -63,11 +71,12 @@ const ContainerInListView = (props: ContainerBaseProps ) => {
63
71
horizontalWidth,
64
72
minHorizontalWidth
65
73
} = useContext ( MinHorizontalWidthContext ) ;
74
+
66
75
return (
67
76
< div
68
77
style = { {
69
78
width : horizontalWidth ,
70
- minWidth : minHorizontalWidth ,
79
+ minWidth : minHorizontalWidth || '0px' ,
71
80
} }
72
81
>
73
82
< InnerGrid
@@ -88,7 +97,7 @@ type ListItemProps = {
88
97
scrollContainerRef ?: RefObject < HTMLDivElement > ;
89
98
minHeight ?: string ;
90
99
unMountFn ?: ( ) => void ;
91
- minHorizontalWidth : string ;
100
+ minHorizontalWidth ? : string ;
92
101
horizontalWidth : string ;
93
102
} ;
94
103
@@ -129,8 +138,10 @@ function ListItem({
129
138
dispatch = { itemIdx === offset ? containerProps . dispatch : _ . noop }
130
139
style = { {
131
140
height : "100%" ,
141
+ // in case of horizontal mode, minHorizontalWidth is 0px
142
+ width : minHorizontalWidth || '100%' ,
132
143
backgroundColor : "transparent" ,
133
- flex : "auto" ,
144
+ // flex: "auto",
134
145
} }
135
146
autoHeight = { autoHeight }
136
147
isDroppable = { itemIdx === offset }
@@ -247,7 +258,7 @@ export function ListView(props: Props) {
247
258
minHeight = { minHeight }
248
259
unMountFn = { unMountFn }
249
260
horizontalWidth = { `${ 100 / noOfColumns } %` }
250
- minHorizontalWidth = { horizontal ? minHorizontalWidth : '0px' }
261
+ minHorizontalWidth = { horizontal ? minHorizontalWidth : undefined }
251
262
/>
252
263
) ;
253
264
} ) }
@@ -268,7 +279,13 @@ export function ListView(props: Props) {
268
279
< BodyWrapper ref = { ref } $autoHeight = { autoHeight } >
269
280
< ScrollBar style = { { height : autoHeight ? "auto" : "100%" , margin : "0px" , padding : "0px" } } hideScrollbar = { ! scrollbars } >
270
281
< > { < ReactResizeDetector onResize = { ( width ?: number , height ?: number ) => { if ( height ) setListHeight ( height ) ; } } observerOptions = { { box : "border-box" } } >
271
- < ListOrientationWrapper $isHorizontal = { horizontal } $autoHeight = { autoHeight } > { renders } </ ListOrientationWrapper >
282
+ < ListOrientationWrapper
283
+ $isHorizontal = { horizontal }
284
+ $isGrid = { noOfColumns > 1 }
285
+ $autoHeight = { autoHeight }
286
+ >
287
+ { renders }
288
+ </ ListOrientationWrapper >
272
289
</ ReactResizeDetector > } </ >
273
290
</ ScrollBar >
274
291
</ BodyWrapper >
0 commit comments