@@ -55,17 +55,19 @@ export class SectionFormOperationsService {
5555 * the [[FormFieldPreviousValueObject]] for the specified operation
5656 * @param hasStoredValue
5757 * representing if field value related to the specified operation has stored value
58+ * @param languageMap
5859 */
5960 public dispatchOperationsFromEvent ( pathCombiner : JsonPatchOperationPathCombiner ,
6061 event : DynamicFormControlEvent ,
6162 previousValue : FormFieldPreviousValueObject ,
62- hasStoredValue : boolean ) : void {
63+ hasStoredValue : boolean ,
64+ languageMap : Map < string , string [ ] > = null ) : void {
6365 switch ( event . type ) {
6466 case 'remove' :
6567 this . dispatchOperationsFromRemoveEvent ( pathCombiner , event , previousValue ) ;
6668 break ;
6769 case 'change' :
68- this . dispatchOperationsFromChangeEvent ( pathCombiner , event , previousValue , hasStoredValue ) ;
70+ this . dispatchOperationsFromChangeEvent ( pathCombiner , event , previousValue , hasStoredValue , languageMap ) ;
6971 break ;
7072 case 'move' :
7173 this . dispatchOperationsFromMoveEvent ( pathCombiner , event , previousValue ) ;
@@ -374,11 +376,13 @@ export class SectionFormOperationsService {
374376 * the [[FormFieldPreviousValueObject]] for the specified operation
375377 * @param hasStoredValue
376378 * representing if field value related to the specified operation has stored value
379+ * @param languageMap
377380 */
378381 protected dispatchOperationsFromChangeEvent ( pathCombiner : JsonPatchOperationPathCombiner ,
379382 event : DynamicFormControlEvent ,
380383 previousValue : FormFieldPreviousValueObject ,
381- hasStoredValue : boolean ) : void {
384+ hasStoredValue : boolean ,
385+ languageMap ?: Map < string , string [ ] > ) : void {
382386 if ( event . context && event . context instanceof DynamicFormArrayGroupModel ) {
383387 // Model is a DynamicRowArrayModel
384388 this . handleArrayGroupPatch ( pathCombiner , event , ( event as any ) . context . context , previousValue ) ;
@@ -396,7 +400,7 @@ export class SectionFormOperationsService {
396400 if ( this . formBuilder . isQualdropGroup ( event . model . parent as DynamicFormControlModel )
397401 || this . formBuilder . isQualdropGroup ( event . model as DynamicFormControlModel ) ) {
398402 // It's a qualdrup model
399- this . dispatchOperationsFromMap ( this . getQualdropValueMap ( event ) , pathCombiner , event , previousValue ) ;
403+ this . dispatchOperationsFromMap ( this . getQualdropValueMap ( event ) , pathCombiner , event , previousValue , languageMap ) ;
400404 } else if ( this . formBuilder . isRelationGroup ( event . model ) ) {
401405 // It's a relation model
402406 this . dispatchOperationsFromMap ( this . getValueMap ( value ) , pathCombiner , event , previousValue ) ;
@@ -465,11 +469,13 @@ export class SectionFormOperationsService {
465469 * the [[DynamicFormControlEvent]] for the specified operation
466470 * @param previousValue
467471 * the [[FormFieldPreviousValueObject]] for the specified operation
472+ * @param languageMap
468473 */
469474 protected dispatchOperationsFromMap ( valueMap : Map < string , any > ,
470475 pathCombiner : JsonPatchOperationPathCombiner ,
471476 event : DynamicFormControlEvent ,
472- previousValue : FormFieldPreviousValueObject ) : void {
477+ previousValue : FormFieldPreviousValueObject ,
478+ languageMap : Map < string , string [ ] > = null ) : void {
473479 const currentValueMap = valueMap ;
474480 if ( event . type === 'remove' ) {
475481 const path = this . getQualdropItemPathFromEvent ( event ) ;
@@ -480,7 +486,8 @@ export class SectionFormOperationsService {
480486 const currentValue = currentValueMap . get ( index ) ;
481487 if ( currentValue ) {
482488 if ( ! isEqual ( entry , currentValue ) ) {
483- this . operationsBuilder . add ( pathCombiner . getPath ( index ) , currentValue , true ) ;
489+ const metadataFromPath = pathCombiner . getPath ( index ) . path . split ( '/' ) . slice ( - 1 ) [ 0 ] ;
490+ this . operationsBuilder . add ( pathCombiner . getPath ( index ) , currentValue , true , false , languageMap ?. get ( metadataFromPath ) ) ;
484491 }
485492 currentValueMap . delete ( index ) ;
486493 } else if ( ! currentValue ) {
@@ -493,7 +500,8 @@ export class SectionFormOperationsService {
493500 // The last item of the group has been deleted so make a remove op
494501 this . operationsBuilder . remove ( pathCombiner . getPath ( index ) ) ;
495502 } else {
496- this . operationsBuilder . add ( pathCombiner . getPath ( index ) , entry , true ) ;
503+ const metadataFromPath = pathCombiner . getPath ( index ) . path . split ( '/' ) . slice ( - 1 ) [ 0 ] ;
504+ this . operationsBuilder . add ( pathCombiner . getPath ( index ) , entry , true , null , languageMap ?. get ( metadataFromPath ) ) ;
497505 }
498506 } ) ;
499507 }
@@ -576,4 +584,5 @@ export class SectionFormOperationsService {
576584 }
577585 }
578586 }
587+
579588}
0 commit comments