-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat(modal): support for optionally scoped slots and new Vue.prototype.$bvModal
helper
#3056
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
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #3056 +/- ##
==========================================
+ Coverage 99.03% 99.06% +0.02%
==========================================
Files 207 209 +2
Lines 3746 3836 +90
Branches 1123 1141 +18
==========================================
+ Hits 3710 3800 +90
Misses 28 28
Partials 8 8
Continue to review full report at Codecov.
|
Vue.prototype.$bvModal
helper
This is awesome @tmorehouse! I've been wanting a global ok+/cancel modal for a while and never had time to stop and wrap our functionality. I needed this again today and stumbled onto this PR. It looks really good in the review app! Is there a sense when a new version will launch containing the new Thanks! |
Hopefully by the end of the weekend we should have it out. |
@tmorehouse, would you consider adding |
Description of Pull Request:
Makes many of the named slots (including the default slot) optionally scoped with the following scope:
ok()
hide
andok
events, withevt.trigger = 'ok'
.cancel()
hide
andcancel
events withevt.trigger = 'cancel'
.close()
hide
and 'close' events withevt.trigger = 'headerclose'
.hide(trigger)
hide
event withevt.trigger = trigger
visible
true
orfalse
)Slots that are optionally scoped:
modal-header
modal-title
modal-footer
default
This is in preparation for making fully parameterized scoped modals (issue #2206, where additional data can be passed to modal when triggered to be open via events) in the future.
Also adds
this.$bvModal
to all Vue instances (not available when importing only theb-modal
component, but is available when importing theModal
plugin), which has the following methods:this.$bvModal.show()
id
this.$bvModal.hide()
id
this.$bvModal.msgBoxOk()
message
,options
this.$bvModal.msgBoxConfirm()
message
,options
Also created
utils/inspect.js
helpers for inspecting variable types, etc. Can be used by other components to help with minification.Live preview: https://deploy-preview-3056--bootstrap-vue.netlify.com/docs/components/modal
To Do:
$bvModal
object to theVue.prototype
for easy triggering of modals (without need for user to$emit
events on$root
), which optionally returns aPromise
that resolves when the modalhidden
(or possiblyhide
) event fires (ifPromise
is supported in browser)details
to theBvModalEvent
object, for future returning of data from modal to the user (for both thehide
andhidden
events)$bvModal
Vue prototype injectionPR checklist:
What kind of change does this PR introduce? (check at least one)
Does this PR introduce a breaking change? (check one)
If yes, please describe the impact:
The PR fulfills these requirements:
dev
branch, not themaster
branchfixes #xxxx[,#xxxx]
, where "xxxx" is the issue number)and adding a new feature, break them into separate PRs if at all possible.
Conventional Commits naming convention (i.e.
"fix(alert): not alerting during SSR render", "docs(badge): Updated pill examples, fix typos",
"chore: fix typo in docs", etc). This is very important, as the
CHANGELOG
is generatedfrom these messages.
If new features/enhancement/fixes are added or changed:
package.json
for slot andevent changes)
keyboard only users? clickable items should be in the tab index, etc)
If adding a new feature, or changing the functionality of an existing feature, the PR's
description above includes:
suggestion issue first and wait for approval before working on it)