@angular/cdk 10.0.2 → 10.1.0

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.
Files changed (128) hide show
  1. package/a11y/aria-describer/aria-describer.d.ts +10 -1
  2. package/a11y/index.metadata.json +1 -1
  3. package/a11y/interactivity-checker/interactivity-checker.d.ts +11 -1
  4. package/a11y/key-manager/list-key-manager.d.ts +6 -0
  5. package/accordion/accordion.d.ts +7 -1
  6. package/accordion/index.d.ts +1 -0
  7. package/accordion/index.metadata.json +1 -1
  8. package/bundles/cdk-a11y.umd.js +63 -11
  9. package/bundles/cdk-a11y.umd.js.map +1 -1
  10. package/bundles/cdk-a11y.umd.min.js +11 -11
  11. package/bundles/cdk-a11y.umd.min.js.map +1 -1
  12. package/bundles/cdk-accordion.umd.js +12 -4
  13. package/bundles/cdk-accordion.umd.js.map +1 -1
  14. package/bundles/cdk-accordion.umd.min.js +2 -2
  15. package/bundles/cdk-accordion.umd.min.js.map +1 -1
  16. package/bundles/cdk-drag-drop.umd.js +640 -599
  17. package/bundles/cdk-drag-drop.umd.js.map +1 -1
  18. package/bundles/cdk-drag-drop.umd.min.js +8 -16
  19. package/bundles/cdk-drag-drop.umd.min.js.map +1 -1
  20. package/bundles/cdk-overlay.umd.js +199 -42
  21. package/bundles/cdk-overlay.umd.js.map +1 -1
  22. package/bundles/cdk-overlay.umd.min.js +11 -18
  23. package/bundles/cdk-overlay.umd.min.js.map +1 -1
  24. package/bundles/cdk-platform.umd.min.js +1 -1
  25. package/bundles/cdk-platform.umd.min.js.map +1 -1
  26. package/bundles/cdk-scrolling.umd.js +9 -1
  27. package/bundles/cdk-scrolling.umd.js.map +1 -1
  28. package/bundles/cdk-scrolling.umd.min.js +7 -0
  29. package/bundles/cdk-scrolling.umd.min.js.map +1 -1
  30. package/bundles/cdk-testing-protractor.umd.min.js +1 -1
  31. package/bundles/cdk-testing-protractor.umd.min.js.map +1 -1
  32. package/bundles/cdk-testing-testbed.umd.min.js +8 -8
  33. package/bundles/cdk-testing-testbed.umd.min.js.map +1 -1
  34. package/bundles/cdk-testing.umd.js +32 -0
  35. package/bundles/cdk-testing.umd.js.map +1 -1
  36. package/bundles/cdk-testing.umd.min.js +5 -5
  37. package/bundles/cdk-testing.umd.min.js.map +1 -1
  38. package/bundles/cdk-tree.umd.js +6 -2
  39. package/bundles/cdk-tree.umd.js.map +1 -1
  40. package/bundles/cdk-tree.umd.min.js +3 -3
  41. package/bundles/cdk-tree.umd.min.js.map +1 -1
  42. package/bundles/cdk.umd.js +1 -1
  43. package/bundles/cdk.umd.js.map +1 -1
  44. package/bundles/cdk.umd.min.js +1 -1
  45. package/bundles/cdk.umd.min.js.map +1 -1
  46. package/drag-drop/directives/drag-handle.d.ts +7 -1
  47. package/drag-drop/directives/drag-placeholder.d.ts +7 -1
  48. package/drag-drop/directives/drag-preview.d.ts +7 -1
  49. package/drag-drop/directives/drag.d.ts +3 -7
  50. package/drag-drop/directives/drop-list-group.d.ts +7 -1
  51. package/drag-drop/directives/drop-list.d.ts +7 -1
  52. package/drag-drop/index.d.ts +2 -2
  53. package/drag-drop/index.metadata.json +1 -1
  54. package/esm2015/a11y/aria-describer/aria-describer.js +20 -6
  55. package/esm2015/a11y/interactivity-checker/interactivity-checker.js +16 -3
  56. package/esm2015/a11y/key-manager/list-key-manager.js +27 -2
  57. package/esm2015/accordion/accordion-item.js +7 -7
  58. package/esm2015/accordion/accordion.js +9 -2
  59. package/esm2015/accordion/index.js +2 -1
  60. package/esm2015/drag-drop/directives/drag-handle.js +11 -4
  61. package/esm2015/drag-drop/directives/drag-placeholder.js +10 -3
  62. package/esm2015/drag-drop/directives/drag-preview.js +10 -3
  63. package/esm2015/drag-drop/directives/drag.js +19 -15
  64. package/esm2015/drag-drop/directives/drop-list-group.js +9 -2
  65. package/esm2015/drag-drop/directives/drop-list.js +11 -6
  66. package/esm2015/drag-drop/index.js +3 -2
  67. package/esm2015/layout/breakpoints-observer.js +1 -1
  68. package/esm2015/overlay/dispatchers/base-overlay-dispatcher.js +51 -0
  69. package/esm2015/overlay/dispatchers/index.js +10 -0
  70. package/esm2015/overlay/dispatchers/overlay-keyboard-dispatcher.js +79 -0
  71. package/esm2015/overlay/dispatchers/overlay-outside-click-dispatcher.js +94 -0
  72. package/esm2015/overlay/index.js +5 -4
  73. package/esm2015/overlay/overlay-config.js +5 -1
  74. package/esm2015/overlay/overlay-directives.js +17 -7
  75. package/esm2015/overlay/overlay-module.js +2 -2
  76. package/esm2015/overlay/overlay-ref.js +24 -2
  77. package/esm2015/overlay/overlay-reference.js +1 -1
  78. package/esm2015/overlay/overlay.js +10 -5
  79. package/esm2015/overlay/position/overlay-position-builder.js +1 -1
  80. package/esm2015/overlay/public-api.js +2 -2
  81. package/esm2015/scrolling/public-api.js +2 -1
  82. package/esm2015/scrolling/virtual-for-of.js +1 -1
  83. package/esm2015/scrolling/virtual-scroll-repeater.js +8 -0
  84. package/esm2015/scrolling/virtual-scroll-viewport.js +2 -2
  85. package/esm2015/testing/component-harness.js +19 -1
  86. package/esm2015/testing/harness-environment.js +7 -1
  87. package/esm2015/tree/control/nested-tree-control.js +7 -3
  88. package/esm2015/version.js +1 -1
  89. package/fesm2015/a11y.js +60 -10
  90. package/fesm2015/a11y.js.map +1 -1
  91. package/fesm2015/accordion.js +13 -6
  92. package/fesm2015/accordion.js.map +1 -1
  93. package/fesm2015/cdk.js +1 -1
  94. package/fesm2015/cdk.js.map +1 -1
  95. package/fesm2015/drag-drop.js +607 -570
  96. package/fesm2015/drag-drop.js.map +1 -1
  97. package/fesm2015/overlay.js +196 -32
  98. package/fesm2015/overlay.js.map +1 -1
  99. package/fesm2015/scrolling.js +9 -1
  100. package/fesm2015/scrolling.js.map +1 -1
  101. package/fesm2015/testing.js +25 -1
  102. package/fesm2015/testing.js.map +1 -1
  103. package/fesm2015/tree.js +6 -2
  104. package/fesm2015/tree.js.map +1 -1
  105. package/overlay/dispatchers/base-overlay-dispatcher.d.ts +28 -0
  106. package/overlay/dispatchers/index.d.ts +9 -0
  107. package/overlay/{keyboard → dispatchers}/overlay-keyboard-dispatcher.d.ts +4 -10
  108. package/overlay/dispatchers/overlay-outside-click-dispatcher.d.ts +27 -0
  109. package/overlay/index.d.ts +4 -3
  110. package/overlay/index.metadata.json +1 -1
  111. package/overlay/overlay-config.d.ts +4 -0
  112. package/overlay/overlay-directives.d.ts +4 -0
  113. package/overlay/overlay-ref.d.ts +8 -2
  114. package/overlay/overlay-reference.d.ts +1 -0
  115. package/overlay/overlay.d.ts +4 -2
  116. package/overlay/public-api.d.ts +1 -1
  117. package/package.json +1 -1
  118. package/schematics/ng-add/index.js +1 -1
  119. package/scrolling/index.metadata.json +1 -1
  120. package/scrolling/public-api.d.ts +1 -0
  121. package/scrolling/virtual-for-of.d.ts +2 -1
  122. package/scrolling/virtual-scroll-repeater.d.ts +16 -0
  123. package/scrolling/virtual-scroll-viewport.d.ts +4 -4
  124. package/testing/component-harness.d.ts +12 -0
  125. package/testing/harness-environment.d.ts +1 -0
  126. package/tree/control/nested-tree-control.d.ts +7 -2
  127. package/tree/index.metadata.json +1 -1
  128. package/esm2015/overlay/keyboard/overlay-keyboard-dispatcher.js +0 -96
package/fesm2015/a11y.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { DOCUMENT } from '@angular/common';
2
2
  import { ɵɵdefineInjectable, ɵɵinject, Injectable, Inject, QueryList, isDevMode, NgZone, Directive, ElementRef, Input, InjectionToken, Optional, EventEmitter, Output, NgModule } from '@angular/core';
3
+ import { Platform, normalizePassiveListenerOptions, _getShadowRoot, PlatformModule } from '@angular/cdk/platform';
3
4
  import { Subject, Subscription, of } from 'rxjs';
4
- import { hasModifierKey, A, Z, ZERO, NINE, LEFT_ARROW, RIGHT_ARROW, UP_ARROW, DOWN_ARROW, TAB } from '@angular/cdk/keycodes';
5
+ import { hasModifierKey, A, Z, ZERO, NINE, END, HOME, LEFT_ARROW, RIGHT_ARROW, UP_ARROW, DOWN_ARROW, TAB } from '@angular/cdk/keycodes';
5
6
  import { tap, debounceTime, filter, map, take } from 'rxjs/operators';
6
7
  import { coerceBooleanProperty, coerceElement } from '@angular/cdk/coercion';
7
- import { Platform, normalizePassiveListenerOptions, _getShadowRoot, PlatformModule } from '@angular/cdk/platform';
8
8
  import { ContentObserver, ObserversModule } from '@angular/cdk/observers';
9
9
 
10
10
  /**
@@ -76,7 +76,12 @@ let messagesContainer = null;
76
76
  * content.
77
77
  */
78
78
  class AriaDescriber {
79
- constructor(_document) {
79
+ constructor(_document,
80
+ /**
81
+ * @breaking-change 8.0.0 `_platform` parameter to be made required.
82
+ */
83
+ _platform) {
84
+ this._platform = _platform;
80
85
  this._document = _document;
81
86
  }
82
87
  /**
@@ -162,6 +167,8 @@ class AriaDescriber {
162
167
  /** Creates the global container for all aria-describedby messages. */
163
168
  _createMessagesContainer() {
164
169
  if (!messagesContainer) {
170
+ // @breaking-change 8.0.0 `_platform` null check can be removed once the parameter is required
171
+ const canBeAriaHidden = !this._platform || (!this._platform.EDGE && !this._platform.TRIDENT);
165
172
  const preExistingContainer = this._document.getElementById(MESSAGES_CONTAINER_ID);
166
173
  // When going from the server to the client, we may end up in a situation where there's
167
174
  // already a container on the page, but we don't have a reference to it. Clear the
@@ -172,8 +179,12 @@ class AriaDescriber {
172
179
  }
173
180
  messagesContainer = this._document.createElement('div');
174
181
  messagesContainer.id = MESSAGES_CONTAINER_ID;
175
- messagesContainer.setAttribute('aria-hidden', 'true');
176
- messagesContainer.style.display = 'none';
182
+ messagesContainer.classList.add('cdk-visually-hidden');
183
+ // IE and Edge won't read out the messages if they're in an `aria-hidden` container.
184
+ // We only disable `aria-hidden` for these platforms, because it comes with the
185
+ // disadvantage that people might hit the messages when they've navigated past
186
+ // the end of the document using the arrow keys.
187
+ messagesContainer.setAttribute('aria-hidden', canBeAriaHidden + '');
177
188
  this._document.body.appendChild(messagesContainer);
178
189
  }
179
190
  }
@@ -242,12 +253,13 @@ class AriaDescriber {
242
253
  return element.nodeType === this._document.ELEMENT_NODE;
243
254
  }
244
255
  }
245
- AriaDescriber.ɵprov = ɵɵdefineInjectable({ factory: function AriaDescriber_Factory() { return new AriaDescriber(ɵɵinject(DOCUMENT)); }, token: AriaDescriber, providedIn: "root" });
256
+ AriaDescriber.ɵprov = ɵɵdefineInjectable({ factory: function AriaDescriber_Factory() { return new AriaDescriber(ɵɵinject(DOCUMENT), ɵɵinject(Platform)); }, token: AriaDescriber, providedIn: "root" });
246
257
  AriaDescriber.decorators = [
247
258
  { type: Injectable, args: [{ providedIn: 'root' },] }
248
259
  ];
249
260
  AriaDescriber.ctorParameters = () => [
250
- { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] }
261
+ { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] },
262
+ { type: Platform }
251
263
  ];
252
264
 
253
265
  /**
@@ -271,6 +283,7 @@ class ListKeyManager {
271
283
  this._typeaheadSubscription = Subscription.EMPTY;
272
284
  this._vertical = true;
273
285
  this._allowedModifierKeys = [];
286
+ this._homeAndEnd = false;
274
287
  /**
275
288
  * Predicate function that can be used to check whether an item should be skipped
276
289
  * by the key manager. By default, disabled items are skipped.
@@ -372,6 +385,14 @@ class ListKeyManager {
372
385
  });
373
386
  return this;
374
387
  }
388
+ /**
389
+ * Configures the key manager to focus the first and last items
390
+ * respectively when the Home key and End Key are pressed.
391
+ */
392
+ withHomeAndEnd() {
393
+ this._homeAndEnd = true;
394
+ return this;
395
+ }
375
396
  setActiveItem(item) {
376
397
  const previousActiveItem = this._activeItem;
377
398
  this.updateActiveItem(item);
@@ -425,6 +446,22 @@ class ListKeyManager {
425
446
  else {
426
447
  return;
427
448
  }
449
+ case HOME:
450
+ if (this._homeAndEnd && isModifierAllowed) {
451
+ this.setFirstItemActive();
452
+ break;
453
+ }
454
+ else {
455
+ return;
456
+ }
457
+ case END:
458
+ if (this._homeAndEnd && isModifierAllowed) {
459
+ this.setLastItemActive();
460
+ break;
461
+ }
462
+ else {
463
+ return;
464
+ }
428
465
  default:
429
466
  if (isModifierAllowed || hasModifierKey(event, 'shiftKey')) {
430
467
  // Attempt to use the `event.key` which also maps it to the user's keyboard language,
@@ -590,6 +627,17 @@ class FocusKeyManager extends ListKeyManager {
590
627
  * Use of this source code is governed by an MIT-style license that can be
591
628
  * found in the LICENSE file at https://angular.io/license
592
629
  */
630
+ /**
631
+ * Configuration for the isFocusable method.
632
+ */
633
+ class IsFocusableConfig {
634
+ constructor() {
635
+ /**
636
+ * Whether to count an element as focusable even if it is not currently visible.
637
+ */
638
+ this.ignoreVisibility = false;
639
+ }
640
+ }
593
641
  // The InteractivityChecker leans heavily on the ally.js accessibility utilities.
594
642
  // Methods like `isTabbable` are only covering specific edge-cases for the browsers which are
595
643
  // supported.
@@ -695,12 +743,14 @@ class InteractivityChecker {
695
743
  * Gets whether an element can be focused by the user.
696
744
  *
697
745
  * @param element Element to be checked.
746
+ * @param config The config object with options to customize this method's behavior
698
747
  * @returns Whether the element is focusable.
699
748
  */
700
- isFocusable(element) {
749
+ isFocusable(element, config) {
701
750
  // Perform checks in order of left to most expensive.
702
751
  // Again, naive approach that does not capture many edge cases and browser quirks.
703
- return isPotentiallyFocusable(element) && !this.isDisabled(element) && this.isVisible(element);
752
+ return isPotentiallyFocusable(element) && !this.isDisabled(element) &&
753
+ ((config === null || config === void 0 ? void 0 : config.ignoreVisibility) || this.isVisible(element));
704
754
  }
705
755
  }
706
756
  InteractivityChecker.ɵprov = ɵɵdefineInjectable({ factory: function InteractivityChecker_Factory() { return new InteractivityChecker(ɵɵinject(Platform)); }, token: InteractivityChecker, providedIn: "root" });
@@ -2162,5 +2212,5 @@ A11yModule.ctorParameters = () => [
2162
2212
  * Generated bundle index. Do not edit.
2163
2213
  */
2164
2214
 
2165
- export { A11yModule, ActiveDescendantKeyManager, AriaDescriber, CDK_DESCRIBEDBY_HOST_ATTRIBUTE, CDK_DESCRIBEDBY_ID_PREFIX, CdkAriaLive, CdkMonitorFocus, CdkTrapFocus, ConfigurableFocusTrap, ConfigurableFocusTrapFactory, EventListenerFocusTrapInertStrategy, FOCUS_MONITOR_DEFAULT_OPTIONS, FOCUS_TRAP_INERT_STRATEGY, FocusKeyManager, FocusMonitor, FocusTrap, FocusTrapFactory, HighContrastModeDetector, InteractivityChecker, LIVE_ANNOUNCER_DEFAULT_OPTIONS, LIVE_ANNOUNCER_ELEMENT_TOKEN, LIVE_ANNOUNCER_ELEMENT_TOKEN_FACTORY, ListKeyManager, LiveAnnouncer, MESSAGES_CONTAINER_ID, TOUCH_BUFFER_MS, isFakeMousedownFromScreenReader, FocusTrapManager as ɵangular_material_src_cdk_a11y_a11y_a, ConfigurableFocusTrapConfig as ɵangular_material_src_cdk_a11y_a11y_b };
2215
+ export { A11yModule, ActiveDescendantKeyManager, AriaDescriber, CDK_DESCRIBEDBY_HOST_ATTRIBUTE, CDK_DESCRIBEDBY_ID_PREFIX, CdkAriaLive, CdkMonitorFocus, CdkTrapFocus, ConfigurableFocusTrap, ConfigurableFocusTrapFactory, EventListenerFocusTrapInertStrategy, FOCUS_MONITOR_DEFAULT_OPTIONS, FOCUS_TRAP_INERT_STRATEGY, FocusKeyManager, FocusMonitor, FocusTrap, FocusTrapFactory, HighContrastModeDetector, InteractivityChecker, IsFocusableConfig, LIVE_ANNOUNCER_DEFAULT_OPTIONS, LIVE_ANNOUNCER_ELEMENT_TOKEN, LIVE_ANNOUNCER_ELEMENT_TOKEN_FACTORY, ListKeyManager, LiveAnnouncer, MESSAGES_CONTAINER_ID, TOUCH_BUFFER_MS, isFakeMousedownFromScreenReader, FocusTrapManager as ɵangular_material_src_cdk_a11y_a11y_a, ConfigurableFocusTrapConfig as ɵangular_material_src_cdk_a11y_a11y_b };
2166
2216
  //# sourceMappingURL=a11y.js.map