Skip to content

Commit 98add71

Browse files
Mattia VianelliAndrea Barbasso
authored andcommitted
Merged in task/dspace-cris-2025_02_x/DSC-2905 (pull request DSpace#4826)
DSC-2905 Made the bin icon appear next to non-repeatable/non-required single controlledvocabularyauthority metadata Approved-by: Andrea Barbasso
2 parents 25dea5c + 3ae4125 commit 98add71

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

src/app/shared/form/builder/ds-dynamic-form-ui/models/onebox/dynamic-onebox.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
[readonly]="true"
114114
[disabled]="model.readOnly"
115115
[type]="model.inputType"
116-
[value]="currentValue?.display"
116+
[value]="currentValue?.display ?? ''"
117117
(focus)="onFocus($event)"
118118
(change)="onChange($event)"
119119
(click)="openTree($event)"

src/app/shared/form/form.component.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
(ngbEvent)="onCustomEvent($event)">
1414
<ng-template modelType="ARRAY" let-group let-index="index" let-context="context">
1515
<!--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)))) {
1717
<div
1818
class="col-2 d-flex flex-column justify-content-sm-start align-items-end"
1919
[class.isInlineGroupForm-delete]="isInlineGroupForm"
@@ -43,16 +43,15 @@
4343
}
4444

4545
<!--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)))) {
4747
<div
4848
class="col-2 d-flex flex-column justify-content-sm-start align-items-end"
4949
[class]="arrayButtonsStyle">
5050
<div class="btn-group" role="button">
5151
<button type="button" class="btn btn-secondary"
5252
title="{{'form.discard' | translate}}"
5353
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)">
5655
<span>{{'form.discard' | translate}}</span>
5756
</button>
5857
</div>

0 commit comments

Comments
 (0)