Skip to content

Commit a99e7bb

Browse files
update comp height calculation on auto/fixed height
1 parent 085a33c commit a99e7bb

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

client/packages/lowcoder/src/layout/gridItem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ export function GridItem(props: GridItemProps) {
441441
cssTransforms: true,
442442
}),
443443
style: {
444-
...setTransform(pos,props.name),
444+
...setTransform(pos, props.name, props.autoHeight),
445445
opacity: layoutHide ? 0 : undefined,
446446
pointerEvents: layoutHide ? "none" : "auto",
447447
},

client/packages/lowcoder/src/layout/utils.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,12 +199,21 @@ export function getStatics(layout: Layout): Layout {
199199
return _.pickBy(layout, (l) => l.static);
200200
}
201201

202-
export function setTransform({ top, left, width, height }: Position,name?:string): Record<string, any> {
202+
export function setTransform(
203+
{top, left, width, height }: Position,
204+
name ?: string,
205+
autoHeight?: boolean,
206+
): Record<string, any> {
203207
// Replace unitless items with px
204208
const translate = `translate(${left}px,${top}px)`;
205209
function containsChart(str:string) {
206210
return /chart/i.test(str);
207211
}
212+
213+
let updatedHeight = 'auto';
214+
if (!autoHeight || (name && containsChart(name))) {
215+
updatedHeight = `${height}px`;
216+
}
208217

209218
return {
210219
transform: translate,
@@ -213,7 +222,7 @@ export function setTransform({ top, left, width, height }: Position,name?:string
213222
msTransform: translate,
214223
OTransform: translate,
215224
width: `${width}px`,
216-
height: name ?containsChart(name)?`${height}px`:'auto':`${height}px`,
225+
height: updatedHeight,
217226
position: 'absolute',
218227
};
219228
}

0 commit comments

Comments
 (0)