Fixes #59 and implements more natural sorting for all data-tables by making use of the native Intl.Collator, which has several advantages:
Sorting is based on the users locale conforming to their expectations
Handles accents and cases (e.g. a ≠ b, a = á, a = A) naturally rather than based on ASCII code
Strings containing numbers are sorted in a logical order (device 1, device 3, device 21)
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']).
~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:
a ≠ b, a = á, a = A
) naturally rather than based on ASCII codeAdditionally, 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.