1
1
import { CompAction , RecordConstructorToView , changeChildAction } from "lowcoder-core" ;
2
2
import { styleControl } from "comps/controls/styleControl" ;
3
- import { timerStyle , timerStyleType } from "comps/controls/styleControlConstants" ;
3
+ import { startButtonStyle , StartButtonStyleType , timerStyle , timerStyleType } from "comps/controls/styleControlConstants" ;
4
4
import { UICompBuilder } from "comps/generators/uiCompBuilder" ;
5
5
import { NameConfig , NameConfigHidden , withExposingConfigs } from "comps/generators/withExposing" ;
6
6
import { Section , sectionNames } from "lowcoder-design" ;
@@ -24,21 +24,54 @@ const Container = styled.div<{ $style: timerStyleType | undefined }>`
24
24
word-wrap: break-word;
25
25
line-height: initial;
26
26
background-color: ${ props => props . $style ?. background } ;
27
- border: 1px solid ${ props => props . $style ?. border } ;
28
- border-radius: ${ props => props . $style ?. radius } ;
29
- color: ${ props => props . $style ?. fontColor } ;
27
+ font-weight: ${ props => props ?. $style ?. textWeight } ;
28
+ border-radius: ${ props => props ?. $style ?. radius } ;
29
+ font-size: ${ props => props ?. $style ?. textSize } ;
30
+ rotate: ${ props => props ?. $style ?. rotation } ;
31
+ text-transform: ${ props => props ?. $style ?. textTransform } ;
32
+ color: ${ props => props ?. $style ?. text } ;
33
+ border: ${ props => props ?. $style ?. border } ;
34
+ border-style: ${ props => props ?. $style ?. borderStyle } ;
35
+ border-width: ${ props => props ?. $style ?. borderWidth } ;
36
+ font-family: ${ props => props ?. $style ?. fontFamily } ;
37
+ font-style: ${ props => props ?. $style ?. fontStyle } ;
38
+ margin: ${ props => props ?. $style ?. margin } ;
39
+ padding: ${ props => props ?. $style ?. padding } ;
40
+ background: ${ props => props ?. $style ?. background } ;
41
+ text-decoration: ${ props => props ?. $style ?. textDecoration } ;
30
42
` ;
31
43
32
44
const ButtonWarrper = styled . div `
33
45
width: 100%;
34
46
min-height: 35px;
35
47
display: flex;
36
- justify-content: flex-end ;
48
+ justify-content: center ;
37
49
padding-right: 15px;
38
50
padding-bottom: 10px;
39
- margin-top: - 10px;
51
+ margin-top: 10px;
40
52
` ;
41
53
54
+ const StyledButton = styled ( Button ) < { $style : StartButtonStyleType } > `
55
+ background-color: ${ props => props . $style . background } ;
56
+ font-weight: ${ props => props . $style . textWeight } ;
57
+ border-radius: ${ props => props . $style . radius } ;
58
+ font-size: ${ props => props . $style . textSize } ;
59
+ rotate: ${ props => props . $style . rotation } ;
60
+ text-transform: ${ props => props . $style . textTransform } ;
61
+ color: ${ props => props . $style . text } ;
62
+ border: ${ props => props . $style . border } ;
63
+ border-style: ${ props => props . $style . borderStyle } ;
64
+ border-width: ${ props => props . $style . borderWidth } ;
65
+ font-family: ${ props => props . $style . fontFamily } ;
66
+ font-style: ${ props => props . $style . fontStyle } ;
67
+ margin: ${ props => props . $style . margin } ;
68
+ padding: ${ props => props . $style . padding } ;
69
+ background: ${ props => props . $style . background } ;
70
+ text-decoration: ${ props => props . $style . textDecoration } ;
71
+ ` ;
72
+
73
+
74
+
42
75
function formatTimeDifference ( timeDifference : number ) {
43
76
// 计算时、分、秒、毫秒
44
77
const hours = Math . floor ( timeDifference / ( 1000 * 60 * 60 ) ) ;
@@ -64,6 +97,8 @@ const timerTypeOptions = [
64
97
65
98
const childrenMap = {
66
99
style : styleControl ( timerStyle ) ,
100
+ startButtonStyle : styleControl ( startButtonStyle ) ,
101
+ resetButtonStyle : styleControl ( startButtonStyle ) ,
67
102
onEvent : eventHandlerControl ( EventOptions ) ,
68
103
defaultValue : stringExposingStateControl ( "defaultValue" , '00:00:00:000' ) ,
69
104
timerType : dropdownControl ( timerTypeOptions , 'timer' ) ,
@@ -162,19 +197,21 @@ const AvatarGroupView = (props: RecordConstructorToView<typeof childrenMap> & {
162
197
{ formatTimeDifference ( elapsedTime ) }
163
198
< ButtonWarrper hidden = { props . hideButton } >
164
199
< Space >
165
- < Button
200
+ < StyledButton
201
+ $style = { props . startButtonStyle }
166
202
disabled = { ! buttonState }
167
203
type = { timerState === 'stoped' ? "primary" : 'default' }
168
204
onClick = { ( ) => {
169
205
if ( timerState === 'stoped' ) startAction ( )
170
206
else if ( timerState === 'started' ) pauseAction ( )
171
207
else if ( timerState === 'paused' ) resumeAction ( )
172
208
} }
173
- > { timerState === 'stoped' ? trans ( 'timer.start' ) : ( timerState === 'started' ? trans ( 'timer.pause' ) : trans ( 'timer.resume' ) ) } </ Button >
174
- < Button
175
- onClick = { ( ) => resetAction ( ) }
209
+ > { timerState === 'stoped' ? trans ( 'timer.start' ) : ( timerState === 'started' ? trans ( 'timer.pause' ) : trans ( 'timer.resume' ) ) } </ StyledButton >
210
+ < StyledButton
211
+ $style = { props . resetButtonStyle }
212
+ onClick = { ( ) => resetAction ( ) }
176
213
> { trans ( 'timer.reset' ) }
177
- </ Button >
214
+ </ StyledButton >
178
215
</ Space >
179
216
</ ButtonWarrper >
180
217
</ Container >
@@ -206,9 +243,17 @@ let AvatarGroupBasicComp = (function () {
206
243
) }
207
244
208
245
{ [ "layout" , "both" ] . includes ( useContext ( EditorContext ) . editorModeStatus ) && (
246
+ < >
209
247
< Section name = { sectionNames . style } >
210
248
{ children . style . getPropertyView ( ) }
211
249
</ Section >
250
+ < Section name = { sectionNames . startButtonStyle } >
251
+ { children . startButtonStyle . getPropertyView ( ) }
252
+ </ Section >
253
+ < Section name = { sectionNames . resetButtonStyle } >
254
+ { children . resetButtonStyle . getPropertyView ( ) }
255
+ </ Section >
256
+ </ >
212
257
) }
213
258
</ >
214
259
) )
0 commit comments