Skip to content

Commit 406dc54

Browse files
authored
Merge branch 'dev' into sharing_state_on_app_creation
2 parents 4699dbe + cda8b6d commit 406dc54

File tree

11 files changed

+87
-66
lines changed

11 files changed

+87
-66
lines changed

client/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.6.4
1+
2.6.5

client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lowcoder-frontend",
3-
"version": "2.6.4",
3+
"version": "2.6.5",
44
"type": "module",
55
"private": true,
66
"workspaces": [

client/packages/lowcoder-comps/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lowcoder-comps",
3-
"version": "2.6.5",
3+
"version": "2.6.6",
44
"type": "module",
55
"license": "MIT",
66
"dependencies": {

client/packages/lowcoder/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lowcoder",
3-
"version": "2.6.4",
3+
"version": "2.6.5",
44
"private": true,
55
"type": "module",
66
"main": "src/index.sdk.ts",

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,9 @@ function actionSelectorControl(needContext: boolean) {
251251
const ignorePromise = Promise.resolve();
252252
const realNeedContext = needContext || getReduceContext().inEventContext;
253253
const actionPromise = () => {
254-
return realNeedContext ? action.value.func() : this.children.comp.getView()();
254+
// return realNeedContext ? action.value.func() : this.children.comp.getView()();
255+
// commenting because it's using old context for event handlers inside list/grid
256+
return this.children.comp.getView()();
255257
};
256258
handlePromiseAfterResult(action, ignored ? ignorePromise : actionPromise());
257259
return this;

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

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { getPromiseAfterDispatch } from "util/promiseUtils";
99
import { trans } from "i18n";
1010
import { withDefault } from "comps/generators";
1111
import { keyValueListControl} from "comps/controls/keyValueListControl";
12-
import { useCallback } from "react";
12+
import { useCallback, useEffect } from "react";
1313

1414
const ExecuteQueryPropertyView = ({
1515
comp,
@@ -19,16 +19,25 @@ const ExecuteQueryPropertyView = ({
1919
placement?: "query" | "table"
2020
}) => {
2121
const getQueryOptions = useCallback((editorState?: EditorState) => {
22-
const options: { label: string; value: string; variables?: Record<string, string> }[] =
23-
editorState
24-
?.queryCompInfoList()
25-
.map((info) => {
22+
if (!editorState) return [];
23+
const options: {
24+
label: string;
25+
value: string;
26+
variables?: Record<string, string>
27+
}[] = editorState.getQueriesComp()
28+
.getView()
29+
.map((item) => {
30+
const name = item.children.name.getView();
31+
const qVariables: Record<string, string> = {};
32+
item.children.variables.toJsonValue().forEach(v => {
33+
qVariables[v.key!] = '';
34+
});
2635
return {
27-
label: info.name,
28-
value: info.name,
29-
variables: info.data.variables,
36+
label: name,
37+
value: name,
38+
variables: qVariables,
3039
}
31-
})
40+
})
3241
.filter(
3342
// Filter out the current query under query
3443
(option) => {
@@ -67,7 +76,7 @@ const ExecuteQueryPropertyView = ({
6776
indicatorForAll: true,
6877
});
6978
}, [comp.children.queryVariables.getView()])
70-
79+
7180
return (
7281
<>
7382
<BranchDiv $type={"inline"}>
@@ -114,26 +123,27 @@ const ExecuteQueryTmpAction = (function () {
114123
export class ExecuteQueryAction extends ExecuteQueryTmpAction {
115124
override getView() {
116125
const queryName = this.children.queryName.getView();
117-
// const queryParams = keyValueListToSearchStr(Array.isArray(this?.children?.query) ? (this.children.query as unknown as any[]).map((i: any) => i.getView() as KeyValue) : []);
118-
const result = this.children.queryVariables.toJsonValue()
119-
.filter(item => item.key !== "" && item.value !== "")
120-
.map(item => ({[item.key as string]: item.value}))
121-
.reduce((acc, curr) => Object.assign(acc, curr), {});
122-
123-
result.$queryName = queryName;
124126
if (!queryName) {
125127
return () => Promise.resolve();
126128
}
127129

128-
return () =>
129-
getPromiseAfterDispatch(
130+
let result = Object.values(this.children.queryVariables.getView())
131+
.filter((item) => item.children.key.getView() !== "" && item.children.value.getView() !== "")
132+
.map((item) => ({[item.children.key.getView() as string]: {value: item.children.value.getView()}}))
133+
.reduce((acc, curr) => Object.assign(acc, curr), {});
134+
135+
result.$queryName = {value: this.children.queryName.getView()};
136+
137+
return () => {
138+
return getPromiseAfterDispatch(
130139
this.dispatch,
131140
routeByNameAction(
132141
queryName,
133142
executeQueryAction({args: result})
134143
),
135144
{ notHandledError: trans("eventHandler.notHandledError") }
136145
);
146+
}
137147
}
138148

139149
displayName() {

client/packages/lowcoder/src/comps/generators/withSelectedMultiContext.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,12 @@ export function withSelectedMultiContext<TCtor extends MultiCompConstructor>(
8686
action.editDSL
8787
|| isCustomAction<LazyCompReadyAction>(action, "LazyCompReady")
8888
|| isCustomAction<ModuleReadyAction>(action, "moduleReady")
89-
) && action.path[1] === SELECTED_KEY) {
89+
) && (
90+
action.path[1] === SELECTED_KEY
91+
|| ( // special check added for modules inside list view
92+
isCustomAction<ModuleReadyAction>(action, "moduleReady")
93+
&& action.path[1] === this.selection)
94+
)) {
9095
// broadcast
9196
const newAction = {
9297
...action,

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

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ import {
3737
FetchCheckNode,
3838
FetchInfo,
3939
fromRecord,
40-
fromValue,
4140
isCustomAction,
4241
MultiBaseComp,
4342
multiChangeAction,
@@ -369,7 +368,7 @@ QueryCompTmp = class extends QueryCompTmp {
369368
}
370369
if (action.type === CompActionTypes.EXECUTE_QUERY) {
371370
if (getReduceContext().disableUpdateState) return this;
372-
if(!action.args) action.args = this.children.variables.toJsonValue().filter(kv => kv.key).reduce((acc, curr) => Object.assign(acc, {[curr.key as string]:curr.value}), {});
371+
action.args = action.args || {};
373372
action.args.$queryName = this.children.name.getView();
374373

375374
return this.executeQuery(action);
@@ -711,25 +710,18 @@ class QueryListComp extends QueryListTmpComp implements BottomResListComp {
711710
}
712711

713712
nameAndExposingInfo(): NameAndExposingInfo {
714-
const result: NameAndExposingInfo = {};
713+
let result: NameAndExposingInfo = {};
715714
Object.values(this.children).forEach((comp) => {
716715
result[comp.children.name.getView()] = comp.exposingInfo();
717716

718-
const variables = comp.children.variables.toJsonValue();
719-
variables.forEach((variable: Record<string, any>) => {
720-
result[variable.key] = {
721-
property: fromRecord({
722-
value: fromValue(variable.value),
723-
}),
724-
propertyValue: {
725-
value: variable.value,
726-
},
727-
propertyDesc: {},
728-
methods: {},
729-
};
730-
})
717+
const variables = comp.children.variables.nameAndExposingInfo();
718+
if (variables) {
719+
result = {
720+
...result,
721+
...variables,
722+
}
723+
}
731724
});
732-
733725
return result;
734726
}
735727

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

Lines changed: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { simpleMultiComp } from "../../generators";
1+
import { MultiCompBuilder, simpleMultiComp } from "../../generators";
22
import { SimpleNameComp } from "@lowcoder-ee/comps/comps/simpleNameComp";
33
import { StringControl } from "@lowcoder-ee/comps/controls/codeControl";
44
import { list } from "@lowcoder-ee/comps/generators/list";
@@ -9,7 +9,9 @@ import { KeyValueList } from "components/keyValueList";
99
import { trans } from "i18n";
1010
import { PopupCard } from "components/popupCard";
1111
import { EditorContext, EditorState } from "@lowcoder-ee/comps/editorState";
12-
import { migrateOldData } from "@lowcoder-ee/comps/generators/simpleGenerators";
12+
import { withExposingRaw } from "@lowcoder-ee/comps/generators/withExposing";
13+
import { NameAndExposingInfo } from "@lowcoder-ee/comps/utils/exposingTypes";
14+
import { fromRecord } from "lowcoder-core";
1315

1416
interface VariablesParams {
1517
// variables: string[]; todo support parse variables
@@ -50,33 +52,44 @@ const VariableKey = ({children, dispatch}: any) => {
5052
</>
5153
)
5254
}
53-
const VariableItem = class extends simpleMultiComp({
55+
56+
const VariableItemBase = new MultiCompBuilder({
5457
key: SimpleNameComp,
5558
value: StringControl,
56-
}) {
57-
propertyView(params: VariablesParams): ReactNode {
58-
return (
59-
<>
60-
<div style={{ display: "flex", gap: "8px", flexGrow: 1 }}>
61-
<VariableKey
62-
children={this.children}
63-
dispatch={this.dispatch}
64-
/>
65-
<div style={{ width: "232px", flexGrow: 1 }}>
66-
{this.children.value.propertyView({ placeholder: "value" })}
67-
</div>
68-
</div>
69-
</>
70-
)
71-
}
72-
}
59+
}, (props) => props)
60+
.setPropertyViewFn((children, dispatch) => (<>
61+
<div style={{ display: "flex", gap: "8px", flexGrow: 1 }}>
62+
<VariableKey
63+
children={children}
64+
dispatch={dispatch}
65+
/>
66+
<div style={{ width: "232px", flexGrow: 1 }}>
67+
{children.value.propertyView({ placeholder: "value" })}
68+
</div>
69+
</div>
70+
</>))
71+
.build()
72+
73+
const VariableItem = withExposingRaw(VariableItemBase, {}, (comp) =>
74+
fromRecord({
75+
value: comp.children.value.exposingNode(),
76+
})
77+
);
7378

7479
const VariableListPropertyViewWrapper = ({children}: any) => {
7580
const editorState = useContext(EditorContext);
7681
return children(editorState);
7782
}
7883

7984
export const VariablesComp = class extends list(VariableItem) {
85+
nameAndExposingInfo(): NameAndExposingInfo {
86+
const result: NameAndExposingInfo = {};
87+
Object.values(this.children).forEach((comp) => {
88+
result[comp.children.key.getView()] = comp.exposingInfo();
89+
})
90+
return result;
91+
}
92+
8093
genNewName(editorState: EditorState) {
8194
const name = editorState.getNameGenerator().genItemName("variable");
8295
return name;
@@ -99,7 +112,7 @@ export const VariablesComp = class extends list(VariableItem) {
99112
<ControlPropertyViewWrapper {...params}>
100113
<KeyValueList
101114
allowDeletingAll
102-
list={this.getView().map((child) => child.propertyView(params))}
115+
list={this.getView().map((child) => child.getPropertyView())}
103116
onAdd={() => this.add(editorState)}
104117
onDelete={(item, index) => this.dispatch(this.deleteAction(index))}
105118
/>

server/api-service/pom.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313

1414
<properties>
15-
<revision>2.6.4</revision>
15+
<revision>2.6.5</revision>
1616
<java.version>17</java.version>
1717
<maven.compiler.source>${java.version}</maven.compiler.source>
1818
<maven.compiler.target>${java.version}</maven.compiler.target>
@@ -164,4 +164,3 @@
164164
</modules>
165165

166166
</project>
167-

server/node-service/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lowcoder-node-server",
3-
"version": "2.6.4",
3+
"version": "2.6.5",
44
"private": true,
55
"engines": {
66
"node": "^14.18.0 || >=16.0.0"

0 commit comments

Comments
 (0)