[CST-4506] Fix item access condition remove operation

This commit is contained in:
Giuseppe Digilio
2022-01-28 11:09:48 +01:00
parent 232baf5973
commit 6c720b8031
2 changed files with 13 additions and 1 deletions

View File

@@ -3,4 +3,5 @@
[formModel]="formModel"
[displaySubmit]="false"
[displayCancel]="false"
(dfChange)="onChange($event)"></ds-form>
(dfChange)="onChange($event)"
(removeArrayItem)="onRemove($event)"></ds-form>

View File

@@ -222,6 +222,17 @@ export class SubmissionSectionAccessesComponent extends SectionModelComponent {
}
}
/**
* Method called when a form removeArrayItem event is fired.
* Dispatch remove form operations based on changes.
*/
onRemove(event: DynamicFormControlEvent) {
const fieldIndex = this.formOperationsService.getArrayIndexFromEvent(event);
const fieldPath = 'accessConditions/' + fieldIndex;
this.operationsBuilder.remove(this.pathCombiner.getPath(fieldPath));
}
/**
* Unsubscribe from all subscriptions
*/