* Configures the drop list so that a different element is used as the container for the * dragged items. This is useful for the cases when one might not have control over the * full DOM that sets up the dragging. * Note that the alternate container needs to be a descendant of the drop list.
(container: HTMLElement)
| 409 | * @param container New element container to be assigned. |
| 410 | */ |
| 411 | withElementContainer(container: HTMLElement): this { |
| 412 | if (container === this._container) { |
| 413 | return this; |
| 414 | } |
| 415 | |
| 416 | const element = coerceElement(this.element); |
| 417 | |
| 418 | if ( |
| 419 | (typeof ngDevMode === 'undefined' || ngDevMode) && |
| 420 | container !== element && |
| 421 | !element.contains(container) |
| 422 | ) { |
| 423 | throw new Error( |
| 424 | 'Invalid DOM structure for drop list. Alternate container element must be a descendant of the drop list.', |
| 425 | ); |
| 426 | } |
| 427 | |
| 428 | const oldContainerIndex = this._scrollableElements.indexOf(this._container); |
| 429 | const newContainerIndex = this._scrollableElements.indexOf(container); |
| 430 | |
| 431 | if (oldContainerIndex > -1) { |
| 432 | this._scrollableElements.splice(oldContainerIndex, 1); |
| 433 | } |
| 434 | |
| 435 | if (newContainerIndex > -1) { |
| 436 | this._scrollableElements.splice(newContainerIndex, 1); |
| 437 | } |
| 438 | |
| 439 | if (this._sortStrategy) { |
| 440 | this._sortStrategy.withElementContainer(container); |
| 441 | } |
| 442 | |
| 443 | this._cachedShadowRoot = null; |
| 444 | this._scrollableElements.unshift(container); |
| 445 | this._container = container; |
| 446 | return this; |
| 447 | } |
| 448 | |
| 449 | /** Gets the scrollable parents that are registered with this drop container. */ |
| 450 | getScrollableParents(): readonly HTMLElement[] { |
nothing calls this directly
no test coverage detected