@@ -90,8 +90,11 @@ import { inputFieldComps } from "@lowcoder-ee/constants/compConstants";
90
90
function isSimpleColorConfig ( config : SingleColorConfig ) : config is SimpleColorConfig {
91
91
return config . hasOwnProperty ( "color" ) ;
92
92
}
93
- function isSimpleLineHeightConfig ( config : SingleColorConfig ) : config is LineHeightConfig {
94
- return config . hasOwnProperty ( "lineheight" ) ;
93
+ function isLineHeightConfig ( config : SingleColorConfig ) : config is LineHeightConfig {
94
+ return config . hasOwnProperty ( "lineHeight" ) ;
95
+ }
96
+ function isTextSizeConfig ( config : SingleColorConfig ) : config is TextSizeConfig {
97
+ return config . hasOwnProperty ( "textSize" ) ;
95
98
}
96
99
97
100
function isDepColorConfig ( config : SingleColorConfig ) : config is DepColorConfig {
@@ -161,9 +164,6 @@ function isFooterBackgroundImageOriginConfig(config: SingleColorConfig): config
161
164
return config . hasOwnProperty ( "footerBackgroundImageOrigin" ) ;
162
165
}
163
166
164
- function isTextSizeConfig ( config : SingleColorConfig ) : config is TextSizeConfig {
165
- return config . hasOwnProperty ( "textSize" ) ;
166
- }
167
167
168
168
function isTextWeightConfig ( config : SingleColorConfig ) : config is TextWeightConfig {
169
169
return config . hasOwnProperty ( "textWeight" ) ;
@@ -244,7 +244,9 @@ function isEmptyColor(color: string) {
244
244
function isEmptyLineHeight ( lineHeight : string ) {
245
245
return _ . isEmpty ( lineHeight ) ;
246
246
}
247
-
247
+ function isEmptyTextSize ( textSize : string ) {
248
+ return _ . isEmpty ( textSize ) ;
249
+ }
248
250
function isEmptyRadius ( radius : string ) {
249
251
return _ . isEmpty ( radius ) ;
250
252
}
@@ -300,9 +302,7 @@ function isEmptyFooterBackgroundImageOriginConfig(footerBackgroundImageOrigin: s
300
302
return _ . isEmpty ( footerBackgroundImageOrigin ) ;
301
303
}
302
304
303
- function isEmptyTextSize ( textSize : string ) {
304
- return _ . isEmpty ( textSize ) ;
305
- }
305
+
306
306
function isEmptyTextWeight ( textWeight : string ) {
307
307
return _ . isEmpty ( textWeight ) ;
308
308
}
@@ -376,17 +376,21 @@ function calcColors<ColorMap extends Record<string, string>>(
376
376
if ( compType && styleKey && inputFieldComps . includes ( compType ) && styleKey !== 'inputFieldStyle' ) {
377
377
const style = theme ?. components ?. [ compType ] ?. [ styleKey ] as Record < string , string > ;
378
378
themeWithDefault [ 'borderWidth' ] = style ?. [ 'borderWidth' ] || '0px' ;
379
+ console . log ( "The values are " , themeWithDefault )
379
380
}
380
381
381
382
// Cover what is not there for the first pass
382
383
let res : Record < string , string > = { } ;
383
384
colorConfigs . forEach ( ( config ) => {
384
385
const name = config . name ;
385
- if ( ! isEmptyLineHeight ( props [ name ] ) && isSimpleLineHeightConfig ( config ) ) {
386
+ if ( ! isEmptyLineHeight ( props [ name ] ) && isLineHeightConfig ( config ) ) {
387
+ res [ name ] = props [ name ] ;
388
+ return ;
389
+ }
390
+ if ( ! isEmptyTextSize ( props [ name ] ) && isTextSizeConfig ( config ) ) {
386
391
res [ name ] = props [ name ] ;
387
392
return ;
388
393
}
389
-
390
394
if ( ! isEmptyRadius ( props [ name ] ) && isRadiusConfig ( config ) ) {
391
395
res [ name ] = props [ name ] ;
392
396
return ;
@@ -460,10 +464,7 @@ function calcColors<ColorMap extends Record<string, string>>(
460
464
res [ name ] = props [ name ] ;
461
465
return ;
462
466
}
463
- if ( ! isEmptyTextSize ( props [ name ] ) && isTextSizeConfig ( config ) ) {
464
- res [ name ] = props [ name ] ;
465
- return ;
466
- }
467
+
467
468
if ( ! isEmptyTextWeight ( props [ name ] ) && isTextWeightConfig ( config ) ) {
468
469
res [ name ] = props [ name ] ;
469
470
return ;
@@ -645,6 +646,12 @@ function calcColors<ColorMap extends Record<string, string>>(
645
646
if ( isAnimationDurationConfig ( config ) ) {
646
647
res [ name ] = themeWithDefault [ config . animationDuration ] || '0s' ;
647
648
}
649
+ if ( isLineHeightConfig ( config ) ) {
650
+
651
+ res [ name ] = themeWithDefault [ config . lineHeight ] || '20px' ;
652
+ console . log ( "The 2nd Values are" , themeWithDefault ) ;
653
+ console . log ( "The 2nd Values are" , isLineHeightConfig ) ;
654
+ }
648
655
} ) ;
649
656
// The second pass calculates dep
650
657
colorConfigs . forEach ( ( config ) => {
@@ -682,6 +689,7 @@ function calcColors<ColorMap extends Record<string, string>>(
682
689
res [ name ] = themeWithDefault [ config . name ]
683
690
}
684
691
} ) ;
692
+ console . log ( "The defaults are " , themeWithDefault )
685
693
return res as ColorMap ;
686
694
}
687
695
@@ -1357,4 +1365,5 @@ export function useStyle<T extends readonly SingleColorConfig[]>(colorConfigs: T
1357
1365
props [ config . name as Names < T > ] = "" ;
1358
1366
} ) ;
1359
1367
return calcColors ( props , colorConfigs , theme ?. theme , bgColor ) ;
1368
+
1360
1369
}
0 commit comments