cibernox / ember-power-select-typeahead

Typeahead component built on top of ember-power-select
MIT License
37 stars 57 forks source link

Update to beta ember-power-select #17

Closed jesseditson closed 7 years ago

jesseditson commented 8 years ago

Fixes #14:

I took some liberties with the code, but kept the old tests, which continue to pass. The only added functionality is the ability to pass showOptions, which causes the list to show on focus if options are provided (therefore providing a simple filtering typeahead instead of an async one). I added a test to cover this use case.

This likely needs a review to make sure I'm matching style properly, but I tested it pretty thoroughly (via the new views in the dummy app).

This also probably wants a minor/major version bump because of the breaking EPS dependency, but the API is identical so that's your call.

Here's a demo of the functionality:

sivakumar-kailasam commented 8 years ago

@cibernox I've been using @jesseditson's branch on my app. Works as expected for me. Hope this gets merged and we get a release 😄

cibernox commented 8 years ago

Ok, I'm going to pull these changes and review it now.

For opening on focus I typically recommend users to use the onfocus=(action "openIfIFeelLike"). and let the users decide what to do when it gets the focus. I do that to keep the api of the component minimal yet make it flexible enough.

That said, that's Ember Power Select rules, this component doesn't need to adhere to the same principle of being as low-level as possible, so one option to openOnFocus might be ok.

cibernox commented 8 years ago

For the record, I've been on holidays until Monday, that's why it took soo long 😓

sivakumar-kailasam commented 8 years ago

😄 hope you had a good time @cibernox

cibernox commented 8 years ago

In the review I found a couple errors. In particular, when you search for a string that doesn't give any results and the components. Given that this component had quite a lot of changes not-related with the update to 1.0.0, I did another PR that contains no changes in functionality, just the minimum changes to make it work.

It has been released on 0.4.1.

I added one example using a non-asynchonous search to the application.hbs.

@jesseditson can you check if it works for you (openOnFocus aside)?

jesseditson commented 8 years ago

Thanks! I'll take a peek at this when I get a moment and get it shored up & rebased.