source: trip-planner-front/node_modules/@angular/cdk/esm2015/drag-drop/drop-list-ref.js

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 126.3 KB
Line 
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8import { coerceElement } from '@angular/cdk/coercion';
9import { _getShadowRoot } from '@angular/cdk/platform';
10import { Subject, Subscription, interval, animationFrameScheduler } from 'rxjs';
11import { takeUntil } from 'rxjs/operators';
12import { moveItemInArray } from './drag-utils';
13import { isPointerNearClientRect, adjustClientRect, getMutableClientRect, isInsideClientRect, } from './client-rect';
14import { ParentPositionTracker } from './parent-position-tracker';
15import { combineTransforms } from './drag-styling';
16/**
17 * Proximity, as a ratio to width/height, at which a
18 * dragged item will affect the drop container.
19 */
20const DROP_PROXIMITY_THRESHOLD = 0.05;
21/**
22 * Proximity, as a ratio to width/height at which to start auto-scrolling the drop list or the
23 * viewport. The value comes from trying it out manually until it feels right.
24 */
25const SCROLL_PROXIMITY_THRESHOLD = 0.05;
26/**
27 * Reference to a drop list. Used to manipulate or dispose of the container.
28 */
29export class DropListRef {
30 constructor(element, _dragDropRegistry, _document, _ngZone, _viewportRuler) {
31 this._dragDropRegistry = _dragDropRegistry;
32 this._ngZone = _ngZone;
33 this._viewportRuler = _viewportRuler;
34 /** Whether starting a dragging sequence from this container is disabled. */
35 this.disabled = false;
36 /** Whether sorting items within the list is disabled. */
37 this.sortingDisabled = false;
38 /**
39 * Whether auto-scrolling the view when the user
40 * moves their pointer close to the edges is disabled.
41 */
42 this.autoScrollDisabled = false;
43 /** Number of pixels to scroll for each frame when auto-scrolling an element. */
44 this.autoScrollStep = 2;
45 /**
46 * Function that is used to determine whether an item
47 * is allowed to be moved into a drop container.
48 */
49 this.enterPredicate = () => true;
50 /** Functions that is used to determine whether an item can be sorted into a particular index. */
51 this.sortPredicate = () => true;
52 /** Emits right before dragging has started. */
53 this.beforeStarted = new Subject();
54 /**
55 * Emits when the user has moved a new drag item into this container.
56 */
57 this.entered = new Subject();
58 /**
59 * Emits when the user removes an item from the container
60 * by dragging it into another container.
61 */
62 this.exited = new Subject();
63 /** Emits when the user drops an item inside the container. */
64 this.dropped = new Subject();
65 /** Emits as the user is swapping items while actively dragging. */
66 this.sorted = new Subject();
67 /** Whether an item in the list is being dragged. */
68 this._isDragging = false;
69 /** Cache of the dimensions of all the items inside the container. */
70 this._itemPositions = [];
71 /**
72 * Keeps track of the item that was last swapped with the dragged item, as well as what direction
73 * the pointer was moving in when the swap occured and whether the user's pointer continued to
74 * overlap with the swapped item after the swapping occurred.
75 */
76 this._previousSwap = { drag: null, delta: 0, overlaps: false };
77 /** Draggable items in the container. */
78 this._draggables = [];
79 /** Drop lists that are connected to the current one. */
80 this._siblings = [];
81 /** Direction in which the list is oriented. */
82 this._orientation = 'vertical';
83 /** Connected siblings that currently have a dragged item. */
84 this._activeSiblings = new Set();
85 /** Layout direction of the drop list. */
86 this._direction = 'ltr';
87 /** Subscription to the window being scrolled. */
88 this._viewportScrollSubscription = Subscription.EMPTY;
89 /** Vertical direction in which the list is currently scrolling. */
90 this._verticalScrollDirection = 0 /* NONE */;
91 /** Horizontal direction in which the list is currently scrolling. */
92 this._horizontalScrollDirection = 0 /* NONE */;
93 /** Used to signal to the current auto-scroll sequence when to stop. */
94 this._stopScrollTimers = new Subject();
95 /** Shadow root of the current element. Necessary for `elementFromPoint` to resolve correctly. */
96 this._cachedShadowRoot = null;
97 /** Starts the interval that'll auto-scroll the element. */
98 this._startScrollInterval = () => {
99 this._stopScrolling();
100 interval(0, animationFrameScheduler)
101 .pipe(takeUntil(this._stopScrollTimers))
102 .subscribe(() => {
103 const node = this._scrollNode;
104 const scrollStep = this.autoScrollStep;
105 if (this._verticalScrollDirection === 1 /* UP */) {
106 incrementVerticalScroll(node, -scrollStep);
107 }
108 else if (this._verticalScrollDirection === 2 /* DOWN */) {
109 incrementVerticalScroll(node, scrollStep);
110 }
111 if (this._horizontalScrollDirection === 1 /* LEFT */) {
112 incrementHorizontalScroll(node, -scrollStep);
113 }
114 else if (this._horizontalScrollDirection === 2 /* RIGHT */) {
115 incrementHorizontalScroll(node, scrollStep);
116 }
117 });
118 };
119 this.element = coerceElement(element);
120 this._document = _document;
121 this.withScrollableParents([this.element]);
122 _dragDropRegistry.registerDropContainer(this);
123 this._parentPositions = new ParentPositionTracker(_document, _viewportRuler);
124 }
125 /** Removes the drop list functionality from the DOM element. */
126 dispose() {
127 this._stopScrolling();
128 this._stopScrollTimers.complete();
129 this._viewportScrollSubscription.unsubscribe();
130 this.beforeStarted.complete();
131 this.entered.complete();
132 this.exited.complete();
133 this.dropped.complete();
134 this.sorted.complete();
135 this._activeSiblings.clear();
136 this._scrollNode = null;
137 this._parentPositions.clear();
138 this._dragDropRegistry.removeDropContainer(this);
139 }
140 /** Whether an item from this list is currently being dragged. */
141 isDragging() {
142 return this._isDragging;
143 }
144 /** Starts dragging an item. */
145 start() {
146 this._draggingStarted();
147 this._notifyReceivingSiblings();
148 }
149 /**
150 * Emits an event to indicate that the user moved an item into the container.
151 * @param item Item that was moved into the container.
152 * @param pointerX Position of the item along the X axis.
153 * @param pointerY Position of the item along the Y axis.
154 * @param index Index at which the item entered. If omitted, the container will try to figure it
155 * out automatically.
156 */
157 enter(item, pointerX, pointerY, index) {
158 this._draggingStarted();
159 // If sorting is disabled, we want the item to return to its starting
160 // position if the user is returning it to its initial container.
161 let newIndex;
162 if (index == null) {
163 newIndex = this.sortingDisabled ? this._draggables.indexOf(item) : -1;
164 if (newIndex === -1) {
165 // We use the coordinates of where the item entered the drop
166 // zone to figure out at which index it should be inserted.
167 newIndex = this._getItemIndexFromPointerPosition(item, pointerX, pointerY);
168 }
169 }
170 else {
171 newIndex = index;
172 }
173 const activeDraggables = this._activeDraggables;
174 const currentIndex = activeDraggables.indexOf(item);
175 const placeholder = item.getPlaceholderElement();
176 let newPositionReference = activeDraggables[newIndex];
177 // If the item at the new position is the same as the item that is being dragged,
178 // it means that we're trying to restore the item to its initial position. In this
179 // case we should use the next item from the list as the reference.
180 if (newPositionReference === item) {
181 newPositionReference = activeDraggables[newIndex + 1];
182 }
183 // Since the item may be in the `activeDraggables` already (e.g. if the user dragged it
184 // into another container and back again), we have to ensure that it isn't duplicated.
185 if (currentIndex > -1) {
186 activeDraggables.splice(currentIndex, 1);
187 }
188 // Don't use items that are being dragged as a reference, because
189 // their element has been moved down to the bottom of the body.
190 if (newPositionReference && !this._dragDropRegistry.isDragging(newPositionReference)) {
191 const element = newPositionReference.getRootElement();
192 element.parentElement.insertBefore(placeholder, element);
193 activeDraggables.splice(newIndex, 0, item);
194 }
195 else if (this._shouldEnterAsFirstChild(pointerX, pointerY)) {
196 const reference = activeDraggables[0].getRootElement();
197 reference.parentNode.insertBefore(placeholder, reference);
198 activeDraggables.unshift(item);
199 }
200 else {
201 coerceElement(this.element).appendChild(placeholder);
202 activeDraggables.push(item);
203 }
204 // The transform needs to be cleared so it doesn't throw off the measurements.
205 placeholder.style.transform = '';
206 // Note that the positions were already cached when we called `start` above,
207 // but we need to refresh them since the amount of items has changed and also parent rects.
208 this._cacheItemPositions();
209 this._cacheParentPositions();
210 // Notify siblings at the end so that the item has been inserted into the `activeDraggables`.
211 this._notifyReceivingSiblings();
212 this.entered.next({ item, container: this, currentIndex: this.getItemIndex(item) });
213 }
214 /**
215 * Removes an item from the container after it was dragged into another container by the user.
216 * @param item Item that was dragged out.
217 */
218 exit(item) {
219 this._reset();
220 this.exited.next({ item, container: this });
221 }
222 /**
223 * Drops an item into this container.
224 * @param item Item being dropped into the container.
225 * @param currentIndex Index at which the item should be inserted.
226 * @param previousIndex Index of the item when dragging started.
227 * @param previousContainer Container from which the item got dragged in.
228 * @param isPointerOverContainer Whether the user's pointer was over the
229 * container when the item was dropped.
230 * @param distance Distance the user has dragged since the start of the dragging sequence.
231 */
232 drop(item, currentIndex, previousIndex, previousContainer, isPointerOverContainer, distance, dropPoint) {
233 this._reset();
234 this.dropped.next({
235 item,
236 currentIndex,
237 previousIndex,
238 container: this,
239 previousContainer,
240 isPointerOverContainer,
241 distance,
242 dropPoint
243 });
244 }
245 /**
246 * Sets the draggable items that are a part of this list.
247 * @param items Items that are a part of this list.
248 */
249 withItems(items) {
250 const previousItems = this._draggables;
251 this._draggables = items;
252 items.forEach(item => item._withDropContainer(this));
253 if (this.isDragging()) {
254 const draggedItems = previousItems.filter(item => item.isDragging());
255 // If all of the items being dragged were removed
256 // from the list, abort the current drag sequence.
257 if (draggedItems.every(item => items.indexOf(item) === -1)) {
258 this._reset();
259 }
260 else {
261 this._cacheItems();
262 }
263 }
264 return this;
265 }
266 /** Sets the layout direction of the drop list. */
267 withDirection(direction) {
268 this._direction = direction;
269 return this;
270 }
271 /**
272 * Sets the containers that are connected to this one. When two or more containers are
273 * connected, the user will be allowed to transfer items between them.
274 * @param connectedTo Other containers that the current containers should be connected to.
275 */
276 connectedTo(connectedTo) {
277 this._siblings = connectedTo.slice();
278 return this;
279 }
280 /**
281 * Sets the orientation of the container.
282 * @param orientation New orientation for the container.
283 */
284 withOrientation(orientation) {
285 this._orientation = orientation;
286 return this;
287 }
288 /**
289 * Sets which parent elements are can be scrolled while the user is dragging.
290 * @param elements Elements that can be scrolled.
291 */
292 withScrollableParents(elements) {
293 const element = coerceElement(this.element);
294 // We always allow the current element to be scrollable
295 // so we need to ensure that it's in the array.
296 this._scrollableElements =
297 elements.indexOf(element) === -1 ? [element, ...elements] : elements.slice();
298 return this;
299 }
300 /** Gets the scrollable parents that are registered with this drop container. */
301 getScrollableParents() {
302 return this._scrollableElements;
303 }
304 /**
305 * Figures out the index of an item in the container.
306 * @param item Item whose index should be determined.
307 */
308 getItemIndex(item) {
309 if (!this._isDragging) {
310 return this._draggables.indexOf(item);
311 }
312 // Items are sorted always by top/left in the cache, however they flow differently in RTL.
313 // The rest of the logic still stands no matter what orientation we're in, however
314 // we need to invert the array when determining the index.
315 const items = this._orientation === 'horizontal' && this._direction === 'rtl' ?
316 this._itemPositions.slice().reverse() : this._itemPositions;
317 return findIndex(items, currentItem => currentItem.drag === item);
318 }
319 /**
320 * Whether the list is able to receive the item that
321 * is currently being dragged inside a connected drop list.
322 */
323 isReceiving() {
324 return this._activeSiblings.size > 0;
325 }
326 /**
327 * Sorts an item inside the container based on its position.
328 * @param item Item to be sorted.
329 * @param pointerX Position of the item along the X axis.
330 * @param pointerY Position of the item along the Y axis.
331 * @param pointerDelta Direction in which the pointer is moving along each axis.
332 */
333 _sortItem(item, pointerX, pointerY, pointerDelta) {
334 // Don't sort the item if sorting is disabled or it's out of range.
335 if (this.sortingDisabled || !this._clientRect ||
336 !isPointerNearClientRect(this._clientRect, DROP_PROXIMITY_THRESHOLD, pointerX, pointerY)) {
337 return;
338 }
339 const siblings = this._itemPositions;
340 const newIndex = this._getItemIndexFromPointerPosition(item, pointerX, pointerY, pointerDelta);
341 if (newIndex === -1 && siblings.length > 0) {
342 return;
343 }
344 const isHorizontal = this._orientation === 'horizontal';
345 const currentIndex = findIndex(siblings, currentItem => currentItem.drag === item);
346 const siblingAtNewPosition = siblings[newIndex];
347 const currentPosition = siblings[currentIndex].clientRect;
348 const newPosition = siblingAtNewPosition.clientRect;
349 const delta = currentIndex > newIndex ? 1 : -1;
350 // How many pixels the item's placeholder should be offset.
351 const itemOffset = this._getItemOffsetPx(currentPosition, newPosition, delta);
352 // How many pixels all the other items should be offset.
353 const siblingOffset = this._getSiblingOffsetPx(currentIndex, siblings, delta);
354 // Save the previous order of the items before moving the item to its new index.
355 // We use this to check whether an item has been moved as a result of the sorting.
356 const oldOrder = siblings.slice();
357 // Shuffle the array in place.
358 moveItemInArray(siblings, currentIndex, newIndex);
359 this.sorted.next({
360 previousIndex: currentIndex,
361 currentIndex: newIndex,
362 container: this,
363 item
364 });
365 siblings.forEach((sibling, index) => {
366 // Don't do anything if the position hasn't changed.
367 if (oldOrder[index] === sibling) {
368 return;
369 }
370 const isDraggedItem = sibling.drag === item;
371 const offset = isDraggedItem ? itemOffset : siblingOffset;
372 const elementToOffset = isDraggedItem ? item.getPlaceholderElement() :
373 sibling.drag.getRootElement();
374 // Update the offset to reflect the new position.
375 sibling.offset += offset;
376 // Since we're moving the items with a `transform`, we need to adjust their cached
377 // client rects to reflect their new position, as well as swap their positions in the cache.
378 // Note that we shouldn't use `getBoundingClientRect` here to update the cache, because the
379 // elements may be mid-animation which will give us a wrong result.
380 if (isHorizontal) {
381 // Round the transforms since some browsers will
382 // blur the elements, for sub-pixel transforms.
383 elementToOffset.style.transform = combineTransforms(`translate3d(${Math.round(sibling.offset)}px, 0, 0)`, sibling.initialTransform);
384 adjustClientRect(sibling.clientRect, 0, offset);
385 }
386 else {
387 elementToOffset.style.transform = combineTransforms(`translate3d(0, ${Math.round(sibling.offset)}px, 0)`, sibling.initialTransform);
388 adjustClientRect(sibling.clientRect, offset, 0);
389 }
390 });
391 // Note that it's important that we do this after the client rects have been adjusted.
392 this._previousSwap.overlaps = isInsideClientRect(newPosition, pointerX, pointerY);
393 this._previousSwap.drag = siblingAtNewPosition.drag;
394 this._previousSwap.delta = isHorizontal ? pointerDelta.x : pointerDelta.y;
395 }
396 /**
397 * Checks whether the user's pointer is close to the edges of either the
398 * viewport or the drop list and starts the auto-scroll sequence.
399 * @param pointerX User's pointer position along the x axis.
400 * @param pointerY User's pointer position along the y axis.
401 */
402 _startScrollingIfNecessary(pointerX, pointerY) {
403 if (this.autoScrollDisabled) {
404 return;
405 }
406 let scrollNode;
407 let verticalScrollDirection = 0 /* NONE */;
408 let horizontalScrollDirection = 0 /* NONE */;
409 // Check whether we should start scrolling any of the parent containers.
410 this._parentPositions.positions.forEach((position, element) => {
411 // We have special handling for the `document` below. Also this would be
412 // nicer with a for...of loop, but it requires changing a compiler flag.
413 if (element === this._document || !position.clientRect || scrollNode) {
414 return;
415 }
416 if (isPointerNearClientRect(position.clientRect, DROP_PROXIMITY_THRESHOLD, pointerX, pointerY)) {
417 [verticalScrollDirection, horizontalScrollDirection] = getElementScrollDirections(element, position.clientRect, pointerX, pointerY);
418 if (verticalScrollDirection || horizontalScrollDirection) {
419 scrollNode = element;
420 }
421 }
422 });
423 // Otherwise check if we can start scrolling the viewport.
424 if (!verticalScrollDirection && !horizontalScrollDirection) {
425 const { width, height } = this._viewportRuler.getViewportSize();
426 const clientRect = { width, height, top: 0, right: width, bottom: height, left: 0 };
427 verticalScrollDirection = getVerticalScrollDirection(clientRect, pointerY);
428 horizontalScrollDirection = getHorizontalScrollDirection(clientRect, pointerX);
429 scrollNode = window;
430 }
431 if (scrollNode && (verticalScrollDirection !== this._verticalScrollDirection ||
432 horizontalScrollDirection !== this._horizontalScrollDirection ||
433 scrollNode !== this._scrollNode)) {
434 this._verticalScrollDirection = verticalScrollDirection;
435 this._horizontalScrollDirection = horizontalScrollDirection;
436 this._scrollNode = scrollNode;
437 if ((verticalScrollDirection || horizontalScrollDirection) && scrollNode) {
438 this._ngZone.runOutsideAngular(this._startScrollInterval);
439 }
440 else {
441 this._stopScrolling();
442 }
443 }
444 }
445 /** Stops any currently-running auto-scroll sequences. */
446 _stopScrolling() {
447 this._stopScrollTimers.next();
448 }
449 /** Starts the dragging sequence within the list. */
450 _draggingStarted() {
451 const styles = coerceElement(this.element).style;
452 this.beforeStarted.next();
453 this._isDragging = true;
454 // We need to disable scroll snapping while the user is dragging, because it breaks automatic
455 // scrolling. The browser seems to round the value based on the snapping points which means
456 // that we can't increment/decrement the scroll position.
457 this._initialScrollSnap = styles.msScrollSnapType || styles.scrollSnapType || '';
458 styles.scrollSnapType = styles.msScrollSnapType = 'none';
459 this._cacheItems();
460 this._viewportScrollSubscription.unsubscribe();
461 this._listenToScrollEvents();
462 }
463 /** Caches the positions of the configured scrollable parents. */
464 _cacheParentPositions() {
465 const element = coerceElement(this.element);
466 this._parentPositions.cache(this._scrollableElements);
467 // The list element is always in the `scrollableElements`
468 // so we can take advantage of the cached `ClientRect`.
469 this._clientRect = this._parentPositions.positions.get(element).clientRect;
470 }
471 /** Refreshes the position cache of the items and sibling containers. */
472 _cacheItemPositions() {
473 const isHorizontal = this._orientation === 'horizontal';
474 this._itemPositions = this._activeDraggables.map(drag => {
475 const elementToMeasure = drag.getVisibleElement();
476 return {
477 drag,
478 offset: 0,
479 initialTransform: elementToMeasure.style.transform || '',
480 clientRect: getMutableClientRect(elementToMeasure),
481 };
482 }).sort((a, b) => {
483 return isHorizontal ? a.clientRect.left - b.clientRect.left :
484 a.clientRect.top - b.clientRect.top;
485 });
486 }
487 /** Resets the container to its initial state. */
488 _reset() {
489 this._isDragging = false;
490 const styles = coerceElement(this.element).style;
491 styles.scrollSnapType = styles.msScrollSnapType = this._initialScrollSnap;
492 // TODO(crisbeto): may have to wait for the animations to finish.
493 this._activeDraggables.forEach(item => {
494 var _a;
495 const rootElement = item.getRootElement();
496 if (rootElement) {
497 const initialTransform = (_a = this._itemPositions
498 .find(current => current.drag === item)) === null || _a === void 0 ? void 0 : _a.initialTransform;
499 rootElement.style.transform = initialTransform || '';
500 }
501 });
502 this._siblings.forEach(sibling => sibling._stopReceiving(this));
503 this._activeDraggables = [];
504 this._itemPositions = [];
505 this._previousSwap.drag = null;
506 this._previousSwap.delta = 0;
507 this._previousSwap.overlaps = false;
508 this._stopScrolling();
509 this._viewportScrollSubscription.unsubscribe();
510 this._parentPositions.clear();
511 }
512 /**
513 * Gets the offset in pixels by which the items that aren't being dragged should be moved.
514 * @param currentIndex Index of the item currently being dragged.
515 * @param siblings All of the items in the list.
516 * @param delta Direction in which the user is moving.
517 */
518 _getSiblingOffsetPx(currentIndex, siblings, delta) {
519 const isHorizontal = this._orientation === 'horizontal';
520 const currentPosition = siblings[currentIndex].clientRect;
521 const immediateSibling = siblings[currentIndex + delta * -1];
522 let siblingOffset = currentPosition[isHorizontal ? 'width' : 'height'] * delta;
523 if (immediateSibling) {
524 const start = isHorizontal ? 'left' : 'top';
525 const end = isHorizontal ? 'right' : 'bottom';
526 // Get the spacing between the start of the current item and the end of the one immediately
527 // after it in the direction in which the user is dragging, or vice versa. We add it to the
528 // offset in order to push the element to where it will be when it's inline and is influenced
529 // by the `margin` of its siblings.
530 if (delta === -1) {
531 siblingOffset -= immediateSibling.clientRect[start] - currentPosition[end];
532 }
533 else {
534 siblingOffset += currentPosition[start] - immediateSibling.clientRect[end];
535 }
536 }
537 return siblingOffset;
538 }
539 /**
540 * Gets the offset in pixels by which the item that is being dragged should be moved.
541 * @param currentPosition Current position of the item.
542 * @param newPosition Position of the item where the current item should be moved.
543 * @param delta Direction in which the user is moving.
544 */
545 _getItemOffsetPx(currentPosition, newPosition, delta) {
546 const isHorizontal = this._orientation === 'horizontal';
547 let itemOffset = isHorizontal ? newPosition.left - currentPosition.left :
548 newPosition.top - currentPosition.top;
549 // Account for differences in the item width/height.
550 if (delta === -1) {
551 itemOffset += isHorizontal ? newPosition.width - currentPosition.width :
552 newPosition.height - currentPosition.height;
553 }
554 return itemOffset;
555 }
556 /**
557 * Checks if pointer is entering in the first position
558 * @param pointerX Position of the user's pointer along the X axis.
559 * @param pointerY Position of the user's pointer along the Y axis.
560 */
561 _shouldEnterAsFirstChild(pointerX, pointerY) {
562 if (!this._activeDraggables.length) {
563 return false;
564 }
565 const itemPositions = this._itemPositions;
566 const isHorizontal = this._orientation === 'horizontal';
567 // `itemPositions` are sorted by position while `activeDraggables` are sorted by child index
568 // check if container is using some sort of "reverse" ordering (eg: flex-direction: row-reverse)
569 const reversed = itemPositions[0].drag !== this._activeDraggables[0];
570 if (reversed) {
571 const lastItemRect = itemPositions[itemPositions.length - 1].clientRect;
572 return isHorizontal ? pointerX >= lastItemRect.right : pointerY >= lastItemRect.bottom;
573 }
574 else {
575 const firstItemRect = itemPositions[0].clientRect;
576 return isHorizontal ? pointerX <= firstItemRect.left : pointerY <= firstItemRect.top;
577 }
578 }
579 /**
580 * Gets the index of an item in the drop container, based on the position of the user's pointer.
581 * @param item Item that is being sorted.
582 * @param pointerX Position of the user's pointer along the X axis.
583 * @param pointerY Position of the user's pointer along the Y axis.
584 * @param delta Direction in which the user is moving their pointer.
585 */
586 _getItemIndexFromPointerPosition(item, pointerX, pointerY, delta) {
587 const isHorizontal = this._orientation === 'horizontal';
588 const index = findIndex(this._itemPositions, ({ drag, clientRect }, _, array) => {
589 if (drag === item) {
590 // If there's only one item left in the container, it must be
591 // the dragged item itself so we use it as a reference.
592 return array.length < 2;
593 }
594 if (delta) {
595 const direction = isHorizontal ? delta.x : delta.y;
596 // If the user is still hovering over the same item as last time, their cursor hasn't left
597 // the item after we made the swap, and they didn't change the direction in which they're
598 // dragging, we don't consider it a direction swap.
599 if (drag === this._previousSwap.drag && this._previousSwap.overlaps &&
600 direction === this._previousSwap.delta) {
601 return false;
602 }
603 }
604 return isHorizontal ?
605 // Round these down since most browsers report client rects with
606 // sub-pixel precision, whereas the pointer coordinates are rounded to pixels.
607 pointerX >= Math.floor(clientRect.left) && pointerX < Math.floor(clientRect.right) :
608 pointerY >= Math.floor(clientRect.top) && pointerY < Math.floor(clientRect.bottom);
609 });
610 return (index === -1 || !this.sortPredicate(index, item, this)) ? -1 : index;
611 }
612 /** Caches the current items in the list and their positions. */
613 _cacheItems() {
614 this._activeDraggables = this._draggables.slice();
615 this._cacheItemPositions();
616 this._cacheParentPositions();
617 }
618 /**
619 * Checks whether the user's pointer is positioned over the container.
620 * @param x Pointer position along the X axis.
621 * @param y Pointer position along the Y axis.
622 */
623 _isOverContainer(x, y) {
624 return this._clientRect != null && isInsideClientRect(this._clientRect, x, y);
625 }
626 /**
627 * Figures out whether an item should be moved into a sibling
628 * drop container, based on its current position.
629 * @param item Drag item that is being moved.
630 * @param x Position of the item along the X axis.
631 * @param y Position of the item along the Y axis.
632 */
633 _getSiblingContainerFromPosition(item, x, y) {
634 return this._siblings.find(sibling => sibling._canReceive(item, x, y));
635 }
636 /**
637 * Checks whether the drop list can receive the passed-in item.
638 * @param item Item that is being dragged into the list.
639 * @param x Position of the item along the X axis.
640 * @param y Position of the item along the Y axis.
641 */
642 _canReceive(item, x, y) {
643 if (!this._clientRect || !isInsideClientRect(this._clientRect, x, y) ||
644 !this.enterPredicate(item, this)) {
645 return false;
646 }
647 const elementFromPoint = this._getShadowRoot().elementFromPoint(x, y);
648 // If there's no element at the pointer position, then
649 // the client rect is probably scrolled out of the view.
650 if (!elementFromPoint) {
651 return false;
652 }
653 const nativeElement = coerceElement(this.element);
654 // The `ClientRect`, that we're using to find the container over which the user is
655 // hovering, doesn't give us any information on whether the element has been scrolled
656 // out of the view or whether it's overlapping with other containers. This means that
657 // we could end up transferring the item into a container that's invisible or is positioned
658 // below another one. We use the result from `elementFromPoint` to get the top-most element
659 // at the pointer position and to find whether it's one of the intersecting drop containers.
660 return elementFromPoint === nativeElement || nativeElement.contains(elementFromPoint);
661 }
662 /**
663 * Called by one of the connected drop lists when a dragging sequence has started.
664 * @param sibling Sibling in which dragging has started.
665 */
666 _startReceiving(sibling, items) {
667 const activeSiblings = this._activeSiblings;
668 if (!activeSiblings.has(sibling) && items.every(item => {
669 // Note that we have to add an exception to the `enterPredicate` for items that started off
670 // in this drop list. The drag ref has logic that allows an item to return to its initial
671 // container, if it has left the initial container and none of the connected containers
672 // allow it to enter. See `DragRef._updateActiveDropContainer` for more context.
673 return this.enterPredicate(item, this) || this._draggables.indexOf(item) > -1;
674 })) {
675 activeSiblings.add(sibling);
676 this._cacheParentPositions();
677 this._listenToScrollEvents();
678 }
679 }
680 /**
681 * Called by a connected drop list when dragging has stopped.
682 * @param sibling Sibling whose dragging has stopped.
683 */
684 _stopReceiving(sibling) {
685 this._activeSiblings.delete(sibling);
686 this._viewportScrollSubscription.unsubscribe();
687 }
688 /**
689 * Starts listening to scroll events on the viewport.
690 * Used for updating the internal state of the list.
691 */
692 _listenToScrollEvents() {
693 this._viewportScrollSubscription = this._dragDropRegistry
694 .scrolled(this._getShadowRoot())
695 .subscribe(event => {
696 if (this.isDragging()) {
697 const scrollDifference = this._parentPositions.handleScroll(event);
698 if (scrollDifference) {
699 // Since we know the amount that the user has scrolled we can shift all of the
700 // client rectangles ourselves. This is cheaper than re-measuring everything and
701 // we can avoid inconsistent behavior where we might be measuring the element before
702 // its position has changed.
703 this._itemPositions.forEach(({ clientRect }) => {
704 adjustClientRect(clientRect, scrollDifference.top, scrollDifference.left);
705 });
706 // We need two loops for this, because we want all of the cached
707 // positions to be up-to-date before we re-sort the item.
708 this._itemPositions.forEach(({ drag }) => {
709 if (this._dragDropRegistry.isDragging(drag)) {
710 // We need to re-sort the item manually, because the pointer move
711 // events won't be dispatched while the user is scrolling.
712 drag._sortFromLastPointerPosition();
713 }
714 });
715 }
716 }
717 else if (this.isReceiving()) {
718 this._cacheParentPositions();
719 }
720 });
721 }
722 /**
723 * Lazily resolves and returns the shadow root of the element. We do this in a function, rather
724 * than saving it in property directly on init, because we want to resolve it as late as possible
725 * in order to ensure that the element has been moved into the shadow DOM. Doing it inside the
726 * constructor might be too early if the element is inside of something like `ngFor` or `ngIf`.
727 */
728 _getShadowRoot() {
729 if (!this._cachedShadowRoot) {
730 const shadowRoot = _getShadowRoot(coerceElement(this.element));
731 this._cachedShadowRoot = shadowRoot || this._document;
732 }
733 return this._cachedShadowRoot;
734 }
735 /** Notifies any siblings that may potentially receive the item. */
736 _notifyReceivingSiblings() {
737 const draggedItems = this._activeDraggables.filter(item => item.isDragging());
738 this._siblings.forEach(sibling => sibling._startReceiving(this, draggedItems));
739 }
740}
741/**
742 * Finds the index of an item that matches a predicate function. Used as an equivalent
743 * of `Array.prototype.findIndex` which isn't part of the standard Google typings.
744 * @param array Array in which to look for matches.
745 * @param predicate Function used to determine whether an item is a match.
746 */
747function findIndex(array, predicate) {
748 for (let i = 0; i < array.length; i++) {
749 if (predicate(array[i], i, array)) {
750 return i;
751 }
752 }
753 return -1;
754}
755/**
756 * Increments the vertical scroll position of a node.
757 * @param node Node whose scroll position should change.
758 * @param amount Amount of pixels that the `node` should be scrolled.
759 */
760function incrementVerticalScroll(node, amount) {
761 if (node === window) {
762 node.scrollBy(0, amount);
763 }
764 else {
765 // Ideally we could use `Element.scrollBy` here as well, but IE and Edge don't support it.
766 node.scrollTop += amount;
767 }
768}
769/**
770 * Increments the horizontal scroll position of a node.
771 * @param node Node whose scroll position should change.
772 * @param amount Amount of pixels that the `node` should be scrolled.
773 */
774function incrementHorizontalScroll(node, amount) {
775 if (node === window) {
776 node.scrollBy(amount, 0);
777 }
778 else {
779 // Ideally we could use `Element.scrollBy` here as well, but IE and Edge don't support it.
780 node.scrollLeft += amount;
781 }
782}
783/**
784 * Gets whether the vertical auto-scroll direction of a node.
785 * @param clientRect Dimensions of the node.
786 * @param pointerY Position of the user's pointer along the y axis.
787 */
788function getVerticalScrollDirection(clientRect, pointerY) {
789 const { top, bottom, height } = clientRect;
790 const yThreshold = height * SCROLL_PROXIMITY_THRESHOLD;
791 if (pointerY >= top - yThreshold && pointerY <= top + yThreshold) {
792 return 1 /* UP */;
793 }
794 else if (pointerY >= bottom - yThreshold && pointerY <= bottom + yThreshold) {
795 return 2 /* DOWN */;
796 }
797 return 0 /* NONE */;
798}
799/**
800 * Gets whether the horizontal auto-scroll direction of a node.
801 * @param clientRect Dimensions of the node.
802 * @param pointerX Position of the user's pointer along the x axis.
803 */
804function getHorizontalScrollDirection(clientRect, pointerX) {
805 const { left, right, width } = clientRect;
806 const xThreshold = width * SCROLL_PROXIMITY_THRESHOLD;
807 if (pointerX >= left - xThreshold && pointerX <= left + xThreshold) {
808 return 1 /* LEFT */;
809 }
810 else if (pointerX >= right - xThreshold && pointerX <= right + xThreshold) {
811 return 2 /* RIGHT */;
812 }
813 return 0 /* NONE */;
814}
815/**
816 * Gets the directions in which an element node should be scrolled,
817 * assuming that the user's pointer is already within it scrollable region.
818 * @param element Element for which we should calculate the scroll direction.
819 * @param clientRect Bounding client rectangle of the element.
820 * @param pointerX Position of the user's pointer along the x axis.
821 * @param pointerY Position of the user's pointer along the y axis.
822 */
823function getElementScrollDirections(element, clientRect, pointerX, pointerY) {
824 const computedVertical = getVerticalScrollDirection(clientRect, pointerY);
825 const computedHorizontal = getHorizontalScrollDirection(clientRect, pointerX);
826 let verticalScrollDirection = 0 /* NONE */;
827 let horizontalScrollDirection = 0 /* NONE */;
828 // Note that we here we do some extra checks for whether the element is actually scrollable in
829 // a certain direction and we only assign the scroll direction if it is. We do this so that we
830 // can allow other elements to be scrolled, if the current element can't be scrolled anymore.
831 // This allows us to handle cases where the scroll regions of two scrollable elements overlap.
832 if (computedVertical) {
833 const scrollTop = element.scrollTop;
834 if (computedVertical === 1 /* UP */) {
835 if (scrollTop > 0) {
836 verticalScrollDirection = 1 /* UP */;
837 }
838 }
839 else if (element.scrollHeight - scrollTop > element.clientHeight) {
840 verticalScrollDirection = 2 /* DOWN */;
841 }
842 }
843 if (computedHorizontal) {
844 const scrollLeft = element.scrollLeft;
845 if (computedHorizontal === 1 /* LEFT */) {
846 if (scrollLeft > 0) {
847 horizontalScrollDirection = 1 /* LEFT */;
848 }
849 }
850 else if (element.scrollWidth - scrollLeft > element.clientWidth) {
851 horizontalScrollDirection = 2 /* RIGHT */;
852 }
853 }
854 return [verticalScrollDirection, horizontalScrollDirection];
855}
856//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZHJvcC1saXN0LXJlZi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3NyYy9jZGsvZHJhZy1kcm9wL2Ryb3AtbGlzdC1yZWYudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HO0FBSUgsT0FBTyxFQUFDLGFBQWEsRUFBQyxNQUFNLHVCQUF1QixDQUFDO0FBRXBELE9BQU8sRUFBQyxjQUFjLEVBQUMsTUFBTSx1QkFBdUIsQ0FBQztBQUNyRCxPQUFPLEVBQUMsT0FBTyxFQUFFLFlBQVksRUFBRSxRQUFRLEVBQUUsdUJBQXVCLEVBQUMsTUFBTSxNQUFNLENBQUM7QUFDOUUsT0FBTyxFQUFDLFNB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