Skip to content

Commit 36c9085

Browse files
allow deleting all query variables
1 parent 13dd1f6 commit 36c9085

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

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

+3-2
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ export const KeyValueList = (props: {
9696
onDelete: (item: ReactNode, index: number) => void;
9797
isStatic?: boolean;
9898
indicatorForAll?: boolean;
99+
allowDeletingAll?: boolean;
99100
}) => {
100101
return (
101102
<>
@@ -105,8 +106,8 @@ export const KeyValueList = (props: {
105106
{item}
106107
{!props.isStatic &&
107108
<DelIcon
108-
onClick={() => props.list.length > 1 && props.onDelete(item, index)}
109-
$forbidden={props.list.length === 1}
109+
onClick={() => (props.allowDeletingAll || (!props.allowDeletingAll && props.list.length > 1)) && props.onDelete(item, index)}
110+
$forbidden={!props.allowDeletingAll && props.list.length === 1}
110111
/>
111112
}
112113
</KeyValueListItem>

client/packages/lowcoder/src/comps/queries/queryComp/variablesComp.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ export const VariablesComp = class extends list(VariableItem) {
9898
{(editorState: EditorState) => (
9999
<ControlPropertyViewWrapper {...params}>
100100
<KeyValueList
101+
allowDeletingAll
101102
list={this.getView().map((child) => child.propertyView(params))}
102103
onAdd={() => this.add(editorState)}
103104
onDelete={(item, index) => this.dispatch(this.deleteAction(index))}

0 commit comments

Comments
 (0)