Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(BTable): Enable more sorting options to get closer to BSV parity #1771

Merged
merged 7 commits into from
Feb 21, 2024

Conversation

dwgray
Copy link
Contributor

@dwgray dwgray commented Feb 14, 2024

Describe the PR

There were a few issues with table sorting compared to BSV:

  • The sortDesc flag wasn't respected
  • The sortByFormatted field wasn't used
    • And the sortByFormatted field didn't allow passing in a formatter function

I also added tests to cover these cases and updated the type documentation.

Small replication

Any sorted table example will replicate these issues. See the tests in this PR for concrete examples.

PR checklist

What kind of change does this PR introduce? (check at least one)

  • Bugfix 馃悰 - fix(...)
  • Feature - feat(...)
  • ARIA accessibility - fix(...)
  • Documentation update - docs(...)
  • Other (please describe)

The PR fulfills these requirements:

  • Pull request title and all commits follow the Conventional Commits convention or has an override in this pull request body This is very important, as the CHANGELOG is generated from these messages, and determines the next version type. Pull requests that do not follow conventional commits or do not have an override will be denied

Copy link

stackblitz bot commented Feb 14, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

VividLemon
VividLemon previously approved these changes Feb 19, 2024
)
})
return sortDescBoolean.value && props.sortCompare === undefined ? sorted.reverse() : sorted
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this functionality still is working in return ( realVal(a).localeCompare(realVal(b), props.sortCompareLocale, props.sortCompareOptions) * (sortDescBoolean.value ? -1 : 1)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes - we had a case "conflicting" PRs that solved the same problem in ways that didn't actually cause a conflict in the diffs. My unit tests caught this. I left the way that I solved it in, as I think it's slightly cleaner (but I'm not a native JS developer, so if you'd prefer doing the explicit reverse at the end rather than sorting in the correct direction in the first place, I'll swap it out.

@VividLemon VividLemon merged commit cafb4c4 into bootstrap-vue-next:main Feb 21, 2024
3 checks passed
@github-actions github-actions bot mentioned this pull request Feb 21, 2024
@dwgray dwgray mentioned this pull request Mar 1, 2024
6 tasks
@dwgray dwgray deleted the table-sort-fixes branch June 11, 2024 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants