mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-24 09:28:31 +00:00
fix
This commit is contained in:
parent
0a70c7faea
commit
ab1f411b12
1 changed files with 3 additions and 7 deletions
|
|
@ -1019,20 +1019,16 @@ const WidgetWrapper = ({
|
|||
if (!['TextInput', 'PasswordInput', 'NumberInput'].includes(componentType)) {
|
||||
return layoutData?.height;
|
||||
}
|
||||
|
||||
// Destructure stylesDefinition once
|
||||
const { alignment = { value: null }, width = { value: null }, auto = { value: null } } = stylesDefinition ?? {};
|
||||
|
||||
// Resolve values only once per dependency
|
||||
const resolvedLabel = label?.value?.length ?? 0; // Use nullish coalescing for label length
|
||||
const resolvedLabel = label?.value?.length ?? 0;
|
||||
const resolvedWidth = resolveWidgetFieldValue(width?.value) ?? 0;
|
||||
const resolvedAuto = resolveWidgetFieldValue(auto?.value) ?? false; // Default to false
|
||||
const resolvedAuto = resolveWidgetFieldValue(auto?.value) ?? false;
|
||||
|
||||
// Calculate new height based on conditions
|
||||
let newHeight = layoutData?.height;
|
||||
if (alignment.value && resolveWidgetFieldValue(alignment.value) === 'top') {
|
||||
if ((resolvedLabel > 0 && resolvedWidth > 0) || (resolvedAuto && resolvedWidth === 0 && resolvedLabel > 0)) {
|
||||
newHeight += 20; // Use += for in-place modification
|
||||
newHeight += 20;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue