@angular/cdk 10.0.0-rc.3 → 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 (242) hide show
  1. package/a11y/aria-describer/aria-describer.d.ts +10 -1
  2. package/a11y/focus-trap/focus-trap.d.ts +4 -2
  3. package/a11y/index.metadata.json +1 -1
  4. package/a11y/interactivity-checker/interactivity-checker.d.ts +11 -1
  5. package/a11y/key-manager/list-key-manager.d.ts +6 -0
  6. package/accordion/accordion.d.ts +7 -1
  7. package/accordion/index.d.ts +1 -0
  8. package/accordion/index.metadata.json +1 -1
  9. package/bundles/cdk-a11y.umd.js +78 -15
  10. package/bundles/cdk-a11y.umd.js.map +1 -1
  11. package/bundles/cdk-a11y.umd.min.js +11 -11
  12. package/bundles/cdk-a11y.umd.min.js.map +1 -1
  13. package/bundles/cdk-accordion.umd.js +12 -4
  14. package/bundles/cdk-accordion.umd.js.map +1 -1
  15. package/bundles/cdk-accordion.umd.min.js +2 -2
  16. package/bundles/cdk-accordion.umd.min.js.map +1 -1
  17. package/bundles/cdk-drag-drop.umd.js +717 -641
  18. package/bundles/cdk-drag-drop.umd.js.map +1 -1
  19. package/bundles/cdk-drag-drop.umd.min.js +8 -16
  20. package/bundles/cdk-drag-drop.umd.min.js.map +1 -1
  21. package/bundles/cdk-overlay.umd.js +199 -42
  22. package/bundles/cdk-overlay.umd.js.map +1 -1
  23. package/bundles/cdk-overlay.umd.min.js +11 -18
  24. package/bundles/cdk-overlay.umd.min.js.map +1 -1
  25. package/bundles/cdk-platform.umd.js +0 -1
  26. package/bundles/cdk-platform.umd.js.map +1 -1
  27. package/bundles/cdk-platform.umd.min.js +2 -2
  28. package/bundles/cdk-platform.umd.min.js.map +1 -1
  29. package/bundles/cdk-scrolling.umd.js +26 -4
  30. package/bundles/cdk-scrolling.umd.js.map +1 -1
  31. package/bundles/cdk-scrolling.umd.min.js +11 -4
  32. package/bundles/cdk-scrolling.umd.min.js.map +1 -1
  33. package/bundles/cdk-testing-protractor.umd.min.js +1 -1
  34. package/bundles/cdk-testing-protractor.umd.min.js.map +1 -1
  35. package/bundles/cdk-testing-testbed.umd.min.js +8 -8
  36. package/bundles/cdk-testing-testbed.umd.min.js.map +1 -1
  37. package/bundles/cdk-testing.umd.js +32 -0
  38. package/bundles/cdk-testing.umd.js.map +1 -1
  39. package/bundles/cdk-testing.umd.min.js +5 -5
  40. package/bundles/cdk-testing.umd.min.js.map +1 -1
  41. package/bundles/cdk-tree.umd.js +6 -2
  42. package/bundles/cdk-tree.umd.js.map +1 -1
  43. package/bundles/cdk-tree.umd.min.js +3 -3
  44. package/bundles/cdk-tree.umd.min.js.map +1 -1
  45. package/bundles/cdk.umd.js +1 -1
  46. package/bundles/cdk.umd.js.map +1 -1
  47. package/bundles/cdk.umd.min.js +1 -1
  48. package/bundles/cdk.umd.min.js.map +1 -1
  49. package/drag-drop/directives/drag-handle.d.ts +7 -1
  50. package/drag-drop/directives/drag-placeholder.d.ts +7 -1
  51. package/drag-drop/directives/drag-preview.d.ts +7 -1
  52. package/drag-drop/directives/drag.d.ts +4 -14
  53. package/drag-drop/directives/drop-list-group.d.ts +7 -1
  54. package/drag-drop/directives/drop-list.d.ts +7 -1
  55. package/drag-drop/drag-ref.d.ts +6 -0
  56. package/drag-drop/drop-list-ref.d.ts +3 -2
  57. package/drag-drop/index.d.ts +2 -2
  58. package/drag-drop/index.metadata.json +1 -1
  59. package/esm2015/a11y/a11y-module.js +15 -19
  60. package/esm2015/a11y/aria-describer/aria-describer.js +177 -167
  61. package/esm2015/a11y/focus-monitor/focus-monitor.js +337 -345
  62. package/esm2015/a11y/focus-trap/configurable-focus-trap-factory.js +30 -34
  63. package/esm2015/a11y/focus-trap/focus-trap-manager.js +36 -40
  64. package/esm2015/a11y/focus-trap/focus-trap.js +85 -82
  65. package/esm2015/a11y/high-contrast-mode/high-contrast-mode-detector.js +56 -60
  66. package/esm2015/a11y/interactivity-checker/interactivity-checker.js +113 -104
  67. package/esm2015/a11y/key-manager/list-key-manager.js +29 -4
  68. package/esm2015/a11y/live-announcer/live-announcer.js +138 -146
  69. package/esm2015/accordion/accordion-item.js +119 -123
  70. package/esm2015/accordion/accordion-module.js +9 -13
  71. package/esm2015/accordion/accordion.js +49 -46
  72. package/esm2015/accordion/index.js +2 -1
  73. package/esm2015/bidi/bidi-module.js +9 -13
  74. package/esm2015/bidi/dir.js +41 -45
  75. package/esm2015/bidi/directionality.js +27 -31
  76. package/esm2015/clipboard/clipboard-module.js +9 -13
  77. package/esm2015/clipboard/clipboard.js +36 -40
  78. package/esm2015/clipboard/copy-to-clipboard.js +71 -75
  79. package/esm2015/collections/unique-selection-dispatcher.js +33 -37
  80. package/esm2015/drag-drop/directives/drag-handle.js +42 -39
  81. package/esm2015/drag-drop/directives/drag-placeholder.js +24 -21
  82. package/esm2015/drag-drop/directives/drag-preview.js +29 -26
  83. package/esm2015/drag-drop/directives/drag.js +313 -319
  84. package/esm2015/drag-drop/directives/drop-list-group.js +32 -29
  85. package/esm2015/drag-drop/directives/drop-list.js +251 -250
  86. package/esm2015/drag-drop/drag-drop-module.js +27 -31
  87. package/esm2015/drag-drop/drag-drop-registry.js +139 -143
  88. package/esm2015/drag-drop/drag-drop.js +33 -37
  89. package/esm2015/drag-drop/drag-ref.js +59 -25
  90. package/esm2015/drag-drop/drop-list-ref.js +15 -9
  91. package/esm2015/drag-drop/index.js +3 -2
  92. package/esm2015/layout/breakpoints-observer.js +81 -85
  93. package/esm2015/layout/layout-module.js +6 -10
  94. package/esm2015/layout/media-matcher.js +28 -32
  95. package/esm2015/observers/observe-content.js +147 -163
  96. package/esm2015/overlay/dispatchers/base-overlay-dispatcher.js +51 -0
  97. package/esm2015/overlay/dispatchers/index.js +10 -0
  98. package/esm2015/overlay/dispatchers/overlay-keyboard-dispatcher.js +79 -0
  99. package/esm2015/overlay/dispatchers/overlay-outside-click-dispatcher.js +94 -0
  100. package/esm2015/overlay/fullscreen-overlay-container.js +70 -74
  101. package/esm2015/overlay/index.js +5 -4
  102. package/esm2015/overlay/overlay-config.js +5 -1
  103. package/esm2015/overlay/overlay-container.js +69 -73
  104. package/esm2015/overlay/overlay-directives.js +245 -243
  105. package/esm2015/overlay/overlay-module.js +15 -19
  106. package/esm2015/overlay/overlay-ref.js +24 -2
  107. package/esm2015/overlay/overlay-reference.js +1 -1
  108. package/esm2015/overlay/overlay.js +93 -92
  109. package/esm2015/overlay/position/connected-position.js +14 -18
  110. package/esm2015/overlay/position/overlay-position-builder.js +43 -47
  111. package/esm2015/overlay/public-api.js +2 -2
  112. package/esm2015/overlay/scroll/scroll-strategy-options.js +33 -37
  113. package/esm2015/platform/features/scrolling.js +1 -2
  114. package/esm2015/platform/platform-module.js +6 -10
  115. package/esm2015/platform/platform.js +48 -52
  116. package/esm2015/portal/portal-directives.js +181 -201
  117. package/esm2015/scrolling/fixed-size-virtual-scroll.js +57 -47
  118. package/esm2015/scrolling/public-api.js +2 -1
  119. package/esm2015/scrolling/scroll-dispatcher.js +139 -143
  120. package/esm2015/scrolling/scrollable.js +135 -139
  121. package/esm2015/scrolling/scrolling-module.js +32 -40
  122. package/esm2015/scrolling/viewport-ruler.js +105 -109
  123. package/esm2015/scrolling/virtual-for-of.js +264 -268
  124. package/esm2015/scrolling/virtual-scroll-repeater.js +8 -0
  125. package/esm2015/scrolling/virtual-scroll-viewport.js +318 -322
  126. package/esm2015/stepper/step-header.js +20 -24
  127. package/esm2015/stepper/step-label.js +13 -17
  128. package/esm2015/stepper/stepper-button.js +59 -67
  129. package/esm2015/stepper/stepper-module.js +24 -28
  130. package/esm2015/stepper/stepper.js +313 -321
  131. package/esm2015/table/cell.js +129 -157
  132. package/esm2015/table/row.js +183 -219
  133. package/esm2015/table/table-module.js +9 -13
  134. package/esm2015/table/table.js +765 -785
  135. package/esm2015/table/text-column.js +85 -89
  136. package/esm2015/testing/component-harness.js +19 -1
  137. package/esm2015/testing/harness-environment.js +7 -1
  138. package/esm2015/text-field/autofill.js +89 -97
  139. package/esm2015/text-field/autosize.js +225 -229
  140. package/esm2015/text-field/text-field-module.js +10 -14
  141. package/esm2015/tree/control/nested-tree-control.js +7 -3
  142. package/esm2015/tree/nested-node.js +79 -83
  143. package/esm2015/tree/node.js +17 -21
  144. package/esm2015/tree/outlet.js +15 -19
  145. package/esm2015/tree/padding.js +88 -92
  146. package/esm2015/tree/toggle.js +32 -36
  147. package/esm2015/tree/tree-module.js +10 -14
  148. package/esm2015/tree/tree.js +266 -274
  149. package/esm2015/version.js +1 -1
  150. package/fesm2015/a11y.js +1021 -996
  151. package/fesm2015/a11y.js.map +1 -1
  152. package/fesm2015/accordion.js +173 -175
  153. package/fesm2015/accordion.js.map +1 -1
  154. package/fesm2015/bidi.js +74 -83
  155. package/fesm2015/bidi.js.map +1 -1
  156. package/fesm2015/cdk.js +1 -1
  157. package/fesm2015/cdk.js.map +1 -1
  158. package/fesm2015/clipboard.js +113 -122
  159. package/fesm2015/clipboard.js.map +1 -1
  160. package/fesm2015/collections.js +32 -35
  161. package/fesm2015/collections.js.map +1 -1
  162. package/fesm2015/drag-drop.js +1005 -961
  163. package/fesm2015/drag-drop.js.map +1 -1
  164. package/fesm2015/layout.js +111 -120
  165. package/fesm2015/layout.js.map +1 -1
  166. package/fesm2015/observers.js +146 -158
  167. package/fesm2015/observers.js.map +1 -1
  168. package/fesm2015/overlay.js +793 -659
  169. package/fesm2015/overlay.js.map +1 -1
  170. package/fesm2015/platform.js +52 -59
  171. package/fesm2015/platform.js.map +1 -1
  172. package/fesm2015/portal.js +180 -195
  173. package/fesm2015/portal.js.map +1 -1
  174. package/fesm2015/scrolling.js +1058 -1060
  175. package/fesm2015/scrolling.js.map +1 -1
  176. package/fesm2015/stepper.js +424 -445
  177. package/fesm2015/stepper.js.map +1 -1
  178. package/fesm2015/table.js +1178 -1247
  179. package/fesm2015/table.js.map +1 -1
  180. package/fesm2015/testing.js +25 -1
  181. package/fesm2015/testing.js.map +1 -1
  182. package/fesm2015/text-field.js +318 -330
  183. package/fesm2015/text-field.js.map +1 -1
  184. package/fesm2015/tree.js +517 -537
  185. package/fesm2015/tree.js.map +1 -1
  186. package/overlay/dispatchers/base-overlay-dispatcher.d.ts +28 -0
  187. package/overlay/dispatchers/index.d.ts +9 -0
  188. package/overlay/{keyboard → dispatchers}/overlay-keyboard-dispatcher.d.ts +4 -10
  189. package/overlay/dispatchers/overlay-outside-click-dispatcher.d.ts +27 -0
  190. package/overlay/index.d.ts +4 -3
  191. package/overlay/index.metadata.json +1 -1
  192. package/overlay/overlay-config.d.ts +4 -0
  193. package/overlay/overlay-directives.d.ts +4 -0
  194. package/overlay/overlay-ref.d.ts +8 -2
  195. package/overlay/overlay-reference.d.ts +1 -0
  196. package/overlay/overlay.d.ts +4 -2
  197. package/overlay/public-api.d.ts +1 -1
  198. package/package.json +3 -3
  199. package/schematics/index.js +1 -1
  200. package/schematics/migration.json +5 -0
  201. package/schematics/ng-add/index.js +1 -1
  202. package/schematics/ng-update/data/index.js +1 -1
  203. package/schematics/ng-update/devkit-file-system.d.ts +5 -5
  204. package/schematics/ng-update/devkit-file-system.js +21 -16
  205. package/schematics/ng-update/devkit-migration-rule.js +13 -20
  206. package/schematics/ng-update/devkit-migration.d.ts +0 -2
  207. package/schematics/ng-update/devkit-migration.js +1 -1
  208. package/schematics/ng-update/find-stylesheets.d.ts +10 -0
  209. package/schematics/ng-update/find-stylesheets.js +31 -0
  210. package/schematics/ng-update/index.d.ts +2 -0
  211. package/schematics/ng-update/index.js +7 -2
  212. package/schematics/ng-update/migrations/attribute-selectors.js +3 -3
  213. package/schematics/ng-update/migrations/css-selectors.js +3 -3
  214. package/schematics/ng-update/migrations/element-selectors.js +3 -3
  215. package/schematics/ng-update/public-api.js +1 -1
  216. package/schematics/update-tool/component-resource-collector.d.ts +1 -1
  217. package/schematics/update-tool/component-resource-collector.js +18 -14
  218. package/schematics/update-tool/file-system.d.ts +19 -14
  219. package/schematics/update-tool/file-system.js +1 -1
  220. package/schematics/update-tool/index.d.ts +21 -3
  221. package/schematics/update-tool/index.js +29 -23
  222. package/schematics/update-tool/public-api.js +1 -1
  223. package/schematics/update-tool/target-version.d.ts +2 -1
  224. package/schematics/update-tool/target-version.js +5 -3
  225. package/schematics/update-tool/utils/parse-tsconfig.d.ts +2 -1
  226. package/schematics/update-tool/utils/parse-tsconfig.js +6 -10
  227. package/schematics/update-tool/utils/virtual-host.d.ts +34 -0
  228. package/schematics/update-tool/utils/virtual-host.js +62 -0
  229. package/schematics/update-tool/version-changes.js +4 -6
  230. package/schematics/utils/index.js +1 -1
  231. package/schematics/utils/project-tsconfig-paths.d.ts +2 -1
  232. package/schematics/utils/project-tsconfig-paths.js +1 -1
  233. package/scrolling/index.metadata.json +1 -1
  234. package/scrolling/public-api.d.ts +1 -0
  235. package/scrolling/virtual-for-of.d.ts +2 -1
  236. package/scrolling/virtual-scroll-repeater.d.ts +16 -0
  237. package/scrolling/virtual-scroll-viewport.d.ts +4 -4
  238. package/testing/component-harness.d.ts +12 -0
  239. package/testing/harness-environment.d.ts +1 -0
  240. package/tree/control/nested-tree-control.d.ts +7 -2
  241. package/tree/index.metadata.json +1 -1
  242. package/esm2015/overlay/keyboard/overlay-keyboard-dispatcher.js +0 -100
@@ -14,181 +14,169 @@ import { debounceTime } from 'rxjs/operators';
14
14
  * Factory that creates a new MutationObserver and allows us to stub it out in unit tests.
15
15
  * @docs-private
16
16
  */
17
- let MutationObserverFactory = /** @class */ (() => {
18
- class MutationObserverFactory {
19
- create(callback) {
20
- return typeof MutationObserver === 'undefined' ? null : new MutationObserver(callback);
21
- }
17
+ class MutationObserverFactory {
18
+ create(callback) {
19
+ return typeof MutationObserver === 'undefined' ? null : new MutationObserver(callback);
22
20
  }
23
- MutationObserverFactory.ɵprov = ɵɵdefineInjectable({ factory: function MutationObserverFactory_Factory() { return new MutationObserverFactory(); }, token: MutationObserverFactory, providedIn: "root" });
24
- MutationObserverFactory.decorators = [
25
- { type: Injectable, args: [{ providedIn: 'root' },] }
26
- ];
27
- return MutationObserverFactory;
28
- })();
21
+ }
22
+ MutationObserverFactory.ɵprov = ɵɵdefineInjectable({ factory: function MutationObserverFactory_Factory() { return new MutationObserverFactory(); }, token: MutationObserverFactory, providedIn: "root" });
23
+ MutationObserverFactory.decorators = [
24
+ { type: Injectable, args: [{ providedIn: 'root' },] }
25
+ ];
29
26
  /** An injectable service that allows watching elements for changes to their content. */
30
- let ContentObserver = /** @class */ (() => {
31
- class ContentObserver {
32
- constructor(_mutationObserverFactory) {
33
- this._mutationObserverFactory = _mutationObserverFactory;
34
- /** Keeps track of the existing MutationObservers so they can be reused. */
35
- this._observedElements = new Map();
36
- }
37
- ngOnDestroy() {
38
- this._observedElements.forEach((_, element) => this._cleanupObserver(element));
39
- }
40
- observe(elementOrRef) {
41
- const element = coerceElement(elementOrRef);
42
- return new Observable((observer) => {
43
- const stream = this._observeElement(element);
44
- const subscription = stream.subscribe(observer);
45
- return () => {
46
- subscription.unsubscribe();
47
- this._unobserveElement(element);
48
- };
49
- });
50
- }
51
- /**
52
- * Observes the given element by using the existing MutationObserver if available, or creating a
53
- * new one if not.
54
- */
55
- _observeElement(element) {
56
- if (!this._observedElements.has(element)) {
57
- const stream = new Subject();
58
- const observer = this._mutationObserverFactory.create(mutations => stream.next(mutations));
59
- if (observer) {
60
- observer.observe(element, {
61
- characterData: true,
62
- childList: true,
63
- subtree: true
64
- });
65
- }
66
- this._observedElements.set(element, { observer, stream, count: 1 });
67
- }
68
- else {
69
- this._observedElements.get(element).count++;
27
+ class ContentObserver {
28
+ constructor(_mutationObserverFactory) {
29
+ this._mutationObserverFactory = _mutationObserverFactory;
30
+ /** Keeps track of the existing MutationObservers so they can be reused. */
31
+ this._observedElements = new Map();
32
+ }
33
+ ngOnDestroy() {
34
+ this._observedElements.forEach((_, element) => this._cleanupObserver(element));
35
+ }
36
+ observe(elementOrRef) {
37
+ const element = coerceElement(elementOrRef);
38
+ return new Observable((observer) => {
39
+ const stream = this._observeElement(element);
40
+ const subscription = stream.subscribe(observer);
41
+ return () => {
42
+ subscription.unsubscribe();
43
+ this._unobserveElement(element);
44
+ };
45
+ });
46
+ }
47
+ /**
48
+ * Observes the given element by using the existing MutationObserver if available, or creating a
49
+ * new one if not.
50
+ */
51
+ _observeElement(element) {
52
+ if (!this._observedElements.has(element)) {
53
+ const stream = new Subject();
54
+ const observer = this._mutationObserverFactory.create(mutations => stream.next(mutations));
55
+ if (observer) {
56
+ observer.observe(element, {
57
+ characterData: true,
58
+ childList: true,
59
+ subtree: true
60
+ });
70
61
  }
71
- return this._observedElements.get(element).stream;
62
+ this._observedElements.set(element, { observer, stream, count: 1 });
63
+ }
64
+ else {
65
+ this._observedElements.get(element).count++;
72
66
  }
73
- /**
74
- * Un-observes the given element and cleans up the underlying MutationObserver if nobody else is
75
- * observing this element.
76
- */
77
- _unobserveElement(element) {
78
- if (this._observedElements.has(element)) {
79
- this._observedElements.get(element).count--;
80
- if (!this._observedElements.get(element).count) {
81
- this._cleanupObserver(element);
82
- }
67
+ return this._observedElements.get(element).stream;
68
+ }
69
+ /**
70
+ * Un-observes the given element and cleans up the underlying MutationObserver if nobody else is
71
+ * observing this element.
72
+ */
73
+ _unobserveElement(element) {
74
+ if (this._observedElements.has(element)) {
75
+ this._observedElements.get(element).count--;
76
+ if (!this._observedElements.get(element).count) {
77
+ this._cleanupObserver(element);
83
78
  }
84
79
  }
85
- /** Clean up the underlying MutationObserver for the specified element. */
86
- _cleanupObserver(element) {
87
- if (this._observedElements.has(element)) {
88
- const { observer, stream } = this._observedElements.get(element);
89
- if (observer) {
90
- observer.disconnect();
91
- }
92
- stream.complete();
93
- this._observedElements.delete(element);
80
+ }
81
+ /** Clean up the underlying MutationObserver for the specified element. */
82
+ _cleanupObserver(element) {
83
+ if (this._observedElements.has(element)) {
84
+ const { observer, stream } = this._observedElements.get(element);
85
+ if (observer) {
86
+ observer.disconnect();
94
87
  }
88
+ stream.complete();
89
+ this._observedElements.delete(element);
95
90
  }
96
91
  }
97
- ContentObserver.ɵprov = ɵɵdefineInjectable({ factory: function ContentObserver_Factory() { return new ContentObserver(ɵɵinject(MutationObserverFactory)); }, token: ContentObserver, providedIn: "root" });
98
- ContentObserver.decorators = [
99
- { type: Injectable, args: [{ providedIn: 'root' },] }
100
- ];
101
- ContentObserver.ctorParameters = () => [
102
- { type: MutationObserverFactory }
103
- ];
104
- return ContentObserver;
105
- })();
92
+ }
93
+ ContentObserver.ɵprov = ɵɵdefineInjectable({ factory: function ContentObserver_Factory() { return new ContentObserver(ɵɵinject(MutationObserverFactory)); }, token: ContentObserver, providedIn: "root" });
94
+ ContentObserver.decorators = [
95
+ { type: Injectable, args: [{ providedIn: 'root' },] }
96
+ ];
97
+ ContentObserver.ctorParameters = () => [
98
+ { type: MutationObserverFactory }
99
+ ];
106
100
  /**
107
101
  * Directive that triggers a callback whenever the content of
108
102
  * its associated element has changed.
109
103
  */
110
- let CdkObserveContent = /** @class */ (() => {
111
- class CdkObserveContent {
112
- constructor(_contentObserver, _elementRef, _ngZone) {
113
- this._contentObserver = _contentObserver;
114
- this._elementRef = _elementRef;
115
- this._ngZone = _ngZone;
116
- /** Event emitted for each change in the element's content. */
117
- this.event = new EventEmitter();
118
- this._disabled = false;
119
- this._currentSubscription = null;
120
- }
121
- /**
122
- * Whether observing content is disabled. This option can be used
123
- * to disconnect the underlying MutationObserver until it is needed.
124
- */
125
- get disabled() { return this._disabled; }
126
- set disabled(value) {
127
- this._disabled = coerceBooleanProperty(value);
128
- this._disabled ? this._unsubscribe() : this._subscribe();
129
- }
130
- /** Debounce interval for emitting the changes. */
131
- get debounce() { return this._debounce; }
132
- set debounce(value) {
133
- this._debounce = coerceNumberProperty(value);
104
+ class CdkObserveContent {
105
+ constructor(_contentObserver, _elementRef, _ngZone) {
106
+ this._contentObserver = _contentObserver;
107
+ this._elementRef = _elementRef;
108
+ this._ngZone = _ngZone;
109
+ /** Event emitted for each change in the element's content. */
110
+ this.event = new EventEmitter();
111
+ this._disabled = false;
112
+ this._currentSubscription = null;
113
+ }
114
+ /**
115
+ * Whether observing content is disabled. This option can be used
116
+ * to disconnect the underlying MutationObserver until it is needed.
117
+ */
118
+ get disabled() { return this._disabled; }
119
+ set disabled(value) {
120
+ this._disabled = coerceBooleanProperty(value);
121
+ this._disabled ? this._unsubscribe() : this._subscribe();
122
+ }
123
+ /** Debounce interval for emitting the changes. */
124
+ get debounce() { return this._debounce; }
125
+ set debounce(value) {
126
+ this._debounce = coerceNumberProperty(value);
127
+ this._subscribe();
128
+ }
129
+ ngAfterContentInit() {
130
+ if (!this._currentSubscription && !this.disabled) {
134
131
  this._subscribe();
135
132
  }
136
- ngAfterContentInit() {
137
- if (!this._currentSubscription && !this.disabled) {
138
- this._subscribe();
139
- }
140
- }
141
- ngOnDestroy() {
142
- this._unsubscribe();
143
- }
144
- _subscribe() {
145
- this._unsubscribe();
146
- const stream = this._contentObserver.observe(this._elementRef);
147
- // TODO(mmalerba): We shouldn't be emitting on this @Output() outside the zone.
148
- // Consider brining it back inside the zone next time we're making breaking changes.
149
- // Bringing it back inside can cause things like infinite change detection loops and changed
150
- // after checked errors if people's code isn't handling it properly.
151
- this._ngZone.runOutsideAngular(() => {
152
- this._currentSubscription =
153
- (this.debounce ? stream.pipe(debounceTime(this.debounce)) : stream).subscribe(this.event);
154
- });
155
- }
156
- _unsubscribe() {
157
- if (this._currentSubscription) {
158
- this._currentSubscription.unsubscribe();
159
- }
160
- }
161
133
  }
162
- CdkObserveContent.decorators = [
163
- { type: Directive, args: [{
164
- selector: '[cdkObserveContent]',
165
- exportAs: 'cdkObserveContent',
166
- },] }
167
- ];
168
- CdkObserveContent.ctorParameters = () => [
169
- { type: ContentObserver },
170
- { type: ElementRef },
171
- { type: NgZone }
172
- ];
173
- CdkObserveContent.propDecorators = {
174
- event: [{ type: Output, args: ['cdkObserveContent',] }],
175
- disabled: [{ type: Input, args: ['cdkObserveContentDisabled',] }],
176
- debounce: [{ type: Input }]
177
- };
178
- return CdkObserveContent;
179
- })();
180
- let ObserversModule = /** @class */ (() => {
181
- class ObserversModule {
134
+ ngOnDestroy() {
135
+ this._unsubscribe();
136
+ }
137
+ _subscribe() {
138
+ this._unsubscribe();
139
+ const stream = this._contentObserver.observe(this._elementRef);
140
+ // TODO(mmalerba): We shouldn't be emitting on this @Output() outside the zone.
141
+ // Consider brining it back inside the zone next time we're making breaking changes.
142
+ // Bringing it back inside can cause things like infinite change detection loops and changed
143
+ // after checked errors if people's code isn't handling it properly.
144
+ this._ngZone.runOutsideAngular(() => {
145
+ this._currentSubscription =
146
+ (this.debounce ? stream.pipe(debounceTime(this.debounce)) : stream).subscribe(this.event);
147
+ });
148
+ }
149
+ _unsubscribe() {
150
+ if (this._currentSubscription) {
151
+ this._currentSubscription.unsubscribe();
152
+ }
182
153
  }
183
- ObserversModule.decorators = [
184
- { type: NgModule, args: [{
185
- exports: [CdkObserveContent],
186
- declarations: [CdkObserveContent],
187
- providers: [MutationObserverFactory]
188
- },] }
189
- ];
190
- return ObserversModule;
191
- })();
154
+ }
155
+ CdkObserveContent.decorators = [
156
+ { type: Directive, args: [{
157
+ selector: '[cdkObserveContent]',
158
+ exportAs: 'cdkObserveContent',
159
+ },] }
160
+ ];
161
+ CdkObserveContent.ctorParameters = () => [
162
+ { type: ContentObserver },
163
+ { type: ElementRef },
164
+ { type: NgZone }
165
+ ];
166
+ CdkObserveContent.propDecorators = {
167
+ event: [{ type: Output, args: ['cdkObserveContent',] }],
168
+ disabled: [{ type: Input, args: ['cdkObserveContentDisabled',] }],
169
+ debounce: [{ type: Input }]
170
+ };
171
+ class ObserversModule {
172
+ }
173
+ ObserversModule.decorators = [
174
+ { type: NgModule, args: [{
175
+ exports: [CdkObserveContent],
176
+ declarations: [CdkObserveContent],
177
+ providers: [MutationObserverFactory]
178
+ },] }
179
+ ];
192
180
 
193
181
  /**
194
182
  * @license
@@ -1 +1 @@
1
- {"version":3,"file":"observers.js","sources":["../../../../../../src/cdk/observers/observe-content.ts","../../../../../../src/cdk/observers/public-api.ts","../../../../../../src/cdk/observers/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 {\n coerceBooleanProperty,\n coerceNumberProperty,\n coerceElement,\n BooleanInput\n} from '@angular/cdk/coercion';\nimport {\n AfterContentInit,\n Directive,\n ElementRef,\n EventEmitter,\n Injectable,\n Input,\n NgModule,\n NgZone,\n OnDestroy,\n Output,\n} from '@angular/core';\nimport {Observable, Subject, Subscription, Observer} from 'rxjs';\nimport {debounceTime} from 'rxjs/operators';\n\n/**\n * Factory that creates a new MutationObserver and allows us to stub it out in unit tests.\n * @docs-private\n */\n@Injectable({providedIn: 'root'})\nexport class MutationObserverFactory {\n create(callback: MutationCallback): MutationObserver | null {\n return typeof MutationObserver === 'undefined' ? null : new MutationObserver(callback);\n }\n}\n\n\n/** An injectable service that allows watching elements for changes to their content. */\n@Injectable({providedIn: 'root'})\nexport class ContentObserver implements OnDestroy {\n /** Keeps track of the existing MutationObservers so they can be reused. */\n private _observedElements = new Map<Element, {\n observer: MutationObserver | null,\n stream: Subject<MutationRecord[]>,\n count: number\n }>();\n\n constructor(private _mutationObserverFactory: MutationObserverFactory) {}\n\n ngOnDestroy() {\n this._observedElements.forEach((_, element) => this._cleanupObserver(element));\n }\n\n /**\n * Observe content changes on an element.\n * @param element The element to observe for content changes.\n */\n observe(element: Element): Observable<MutationRecord[]>;\n\n /**\n * Observe content changes on an element.\n * @param element The element to observe for content changes.\n */\n observe(element: ElementRef<Element>): Observable<MutationRecord[]>;\n\n observe(elementOrRef: Element | ElementRef<Element>): Observable<MutationRecord[]> {\n const element = coerceElement(elementOrRef);\n\n return new Observable((observer: Observer<MutationRecord[]>) => {\n const stream = this._observeElement(element);\n const subscription = stream.subscribe(observer);\n\n return () => {\n subscription.unsubscribe();\n this._unobserveElement(element);\n };\n });\n }\n\n /**\n * Observes the given element by using the existing MutationObserver if available, or creating a\n * new one if not.\n */\n private _observeElement(element: Element): Subject<MutationRecord[]> {\n if (!this._observedElements.has(element)) {\n const stream = new Subject<MutationRecord[]>();\n const observer = this._mutationObserverFactory.create(mutations => stream.next(mutations));\n if (observer) {\n observer.observe(element, {\n characterData: true,\n childList: true,\n subtree: true\n });\n }\n this._observedElements.set(element, {observer, stream, count: 1});\n } else {\n this._observedElements.get(element)!.count++;\n }\n return this._observedElements.get(element)!.stream;\n }\n\n /**\n * Un-observes the given element and cleans up the underlying MutationObserver if nobody else is\n * observing this element.\n */\n private _unobserveElement(element: Element) {\n if (this._observedElements.has(element)) {\n this._observedElements.get(element)!.count--;\n if (!this._observedElements.get(element)!.count) {\n this._cleanupObserver(element);\n }\n }\n }\n\n /** Clean up the underlying MutationObserver for the specified element. */\n private _cleanupObserver(element: Element) {\n if (this._observedElements.has(element)) {\n const {observer, stream} = this._observedElements.get(element)!;\n if (observer) {\n observer.disconnect();\n }\n stream.complete();\n this._observedElements.delete(element);\n }\n }\n}\n\n\n/**\n * Directive that triggers a callback whenever the content of\n * its associated element has changed.\n */\n@Directive({\n selector: '[cdkObserveContent]',\n exportAs: 'cdkObserveContent',\n})\nexport class CdkObserveContent implements AfterContentInit, OnDestroy {\n /** Event emitted for each change in the element's content. */\n @Output('cdkObserveContent') event = new EventEmitter<MutationRecord[]>();\n\n /**\n * Whether observing content is disabled. This option can be used\n * to disconnect the underlying MutationObserver until it is needed.\n */\n @Input('cdkObserveContentDisabled')\n get disabled() { return this._disabled; }\n set disabled(value: any) {\n this._disabled = coerceBooleanProperty(value);\n this._disabled ? this._unsubscribe() : this._subscribe();\n }\n private _disabled = false;\n\n /** Debounce interval for emitting the changes. */\n @Input()\n get debounce(): number { return this._debounce; }\n set debounce(value: number) {\n this._debounce = coerceNumberProperty(value);\n this._subscribe();\n }\n private _debounce: number;\n\n private _currentSubscription: Subscription | null = null;\n\n constructor(private _contentObserver: ContentObserver,\n private _elementRef: ElementRef<HTMLElement>,\n private _ngZone: NgZone) {}\n\n ngAfterContentInit() {\n if (!this._currentSubscription && !this.disabled) {\n this._subscribe();\n }\n }\n\n ngOnDestroy() {\n this._unsubscribe();\n }\n\n private _subscribe() {\n this._unsubscribe();\n const stream = this._contentObserver.observe(this._elementRef);\n\n // TODO(mmalerba): We shouldn't be emitting on this @Output() outside the zone.\n // Consider brining it back inside the zone next time we're making breaking changes.\n // Bringing it back inside can cause things like infinite change detection loops and changed\n // after checked errors if people's code isn't handling it properly.\n this._ngZone.runOutsideAngular(() => {\n this._currentSubscription =\n (this.debounce ? stream.pipe(debounceTime(this.debounce)) : stream).subscribe(this.event);\n });\n }\n\n private _unsubscribe() {\n if (this._currentSubscription) {\n this._currentSubscription.unsubscribe();\n }\n }\n\n static ngAcceptInputType_disabled: BooleanInput;\n static ngAcceptInputType_debounce: BooleanInput;\n}\n\n\n@NgModule({\n exports: [CdkObserveContent],\n declarations: [CdkObserveContent],\n providers: [MutationObserverFactory]\n})\nexport class ObserversModule {}\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 './observe-content';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;AAAA;;;;;;;AAQA,AAqBA;;;;AAIA;IAAA,MACa,uBAAuB;QAClC,MAAM,CAAC,QAA0B;YAC/B,OAAO,OAAO,gBAAgB,KAAK,WAAW,GAAG,IAAI,GAAG,IAAI,gBAAgB,CAAC,QAAQ,CAAC,CAAC;SACxF;;;;gBAJF,UAAU,SAAC,EAAC,UAAU,EAAE,MAAM,EAAC;;kCAjChC;KAsCC;AAGD;AACA;IAAA,MACa,eAAe;QAQ1B,YAAoB,wBAAiD;YAAjD,6BAAwB,GAAxB,wBAAwB,CAAyB;;YAN7D,sBAAiB,GAAG,IAAI,GAAG,EAI/B,CAAC;SAEoE;QAEzE,WAAW;YACT,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,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AAC,mBAAmB;2BAM1B,KAAK,SAAC,2BAA2B;2BASjC,KAAK;;IA8CR,wBAAC;KAAA;;IAGD,MAKa,eAAe;;;gBAL3B,QAAQ,SAAC;oBACR,OAAO,EAAE,CAAC,iBAAiB,CAAC;oBAC5B,YAAY,EAAE,CAAC,iBAAiB,CAAC;oBACjC,SAAS,EAAE,CAAC,uBAAuB,CAAC;iBACrC;;IAC6B,sBAAC;;;ACnN/B;;;;;;GAMG;;ACNH;;GAEG;;;;"}
1
+ {"version":3,"file":"observers.js","sources":["../../../../../../src/cdk/observers/observe-content.ts","../../../../../../src/cdk/observers/public-api.ts","../../../../../../src/cdk/observers/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 {\n coerceBooleanProperty,\n coerceNumberProperty,\n coerceElement,\n BooleanInput\n} from '@angular/cdk/coercion';\nimport {\n AfterContentInit,\n Directive,\n ElementRef,\n EventEmitter,\n Injectable,\n Input,\n NgModule,\n NgZone,\n OnDestroy,\n Output,\n} from '@angular/core';\nimport {Observable, Subject, Subscription, Observer} from 'rxjs';\nimport {debounceTime} from 'rxjs/operators';\n\n/**\n * Factory that creates a new MutationObserver and allows us to stub it out in unit tests.\n * @docs-private\n */\n@Injectable({providedIn: 'root'})\nexport class MutationObserverFactory {\n create(callback: MutationCallback): MutationObserver | null {\n return typeof MutationObserver === 'undefined' ? null : new MutationObserver(callback);\n }\n}\n\n\n/** An injectable service that allows watching elements for changes to their content. */\n@Injectable({providedIn: 'root'})\nexport class ContentObserver implements OnDestroy {\n /** Keeps track of the existing MutationObservers so they can be reused. */\n private _observedElements = new Map<Element, {\n observer: MutationObserver | null,\n stream: Subject<MutationRecord[]>,\n count: number\n }>();\n\n constructor(private _mutationObserverFactory: MutationObserverFactory) {}\n\n ngOnDestroy() {\n this._observedElements.forEach((_, element) => this._cleanupObserver(element));\n }\n\n /**\n * Observe content changes on an element.\n * @param element The element to observe for content changes.\n */\n observe(element: Element): Observable<MutationRecord[]>;\n\n /**\n * Observe content changes on an element.\n * @param element The element to observe for content changes.\n */\n observe(element: ElementRef<Element>): Observable<MutationRecord[]>;\n\n observe(elementOrRef: Element | ElementRef<Element>): Observable<MutationRecord[]> {\n const element = coerceElement(elementOrRef);\n\n return new Observable((observer: Observer<MutationRecord[]>) => {\n const stream = this._observeElement(element);\n const subscription = stream.subscribe(observer);\n\n return () => {\n subscription.unsubscribe();\n this._unobserveElement(element);\n };\n });\n }\n\n /**\n * Observes the given element by using the existing MutationObserver if available, or creating a\n * new one if not.\n */\n private _observeElement(element: Element): Subject<MutationRecord[]> {\n if (!this._observedElements.has(element)) {\n const stream = new Subject<MutationRecord[]>();\n const observer = this._mutationObserverFactory.create(mutations => stream.next(mutations));\n if (observer) {\n observer.observe(element, {\n characterData: true,\n childList: true,\n subtree: true\n });\n }\n this._observedElements.set(element, {observer, stream, count: 1});\n } else {\n this._observedElements.get(element)!.count++;\n }\n return this._observedElements.get(element)!.stream;\n }\n\n /**\n * Un-observes the given element and cleans up the underlying MutationObserver if nobody else is\n * observing this element.\n */\n private _unobserveElement(element: Element) {\n if (this._observedElements.has(element)) {\n this._observedElements.get(element)!.count--;\n if (!this._observedElements.get(element)!.count) {\n this._cleanupObserver(element);\n }\n }\n }\n\n /** Clean up the underlying MutationObserver for the specified element. */\n private _cleanupObserver(element: Element) {\n if (this._observedElements.has(element)) {\n const {observer, stream} = this._observedElements.get(element)!;\n if (observer) {\n observer.disconnect();\n }\n stream.complete();\n this._observedElements.delete(element);\n }\n }\n}\n\n\n/**\n * Directive that triggers a callback whenever the content of\n * its associated element has changed.\n */\n@Directive({\n selector: '[cdkObserveContent]',\n exportAs: 'cdkObserveContent',\n})\nexport class CdkObserveContent implements AfterContentInit, OnDestroy {\n /** Event emitted for each change in the element's content. */\n @Output('cdkObserveContent') event = new EventEmitter<MutationRecord[]>();\n\n /**\n * Whether observing content is disabled. This option can be used\n * to disconnect the underlying MutationObserver until it is needed.\n */\n @Input('cdkObserveContentDisabled')\n get disabled() { return this._disabled; }\n set disabled(value: any) {\n this._disabled = coerceBooleanProperty(value);\n this._disabled ? this._unsubscribe() : this._subscribe();\n }\n private _disabled = false;\n\n /** Debounce interval for emitting the changes. */\n @Input()\n get debounce(): number { return this._debounce; }\n set debounce(value: number) {\n this._debounce = coerceNumberProperty(value);\n this._subscribe();\n }\n private _debounce: number;\n\n private _currentSubscription: Subscription | null = null;\n\n constructor(private _contentObserver: ContentObserver,\n private _elementRef: ElementRef<HTMLElement>,\n private _ngZone: NgZone) {}\n\n ngAfterContentInit() {\n if (!this._currentSubscription && !this.disabled) {\n this._subscribe();\n }\n }\n\n ngOnDestroy() {\n this._unsubscribe();\n }\n\n private _subscribe() {\n this._unsubscribe();\n const stream = this._contentObserver.observe(this._elementRef);\n\n // TODO(mmalerba): We shouldn't be emitting on this @Output() outside the zone.\n // Consider brining it back inside the zone next time we're making breaking changes.\n // Bringing it back inside can cause things like infinite change detection loops and changed\n // after checked errors if people's code isn't handling it properly.\n this._ngZone.runOutsideAngular(() => {\n this._currentSubscription =\n (this.debounce ? stream.pipe(debounceTime(this.debounce)) : stream).subscribe(this.event);\n });\n }\n\n private _unsubscribe() {\n if (this._currentSubscription) {\n this._currentSubscription.unsubscribe();\n }\n }\n\n static ngAcceptInputType_disabled: BooleanInput;\n static ngAcceptInputType_debounce: BooleanInput;\n}\n\n\n@NgModule({\n exports: [CdkObserveContent],\n declarations: [CdkObserveContent],\n providers: [MutationObserverFactory]\n})\nexport class ObserversModule {}\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 './observe-content';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;AAAA;;;;;;;AAQA,AAqBA;;;;AAKA,MAAa,uBAAuB;IAClC,MAAM,C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