|
101 | 101 | }" |
102 | 102 | > |
103 | 103 | <thead> |
104 | | - <tr [ngClass]="{ 'no-hover': hideSelectAll }" [class.po-table-header]="!height"> |
| 104 | + <tr |
| 105 | + [ngClass]="{ 'no-hover': hideSelectAll, 'po-table-column-drag': this.isDraggable }" |
| 106 | + [class.po-table-header]="!height" |
| 107 | + cdkDropList |
| 108 | + cdkDropListOrientation="horizontal" |
| 109 | + (cdkDropListDropped)="drop($event)" |
| 110 | + > |
105 | 111 | <th |
106 | 112 | *ngIf="hasSelectableColumn" |
107 | 113 | [style.pointer-events]="hideSelectAll ? 'none' : 'auto'" |
|
134 | 140 | <ng-container *ngIf="height; then noColumnsWithHeight; else noColumnsWithoutHeight"> </ng-container> |
135 | 141 | </th> |
136 | 142 |
|
137 | | - <th |
138 | | - *ngFor="let column of mainColumns; let i = index; trackBy: trackBy" |
139 | | - class="po-table-header-ellipsis" |
140 | | - [style.width]="column.width" |
141 | | - [style.max-width]="column.width" |
142 | | - [style.min-width]="column.width" |
143 | | - [attr.data-po-table-column-name]="column.label || (column.property | titlecase) | lowercase" |
144 | | - [class.po-clickable]="(sort && column.sortable !== false) || hasService" |
145 | | - [ngClass]="{ |
146 | | - 'po-table-header-sorted': |
147 | | - sort && |
148 | | - JSON.stringify(sortedColumn?.property) === JSON.stringify(column) && |
149 | | - (sortedColumn.ascending || !sortedColumn.ascending) |
150 | | - }" |
151 | | - [class.po-table-header-subtitle]="column.type === 'subtitle'" |
152 | | - (click)="sortColumn(column)" |
153 | | - > |
154 | | - <div |
155 | | - class="po-table-header-flex" |
156 | | - [class.po-table-header-fixed-inner]="height" |
157 | | - [class.po-table-header-flex-right]="column.type === 'currency' || column.type === 'number'" |
158 | | - [class.po-table-header-flex-center]="column.type === 'subtitle'" |
| 143 | + <ng-container *ngIf="this.isDraggable; then tableDefaultThDragDrop; else tableDefaultThDefault"> </ng-container> |
| 144 | + <ng-template #tableDefaultThDragDrop> |
| 145 | + <th |
| 146 | + *ngFor="let column of mainColumns; let i = index; trackBy: trackBy" |
| 147 | + class="po-table-header-ellipsis" |
| 148 | + [style.width]="column.width" |
| 149 | + [style.max-width]="column.width" |
| 150 | + [style.min-width]="column.width" |
| 151 | + [attr.data-po-table-column-name]="column.label || (column.property | titlecase) | lowercase" |
| 152 | + [class.po-clickable]="(sort && column.sortable !== false) || hasService" |
| 153 | + [ngClass]="{ |
| 154 | + 'po-table-header-sorted': |
| 155 | + sort && |
| 156 | + JSON.stringify(sortedColumn?.property) === JSON.stringify(column) && |
| 157 | + (sortedColumn.ascending || !sortedColumn.ascending) |
| 158 | + }" |
| 159 | + [class.po-table-header-subtitle]="column.type === 'subtitle'" |
| 160 | + [class.po-table-column-drag-box]="this.isDraggable" |
| 161 | + (click)="sortColumn(column)" |
| 162 | + cdkDrag |
| 163 | + cdkDragLockAxis="x" |
159 | 164 | > |
160 | | - <ng-container *ngTemplateOutlet="contentHeaderTemplate; context: { $implicit: column }"> </ng-container> |
161 | | - </div> |
162 | | - </th> |
| 165 | + <div |
| 166 | + class="po-table-header-flex" |
| 167 | + [class.po-table-header-fixed-inner]="height" |
| 168 | + [class.po-table-header-flex-right]="column.type === 'currency' || column.type === 'number'" |
| 169 | + [class.po-table-header-flex-center]="column.type === 'subtitle'" |
| 170 | + > |
| 171 | + <ng-container *ngIf="this.isDraggable"> |
| 172 | + <svg |
| 173 | + cdkDragHandle |
| 174 | + width="24" |
| 175 | + height="24" |
| 176 | + viewBox="0 0 24 24" |
| 177 | + fill="none" |
| 178 | + xmlns="http://www.w3.org/2000/svg" |
| 179 | + > |
| 180 | + <circle cx="9" cy="6" r="2" fill="black" /> |
| 181 | + <circle cx="15" cy="6" r="2" fill="black" /> |
| 182 | + <circle cx="9" cy="12" r="2" fill="black" /> |
| 183 | + <circle cx="15" cy="12" r="2" fill="black" /> |
| 184 | + <circle cx="9" cy="18" r="2" fill="black" /> |
| 185 | + <circle cx="15" cy="18" r="2" fill="black" /> |
| 186 | + </svg> |
| 187 | + </ng-container> |
| 188 | + <ng-container *ngTemplateOutlet="contentHeaderTemplate; context: { $implicit: column }"> </ng-container> |
| 189 | + </div> |
| 190 | + </th> |
| 191 | + </ng-template> |
| 192 | + <ng-template #tableDefaultThDefault> |
| 193 | + <th |
| 194 | + *ngFor="let column of mainColumns; let i = index; trackBy: trackBy" |
| 195 | + class="po-table-header-ellipsis" |
| 196 | + [style.width]="column.width" |
| 197 | + [style.max-width]="column.width" |
| 198 | + [style.min-width]="column.width" |
| 199 | + [attr.data-po-table-column-name]="column.label || (column.property | titlecase) | lowercase" |
| 200 | + [class.po-clickable]="(sort && column.sortable !== false) || hasService" |
| 201 | + [ngClass]="{ |
| 202 | + 'po-table-header-sorted': |
| 203 | + sort && |
| 204 | + JSON.stringify(sortedColumn?.property) === JSON.stringify(column) && |
| 205 | + (sortedColumn.ascending || !sortedColumn.ascending) |
| 206 | + }" |
| 207 | + [class.po-table-header-subtitle]="column.type === 'subtitle'" |
| 208 | + (click)="sortColumn(column)" |
| 209 | + > |
| 210 | + <div |
| 211 | + class="po-table-header-flex" |
| 212 | + [class.po-table-header-fixed-inner]="height" |
| 213 | + [class.po-table-header-flex-right]="column.type === 'currency' || column.type === 'number'" |
| 214 | + [class.po-table-header-flex-center]="column.type === 'subtitle'" |
| 215 | + > |
| 216 | + <ng-container *ngTemplateOutlet="contentHeaderTemplate; context: { $implicit: column }"> </ng-container> |
| 217 | + </div> |
| 218 | + </th> |
| 219 | + </ng-template> |
163 | 220 |
|
164 | 221 | <th |
165 | 222 | *ngIf="hasRowTemplateWithArrowDirectionRight && (hasVisibleActions || hideColumnsManager)" |
|
373 | 430 | [ngStyle]="{ 'table-layout': !hasItems ? 'fixed' : 'auto' }" |
374 | 431 | > |
375 | 432 | <thead class="po-table-header-sticky" [style.top]="inverseOfTranslation"> |
376 | | - <tr [class.po-table-header]="!height"> |
| 433 | + <tr |
| 434 | + [class.po-table-header]="!height" |
| 435 | + cdkDropList |
| 436 | + cdkDropListOrientation="horizontal" |
| 437 | + (cdkDropListDropped)="drop($event)" |
| 438 | + > |
377 | 439 | <th |
378 | 440 | *ngIf="hasSelectableColumn" |
379 | 441 | [style.pointer-events]="hideSelectAll ? 'none' : 'auto'" |
|
406 | 468 | <ng-container *ngIf="height; then noColumnsWithHeight; else noColumnsWithoutHeight"> </ng-container> |
407 | 469 | </th> |
408 | 470 |
|
409 | | - <th |
410 | | - *ngFor="let column of mainColumns; let i = index; trackBy: trackBy" |
411 | | - class="po-table-header-ellipsis" |
412 | | - [style.width]="column.width" |
413 | | - [style.max-width]="column.width" |
414 | | - [style.min-width]="column.width" |
415 | | - [attr.data-po-table-column-name]="column.label || (column.property | titlecase) | lowercase" |
416 | | - [class.po-clickable]="(sort && column.sortable !== false) || hasService" |
417 | | - [ngClass]="{ |
418 | | - 'po-table-header-sorted': |
419 | | - sort && |
420 | | - JSON.stringify(sortedColumn?.property) === JSON.stringify(column) && |
421 | | - (sortedColumn.ascending || !sortedColumn.ascending) |
422 | | - }" |
423 | | - [ngStyle]="{ 'width': !hasItems ? '100%' : 'auto' }" |
424 | | - [class.po-table-header-subtitle]="column.type === 'subtitle'" |
425 | | - (click)="sortColumn(column)" |
426 | | - > |
427 | | - <div |
428 | | - class="po-table-header-flex" |
429 | | - [class.po-table-header-fixed-inner]="height" |
430 | | - [class.po-table-header-flex-right]="column.type === 'currency' || column.type === 'number'" |
431 | | - [class.po-table-header-flex-center]="column.type === 'subtitle'" |
| 471 | + <ng-container *ngIf="this.isDraggable; then tableVirtualScrollThDragDrop; else tableVirtualScrollThDefault"> |
| 472 | + </ng-container> |
| 473 | + <ng-template #tableVirtualScrollThDragDrop> |
| 474 | + <th |
| 475 | + *ngFor="let column of mainColumns; let i = index; trackBy: trackBy" |
| 476 | + class="po-table-header-ellipsis" |
| 477 | + [style.width]="column.width" |
| 478 | + [style.max-width]="column.width" |
| 479 | + [style.min-width]="column.width" |
| 480 | + [attr.data-po-table-column-name]="column.label || (column.property | titlecase) | lowercase" |
| 481 | + [class.po-clickable]="(sort && column.sortable !== false) || hasService" |
| 482 | + [ngClass]="{ |
| 483 | + 'po-table-header-sorted': |
| 484 | + sort && |
| 485 | + JSON.stringify(sortedColumn?.property) === JSON.stringify(column) && |
| 486 | + (sortedColumn.ascending || !sortedColumn.ascending) |
| 487 | + }" |
| 488 | + [ngStyle]="{ 'width': !hasItems ? '100%' : 'auto' }" |
| 489 | + [class.po-table-header-subtitle]="column.type === 'subtitle'" |
| 490 | + [class.po-table-column-drag-box]="this.isDraggable" |
| 491 | + (click)="sortColumn(column)" |
| 492 | + cdkDrag |
| 493 | + cdkDragLockAxis="x" |
432 | 494 | > |
433 | | - <ng-container *ngTemplateOutlet="contentHeaderTemplate; context: { $implicit: column }"> </ng-container> |
434 | | - </div> |
435 | | - </th> |
| 495 | + <div |
| 496 | + class="po-table-header-flex" |
| 497 | + [class.po-table-header-fixed-inner]="height" |
| 498 | + [class.po-table-header-flex-right]="column.type === 'currency' || column.type === 'number'" |
| 499 | + [class.po-table-header-flex-center]="column.type === 'subtitle'" |
| 500 | + > |
| 501 | + <ng-container *ngIf="this.isDraggable"> |
| 502 | + <svg |
| 503 | + cdkDragHandle |
| 504 | + width="24" |
| 505 | + height="24" |
| 506 | + viewBox="0 0 24 24" |
| 507 | + fill="none" |
| 508 | + xmlns="http://www.w3.org/2000/svg" |
| 509 | + > |
| 510 | + <circle cx="9" cy="6" r="2" fill="black" /> |
| 511 | + <circle cx="15" cy="6" r="2" fill="black" /> |
| 512 | + <circle cx="9" cy="12" r="2" fill="black" /> |
| 513 | + <circle cx="15" cy="12" r="2" fill="black" /> |
| 514 | + <circle cx="9" cy="18" r="2" fill="black" /> |
| 515 | + <circle cx="15" cy="18" r="2" fill="black" /> |
| 516 | + </svg> |
| 517 | + </ng-container> |
| 518 | + |
| 519 | + <ng-container *ngTemplateOutlet="contentHeaderTemplate; context: { $implicit: column }"> </ng-container> |
| 520 | + </div> |
| 521 | + </th> |
| 522 | + </ng-template> |
| 523 | + <ng-template #tableVirtualScrollThDefault> |
| 524 | + <th |
| 525 | + *ngFor="let column of mainColumns; let i = index; trackBy: trackBy" |
| 526 | + class="po-table-header-ellipsis" |
| 527 | + [style.width]="column.width" |
| 528 | + [style.max-width]="column.width" |
| 529 | + [style.min-width]="column.width" |
| 530 | + [attr.data-po-table-column-name]="column.label || (column.property | titlecase) | lowercase" |
| 531 | + [class.po-clickable]="(sort && column.sortable !== false) || hasService" |
| 532 | + [ngClass]="{ |
| 533 | + 'po-table-header-sorted': |
| 534 | + sort && |
| 535 | + JSON.stringify(sortedColumn?.property) === JSON.stringify(column) && |
| 536 | + (sortedColumn.ascending || !sortedColumn.ascending) |
| 537 | + }" |
| 538 | + [ngStyle]="{ 'width': !hasItems ? '100%' : 'auto' }" |
| 539 | + [class.po-table-header-subtitle]="column.type === 'subtitle'" |
| 540 | + (click)="sortColumn(column)" |
| 541 | + > |
| 542 | + <div |
| 543 | + class="po-table-header-flex" |
| 544 | + [class.po-table-header-fixed-inner]="height" |
| 545 | + [class.po-table-header-flex-right]="column.type === 'currency' || column.type === 'number'" |
| 546 | + [class.po-table-header-flex-center]="column.type === 'subtitle'" |
| 547 | + > |
| 548 | + <ng-container *ngTemplateOutlet="contentHeaderTemplate; context: { $implicit: column }"> </ng-container> |
| 549 | + </div> |
| 550 | + </th> |
| 551 | + </ng-template> |
436 | 552 |
|
437 | 553 | <th |
438 | 554 | *ngIf="hasRowTemplateWithArrowDirectionRight && (hasVisibleActions || hideColumnsManager)" |
|
0 commit comments