@@ -5,36 +5,46 @@ import has from 'lodash/has'
55import values from 'lodash/values'
66import isEmpty from 'lodash/isEmpty'
77import find from 'lodash/find'
8+ import get from 'lodash/get'
89import compact from 'lodash/compact'
910import MapButton from './MapButton'
1011import { URIToParentParams } from '../../common/utils'
1112import Score from './Score'
1213
13- const MappingDecisionResult = ( { targetConcept, row, rowIndex, mapTypes, allMapTypes, onMap, proposed} ) => {
14+ const MappingDecisionResult = ( { targetConcept, row, rowIndex, mapTypes, allMapTypes, onMap, proposed, columns } ) => {
1415 const parentParams = targetConcept ?. url ? URIToParentParams ( targetConcept . url ) : { }
1516 const hasClass = has ( row , 'Class' ) || has ( row , 'Concept Class' )
1617 const hasDatatype = has ( row , 'Datatype' ) || has ( row , 'datatype' )
1718 const getFieldFromProposed = field => {
1819 return find ( proposed ?. attributes , attr => attr ?. name ?. toLowerCase ( ) ?. includes ( field ) ) ?. value || ''
1920 }
2021
22+ const getValue = field => {
23+ const col = find ( columns , col => col ?. label ?. toLowerCase ( ) == field . toLowerCase ( ) )
24+ let val
25+ if ( col ?. dataKey )
26+ val = row [ col . dataKey ]
27+ if ( ! val )
28+ val = get ( row , field ) || get ( row , field . toLowerCase ( ) )
29+ return val
30+ }
2131
2232 return (
2333 < div className = 'col-xs-12 padding-0' style = { { display : 'flex' , margin : '8px 0' , justifyContent : 'space-between' } } >
2434 < div style = { { maxWidth : '45%' } } >
2535 < Typography component = 'span' sx = { { color : 'rgba(0, 0, 0, 0.6)' , fontSize : '12px' } } > Source Code</ Typography >
2636 < div className = 'col-xs-12 padding-0' >
2737 < ListItemText
28- primary = { row ?. Name || row ?. name || '-' }
38+ primary = { getValue ( ' Name' ) }
2939 secondary = {
3040 < span style = { { fontSize : '12px' } } >
3141 {
3242 hasClass &&
33- < > Class: < i > { row . Class || row [ 'Concept Class'] } </ i > ,</ >
43+ < > Class: < i > { getValue ( 'Property: Class' ) || getValue ( ' Class') || getValue ( 'concept_class' ) } </ i > ,</ >
3444 }
3545 {
3646 hasDatatype &&
37- < > Datatype: < i > { row . Datatype } </ i > </ >
47+ < > Datatype: < i > { getValue ( 'Property: Datatype' ) || getValue ( 'datatype' ) } </ i > </ >
3848 }
3949 </ span >
4050 }
0 commit comments