@@ -17,6 +17,7 @@ import {
17
17
defaultTheme ,
18
18
handleToHoverRow ,
19
19
handleToSelectedRow ,
20
+ TableColumnStyleType ,
20
21
TableStyleType ,
21
22
} from "comps/controls/styleControlConstants" ;
22
23
import { CompNameContext , EditorContext } from "comps/editorState" ;
@@ -292,19 +293,29 @@ const TableTh = styled.th<{ width?: number }>`
292
293
${ ( props ) => props . width && `width: ${ props . width } px` } ;
293
294
` ;
294
295
295
- const TableTd = styled . td < { background : string ; $isEditing : boolean } > `
296
+ const TableTd = styled . td < {
297
+ background : string ;
298
+ columnStyle : TableColumnStyleType ;
299
+ $isEditing : boolean ;
300
+ } > `
296
301
.ant-table-row-expand-icon,
297
302
.ant-table-row-indent {
298
303
display: ${ ( props ) => ( props . $isEditing ? "none" : "initial" ) } ;
299
304
}
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
+ }
306
311
` ;
307
312
313
+ // ${(props) =>
314
+ // props.background &&
315
+ // `
316
+ // background: ${props.background} !important;
317
+ // `};
318
+
308
319
const ResizeableTitle = ( props : any ) => {
309
320
const { onResize, onResizeStop, width, viewModeResizable, ...restProps } = props ;
310
321
const [ widthChild , setWidthChild ] = useState ( 0 ) ;
@@ -365,6 +376,7 @@ type CustomTableProps<RecordType> = Omit<TableProps<RecordType>, "components" |
365
376
columns : CustomColumnType < RecordType > [ ] ;
366
377
viewModeResizable : boolean ;
367
378
rowColor : RowColorViewType ;
379
+ columnStyle : TableColumnStyleType ;
368
380
} ;
369
381
370
382
function TableCellView ( props : {
@@ -373,8 +385,10 @@ function TableCellView(props: {
373
385
rowColor : RowColorViewType ;
374
386
rowIndex : number ;
375
387
children : any ;
388
+ columnStyle : TableColumnStyleType ;
376
389
} ) {
377
- const { record, title, rowIndex, rowColor, children, ...restProps } = props ;
390
+ const { record, title, rowIndex, rowColor, children, columnStyle, ...restProps } = props ;
391
+ console . log ( columnStyle )
378
392
const [ editing , setEditing ] = useState ( false ) ;
379
393
const rowContext = useContext ( TableRowContext ) ;
380
394
let tdView ;
@@ -387,7 +401,7 @@ function TableCellView(props: {
387
401
currentOriginalIndex : record [ OB_ROW_ORI_INDEX ] ,
388
402
columnTitle : title ,
389
403
} ) ;
390
- let background = "" ;
404
+ let { background } = columnStyle ;
391
405
if ( color ) {
392
406
background = genLinerGradient ( color ) ;
393
407
}
@@ -398,7 +412,12 @@ function TableCellView(props: {
398
412
background = genLinerGradient ( handleToHoverRow ( color ) ) + "," + background ;
399
413
}
400
414
tdView = (
401
- < TableTd { ...restProps } background = { background } $isEditing = { editing } >
415
+ < TableTd
416
+ { ...restProps }
417
+ background = { background }
418
+ columnStyle = { columnStyle }
419
+ $isEditing = { editing }
420
+ >
402
421
{ children }
403
422
</ TableTd >
404
423
) ;
@@ -466,6 +485,7 @@ function ResizeableTable<RecordType extends object>(props: CustomTableProps<Reco
466
485
title : col . titleText ,
467
486
rowColor : props . rowColor ,
468
487
rowIndex : rowIndex ,
488
+ columnStyle : props . columnStyle ,
469
489
} ) ,
470
490
onHeaderCell : ( ) => ( {
471
491
width : resizeWidth ,
@@ -533,6 +553,7 @@ export function TableCompView(props: {
533
553
const changeSet = useMemo ( ( ) => compChildren . columns . getChangeSet ( ) , [ compChildren . columns ] ) ;
534
554
const hasChange = useMemo ( ( ) => ! _ . isEmpty ( changeSet ) , [ changeSet ] ) ;
535
555
const columns = useMemo ( ( ) => compChildren . columns . getView ( ) , [ compChildren . columns ] ) ;
556
+ const columnStyle = useMemo ( ( ) => compChildren . columnStyle . getView ( ) , [ compChildren . columnStyle ] ) ;
536
557
const columnViews = useMemo ( ( ) => columns . map ( ( c ) => c . getView ( ) ) , [ columns ] ) ;
537
558
const data = comp . filterData ;
538
559
const sort = useMemo ( ( ) => compChildren . sort . getView ( ) , [ compChildren . sort ] ) ;
@@ -657,6 +678,7 @@ export function TableCompView(props: {
657
678
} }
658
679
showHeader = { ! compChildren . hideHeader . getView ( ) }
659
680
columns = { antdColumns }
681
+ columnStyle = { columnStyle }
660
682
viewModeResizable = { compChildren . viewModeResizable . getView ( ) }
661
683
dataSource = { pageDataInfo . data }
662
684
size = { compChildren . size . getView ( ) }
0 commit comments