helfi92 / material-ui-treeview

A React tree view for material-ui.
MIT License
47 stars 21 forks source link

Added onParentClick to MuiTreeView #37

Closed ZakCodes closed 5 years ago

ZakCodes commented 5 years ago

I had to make changes in a few files, and I'm still not sure that I haven't forgotten anything, so don't hesitate to tell me if there's something missing. resolve #9

ZakCodes commented 5 years ago

You're right there were some linting error, so I ran the command you told me to and then I ran yarn lint and there are no more errors.

Also, you shouldn't pull my changes just yet because I've just seen that onParentClick wasn't added to the file src/index.d.ts. I'm not sure if there's any command I can run or if I need to do it manually.

helfi92 commented 5 years ago

Good catch. It's done manually unfortunately.

ZakCodes commented 5 years ago

I've manually added the types, so I think that this type it should truly be ready to be merged lol.

I tried to check the typescript file using tsc --lib es6 but I got a few errors but none of them are coming from this library, they're comming from @material-ui/core and popper.js. Here's the error:

../node_modules/@material-ui/core/Button/Button.d.ts:5:18 - error TS2430: Interface 'ButtonProps' incorrectly extends interface 'Pick<ButtonBaseProps, "hidden" | "color" | "style" | "disabled" | "form" | "title" | "children" | "innerRef" | "media" | "name" | "action" | "defaultChecked" | "defaultValue" | ... 268 more ... | "TouchRippleProps"> & StyledComponentProps<...> & { ...; }'.
  Type 'ButtonProps' is not assignable to type 'Pick<ButtonBaseProps, "hidden" | "color" | "style" | "disabled" | "form" | "title" | "children" | "innerRef" | "media" | "name" | "action" | "defaultChecked" | "defaultValue" | ... 268 more ... | "TouchRippleProps">'.
    Types of property 'type' are incompatible.
      Type 'string' is not assignable to type '"button" | "reset" | "submit"'.

5 export interface ButtonProps extends StandardProps<ButtonBaseProps, ButtonClassKey, 'component'> {
                   ~~~~~~~~~~~

../node_modules/popper.js/index.d.ts:107:13 - error TS2304: Cannot find name 'CSSStyleDeclaration'.

107     styles: CSSStyleDeclaration;
                ~~~~~~~~~~~~~~~~~~~

../node_modules/popper.js/index.d.ts:108:18 - error TS2304: Cannot find name 'CSSStyleDeclaration'.

108     arrowStyles: CSSStyleDeclaration;
                     ~~~~~~~~~~~~~~~~~~~

../node_modules/popper.js/index.d.ts:137:30 - error TS2304: Cannot find name 'ClientRect'.

137     getBoundingClientRect(): ClientRect;
                                 ~~~~~~~~~~

For the popper errors, I probably just included the wrong library, but for @material-ui/core there seems to be a real type error.

helfi92 commented 5 years ago

I suppose migrating @material-ui/core to to latest would most probably fix these errors. Also, it would probably encourage more users to use this repo :)

helfi92 commented 5 years ago

Released in v3.4.0 🎉

ZakCodes commented 5 years ago

Nice, I didn't know whether you would release it right away or not, but I'm glad you did. Thanks a lot.

For the @material-ui/core update, I've seen that there are quite a few things to update, so I'll see if I can do it at some point. I'll do my best but I don't have much experience with it, so I might end up making a draft pull request with what I managed to do and ask questions from there on.

helfi92 commented 5 years ago

That definitely works :) Thanks a lot for your assistance!