File tree Expand file tree Collapse file tree
src/app/shared/form/builder/ds-dynamic-form-ui/models Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -50,8 +50,9 @@ export abstract class DsDynamicVocabularyComponent extends DynamicFormControlCom
5050
5151 /**
5252 * Retrieves the init form value from model
53+ * @param preserveConfidence if the original model confidence value should be used after retrieving the vocabulary's entry
5354 */
54- getInitValueFromModel ( ) : Observable < FormFieldMetadataValueObject > {
55+ getInitValueFromModel ( preserveConfidence = false ) : Observable < FormFieldMetadataValueObject > {
5556 let initValue$ : Observable < FormFieldMetadataValueObject > ;
5657 if ( isNotEmpty ( this . model . value ) && ( this . model . value instanceof FormFieldMetadataValueObject ) && ! this . model . value . hasAuthorityToGenerate ( ) ) {
5758 let initEntry$ : Observable < VocabularyEntry > ;
@@ -63,7 +64,7 @@ export abstract class DsDynamicVocabularyComponent extends DynamicFormControlCom
6364 initValue$ = initEntry$ . pipe ( map ( ( initEntry : VocabularyEntry ) => {
6465 if ( isNotEmpty ( initEntry ) ) {
6566 // Integrate FormFieldMetadataValueObject with retrieved information
66- return new FormFieldMetadataValueObject (
67+ let formField = new FormFieldMetadataValueObject (
6768 initEntry . value ,
6869 null ,
6970 initEntry . authority ,
@@ -72,6 +73,11 @@ export abstract class DsDynamicVocabularyComponent extends DynamicFormControlCom
7273 null ,
7374 initEntry . otherInformation || null
7475 ) ;
76+ // Preserve the original confidence
77+ if ( preserveConfidence ) {
78+ formField . confidence = ( this . model . value as any ) . confidence ;
79+ }
80+ return formField ;
7581 } else {
7682 return this . model . value as any ;
7783 }
Original file line number Diff line number Diff line change @@ -273,7 +273,7 @@ export class DsDynamicOneboxComponent extends DsDynamicVocabularyComponent imple
273273 let result : string ;
274274 if ( init ) {
275275 this . changeLoadingInitialValueStatus ( true ) ;
276- this . getInitValueFromModel ( )
276+ this . getInitValueFromModel ( true )
277277 . subscribe ( ( formValue : FormFieldMetadataValueObject ) => {
278278 this . changeLoadingInitialValueStatus ( false ) ;
279279 this . currentValue = formValue ;
You can’t perform that action at this time.
0 commit comments