Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve span when changing grid item positions #6639

Closed
ruggi opened this issue Nov 13, 2024 · 0 comments · Fixed by #6633
Closed

Preserve span when changing grid item positions #6639

ruggi opened this issue Nov 13, 2024 · 0 comments · Fixed by #6633
Assignees

Comments

@ruggi
Copy link
Contributor

ruggi commented Nov 13, 2024

No description provided.

@ruggi ruggi self-assigned this Nov 13, 2024
ruggi added a commit that referenced this issue Nov 14, 2024
**Problem:**

`span` values for grid child positioning props are wiped when using
`gridChangeElementLocationStrategy`.

**Fix:**

Rework the way grid element props are calculated when changing element
location pins, so that `spans` are respected and kept in place if
present.

The behavior is now so that:
- when it makes sense to do so, return shorthand versions of grid
positioning props
- when moving an element with `span` values, support moving them when
the span is in the starting prop as well as the ending prop

Examples for moving a item one cell to the right:

| Initial config | Result |
|------------|------------|
| `gridColumn: 'span 2'` | `gridColumn: 'span 2 / 4'` |
| `gridColumn: '2 / span 2'` | `gridColumn: '3 / span 2'` |
| `gridColumnStart: 'span 2'` | `gridColumn: 'span 2 / 4'` |
| `gridColumnEnd: 'span 2'` | `gridColumn: '3 / span 2'` |

**Note:** a subsequent PR will take care of also keepign `span` intact
for the reorder strategy.

Fixes #6639
liady pushed a commit that referenced this issue Dec 13, 2024
**Problem:**

`span` values for grid child positioning props are wiped when using
`gridChangeElementLocationStrategy`.

**Fix:**

Rework the way grid element props are calculated when changing element
location pins, so that `spans` are respected and kept in place if
present.

The behavior is now so that:
- when it makes sense to do so, return shorthand versions of grid
positioning props
- when moving an element with `span` values, support moving them when
the span is in the starting prop as well as the ending prop

Examples for moving a item one cell to the right:

| Initial config | Result |
|------------|------------|
| `gridColumn: 'span 2'` | `gridColumn: 'span 2 / 4'` |
| `gridColumn: '2 / span 2'` | `gridColumn: '3 / span 2'` |
| `gridColumnStart: 'span 2'` | `gridColumn: 'span 2 / 4'` |
| `gridColumnEnd: 'span 2'` | `gridColumn: '3 / span 2'` |

**Note:** a subsequent PR will take care of also keepign `span` intact
for the reorder strategy.

Fixes #6639
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant