Skip to content

Commit 0fd2b16

Browse files
Merge pull request #2071 from iamfaran/fix/table-header
[Fix]: table header on different table sizes
2 parents 70ffeea + a656c5c commit 0fd2b16

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,7 @@ export const TableCompView = React.memo((props: {
378378
$isVirtual={scrollConfig.virtual}
379379
$showHorizontalScrollbar={showHorizontalScrollbar}
380380
$showVerticalScrollbar={showVerticalScrollbar}
381+
$tableSize={size as 'small' | 'middle' | 'large'}
381382
>
382383
<ResizeableTable<RecordType>
383384
expandable={{

client/packages/lowcoder/src/comps/comps/tableComp/tableStyles.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ export const TableWrapper = styled.div.attrs<{
136136
$isVirtual?: boolean;
137137
$showHorizontalScrollbar?: boolean;
138138
$showVerticalScrollbar?: boolean;
139+
$tableSize?: "small" | "middle" | "large";
139140
}>`
140141
.ant-table-wrapper {
141142
border-top: unset;
@@ -202,6 +203,8 @@ export const TableWrapper = styled.div.attrs<{
202203
border-color: ${(props) => props.$headerStyle.border};
203204
border-width: ${(props) => props.$headerStyle.borderWidth};
204205
color: ${(props) => props.$headerStyle.headerText};
206+
padding: 0 !important; /* Override Ant Design's default padding */
207+
// border-inline-end: ${(props) => `${props.$headerStyle.borderWidth} solid ${props.$headerStyle.border}`} !important;
205208
${(props) => props.$showRowGridBorder
206209
? `border-inline-end: ${props.$headerStyle.borderWidth} solid ${props.$headerStyle.border} !important;`
207210
: `border-inline-end: none !important;`
@@ -221,6 +224,9 @@ export const TableWrapper = styled.div.attrs<{
221224
222225
> div {
223226
margin: ${(props) => props.$headerStyle.margin};
227+
/* Default padding for middle size (Ant Design default) */
228+
padding: 8px 8px;
229+
min-height: 24px;
224230
225231
&, .ant-table-column-title > div {
226232
font-size: ${(props) => props.$headerStyle.textSize};
@@ -229,6 +235,20 @@ export const TableWrapper = styled.div.attrs<{
229235
font-style: ${(props) => props.$headerStyle.fontStyle};
230236
color:${(props) => props.$headerStyle.headerText}
231237
}
238+
239+
/* Adjust header size based on table size */
240+
${(props) => props.$tableSize === 'small' && `
241+
padding: 1px 8px;
242+
min-height: 14px;
243+
`}
244+
${(props) => props.$tableSize === 'middle' && `
245+
padding: 8px 8px;
246+
min-height: 24px;
247+
`}
248+
${(props) => props.$tableSize === 'large' && `
249+
padding: 16px 16px;
250+
min-height: 48px;
251+
`}
232252
}
233253
234254
&:last-child {

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1828,7 +1828,6 @@ export const TableToolbarStyle = [
18281828

18291829
export const TableHeaderStyle = [
18301830
MARGIN,
1831-
PADDING,
18321831
FONT_FAMILY,
18331832
FONT_STYLE,
18341833
// getStaticBackground(SURFACE_COLOR),

0 commit comments

Comments
 (0)