Coder Social home page Coder Social logo

Comments (7)

advance512 avatar advance512 commented on May 31, 2024

This was not fixed, right?

onRequestAdd receives an object (if you use dataSource and dataSourceConfig) while onRequestDelete receives a string, being just the value of the item in the data source.

e.g.

onRequestAdd({ label: "Some label", value: "SOME_ENUM_VALUE"});
onRequestDelete("SOME_ENUM_VALUE");

from material-ui-chip-input.

leMaik avatar leMaik commented on May 31, 2024

It was fixed, but in the other way: onRequestDelete no always gets called with the value (which is either the string or the value property when using dataSourceConfig.

from material-ui-chip-input.

advance512 avatar advance512 commented on May 31, 2024

Isn't this inconsistent?

You get the item in one, the value in another. Sure, sometimes the item is a string, sometimes it contains a text/label and the value string.

Seems to me that it would be more consistent to stick to either value or the complete item.

Anyways, I work around it by translating it so I can use it in redux-form.

from material-ui-chip-input.

leMaik avatar leMaik commented on May 31, 2024

Yes, but at least it's consistent for onRequestDelete calls, which it wasn't before. Making it consistent between onRequestAdd and onRequestDelete would be a breaking change, unfortunately (and I don't want to break everyone's code even if this is < 1.0.0).
I could do that when I update this to material-ui@next and bump the version to 1.0.0, though. πŸ‘ Could you please open a new issue for that?

from material-ui-chip-input.

advance512 avatar advance512 commented on May 31, 2024

Done. Awesome work, btw. :)

I'll probably wrap it in a new lib, that support redux-form and that can integrate into Google Places. Soonish or laterish

from material-ui-chip-input.

leMaik avatar leMaik commented on May 31, 2024

Thank you, @advance512 ☺️
That sounds like a good idea. I have an example for formsy support here, it may help you when building a redux-form wrapper.
Let me know when you're done, I'd like to link that as related project. πŸ˜‰

from material-ui-chip-input.

advance512 avatar advance512 commented on May 31, 2024

I have the redux-form wrapper, actually. I had to split it into two:
A "multi-select" and a "tags input". The reason is that with a DataSource, I need to use onRequestAdd, but without one, I need to use onChange (which, btw, gives you the complete list of items, also a tad inconsistent, but there IS only one handler).

I don't have time to port my existing, ugly, component that merge react-places-autocomplete and react-select to do the Google Places thing, but I will soon - it's the only non-Material UI component I currently use.

from material-ui-chip-input.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.