-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[modal] change event order #454
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
Well, I'll just add BS4 event system there |
Also, Vue.js (and boostrap-vue) is reactive based, whereas Bootstrap V4 native is event based. so there are a few differences in how things can be handled. Although I do think having some of the added events fire on $root would be handy... The biggest issue is providing context to the event when it is fired. i.e. providing the ID of the component, a reference to the component, or an event object (with target and maybe relatedTarget attached). |
@youaresofunny You can see part of the long-running questions on issue #276 |
Yep, but this commit is not about $root emits 🚶♂️ |
You're right, @youaresofunny , I got carried away on another topic. The order of events seems more sensible with your changes. They don't take into account the asynchronous nature of the transitions, but that is probably best dealt with in a later, breaking change. Now with your event renaming, I don't believe we've made any breaking changes at all, and you should have your event flow worked out. Any extra thoughts, @tmorehouse ? |
I wonder if we should standardize the format / calling signature of all component emits on $root? i.e. this or something like this: this.$root.$emit('event::name', this.id, this, other, args, here)
this.$root.$on('event::name', id, ctx, other , args, here) Although not all components have an id, so maybe just |
For local the transition triggered events might be something we have to deal with later. |
@tmorehouse, with all those options, why not make a class and just pass that? I've got some sweet class patterns you guys might like, so pass me the prop names and I'll PR the internal event object so we can define an interface and avoid too many parameters. |
The modal click handler (where it can be canceled) is kind of nifty, although it is binding to a native event structure ($event) which we don't have the luxury of in I can see possibly providing 'target' being the VM of the component, and Maybe |
Yeah, I was thinking of more of a hybrid event. A class that uses a lot of the same Event names, but it more scoped to the internal needs of the BV components. For example, the emitting component would be placed on |
If you've played with react, they have done some cool things with their synthetic event to make it familiar, but ergonomic. We have very small needs, but I thought that was a good target to emulate. |
Cool. I think it should have props similar to
|
There are no issue about it (but i think we can discus this little fix here)
The chain of events in hide method of modal now looks like this:
click smth (ok / cancel) -> trigger(change, hidden) -> trigger(ok/cancel)
It means that 'hidden' (or 'change') is triggered even before we start to process the 'ok' or 'cancel' methods. (so if we e.cancel() in ok, we will anyway see hidden trigger)
After commit it will be work in this way:
click smth (ok / cancel ) -> trigger(ok / cancel) -> trigger(change) -> trigger(hidden) (if event not canceled)
Also, can i add "beforechange" emit, that triggers before "ok" / "cancel" ?