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

Commitd3015a6

Browse files
update temporaryStateComp setValue, setIn functions to return value in promise
1 parente0383d8 commitd3015a6

File tree

1 file changed

+32
-25
lines changed

1 file changed

+32
-25
lines changed

‎client/packages/lowcoder/src/comps/comps/temporaryStateComp.tsx‎

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@ import { JSONObject } from "util/jsonTypes";
1414
import{QueryTutorials}from"util/tutorialUtils";
1515
import{SimpleNameComp}from"./simpleNameComp";
1616
import{markdownCompCss,TacoMarkDown}from"lowcoder-design";
17+
import{evalAndReduce}from"../utils";
1718

1819
constTemporaryStateItemCompBase=newMultiCompBuilder(
19-
{
20-
name:SimpleNameComp,
21-
value:jsonValueStateControl(null),
22-
},
23-
()=>null
24-
)
20+
{
21+
name:SimpleNameComp,
22+
value:jsonValueStateControl(null),
23+
},
24+
()=>null
25+
)
2526
.setPropertyViewFn((children)=>{
2627
return(
2728
<BottomTabs
@@ -80,7 +81,10 @@ const TemporaryStateItemCompWithMethodExpose = withMethodExposing(TemporaryState
8081
description:"",
8182
},
8283
execute:async(comp,params)=>{
83-
comp.children.value.change(params?.[0]);
84+
returnnewPromise(async(resolve)=>{
85+
awaitcomp.children.value.change(params?.[0]);
86+
resolve(params?.[0])
87+
})
8488
},
8589
},
8690
{
@@ -99,24 +103,27 @@ const TemporaryStateItemCompWithMethodExpose = withMethodExposing(TemporaryState
99103
description:"",
100104
},
101105
execute:async(comp,params)=>{
102-
const{value:prev, onChange}=comp.children.value.getView();
103-
const[path,value]=params;
104-
if(
105-
!Array.isArray(path)||
106-
!path.every((i)=>typeofi==="string"||typeofi==="number")
107-
){
108-
thrownewError(trans("temporaryState.pathTypeError"));
109-
}
110-
if(!_.isPlainObject(prev)&&!Array.isArray(prev)){
111-
thrownewError(
112-
trans("temporaryState.unStructuredError",{
113-
path:JSON.stringify(path),
114-
prev:JSON.stringify(prev),
115-
})
116-
);
117-
}
118-
constnextValue=_.set(_.cloneDeep(prevasJSONObject),pathas(string|number)[],value);
119-
onChange(nextValue);
106+
returnnewPromise(async(resolve)=>{
107+
const{value:prev, onChange}=comp.children.value.getView();
108+
const[path,value]=params;
109+
if(
110+
!Array.isArray(path)||
111+
!path.every((i)=>typeofi==="string"||typeofi==="number")
112+
){
113+
thrownewError(trans("temporaryState.pathTypeError"));
114+
}
115+
if(!_.isPlainObject(prev)&&!Array.isArray(prev)){
116+
thrownewError(
117+
trans("temporaryState.unStructuredError",{
118+
path:JSON.stringify(path),
119+
prev:JSON.stringify(prev),
120+
})
121+
);
122+
}
123+
constnextValue=_.set(_.cloneDeep(prevasJSONObject),pathas(string|number)[],value);
124+
awaitonChange(nextValue);
125+
resolve(nextValue);
126+
})
120127
},
121128
},
122129
]);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp