-
-
Notifications
You must be signed in to change notification settings - Fork 98
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
fix(BTable): Pass through original records to slots when primary key is defined #1869
Conversation
Run & review this pull request in StackBlitz Codeflow. |
if ( | ||
typeof item === 'object' && | ||
item !== null && | ||
Object.keys(item).some((key) => key.includes('.')) |
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 takes care of passing through the original objects to BTableLite except in the case where the a key contains "." - I believe this is an acceptable compromise as the use case for maintaining the object is well-behaved typescript objects, which shouldn't contain "." in property names. It also has the benefit of not transforming object arbitrarily if they're "normal" objects.
@@ -273,6 +273,26 @@ watch( | |||
} | |||
) | |||
|
|||
const itemMap = computed(() => { |
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 depends on having a primary key defined. That's fine for my use case (and I think in general for the kind of case that I think would be important for enabling the pass through) - I don't see a more general way to do this, but if I'm missing something obvious, I'd be happy to take another un at it. I'll also document this capability and its limitations in a follow-up PR (and probably get some more of the surrounding table docs added).
* upstream/main: (23 commits) feat(BInput): Alias BFormInput to BInput fix(nuxt): dont teleport everything to #teleports -- selectively teleport based on body fixes bootstrap-vue-next#1898 chore: release main feat(nuxt): allow passthrough options to createBootstrap plugin chore: release main (bootstrap-vue-next#1894) feat: implmenet a use defaults system WIP fixes bootstrap-vue-next#1607 (bootstrap-vue-next#1889) docs(BCheckBox*): Small changes to get documentation to parity (bootstrap-vue-next#1873) docs: Add component reference link in the page table of contents sidebar fixed BTableLite item _showDetails BTable delete selection when primary-key chore: release main feat(BTable): add change event -- replaces bv `modelValue` see bootstrap-vue-next#1775 (comment) chore: release main fix(BTable): selectedItems not clearing values properly fixes bootstrap-vue-next#1878 (bootstrap-vue-next#1879) chore: release main (bootstrap-vue-next#1874) fix(BTable): Pass through original records to slots in most circumstances (bootstrap-vue-next#1869) chore: release main (bootstrap-vue-next#1867) feat(BTable): Allow dot in sortby key fix: update dependencies to fix a bug in vue compiler (bootstrap-vue-next#1866) chore: release main (bootstrap-vue-next#1859) ...
Describe the PR
For use cases when row items are defined as functional objects, it's convenient for the original object to be passed through to the scoped slots. The object still has to not contain loops and correctly transform through the JSON.parse(JSON.stringify()) loop, but it is returned to the client code intact.
The requirements for this to work are:
If this is acceptable, I'll get documentation including the limitations (and probably some stuff around it) in as a follow-up PR.
Small replication
Included in the test cases in the PR.
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