Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd3e06ba

Browse files
updated query's variableComp to expose value properly
1 parent57e34bb commitd3e06ba

File tree

1 file changed

+34
-21
lines changed

1 file changed

+34
-21
lines changed

‎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
interfaceVariablesParams{
1517
// variables: string[]; todo support parse variables
@@ -50,33 +52,44 @@ const VariableKey = ({children, dispatch}: any) => {
5052
</>
5153
)
5254
}
53-
constVariableItem=classextendssimpleMultiComp({
55+
56+
constVariableItemBase=newMultiCompBuilder({
5457
key:SimpleNameComp,
5558
value:StringControl,
56-
}){
57-
propertyView(params:VariablesParams):ReactNode{
58-
return(
59-
<>
60-
<divstyle={{display:"flex",gap:"8px",flexGrow:1}}>
61-
<VariableKey
62-
children={this.children}
63-
dispatch={this.dispatch}
64-
/>
65-
<divstyle={{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+
<divstyle={{display:"flex",gap:"8px",flexGrow:1}}>
62+
<VariableKey
63+
children={children}
64+
dispatch={dispatch}
65+
/>
66+
<divstyle={{width:"232px",flexGrow:1}}>
67+
{children.value.propertyView({placeholder:"value"})}
68+
</div>
69+
</div>
70+
</>))
71+
.build()
72+
73+
constVariableItem=withExposingRaw(VariableItemBase,{},(comp)=>
74+
fromRecord({
75+
value:comp.children.value.exposingNode(),
76+
})
77+
);
7378

7479
constVariableListPropertyViewWrapper=({children}:any)=>{
7580
consteditorState=useContext(EditorContext);
7681
returnchildren(editorState);
7782
}
7883

7984
exportconstVariablesComp=classextendslist(VariableItem){
85+
nameAndExposingInfo():NameAndExposingInfo{
86+
constresult:NameAndExposingInfo={};
87+
Object.values(this.children).forEach((comp)=>{
88+
result[comp.children.key.getView()]=comp.exposingInfo();
89+
})
90+
returnresult;
91+
}
92+
8093
genNewName(editorState:EditorState){
8194
constname=editorState.getNameGenerator().genItemName("variable");
8295
returnname;
@@ -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
/>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp