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) name: str = Field(default=None)
"""The name of the field.""" """The name of the field."""
hide: Optional[bool] = Field(default=None) hidden: Optional[bool] = Field(default=None)
"""Dictates if the field is hidden.""" """Dictates if the field is hidden."""
display_name: Optional[str] = Field(default=None) display_name: Optional[str] = Field(default=None)

View file

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

View file

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

View file

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