|
13 | 13 | (ngbEvent)="onCustomEvent($event)"> |
14 | 14 | <ng-template modelType="ARRAY" let-group let-index="index" let-context="context"> |
15 | 15 | <!--Array with repeatable items--> |
16 | | - @if ((!context.notRepeatable) && !isVirtual(context, index) && group.context.groups.length !== 1 && !isItemReadOnly(context, index)) { |
| 16 | + @if ((!context.notRepeatable) && !isVirtual(context, index) && !isItemReadOnly(context, index) && (group.context.groups.length !== 1 || (!context.required && !isArrayGroupEmpty(group)))) { |
17 | 17 | <div |
18 | 18 | class="col-2 d-flex flex-column justify-content-sm-start align-items-end" |
19 | 19 | [class.isInlineGroupForm-delete]="isInlineGroupForm" |
|
43 | 43 | } |
44 | 44 |
|
45 | 45 | <!--Array with non repeatable items - Only discard button--> |
46 | | - @if (context.notRepeatable && context.showButtons && group.context.groups.length > 1) { |
| 46 | + @if (context.notRepeatable && context.showButtons && !isItemReadOnly(context, index) && (group.context.groups.length > 1 || (!context.required && !isArrayGroupEmpty(group)))) { |
47 | 47 | <div |
48 | 48 | class="col-2 d-flex flex-column justify-content-sm-start align-items-end" |
49 | 49 | [class]="arrayButtonsStyle"> |
50 | 50 | <div class="btn-group" role="button"> |
51 | 51 | <button type="button" class="btn btn-secondary" |
52 | 52 | title="{{'form.discard' | translate}}" |
53 | 53 | attr.aria-label="{{'form.discard' | translate}}" |
54 | | - (click)="removeItem($event, context, index)" |
55 | | - [dsBtnDisabled]="group.context.groups.length === 1 || isItemReadOnly(context, index)"> |
| 54 | + (click)="removeItem($event, context, index)"> |
56 | 55 | <span>{{'form.discard' | translate}}</span> |
57 | 56 | </button> |
58 | 57 | </div> |
|
0 commit comments