MCPcopy Create free account
hub / github.com/angular/components / withItems

Method withItems

src/cdk/drag-drop/drop-list-ref.ts:333–351  ·  view source on GitHub ↗

* Sets the draggable items that are a part of this list. * @param items Items that are a part of this list.

(items: DragRef[])

Source from the content-addressed store, hash-verified

331 * @param items Items that are a part of this list.
332 */
333 withItems(items: DragRef[]): this {
334 const previousItems = this._draggables;
335 this._draggables = items;
336 items.forEach(item => item._withDropContainer(this));
337
338 if (this.isDragging()) {
339 const draggedItems = previousItems.filter(item => item.isDragging());
340
341 // If all of the items being dragged were removed
342 // from the list, abort the current drag sequence.
343 if (draggedItems.every(item => items.indexOf(item) === -1)) {
344 this._reset();
345 } else {
346 this._sortStrategy.withItems(this._draggables);
347 }
348 }
349
350 return this;
351 }
352
353 /** Sets the layout direction of the drop list. */
354 withDirection(direction: Direction): this {

Callers

nothing calls this directly

Calls 5

isDraggingMethod · 0.95
_resetMethod · 0.95
_withDropContainerMethod · 0.80
withItemsMethod · 0.65
filterMethod · 0.45

Tested by

no test coverage detected