bmcmahen / react-grid-dnd

drag and drop, grid edition. built with react

Home Page:https://codesandbox.io/embed/gracious-wozniak-kj9w8

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Some feature requests

TheAifam5 opened this issue · comments

Hey! It's first library which works for me :D Other just crashing with HMR or something else and I'm getting really annoyed. Thank you for that library!

I want to propose some features like:

  1. Automatically wrap childrens in GridItem.
  2. Allow to define in GridItem:
  • disableDrag
  • disableDrop
  1. Layout persistence
  2. Breakpoints
  3. Dynamic columns (based on breakpoints) - boxesPerRow
  4. Consider to remove id from GridDropZone - could be set internally.
  5. Allow to style GridItem.

About 2 - It's because of that last element.
image

Regards,
TheAifam5

Glad it's working and thanks for the feedback! I'm going to address some of your ideas point by point:

  1. There's a reason why I kept GridItem distinct... but I honestly can't remember why right now. Haha. Let me get back to you on this one.
  2. Agreed. This would be nice.
  3. What do you mean by layout persistence?
  4. I'd rather breakpoints be handled outside of this library. You could do this by using useMedia and then altering the boxesPerRow accordingly. I haven't tried this, but it should work.
  5. It should be dynamic already if you alter boxesPerRow
  6. We can make it optional, but setting it manually is more useful when working with multiple drop zones because you need to alter the relevant data object accordingly.
  7. Yes, definitely! This should be an easy fix. I'll see what I can do.

@TheAifam5 I just published a new version which allows you to pass custom styles, classNames and other props to the GridItem.

@bmcmahen Thank your for your answer.
About the 2. - I mean there that the position are saved in correct order, by Id or something but looks like you just do it by the index.

About 6. Yes, if you have multiple drop zones then makes sense to have the ID - but if you have only one? :D

And... Thanks again for this. Everything works fine and no needs to have a bloated config to get it working - i really like it. :D

Regarding 2, order is determined entirely by the order in which you render your GridItems -- so yes, by index. It's up to you to maintain and persist that order. I'd like to keep it like that because it's ultimately more flexible.

About 6, I'll likely make ids optional and auto generate one if it's not provided.

Glad you're enjoying this library - honestly probably one of the harder ones I've had to make! I'm going to close this and make individual issues for the points I think are worth the effort.