Skip to content

Add indicator to all headers in event popup #1476

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion client/packages/lowcoder-design/src/components/Trees.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const BranchStyle = css`
background-color: #d7d9e0;
}
`;
export const BranchDiv = styled.div<{ $type?: "inline" | "switch" }>`
export const BranchDiv = styled.div<{ $type?: "inline" | "switch" | "center" }>`
position: relative;
${BranchStyle}
${(props) => {
Expand Down Expand Up @@ -81,6 +81,16 @@ export const BranchDiv = styled.div<{ $type?: "inline" | "switch" }>`
bottom: 11px;
}
`;
case "center":
return css`
&::before {
top: calc(50% - 2px);
}

&::after {
top: 50%;
}
`;
default:
return css``;
}
Expand Down
30 changes: 18 additions & 12 deletions client/packages/lowcoder-design/src/components/keyValueList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { TacoButton } from "./button";
import { ReactNode } from "react";
import { BluePlusIcon } from "icons";
import { trans } from "i18n/design";
import { BranchDiv } from "./Trees";

const KeyValueListItem = styled.div`
display: flex;
Expand Down Expand Up @@ -77,18 +78,23 @@ export const KeyValueList = (props: {
onAdd: () => void;
onDelete: (item: ReactNode, index: number) => void;
isStatic?: boolean;
}) => (
<>
indicatorForAll?: boolean;
}) => {
let IndicatorWrapper = ({children}: any) => (<>{children}</>);
if(props.indicatorForAll) IndicatorWrapper = BranchDiv;
return <>
{props.list.map((item, index) => (
<KeyValueListItem key={index /* FIXME: find a proper key instead of `index` */}>
{item}
{!props.isStatic &&
<DelIcon
onClick={() => props.list.length > 1 && props.onDelete(item, index)}
$forbidden={props.list.length === 1}
/>
}
</KeyValueListItem>
<IndicatorWrapper $type={"inline"} key={index}>
<KeyValueListItem key={index /* FIXME: find a proper key instead of `index` */}>
{item}
{!props.isStatic &&
<DelIcon
onClick={() => props.list.length > 1 && props.onDelete(item, index)}
$forbidden={props.list.length === 1}
/>
}
</KeyValueListItem>
</IndicatorWrapper>
))}
{!props.isStatic &&
<AddBtn onClick={props.onAdd}>
Expand All @@ -97,4 +103,4 @@ export const KeyValueList = (props: {
</AddBtn>
}
</>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const ExecuteQueryPropertyView = ({
layout: "vertical",
isStatic: true,
keyFixed: true,
indicatorForAll: true,
});
}, [comp.children.queryVariables.getView()])

Expand Down Expand Up @@ -89,11 +90,9 @@ const ExecuteQueryPropertyView = ({
)}
</EditorContext.Consumer>
</BranchDiv>
<BranchDiv>
<EditorContext.Consumer>
{(editorState) => getVariableOptions(editorState)}
</EditorContext.Consumer>
</BranchDiv>
<EditorContext.Consumer>
{(editorState) => getVariableOptions(editorState)}
</EditorContext.Consumer>
</>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export type KeyValueControlParams = ControlParams & {
valueFlexBasics?: number;
isStatic?: boolean;
keyFixed?: boolean;
indicatorForAll?: boolean;
};

/**
Expand Down Expand Up @@ -143,6 +144,7 @@ export function keyValueListControl<T extends OptionsType>(
onAdd={() => this.dispatch(this.pushAction({}))}
onDelete={(item, index) => this.dispatch(this.deleteAction(index))}
isStatic={params.isStatic}
indicatorForAll={params.indicatorForAll}
/>
</ControlPropertyViewWrapper>
);
Expand Down
Loading