DomonJi / vue-clock-picker

A vue-based time picker Component
https://domon.me/vue-clock-picker
MIT License
38 stars 10 forks source link

Don't open TimePickerModal on click time-picker-preview #1

Open BalGuldur opened 7 years ago

BalGuldur commented 7 years ago

Don't open modal becourse click on time-picker run two function: toggleFocus() and onClearFocus() becourse element OutsideClickHandler catch this click as outside click. toggleFocus() - open modal then onClearFocus() close modal. I think need add overElement data for TimePicker(), add @mouseover="overElement=true" @mouseout="overElement=false" to time-picker-preview, and change onClearFocus() to:

  !this.overElement && (this.focused = false)
  !this.overElement && this.onFocusChanged && this.onFocusChanged(false)
DomonJi commented 7 years ago

I know what you mean, but actually I just want to toggle the modal when clicking on the preview panel. I think it's reasonable. Anyway, thanks a lot for your advice.

DomonJi commented 7 years ago

Maybe I could make this behavior configurable. 😃

BalGuldur commented 7 years ago

Mmm. Maybe i don't understand. But u live demo (https://domonji.github.io/vue-clock-picker/) work prefect as need, and click on preview panel -> toggle modal with clock. But version on master branch and npm package don't toggle modal with clock by click on preview panel. Becourse click on preview panel runing two handler: toggleFocus() on preview panel and onOutsideClickHandler() on OutsideClickHandler. (area of preview panel is outside for OutsideClickHandler and OutsideClickHandler is focused (changed by toggleFocus()) ) Anyway, thx for this project, it's good. Thx if u fix this, or add configurable props. Second way for fix this, is expand OutsideClickHandler to preview panel + modal.

P.S. if need, i can create version with autoswitch from hour to minutes on choose hour, and close modal on choose minutes, and add pull request.

DomonJi commented 7 years ago

That's strange. I remember I built this live demo with master branch. However, I'll test it and find out what is going wrong.

It would be very nice if you add pull requests.