Skip to content

Commit 7e13a33

Browse files
author
FalkWolsky
committed
Column Layout & Responsive Layout style update
1 parent 0d47fe8 commit 7e13a33

File tree

10 files changed

+123
-63
lines changed

10 files changed

+123
-63
lines changed

client/packages/lowcoder-design/src/components/Section.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,4 +158,5 @@ export const sectionNames = {
158158
headerStyle:trans("prop.headerStyle"),
159159
bodyStyle:trans("prop.bodyStyle"),
160160
badgeStyle:trans("prop.badgeStyle"),
161+
columnStyle:trans("prop.columnStyle"),
161162
};

client/packages/lowcoder-design/src/i18n/design/locales/en.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export const en = {
3737
headerStyle: 'Header Style',
3838
bodyStyle: 'Body Style',
3939
badgeStyle: 'Badge Style',
40+
columnStyle: 'Column Style',
4041
},
4142
passwordInput: {
4243
label: "Password:",

client/packages/lowcoder-design/src/i18n/design/locales/zh.ts

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
export const zh = {
1+
import {en} from "./en";
2+
3+
export const zh: typeof en = {
4+
...en,
25
addItem: "添加",
36
duplicate: "复制",
47
rename: "重命名",
@@ -10,54 +13,64 @@ export const zh = {
1013
nextStep: "下一步",
1114
finish: "完成",
1215
country: {
13-
china: "中国",
16+
...en.country,
17+
china: "中国",
1418
},
1519
notification: {
16-
copySuccess: "复制成功",
17-
copyFail: "复制失败",
20+
...en.notification,
21+
copySuccess: "复制成功",
22+
copyFail: "复制失败",
1823
},
1924
prop: {
20-
basic: "基础",
21-
resources: "资源",
22-
interaction: "交互",
23-
advanced: "高级",
24-
validation: "验证",
25-
layout: "布局",
26-
labelStyle:"标签样式",
27-
style: "样式",
28-
meetings: "会议",
29-
data: "数据",
25+
...en.prop,
26+
basic: "基础",
27+
resources: "资源",
28+
interaction: "交互",
29+
advanced: "高级",
30+
validation: "验证",
31+
layout: "布局",
32+
labelStyle:"标签样式",
33+
style: "样式",
34+
meetings: "会议",
35+
data: "数据",
3036
},
3137
passwordInput: {
38+
...en.passwordInput,
3239
label: "密码:",
3340
placeholder: "请输入密码",
3441
inconsistentPassword: "两次密码输入不一致",
3542
confirmPasswordLabel: "确认密码:",
3643
confirmPasswordPlaceholder: "请再次输入密码",
3744
},
3845
verifyCodeInput: {
46+
...en.verifyCodeInput,
3947
label: "验证码:",
4048
errorMsg: "验证码应为 {digitNum} 位数字",
4149
placeholder: "请输入 {digitNum} 位数字验证码",
4250
sendCode: "发送验证码",
4351
},
4452
iconSelect: {
53+
...en.iconSelect,
4554
title: "选择图标",
4655
searchPlaceholder: "搜索图标",
4756
},
4857
eventHandler: {
58+
...en.eventHandler,
4959
advanced: "高级",
5060
},
5161
comp: {
62+
...en.comp,
5263
selectedCompsTitle: "已选择 {selectCompNum} 个组件",
5364
selectedCompsDetail: "点击组件查看其属性",
5465
batchDelete: "批量删除",
5566
},
5667
optionsControl: {
68+
...en.optionsControl,
5769
optionItemErrorMSg: `发现重复的选项值 "{value}",只会显示第一项,请更改为唯一值.`,
5870
emptyList: "无选项",
5971
},
6072
container: {
73+
...en.container,
6174
hintPlaceHolder: "从右侧面板拖动组件",
6275
},
6376
};

client/packages/lowcoder-design/src/icons/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ export { ReactComponent as ChartCompIconSmall } from "./v2/pie-chart-s.svg";
264264
export { ReactComponent as CheckboxCompIconSmall } from "./v2/checkbox-s.svg";
265265
export { ReactComponent as ColorPickerCompIconSmall } from "./v2/colorpicker-s.svg"; // new
266266
export { ReactComponent as CollapsibleContainerCompIconSmall } from "./v2/collapsible-container-s.svg"; // new
267+
export { ReactComponent as ColumnLayoutCompIconSmall } from "./v2/column-layout-s.svg"; // new
267268
export { ReactComponent as CommentCompIconSmall } from "./v2/comment-s.svg";
268269
export { ReactComponent as ContainerCompIconSmall } from "./v2/container-s.svg";
269270
export { ReactComponent as CustomCompIconSmall } from "./v2/custom-code-s.svg"; // new
@@ -365,6 +366,7 @@ export { ReactComponent as CascaderCompIcon } from "./v2/cascader-m.svg";
365366
export { ReactComponent as ChartCompIcon } from "./v2/pie-chart-m.svg";
366367
export { ReactComponent as CheckboxCompIcon } from "./v2/checkbox-m.svg";
367368
export { ReactComponent as CollapsibleContainerCompIcon } from "./v2/collapsible-container-m.svg";
369+
export { ReactComponent as ColumnLayoutCompIcon } from "./v2/column-layout-m.svg";
368370
export { ReactComponent as CommentCompIcon } from "./v2/comment-m.svg";
369371
export { ReactComponent as ColorPickerCompIcon } from "./v2/colorpicker-m.svg";
370372
export { ReactComponent as ContainerCompIcon } from "./v2/container-m.svg";

client/packages/lowcoder/src/comps/comps/columnLayout/columnLayout.tsx

Lines changed: 49 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ import { AutoHeightControl } from "comps/controls/autoHeightControl";
77
import { ColumnOptionControl } from "comps/controls/optionsControl";
88
import { styleControl } from "comps/controls/styleControl";
99
import {
10-
ResponsiveLayoutRowStyle,
11-
ResponsiveLayoutRowStyleType,
10+
ContainerStyle,
11+
ContainerStyleType,
1212
ResponsiveLayoutColStyleType,
1313
ResponsiveLayoutColStyle
1414
} from "comps/controls/styleControlConstants";
15+
1516
import { sameTypeMap, UICompBuilder, withDefault } from "comps/generators";
1617
import { addMapChildAction } from "comps/generators/sameTypeMap";
1718
import { NameConfigHidden, withExposingConfigs } from "comps/generators/withExposing";
@@ -40,14 +41,33 @@ import { EditorContext } from "comps/editorState";
4041
import { disabledPropertyView, hiddenPropertyView } from "comps/utils/propertyUtils";
4142
import { DisabledContext } from "comps/generators/uiCompBuilder";
4243

44+
const ContainWrapper = styled.div<{
45+
$style: ContainerStyleType | undefined;
46+
}>`
47+
background-color: ${(props) => props.$style?.background} !important;
48+
border-radius: ${(props) => props.$style?.radius};
49+
border-width: ${(props) => props.$style?.borderWidth};
50+
border-color: ${(props) => props.$style?.border};
51+
border-style: ${(props) => props.$style?.borderStyle};
52+
rotate: ${(props) => props.$style?.rotation};
53+
margin: ${(props) => props.$style?.margin};
54+
padding: ${(props) => props.$style?.padding};
55+
`;
4356

4457
const ColWrapper = styled(Col)<{
45-
$style: ResponsiveLayoutColStyleType,
58+
$style: ResponsiveLayoutColStyleType | undefined,
4659
$minWidth?: string,
4760
$matchColumnsHeight: boolean,
4861
}>`
4962
> div {
5063
height: ${(props) => props.$matchColumnsHeight ? '100%' : 'auto'};
64+
background-color: ${(props) => props.$style?.background} !important;
65+
border-radius: ${(props) => props.$style?.radius};
66+
border-width: ${(props) => props.$style?.borderWidth};
67+
border-color: ${(props) => props.$style?.border};
68+
border-style: ${(props) => props.$style?.borderStyle};
69+
margin: ${(props) => props.$style?.margin};
70+
padding: ${(props) => props.$style?.padding};
5171
}
5272
`;
5373

@@ -64,7 +84,8 @@ const childrenMap = {
6484
rowGap: withDefault(StringControl, "20px"),
6585
templateColumns: withDefault(StringControl, "1fr 1fr"),
6686
columnGap: withDefault(StringControl, "20px"),
67-
columnStyle: withDefault(styleControl(ResponsiveLayoutColStyle), {})
87+
style: withDefault(styleControl(ContainerStyle), {}),
88+
columnStyle: withDefault(styleControl(ResponsiveLayoutColStyle),{borderWidth:'1px'})
6889
};
6990

7091
type ViewProps = RecordConstructorToView<typeof childrenMap>;
@@ -89,7 +110,7 @@ const ColumnContainer = (props: ColumnContainerProps) => {
89110

90111
const ColumnLayout = (props: ColumnLayoutProps) => {
91112
let {
92-
columns,
113+
columns,
93114
containers,
94115
dispatch,
95116
matchColumnsHeight,
@@ -103,15 +124,15 @@ const ColumnLayout = (props: ColumnLayoutProps) => {
103124
return (
104125
<BackgroundColorContext.Provider value={"none"}>
105126
<DisabledContext.Provider value={props.disabled}>
106-
<div style={{height: '100%', backgroundColor: "pink"}}>
127+
<ContainWrapper $style={props.style}>
107128
<div style={{display: "grid", gridTemplateColumns: templateColumns, columnGap, gridTemplateRows: templateRows, rowGap}}>
108129
{columns.map(column => {
109130
const id = String(column.id);
110131
const childDispatch = wrapDispatch(wrapDispatch(dispatch, "containers"), id);
111132
if(!containers[id]) return null
112133
const containerProps = containers[id].children;
113134

114-
const columnCustomStyle = {
135+
/* const columnCustomStyle = {
115136
margin: "0",
116137
padding: !_.isEmpty(column.padding) ? column.padding : "0",
117138
radius: "0",
@@ -121,16 +142,16 @@ const ColumnLayout = (props: ColumnLayoutProps) => {
121142
backgroundImage: "linear-gradient(to bottom, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 1) 100%), linear-gradient(to bottom, rgba(253, 246, 199, 1) 0%, rgba(253, 246, 199, 1) 100%)",
122143
backgroundClip: "content-box, padding-box",
123144
124-
}
145+
} */
125146
const noOfColumns = columns.length;
126-
let backgroundStyle = columnCustomStyle.background;
147+
/* let backgroundStyle = columnCustomStyle.background;
127148
if(!_.isEmpty(column.backgroundImage)) {
128149
backgroundStyle = `center / cover url('${column.backgroundImage}') no-repeat, ${backgroundStyle}`;
129-
}
150+
} */
130151
return (
131152
<ColWrapper
132153
key={id}
133-
$style={columnCustomStyle}
154+
$style={props.columnStyle}
134155
$minWidth={column.minWidth}
135156
$matchColumnsHeight={matchColumnsHeight}
136157
>
@@ -140,17 +161,14 @@ const ColumnLayout = (props: ColumnLayoutProps) => {
140161
positionParams={containerProps.positionParams.getView()}
141162
dispatch={childDispatch}
142163
autoHeight={props.autoHeight}
143-
style={{
144-
...columnCustomStyle,
145-
background: backgroundStyle,
146-
}}
164+
style={columnStyle}
147165
/>
148166
</ColWrapper>
149167
)
150168
})
151169
}
152170
</div>
153-
</div>
171+
</ContainWrapper>
154172
</DisabledContext.Provider>
155173
</BackgroundColorContext.Provider>
156174
);
@@ -170,8 +188,6 @@ export const ResponsiveLayoutBaseComp = (function () {
170188
title: trans("responsiveLayout.column"),
171189
newOptionLabel: "Column",
172190
})}
173-
{children.templateColumns.propertyView({label: "Column Definition"})}
174-
{children.templateRows.propertyView({label: "Row Definition"})}
175191
</Section>
176192

177193
{(useContext(EditorContext).editorModeStatus === "logic" || useContext(EditorContext).editorModeStatus === "both") && (
@@ -187,19 +203,29 @@ export const ResponsiveLayoutBaseComp = (function () {
187203
{children.autoHeight.getPropertyView()}
188204
</Section>
189205
<Section name={trans("responsiveLayout.columnsLayout")}>
190-
{children.matchColumnsHeight.propertyView({
191-
label: trans("responsiveLayout.matchColumnsHeight")
206+
{children.matchColumnsHeight.propertyView({ label: trans("responsiveLayout.matchColumnsHeight")
192207
})}
193208
{controlItem({}, (
194-
<div style={{ marginTop: '8px' }}>
195-
{trans("responsiveLayout.columnsSpacing")}
196-
</div>
209+
<div style={{ marginTop: '8px' }}>{trans("responsiveLayout.columnsSpacing")}</div>
197210
))}
211+
{children.templateColumns.propertyView({label: "Column Definition"})}
212+
{children.templateRows.propertyView({label: "Row Definition"})}
198213
{children.columnGap.propertyView({label: "Column Gap"})}
199214
{children.rowGap.propertyView({label: "Row Gap"})}
200215
</Section>
201216
</>
202217
)}
218+
219+
{(useContext(EditorContext).editorModeStatus === "layout" || useContext(EditorContext).editorModeStatus === "both") && (
220+
<>
221+
<Section name={sectionNames.style}>
222+
{children.style.getPropertyView()}
223+
</Section>
224+
<Section name={sectionNames.columnStyle}>
225+
{children.columnStyle.getPropertyView()}
226+
</Section>
227+
</>
228+
)}
203229
</>
204230
);
205231
})

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { dropdownControl } from "comps/controls/dropdownControl";
2222
import { styleControl } from "comps/controls/styleControl";
2323
const { Meta } = Card;
2424

25-
const Warpper = styled.div<{
25+
const Wrapper = styled.div<{
2626
$style: CardStyleType | undefined;
2727
$showMate: boolean;
2828
$cardType: string;
@@ -103,12 +103,12 @@ const Warpper = styled.div<{
103103
}
104104
`;
105105

106-
const ContainWarpper = styled.div`
106+
const ContainWrapper = styled.div`
107107
height: 100%;
108108
width: 100%;
109109
`
110110

111-
const IconWarpper = styled.div<{ $style: CardStyleType | undefined, disabled: boolean }>`
111+
const IconWrapper = styled.div<{ $style: CardStyleType | undefined, disabled: boolean }>`
112112
pointer-events: ${props => props.disabled ? 'none' : ''};
113113
svg {
114114
color: ${props => props.disabled ? '#d9d9d9' : props.$style?.IconColor};
@@ -208,7 +208,7 @@ export const ContainerBaseComp = (function () {
208208
};
209209
return (
210210
<ReactResizeDetector onResize={onResize}>
211-
<Warpper
211+
<Wrapper
212212
ref={conRef}
213213
$style={props.style}
214214
$animationStyle={props.animationStyle}
@@ -233,23 +233,23 @@ export const ContainerBaseComp = (function () {
233233
actions={props.cardType == 'common' && props.showActionIcon ?
234234
props.actionOptions.filter(item => !item.hidden).map(item => {
235235
return (
236-
<IconWarpper
236+
<IconWrapper
237237
onClick={() => item.onEvent('click')}
238238
disabled={item.disabled}
239239
$style={props.style}
240240
>
241241
{item.icon}
242-
</IconWarpper>)
242+
</IconWrapper>)
243243
}
244244
) : []
245245
}
246246
>
247247
{props.cardType == 'common' && props.showMeta && <Meta title={props.metaTitle} description={props.metaDesc} />}
248-
{props.cardType == 'custom' && <ContainWarpper>
249-
<TriContainer {...props} /></ContainWarpper>}
248+
{props.cardType == 'custom' && <ContainWrapper>
249+
<TriContainer {...props} /></ContainWrapper>}
250250
</Card>
251251
}
252-
</Warpper>
252+
</Wrapper>
253253
</ReactResizeDetector>
254254
);
255255
})

0 commit comments

Comments
 (0)