Skip to content

Commit 4d6f8da

Browse files
author
FalkWolsky
committed
Margins, Header, Borders
1 parent 8d485a2 commit 4d6f8da

File tree

4 files changed

+30
-12
lines changed

4 files changed

+30
-12
lines changed

client/packages/lowcoder/src/comps/comps/tableComp/column/tableColumnComp.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ export const columnChildrenMap = {
100100
fixed: dropdownControl(columnFixOptions, "close"),
101101
editable: BoolControl,
102102
background: withDefault(ColorControl, ""),
103+
margin: withDefault(RadiusControl, ""),
103104
text: withDefault(ColorControl, ""),
104105
border: withDefault(ColorControl, ""),
105106
borderWidth: withDefault(RadiusControl, ""),

client/packages/lowcoder/src/comps/comps/tableComp/tableCompView.tsx

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,11 @@ const TableWrapper = styled.div<{
141141
}>`
142142
max-height: 100%;
143143
overflow-y: auto;
144-
background: white;
144+
background: ${(props) => props.$style.background};
145145
border: ${(props) => `${props.$style.borderWidth} solid ${props.$style.border}`};
146146
border-radius: ${(props) => props.$style.radius};
147+
padding: ${(props) => props.$style.padding};
148+
margin: ${(props) => props.$style.margin};
147149
148150
.ant-table-wrapper {
149151
border-top: ${(props) => (props.$toolbarPosition === "above" ? "1px solid" : "unset")};
@@ -194,11 +196,11 @@ const TableWrapper = styled.div<{
194196
> .ant-table-thead {
195197
> tr > th {
196198
background-color: ${(props) => props.$headerStyle.headerBackground};
197-
border-color: ${(props) => props.$style.border};
199+
border-color: ${(props) => props.$headerStyle.border};
198200
border-width: ${(props) => props.$headerStyle.borderWidth};
199-
color: ${(props) => props.$style.headerText};
201+
color: ${(props) => props.$headerStyle.headerText};
200202
font-size: ${(props) => props.$headerStyle.textSize};
201-
border-inline-end: ${(props) => `${props.$headerStyle.borderWidth} solid ${props.$style.border}`} !important;
203+
border-inline-end: ${(props) => `${props.$headerStyle.borderWidth} solid ${props.$headerStyle.border}`} !important;
202204
${(props) =>
203205
props.$fixedHeader && `
204206
position: sticky;
@@ -208,19 +210,23 @@ const TableWrapper = styled.div<{
208210
`
209211
}
210212
213+
> div {
214+
margin: ${(props) => props.$headerStyle.margin};
215+
}
216+
211217
&:last-child {
212218
border-inline-end: none !important;
213219
}
214220
&.ant-table-column-has-sorters:hover {
215-
background-color: ${(props) => darkenColor(props.$style.headerBackground, 0.05)};
221+
background-color: ${(props) => darkenColor(props.$headerStyle.headerBackground, 0.05)};
216222
}
217223
218224
> .ant-table-column-sorters > .ant-table-column-sorter {
219-
color: ${(props) => props.$style.headerText === defaultTheme.textDark ? "#bfbfbf" : props.$style.headerText};
225+
color: ${(props) => props.$headerStyle.headerText === defaultTheme.textDark ? "#bfbfbf" : props.$headerStyle.headerText};
220226
}
221227
222228
&::before {
223-
background-color: ${(props) => props.$style.border};
229+
background-color: ${(props) => props.$headerStyle.border};
224230
}
225231
}
226232
}
@@ -310,6 +316,8 @@ const TableTd = styled.td<{
310316
border-color: ${(props) => props.$style.border} !important;
311317
border-width: ${(props) => props.$style.borderWidth} !important;
312318
border-radius: ${(props) => props.$style.radius};
319+
margin: ${(props) => props.$style.margin};
320+
313321
padding: 0 !important;
314322
315323
> div {
@@ -488,6 +496,7 @@ function TableCellView(props: {
488496

489497
const style = {
490498
background: cellColor || rowColor || columnStyle.background || columnsStyle.background,
499+
margin: columnStyle.margin || columnsStyle.margin,
491500
text: columnStyle.text || columnsStyle.text,
492501
border: columnStyle.border || columnsStyle.border,
493502
radius: columnStyle.radius || columnsStyle.radius,

client/packages/lowcoder/src/comps/comps/tableComp/tableUtils.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,7 @@ export function columnsToAntdFormat(
319319
fixed: column.fixed === "close" ? false : column.fixed,
320320
style: {
321321
background: column.background,
322+
margin: column.margin,
322323
text: column.text,
323324
border: column.border,
324325
radius: column.radius,

client/packages/lowcoder/src/comps/controls/styleControlConstants.tsx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,8 @@ const LinkTextStyle = [
683683
] as const;
684684

685685
export const TableStyle = [
686+
MARGIN,
687+
PADDING,
686688
...BG_STATIC_BORDER_RADIUS,
687689
{
688690
name: "borderWidth",
@@ -719,6 +721,8 @@ export const TableStyle = [
719721
] as const;
720722

721723
export const TableToolbarStyle = [
724+
MARGIN,
725+
PADDING,
722726
{
723727
name: "toolbarBackground",
724728
label: trans("style.toolbarBackground"),
@@ -736,17 +740,19 @@ export const TableToolbarStyle = [
736740
] as const;
737741

738742
export const TableHeaderStyle = [
739-
{
740-
name: "borderWidth",
741-
label: trans("style.borderWidth"),
742-
borderWidth: "borderWidth",
743-
},
744743
{
745744
name: "headerBackground",
746745
label: trans("style.tableHeaderBackground"),
747746
depName: "background",
748747
transformer: handleToHeadBg,
749748
},
749+
MARGIN,
750+
getStaticBorder(),
751+
{
752+
name: "borderWidth",
753+
label: trans("style.borderWidth"),
754+
borderWidth: "borderWidth",
755+
},
750756
{
751757
name: "headerText",
752758
label: trans("style.tableHeaderText"),
@@ -784,6 +790,7 @@ export const TableRowStyle = [
784790
export const TableColumnStyle = [
785791
getStaticBackground("#00000000"),
786792
getStaticBorder(),
793+
MARGIN,
787794
BORDER_WIDTH,
788795
RADIUS,
789796
TEXT,

0 commit comments

Comments
 (0)