]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/eg2/src/app/share/grid/grid-body.component.html
LP1803787: Add keyboard support (Shift+F10)
[working/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           #rowContextMenu="ngbPopover"
19           popoverTitle="Actions for Selected Rows" i18n-popoverTitle
20           (contextmenu)="onRowContextClick($event, row, rowContextMenu)"
21           [ngbPopover]="contextMenu"
22           placement="right"
23           triggers="manual">
24       </div>
25     </ng-container>
26     <div class="eg-grid-cell eg-grid-number-cell eg-grid-cell-skinny">
27       {{context.pager.rowNumber(idx)}}
28     </div>
29     <div *ngIf="context.rowFlairIsEnabled" class="eg-grid-cell eg-grid-flair-cell">
30       <!-- using *ngIf allows us to assign the flair callback to a value,
31             obviating the need for multiple calls of the same function -->
32       <ng-container *ngIf="context.rowFlairCallback(row); let flair">
33         <ng-container *ngIf="flair.icon">
34           <!-- tooltip is disabled when no title is set -->
35           <span class="material-icons"
36             ngbTooltip="{{flair.title || ''}}" triggers="mouseenter:mouseleave">
37             {{flair.icon}}
38           </span>
39         </ng-container>
40       </ng-container>
41     </div>
42     <!-- contextMenu applied to cells instead of rows so the position
43          of the popover is close to the mouse.  As of writing, no way
44          to position the popover at the mouse -->
45     <div role="gridcell" class="eg-grid-cell eg-grid-body-cell"
46       [ngStyle]="{flex:col.flex}"
47       [ngClass]="{'eg-grid-cell-overflow': context.overflowCells}"
48       (dblclick)="onRowDblClick(row)"
49       (click)="onRowClick($event, row, idx)"
50       #rowContextMenu="ngbPopover"
51       popoverTitle="Actions for Selected Rows" i18n-popoverTitle
52       (contextmenu)="onRowContextClick($event, row, rowContextMenu)"
53       [ngbPopover]="contextMenu"
54       placement="bottom"
55       triggers="manual"
56       *ngFor="let col of context.columnSet.displayColumns()">
57
58       <eg-grid-body-cell [context]="context" [row]="row" [column]="col">
59       </eg-grid-body-cell>
60     </div>
61   </div>
62 </div>
63