Skip to content

Commit 4c8dd4e

Browse files
committed
Push for debug
1 parent 0cf5abd commit 4c8dd4e

File tree

2 files changed

+25
-22
lines changed

2 files changed

+25
-22
lines changed

client/packages/lowcoder/src/comps/controls/styleControl.tsx

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,11 @@ import { inputFieldComps } from "@lowcoder-ee/constants/compConstants";
9090
function isSimpleColorConfig(config: SingleColorConfig): config is SimpleColorConfig {
9191
return config.hasOwnProperty("color");
9292
}
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");
9598
}
9699

97100
function isDepColorConfig(config: SingleColorConfig): config is DepColorConfig {
@@ -161,9 +164,6 @@ function isFooterBackgroundImageOriginConfig(config: SingleColorConfig): config
161164
return config.hasOwnProperty("footerBackgroundImageOrigin");
162165
}
163166

164-
function isTextSizeConfig(config: SingleColorConfig): config is TextSizeConfig {
165-
return config.hasOwnProperty("textSize");
166-
}
167167

168168
function isTextWeightConfig(config: SingleColorConfig): config is TextWeightConfig {
169169
return config.hasOwnProperty("textWeight");
@@ -244,7 +244,9 @@ function isEmptyColor(color: string) {
244244
function isEmptyLineHeight(lineHeight: string) {
245245
return _.isEmpty(lineHeight);
246246
}
247-
247+
function isEmptyTextSize(textSize: string) {
248+
return _.isEmpty(textSize);
249+
}
248250
function isEmptyRadius(radius: string) {
249251
return _.isEmpty(radius);
250252
}
@@ -300,9 +302,7 @@ function isEmptyFooterBackgroundImageOriginConfig(footerBackgroundImageOrigin: s
300302
return _.isEmpty(footerBackgroundImageOrigin);
301303
}
302304

303-
function isEmptyTextSize(textSize: string) {
304-
return _.isEmpty(textSize);
305-
}
305+
306306
function isEmptyTextWeight(textWeight: string) {
307307
return _.isEmpty(textWeight);
308308
}
@@ -376,17 +376,21 @@ function calcColors<ColorMap extends Record<string, string>>(
376376
if (compType && styleKey && inputFieldComps.includes(compType) && styleKey !== 'inputFieldStyle') {
377377
const style = theme?.components?.[compType]?.[styleKey] as Record<string, string>;
378378
themeWithDefault['borderWidth'] = style?.['borderWidth'] || '0px';
379+
console.log("The values are ", themeWithDefault)
379380
}
380381

381382
// Cover what is not there for the first pass
382383
let res: Record<string, string> = {};
383384
colorConfigs.forEach((config) => {
384385
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)) {
386391
res[name] = props[name];
387392
return;
388393
}
389-
390394
if (!isEmptyRadius(props[name]) && isRadiusConfig(config)) {
391395
res[name] = props[name];
392396
return;
@@ -460,10 +464,7 @@ function calcColors<ColorMap extends Record<string, string>>(
460464
res[name] = props[name];
461465
return;
462466
}
463-
if (!isEmptyTextSize(props[name]) && isTextSizeConfig(config)) {
464-
res[name] = props[name];
465-
return;
466-
}
467+
467468
if (!isEmptyTextWeight(props[name]) && isTextWeightConfig(config)) {
468469
res[name] = props[name];
469470
return;
@@ -645,6 +646,12 @@ function calcColors<ColorMap extends Record<string, string>>(
645646
if (isAnimationDurationConfig(config)) {
646647
res[name] = themeWithDefault[config.animationDuration] || '0s';
647648
}
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+
}
648655
});
649656
// The second pass calculates dep
650657
colorConfigs.forEach((config) => {
@@ -682,6 +689,7 @@ function calcColors<ColorMap extends Record<string, string>>(
682689
res[name] = themeWithDefault[config.name]
683690
}
684691
});
692+
console.log("The defaults are ", themeWithDefault)
685693
return res as ColorMap;
686694
}
687695

@@ -1357,4 +1365,5 @@ export function useStyle<T extends readonly SingleColorConfig[]>(colorConfigs: T
13571365
props[config.name as Names<T>] = "";
13581366
});
13591367
return calcColors(props, colorConfigs, theme?.theme, bgColor);
1368+
13601369
}

client/packages/lowcoder/src/comps/controls/styleControlConstants.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -379,18 +379,12 @@ export function handleToCalendarToday(color: string) {
379379
export function getLineHeightValue(theme: ThemeDetail, value: string | number) {
380380
if (typeof value === 'number') {
381381
return `${value}px`;
382-
} else if (value === 'inherit') {
383-
return 'inherit';
384-
} else if (value === 'initial') {
385-
return 'initial';
386-
} else if (value === 'unset') {
387-
return 'unset';
388382
} else {
389383
const lineHeightValue = theme.lineHeight;
390384
if (lineHeightValue) {
391385
return lineHeightValue;
392386
} else {
393-
return '1.5'; // default line height value
387+
return value; // default line height value
394388
}
395389
}
396390
}

0 commit comments

Comments
 (0)