material-ui-superselectfield icon indicating copy to clipboard operation
material-ui-superselectfield copied to clipboard

is it support V1 of material-ui ?

Open toolaugh opened this issue 7 years ago • 17 comments

toolaugh avatar Oct 15 '17 08:10 toolaugh

not yet

Sharlaan avatar Oct 15 '17 09:10 Sharlaan

Do you need help porting to v1?

gilles-yvetot avatar Jan 23 '18 02:01 gilles-yvetot

Yes. Every kind of help is welcome 😄

TarikHuber avatar Jan 23 '18 10:01 TarikHuber

Okay I am on it. I have done a lot of work and I think it is almost done. I do struggle with something though.

The project is running, the demo "home" page is loading but when I switch pages (e.g. http://localhost:3000/example1), I got the following error: Cannot read property 'baseTheme' of undefined from src/SuperSelectField.js.

// Default style depending on Material-UI context (
const { baseTheme: { palette }, menuItem } = this.context.muiTheme

gilles-yvetot avatar Jan 23 '18 18:01 gilles-yvetot

muiTheme implementation got totally revamped in v1 if i remember correctly.

Your best bet to find the correct context path would be on Material-UI documentation or sources (v1+ branch).

Sharlaan avatar Jan 23 '18 19:01 Sharlaan

From what I am seeing here,

remove the duplication between the theme and the styleManager as we can use
this.context.styleManager.theme over this.context.theme

which I tried but this.context.styleManager is still undefined, grrrr

EDIT: After reading the changelog,

The styleManager is gone. The server side rendering configuration changed, use the sheetManager instead. The documentation was updated, you can refer to it if needed.

So I am continuing the investigation

gilles-yvetot avatar Jan 23 '18 19:01 gilles-yvetot

The whole baseTheme concept is to grab the default styles from the default/user-defined theme.

So check the source of any v1 component to find out how do they mix component-scale styles with app-scale styles(theme) for example AppBar.js

Sharlaan avatar Jan 23 '18 20:01 Sharlaan

Then why do you use the context instead of wrapping your component with muiThemeable (which became withTheme) and then use the theme attached to the props?

gilles-yvetot avatar Jan 23 '18 20:01 gilles-yvetot

maybe because only way i found in v0.x were through this.context.muiTheme.

In your case, you are targeting v1.+, which got totally revamped. In that regard, i didnot look much how the new system works. "Try it !" :p

Sharlaan avatar Jan 23 '18 20:01 Sharlaan

Hi @Sharlaan and @gilles-yvetot ,

How is it going with the migration? MUI V1 Stable will be released next month. We should think now about the migration more seriously. I also have to migrate now about 5 libraries -.-

TarikHuber avatar Apr 23 '18 06:04 TarikHuber

Material UI V1 is out! would really love to see this supported.

amrsobhy avatar May 23 '18 10:05 amrsobhy

Any updates on this? I'm planning on migrating my own code to material-ui latest version but I think I can't do it until this component also updates.

cristianocca avatar Dec 27 '18 15:12 cristianocca

Hi @cristianocca and @amrsobhy ,

for my part we could not wait and made our own component for autocomplete fields with MUI V1 and used for that the established library downshift. muishift uses downshift and just Material UI components as UI. If someone needs a fast solution that should work out. Othervise a PR to this library is always welcome 😄

TarikHuber avatar Dec 27 '18 18:12 TarikHuber

Thanks @TarikHuber; however, I need more than just the basic features of a select field (multi select with checkboxes for example)

cristianocca avatar Dec 28 '18 16:12 cristianocca

@TarikHuber : Well, I couldn't wait neither and ended up "vendoring" the library into my project and adapting it to my needs (material ui 3.x and some fixes). I can't really do a PR or contribute to the actual project since I removed most of the functionalities and customizations I didn't need (in order to migrate it faster).

However, if anyone is interested, I would gladly share the the code. I have basically kept the main functionalities (simple and multi picker with checkboxes) and adapted all the components so it matches exactly all the other material UI fields (same colors, sizes, width, etc.)

cristianocca avatar Jan 05 '19 15:01 cristianocca

@cristianocca i'm interested please share in a codesandbox.

Sharlaan avatar Jan 06 '19 11:01 Sharlaan

@Sharlaan I don't really have time to make a proper example in a code sandbox. Please see the attached zip file with the code and captures of how it looks.

Keep in mind that I don't think this version of the code is suitable for everyone since I removed some features I didn't need in order to make the migration faster. Also, I wasn't able to make the infinite scroll library to work properly (which for some reason broke with the new MUI modals, I believe it's related to the new use of portals), so the dropdown won't work efficiently with massive lists. Lastly, it can't be used as a drop-in replacement of the original version since I have also renamed "floatingLabel" and similar to just "label" to match the new MUI namings.

1 2 3 4

muiSuperselect.zip

cristianocca avatar Jan 06 '19 20:01 cristianocca