@@ -2,7 +2,7 @@ import { Table } from "antd";
22import { TableProps } from "antd/es/table" ;
33import { TableCellContext , TableRowContext } from "comps/comps/tableComp/tableContext" ;
44import { TableToolbar } from "comps/comps/tableComp/tableToolbarComp" ;
5- import { RowColorViewType } from "comps/comps/tableComp/tableTypes" ;
5+ import { RowColorViewType , RowHeightViewType } from "comps/comps/tableComp/tableTypes" ;
66import {
77 COL_MIN_WIDTH ,
88 COLUMN_CHILDREN_KEY ,
@@ -169,6 +169,10 @@ const TableWrapper = styled.div<{
169169 border-top: none !important;
170170 border-inline-start: none !important;
171171
172+ &::after {
173+ box-shadow: none !important;
174+ }
175+
172176 .ant-table-content {
173177 overflow: unset !important;
174178 }
@@ -280,8 +284,10 @@ const TableTh = styled.th<{ width?: number }>`
280284
281285const TableTd = styled . td < {
282286 background : string ;
283- $style : TableColumnStyleType ;
287+ $style : TableColumnStyleType & { rowHeight ?: string } ;
284288 $isEditing : boolean ;
289+ $tableSize ?: string ;
290+ $autoHeight ?: boolean ;
285291} > `
286292 .ant-table-row-expand-icon,
287293 .ant-table-row-indent {
@@ -291,16 +297,42 @@ const TableTd = styled.td<{
291297 background: ${ ( props ) => props . background } ;
292298 border-color: ${ ( props ) => props . $style . border } ;
293299 }
294-
295300 background: ${ ( props ) => props . background } !important;
296301 border-color: ${ ( props ) => props . $style . border } !important;
297302 border-width: ${ ( props ) => props . $style . borderWidth } !important;
298303 border-radius: ${ ( props ) => props . $style . radius } ;
299304 padding: 0 !important;
300305
301- > div > div {
306+ > div {
302307 color: ${ ( props ) => props . $style . text } ;
303308 font-size: ${ ( props ) => props . $style . textSize } ;
309+ line-height: 21px;
310+
311+ ${ ( props ) => props . $tableSize === 'small' && `
312+ padding: 8.5px 8px;
313+ min-height: ${ props . $style . rowHeight || '39px' } ;
314+ ${ ! props . $autoHeight && `
315+ overflow-y: auto;
316+ max-height: ${ props . $style . rowHeight || '39px' } ;
317+ ` } ;
318+ ` } ;
319+ ${ ( props ) => props . $tableSize === 'middle' && `
320+ padding: 12.5px 8px;
321+ min-height: ${ props . $style . rowHeight || '47px' } ;
322+ ${ ! props . $autoHeight && `
323+ overflow-y: auto;
324+ max-height: ${ props . $style . rowHeight || '47px' } ;
325+ ` } ;
326+ ` } ;
327+ ${ ( props ) => props . $tableSize === 'large' && `
328+ padding: 16.5px 16px;
329+ min-height: ${ props . $style . rowHeight || '55px' } ;
330+ ${ ! props . $autoHeight && `
331+ overflow-y: auto;
332+ max-height: ${ props . $style . rowHeight || '55px' } ;
333+ ` } ;
334+ ` } ;
335+
304336 &,
305337 > .ant-badge > .ant-badge-status-text,
306338 > div > .markdown-body {
@@ -383,30 +415,40 @@ type CustomTableProps<RecordType> = Omit<TableProps<RecordType>, "components" |
383415 columns : CustomColumnType < RecordType > [ ] ;
384416 viewModeResizable : boolean ;
385417 rowColorFn : RowColorViewType ;
418+ rowHeightFn : RowHeightViewType ;
386419 columnsStyle : TableColumnStyleType ;
420+ size ?: string ;
421+ rowAutoHeight ?: boolean ;
387422} ;
388423
389424function TableCellView ( props : {
390425 record : RecordType ;
391426 title : string ;
392427 rowColorFn : RowColorViewType ;
428+ rowHeightFn : RowHeightViewType ;
393429 cellColorFn : CellColorViewType ;
394430 rowIndex : number ;
395431 children : any ;
396432 columnsStyle : TableColumnStyleType ;
397433 columnStyle : TableColumnStyleType ;
434+ tableSize ?: string ;
435+ autoHeight ?: boolean ;
398436} ) {
399437 const {
400438 record,
401439 title,
402440 rowIndex,
403441 rowColorFn,
442+ rowHeightFn,
404443 cellColorFn,
405444 children,
406445 columnsStyle,
407446 columnStyle,
447+ tableSize,
448+ autoHeight,
408449 ...restProps
409450 } = props ;
451+
410452 const [ editing , setEditing ] = useState ( false ) ;
411453 const rowContext = useContext ( TableRowContext ) ;
412454 let tdView ;
@@ -419,17 +461,24 @@ function TableCellView(props: {
419461 currentOriginalIndex : record [ OB_ROW_ORI_INDEX ] ,
420462 columnTitle : title ,
421463 } ) ;
464+ const rowHeight = rowHeightFn ( {
465+ currentRow : record ,
466+ currentIndex : rowIndex ,
467+ currentOriginalIndex : record [ OB_ROW_ORI_INDEX ] ,
468+ columnTitle : title ,
469+ } ) ;
422470 const cellColor = cellColorFn ( {
423471 currentCell : record [ title . toLowerCase ( ) ] ,
424472 } ) ;
425473
426- const style : TableColumnStyleType = {
474+ const style = {
427475 background : cellColor || rowColor || columnStyle . background || columnsStyle . background ,
428476 text : columnStyle . text || columnsStyle . text ,
429477 border : columnStyle . border || columnsStyle . border ,
430478 radius : columnStyle . radius || columnsStyle . radius ,
431479 borderWidth : columnStyle . borderWidth || columnsStyle . borderWidth ,
432480 textSize : columnStyle . textSize || columnsStyle . textSize ,
481+ rowHeight : rowHeight ,
433482 }
434483 let { background } = style ;
435484 if ( rowContext . selected ) {
@@ -444,6 +493,8 @@ function TableCellView(props: {
444493 background = { background }
445494 $style = { style }
446495 $isEditing = { editing }
496+ $tableSize = { tableSize }
497+ $autoHeight = { autoHeight }
447498 >
448499 { children }
449500 </ TableTd >
@@ -511,10 +562,13 @@ function ResizeableTable<RecordType extends object>(props: CustomTableProps<Reco
511562 record,
512563 title : col . titleText ,
513564 rowColorFn : props . rowColorFn ,
565+ rowHeightFn : props . rowHeightFn ,
514566 cellColorFn : cellColorFn ,
515567 rowIndex : rowIndex ,
516568 columnsStyle : props . columnsStyle ,
517569 columnStyle : style ,
570+ tableSize : props . size ,
571+ autoHeight : props . rowAutoHeight ,
518572 } ) ,
519573 onHeaderCell : ( ) => ( {
520574 width : resizeWidth ,
@@ -583,6 +637,7 @@ export function TableCompView(props: {
583637 const compChildren = comp . children ;
584638 const style = compChildren . style . getView ( ) ;
585639 const rowStyle = compChildren . rowStyle . getView ( ) ;
640+ const rowAutoHeight = compChildren . rowAutoHeight . getView ( ) ;
586641 const columnsStyle = compChildren . columnsStyle . getView ( ) ;
587642 const changeSet = useMemo ( ( ) => compChildren . columns . getChangeSet ( ) , [ compChildren . columns ] ) ;
588643 const hasChange = useMemo ( ( ) => ! _ . isEmpty ( changeSet ) , [ changeSet ] ) ;
@@ -610,7 +665,7 @@ export function TableCompView(props: {
610665 size ,
611666 dynamicColumn ,
612667 dynamicColumnConfig ,
613- columnsAggrData
668+ columnsAggrData ,
614669 ) ,
615670 [
616671 columnViews ,
@@ -711,6 +766,7 @@ export function TableCompView(props: {
711766 }
712767 } }
713768 rowColorFn = { compChildren . rowColor . getView ( ) as any }
769+ rowHeightFn = { compChildren . rowHeight . getView ( ) as any }
714770 { ...compChildren . selection . getView ( ) ( onEvent ) }
715771 bordered = { ! compChildren . hideBordered . getView ( ) }
716772 onChange = { ( pagination , filters , sorter , extra ) => {
@@ -722,6 +778,7 @@ export function TableCompView(props: {
722778 viewModeResizable = { compChildren . viewModeResizable . getView ( ) }
723779 dataSource = { pageDataInfo . data }
724780 size = { compChildren . size . getView ( ) }
781+ rowAutoHeight = { rowAutoHeight }
725782 tableLayout = "fixed"
726783 loading = {
727784 loading ||
0 commit comments