@@ -3,6 +3,7 @@ import * as React from 'react';
33import { render } from 'react-dom' ;
44import { IGridColumn } from '../Generic/Hooks/useColumns' ;
55import { ISetupSchemaValue } from '../Utils/interfaces' ;
6+ import { ColorfulCellItem } from './ColorfulCellItem' ;
67
78export interface IColorfulCellProps {
89 item : any ;
@@ -14,37 +15,35 @@ export interface IColorfulCellProps {
1415}
1516
1617export const ColorfulCell = function ColorfulCell ( { item, column, metadataOptions, displayTextType, displayIconType, defaultIcon} : IColorfulCellProps ) : JSX . Element {
17- const currentOptionSetValue = item . raw . getValue ( column . original . name ) as number ;
18- let color = metadataOptions ?. get ( currentOptionSetValue ?. toString ( ) ?? "" ) ?. color ?? "gray" ;
19- if ( color === "white" ) {
20- color = "gray"
18+
19+ if ( item . raw . getValue ( column . original . name ) == null ) {
20+ return < div > </ div > ;
2121 }
22- const icon = metadataOptions ?. get ( currentOptionSetValue ?. toString ( ) ?? "" ) ?. icon ?? defaultIcon ;
23- const iconColor = displayTextType === "BOX" ? "white" : color ;
24- const renderIcon = displayIconType !== "NONE" ? < Icon className = "colorIcon" style = { { color : iconColor , marginRight : "5px" } } iconName = { icon } aria-hidden = "true" /> : "" ;
25- const style = {
26- "BORDER" : {
27- borderWidth : "1px" ,
28- borderStyle : "solid" ,
29- borderColor : color ,
30- color : color ,
31- borderRadius : "5px"
32- } ,
33- "BOX" : {
34- backgroundColor : color === "white" ? "gray" : color , color : iconColor , borderRadius : "5px"
35- } ,
36- "SIMPLE" : {
37- } ,
38- "NOTEXT" : {
39- cursor : "pointer"
40- }
41- } [ displayTextType ] ;
42- const content = item [ column . original . name ] ;
43- const renderText = displayTextType !== "NOTEXT" ? < span className = "cell" > { content } </ span > : ""
44- return ( < div className = "ColorfulCell" style = { style } title = { content } >
45- { renderIcon }
46- { renderText }
47- </ div > ) ;
22+ if ( column . original . dataType === "MultiSelectOptionSet" || column . original . dataType === "MultiSelectPicklist" ) {
23+ const currentValues = ( item . raw . getValue ( column . original . name ) as string ?? "" ) . split ( "," ) ;
24+ const currentDisplayNames = ( item . raw . getFormattedValue ( column . original . name ) as string ?? "" ) . split ( ";" ) ;
25+ return ( < div className = "ColorfulCell_MultiSelectOptionSet" >
26+ { currentValues . map ( ( currentValue , index ) => {
27+ return ( < ColorfulCellItem className = 'ColorfulCellItem'
28+ currentValue = { parseInt ( currentValue ) }
29+ currentDisplayName = { currentDisplayNames [ index ] ?? "" }
30+ defaultIcon = { defaultIcon }
31+ displayIconType = { displayIconType }
32+ displayTextType = { displayTextType }
33+ metadataOptions = { metadataOptions }
34+ /> )
35+ } ) }
36+ </ div > )
37+ }
38+ const currentOptionSetValue = item . raw . getValue ( column . original . name ) as number ;
39+ return ( < ColorfulCellItem className = 'ColorfulCell'
40+ currentValue = { currentOptionSetValue }
41+ currentDisplayName = { item [ column . original . name ] }
42+ defaultIcon = { defaultIcon }
43+ displayIconType = { displayIconType }
44+ displayTextType = { displayTextType }
45+ metadataOptions = { metadataOptions }
46+ /> ) ;
4847
4948
5049} ;
0 commit comments