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

Commitf1f03b0

Browse files
committed
Check only key
1 parentffbe25a commitf1f03b0

File tree

2 files changed

+31
-41
lines changed

2 files changed

+31
-41
lines changed
Lines changed: 29 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,65 @@
11
import{CompAction,SimpleComp}from"lowcoder-core";
2-
import{ControlParams,ControlPropertyViewWrapper,EditorContext,EditText,PopupCard}from"@lowcoder-ee/index.sdk";
2+
import{ControlParams,ControlPropertyViewWrapper,PopupCard}from"@lowcoder-ee/index.sdk";
33
import{useEffect,useState}from"react";
44
import{trans}from"@lowcoder-ee/i18n";
55
import{Input}from"lowcoder-design/src/components/Input";
66
import{checkName}from"../utils/rename";
7-
constSimpleVariableHeaderPropertyView=({params, comp}:any)=>{
8-
const[error,setError]=useState<string|undefined>("");
7+
constSimpleVariableHeaderPropertyView=({params, comp, isCheck}:any)=>{
8+
const[error,setError]=useState<string|undefined>();
99
const[value,setValue]=useState(comp.value);
1010
useEffect(()=>{
1111
setValue(comp.value);
12-
setError(undefined);
12+
isCheck&&setError(undefined);
1313
},[comp]);
1414
return(
1515
<ControlPropertyViewWrapper{...params}>
1616
<Input
1717
value={value}
1818
placeholder={params.placeholder}
1919
onChange={(e)=>{
20-
consterror=checkName(e.target.value);
21-
setError(error||undefined);
20+
consterror=isCheck&&checkName(e.target.value);
21+
isCheck&&setError(error||undefined);
2222
setValue(e.target.value);
2323
}}
2424
onBlur={(e)=>{
25-
if(!error)comp.dispatchChangeValueAction(value);
25+
if(!isCheck||!error)comp.dispatchChangeValueAction(value);
2626
else{
2727
setValue(comp.value);
2828
setError(undefined);
2929
}
3030
}}
3131
/>
32-
{/* <EditText
33-
// disabled={readOnly}
34-
text={comp.value}
35-
onFinish={(value) => {
36-
if (editorState.rename(comp.value, value)) {
37-
// editorState.setSelectedBottomRes(value, type);
38-
setError("");
39-
}
40-
}}
41-
onChange={(value) => setError(editorState.checkRename(comp.value, value))}
42-
style={{ maxWidth: '100%', width: '100%' }}
43-
/> */}
44-
<PopupCard
32+
{isCheck&&<PopupCard
4533
editorFocus={!!error}
4634
title={error ?trans("error") :""}
4735
content={error}
4836
hasError={!!error}
49-
/>
37+
/>}
5038
</ControlPropertyViewWrapper>
5139
);
5240
}
53-
exportclassSimpleVariableHeaderCompextendsSimpleComp<string>{
54-
overridereduce(action:CompAction): this{
55-
// if (isBroadcastAction<RenameAction>(action, CompActionTypes.RENAME)) {
56-
// if (this.getView() === action.action.oldName) {
57-
// return super.reduce(this.changeValueAction(action.action.name));
58-
// }
59-
// }
60-
returnsuper.reduce(action);
61-
}
41+
exportconstSimpleVariableHeaderComp=(isCheck:boolean=false)=>{
42+
returnclassSimpleVariableHeaderCompextendsSimpleComp<string>{
43+
overridereduce(action:CompAction): this{
44+
// if (isBroadcastAction<RenameAction>(action, CompActionTypes.RENAME)) {
45+
// if (this.getView() === action.action.oldName) {
46+
// return super.reduce(this.changeValueAction(action.action.name));
47+
// }
48+
// }
49+
returnsuper.reduce(action);
50+
}
6251

63-
readonlyIGNORABLE_DEFAULT_VALUE="";
64-
protectedgetDefaultValue():string{
65-
return"";
66-
}
52+
readonlyIGNORABLE_DEFAULT_VALUE="";
53+
protectedgetDefaultValue():string{
54+
return"";
55+
}
6756

68-
getPropertyView(){
69-
returnthis.propertyView({});
70-
}
57+
getPropertyView(){
58+
returnthis.propertyView({});
59+
}
7160

72-
propertyView(params:ControlParams){
73-
return<SimpleVariableHeaderPropertyViewparams={params}comp={this}></SimpleVariableHeaderPropertyView>
61+
propertyView(params:ControlParams){
62+
return<SimpleVariableHeaderPropertyViewparams={params}comp={this}isCheck={isCheck}></SimpleVariableHeaderPropertyView>
63+
}
7464
}
7565
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ export function keyValueControl<T extends OptionsType>(
6868
};
6969
if(controlType==="variable"){
7070
childrenMap={
71-
key:SimpleVariableHeaderCompasany,
72-
value:SimpleVariableHeaderCompasany,
71+
key:SimpleVariableHeaderComp(true)asany,
72+
value:SimpleVariableHeaderComp()asany,
7373
type:dropdownControl(types,types[0]?.value),
7474
};
7575
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp