@angular/cdk 12.1.1 → 12.1.2
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/index.metadata.json +1 -1
- package/a11y/input-modality/input-modality-detector.d.ts +0 -2
- package/bundles/cdk-a11y.umd.js +11 -16
- package/bundles/cdk-a11y.umd.js.map +1 -1
- package/bundles/cdk-drag-drop.umd.js +51 -38
- package/bundles/cdk-drag-drop.umd.js.map +1 -1
- package/bundles/cdk-overlay.umd.js +1 -2
- package/bundles/cdk-overlay.umd.js.map +1 -1
- package/bundles/cdk-platform.umd.js +7 -0
- package/bundles/cdk-platform.umd.js.map +1 -1
- package/bundles/cdk-scrolling.umd.js +3 -3
- package/bundles/cdk-scrolling.umd.js.map +1 -1
- package/bundles/cdk-table.umd.js +25 -9
- package/bundles/cdk-table.umd.js.map +1 -1
- package/bundles/cdk-testing-protractor.umd.js.map +1 -1
- package/bundles/cdk-testing-selenium-webdriver.umd.js.map +1 -1
- package/bundles/cdk-testing-testbed.umd.js +4 -2
- package/bundles/cdk-testing-testbed.umd.js.map +1 -1
- package/bundles/cdk-testing.umd.js.map +1 -1
- package/bundles/cdk.umd.js +1 -1
- package/bundles/cdk.umd.js.map +1 -1
- package/drag-drop/drag-styling.d.ts +5 -10
- package/drag-drop/index.metadata.json +1 -1
- package/drag-drop/parent-position-tracker.d.ts +0 -2
- package/esm2015/a11y/fake-event-detection.js +7 -6
- package/esm2015/a11y/focus-monitor/focus-monitor.js +5 -5
- package/esm2015/a11y/input-modality/input-modality-detector.js +5 -11
- package/esm2015/drag-drop/drag-ref.js +25 -17
- package/esm2015/drag-drop/drag-styling.js +26 -16
- package/esm2015/drag-drop/parent-position-tracker.js +3 -6
- package/esm2015/overlay/dispatchers/overlay-outside-click-dispatcher.js +3 -4
- package/esm2015/platform/features/shadow-dom.js +7 -1
- package/esm2015/scrolling/viewport-ruler.js +4 -4
- package/esm2015/table/cell.js +16 -4
- package/esm2015/table/table.js +2 -2
- package/esm2015/testing/protractor/protractor-element.js +1 -1
- package/esm2015/testing/selenium-webdriver/selenium-web-driver-element.js +1 -1
- package/esm2015/testing/test-element.js +1 -1
- package/esm2015/testing/testbed/fake-events/event-objects.js +5 -3
- package/esm2015/testing/testbed/unit-test-element.js +1 -1
- package/esm2015/version.js +1 -1
- package/fesm2015/a11y.js +12 -17
- package/fesm2015/a11y.js.map +1 -1
- package/fesm2015/cdk.js +1 -1
- package/fesm2015/cdk.js.map +1 -1
- package/fesm2015/drag-drop.js +49 -35
- package/fesm2015/drag-drop.js.map +1 -1
- package/fesm2015/overlay.js +2 -3
- package/fesm2015/overlay.js.map +1 -1
- package/fesm2015/platform.js +7 -1
- package/fesm2015/platform.js.map +1 -1
- package/fesm2015/scrolling.js +3 -3
- package/fesm2015/scrolling.js.map +1 -1
- package/fesm2015/table.js +15 -3
- package/fesm2015/table.js.map +1 -1
- package/fesm2015/testing/protractor.js.map +1 -1
- package/fesm2015/testing/selenium-webdriver.js.map +1 -1
- package/fesm2015/testing/testbed.js +4 -2
- package/fesm2015/testing/testbed.js.map +1 -1
- package/fesm2015/testing.js.map +1 -1
- package/package.json +1 -1
- package/platform/features/shadow-dom.d.ts +2 -0
- package/platform/index.metadata.json +1 -1
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-add/index.mjs +1 -1
- package/schematics/ng-update/devkit-migration-rule.js +1 -1
- package/schematics/ng-update/devkit-migration-rule.mjs +1 -1
- package/schematics/ng-update/html-parsing/elements.js +3 -2
- package/schematics/ng-update/html-parsing/elements.mjs +3 -2
- package/schematics/ng-update/typescript/base-types.js +2 -2
- package/schematics/ng-update/typescript/base-types.mjs +2 -2
- package/schematics/tsconfig.json +1 -0
- package/schematics/update-tool/migration.d.ts +2 -2
- package/schematics/update-tool/migration.js +1 -1
- package/schematics/update-tool/migration.mjs +1 -1
- package/schematics/utils/build-component.js +7 -8
- package/schematics/utils/build-component.mjs +7 -8
- package/table/index.metadata.json +1 -1
- package/testing/protractor/protractor-element.d.ts +1 -1
- package/testing/selenium-webdriver/selenium-web-driver-element.d.ts +1 -1
- package/testing/test-element.d.ts +1 -1
- package/testing/testbed/unit-test-element.d.ts +1 -1
package/fesm2015/cdk.js
CHANGED
|
@@ -8,7 +8,7 @@ import { Version } from '@angular/core';
|
|
|
8
8
|
* found in the LICENSE file at https://angular.io/license
|
|
9
9
|
*/
|
|
10
10
|
/** Current version of the Angular Component Development Kit. */
|
|
11
|
-
const VERSION = new Version('12.1.
|
|
11
|
+
const VERSION = new Version('12.1.2');
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* @license
|
package/fesm2015/cdk.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cdk.js","sources":["../../../../../../src/cdk/version.ts","../../../../../../src/cdk/public-api.ts","../../../../../../src/cdk/index.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Version} from '@angular/core';\n\n/** Current version of the Angular Component Development Kit. */\nexport const VERSION = new Version('12.1.
|
|
1
|
+
{"version":3,"file":"cdk.js","sources":["../../../../../../src/cdk/version.ts","../../../../../../src/cdk/public-api.ts","../../../../../../src/cdk/index.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Version} from '@angular/core';\n\n/** Current version of the Angular Component Development Kit. */\nexport const VERSION = new Version('12.1.2');\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nexport * from './version';\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;AAAA;;;;;;;AAUA;MACa,OAAO,GAAG,IAAI,OAAO,CAAC,mBAAmB;;ACXtD;;;;;;;;ACAA;;;;;;;;;;"}
|
package/fesm2015/drag-drop.js
CHANGED
|
@@ -4,8 +4,9 @@ import * as i1 from '@angular/common';
|
|
|
4
4
|
import { DOCUMENT } from '@angular/common';
|
|
5
5
|
import * as i2 from '@angular/cdk/scrolling';
|
|
6
6
|
import { ViewportRuler, ScrollDispatcher, CdkScrollableModule } from '@angular/cdk/scrolling';
|
|
7
|
-
import { normalizePassiveListenerOptions, _getShadowRoot } from '@angular/cdk/platform';
|
|
7
|
+
import { _getEventTarget, normalizePassiveListenerOptions, _getShadowRoot } from '@angular/cdk/platform';
|
|
8
8
|
import { coerceBooleanProperty, coerceElement, coerceArray, coerceNumberProperty } from '@angular/cdk/coercion';
|
|
9
|
+
import { isFakeTouchstartFromScreenReader, isFakeMousedownFromScreenReader } from '@angular/cdk/a11y';
|
|
9
10
|
import { Subject, Subscription, interval, animationFrameScheduler, Observable, merge } from 'rxjs';
|
|
10
11
|
import { takeUntil, startWith, map, take, tap, switchMap } from 'rxjs/operators';
|
|
11
12
|
import { Directionality } from '@angular/cdk/bidi';
|
|
@@ -18,13 +19,20 @@ import { Directionality } from '@angular/cdk/bidi';
|
|
|
18
19
|
* found in the LICENSE file at https://angular.io/license
|
|
19
20
|
*/
|
|
20
21
|
/**
|
|
21
|
-
* Shallow-extends a stylesheet object with another stylesheet object.
|
|
22
|
+
* Shallow-extends a stylesheet object with another stylesheet-like object.
|
|
23
|
+
* Note that the keys in `source` have to be dash-cased.
|
|
22
24
|
* @docs-private
|
|
23
25
|
*/
|
|
24
|
-
function extendStyles(dest, source) {
|
|
26
|
+
function extendStyles(dest, source, importantProperties) {
|
|
25
27
|
for (let key in source) {
|
|
26
28
|
if (source.hasOwnProperty(key)) {
|
|
27
|
-
|
|
29
|
+
const value = source[key];
|
|
30
|
+
if (value) {
|
|
31
|
+
dest.setProperty(key, value, (importantProperties === null || importantProperties === void 0 ? void 0 : importantProperties.has(key)) ? 'important' : '');
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
dest.removeProperty(key);
|
|
35
|
+
}
|
|
28
36
|
}
|
|
29
37
|
}
|
|
30
38
|
return dest;
|
|
@@ -38,26 +46,29 @@ function extendStyles(dest, source) {
|
|
|
38
46
|
function toggleNativeDragInteractions(element, enable) {
|
|
39
47
|
const userSelect = enable ? '' : 'none';
|
|
40
48
|
extendStyles(element.style, {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
49
|
+
'touch-action': enable ? '' : 'none',
|
|
50
|
+
'-webkit-user-drag': enable ? '' : 'none',
|
|
51
|
+
'-webkit-tap-highlight-color': enable ? '' : 'transparent',
|
|
52
|
+
'user-select': userSelect,
|
|
53
|
+
'-ms-user-select': userSelect,
|
|
54
|
+
'-webkit-user-select': userSelect,
|
|
55
|
+
'-moz-user-select': userSelect
|
|
48
56
|
});
|
|
49
57
|
}
|
|
50
58
|
/**
|
|
51
59
|
* Toggles whether an element is visible while preserving its dimensions.
|
|
52
60
|
* @param element Element whose visibility to toggle
|
|
53
61
|
* @param enable Whether the element should be visible.
|
|
62
|
+
* @param importantProperties Properties to be set as `!important`.
|
|
54
63
|
* @docs-private
|
|
55
64
|
*/
|
|
56
|
-
function toggleVisibility(element, enable) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
65
|
+
function toggleVisibility(element, enable, importantProperties) {
|
|
66
|
+
extendStyles(element.style, {
|
|
67
|
+
position: enable ? '' : 'fixed',
|
|
68
|
+
top: enable ? '' : '0',
|
|
69
|
+
opacity: enable ? '' : '0',
|
|
70
|
+
left: enable ? '' : '-999em'
|
|
71
|
+
}, importantProperties);
|
|
61
72
|
}
|
|
62
73
|
/**
|
|
63
74
|
* Combines a transform string with an optional other transform
|
|
@@ -197,7 +208,7 @@ class ParentPositionTracker {
|
|
|
197
208
|
}
|
|
198
209
|
/** Handles scrolling while a drag is taking place. */
|
|
199
210
|
handleScroll(event) {
|
|
200
|
-
const target =
|
|
211
|
+
const target = _getEventTarget(event);
|
|
201
212
|
const cachedPosition = this.positions.get(target);
|
|
202
213
|
if (!cachedPosition) {
|
|
203
214
|
return null;
|
|
@@ -232,10 +243,6 @@ class ParentPositionTracker {
|
|
|
232
243
|
return { top: topDifference, left: leftDifference };
|
|
233
244
|
}
|
|
234
245
|
}
|
|
235
|
-
/** Gets the target of an event while accounting for shadow dom. */
|
|
236
|
-
function getEventTarget(event) {
|
|
237
|
-
return (event.composedPath ? event.composedPath()[0] : event.target);
|
|
238
|
-
}
|
|
239
246
|
|
|
240
247
|
/**
|
|
241
248
|
* @license
|
|
@@ -320,6 +327,11 @@ const activeEventListenerOptions = normalizePassiveListenerOptions({ passive: fa
|
|
|
320
327
|
* addition to touch events.
|
|
321
328
|
*/
|
|
322
329
|
const MOUSE_EVENT_IGNORE_TIME = 800;
|
|
330
|
+
/** Inline styles to be set as `!important` while dragging. */
|
|
331
|
+
const dragImportantProperties = new Set([
|
|
332
|
+
// Needs to be important, because some `mat-table` sets `position: sticky !important`. See #22781.
|
|
333
|
+
'position'
|
|
334
|
+
]);
|
|
323
335
|
/**
|
|
324
336
|
* Reference to a draggable item. Used to manipulate or dispose of the item.
|
|
325
337
|
*/
|
|
@@ -395,7 +407,7 @@ class DragRef {
|
|
|
395
407
|
// Delegate the event based on whether it started from a handle or the element itself.
|
|
396
408
|
if (this._handles.length) {
|
|
397
409
|
const targetHandle = this._handles.find(handle => {
|
|
398
|
-
const target =
|
|
410
|
+
const target = _getEventTarget(event);
|
|
399
411
|
return !!target && (target === handle || handle.contains(target));
|
|
400
412
|
});
|
|
401
413
|
if (targetHandle && !this._disabledHandles.has(targetHandle) && !this.disabled) {
|
|
@@ -802,7 +814,7 @@ class DragRef {
|
|
|
802
814
|
// We move the element out at the end of the body and we make it hidden, because keeping it in
|
|
803
815
|
// place will throw off the consumer's `:last-child` selectors. We can't remove the element
|
|
804
816
|
// from the DOM completely, because iOS will stop firing all subsequent events in the chain.
|
|
805
|
-
toggleVisibility(element, false);
|
|
817
|
+
toggleVisibility(element, false, dragImportantProperties);
|
|
806
818
|
this._document.body.appendChild(parent.replaceChild(placeholder, element));
|
|
807
819
|
this._getPreviewInsertionPoint(parent, shadowRoot).appendChild(this._preview);
|
|
808
820
|
this.started.next({ source: this }); // Emit before notifying the container.
|
|
@@ -834,9 +846,11 @@ class DragRef {
|
|
|
834
846
|
const isTouchSequence = isTouchEvent(event);
|
|
835
847
|
const isAuxiliaryMouseButton = !isTouchSequence && event.button !== 0;
|
|
836
848
|
const rootElement = this._rootElement;
|
|
837
|
-
const target =
|
|
849
|
+
const target = _getEventTarget(event);
|
|
838
850
|
const isSyntheticEvent = !isTouchSequence && this._lastTouchEventTime &&
|
|
839
851
|
this._lastTouchEventTime + MOUSE_EVENT_IGNORE_TIME > Date.now();
|
|
852
|
+
const isFakeEvent = isTouchSequence ? isFakeTouchstartFromScreenReader(event) :
|
|
853
|
+
isFakeMousedownFromScreenReader(event);
|
|
840
854
|
// If the event started from an element with the native HTML drag&drop, it'll interfere
|
|
841
855
|
// with our own dragging (e.g. `img` tags do it by default). Prevent the default action
|
|
842
856
|
// to stop it from happening. Note that preventing on `dragstart` also seems to work, but
|
|
@@ -847,7 +861,7 @@ class DragRef {
|
|
|
847
861
|
event.preventDefault();
|
|
848
862
|
}
|
|
849
863
|
// Abort if the user is already dragging or is using a mouse button other than the primary one.
|
|
850
|
-
if (isDragging || isAuxiliaryMouseButton || isSyntheticEvent) {
|
|
864
|
+
if (isDragging || isAuxiliaryMouseButton || isSyntheticEvent || isFakeEvent) {
|
|
851
865
|
return;
|
|
852
866
|
}
|
|
853
867
|
// If we've got handles, we need to disable the tap highlight on the entire root element,
|
|
@@ -889,7 +903,7 @@ class DragRef {
|
|
|
889
903
|
// It's important that we maintain the position, because moving the element around in the DOM
|
|
890
904
|
// can throw off `NgFor` which does smart diffing and re-creates elements only when necessary,
|
|
891
905
|
// while moving the existing elements in all other cases.
|
|
892
|
-
toggleVisibility(this._rootElement, true);
|
|
906
|
+
toggleVisibility(this._rootElement, true, dragImportantProperties);
|
|
893
907
|
this._anchor.parentNode.replaceChild(this._rootElement, this._anchor);
|
|
894
908
|
this._destroyPreview();
|
|
895
909
|
this._destroyPlaceholder();
|
|
@@ -992,14 +1006,14 @@ class DragRef {
|
|
|
992
1006
|
extendStyles(preview.style, {
|
|
993
1007
|
// It's important that we disable the pointer events on the preview, because
|
|
994
1008
|
// it can throw off the `document.elementFromPoint` calls in the `CdkDropList`.
|
|
995
|
-
|
|
1009
|
+
'pointer-events': 'none',
|
|
996
1010
|
// We have to reset the margin, because it can throw off positioning relative to the viewport.
|
|
997
|
-
margin: '0',
|
|
998
|
-
position: 'fixed',
|
|
999
|
-
top: '0',
|
|
1000
|
-
left: '0',
|
|
1001
|
-
|
|
1002
|
-
});
|
|
1011
|
+
'margin': '0',
|
|
1012
|
+
'position': 'fixed',
|
|
1013
|
+
'top': '0',
|
|
1014
|
+
'left': '0',
|
|
1015
|
+
'z-index': `${this._config.zIndex || 1000}`
|
|
1016
|
+
}, dragImportantProperties);
|
|
1003
1017
|
toggleNativeDragInteractions(preview, false);
|
|
1004
1018
|
preview.classList.add('cdk-drag-preview');
|
|
1005
1019
|
preview.setAttribute('dir', this._direction);
|
|
@@ -1038,7 +1052,7 @@ class DragRef {
|
|
|
1038
1052
|
return this._ngZone.runOutsideAngular(() => {
|
|
1039
1053
|
return new Promise(resolve => {
|
|
1040
1054
|
const handler = ((event) => {
|
|
1041
|
-
if (!event || (
|
|
1055
|
+
if (!event || (_getEventTarget(event) === this._preview &&
|
|
1042
1056
|
event.propertyName === 'transform')) {
|
|
1043
1057
|
this._preview.removeEventListener('transitionend', handler);
|
|
1044
1058
|
resolve();
|
|
@@ -1287,7 +1301,7 @@ class DragRef {
|
|
|
1287
1301
|
_updateOnScroll(event) {
|
|
1288
1302
|
const scrollDifference = this._parentPositions.handleScroll(event);
|
|
1289
1303
|
if (scrollDifference) {
|
|
1290
|
-
const target =
|
|
1304
|
+
const target = _getEventTarget(event);
|
|
1291
1305
|
// ClientRect dimensions are based on the scroll position of the page and its parent node so
|
|
1292
1306
|
// we have to update the cached boundary ClientRect if the user has scrolled. Check for
|
|
1293
1307
|
// the `document` specifically since IE doesn't support `contains` on it.
|