Johann-S/bs-stepper

Old step is not available in 'show.bs-stepper' event details

nelson6e65 opened this issue ยท 6 comments

Hi. Amazing package.

The 'show' event is cancellable, but only is provided the step that will be 'shown' via event.detail.indexStep. I would like to know the old and next step in this event.

I would like to know how to check the current step (before 'shown') in the 'show' event?

I am able to use the global stepperInstance._currentIndex as the old value, but... should be nice to have it as event data.

Hi @nelson6e65,

Thanks for your feedback, yes you can use _currentIndex or you do: event.detail.indexStep - 1 to know the previous step.

I'll keep your issue for a next major release of bs-stepper, because if we do that it'll introduce a breaking change

Hmm... That is cool for .next(), but what about .previous() and .to(2) methods?

I think introduce oldValue property and an alias newValue in addition to current indexStep, it should not break anything.

{
  oldStep,
  newStep, // Alias for indexStep
  indexStep, // current property
}

I agree for .to it's impossible to know which was the old step.

Feel free to make a PR or I'll do it when I find the time ๐Ÿ‘

Fixed by: 16b146a

Nice! Thanks. ๐ŸŽ‰

you're welcome ๐Ÿ˜‰ it's already shipped in v1.7.0