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

Commit2b9de40

Browse files
committed
Updated navigation app for settings and JS
1 parent524bc75 commit2b9de40

File tree

3 files changed

+31
-23
lines changed

3 files changed

+31
-23
lines changed

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

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,11 @@ type ChildrenInstance = RecordConstructorToComp<typeof childrenMap> & {
233233
defaultTheme:string;
234234
};
235235

236-
functionAppGeneralSettingsModal(props:ChildrenInstance){
236+
typeAppSettingsExtraProps={isAggregationApp?:boolean};
237+
typeAppGeneralSettingsModalProps=ChildrenInstance&AppSettingsExtraProps;
238+
typeAppCanvasSettingsModalProps=ChildrenInstance&AppSettingsExtraProps;
239+
240+
functionAppGeneralSettingsModal(props:AppGeneralSettingsModalProps){
237241
constlowcoderCompsMeta=useSelector((state:AppState)=>state.npmPlugin.packageMeta['lowcoder-comps']);
238242
const[lowcoderCompVersions,setLowcoderCompVersions]=useState(['latest']);
239243
const{
@@ -243,6 +247,7 @@ function AppGeneralSettingsModal(props: ChildrenInstance) {
243247
category,
244248
showHeaderInPublic,
245249
lowcoderCompVersion,
250+
isAggregationApp
246251
}=props;
247252

248253
useEffect(()=>{
@@ -288,7 +293,8 @@ function AppGeneralSettingsModal(props: ChildrenInstance) {
288293
</div>
289294
</DivStyled>
290295
</BaseSection>
291-
<BaseSection
296+
{!isAggregationApp&&
297+
<BaseSection
292298
name={"Lowcoder Comps"}
293299
width={288}
294300
noMargin
@@ -319,7 +325,7 @@ function AppGeneralSettingsModal(props: ChildrenInstance) {
319325
}}
320326
/>
321327
</DivStyled>
322-
</BaseSection>
328+
</BaseSection>}
323329
<BaseSection
324330
name={"Shortcuts"}
325331
width={288}
@@ -337,7 +343,7 @@ function AppGeneralSettingsModal(props: ChildrenInstance) {
337343
);
338344
}
339345

340-
functionAppCanvasSettingsModal(props:ChildrenInstance){
346+
functionAppCanvasSettingsModal(props:AppCanvasSettingsModalProps){
341347
constisPublicApp=useSelector(isPublicApplication);
342348
const{
343349
themeList,
@@ -516,13 +522,12 @@ export const AppSettingsComp = new MultiCompBuilder(childrenMap, (props) => {
516522
maxWidth:Number(props.maxWidth),
517523
};
518524
})
519-
.setPropertyViewFn((children)=>{
525+
.setPropertyViewFn((children,extraProps)=>{
520526
const{ settingType}=useContext(AppSettingContext);
521527
constthemeList=useSelector(getThemeList)||[];
522528
constdefaultTheme=(useSelector(getDefaultTheme)||"").toString();
523-
524529
returnsettingType==='canvas'
525-
?<AppCanvasSettingsModal{...children}themeList={themeList}defaultTheme={defaultTheme}/>
526-
:<AppGeneralSettingsModal{...children}themeList={themeList}defaultTheme={defaultTheme}/>;
530+
?<AppCanvasSettingsModal{...children}themeList={themeList}defaultTheme={defaultTheme}{...(extraProps||{})}/>
531+
:<AppGeneralSettingsModal{...children}themeList={themeList}defaultTheme={defaultTheme}{...(extraProps||{})}/>;
527532
})
528533
.build();

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

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,10 @@ export type ViewFnTypeForComp<ViewReturn, ChildrenCompMap> = ViewFnType<
5151
ViewReturn,
5252
ToViewReturn<ChildrenCompMap>
5353
>;
54-
exporttypePropertyViewFnTypeForComp<ChildrenCompMap>=(
54+
exporttypePropertyViewFnTypeForComp<ChildrenCompMap,ExtraProps=any>=(
5555
children:ChildrenCompMap,
56-
dispatch:(action:CompAction)=>void
56+
dispatch:(action:CompAction)=>void,
57+
extraProps?:ExtraProps
5758
)=>ReactNode;
5859

5960
exportfunctionparseChildrenFromValueAndChildrenMap<
@@ -83,10 +84,10 @@ export function parseChildrenFromValueAndChildrenMap<
8384
* Building comp this way can use typescript's type inference capabilities.
8485
* Using ChildrenCompMap as a generic is to retain the information of each class, such as not wanting StringControl to degenerate into Comp<string>
8586
*/
86-
exportclassMultiCompBuilder<ViewReturn,ChildrenCompMapextendsRecord<string,Comp<unknown>>>{
87+
exportclassMultiCompBuilder<ViewReturn,ChildrenCompMapextendsRecord<string,Comp<unknown>>,ExtraProps=any>{
8788
privatechildrenMap:ToConstructor<ChildrenCompMap>;
8889
privateviewFn:ViewFnTypeForComp<ViewReturn,ChildrenCompMap>;
89-
privatepropertyViewFn?:PropertyViewFnTypeForComp<ChildrenCompMap>;
90+
privatepropertyViewFn?:PropertyViewFnTypeForComp<ChildrenCompMap,ExtraProps>;
9091

9192
/**
9293
* If viewFn is not placed in the constructor, the type of ViewReturn cannot be inferred
@@ -99,7 +100,7 @@ export class MultiCompBuilder<ViewReturn, ChildrenCompMap extends Record<string,
99100
this.viewFn=viewFn;
100101
}
101102

102-
setPropertyViewFn(propertyViewFn:PropertyViewFnTypeForComp<ChildrenCompMap>){
103+
setPropertyViewFn(propertyViewFn:PropertyViewFnTypeForComp<ChildrenCompMap,ExtraProps>){
103104
this.propertyViewFn=propertyViewFn;
104105
returnthis;
105106
}
@@ -129,8 +130,8 @@ export class MultiCompBuilder<ViewReturn, ChildrenCompMap extends Record<string,
129130
);
130131
}
131132

132-
overridegetPropertyView():ReactNode{
133-
return<PropertyViewcomp={this}propertyViewFn={builder.propertyViewFn}/>;
133+
overridegetPropertyView(extraProps?:ExtraProps):ReactNode{
134+
return<PropertyViewcomp={this}propertyViewFn={builder.propertyViewFn}extraProps={extraProps}/>;
134135
}
135136
}
136137

@@ -141,12 +142,12 @@ export class MultiCompBuilder<ViewReturn, ChildrenCompMap extends Record<string,
141142
/**
142143
* Guaranteed to be in a react component, so that react hooks can be used internally
143144
*/
144-
exportfunctionPropertyView(props:{comp:any;propertyViewFn:any}){
145+
exportfunctionPropertyView(props:{comp:any;propertyViewFn:any;extraProps?:any}){
145146
constcomp=props.comp;
146147
if(!props.propertyViewFn){
147148
returnnull;
148149
}
149-
returnprops.propertyViewFn(comp.children,comp.dispatch);
150+
returnprops.propertyViewFn(comp.children,comp.dispatch,props.extraProps);
150151
}
151152

152153
exportfunctionchildrenToProps<ChildrenCompMapextendsRecord<string,Comp<unknown>>>(

‎client/packages/lowcoder/src/pages/editor/editorView.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,11 @@ const aggregationSiderItems = [
337337
{
338338
key:SiderKey.Setting,
339339
icon:<LeftSettingIcon/>,
340-
}
340+
},
341+
{
342+
key:SiderKey.JS,
343+
icon:<LeftJSSettingIcon/>,
344+
},
341345
];
342346

343347
constDeviceWrapper=({
@@ -706,11 +710,9 @@ function EditorView(props: EditorViewProps) {
706710
<SettingsDiv>
707711
<ScrollBar>
708712
{application&&
709-
!isAggregationApp(
710-
AppUILayoutType[application.applicationType]
711-
)&&(
713+
(
712714
<>
713-
{appSettingsComp.getPropertyView()}
715+
{appSettingsComp.getPropertyView({isAggregationApp:isAggregationApp(AppUILayoutType[application.applicationType])})}
714716
</>
715717
)}
716718
</ScrollBar>
@@ -724,7 +726,7 @@ function EditorView(props: EditorViewProps) {
724726
AppUILayoutType[application.applicationType]
725727
)&&(
726728
<>
727-
{appSettingsComp.getPropertyView()}
729+
{appSettingsComp.getPropertyView({isAggregationApp:isAggregationApp(AppUILayoutType[application.applicationType])})}
728730
</>
729731
)}
730732
</ScrollBar>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp