@angular/material 8.1.4 → 8.2.3

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 (358) hide show
  1. package/_theming.scss +13 -11
  2. package/autocomplete/typings/autocomplete-trigger.d.ts +5 -2
  3. package/autocomplete/typings/index.metadata.json +1 -1
  4. package/bundles/material-autocomplete.umd.js +48 -20
  5. package/bundles/material-autocomplete.umd.js.map +1 -1
  6. package/bundles/material-autocomplete.umd.min.js +1 -1
  7. package/bundles/material-autocomplete.umd.min.js.map +1 -1
  8. package/bundles/material-button.umd.js +5 -6
  9. package/bundles/material-button.umd.js.map +1 -1
  10. package/bundles/material-button.umd.min.js +1 -1
  11. package/bundles/material-button.umd.min.js.map +1 -1
  12. package/bundles/material-card.umd.js +1 -1
  13. package/bundles/material-card.umd.js.map +1 -1
  14. package/bundles/material-card.umd.min.js +1 -1
  15. package/bundles/material-card.umd.min.js.map +1 -1
  16. package/bundles/material-checkbox.umd.js +1 -1
  17. package/bundles/material-checkbox.umd.js.map +1 -1
  18. package/bundles/material-checkbox.umd.min.js.map +1 -1
  19. package/bundles/material-chips.umd.js +24 -4
  20. package/bundles/material-chips.umd.js.map +1 -1
  21. package/bundles/material-chips.umd.min.js +1 -1
  22. package/bundles/material-chips.umd.min.js.map +1 -1
  23. package/bundles/material-core.umd.js +20 -18
  24. package/bundles/material-core.umd.js.map +1 -1
  25. package/bundles/material-core.umd.min.js +2 -2
  26. package/bundles/material-core.umd.min.js.map +1 -1
  27. package/bundles/material-datepicker.umd.js +22 -2
  28. package/bundles/material-datepicker.umd.js.map +1 -1
  29. package/bundles/material-datepicker.umd.min.js +2 -2
  30. package/bundles/material-datepicker.umd.min.js.map +1 -1
  31. package/bundles/material-dialog.umd.js +28 -5
  32. package/bundles/material-dialog.umd.js.map +1 -1
  33. package/bundles/material-dialog.umd.min.js +1 -1
  34. package/bundles/material-dialog.umd.min.js.map +1 -1
  35. package/bundles/material-form-field.umd.js +15 -2
  36. package/bundles/material-form-field.umd.js.map +1 -1
  37. package/bundles/material-form-field.umd.min.js +1 -1
  38. package/bundles/material-form-field.umd.min.js.map +1 -1
  39. package/bundles/material-grid-list.umd.js +1 -1
  40. package/bundles/material-grid-list.umd.min.js +1 -1
  41. package/bundles/material-icon.umd.js +103 -42
  42. package/bundles/material-icon.umd.js.map +1 -1
  43. package/bundles/material-icon.umd.min.js +1 -1
  44. package/bundles/material-icon.umd.min.js.map +1 -1
  45. package/bundles/material-list.umd.js +4 -1
  46. package/bundles/material-list.umd.js.map +1 -1
  47. package/bundles/material-list.umd.min.js +1 -1
  48. package/bundles/material-list.umd.min.js.map +1 -1
  49. package/bundles/material-menu.umd.js +35 -19
  50. package/bundles/material-menu.umd.js.map +1 -1
  51. package/bundles/material-menu.umd.min.js +1 -1
  52. package/bundles/material-menu.umd.min.js.map +1 -1
  53. package/bundles/material-paginator.umd.js +1 -1
  54. package/bundles/material-paginator.umd.js.map +1 -1
  55. package/bundles/material-paginator.umd.min.js +1 -1
  56. package/bundles/material-paginator.umd.min.js.map +1 -1
  57. package/bundles/material-progress-spinner.umd.js +34 -23
  58. package/bundles/material-progress-spinner.umd.js.map +1 -1
  59. package/bundles/material-progress-spinner.umd.min.js +1 -1
  60. package/bundles/material-progress-spinner.umd.min.js.map +1 -1
  61. package/bundles/material-radio.umd.js +3 -0
  62. package/bundles/material-radio.umd.js.map +1 -1
  63. package/bundles/material-radio.umd.min.js +1 -1
  64. package/bundles/material-radio.umd.min.js.map +1 -1
  65. package/bundles/material-select.umd.js +14 -2
  66. package/bundles/material-select.umd.js.map +1 -1
  67. package/bundles/material-select.umd.min.js +1 -1
  68. package/bundles/material-select.umd.min.js.map +1 -1
  69. package/bundles/material-slide-toggle.umd.js +3 -1
  70. package/bundles/material-slide-toggle.umd.js.map +1 -1
  71. package/bundles/material-slide-toggle.umd.min.js +1 -1
  72. package/bundles/material-slide-toggle.umd.min.js.map +1 -1
  73. package/bundles/material-slider.umd.js +6 -3
  74. package/bundles/material-slider.umd.js.map +1 -1
  75. package/bundles/material-slider.umd.min.js +1 -1
  76. package/bundles/material-slider.umd.min.js.map +1 -1
  77. package/bundles/material-snack-bar.umd.js +7 -8
  78. package/bundles/material-snack-bar.umd.js.map +1 -1
  79. package/bundles/material-snack-bar.umd.min.js +1 -1
  80. package/bundles/material-snack-bar.umd.min.js.map +1 -1
  81. package/bundles/material-sort.umd.js +0 -1
  82. package/bundles/material-sort.umd.js.map +1 -1
  83. package/bundles/material-sort.umd.min.js +1 -1
  84. package/bundles/material-sort.umd.min.js.map +1 -1
  85. package/bundles/material-table.umd.js +14 -4
  86. package/bundles/material-table.umd.js.map +1 -1
  87. package/bundles/material-table.umd.min.js +1 -1
  88. package/bundles/material-table.umd.min.js.map +1 -1
  89. package/bundles/material-tabs.umd.js +1390 -1208
  90. package/bundles/material-tabs.umd.js.map +1 -1
  91. package/bundles/material-tabs.umd.min.js +2 -2
  92. package/bundles/material-tabs.umd.min.js.map +1 -1
  93. package/bundles/material-tooltip.umd.js +16 -1
  94. package/bundles/material-tooltip.umd.js.map +1 -1
  95. package/bundles/material-tooltip.umd.min.js +1 -1
  96. package/bundles/material-tooltip.umd.min.js.map +1 -1
  97. package/bundles/material.umd.js +1767 -1346
  98. package/bundles/material.umd.js.map +1 -1
  99. package/bundles/material.umd.min.js +19 -19
  100. package/bundles/material.umd.min.js.map +1 -1
  101. package/button/typings/button.d.ts +1 -1
  102. package/button/typings/index.metadata.json +1 -1
  103. package/card/typings/index.metadata.json +1 -1
  104. package/chips/typings/chip.d.ts +4 -2
  105. package/chips/typings/index.metadata.json +1 -1
  106. package/core/typings/common-behaviors/common-module.d.ts +2 -2
  107. package/core/typings/datetime/date-adapter.d.ts +1 -1
  108. package/core/typings/datetime/native-date-adapter.d.ts +1 -1
  109. package/core/typings/index.metadata.json +1 -1
  110. package/core/typings/ripple/ripple-renderer.d.ts +2 -2
  111. package/core/typings/ripple/ripple.d.ts +1 -1
  112. package/datepicker/typings/datepicker-intl.d.ts +2 -0
  113. package/datepicker/typings/index.metadata.json +1 -1
  114. package/dialog/typings/dialog-config.d.ts +9 -7
  115. package/dialog/typings/dialog-content-directives.d.ts +2 -0
  116. package/dialog/typings/dialog-ref.d.ts +10 -0
  117. package/dialog/typings/index.metadata.json +1 -1
  118. package/esm2015/autocomplete.js +44 -19
  119. package/esm2015/autocomplete.js.map +1 -1
  120. package/esm2015/button.js +3 -5
  121. package/esm2015/button.js.map +1 -1
  122. package/esm2015/card.js +1 -1
  123. package/esm2015/card.js.map +1 -1
  124. package/esm2015/checkbox.js +1 -1
  125. package/esm2015/checkbox.js.map +1 -1
  126. package/esm2015/chips.js +22 -5
  127. package/esm2015/chips.js.map +1 -1
  128. package/esm2015/core.js +19 -17
  129. package/esm2015/core.js.map +1 -1
  130. package/esm2015/datepicker.js +15 -2
  131. package/esm2015/datepicker.js.map +1 -1
  132. package/esm2015/dialog.js +23 -5
  133. package/esm2015/dialog.js.map +1 -1
  134. package/esm2015/form-field.js +15 -2
  135. package/esm2015/form-field.js.map +1 -1
  136. package/esm2015/grid-list.js +1 -1
  137. package/esm2015/icon.js +93 -40
  138. package/esm2015/icon.js.map +1 -1
  139. package/esm2015/list.js +4 -1
  140. package/esm2015/list.js.map +1 -1
  141. package/esm2015/material.js +3 -3
  142. package/esm2015/menu.js +31 -10
  143. package/esm2015/menu.js.map +1 -1
  144. package/esm2015/paginator.js +1 -1
  145. package/esm2015/paginator.js.map +1 -1
  146. package/esm2015/progress-spinner.js +31 -23
  147. package/esm2015/progress-spinner.js.map +1 -1
  148. package/esm2015/radio.js +3 -0
  149. package/esm2015/radio.js.map +1 -1
  150. package/esm2015/select.js +14 -2
  151. package/esm2015/select.js.map +1 -1
  152. package/esm2015/slide-toggle.js +3 -1
  153. package/esm2015/slide-toggle.js.map +1 -1
  154. package/esm2015/slider.js +6 -2
  155. package/esm2015/slider.js.map +1 -1
  156. package/esm2015/snack-bar.js +7 -8
  157. package/esm2015/snack-bar.js.map +1 -1
  158. package/esm2015/sort.js +0 -1
  159. package/esm2015/sort.js.map +1 -1
  160. package/esm2015/table.js +9 -4
  161. package/esm2015/table.js.map +1 -1
  162. package/esm2015/tabs.js +1094 -890
  163. package/esm2015/tabs.js.map +1 -1
  164. package/esm2015/tooltip.js +15 -1
  165. package/esm2015/tooltip.js.map +1 -1
  166. package/esm5/autocomplete.es5.js +48 -19
  167. package/esm5/autocomplete.es5.js.map +1 -1
  168. package/esm5/button.es5.js +5 -6
  169. package/esm5/button.es5.js.map +1 -1
  170. package/esm5/card.es5.js +1 -1
  171. package/esm5/card.es5.js.map +1 -1
  172. package/esm5/checkbox.es5.js +1 -1
  173. package/esm5/checkbox.es5.js.map +1 -1
  174. package/esm5/chips.es5.js +25 -5
  175. package/esm5/chips.es5.js.map +1 -1
  176. package/esm5/core.es5.js +21 -19
  177. package/esm5/core.es5.js.map +1 -1
  178. package/esm5/datepicker.es5.js +22 -2
  179. package/esm5/datepicker.es5.js.map +1 -1
  180. package/esm5/dialog.es5.js +28 -5
  181. package/esm5/dialog.es5.js.map +1 -1
  182. package/esm5/form-field.es5.js +15 -2
  183. package/esm5/form-field.es5.js.map +1 -1
  184. package/esm5/grid-list.es5.js +1 -1
  185. package/esm5/icon.es5.js +101 -40
  186. package/esm5/icon.es5.js.map +1 -1
  187. package/esm5/list.es5.js +4 -1
  188. package/esm5/list.es5.js.map +1 -1
  189. package/esm5/material.es5.js +3 -3
  190. package/esm5/menu.es5.js +33 -17
  191. package/esm5/menu.es5.js.map +1 -1
  192. package/esm5/paginator.es5.js +1 -1
  193. package/esm5/paginator.es5.js.map +1 -1
  194. package/esm5/progress-spinner.es5.js +34 -23
  195. package/esm5/progress-spinner.es5.js.map +1 -1
  196. package/esm5/radio.es5.js +3 -0
  197. package/esm5/radio.es5.js.map +1 -1
  198. package/esm5/select.es5.js +14 -2
  199. package/esm5/select.es5.js.map +1 -1
  200. package/esm5/slide-toggle.es5.js +3 -1
  201. package/esm5/slide-toggle.es5.js.map +1 -1
  202. package/esm5/slider.es5.js +6 -3
  203. package/esm5/slider.es5.js.map +1 -1
  204. package/esm5/snack-bar.es5.js +7 -8
  205. package/esm5/snack-bar.es5.js.map +1 -1
  206. package/esm5/sort.es5.js +0 -1
  207. package/esm5/sort.es5.js.map +1 -1
  208. package/esm5/table.es5.js +14 -4
  209. package/esm5/table.es5.js.map +1 -1
  210. package/esm5/tabs.es5.js +1384 -1207
  211. package/esm5/tabs.es5.js.map +1 -1
  212. package/esm5/tooltip.es5.js +16 -1
  213. package/esm5/tooltip.es5.js.map +1 -1
  214. package/form-field/typings/form-field.d.ts +2 -0
  215. package/form-field/typings/index.metadata.json +1 -1
  216. package/grid-list/typings/index.d.ts +1 -1
  217. package/grid-list/typings/index.metadata.json +1 -1
  218. package/icon/typings/icon-registry.d.ts +17 -11
  219. package/icon/typings/icon.d.ts +3 -2
  220. package/icon/typings/index.metadata.json +1 -1
  221. package/list/typings/index.metadata.json +1 -1
  222. package/menu/typings/index.d.ts +2 -2
  223. package/menu/typings/index.metadata.json +1 -1
  224. package/menu/typings/menu-trigger.d.ts +2 -5
  225. package/package.json +5 -5
  226. package/prebuilt-themes/deeppurple-amber.css +1 -1
  227. package/prebuilt-themes/indigo-pink.css +1 -1
  228. package/prebuilt-themes/pink-bluegrey.css +1 -1
  229. package/prebuilt-themes/purple-green.css +1 -1
  230. package/progress-spinner/typings/index.metadata.json +1 -1
  231. package/progress-spinner/typings/progress-spinner.d.ts +3 -2
  232. package/radio/typings/index.metadata.json +1 -1
  233. package/schematics/ng-add/setup-project.js +8 -8
  234. package/schematics/ng-add/setup-project.js.map +1 -1
  235. package/schematics/ng-add/theming/theming.js +6 -6
  236. package/schematics/ng-add/theming/theming.js.map +1 -1
  237. package/schematics/ng-update/index.js +2 -2
  238. package/schematics/ng-update/index.js.map +1 -1
  239. package/select/typings/index.metadata.json +1 -1
  240. package/select/typings/select.d.ts +2 -0
  241. package/slide-toggle/typings/index.metadata.json +1 -1
  242. package/slider/typings/index.metadata.json +1 -1
  243. package/slider/typings/slider.d.ts +2 -2
  244. package/snack-bar/typings/index.metadata.json +1 -1
  245. package/sort/typings/index.metadata.json +1 -1
  246. package/table/typings/index.metadata.json +1 -1
  247. package/table/typings/table-data-source.d.ts +5 -0
  248. package/tabs/typings/index.d.ts +2 -2
  249. package/tabs/typings/index.metadata.json +1 -1
  250. package/tabs/typings/paginated-tab-header.d.ts +8 -5
  251. package/tabs/typings/public-api.d.ts +4 -4
  252. package/tabs/typings/tab-body.d.ts +11 -3
  253. package/tabs/typings/tab-group.d.ts +24 -11
  254. package/tabs/typings/tab-header.d.ts +12 -5
  255. package/tabs/typings/tab-nav-bar/tab-nav-bar.d.ts +38 -19
  256. package/tooltip/typings/index.metadata.json +1 -1
  257. package/typings/autocomplete/autocomplete-trigger.d.ts +5 -2
  258. package/typings/autocomplete/index.metadata.json +1 -1
  259. package/typings/button/button.d.ts +1 -1
  260. package/typings/button/index.metadata.json +1 -1
  261. package/typings/card/index.metadata.json +1 -1
  262. package/typings/chips/chip.d.ts +4 -2
  263. package/typings/chips/index.metadata.json +1 -1
  264. package/typings/core/common-behaviors/common-module.d.ts +2 -2
  265. package/typings/core/datetime/date-adapter.d.ts +1 -1
  266. package/typings/core/datetime/native-date-adapter.d.ts +1 -1
  267. package/typings/core/index.metadata.json +1 -1
  268. package/typings/core/ripple/ripple-renderer.d.ts +2 -2
  269. package/typings/core/ripple/ripple.d.ts +1 -1
  270. package/typings/datepicker/datepicker-intl.d.ts +2 -0
  271. package/typings/datepicker/index.metadata.json +1 -1
  272. package/typings/dialog/dialog-config.d.ts +9 -7
  273. package/typings/dialog/dialog-content-directives.d.ts +2 -0
  274. package/typings/dialog/dialog-ref.d.ts +10 -0
  275. package/typings/dialog/index.metadata.json +1 -1
  276. package/typings/esm5/autocomplete/autocomplete-trigger.d.ts +5 -2
  277. package/typings/esm5/autocomplete/index.metadata.json +1 -1
  278. package/typings/esm5/button/button.d.ts +1 -1
  279. package/typings/esm5/button/index.metadata.json +1 -1
  280. package/typings/esm5/card/index.metadata.json +1 -1
  281. package/typings/esm5/chips/chip.d.ts +4 -2
  282. package/typings/esm5/chips/index.metadata.json +1 -1
  283. package/typings/esm5/core/common-behaviors/common-module.d.ts +2 -2
  284. package/typings/esm5/core/datetime/date-adapter.d.ts +1 -1
  285. package/typings/esm5/core/datetime/native-date-adapter.d.ts +1 -1
  286. package/typings/esm5/core/index.metadata.json +1 -1
  287. package/typings/esm5/core/ripple/ripple-renderer.d.ts +2 -2
  288. package/typings/esm5/core/ripple/ripple.d.ts +1 -1
  289. package/typings/esm5/datepicker/datepicker-intl.d.ts +2 -0
  290. package/typings/esm5/datepicker/index.metadata.json +1 -1
  291. package/typings/esm5/dialog/dialog-config.d.ts +9 -7
  292. package/typings/esm5/dialog/dialog-content-directives.d.ts +2 -0
  293. package/typings/esm5/dialog/dialog-ref.d.ts +10 -0
  294. package/typings/esm5/dialog/index.metadata.json +1 -1
  295. package/typings/esm5/form-field/form-field.d.ts +2 -0
  296. package/typings/esm5/form-field/index.metadata.json +1 -1
  297. package/typings/esm5/grid-list/index.d.ts +1 -1
  298. package/typings/esm5/grid-list/index.metadata.json +1 -1
  299. package/typings/esm5/icon/icon-registry.d.ts +17 -11
  300. package/typings/esm5/icon/icon.d.ts +3 -2
  301. package/typings/esm5/icon/index.metadata.json +1 -1
  302. package/typings/esm5/list/index.metadata.json +1 -1
  303. package/typings/esm5/menu/index.d.ts +2 -2
  304. package/typings/esm5/menu/index.metadata.json +1 -1
  305. package/typings/esm5/menu/menu-trigger.d.ts +2 -5
  306. package/typings/esm5/progress-spinner/index.metadata.json +1 -1
  307. package/typings/esm5/progress-spinner/progress-spinner.d.ts +3 -2
  308. package/typings/esm5/radio/index.metadata.json +1 -1
  309. package/typings/esm5/select/index.metadata.json +1 -1
  310. package/typings/esm5/select/select.d.ts +2 -0
  311. package/typings/esm5/slide-toggle/index.metadata.json +1 -1
  312. package/typings/esm5/slider/index.metadata.json +1 -1
  313. package/typings/esm5/slider/slider.d.ts +2 -2
  314. package/typings/esm5/snack-bar/index.metadata.json +1 -1
  315. package/typings/esm5/sort/index.metadata.json +1 -1
  316. package/typings/esm5/table/index.metadata.json +1 -1
  317. package/typings/esm5/table/table-data-source.d.ts +5 -0
  318. package/typings/esm5/tabs/index.d.ts +2 -2
  319. package/typings/esm5/tabs/index.metadata.json +1 -1
  320. package/typings/esm5/tabs/paginated-tab-header.d.ts +8 -5
  321. package/typings/esm5/tabs/public-api.d.ts +4 -4
  322. package/typings/esm5/tabs/tab-body.d.ts +11 -3
  323. package/typings/esm5/tabs/tab-group.d.ts +24 -11
  324. package/typings/esm5/tabs/tab-header.d.ts +12 -5
  325. package/typings/esm5/tabs/tab-nav-bar/tab-nav-bar.d.ts +38 -19
  326. package/typings/esm5/tooltip/index.metadata.json +1 -1
  327. package/typings/form-field/form-field.d.ts +2 -0
  328. package/typings/form-field/index.metadata.json +1 -1
  329. package/typings/grid-list/index.d.ts +1 -1
  330. package/typings/grid-list/index.metadata.json +1 -1
  331. package/typings/icon/icon-registry.d.ts +17 -11
  332. package/typings/icon/icon.d.ts +3 -2
  333. package/typings/icon/index.metadata.json +1 -1
  334. package/typings/list/index.metadata.json +1 -1
  335. package/typings/menu/index.d.ts +2 -2
  336. package/typings/menu/index.metadata.json +1 -1
  337. package/typings/menu/menu-trigger.d.ts +2 -5
  338. package/typings/progress-spinner/index.metadata.json +1 -1
  339. package/typings/progress-spinner/progress-spinner.d.ts +3 -2
  340. package/typings/radio/index.metadata.json +1 -1
  341. package/typings/select/index.metadata.json +1 -1
  342. package/typings/select/select.d.ts +2 -0
  343. package/typings/slide-toggle/index.metadata.json +1 -1
  344. package/typings/slider/index.metadata.json +1 -1
  345. package/typings/slider/slider.d.ts +2 -2
  346. package/typings/snack-bar/index.metadata.json +1 -1
  347. package/typings/sort/index.metadata.json +1 -1
  348. package/typings/table/index.metadata.json +1 -1
  349. package/typings/table/table-data-source.d.ts +5 -0
  350. package/typings/tabs/index.d.ts +2 -2
  351. package/typings/tabs/index.metadata.json +1 -1
  352. package/typings/tabs/paginated-tab-header.d.ts +8 -5
  353. package/typings/tabs/public-api.d.ts +4 -4
  354. package/typings/tabs/tab-body.d.ts +11 -3
  355. package/typings/tabs/tab-group.d.ts +24 -11
  356. package/typings/tabs/tab-header.d.ts +12 -5
  357. package/typings/tabs/tab-nav-bar/tab-nav-bar.d.ts +38 -19
  358. package/typings/tooltip/index.metadata.json +1 -1
@@ -461,11 +461,12 @@ var MatTabBodyPortal = /** @class */ (function (_super) {
461
461
  return MatTabBodyPortal;
462
462
  }(portal.CdkPortalOutlet));
463
463
  /**
464
- * Wrapper for the contents of a tab.
464
+ * Base class with all of the `MatTabBody` functionality.
465
465
  * \@docs-private
466
+ * @abstract
466
467
  */
467
- var MatTabBody = /** @class */ (function () {
468
- function MatTabBody(_elementRef, _dir, changeDetectorRef) {
468
+ var _MatTabBodyBase = /** @class */ (function () {
469
+ function _MatTabBodyBase(_elementRef, _dir, changeDetectorRef) {
469
470
  var _this = this;
470
471
  this._elementRef = _elementRef;
471
472
  this._dir = _dir;
@@ -532,7 +533,7 @@ var MatTabBody = /** @class */ (function () {
532
533
  }
533
534
  }));
534
535
  }
535
- Object.defineProperty(MatTabBody.prototype, "position", {
536
+ Object.defineProperty(_MatTabBodyBase.prototype, "position", {
536
537
  /** The shifted index position of the tab body, where zero represents the active center tab. */
537
538
  set: /**
538
539
  * The shifted index position of the tab body, where zero represents the active center tab.
@@ -555,7 +556,7 @@ var MatTabBody = /** @class */ (function () {
555
556
  * special position states that transition the tab from the left or right before centering.
556
557
  * @return {?}
557
558
  */
558
- MatTabBody.prototype.ngOnInit = /**
559
+ _MatTabBodyBase.prototype.ngOnInit = /**
559
560
  * After initialized, check if the content is centered and has an origin. If so, set the
560
561
  * special position states that transition the tab from the left or right before centering.
561
562
  * @return {?}
@@ -568,7 +569,7 @@ var MatTabBody = /** @class */ (function () {
568
569
  /**
569
570
  * @return {?}
570
571
  */
571
- MatTabBody.prototype.ngOnDestroy = /**
572
+ _MatTabBodyBase.prototype.ngOnDestroy = /**
572
573
  * @return {?}
573
574
  */
574
575
  function () {
@@ -579,7 +580,7 @@ var MatTabBody = /** @class */ (function () {
579
580
  * @param {?} event
580
581
  * @return {?}
581
582
  */
582
- MatTabBody.prototype._onTranslateTabStarted = /**
583
+ _MatTabBodyBase.prototype._onTranslateTabStarted = /**
583
584
  * @param {?} event
584
585
  * @return {?}
585
586
  */
@@ -596,7 +597,7 @@ var MatTabBody = /** @class */ (function () {
596
597
  * The text direction of the containing app.
597
598
  * @return {?}
598
599
  */
599
- MatTabBody.prototype._getLayoutDirection = /**
600
+ _MatTabBodyBase.prototype._getLayoutDirection = /**
600
601
  * The text direction of the containing app.
601
602
  * @return {?}
602
603
  */
@@ -609,7 +610,7 @@ var MatTabBody = /** @class */ (function () {
609
610
  * @param {?} position
610
611
  * @return {?}
611
612
  */
612
- MatTabBody.prototype._isCenterPosition = /**
613
+ _MatTabBodyBase.prototype._isCenterPosition = /**
613
614
  * Whether the provided position state is considered center, regardless of origin.
614
615
  * @param {?} position
615
616
  * @return {?}
@@ -626,7 +627,7 @@ var MatTabBody = /** @class */ (function () {
626
627
  * @param {?=} dir
627
628
  * @return {?}
628
629
  */
629
- MatTabBody.prototype._computePositionAnimationState = /**
630
+ _MatTabBodyBase.prototype._computePositionAnimationState = /**
630
631
  * Computes the position state that will be used for the tab-body animation trigger.
631
632
  * @private
632
633
  * @param {?=} dir
@@ -654,7 +655,7 @@ var MatTabBody = /** @class */ (function () {
654
655
  * @private
655
656
  * @return {?}
656
657
  */
657
- MatTabBody.prototype._computePositionFromOrigin = /**
658
+ _MatTabBodyBase.prototype._computePositionFromOrigin = /**
658
659
  * Computes the position state based on the specified origin position. This is used if the
659
660
  * tab is becoming visible immediately after creation.
660
661
  * @private
@@ -668,210 +669,175 @@ var MatTabBody = /** @class */ (function () {
668
669
  }
669
670
  return 'right-origin-center';
670
671
  };
671
- MatTabBody.decorators = [
672
- { type: core.Component, args: [{selector: 'mat-tab-body',
673
- template: "<div class=\"mat-tab-body-content\" #content [@translateTab]=\"{ value: _position, params: {animationDuration: animationDuration} }\" (@translateTab.start)=\"_onTranslateTabStarted($event)\" (@translateTab.done)=\"_translateTabComplete.next($event)\"><ng-template matTabBodyHost></ng-template></div>",
674
- styles: [".mat-tab-body-content{height:100%;overflow:auto}.mat-tab-group-dynamic-height .mat-tab-body-content{overflow:hidden}"],
675
- encapsulation: core.ViewEncapsulation.None,
676
- changeDetection: core.ChangeDetectionStrategy.OnPush,
677
- animations: [matTabsAnimations.translateTab],
678
- host: {
679
- 'class': 'mat-tab-body',
680
- },
672
+ _MatTabBodyBase.decorators = [
673
+ { type: core.Directive, args: [{
674
+ // TODO(crisbeto): this selector can be removed when we update to Angular 9.0.
675
+ selector: 'do-not-use-abstract-mat-tab-body-base'
681
676
  },] },
682
677
  ];
683
678
  /** @nocollapse */
684
- MatTabBody.ctorParameters = function () { return [
679
+ _MatTabBodyBase.ctorParameters = function () { return [
685
680
  { type: core.ElementRef },
686
681
  { type: bidi.Directionality, decorators: [{ type: core.Optional }] },
687
682
  { type: core.ChangeDetectorRef }
688
683
  ]; };
689
- MatTabBody.propDecorators = {
684
+ _MatTabBodyBase.propDecorators = {
690
685
  _onCentering: [{ type: core.Output }],
691
686
  _beforeCentering: [{ type: core.Output }],
692
687
  _afterLeavingCenter: [{ type: core.Output }],
693
688
  _onCentered: [{ type: core.Output }],
694
- _portalHost: [{ type: core.ViewChild, args: [portal.PortalHostDirective, { static: false },] }],
695
689
  _content: [{ type: core.Input, args: ['content',] }],
696
690
  origin: [{ type: core.Input }],
697
691
  animationDuration: [{ type: core.Input }],
698
692
  position: [{ type: core.Input }]
699
693
  };
700
- return MatTabBody;
701
- }());
702
-
703
- /**
704
- * @fileoverview added by tsickle
705
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
706
- */
707
- // Boilerplate for applying mixins to MatTabLabelWrapper.
708
- /**
709
- * \@docs-private
710
- */
711
- var
712
- // Boilerplate for applying mixins to MatTabLabelWrapper.
713
- /**
714
- * \@docs-private
715
- */
716
- MatTabLabelWrapperBase = /** @class */ (function () {
717
- function MatTabLabelWrapperBase() {
718
- }
719
- return MatTabLabelWrapperBase;
694
+ return _MatTabBodyBase;
720
695
  }());
721
- /** @type {?} */
722
- var _MatTabLabelWrapperMixinBase = core$1.mixinDisabled(MatTabLabelWrapperBase);
723
696
  /**
724
- * Used in the `mat-tab-group` view to display tab labels.
697
+ * Wrapper for the contents of a tab.
725
698
  * \@docs-private
726
699
  */
727
- var MatTabLabelWrapper = /** @class */ (function (_super) {
728
- __extends(MatTabLabelWrapper, _super);
729
- function MatTabLabelWrapper(elementRef) {
730
- var _this = _super.call(this) || this;
731
- _this.elementRef = elementRef;
732
- return _this;
700
+ var MatTabBody = /** @class */ (function (_super) {
701
+ __extends(MatTabBody, _super);
702
+ function MatTabBody(elementRef, dir, changeDetectorRef) {
703
+ return _super.call(this, elementRef, dir, changeDetectorRef) || this;
733
704
  }
734
- /** Sets focus on the wrapper element */
735
- /**
736
- * Sets focus on the wrapper element
737
- * @return {?}
738
- */
739
- MatTabLabelWrapper.prototype.focus = /**
740
- * Sets focus on the wrapper element
741
- * @return {?}
742
- */
743
- function () {
744
- this.elementRef.nativeElement.focus();
745
- };
746
- /**
747
- * @return {?}
748
- */
749
- MatTabLabelWrapper.prototype.getOffsetLeft = /**
750
- * @return {?}
751
- */
752
- function () {
753
- return this.elementRef.nativeElement.offsetLeft;
754
- };
755
- /**
756
- * @return {?}
757
- */
758
- MatTabLabelWrapper.prototype.getOffsetWidth = /**
759
- * @return {?}
760
- */
761
- function () {
762
- return this.elementRef.nativeElement.offsetWidth;
763
- };
764
- MatTabLabelWrapper.decorators = [
765
- { type: core.Directive, args: [{
766
- selector: '[matTabLabelWrapper]',
767
- inputs: ['disabled'],
705
+ MatTabBody.decorators = [
706
+ { type: core.Component, args: [{selector: 'mat-tab-body',
707
+ template: "<div class=\"mat-tab-body-content\" #content [@translateTab]=\"{ value: _position, params: {animationDuration: animationDuration} }\" (@translateTab.start)=\"_onTranslateTabStarted($event)\" (@translateTab.done)=\"_translateTabComplete.next($event)\"><ng-template matTabBodyHost></ng-template></div>",
708
+ styles: [".mat-tab-body-content{height:100%;overflow:auto}.mat-tab-group-dynamic-height .mat-tab-body-content{overflow:hidden}"],
709
+ encapsulation: core.ViewEncapsulation.None,
710
+ changeDetection: core.ChangeDetectionStrategy.OnPush,
711
+ animations: [matTabsAnimations.translateTab],
768
712
  host: {
769
- '[class.mat-tab-disabled]': 'disabled',
770
- '[attr.aria-disabled]': '!!disabled',
713
+ 'class': 'mat-tab-body',
771
714
  }
772
715
  },] },
773
716
  ];
774
717
  /** @nocollapse */
775
- MatTabLabelWrapper.ctorParameters = function () { return [
776
- { type: core.ElementRef }
718
+ MatTabBody.ctorParameters = function () { return [
719
+ { type: core.ElementRef },
720
+ { type: bidi.Directionality, decorators: [{ type: core.Optional }] },
721
+ { type: core.ChangeDetectorRef }
777
722
  ]; };
778
- return MatTabLabelWrapper;
779
- }(_MatTabLabelWrapperMixinBase));
723
+ MatTabBody.propDecorators = {
724
+ _portalHost: [{ type: core.ViewChild, args: [portal.PortalHostDirective, { static: false },] }]
725
+ };
726
+ return MatTabBody;
727
+ }(_MatTabBodyBase));
780
728
 
781
729
  /**
782
730
  * @fileoverview added by tsickle
783
731
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
784
732
  */
785
733
  /**
786
- * Config used to bind passive event listeners
734
+ * Used to generate unique ID's for each tab component
787
735
  * @type {?}
788
736
  */
789
- var passiveEventListenerOptions = (/** @type {?} */ (platform.normalizePassiveListenerOptions({ passive: true })));
737
+ var nextId = 0;
790
738
  /**
791
- * The distance in pixels that will be overshot when scrolling a tab label into view. This helps
792
- * provide a small affordance to the label next to it.
793
- * @type {?}
739
+ * A simple change event emitted on focus or selection changes.
794
740
  */
795
- var EXAGGERATED_OVERSCROLL = 60;
741
+ var /**
742
+ * A simple change event emitted on focus or selection changes.
743
+ */
744
+ MatTabChangeEvent = /** @class */ (function () {
745
+ function MatTabChangeEvent() {
746
+ }
747
+ return MatTabChangeEvent;
748
+ }());
796
749
  /**
797
- * Amount of milliseconds to wait before starting to scroll the header automatically.
798
- * Set a little conservatively in order to handle fake events dispatched on touch devices.
750
+ * Injection token that can be used to provide the default options the tabs module.
799
751
  * @type {?}
800
752
  */
801
- var HEADER_SCROLL_DELAY = 650;
753
+ var MAT_TABS_CONFIG = new core.InjectionToken('MAT_TABS_CONFIG');
754
+ // Boilerplate for applying mixins to MatTabGroup.
802
755
  /**
803
- * Interval in milliseconds at which to scroll the header
804
- * while the user is holding their pointer.
805
- * @type {?}
756
+ * \@docs-private
806
757
  */
807
- var HEADER_SCROLL_INTERVAL = 100;
758
+ var
759
+ // Boilerplate for applying mixins to MatTabGroup.
808
760
  /**
809
- * Base class for a tab header that supported pagination.
810
- * @abstract
761
+ * \@docs-private
811
762
  */
812
- var MatPaginatedTabHeader = /** @class */ (function () {
813
- function MatPaginatedTabHeader(_elementRef, _changeDetectorRef, _viewportRuler, _dir, _ngZone, _platform, _animationMode) {
814
- var _this = this;
763
+ MatTabGroupMixinBase = /** @class */ (function () {
764
+ function MatTabGroupMixinBase(_elementRef) {
815
765
  this._elementRef = _elementRef;
816
- this._changeDetectorRef = _changeDetectorRef;
817
- this._viewportRuler = _viewportRuler;
818
- this._dir = _dir;
819
- this._ngZone = _ngZone;
820
- this._platform = _platform;
821
- this._animationMode = _animationMode;
766
+ }
767
+ return MatTabGroupMixinBase;
768
+ }());
769
+ /** @type {?} */
770
+ var _MatTabGroupMixinBase = core$1.mixinColor(core$1.mixinDisableRipple(MatTabGroupMixinBase), 'primary');
771
+ /**
772
+ * Base class with all of the `MatTabGroupBase` functionality.
773
+ * \@docs-private
774
+ * @abstract
775
+ */
776
+ var _MatTabGroupBase = /** @class */ (function (_super) {
777
+ __extends(_MatTabGroupBase, _super);
778
+ function _MatTabGroupBase(elementRef, _changeDetectorRef, defaultConfig, _animationMode) {
779
+ var _this = _super.call(this, elementRef) || this;
780
+ _this._changeDetectorRef = _changeDetectorRef;
781
+ _this._animationMode = _animationMode;
822
782
  /**
823
- * The distance in pixels that the tab labels should be translated to the left.
783
+ * The tab index that should be selected after the content has been checked.
824
784
  */
825
- this._scrollDistance = 0;
785
+ _this._indexToSelect = 0;
826
786
  /**
827
- * Whether the header should scroll to the selected index after the view has been checked.
787
+ * Snapshot of the height of the tab body wrapper before another tab is activated.
828
788
  */
829
- this._selectedIndexChanged = false;
789
+ _this._tabBodyWrapperHeight = 0;
830
790
  /**
831
- * Emits when the component is destroyed.
791
+ * Subscription to tabs being added/removed.
832
792
  */
833
- this._destroyed = new rxjs.Subject();
793
+ _this._tabsSubscription = rxjs.Subscription.EMPTY;
834
794
  /**
835
- * Whether the controls for pagination should be displayed
795
+ * Subscription to changes in the tab labels.
836
796
  */
837
- this._showPaginationControls = false;
797
+ _this._tabLabelSubscription = rxjs.Subscription.EMPTY;
798
+ _this._dynamicHeight = false;
799
+ _this._selectedIndex = null;
838
800
  /**
839
- * Whether the tab list can be scrolled more towards the end of the tab label list.
801
+ * Position of the tab header.
840
802
  */
841
- this._disableScrollAfter = true;
803
+ _this.headerPosition = 'above';
842
804
  /**
843
- * Whether the tab list can be scrolled more towards the beginning of the tab label list.
805
+ * Output to enable support for two-way binding on `[(selectedIndex)]`
844
806
  */
845
- this._disableScrollBefore = true;
807
+ _this.selectedIndexChange = new core.EventEmitter();
846
808
  /**
847
- * Stream that will stop the automated scrolling.
809
+ * Event emitted when focus has changed within a tab group.
848
810
  */
849
- this._stopScrolling = new rxjs.Subject();
850
- this._selectedIndex = 0;
811
+ _this.focusChange = new core.EventEmitter();
851
812
  /**
852
- * Event emitted when the option is selected.
813
+ * Event emitted when the body animation has completed
853
814
  */
854
- this.selectFocusedIndex = new core.EventEmitter();
815
+ _this.animationDone = new core.EventEmitter();
855
816
  /**
856
- * Event emitted when a label is focused.
817
+ * Event emitted when the tab selection has changed.
857
818
  */
858
- this.indexFocused = new core.EventEmitter();
859
- // Bind the `mouseleave` event on the outside since it doesn't change anything in the view.
860
- _ngZone.runOutsideAngular((/**
819
+ _this.selectedTabChange = new core.EventEmitter(true);
820
+ _this._groupId = nextId++;
821
+ _this.animationDuration = defaultConfig && defaultConfig.animationDuration ?
822
+ defaultConfig.animationDuration : '500ms';
823
+ return _this;
824
+ }
825
+ Object.defineProperty(_MatTabGroupBase.prototype, "dynamicHeight", {
826
+ /** Whether the tab group should grow to the size of the active tab. */
827
+ get: /**
828
+ * Whether the tab group should grow to the size of the active tab.
861
829
  * @return {?}
862
830
  */
863
- function () {
864
- rxjs.fromEvent(_elementRef.nativeElement, 'mouseleave')
865
- .pipe(operators.takeUntil(_this._destroyed))
866
- .subscribe((/**
867
- * @return {?}
868
- */
869
- function () {
870
- _this._stopInterval();
871
- }));
872
- }));
873
- }
874
- Object.defineProperty(MatPaginatedTabHeader.prototype, "selectedIndex", {
831
+ function () { return this._dynamicHeight; },
832
+ set: /**
833
+ * @param {?} value
834
+ * @return {?}
835
+ */
836
+ function (value) { this._dynamicHeight = coercion.coerceBooleanProperty(value); },
837
+ enumerable: true,
838
+ configurable: true
839
+ });
840
+ Object.defineProperty(_MatTabGroupBase.prototype, "selectedIndex", {
875
841
  /** The index of the active tab. */
876
842
  get: /**
877
843
  * The index of the active tab.
@@ -883,890 +849,617 @@ var MatPaginatedTabHeader = /** @class */ (function () {
883
849
  * @return {?}
884
850
  */
885
851
  function (value) {
886
- value = coercion.coerceNumberProperty(value);
887
- if (this._selectedIndex != value) {
888
- this._selectedIndexChanged = true;
889
- this._selectedIndex = value;
890
- if (this._keyManager) {
891
- this._keyManager.updateActiveItemIndex(value);
892
- }
893
- }
852
+ this._indexToSelect = coercion.coerceNumberProperty(value, null);
894
853
  },
895
854
  enumerable: true,
896
855
  configurable: true
897
856
  });
898
- /**
899
- * @return {?}
900
- */
901
- MatPaginatedTabHeader.prototype.ngAfterViewInit = /**
902
- * @return {?}
903
- */
904
- function () {
905
- var _this = this;
906
- // We need to handle these events manually, because we want to bind passive event listeners.
907
- rxjs.fromEvent(this._previousPaginator.nativeElement, 'touchstart', passiveEventListenerOptions)
908
- .pipe(operators.takeUntil(this._destroyed))
909
- .subscribe((/**
857
+ Object.defineProperty(_MatTabGroupBase.prototype, "animationDuration", {
858
+ /** Duration for the tab animation. Will be normalized to milliseconds if no units are set. */
859
+ get: /**
860
+ * Duration for the tab animation. Will be normalized to milliseconds if no units are set.
910
861
  * @return {?}
911
862
  */
912
- function () {
913
- _this._handlePaginatorPress('before');
914
- }));
915
- rxjs.fromEvent(this._nextPaginator.nativeElement, 'touchstart', passiveEventListenerOptions)
916
- .pipe(operators.takeUntil(this._destroyed))
917
- .subscribe((/**
863
+ function () { return this._animationDuration; },
864
+ set: /**
865
+ * @param {?} value
918
866
  * @return {?}
919
867
  */
920
- function () {
921
- _this._handlePaginatorPress('after');
922
- }));
923
- };
868
+ function (value) {
869
+ this._animationDuration = /^\d+$/.test(value) ? value + 'ms' : value;
870
+ },
871
+ enumerable: true,
872
+ configurable: true
873
+ });
874
+ Object.defineProperty(_MatTabGroupBase.prototype, "backgroundColor", {
875
+ /** Background color of the tab group. */
876
+ get: /**
877
+ * Background color of the tab group.
878
+ * @return {?}
879
+ */
880
+ function () { return this._backgroundColor; },
881
+ set: /**
882
+ * @param {?} value
883
+ * @return {?}
884
+ */
885
+ function (value) {
886
+ /** @type {?} */
887
+ var nativeElement = this._elementRef.nativeElement;
888
+ nativeElement.classList.remove("mat-background-" + this.backgroundColor);
889
+ if (value) {
890
+ nativeElement.classList.add("mat-background-" + value);
891
+ }
892
+ this._backgroundColor = value;
893
+ },
894
+ enumerable: true,
895
+ configurable: true
896
+ });
897
+ /**
898
+ * After the content is checked, this component knows what tabs have been defined
899
+ * and what the selected index should be. This is where we can know exactly what position
900
+ * each tab should be in according to the new selected index, and additionally we know how
901
+ * a new selected tab should transition in (from the left or right).
902
+ */
924
903
  /**
904
+ * After the content is checked, this component knows what tabs have been defined
905
+ * and what the selected index should be. This is where we can know exactly what position
906
+ * each tab should be in according to the new selected index, and additionally we know how
907
+ * a new selected tab should transition in (from the left or right).
925
908
  * @return {?}
926
909
  */
927
- MatPaginatedTabHeader.prototype.ngAfterContentInit = /**
910
+ _MatTabGroupBase.prototype.ngAfterContentChecked = /**
911
+ * After the content is checked, this component knows what tabs have been defined
912
+ * and what the selected index should be. This is where we can know exactly what position
913
+ * each tab should be in according to the new selected index, and additionally we know how
914
+ * a new selected tab should transition in (from the left or right).
928
915
  * @return {?}
929
916
  */
930
917
  function () {
931
918
  var _this = this;
919
+ // Don't clamp the `indexToSelect` immediately in the setter because it can happen that
920
+ // the amount of tabs changes before the actual change detection runs.
932
921
  /** @type {?} */
933
- var dirChange = this._dir ? this._dir.change : rxjs.of(null);
934
- /** @type {?} */
935
- var resize = this._viewportRuler.change(150);
936
- /** @type {?} */
937
- var realign = (/**
938
- * @return {?}
939
- */
940
- function () {
941
- _this.updatePagination();
942
- _this._alignInkBarToSelectedTab();
943
- });
944
- this._keyManager = new a11y.FocusKeyManager(this._items)
945
- .withHorizontalOrientation(this._getLayoutDirection())
946
- .withWrap();
947
- this._keyManager.updateActiveItem(0);
948
- // Defer the first call in order to allow for slower browsers to lay out the elements.
949
- // This helps in cases where the user lands directly on a page with paginated tabs.
950
- typeof requestAnimationFrame !== 'undefined' ? requestAnimationFrame(realign) : realign();
951
- // On dir change or window resize, realign the ink bar and update the orientation of
952
- // the key manager if the direction has changed.
953
- rxjs.merge(dirChange, resize, this._items.changes).pipe(operators.takeUntil(this._destroyed)).subscribe((/**
922
+ var indexToSelect = this._indexToSelect = this._clampTabIndex(this._indexToSelect);
923
+ // If there is a change in selected index, emit a change event. Should not trigger if
924
+ // the selected index has not yet been initialized.
925
+ if (this._selectedIndex != indexToSelect) {
926
+ /** @type {?} */
927
+ var isFirstRun_1 = this._selectedIndex == null;
928
+ if (!isFirstRun_1) {
929
+ this.selectedTabChange.emit(this._createChangeEvent(indexToSelect));
930
+ }
931
+ // Changing these values after change detection has run
932
+ // since the checked content may contain references to them.
933
+ Promise.resolve().then((/**
934
+ * @return {?}
935
+ */
936
+ function () {
937
+ _this._tabs.forEach((/**
938
+ * @param {?} tab
939
+ * @param {?} index
940
+ * @return {?}
941
+ */
942
+ function (tab, index) { return tab.isActive = index === indexToSelect; }));
943
+ if (!isFirstRun_1) {
944
+ _this.selectedIndexChange.emit(indexToSelect);
945
+ }
946
+ }));
947
+ }
948
+ // Setup the position for each tab and optionally setup an origin on the next selected tab.
949
+ this._tabs.forEach((/**
950
+ * @param {?} tab
951
+ * @param {?} index
954
952
  * @return {?}
955
953
  */
956
- function () {
957
- realign();
958
- _this._keyManager.withHorizontalOrientation(_this._getLayoutDirection());
954
+ function (tab, index) {
955
+ tab.position = index - indexToSelect;
956
+ // If there is already a selected tab, then set up an origin for the next selected tab
957
+ // if it doesn't have one already.
958
+ if (_this._selectedIndex != null && tab.position == 0 && !tab.origin) {
959
+ tab.origin = indexToSelect - _this._selectedIndex;
960
+ }
959
961
  }));
960
- // If there is a change in the focus key manager we need to emit the `indexFocused`
961
- // event in order to provide a public event that notifies about focus changes. Also we realign
962
- // the tabs container by scrolling the new focused tab into the visible section.
963
- this._keyManager.change.pipe(operators.takeUntil(this._destroyed)).subscribe((/**
964
- * @param {?} newFocusIndex
962
+ if (this._selectedIndex !== indexToSelect) {
963
+ this._selectedIndex = indexToSelect;
964
+ this._changeDetectorRef.markForCheck();
965
+ }
966
+ };
967
+ /**
968
+ * @return {?}
969
+ */
970
+ _MatTabGroupBase.prototype.ngAfterContentInit = /**
971
+ * @return {?}
972
+ */
973
+ function () {
974
+ var _this = this;
975
+ this._subscribeToTabLabels();
976
+ // Subscribe to changes in the amount of tabs, in order to be
977
+ // able to re-render the content as new tabs are added or removed.
978
+ this._tabsSubscription = this._tabs.changes.subscribe((/**
965
979
  * @return {?}
966
980
  */
967
- function (newFocusIndex) {
968
- _this.indexFocused.emit(newFocusIndex);
969
- _this._setTabFocus(newFocusIndex);
981
+ function () {
982
+ /** @type {?} */
983
+ var indexToSelect = _this._clampTabIndex(_this._indexToSelect);
984
+ // Maintain the previously-selected tab if a new tab is added or removed and there is no
985
+ // explicit change that selects a different tab.
986
+ if (indexToSelect === _this._selectedIndex) {
987
+ /** @type {?} */
988
+ var tabs = _this._tabs.toArray();
989
+ for (var i = 0; i < tabs.length; i++) {
990
+ if (tabs[i].isActive) {
991
+ // Assign both to the `_indexToSelect` and `_selectedIndex` so we don't fire a changed
992
+ // event, otherwise the consumer may end up in an infinite loop in some edge cases like
993
+ // adding a tab within the `selectedIndexChange` event.
994
+ _this._indexToSelect = _this._selectedIndex = i;
995
+ break;
996
+ }
997
+ }
998
+ }
999
+ _this._subscribeToTabLabels();
1000
+ _this._changeDetectorRef.markForCheck();
970
1001
  }));
971
1002
  };
972
1003
  /**
973
1004
  * @return {?}
974
1005
  */
975
- MatPaginatedTabHeader.prototype.ngAfterContentChecked = /**
1006
+ _MatTabGroupBase.prototype.ngOnDestroy = /**
976
1007
  * @return {?}
977
1008
  */
978
1009
  function () {
979
- // If the number of tab labels have changed, check if scrolling should be enabled
980
- if (this._tabLabelCount != this._items.length) {
981
- this.updatePagination();
982
- this._tabLabelCount = this._items.length;
983
- this._changeDetectorRef.markForCheck();
984
- }
985
- // If the selected index has changed, scroll to the label and check if the scrolling controls
986
- // should be disabled.
987
- if (this._selectedIndexChanged) {
988
- this._scrollToLabel(this._selectedIndex);
989
- this._checkScrollingControls();
990
- this._alignInkBarToSelectedTab();
991
- this._selectedIndexChanged = false;
992
- this._changeDetectorRef.markForCheck();
993
- }
994
- // If the scroll distance has been changed (tab selected, focused, scroll controls activated),
995
- // then translate the header to reflect this.
996
- if (this._scrollDistanceChanged) {
997
- this._updateTabScrollPosition();
998
- this._scrollDistanceChanged = false;
999
- this._changeDetectorRef.markForCheck();
1000
- }
1010
+ this._tabsSubscription.unsubscribe();
1011
+ this._tabLabelSubscription.unsubscribe();
1001
1012
  };
1013
+ /** Re-aligns the ink bar to the selected tab element. */
1002
1014
  /**
1015
+ * Re-aligns the ink bar to the selected tab element.
1003
1016
  * @return {?}
1004
1017
  */
1005
- MatPaginatedTabHeader.prototype.ngOnDestroy = /**
1018
+ _MatTabGroupBase.prototype.realignInkBar = /**
1019
+ * Re-aligns the ink bar to the selected tab element.
1006
1020
  * @return {?}
1007
1021
  */
1008
1022
  function () {
1009
- this._destroyed.next();
1010
- this._destroyed.complete();
1011
- this._stopScrolling.complete();
1023
+ if (this._tabHeader) {
1024
+ this._tabHeader._alignInkBarToSelectedTab();
1025
+ }
1012
1026
  };
1013
- /** Handles keyboard events on the header. */
1014
1027
  /**
1015
- * Handles keyboard events on the header.
1016
- * @param {?} event
1028
+ * @param {?} index
1017
1029
  * @return {?}
1018
1030
  */
1019
- MatPaginatedTabHeader.prototype._handleKeydown = /**
1020
- * Handles keyboard events on the header.
1021
- * @param {?} event
1031
+ _MatTabGroupBase.prototype._focusChanged = /**
1032
+ * @param {?} index
1022
1033
  * @return {?}
1023
1034
  */
1024
- function (event) {
1025
- // We don't handle any key bindings with a modifier key.
1026
- if (keycodes.hasModifierKey(event)) {
1027
- return;
1028
- }
1029
- switch (event.keyCode) {
1030
- case keycodes.HOME:
1031
- this._keyManager.setFirstItemActive();
1032
- event.preventDefault();
1033
- break;
1034
- case keycodes.END:
1035
- this._keyManager.setLastItemActive();
1036
- event.preventDefault();
1037
- break;
1038
- case keycodes.ENTER:
1039
- case keycodes.SPACE:
1040
- this.selectFocusedIndex.emit(this.focusIndex);
1041
- this._itemSelected(event);
1042
- break;
1043
- default:
1044
- this._keyManager.onKeydown(event);
1035
+ function (index) {
1036
+ this.focusChange.emit(this._createChangeEvent(index));
1037
+ };
1038
+ /**
1039
+ * @private
1040
+ * @param {?} index
1041
+ * @return {?}
1042
+ */
1043
+ _MatTabGroupBase.prototype._createChangeEvent = /**
1044
+ * @private
1045
+ * @param {?} index
1046
+ * @return {?}
1047
+ */
1048
+ function (index) {
1049
+ /** @type {?} */
1050
+ var event = new MatTabChangeEvent;
1051
+ event.index = index;
1052
+ if (this._tabs && this._tabs.length) {
1053
+ event.tab = this._tabs.toArray()[index];
1045
1054
  }
1055
+ return event;
1046
1056
  };
1047
1057
  /**
1048
- * Callback for when the MutationObserver detects that the content has changed.
1058
+ * Subscribes to changes in the tab labels. This is needed, because the @Input for the label is
1059
+ * on the MatTab component, whereas the data binding is inside the MatTabGroup. In order for the
1060
+ * binding to be updated, we need to subscribe to changes in it and trigger change detection
1061
+ * manually.
1049
1062
  */
1050
1063
  /**
1051
- * Callback for when the MutationObserver detects that the content has changed.
1064
+ * Subscribes to changes in the tab labels. This is needed, because the \@Input for the label is
1065
+ * on the MatTab component, whereas the data binding is inside the MatTabGroup. In order for the
1066
+ * binding to be updated, we need to subscribe to changes in it and trigger change detection
1067
+ * manually.
1068
+ * @private
1052
1069
  * @return {?}
1053
1070
  */
1054
- MatPaginatedTabHeader.prototype._onContentChanges = /**
1055
- * Callback for when the MutationObserver detects that the content has changed.
1071
+ _MatTabGroupBase.prototype._subscribeToTabLabels = /**
1072
+ * Subscribes to changes in the tab labels. This is needed, because the \@Input for the label is
1073
+ * on the MatTab component, whereas the data binding is inside the MatTabGroup. In order for the
1074
+ * binding to be updated, we need to subscribe to changes in it and trigger change detection
1075
+ * manually.
1076
+ * @private
1056
1077
  * @return {?}
1057
1078
  */
1058
1079
  function () {
1059
1080
  var _this = this;
1060
- /** @type {?} */
1061
- var textContent = this._elementRef.nativeElement.textContent;
1062
- // We need to diff the text content of the header, because the MutationObserver callback
1063
- // will fire even if the text content didn't change which is inefficient and is prone
1064
- // to infinite loops if a poorly constructed expression is passed in (see #14249).
1065
- if (textContent !== this._currentTextContent) {
1066
- this._currentTextContent = textContent || '';
1067
- // The content observer runs outside the `NgZone` by default, which
1068
- // means that we need to bring the callback back in ourselves.
1069
- this._ngZone.run((/**
1070
- * @return {?}
1071
- */
1072
- function () {
1073
- _this.updatePagination();
1074
- _this._alignInkBarToSelectedTab();
1075
- _this._changeDetectorRef.markForCheck();
1076
- }));
1081
+ if (this._tabLabelSubscription) {
1082
+ this._tabLabelSubscription.unsubscribe();
1077
1083
  }
1078
- };
1079
- /**
1080
- * Updates the view whether pagination should be enabled or not.
1081
- *
1082
- * WARNING: Calling this method can be very costly in terms of performance. It should be called
1083
- * as infrequently as possible from outside of the Tabs component as it causes a reflow of the
1084
- * page.
1085
- */
1086
- /**
1087
- * Updates the view whether pagination should be enabled or not.
1088
- *
1089
- * WARNING: Calling this method can be very costly in terms of performance. It should be called
1090
- * as infrequently as possible from outside of the Tabs component as it causes a reflow of the
1091
- * page.
1092
- * @return {?}
1093
- */
1094
- MatPaginatedTabHeader.prototype.updatePagination = /**
1095
- * Updates the view whether pagination should be enabled or not.
1096
- *
1097
- * WARNING: Calling this method can be very costly in terms of performance. It should be called
1098
- * as infrequently as possible from outside of the Tabs component as it causes a reflow of the
1099
- * page.
1100
- * @return {?}
1101
- */
1102
- function () {
1103
- this._checkPaginationEnabled();
1104
- this._checkScrollingControls();
1105
- this._updateTabScrollPosition();
1106
- };
1107
- Object.defineProperty(MatPaginatedTabHeader.prototype, "focusIndex", {
1108
- /** Tracks which element has focus; used for keyboard navigation */
1109
- get: /**
1110
- * Tracks which element has focus; used for keyboard navigation
1084
+ this._tabLabelSubscription = rxjs.merge.apply(void 0, this._tabs.map((/**
1085
+ * @param {?} tab
1111
1086
  * @return {?}
1112
1087
  */
1113
- function () {
1114
- return this._keyManager ? (/** @type {?} */ (this._keyManager.activeItemIndex)) : 0;
1115
- },
1116
- /** When the focus index is set, we must manually send focus to the correct label */
1117
- set: /**
1118
- * When the focus index is set, we must manually send focus to the correct label
1119
- * @param {?} value
1088
+ function (tab) { return tab._stateChanges; }))).subscribe((/**
1120
1089
  * @return {?}
1121
1090
  */
1122
- function (value) {
1123
- if (!this._isValidIndex(value) || this.focusIndex === value || !this._keyManager) {
1124
- return;
1125
- }
1126
- this._keyManager.setActiveItem(value);
1127
- },
1128
- enumerable: true,
1129
- configurable: true
1130
- });
1131
- /**
1132
- * Determines if an index is valid. If the tabs are not ready yet, we assume that the user is
1133
- * providing a valid index and return true.
1134
- */
1091
+ function () { return _this._changeDetectorRef.markForCheck(); }));
1092
+ };
1093
+ /** Clamps the given index to the bounds of 0 and the tabs length. */
1135
1094
  /**
1136
- * Determines if an index is valid. If the tabs are not ready yet, we assume that the user is
1137
- * providing a valid index and return true.
1095
+ * Clamps the given index to the bounds of 0 and the tabs length.
1096
+ * @private
1138
1097
  * @param {?} index
1139
1098
  * @return {?}
1140
1099
  */
1141
- MatPaginatedTabHeader.prototype._isValidIndex = /**
1142
- * Determines if an index is valid. If the tabs are not ready yet, we assume that the user is
1143
- * providing a valid index and return true.
1100
+ _MatTabGroupBase.prototype._clampTabIndex = /**
1101
+ * Clamps the given index to the bounds of 0 and the tabs length.
1102
+ * @private
1144
1103
  * @param {?} index
1145
1104
  * @return {?}
1146
1105
  */
1147
1106
  function (index) {
1148
- if (!this._items) {
1149
- return true;
1150
- }
1151
- /** @type {?} */
1152
- var tab = this._items ? this._items.toArray()[index] : null;
1153
- return !!tab && !tab.disabled;
1107
+ // Note the `|| 0`, which ensures that values like NaN can't get through
1108
+ // and which would otherwise throw the component into an infinite loop
1109
+ // (since Math.max(NaN, 0) === NaN).
1110
+ return Math.min(this._tabs.length - 1, Math.max(index || 0, 0));
1154
1111
  };
1112
+ /** Returns a unique id for each tab label element */
1155
1113
  /**
1156
- * Sets focus on the HTML element for the label wrapper and scrolls it into the view if
1157
- * scrolling is enabled.
1158
- */
1159
- /**
1160
- * Sets focus on the HTML element for the label wrapper and scrolls it into the view if
1161
- * scrolling is enabled.
1162
- * @param {?} tabIndex
1114
+ * Returns a unique id for each tab label element
1115
+ * @param {?} i
1163
1116
  * @return {?}
1164
1117
  */
1165
- MatPaginatedTabHeader.prototype._setTabFocus = /**
1166
- * Sets focus on the HTML element for the label wrapper and scrolls it into the view if
1167
- * scrolling is enabled.
1168
- * @param {?} tabIndex
1118
+ _MatTabGroupBase.prototype._getTabLabelId = /**
1119
+ * Returns a unique id for each tab label element
1120
+ * @param {?} i
1169
1121
  * @return {?}
1170
1122
  */
1171
- function (tabIndex) {
1172
- if (this._showPaginationControls) {
1173
- this._scrollToLabel(tabIndex);
1174
- }
1175
- if (this._items && this._items.length) {
1176
- this._items.toArray()[tabIndex].focus();
1177
- // Do not let the browser manage scrolling to focus the element, this will be handled
1178
- // by using translation. In LTR, the scroll left should be 0. In RTL, the scroll width
1179
- // should be the full width minus the offset width.
1180
- /** @type {?} */
1181
- var containerEl = this._tabListContainer.nativeElement;
1182
- /** @type {?} */
1183
- var dir = this._getLayoutDirection();
1184
- if (dir == 'ltr') {
1185
- containerEl.scrollLeft = 0;
1186
- }
1187
- else {
1188
- containerEl.scrollLeft = containerEl.scrollWidth - containerEl.offsetWidth;
1189
- }
1190
- }
1123
+ function (i) {
1124
+ return "mat-tab-label-" + this._groupId + "-" + i;
1191
1125
  };
1192
- /** The layout direction of the containing app. */
1126
+ /** Returns a unique id for each tab content element */
1193
1127
  /**
1194
- * The layout direction of the containing app.
1128
+ * Returns a unique id for each tab content element
1129
+ * @param {?} i
1195
1130
  * @return {?}
1196
1131
  */
1197
- MatPaginatedTabHeader.prototype._getLayoutDirection = /**
1198
- * The layout direction of the containing app.
1132
+ _MatTabGroupBase.prototype._getTabContentId = /**
1133
+ * Returns a unique id for each tab content element
1134
+ * @param {?} i
1199
1135
  * @return {?}
1200
1136
  */
1201
- function () {
1202
- return this._dir && this._dir.value === 'rtl' ? 'rtl' : 'ltr';
1137
+ function (i) {
1138
+ return "mat-tab-content-" + this._groupId + "-" + i;
1203
1139
  };
1204
- /** Performs the CSS transformation on the tab list that will cause the list to scroll. */
1205
1140
  /**
1206
- * Performs the CSS transformation on the tab list that will cause the list to scroll.
1141
+ * Sets the height of the body wrapper to the height of the activating tab if dynamic
1142
+ * height property is true.
1143
+ */
1144
+ /**
1145
+ * Sets the height of the body wrapper to the height of the activating tab if dynamic
1146
+ * height property is true.
1147
+ * @param {?} tabHeight
1207
1148
  * @return {?}
1208
1149
  */
1209
- MatPaginatedTabHeader.prototype._updateTabScrollPosition = /**
1210
- * Performs the CSS transformation on the tab list that will cause the list to scroll.
1150
+ _MatTabGroupBase.prototype._setTabBodyWrapperHeight = /**
1151
+ * Sets the height of the body wrapper to the height of the activating tab if dynamic
1152
+ * height property is true.
1153
+ * @param {?} tabHeight
1211
1154
  * @return {?}
1212
1155
  */
1213
- function () {
1214
- /** @type {?} */
1215
- var scrollDistance = this.scrollDistance;
1216
- /** @type {?} */
1217
- var platform$$1 = this._platform;
1156
+ function (tabHeight) {
1157
+ if (!this._dynamicHeight || !this._tabBodyWrapperHeight) {
1158
+ return;
1159
+ }
1218
1160
  /** @type {?} */
1219
- var translateX = this._getLayoutDirection() === 'ltr' ? -scrollDistance : scrollDistance;
1220
- // Don't use `translate3d` here because we don't want to create a new layer. A new layer
1221
- // seems to cause flickering and overflow in Internet Explorer. For example, the ink bar
1222
- // and ripples will exceed the boundaries of the visible tab bar.
1223
- // See: https://github.com/angular/components/issues/10276
1224
- // We round the `transform` here, because transforms with sub-pixel precision cause some
1225
- // browsers to blur the content of the element.
1226
- this._tabList.nativeElement.style.transform = "translateX(" + Math.round(translateX) + "px)";
1227
- // Setting the `transform` on IE will change the scroll offset of the parent, causing the
1228
- // position to be thrown off in some cases. We have to reset it ourselves to ensure that
1229
- // it doesn't get thrown off. Note that we scope it only to IE and Edge, because messing
1230
- // with the scroll position throws off Chrome 71+ in RTL mode (see #14689).
1231
- // @breaking-change 9.0.0 Remove null check for `platform` after it can no longer be undefined.
1232
- if (platform$$1 && (platform$$1.TRIDENT || platform$$1.EDGE)) {
1233
- this._tabListContainer.nativeElement.scrollLeft = 0;
1161
+ var wrapper = this._tabBodyWrapper.nativeElement;
1162
+ wrapper.style.height = this._tabBodyWrapperHeight + 'px';
1163
+ // This conditional forces the browser to paint the height so that
1164
+ // the animation to the new height can have an origin.
1165
+ if (this._tabBodyWrapper.nativeElement.offsetHeight) {
1166
+ wrapper.style.height = tabHeight + 'px';
1234
1167
  }
1235
1168
  };
1236
- Object.defineProperty(MatPaginatedTabHeader.prototype, "scrollDistance", {
1237
- /** Sets the distance in pixels that the tab header should be transformed in the X-axis. */
1238
- get: /**
1239
- * Sets the distance in pixels that the tab header should be transformed in the X-axis.
1240
- * @return {?}
1241
- */
1242
- function () { return this._scrollDistance; },
1243
- set: /**
1244
- * @param {?} value
1245
- * @return {?}
1246
- */
1247
- function (value) {
1248
- this._scrollTo(value);
1249
- },
1250
- enumerable: true,
1251
- configurable: true
1252
- });
1253
- /**
1254
- * Moves the tab list in the 'before' or 'after' direction (towards the beginning of the list or
1255
- * the end of the list, respectively). The distance to scroll is computed to be a third of the
1256
- * length of the tab list view window.
1257
- *
1258
- * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
1259
- * should be called sparingly.
1260
- */
1169
+ /** Removes the height of the tab body wrapper. */
1261
1170
  /**
1262
- * Moves the tab list in the 'before' or 'after' direction (towards the beginning of the list or
1263
- * the end of the list, respectively). The distance to scroll is computed to be a third of the
1264
- * length of the tab list view window.
1265
- *
1266
- * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
1267
- * should be called sparingly.
1268
- * @param {?} direction
1171
+ * Removes the height of the tab body wrapper.
1269
1172
  * @return {?}
1270
1173
  */
1271
- MatPaginatedTabHeader.prototype._scrollHeader = /**
1272
- * Moves the tab list in the 'before' or 'after' direction (towards the beginning of the list or
1273
- * the end of the list, respectively). The distance to scroll is computed to be a third of the
1274
- * length of the tab list view window.
1275
- *
1276
- * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
1277
- * should be called sparingly.
1278
- * @param {?} direction
1174
+ _MatTabGroupBase.prototype._removeTabBodyWrapperHeight = /**
1175
+ * Removes the height of the tab body wrapper.
1279
1176
  * @return {?}
1280
1177
  */
1281
- function (direction) {
1282
- /** @type {?} */
1283
- var viewLength = this._tabListContainer.nativeElement.offsetWidth;
1284
- // Move the scroll distance one-third the length of the tab list's viewport.
1178
+ function () {
1285
1179
  /** @type {?} */
1286
- var scrollAmount = (direction == 'before' ? -1 : 1) * viewLength / 3;
1287
- return this._scrollTo(this._scrollDistance + scrollAmount);
1180
+ var wrapper = this._tabBodyWrapper.nativeElement;
1181
+ this._tabBodyWrapperHeight = wrapper.clientHeight;
1182
+ wrapper.style.height = '';
1183
+ this.animationDone.emit();
1288
1184
  };
1289
- /** Handles click events on the pagination arrows. */
1185
+ /** Handle click events, setting new selected index if appropriate. */
1290
1186
  /**
1291
- * Handles click events on the pagination arrows.
1292
- * @param {?} direction
1187
+ * Handle click events, setting new selected index if appropriate.
1188
+ * @param {?} tab
1189
+ * @param {?} tabHeader
1190
+ * @param {?} index
1293
1191
  * @return {?}
1294
1192
  */
1295
- MatPaginatedTabHeader.prototype._handlePaginatorClick = /**
1296
- * Handles click events on the pagination arrows.
1297
- * @param {?} direction
1298
- * @return {?}
1299
- */
1300
- function (direction) {
1301
- this._stopInterval();
1302
- this._scrollHeader(direction);
1303
- };
1304
- /**
1305
- * Moves the tab list such that the desired tab label (marked by index) is moved into view.
1306
- *
1307
- * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
1308
- * should be called sparingly.
1309
- */
1310
- /**
1311
- * Moves the tab list such that the desired tab label (marked by index) is moved into view.
1312
- *
1313
- * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
1314
- * should be called sparingly.
1315
- * @param {?} labelIndex
1316
- * @return {?}
1317
- */
1318
- MatPaginatedTabHeader.prototype._scrollToLabel = /**
1319
- * Moves the tab list such that the desired tab label (marked by index) is moved into view.
1320
- *
1321
- * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
1322
- * should be called sparingly.
1323
- * @param {?} labelIndex
1193
+ _MatTabGroupBase.prototype._handleClick = /**
1194
+ * Handle click events, setting new selected index if appropriate.
1195
+ * @param {?} tab
1196
+ * @param {?} tabHeader
1197
+ * @param {?} index
1324
1198
  * @return {?}
1325
1199
  */
1326
- function (labelIndex) {
1327
- /** @type {?} */
1328
- var selectedLabel = this._items ? this._items.toArray()[labelIndex] : null;
1329
- if (!selectedLabel) {
1330
- return;
1331
- }
1332
- // The view length is the visible width of the tab labels.
1333
- /** @type {?} */
1334
- var viewLength = this._tabListContainer.nativeElement.offsetWidth;
1335
- var _a = selectedLabel.elementRef.nativeElement, offsetLeft = _a.offsetLeft, offsetWidth = _a.offsetWidth;
1336
- /** @type {?} */
1337
- var labelBeforePos;
1338
- /** @type {?} */
1339
- var labelAfterPos;
1340
- if (this._getLayoutDirection() == 'ltr') {
1341
- labelBeforePos = offsetLeft;
1342
- labelAfterPos = labelBeforePos + offsetWidth;
1343
- }
1344
- else {
1345
- labelAfterPos = this._tabList.nativeElement.offsetWidth - offsetLeft;
1346
- labelBeforePos = labelAfterPos - offsetWidth;
1347
- }
1348
- /** @type {?} */
1349
- var beforeVisiblePos = this.scrollDistance;
1350
- /** @type {?} */
1351
- var afterVisiblePos = this.scrollDistance + viewLength;
1352
- if (labelBeforePos < beforeVisiblePos) {
1353
- // Scroll header to move label to the before direction
1354
- this.scrollDistance -= beforeVisiblePos - labelBeforePos + EXAGGERATED_OVERSCROLL;
1355
- }
1356
- else if (labelAfterPos > afterVisiblePos) {
1357
- // Scroll header to move label to the after direction
1358
- this.scrollDistance += labelAfterPos - afterVisiblePos + EXAGGERATED_OVERSCROLL;
1200
+ function (tab, tabHeader, index) {
1201
+ if (!tab.disabled) {
1202
+ this.selectedIndex = tabHeader.focusIndex = index;
1359
1203
  }
1360
1204
  };
1205
+ /** Retrieves the tabindex for the tab. */
1361
1206
  /**
1362
- * Evaluate whether the pagination controls should be displayed. If the scroll width of the
1363
- * tab list is wider than the size of the header container, then the pagination controls should
1364
- * be shown.
1365
- *
1366
- * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
1367
- * should be called sparingly.
1368
- */
1369
- /**
1370
- * Evaluate whether the pagination controls should be displayed. If the scroll width of the
1371
- * tab list is wider than the size of the header container, then the pagination controls should
1372
- * be shown.
1373
- *
1374
- * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
1375
- * should be called sparingly.
1207
+ * Retrieves the tabindex for the tab.
1208
+ * @param {?} tab
1209
+ * @param {?} idx
1376
1210
  * @return {?}
1377
1211
  */
1378
- MatPaginatedTabHeader.prototype._checkPaginationEnabled = /**
1379
- * Evaluate whether the pagination controls should be displayed. If the scroll width of the
1380
- * tab list is wider than the size of the header container, then the pagination controls should
1381
- * be shown.
1382
- *
1383
- * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
1384
- * should be called sparingly.
1212
+ _MatTabGroupBase.prototype._getTabIndex = /**
1213
+ * Retrieves the tabindex for the tab.
1214
+ * @param {?} tab
1215
+ * @param {?} idx
1385
1216
  * @return {?}
1386
1217
  */
1387
- function () {
1388
- /** @type {?} */
1389
- var isEnabled = this._tabList.nativeElement.scrollWidth > this._elementRef.nativeElement.offsetWidth;
1390
- if (!isEnabled) {
1391
- this.scrollDistance = 0;
1392
- }
1393
- if (isEnabled !== this._showPaginationControls) {
1394
- this._changeDetectorRef.markForCheck();
1218
+ function (tab, idx) {
1219
+ if (tab.disabled) {
1220
+ return null;
1395
1221
  }
1396
- this._showPaginationControls = isEnabled;
1222
+ return this.selectedIndex === idx ? 0 : -1;
1397
1223
  };
1224
+ _MatTabGroupBase.decorators = [
1225
+ { type: core.Directive, args: [{
1226
+ // TODO(crisbeto): this selector can be removed when we update to Angular 9.0.
1227
+ selector: 'do-not-use-abstract-mat-tab-group-base'
1228
+ },] },
1229
+ ];
1230
+ /** @nocollapse */
1231
+ _MatTabGroupBase.ctorParameters = function () { return [
1232
+ { type: core.ElementRef },
1233
+ { type: core.ChangeDetectorRef },
1234
+ { type: undefined, decorators: [{ type: core.Inject, args: [MAT_TABS_CONFIG,] }, { type: core.Optional }] },
1235
+ { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] }
1236
+ ]; };
1237
+ _MatTabGroupBase.propDecorators = {
1238
+ dynamicHeight: [{ type: core.Input }],
1239
+ selectedIndex: [{ type: core.Input }],
1240
+ headerPosition: [{ type: core.Input }],
1241
+ animationDuration: [{ type: core.Input }],
1242
+ backgroundColor: [{ type: core.Input }],
1243
+ selectedIndexChange: [{ type: core.Output }],
1244
+ focusChange: [{ type: core.Output }],
1245
+ animationDone: [{ type: core.Output }],
1246
+ selectedTabChange: [{ type: core.Output }]
1247
+ };
1248
+ return _MatTabGroupBase;
1249
+ }(_MatTabGroupMixinBase));
1250
+ /**
1251
+ * Material design tab-group component. Supports basic tab pairs (label + content) and includes
1252
+ * animated ink-bar, keyboard navigation, and screen reader.
1253
+ * See: https://material.io/design/components/tabs.html
1254
+ */
1255
+ var MatTabGroup = /** @class */ (function (_super) {
1256
+ __extends(MatTabGroup, _super);
1257
+ function MatTabGroup(elementRef, changeDetectorRef, defaultConfig, animationMode) {
1258
+ return _super.call(this, elementRef, changeDetectorRef, defaultConfig, animationMode) || this;
1259
+ }
1260
+ MatTabGroup.decorators = [
1261
+ { type: core.Component, args: [{selector: 'mat-tab-group',
1262
+ exportAs: 'matTabGroup',
1263
+ template: "<mat-tab-header #tabHeader [selectedIndex]=\"selectedIndex\" [disableRipple]=\"disableRipple\" (indexFocused)=\"_focusChanged($event)\" (selectFocusedIndex)=\"selectedIndex = $event\"><div class=\"mat-tab-label\" role=\"tab\" matTabLabelWrapper mat-ripple cdkMonitorElementFocus *ngFor=\"let tab of _tabs; let i = index\" [id]=\"_getTabLabelId(i)\" [attr.tabIndex]=\"_getTabIndex(tab, i)\" [attr.aria-posinset]=\"i + 1\" [attr.aria-setsize]=\"_tabs.length\" [attr.aria-controls]=\"_getTabContentId(i)\" [attr.aria-selected]=\"selectedIndex == i\" [attr.aria-label]=\"tab.ariaLabel || null\" [attr.aria-labelledby]=\"(!tab.ariaLabel && tab.ariaLabelledby) ? tab.ariaLabelledby : null\" [class.mat-tab-label-active]=\"selectedIndex == i\" [disabled]=\"tab.disabled\" [matRippleDisabled]=\"tab.disabled || disableRipple\" (click)=\"_handleClick(tab, tabHeader, i)\"><div class=\"mat-tab-label-content\"><ng-template [ngIf]=\"tab.templateLabel\"><ng-template [cdkPortalOutlet]=\"tab.templateLabel\"></ng-template></ng-template><ng-template [ngIf]=\"!tab.templateLabel\">{{tab.textLabel}}</ng-template></div></div></mat-tab-header><div class=\"mat-tab-body-wrapper\" [class._mat-animation-noopable]=\"_animationMode === 'NoopAnimations'\" #tabBodyWrapper><mat-tab-body role=\"tabpanel\" *ngFor=\"let tab of _tabs; let i = index\" [id]=\"_getTabContentId(i)\" [attr.aria-labelledby]=\"_getTabLabelId(i)\" [class.mat-tab-body-active]=\"selectedIndex == i\" [content]=\"tab.content\" [position]=\"tab.position\" [origin]=\"tab.origin\" [animationDuration]=\"animationDuration\" (_onCentered)=\"_removeTabBodyWrapperHeight()\" (_onCentering)=\"_setTabBodyWrapperHeight($event)\"></mat-tab-body></div>",
1264
+ styles: [".mat-tab-group{display:flex;flex-direction:column}.mat-tab-group.mat-tab-group-inverted-header{flex-direction:column-reverse}.mat-tab-label{height:48px;padding:0 24px;cursor:pointer;box-sizing:border-box;opacity:.6;min-width:160px;text-align:center;display:inline-flex;justify-content:center;align-items:center;white-space:nowrap;position:relative}.mat-tab-label:focus{outline:0}.mat-tab-label:focus:not(.mat-tab-disabled){opacity:1}@media (-ms-high-contrast:active){.mat-tab-label:focus{outline:dotted 2px}}.mat-tab-label.mat-tab-disabled{cursor:default}@media (-ms-high-contrast:active){.mat-tab-label.mat-tab-disabled{opacity:.5}}.mat-tab-label .mat-tab-label-content{display:inline-flex;justify-content:center;align-items:center;white-space:nowrap}@media (-ms-high-contrast:active){.mat-tab-label{opacity:1}}@media (max-width:599px){.mat-tab-label{padding:0 12px}}@media (max-width:959px){.mat-tab-label{padding:0 12px}}.mat-tab-group[mat-stretch-tabs]>.mat-tab-header .mat-tab-label{flex-basis:0;flex-grow:1}.mat-tab-body-wrapper{position:relative;overflow:hidden;display:flex;transition:height .5s cubic-bezier(.35,0,.25,1)}._mat-animation-noopable.mat-tab-body-wrapper{transition:none;animation:none}.mat-tab-body{top:0;left:0;right:0;bottom:0;position:absolute;display:block;overflow:hidden;flex-basis:100%}.mat-tab-body.mat-tab-body-active{position:relative;overflow-x:hidden;overflow-y:auto;z-index:1;flex-grow:1}.mat-tab-group.mat-tab-group-dynamic-height .mat-tab-body.mat-tab-body-active{overflow-y:hidden}"],
1265
+ encapsulation: core.ViewEncapsulation.None,
1266
+ changeDetection: core.ChangeDetectionStrategy.OnPush,
1267
+ inputs: ['color', 'disableRipple'],
1268
+ host: {
1269
+ 'class': 'mat-tab-group',
1270
+ '[class.mat-tab-group-dynamic-height]': 'dynamicHeight',
1271
+ '[class.mat-tab-group-inverted-header]': 'headerPosition === "below"',
1272
+ },
1273
+ },] },
1274
+ ];
1275
+ /** @nocollapse */
1276
+ MatTabGroup.ctorParameters = function () { return [
1277
+ { type: core.ElementRef },
1278
+ { type: core.ChangeDetectorRef },
1279
+ { type: undefined, decorators: [{ type: core.Inject, args: [MAT_TABS_CONFIG,] }, { type: core.Optional }] },
1280
+ { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] }
1281
+ ]; };
1282
+ MatTabGroup.propDecorators = {
1283
+ _tabs: [{ type: core.ContentChildren, args: [MatTab,] }],
1284
+ _tabBodyWrapper: [{ type: core.ViewChild, args: ['tabBodyWrapper', { static: false },] }],
1285
+ _tabHeader: [{ type: core.ViewChild, args: ['tabHeader', { static: false },] }]
1286
+ };
1287
+ return MatTabGroup;
1288
+ }(_MatTabGroupBase));
1289
+
1290
+ /**
1291
+ * @fileoverview added by tsickle
1292
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1293
+ */
1294
+ // Boilerplate for applying mixins to MatTabLabelWrapper.
1295
+ /**
1296
+ * \@docs-private
1297
+ */
1298
+ var
1299
+ // Boilerplate for applying mixins to MatTabLabelWrapper.
1300
+ /**
1301
+ * \@docs-private
1302
+ */
1303
+ MatTabLabelWrapperBase = /** @class */ (function () {
1304
+ function MatTabLabelWrapperBase() {
1305
+ }
1306
+ return MatTabLabelWrapperBase;
1307
+ }());
1308
+ /** @type {?} */
1309
+ var _MatTabLabelWrapperMixinBase = core$1.mixinDisabled(MatTabLabelWrapperBase);
1310
+ /**
1311
+ * Used in the `mat-tab-group` view to display tab labels.
1312
+ * \@docs-private
1313
+ */
1314
+ var MatTabLabelWrapper = /** @class */ (function (_super) {
1315
+ __extends(MatTabLabelWrapper, _super);
1316
+ function MatTabLabelWrapper(elementRef) {
1317
+ var _this = _super.call(this) || this;
1318
+ _this.elementRef = elementRef;
1319
+ return _this;
1320
+ }
1321
+ /** Sets focus on the wrapper element */
1398
1322
  /**
1399
- * Evaluate whether the before and after controls should be enabled or disabled.
1400
- * If the header is at the beginning of the list (scroll distance is equal to 0) then disable the
1401
- * before button. If the header is at the end of the list (scroll distance is equal to the
1402
- * maximum distance we can scroll), then disable the after button.
1403
- *
1404
- * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
1405
- * should be called sparingly.
1406
- */
1407
- /**
1408
- * Evaluate whether the before and after controls should be enabled or disabled.
1409
- * If the header is at the beginning of the list (scroll distance is equal to 0) then disable the
1410
- * before button. If the header is at the end of the list (scroll distance is equal to the
1411
- * maximum distance we can scroll), then disable the after button.
1412
- *
1413
- * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
1414
- * should be called sparingly.
1323
+ * Sets focus on the wrapper element
1415
1324
  * @return {?}
1416
1325
  */
1417
- MatPaginatedTabHeader.prototype._checkScrollingControls = /**
1418
- * Evaluate whether the before and after controls should be enabled or disabled.
1419
- * If the header is at the beginning of the list (scroll distance is equal to 0) then disable the
1420
- * before button. If the header is at the end of the list (scroll distance is equal to the
1421
- * maximum distance we can scroll), then disable the after button.
1422
- *
1423
- * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
1424
- * should be called sparingly.
1326
+ MatTabLabelWrapper.prototype.focus = /**
1327
+ * Sets focus on the wrapper element
1425
1328
  * @return {?}
1426
1329
  */
1427
1330
  function () {
1428
- // Check if the pagination arrows should be activated.
1429
- this._disableScrollBefore = this.scrollDistance == 0;
1430
- this._disableScrollAfter = this.scrollDistance == this._getMaxScrollDistance();
1431
- this._changeDetectorRef.markForCheck();
1331
+ this.elementRef.nativeElement.focus();
1432
1332
  };
1433
1333
  /**
1434
- * Determines what is the maximum length in pixels that can be set for the scroll distance. This
1435
- * is equal to the difference in width between the tab list container and tab header container.
1436
- *
1437
- * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
1438
- * should be called sparingly.
1439
- */
1440
- /**
1441
- * Determines what is the maximum length in pixels that can be set for the scroll distance. This
1442
- * is equal to the difference in width between the tab list container and tab header container.
1443
- *
1444
- * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
1445
- * should be called sparingly.
1446
1334
  * @return {?}
1447
1335
  */
1448
- MatPaginatedTabHeader.prototype._getMaxScrollDistance = /**
1449
- * Determines what is the maximum length in pixels that can be set for the scroll distance. This
1450
- * is equal to the difference in width between the tab list container and tab header container.
1451
- *
1452
- * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
1453
- * should be called sparingly.
1336
+ MatTabLabelWrapper.prototype.getOffsetLeft = /**
1454
1337
  * @return {?}
1455
1338
  */
1456
1339
  function () {
1457
- /** @type {?} */
1458
- var lengthOfTabList = this._tabList.nativeElement.scrollWidth;
1459
- /** @type {?} */
1460
- var viewLength = this._tabListContainer.nativeElement.offsetWidth;
1461
- return (lengthOfTabList - viewLength) || 0;
1340
+ return this.elementRef.nativeElement.offsetLeft;
1462
1341
  };
1463
- /** Tells the ink-bar to align itself to the current label wrapper */
1464
1342
  /**
1465
- * Tells the ink-bar to align itself to the current label wrapper
1466
1343
  * @return {?}
1467
1344
  */
1468
- MatPaginatedTabHeader.prototype._alignInkBarToSelectedTab = /**
1469
- * Tells the ink-bar to align itself to the current label wrapper
1345
+ MatTabLabelWrapper.prototype.getOffsetWidth = /**
1470
1346
  * @return {?}
1471
1347
  */
1472
1348
  function () {
1473
- /** @type {?} */
1474
- var selectedItem = this._items && this._items.length ?
1475
- this._items.toArray()[this.selectedIndex] : null;
1476
- /** @type {?} */
1477
- var selectedLabelWrapper = selectedItem ? selectedItem.elementRef.nativeElement : null;
1478
- if (selectedLabelWrapper) {
1479
- this._inkBar.alignToElement(selectedLabelWrapper);
1480
- }
1481
- else {
1482
- this._inkBar.hide();
1483
- }
1484
- };
1485
- /** Stops the currently-running paginator interval. */
1486
- /**
1487
- * Stops the currently-running paginator interval.
1488
- * @return {?}
1489
- */
1490
- MatPaginatedTabHeader.prototype._stopInterval = /**
1491
- * Stops the currently-running paginator interval.
1492
- * @return {?}
1493
- */
1494
- function () {
1495
- this._stopScrolling.next();
1496
- };
1497
- /**
1498
- * Handles the user pressing down on one of the paginators.
1499
- * Starts scrolling the header after a certain amount of time.
1500
- * @param direction In which direction the paginator should be scrolled.
1501
- */
1502
- /**
1503
- * Handles the user pressing down on one of the paginators.
1504
- * Starts scrolling the header after a certain amount of time.
1505
- * @param {?} direction In which direction the paginator should be scrolled.
1506
- * @return {?}
1507
- */
1508
- MatPaginatedTabHeader.prototype._handlePaginatorPress = /**
1509
- * Handles the user pressing down on one of the paginators.
1510
- * Starts scrolling the header after a certain amount of time.
1511
- * @param {?} direction In which direction the paginator should be scrolled.
1512
- * @return {?}
1513
- */
1514
- function (direction) {
1515
- var _this = this;
1516
- // Avoid overlapping timers.
1517
- this._stopInterval();
1518
- // Start a timer after the delay and keep firing based on the interval.
1519
- rxjs.timer(HEADER_SCROLL_DELAY, HEADER_SCROLL_INTERVAL)
1520
- // Keep the timer going until something tells it to stop or the component is destroyed.
1521
- .pipe(operators.takeUntil(rxjs.merge(this._stopScrolling, this._destroyed)))
1522
- .subscribe((/**
1523
- * @return {?}
1524
- */
1525
- function () {
1526
- var _a = _this._scrollHeader(direction), maxScrollDistance = _a.maxScrollDistance, distance = _a.distance;
1527
- // Stop the timer if we've reached the start or the end.
1528
- if (distance === 0 || distance >= maxScrollDistance) {
1529
- _this._stopInterval();
1530
- }
1531
- }));
1532
- };
1533
- /**
1534
- * Scrolls the header to a given position.
1535
- * @param position Position to which to scroll.
1536
- * @returns Information on the current scroll distance and the maximum.
1537
- */
1538
- /**
1539
- * Scrolls the header to a given position.
1540
- * @private
1541
- * @param {?} position Position to which to scroll.
1542
- * @return {?} Information on the current scroll distance and the maximum.
1543
- */
1544
- MatPaginatedTabHeader.prototype._scrollTo = /**
1545
- * Scrolls the header to a given position.
1546
- * @private
1547
- * @param {?} position Position to which to scroll.
1548
- * @return {?} Information on the current scroll distance and the maximum.
1549
- */
1550
- function (position) {
1551
- /** @type {?} */
1552
- var maxScrollDistance = this._getMaxScrollDistance();
1553
- this._scrollDistance = Math.max(0, Math.min(maxScrollDistance, position));
1554
- // Mark that the scroll distance has changed so that after the view is checked, the CSS
1555
- // transformation can move the header.
1556
- this._scrollDistanceChanged = true;
1557
- this._checkScrollingControls();
1558
- return { maxScrollDistance: maxScrollDistance, distance: this._scrollDistance };
1559
- };
1560
- /** @nocollapse */
1561
- MatPaginatedTabHeader.ctorParameters = function () { return [
1562
- { type: core.ElementRef },
1563
- { type: core.ChangeDetectorRef },
1564
- { type: scrolling.ViewportRuler },
1565
- { type: bidi.Directionality, decorators: [{ type: core.Optional }] },
1566
- { type: core.NgZone },
1567
- { type: platform.Platform },
1568
- { type: String }
1569
- ]; };
1570
- return MatPaginatedTabHeader;
1571
- }());
1572
-
1573
- /**
1574
- * @fileoverview added by tsickle
1575
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1576
- */
1577
- /**
1578
- * The header of the tab group which displays a list of all the tabs in the tab group. Includes
1579
- * an ink bar that follows the currently selected tab. When the tabs list's width exceeds the
1580
- * width of the header container, then arrows will be displayed to allow the user to scroll
1581
- * left and right across the header.
1582
- * \@docs-private
1583
- */
1584
- var MatTabHeader = /** @class */ (function (_super) {
1585
- __extends(MatTabHeader, _super);
1586
- function MatTabHeader(elementRef, changeDetectorRef, viewportRuler, dir, ngZone, platform$$1,
1587
- // @breaking-change 9.0.0 `_animationMode` parameter to be made required.
1588
- animationMode) {
1589
- var _this = _super.call(this, elementRef, changeDetectorRef, viewportRuler, dir, ngZone, platform$$1, animationMode) || this;
1590
- _this._disableRipple = false;
1591
- return _this;
1592
- }
1593
- Object.defineProperty(MatTabHeader.prototype, "disableRipple", {
1594
- /** Whether the ripple effect is disabled or not. */
1595
- get: /**
1596
- * Whether the ripple effect is disabled or not.
1597
- * @return {?}
1598
- */
1599
- function () { return this._disableRipple; },
1600
- set: /**
1601
- * @param {?} value
1602
- * @return {?}
1603
- */
1604
- function (value) { this._disableRipple = coercion.coerceBooleanProperty(value); },
1605
- enumerable: true,
1606
- configurable: true
1607
- });
1608
- /**
1609
- * @protected
1610
- * @param {?} event
1611
- * @return {?}
1612
- */
1613
- MatTabHeader.prototype._itemSelected = /**
1614
- * @protected
1615
- * @param {?} event
1616
- * @return {?}
1617
- */
1618
- function (event) {
1619
- event.preventDefault();
1349
+ return this.elementRef.nativeElement.offsetWidth;
1620
1350
  };
1621
- MatTabHeader.decorators = [
1622
- { type: core.Component, args: [{selector: 'mat-tab-header',
1623
- template: "<div class=\"mat-tab-header-pagination mat-tab-header-pagination-before mat-elevation-z4\" #previousPaginator aria-hidden=\"true\" mat-ripple [matRippleDisabled]=\"_disableScrollBefore || disableRipple\" [class.mat-tab-header-pagination-disabled]=\"_disableScrollBefore\" (click)=\"_handlePaginatorClick('before')\" (mousedown)=\"_handlePaginatorPress('before')\" (touchend)=\"_stopInterval()\"><div class=\"mat-tab-header-pagination-chevron\"></div></div><div class=\"mat-tab-label-container\" #tabListContainer (keydown)=\"_handleKeydown($event)\"><div #tabList class=\"mat-tab-list\" [class._mat-animation-noopable]=\"_animationMode === 'NoopAnimations'\" role=\"tablist\" (cdkObserveContent)=\"_onContentChanges()\"><div class=\"mat-tab-labels\"><ng-content></ng-content></div><mat-ink-bar></mat-ink-bar></div></div><div class=\"mat-tab-header-pagination mat-tab-header-pagination-after mat-elevation-z4\" #nextPaginator aria-hidden=\"true\" mat-ripple [matRippleDisabled]=\"_disableScrollAfter || disableRipple\" [class.mat-tab-header-pagination-disabled]=\"_disableScrollAfter\" (mousedown)=\"_handlePaginatorPress('after')\" (click)=\"_handlePaginatorClick('after')\" (touchend)=\"_stopInterval()\"><div class=\"mat-tab-header-pagination-chevron\"></div></div>",
1624
- styles: [".mat-tab-header{display:flex;overflow:hidden;position:relative;flex-shrink:0}.mat-tab-header-pagination{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;position:relative;display:none;justify-content:center;align-items:center;min-width:32px;cursor:pointer;z-index:2;-webkit-tap-highlight-color:transparent;touch-action:none}.mat-tab-header-pagination-controls-enabled .mat-tab-header-pagination{display:flex}.mat-tab-header-pagination-before,.mat-tab-header-rtl .mat-tab-header-pagination-after{padding-left:4px}.mat-tab-header-pagination-before .mat-tab-header-pagination-chevron,.mat-tab-header-rtl .mat-tab-header-pagination-after .mat-tab-header-pagination-chevron{transform:rotate(-135deg)}.mat-tab-header-pagination-after,.mat-tab-header-rtl .mat-tab-header-pagination-before{padding-right:4px}.mat-tab-header-pagination-after .mat-tab-header-pagination-chevron,.mat-tab-header-rtl .mat-tab-header-pagination-before .mat-tab-header-pagination-chevron{transform:rotate(45deg)}.mat-tab-header-pagination-chevron{border-style:solid;border-width:2px 2px 0 0;content:'';height:8px;width:8px}.mat-tab-header-pagination-disabled{box-shadow:none;cursor:default}.mat-tab-list{flex-grow:1;position:relative;transition:transform .5s cubic-bezier(.35,0,.25,1)}.mat-ink-bar{position:absolute;bottom:0;height:2px;transition:.5s cubic-bezier(.35,0,.25,1)}._mat-animation-noopable.mat-ink-bar{transition:none;animation:none}.mat-tab-group-inverted-header .mat-ink-bar{bottom:auto;top:0}@media (-ms-high-contrast:active){.mat-ink-bar{outline:solid 2px;height:0}}.mat-tab-labels{display:flex}[mat-align-tabs=center] .mat-tab-labels{justify-content:center}[mat-align-tabs=end] .mat-tab-labels{justify-content:flex-end}.mat-tab-label-container{display:flex;flex-grow:1;overflow:hidden;z-index:1}._mat-animation-noopable.mat-tab-list{transition:none;animation:none}.mat-tab-label{height:48px;padding:0 24px;cursor:pointer;box-sizing:border-box;opacity:.6;min-width:160px;text-align:center;display:inline-flex;justify-content:center;align-items:center;white-space:nowrap;position:relative}.mat-tab-label:focus{outline:0}.mat-tab-label:focus:not(.mat-tab-disabled){opacity:1}@media (-ms-high-contrast:active){.mat-tab-label:focus{outline:dotted 2px}}.mat-tab-label.mat-tab-disabled{cursor:default}@media (-ms-high-contrast:active){.mat-tab-label.mat-tab-disabled{opacity:.5}}.mat-tab-label .mat-tab-label-content{display:inline-flex;justify-content:center;align-items:center;white-space:nowrap}@media (-ms-high-contrast:active){.mat-tab-label{opacity:1}}@media (max-width:599px){.mat-tab-label{min-width:72px}}"],
1625
- inputs: ['selectedIndex'],
1626
- outputs: ['selectFocusedIndex', 'indexFocused'],
1627
- encapsulation: core.ViewEncapsulation.None,
1628
- changeDetection: core.ChangeDetectionStrategy.OnPush,
1351
+ MatTabLabelWrapper.decorators = [
1352
+ { type: core.Directive, args: [{
1353
+ selector: '[matTabLabelWrapper]',
1354
+ inputs: ['disabled'],
1629
1355
  host: {
1630
- 'class': 'mat-tab-header',
1631
- '[class.mat-tab-header-pagination-controls-enabled]': '_showPaginationControls',
1632
- '[class.mat-tab-header-rtl]': "_getLayoutDirection() == 'rtl'",
1633
- },
1356
+ '[class.mat-tab-disabled]': 'disabled',
1357
+ '[attr.aria-disabled]': '!!disabled',
1358
+ }
1634
1359
  },] },
1635
1360
  ];
1636
1361
  /** @nocollapse */
1637
- MatTabHeader.ctorParameters = function () { return [
1638
- { type: core.ElementRef },
1639
- { type: core.ChangeDetectorRef },
1640
- { type: scrolling.ViewportRuler },
1641
- { type: bidi.Directionality, decorators: [{ type: core.Optional }] },
1642
- { type: core.NgZone },
1643
- { type: platform.Platform },
1644
- { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] }
1362
+ MatTabLabelWrapper.ctorParameters = function () { return [
1363
+ { type: core.ElementRef }
1645
1364
  ]; };
1646
- MatTabHeader.propDecorators = {
1647
- _items: [{ type: core.ContentChildren, args: [MatTabLabelWrapper,] }],
1648
- _inkBar: [{ type: core.ViewChild, args: [MatInkBar, { static: true },] }],
1649
- _tabListContainer: [{ type: core.ViewChild, args: ['tabListContainer', { static: true },] }],
1650
- _tabList: [{ type: core.ViewChild, args: ['tabList', { static: true },] }],
1651
- _nextPaginator: [{ type: core.ViewChild, args: ['nextPaginator', { static: false },] }],
1652
- _previousPaginator: [{ type: core.ViewChild, args: ['previousPaginator', { static: false },] }],
1653
- disableRipple: [{ type: core.Input }]
1654
- };
1655
- return MatTabHeader;
1656
- }(MatPaginatedTabHeader));
1365
+ return MatTabLabelWrapper;
1366
+ }(_MatTabLabelWrapperMixinBase));
1657
1367
 
1658
1368
  /**
1659
1369
  * @fileoverview added by tsickle
1660
1370
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1661
1371
  */
1662
1372
  /**
1663
- * Used to generate unique ID's for each tab component
1373
+ * Config used to bind passive event listeners
1664
1374
  * @type {?}
1665
1375
  */
1666
- var nextId = 0;
1376
+ var passiveEventListenerOptions = (/** @type {?} */ (platform.normalizePassiveListenerOptions({ passive: true })));
1667
1377
  /**
1668
- * A simple change event emitted on focus or selection changes.
1669
- */
1670
- var /**
1671
- * A simple change event emitted on focus or selection changes.
1378
+ * The distance in pixels that will be overshot when scrolling a tab label into view. This helps
1379
+ * provide a small affordance to the label next to it.
1380
+ * @type {?}
1672
1381
  */
1673
- MatTabChangeEvent = /** @class */ (function () {
1674
- function MatTabChangeEvent() {
1675
- }
1676
- return MatTabChangeEvent;
1677
- }());
1382
+ var EXAGGERATED_OVERSCROLL = 60;
1678
1383
  /**
1679
- * Injection token that can be used to provide the default options the tabs module.
1384
+ * Amount of milliseconds to wait before starting to scroll the header automatically.
1385
+ * Set a little conservatively in order to handle fake events dispatched on touch devices.
1680
1386
  * @type {?}
1681
1387
  */
1682
- var MAT_TABS_CONFIG = new core.InjectionToken('MAT_TABS_CONFIG');
1683
- // Boilerplate for applying mixins to MatTabGroup.
1388
+ var HEADER_SCROLL_DELAY = 650;
1684
1389
  /**
1685
- * \@docs-private
1390
+ * Interval in milliseconds at which to scroll the header
1391
+ * while the user is holding their pointer.
1392
+ * @type {?}
1686
1393
  */
1687
- var
1688
- // Boilerplate for applying mixins to MatTabGroup.
1394
+ var HEADER_SCROLL_INTERVAL = 100;
1689
1395
  /**
1396
+ * Base class for a tab header that supported pagination.
1690
1397
  * \@docs-private
1398
+ * @abstract
1691
1399
  */
1692
- MatTabGroupBase = /** @class */ (function () {
1693
- function MatTabGroupBase(_elementRef) {
1400
+ var MatPaginatedTabHeader = /** @class */ (function () {
1401
+ function MatPaginatedTabHeader(_elementRef, _changeDetectorRef, _viewportRuler, _dir, _ngZone, _platform, _animationMode) {
1402
+ var _this = this;
1694
1403
  this._elementRef = _elementRef;
1695
- }
1696
- return MatTabGroupBase;
1697
- }());
1698
- /** @type {?} */
1699
- var _MatTabGroupMixinBase = core$1.mixinColor(core$1.mixinDisableRipple(MatTabGroupBase), 'primary');
1700
- /**
1701
- * Material design tab-group component. Supports basic tab pairs (label + content) and includes
1702
- * animated ink-bar, keyboard navigation, and screen reader.
1703
- * See: https://material.io/design/components/tabs.html
1704
- */
1705
- var MatTabGroup = /** @class */ (function (_super) {
1706
- __extends(MatTabGroup, _super);
1707
- function MatTabGroup(elementRef, _changeDetectorRef, defaultConfig, _animationMode) {
1708
- var _this = _super.call(this, elementRef) || this;
1709
- _this._changeDetectorRef = _changeDetectorRef;
1710
- _this._animationMode = _animationMode;
1404
+ this._changeDetectorRef = _changeDetectorRef;
1405
+ this._viewportRuler = _viewportRuler;
1406
+ this._dir = _dir;
1407
+ this._ngZone = _ngZone;
1408
+ this._platform = _platform;
1409
+ this._animationMode = _animationMode;
1711
1410
  /**
1712
- * The tab index that should be selected after the content has been checked.
1411
+ * The distance in pixels that the tab labels should be translated to the left.
1713
1412
  */
1714
- _this._indexToSelect = 0;
1413
+ this._scrollDistance = 0;
1715
1414
  /**
1716
- * Snapshot of the height of the tab body wrapper before another tab is activated.
1415
+ * Whether the header should scroll to the selected index after the view has been checked.
1717
1416
  */
1718
- _this._tabBodyWrapperHeight = 0;
1417
+ this._selectedIndexChanged = false;
1719
1418
  /**
1720
- * Subscription to tabs being added/removed.
1419
+ * Emits when the component is destroyed.
1721
1420
  */
1722
- _this._tabsSubscription = rxjs.Subscription.EMPTY;
1421
+ this._destroyed = new rxjs.Subject();
1723
1422
  /**
1724
- * Subscription to changes in the tab labels.
1423
+ * Whether the controls for pagination should be displayed
1725
1424
  */
1726
- _this._tabLabelSubscription = rxjs.Subscription.EMPTY;
1727
- _this._dynamicHeight = false;
1728
- _this._selectedIndex = null;
1425
+ this._showPaginationControls = false;
1729
1426
  /**
1730
- * Position of the tab header.
1427
+ * Whether the tab list can be scrolled more towards the end of the tab label list.
1731
1428
  */
1732
- _this.headerPosition = 'above';
1429
+ this._disableScrollAfter = true;
1733
1430
  /**
1734
- * Output to enable support for two-way binding on `[(selectedIndex)]`
1431
+ * Whether the tab list can be scrolled more towards the beginning of the tab label list.
1735
1432
  */
1736
- _this.selectedIndexChange = new core.EventEmitter();
1433
+ this._disableScrollBefore = true;
1737
1434
  /**
1738
- * Event emitted when focus has changed within a tab group.
1435
+ * Stream that will stop the automated scrolling.
1739
1436
  */
1740
- _this.focusChange = new core.EventEmitter();
1437
+ this._stopScrolling = new rxjs.Subject();
1438
+ this._selectedIndex = 0;
1741
1439
  /**
1742
- * Event emitted when the body animation has completed
1440
+ * Event emitted when the option is selected.
1743
1441
  */
1744
- _this.animationDone = new core.EventEmitter();
1442
+ this.selectFocusedIndex = new core.EventEmitter();
1745
1443
  /**
1746
- * Event emitted when the tab selection has changed.
1747
- */
1748
- _this.selectedTabChange = new core.EventEmitter(true);
1749
- _this._groupId = nextId++;
1750
- _this.animationDuration = defaultConfig && defaultConfig.animationDuration ?
1751
- defaultConfig.animationDuration : '500ms';
1752
- return _this;
1753
- }
1754
- Object.defineProperty(MatTabGroup.prototype, "dynamicHeight", {
1755
- /** Whether the tab group should grow to the size of the active tab. */
1756
- get: /**
1757
- * Whether the tab group should grow to the size of the active tab.
1758
- * @return {?}
1444
+ * Event emitted when a label is focused.
1759
1445
  */
1760
- function () { return this._dynamicHeight; },
1761
- set: /**
1762
- * @param {?} value
1446
+ this.indexFocused = new core.EventEmitter();
1447
+ // Bind the `mouseleave` event on the outside since it doesn't change anything in the view.
1448
+ _ngZone.runOutsideAngular((/**
1763
1449
  * @return {?}
1764
1450
  */
1765
- function (value) { this._dynamicHeight = coercion.coerceBooleanProperty(value); },
1766
- enumerable: true,
1767
- configurable: true
1768
- });
1769
- Object.defineProperty(MatTabGroup.prototype, "selectedIndex", {
1451
+ function () {
1452
+ rxjs.fromEvent(_elementRef.nativeElement, 'mouseleave')
1453
+ .pipe(operators.takeUntil(_this._destroyed))
1454
+ .subscribe((/**
1455
+ * @return {?}
1456
+ */
1457
+ function () {
1458
+ _this._stopInterval();
1459
+ }));
1460
+ }));
1461
+ }
1462
+ Object.defineProperty(MatPaginatedTabHeader.prototype, "selectedIndex", {
1770
1463
  /** The index of the active tab. */
1771
1464
  get: /**
1772
1465
  * The index of the active tab.
@@ -1778,428 +1471,828 @@ var MatTabGroup = /** @class */ (function (_super) {
1778
1471
  * @return {?}
1779
1472
  */
1780
1473
  function (value) {
1781
- this._indexToSelect = coercion.coerceNumberProperty(value, null);
1782
- },
1783
- enumerable: true,
1784
- configurable: true
1785
- });
1786
- Object.defineProperty(MatTabGroup.prototype, "animationDuration", {
1787
- /** Duration for the tab animation. Will be normalized to milliseconds if no units are set. */
1788
- get: /**
1789
- * Duration for the tab animation. Will be normalized to milliseconds if no units are set.
1790
- * @return {?}
1791
- */
1792
- function () { return this._animationDuration; },
1793
- set: /**
1794
- * @param {?} value
1795
- * @return {?}
1796
- */
1797
- function (value) {
1798
- this._animationDuration = /^\d+$/.test(value) ? value + 'ms' : value;
1474
+ value = coercion.coerceNumberProperty(value);
1475
+ if (this._selectedIndex != value) {
1476
+ this._selectedIndexChanged = true;
1477
+ this._selectedIndex = value;
1478
+ if (this._keyManager) {
1479
+ this._keyManager.updateActiveItemIndex(value);
1480
+ }
1481
+ }
1799
1482
  },
1800
1483
  enumerable: true,
1801
1484
  configurable: true
1802
1485
  });
1803
- Object.defineProperty(MatTabGroup.prototype, "backgroundColor", {
1804
- /** Background color of the tab group. */
1805
- get: /**
1806
- * Background color of the tab group.
1486
+ /**
1487
+ * @return {?}
1488
+ */
1489
+ MatPaginatedTabHeader.prototype.ngAfterViewInit = /**
1490
+ * @return {?}
1491
+ */
1492
+ function () {
1493
+ var _this = this;
1494
+ // We need to handle these events manually, because we want to bind passive event listeners.
1495
+ rxjs.fromEvent(this._previousPaginator.nativeElement, 'touchstart', passiveEventListenerOptions)
1496
+ .pipe(operators.takeUntil(this._destroyed))
1497
+ .subscribe((/**
1807
1498
  * @return {?}
1808
1499
  */
1809
- function () { return this._backgroundColor; },
1810
- set: /**
1811
- * @param {?} value
1500
+ function () {
1501
+ _this._handlePaginatorPress('before');
1502
+ }));
1503
+ rxjs.fromEvent(this._nextPaginator.nativeElement, 'touchstart', passiveEventListenerOptions)
1504
+ .pipe(operators.takeUntil(this._destroyed))
1505
+ .subscribe((/**
1812
1506
  * @return {?}
1813
1507
  */
1814
- function (value) {
1815
- /** @type {?} */
1816
- var nativeElement = this._elementRef.nativeElement;
1817
- nativeElement.classList.remove("mat-background-" + this.backgroundColor);
1818
- if (value) {
1819
- nativeElement.classList.add("mat-background-" + value);
1820
- }
1821
- this._backgroundColor = value;
1822
- },
1823
- enumerable: true,
1824
- configurable: true
1825
- });
1826
- /**
1827
- * After the content is checked, this component knows what tabs have been defined
1828
- * and what the selected index should be. This is where we can know exactly what position
1829
- * each tab should be in according to the new selected index, and additionally we know how
1830
- * a new selected tab should transition in (from the left or right).
1831
- */
1508
+ function () {
1509
+ _this._handlePaginatorPress('after');
1510
+ }));
1511
+ };
1832
1512
  /**
1833
- * After the content is checked, this component knows what tabs have been defined
1834
- * and what the selected index should be. This is where we can know exactly what position
1835
- * each tab should be in according to the new selected index, and additionally we know how
1836
- * a new selected tab should transition in (from the left or right).
1837
1513
  * @return {?}
1838
1514
  */
1839
- MatTabGroup.prototype.ngAfterContentChecked = /**
1840
- * After the content is checked, this component knows what tabs have been defined
1841
- * and what the selected index should be. This is where we can know exactly what position
1842
- * each tab should be in according to the new selected index, and additionally we know how
1843
- * a new selected tab should transition in (from the left or right).
1515
+ MatPaginatedTabHeader.prototype.ngAfterContentInit = /**
1844
1516
  * @return {?}
1845
1517
  */
1846
1518
  function () {
1847
1519
  var _this = this;
1848
- // Don't clamp the `indexToSelect` immediately in the setter because it can happen that
1849
- // the amount of tabs changes before the actual change detection runs.
1850
1520
  /** @type {?} */
1851
- var indexToSelect = this._indexToSelect = this._clampTabIndex(this._indexToSelect);
1852
- // If there is a change in selected index, emit a change event. Should not trigger if
1853
- // the selected index has not yet been initialized.
1854
- if (this._selectedIndex != indexToSelect) {
1855
- /** @type {?} */
1856
- var isFirstRun_1 = this._selectedIndex == null;
1857
- if (!isFirstRun_1) {
1858
- this.selectedTabChange.emit(this._createChangeEvent(indexToSelect));
1859
- }
1860
- // Changing these values after change detection has run
1861
- // since the checked content may contain references to them.
1862
- Promise.resolve().then((/**
1863
- * @return {?}
1864
- */
1865
- function () {
1866
- _this._tabs.forEach((/**
1867
- * @param {?} tab
1868
- * @param {?} index
1869
- * @return {?}
1870
- */
1871
- function (tab, index) { return tab.isActive = index === indexToSelect; }));
1872
- if (!isFirstRun_1) {
1873
- _this.selectedIndexChange.emit(indexToSelect);
1874
- }
1875
- }));
1876
- }
1877
- // Setup the position for each tab and optionally setup an origin on the next selected tab.
1878
- this._tabs.forEach((/**
1879
- * @param {?} tab
1880
- * @param {?} index
1521
+ var dirChange = this._dir ? this._dir.change : rxjs.of(null);
1522
+ /** @type {?} */
1523
+ var resize = this._viewportRuler.change(150);
1524
+ /** @type {?} */
1525
+ var realign = (/**
1881
1526
  * @return {?}
1882
1527
  */
1883
- function (tab, index) {
1884
- tab.position = index - indexToSelect;
1885
- // If there is already a selected tab, then set up an origin for the next selected tab
1886
- // if it doesn't have one already.
1887
- if (_this._selectedIndex != null && tab.position == 0 && !tab.origin) {
1888
- tab.origin = indexToSelect - _this._selectedIndex;
1889
- }
1528
+ function () {
1529
+ _this.updatePagination();
1530
+ _this._alignInkBarToSelectedTab();
1531
+ });
1532
+ this._keyManager = new a11y.FocusKeyManager(this._items)
1533
+ .withHorizontalOrientation(this._getLayoutDirection())
1534
+ .withWrap();
1535
+ this._keyManager.updateActiveItem(0);
1536
+ // Defer the first call in order to allow for slower browsers to lay out the elements.
1537
+ // This helps in cases where the user lands directly on a page with paginated tabs.
1538
+ typeof requestAnimationFrame !== 'undefined' ? requestAnimationFrame(realign) : realign();
1539
+ // On dir change or window resize, realign the ink bar and update the orientation of
1540
+ // the key manager if the direction has changed.
1541
+ rxjs.merge(dirChange, resize, this._items.changes).pipe(operators.takeUntil(this._destroyed)).subscribe((/**
1542
+ * @return {?}
1543
+ */
1544
+ function () {
1545
+ realign();
1546
+ _this._keyManager.withHorizontalOrientation(_this._getLayoutDirection());
1890
1547
  }));
1891
- if (this._selectedIndex !== indexToSelect) {
1892
- this._selectedIndex = indexToSelect;
1548
+ // If there is a change in the focus key manager we need to emit the `indexFocused`
1549
+ // event in order to provide a public event that notifies about focus changes. Also we realign
1550
+ // the tabs container by scrolling the new focused tab into the visible section.
1551
+ this._keyManager.change.pipe(operators.takeUntil(this._destroyed)).subscribe((/**
1552
+ * @param {?} newFocusIndex
1553
+ * @return {?}
1554
+ */
1555
+ function (newFocusIndex) {
1556
+ _this.indexFocused.emit(newFocusIndex);
1557
+ _this._setTabFocus(newFocusIndex);
1558
+ }));
1559
+ };
1560
+ /**
1561
+ * @return {?}
1562
+ */
1563
+ MatPaginatedTabHeader.prototype.ngAfterContentChecked = /**
1564
+ * @return {?}
1565
+ */
1566
+ function () {
1567
+ // If the number of tab labels have changed, check if scrolling should be enabled
1568
+ if (this._tabLabelCount != this._items.length) {
1569
+ this.updatePagination();
1570
+ this._tabLabelCount = this._items.length;
1571
+ this._changeDetectorRef.markForCheck();
1572
+ }
1573
+ // If the selected index has changed, scroll to the label and check if the scrolling controls
1574
+ // should be disabled.
1575
+ if (this._selectedIndexChanged) {
1576
+ this._scrollToLabel(this._selectedIndex);
1577
+ this._checkScrollingControls();
1578
+ this._alignInkBarToSelectedTab();
1579
+ this._selectedIndexChanged = false;
1580
+ this._changeDetectorRef.markForCheck();
1581
+ }
1582
+ // If the scroll distance has been changed (tab selected, focused, scroll controls activated),
1583
+ // then translate the header to reflect this.
1584
+ if (this._scrollDistanceChanged) {
1585
+ this._updateTabScrollPosition();
1586
+ this._scrollDistanceChanged = false;
1893
1587
  this._changeDetectorRef.markForCheck();
1894
1588
  }
1895
1589
  };
1896
1590
  /**
1897
1591
  * @return {?}
1898
1592
  */
1899
- MatTabGroup.prototype.ngAfterContentInit = /**
1593
+ MatPaginatedTabHeader.prototype.ngOnDestroy = /**
1900
1594
  * @return {?}
1901
1595
  */
1902
1596
  function () {
1903
- var _this = this;
1904
- this._subscribeToTabLabels();
1905
- // Subscribe to changes in the amount of tabs, in order to be
1906
- // able to re-render the content as new tabs are added or removed.
1907
- this._tabsSubscription = this._tabs.changes.subscribe((/**
1908
- * @return {?}
1909
- */
1910
- function () {
1911
- /** @type {?} */
1912
- var indexToSelect = _this._clampTabIndex(_this._indexToSelect);
1913
- // Maintain the previously-selected tab if a new tab is added or removed and there is no
1914
- // explicit change that selects a different tab.
1915
- if (indexToSelect === _this._selectedIndex) {
1916
- /** @type {?} */
1917
- var tabs = _this._tabs.toArray();
1918
- for (var i = 0; i < tabs.length; i++) {
1919
- if (tabs[i].isActive) {
1920
- // Assign both to the `_indexToSelect` and `_selectedIndex` so we don't fire a changed
1921
- // event, otherwise the consumer may end up in an infinite loop in some edge cases like
1922
- // adding a tab within the `selectedIndexChange` event.
1923
- _this._indexToSelect = _this._selectedIndex = i;
1924
- break;
1925
- }
1926
- }
1597
+ this._destroyed.next();
1598
+ this._destroyed.complete();
1599
+ this._stopScrolling.complete();
1600
+ };
1601
+ /** Handles keyboard events on the header. */
1602
+ /**
1603
+ * Handles keyboard events on the header.
1604
+ * @param {?} event
1605
+ * @return {?}
1606
+ */
1607
+ MatPaginatedTabHeader.prototype._handleKeydown = /**
1608
+ * Handles keyboard events on the header.
1609
+ * @param {?} event
1610
+ * @return {?}
1611
+ */
1612
+ function (event) {
1613
+ // We don't handle any key bindings with a modifier key.
1614
+ if (keycodes.hasModifierKey(event)) {
1615
+ return;
1616
+ }
1617
+ switch (event.keyCode) {
1618
+ case keycodes.HOME:
1619
+ this._keyManager.setFirstItemActive();
1620
+ event.preventDefault();
1621
+ break;
1622
+ case keycodes.END:
1623
+ this._keyManager.setLastItemActive();
1624
+ event.preventDefault();
1625
+ break;
1626
+ case keycodes.ENTER:
1627
+ case keycodes.SPACE:
1628
+ this.selectFocusedIndex.emit(this.focusIndex);
1629
+ this._itemSelected(event);
1630
+ break;
1631
+ default:
1632
+ this._keyManager.onKeydown(event);
1633
+ }
1634
+ };
1635
+ /**
1636
+ * Callback for when the MutationObserver detects that the content has changed.
1637
+ */
1638
+ /**
1639
+ * Callback for when the MutationObserver detects that the content has changed.
1640
+ * @return {?}
1641
+ */
1642
+ MatPaginatedTabHeader.prototype._onContentChanges = /**
1643
+ * Callback for when the MutationObserver detects that the content has changed.
1644
+ * @return {?}
1645
+ */
1646
+ function () {
1647
+ var _this = this;
1648
+ /** @type {?} */
1649
+ var textContent = this._elementRef.nativeElement.textContent;
1650
+ // We need to diff the text content of the header, because the MutationObserver callback
1651
+ // will fire even if the text content didn't change which is inefficient and is prone
1652
+ // to infinite loops if a poorly constructed expression is passed in (see #14249).
1653
+ if (textContent !== this._currentTextContent) {
1654
+ this._currentTextContent = textContent || '';
1655
+ // The content observer runs outside the `NgZone` by default, which
1656
+ // means that we need to bring the callback back in ourselves.
1657
+ this._ngZone.run((/**
1658
+ * @return {?}
1659
+ */
1660
+ function () {
1661
+ _this.updatePagination();
1662
+ _this._alignInkBarToSelectedTab();
1663
+ _this._changeDetectorRef.markForCheck();
1664
+ }));
1665
+ }
1666
+ };
1667
+ /**
1668
+ * Updates the view whether pagination should be enabled or not.
1669
+ *
1670
+ * WARNING: Calling this method can be very costly in terms of performance. It should be called
1671
+ * as infrequently as possible from outside of the Tabs component as it causes a reflow of the
1672
+ * page.
1673
+ */
1674
+ /**
1675
+ * Updates the view whether pagination should be enabled or not.
1676
+ *
1677
+ * WARNING: Calling this method can be very costly in terms of performance. It should be called
1678
+ * as infrequently as possible from outside of the Tabs component as it causes a reflow of the
1679
+ * page.
1680
+ * @return {?}
1681
+ */
1682
+ MatPaginatedTabHeader.prototype.updatePagination = /**
1683
+ * Updates the view whether pagination should be enabled or not.
1684
+ *
1685
+ * WARNING: Calling this method can be very costly in terms of performance. It should be called
1686
+ * as infrequently as possible from outside of the Tabs component as it causes a reflow of the
1687
+ * page.
1688
+ * @return {?}
1689
+ */
1690
+ function () {
1691
+ this._checkPaginationEnabled();
1692
+ this._checkScrollingControls();
1693
+ this._updateTabScrollPosition();
1694
+ };
1695
+ Object.defineProperty(MatPaginatedTabHeader.prototype, "focusIndex", {
1696
+ /** Tracks which element has focus; used for keyboard navigation */
1697
+ get: /**
1698
+ * Tracks which element has focus; used for keyboard navigation
1699
+ * @return {?}
1700
+ */
1701
+ function () {
1702
+ return this._keyManager ? (/** @type {?} */ (this._keyManager.activeItemIndex)) : 0;
1703
+ },
1704
+ /** When the focus index is set, we must manually send focus to the correct label */
1705
+ set: /**
1706
+ * When the focus index is set, we must manually send focus to the correct label
1707
+ * @param {?} value
1708
+ * @return {?}
1709
+ */
1710
+ function (value) {
1711
+ if (!this._isValidIndex(value) || this.focusIndex === value || !this._keyManager) {
1712
+ return;
1927
1713
  }
1928
- _this._subscribeToTabLabels();
1929
- _this._changeDetectorRef.markForCheck();
1930
- }));
1714
+ this._keyManager.setActiveItem(value);
1715
+ },
1716
+ enumerable: true,
1717
+ configurable: true
1718
+ });
1719
+ /**
1720
+ * Determines if an index is valid. If the tabs are not ready yet, we assume that the user is
1721
+ * providing a valid index and return true.
1722
+ */
1723
+ /**
1724
+ * Determines if an index is valid. If the tabs are not ready yet, we assume that the user is
1725
+ * providing a valid index and return true.
1726
+ * @param {?} index
1727
+ * @return {?}
1728
+ */
1729
+ MatPaginatedTabHeader.prototype._isValidIndex = /**
1730
+ * Determines if an index is valid. If the tabs are not ready yet, we assume that the user is
1731
+ * providing a valid index and return true.
1732
+ * @param {?} index
1733
+ * @return {?}
1734
+ */
1735
+ function (index) {
1736
+ if (!this._items) {
1737
+ return true;
1738
+ }
1739
+ /** @type {?} */
1740
+ var tab = this._items ? this._items.toArray()[index] : null;
1741
+ return !!tab && !tab.disabled;
1742
+ };
1743
+ /**
1744
+ * Sets focus on the HTML element for the label wrapper and scrolls it into the view if
1745
+ * scrolling is enabled.
1746
+ */
1747
+ /**
1748
+ * Sets focus on the HTML element for the label wrapper and scrolls it into the view if
1749
+ * scrolling is enabled.
1750
+ * @param {?} tabIndex
1751
+ * @return {?}
1752
+ */
1753
+ MatPaginatedTabHeader.prototype._setTabFocus = /**
1754
+ * Sets focus on the HTML element for the label wrapper and scrolls it into the view if
1755
+ * scrolling is enabled.
1756
+ * @param {?} tabIndex
1757
+ * @return {?}
1758
+ */
1759
+ function (tabIndex) {
1760
+ if (this._showPaginationControls) {
1761
+ this._scrollToLabel(tabIndex);
1762
+ }
1763
+ if (this._items && this._items.length) {
1764
+ this._items.toArray()[tabIndex].focus();
1765
+ // Do not let the browser manage scrolling to focus the element, this will be handled
1766
+ // by using translation. In LTR, the scroll left should be 0. In RTL, the scroll width
1767
+ // should be the full width minus the offset width.
1768
+ /** @type {?} */
1769
+ var containerEl = this._tabListContainer.nativeElement;
1770
+ /** @type {?} */
1771
+ var dir = this._getLayoutDirection();
1772
+ if (dir == 'ltr') {
1773
+ containerEl.scrollLeft = 0;
1774
+ }
1775
+ else {
1776
+ containerEl.scrollLeft = containerEl.scrollWidth - containerEl.offsetWidth;
1777
+ }
1778
+ }
1779
+ };
1780
+ /** The layout direction of the containing app. */
1781
+ /**
1782
+ * The layout direction of the containing app.
1783
+ * @return {?}
1784
+ */
1785
+ MatPaginatedTabHeader.prototype._getLayoutDirection = /**
1786
+ * The layout direction of the containing app.
1787
+ * @return {?}
1788
+ */
1789
+ function () {
1790
+ return this._dir && this._dir.value === 'rtl' ? 'rtl' : 'ltr';
1791
+ };
1792
+ /** Performs the CSS transformation on the tab list that will cause the list to scroll. */
1793
+ /**
1794
+ * Performs the CSS transformation on the tab list that will cause the list to scroll.
1795
+ * @return {?}
1796
+ */
1797
+ MatPaginatedTabHeader.prototype._updateTabScrollPosition = /**
1798
+ * Performs the CSS transformation on the tab list that will cause the list to scroll.
1799
+ * @return {?}
1800
+ */
1801
+ function () {
1802
+ /** @type {?} */
1803
+ var scrollDistance = this.scrollDistance;
1804
+ /** @type {?} */
1805
+ var platform$$1 = this._platform;
1806
+ /** @type {?} */
1807
+ var translateX = this._getLayoutDirection() === 'ltr' ? -scrollDistance : scrollDistance;
1808
+ // Don't use `translate3d` here because we don't want to create a new layer. A new layer
1809
+ // seems to cause flickering and overflow in Internet Explorer. For example, the ink bar
1810
+ // and ripples will exceed the boundaries of the visible tab bar.
1811
+ // See: https://github.com/angular/components/issues/10276
1812
+ // We round the `transform` here, because transforms with sub-pixel precision cause some
1813
+ // browsers to blur the content of the element.
1814
+ this._tabList.nativeElement.style.transform = "translateX(" + Math.round(translateX) + "px)";
1815
+ // Setting the `transform` on IE will change the scroll offset of the parent, causing the
1816
+ // position to be thrown off in some cases. We have to reset it ourselves to ensure that
1817
+ // it doesn't get thrown off. Note that we scope it only to IE and Edge, because messing
1818
+ // with the scroll position throws off Chrome 71+ in RTL mode (see #14689).
1819
+ // @breaking-change 9.0.0 Remove null check for `platform` after it can no longer be undefined.
1820
+ if (platform$$1 && (platform$$1.TRIDENT || platform$$1.EDGE)) {
1821
+ this._tabListContainer.nativeElement.scrollLeft = 0;
1822
+ }
1823
+ };
1824
+ Object.defineProperty(MatPaginatedTabHeader.prototype, "scrollDistance", {
1825
+ /** Sets the distance in pixels that the tab header should be transformed in the X-axis. */
1826
+ get: /**
1827
+ * Sets the distance in pixels that the tab header should be transformed in the X-axis.
1828
+ * @return {?}
1829
+ */
1830
+ function () { return this._scrollDistance; },
1831
+ set: /**
1832
+ * @param {?} value
1833
+ * @return {?}
1834
+ */
1835
+ function (value) {
1836
+ this._scrollTo(value);
1837
+ },
1838
+ enumerable: true,
1839
+ configurable: true
1840
+ });
1841
+ /**
1842
+ * Moves the tab list in the 'before' or 'after' direction (towards the beginning of the list or
1843
+ * the end of the list, respectively). The distance to scroll is computed to be a third of the
1844
+ * length of the tab list view window.
1845
+ *
1846
+ * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
1847
+ * should be called sparingly.
1848
+ */
1849
+ /**
1850
+ * Moves the tab list in the 'before' or 'after' direction (towards the beginning of the list or
1851
+ * the end of the list, respectively). The distance to scroll is computed to be a third of the
1852
+ * length of the tab list view window.
1853
+ *
1854
+ * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
1855
+ * should be called sparingly.
1856
+ * @param {?} direction
1857
+ * @return {?}
1858
+ */
1859
+ MatPaginatedTabHeader.prototype._scrollHeader = /**
1860
+ * Moves the tab list in the 'before' or 'after' direction (towards the beginning of the list or
1861
+ * the end of the list, respectively). The distance to scroll is computed to be a third of the
1862
+ * length of the tab list view window.
1863
+ *
1864
+ * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
1865
+ * should be called sparingly.
1866
+ * @param {?} direction
1867
+ * @return {?}
1868
+ */
1869
+ function (direction) {
1870
+ /** @type {?} */
1871
+ var viewLength = this._tabListContainer.nativeElement.offsetWidth;
1872
+ // Move the scroll distance one-third the length of the tab list's viewport.
1873
+ /** @type {?} */
1874
+ var scrollAmount = (direction == 'before' ? -1 : 1) * viewLength / 3;
1875
+ return this._scrollTo(this._scrollDistance + scrollAmount);
1876
+ };
1877
+ /** Handles click events on the pagination arrows. */
1878
+ /**
1879
+ * Handles click events on the pagination arrows.
1880
+ * @param {?} direction
1881
+ * @return {?}
1882
+ */
1883
+ MatPaginatedTabHeader.prototype._handlePaginatorClick = /**
1884
+ * Handles click events on the pagination arrows.
1885
+ * @param {?} direction
1886
+ * @return {?}
1887
+ */
1888
+ function (direction) {
1889
+ this._stopInterval();
1890
+ this._scrollHeader(direction);
1891
+ };
1892
+ /**
1893
+ * Moves the tab list such that the desired tab label (marked by index) is moved into view.
1894
+ *
1895
+ * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
1896
+ * should be called sparingly.
1897
+ */
1898
+ /**
1899
+ * Moves the tab list such that the desired tab label (marked by index) is moved into view.
1900
+ *
1901
+ * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
1902
+ * should be called sparingly.
1903
+ * @param {?} labelIndex
1904
+ * @return {?}
1905
+ */
1906
+ MatPaginatedTabHeader.prototype._scrollToLabel = /**
1907
+ * Moves the tab list such that the desired tab label (marked by index) is moved into view.
1908
+ *
1909
+ * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
1910
+ * should be called sparingly.
1911
+ * @param {?} labelIndex
1912
+ * @return {?}
1913
+ */
1914
+ function (labelIndex) {
1915
+ /** @type {?} */
1916
+ var selectedLabel = this._items ? this._items.toArray()[labelIndex] : null;
1917
+ if (!selectedLabel) {
1918
+ return;
1919
+ }
1920
+ // The view length is the visible width of the tab labels.
1921
+ /** @type {?} */
1922
+ var viewLength = this._tabListContainer.nativeElement.offsetWidth;
1923
+ var _a = selectedLabel.elementRef.nativeElement, offsetLeft = _a.offsetLeft, offsetWidth = _a.offsetWidth;
1924
+ /** @type {?} */
1925
+ var labelBeforePos;
1926
+ /** @type {?} */
1927
+ var labelAfterPos;
1928
+ if (this._getLayoutDirection() == 'ltr') {
1929
+ labelBeforePos = offsetLeft;
1930
+ labelAfterPos = labelBeforePos + offsetWidth;
1931
+ }
1932
+ else {
1933
+ labelAfterPos = this._tabList.nativeElement.offsetWidth - offsetLeft;
1934
+ labelBeforePos = labelAfterPos - offsetWidth;
1935
+ }
1936
+ /** @type {?} */
1937
+ var beforeVisiblePos = this.scrollDistance;
1938
+ /** @type {?} */
1939
+ var afterVisiblePos = this.scrollDistance + viewLength;
1940
+ if (labelBeforePos < beforeVisiblePos) {
1941
+ // Scroll header to move label to the before direction
1942
+ this.scrollDistance -= beforeVisiblePos - labelBeforePos + EXAGGERATED_OVERSCROLL;
1943
+ }
1944
+ else if (labelAfterPos > afterVisiblePos) {
1945
+ // Scroll header to move label to the after direction
1946
+ this.scrollDistance += labelAfterPos - afterVisiblePos + EXAGGERATED_OVERSCROLL;
1947
+ }
1931
1948
  };
1932
1949
  /**
1933
- * @return {?}
1934
- */
1935
- MatTabGroup.prototype.ngOnDestroy = /**
1936
- * @return {?}
1950
+ * Evaluate whether the pagination controls should be displayed. If the scroll width of the
1951
+ * tab list is wider than the size of the header container, then the pagination controls should
1952
+ * be shown.
1953
+ *
1954
+ * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
1955
+ * should be called sparingly.
1937
1956
  */
1938
- function () {
1939
- this._tabsSubscription.unsubscribe();
1940
- this._tabLabelSubscription.unsubscribe();
1941
- };
1942
- /** Re-aligns the ink bar to the selected tab element. */
1943
1957
  /**
1944
- * Re-aligns the ink bar to the selected tab element.
1958
+ * Evaluate whether the pagination controls should be displayed. If the scroll width of the
1959
+ * tab list is wider than the size of the header container, then the pagination controls should
1960
+ * be shown.
1961
+ *
1962
+ * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
1963
+ * should be called sparingly.
1945
1964
  * @return {?}
1946
1965
  */
1947
- MatTabGroup.prototype.realignInkBar = /**
1948
- * Re-aligns the ink bar to the selected tab element.
1966
+ MatPaginatedTabHeader.prototype._checkPaginationEnabled = /**
1967
+ * Evaluate whether the pagination controls should be displayed. If the scroll width of the
1968
+ * tab list is wider than the size of the header container, then the pagination controls should
1969
+ * be shown.
1970
+ *
1971
+ * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
1972
+ * should be called sparingly.
1949
1973
  * @return {?}
1950
1974
  */
1951
1975
  function () {
1952
- if (this._tabHeader) {
1953
- this._tabHeader._alignInkBarToSelectedTab();
1976
+ /** @type {?} */
1977
+ var isEnabled = this._tabList.nativeElement.scrollWidth > this._elementRef.nativeElement.offsetWidth;
1978
+ if (!isEnabled) {
1979
+ this.scrollDistance = 0;
1980
+ }
1981
+ if (isEnabled !== this._showPaginationControls) {
1982
+ this._changeDetectorRef.markForCheck();
1954
1983
  }
1984
+ this._showPaginationControls = isEnabled;
1955
1985
  };
1956
1986
  /**
1957
- * @param {?} index
1958
- * @return {?}
1959
- */
1960
- MatTabGroup.prototype._focusChanged = /**
1961
- * @param {?} index
1962
- * @return {?}
1987
+ * Evaluate whether the before and after controls should be enabled or disabled.
1988
+ * If the header is at the beginning of the list (scroll distance is equal to 0) then disable the
1989
+ * before button. If the header is at the end of the list (scroll distance is equal to the
1990
+ * maximum distance we can scroll), then disable the after button.
1991
+ *
1992
+ * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
1993
+ * should be called sparingly.
1963
1994
  */
1964
- function (index) {
1965
- this.focusChange.emit(this._createChangeEvent(index));
1966
- };
1967
1995
  /**
1968
- * @private
1969
- * @param {?} index
1996
+ * Evaluate whether the before and after controls should be enabled or disabled.
1997
+ * If the header is at the beginning of the list (scroll distance is equal to 0) then disable the
1998
+ * before button. If the header is at the end of the list (scroll distance is equal to the
1999
+ * maximum distance we can scroll), then disable the after button.
2000
+ *
2001
+ * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
2002
+ * should be called sparingly.
1970
2003
  * @return {?}
1971
2004
  */
1972
- MatTabGroup.prototype._createChangeEvent = /**
1973
- * @private
1974
- * @param {?} index
2005
+ MatPaginatedTabHeader.prototype._checkScrollingControls = /**
2006
+ * Evaluate whether the before and after controls should be enabled or disabled.
2007
+ * If the header is at the beginning of the list (scroll distance is equal to 0) then disable the
2008
+ * before button. If the header is at the end of the list (scroll distance is equal to the
2009
+ * maximum distance we can scroll), then disable the after button.
2010
+ *
2011
+ * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
2012
+ * should be called sparingly.
1975
2013
  * @return {?}
1976
2014
  */
1977
- function (index) {
1978
- /** @type {?} */
1979
- var event = new MatTabChangeEvent;
1980
- event.index = index;
1981
- if (this._tabs && this._tabs.length) {
1982
- event.tab = this._tabs.toArray()[index];
1983
- }
1984
- return event;
2015
+ function () {
2016
+ // Check if the pagination arrows should be activated.
2017
+ this._disableScrollBefore = this.scrollDistance == 0;
2018
+ this._disableScrollAfter = this.scrollDistance == this._getMaxScrollDistance();
2019
+ this._changeDetectorRef.markForCheck();
1985
2020
  };
1986
2021
  /**
1987
- * Subscribes to changes in the tab labels. This is needed, because the @Input for the label is
1988
- * on the MatTab component, whereas the data binding is inside the MatTabGroup. In order for the
1989
- * binding to be updated, we need to subscribe to changes in it and trigger change detection
1990
- * manually.
2022
+ * Determines what is the maximum length in pixels that can be set for the scroll distance. This
2023
+ * is equal to the difference in width between the tab list container and tab header container.
2024
+ *
2025
+ * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
2026
+ * should be called sparingly.
1991
2027
  */
1992
2028
  /**
1993
- * Subscribes to changes in the tab labels. This is needed, because the \@Input for the label is
1994
- * on the MatTab component, whereas the data binding is inside the MatTabGroup. In order for the
1995
- * binding to be updated, we need to subscribe to changes in it and trigger change detection
1996
- * manually.
1997
- * @private
2029
+ * Determines what is the maximum length in pixels that can be set for the scroll distance. This
2030
+ * is equal to the difference in width between the tab list container and tab header container.
2031
+ *
2032
+ * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
2033
+ * should be called sparingly.
1998
2034
  * @return {?}
1999
2035
  */
2000
- MatTabGroup.prototype._subscribeToTabLabels = /**
2001
- * Subscribes to changes in the tab labels. This is needed, because the \@Input for the label is
2002
- * on the MatTab component, whereas the data binding is inside the MatTabGroup. In order for the
2003
- * binding to be updated, we need to subscribe to changes in it and trigger change detection
2004
- * manually.
2005
- * @private
2036
+ MatPaginatedTabHeader.prototype._getMaxScrollDistance = /**
2037
+ * Determines what is the maximum length in pixels that can be set for the scroll distance. This
2038
+ * is equal to the difference in width between the tab list container and tab header container.
2039
+ *
2040
+ * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
2041
+ * should be called sparingly.
2006
2042
  * @return {?}
2007
2043
  */
2008
2044
  function () {
2009
- var _this = this;
2010
- if (this._tabLabelSubscription) {
2011
- this._tabLabelSubscription.unsubscribe();
2012
- }
2013
- this._tabLabelSubscription = rxjs.merge.apply(void 0, this._tabs.map((/**
2014
- * @param {?} tab
2015
- * @return {?}
2016
- */
2017
- function (tab) { return tab._stateChanges; }))).subscribe((/**
2018
- * @return {?}
2019
- */
2020
- function () { return _this._changeDetectorRef.markForCheck(); }));
2021
- };
2022
- /** Clamps the given index to the bounds of 0 and the tabs length. */
2023
- /**
2024
- * Clamps the given index to the bounds of 0 and the tabs length.
2025
- * @private
2026
- * @param {?} index
2027
- * @return {?}
2028
- */
2029
- MatTabGroup.prototype._clampTabIndex = /**
2030
- * Clamps the given index to the bounds of 0 and the tabs length.
2031
- * @private
2032
- * @param {?} index
2033
- * @return {?}
2034
- */
2035
- function (index) {
2036
- // Note the `|| 0`, which ensures that values like NaN can't get through
2037
- // and which would otherwise throw the component into an infinite loop
2038
- // (since Math.max(NaN, 0) === NaN).
2039
- return Math.min(this._tabs.length - 1, Math.max(index || 0, 0));
2045
+ /** @type {?} */
2046
+ var lengthOfTabList = this._tabList.nativeElement.scrollWidth;
2047
+ /** @type {?} */
2048
+ var viewLength = this._tabListContainer.nativeElement.offsetWidth;
2049
+ return (lengthOfTabList - viewLength) || 0;
2040
2050
  };
2041
- /** Returns a unique id for each tab label element */
2051
+ /** Tells the ink-bar to align itself to the current label wrapper */
2042
2052
  /**
2043
- * Returns a unique id for each tab label element
2044
- * @param {?} i
2053
+ * Tells the ink-bar to align itself to the current label wrapper
2045
2054
  * @return {?}
2046
2055
  */
2047
- MatTabGroup.prototype._getTabLabelId = /**
2048
- * Returns a unique id for each tab label element
2049
- * @param {?} i
2056
+ MatPaginatedTabHeader.prototype._alignInkBarToSelectedTab = /**
2057
+ * Tells the ink-bar to align itself to the current label wrapper
2050
2058
  * @return {?}
2051
2059
  */
2052
- function (i) {
2053
- return "mat-tab-label-" + this._groupId + "-" + i;
2060
+ function () {
2061
+ /** @type {?} */
2062
+ var selectedItem = this._items && this._items.length ?
2063
+ this._items.toArray()[this.selectedIndex] : null;
2064
+ /** @type {?} */
2065
+ var selectedLabelWrapper = selectedItem ? selectedItem.elementRef.nativeElement : null;
2066
+ if (selectedLabelWrapper) {
2067
+ this._inkBar.alignToElement(selectedLabelWrapper);
2068
+ }
2069
+ else {
2070
+ this._inkBar.hide();
2071
+ }
2054
2072
  };
2055
- /** Returns a unique id for each tab content element */
2073
+ /** Stops the currently-running paginator interval. */
2056
2074
  /**
2057
- * Returns a unique id for each tab content element
2058
- * @param {?} i
2075
+ * Stops the currently-running paginator interval.
2059
2076
  * @return {?}
2060
2077
  */
2061
- MatTabGroup.prototype._getTabContentId = /**
2062
- * Returns a unique id for each tab content element
2063
- * @param {?} i
2078
+ MatPaginatedTabHeader.prototype._stopInterval = /**
2079
+ * Stops the currently-running paginator interval.
2064
2080
  * @return {?}
2065
2081
  */
2066
- function (i) {
2067
- return "mat-tab-content-" + this._groupId + "-" + i;
2082
+ function () {
2083
+ this._stopScrolling.next();
2068
2084
  };
2069
2085
  /**
2070
- * Sets the height of the body wrapper to the height of the activating tab if dynamic
2071
- * height property is true.
2086
+ * Handles the user pressing down on one of the paginators.
2087
+ * Starts scrolling the header after a certain amount of time.
2088
+ * @param direction In which direction the paginator should be scrolled.
2072
2089
  */
2073
2090
  /**
2074
- * Sets the height of the body wrapper to the height of the activating tab if dynamic
2075
- * height property is true.
2076
- * @param {?} tabHeight
2091
+ * Handles the user pressing down on one of the paginators.
2092
+ * Starts scrolling the header after a certain amount of time.
2093
+ * @param {?} direction In which direction the paginator should be scrolled.
2077
2094
  * @return {?}
2078
2095
  */
2079
- MatTabGroup.prototype._setTabBodyWrapperHeight = /**
2080
- * Sets the height of the body wrapper to the height of the activating tab if dynamic
2081
- * height property is true.
2082
- * @param {?} tabHeight
2096
+ MatPaginatedTabHeader.prototype._handlePaginatorPress = /**
2097
+ * Handles the user pressing down on one of the paginators.
2098
+ * Starts scrolling the header after a certain amount of time.
2099
+ * @param {?} direction In which direction the paginator should be scrolled.
2083
2100
  * @return {?}
2084
2101
  */
2085
- function (tabHeight) {
2086
- if (!this._dynamicHeight || !this._tabBodyWrapperHeight) {
2087
- return;
2088
- }
2089
- /** @type {?} */
2090
- var wrapper = this._tabBodyWrapper.nativeElement;
2091
- wrapper.style.height = this._tabBodyWrapperHeight + 'px';
2092
- // This conditional forces the browser to paint the height so that
2093
- // the animation to the new height can have an origin.
2094
- if (this._tabBodyWrapper.nativeElement.offsetHeight) {
2095
- wrapper.style.height = tabHeight + 'px';
2096
- }
2102
+ function (direction) {
2103
+ var _this = this;
2104
+ // Avoid overlapping timers.
2105
+ this._stopInterval();
2106
+ // Start a timer after the delay and keep firing based on the interval.
2107
+ rxjs.timer(HEADER_SCROLL_DELAY, HEADER_SCROLL_INTERVAL)
2108
+ // Keep the timer going until something tells it to stop or the component is destroyed.
2109
+ .pipe(operators.takeUntil(rxjs.merge(this._stopScrolling, this._destroyed)))
2110
+ .subscribe((/**
2111
+ * @return {?}
2112
+ */
2113
+ function () {
2114
+ var _a = _this._scrollHeader(direction), maxScrollDistance = _a.maxScrollDistance, distance = _a.distance;
2115
+ // Stop the timer if we've reached the start or the end.
2116
+ if (distance === 0 || distance >= maxScrollDistance) {
2117
+ _this._stopInterval();
2118
+ }
2119
+ }));
2097
2120
  };
2098
- /** Removes the height of the tab body wrapper. */
2099
2121
  /**
2100
- * Removes the height of the tab body wrapper.
2101
- * @return {?}
2102
- */
2103
- MatTabGroup.prototype._removeTabBodyWrapperHeight = /**
2104
- * Removes the height of the tab body wrapper.
2105
- * @return {?}
2106
- */
2107
- function () {
2108
- /** @type {?} */
2109
- var wrapper = this._tabBodyWrapper.nativeElement;
2110
- this._tabBodyWrapperHeight = wrapper.clientHeight;
2111
- wrapper.style.height = '';
2112
- this.animationDone.emit();
2113
- };
2114
- /** Handle click events, setting new selected index if appropriate. */
2122
+ * Scrolls the header to a given position.
2123
+ * @param position Position to which to scroll.
2124
+ * @returns Information on the current scroll distance and the maximum.
2125
+ */
2115
2126
  /**
2116
- * Handle click events, setting new selected index if appropriate.
2117
- * @param {?} tab
2118
- * @param {?} tabHeader
2119
- * @param {?} index
2120
- * @return {?}
2127
+ * Scrolls the header to a given position.
2128
+ * @private
2129
+ * @param {?} position Position to which to scroll.
2130
+ * @return {?} Information on the current scroll distance and the maximum.
2121
2131
  */
2122
- MatTabGroup.prototype._handleClick = /**
2123
- * Handle click events, setting new selected index if appropriate.
2124
- * @param {?} tab
2125
- * @param {?} tabHeader
2126
- * @param {?} index
2127
- * @return {?}
2132
+ MatPaginatedTabHeader.prototype._scrollTo = /**
2133
+ * Scrolls the header to a given position.
2134
+ * @private
2135
+ * @param {?} position Position to which to scroll.
2136
+ * @return {?} Information on the current scroll distance and the maximum.
2128
2137
  */
2129
- function (tab, tabHeader, index) {
2130
- if (!tab.disabled) {
2131
- this.selectedIndex = tabHeader.focusIndex = index;
2132
- }
2138
+ function (position) {
2139
+ /** @type {?} */
2140
+ var maxScrollDistance = this._getMaxScrollDistance();
2141
+ this._scrollDistance = Math.max(0, Math.min(maxScrollDistance, position));
2142
+ // Mark that the scroll distance has changed so that after the view is checked, the CSS
2143
+ // transformation can move the header.
2144
+ this._scrollDistanceChanged = true;
2145
+ this._checkScrollingControls();
2146
+ return { maxScrollDistance: maxScrollDistance, distance: this._scrollDistance };
2133
2147
  };
2134
- /** Retrieves the tabindex for the tab. */
2148
+ MatPaginatedTabHeader.decorators = [
2149
+ { type: core.Directive, args: [{
2150
+ // TODO(crisbeto): this selector can be removed when we update to Angular 9.0.
2151
+ selector: 'do-not-use-abstract-mat-paginated-tab-header'
2152
+ },] },
2153
+ ];
2154
+ /** @nocollapse */
2155
+ MatPaginatedTabHeader.ctorParameters = function () { return [
2156
+ { type: core.ElementRef },
2157
+ { type: core.ChangeDetectorRef },
2158
+ { type: scrolling.ViewportRuler },
2159
+ { type: bidi.Directionality, decorators: [{ type: core.Optional }] },
2160
+ { type: core.NgZone },
2161
+ { type: platform.Platform },
2162
+ { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] }
2163
+ ]; };
2164
+ return MatPaginatedTabHeader;
2165
+ }());
2166
+
2167
+ /**
2168
+ * @fileoverview added by tsickle
2169
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2170
+ */
2171
+ /**
2172
+ * Base class with all of the `MatTabHeader` functionality.
2173
+ * \@docs-private
2174
+ * @abstract
2175
+ */
2176
+ var _MatTabHeaderBase = /** @class */ (function (_super) {
2177
+ __extends(_MatTabHeaderBase, _super);
2178
+ function _MatTabHeaderBase(elementRef, changeDetectorRef, viewportRuler, dir, ngZone, platform$$1,
2179
+ // @breaking-change 9.0.0 `_animationMode` parameter to be made required.
2180
+ animationMode) {
2181
+ var _this = _super.call(this, elementRef, changeDetectorRef, viewportRuler, dir, ngZone, platform$$1, animationMode) || this;
2182
+ _this._disableRipple = false;
2183
+ return _this;
2184
+ }
2185
+ Object.defineProperty(_MatTabHeaderBase.prototype, "disableRipple", {
2186
+ /** Whether the ripple effect is disabled or not. */
2187
+ get: /**
2188
+ * Whether the ripple effect is disabled or not.
2189
+ * @return {?}
2190
+ */
2191
+ function () { return this._disableRipple; },
2192
+ set: /**
2193
+ * @param {?} value
2194
+ * @return {?}
2195
+ */
2196
+ function (value) { this._disableRipple = coercion.coerceBooleanProperty(value); },
2197
+ enumerable: true,
2198
+ configurable: true
2199
+ });
2135
2200
  /**
2136
- * Retrieves the tabindex for the tab.
2137
- * @param {?} tab
2138
- * @param {?} idx
2201
+ * @protected
2202
+ * @param {?} event
2139
2203
  * @return {?}
2140
2204
  */
2141
- MatTabGroup.prototype._getTabIndex = /**
2142
- * Retrieves the tabindex for the tab.
2143
- * @param {?} tab
2144
- * @param {?} idx
2205
+ _MatTabHeaderBase.prototype._itemSelected = /**
2206
+ * @protected
2207
+ * @param {?} event
2145
2208
  * @return {?}
2146
2209
  */
2147
- function (tab, idx) {
2148
- if (tab.disabled) {
2149
- return null;
2150
- }
2151
- return this.selectedIndex === idx ? 0 : -1;
2210
+ function (event) {
2211
+ event.preventDefault();
2152
2212
  };
2153
- MatTabGroup.decorators = [
2154
- { type: core.Component, args: [{selector: 'mat-tab-group',
2155
- exportAs: 'matTabGroup',
2156
- template: "<mat-tab-header #tabHeader [selectedIndex]=\"selectedIndex\" [disableRipple]=\"disableRipple\" (indexFocused)=\"_focusChanged($event)\" (selectFocusedIndex)=\"selectedIndex = $event\"><div class=\"mat-tab-label\" role=\"tab\" matTabLabelWrapper mat-ripple cdkMonitorElementFocus *ngFor=\"let tab of _tabs; let i = index\" [id]=\"_getTabLabelId(i)\" [attr.tabIndex]=\"_getTabIndex(tab, i)\" [attr.aria-posinset]=\"i + 1\" [attr.aria-setsize]=\"_tabs.length\" [attr.aria-controls]=\"_getTabContentId(i)\" [attr.aria-selected]=\"selectedIndex == i\" [attr.aria-label]=\"tab.ariaLabel || null\" [attr.aria-labelledby]=\"(!tab.ariaLabel && tab.ariaLabelledby) ? tab.ariaLabelledby : null\" [class.mat-tab-label-active]=\"selectedIndex == i\" [disabled]=\"tab.disabled\" [matRippleDisabled]=\"tab.disabled || disableRipple\" (click)=\"_handleClick(tab, tabHeader, i)\"><div class=\"mat-tab-label-content\"><ng-template [ngIf]=\"tab.templateLabel\"><ng-template [cdkPortalOutlet]=\"tab.templateLabel\"></ng-template></ng-template><ng-template [ngIf]=\"!tab.templateLabel\">{{tab.textLabel}}</ng-template></div></div></mat-tab-header><div class=\"mat-tab-body-wrapper\" [class._mat-animation-noopable]=\"_animationMode === 'NoopAnimations'\" #tabBodyWrapper><mat-tab-body role=\"tabpanel\" *ngFor=\"let tab of _tabs; let i = index\" [id]=\"_getTabContentId(i)\" [attr.aria-labelledby]=\"_getTabLabelId(i)\" [class.mat-tab-body-active]=\"selectedIndex == i\" [content]=\"tab.content\" [position]=\"tab.position\" [origin]=\"tab.origin\" [animationDuration]=\"animationDuration\" (_onCentered)=\"_removeTabBodyWrapperHeight()\" (_onCentering)=\"_setTabBodyWrapperHeight($event)\"></mat-tab-body></div>",
2157
- styles: [".mat-tab-group{display:flex;flex-direction:column}.mat-tab-group.mat-tab-group-inverted-header{flex-direction:column-reverse}.mat-tab-label{height:48px;padding:0 24px;cursor:pointer;box-sizing:border-box;opacity:.6;min-width:160px;text-align:center;display:inline-flex;justify-content:center;align-items:center;white-space:nowrap;position:relative}.mat-tab-label:focus{outline:0}.mat-tab-label:focus:not(.mat-tab-disabled){opacity:1}@media (-ms-high-contrast:active){.mat-tab-label:focus{outline:dotted 2px}}.mat-tab-label.mat-tab-disabled{cursor:default}@media (-ms-high-contrast:active){.mat-tab-label.mat-tab-disabled{opacity:.5}}.mat-tab-label .mat-tab-label-content{display:inline-flex;justify-content:center;align-items:center;white-space:nowrap}@media (-ms-high-contrast:active){.mat-tab-label{opacity:1}}@media (max-width:599px){.mat-tab-label{padding:0 12px}}@media (max-width:959px){.mat-tab-label{padding:0 12px}}.mat-tab-group[mat-stretch-tabs]>.mat-tab-header .mat-tab-label{flex-basis:0;flex-grow:1}.mat-tab-body-wrapper{position:relative;overflow:hidden;display:flex;transition:height .5s cubic-bezier(.35,0,.25,1)}._mat-animation-noopable.mat-tab-body-wrapper{transition:none;animation:none}.mat-tab-body{top:0;left:0;right:0;bottom:0;position:absolute;display:block;overflow:hidden;flex-basis:100%}.mat-tab-body.mat-tab-body-active{position:relative;overflow-x:hidden;overflow-y:auto;z-index:1;flex-grow:1}.mat-tab-group.mat-tab-group-dynamic-height .mat-tab-body.mat-tab-body-active{overflow-y:hidden}"],
2213
+ _MatTabHeaderBase.decorators = [
2214
+ { type: core.Directive, args: [{
2215
+ // TODO(crisbeto): this selector can be removed when we update to Angular 9.0.
2216
+ selector: 'do-not-use-abstract-mat-tab-header-base'
2217
+ },] },
2218
+ ];
2219
+ /** @nocollapse */
2220
+ _MatTabHeaderBase.ctorParameters = function () { return [
2221
+ { type: core.ElementRef },
2222
+ { type: core.ChangeDetectorRef },
2223
+ { type: scrolling.ViewportRuler },
2224
+ { type: bidi.Directionality, decorators: [{ type: core.Optional }] },
2225
+ { type: core.NgZone },
2226
+ { type: platform.Platform },
2227
+ { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] }
2228
+ ]; };
2229
+ _MatTabHeaderBase.propDecorators = {
2230
+ disableRipple: [{ type: core.Input }]
2231
+ };
2232
+ return _MatTabHeaderBase;
2233
+ }(MatPaginatedTabHeader));
2234
+ /**
2235
+ * The header of the tab group which displays a list of all the tabs in the tab group. Includes
2236
+ * an ink bar that follows the currently selected tab. When the tabs list's width exceeds the
2237
+ * width of the header container, then arrows will be displayed to allow the user to scroll
2238
+ * left and right across the header.
2239
+ * \@docs-private
2240
+ */
2241
+ var MatTabHeader = /** @class */ (function (_super) {
2242
+ __extends(MatTabHeader, _super);
2243
+ function MatTabHeader(elementRef, changeDetectorRef, viewportRuler, dir, ngZone, platform$$1,
2244
+ // @breaking-change 9.0.0 `_animationMode` parameter to be made required.
2245
+ animationMode) {
2246
+ return _super.call(this, elementRef, changeDetectorRef, viewportRuler, dir, ngZone, platform$$1, animationMode) || this;
2247
+ }
2248
+ MatTabHeader.decorators = [
2249
+ { type: core.Component, args: [{selector: 'mat-tab-header',
2250
+ template: "<div class=\"mat-tab-header-pagination mat-tab-header-pagination-before mat-elevation-z4\" #previousPaginator aria-hidden=\"true\" mat-ripple [matRippleDisabled]=\"_disableScrollBefore || disableRipple\" [class.mat-tab-header-pagination-disabled]=\"_disableScrollBefore\" (click)=\"_handlePaginatorClick('before')\" (mousedown)=\"_handlePaginatorPress('before')\" (touchend)=\"_stopInterval()\"><div class=\"mat-tab-header-pagination-chevron\"></div></div><div class=\"mat-tab-label-container\" #tabListContainer (keydown)=\"_handleKeydown($event)\"><div #tabList class=\"mat-tab-list\" [class._mat-animation-noopable]=\"_animationMode === 'NoopAnimations'\" role=\"tablist\" (cdkObserveContent)=\"_onContentChanges()\"><div class=\"mat-tab-labels\"><ng-content></ng-content></div><mat-ink-bar></mat-ink-bar></div></div><div class=\"mat-tab-header-pagination mat-tab-header-pagination-after mat-elevation-z4\" #nextPaginator aria-hidden=\"true\" mat-ripple [matRippleDisabled]=\"_disableScrollAfter || disableRipple\" [class.mat-tab-header-pagination-disabled]=\"_disableScrollAfter\" (mousedown)=\"_handlePaginatorPress('after')\" (click)=\"_handlePaginatorClick('after')\" (touchend)=\"_stopInterval()\"><div class=\"mat-tab-header-pagination-chevron\"></div></div>",
2251
+ styles: [".mat-tab-header{display:flex;overflow:hidden;position:relative;flex-shrink:0}.mat-tab-header-pagination{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;position:relative;display:none;justify-content:center;align-items:center;min-width:32px;cursor:pointer;z-index:2;-webkit-tap-highlight-color:transparent;touch-action:none}.mat-tab-header-pagination-controls-enabled .mat-tab-header-pagination{display:flex}.mat-tab-header-pagination-before,.mat-tab-header-rtl .mat-tab-header-pagination-after{padding-left:4px}.mat-tab-header-pagination-before .mat-tab-header-pagination-chevron,.mat-tab-header-rtl .mat-tab-header-pagination-after .mat-tab-header-pagination-chevron{transform:rotate(-135deg)}.mat-tab-header-pagination-after,.mat-tab-header-rtl .mat-tab-header-pagination-before{padding-right:4px}.mat-tab-header-pagination-after .mat-tab-header-pagination-chevron,.mat-tab-header-rtl .mat-tab-header-pagination-before .mat-tab-header-pagination-chevron{transform:rotate(45deg)}.mat-tab-header-pagination-chevron{border-style:solid;border-width:2px 2px 0 0;content:'';height:8px;width:8px}.mat-tab-header-pagination-disabled{box-shadow:none;cursor:default}.mat-tab-list{flex-grow:1;position:relative;transition:transform .5s cubic-bezier(.35,0,.25,1)}.mat-ink-bar{position:absolute;bottom:0;height:2px;transition:.5s cubic-bezier(.35,0,.25,1)}._mat-animation-noopable.mat-ink-bar{transition:none;animation:none}.mat-tab-group-inverted-header .mat-ink-bar{bottom:auto;top:0}@media (-ms-high-contrast:active){.mat-ink-bar{outline:solid 2px;height:0}}.mat-tab-labels{display:flex}[mat-align-tabs=center] .mat-tab-labels{justify-content:center}[mat-align-tabs=end] .mat-tab-labels{justify-content:flex-end}.mat-tab-label-container{display:flex;flex-grow:1;overflow:hidden;z-index:1}._mat-animation-noopable.mat-tab-list{transition:none;animation:none}.mat-tab-label{height:48px;padding:0 24px;cursor:pointer;box-sizing:border-box;opacity:.6;min-width:160px;text-align:center;display:inline-flex;justify-content:center;align-items:center;white-space:nowrap;position:relative}.mat-tab-label:focus{outline:0}.mat-tab-label:focus:not(.mat-tab-disabled){opacity:1}@media (-ms-high-contrast:active){.mat-tab-label:focus{outline:dotted 2px}}.mat-tab-label.mat-tab-disabled{cursor:default}@media (-ms-high-contrast:active){.mat-tab-label.mat-tab-disabled{opacity:.5}}.mat-tab-label .mat-tab-label-content{display:inline-flex;justify-content:center;align-items:center;white-space:nowrap}@media (-ms-high-contrast:active){.mat-tab-label{opacity:1}}@media (max-width:599px){.mat-tab-label{min-width:72px}}"],
2252
+ inputs: ['selectedIndex'],
2253
+ outputs: ['selectFocusedIndex', 'indexFocused'],
2158
2254
  encapsulation: core.ViewEncapsulation.None,
2159
2255
  changeDetection: core.ChangeDetectionStrategy.OnPush,
2160
- inputs: ['color', 'disableRipple'],
2161
2256
  host: {
2162
- 'class': 'mat-tab-group',
2163
- '[class.mat-tab-group-dynamic-height]': 'dynamicHeight',
2164
- '[class.mat-tab-group-inverted-header]': 'headerPosition === "below"',
2257
+ 'class': 'mat-tab-header',
2258
+ '[class.mat-tab-header-pagination-controls-enabled]': '_showPaginationControls',
2259
+ '[class.mat-tab-header-rtl]': "_getLayoutDirection() == 'rtl'",
2165
2260
  },
2166
2261
  },] },
2167
2262
  ];
2168
2263
  /** @nocollapse */
2169
- MatTabGroup.ctorParameters = function () { return [
2264
+ MatTabHeader.ctorParameters = function () { return [
2170
2265
  { type: core.ElementRef },
2171
2266
  { type: core.ChangeDetectorRef },
2172
- { type: undefined, decorators: [{ type: core.Inject, args: [MAT_TABS_CONFIG,] }, { type: core.Optional }] },
2267
+ { type: scrolling.ViewportRuler },
2268
+ { type: bidi.Directionality, decorators: [{ type: core.Optional }] },
2269
+ { type: core.NgZone },
2270
+ { type: platform.Platform },
2173
2271
  { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] }
2174
2272
  ]; };
2175
- MatTabGroup.propDecorators = {
2176
- _tabs: [{ type: core.ContentChildren, args: [MatTab,] }],
2177
- _tabBodyWrapper: [{ type: core.ViewChild, args: ['tabBodyWrapper', { static: false },] }],
2178
- _tabHeader: [{ type: core.ViewChild, args: ['tabHeader', { static: false },] }],
2179
- dynamicHeight: [{ type: core.Input }],
2180
- selectedIndex: [{ type: core.Input }],
2181
- headerPosition: [{ type: core.Input }],
2182
- animationDuration: [{ type: core.Input }],
2183
- backgroundColor: [{ type: core.Input }],
2184
- selectedIndexChange: [{ type: core.Output }],
2185
- focusChange: [{ type: core.Output }],
2186
- animationDone: [{ type: core.Output }],
2187
- selectedTabChange: [{ type: core.Output }]
2273
+ MatTabHeader.propDecorators = {
2274
+ _items: [{ type: core.ContentChildren, args: [MatTabLabelWrapper,] }],
2275
+ _inkBar: [{ type: core.ViewChild, args: [MatInkBar, { static: true },] }],
2276
+ _tabListContainer: [{ type: core.ViewChild, args: ['tabListContainer', { static: true },] }],
2277
+ _tabList: [{ type: core.ViewChild, args: ['tabList', { static: true },] }],
2278
+ _nextPaginator: [{ type: core.ViewChild, args: ['nextPaginator', { static: false },] }],
2279
+ _previousPaginator: [{ type: core.ViewChild, args: ['previousPaginator', { static: false },] }]
2188
2280
  };
2189
- return MatTabGroup;
2190
- }(_MatTabGroupMixinBase));
2281
+ return MatTabHeader;
2282
+ }(_MatTabHeaderBase));
2191
2283
 
2192
2284
  /**
2193
2285
  * @fileoverview added by tsickle
2194
2286
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2195
2287
  */
2196
2288
  /**
2197
- * Navigation component matching the styles of the tab group header.
2198
- * Provides anchored navigation with animated ink bar.
2289
+ * Base class with all of the `MatTabNav` functionality.
2290
+ * \@docs-private
2291
+ * @abstract
2199
2292
  */
2200
- var MatTabNav = /** @class */ (function (_super) {
2201
- __extends(MatTabNav, _super);
2202
- function MatTabNav(elementRef, dir, ngZone, changeDetectorRef, viewportRuler,
2293
+ var _MatTabNavBase = /** @class */ (function (_super) {
2294
+ __extends(_MatTabNavBase, _super);
2295
+ function _MatTabNavBase(elementRef, dir, ngZone, changeDetectorRef, viewportRuler,
2203
2296
  /**
2204
2297
  * @deprecated @breaking-change 9.0.0 `platform` parameter to become required.
2205
2298
  */
@@ -2212,7 +2305,7 @@ var MatTabNav = /** @class */ (function (_super) {
2212
2305
  _this.color = 'primary';
2213
2306
  return _this;
2214
2307
  }
2215
- Object.defineProperty(MatTabNav.prototype, "backgroundColor", {
2308
+ Object.defineProperty(_MatTabNavBase.prototype, "backgroundColor", {
2216
2309
  /** Background color of the tab nav. */
2217
2310
  get: /**
2218
2311
  * Background color of the tab nav.
@@ -2235,7 +2328,7 @@ var MatTabNav = /** @class */ (function (_super) {
2235
2328
  enumerable: true,
2236
2329
  configurable: true
2237
2330
  });
2238
- Object.defineProperty(MatTabNav.prototype, "disableRipple", {
2331
+ Object.defineProperty(_MatTabNavBase.prototype, "disableRipple", {
2239
2332
  /** Whether the ripple effect is disabled or not. */
2240
2333
  get: /**
2241
2334
  * Whether the ripple effect is disabled or not.
@@ -2254,7 +2347,7 @@ var MatTabNav = /** @class */ (function (_super) {
2254
2347
  * @protected
2255
2348
  * @return {?}
2256
2349
  */
2257
- MatTabNav.prototype._itemSelected = /**
2350
+ _MatTabNavBase.prototype._itemSelected = /**
2258
2351
  * @protected
2259
2352
  * @return {?}
2260
2353
  */
@@ -2264,11 +2357,19 @@ var MatTabNav = /** @class */ (function (_super) {
2264
2357
  /**
2265
2358
  * @return {?}
2266
2359
  */
2267
- MatTabNav.prototype.ngAfterContentInit = /**
2360
+ _MatTabNavBase.prototype.ngAfterContentInit = /**
2268
2361
  * @return {?}
2269
2362
  */
2270
2363
  function () {
2271
- this.updateActiveLink();
2364
+ var _this = this;
2365
+ // We need this to run before the `changes` subscription in parent to ensure that the
2366
+ // selectedIndex is up-to-date by the time the super class starts looking for it.
2367
+ this._items.changes.pipe(operators.startWith(null), operators.takeUntil(this._destroyed)).subscribe((/**
2368
+ * @return {?}
2369
+ */
2370
+ function () {
2371
+ _this.updateActiveLink();
2372
+ }));
2272
2373
  _super.prototype.ngAfterContentInit.call(this);
2273
2374
  };
2274
2375
  /**
@@ -2281,7 +2382,7 @@ var MatTabNav = /** @class */ (function (_super) {
2281
2382
  * @param {?=} _element
2282
2383
  * @return {?}
2283
2384
  */
2284
- MatTabNav.prototype.updateActiveLink = /**
2385
+ _MatTabNavBase.prototype.updateActiveLink = /**
2285
2386
  * Notifies the component that the active link has been changed.
2286
2387
  * \@breaking-change 8.0.0 `element` parameter to be removed.
2287
2388
  * @param {?=} _element
@@ -2304,6 +2405,42 @@ var MatTabNav = /** @class */ (function (_super) {
2304
2405
  this.selectedIndex = -1;
2305
2406
  this._inkBar.hide();
2306
2407
  };
2408
+ _MatTabNavBase.decorators = [
2409
+ { type: core.Directive, args: [{
2410
+ // TODO(crisbeto): this selector can be removed when we update to Angular 9.0.
2411
+ selector: 'do-not-use-abstract-mat-tab-nav-base'
2412
+ },] },
2413
+ ];
2414
+ /** @nocollapse */
2415
+ _MatTabNavBase.ctorParameters = function () { return [
2416
+ { type: core.ElementRef },
2417
+ { type: bidi.Directionality, decorators: [{ type: core.Optional }] },
2418
+ { type: core.NgZone },
2419
+ { type: core.ChangeDetectorRef },
2420
+ { type: scrolling.ViewportRuler },
2421
+ { type: platform.Platform, decorators: [{ type: core.Optional }] },
2422
+ { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] }
2423
+ ]; };
2424
+ _MatTabNavBase.propDecorators = {
2425
+ backgroundColor: [{ type: core.Input }],
2426
+ disableRipple: [{ type: core.Input }],
2427
+ color: [{ type: core.Input }]
2428
+ };
2429
+ return _MatTabNavBase;
2430
+ }(MatPaginatedTabHeader));
2431
+ /**
2432
+ * Navigation component matching the styles of the tab group header.
2433
+ * Provides anchored navigation with animated ink bar.
2434
+ */
2435
+ var MatTabNav = /** @class */ (function (_super) {
2436
+ __extends(MatTabNav, _super);
2437
+ function MatTabNav(elementRef, dir, ngZone, changeDetectorRef, viewportRuler,
2438
+ /**
2439
+ * @deprecated @breaking-change 9.0.0 `platform` parameter to become required.
2440
+ */
2441
+ platform$$1, animationMode) {
2442
+ return _super.call(this, elementRef, dir, ngZone, changeDetectorRef, viewportRuler, platform$$1, animationMode) || this;
2443
+ }
2307
2444
  MatTabNav.decorators = [
2308
2445
  { type: core.Component, args: [{selector: '[mat-tab-nav-bar]',
2309
2446
  exportAs: 'matTabNavBar, matTabNav',
@@ -2341,29 +2478,26 @@ var MatTabNav = /** @class */ (function (_super) {
2341
2478
  _tabListContainer: [{ type: core.ViewChild, args: ['tabListContainer', { static: true },] }],
2342
2479
  _tabList: [{ type: core.ViewChild, args: ['tabList', { static: true },] }],
2343
2480
  _nextPaginator: [{ type: core.ViewChild, args: ['nextPaginator', { static: false },] }],
2344
- _previousPaginator: [{ type: core.ViewChild, args: ['previousPaginator', { static: false },] }],
2345
- backgroundColor: [{ type: core.Input }],
2346
- disableRipple: [{ type: core.Input }],
2347
- color: [{ type: core.Input }]
2481
+ _previousPaginator: [{ type: core.ViewChild, args: ['previousPaginator', { static: false },] }]
2348
2482
  };
2349
2483
  return MatTabNav;
2350
- }(MatPaginatedTabHeader));
2484
+ }(_MatTabNavBase));
2351
2485
  // Boilerplate for applying mixins to MatTabLink.
2352
2486
  var
2353
2487
  // Boilerplate for applying mixins to MatTabLink.
2354
- MatTabLinkBase = /** @class */ (function () {
2355
- function MatTabLinkBase() {
2488
+ MatTabLinkMixinBase = /** @class */ (function () {
2489
+ function MatTabLinkMixinBase() {
2356
2490
  }
2357
- return MatTabLinkBase;
2491
+ return MatTabLinkMixinBase;
2358
2492
  }());
2359
2493
  /** @type {?} */
2360
- var _MatTabLinkMixinBase = core$1.mixinTabIndex(core$1.mixinDisableRipple(core$1.mixinDisabled(MatTabLinkBase)));
2494
+ var _MatTabLinkMixinBase = core$1.mixinTabIndex(core$1.mixinDisableRipple(core$1.mixinDisabled(MatTabLinkMixinBase)));
2361
2495
  /**
2362
- * Link inside of a `mat-tab-nav-bar`.
2496
+ * Base class with all of the `MatTabLink` functionality.
2363
2497
  */
2364
- var MatTabLink = /** @class */ (function (_super) {
2365
- __extends(MatTabLink, _super);
2366
- function MatTabLink(_tabNavBar, elementRef, ngZone, platform$$1, globalRippleOptions, tabIndex, _focusMonitor, animationMode) {
2498
+ var _MatTabLinkBase = /** @class */ (function (_super) {
2499
+ __extends(_MatTabLinkBase, _super);
2500
+ function _MatTabLinkBase(_tabNavBar, elementRef, globalRippleOptions, tabIndex, _focusMonitor, animationMode) {
2367
2501
  var _this = _super.call(this) || this;
2368
2502
  _this._tabNavBar = _tabNavBar;
2369
2503
  _this.elementRef = elementRef;
@@ -2372,8 +2506,6 @@ var MatTabLink = /** @class */ (function (_super) {
2372
2506
  * Whether the tab link is active or not.
2373
2507
  */
2374
2508
  _this._isActive = false;
2375
- _this._tabLinkRipple = new core$1.RippleRenderer(_this, ngZone, elementRef, platform$$1);
2376
- _this._tabLinkRipple.setupTriggerEvents(elementRef.nativeElement);
2377
2509
  _this.rippleConfig = globalRippleOptions || {};
2378
2510
  _this.tabIndex = parseInt(tabIndex) || 0;
2379
2511
  if (animationMode === 'NoopAnimations') {
@@ -2382,7 +2514,7 @@ var MatTabLink = /** @class */ (function (_super) {
2382
2514
  _focusMonitor.monitor(elementRef);
2383
2515
  return _this;
2384
2516
  }
2385
- Object.defineProperty(MatTabLink.prototype, "active", {
2517
+ Object.defineProperty(_MatTabLinkBase.prototype, "active", {
2386
2518
  /** Whether the link is active. */
2387
2519
  get: /**
2388
2520
  * Whether the link is active.
@@ -2402,7 +2534,7 @@ var MatTabLink = /** @class */ (function (_super) {
2402
2534
  enumerable: true,
2403
2535
  configurable: true
2404
2536
  });
2405
- Object.defineProperty(MatTabLink.prototype, "rippleDisabled", {
2537
+ Object.defineProperty(_MatTabLinkBase.prototype, "rippleDisabled", {
2406
2538
  /**
2407
2539
  * Whether ripples are disabled on interaction.
2408
2540
  * @docs-private
@@ -2422,12 +2554,52 @@ var MatTabLink = /** @class */ (function (_super) {
2422
2554
  /**
2423
2555
  * @return {?}
2424
2556
  */
2425
- MatTabLink.prototype.focus = /**
2557
+ _MatTabLinkBase.prototype.focus = /**
2426
2558
  * @return {?}
2427
2559
  */
2428
2560
  function () {
2429
2561
  this.elementRef.nativeElement.focus();
2430
2562
  };
2563
+ /**
2564
+ * @return {?}
2565
+ */
2566
+ _MatTabLinkBase.prototype.ngOnDestroy = /**
2567
+ * @return {?}
2568
+ */
2569
+ function () {
2570
+ this._focusMonitor.stopMonitoring(this.elementRef);
2571
+ };
2572
+ _MatTabLinkBase.decorators = [
2573
+ { type: core.Directive, args: [{
2574
+ // TODO(crisbeto): this selector can be removed when we update to Angular 9.0.
2575
+ selector: 'do-not-use-abstract-mat-tab-link-base'
2576
+ },] },
2577
+ ];
2578
+ /** @nocollapse */
2579
+ _MatTabLinkBase.ctorParameters = function () { return [
2580
+ { type: _MatTabNavBase },
2581
+ { type: core.ElementRef },
2582
+ { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [core$1.MAT_RIPPLE_GLOBAL_OPTIONS,] }] },
2583
+ { type: String, decorators: [{ type: core.Attribute, args: ['tabindex',] }] },
2584
+ { type: a11y.FocusMonitor },
2585
+ { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] }
2586
+ ]; };
2587
+ _MatTabLinkBase.propDecorators = {
2588
+ active: [{ type: core.Input }]
2589
+ };
2590
+ return _MatTabLinkBase;
2591
+ }(_MatTabLinkMixinBase));
2592
+ /**
2593
+ * Link inside of a `mat-tab-nav-bar`.
2594
+ */
2595
+ var MatTabLink = /** @class */ (function (_super) {
2596
+ __extends(MatTabLink, _super);
2597
+ function MatTabLink(tabNavBar, elementRef, ngZone, platform$$1, globalRippleOptions, tabIndex, focusMonitor, animationMode) {
2598
+ var _this = _super.call(this, tabNavBar, elementRef, globalRippleOptions, tabIndex, focusMonitor, animationMode) || this;
2599
+ _this._tabLinkRipple = new core$1.RippleRenderer(_this, ngZone, elementRef, platform$$1);
2600
+ _this._tabLinkRipple.setupTriggerEvents(elementRef.nativeElement);
2601
+ return _this;
2602
+ }
2431
2603
  /**
2432
2604
  * @return {?}
2433
2605
  */
@@ -2435,8 +2607,8 @@ var MatTabLink = /** @class */ (function (_super) {
2435
2607
  * @return {?}
2436
2608
  */
2437
2609
  function () {
2610
+ _super.prototype.ngOnDestroy.call(this);
2438
2611
  this._tabLinkRipple._removeTriggerEvents();
2439
- this._focusMonitor.stopMonitoring(this.elementRef);
2440
2612
  };
2441
2613
  MatTabLink.decorators = [
2442
2614
  { type: core.Directive, args: [{
@@ -2464,11 +2636,8 @@ var MatTabLink = /** @class */ (function (_super) {
2464
2636
  { type: a11y.FocusMonitor },
2465
2637
  { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] }
2466
2638
  ]; };
2467
- MatTabLink.propDecorators = {
2468
- active: [{ type: core.Input }]
2469
- };
2470
2639
  return MatTabLink;
2471
- }(_MatTabLinkMixinBase));
2640
+ }(_MatTabLinkBase));
2472
2641
 
2473
2642
  /**
2474
2643
  * @fileoverview added by tsickle
@@ -2509,30 +2678,43 @@ var MatTabsModule = /** @class */ (function () {
2509
2678
  MatTabBodyPortal,
2510
2679
  MatTabHeader,
2511
2680
  MatTabContent,
2681
+ (/** @type {?} */ (
2682
+ // TODO(crisbeto): these can be removed once they're turned into selector-less directives.
2683
+ MatPaginatedTabHeader)),
2684
+ (/** @type {?} */ (_MatTabGroupBase)),
2685
+ (/** @type {?} */ (_MatTabNavBase)),
2686
+ (/** @type {?} */ (_MatTabBodyBase)),
2687
+ (/** @type {?} */ (_MatTabHeaderBase)),
2688
+ (/** @type {?} */ (_MatTabLinkBase)),
2512
2689
  ],
2513
2690
  },] },
2514
2691
  ];
2515
2692
  return MatTabsModule;
2516
2693
  }());
2517
2694
 
2695
+ exports.MatTabsModule = MatTabsModule;
2518
2696
  exports.MatInkBar = MatInkBar;
2519
2697
  exports._MAT_INK_BAR_POSITIONER = _MAT_INK_BAR_POSITIONER;
2520
2698
  exports.MatTabBody = MatTabBody;
2699
+ exports._MatTabBodyBase = _MatTabBodyBase;
2521
2700
  exports.MatTabBodyPortal = MatTabBodyPortal;
2522
2701
  exports.MatTabHeader = MatTabHeader;
2702
+ exports._MatTabHeaderBase = _MatTabHeaderBase;
2523
2703
  exports.MatTabLabelWrapper = MatTabLabelWrapper;
2524
2704
  exports.MatTab = MatTab;
2525
2705
  exports.MatTabLabel = MatTabLabel;
2526
2706
  exports.MatTabNav = MatTabNav;
2527
2707
  exports.MatTabLink = MatTabLink;
2708
+ exports._MatTabNavBase = _MatTabNavBase;
2709
+ exports._MatTabLinkBase = _MatTabLinkBase;
2528
2710
  exports.MatTabContent = MatTabContent;
2529
- exports.MatTabsModule = MatTabsModule;
2530
2711
  exports.MatTabChangeEvent = MatTabChangeEvent;
2531
2712
  exports.MAT_TABS_CONFIG = MAT_TABS_CONFIG;
2713
+ exports._MatTabGroupBase = _MatTabGroupBase;
2532
2714
  exports.MatTabGroup = MatTabGroup;
2533
2715
  exports.matTabsAnimations = matTabsAnimations;
2534
- exports.ɵa23 = _MAT_INK_BAR_POSITIONER_FACTORY;
2535
- exports.ɵb23 = MatPaginatedTabHeader;
2716
+ exports.ɵa24 = _MAT_INK_BAR_POSITIONER_FACTORY;
2717
+ exports.ɵb24 = MatPaginatedTabHeader;
2536
2718
 
2537
2719
  Object.defineProperty(exports, '__esModule', { value: true });
2538
2720