@@ -11,7 +11,6 @@ import {
11
11
ContentChildren ,
12
12
ElementRef ,
13
13
EventEmitter ,
14
- forwardRef ,
15
14
Input ,
16
15
OnDestroy ,
17
16
Output ,
@@ -23,9 +22,8 @@ import {
23
22
AfterContentInit ,
24
23
} from '@angular/core' ;
25
24
import { Directionality } from '@angular/cdk/bidi' ;
26
- import { CdkDrag } from './drag' ;
25
+ import { CdkDrag , CDK_DROP_LIST } from './drag' ;
27
26
import { CdkDragDrop , CdkDragEnter , CdkDragExit , CdkDragSortEvent } from '../drag-events' ;
28
- import { CDK_DROP_LIST_CONTAINER , CdkDropListContainer } from '../drop-list-container' ;
29
27
import { CdkDropListGroup } from './drop-list-group' ;
30
28
import { DropListRef } from '../drop-list-ref' ;
31
29
import { DragRef } from '../drag-ref' ;
@@ -43,18 +41,14 @@ let _uniqueIdCounter = 0;
43
41
*/
44
42
export interface CdkDropListInternal extends CdkDropList { }
45
43
46
- // @breaking -change 8.0.0 `CdkDropList` implements `CdkDropListContainer` for backwards
47
- // compatiblity. The implements clause, as well as all the methods that it enforces can
48
- // be removed when `CdkDropListContainer` is deleted.
49
-
50
44
/** Container that wraps a set of draggable items. */
51
45
@Directive ( {
52
46
selector : '[cdkDropList], cdk-drop-list' ,
53
47
exportAs : 'cdkDropList' ,
54
48
providers : [
55
49
// Prevent child drop lists from picking up the same group as their parent.
56
50
{ provide : CdkDropListGroup , useValue : undefined } ,
57
- { provide : CDK_DROP_LIST_CONTAINER , useExisting : CdkDropList } ,
51
+ { provide : CDK_DROP_LIST , useExisting : CdkDropList } ,
58
52
] ,
59
53
host : {
60
54
'class' : 'cdk-drop-list' ,
@@ -64,7 +58,7 @@ export interface CdkDropListInternal extends CdkDropList {}
64
58
'[class.cdk-drop-list-receiving]' : '_dropListRef.isReceiving()' ,
65
59
}
66
60
} )
67
- export class CdkDropList < T = any > implements CdkDropListContainer , AfterContentInit , OnDestroy {
61
+ export class CdkDropList < T = any > implements AfterContentInit , OnDestroy {
68
62
/** Emits when the list has been destroyed. */
69
63
private _destroyed = new Subject < void > ( ) ;
70
64
@@ -75,7 +69,7 @@ export class CdkDropList<T = any> implements CdkDropListContainer, AfterContentI
75
69
_dropListRef : DropListRef < CdkDropList < T > > ;
76
70
77
71
/** Draggable items in the container. */
78
- @ContentChildren ( forwardRef ( ( ) => CdkDrag ) , {
72
+ @ContentChildren ( CdkDrag , {
79
73
// Explicitly set to false since some of the logic below makes assumptions about it.
80
74
// The `.withItems` call below should be updated if we ever need to switch this to `true`.
81
75
descendants : false
@@ -198,7 +192,11 @@ export class CdkDropList<T = any> implements CdkDropListContainer, AfterContentI
198
192
this . _destroyed . complete ( ) ;
199
193
}
200
194
201
- /** Starts dragging an item. */
195
+ /**
196
+ * Starts dragging an item.
197
+ * @deprecated No longer being used. To be removed.
198
+ * @breaking -change 10.0.0
199
+ */
202
200
start ( ) : void {
203
201
this . _dropListRef . start ( ) ;
204
202
}
@@ -210,18 +208,23 @@ export class CdkDropList<T = any> implements CdkDropListContainer, AfterContentI
210
208
* @param previousContainer Container from which the item got dragged in.
211
209
* @param isPointerOverContainer Whether the user's pointer was over the
212
210
* container when the item was dropped.
211
+ *
212
+ * @deprecated No longer being used. To be removed.
213
+ * @breaking -change 10.0.0
213
214
*/
214
- drop ( item : CdkDrag , currentIndex : number , previousContainer : Partial < CdkDropListContainer > ,
215
+ drop ( item : CdkDrag , currentIndex : number , previousContainer : CdkDropList ,
215
216
isPointerOverContainer : boolean ) : void {
216
- this . _dropListRef . drop ( item . _dragRef , currentIndex ,
217
- ( previousContainer as CdkDropList ) . _dropListRef , isPointerOverContainer ) ;
217
+ this . _dropListRef . drop ( item . _dragRef , currentIndex , previousContainer . _dropListRef ,
218
+ isPointerOverContainer , { x : 0 , y : 0 } ) ;
218
219
}
219
220
220
221
/**
221
222
* Emits an event to indicate that the user moved an item into the container.
222
223
* @param item Item that was moved into the container.
223
224
* @param pointerX Position of the item along the X axis.
224
225
* @param pointerY Position of the item along the Y axis.
226
+ * @deprecated No longer being used. To be removed.
227
+ * @breaking -change 10.0.0
225
228
*/
226
229
enter ( item : CdkDrag , pointerX : number , pointerY : number ) : void {
227
230
this . _dropListRef . enter ( item . _dragRef , pointerX , pointerY ) ;
@@ -230,6 +233,8 @@ export class CdkDropList<T = any> implements CdkDropListContainer, AfterContentI
230
233
/**
231
234
* Removes an item from the container after it was dragged into another container by the user.
232
235
* @param item Item that was dragged out.
236
+ * @deprecated No longer being used. To be removed.
237
+ * @breaking -change 10.0.0
233
238
*/
234
239
exit ( item : CdkDrag ) : void {
235
240
this . _dropListRef . exit ( item . _dragRef ) ;
@@ -238,45 +243,13 @@ export class CdkDropList<T = any> implements CdkDropListContainer, AfterContentI
238
243
/**
239
244
* Figures out the index of an item in the container.
240
245
* @param item Item whose index should be determined.
246
+ * @deprecated No longer being used. To be removed.
247
+ * @breaking -change 10.0.0
241
248
*/
242
249
getItemIndex ( item : CdkDrag ) : number {
243
250
return this . _dropListRef . getItemIndex ( item . _dragRef ) ;
244
251
}
245
252
246
- /**
247
- * Sorts an item inside the container based on its position.
248
- * @param item Item to be sorted.
249
- * @param pointerX Position of the item along the X axis.
250
- * @param pointerY Position of the item along the Y axis.
251
- * @param pointerDelta Direction in which the pointer is moving along each axis.
252
- */
253
- _sortItem ( item : CdkDrag , pointerX : number , pointerY : number ,
254
- pointerDelta : { x : number , y : number } ) : void {
255
- return this . _dropListRef . _sortItem ( item . _dragRef , pointerX , pointerY , pointerDelta ) ;
256
- }
257
-
258
- /**
259
- * Figures out whether an item should be moved into a sibling
260
- * drop container, based on its current position.
261
- * @param item Drag item that is being moved.
262
- * @param x Position of the item along the X axis.
263
- * @param y Position of the item along the Y axis.
264
- */
265
- _getSiblingContainerFromPosition ( item : CdkDrag , x : number , y : number ) :
266
- CdkDropListContainer | null {
267
- const result = this . _dropListRef . _getSiblingContainerFromPosition ( item . _dragRef , x , y ) ;
268
- return result ? result . data : null ;
269
- }
270
-
271
- /**
272
- * Checks whether the user's pointer is positioned over the container.
273
- * @param x Pointer position along the X axis.
274
- * @param y Pointer position along the Y axis.
275
- */
276
- _isOverContainer ( x : number , y : number ) : boolean {
277
- return this . _dropListRef . _isOverContainer ( x , y ) ;
278
- }
279
-
280
253
/** Syncs the inputs of the CdkDropList with the options of the underlying DropListRef. */
281
254
private _syncInputs ( ref : DropListRef < CdkDropList > ) {
282
255
if ( this . _dir ) {
0 commit comments