-
Notifications
You must be signed in to change notification settings - Fork 6.8k
refactor(drag-drop): clean up DragRef public API #14654
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
Conversation
* Sets a handle as disabled. While a handle is disabled, it'll capture and interrupt dragging. | ||
* @param handle Handle element that should be disabled. | ||
*/ | ||
disableHandle(handle: HTMLElement) { |
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: I'm not too happy with having to add this method and enableHandle
below, since it means having to do this above, however we need them in order to keep backwards compatibility. They allow us to handle the case where the user starts to drag from a disabled handle, in which case the dragging sequence should be interrupted. In the future we can reconsider whether supporting that case is worth it.
119499f
to
011ba9a
Compare
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.
LGTM
src/cdk/drag-drop/directives/drag.ts
Outdated
startWith(this._handles), | ||
// Sync the new handles with the DragRef. | ||
tap((handles: QueryList<CdkDragHandle>) => { | ||
const ownHandles = handles.reduce((accumulator, handle) => { |
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.
I would do
const childHandleElements =
handles.filter(h => h._parentDrag === this).map(h => h.element);
The number of handles will be trivially small
Cleans up the API of the DragRef before we can expose it through the public API by making the handle, custom placeholder and custom preview easier to configure.
011ba9a
to
ff0faf9
Compare
Cleans up the API of the DragRef before we can expose it through the public API by making the handle, custom placeholder and custom preview easier to configure.
Cleans up the API of the DragRef before we can expose it through the public API by making the handle, custom placeholder and custom preview easier to configure.
Cleans up the API of the DragRef before we can expose it through the public API by making the handle, custom placeholder and custom preview easier to configure.
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. |
Cleans up the API of the DragRef before we can expose it through the public API by making the handle, custom placeholder and custom preview easier to configure.
Note: marking as merge safe, because all of the public API signature changes are to classes that haven't been exposed yet.