-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
feat(cdk/drag-drop): add mixed orientation support #29216
Conversation
Fixes some test cases that don't behave like a user would do, like hovering over an item that is out of the screen. They worked because currently the drag&drop is almost purely coordinate-based, but that won't be the case with the `mixed` orientation. Also fixes some concatenated test names that were difficult to search for.
Reduces the amount of information that needs to be passed in for the shared drag&drop tests.
Simplifies the interface for sort strategies to avoid the unnecessary generics that were put in place to avoid circular imports.
import {createComponent, dragElementViaMouse} from './test-utils.spec'; | ||
|
||
describe('mixed drop list', () => { | ||
defineCommonDropListTests({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that we don't have that many tests here, because we reuse the ~190 tests from the existing drop list. We add some more below to ensure that sorting works properly on mixed lists as well.
Currently the drop list sorts items by moving them using a `transform` which keeps the DOM stable and allows for the sorting to be animated, but has the drawback of only allowing sorting in one direction. These changes implement a new `DropListSortStrategy` that allows sorting of lists that can wrap by moving the DOM nodes around directly, rather than via a `transform`. It has the caveat that it can't animate the sorting action. The new strategy can be enabled by setting `cdkDropListOrientation="mixed"`. Fixes angular#13372.
19ebd54
to
c0b5c3f
Compare
Deployed dev-app for c0b5c3f to: https://ng-dev-previews-comp--pr-angular-components-29216-dev-tnw1ojix.web.app Note: As new commits are pushed to this pull request, this link is updated after the preview is rebuilt. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Currently the drop list sorts items by moving them using a
transform
which keeps the DOM stable and allows for the sorting to be animated, but has the drawback of only allowing sorting in one direction.These changes implement a new
DropListSortStrategy
that allows sorting of lists that can wrap by moving the DOM nodes around directly, rather than via atransform
. It has the caveat that it can't animate the sorting action.The new strategy can be enabled by setting
cdkDropListOrientation="mixed"
.Fixes #13372.