forked from buefy/buefy
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: Table: customSort does not work when sortMultiple is enabled (bu…
…efy#2681) (buefy#3945) * test(lib): add tests around BTable sort - Adds test cases that test sortable columns of BTable. Tests the following functionalities: - Sort single column - Sort multicolumns - Sort single column with custom sort * feat(lib): support multi-column sort with custom sort - `BTable` now uses `customSort` of each column if exists when it sorts multiple columns. Actual sorting is done by `multiColumnSort` function defined in `src/utils/helpers.js`. To support custom sort, `multiColumnSort` changes the format of the second parameter `sortingPriority` which used to accept an array of dot-separated field paths but now accepts an array of objects with the following fields: - `field`: dot-separated field path - `order`: sort direction: - 'asc' | undefined → ascending order - 'desc' → descending order - `customSort`: function to compare two field values for sorting. The same function given to the column definition. Natural ordering is used if omitted. As far as I checked, `multiColumnSort` is only used by `BTable`. Adds test cases that test multi-column sorting with custom sort. - Includes migration to Vue 3, and Vue Test Utils v2: - Applies `toRaw` before testing if two columns, `column` and `currentSortColumn`, are indentical because they are reactive states. See Vue's documentation for more details: - https://vuejs.org/guide/essentials/reactivity-fundamentals.html#reactive-proxy-vs-original - https://vuejs.org/api/reactivity-advanced.html#toraw - Renames `propsData` → `props`
- Loading branch information
Showing
3 changed files
with
320 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters