@angular/cdk 7.1.0 → 7.2.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.
Files changed (267) hide show
  1. package/LICENSE +1 -1
  2. package/_a11y.scss +1 -1
  3. package/a11y/typings/focus-monitor/focus-monitor.d.ts +20 -5
  4. package/a11y/typings/focus-trap/focus-trap.d.ts +2 -0
  5. package/a11y/typings/index.metadata.json +1 -1
  6. package/bundles/cdk-a11y.umd.js +428 -197
  7. package/bundles/cdk-a11y.umd.js.map +1 -1
  8. package/bundles/cdk-a11y.umd.min.js +1 -1
  9. package/bundles/cdk-a11y.umd.min.js.map +1 -1
  10. package/bundles/cdk-accordion.umd.js +16 -9
  11. package/bundles/cdk-accordion.umd.js.map +1 -1
  12. package/bundles/cdk-accordion.umd.min.js.map +1 -1
  13. package/bundles/cdk-bidi.umd.js +11 -6
  14. package/bundles/cdk-bidi.umd.js.map +1 -1
  15. package/bundles/cdk-bidi.umd.min.js.map +1 -1
  16. package/bundles/cdk-coercion.umd.js +25 -9
  17. package/bundles/cdk-coercion.umd.js.map +1 -1
  18. package/bundles/cdk-coercion.umd.min.js +1 -1
  19. package/bundles/cdk-coercion.umd.min.js.map +1 -1
  20. package/bundles/cdk-collections.umd.js +28 -5
  21. package/bundles/cdk-collections.umd.js.map +1 -1
  22. package/bundles/cdk-collections.umd.min.js.map +1 -1
  23. package/bundles/cdk-drag-drop.umd.js +2297 -973
  24. package/bundles/cdk-drag-drop.umd.js.map +1 -1
  25. package/bundles/cdk-drag-drop.umd.min.js +2 -1
  26. package/bundles/cdk-drag-drop.umd.min.js.map +1 -1
  27. package/bundles/cdk-keycodes.umd.js +12 -2
  28. package/bundles/cdk-keycodes.umd.js.map +1 -1
  29. package/bundles/cdk-layout.umd.js +29 -22
  30. package/bundles/cdk-layout.umd.js.map +1 -1
  31. package/bundles/cdk-layout.umd.min.js +1 -1
  32. package/bundles/cdk-layout.umd.min.js.map +1 -1
  33. package/bundles/cdk-observers.umd.js +27 -8
  34. package/bundles/cdk-observers.umd.js.map +1 -1
  35. package/bundles/cdk-observers.umd.min.js +1 -1
  36. package/bundles/cdk-observers.umd.min.js.map +1 -1
  37. package/bundles/cdk-overlay.umd.js +586 -240
  38. package/bundles/cdk-overlay.umd.js.map +1 -1
  39. package/bundles/cdk-overlay.umd.min.js +2 -2
  40. package/bundles/cdk-overlay.umd.min.js.map +1 -1
  41. package/bundles/cdk-platform.umd.js +50 -28
  42. package/bundles/cdk-platform.umd.js.map +1 -1
  43. package/bundles/cdk-platform.umd.min.js.map +1 -1
  44. package/bundles/cdk-portal.umd.js +17 -10
  45. package/bundles/cdk-portal.umd.js.map +1 -1
  46. package/bundles/cdk-portal.umd.min.js.map +1 -1
  47. package/bundles/cdk-scrolling.umd.js +148 -50
  48. package/bundles/cdk-scrolling.umd.js.map +1 -1
  49. package/bundles/cdk-scrolling.umd.min.js +1 -1
  50. package/bundles/cdk-scrolling.umd.min.js.map +1 -1
  51. package/bundles/cdk-stepper.umd.js +69 -27
  52. package/bundles/cdk-stepper.umd.js.map +1 -1
  53. package/bundles/cdk-stepper.umd.min.js +1 -1
  54. package/bundles/cdk-stepper.umd.min.js.map +1 -1
  55. package/bundles/cdk-table.umd.js +189 -51
  56. package/bundles/cdk-table.umd.js.map +1 -1
  57. package/bundles/cdk-table.umd.min.js +1 -1
  58. package/bundles/cdk-table.umd.min.js.map +1 -1
  59. package/bundles/cdk-text-field.umd.js +76 -38
  60. package/bundles/cdk-text-field.umd.js.map +1 -1
  61. package/bundles/cdk-text-field.umd.min.js +1 -1
  62. package/bundles/cdk-text-field.umd.min.js.map +1 -1
  63. package/bundles/cdk-tree.umd.js +71 -34
  64. package/bundles/cdk-tree.umd.js.map +1 -1
  65. package/bundles/cdk-tree.umd.min.js +1 -1
  66. package/bundles/cdk-tree.umd.min.js.map +1 -1
  67. package/bundles/cdk.umd.js +5 -4
  68. package/bundles/cdk.umd.js.map +1 -1
  69. package/bundles/cdk.umd.min.js +1 -1
  70. package/bundles/cdk.umd.min.js.map +1 -1
  71. package/coercion/typings/element.d.ts +13 -0
  72. package/coercion/typings/index.metadata.json +1 -1
  73. package/coercion/typings/public-api.d.ts +1 -0
  74. package/drag-drop/typings/{drag-handle.d.ts → directives/drag-handle.d.ts} +6 -2
  75. package/drag-drop/typings/{drag-placeholder.d.ts → directives/drag-placeholder.d.ts} +0 -0
  76. package/drag-drop/typings/{drag-preview.d.ts → directives/drag-preview.d.ts} +0 -0
  77. package/drag-drop/typings/directives/drag.d.ts +110 -0
  78. package/{typings/esm5/drag-drop → drag-drop/typings/directives}/drop-list-group.d.ts +3 -0
  79. package/drag-drop/typings/{drop-list.d.ts → directives/drop-list.d.ts} +32 -72
  80. package/drag-drop/typings/drag-drop-registry.d.ts +8 -3
  81. package/drag-drop/typings/drag-events.d.ts +14 -7
  82. package/{typings/esm5/drag-drop/drag.d.ts → drag-drop/typings/drag-ref.d.ts} +152 -83
  83. package/drag-drop/typings/drop-list-container.d.ts +19 -3
  84. package/drag-drop/typings/drop-list-ref.d.ts +234 -0
  85. package/drag-drop/typings/index.d.ts +1 -0
  86. package/drag-drop/typings/index.metadata.json +1 -1
  87. package/drag-drop/typings/public-api.d.ts +13 -6
  88. package/esm2015/a11y.js +306 -182
  89. package/esm2015/a11y.js.map +1 -1
  90. package/esm2015/accordion.js +16 -11
  91. package/esm2015/accordion.js.map +1 -1
  92. package/esm2015/bidi.js +13 -8
  93. package/esm2015/bidi.js.map +1 -1
  94. package/esm2015/cdk.js +7 -6
  95. package/esm2015/cdk.js.map +1 -1
  96. package/esm2015/coercion.js +25 -8
  97. package/esm2015/coercion.js.map +1 -1
  98. package/esm2015/collections.js +22 -7
  99. package/esm2015/collections.js.map +1 -1
  100. package/esm2015/drag-drop.js +1774 -864
  101. package/esm2015/drag-drop.js.map +1 -1
  102. package/esm2015/keycodes.js +14 -4
  103. package/esm2015/keycodes.js.map +1 -1
  104. package/esm2015/layout.js +29 -19
  105. package/esm2015/layout.js.map +1 -1
  106. package/esm2015/observers.js +16 -11
  107. package/esm2015/observers.js.map +1 -1
  108. package/esm2015/overlay.js +373 -213
  109. package/esm2015/overlay.js.map +1 -1
  110. package/esm2015/platform.js +53 -31
  111. package/esm2015/platform.js.map +1 -1
  112. package/esm2015/portal.js +14 -10
  113. package/esm2015/portal.js.map +1 -1
  114. package/esm2015/scrolling.js +111 -51
  115. package/esm2015/scrolling.js.map +1 -1
  116. package/esm2015/stepper.js +56 -30
  117. package/esm2015/stepper.js.map +1 -1
  118. package/esm2015/table.js +96 -48
  119. package/esm2015/table.js.map +1 -1
  120. package/esm2015/text-field.js +54 -37
  121. package/esm2015/text-field.js.map +1 -1
  122. package/esm2015/tree.js +55 -36
  123. package/esm2015/tree.js.map +1 -1
  124. package/esm5/a11y.es5.js +432 -201
  125. package/esm5/a11y.es5.js.map +1 -1
  126. package/esm5/accordion.es5.js +18 -11
  127. package/esm5/accordion.es5.js.map +1 -1
  128. package/esm5/bidi.es5.js +13 -8
  129. package/esm5/bidi.es5.js.map +1 -1
  130. package/esm5/cdk.es5.js +7 -6
  131. package/esm5/cdk.es5.js.map +1 -1
  132. package/esm5/coercion.es5.js +25 -8
  133. package/esm5/coercion.es5.js.map +1 -1
  134. package/esm5/collections.es5.js +35 -7
  135. package/esm5/collections.es5.js.map +1 -1
  136. package/esm5/drag-drop.es5.js +2358 -1035
  137. package/esm5/drag-drop.es5.js.map +1 -1
  138. package/esm5/keycodes.es5.js +14 -4
  139. package/esm5/keycodes.es5.js.map +1 -1
  140. package/esm5/layout.es5.js +31 -24
  141. package/esm5/layout.es5.js.map +1 -1
  142. package/esm5/observers.es5.js +30 -11
  143. package/esm5/observers.es5.js.map +1 -1
  144. package/esm5/overlay.es5.js +590 -244
  145. package/esm5/overlay.es5.js.map +1 -1
  146. package/esm5/platform.es5.js +52 -30
  147. package/esm5/platform.es5.js.map +1 -1
  148. package/esm5/portal.es5.js +19 -12
  149. package/esm5/portal.es5.js.map +1 -1
  150. package/esm5/scrolling.es5.js +150 -52
  151. package/esm5/scrolling.es5.js.map +1 -1
  152. package/esm5/stepper.es5.js +71 -30
  153. package/esm5/stepper.es5.js.map +1 -1
  154. package/esm5/table.es5.js +191 -53
  155. package/esm5/table.es5.js.map +1 -1
  156. package/esm5/text-field.es5.js +75 -37
  157. package/esm5/text-field.es5.js.map +1 -1
  158. package/esm5/tree.es5.js +74 -37
  159. package/esm5/tree.es5.js.map +1 -1
  160. package/overlay/typings/index.metadata.json +1 -1
  161. package/overlay/typings/overlay-directives.d.ts +0 -2
  162. package/overlay/typings/overlay-ref.d.ts +1 -1
  163. package/package.json +4 -4
  164. package/portal/typings/portal.d.ts +1 -1
  165. package/schematics/migration.json +5 -0
  166. package/schematics/ng-generate/drag-drop/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.ts +2 -2
  167. package/schematics/ng-update/index.d.ts +2 -0
  168. package/schematics/ng-update/index.js +5 -0
  169. package/schematics/ng-update/index.js.map +1 -1
  170. package/schematics/ng-update/target-version.d.ts +7 -1
  171. package/schematics/ng-update/target-version.js +10 -0
  172. package/schematics/ng-update/target-version.js.map +1 -1
  173. package/schematics/ng-update/upgrade-data.js +2 -1
  174. package/schematics/ng-update/upgrade-data.js.map +1 -1
  175. package/schematics/ng-update/upgrade-rules/index.js +3 -2
  176. package/schematics/ng-update/upgrade-rules/index.js.map +1 -1
  177. package/schematics/utils/ast/ng-module-imports.d.ts +1 -1
  178. package/schematics/utils/ast/ng-module-imports.js +25 -13
  179. package/schematics/utils/ast/ng-module-imports.js.map +1 -1
  180. package/schematics/utils/get-project.js +2 -1
  181. package/schematics/utils/get-project.js.map +1 -1
  182. package/schematics/utils/parse5-element.js +3 -2
  183. package/schematics/utils/parse5-element.js.map +1 -1
  184. package/schematics/utils/project-targets.js +2 -1
  185. package/schematics/utils/project-targets.js.map +1 -1
  186. package/schematics/utils/version-agnostic-typescript.js +3 -2
  187. package/schematics/utils/version-agnostic-typescript.js.map +1 -1
  188. package/scrolling/typings/index.metadata.json +1 -1
  189. package/stepper/typings/index.metadata.json +1 -1
  190. package/stepper/typings/stepper.d.ts +13 -1
  191. package/text-field/typings/autosize.d.ts +6 -0
  192. package/text-field/typings/index.metadata.json +1 -1
  193. package/tree/typings/control/base-tree-control.d.ts +1 -1
  194. package/tree/typings/control/nested-tree-control.d.ts +2 -2
  195. package/tree/typings/control/tree-control.d.ts +1 -1
  196. package/tree/typings/nested-node.d.ts +5 -5
  197. package/typings/a11y/focus-monitor/focus-monitor.d.ts +20 -5
  198. package/typings/a11y/focus-trap/focus-trap.d.ts +2 -0
  199. package/typings/a11y/index.metadata.json +1 -1
  200. package/typings/coercion/element.d.ts +13 -0
  201. package/typings/coercion/index.metadata.json +1 -1
  202. package/typings/coercion/public-api.d.ts +1 -0
  203. package/typings/drag-drop/{drag-handle.d.ts → directives/drag-handle.d.ts} +6 -2
  204. package/typings/drag-drop/{drag-placeholder.d.ts → directives/drag-placeholder.d.ts} +0 -0
  205. package/typings/drag-drop/{drag-preview.d.ts → directives/drag-preview.d.ts} +0 -0
  206. package/typings/drag-drop/directives/drag.d.ts +110 -0
  207. package/typings/drag-drop/{drop-list-group.d.ts → directives/drop-list-group.d.ts} +3 -0
  208. package/typings/{esm5/drag-drop → drag-drop/directives}/drop-list.d.ts +32 -72
  209. package/typings/drag-drop/drag-drop-registry.d.ts +8 -3
  210. package/typings/drag-drop/drag-events.d.ts +14 -7
  211. package/typings/drag-drop/{drag.d.ts → drag-ref.d.ts} +152 -83
  212. package/typings/drag-drop/drop-list-container.d.ts +19 -3
  213. package/typings/drag-drop/drop-list-ref.d.ts +234 -0
  214. package/typings/drag-drop/index.d.ts +1 -0
  215. package/typings/drag-drop/index.metadata.json +1 -1
  216. package/typings/drag-drop/public-api.d.ts +13 -6
  217. package/typings/esm5/a11y/focus-monitor/focus-monitor.d.ts +20 -5
  218. package/typings/esm5/a11y/focus-trap/focus-trap.d.ts +2 -0
  219. package/typings/esm5/a11y/index.metadata.json +1 -1
  220. package/typings/esm5/coercion/element.d.ts +13 -0
  221. package/typings/esm5/coercion/index.metadata.json +1 -1
  222. package/typings/esm5/coercion/public-api.d.ts +1 -0
  223. package/typings/esm5/drag-drop/{drag-handle.d.ts → directives/drag-handle.d.ts} +6 -2
  224. package/typings/esm5/drag-drop/{drag-placeholder.d.ts → directives/drag-placeholder.d.ts} +0 -0
  225. package/typings/esm5/drag-drop/{drag-preview.d.ts → directives/drag-preview.d.ts} +0 -0
  226. package/typings/esm5/drag-drop/directives/drag.d.ts +110 -0
  227. package/{drag-drop/typings → typings/esm5/drag-drop/directives}/drop-list-group.d.ts +3 -0
  228. package/typings/{drag-drop → esm5/drag-drop/directives}/drop-list.d.ts +32 -72
  229. package/typings/esm5/drag-drop/drag-drop-registry.d.ts +8 -3
  230. package/typings/esm5/drag-drop/drag-events.d.ts +14 -7
  231. package/{drag-drop/typings/drag.d.ts → typings/esm5/drag-drop/drag-ref.d.ts} +152 -83
  232. package/typings/esm5/drag-drop/drop-list-container.d.ts +19 -3
  233. package/typings/esm5/drag-drop/drop-list-ref.d.ts +234 -0
  234. package/typings/esm5/drag-drop/index.d.ts +1 -0
  235. package/typings/esm5/drag-drop/index.metadata.json +1 -1
  236. package/typings/esm5/drag-drop/public-api.d.ts +13 -6
  237. package/typings/esm5/index.metadata.json +1 -1
  238. package/typings/esm5/overlay/index.metadata.json +1 -1
  239. package/typings/esm5/overlay/overlay-directives.d.ts +0 -2
  240. package/typings/esm5/overlay/overlay-ref.d.ts +1 -1
  241. package/typings/esm5/portal/portal.d.ts +1 -1
  242. package/typings/esm5/scrolling/index.metadata.json +1 -1
  243. package/typings/esm5/stepper/index.metadata.json +1 -1
  244. package/typings/esm5/stepper/stepper.d.ts +13 -1
  245. package/typings/esm5/text-field/autosize.d.ts +6 -0
  246. package/typings/esm5/text-field/index.metadata.json +1 -1
  247. package/typings/esm5/tree/control/base-tree-control.d.ts +1 -1
  248. package/typings/esm5/tree/control/nested-tree-control.d.ts +2 -2
  249. package/typings/esm5/tree/control/tree-control.d.ts +1 -1
  250. package/typings/esm5/tree/nested-node.d.ts +5 -5
  251. package/typings/index.metadata.json +1 -1
  252. package/typings/overlay/index.metadata.json +1 -1
  253. package/typings/overlay/overlay-directives.d.ts +0 -2
  254. package/typings/overlay/overlay-ref.d.ts +1 -1
  255. package/typings/portal/portal.d.ts +1 -1
  256. package/typings/schematics/ng-update/index.d.ts +2 -0
  257. package/typings/schematics/ng-update/target-version.d.ts +7 -1
  258. package/typings/schematics/utils/ast/ng-module-imports.d.ts +1 -1
  259. package/typings/scrolling/index.metadata.json +1 -1
  260. package/typings/stepper/index.metadata.json +1 -1
  261. package/typings/stepper/stepper.d.ts +13 -1
  262. package/typings/text-field/autosize.d.ts +6 -0
  263. package/typings/text-field/index.metadata.json +1 -1
  264. package/typings/tree/control/base-tree-control.d.ts +1 -1
  265. package/typings/tree/control/nested-tree-control.d.ts +2 -2
  266. package/typings/tree/control/tree-control.d.ts +1 -1
  267. package/typings/tree/nested-node.d.ts +5 -5
@@ -15,16 +15,17 @@ import { ArrayDataSource, DataSource } from '@angular/cdk/collections';
15
15
 
16
16
  /**
17
17
  * @fileoverview added by tsickle
18
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
18
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
19
19
  */
20
- /** *
20
+ /**
21
21
  * The injection token used to specify the virtual scrolling strategy.
22
- @type {?} */
22
+ * @type {?}
23
+ */
23
24
  const VIRTUAL_SCROLL_STRATEGY = new InjectionToken('VIRTUAL_SCROLL_STRATEGY');
24
25
 
25
26
  /**
26
27
  * @fileoverview added by tsickle
27
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
28
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
28
29
  */
29
30
  /**
30
31
  * Virtual scrolling strategy for lists with items of known fixed size.
@@ -103,16 +104,12 @@ class FixedSizeVirtualScrollStrategy {
103
104
  * \@docs-private Implemented as part of VirtualScrollStrategy.
104
105
  * @return {?}
105
106
  */
106
- onContentRendered() {
107
- /* no-op */
108
- }
107
+ onContentRendered() { }
109
108
  /**
110
109
  * \@docs-private Implemented as part of VirtualScrollStrategy.
111
110
  * @return {?}
112
111
  */
113
- onRenderedOffsetChanged() {
114
- /* no-op */
115
- }
112
+ onRenderedOffsetChanged() { }
116
113
  /**
117
114
  * Scroll to the offset for the given index.
118
115
  * @param {?} index The index of the element to scroll to.
@@ -126,6 +123,7 @@ class FixedSizeVirtualScrollStrategy {
126
123
  }
127
124
  /**
128
125
  * Update the viewport's total content size.
126
+ * @private
129
127
  * @return {?}
130
128
  */
131
129
  _updateTotalContentSize() {
@@ -136,6 +134,7 @@ class FixedSizeVirtualScrollStrategy {
136
134
  }
137
135
  /**
138
136
  * Update the viewport's rendered range.
137
+ * @private
139
138
  * @return {?}
140
139
  */
141
140
  _updateRenderedRange() {
@@ -258,11 +257,12 @@ CdkFixedSizeVirtualScroll.propDecorators = {
258
257
 
259
258
  /**
260
259
  * @fileoverview added by tsickle
261
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
260
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
262
261
  */
263
- /** *
262
+ /**
264
263
  * Time in ms to throttle the scrolling events by default.
265
- @type {?} */
264
+ * @type {?}
265
+ */
266
266
  const DEFAULT_SCROLL_TIME = 20;
267
267
  /**
268
268
  * Service contained all registered Scrollable references and emits an event when any one of the
@@ -335,10 +335,12 @@ class ScrollDispatcher {
335
335
  if (!this._platform.isBrowser) {
336
336
  return of();
337
337
  }
338
- return Observable.create((observer) => {
338
+ return new Observable((observer) => {
339
339
  if (!this._globalSubscription) {
340
340
  this._addGlobalListener();
341
341
  }
342
+ // In the case of a 0ms delay, use an observable without auditTime
343
+ // since it does add a perceptible delay in processing overhead.
342
344
  /** @type {?} */
343
345
  const subscription = auditTimeInMs > 0 ?
344
346
  this._scrolled.pipe(auditTime(auditTimeInMs)).subscribe(observer) :
@@ -392,6 +394,7 @@ class ScrollDispatcher {
392
394
  }
393
395
  /**
394
396
  * Returns true if the element is contained within the provided Scrollable.
397
+ * @private
395
398
  * @param {?} scrollable
396
399
  * @param {?} elementRef
397
400
  * @return {?}
@@ -407,11 +410,12 @@ class ScrollDispatcher {
407
410
  if (element == scrollableElement) {
408
411
  return true;
409
412
  }
410
- } while (element = /** @type {?} */ ((element)).parentElement);
413
+ } while (element = (/** @type {?} */ (element)).parentElement);
411
414
  return false;
412
415
  }
413
416
  /**
414
417
  * Sets up the global scroll listeners.
418
+ * @private
415
419
  * @return {?}
416
420
  */
417
421
  _addGlobalListener() {
@@ -421,6 +425,7 @@ class ScrollDispatcher {
421
425
  }
422
426
  /**
423
427
  * Cleans up the global scroll listener.
428
+ * @private
424
429
  * @return {?}
425
430
  */
426
431
  _removeGlobalListener() {
@@ -449,9 +454,10 @@ ScrollDispatcher.ctorParameters = () => [
449
454
  function SCROLL_DISPATCHER_PROVIDER_FACTORY(parentDispatcher, ngZone, platform) {
450
455
  return parentDispatcher || new ScrollDispatcher(ngZone, platform);
451
456
  }
452
- /** *
457
+ /**
453
458
  * \@docs-private \@deprecated \@breaking-change 8.0.0
454
- @type {?} */
459
+ * @type {?}
460
+ */
455
461
  const SCROLL_DISPATCHER_PROVIDER = {
456
462
  // If there is already a ScrollDispatcher available, use that. Otherwise, provide a new one.
457
463
  provide: ScrollDispatcher,
@@ -461,7 +467,7 @@ const SCROLL_DISPATCHER_PROVIDER = {
461
467
 
462
468
  /**
463
469
  * @fileoverview added by tsickle
464
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
470
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
465
471
  */
466
472
  /**
467
473
  * Sends an event when the directive's element is scrolled. Registers itself with the
@@ -481,7 +487,7 @@ class CdkScrollable {
481
487
  this.ngZone = ngZone;
482
488
  this.dir = dir;
483
489
  this._destroyed = new Subject();
484
- this._elementScrolled = Observable.create((observer) => this.ngZone.runOutsideAngular(() => fromEvent(this.elementRef.nativeElement, 'scroll').pipe(takeUntil(this._destroyed))
490
+ this._elementScrolled = new Observable((observer) => this.ngZone.runOutsideAngular(() => fromEvent(this.elementRef.nativeElement, 'scroll').pipe(takeUntil(this._destroyed))
485
491
  .subscribe(observer)));
486
492
  }
487
493
  /**
@@ -531,12 +537,14 @@ class CdkScrollable {
531
537
  options.right = options.right == null ? (isRtl ? options.start : options.end) : options.right;
532
538
  // Rewrite the bottom offset as a top offset.
533
539
  if (options.bottom != null) {
534
- options.top = el.scrollHeight - el.clientHeight - options.bottom;
540
+ ((/** @type {?} */ (options))).top =
541
+ el.scrollHeight - el.clientHeight - options.bottom;
535
542
  }
536
543
  // Rewrite the right offset as a left offset.
537
544
  if (isRtl && getRtlScrollAxisType() != RtlScrollAxisType.NORMAL) {
538
545
  if (options.left != null) {
539
- options.right = el.scrollWidth - el.clientWidth - options.left;
546
+ ((/** @type {?} */ (options))).right =
547
+ el.scrollWidth - el.clientWidth - options.left;
540
548
  }
541
549
  if (getRtlScrollAxisType() == RtlScrollAxisType.INVERTED) {
542
550
  options.left = options.right;
@@ -547,12 +555,14 @@ class CdkScrollable {
547
555
  }
548
556
  else {
549
557
  if (options.right != null) {
550
- options.left = el.scrollWidth - el.clientWidth - options.right;
558
+ ((/** @type {?} */ (options))).left =
559
+ el.scrollWidth - el.clientWidth - options.right;
551
560
  }
552
561
  }
553
562
  this._applyScrollToOptions(options);
554
563
  }
555
564
  /**
565
+ * @private
556
566
  * @param {?} options
557
567
  * @return {?}
558
568
  */
@@ -594,6 +604,7 @@ class CdkScrollable {
594
604
  if (from == 'bottom') {
595
605
  return el.scrollHeight - el.clientHeight - el.scrollTop;
596
606
  }
607
+ // Rewrite start & end as left or right offsets.
597
608
  /** @type {?} */
598
609
  const isRtl = this.dir && this.dir.value == 'rtl';
599
610
  if (from == 'start') {
@@ -649,7 +660,7 @@ CdkScrollable.ctorParameters = () => [
649
660
 
650
661
  /**
651
662
  * @fileoverview added by tsickle
652
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
663
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
653
664
  */
654
665
  /**
655
666
  * Checks if the given ranges are equal.
@@ -689,10 +700,14 @@ class CdkVirtualScrollViewport extends CdkScrollable {
689
700
  * The direction the viewport scrolls.
690
701
  */
691
702
  this.orientation = 'vertical';
703
+ // Note: we don't use the typical EventEmitter here because we need to subscribe to the scroll
704
+ // strategy lazily (i.e. only if the user is actually listening to the events). We do this because
705
+ // depending on how the strategy calculates the scrolled index, it may come at a cost to
706
+ // performance.
692
707
  /**
693
708
  * Emits when the index of the first element visible in the viewport changes.
694
709
  */
695
- this.scrolledIndexChange = Observable.create((observer) => this._scrollStrategy.scrolledIndexChange.subscribe(index => Promise.resolve().then(() => this.ngZone.run(() => observer.next(index)))));
710
+ this.scrolledIndexChange = new Observable((observer) => this._scrollStrategy.scrolledIndexChange.subscribe(index => Promise.resolve().then(() => this.ngZone.run(() => observer.next(index)))));
696
711
  /**
697
712
  * A stream that emits whenever the rendered range changes.
698
713
  */
@@ -754,7 +769,7 @@ class CdkVirtualScrollViewport extends CdkScrollable {
754
769
  this.elementScrolled()
755
770
  .pipe(
756
771
  // Start off with a fake scroll event so we properly detect our initial position.
757
- startWith(/** @type {?} */ ((null))),
772
+ startWith((/** @type {?} */ (null))),
758
773
  // Collect multiple events into one until the next animation frame. This way if
759
774
  // there are multiple scroll events in the same frame we only need to recheck
760
775
  // our layout once.
@@ -821,6 +836,10 @@ class CdkVirtualScrollViewport extends CdkScrollable {
821
836
  getViewportSize() {
822
837
  return this._viewportSize;
823
838
  }
839
+ // TODO(mmalerba): This is technically out of sync with what's really rendered until a render
840
+ // cycle happens. I'm being careful to only call it after the render cycle is complete and before
841
+ // setting it to something else, but its error prone and should probably be split into
842
+ // `pendingRange` and `renderedRange`, the latter reflecting whats actually in the DOM.
824
843
  /**
825
844
  * Get the current rendered range of items.
826
845
  * @return {?}
@@ -869,6 +888,8 @@ class CdkVirtualScrollViewport extends CdkScrollable {
869
888
  * @return {?}
870
889
  */
871
890
  setRenderedContentOffset(offset, to = 'to-start') {
891
+ // For a horizontal viewport in a right-to-left language we need to translate along the x-axis
892
+ // in the negative direction.
872
893
  /** @type {?} */
873
894
  const isRtl = this.dir && this.dir.value == 'rtl';
874
895
  /** @type {?} */
@@ -972,6 +993,7 @@ class CdkVirtualScrollViewport extends CdkScrollable {
972
993
  }
973
994
  /**
974
995
  * Measure the viewport size.
996
+ * @private
975
997
  * @return {?}
976
998
  */
977
999
  _measureViewportSize() {
@@ -982,6 +1004,7 @@ class CdkVirtualScrollViewport extends CdkScrollable {
982
1004
  }
983
1005
  /**
984
1006
  * Queue up change detection to run.
1007
+ * @private
985
1008
  * @param {?=} runAfter
986
1009
  * @return {?}
987
1010
  */
@@ -1000,6 +1023,7 @@ class CdkVirtualScrollViewport extends CdkScrollable {
1000
1023
  }
1001
1024
  /**
1002
1025
  * Run change detection.
1026
+ * @private
1003
1027
  * @return {?}
1004
1028
  */
1005
1029
  _doChangeDetection() {
@@ -1028,10 +1052,14 @@ CdkVirtualScrollViewport.decorators = [
1028
1052
  host: {
1029
1053
  'class': 'cdk-virtual-scroll-viewport',
1030
1054
  '[class.cdk-virtual-scroll-orientation-horizontal]': 'orientation === "horizontal"',
1031
- '[class.cdk-virtual-scroll-orientation-vertical]': 'orientation === "vertical"',
1055
+ '[class.cdk-virtual-scroll-orientation-vertical]': 'orientation !== "horizontal"',
1032
1056
  },
1033
1057
  encapsulation: ViewEncapsulation.None,
1034
1058
  changeDetection: ChangeDetectionStrategy.OnPush,
1059
+ providers: [{
1060
+ provide: CdkScrollable,
1061
+ useExisting: CdkVirtualScrollViewport,
1062
+ }]
1035
1063
  },] },
1036
1064
  ];
1037
1065
  /** @nocollapse */
@@ -1051,7 +1079,7 @@ CdkVirtualScrollViewport.propDecorators = {
1051
1079
 
1052
1080
  /**
1053
1081
  * @fileoverview added by tsickle
1054
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
1082
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1055
1083
  */
1056
1084
  /**
1057
1085
  * Helper to extract size from a DOM Node.
@@ -1061,7 +1089,7 @@ CdkVirtualScrollViewport.propDecorators = {
1061
1089
  */
1062
1090
  function getSize(orientation, node) {
1063
1091
  /** @type {?} */
1064
- const el = /** @type {?} */ (node);
1092
+ const el = (/** @type {?} */ (node));
1065
1093
  if (!el.getBoundingClientRect) {
1066
1094
  return 0;
1067
1095
  }
@@ -1082,8 +1110,7 @@ class CdkVirtualForOf {
1082
1110
  * @param {?} _viewport
1083
1111
  * @param {?} ngZone
1084
1112
  */
1085
- constructor(_viewContainerRef, _template, _differs, /** The virtual scrolling viewport that these items are being rendered in. */
1086
- _viewport, ngZone) {
1113
+ constructor(_viewContainerRef, _template, _differs, _viewport, ngZone) {
1087
1114
  this._viewContainerRef = _viewContainerRef;
1088
1115
  this._template = _template;
1089
1116
  this._differs = _differs;
@@ -1107,7 +1134,7 @@ class CdkVirtualForOf {
1107
1134
  this.dataStream = this._dataSourceChanges
1108
1135
  .pipe(
1109
1136
  // Start off with null `DataSource`.
1110
- startWith(/** @type {?} */ ((null))),
1137
+ startWith((/** @type {?} */ (null))),
1111
1138
  // Bundle up the previous and current data sources so we can work with both.
1112
1139
  pairwise(),
1113
1140
  // Use `_changeDataSource` to disconnect from the previous data source and connect to the
@@ -1205,21 +1232,24 @@ class CdkVirtualForOf {
1205
1232
  if (range.start < this._renderedRange.start || range.end > this._renderedRange.end) {
1206
1233
  throw Error(`Error: attempted to measure an item that isn't rendered.`);
1207
1234
  }
1235
+ // The index into the list of rendered views for the first item in the range.
1208
1236
  /** @type {?} */
1209
1237
  const renderedStartIndex = range.start - this._renderedRange.start;
1238
+ // The length of the range we're measuring.
1210
1239
  /** @type {?} */
1211
1240
  const rangeLen = range.end - range.start;
1241
+ // Loop over all root nodes for all items in the range and sum up their size.
1212
1242
  /** @type {?} */
1213
1243
  let totalSize = 0;
1214
1244
  /** @type {?} */
1215
1245
  let i = rangeLen;
1216
1246
  while (i--) {
1217
1247
  /** @type {?} */
1218
- const view = /** @type {?} */ (this._viewContainerRef.get(i + renderedStartIndex));
1248
+ const view = (/** @type {?} */ (this._viewContainerRef.get(i + renderedStartIndex)));
1219
1249
  /** @type {?} */
1220
1250
  let j = view ? view.rootNodes.length : 0;
1221
1251
  while (j--) {
1222
- totalSize += getSize(orientation, /** @type {?} */ ((view)).rootNodes[j]);
1252
+ totalSize += getSize(orientation, (/** @type {?} */ (view)).rootNodes[j]);
1223
1253
  }
1224
1254
  }
1225
1255
  return totalSize;
@@ -1229,6 +1259,9 @@ class CdkVirtualForOf {
1229
1259
  */
1230
1260
  ngDoCheck() {
1231
1261
  if (this._differ && this._needsUpdate) {
1262
+ // TODO(mmalerba): We should differentiate needs update due to scrolling and a new portion of
1263
+ // this list being rendered (can use simpler algorithm) vs needs update due to data actually
1264
+ // changing (need to do this diff).
1232
1265
  /** @type {?} */
1233
1266
  const changes = this._differ.diff(this._renderedItems);
1234
1267
  if (!changes) {
@@ -1255,6 +1288,7 @@ class CdkVirtualForOf {
1255
1288
  }
1256
1289
  /**
1257
1290
  * React to scroll state changes in the viewport.
1291
+ * @private
1258
1292
  * @return {?}
1259
1293
  */
1260
1294
  _onRenderedDataChange() {
@@ -1269,6 +1303,7 @@ class CdkVirtualForOf {
1269
1303
  }
1270
1304
  /**
1271
1305
  * Swap out one `DataSource` for another.
1306
+ * @private
1272
1307
  * @param {?} oldDs
1273
1308
  * @param {?} newDs
1274
1309
  * @return {?}
@@ -1282,6 +1317,7 @@ class CdkVirtualForOf {
1282
1317
  }
1283
1318
  /**
1284
1319
  * Update the `CdkVirtualForOfContext` for all views.
1320
+ * @private
1285
1321
  * @return {?}
1286
1322
  */
1287
1323
  _updateContext() {
@@ -1291,7 +1327,7 @@ class CdkVirtualForOf {
1291
1327
  let i = this._viewContainerRef.length;
1292
1328
  while (i--) {
1293
1329
  /** @type {?} */
1294
- let view = /** @type {?} */ (this._viewContainerRef.get(i));
1330
+ let view = (/** @type {?} */ (this._viewContainerRef.get(i)));
1295
1331
  view.context.index = this._renderedRange.start + i;
1296
1332
  view.context.count = count;
1297
1333
  this._updateComputedContextProperties(view.context);
@@ -1300,6 +1336,7 @@ class CdkVirtualForOf {
1300
1336
  }
1301
1337
  /**
1302
1338
  * Apply changes to the DOM.
1339
+ * @private
1303
1340
  * @param {?} changes
1304
1341
  * @return {?}
1305
1342
  */
@@ -1307,18 +1344,19 @@ class CdkVirtualForOf {
1307
1344
  // Rearrange the views to put them in the right location.
1308
1345
  changes.forEachOperation((record, adjustedPreviousIndex, currentIndex) => {
1309
1346
  if (record.previousIndex == null) { // Item added.
1347
+ // Item added.
1310
1348
  /** @type {?} */
1311
1349
  const view = this._getViewForNewItem();
1312
- this._viewContainerRef.insert(view, /** @type {?} */ ((currentIndex)));
1350
+ this._viewContainerRef.insert(view, (/** @type {?} */ (currentIndex)));
1313
1351
  view.context.$implicit = record.item;
1314
1352
  }
1315
1353
  else if (currentIndex == null) { // Item removed.
1316
- // Item removed.
1317
- this._cacheView(/** @type {?} */ (this._viewContainerRef.detach(/** @type {?} */ ((adjustedPreviousIndex)))));
1354
+ this._cacheView((/** @type {?} */ (this._viewContainerRef.detach((/** @type {?} */ (adjustedPreviousIndex))))));
1318
1355
  }
1319
1356
  else { // Item moved.
1357
+ // Item moved.
1320
1358
  /** @type {?} */
1321
- const view = /** @type {?} */ (this._viewContainerRef.get(/** @type {?} */ ((adjustedPreviousIndex))));
1359
+ const view = (/** @type {?} */ (this._viewContainerRef.get((/** @type {?} */ (adjustedPreviousIndex)))));
1322
1360
  this._viewContainerRef.move(view, currentIndex);
1323
1361
  view.context.$implicit = record.item;
1324
1362
  }
@@ -1326,16 +1364,17 @@ class CdkVirtualForOf {
1326
1364
  // Update $implicit for any items that had an identity change.
1327
1365
  changes.forEachIdentityChange((record) => {
1328
1366
  /** @type {?} */
1329
- const view = /** @type {?} */ (this._viewContainerRef.get(/** @type {?} */ ((record.currentIndex))));
1367
+ const view = (/** @type {?} */ (this._viewContainerRef.get((/** @type {?} */ (record.currentIndex)))));
1330
1368
  view.context.$implicit = record.item;
1331
1369
  });
1370
+ // Update the context variables on all items.
1332
1371
  /** @type {?} */
1333
1372
  const count = this._data.length;
1334
1373
  /** @type {?} */
1335
1374
  let i = this._viewContainerRef.length;
1336
1375
  while (i--) {
1337
1376
  /** @type {?} */
1338
- const view = /** @type {?} */ (this._viewContainerRef.get(i));
1377
+ const view = (/** @type {?} */ (this._viewContainerRef.get(i)));
1339
1378
  view.context.index = this._renderedRange.start + i;
1340
1379
  view.context.count = count;
1341
1380
  this._updateComputedContextProperties(view.context);
@@ -1343,6 +1382,7 @@ class CdkVirtualForOf {
1343
1382
  }
1344
1383
  /**
1345
1384
  * Cache the given detached view.
1385
+ * @private
1346
1386
  * @param {?} view
1347
1387
  * @return {?}
1348
1388
  */
@@ -1366,11 +1406,12 @@ class CdkVirtualForOf {
1366
1406
  }
1367
1407
  /**
1368
1408
  * Get a view for a new item, either from the cache or by creating a new one.
1409
+ * @private
1369
1410
  * @return {?}
1370
1411
  */
1371
1412
  _getViewForNewItem() {
1372
1413
  return this._templateCache.pop() || this._viewContainerRef.createEmbeddedView(this._template, {
1373
- $implicit: /** @type {?} */ ((null)),
1414
+ $implicit: (/** @type {?} */ (null)),
1374
1415
  cdkVirtualForOf: this._cdkVirtualForOf,
1375
1416
  index: -1,
1376
1417
  count: -1,
@@ -1382,6 +1423,7 @@ class CdkVirtualForOf {
1382
1423
  }
1383
1424
  /**
1384
1425
  * Update the computed properties on the `CdkVirtualForOfContext`.
1426
+ * @private
1385
1427
  * @param {?} context
1386
1428
  * @return {?}
1387
1429
  */
@@ -1414,7 +1456,7 @@ CdkVirtualForOf.propDecorators = {
1414
1456
 
1415
1457
  /**
1416
1458
  * @fileoverview added by tsickle
1417
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
1459
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1418
1460
  */
1419
1461
  class ScrollingModule {
1420
1462
  }
@@ -1451,11 +1493,12 @@ ScrollDispatchModule.decorators = [
1451
1493
 
1452
1494
  /**
1453
1495
  * @fileoverview added by tsickle
1454
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
1496
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1455
1497
  */
1456
- /** *
1498
+ /**
1457
1499
  * Time in ms to throttle the resize events by default.
1458
- @type {?} */
1500
+ * @type {?}
1501
+ */
1459
1502
  const DEFAULT_RESIZE_TIME = 20;
1460
1503
  /**
1461
1504
  * Simple utility for getting the bounds of the browser viewport.
@@ -1495,7 +1538,7 @@ class ViewportRuler {
1495
1538
  const output = { width: this._viewportSize.width, height: this._viewportSize.height };
1496
1539
  // If we're not on a browser, don't cache the size since it'll be mocked out anyway.
1497
1540
  if (!this._platform.isBrowser) {
1498
- this._viewportSize = /** @type {?} */ ((null));
1541
+ this._viewportSize = (/** @type {?} */ (null));
1499
1542
  }
1500
1543
  return output;
1501
1544
  }
@@ -1504,6 +1547,15 @@ class ViewportRuler {
1504
1547
  * @return {?}
1505
1548
  */
1506
1549
  getViewportRect() {
1550
+ // Use the document element's bounding rect rather than the window scroll properties
1551
+ // (e.g. pageYOffset, scrollY) due to in issue in Chrome and IE where window scroll
1552
+ // properties and client coordinates (boundingClientRect, clientX/Y, etc.) are in different
1553
+ // conceptual viewports. Under most circumstances these viewports are equivalent, but they
1554
+ // can disagree when the page is pinch-zoomed (on devices that support touch).
1555
+ // See https://bugs.chromium.org/p/chromium/issues/detail?id=489206#c4
1556
+ // We use the documentElement instead of the body because, by default (without a css reset)
1557
+ // browsers typically give the document body an 8px margin, which is not included in
1558
+ // getBoundingClientRect().
1507
1559
  /** @type {?} */
1508
1560
  const scrollPosition = this.getViewportScrollPosition();
1509
1561
  const { width, height } = this.getViewportSize();
@@ -1526,8 +1578,14 @@ class ViewportRuler {
1526
1578
  if (!this._platform.isBrowser) {
1527
1579
  return { top: 0, left: 0 };
1528
1580
  }
1581
+ // The top-left-corner of the viewport is determined by the scroll position of the document
1582
+ // body, normally just (scrollLeft, scrollTop). However, Chrome and Firefox disagree about
1583
+ // whether `document.body` or `document.documentElement` is the scrolled element, so reading
1584
+ // `scrollTop` and `scrollLeft` is inconsistent. However, using the bounding rect of
1585
+ // `document.documentElement` works consistently, where the `top` and `left` values will
1586
+ // equal negative the scroll position.
1529
1587
  /** @type {?} */
1530
- const documentElement = /** @type {?} */ ((document.documentElement));
1588
+ const documentElement = (/** @type {?} */ (document.documentElement));
1531
1589
  /** @type {?} */
1532
1590
  const documentRect = documentElement.getBoundingClientRect();
1533
1591
  /** @type {?} */
@@ -1548,6 +1606,7 @@ class ViewportRuler {
1548
1606
  }
1549
1607
  /**
1550
1608
  * Updates the cached viewport size.
1609
+ * @private
1551
1610
  * @return {?}
1552
1611
  */
1553
1612
  _updateViewportSize() {
@@ -1575,9 +1634,10 @@ ViewportRuler.ctorParameters = () => [
1575
1634
  function VIEWPORT_RULER_PROVIDER_FACTORY(parentRuler, platform, ngZone) {
1576
1635
  return parentRuler || new ViewportRuler(platform, ngZone);
1577
1636
  }
1578
- /** *
1637
+ /**
1579
1638
  * \@docs-private \@deprecated \@breaking-change 8.0.0
1580
- @type {?} */
1639
+ * @type {?}
1640
+ */
1581
1641
  const VIEWPORT_RULER_PROVIDER = {
1582
1642
  // If there is already a ViewportRuler available, use that. Otherwise, provide a new one.
1583
1643
  provide: ViewportRuler,
@@ -1587,12 +1647,12 @@ const VIEWPORT_RULER_PROVIDER = {
1587
1647
 
1588
1648
  /**
1589
1649
  * @fileoverview added by tsickle
1590
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
1650
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1591
1651
  */
1592
1652
 
1593
1653
  /**
1594
1654
  * @fileoverview added by tsickle
1595
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
1655
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1596
1656
  */
1597
1657
 
1598
1658
  export { _fixedSizeVirtualScrollStrategyFactory, FixedSizeVirtualScrollStrategy, CdkFixedSizeVirtualScroll, SCROLL_DISPATCHER_PROVIDER_FACTORY, DEFAULT_SCROLL_TIME, ScrollDispatcher, SCROLL_DISPATCHER_PROVIDER, CdkScrollable, ScrollingModule, ScrollDispatchModule, VIEWPORT_RULER_PROVIDER_FACTORY, DEFAULT_RESIZE_TIME, ViewportRuler, VIEWPORT_RULER_PROVIDER, CdkVirtualForOf, VIRTUAL_SCROLL_STRATEGY, CdkVirtualScrollViewport };