FlowFuse / forge-ui-components

Set of FlowForge-themed VueJS components that can be used in any FlowForge web applications.
Apache License 2.0
3 stars 1 forks source link

Natural sorting of data-tables #80

Closed Pezmc closed 1 year ago

Pezmc commented 1 year ago

~Warning: Merge target is https://github.com/flowforge/forge-ui-components/pull/79 which should be merged first. Alternatively, the unit tests can be removed from this PR.~

Fixes #59 and implements more natural sorting for all data-tables by making use of the native Intl.Collator, which has several advantages:

Additionally, this PR adds a special case that groups booleans when sorting. Booleans render in the UI as a checkmark, and this looks out of place when treating the boolean as a string and ordering alphabetically (since you'd end up with ['apple', ✓, 'zebra']).

See the unit tests for how this looks in practice

This might be easier to review commit by commit.