44 Component ,
55 ComponentFactoryResolver ,
66 ContentChildren ,
7- EventEmitter ,
7+ EventEmitter , Inject ,
88 Input ,
99 NgZone ,
1010 OnChanges ,
@@ -118,6 +118,8 @@ import { RelationshipOptions } from '../models/relationship-options.model';
118118import { FormBuilderService } from '../form-builder.service' ;
119119import { DYNAMIC_FORM_CONTROL_TYPE_RELATION_GROUP } from './ds-dynamic-form-constants' ;
120120import { FormFieldMetadataValueObject } from '../models/form-field-metadata-value.model' ;
121+ import { APP_CONFIG , AppConfig } from '../../../../../config/app-config.interface' ;
122+ import { itemLinksToFollow } from '../../../utils/relation-query.utils' ;
121123
122124export function dsDynamicFormControlMapFn ( model : DynamicFormControlModel ) : Type < DynamicFormControl > | null {
123125 switch ( model . type ) {
@@ -231,6 +233,11 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo
231233
232234 private showErrorMessagesPreviousStage : boolean ;
233235
236+ /**
237+ * Determines whether to request embedded thumbnail.
238+ */
239+ fetchThumbnail : boolean ;
240+
234241 get componentType ( ) : Type < DynamicFormControl > | null {
235242 return dsDynamicFormControlMapFn ( this . model ) ;
236243 }
@@ -253,9 +260,11 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo
253260 private ref : ChangeDetectorRef ,
254261 private formService : FormService ,
255262 private formBuilderService : FormBuilderService ,
256- private submissionService : SubmissionService
263+ private submissionService : SubmissionService ,
264+ @Inject ( APP_CONFIG ) protected appConfig : AppConfig ,
257265 ) {
258266 super ( ref , componentFactoryResolver , layoutService , validationService , dynamicFormComponentService , relationService ) ;
267+ this . fetchThumbnail = this . appConfig . browseBy . showThumbnails ;
259268 }
260269
261270 /**
@@ -285,7 +294,6 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo
285294 followLink ( 'rightItem' ) ,
286295 followLink ( 'relationshipType' )
287296 ) ;
288-
289297 relationshipsRD$ . pipe (
290298 getFirstSucceededRemoteDataPayload ( ) ,
291299 getPaginatedListPayload ( )
@@ -317,8 +325,10 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo
317325 }
318326
319327 if ( hasValue ( this . value ) && this . value . isVirtual ) {
320- const relationship$ = this . relationshipService . findById ( this . value . virtualValue , true , true , followLink ( 'leftItem' ) , followLink ( 'rightItem' ) , followLink ( 'relationshipType' ) )
321- . pipe (
328+ const relationship$ = this . relationshipService . findById ( this . value . virtualValue ,
329+ true ,
330+ true ,
331+ ... itemLinksToFollow ( this . fetchThumbnail ) ) . pipe (
322332 getAllSucceededRemoteData ( ) ,
323333 getRemoteDataPayload ( ) ) ;
324334 this . relationshipValue$ = observableCombineLatest ( [ this . item$ . pipe ( take ( 1 ) ) , relationship$ ] ) . pipe (
0 commit comments