2026-05-08 18:08:57 +03:30
|
|
|
<div class="h-full overflow-auto border border-surface-border cardShadow">
|
2026-05-04 20:02:10 +03:30
|
|
|
<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}`) {
|
2026-05-08 18:08:57 +03:30
|
|
|
<div class="card border border-surface-border bg-surface-0! mb-0! rounded-2xl p-4!">
|
2026-05-04 20:02:10 +03:30
|
|
|
<div class="listKeyValue">
|
|
|
|
|
@for (col of columns; track `gridView_${col.field.toString()}_${$index}`) {
|
|
|
|
|
@if (col.type !== "index") {
|
2026-05-06 22:01:20 +03:30
|
|
|
<app-key-value [label]="col.header" [variant]="col.variant">
|
2026-05-04 20:02:10 +03:30
|
|
|
@if (col.type === "thumbnail") {
|
|
|
|
|
<div
|
2026-05-08 18:08:57 +03:30
|
|
|
class="w-20 h-20 rounded-2xl overflow-hidden bg-surface-100 cursor-pointer"
|
2026-05-04 20:02:10 +03:30
|
|
|
(click)="openThumbnailModal(item)"
|
|
|
|
|
>
|
|
|
|
|
@if (item && col?.field && item[col!.field!]) {
|
|
|
|
|
<img [src]="item[col.field]" class="w-full h-full object-cover" />
|
|
|
|
|
}
|
|
|
|
|
</div>
|
2026-05-06 22:01:20 +03:30
|
|
|
} @else if (col.variant === "tag") {
|
|
|
|
|
<p-tag [value]="getCell(item, col)" [severity]="col.tagOptions?.severity || 'contrast'"></p-tag>
|
2026-05-04 20:02:10 +03:30
|
|
|
} @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) {
|
2026-05-08 18:08:57 +03:30
|
|
|
<hr class="my-2" />
|
|
|
|
|
<div class="flex justify-center gap-2 mt-4">
|
2026-05-04 20:02:10 +03:30
|
|
|
@if (showEdit) {
|
2026-05-08 18:08:57 +03:30
|
|
|
<p-button
|
|
|
|
|
icon="pi pi-pencil"
|
|
|
|
|
label="ویرایش"
|
|
|
|
|
size="small"
|
|
|
|
|
outlined
|
|
|
|
|
severity="secondary"
|
|
|
|
|
(click)="edit(item)"
|
|
|
|
|
>
|
|
|
|
|
</p-button>
|
2026-05-04 20:02:10 +03:30
|
|
|
}
|
|
|
|
|
@if (showDelete) {
|
2026-05-08 18:08:57 +03:30
|
|
|
<p-button icon="pi pi-trash" label="حذف" size="small" outlined severity="danger" (click)="remove(item)">
|
|
|
|
|
</p-button>
|
2026-05-04 20:02:10 +03:30
|
|
|
}
|
|
|
|
|
@if (showDetails) {
|
2026-05-08 18:08:57 +03:30
|
|
|
<p-button
|
|
|
|
|
icon="pi pi-eye"
|
|
|
|
|
label="مشاهده"
|
|
|
|
|
size="small"
|
|
|
|
|
outlined
|
|
|
|
|
severity="primary"
|
|
|
|
|
(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>
|