Merge pull request #12238 from ToolJet/label-input-alignment

Fix alignment issues arising due to label width setting for input components
This commit is contained in:
Johnson Cherian 2025-03-19 16:20:51 +05:30 committed by GitHub
commit d159e5a55c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 24 additions and 5 deletions

View file

@ -18,6 +18,7 @@ export const ConfigHandle = ({
showHandle,
componentType,
visibility,
subContainerIndex,
}) => {
const shouldFreeze = useStore((state) => state.getShouldFreeze());
const componentName = useStore((state) => state.getComponentDefinition(id)?.component?.name || '', shallow);
@ -40,10 +41,12 @@ export const ConfigHandle = ({
const anyComponentHovered = state.getHoveredComponentForGrid() !== '' || state.hoveredComponentBoundaryId !== '';
// If one component is hovered and one is selected, show the handle for the hovered component
return (
isWidgetHovered ||
(showHandle && (!isMultipleComponentsSelected || (isModal && isModalOpen)) && !anyComponentHovered)
(subContainerIndex === 0 || subContainerIndex === null) &&
(isWidgetHovered ||
(showHandle && (!isMultipleComponentsSelected || (isModal && isModalOpen)) && !anyComponentHovered))
);
}, shallow);
let height = visibility === false ? 10 : widgetHeight;
return (

View file

@ -91,6 +91,7 @@ const WidgetWrapper = memo(
showHandle={isWidgetActive}
componentType={componentType}
visibility={visibility}
subContainerIndex={subContainerIndex}
/>
)}
<RenderWidget

View file

@ -13,6 +13,7 @@ export const listviewConfig = {
top: 15,
left: 3,
height: 100,
width: 7,
},
properties: ['source'],
accessorKey: 'imageURL',

View file

@ -13,6 +13,7 @@ export const tabsConfig = {
top: 60,
left: 17,
height: 100,
width: 7,
},
tab: 0,
properties: ['source'],

View file

@ -236,8 +236,6 @@ export const TextInput = function TextInput({
value: properties.value,
isMandatory: isMandatory,
isLoading: loading,
isVisible: visibility,
isDisabled: disable,
};
setExposedVariables(exposedVariables);
@ -245,6 +243,17 @@ export const TextInput = function TextInput({
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
useEffect(() => {
// Fix for "visibility is not defined" in production because there's a naming conflict in the code.
// The issue is in the exposedVariables object where we had both a function named visibility and a property isVisible that depends on the state variable with the same name.
const exposedVariables = {
isVisible: visibility,
isDisabled: disable,
};
setExposedVariables(exposedVariables);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
const setInputValue = (value) => {
setValue(value);
setExposedVariable('value', value);

View file

@ -13,6 +13,7 @@ export const listviewConfig = {
top: 15,
left: 3,
height: 100,
width: 7,
},
properties: ['source'],
accessorKey: 'imageURL',

View file

@ -13,6 +13,7 @@ export const tabsConfig = {
top: 60,
left: 17,
height: 100,
width: 7,
},
tab: 0,
properties: ['source'],

View file

@ -13,7 +13,7 @@ function Label({ label, width, labelRef, color, defaultAlignment, direction, aut
justifyContent: direction == 'right' ? 'flex-end' : 'flex-start',
fontSize: '12px',
height: defaultAlignment === 'top' && '20px',
overflow: 'hidden',
overflow: auto ? 'visible' : 'hidden',
}}
>
<p

View file

@ -13,6 +13,7 @@ export const listviewConfig = {
top: 15,
left: 3,
height: 100,
width: 7,
},
properties: ['source'],
accessorKey: 'imageURL',

View file

@ -13,6 +13,7 @@ export const tabsConfig = {
top: 60,
left: 17,
height: 100,
width: 7,
},
tab: 0,
properties: ['source'],