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

Commita314784

Browse files
fix:when using an external data source
1 parentad0d049 commita314784

File tree

1 file changed

+56
-15
lines changed

1 file changed

+56
-15
lines changed

‎client/packages/lowcoder/src/comps/generators/uiCompBuilder.tsx‎

Lines changed: 56 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,36 @@ import {
1212
ToNodeType,
1313
ViewFnTypeForComp,
1414
}from"./multi";
15-
import{ChildrenToComp,ExposingConfig,withExposingConfigs}from"./withExposing";
15+
import{
16+
ChildrenToComp,
17+
ExposingConfig,
18+
withExposingConfigs,
19+
}from"./withExposing";
1620
import{
1721
ExposeMethodCompConstructor,
1822
MethodConfigsType,
1923
withMethodExposing,
2024
}from"./withMethodExposing";
2125

22-
exporttypeNewChildren<ChildrenCompMapextendsRecord<string,Comp<unknown>>>=ChildrenCompMap&{
23-
hidden:InstanceType<typeofBoolCodeControl>;
24-
};
26+
exporttypeNewChildren<ChildrenCompMapextendsRecord<string,Comp<unknown>>>=
27+
ChildrenCompMap&{
28+
hidden:InstanceType<typeofBoolCodeControl>;
29+
};
2530

26-
exportfunctionHidableView(props:{children:JSX.Element|React.ReactNode;hidden:boolean}){
31+
exportfunctionHidableView(props:{
32+
children:JSX.Element|React.ReactNode;
33+
hidden:boolean;
34+
}){
2735
const{ readOnly}=useContext(ExternalEditorContext);
2836
if(readOnly){
2937
return<>{props.children}</>;
3038
}else{
3139
return(
3240
<>
3341
{props.hidden ?(
34-
<divstyle={{opacity:"50%",width:"100%",height:"100%"}}>{props.children}</div>
42+
<divstyle={{opacity:"50%",width:"100%",height:"100%"}}>
43+
{props.children}
44+
</div>
3545
) :(
3646
<>{props.children}</>
3747
)}
@@ -40,7 +50,9 @@ export function HidableView(props: { children: JSX.Element | React.ReactNode; hi
4050
}
4151
}
4252

43-
exportfunctionuiChildren<ChildrenCompMapextendsRecord<string,Comp<unknown>>>(
53+
exportfunctionuiChildren<
54+
ChildrenCompMapextendsRecord<string,Comp<unknown>>,
55+
>(
4456
childrenMap:ToConstructor<ChildrenCompMap>
4557
):ToConstructor<NewChildren<ChildrenCompMap>>{
4658
return{ ...childrenMap,hidden:BoolCodeControl}asany;
@@ -51,12 +63,17 @@ type ViewReturn = ReactNode;
5163
/**
5264
* UI components can be constructed with this class, providing the hidden interface
5365
*/
54-
exportclassUICompBuilder<ChildrenCompMapextendsRecord<string,Comp<unknown>>>{
66+
exportclassUICompBuilder<
67+
ChildrenCompMapextendsRecord<string,Comp<unknown>>,
68+
>{
5569
privatechildrenMap:ToConstructor<ChildrenCompMap>;
5670
privateviewFn:ViewFnTypeForComp<ViewReturn,NewChildren<ChildrenCompMap>>;
57-
privatepropertyViewFn:PropertyViewFnTypeForComp<NewChildren<ChildrenCompMap>>=()=>null;
71+
privatepropertyViewFn:PropertyViewFnTypeForComp<
72+
NewChildren<ChildrenCompMap>
73+
>=()=>null;
5874
privatestateConfigs:ExposingConfig<ChildrenToComp<ChildrenCompMap>>[]=[];
59-
privatemethodConfigs:MethodConfigsType<ExposeMethodCompConstructor<any>>=[];
75+
privatemethodConfigs:MethodConfigsType<ExposeMethodCompConstructor<any>>=
76+
[];
6077

6178
/**
6279
* If viewFn is not placed in the constructor, the type of ViewReturn cannot be inferred
@@ -69,18 +86,24 @@ export class UICompBuilder<ChildrenCompMap extends Record<string, Comp<unknown>>
6986
this.viewFn=viewFn;
7087
}
7188

72-
setPropertyViewFn(propertyViewFn:PropertyViewFnTypeForComp<NewChildren<ChildrenCompMap>>){
89+
setPropertyViewFn(
90+
propertyViewFn:PropertyViewFnTypeForComp<NewChildren<ChildrenCompMap>>
91+
){
7392
this.propertyViewFn=propertyViewFn;
7493
returnthis;
7594
}
7695

77-
setExposeStateConfigs(configs:ExposingConfig<ChildrenToComp<ChildrenCompMap>>[]){
96+
setExposeStateConfigs(
97+
configs:ExposingConfig<ChildrenToComp<ChildrenCompMap>>[]
98+
){
7899
this.stateConfigs=configs;
79100
returnthis;
80101
}
81102

82103
setExposeMethodConfigs(
83-
configs:MethodConfigsType<ExposeMethodCompConstructor<MultiBaseComp<ChildrenCompMap>>>
104+
configs:MethodConfigsType<
105+
ExposeMethodCompConstructor<MultiBaseComp<ChildrenCompMap>>
106+
>
84107
){
85108
this.methodConfigs=configs;
86109
returnthis;
@@ -113,14 +136,18 @@ export class UICompBuilder<ChildrenCompMap extends Record<string, Comp<unknown>>
113136
}
114137

115138
overridegetPropertyView():ReactNode{
116-
return<PropertyViewcomp={this}propertyViewFn={builder.propertyViewFn}/>;
139+
return(
140+
<PropertyViewcomp={this}propertyViewFn={builder.propertyViewFn}/>
141+
);
117142
}
118143
}
119144

120145
returnwithExposingConfigs(
121146
withMethodExposing(
122147
MultiTempComp,
123-
this.methodConfigsasMethodConfigsType<ExposeMethodCompConstructor<MultiTempComp>>
148+
this.methodConfigsasMethodConfigsType<
149+
ExposeMethodCompConstructor<MultiTempComp>
150+
>
124151
)astypeofMultiTempComp,
125152
this.stateConfigs
126153
);
@@ -134,12 +161,26 @@ export const DisabledContext = React.createContext<boolean>(false);
134161
*/
135162
functionUIView(props:{comp:any;viewFn:any}){
136163
constcomp=props.comp;
164+
console.log(comp);
165+
166+
console.log(comp.children);
167+
137168
constchildrenProps=childrenToProps(comp.children);
138169
constparentDisabled=useContext(DisabledContext);
139170
constdisabled=childrenProps["disabled"];
140171
if(disabled!==undefined&&typeofdisabled==="boolean"){
141172
childrenProps["disabled"]=disabled||parentDisabled;
142173
}
174+
175+
//ADDED BY FRED
176+
if(childrenProps.events){
177+
constevents=childrenProps.eventsas{value?:any[]};
178+
if(!events.value||events.value.length===0){
179+
events.value=[];
180+
}
181+
}
182+
//END ADD BY FRED
183+
143184
return(
144185
<HidableViewhidden={childrenProps.hiddenasboolean}>
145186
{props.viewFn(childrenProps,comp.dispatch)}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp