duplicate of this https://seoinfotech.com/change-table-columns-order-using-drag-drop-angular/
but in angular 7.
this is the angular 9 github repo, that this repository matches, except for angular version https://github.com/infotechseo/angular-dragdrop-column
cdk dragDrop draggable columns on mat-table works in angular 9. but not angular 7. the code in this angular 7 repository demonstrates the feature NOT working, where in angular 9 it works.
this stackblitz shows a workaround, which makes every header cell a 'list'. then you can handle movement manually with index. https://stackblitz.com/edit/angular-mat-table-columns-draggable