Skip to content

Commit caa36ff

Browse files
committed
Style Control CHanges
1 parent 11f1022 commit caa36ff

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

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

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ import {
7474
AnimationConfig,
7575
AnimationDelayConfig,
7676
AnimationDurationConfig,
77+
LineHeightConfig,
7778

7879

7980
} from "./styleControlConstants";
@@ -89,6 +90,9 @@ import { inputFieldComps } from "@lowcoder-ee/constants/compConstants";
8990
function isSimpleColorConfig(config: SingleColorConfig): config is SimpleColorConfig {
9091
return config.hasOwnProperty("color");
9192
}
93+
function isSimpleLineHeightConfig(config: SingleColorConfig): config is LineHeightConfig {
94+
return config.hasOwnProperty("lineheight");
95+
}
9296

9397
function isDepColorConfig(config: SingleColorConfig): config is DepColorConfig {
9498
return config.hasOwnProperty("depName") || config.hasOwnProperty("depTheme");
@@ -237,6 +241,9 @@ export type StyleConfigType<T extends readonly SingleColorConfig[]> = { [K in Na
237241
function isEmptyColor(color: string) {
238242
return _.isEmpty(color);
239243
}
244+
function isEmptyLineHeight(lineHeight: string) {
245+
return _.isEmpty(lineHeight);
246+
}
240247

241248
function isEmptyRadius(radius: string) {
242249
return _.isEmpty(radius);
@@ -375,6 +382,11 @@ function calcColors<ColorMap extends Record<string, string>>(
375382
let res: Record<string, string> = {};
376383
colorConfigs.forEach((config) => {
377384
const name = config.name;
385+
if (!isEmptyLineHeight(props[name]) && isSimpleLineHeightConfig(config)) {
386+
res[name] = props[name];
387+
return;
388+
}
389+
378390
if (!isEmptyRadius(props[name]) && isRadiusConfig(config)) {
379391
res[name] = props[name];
380392
return;
@@ -743,6 +755,11 @@ const StyleContent = styled.div`
743755
border-radius: 0 0 6px 6px;
744756
}
745757
`;
758+
const LineHeightPropIcon = styled(ExpandIcon)`
759+
margin: 0 8px 0 -3px;
760+
padding: 3px;
761+
color: #888;
762+
`;
746763

747764
const MarginIcon = styled(ExpandIcon)` margin: 0 8px 0 2px; color: #888`;
748765
const PaddingIcon = styled(CompressIcon)` margin: 0 8px 0 2px; color: #888`;
@@ -853,7 +870,8 @@ export function styleControl<T extends readonly SingleColorConfig[]>(
853870
name === 'containerHeaderPadding' ||
854871
name === 'containerSiderPadding' ||
855872
name === 'containerFooterPadding' ||
856-
name === 'containerBodyPadding'
873+
name === 'containerBodyPadding' ||
874+
name === 'lineHeight'
857875
) {
858876
childrenMap[name] = StringControl;
859877
} else {
@@ -966,7 +984,8 @@ export function styleControl<T extends readonly SingleColorConfig[]>(
966984
name === 'footerBackgroundImageRepeat' ||
967985
name === 'footerBackgroundImageSize' ||
968986
name === 'footerBackgroundImagePosition' ||
969-
name === 'footerBackgroundImageOrigin'
987+
name === 'footerBackgroundImageOrigin' ||
988+
name === 'lineHeight'
970989
) {
971990
children[name]?.dispatchChangeValueAction('');
972991
} else {
@@ -1299,6 +1318,14 @@ export function styleControl<T extends readonly SingleColorConfig[]>(
12991318
placeholder:
13001319
props[name],
13011320
})
1321+
: name === 'lineHeight' // Added lineHeight here
1322+
? (
1323+
children[name] as InstanceType<typeof StringControl>
1324+
).propertyView({
1325+
label: config.label,
1326+
preInputNode: <LineHeightPropIcon title="Line Height" />,
1327+
placeholder: props[name],
1328+
})
13021329
: children[
13031330
name
13041331
].propertyView({

0 commit comments

Comments
 (0)