2026-05-04 20:02:10 +03:30
|
|
|
<div class="h-full overflow-auto">
|
|
|
|
|
<div
|
|
|
|
|
[ngClass]="{
|
|
|
|
|
'px-4': captionBox,
|
|
|
|
|
'pb-4': true,
|
|
|
|
|
}"
|
|
|
|
|
>
|
|
|
|
|
@if (captionBox) {
|
|
|
|
|
<div class="pt-4">
|
|
|
|
|
<ng-container [ngTemplateOutlet]="captionBox"></ng-container>
|
|
|
|
|
</div>
|
|
|
|
|
<hr />
|
|
|
|
|
}
|
|
|
|
|
<div class="grid grid-cols-1 gap-3" [ngClass]="{ 'pt-4': captionBox }">
|
|
|
|
|
@for (item of items; track `gridView_${$index}`) {
|
|
|
|
|
<div class="card border border-surface-border bg-surface-50! mb-0! rounded-2xl p-4!">
|
|
|
|
|
<div class="listKeyValue">
|
|
|
|
|
@for (col of columns; track `gridView_${col.field.toString()}_${$index}`) {
|
|
|
|
|
@if (col.type !== "index") {
|
|
|
|
|
<app-key-value [label]="col.header">
|
|
|
|
|
@if (col.type === "thumbnail") {
|
|
|
|
|
<div
|
|
|
|
|
class="w-20 h-20 rounded-2xl overflow-hidden bg-surface-50 cursor-pointer"
|
|
|
|
|
(click)="openThumbnailModal(item)"
|
|
|
|
|
>
|
|
|
|
|
@if (item && col?.field && item[col!.field!]) {
|
|
|
|
|
<img [src]="item[col.field]" class="w-full h-full object-cover" />
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
} @else if (getTemplate(col)) {
|
|
|
|
|
<ng-container
|
|
|
|
|
[ngTemplateOutlet]="getTemplate(col)"
|
|
|
|
|
[ngTemplateOutletContext]="{ $implicit: item }"
|
|
|
|
|
></ng-container>
|
|
|
|
|
} @else if (col.canCopy) {
|
|
|
|
|
<uikit-copy [text]="getCell(item, col)"></uikit-copy>
|
|
|
|
|
} @else {
|
|
|
|
|
<span [class]="getPreviewClasses(item, col)">
|
|
|
|
|
{{ getCell(item, col) }}
|
|
|
|
|
</span>
|
|
|
|
|
}
|
|
|
|
|
</app-key-value>
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
@if (showEdit || showDelete || showDetails) {
|
|
|
|
|
<hr />
|
|
|
|
|
<div class="flex justify-center gap-2 mt-2">
|
|
|
|
|
@if (showEdit) {
|
2026-05-04 21:30:05 +03:30
|
|
|
<p-button icon="pi pi-pencil" label="ویرایش" size="small" outlined (click)="edit(item)"> </p-button>
|
2026-05-04 20:02:10 +03:30
|
|
|
}
|
|
|
|
|
@if (showDelete) {
|
2026-05-04 21:30:05 +03:30
|
|
|
<p-button icon="pi pi-trash" label="حذف" size="small" outlined (click)="remove(item)"> </p-button>
|
2026-05-04 20:02:10 +03:30
|
|
|
}
|
|
|
|
|
@if (showDetails) {
|
2026-05-04 21:30:05 +03:30
|
|
|
<p-button icon="pi pi-eye" label="مشاهده" size="small" outlined (click)="details(item)"> </p-button>
|
2026-05-04 20:02:10 +03:30
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
@if (loading) {
|
|
|
|
|
@for (i of [1, 2, 3, 4]; track `grid_view_loading${$index}`) {
|
|
|
|
|
<div class="w-full h-40">
|
|
|
|
|
<p-skeleton height="100%"></p-skeleton>
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@if (showPaginator) {
|
|
|
|
|
<ng-container [ngTemplateOutlet]="paginator"> </ng-container>
|
|
|
|
|
}
|
|
|
|
|
@if (items.length === 0 && !loading) {
|
|
|
|
|
<ng-container [ngTemplateOutlet]="emptyMessageCard"></ng-container>
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|