hotfix(data-table): column sort direction order should be independent (#1342)

Fixes #1341
This commit is contained in:
metonym 2022-06-09 11:14:14 -07:00 committed by GitHub
commit e56ee83dc4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -344,15 +344,17 @@
id="{header.key}"
style="{formatHeaderWidth(header)}"
sortable="{sortable && header.sort !== false}"
sortDirection="{sortDirection}"
active="{sortKey !== null && sortKey === header.key}"
sortDirection="{sortKey === header.key ? sortDirection : 'none'}"
active="{sortKey === header.key}"
on:click="{() => {
dispatch('click', { header });
if (header.sort === false) {
dispatch('click:header', { header });
} else {
sortDirection = sortDirectionMap[sortDirection];
let currentSortDirection =
sortKey === header.key ? sortDirection : 'none';
sortDirection = sortDirectionMap[currentSortDirection];
sortKey =
sortDirection === 'none' ? null : $thKeys[header.key];
dispatch('click:header', { header, sortDirection });