@@ -177,7 +177,7 @@ export class DsDynamicRelationInlineGroupComponent extends DynamicFormControlCom
177177 }
178178
179179 private initSecurityLevelConfig ( model : DynamicInputModel | any , modelGroup : DynamicFormGroupModel ) {
180- if ( this . model . name === model . name && this . model . securityConfigLevel . length > 1 ) {
180+ if ( this . model . name === model . name && this . model . securityConfigLevel ? .length > 1 ) {
181181 model . securityConfigLevel = this . model . securityConfigLevel ;
182182 model . toggleSecurityVisibility = true ;
183183
@@ -199,7 +199,7 @@ export class DsDynamicRelationInlineGroupComponent extends DynamicFormControlCom
199199 }
200200 } ) ;
201201 }
202- if ( this . model . securityConfigLevel . length === 1 ) {
202+ if ( this . model . securityConfigLevel ? .length === 1 ) {
203203 modelGroup . group . forEach ( ( item : any ) => {
204204 item . securityConfigLevel = this . model . securityConfigLevel ;
205205 item . toggleSecurityVisibility = false ;
@@ -225,14 +225,14 @@ export class DsDynamicRelationInlineGroupComponent extends DynamicFormControlCom
225225 if ( typeof model . value === 'string' ) {
226226 groupValue [ model . name ] = new FormFieldMetadataValueObject ( model . value , null , mainSecurityLevel ) ;
227227 } else {
228- groupValue [ model . name ] = { ... model . value , securityLevel : mainSecurityLevel } ;
228+ groupValue [ model . name ] = Object . assign ( new FormFieldMetadataValueObject ( ) , model . value , { securityLevel : mainSecurityLevel || null } ) ;
229229 }
230230 }
231231 } else {
232232 if ( typeof model . value === 'string' ) {
233233 groupValue [ model . name ] = new FormFieldMetadataValueObject ( model . value , null , mainSecurityLevel ) ;
234234 } else {
235- groupValue [ model . name ] = { ... model . value , securityLevel : mainSecurityLevel } ;
235+ groupValue [ model . name ] = Object . assign ( new FormFieldMetadataValueObject ( ) , model . value , { securityLevel : mainSecurityLevel || null } ) ;
236236 }
237237 }
238238 } ) ;
@@ -276,7 +276,7 @@ export class DsDynamicRelationInlineGroupComponent extends DynamicFormControlCom
276276 }
277277
278278 private updateArrayModelValue ( groupValue , index ) {
279- let parentSecurityLevel = this . model . securityLevel || this . model . securityConfigLevel [ 0 ] ;
279+ let parentSecurityLevel = this . model . securityLevel || this . model . securityConfigLevel ?. length > 0 ? this . model . securityConfigLevel [ 0 ] : null ;
280280 for ( const name of Object . keys ( groupValue ) ) {
281281 if ( name === this . model . name && isNotEmpty ( groupValue [ name ] . securityLevel ) ) {
282282 parentSecurityLevel = groupValue [ name ] . securityLevel ;
@@ -335,7 +335,8 @@ export class DsDynamicRelationInlineGroupComponent extends DynamicFormControlCom
335335
336336 private copyArrayItem ( event ) {
337337 const index = Array . isArray ( this . model . value ) ? this . model . value . length : event . model . parent . index ;
338- const groupValue = this . getRowValue ( event . model as DynamicFormGroupModel , this . model . securityLevel ) ;
338+ const mainRow = event . model . group . find ( itemModel => itemModel . name === this . model . name ) ;
339+ const groupValue = this . getRowValue ( event . model as DynamicFormGroupModel , mainRow . securityLevel ) ;
339340 this . updateArrayModelValue ( groupValue , index ) ;
340341 this . findModelGroups ( ) ;
341342 this . change . emit ( ) ;
0 commit comments