refactor: Rename 'hide' to 'hidden' in field classes

Update the field classes in the codebase to use the 'hidden' attribute instead of 'hide' for consistency and clarity. This change aligns with recent updates to the langflow library and improves the readability of the code.
This commit is contained in:
ogabrielluiz 2024-06-12 22:16:41 -03:00
commit 6357d245aa
4 changed files with 16 additions and 16 deletions

View file

@ -164,7 +164,7 @@ class Output(BaseModel):
name: str = Field(default=None)
"""The name of the field."""
hide: Optional[bool] = Field(default=None)
hidden: Optional[bool] = Field(default=None)
"""Dictates if the field is hidden."""
display_name: Optional[str] = Field(default=None)

View file

@ -138,7 +138,7 @@ export default function ParameterComponent({
let disabledOutput =
edges.some(
(edge) =>
edge.sourceHandle === scapedJSONStringfy(proxy ? { ...id, proxy } : id),
edge.sourceHandle === scapedJSONStringfy(proxy ? { ...id, proxy } : id)
) ?? false;
const handleRefreshButtonPress = async (name, data) => {
@ -205,7 +205,7 @@ export default function ParameterComponent({
...newNode.data.node,
outputs: newNode.data.node.outputs?.map((output, i) => {
if (i === index) {
output.hide = value ?? !output.hide;
output.hidden = value ?? !output.hidden;
}
return output;
}),
@ -306,7 +306,7 @@ export default function ParameterComponent({
<IconComponent
className="h-4 w-4"
strokeWidth={1.5}
name={data.node?.outputs![index].hide ? "EyeOff" : "Eye"}
name={data.node?.outputs![index].hidden ? "EyeOff" : "Eye"}
/>
</Button>
</div>

View file

@ -246,10 +246,10 @@ export default function GenericNode({
}
const shownOutputs =
data.node!.outputs?.filter((output) => !output.hide) ?? [];
data.node!.outputs?.filter((output) => !output.hidden) ?? [];
const hiddenOutputs =
data.node!.outputs?.filter((output) => output.hide) ?? [];
data.node!.outputs?.filter((output) => output.hidden) ?? [];
function handlePlayWShortcut() {
if (buildStatus === BuildStatus.BUILDING || isBuilding || !selected) return;
@ -634,7 +634,7 @@ export default function GenericNode({
? "pb-8"
: "pb-8 pt-5"
: "",
"relative",
"relative"
)}
>
{/* increase height!! */}
@ -804,9 +804,9 @@ export default function GenericNode({
renderOutputParameter(
output,
data.node!.outputs?.findIndex(
(out) => out.name === output.name,
) ?? idx,
),
(out) => out.name === output.name
) ?? idx
)
)}
<div
className={cn(showHiddenOutputs ? "" : "h-0 overflow-hidden")}
@ -817,9 +817,9 @@ export default function GenericNode({
renderOutputParameter(
output,
data.node!.outputs?.findIndex(
(out) => out.name === output.name,
) ?? idx,
),
(out) => out.name === output.name
) ?? idx
)
)}
</div>
</div>
@ -830,7 +830,7 @@ export default function GenericNode({
(shownOutputs && shownOutputs.length > 0) ||
showHiddenOutputs
? "bottom-5"
: "bottom-1.5",
: "bottom-1.5"
)}
>
<Button
@ -844,7 +844,7 @@ export default function GenericNode({
strokeWidth={1.5}
className={cn(
"h-5 w-5 pt-px text-muted-foreground transition-all group-hover:text-medium-indigo group-hover/node:opacity-100",
showHiddenOutputs ? "rotate-180 transform" : "",
showHiddenOutputs ? "rotate-180 transform" : ""
)}
/>
</Button>

View file

@ -76,7 +76,7 @@ export type OutputFieldType = {
selected?: string;
name: string;
display_name: string;
hide?: boolean;
hidden?: boolean;
proxy?: OutputFieldProxyType;
};
export type sendAllProps = {