8
8
} from "lowcoder-core" ;
9
9
import { trans } from "i18n" ;
10
10
import { UICompBuilder , withDefault } from "../../generators" ;
11
- import { Section , sectionNames } from "lowcoder-design" ;
11
+ import { ScrollBar , Section , sectionNames } from "lowcoder-design" ;
12
12
import { hiddenPropertyView } from "comps/utils/propertyUtils" ;
13
13
import { BoolControl } from "comps/controls/boolControl" ;
14
14
import { stringExposingStateControl } from "comps/controls/codeStateControl" ;
@@ -62,6 +62,8 @@ const childrenMap = {
62
62
value : jsonControl ( convertTimeLineData , timelineDate ) ,
63
63
mode : dropdownControl ( modeOptions , "alternate" ) ,
64
64
reverse : BoolControl ,
65
+ autoHeight : AutoHeightControl ,
66
+ verticalScrollbar : withDefault ( BoolControl , false ) ,
65
67
pending : withDefault ( StringControl , trans ( "timeLine.defaultPending" ) ) ,
66
68
onEvent : eventHandlerControl ( EventOptions ) ,
67
69
style : styleControl ( TimeLineStyle , 'style' ) ,
@@ -136,31 +138,33 @@ const TimelineComp = (
136
138
} ) ) ;
137
139
138
140
return (
139
- < div
140
- style = { {
141
- margin : style . margin ?? '3px' ,
142
- padding : style . padding !== '3px' ? style . padding : '20px 10px 0px 10px' ,
143
- width : widthCalculator ( style . margin ?? '3px' ) ,
144
- height : heightCalculator ( style . margin ?? '3px' ) ,
145
- background : style . background ,
146
- overflow : "auto" ,
147
- overflowX : "hidden" ,
148
- borderRadius : style . radius ,
149
- } }
150
- >
151
- < Timeline
152
- mode = { props ?. mode || "left" }
153
- reverse = { props ?. reverse }
154
- pending = {
155
- props ?. pending && (
156
- < span style = { { color : style ?. titleColor } } >
157
- { props ?. pending || "" }
158
- </ span >
159
- )
160
- }
161
- items = { timelineItems }
162
- />
163
- </ div >
141
+ < ScrollBar hideScrollbar = { ! props . verticalScrollbar } >
142
+ < div
143
+ style = { {
144
+ margin : style . margin ?? '3px' ,
145
+ padding : style . padding !== '3px' ? style . padding : '20px 10px 0px 10px' ,
146
+ width : widthCalculator ( style . margin ?? '3px' ) ,
147
+ height : heightCalculator ( style . margin ?? '3px' ) ,
148
+ background : style . background ,
149
+ overflow : "auto" ,
150
+ overflowX : "hidden" ,
151
+ borderRadius : style . radius ,
152
+ } }
153
+ >
154
+ < Timeline
155
+ mode = { props ?. mode || "left" }
156
+ reverse = { props ?. reverse }
157
+ pending = {
158
+ props ?. pending && (
159
+ < span style = { { color : style ?. titleColor } } >
160
+ { props ?. pending || "" }
161
+ </ span >
162
+ )
163
+ }
164
+ items = { timelineItems }
165
+ />
166
+ </ div >
167
+ </ ScrollBar >
164
168
) ;
165
169
} ;
166
170
@@ -187,6 +191,11 @@ let TimeLineBasicComp = (function () {
187
191
188
192
{ [ "layout" , "both" ] . includes ( useContext ( EditorContext ) . editorModeStatus ) && (
189
193
< > < Section name = { sectionNames . layout } >
194
+ { children . autoHeight . getPropertyView ( ) }
195
+ { ! children . autoHeight . getView ( ) &&
196
+ children . verticalScrollbar . propertyView ( {
197
+ label : trans ( "prop.showVerticalScrollbar" )
198
+ } ) }
190
199
{ children . mode . propertyView ( {
191
200
label : trans ( "timeLine.mode" ) ,
192
201
tooltip : trans ( "timeLine.modeTooltip" ) ,
@@ -211,7 +220,7 @@ let TimeLineBasicComp = (function () {
211
220
212
221
TimeLineBasicComp = class extends TimeLineBasicComp {
213
222
override autoHeight ( ) : boolean {
214
- return false ;
223
+ return this . children . autoHeight . getView ( ) ;
215
224
}
216
225
} ;
217
226
0 commit comments