@angular/cdk 11.0.3 → 11.1.1
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/LICENSE +1 -1
- package/a11y/aria-describer/aria-describer.d.ts +9 -14
- package/a11y/focus-monitor/focus-monitor.d.ts +6 -0
- package/a11y/index.metadata.json +1 -1
- package/bundles/cdk-a11y.umd.js +83 -66
- package/bundles/cdk-a11y.umd.js.map +1 -1
- package/bundles/cdk-a11y.umd.min.js +13 -21
- package/bundles/cdk-a11y.umd.min.js.map +1 -1
- package/bundles/cdk-accordion.umd.js.map +1 -1
- package/bundles/cdk-bidi.umd.js.map +1 -1
- package/bundles/cdk-coercion.umd.js +9 -1
- package/bundles/cdk-coercion.umd.js.map +1 -1
- package/bundles/cdk-coercion.umd.min.js.map +1 -1
- package/bundles/cdk-collections.umd.js +9 -1
- package/bundles/cdk-collections.umd.js.map +1 -1
- package/bundles/cdk-collections.umd.min.js +1 -1
- package/bundles/cdk-collections.umd.min.js.map +1 -1
- package/bundles/cdk-drag-drop.umd.js +136 -53
- package/bundles/cdk-drag-drop.umd.js.map +1 -1
- package/bundles/cdk-drag-drop.umd.min.js +8 -8
- package/bundles/cdk-drag-drop.umd.min.js.map +1 -1
- package/bundles/cdk-overlay.umd.js +49 -11
- package/bundles/cdk-overlay.umd.js.map +1 -1
- package/bundles/cdk-overlay.umd.min.js +18 -25
- package/bundles/cdk-overlay.umd.min.js.map +1 -1
- package/bundles/cdk-platform.umd.js +1 -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-portal.umd.js +9 -1
- package/bundles/cdk-portal.umd.js.map +1 -1
- package/bundles/cdk-portal.umd.min.js +2 -2
- package/bundles/cdk-portal.umd.min.js.map +1 -1
- package/bundles/cdk-scrolling.umd.js +25 -11
- package/bundles/cdk-scrolling.umd.js.map +1 -1
- package/bundles/cdk-scrolling.umd.min.js +4 -4
- package/bundles/cdk-scrolling.umd.min.js.map +1 -1
- package/bundles/cdk-table.umd.js +99 -30
- package/bundles/cdk-table.umd.js.map +1 -1
- package/bundles/cdk-table.umd.min.js +7 -7
- package/bundles/cdk-table.umd.min.js.map +1 -1
- package/bundles/cdk-testing-protractor.umd.js +59 -13
- package/bundles/cdk-testing-protractor.umd.js.map +1 -1
- package/bundles/cdk-testing-protractor.umd.min.js +2 -2
- package/bundles/cdk-testing-protractor.umd.min.js.map +1 -1
- package/bundles/cdk-testing-testbed.umd.js +40 -15
- package/bundles/cdk-testing-testbed.umd.js.map +1 -1
- package/bundles/cdk-testing-testbed.umd.min.js +7 -7
- package/bundles/cdk-testing-testbed.umd.min.js.map +1 -1
- package/bundles/cdk-testing.umd.js +11 -10
- package/bundles/cdk-testing.umd.js.map +1 -1
- package/bundles/cdk-testing.umd.min.js +2 -2
- package/bundles/cdk-testing.umd.min.js.map +1 -1
- package/bundles/cdk-tree.umd.js +9 -1
- package/bundles/cdk-tree.umd.js.map +1 -1
- package/bundles/cdk-tree.umd.min.js +5 -5
- package/bundles/cdk-tree.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/directives/drag.d.ts +3 -1
- package/drag-drop/directives/drop-list.d.ts +4 -1
- package/drag-drop/drag-drop-registry.d.ts +8 -1
- package/drag-drop/drag-ref.d.ts +6 -0
- package/drag-drop/drop-list-ref.d.ts +7 -1
- package/drag-drop/index.metadata.json +1 -1
- package/esm2015/a11y/aria-describer/aria-describer.js +50 -55
- package/esm2015/a11y/focus-monitor/focus-monitor.js +18 -3
- package/esm2015/drag-drop/directives/drag.js +39 -5
- package/esm2015/drag-drop/directives/drop-list.js +4 -2
- package/esm2015/drag-drop/drag-drop-registry.js +25 -12
- package/esm2015/drag-drop/drag-ref.js +17 -10
- package/esm2015/drag-drop/drop-list-ref.js +46 -28
- package/esm2015/overlay/overlay-ref.js +2 -2
- package/esm2015/overlay/position/flexible-connected-position-strategy.js +25 -3
- package/esm2015/overlay/scroll/block-scroll-strategy.js +13 -4
- package/esm2015/platform/features/scrolling.js +2 -1
- package/esm2015/scrolling/fixed-size-virtual-scroll.js +3 -2
- package/esm2015/scrolling/scroll-dispatcher.js +9 -8
- package/esm2015/scrolling/virtual-for-of.js +8 -4
- package/esm2015/scrolling/virtual-scroll-viewport.js +1 -1
- package/esm2015/table/public-api.js +2 -1
- package/esm2015/table/sticky-position-listener.js +11 -0
- package/esm2015/table/sticky-styler.js +60 -14
- package/esm2015/table/table.js +9 -4
- package/esm2015/testing/change-detection.js +1 -8
- package/esm2015/testing/harness-environment.js +3 -3
- package/esm2015/testing/protractor/protractor-element.js +29 -13
- package/esm2015/testing/test-element.js +1 -1
- package/esm2015/testing/testbed/fake-events/dispatch-events.js +3 -3
- package/esm2015/testing/testbed/fake-events/event-objects.js +6 -6
- package/esm2015/testing/testbed/unit-test-element.js +21 -9
- package/esm2015/tree/nested-node.js +1 -1
- package/esm2015/tree/padding.js +1 -1
- package/esm2015/tree/toggle.js +1 -1
- package/esm2015/tree/tree.js +1 -1
- package/esm2015/version.js +1 -1
- package/fesm2015/a11y.js +67 -55
- package/fesm2015/a11y.js.map +1 -1
- package/fesm2015/accordion.js.map +1 -1
- package/fesm2015/bidi.js.map +1 -1
- package/fesm2015/cdk.js +1 -1
- package/fesm2015/cdk.js.map +1 -1
- package/fesm2015/drag-drop.js +125 -51
- package/fesm2015/drag-drop.js.map +1 -1
- package/fesm2015/overlay.js +37 -7
- package/fesm2015/overlay.js.map +1 -1
- package/fesm2015/platform.js +1 -0
- package/fesm2015/platform.js.map +1 -1
- package/fesm2015/scrolling.js +17 -12
- package/fesm2015/scrolling.js.map +1 -1
- package/fesm2015/table.js +77 -17
- package/fesm2015/table.js.map +1 -1
- package/fesm2015/testing/protractor.js +27 -11
- package/fesm2015/testing/protractor.js.map +1 -1
- package/fesm2015/testing/testbed.js +25 -13
- package/fesm2015/testing/testbed.js.map +1 -1
- package/fesm2015/testing.js +2 -9
- package/fesm2015/testing.js.map +1 -1
- package/fesm2015/tree.js.map +1 -1
- package/overlay/index.metadata.json +1 -1
- package/package.json +1 -1
- package/schematics/ng-add/index.js +1 -1
- package/scrolling/index.metadata.json +1 -1
- package/scrolling/scroll-dispatcher.d.ts +3 -3
- package/table/index.metadata.json +1 -1
- package/table/public-api.d.ts +1 -0
- package/table/sticky-position-listener.d.ts +28 -0
- package/table/sticky-styler.d.ts +7 -2
- package/table/table.d.ts +4 -2
- package/testing/change-detection.d.ts +44 -1
- package/testing/protractor/protractor-element.d.ts +12 -4
- package/testing/test-element.d.ts +11 -5
- package/testing/testbed/fake-events/dispatch-events.d.ts +1 -1
- package/testing/testbed/fake-events/event-objects.d.ts +1 -1
- package/testing/testbed/unit-test-element.d.ts +12 -4
- package/tree/index.metadata.json +1 -1
- package/tree/nested-node.d.ts +3 -3
- package/tree/padding.d.ts +2 -2
- package/tree/toggle.d.ts +4 -4
- package/tree/tree.d.ts +5 -5
package/fesm2015/overlay.js
CHANGED
|
@@ -3,9 +3,9 @@ export { CdkScrollable, ScrollDispatcher, ViewportRuler } from '@angular/cdk/scr
|
|
|
3
3
|
import { DOCUMENT, Location } from '@angular/common';
|
|
4
4
|
import { ɵɵdefineInjectable, ɵɵinject, NgZone, Injectable, Inject, Optional, ElementRef, ApplicationRef, ComponentFactoryResolver, Injector, InjectionToken, Directive, EventEmitter, TemplateRef, ViewContainerRef, Input, Output, NgModule } from '@angular/core';
|
|
5
5
|
import { coerceCssPixelValue, coerceArray, coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
6
|
+
import { supportsScrollBehavior, Platform } from '@angular/cdk/platform';
|
|
6
7
|
import { Directionality, BidiModule } from '@angular/cdk/bidi';
|
|
7
8
|
import { DomPortalOutlet, TemplatePortal, PortalModule } from '@angular/cdk/portal';
|
|
8
|
-
import { Platform } from '@angular/cdk/platform';
|
|
9
9
|
import { Subject, Subscription, merge } from 'rxjs';
|
|
10
10
|
import { take, takeUntil, takeWhile } from 'rxjs/operators';
|
|
11
11
|
import { ESCAPE, hasModifierKey } from '@angular/cdk/keycodes';
|
|
@@ -17,6 +17,7 @@ import { ESCAPE, hasModifierKey } from '@angular/cdk/keycodes';
|
|
|
17
17
|
* Use of this source code is governed by an MIT-style license that can be
|
|
18
18
|
* found in the LICENSE file at https://angular.io/license
|
|
19
19
|
*/
|
|
20
|
+
const scrollBehaviorSupported = supportsScrollBehavior();
|
|
20
21
|
/**
|
|
21
22
|
* Strategy that will prevent the user from scrolling while the overlay is visible.
|
|
22
23
|
*/
|
|
@@ -60,10 +61,17 @@ class BlockScrollStrategy {
|
|
|
60
61
|
html.classList.remove('cdk-global-scrollblock');
|
|
61
62
|
// Disable user-defined smooth scrolling temporarily while we restore the scroll position.
|
|
62
63
|
// See https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-behavior
|
|
63
|
-
|
|
64
|
+
// Note that we don't mutate the property if the browser doesn't support `scroll-behavior`,
|
|
65
|
+
// because it can throw off feature detections in `supportsScrollBehavior` which
|
|
66
|
+
// checks for `'scrollBehavior' in documentElement.style`.
|
|
67
|
+
if (scrollBehaviorSupported) {
|
|
68
|
+
htmlStyle.scrollBehavior = bodyStyle.scrollBehavior = 'auto';
|
|
69
|
+
}
|
|
64
70
|
window.scroll(this._previousScrollPosition.left, this._previousScrollPosition.top);
|
|
65
|
-
|
|
66
|
-
|
|
71
|
+
if (scrollBehaviorSupported) {
|
|
72
|
+
htmlStyle.scrollBehavior = previousHtmlScrollBehavior;
|
|
73
|
+
bodyStyle.scrollBehavior = previousBodyScrollBehavior;
|
|
74
|
+
}
|
|
67
75
|
}
|
|
68
76
|
}
|
|
69
77
|
_canBeEnabled() {
|
|
@@ -1011,7 +1019,7 @@ class OverlayRef {
|
|
|
1011
1019
|
}
|
|
1012
1020
|
/** Toggles the pointer events for the overlay pane element. */
|
|
1013
1021
|
_togglePointerEvents(enablePointer) {
|
|
1014
|
-
this._pane.style.pointerEvents = enablePointer ? '
|
|
1022
|
+
this._pane.style.pointerEvents = enablePointer ? '' : 'none';
|
|
1015
1023
|
}
|
|
1016
1024
|
/** Attaches a backdrop for this overlay. */
|
|
1017
1025
|
_attachBackdrop() {
|
|
@@ -1535,7 +1543,10 @@ class FlexibleConnectedPositionStrategy {
|
|
|
1535
1543
|
};
|
|
1536
1544
|
}
|
|
1537
1545
|
/** Gets how well an overlay at the given point will fit within the viewport. */
|
|
1538
|
-
_getOverlayFit(point,
|
|
1546
|
+
_getOverlayFit(point, rawOverlayRect, viewport, position) {
|
|
1547
|
+
// Round the overlay rect when comparing against the
|
|
1548
|
+
// viewport, because the viewport is always rounded.
|
|
1549
|
+
const overlay = getRoundedBoundingClientRect(rawOverlayRect);
|
|
1539
1550
|
let { x, y } = point;
|
|
1540
1551
|
let offsetX = this._getOffset(position, 'x');
|
|
1541
1552
|
let offsetY = this._getOffset(position, 'y');
|
|
@@ -1593,7 +1604,7 @@ class FlexibleConnectedPositionStrategy {
|
|
|
1593
1604
|
* @returns The point at which to position the overlay after pushing. This is effectively a new
|
|
1594
1605
|
* originPoint.
|
|
1595
1606
|
*/
|
|
1596
|
-
_pushOverlayOnScreen(start,
|
|
1607
|
+
_pushOverlayOnScreen(start, rawOverlayRect, scrollPosition) {
|
|
1597
1608
|
// If the position is locked and we've pushed the overlay already, reuse the previous push
|
|
1598
1609
|
// amount, rather than pushing it again. If we were to continue pushing, the element would
|
|
1599
1610
|
// remain in the viewport, which goes against the expectations when position locking is enabled.
|
|
@@ -1603,6 +1614,9 @@ class FlexibleConnectedPositionStrategy {
|
|
|
1603
1614
|
y: start.y + this._previousPushAmount.y
|
|
1604
1615
|
};
|
|
1605
1616
|
}
|
|
1617
|
+
// Round the overlay rect when comparing against the
|
|
1618
|
+
// viewport, because the viewport is always rounded.
|
|
1619
|
+
const overlay = getRoundedBoundingClientRect(rawOverlayRect);
|
|
1606
1620
|
const viewport = this._viewportRect;
|
|
1607
1621
|
// Determine how much the overlay goes outside the viewport on each
|
|
1608
1622
|
// side, which we'll use to decide which direction to push it.
|
|
@@ -2074,6 +2088,22 @@ function getPixelValue(input) {
|
|
|
2074
2088
|
}
|
|
2075
2089
|
return input || null;
|
|
2076
2090
|
}
|
|
2091
|
+
/**
|
|
2092
|
+
* Gets a version of an element's bounding `ClientRect` where all the values are rounded down to
|
|
2093
|
+
* the nearest pixel. This allows us to account for the cases where there may be sub-pixel
|
|
2094
|
+
* deviations in the `ClientRect` returned by the browser (e.g. when zoomed in with a percentage
|
|
2095
|
+
* size, see #21350).
|
|
2096
|
+
*/
|
|
2097
|
+
function getRoundedBoundingClientRect(clientRect) {
|
|
2098
|
+
return {
|
|
2099
|
+
top: Math.floor(clientRect.top),
|
|
2100
|
+
right: Math.floor(clientRect.right),
|
|
2101
|
+
bottom: Math.floor(clientRect.bottom),
|
|
2102
|
+
left: Math.floor(clientRect.left),
|
|
2103
|
+
width: Math.floor(clientRect.width),
|
|
2104
|
+
height: Math.floor(clientRect.height)
|
|
2105
|
+
};
|
|
2106
|
+
}
|
|
2077
2107
|
|
|
2078
2108
|
/**
|
|
2079
2109
|
* @license
|