]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/eg2/src/app/share/grid/grid-body.component.html
b83c6190448ec264cdc51cae7eb8c6e8816879cb
[Evergreen.git] / Open-ILS / src / eg2 / src / app / share / grid / grid-body.component.html
1 <!-- uses dropdown menu CSS for easy stying, but it's not a dropdown -->
2 <ng-template #contextMenu let-gridContext="gridContext">
3   <eg-grid-toolbar-actions-menu [gridContext]="gridContext">
4   </eg-grid-toolbar-actions-menu>
5 </ng-template>
6
7 <!--
8   tabindex=1 so the grid body can capture keyboard events.
9 -->
10 <div class="eg-grid-body" tabindex="1" (keydown)="onGridKeyDown($event)">
11   <div role="row" class="eg-grid-row eg-grid-body-row {{context.rowClassCallback(row)}}"
12     [ngClass]="{'selected': context.rowSelector.contains(context.getRowIndex(row))}"
13     *ngFor="let row of context.dataSource.getPageOfRows(context.pager); let idx = index">
14
15     <ng-container *ngIf="!context.disableSelect">
16       <div class="eg-grid-cell eg-grid-checkbox-cell eg-grid-cell-skinny">
17         <input type='checkbox' [(ngModel)]="context.rowSelector.indexes[context.getRowIndex(row)]">
18       </div>
19     </ng-container>
20     <div class="eg-grid-cell eg-grid-number-cell eg-grid-cell-skinny">
21       {{context.pager.rowNumber(idx)}}
22     </div>
23     <div *ngIf="context.rowFlairIsEnabled" class="eg-grid-cell eg-grid-flair-cell">
24       <!-- using *ngIf allows us to assign the flair callback to a value,
25             obviating the need for multiple calls of the same function -->
26       <ng-container *ngIf="context.rowFlairCallback(row); let flair">
27         <ng-container *ngIf="flair.icon">
28           <!-- tooltip is disabled when no title is set -->
29           <span class="material-icons"
30             ngbTooltip="{{flair.title || ''}}" triggers="mouseenter:mouseleave">
31             {{flair.icon}}
32           </span>
33         </ng-container>
34       </ng-container>
35     </div>
36     <!-- contextMenu applied to cells instead of rows so the position
37          of the popover is close to the mouse.  As of writing, no way
38          to position the popover at the mouse -->
39     <div role="gridcell" class="eg-grid-cell eg-grid-body-cell"
40       [ngStyle]="{flex:col.flex}"
41       [ngClass]="{'eg-grid-cell-overflow': context.overflowCells}"
42       (dblclick)="onRowDblClick(row)"
43       (click)="onRowClick($event, row, idx)"
44       #rowContextMenu="ngbPopover"
45       popoverTitle="Actions for Selected Rows" i18n-popoverTitle
46       (contextmenu)="onRowContextClick($event, row, rowContextMenu)"
47       [ngbPopover]="contextMenu"
48       placement="bottom"
49       triggers="manual"
50       *ngFor="let col of context.columnSet.displayColumns()">
51
52       <eg-grid-body-cell [context]="context" [row]="row" [column]="col">
53       </eg-grid-body-cell>
54     </div>
55   </div>
56 </div>
57