Skip to content

Commit

Permalink
ACS-6323 Allow to dragging column over columns in index range
Browse files Browse the repository at this point in the history
  • Loading branch information
AleksanderSklorz committed Dec 8, 2023
1 parent 7b78a88 commit 8e7441a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<adf-datatable-row
cdkDropList
cdkDropListOrientation="horizontal"
[cdkDropListSortPredicate]="sortPredicate"
data-automation-id="datatable-row-header"
[disabled]="!isHeaderVisible()"
class="adf-datatable-row"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ import { ObjectDataTableAdapter } from '../../data/object-datatable-adapter';
import { DataCellEvent } from '../data-cell.event';
import { DataRowActionEvent } from '../data-row-action.event';
import { buffer, debounceTime, filter, map, share } from 'rxjs/operators';
import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop';
import { CdkDrag, CdkDragDrop, CdkDropList, moveItemInArray } from '@angular/cdk/drag-drop';
import { MatIconRegistry } from '@angular/material/icon';
import { DomSanitizer } from '@angular/platform-browser';
import { ResizeEvent } from '../../directives/resizable/types';
Expand Down Expand Up @@ -975,6 +975,10 @@ export class DataTableComponent implements OnInit, AfterContentInit, OnChanges,
return `0 1 ${width < DataTableComponent.MINIMUM_COLUMN_SIZE ? DataTableComponent.MINIMUM_COLUMN_SIZE : width}px`;
}

sortPredicate(index: number, _drag: CdkDrag, drop: CdkDropList): boolean {
return index > 0 && index < drop.getSortedItems().length;
}

private updateColumnsWidths(): void {
const allColumns = this.data.getColumns();

Expand Down

0 comments on commit 8e7441a

Please sign in to comment.