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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(BTable)!: add multisort capabilities #1840
Conversation
feat(BDropdown): add teleportDisabled prop feat(BPopover)!: replace "container" prop with "teleportTo" feat(BPopover): add teleportDisabled prop feat: export component prop types refactor: use defineModel > useVModel fixes bootstrap-vue-next#1799 fix(generics): use generic constraints for BTable & BTableLite refactor: move all props into ComponentProps.ts -> export types & for future global options overhaul
chore: remove deprecated vscode extension recommendation
feat(BTable): allow Numberish values => string is interpreted as is with maxHeight, numbers are converted to ${number}px maxHeight refactor(BTable): move tableAttrs to a computed for shared props
…ue-next chore: update packages chore: update vue-tsc feat(BTable): add prop nosortreset feat(BTable)!: add multisort capabilities feat(BTable)!: remove sortCompare prop, use type BTableSortBy.comparer prop feat(BTable): add multisort prop feat(BTableLite): display arrays of primitives -- number[], string[], etc feat(BTable): display arrays of arrays feat(BTable): WIP allow displaying sortAsc/sortDesc with function syntax `sortAsc(key)` to modify specific columns feat(BTable): WIP allow displaying sortDefault to specify a default state
fix(BTable): fix handleFieldSorting algorithm to properly handle multisort with mustSort
…`sortAsc(fieldKey)` to specify the sort content for that specific field
…e user defined comparer functions
Run & review this pull request in StackBlitz Codeflow. |
packages/bootstrap-vue-next/src/components/BTable/table-simple.spec.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is puzzling. I would have expected the tests that check for input
and change
events to start failing with #1825, which is when I removed the events from the code under test. But instead, all of the tests that are checking for emit
are failing now. My first thought was that this was related to the useVmodel/defineModel changes that I noted in the [commit description(https://github.com//pull/1840#issue-2236507641). But there is something else going on specifically with the checkbox event tests.
I did just the package updates from this PR in a separate branch and the only tests that fail are the checkbox tests (and they fail in the same way).
I checked the changelogs for the three most likely suspects (vue-test-utils, vue, and vitest) and didn't see anything suspicious.
Releases · vuejs/test-utils (github.com)
core/CHANGELOG.md at main · vuejs/core (github.com)
Release v1.4.0 · vitest-dev/vitest (github.com)
Then I tried rolling them back explicitly and am still seeing the errors. I may be misunderstanding how to roll back packages - what I did was changed the version to the exact version we were previously using (without the '^') did a pnpm-install
and then checked the pnpm-lock
file to validate that it was showing the rolled back versions.
I logged the results of wrapper.emit() before and after the package updates on one test it('custom value checked checkbox emits change event when clicked', async () => {
.
Before (and working):
{
input: [ [ [Event] ] ],
'update:indeterminate': [ [ false ] ],
change: [ [ [Event] ] ],
click: [ [ [MouseEvent] ] ],
'update:modelValue': [ [ 'unchecked' ] ]
}
After (and failing):
{ click: [ [ [MouseEvent] ] ] }
In any case, I can fix these specific tests, by testing the model value after the click rather than the emit, but I'm worried that this is reflecting a deeper problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some failing tests appear to be the result of https://github.com/search?q=repo%3Abootstrap-vue-next%2Fbootstrap-vue-next%20%3Ato%3D%22container&type=code being changed to whatever they are now.
At the moment, I'm unsure about some of the others.
Although, it appears that some other issues may be something to do with
Under the circumstance where the wrapper component (rendercomponentorskip) is NOT skipped, it will create a wrapper div. Which means the native input and change events wont bubble up. If it is skipped, they will bubble up. However, we somewhat want these native events to bubble. I assume someone somewhere could use the Event
.
Custom components like BFormRadioGroup don't declare these, because there isn't really a purpose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related: capricorn86/happy-dom#1409
Closing -- commits pulled into #1842 |
Describe the PR
This is an update to #1835 with some progress.
BLink
that I think might be a more fundamental problem. But I don't use BLinks in the router scenario, so don't have enough of a sense of what's going on to understand the intent.defineModel
works that is breaking the tests and causing other issues.On the
defineModel
issue, it looks like the model isn't getting defined as expected. I believe this may be the same issue that I saw in #1822 - According to the vue docs:In dev mode I'm seeing errors like this:
[Vue warn]: Invalid prop: type check failed for prop "modelValue". Expected Boolean, got Array
for things like BFormCheckboxAnd if I move the type declaration of
BFormCheckboxProps
intoBFormCheckboxVue
I get an error on the when usingdefineModel
- `Duplicate key 'modelValue'. May cause name collision in script or template tag.I've actually tried reverting back to
useVModel
and the tests still fail. Also trie reverting the versions of dependencies inpackage.json
I must be misunderstanding something about how the system builds/works because I would expect the combination of those two actions to get back to passing tests.On multisort, there were a couple of bugs in the existing implementation, and I'm not 100% certain that I kept the spirit of what @VividLemon intended. But I documented what I implemented, so hopefully, it's close enough and should be more obvious what the intent is if you want to move in a different direction.
The one thing I didn't do that I think might be worthwhile is to allow
sortBy
to be a singleBTableSortBy
value whenmultisort == false
. I think that would be somewhat more ergonomic for a developer to consume.Small replication
A small replication or video walkthrough can help demonstrate the changes made. This is optional, but can help observe the intended changes. A mentioned issue that contains a replication also works.
PR checklist
What kind of change does this PR introduce? (check at least one)
fix(...)
feat(...)
fix(...)
docs(...)
The PR fulfills these requirements:
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