mirror of
https://github.com/twentyhq/twenty.git
synced 2024-12-23 12:02:10 +03:00
fix: empty composite field input (#8451)
Fixes: #7225 --------- Co-authored-by: bosiraphael <raphael.bosi@gmail.com>
This commit is contained in:
parent
24c0b0f873
commit
96c8673278
@ -19,9 +19,8 @@ import { toSpliced } from '~/utils/array/toSpliced';
|
|||||||
import { turnIntoEmptyStringIfWhitespacesOnly } from '~/utils/string/turnIntoEmptyStringIfWhitespacesOnly';
|
import { turnIntoEmptyStringIfWhitespacesOnly } from '~/utils/string/turnIntoEmptyStringIfWhitespacesOnly';
|
||||||
|
|
||||||
const StyledDropdownMenu = styled(DropdownMenu)`
|
const StyledDropdownMenu = styled(DropdownMenu)`
|
||||||
margin-left: -1px;
|
margin: -1px;
|
||||||
position: relative;
|
position: relative;
|
||||||
margin-top: -1px;
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
type MultiItemFieldInputProps<T> = {
|
type MultiItemFieldInputProps<T> = {
|
||||||
@ -65,8 +64,12 @@ export const MultiItemFieldInput = <T,>({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleDropdownCloseOutside = (event: MouseEvent | TouchEvent) => {
|
const handleDropdownCloseOutside = (event: MouseEvent | TouchEvent) => {
|
||||||
onCancel?.();
|
|
||||||
event.stopImmediatePropagation();
|
event.stopImmediatePropagation();
|
||||||
|
if (inputValue?.trim().length > 0) {
|
||||||
|
handleSubmitInput();
|
||||||
|
} else {
|
||||||
|
onCancel?.();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
useListenClickOutside({
|
useListenClickOutside({
|
||||||
@ -202,10 +205,12 @@ export const MultiItemFieldInput = <T,>({
|
|||||||
}
|
}
|
||||||
onEnter={handleSubmitInput}
|
onEnter={handleSubmitInput}
|
||||||
rightComponent={
|
rightComponent={
|
||||||
<LightIconButton
|
items.length ? (
|
||||||
Icon={isAddingNewItem ? IconPlus : IconCheck}
|
<LightIconButton
|
||||||
onClick={handleSubmitInput}
|
Icon={isAddingNewItem ? IconPlus : IconCheck}
|
||||||
/>
|
onClick={handleSubmitInput}
|
||||||
|
/>
|
||||||
|
) : null
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
|
@ -36,6 +36,10 @@ const StyledInputContainer = styled.div`
|
|||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
|
&:not(:first-of-type) {
|
||||||
|
padding: ${({ theme }) => theme.spacing(1)};
|
||||||
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const StyledRightContainer = styled.div`
|
const StyledRightContainer = styled.div`
|
||||||
|
Loading…
Reference in New Issue
Block a user