@@ -20,7 +20,7 @@ import { UICompBuilder, withDefault } from "../../generators";
20
20
import { CommonNameConfig , depsConfig , withExposingConfigs } from "../../generators/withExposing" ;
21
21
import { formDataChildren , FormDataPropertyView } from "../formComp/formDataConstants" ;
22
22
import { styleControl } from "comps/controls/styleControl" ;
23
- import { DateTimeStyle , DateTimeStyleType } from "comps/controls/styleControlConstants" ;
23
+ import { DateTimeStyle , DateTimeStyleType , LabelStyle } from "comps/controls/styleControlConstants" ;
24
24
import { withMethodExposing } from "../../generators/withMethodExposing" ;
25
25
import {
26
26
disabledPropertyView ,
@@ -72,6 +72,7 @@ const commonChildren = {
72
72
minuteStep : RangeControl . closed ( 1 , 60 , 1 ) ,
73
73
secondStep : RangeControl . closed ( 1 , 60 , 1 ) ,
74
74
style : styleControl ( DateTimeStyle ) ,
75
+ labelStyle : styleControl ( LabelStyle . filter ( ( style ) => [ 'accent' , 'validate' ] . includes ( style . name ) === false ) ) ,
75
76
suffixIcon : withDefault ( IconControl , "/icon:regular/calendar" ) ,
76
77
...validationChildren ,
77
78
viewRef : RefControl < CommonPickerMethods > ,
@@ -159,12 +160,12 @@ export type DateCompViewProps = Pick<
159
160
160
161
export const datePickerControl = new UICompBuilder ( childrenMap , ( props ) => {
161
162
let time = dayjs ( null ) ;
162
- if ( props . value . value !== '' ) {
163
+ if ( props . value . value !== '' ) {
163
164
time = dayjs ( props . value . value , DateParser ) ;
164
165
}
165
166
return props . label ( {
166
167
required : props . required ,
167
- style : props . style ,
168
+ style : props . labelStyle ,
168
169
children : (
169
170
< DateUIView
170
171
viewRef = { props . viewRef }
@@ -212,11 +213,11 @@ export const datePickerControl = new UICompBuilder(childrenMap, (props) => {
212
213
213
214
{ ( useContext ( EditorContext ) . editorModeStatus === "logic" || useContext ( EditorContext ) . editorModeStatus === "both" ) && (
214
215
< > < Section name = { sectionNames . validation } >
215
- { requiredPropertyView ( children ) }
216
- { dateValidationFields ( children ) }
217
- { timeValidationFields ( children ) }
218
- { children . customRule . propertyView ( { } ) }
219
- </ Section >
216
+ { requiredPropertyView ( children ) }
217
+ { dateValidationFields ( children ) }
218
+ { timeValidationFields ( children ) }
219
+ { children . customRule . propertyView ( { } ) }
220
+ </ Section >
220
221
< Section name = { sectionNames . interaction } >
221
222
{ children . onEvent . getPropertyView ( ) }
222
223
{ disabledPropertyView ( children ) }
@@ -234,19 +235,24 @@ export const datePickerControl = new UICompBuilder(childrenMap, (props) => {
234
235
{ children . placeholder . propertyView ( { label : trans ( "date.placeholderText" ) } ) }
235
236
</ Section >
236
237
) }
237
-
238
+
238
239
{ ( useContext ( EditorContext ) . editorModeStatus === "logic" || useContext ( EditorContext ) . editorModeStatus === "both" ) && (
239
- < > < Section name = { sectionNames . advanced } >
240
+ < > < Section name = { sectionNames . advanced } >
240
241
{ timeFields ( children , isMobile ) }
241
242
{ children . suffixIcon . propertyView ( { label : trans ( "button.suffixIcon" ) } ) }
242
243
</ Section > </ >
243
244
) }
244
245
{ ( useContext ( EditorContext ) . editorModeStatus === "logic" || useContext ( EditorContext ) . editorModeStatus === "both" ) && ! isMobile && commonAdvanceSection ( children ) }
245
246
246
247
{ ( useContext ( EditorContext ) . editorModeStatus === "layout" || useContext ( EditorContext ) . editorModeStatus === "both" ) && (
247
- < Section name = { sectionNames . style } >
248
- { children . style . getPropertyView ( ) }
249
- </ Section >
248
+ < >
249
+ < Section name = { sectionNames . style } >
250
+ { children . style . getPropertyView ( ) }
251
+ </ Section >
252
+ < Section name = { sectionNames . labelStyle } >
253
+ { children . labelStyle . getPropertyView ( ) }
254
+ </ Section >
255
+ </ >
250
256
) }
251
257
</ >
252
258
) ;
@@ -264,10 +270,10 @@ export const dateRangeControl = (function () {
264
270
return new UICompBuilder ( childrenMap , ( props ) => {
265
271
let start = dayjs ( null ) ;
266
272
let end = dayjs ( null ) ;
267
- if ( props . start . value !== '' ) {
273
+ if ( props . start . value !== '' ) {
268
274
start = dayjs ( props . start . value , DateParser ) ;
269
275
}
270
- if ( props . end . value !== '' ) {
276
+ if ( props . end . value !== '' ) {
271
277
end = dayjs ( props . end . value , DateParser ) ;
272
278
}
273
279
@@ -309,13 +315,13 @@ export const dateRangeControl = (function () {
309
315
310
316
return props . label ( {
311
317
required : props . required ,
312
- style : props . style ,
318
+ style : props . labelStyle ,
313
319
children : children ,
314
320
...( startResult . validateStatus !== "success"
315
321
? startResult
316
322
: endResult . validateStatus !== "success"
317
- ? endResult
318
- : startResult ) ,
323
+ ? endResult
324
+ : startResult ) ,
319
325
} ) ;
320
326
} )
321
327
. setPropertyViewFn ( ( children ) => {
@@ -337,11 +343,11 @@ export const dateRangeControl = (function () {
337
343
338
344
{ ( useContext ( EditorContext ) . editorModeStatus === "logic" || useContext ( EditorContext ) . editorModeStatus === "both" ) && (
339
345
< > < Section name = { sectionNames . validation } >
340
- { requiredPropertyView ( children ) }
341
- { dateValidationFields ( children ) }
342
- { timeValidationFields ( children ) }
343
- { children . customRule . propertyView ( { } ) }
344
- </ Section >
346
+ { requiredPropertyView ( children ) }
347
+ { dateValidationFields ( children ) }
348
+ { timeValidationFields ( children ) }
349
+ { children . customRule . propertyView ( { } ) }
350
+ </ Section >
345
351
< Section name = { sectionNames . interaction } >
346
352
{ children . onEvent . getPropertyView ( ) }
347
353
{ disabledPropertyView ( children ) }
@@ -358,7 +364,7 @@ export const dateRangeControl = (function () {
358
364
{ children . placeholder . propertyView ( { label : trans ( "date.placeholderText" ) } ) }
359
365
</ Section >
360
366
) }
361
-
367
+
362
368
{ ( useContext ( EditorContext ) . editorModeStatus === "logic" || useContext ( EditorContext ) . editorModeStatus === "both" ) && (
363
369
< > < Section name = { sectionNames . advanced } >
364
370
{ timeFields ( children , isMobile ) }
@@ -368,9 +374,14 @@ export const dateRangeControl = (function () {
368
374
{ ( useContext ( EditorContext ) . editorModeStatus === "logic" || useContext ( EditorContext ) . editorModeStatus === "both" ) && commonAdvanceSection ( children ) }
369
375
370
376
{ ( useContext ( EditorContext ) . editorModeStatus === "layout" || useContext ( EditorContext ) . editorModeStatus === "both" ) && (
371
- < Section name = { sectionNames . style } >
372
- { children . style . getPropertyView ( ) }
373
- </ Section >
377
+ < >
378
+ < Section name = { sectionNames . style } >
379
+ { children . style . getPropertyView ( ) }
380
+ </ Section >
381
+ < Section name = { sectionNames . labelStyle } >
382
+ { children . labelStyle . getPropertyView ( ) }
383
+ </ Section >
384
+ </ >
374
385
) }
375
386
376
387
</ >
0 commit comments