@@ -17,6 +17,7 @@ import {
1717 defaultTheme ,
1818 handleToHoverRow ,
1919 handleToSelectedRow ,
20+ TableColumnStyleType ,
2021 TableStyleType ,
2122} from "comps/controls/styleControlConstants" ;
2223import { CompNameContext , EditorContext } from "comps/editorState" ;
@@ -292,19 +293,29 @@ const TableTh = styled.th<{ width?: number }>`
292293 ${ ( props ) => props . width && `width: ${ props . width } px` } ;
293294` ;
294295
295- const TableTd = styled . td < { background : string ; $isEditing : boolean } > `
296+ const TableTd = styled . td < {
297+ background : string ;
298+ columnStyle : TableColumnStyleType ;
299+ $isEditing : boolean ;
300+ } > `
296301 .ant-table-row-expand-icon,
297302 .ant-table-row-indent {
298303 display: ${ ( props ) => ( props . $isEditing ? "none" : "initial" ) } ;
299304 }
300-
301- ${ ( props ) =>
302- props . background &&
303- `
304- background : ${ props . background } !important ;
305- ` } ;
305+ > div > div {
306+ background: ${ ( props ) => props . background } ;
307+ color: ${ ( props ) => props . columnStyle . cellText } !important;
308+ border-radius: ${ ( props ) => props . columnStyle . radius } ;
309+ border-color : ${ ( props ) => props . columnStyle . border } ;
310+ }
306311` ;
307312
313+ // ${(props) =>
314+ // props.background &&
315+ // `
316+ // background: ${props.background} !important;
317+ // `};
318+
308319const ResizeableTitle = ( props : any ) => {
309320 const { onResize, onResizeStop, width, viewModeResizable, ...restProps } = props ;
310321 const [ widthChild , setWidthChild ] = useState ( 0 ) ;
@@ -365,6 +376,7 @@ type CustomTableProps<RecordType> = Omit<TableProps<RecordType>, "components" |
365376 columns : CustomColumnType < RecordType > [ ] ;
366377 viewModeResizable : boolean ;
367378 rowColor : RowColorViewType ;
379+ columnStyle : TableColumnStyleType ;
368380} ;
369381
370382function TableCellView ( props : {
@@ -373,8 +385,10 @@ function TableCellView(props: {
373385 rowColor : RowColorViewType ;
374386 rowIndex : number ;
375387 children : any ;
388+ columnStyle : TableColumnStyleType ;
376389} ) {
377- const { record, title, rowIndex, rowColor, children, ...restProps } = props ;
390+ const { record, title, rowIndex, rowColor, children, columnStyle, ...restProps } = props ;
391+ console . log ( columnStyle )
378392 const [ editing , setEditing ] = useState ( false ) ;
379393 const rowContext = useContext ( TableRowContext ) ;
380394 let tdView ;
@@ -387,7 +401,7 @@ function TableCellView(props: {
387401 currentOriginalIndex : record [ OB_ROW_ORI_INDEX ] ,
388402 columnTitle : title ,
389403 } ) ;
390- let background = "" ;
404+ let { background } = columnStyle ;
391405 if ( color ) {
392406 background = genLinerGradient ( color ) ;
393407 }
@@ -398,7 +412,12 @@ function TableCellView(props: {
398412 background = genLinerGradient ( handleToHoverRow ( color ) ) + "," + background ;
399413 }
400414 tdView = (
401- < TableTd { ...restProps } background = { background } $isEditing = { editing } >
415+ < TableTd
416+ { ...restProps }
417+ background = { background }
418+ columnStyle = { columnStyle }
419+ $isEditing = { editing }
420+ >
402421 { children }
403422 </ TableTd >
404423 ) ;
@@ -466,6 +485,7 @@ function ResizeableTable<RecordType extends object>(props: CustomTableProps<Reco
466485 title : col . titleText ,
467486 rowColor : props . rowColor ,
468487 rowIndex : rowIndex ,
488+ columnStyle : props . columnStyle ,
469489 } ) ,
470490 onHeaderCell : ( ) => ( {
471491 width : resizeWidth ,
@@ -533,6 +553,7 @@ export function TableCompView(props: {
533553 const changeSet = useMemo ( ( ) => compChildren . columns . getChangeSet ( ) , [ compChildren . columns ] ) ;
534554 const hasChange = useMemo ( ( ) => ! _ . isEmpty ( changeSet ) , [ changeSet ] ) ;
535555 const columns = useMemo ( ( ) => compChildren . columns . getView ( ) , [ compChildren . columns ] ) ;
556+ const columnStyle = useMemo ( ( ) => compChildren . columnStyle . getView ( ) , [ compChildren . columnStyle ] ) ;
536557 const columnViews = useMemo ( ( ) => columns . map ( ( c ) => c . getView ( ) ) , [ columns ] ) ;
537558 const data = comp . filterData ;
538559 const sort = useMemo ( ( ) => compChildren . sort . getView ( ) , [ compChildren . sort ] ) ;
@@ -657,6 +678,7 @@ export function TableCompView(props: {
657678 } }
658679 showHeader = { ! compChildren . hideHeader . getView ( ) }
659680 columns = { antdColumns }
681+ columnStyle = { columnStyle }
660682 viewModeResizable = { compChildren . viewModeResizable . getView ( ) }
661683 dataSource = { pageDataInfo . data }
662684 size = { compChildren . size . getView ( ) }
0 commit comments