@angular/cdk 8.1.4 → 8.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/a11y/typings/index.metadata.json +1 -1
- package/a11y/typings/key-manager/focus-key-manager.d.ts +1 -1
- package/bundles/cdk-a11y.umd.js +10 -2
- package/bundles/cdk-a11y.umd.js.map +1 -1
- package/bundles/cdk-a11y.umd.min.js +1 -1
- package/bundles/cdk-a11y.umd.min.js.map +1 -1
- package/bundles/cdk-drag-drop.umd.js +239 -36
- package/bundles/cdk-drag-drop.umd.js.map +1 -1
- package/bundles/cdk-drag-drop.umd.min.js +2 -2
- package/bundles/cdk-drag-drop.umd.min.js.map +1 -1
- package/bundles/cdk-overlay.umd.js +15 -8
- package/bundles/cdk-overlay.umd.js.map +1 -1
- package/bundles/cdk-overlay.umd.min.js +2 -2
- package/bundles/cdk-overlay.umd.min.js.map +1 -1
- package/bundles/cdk-platform.umd.js +21 -0
- package/bundles/cdk-platform.umd.js.map +1 -1
- package/bundles/cdk-platform.umd.min.js +1 -1
- package/bundles/cdk-platform.umd.min.js.map +1 -1
- package/bundles/cdk-scrolling.umd.js +1 -1
- package/bundles/cdk-scrolling.umd.js.map +1 -1
- package/bundles/cdk-scrolling.umd.min.js.map +1 -1
- package/bundles/cdk-stepper.umd.js +46 -40
- package/bundles/cdk-stepper.umd.js.map +1 -1
- package/bundles/cdk-stepper.umd.min.js +1 -1
- package/bundles/cdk-stepper.umd.min.js.map +1 -1
- package/bundles/cdk-table.umd.js +4 -4
- package/bundles/cdk-table.umd.js.map +1 -1
- package/bundles/cdk-table.umd.min.js.map +1 -1
- package/bundles/cdk-testing.umd.js +404 -0
- package/bundles/cdk-testing.umd.js.map +1 -0
- package/bundles/cdk-testing.umd.min.js +9 -0
- package/bundles/cdk-testing.umd.min.js.map +1 -0
- package/bundles/cdk-text-field.umd.js +3 -3
- package/bundles/cdk-text-field.umd.js.map +1 -1
- package/bundles/cdk-text-field.umd.min.js.map +1 -1
- package/bundles/cdk.umd.js +1 -1
- package/bundles/cdk.umd.js.map +1 -1
- package/bundles/cdk.umd.min.js +1 -1
- package/bundles/cdk.umd.min.js.map +1 -1
- package/drag-drop/typings/drag-ref.d.ts +9 -0
- package/drag-drop/typings/drop-list-ref.d.ts +7 -1
- package/drag-drop/typings/index.metadata.json +1 -1
- package/esm2015/a11y.js +10 -2
- package/esm2015/a11y.js.map +1 -1
- package/esm2015/cdk.js +1 -1
- package/esm2015/cdk.js.map +1 -1
- package/esm2015/drag-drop.js +212 -37
- package/esm2015/drag-drop.js.map +1 -1
- package/esm2015/overlay.js +13 -6
- package/esm2015/overlay.js.map +1 -1
- package/esm2015/platform.js +21 -1
- package/esm2015/platform.js.map +1 -1
- package/esm2015/scrolling.js +1 -1
- package/esm2015/scrolling.js.map +1 -1
- package/esm2015/stepper.js +51 -45
- package/esm2015/stepper.js.map +1 -1
- package/esm2015/table.js +4 -4
- package/esm2015/table.js.map +1 -1
- package/esm2015/testing.js +370 -0
- package/esm2015/testing.js.map +1 -0
- package/esm2015/text-field.js +1 -1
- package/esm2015/text-field.js.map +1 -1
- package/esm5/a11y.es5.js +10 -2
- package/esm5/a11y.es5.js.map +1 -1
- package/esm5/cdk.es5.js +1 -1
- package/esm5/cdk.es5.js.map +1 -1
- package/esm5/drag-drop.es5.js +241 -38
- package/esm5/drag-drop.es5.js.map +1 -1
- package/esm5/overlay.es5.js +15 -8
- package/esm5/overlay.es5.js.map +1 -1
- package/esm5/platform.es5.js +21 -1
- package/esm5/platform.es5.js.map +1 -1
- package/esm5/scrolling.es5.js +1 -1
- package/esm5/scrolling.es5.js.map +1 -1
- package/esm5/stepper.es5.js +49 -43
- package/esm5/stepper.es5.js.map +1 -1
- package/esm5/table.es5.js +4 -4
- package/esm5/table.es5.js.map +1 -1
- package/esm5/testing.es5.js +390 -0
- package/esm5/testing.es5.js.map +1 -0
- package/esm5/text-field.es5.js +3 -3
- package/esm5/text-field.es5.js.map +1 -1
- package/overlay/typings/index.metadata.json +1 -1
- package/overlay/typings/position/flexible-connected-position-strategy.d.ts +5 -2
- package/overlay/typings/public-api.d.ts +1 -1
- package/package.json +4 -4
- package/platform/typings/features/shadow-dom.d.ts +9 -0
- package/platform/typings/index.metadata.json +1 -1
- package/platform/typings/public-api.d.ts +1 -0
- package/schematics/ng-update/index.js +2 -2
- package/schematics/ng-update/index.js.map +1 -1
- package/schematics/ng-update/test-cases/misc/global-stylesheets-test.css +1 -0
- package/schematics/ng-update/upgrade-rules/class-inheritance-rule.js +3 -3
- package/schematics/ng-update/upgrade-rules/class-inheritance-rule.js.map +1 -1
- package/schematics/tsconfig.tsbuildinfo +2898 -2898
- package/schematics/update-tool/index.js +9 -5
- package/schematics/update-tool/index.js.map +1 -1
- package/scrolling/typings/virtual-scroll-viewport.d.ts +1 -1
- package/stepper/typings/index.metadata.json +1 -1
- package/stepper/typings/stepper.d.ts +3 -3
- package/table/typings/table.d.ts +4 -4
- package/testing/index.d.ts +8 -0
- package/testing/index.metadata.json +12 -0
- package/testing/package.json +8 -0
- package/testing/typings/dispatch-events.d.ts +33 -0
- package/testing/typings/element-focus.d.ts +18 -0
- package/testing/typings/event-objects.d.ts +34 -0
- package/testing/typings/index.d.ts +4 -0
- package/testing/typings/index.metadata.json +1 -0
- package/testing/typings/public-api.d.ts +11 -0
- package/testing/typings/type-in-element.d.ts +41 -0
- package/testing.d.ts +8 -0
- package/testing.metadata.json +12 -0
- package/text-field/typings/autosize.d.ts +1 -1
- package/typings/a11y/index.metadata.json +1 -1
- package/typings/a11y/key-manager/focus-key-manager.d.ts +1 -1
- package/typings/drag-drop/drag-ref.d.ts +9 -0
- package/typings/drag-drop/drop-list-ref.d.ts +7 -1
- package/typings/drag-drop/index.metadata.json +1 -1
- package/typings/esm5/a11y/index.metadata.json +1 -1
- package/typings/esm5/a11y/key-manager/focus-key-manager.d.ts +1 -1
- package/typings/esm5/drag-drop/drag-ref.d.ts +9 -0
- package/typings/esm5/drag-drop/drop-list-ref.d.ts +7 -1
- package/typings/esm5/drag-drop/index.metadata.json +1 -1
- package/typings/esm5/index.metadata.json +1 -1
- package/typings/esm5/overlay/index.metadata.json +1 -1
- package/typings/esm5/overlay/position/flexible-connected-position-strategy.d.ts +5 -2
- package/typings/esm5/overlay/public-api.d.ts +1 -1
- package/typings/esm5/platform/features/shadow-dom.d.ts +9 -0
- package/typings/esm5/platform/index.metadata.json +1 -1
- package/typings/esm5/platform/public-api.d.ts +1 -0
- package/typings/esm5/scrolling/virtual-scroll-viewport.d.ts +1 -1
- package/typings/esm5/stepper/index.metadata.json +1 -1
- package/typings/esm5/stepper/stepper.d.ts +3 -3
- package/typings/esm5/table/table.d.ts +4 -4
- package/typings/esm5/testing/dispatch-events.d.ts +33 -0
- package/typings/esm5/testing/element-focus.d.ts +18 -0
- package/typings/esm5/testing/event-objects.d.ts +34 -0
- package/typings/esm5/testing/index.d.ts +4 -0
- package/typings/esm5/testing/index.metadata.json +1 -0
- package/typings/esm5/testing/public-api.d.ts +11 -0
- package/typings/esm5/testing/type-in-element.d.ts +41 -0
- package/typings/esm5/text-field/autosize.d.ts +1 -1
- package/typings/index.metadata.json +1 -1
- package/typings/overlay/index.metadata.json +1 -1
- package/typings/overlay/position/flexible-connected-position-strategy.d.ts +5 -2
- package/typings/overlay/public-api.d.ts +1 -1
- package/typings/platform/features/shadow-dom.d.ts +9 -0
- package/typings/platform/index.metadata.json +1 -1
- package/typings/platform/public-api.d.ts +1 -0
- package/typings/scrolling/virtual-scroll-viewport.d.ts +1 -1
- package/typings/stepper/index.metadata.json +1 -1
- package/typings/stepper/stepper.d.ts +3 -3
- package/typings/table/table.d.ts +4 -4
- package/typings/testing/dispatch-events.d.ts +33 -0
- package/typings/testing/element-focus.d.ts +18 -0
- package/typings/testing/event-objects.d.ts +34 -0
- package/typings/testing/index.d.ts +4 -0
- package/typings/testing/index.metadata.json +1 -0
- package/typings/testing/public-api.d.ts +11 -0
- package/typings/testing/type-in-element.d.ts +41 -0
- package/typings/text-field/autosize.d.ts +1 -1
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
function extendStyles(dest, source) {
|
|
26
26
|
for (var key in source) {
|
|
27
27
|
if (source.hasOwnProperty(key)) {
|
|
28
|
-
dest[
|
|
28
|
+
dest[key] = (/** @type {?} */ (source[key]));
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
return dest;
|
|
@@ -181,6 +181,10 @@ DragRef = /** @class */ (function () {
|
|
|
181
181
|
* Subscription to the viewport being scrolled.
|
|
182
182
|
*/
|
|
183
183
|
this._scrollSubscription = rxjs.Subscription.EMPTY;
|
|
184
|
+
/**
|
|
185
|
+
* Subscription to the viewport being resized.
|
|
186
|
+
*/
|
|
187
|
+
this._resizeSubscription = rxjs.Subscription.EMPTY;
|
|
184
188
|
/**
|
|
185
189
|
* Cached reference to the boundary element.
|
|
186
190
|
*/
|
|
@@ -553,7 +557,17 @@ DragRef = /** @class */ (function () {
|
|
|
553
557
|
* @return {THIS}
|
|
554
558
|
*/
|
|
555
559
|
function (boundaryElement) {
|
|
560
|
+
var _this = this;
|
|
556
561
|
(/** @type {?} */ (this))._boundaryElement = boundaryElement ? coercion.coerceElement(boundaryElement) : null;
|
|
562
|
+
(/** @type {?} */ (this))._resizeSubscription.unsubscribe();
|
|
563
|
+
if (boundaryElement) {
|
|
564
|
+
(/** @type {?} */ (this))._resizeSubscription = (/** @type {?} */ (this))._viewportRuler
|
|
565
|
+
.change(10)
|
|
566
|
+
.subscribe((/**
|
|
567
|
+
* @return {?}
|
|
568
|
+
*/
|
|
569
|
+
function () { return (/** @type {?} */ (_this))._containInsideBoundaryOnResize(); }));
|
|
570
|
+
}
|
|
557
571
|
return (/** @type {?} */ (this));
|
|
558
572
|
};
|
|
559
573
|
/** Removes the dragging functionality from the DOM element. */
|
|
@@ -829,6 +843,7 @@ DragRef = /** @class */ (function () {
|
|
|
829
843
|
}
|
|
830
844
|
this._removeSubscriptions();
|
|
831
845
|
this._dragDropRegistry.stopDragging(this);
|
|
846
|
+
this._toggleNativeDragInteractions();
|
|
832
847
|
if (this._handles) {
|
|
833
848
|
this._rootElement.style.webkitTapHighlightColor = this._rootElementTapHighlight;
|
|
834
849
|
}
|
|
@@ -844,6 +859,7 @@ DragRef = /** @class */ (function () {
|
|
|
844
859
|
*/
|
|
845
860
|
function () {
|
|
846
861
|
_this._cleanupDragArtifacts(event);
|
|
862
|
+
_this._cleanupCachedDimensions();
|
|
847
863
|
_this._dragDropRegistry.stopDragging(_this);
|
|
848
864
|
}));
|
|
849
865
|
}
|
|
@@ -862,6 +878,7 @@ DragRef = /** @class */ (function () {
|
|
|
862
878
|
distance: _this._getDragDistance(_this._getPointerPositionOnPage(event))
|
|
863
879
|
});
|
|
864
880
|
}));
|
|
881
|
+
this._cleanupCachedDimensions();
|
|
865
882
|
this._dragDropRegistry.stopDragging(this);
|
|
866
883
|
}
|
|
867
884
|
};
|
|
@@ -1073,7 +1090,7 @@ DragRef = /** @class */ (function () {
|
|
|
1073
1090
|
// Drop container that draggable has been moved into.
|
|
1074
1091
|
/** @type {?} */
|
|
1075
1092
|
var newContainer = this._initialContainer._getSiblingContainerFromPosition(this, x, y);
|
|
1076
|
-
// If we couldn't find a new container to move the item into, and the item has left
|
|
1093
|
+
// If we couldn't find a new container to move the item into, and the item has left its
|
|
1077
1094
|
// initial container, check whether the it's over the initial container. This handles the
|
|
1078
1095
|
// case where two containers are connected one way and the user tries to undo dragging an
|
|
1079
1096
|
// item into a new container.
|
|
@@ -1130,7 +1147,7 @@ DragRef = /** @class */ (function () {
|
|
|
1130
1147
|
if (previewTemplate) {
|
|
1131
1148
|
/** @type {?} */
|
|
1132
1149
|
var viewRef = (/** @type {?} */ (previewConfig)).viewContainer.createEmbeddedView(previewTemplate, (/** @type {?} */ (previewConfig)).context);
|
|
1133
|
-
preview = viewRef.
|
|
1150
|
+
preview = getRootNode(viewRef, this._document);
|
|
1134
1151
|
this._previewRef = viewRef;
|
|
1135
1152
|
preview.style.transform =
|
|
1136
1153
|
getTransform(this._pickupPositionOnPage.x, this._pickupPositionOnPage.y);
|
|
@@ -1149,6 +1166,8 @@ DragRef = /** @class */ (function () {
|
|
|
1149
1166
|
// It's important that we disable the pointer events on the preview, because
|
|
1150
1167
|
// it can throw off the `document.elementFromPoint` calls in the `CdkDropList`.
|
|
1151
1168
|
pointerEvents: 'none',
|
|
1169
|
+
// We have to reset the margin, because can throw off positioning relative to the viewport.
|
|
1170
|
+
margin: '0',
|
|
1152
1171
|
position: 'fixed',
|
|
1153
1172
|
top: '0',
|
|
1154
1173
|
left: '0',
|
|
@@ -1244,7 +1263,7 @@ DragRef = /** @class */ (function () {
|
|
|
1244
1263
|
var placeholder;
|
|
1245
1264
|
if (placeholderTemplate) {
|
|
1246
1265
|
this._placeholderRef = (/** @type {?} */ (placeholderConfig)).viewContainer.createEmbeddedView(placeholderTemplate, (/** @type {?} */ (placeholderConfig)).context);
|
|
1247
|
-
placeholder = this._placeholderRef.
|
|
1266
|
+
placeholder = getRootNode(this._placeholderRef, this._document);
|
|
1248
1267
|
}
|
|
1249
1268
|
else {
|
|
1250
1269
|
placeholder = deepCloneNode(this._rootElement);
|
|
@@ -1490,6 +1509,83 @@ DragRef = /** @class */ (function () {
|
|
|
1490
1509
|
}
|
|
1491
1510
|
return { x: 0, y: 0 };
|
|
1492
1511
|
};
|
|
1512
|
+
/** Cleans up any cached element dimensions that we don't need after dragging has stopped. */
|
|
1513
|
+
/**
|
|
1514
|
+
* Cleans up any cached element dimensions that we don't need after dragging has stopped.
|
|
1515
|
+
* @private
|
|
1516
|
+
* @return {?}
|
|
1517
|
+
*/
|
|
1518
|
+
DragRef.prototype._cleanupCachedDimensions = /**
|
|
1519
|
+
* Cleans up any cached element dimensions that we don't need after dragging has stopped.
|
|
1520
|
+
* @private
|
|
1521
|
+
* @return {?}
|
|
1522
|
+
*/
|
|
1523
|
+
function () {
|
|
1524
|
+
this._boundaryRect = this._previewRect = undefined;
|
|
1525
|
+
};
|
|
1526
|
+
/**
|
|
1527
|
+
* Checks whether the element is still inside its boundary after the viewport has been resized.
|
|
1528
|
+
* If not, the position is adjusted so that the element fits again.
|
|
1529
|
+
*/
|
|
1530
|
+
/**
|
|
1531
|
+
* Checks whether the element is still inside its boundary after the viewport has been resized.
|
|
1532
|
+
* If not, the position is adjusted so that the element fits again.
|
|
1533
|
+
* @private
|
|
1534
|
+
* @return {?}
|
|
1535
|
+
*/
|
|
1536
|
+
DragRef.prototype._containInsideBoundaryOnResize = /**
|
|
1537
|
+
* Checks whether the element is still inside its boundary after the viewport has been resized.
|
|
1538
|
+
* If not, the position is adjusted so that the element fits again.
|
|
1539
|
+
* @private
|
|
1540
|
+
* @return {?}
|
|
1541
|
+
*/
|
|
1542
|
+
function () {
|
|
1543
|
+
var _a = this._passiveTransform, x = _a.x, y = _a.y;
|
|
1544
|
+
if ((x === 0 && y === 0) || this.isDragging() || !this._boundaryElement) {
|
|
1545
|
+
return;
|
|
1546
|
+
}
|
|
1547
|
+
/** @type {?} */
|
|
1548
|
+
var boundaryRect = this._boundaryElement.getBoundingClientRect();
|
|
1549
|
+
/** @type {?} */
|
|
1550
|
+
var elementRect = this._rootElement.getBoundingClientRect();
|
|
1551
|
+
/** @type {?} */
|
|
1552
|
+
var leftOverflow = boundaryRect.left - elementRect.left;
|
|
1553
|
+
/** @type {?} */
|
|
1554
|
+
var rightOverflow = elementRect.right - boundaryRect.right;
|
|
1555
|
+
/** @type {?} */
|
|
1556
|
+
var topOverflow = boundaryRect.top - elementRect.top;
|
|
1557
|
+
/** @type {?} */
|
|
1558
|
+
var bottomOverflow = elementRect.bottom - boundaryRect.bottom;
|
|
1559
|
+
// If the element has become wider than the boundary, we can't
|
|
1560
|
+
// do much to make it fit so we just anchor it to the left.
|
|
1561
|
+
if (boundaryRect.width > elementRect.width) {
|
|
1562
|
+
if (leftOverflow > 0) {
|
|
1563
|
+
x += leftOverflow;
|
|
1564
|
+
}
|
|
1565
|
+
if (rightOverflow > 0) {
|
|
1566
|
+
x -= rightOverflow;
|
|
1567
|
+
}
|
|
1568
|
+
}
|
|
1569
|
+
else {
|
|
1570
|
+
x = 0;
|
|
1571
|
+
}
|
|
1572
|
+
// If the element has become taller than the boundary, we can't
|
|
1573
|
+
// do much to make it fit so we just anchor it to the top.
|
|
1574
|
+
if (boundaryRect.height > elementRect.height) {
|
|
1575
|
+
if (topOverflow > 0) {
|
|
1576
|
+
y += topOverflow;
|
|
1577
|
+
}
|
|
1578
|
+
if (bottomOverflow > 0) {
|
|
1579
|
+
y -= bottomOverflow;
|
|
1580
|
+
}
|
|
1581
|
+
}
|
|
1582
|
+
else {
|
|
1583
|
+
y = 0;
|
|
1584
|
+
}
|
|
1585
|
+
if (x !== this._passiveTransform.x || y !== this._passiveTransform.y) {
|
|
1586
|
+
this.setFreeDragPosition({ y: y, x: x });
|
|
1587
|
+
}
|
|
1588
|
+
};
|
|
1493
1589
|
return DragRef;
|
|
1494
1590
|
}());
|
|
1495
1591
|
/**
|
|
@@ -1581,6 +1677,24 @@ function getPreviewInsertionPoint(documentRef) {
|
|
|
1581
1677
|
documentRef.msFullscreenElement ||
|
|
1582
1678
|
documentRef.body;
|
|
1583
1679
|
}
|
|
1680
|
+
/**
|
|
1681
|
+
* Gets the root HTML element of an embedded view.
|
|
1682
|
+
* If the root is not an HTML element it gets wrapped in one.
|
|
1683
|
+
* @param {?} viewRef
|
|
1684
|
+
* @param {?} _document
|
|
1685
|
+
* @return {?}
|
|
1686
|
+
*/
|
|
1687
|
+
function getRootNode(viewRef, _document) {
|
|
1688
|
+
/** @type {?} */
|
|
1689
|
+
var rootNode = viewRef.rootNodes[0];
|
|
1690
|
+
if (rootNode.nodeType !== _document.ELEMENT_NODE) {
|
|
1691
|
+
/** @type {?} */
|
|
1692
|
+
var wrapper = _document.createElement('div');
|
|
1693
|
+
wrapper.appendChild(rootNode);
|
|
1694
|
+
return wrapper;
|
|
1695
|
+
}
|
|
1696
|
+
return (/** @type {?} */ (rootNode));
|
|
1697
|
+
}
|
|
1584
1698
|
|
|
1585
1699
|
/**
|
|
1586
1700
|
* @fileoverview added by tsickle
|
|
@@ -1714,7 +1828,7 @@ DropListRef = /** @class */ (function () {
|
|
|
1714
1828
|
/**
|
|
1715
1829
|
* Whether sorting items within the list is disabled.
|
|
1716
1830
|
*/
|
|
1717
|
-
this.sortingDisabled =
|
|
1831
|
+
this.sortingDisabled = false;
|
|
1718
1832
|
/**
|
|
1719
1833
|
* Whether auto-scrolling the view when the user
|
|
1720
1834
|
* moves their pointer close to the edges is disabled.
|
|
@@ -1846,9 +1960,10 @@ DropListRef = /** @class */ (function () {
|
|
|
1846
1960
|
}
|
|
1847
1961
|
}));
|
|
1848
1962
|
});
|
|
1963
|
+
/** @type {?} */
|
|
1964
|
+
var nativeNode = this.element = coercion.coerceElement(element);
|
|
1965
|
+
this._shadowRoot = getShadowRoot(nativeNode) || _document;
|
|
1849
1966
|
_dragDropRegistry.registerDropContainer(this);
|
|
1850
|
-
this._document = _document;
|
|
1851
|
-
this.element = element instanceof core.ElementRef ? element.nativeElement : element;
|
|
1852
1967
|
}
|
|
1853
1968
|
/** Removes the drop list functionality from the DOM element. */
|
|
1854
1969
|
/**
|
|
@@ -1918,17 +2033,7 @@ DropListRef = /** @class */ (function () {
|
|
|
1918
2033
|
}
|
|
1919
2034
|
// @breaking-change 9.0.0 Remove check for _viewportRuler once it's marked as a required param.
|
|
1920
2035
|
if (this._viewportRuler) {
|
|
1921
|
-
this.
|
|
1922
|
-
this._viewportScrollSubscription = this._dragDropRegistry.scroll.subscribe((/**
|
|
1923
|
-
* @return {?}
|
|
1924
|
-
*/
|
|
1925
|
-
function () {
|
|
1926
|
-
if (_this.isDragging()) {
|
|
1927
|
-
/** @type {?} */
|
|
1928
|
-
var newPosition = (/** @type {?} */ (_this._viewportRuler)).getViewportScrollPosition();
|
|
1929
|
-
_this._updateAfterScroll(_this._viewportScrollPosition, newPosition.top, newPosition.left, _this._clientRect);
|
|
1930
|
-
}
|
|
1931
|
-
}));
|
|
2036
|
+
this._listenToScrollEvents();
|
|
1932
2037
|
}
|
|
1933
2038
|
};
|
|
1934
2039
|
/**
|
|
@@ -2334,6 +2439,7 @@ DropListRef = /** @class */ (function () {
|
|
|
2334
2439
|
* @return {?}
|
|
2335
2440
|
*/
|
|
2336
2441
|
function (pointerX, pointerY) {
|
|
2442
|
+
var _a;
|
|
2337
2443
|
if (this.autoScrollDisabled) {
|
|
2338
2444
|
return;
|
|
2339
2445
|
}
|
|
@@ -2343,29 +2449,25 @@ DropListRef = /** @class */ (function () {
|
|
|
2343
2449
|
var verticalScrollDirection = 0 /* NONE */;
|
|
2344
2450
|
/** @type {?} */
|
|
2345
2451
|
var horizontalScrollDirection = 0 /* NONE */;
|
|
2452
|
+
// Check whether we should start scrolling the container.
|
|
2453
|
+
if (this._isPointerNearDropContainer(pointerX, pointerY)) {
|
|
2454
|
+
/** @type {?} */
|
|
2455
|
+
var element = coercion.coerceElement(this.element);
|
|
2456
|
+
_a = getElementScrollDirections(element, this._clientRect, pointerX, pointerY), verticalScrollDirection = _a[0], horizontalScrollDirection = _a[1];
|
|
2457
|
+
if (verticalScrollDirection || horizontalScrollDirection) {
|
|
2458
|
+
scrollNode = element;
|
|
2459
|
+
}
|
|
2460
|
+
}
|
|
2346
2461
|
// @breaking-change 9.0.0 Remove null check for _viewportRuler once it's a required parameter.
|
|
2347
|
-
//
|
|
2348
|
-
if (this._viewportRuler) {
|
|
2349
|
-
var
|
|
2462
|
+
// Otherwise check if we can start scrolling the viewport.
|
|
2463
|
+
if (this._viewportRuler && !verticalScrollDirection && !horizontalScrollDirection) {
|
|
2464
|
+
var _b = this._viewportRuler.getViewportSize(), width = _b.width, height = _b.height;
|
|
2350
2465
|
/** @type {?} */
|
|
2351
2466
|
var clientRect = { width: width, height: height, top: 0, right: width, bottom: height, left: 0 };
|
|
2352
2467
|
verticalScrollDirection = getVerticalScrollDirection(clientRect, pointerY);
|
|
2353
2468
|
horizontalScrollDirection = getHorizontalScrollDirection(clientRect, pointerX);
|
|
2354
2469
|
scrollNode = window;
|
|
2355
2470
|
}
|
|
2356
|
-
// If we couldn't find a scroll direction based on the
|
|
2357
|
-
// window, try with the container, if the pointer is close by.
|
|
2358
|
-
if (!verticalScrollDirection && !horizontalScrollDirection &&
|
|
2359
|
-
this._isPointerNearDropContainer(pointerX, pointerY)) {
|
|
2360
|
-
verticalScrollDirection = getVerticalScrollDirection(this._clientRect, pointerY);
|
|
2361
|
-
horizontalScrollDirection = getHorizontalScrollDirection(this._clientRect, pointerX);
|
|
2362
|
-
scrollNode = coercion.coerceElement(this.element);
|
|
2363
|
-
}
|
|
2364
|
-
// TODO(crisbeto): we also need to account for whether the view or element are scrollable in
|
|
2365
|
-
// the first place. With the current approach we'll still try to scroll them, but it just
|
|
2366
|
-
// won't do anything. The only case where this is relevant is that if we have a scrollable
|
|
2367
|
-
// list close to the viewport edge where the viewport isn't scrollable. In this case the
|
|
2368
|
-
// we'll be trying to scroll the viewport rather than the list.
|
|
2369
2471
|
if (scrollNode && (verticalScrollDirection !== this._verticalScrollDirection ||
|
|
2370
2472
|
horizontalScrollDirection !== this._horizontalScrollDirection ||
|
|
2371
2473
|
scrollNode !== this._scrollNode)) {
|
|
@@ -2828,7 +2930,7 @@ DropListRef = /** @class */ (function () {
|
|
|
2828
2930
|
return false;
|
|
2829
2931
|
}
|
|
2830
2932
|
/** @type {?} */
|
|
2831
|
-
var elementFromPoint = (/** @type {?} */ (this.
|
|
2933
|
+
var elementFromPoint = (/** @type {?} */ (this._shadowRoot.elementFromPoint(x, y)));
|
|
2832
2934
|
// If there's no element at the pointer position, then
|
|
2833
2935
|
// the client rect is probably scrolled out of the view.
|
|
2834
2936
|
if (!elementFromPoint) {
|
|
@@ -2864,6 +2966,7 @@ DropListRef = /** @class */ (function () {
|
|
|
2864
2966
|
if (!activeSiblings.has(sibling)) {
|
|
2865
2967
|
activeSiblings.add(sibling);
|
|
2866
2968
|
this._cacheOwnPosition();
|
|
2969
|
+
this._listenToScrollEvents();
|
|
2867
2970
|
}
|
|
2868
2971
|
};
|
|
2869
2972
|
/**
|
|
@@ -2882,6 +2985,40 @@ DropListRef = /** @class */ (function () {
|
|
|
2882
2985
|
*/
|
|
2883
2986
|
function (sibling) {
|
|
2884
2987
|
this._activeSiblings.delete(sibling);
|
|
2988
|
+
this._viewportScrollSubscription.unsubscribe();
|
|
2989
|
+
};
|
|
2990
|
+
/**
|
|
2991
|
+
* Starts listening to scroll events on the viewport.
|
|
2992
|
+
* Used for updating the internal state of the list.
|
|
2993
|
+
*/
|
|
2994
|
+
/**
|
|
2995
|
+
* Starts listening to scroll events on the viewport.
|
|
2996
|
+
* Used for updating the internal state of the list.
|
|
2997
|
+
* @private
|
|
2998
|
+
* @return {?}
|
|
2999
|
+
*/
|
|
3000
|
+
DropListRef.prototype._listenToScrollEvents = /**
|
|
3001
|
+
* Starts listening to scroll events on the viewport.
|
|
3002
|
+
* Used for updating the internal state of the list.
|
|
3003
|
+
* @private
|
|
3004
|
+
* @return {?}
|
|
3005
|
+
*/
|
|
3006
|
+
function () {
|
|
3007
|
+
var _this = this;
|
|
3008
|
+
this._viewportScrollPosition = (/** @type {?} */ (this._viewportRuler)).getViewportScrollPosition();
|
|
3009
|
+
this._viewportScrollSubscription = this._dragDropRegistry.scroll.subscribe((/**
|
|
3010
|
+
* @return {?}
|
|
3011
|
+
*/
|
|
3012
|
+
function () {
|
|
3013
|
+
if (_this.isDragging()) {
|
|
3014
|
+
/** @type {?} */
|
|
3015
|
+
var newPosition = (/** @type {?} */ (_this._viewportRuler)).getViewportScrollPosition();
|
|
3016
|
+
_this._updateAfterScroll(_this._viewportScrollPosition, newPosition.top, newPosition.left, _this._clientRect);
|
|
3017
|
+
}
|
|
3018
|
+
else if (_this.isReceiving()) {
|
|
3019
|
+
_this._cacheOwnPosition();
|
|
3020
|
+
}
|
|
3021
|
+
}));
|
|
2885
3022
|
};
|
|
2886
3023
|
return DropListRef;
|
|
2887
3024
|
}());
|
|
@@ -3012,6 +3149,69 @@ function getHorizontalScrollDirection(clientRect, pointerX) {
|
|
|
3012
3149
|
}
|
|
3013
3150
|
return 0 /* NONE */;
|
|
3014
3151
|
}
|
|
3152
|
+
/**
|
|
3153
|
+
* Gets the directions in which an element node should be scrolled,
|
|
3154
|
+
* assuming that the user's pointer is already within it scrollable region.
|
|
3155
|
+
* @param {?} element Element for which we should calculate the scroll direction.
|
|
3156
|
+
* @param {?} clientRect Bounding client rectangle of the element.
|
|
3157
|
+
* @param {?} pointerX Position of the user's pointer along the x axis.
|
|
3158
|
+
* @param {?} pointerY Position of the user's pointer along the y axis.
|
|
3159
|
+
* @return {?}
|
|
3160
|
+
*/
|
|
3161
|
+
function getElementScrollDirections(element, clientRect, pointerX, pointerY) {
|
|
3162
|
+
/** @type {?} */
|
|
3163
|
+
var computedVertical = getVerticalScrollDirection(clientRect, pointerY);
|
|
3164
|
+
/** @type {?} */
|
|
3165
|
+
var computedHorizontal = getHorizontalScrollDirection(clientRect, pointerX);
|
|
3166
|
+
/** @type {?} */
|
|
3167
|
+
var verticalScrollDirection = 0 /* NONE */;
|
|
3168
|
+
/** @type {?} */
|
|
3169
|
+
var horizontalScrollDirection = 0 /* NONE */;
|
|
3170
|
+
// Note that we here we do some extra checks for whether the element is actually scrollable in
|
|
3171
|
+
// a certain direction and we only assign the scroll direction if it is. We do this so that we
|
|
3172
|
+
// can allow other elements to be scrolled, if the current element can't be scrolled anymore.
|
|
3173
|
+
// This allows us to handle cases where the scroll regions of two scrollable elements overlap.
|
|
3174
|
+
if (computedVertical) {
|
|
3175
|
+
/** @type {?} */
|
|
3176
|
+
var scrollTop = element.scrollTop;
|
|
3177
|
+
if (computedVertical === 1 /* UP */) {
|
|
3178
|
+
if (scrollTop > 0) {
|
|
3179
|
+
verticalScrollDirection = 1 /* UP */;
|
|
3180
|
+
}
|
|
3181
|
+
}
|
|
3182
|
+
else if (element.scrollHeight - scrollTop > element.clientHeight) {
|
|
3183
|
+
verticalScrollDirection = 2 /* DOWN */;
|
|
3184
|
+
}
|
|
3185
|
+
}
|
|
3186
|
+
if (computedHorizontal) {
|
|
3187
|
+
/** @type {?} */
|
|
3188
|
+
var scrollLeft = element.scrollLeft;
|
|
3189
|
+
if (computedHorizontal === 1 /* LEFT */) {
|
|
3190
|
+
if (scrollLeft > 0) {
|
|
3191
|
+
horizontalScrollDirection = 1 /* LEFT */;
|
|
3192
|
+
}
|
|
3193
|
+
}
|
|
3194
|
+
else if (element.scrollWidth - scrollLeft > element.clientWidth) {
|
|
3195
|
+
horizontalScrollDirection = 2 /* RIGHT */;
|
|
3196
|
+
}
|
|
3197
|
+
}
|
|
3198
|
+
return [verticalScrollDirection, horizontalScrollDirection];
|
|
3199
|
+
}
|
|
3200
|
+
/**
|
|
3201
|
+
* Gets the shadow root of an element, if any.
|
|
3202
|
+
* @param {?} element
|
|
3203
|
+
* @return {?}
|
|
3204
|
+
*/
|
|
3205
|
+
function getShadowRoot(element) {
|
|
3206
|
+
if (platform._supportsShadowDom()) {
|
|
3207
|
+
/** @type {?} */
|
|
3208
|
+
var rootNode = element.getRootNode ? element.getRootNode() : null;
|
|
3209
|
+
if (rootNode instanceof ShadowRoot) {
|
|
3210
|
+
return rootNode;
|
|
3211
|
+
}
|
|
3212
|
+
}
|
|
3213
|
+
return null;
|
|
3214
|
+
}
|
|
3015
3215
|
|
|
3016
3216
|
/**
|
|
3017
3217
|
* @fileoverview added by tsickle
|
|
@@ -3218,7 +3418,10 @@ var DragDropRegistry = /** @class */ (function () {
|
|
|
3218
3418
|
* @param {?} e
|
|
3219
3419
|
* @return {?}
|
|
3220
3420
|
*/
|
|
3221
|
-
function (e) { return _this.scroll.next(e); })
|
|
3421
|
+
function (e) { return _this.scroll.next(e); }),
|
|
3422
|
+
// Use capturing so that we pick up scroll changes in any scrollable nodes that aren't
|
|
3423
|
+
// the document. See https://github.com/angular/components/issues/17144.
|
|
3424
|
+
options: true
|
|
3222
3425
|
})
|
|
3223
3426
|
// Preventing the default action on `mousemove` isn't enough to disable text selection
|
|
3224
3427
|
// on Safari so we need to prevent the selection event as well. Alternatively this can
|