Skip to content

Commit b44d37a

Browse files
authored
Merge pull request #1476 from lowcoder-org/event_header_indicator
Add indicator to all headers in event popup
2 parents cc29011 + 7c7ea52 commit b44d37a

File tree

4 files changed

+35
-18
lines changed

4 files changed

+35
-18
lines changed

client/packages/lowcoder-design/src/components/Trees.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const BranchStyle = css`
5252
background-color: #d7d9e0;
5353
}
5454
`;
55-
export const BranchDiv = styled.div<{ $type?: "inline" | "switch" }>`
55+
export const BranchDiv = styled.div<{ $type?: "inline" | "switch" | "center" }>`
5656
position: relative;
5757
${BranchStyle}
5858
${(props) => {
@@ -81,6 +81,16 @@ export const BranchDiv = styled.div<{ $type?: "inline" | "switch" }>`
8181
bottom: 11px;
8282
}
8383
`;
84+
case "center":
85+
return css`
86+
&::before {
87+
top: calc(50% - 2px);
88+
}
89+
90+
&::after {
91+
top: 50%;
92+
}
93+
`;
8494
default:
8595
return css``;
8696
}

client/packages/lowcoder-design/src/components/keyValueList.tsx

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { TacoButton } from "./button";
44
import { ReactNode } from "react";
55
import { BluePlusIcon } from "icons";
66
import { trans } from "i18n/design";
7+
import { BranchDiv } from "./Trees";
78

89
const KeyValueListItem = styled.div`
910
display: flex;
@@ -77,18 +78,23 @@ export const KeyValueList = (props: {
7778
onAdd: () => void;
7879
onDelete: (item: ReactNode, index: number) => void;
7980
isStatic?: boolean;
80-
}) => (
81-
<>
81+
indicatorForAll?: boolean;
82+
}) => {
83+
let IndicatorWrapper = ({children}: any) => (<>{children}</>);
84+
if(props.indicatorForAll) IndicatorWrapper = BranchDiv;
85+
return <>
8286
{props.list.map((item, index) => (
83-
<KeyValueListItem key={index /* FIXME: find a proper key instead of `index` */}>
84-
{item}
85-
{!props.isStatic &&
86-
<DelIcon
87-
onClick={() => props.list.length > 1 && props.onDelete(item, index)}
88-
$forbidden={props.list.length === 1}
89-
/>
90-
}
91-
</KeyValueListItem>
87+
<IndicatorWrapper $type={"inline"} key={index}>
88+
<KeyValueListItem key={index /* FIXME: find a proper key instead of `index` */}>
89+
{item}
90+
{!props.isStatic &&
91+
<DelIcon
92+
onClick={() => props.list.length > 1 && props.onDelete(item, index)}
93+
$forbidden={props.list.length === 1}
94+
/>
95+
}
96+
</KeyValueListItem>
97+
</IndicatorWrapper>
9298
))}
9399
{!props.isStatic &&
94100
<AddBtn onClick={props.onAdd}>
@@ -97,4 +103,4 @@ export const KeyValueList = (props: {
97103
</AddBtn>
98104
}
99105
</>
100-
);
106+
};

client/packages/lowcoder/src/comps/controls/actionSelector/executeQueryAction.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ const ExecuteQueryPropertyView = ({
6161
layout: "vertical",
6262
isStatic: true,
6363
keyFixed: true,
64+
indicatorForAll: true,
6465
});
6566
}, [comp.children.queryVariables.getView()])
6667

@@ -89,11 +90,9 @@ const ExecuteQueryPropertyView = ({
8990
)}
9091
</EditorContext.Consumer>
9192
</BranchDiv>
92-
<BranchDiv>
93-
<EditorContext.Consumer>
94-
{(editorState) => getVariableOptions(editorState)}
95-
</EditorContext.Consumer>
96-
</BranchDiv>
93+
<EditorContext.Consumer>
94+
{(editorState) => getVariableOptions(editorState)}
95+
</EditorContext.Consumer>
9796
</>
9897
);
9998
}

client/packages/lowcoder/src/comps/controls/keyValueControl.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export type KeyValueControlParams = ControlParams & {
4949
valueFlexBasics?: number;
5050
isStatic?: boolean;
5151
keyFixed?: boolean;
52+
indicatorForAll?: boolean;
5253
};
5354

5455
/**
@@ -143,6 +144,7 @@ export function keyValueListControl<T extends OptionsType>(
143144
onAdd={() => this.dispatch(this.pushAction({}))}
144145
onDelete={(item, index) => this.dispatch(this.deleteAction(index))}
145146
isStatic={params.isStatic}
147+
indicatorForAll={params.indicatorForAll}
146148
/>
147149
</ControlPropertyViewWrapper>
148150
);

0 commit comments

Comments
 (0)