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.
 
 
 
 
 

43 lines
1.7 KiB

<div class="array-container" *ngIf="formModel.items.length > 0"
cdkDropList
[cdkDropListDisabled]="false"
[cdkDropListData]="formModel.items"
(cdkDropListDropped)="sort($event)">
<div *ngFor="let itemForm of formModel.items; index as i; last as isLast; first as isFirst" class="table-drag item" cdkDrag cdkDragLockAxis="y">
<sqx-array-item
[canUnset]="canUnset"
[form]="form"
[formContext]="formContext"
[formModel]="itemForm"
[index]="i"
[isDisabled]="formModel.form.disabled"
[isFirst]="isFirst"
[isLast]="isLast"
[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 || formModel.form.disabled" (click)="itemAdd(undefined)">
{{ 'contents.arrayAddItem' | sqxTranslate }}
</button>
</div>
<div class="col-auto" *ngIf="formModel.items.length > 0">
<button type="button" class="btn btn-text-secondary" (click)="expandAll()" title="i18n:contents.arrayExpandAll">
<i class="icon-plus-square"></i>
</button>
<button type="button" class="btn btn-text-secondary" (click)="collapseAll()" title="i18n:contents.arrayCollapseAll">
<i class="icon-minus-square"></i>
</button>
</div>
</div>
<small class="text-muted ml-2" *ngIf="field.nested.length === 0">
{{ 'contents.arrayNoFields' | sqxTranslate }}
</small>