11import { useMemo } from 'react' ;
22
33import { Grid2 } from '@mui/material' ;
4- import PropTypes from 'prop-types' ;
54
65import { SELECTION_MODE , generateColumns , getDataRelationshipContextFromKey } from './utils' ;
76import { getComponentFromMap } from '../../../bridge/helpers/sdk_component_map' ;
7+ import type { PConnFieldProps } from 'packages/react-sdk-components/src/types/PConnProps' ;
8+
9+ interface ObjectReferenceProps extends Omit < PConnFieldProps , 'value' > {
10+ // If any, enter additional props that only exist on ObjectReference here
11+ getPConnect : any ;
12+ displayMode ;
13+ allowAndPersistChangesInReviewMode : any ;
14+ targetObjectType : any ;
15+ mode : string ;
16+ parameters : Object ;
17+ hideLabel : boolean ;
18+ inline : boolean ;
19+ showPromotedFilters : boolean ;
20+ additionalFields : any ;
21+ }
822
9- export default function ObjectReference ( props ) {
23+ export default function ObjectReference ( props : ObjectReferenceProps ) {
1024 const {
1125 getPConnect,
12- label,
1326 displayMode,
1427 allowAndPersistChangesInReviewMode : editableInReview = false ,
1528 targetObjectType,
@@ -30,7 +43,7 @@ export default function ObjectReference(props) {
3043 const refFieldMetadata = pConn . getFieldMetadata ( rawViewMetadata ?. config ?. value ?. split ( '.' , 2 ) [ 1 ] ) ;
3144
3245 // Destructured properties
33- const propsToUse = { label , ...pConn . getInheritedProps ( ) , ...props } ;
46+ const propsToUse = { ...pConn . getInheritedProps ( ) , ...props } ;
3447
3548 // Computed variables
3649 const isDisplayModeEnabled = displayMode === 'DISPLAY_ONLY' ;
@@ -131,7 +144,6 @@ export default function ObjectReference(props) {
131144 } ) ;
132145 }
133146 if ( isDisplayModeEnabled && ! canBeChangedInReviewMode ) {
134- // code coverage
135147 return (
136148 < SingleReferenceReadonly
137149 config = { {
@@ -221,26 +233,3 @@ export default function ObjectReference(props) {
221233 </ Grid2 >
222234 ) ;
223235}
224-
225- ObjectReference . propTypes = {
226- getPConnect : PropTypes . func . isRequired ,
227- label : PropTypes . string ,
228- displayMode : PropTypes . string ,
229- allowAndPersistChangesInReviewMode : PropTypes . bool ,
230- mode : PropTypes . string ,
231- parameters : PropTypes . arrayOf (
232- PropTypes . shape ( {
233- key : PropTypes . string ,
234- value : PropTypes . string
235- } )
236- ) ,
237- hideLabel : PropTypes . bool ,
238- additionalFields : PropTypes . arrayOf (
239- PropTypes . shape ( {
240- source : PropTypes . string ,
241- target : PropTypes . string
242- } )
243- ) ,
244- inline : PropTypes . bool ,
245- showPromotedFilters : PropTypes . bool
246- } ;
0 commit comments