Open
Description
Bug, feature request, or proposal: proposal
What is the expected behavior?
Since drag and drop are in the CDK it makes sense to expose some of the members so they can be extended.
What is the current behavior?
A lot of internal logic that might be useful in derived classes is marked private.
What is the use-case or motivation for changing an existing behavior?
A lot of logic is sitting in CdkDropList
, most of the methods that calculate stuff should be set to protected:
- _positionCache (property) - Will allow access to current environment the drag is in, especially the sibling items. For example, in a table when dragging the header cell we also want to move all the data cells that have the same column as the header cell. Because dragging is temporary (until commit/drop) we need to do it WITHOUT CD via direct DOM updates. Having the cache will help.
- _reset() - will allow resetting custom modifications in derived classes
- _getItemIndexFromPointerPosition(...) - Will help when wanting to prevent a drag to a position based on business rules, e.g.: In a table don't move column at index 0
- and others:
_isPointerNearDropContainer()
,_getItemOffsetPx()
,_getSiblingOffsetPx()
,_getConnectedLists()
The other mentioned will also help on various business constraints... I don't see any harm exposing
them as protected.
Same thing with CdkDrag
... Most important one is CDK_DRAG_PARENT
.
It is not exported by the package so it is impossible to use drag handles,
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
material 7.0.3