@@ -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,13 @@ 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
168
style : props . style ,
169
+ labelStyle :props . labelStyle ,
168
170
children : (
169
171
< DateUIView
170
172
viewRef = { props . viewRef }
@@ -212,11 +214,11 @@ export const datePickerControl = new UICompBuilder(childrenMap, (props) => {
212
214
213
215
{ ( useContext ( EditorContext ) . editorModeStatus === "logic" || useContext ( EditorContext ) . editorModeStatus === "both" ) && (
214
216
< > < Section name = { sectionNames . validation } >
215
- { requiredPropertyView ( children ) }
216
- { dateValidationFields ( children ) }
217
- { timeValidationFields ( children ) }
218
- { children . customRule . propertyView ( { } ) }
219
- </ Section >
217
+ { requiredPropertyView ( children ) }
218
+ { dateValidationFields ( children ) }
219
+ { timeValidationFields ( children ) }
220
+ { children . customRule . propertyView ( { } ) }
221
+ </ Section >
220
222
< Section name = { sectionNames . interaction } >
221
223
{ children . onEvent . getPropertyView ( ) }
222
224
{ disabledPropertyView ( children ) }
@@ -234,19 +236,24 @@ export const datePickerControl = new UICompBuilder(childrenMap, (props) => {
234
236
{ children . placeholder . propertyView ( { label : trans ( "date.placeholderText" ) } ) }
235
237
</ Section >
236
238
) }
237
-
239
+
238
240
{ ( useContext ( EditorContext ) . editorModeStatus === "logic" || useContext ( EditorContext ) . editorModeStatus === "both" ) && (
239
- < > < Section name = { sectionNames . advanced } >
241
+ < > < Section name = { sectionNames . advanced } >
240
242
{ timeFields ( children , isMobile ) }
241
243
{ children . suffixIcon . propertyView ( { label : trans ( "button.suffixIcon" ) } ) }
242
244
</ Section > </ >
243
245
) }
244
246
{ ( useContext ( EditorContext ) . editorModeStatus === "logic" || useContext ( EditorContext ) . editorModeStatus === "both" ) && ! isMobile && commonAdvanceSection ( children ) }
245
247
246
248
{ ( useContext ( EditorContext ) . editorModeStatus === "layout" || useContext ( EditorContext ) . editorModeStatus === "both" ) && (
247
- < Section name = { sectionNames . style } >
248
- { children . style . getPropertyView ( ) }
249
- </ Section >
249
+ < >
250
+ < Section name = { sectionNames . style } >
251
+ { children . style . getPropertyView ( ) }
252
+ </ Section >
253
+ < Section name = { sectionNames . labelStyle } >
254
+ { children . labelStyle . getPropertyView ( ) }
255
+ </ Section >
256
+ </ >
250
257
) }
251
258
</ >
252
259
) ;
@@ -264,10 +271,10 @@ export const dateRangeControl = (function () {
264
271
return new UICompBuilder ( childrenMap , ( props ) => {
265
272
let start = dayjs ( null ) ;
266
273
let end = dayjs ( null ) ;
267
- if ( props . start . value !== '' ) {
274
+ if ( props . start . value !== '' ) {
268
275
start = dayjs ( props . start . value , DateParser ) ;
269
276
}
270
- if ( props . end . value !== '' ) {
277
+ if ( props . end . value !== '' ) {
271
278
end = dayjs ( props . end . value , DateParser ) ;
272
279
}
273
280
@@ -310,12 +317,13 @@ export const dateRangeControl = (function () {
310
317
return props . label ( {
311
318
required : props . required ,
312
319
style : props . style ,
320
+ labelStyle :props . labelStyle ,
313
321
children : children ,
314
322
...( startResult . validateStatus !== "success"
315
323
? startResult
316
324
: endResult . validateStatus !== "success"
317
- ? endResult
318
- : startResult ) ,
325
+ ? endResult
326
+ : startResult ) ,
319
327
} ) ;
320
328
} )
321
329
. setPropertyViewFn ( ( children ) => {
@@ -337,11 +345,11 @@ export const dateRangeControl = (function () {
337
345
338
346
{ ( useContext ( EditorContext ) . editorModeStatus === "logic" || useContext ( EditorContext ) . editorModeStatus === "both" ) && (
339
347
< > < Section name = { sectionNames . validation } >
340
- { requiredPropertyView ( children ) }
341
- { dateValidationFields ( children ) }
342
- { timeValidationFields ( children ) }
343
- { children . customRule . propertyView ( { } ) }
344
- </ Section >
348
+ { requiredPropertyView ( children ) }
349
+ { dateValidationFields ( children ) }
350
+ { timeValidationFields ( children ) }
351
+ { children . customRule . propertyView ( { } ) }
352
+ </ Section >
345
353
< Section name = { sectionNames . interaction } >
346
354
{ children . onEvent . getPropertyView ( ) }
347
355
{ disabledPropertyView ( children ) }
@@ -358,7 +366,7 @@ export const dateRangeControl = (function () {
358
366
{ children . placeholder . propertyView ( { label : trans ( "date.placeholderText" ) } ) }
359
367
</ Section >
360
368
) }
361
-
369
+
362
370
{ ( useContext ( EditorContext ) . editorModeStatus === "logic" || useContext ( EditorContext ) . editorModeStatus === "both" ) && (
363
371
< > < Section name = { sectionNames . advanced } >
364
372
{ timeFields ( children , isMobile ) }
@@ -368,9 +376,14 @@ export const dateRangeControl = (function () {
368
376
{ ( useContext ( EditorContext ) . editorModeStatus === "logic" || useContext ( EditorContext ) . editorModeStatus === "both" ) && commonAdvanceSection ( children ) }
369
377
370
378
{ ( useContext ( EditorContext ) . editorModeStatus === "layout" || useContext ( EditorContext ) . editorModeStatus === "both" ) && (
371
- < Section name = { sectionNames . style } >
372
- { children . style . getPropertyView ( ) }
373
- </ Section >
379
+ < >
380
+ < Section name = { sectionNames . style } >
381
+ { children . style . getPropertyView ( ) }
382
+ </ Section >
383
+ < Section name = { sectionNames . labelStyle } >
384
+ { children . labelStyle . getPropertyView ( ) }
385
+ </ Section >
386
+ </ >
374
387
) }
375
388
376
389
</ >
0 commit comments