Compute next sort state when clicking a column header.
Logic:
Currently sorted column (or undefined)
Current sort direction
Clicked column key
New sort state
Compute next sort state when clicking a column header.
Logic: