Headless CMS and Content Managment Hub
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

48 lines
1.7 KiB

<div class="array-container" *ngIf="arrayControl.controls.length > 0"
cdkDropList
[cdkDropListDisabled]="false"
[cdkDropListData]="arrayControl.controls"
(cdkDropListDropped)="sort($event)">
<div *ngFor="let itemForm of arrayControl.controls; let i = index;"
class="table-drag item"
cdkDrag
cdkDragLockAxis="y">
<sqx-array-item
[form]="form"
[formContext]="formContext"
[field]="field"
[isDisabled]="arrayControl.disabled"
[isFirst]="i === 0"
[isLast]="i === arrayControl.controls.length - 1"
[index]="i"
[itemForm]="itemForm"
[language]="language"
[languages]="languages"
(clone)="itemAdd(itemForm)"
(move)="move(itemForm, $event)"
(remove)="itemRemove(i)">
<i cdkDragHandle class="icon-drag2"></i>
</sqx-array-item>
</div>
</div>
<div class="row">
<div class="col">
<button type="button" class="btn btn-success" [disabled]="field.nested.length === 0 || arrayControl.disabled" (click)="itemAdd(undefined)">
Add Item
</button>
</div>
<div class="col-auto" *ngIf="arrayControl.controls.length > 0">
<button type="button" class="btn btn-text-secondary" (click)="expandAll()" title="Expand all items">
<i class="icon-plus-square"></i>
</button>
<button type="button" class="btn btn-text-secondary" (click)="collapseAll()" title="Collapse all items">
<i class="icon-minus-square"></i>
</button>
</div>
</div>
<small class="text-muted ml-2" *ngIf="field.nested.length === 0">
Add a nested field first to add items.
</small>