Skip to content

Commit

Permalink
2370 when new reference is added jump as active to reference part not…
Browse files Browse the repository at this point in the history
… new reference (#2470)

* Fix entity labels reference

* Add focus style to suggester

* Make reference value autofocus when resource is filled

* Make the prop value active after type is selected

* Remove status from test dataset
  • Loading branch information
adammertel authored Dec 2, 2024
1 parent 6d5c6b8 commit 8cb8eb1
Show file tree
Hide file tree
Showing 6 changed files with 199 additions and 213 deletions.
3 changes: 2 additions & 1 deletion packages/client/src/components/basic/Suggester/Suggester.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ export const Suggester: React.FC<Suggester> = ({
<StyledSuggester
$marginTop={marginTop}
$fullWidth={inputWidth === "full"}
$isFocused={isFocused}
>
<StyledInputWrapper
ref={dropRef}
Expand Down Expand Up @@ -333,7 +334,7 @@ export const Suggester: React.FC<Suggester> = ({
setSelected(-1);
}}
onEnterPressFn={handleEnterPress}
autoFocus={categories.length === 1 && autoFocus}
autoFocus={categories.length === 1 || autoFocus}
disabled={disabled}
/>
{typed.length > 0 && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,21 @@ import { space2, space4 } from "Theme/constants";
interface StyledSuggester {
$marginTop?: boolean;
$fullWidth?: boolean;
$isFocused?: boolean;
}
export const StyledSuggester = styled.div<StyledSuggester>`
position: relative;
display: ${({ $fullWidth }) => ($fullWidth ? "flex" : "inline-flex")};
margin-top: ${({ $marginTop }) => ($marginTop ? space2 : 0)};
input[type="text"] {
border-width: ${({ $isFocused }) => ($isFocused ? "2px" : "1px")};
}
.react-select__control {
border-width: ${({ $isFocused }) =>
$isFocused ? "2px !important" : "1px"};
}
`;

interface Column {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export const EntityReferenceTableResource: React.FC<
territoryParentId={territoryParentId}
disabled={disabled}
initTyped={initResourceTyped}
autoFocus={reference.resource !== ""}
/>
)}
</StyledGridValue>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,10 @@ export const EntityReferenceTableRow: React.FC<EntityReferenceTableRow> = ({
"http"
)
? normalizeURL(resourceEntity.data.partValueBaseURL) +
valueEntity.label
valueEntity.labels[0]
: "//" +
normalizeURL(resourceEntity.data.partValueBaseURL) +
valueEntity.label;
valueEntity.labels[0];
window.open(url, "_blank");
}}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ export const PropGroupRowValue: React.FC<PropGroupRowValue> = ({
true
);
}}
autoFocus={prop.type.entityId !== ""}
placeholder="value"
openDetailOnCreate={openDetailOnCreate}
categoryTypes={classesPropValue}
Expand Down
Loading

0 comments on commit 8cb8eb1

Please sign in to comment.