Add default to empty drag-drop list

This commit is contained in:
shamoon
2024-04-21 07:56:41 -07:00
parent 4207463d20
commit 218488eba6
4 changed files with 29 additions and 8 deletions

View File

@@ -364,7 +364,7 @@
</select>
</div>
@if (displayFields) {
<pngx-input-drag-drop-select i18n-title title="Show" [items]="displayFields" formControlName="display_fields"></pngx-input-drag-drop-select>
<pngx-input-drag-drop-select i18n-title title="Show" i18n-emptyText emptyText="Default" [items]="displayFields" formControlName="display_fields"></pngx-input-drag-drop-select>
}
</div>
</div>

View File

@@ -8,6 +8,9 @@
@for (item of selectedItems; track item.id) {
<div class="badge bg-primary" cdkDrag>{{item.name}}</div>
}
@if (selectedItems.length === 0) {
<div class="badge bg-light fst-italic" i18n>{{emptyText}}</div>
}
</div>
</div>
<div class="d-flex flex-row mt-2 align-items-center bg-light p-2">

View File

@@ -25,6 +25,9 @@ export class DragDropSelectComponent extends AbstractInputComponent<string[]> {
@Input() items: { id: string; name: string }[] = []
public selectedItems: { id: string; name: string }[] = []
@Input()
emptyText = $localize`No items selected`
@ViewChild('selectedList') selectedList: CdkDropList
@ViewChild('unselectedList') unselectedList: CdkDropList