Skip to content

Commit e5c9544

Browse files
author
FalkWolsky
committed
Layout Component v1
1 parent 540e0a0 commit e5c9544

File tree

8 files changed

+388
-193
lines changed

8 files changed

+388
-193
lines changed

client/packages/lowcoder/src/base/codeEditor/codeEditor.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export const CodeEditorTooltipContainer = styled.div`
5252
// tooltip common
5353
.cm-tooltip {
5454
z-index: ${Layers.codeEditorTooltip};
55-
border: none;
55+
border: 1px solid #d7d9e0;
5656
}
5757
// make sure antd popover in the code editor available
5858
.ant-popover {
@@ -84,6 +84,7 @@ export const CodeEditorTooltipContainer = styled.div`
8484
border-radius: 8px;
8585
box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);
8686
transform: translate(-16px, 10px);
87+
z-index: ${Layers.codeEditorTooltip};
8788
}
8889
8990
// left minor tooltip
@@ -109,6 +110,7 @@ export const CodeEditorTooltipContainer = styled.div`
109110
color: #4965f2;
110111
${textStyle};
111112
font-weight: 600;
113+
z-index: ${Layers.codeEditorTooltip};
112114
}
113115
114116
.cm-tooltip > .cm-completionInfo .hintDiv:hover {

client/packages/lowcoder/src/comps/comps/containerComp/pageLayoutComp.tsx

Lines changed: 73 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { CompParams } from "lowcoder-core";
22
import { 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";
45
import { NameGenerator } from "comps/utils/nameGenerator";
56
import { Section, sectionNames } from "lowcoder-design";
67
import { oldContainerParamsToNew } from "../containerBase";
@@ -9,7 +10,7 @@ import { disabledPropertyView, hiddenPropertyView } from "comps/utils/propertyUt
910
import { trans } from "i18n";
1011
import { BoolCodeControl } from "comps/controls/codeControl";
1112
import { DisabledContext } from "comps/generators/uiCompBuilder";
12-
import React, { useContext } from "react";
13+
import React, { useContext, useEffect, useState } from "react";
1314
import { EditorContext } from "comps/editorState";
1415

1516
import {
@@ -18,14 +19,19 @@ import {
1819
} from "../pageLayoutComp/pageLayoutCompBuilder";
1920
import { PageLayout } from "../pageLayoutComp/pageLayout";
2021

22+
2123
export 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+
105112
class 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

113147
type 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

Comments
 (0)