11import { CompParams } from "lowcoder-core" ;
22import { ToDataType } from "comps/generators/multi" ;
3- import { NameConfigHidden , withExposingConfigs } from "comps/generators/withExposing" ;
3+ import { NameConfigDisabled , NameConfigHidden , withExposingConfigs , NameConfig , CompDepsConfig } from "comps/generators/withExposing" ;
4+ import { withMethodExposing } from "comps/generators/withMethodExposing" ;
45import { NameGenerator } from "comps/utils/nameGenerator" ;
56import { Section , sectionNames } from "lowcoder-design" ;
67import { oldContainerParamsToNew } from "../containerBase" ;
@@ -9,7 +10,7 @@ import { disabledPropertyView, hiddenPropertyView } from "comps/utils/propertyUt
910import { trans } from "i18n" ;
1011import { BoolCodeControl } from "comps/controls/codeControl" ;
1112import { DisabledContext } from "comps/generators/uiCompBuilder" ;
12- import React , { useContext } from "react" ;
13+ import React , { useContext , useEffect , useState } from "react" ;
1314import { EditorContext } from "comps/editorState" ;
1415
1516import {
@@ -18,14 +19,19 @@ import {
1819} from "../pageLayoutComp/pageLayoutCompBuilder" ;
1920import { PageLayout } from "../pageLayoutComp/pageLayout" ;
2021
22+
2123export const ContainerBaseComp = ( function ( ) {
22- const childrenMap = {
23- disabled : BoolCodeControl ,
24+ const childrenMap = {
25+ disabled : BoolCodeControl
2426 } ;
27+
2528 return new ContainerCompBuilder ( childrenMap , ( props , dispatch ) => {
29+
30+ const [ siderCollapsed , setSiderCollapsed ] = useState ( false ) ;
31+
2632 return (
2733 < DisabledContext . Provider value = { props . disabled } >
28- < PageLayout { ...props } />
34+ < PageLayout { ...props } siderCollapsed = { siderCollapsed } setSiderCollapsed = { setSiderCollapsed } />
2935 </ DisabledContext . Provider >
3036 ) ;
3137 } )
@@ -102,13 +108,41 @@ function convertOldContainerParams(params: CompParams<any>) {
102108 return tempParams ;
103109}
104110
111+
105112class ContainerTmpComp extends ContainerBaseComp {
106113 constructor ( params : CompParams < any > ) {
107114 super ( convertOldContainerParams ( params ) ) ;
108115 }
109116}
110117
111- export const PageLayoutComp = withExposingConfigs ( ContainerTmpComp , [ NameConfigHidden ] ) ;
118+ const PageLayoutCompTmP = withExposingConfigs ( ContainerTmpComp , [
119+ NameConfigHidden ,
120+ NameConfigDisabled ,
121+
122+ new NameConfig ( "container" , trans ( "export.ratingValueDesc" ) ) ,
123+ new CompDepsConfig (
124+ "siderCollapsed" ,
125+ ( comp ) => ( { data : comp . children . container . children . siderCollapsed . nodeWithoutCache ( ) } ) ,
126+ ( input ) => input . data . value , trans ( "listView.itemsDesc" )
127+ ) ,
128+ ] ) ;
129+
130+ export const PageLayoutComp = withMethodExposing ( PageLayoutCompTmP , [
131+
132+ {
133+ method : {
134+ name : "setSiderCollapsed" ,
135+ description : "Set the Sider of the PageLayout to be collapsed or not" ,
136+ params : [ { name : "collapsed" , type : "boolean" } ] ,
137+ } ,
138+ execute : ( comp , values ) => {
139+ const page = values [ 0 ] as number ;
140+ if ( page && page > 0 ) {
141+ // comp.children.pagination.children.pageNo.dispatchChangeValueAction(page);
142+ }
143+ } ,
144+ }
145+ ] ) ;
112146
113147type ContainerDataType = ToDataType < ContainerChildren < { } > > ;
114148
@@ -121,10 +155,40 @@ export function defaultPageLayoutData(
121155 header : toSimpleContainerData ( [
122156 {
123157 item : {
124- compType : "text " ,
125- name : nameGenerator . genItemName ( "containerTitle " ) ,
158+ compType : "navigation " ,
159+ name : nameGenerator . genItemName ( "pageNavigation " ) ,
126160 comp : {
127- text : "## " + trans ( "container.title" ) ,
161+ logoUrl : "" ,
162+ hidden : false ,
163+ items : [
164+ {
165+ label : "Home" ,
166+ hidden : false ,
167+ active : false ,
168+ } ,
169+ {
170+ label : "Services" ,
171+ hidden : false ,
172+ active : false ,
173+ items : [
174+ {
175+ label : "Lowcode Platform" ,
176+ hidden : false ,
177+ active : false ,
178+ } ,
179+ {
180+ label : "App Development" ,
181+ hidden : false ,
182+ active : false ,
183+ } ,
184+ ] ,
185+ } ,
186+ {
187+ label : "About" ,
188+ hidden : false ,
189+ active : false ,
190+ } ,
191+ ] ,
128192 } ,
129193 } ,
130194 layoutItem : {
0 commit comments