@angular/cdk 7.2.0 → 7.2.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.scss +1 -1
- package/a11y/typings/focus-monitor/focus-monitor.d.ts +0 -1
- package/a11y/typings/focus-trap/focus-trap.d.ts +2 -0
- package/a11y/typings/index.metadata.json +1 -1
- package/bundles/cdk-a11y.umd.js +23 -22
- 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-coercion.umd.js +20 -4
- package/bundles/cdk-coercion.umd.js.map +1 -1
- package/bundles/cdk-coercion.umd.min.js +1 -1
- package/bundles/cdk-coercion.umd.min.js.map +1 -1
- package/bundles/cdk-drag-drop.umd.js +43 -21
- 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-observers.umd.js +1 -1
- package/bundles/cdk-observers.umd.js.map +1 -1
- package/bundles/cdk-observers.umd.min.js +1 -1
- package/bundles/cdk-observers.umd.min.js.map +1 -1
- package/bundles/cdk-overlay.umd.js +9 -19
- 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-text-field.umd.js +6 -6
- package/bundles/cdk-text-field.umd.js.map +1 -1
- package/bundles/cdk-text-field.umd.min.js +1 -1
- package/bundles/cdk-text-field.umd.min.js.map +1 -1
- package/bundles/cdk-tree.umd.js.map +1 -1
- 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/coercion/typings/element.d.ts +13 -0
- package/coercion/typings/index.metadata.json +1 -1
- package/coercion/typings/public-api.d.ts +1 -0
- package/drag-drop/typings/directives/drag.d.ts +5 -4
- package/drag-drop/typings/drag-ref.d.ts +2 -2
- package/drag-drop/typings/index.metadata.json +1 -1
- package/esm2015/a11y.js +23 -18
- package/esm2015/a11y.js.map +1 -1
- package/esm2015/cdk.js +1 -1
- package/esm2015/cdk.js.map +1 -1
- package/esm2015/coercion.js +18 -1
- package/esm2015/coercion.js.map +1 -1
- package/esm2015/drag-drop.js +37 -19
- package/esm2015/drag-drop.js.map +1 -1
- package/esm2015/observers.js +2 -2
- package/esm2015/observers.js.map +1 -1
- package/esm2015/overlay.js +11 -15
- package/esm2015/overlay.js.map +1 -1
- package/esm2015/text-field.js +3 -3
- package/esm2015/text-field.js.map +1 -1
- package/esm2015/tree.js.map +1 -1
- package/esm5/a11y.es5.js +24 -23
- 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/coercion.es5.js +18 -1
- package/esm5/coercion.es5.js.map +1 -1
- package/esm5/drag-drop.es5.js +43 -21
- package/esm5/drag-drop.es5.js.map +1 -1
- package/esm5/observers.es5.js +2 -2
- package/esm5/observers.es5.js.map +1 -1
- package/esm5/overlay.es5.js +11 -21
- package/esm5/overlay.es5.js.map +1 -1
- package/esm5/text-field.es5.js +3 -3
- package/esm5/text-field.es5.js.map +1 -1
- package/esm5/tree.es5.js.map +1 -1
- package/overlay/typings/index.metadata.json +1 -1
- package/overlay/typings/overlay-directives.d.ts +0 -2
- package/package.json +4 -4
- package/text-field/typings/index.metadata.json +1 -1
- package/tree/typings/control/base-tree-control.d.ts +1 -1
- package/tree/typings/control/nested-tree-control.d.ts +2 -2
- package/tree/typings/control/tree-control.d.ts +1 -1
- package/typings/a11y/focus-monitor/focus-monitor.d.ts +0 -1
- package/typings/a11y/focus-trap/focus-trap.d.ts +2 -0
- package/typings/a11y/index.metadata.json +1 -1
- package/typings/coercion/element.d.ts +13 -0
- package/typings/coercion/index.metadata.json +1 -1
- package/typings/coercion/public-api.d.ts +1 -0
- package/typings/drag-drop/directives/drag.d.ts +5 -4
- package/typings/drag-drop/drag-ref.d.ts +2 -2
- package/typings/drag-drop/index.metadata.json +1 -1
- package/typings/esm5/a11y/focus-monitor/focus-monitor.d.ts +0 -1
- package/typings/esm5/a11y/focus-trap/focus-trap.d.ts +2 -0
- package/typings/esm5/a11y/index.metadata.json +1 -1
- package/typings/esm5/coercion/element.d.ts +13 -0
- package/typings/esm5/coercion/index.metadata.json +1 -1
- package/typings/esm5/coercion/public-api.d.ts +1 -0
- package/typings/esm5/drag-drop/directives/drag.d.ts +5 -4
- package/typings/esm5/drag-drop/drag-ref.d.ts +2 -2
- 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/overlay-directives.d.ts +0 -2
- package/typings/esm5/text-field/index.metadata.json +1 -1
- package/typings/esm5/tree/control/base-tree-control.d.ts +1 -1
- package/typings/esm5/tree/control/nested-tree-control.d.ts +2 -2
- package/typings/esm5/tree/control/tree-control.d.ts +1 -1
- package/typings/index.metadata.json +1 -1
- package/typings/overlay/index.metadata.json +1 -1
- package/typings/overlay/overlay-directives.d.ts +0 -2
- package/typings/text-field/index.metadata.json +1 -1
- package/typings/tree/control/base-tree-control.d.ts +1 -1
- package/typings/tree/control/nested-tree-control.d.ts +2 -2
- package/typings/tree/control/tree-control.d.ts +1 -1
package/esm2015/a11y.js
CHANGED
|
@@ -11,7 +11,7 @@ import { Subject, Subscription, of } from 'rxjs';
|
|
|
11
11
|
import { UP_ARROW, DOWN_ARROW, LEFT_ARROW, RIGHT_ARROW, TAB, A, Z, ZERO, NINE, hasModifierKey } from '@angular/cdk/keycodes';
|
|
12
12
|
import { debounceTime, filter, map, tap, take } from 'rxjs/operators';
|
|
13
13
|
import { Platform, normalizePassiveListenerOptions, PlatformModule } from '@angular/cdk/platform';
|
|
14
|
-
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
14
|
+
import { coerceBooleanProperty, coerceElement } from '@angular/cdk/coercion';
|
|
15
15
|
import { ContentObserver, ObserversModule } from '@angular/cdk/observers';
|
|
16
16
|
|
|
17
17
|
/**
|
|
@@ -1076,6 +1076,9 @@ class FocusTrap {
|
|
|
1076
1076
|
this._ngZone = _ngZone;
|
|
1077
1077
|
this._document = _document;
|
|
1078
1078
|
this._hasAttached = false;
|
|
1079
|
+
// Event listeners for the anchors. Need to be regular functions so that we can unbind them later.
|
|
1080
|
+
this._startAnchorListener = () => this.focusLastTabbableElement();
|
|
1081
|
+
this._endAnchorListener = () => this.focusFirstTabbableElement();
|
|
1079
1082
|
this._enabled = true;
|
|
1080
1083
|
if (!deferAnchors) {
|
|
1081
1084
|
this.attachAnchors();
|
|
@@ -1102,11 +1105,21 @@ class FocusTrap {
|
|
|
1102
1105
|
* @return {?}
|
|
1103
1106
|
*/
|
|
1104
1107
|
destroy() {
|
|
1105
|
-
|
|
1106
|
-
|
|
1108
|
+
/** @type {?} */
|
|
1109
|
+
const startAnchor = this._startAnchor;
|
|
1110
|
+
/** @type {?} */
|
|
1111
|
+
const endAnchor = this._endAnchor;
|
|
1112
|
+
if (startAnchor) {
|
|
1113
|
+
startAnchor.removeEventListener('focus', this._startAnchorListener);
|
|
1114
|
+
if (startAnchor.parentNode) {
|
|
1115
|
+
startAnchor.parentNode.removeChild(startAnchor);
|
|
1116
|
+
}
|
|
1107
1117
|
}
|
|
1108
|
-
if (
|
|
1109
|
-
|
|
1118
|
+
if (endAnchor) {
|
|
1119
|
+
endAnchor.removeEventListener('focus', this._endAnchorListener);
|
|
1120
|
+
if (endAnchor.parentNode) {
|
|
1121
|
+
endAnchor.parentNode.removeChild(endAnchor);
|
|
1122
|
+
}
|
|
1110
1123
|
}
|
|
1111
1124
|
this._startAnchor = this._endAnchor = null;
|
|
1112
1125
|
}
|
|
@@ -1124,11 +1137,11 @@ class FocusTrap {
|
|
|
1124
1137
|
this._ngZone.runOutsideAngular(() => {
|
|
1125
1138
|
if (!this._startAnchor) {
|
|
1126
1139
|
this._startAnchor = this._createAnchor();
|
|
1127
|
-
(/** @type {?} */ (this._startAnchor)).addEventListener('focus',
|
|
1140
|
+
(/** @type {?} */ (this._startAnchor)).addEventListener('focus', this._startAnchorListener);
|
|
1128
1141
|
}
|
|
1129
1142
|
if (!this._endAnchor) {
|
|
1130
1143
|
this._endAnchor = this._createAnchor();
|
|
1131
|
-
(/** @type {?} */ (this._endAnchor)).addEventListener('focus',
|
|
1144
|
+
(/** @type {?} */ (this._endAnchor)).addEventListener('focus', this._endAnchorListener);
|
|
1132
1145
|
}
|
|
1133
1146
|
});
|
|
1134
1147
|
if (this._element.parentNode) {
|
|
@@ -1805,7 +1818,7 @@ class FocusMonitor {
|
|
|
1805
1818
|
return of(null);
|
|
1806
1819
|
}
|
|
1807
1820
|
/** @type {?} */
|
|
1808
|
-
const nativeElement =
|
|
1821
|
+
const nativeElement = coerceElement(element);
|
|
1809
1822
|
// Check if we're already monitoring this element.
|
|
1810
1823
|
if (this._elementInfo.has(nativeElement)) {
|
|
1811
1824
|
/** @type {?} */
|
|
@@ -1844,7 +1857,7 @@ class FocusMonitor {
|
|
|
1844
1857
|
*/
|
|
1845
1858
|
stopMonitoring(element) {
|
|
1846
1859
|
/** @type {?} */
|
|
1847
|
-
const nativeElement =
|
|
1860
|
+
const nativeElement = coerceElement(element);
|
|
1848
1861
|
/** @type {?} */
|
|
1849
1862
|
const elementInfo = this._elementInfo.get(nativeElement);
|
|
1850
1863
|
if (elementInfo) {
|
|
@@ -1863,7 +1876,7 @@ class FocusMonitor {
|
|
|
1863
1876
|
*/
|
|
1864
1877
|
focusVia(element, origin, options) {
|
|
1865
1878
|
/** @type {?} */
|
|
1866
|
-
const nativeElement =
|
|
1879
|
+
const nativeElement = coerceElement(element);
|
|
1867
1880
|
this._setOriginForCurrentEventQueue(origin);
|
|
1868
1881
|
// `focus` isn't available on the server
|
|
1869
1882
|
if (typeof nativeElement.focus === 'function') {
|
|
@@ -2061,14 +2074,6 @@ class FocusMonitor {
|
|
|
2061
2074
|
clearTimeout(this._originTimeoutId);
|
|
2062
2075
|
}
|
|
2063
2076
|
}
|
|
2064
|
-
/**
|
|
2065
|
-
* @private
|
|
2066
|
-
* @param {?} element
|
|
2067
|
-
* @return {?}
|
|
2068
|
-
*/
|
|
2069
|
-
_getNativeElement(element) {
|
|
2070
|
-
return element instanceof ElementRef ? element.nativeElement : element;
|
|
2071
|
-
}
|
|
2072
2077
|
}
|
|
2073
2078
|
FocusMonitor.decorators = [
|
|
2074
2079
|
{ type: Injectable, args: [{ providedIn: 'root' },] },
|