Skip to content

Commit 5e1f1d7

Browse files
expose query variables in input hints dropdown
1 parent 6c24e3a commit 5e1f1d7

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

client/packages/lowcoder/src/comps/comps/gridItemComp.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ const CachedPropertyView = React.memo((props: {
9797
useEffect(() => {
9898
setSearchText("");
9999
}, [props.name]);
100+
100101
return useMemo(() => {
101102
return (
102103
<>

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export function keyValueControl<T extends OptionsType>(
6969
if(controlType === "variable") {
7070
childrenMap = {
7171
key: SimpleVariableHeaderComp(true) as any,
72-
value: SimpleVariableHeaderComp() as any,
72+
value: StringControl,
7373
type: dropdownControl(types, types[0]?.value),
7474
};
7575
}

client/packages/lowcoder/src/comps/queries/httpQuery/graphqlQuery.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
HttpParametersPropertyView,
1616
HttpPathPropertyView,
1717
} from "./httpQueryConstants";
18+
import { SimpleNameComp } from "@lowcoder-ee/comps/comps/simpleNameComp";
1819

1920
interface VariablesControlParams {
2021
// variables: string[]; todo support parse variables

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

+17
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import {
3737
FetchCheckNode,
3838
FetchInfo,
3939
fromRecord,
40+
fromValue,
4041
isCustomAction,
4142
MultiBaseComp,
4243
multiChangeAction,
@@ -655,6 +656,7 @@ QueryCompTmp = withMethodExposing(QueryCompTmp, [
655656
},
656657
]);
657658

659+
658660
export const QueryComp = withExposingConfigs(QueryCompTmp, [
659661
new NameConfig("data", trans("query.dataExportDesc")),
660662
new NameConfig("code", trans("query.codeExportDesc")),
@@ -701,7 +703,22 @@ class QueryListComp extends QueryListTmpComp implements BottomResListComp {
701703
const result: NameAndExposingInfo = {};
702704
Object.values(this.children).forEach((comp) => {
703705
result[comp.children.name.getView()] = comp.exposingInfo();
706+
707+
const variables = comp.children.variables.children.variables.toJsonValue();
708+
variables.forEach((variable: Record<string, any>) => {
709+
result[variable.key] = {
710+
property: fromRecord({
711+
value: fromValue(variable.value),
712+
}),
713+
propertyValue: {
714+
value: variable.value,
715+
},
716+
propertyDesc: {},
717+
methods: {},
718+
};
719+
})
704720
});
721+
705722
return result;
706723
}
707724

0 commit comments

Comments
 (0)