Noction / vue-draggable-grid

https://noction.github.io/vue-draggable-grid/
88 stars 33 forks source link

Bug: GridLayout.vue layoutItemOptionalKeys array is missing important optional grid item property keys #51

Closed jremi closed 8 months ago

jremi commented 8 months ago

Tested on release <= v1.9.15.

GridLayout.vue: L195 exposes array layoutItemOptionalKeys. However its missing several optional grid item properties (isBounded, dragIgnoreFrom, dragAllowFrom, resizeIgnoreFrom, preserveAspectRatio, dragOption, resizeOption).

Without these included the props do not get passed down into the GridItem.vue.

You can easily test this with for example adding the optional property dragIgnoreFrom to one of your layout grid items. For example dragIgnoreFrom: '.no-drag' ... Then set a class on an element <div class="no-drag">. You will be able to continue dragging the element. This should not be possible since you have included dragIgnoreFrom property on the grid item.

https://github.com/Noction/vue-draggable-grid/blob/07332cb987d44ea87fe942a304c1bf85fc415e59/packages/vue-draggable-grid/src/components/GridLayout/GridLayout.vue#L195

const layoutItemOptionalKeys = [
  'minW',
  'minH',
  'maxW',
  'maxH',
  'moved',
  'static',
  'isDraggable',
  'isResizable',
  'isBounded',
  'dragIgnoreFrom',
  'dragAllowFrom',
  'resizeIgnoreFrom',
  'preserveAspectRatio',
  'dragOption',
  'resizeOption'
]

I would have opened a pull-request, however I'm confused why the main branch on your repo is now 1.10.0-beta.4. I would have expected that beta code be maintained on the next branch.

My hope is someone can make a version bump for e.g: v1.9.16 with the updated layoutItemOptionalKeys array that I have referenced above.

🙏

LwveMike commented 8 months ago

Now the branch main is used for release and the branch next is used for pre-release.

jremi commented 8 months ago

Hi guys, I just opened a PR for this bugfix: https://github.com/Noction/vue-draggable-grid/pull/52

🙏

LwveMike commented 8 months ago

Merged pull request, now present in v1.9.16