@angular/material 10.0.0-rc.3 → 10.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (627) hide show
  1. package/_theming.scss +17 -17
  2. package/autocomplete/index.metadata.json +1 -1
  3. package/autocomplete/testing/autocomplete-harness.d.ts +2 -0
  4. package/bundles/material-autocomplete-testing.umd.js +11 -0
  5. package/bundles/material-autocomplete-testing.umd.js.map +1 -1
  6. package/bundles/material-autocomplete-testing.umd.min.js +2 -2
  7. package/bundles/material-autocomplete-testing.umd.min.js.map +1 -1
  8. package/bundles/material-autocomplete.umd.js +3 -1
  9. package/bundles/material-autocomplete.umd.js.map +1 -1
  10. package/bundles/material-autocomplete.umd.min.js +5 -5
  11. package/bundles/material-autocomplete.umd.min.js.map +1 -1
  12. package/bundles/material-badge-testing.umd.min.js +1 -1
  13. package/bundles/material-badge-testing.umd.min.js.map +1 -1
  14. package/bundles/material-bottom-sheet-testing.umd.min.js +1 -1
  15. package/bundles/material-bottom-sheet-testing.umd.min.js.map +1 -1
  16. package/bundles/material-button-testing.umd.js +11 -0
  17. package/bundles/material-button-testing.umd.js.map +1 -1
  18. package/bundles/material-button-testing.umd.min.js +2 -2
  19. package/bundles/material-button-testing.umd.min.js.map +1 -1
  20. package/bundles/material-button-toggle-testing.umd.js +11 -0
  21. package/bundles/material-button-toggle-testing.umd.js.map +1 -1
  22. package/bundles/material-button-toggle-testing.umd.min.js +3 -3
  23. package/bundles/material-button-toggle-testing.umd.min.js.map +1 -1
  24. package/bundles/material-button-toggle.umd.js +12 -3
  25. package/bundles/material-button-toggle.umd.js.map +1 -1
  26. package/bundles/material-button-toggle.umd.min.js +2 -2
  27. package/bundles/material-button-toggle.umd.min.js.map +1 -1
  28. package/bundles/material-button.umd.js +7 -2
  29. package/bundles/material-button.umd.js.map +1 -1
  30. package/bundles/material-button.umd.min.js +4 -4
  31. package/bundles/material-button.umd.min.js.map +1 -1
  32. package/bundles/material-card-testing.umd.js +335 -0
  33. package/bundles/material-card-testing.umd.js.map +1 -0
  34. package/bundles/material-card-testing.umd.min.js +44 -0
  35. package/bundles/material-card-testing.umd.min.js.map +1 -0
  36. package/bundles/material-checkbox-testing.umd.js +11 -0
  37. package/bundles/material-checkbox-testing.umd.js.map +1 -1
  38. package/bundles/material-checkbox-testing.umd.min.js +3 -3
  39. package/bundles/material-checkbox-testing.umd.min.js.map +1 -1
  40. package/bundles/material-checkbox.umd.js.map +1 -1
  41. package/bundles/material-chips.umd.js +36 -12
  42. package/bundles/material-chips.umd.js.map +1 -1
  43. package/bundles/material-chips.umd.min.js +4 -4
  44. package/bundles/material-chips.umd.min.js.map +1 -1
  45. package/bundles/material-core-testing.umd.min.js +1 -1
  46. package/bundles/material-core-testing.umd.min.js.map +1 -1
  47. package/bundles/material-core.umd.js +11 -3
  48. package/bundles/material-core.umd.js.map +1 -1
  49. package/bundles/material-core.umd.min.js +11 -11
  50. package/bundles/material-core.umd.min.js.map +1 -1
  51. package/bundles/material-datepicker.umd.js +20 -11
  52. package/bundles/material-datepicker.umd.js.map +1 -1
  53. package/bundles/material-datepicker.umd.min.js +5 -5
  54. package/bundles/material-datepicker.umd.min.js.map +1 -1
  55. package/bundles/material-dialog-testing.umd.min.js +1 -1
  56. package/bundles/material-dialog-testing.umd.min.js.map +1 -1
  57. package/bundles/material-dialog.umd.js +45 -8
  58. package/bundles/material-dialog.umd.js.map +1 -1
  59. package/bundles/material-dialog.umd.min.js +14 -7
  60. package/bundles/material-dialog.umd.min.js.map +1 -1
  61. package/bundles/material-divider-testing.umd.min.js +1 -1
  62. package/bundles/material-divider-testing.umd.min.js.map +1 -1
  63. package/bundles/material-expansion-testing.umd.js +11 -0
  64. package/bundles/material-expansion-testing.umd.js.map +1 -1
  65. package/bundles/material-expansion-testing.umd.min.js +3 -3
  66. package/bundles/material-expansion-testing.umd.min.js.map +1 -1
  67. package/bundles/material-form-field-testing.umd.js +32 -0
  68. package/bundles/material-form-field-testing.umd.js.map +1 -1
  69. package/bundles/material-form-field-testing.umd.min.js +4 -4
  70. package/bundles/material-form-field-testing.umd.min.js.map +1 -1
  71. package/bundles/material-form-field.umd.js +47 -21
  72. package/bundles/material-form-field.umd.js.map +1 -1
  73. package/bundles/material-form-field.umd.min.js +5 -5
  74. package/bundles/material-form-field.umd.min.js.map +1 -1
  75. package/bundles/material-grid-list-testing.umd.min.js +1 -1
  76. package/bundles/material-grid-list-testing.umd.min.js.map +1 -1
  77. package/bundles/material-grid-list.umd.js +2 -2
  78. package/bundles/material-grid-list.umd.js.map +1 -1
  79. package/bundles/material-grid-list.umd.min.js +2 -2
  80. package/bundles/material-grid-list.umd.min.js.map +1 -1
  81. package/bundles/material-input-testing.umd.js +23 -6
  82. package/bundles/material-input-testing.umd.js.map +1 -1
  83. package/bundles/material-input-testing.umd.min.js +3 -3
  84. package/bundles/material-input-testing.umd.min.js.map +1 -1
  85. package/bundles/material-input.umd.js +28 -3
  86. package/bundles/material-input.umd.js.map +1 -1
  87. package/bundles/material-input.umd.min.js +3 -3
  88. package/bundles/material-input.umd.min.js.map +1 -1
  89. package/bundles/material-list-testing.umd.js +33 -0
  90. package/bundles/material-list-testing.umd.js.map +1 -1
  91. package/bundles/material-list-testing.umd.min.js +2 -2
  92. package/bundles/material-list-testing.umd.min.js.map +1 -1
  93. package/bundles/material-list.umd.js +3 -3
  94. package/bundles/material-list.umd.min.js +1 -1
  95. package/bundles/material-list.umd.min.js.map +1 -1
  96. package/bundles/material-menu-testing.umd.js +22 -0
  97. package/bundles/material-menu-testing.umd.js.map +1 -1
  98. package/bundles/material-menu-testing.umd.min.js +2 -2
  99. package/bundles/material-menu-testing.umd.min.js.map +1 -1
  100. package/bundles/material-menu.umd.js +13 -2
  101. package/bundles/material-menu.umd.js.map +1 -1
  102. package/bundles/material-menu.umd.min.js +4 -4
  103. package/bundles/material-menu.umd.min.js.map +1 -1
  104. package/bundles/material-paginator-testing.umd.min.js +1 -1
  105. package/bundles/material-paginator-testing.umd.min.js.map +1 -1
  106. package/bundles/material-progress-bar-testing.umd.min.js +1 -1
  107. package/bundles/material-progress-bar-testing.umd.min.js.map +1 -1
  108. package/bundles/material-progress-spinner-testing.umd.js +1 -1
  109. package/bundles/material-progress-spinner-testing.umd.js.map +1 -1
  110. package/bundles/material-progress-spinner-testing.umd.min.js +2 -2
  111. package/bundles/material-progress-spinner-testing.umd.min.js.map +1 -1
  112. package/bundles/material-progress-spinner.umd.js +2 -2
  113. package/bundles/material-progress-spinner.umd.min.js +3 -3
  114. package/bundles/material-progress-spinner.umd.min.js.map +1 -1
  115. package/bundles/material-radio-testing.umd.js +11 -0
  116. package/bundles/material-radio-testing.umd.js.map +1 -1
  117. package/bundles/material-radio-testing.umd.min.js +3 -3
  118. package/bundles/material-radio-testing.umd.min.js.map +1 -1
  119. package/bundles/material-radio.umd.js +15 -5
  120. package/bundles/material-radio.umd.js.map +1 -1
  121. package/bundles/material-radio.umd.min.js +2 -2
  122. package/bundles/material-radio.umd.min.js.map +1 -1
  123. package/bundles/material-select-testing.umd.js +11 -0
  124. package/bundles/material-select-testing.umd.js.map +1 -1
  125. package/bundles/material-select-testing.umd.min.js +2 -2
  126. package/bundles/material-select-testing.umd.min.js.map +1 -1
  127. package/bundles/material-select.umd.js +11 -3
  128. package/bundles/material-select.umd.js.map +1 -1
  129. package/bundles/material-select.umd.min.js +4 -4
  130. package/bundles/material-select.umd.min.js.map +1 -1
  131. package/bundles/material-sidenav-testing.umd.min.js +1 -1
  132. package/bundles/material-sidenav-testing.umd.min.js.map +1 -1
  133. package/bundles/material-sidenav.umd.js +41 -17
  134. package/bundles/material-sidenav.umd.js.map +1 -1
  135. package/bundles/material-sidenav.umd.min.js +2 -2
  136. package/bundles/material-sidenav.umd.min.js.map +1 -1
  137. package/bundles/material-slide-toggle-testing.umd.js +11 -0
  138. package/bundles/material-slide-toggle-testing.umd.js.map +1 -1
  139. package/bundles/material-slide-toggle-testing.umd.min.js +2 -2
  140. package/bundles/material-slide-toggle-testing.umd.min.js.map +1 -1
  141. package/bundles/material-slide-toggle.umd.js.map +1 -1
  142. package/bundles/material-slider-testing.umd.js +11 -0
  143. package/bundles/material-slider-testing.umd.js.map +1 -1
  144. package/bundles/material-slider-testing.umd.min.js +2 -2
  145. package/bundles/material-slider-testing.umd.min.js.map +1 -1
  146. package/bundles/material-snack-bar-testing.umd.min.js +1 -1
  147. package/bundles/material-snack-bar-testing.umd.min.js.map +1 -1
  148. package/bundles/material-snack-bar.umd.js +47 -39
  149. package/bundles/material-snack-bar.umd.js.map +1 -1
  150. package/bundles/material-snack-bar.umd.min.js +2 -2
  151. package/bundles/material-snack-bar.umd.min.js.map +1 -1
  152. package/bundles/material-sort-testing.umd.js +10 -10
  153. package/bundles/material-sort-testing.umd.js.map +1 -1
  154. package/bundles/material-sort-testing.umd.min.js +3 -3
  155. package/bundles/material-sort-testing.umd.min.js.map +1 -1
  156. package/bundles/material-sort.umd.js +25 -12
  157. package/bundles/material-sort.umd.js.map +1 -1
  158. package/bundles/material-sort.umd.min.js +5 -5
  159. package/bundles/material-sort.umd.min.js.map +1 -1
  160. package/bundles/material-table-testing.umd.min.js +1 -1
  161. package/bundles/material-table-testing.umd.min.js.map +1 -1
  162. package/bundles/material-table.umd.min.js +2 -2
  163. package/bundles/material-table.umd.min.js.map +1 -1
  164. package/bundles/material-tabs-testing.umd.min.js +1 -1
  165. package/bundles/material-tabs-testing.umd.min.js.map +1 -1
  166. package/bundles/material-tabs.umd.js +23 -4
  167. package/bundles/material-tabs.umd.js.map +1 -1
  168. package/bundles/material-tabs.umd.min.js +5 -12
  169. package/bundles/material-tabs.umd.min.js.map +1 -1
  170. package/bundles/material-toolbar-testing.umd.js +330 -0
  171. package/bundles/material-toolbar-testing.umd.js.map +1 -0
  172. package/bundles/material-toolbar-testing.umd.min.js +44 -0
  173. package/bundles/material-toolbar-testing.umd.min.js.map +1 -0
  174. package/bundles/material-tooltip-testing.umd.min.js +1 -1
  175. package/bundles/material-tooltip-testing.umd.min.js.map +1 -1
  176. package/bundles/material-tooltip.umd.js +14 -1
  177. package/bundles/material-tooltip.umd.js.map +1 -1
  178. package/bundles/material-tooltip.umd.min.js +3 -3
  179. package/bundles/material-tooltip.umd.min.js.map +1 -1
  180. package/bundles/material-tree.umd.js.map +1 -1
  181. package/button/_button-base.scss +1 -1
  182. package/button/_button-theme.scss +8 -8
  183. package/button/index.metadata.json +1 -1
  184. package/button/testing/button-harness.d.ts +2 -0
  185. package/button-toggle/button-toggle.d.ts +10 -3
  186. package/button-toggle/index.metadata.json +1 -1
  187. package/button-toggle/testing/button-toggle-harness.d.ts +2 -0
  188. package/card/testing/card-harness-filters.d.ts +17 -0
  189. package/card/testing/card-harness.d.ts +36 -0
  190. package/card/testing/index.d.ts +8 -0
  191. package/card/testing/package.json +9 -0
  192. package/card/testing/public-api.d.ts +9 -0
  193. package/checkbox/index.metadata.json +1 -1
  194. package/checkbox/testing/checkbox-harness.d.ts +2 -0
  195. package/chips/chip.d.ts +19 -1
  196. package/chips/index.metadata.json +1 -1
  197. package/core/focus-indicators/_focus-indicators.scss +6 -6
  198. package/core/index.metadata.json +1 -1
  199. package/core/option/optgroup.d.ts +7 -0
  200. package/core/ripple/ripple-ref.d.ts +21 -2
  201. package/core/ripple/ripple-renderer.d.ts +1 -19
  202. package/core/ripple/ripple.d.ts +2 -2
  203. package/core/style/_list-common.scss +1 -1
  204. package/datepicker/date-range-input-parts.d.ts +2 -4
  205. package/datepicker/date-range-input.d.ts +4 -4
  206. package/datepicker/date-range-picker.d.ts +10 -3
  207. package/datepicker/datepicker.d.ts +2 -3
  208. package/datepicker/index.metadata.json +1 -1
  209. package/datepicker/public-api.d.ts +1 -1
  210. package/dialog/dialog-container.d.ts +9 -2
  211. package/dialog/dialog-content-directives.d.ts +1 -0
  212. package/dialog/dialog-ref.d.ts +7 -0
  213. package/dialog/index.metadata.json +1 -1
  214. package/esm2015/autocomplete/autocomplete-module.js +18 -22
  215. package/esm2015/autocomplete/autocomplete-origin.js +16 -20
  216. package/esm2015/autocomplete/autocomplete-trigger.js +519 -521
  217. package/esm2015/autocomplete/autocomplete.js +126 -130
  218. package/esm2015/autocomplete/testing/autocomplete-harness.js +99 -97
  219. package/esm2015/badge/badge-module.js +13 -17
  220. package/esm2015/badge/badge.js +184 -188
  221. package/esm2015/badge/testing/badge-harness.js +74 -78
  222. package/esm2015/bottom-sheet/bottom-sheet-container.js +161 -165
  223. package/esm2015/bottom-sheet/bottom-sheet-module.js +15 -19
  224. package/esm2015/bottom-sheet/bottom-sheet.js +124 -128
  225. package/esm2015/bottom-sheet/testing/bottom-sheet-harness.js +29 -33
  226. package/esm2015/button/button-module.js +20 -24
  227. package/esm2015/button/button.js +111 -114
  228. package/esm2015/button/testing/button-harness.js +60 -58
  229. package/esm2015/button-toggle/button-toggle-module.js +10 -14
  230. package/esm2015/button-toggle/button-toggle.js +368 -368
  231. package/esm2015/button-toggle/testing/button-toggle-group-harness.js +42 -46
  232. package/esm2015/button-toggle/testing/button-toggle-harness.js +113 -111
  233. package/esm2015/card/card-module.js +30 -34
  234. package/esm2015/card/card.js +147 -203
  235. package/esm2015/card/testing/card-harness-filters.js +8 -0
  236. package/esm2015/card/testing/card-harness.js +52 -0
  237. package/esm2015/card/testing/index.js +9 -0
  238. package/esm2015/card/testing/public-api.js +10 -0
  239. package/esm2015/card/testing/testing.externs.js +0 -0
  240. package/esm2015/checkbox/checkbox-module.js +21 -29
  241. package/esm2015/checkbox/checkbox-required-validator.js +9 -13
  242. package/esm2015/checkbox/checkbox.js +315 -319
  243. package/esm2015/checkbox/testing/checkbox-harness.js +150 -148
  244. package/esm2015/chips/chip-input.js +119 -123
  245. package/esm2015/chips/chip-list.js +572 -576
  246. package/esm2015/chips/chip.js +333 -328
  247. package/esm2015/chips/chips-module.js +16 -20
  248. package/esm2015/core/animation/animation.js +12 -20
  249. package/esm2015/core/common-behaviors/common-module.js +91 -95
  250. package/esm2015/core/datetime/index.js +19 -27
  251. package/esm2015/core/datetime/native-date-adapter.js +202 -206
  252. package/esm2015/core/error/error-options.js +16 -24
  253. package/esm2015/core/line/line.js +18 -26
  254. package/esm2015/core/option/index.js +10 -14
  255. package/esm2015/core/option/optgroup.js +36 -33
  256. package/esm2015/core/option/option.js +181 -185
  257. package/esm2015/core/ripple/index.js +10 -14
  258. package/esm2015/core/ripple/ripple-ref.js +1 -1
  259. package/esm2015/core/ripple/ripple-renderer.js +1 -1
  260. package/esm2015/core/ripple/ripple.js +102 -106
  261. package/esm2015/core/selection/index.js +9 -13
  262. package/esm2015/core/selection/pseudo-checkbox/pseudo-checkbox.js +32 -36
  263. package/esm2015/core/testing/optgroup-harness.js +39 -43
  264. package/esm2015/core/testing/option-harness.js +51 -55
  265. package/esm2015/core/version.js +1 -1
  266. package/esm2015/datepicker/calendar-body.js +214 -218
  267. package/esm2015/datepicker/calendar.js +295 -303
  268. package/esm2015/datepicker/date-range-input-parts.js +214 -229
  269. package/esm2015/datepicker/date-range-input.js +244 -242
  270. package/esm2015/datepicker/date-range-picker.js +19 -23
  271. package/esm2015/datepicker/date-range-selection-strategy.js +31 -35
  272. package/esm2015/datepicker/date-selection-model.js +110 -122
  273. package/esm2015/datepicker/datepicker-base.js +418 -426
  274. package/esm2015/datepicker/datepicker-input-base.js +227 -224
  275. package/esm2015/datepicker/datepicker-input.js +111 -115
  276. package/esm2015/datepicker/datepicker-intl.js +37 -41
  277. package/esm2015/datepicker/datepicker-module.js +62 -66
  278. package/esm2015/datepicker/datepicker-toggle.js +81 -89
  279. package/esm2015/datepicker/datepicker.js +13 -17
  280. package/esm2015/datepicker/month-view.js +283 -287
  281. package/esm2015/datepicker/multi-year-view.js +198 -202
  282. package/esm2015/datepicker/public-api.js +2 -2
  283. package/esm2015/datepicker/year-view.js +220 -224
  284. package/esm2015/dialog/dialog-container.js +175 -164
  285. package/esm2015/dialog/dialog-content-directives.js +105 -114
  286. package/esm2015/dialog/dialog-module.js +32 -36
  287. package/esm2015/dialog/dialog-ref.js +17 -3
  288. package/esm2015/dialog/dialog.js +236 -240
  289. package/esm2015/dialog/testing/dialog-harness.js +58 -62
  290. package/esm2015/divider/divider-module.js +10 -14
  291. package/esm2015/divider/divider.js +33 -37
  292. package/esm2015/divider/testing/divider-harness.js +16 -20
  293. package/esm2015/expansion/accordion.js +73 -77
  294. package/esm2015/expansion/expansion-module.js +26 -30
  295. package/esm2015/expansion/expansion-panel-content.js +13 -17
  296. package/esm2015/expansion/expansion-panel-header.js +168 -180
  297. package/esm2015/expansion/expansion-panel.js +144 -152
  298. package/esm2015/expansion/testing/accordion-harness.js +24 -28
  299. package/esm2015/expansion/testing/expansion-harness.js +136 -134
  300. package/esm2015/form-field/error.js +26 -23
  301. package/esm2015/form-field/form-field-control.js +6 -10
  302. package/esm2015/form-field/form-field-module.js +31 -35
  303. package/esm2015/form-field/form-field.js +407 -409
  304. package/esm2015/form-field/hint.js +35 -29
  305. package/esm2015/form-field/label.js +8 -12
  306. package/esm2015/form-field/placeholder.js +8 -12
  307. package/esm2015/form-field/prefix.js +16 -13
  308. package/esm2015/form-field/suffix.js +16 -13
  309. package/esm2015/form-field/testing/form-field-harness.js +220 -206
  310. package/esm2015/grid-list/grid-list-module.js +26 -30
  311. package/esm2015/grid-list/grid-list.js +108 -112
  312. package/esm2015/grid-list/grid-tile.js +91 -111
  313. package/esm2015/grid-list/testing/grid-list-harness.js +62 -66
  314. package/esm2015/grid-list/testing/grid-tile-harness.js +69 -73
  315. package/esm2015/grid-list/tile-styler.js +1 -1
  316. package/esm2015/icon/icon-module.js +10 -14
  317. package/esm2015/icon/icon-registry.js +406 -410
  318. package/esm2015/icon/icon.js +228 -232
  319. package/esm2015/icon/testing/fake-icon-registry.js +66 -74
  320. package/esm2015/input/autosize.js +30 -34
  321. package/esm2015/input/input-module.js +21 -25
  322. package/esm2015/input/input.js +305 -284
  323. package/esm2015/input/testing/input-harness.js +129 -123
  324. package/esm2015/list/list-module.js +32 -36
  325. package/esm2015/list/list.js +165 -189
  326. package/esm2015/list/selection-list.js +503 -511
  327. package/esm2015/list/testing/action-list-harness.js +55 -57
  328. package/esm2015/list/testing/list-harness.js +31 -39
  329. package/esm2015/list/testing/list-item-harness-base.js +13 -17
  330. package/esm2015/list/testing/nav-list-harness.js +62 -64
  331. package/esm2015/list/testing/selection-list-harness.js +136 -138
  332. package/esm2015/menu/menu-content.js +74 -71
  333. package/esm2015/menu/menu-item.js +119 -123
  334. package/esm2015/menu/menu-module.js +29 -37
  335. package/esm2015/menu/menu-panel.js +1 -1
  336. package/esm2015/menu/menu-trigger.js +402 -405
  337. package/esm2015/menu/menu.js +329 -339
  338. package/esm2015/menu/testing/menu-harness.js +193 -189
  339. package/esm2015/paginator/paginator-intl.js +36 -40
  340. package/esm2015/paginator/paginator-module.js +16 -20
  341. package/esm2015/paginator/paginator.js +205 -209
  342. package/esm2015/paginator/testing/paginator-harness.js +91 -95
  343. package/esm2015/progress-bar/progress-bar-module.js +10 -14
  344. package/esm2015/progress-bar/progress-bar.js +114 -118
  345. package/esm2015/progress-bar/testing/progress-bar-harness.js +27 -31
  346. package/esm2015/progress-spinner/progress-spinner-module.js +17 -21
  347. package/esm2015/progress-spinner/progress-spinner.js +181 -189
  348. package/esm2015/progress-spinner/testing/progress-spinner-harness.js +28 -32
  349. package/esm2015/radio/radio-module.js +10 -14
  350. package/esm2015/radio/radio.js +437 -444
  351. package/esm2015/radio/testing/radio-harness.js +241 -243
  352. package/esm2015/select/select-module.js +23 -27
  353. package/esm2015/select/select.js +917 -918
  354. package/esm2015/select/testing/select-harness.js +138 -136
  355. package/esm2015/sidenav/drawer.js +632 -620
  356. package/esm2015/sidenav/sidenav-module.js +31 -35
  357. package/esm2015/sidenav/sidenav.js +104 -116
  358. package/esm2015/sidenav/testing/drawer-harness.js +40 -44
  359. package/esm2015/sidenav/testing/sidenav-harness.js +20 -24
  360. package/esm2015/slide-toggle/slide-toggle-module.js +27 -35
  361. package/esm2015/slide-toggle/slide-toggle-required-validator.js +9 -13
  362. package/esm2015/slide-toggle/slide-toggle.js +184 -188
  363. package/esm2015/slide-toggle/testing/slide-toggle-harness.js +123 -121
  364. package/esm2015/slider/slider-module.js +10 -14
  365. package/esm2015/slider/slider.js +640 -644
  366. package/esm2015/slider/testing/slider-harness.js +129 -127
  367. package/esm2015/snack-bar/simple-snack-bar.js +32 -36
  368. package/esm2015/snack-bar/snack-bar-container.js +144 -148
  369. package/esm2015/snack-bar/snack-bar-module.js +17 -21
  370. package/esm2015/snack-bar/snack-bar-ref.js +1 -1
  371. package/esm2015/snack-bar/snack-bar.js +208 -205
  372. package/esm2015/snack-bar/testing/snack-bar-harness.js +112 -116
  373. package/esm2015/sort/sort-header-intl.js +21 -21
  374. package/esm2015/sort/sort-header.js +200 -194
  375. package/esm2015/sort/sort-module.js +11 -15
  376. package/esm2015/sort/sort.js +92 -96
  377. package/esm2015/sort/testing/sort-harness.js +28 -32
  378. package/esm2015/sort/testing/sort-header-harness.js +66 -67
  379. package/esm2015/stepper/step-header.js +78 -82
  380. package/esm2015/stepper/step-label.js +8 -12
  381. package/esm2015/stepper/stepper-button.js +23 -31
  382. package/esm2015/stepper/stepper-icon.js +16 -20
  383. package/esm2015/stepper/stepper-intl.js +15 -19
  384. package/esm2015/stepper/stepper-module.js +40 -44
  385. package/esm2015/stepper/stepper.js +139 -155
  386. package/esm2015/table/cell.js +94 -122
  387. package/esm2015/table/row.js +90 -118
  388. package/esm2015/table/table-module.js +13 -17
  389. package/esm2015/table/table.js +26 -30
  390. package/esm2015/table/testing/cell-harness.js +56 -68
  391. package/esm2015/table/testing/row-harness.js +90 -102
  392. package/esm2015/table/testing/table-harness.js +65 -69
  393. package/esm2015/table/text-column.js +17 -21
  394. package/esm2015/tabs/index.js +4 -2
  395. package/esm2015/tabs/ink-bar.js +55 -59
  396. package/esm2015/tabs/paginated-tab-header.js +415 -419
  397. package/esm2015/tabs/tab-body.js +179 -191
  398. package/esm2015/tabs/tab-content.js +21 -16
  399. package/esm2015/tabs/tab-group.js +263 -271
  400. package/esm2015/tabs/tab-header.js +69 -77
  401. package/esm2015/tabs/tab-label-wrapper.js +29 -33
  402. package/esm2015/tabs/tab-label.js +16 -13
  403. package/esm2015/tabs/tab-nav-bar/tab-nav-bar.js +199 -215
  404. package/esm2015/tabs/tab.js +80 -83
  405. package/esm2015/tabs/tabs-module.js +38 -42
  406. package/esm2015/tabs/testing/tab-group-harness.js +52 -56
  407. package/esm2015/tabs/testing/tab-harness.js +78 -82
  408. package/esm2015/toolbar/testing/index.js +9 -0
  409. package/esm2015/toolbar/testing/public-api.js +10 -0
  410. package/esm2015/toolbar/testing/testing.externs.js +0 -0
  411. package/esm2015/toolbar/testing/toolbar-harness-filters.js +8 -0
  412. package/esm2015/toolbar/testing/toolbar-harness.js +47 -0
  413. package/esm2015/toolbar/toolbar-module.js +10 -14
  414. package/esm2015/toolbar/toolbar.js +61 -69
  415. package/esm2015/tooltip/testing/tooltip-harness.js +43 -47
  416. package/esm2015/tooltip/tooltip-module.js +17 -21
  417. package/esm2015/tooltip/tooltip.js +502 -497
  418. package/esm2015/tree/data-source/flat-data-source.js +1 -1
  419. package/esm2015/tree/node.js +99 -111
  420. package/esm2015/tree/outlet.js +19 -23
  421. package/esm2015/tree/padding.js +13 -17
  422. package/esm2015/tree/toggle.js +15 -19
  423. package/esm2015/tree/tree-module.js +10 -14
  424. package/esm2015/tree/tree.js +23 -27
  425. package/expansion/testing/expansion-harness.d.ts +2 -0
  426. package/fesm2015/autocomplete/testing.js +98 -95
  427. package/fesm2015/autocomplete/testing.js.map +1 -1
  428. package/fesm2015/autocomplete.js +677 -687
  429. package/fesm2015/autocomplete.js.map +1 -1
  430. package/fesm2015/badge/testing.js +73 -76
  431. package/fesm2015/badge/testing.js.map +1 -1
  432. package/fesm2015/badge.js +195 -201
  433. package/fesm2015/badge.js.map +1 -1
  434. package/fesm2015/bottom-sheet/testing.js +28 -31
  435. package/fesm2015/bottom-sheet/testing.js.map +1 -1
  436. package/fesm2015/bottom-sheet.js +297 -306
  437. package/fesm2015/bottom-sheet.js.map +1 -1
  438. package/fesm2015/button/testing.js +59 -56
  439. package/fesm2015/button/testing.js.map +1 -1
  440. package/fesm2015/button-toggle/testing.js +155 -155
  441. package/fesm2015/button-toggle/testing.js.map +1 -1
  442. package/fesm2015/button-toggle.js +377 -378
  443. package/fesm2015/button-toggle.js.map +1 -1
  444. package/fesm2015/button.js +129 -133
  445. package/fesm2015/button.js.map +1 -1
  446. package/fesm2015/card/testing.js +79 -0
  447. package/fesm2015/card/testing.js.map +1 -0
  448. package/fesm2015/card.js +175 -220
  449. package/fesm2015/card.js.map +1 -1
  450. package/fesm2015/checkbox/testing.js +149 -146
  451. package/fesm2015/checkbox/testing.js.map +1 -1
  452. package/fesm2015/checkbox.js +342 -354
  453. package/fesm2015/checkbox.js.map +1 -1
  454. package/fesm2015/chips.js +1039 -1039
  455. package/fesm2015/chips.js.map +1 -1
  456. package/fesm2015/core/testing.js +88 -94
  457. package/fesm2015/core/testing.js.map +1 -1
  458. package/fesm2015/core.js +729 -773
  459. package/fesm2015/core.js.map +1 -1
  460. package/fesm2015/datepicker.js +2821 -2884
  461. package/fesm2015/datepicker.js.map +1 -1
  462. package/fesm2015/dialog/testing.js +57 -60
  463. package/fesm2015/dialog/testing.js.map +1 -1
  464. package/fesm2015/dialog.js +564 -549
  465. package/fesm2015/dialog.js.map +1 -1
  466. package/fesm2015/divider/testing.js +15 -18
  467. package/fesm2015/divider/testing.js.map +1 -1
  468. package/fesm2015/divider.js +41 -47
  469. package/fesm2015/divider.js.map +1 -1
  470. package/fesm2015/expansion/testing.js +159 -159
  471. package/fesm2015/expansion/testing.js.map +1 -1
  472. package/fesm2015/expansion.js +422 -446
  473. package/fesm2015/expansion.js.map +1 -1
  474. package/fesm2015/form-field/testing.js +219 -204
  475. package/fesm2015/form-field/testing.js.map +1 -1
  476. package/fesm2015/form-field.js +538 -532
  477. package/fesm2015/form-field.js.map +1 -1
  478. package/fesm2015/grid-list/testing.js +129 -135
  479. package/fesm2015/grid-list/testing.js.map +1 -1
  480. package/fesm2015/grid-list.js +221 -242
  481. package/fesm2015/grid-list.js.map +1 -1
  482. package/fesm2015/icon/testing.js +65 -71
  483. package/fesm2015/icon/testing.js.map +1 -1
  484. package/fesm2015/icon.js +660 -669
  485. package/fesm2015/icon.js.map +1 -1
  486. package/fesm2015/input/testing.js +128 -121
  487. package/fesm2015/input/testing.js.map +1 -1
  488. package/fesm2015/input.js +353 -337
  489. package/fesm2015/input.js.map +1 -1
  490. package/fesm2015/list/testing.js +298 -307
  491. package/fesm2015/list/testing.js.map +1 -1
  492. package/fesm2015/list.js +698 -725
  493. package/fesm2015/list.js.map +1 -1
  494. package/fesm2015/menu/testing.js +192 -186
  495. package/fesm2015/menu/testing.js.map +1 -1
  496. package/fesm2015/menu.js +948 -962
  497. package/fesm2015/menu.js.map +1 -1
  498. package/fesm2015/paginator/testing.js +90 -93
  499. package/fesm2015/paginator/testing.js.map +1 -1
  500. package/fesm2015/paginator.js +247 -256
  501. package/fesm2015/paginator.js.map +1 -1
  502. package/fesm2015/progress-bar/testing.js +26 -29
  503. package/fesm2015/progress-bar/testing.js.map +1 -1
  504. package/fesm2015/progress-bar.js +122 -128
  505. package/fesm2015/progress-bar.js.map +1 -1
  506. package/fesm2015/progress-spinner/testing.js +27 -30
  507. package/fesm2015/progress-spinner/testing.js.map +1 -1
  508. package/fesm2015/progress-spinner.js +196 -205
  509. package/fesm2015/progress-spinner.js.map +1 -1
  510. package/fesm2015/radio/testing.js +240 -240
  511. package/fesm2015/radio/testing.js.map +1 -1
  512. package/fesm2015/radio.js +447 -453
  513. package/fesm2015/radio.js.map +1 -1
  514. package/fesm2015/select/testing.js +137 -134
  515. package/fesm2015/select/testing.js.map +1 -1
  516. package/fesm2015/select.js +939 -941
  517. package/fesm2015/select.js.map +1 -1
  518. package/fesm2015/sidenav/testing.js +58 -64
  519. package/fesm2015/sidenav/testing.js.map +1 -1
  520. package/fesm2015/sidenav.js +765 -762
  521. package/fesm2015/sidenav.js.map +1 -1
  522. package/fesm2015/slide-toggle/testing.js +122 -119
  523. package/fesm2015/slide-toggle/testing.js.map +1 -1
  524. package/fesm2015/slide-toggle.js +217 -229
  525. package/fesm2015/slide-toggle.js.map +1 -1
  526. package/fesm2015/slider/testing.js +128 -125
  527. package/fesm2015/slider/testing.js.map +1 -1
  528. package/fesm2015/slider.js +648 -654
  529. package/fesm2015/slider.js.map +1 -1
  530. package/fesm2015/snack-bar/testing.js +111 -114
  531. package/fesm2015/snack-bar/testing.js.map +1 -1
  532. package/fesm2015/snack-bar.js +426 -431
  533. package/fesm2015/snack-bar.js.map +1 -1
  534. package/fesm2015/sort/testing.js +92 -95
  535. package/fesm2015/sort/testing.js.map +1 -1
  536. package/fesm2015/sort.js +320 -318
  537. package/fesm2015/sort.js.map +1 -1
  538. package/fesm2015/stepper.js +312 -345
  539. package/fesm2015/stepper.js.map +1 -1
  540. package/fesm2015/table/testing.js +208 -229
  541. package/fesm2015/table/testing.js.map +1 -1
  542. package/fesm2015/table.js +235 -286
  543. package/fesm2015/table.js.map +1 -1
  544. package/fesm2015/tabs/testing.js +128 -134
  545. package/fesm2015/tabs/testing.js.map +1 -1
  546. package/fesm2015/tabs.js +1362 -1399
  547. package/fesm2015/tabs.js.map +1 -1
  548. package/fesm2015/toolbar/testing.js +74 -0
  549. package/fesm2015/toolbar/testing.js.map +1 -0
  550. package/fesm2015/toolbar.js +69 -78
  551. package/fesm2015/toolbar.js.map +1 -1
  552. package/fesm2015/tooltip/testing.js +42 -45
  553. package/fesm2015/tooltip/testing.js.map +1 -1
  554. package/fesm2015/tooltip.js +517 -513
  555. package/fesm2015/tooltip.js.map +1 -1
  556. package/fesm2015/tree.js +173 -197
  557. package/fesm2015/tree.js.map +1 -1
  558. package/form-field/error.d.ts +7 -0
  559. package/form-field/hint.d.ts +10 -0
  560. package/form-field/index.metadata.json +1 -1
  561. package/form-field/prefix.d.ts +7 -0
  562. package/form-field/suffix.d.ts +7 -0
  563. package/form-field/testing/form-field-harness.d.ts +8 -0
  564. package/grid-list/grid-list.d.ts +2 -1
  565. package/grid-list/index.metadata.json +1 -1
  566. package/grid-list/tile-styler.d.ts +10 -5
  567. package/input/_input-theme.scss +2 -2
  568. package/input/index.metadata.json +1 -1
  569. package/input/input.d.ts +6 -2
  570. package/input/testing/input-harness.d.ts +2 -0
  571. package/list/index.metadata.json +1 -1
  572. package/list/testing/action-list-harness.d.ts +2 -0
  573. package/list/testing/nav-list-harness.d.ts +2 -0
  574. package/list/testing/selection-list-harness.d.ts +2 -0
  575. package/menu/index.metadata.json +1 -1
  576. package/menu/menu-content.d.ts +7 -1
  577. package/menu/menu-panel.d.ts +1 -0
  578. package/menu/menu.d.ts +4 -0
  579. package/menu/testing/menu-harness.d.ts +4 -0
  580. package/package.json +6 -6
  581. package/prebuilt-themes/deeppurple-amber.css +1 -1
  582. package/prebuilt-themes/indigo-pink.css +1 -1
  583. package/prebuilt-themes/pink-bluegrey.css +1 -1
  584. package/prebuilt-themes/purple-green.css +1 -1
  585. package/progress-spinner/index.metadata.json +1 -1
  586. package/radio/index.metadata.json +1 -1
  587. package/radio/radio.d.ts +6 -0
  588. package/radio/testing/radio-harness.d.ts +2 -0
  589. package/schematics/migration.json +5 -0
  590. package/schematics/ng-add/index.js +2 -2
  591. package/schematics/ng-generate/navigation/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.html.template +3 -3
  592. package/schematics/ng-generate/navigation/schema.json +5 -0
  593. package/schematics/ng-update/data/index.js +1 -1
  594. package/schematics/ng-update/index.d.ts +2 -0
  595. package/schematics/ng-update/index.js +7 -2
  596. package/schematics/ng-update/migrations/hammer-gestures-v9/hammer-gestures-migration.js +639 -639
  597. package/schematics/ng-update/migrations/misc-ripples-v7/ripple-speed-factor-migration.js +1 -1
  598. package/select/index.metadata.json +1 -1
  599. package/select/select.d.ts +6 -0
  600. package/select/testing/select-harness.d.ts +2 -0
  601. package/sidenav/drawer.d.ts +15 -3
  602. package/sidenav/index.metadata.json +1 -1
  603. package/slide-toggle/index.metadata.json +1 -1
  604. package/slide-toggle/testing/slide-toggle-harness.d.ts +2 -0
  605. package/slider/testing/slider-harness.d.ts +2 -0
  606. package/snack-bar/index.metadata.json +1 -1
  607. package/snack-bar/simple-snack-bar.d.ts +13 -1
  608. package/snack-bar/snack-bar-container.d.ts +16 -3
  609. package/snack-bar/snack-bar-ref.d.ts +3 -3
  610. package/snack-bar/snack-bar.d.ts +10 -3
  611. package/sort/index.metadata.json +1 -1
  612. package/sort/sort-header-intl.d.ts +5 -1
  613. package/sort/sort-header.d.ts +3 -1
  614. package/sort/testing/sort-header-harness.d.ts +6 -2
  615. package/tabs/index.d.ts +3 -1
  616. package/tabs/index.metadata.json +1 -1
  617. package/tabs/tab-content.d.ts +7 -1
  618. package/tabs/tab-label.d.ts +7 -0
  619. package/toolbar/testing/index.d.ts +8 -0
  620. package/toolbar/testing/package.json +9 -0
  621. package/toolbar/testing/public-api.d.ts +9 -0
  622. package/toolbar/testing/toolbar-harness-filters.d.ts +13 -0
  623. package/toolbar/testing/toolbar-harness.d.ts +31 -0
  624. package/tooltip/index.metadata.json +1 -1
  625. package/tooltip/tooltip.d.ts +1 -0
  626. package/tree/data-source/flat-data-source.d.ts +4 -4
  627. package/tree/index.metadata.json +1 -1
@@ -54,680 +54,677 @@ const _MatSliderMixinBase = mixinTabIndex(mixinColor(mixinDisabled(MatSliderBase
54
54
  * Allows users to select from a range of values by moving the slider thumb. It is similar in
55
55
  * behavior to the native `<input type="range">` element.
56
56
  */
57
- let MatSlider = /** @class */ (() => {
58
- class MatSlider extends _MatSliderMixinBase {
59
- constructor(elementRef, _focusMonitor, _changeDetectorRef, _dir, tabIndex, _ngZone, _document, _animationMode) {
60
- super(elementRef);
61
- this._focusMonitor = _focusMonitor;
62
- this._changeDetectorRef = _changeDetectorRef;
63
- this._dir = _dir;
64
- this._ngZone = _ngZone;
65
- this._animationMode = _animationMode;
66
- this._invert = false;
67
- this._max = 100;
68
- this._min = 0;
69
- this._step = 1;
70
- this._thumbLabel = false;
71
- this._tickInterval = 0;
72
- this._value = null;
73
- this._vertical = false;
74
- /** Event emitted when the slider value has changed. */
75
- this.change = new EventEmitter();
76
- /** Event emitted when the slider thumb moves. */
77
- this.input = new EventEmitter();
78
- /**
79
- * Emits when the raw value of the slider changes. This is here primarily
80
- * to facilitate the two-way binding for the `value` input.
81
- * @docs-private
82
- */
83
- this.valueChange = new EventEmitter();
84
- /** onTouch function registered via registerOnTouch (ControlValueAccessor). */
85
- this.onTouched = () => { };
86
- this._percent = 0;
87
- /**
88
- * Whether or not the thumb is sliding.
89
- * Used to determine if there should be a transition for the thumb and fill track.
90
- */
91
- this._isSliding = false;
92
- /**
93
- * Whether or not the slider is active (clicked or sliding).
94
- * Used to shrink and grow the thumb as according to the Material Design spec.
95
- */
96
- this._isActive = false;
97
- /** The size of a tick interval as a percentage of the size of the track. */
98
- this._tickIntervalPercent = 0;
99
- /** The dimensions of the slider. */
100
- this._sliderDimensions = null;
101
- this._controlValueAccessorChangeFn = () => { };
102
- /** Subscription to the Directionality change EventEmitter. */
103
- this._dirChangeSubscription = Subscription.EMPTY;
104
- /** Called when the user has put their pointer down on the slider. */
105
- this._pointerDown = (event) => {
106
- // Don't do anything if the slider is disabled or the
107
- // user is using anything other than the main mouse button.
108
- if (this.disabled || this._isSliding || (!isTouchEvent(event) && event.button !== 0)) {
109
- return;
110
- }
111
- this._ngZone.run(() => {
112
- const oldValue = this.value;
113
- const pointerPosition = getPointerPositionOnPage(event);
114
- this._isSliding = true;
115
- this._lastPointerEvent = event;
116
- event.preventDefault();
117
- this._focusHostElement();
118
- this._onMouseenter(); // Simulate mouseenter in case this is a mobile device.
119
- this._bindGlobalEvents(event);
120
- this._focusHostElement();
121
- this._updateValueFromPosition(pointerPosition);
122
- this._valueOnSlideStart = this.value;
123
- this._pointerPositionOnStart = pointerPosition;
124
- // Emit a change and input event if the value changed.
125
- if (oldValue != this.value) {
126
- this._emitInputEvent();
127
- this._emitChangeEvent();
128
- }
129
- });
130
- };
131
- /**
132
- * Called when the user has moved their pointer after
133
- * starting to drag. Bound on the document level.
134
- */
135
- this._pointerMove = (event) => {
136
- if (this._isSliding) {
137
- // Prevent the slide from selecting anything else.
138
- event.preventDefault();
139
- const oldValue = this.value;
140
- this._lastPointerEvent = event;
141
- this._updateValueFromPosition(getPointerPositionOnPage(event));
142
- // Native range elements always emit `input` events when the value changed while sliding.
143
- if (oldValue != this.value) {
144
- this._emitInputEvent();
145
- }
146
- }
147
- };
148
- /** Called when the user has lifted their pointer. Bound on the document level. */
149
- this._pointerUp = (event) => {
150
- if (this._isSliding) {
151
- const pointerPositionOnStart = this._pointerPositionOnStart;
152
- const currentPointerPosition = getPointerPositionOnPage(event);
153
- event.preventDefault();
154
- this._removeGlobalEvents();
155
- this._valueOnSlideStart = this._pointerPositionOnStart = this._lastPointerEvent = null;
156
- this._isSliding = false;
157
- if (this._valueOnSlideStart != this.value && !this.disabled &&
158
- pointerPositionOnStart && (pointerPositionOnStart.x !== currentPointerPosition.x ||
159
- pointerPositionOnStart.y !== currentPointerPosition.y)) {
160
- this._emitChangeEvent();
161
- }
162
- }
163
- };
164
- /** Called when the window has lost focus. */
165
- this._windowBlur = () => {
166
- // If the window is blurred while dragging we need to stop dragging because the
167
- // browser won't dispatch the `mouseup` and `touchend` events anymore.
168
- if (this._lastPointerEvent) {
169
- this._pointerUp(this._lastPointerEvent);
170
- }
171
- };
172
- this._document = _document;
173
- this.tabIndex = parseInt(tabIndex) || 0;
174
- _ngZone.runOutsideAngular(() => {
175
- const element = elementRef.nativeElement;
176
- element.addEventListener('mousedown', this._pointerDown, activeEventOptions);
177
- element.addEventListener('touchstart', this._pointerDown, activeEventOptions);
178
- });
179
- }
180
- /** Whether the slider is inverted. */
181
- get invert() { return this._invert; }
182
- set invert(value) {
183
- this._invert = coerceBooleanProperty(value);
184
- }
185
- /** The maximum value that the slider can have. */
186
- get max() { return this._max; }
187
- set max(v) {
188
- this._max = coerceNumberProperty(v, this._max);
189
- this._percent = this._calculatePercentage(this._value);
190
- // Since this also modifies the percentage, we need to let the change detection know.
191
- this._changeDetectorRef.markForCheck();
192
- }
193
- /** The minimum value that the slider can have. */
194
- get min() { return this._min; }
195
- set min(v) {
196
- this._min = coerceNumberProperty(v, this._min);
197
- // If the value wasn't explicitly set by the user, set it to the min.
198
- if (this._value === null) {
199
- this.value = this._min;
200
- }
201
- this._percent = this._calculatePercentage(this._value);
202
- // Since this also modifies the percentage, we need to let the change detection know.
203
- this._changeDetectorRef.markForCheck();
204
- }
205
- /** The values at which the thumb will snap. */
206
- get step() { return this._step; }
207
- set step(v) {
208
- this._step = coerceNumberProperty(v, this._step);
209
- if (this._step % 1 !== 0) {
210
- this._roundToDecimal = this._step.toString().split('.').pop().length;
211
- }
212
- // Since this could modify the label, we need to notify the change detection.
213
- this._changeDetectorRef.markForCheck();
214
- }
215
- /** Whether or not to show the thumb label. */
216
- get thumbLabel() { return this._thumbLabel; }
217
- set thumbLabel(value) { this._thumbLabel = coerceBooleanProperty(value); }
57
+ class MatSlider extends _MatSliderMixinBase {
58
+ constructor(elementRef, _focusMonitor, _changeDetectorRef, _dir, tabIndex, _ngZone, _document, _animationMode) {
59
+ super(elementRef);
60
+ this._focusMonitor = _focusMonitor;
61
+ this._changeDetectorRef = _changeDetectorRef;
62
+ this._dir = _dir;
63
+ this._ngZone = _ngZone;
64
+ this._animationMode = _animationMode;
65
+ this._invert = false;
66
+ this._max = 100;
67
+ this._min = 0;
68
+ this._step = 1;
69
+ this._thumbLabel = false;
70
+ this._tickInterval = 0;
71
+ this._value = null;
72
+ this._vertical = false;
73
+ /** Event emitted when the slider value has changed. */
74
+ this.change = new EventEmitter();
75
+ /** Event emitted when the slider thumb moves. */
76
+ this.input = new EventEmitter();
218
77
  /**
219
- * How often to show ticks. Relative to the step so that a tick always appears on a step.
220
- * Ex: Tick interval of 4 with a step of 3 will draw a tick every 4 steps (every 12 values).
78
+ * Emits when the raw value of the slider changes. This is here primarily
79
+ * to facilitate the two-way binding for the `value` input.
80
+ * @docs-private
221
81
  */
222
- get tickInterval() { return this._tickInterval; }
223
- set tickInterval(value) {
224
- if (value === 'auto') {
225
- this._tickInterval = 'auto';
226
- }
227
- else if (typeof value === 'number' || typeof value === 'string') {
228
- this._tickInterval = coerceNumberProperty(value, this._tickInterval);
229
- }
230
- else {
231
- this._tickInterval = 0;
232
- }
233
- }
234
- /** Value of the slider. */
235
- get value() {
236
- // If the value needs to be read and it is still uninitialized, initialize it to the min.
237
- if (this._value === null) {
238
- this.value = this._min;
239
- }
240
- return this._value;
241
- }
242
- set value(v) {
243
- if (v !== this._value) {
244
- let value = coerceNumberProperty(v);
245
- // While incrementing by a decimal we can end up with values like 33.300000000000004.
246
- // Truncate it to ensure that it matches the label and to make it easier to work with.
247
- if (this._roundToDecimal) {
248
- value = parseFloat(value.toFixed(this._roundToDecimal));
249
- }
250
- this._value = value;
251
- this._percent = this._calculatePercentage(this._value);
252
- // Since this also modifies the percentage, we need to let the change detection know.
253
- this._changeDetectorRef.markForCheck();
254
- }
255
- }
256
- /** Whether the slider is vertical. */
257
- get vertical() { return this._vertical; }
258
- set vertical(value) {
259
- this._vertical = coerceBooleanProperty(value);
260
- }
261
- /** The value to be used for display purposes. */
262
- get displayValue() {
263
- if (this.displayWith) {
264
- // Value is never null but since setters and getters cannot have
265
- // different types, the value getter is also typed to return null.
266
- return this.displayWith(this.value);
267
- }
268
- // Note that this could be improved further by rounding something like 0.999 to 1 or
269
- // 0.899 to 0.9, however it is very performance sensitive, because it gets called on
270
- // every change detection cycle.
271
- if (this._roundToDecimal && this.value && this.value % 1 !== 0) {
272
- return this.value.toFixed(this._roundToDecimal);
273
- }
274
- return this.value || 0;
275
- }
276
- /** set focus to the host element */
277
- focus(options) {
278
- this._focusHostElement(options);
279
- }
280
- /** blur the host element */
281
- blur() {
282
- this._blurHostElement();
283
- }
284
- /** The percentage of the slider that coincides with the value. */
285
- get percent() { return this._clamp(this._percent); }
82
+ this.valueChange = new EventEmitter();
83
+ /** onTouch function registered via registerOnTouch (ControlValueAccessor). */
84
+ this.onTouched = () => { };
85
+ this._percent = 0;
286
86
  /**
287
- * Whether the axis of the slider is inverted.
288
- * (i.e. whether moving the thumb in the positive x or y direction decreases the slider's value).
87
+ * Whether or not the thumb is sliding.
88
+ * Used to determine if there should be a transition for the thumb and fill track.
289
89
  */
290
- get _invertAxis() {
291
- // Standard non-inverted mode for a vertical slider should be dragging the thumb from bottom to
292
- // top. However from a y-axis standpoint this is inverted.
293
- return this.vertical ? !this.invert : this.invert;
294
- }
295
- /** Whether the slider is at its minimum value. */
296
- get _isMinValue() {
297
- return this.percent === 0;
298
- }
90
+ this._isSliding = false;
299
91
  /**
300
- * The amount of space to leave between the slider thumb and the track fill & track background
301
- * elements.
92
+ * Whether or not the slider is active (clicked or sliding).
93
+ * Used to shrink and grow the thumb as according to the Material Design spec.
302
94
  */
303
- get _thumbGap() {
304
- if (this.disabled) {
305
- return DISABLED_THUMB_GAP;
306
- }
307
- if (this._isMinValue && !this.thumbLabel) {
308
- return this._isActive ? MIN_VALUE_ACTIVE_THUMB_GAP : MIN_VALUE_NONACTIVE_THUMB_GAP;
95
+ this._isActive = false;
96
+ /** The size of a tick interval as a percentage of the size of the track. */
97
+ this._tickIntervalPercent = 0;
98
+ /** The dimensions of the slider. */
99
+ this._sliderDimensions = null;
100
+ this._controlValueAccessorChangeFn = () => { };
101
+ /** Subscription to the Directionality change EventEmitter. */
102
+ this._dirChangeSubscription = Subscription.EMPTY;
103
+ /** Called when the user has put their pointer down on the slider. */
104
+ this._pointerDown = (event) => {
105
+ // Don't do anything if the slider is disabled or the
106
+ // user is using anything other than the main mouse button.
107
+ if (this.disabled || this._isSliding || (!isTouchEvent(event) && event.button !== 0)) {
108
+ return;
309
109
  }
310
- return 0;
311
- }
312
- /** CSS styles for the track background element. */
313
- get _trackBackgroundStyles() {
314
- const axis = this.vertical ? 'Y' : 'X';
315
- const scale = this.vertical ? `1, ${1 - this.percent}, 1` : `${1 - this.percent}, 1, 1`;
316
- const sign = this._shouldInvertMouseCoords() ? '-' : '';
317
- return {
318
- // scale3d avoids some rendering issues in Chrome. See #12071.
319
- transform: `translate${axis}(${sign}${this._thumbGap}px) scale3d(${scale})`
320
- };
321
- }
322
- /** CSS styles for the track fill element. */
323
- get _trackFillStyles() {
324
- const percent = this.percent;
325
- const axis = this.vertical ? 'Y' : 'X';
326
- const scale = this.vertical ? `1, ${percent}, 1` : `${percent}, 1, 1`;
327
- const sign = this._shouldInvertMouseCoords() ? '' : '-';
328
- return {
329
- // scale3d avoids some rendering issues in Chrome. See #12071.
330
- transform: `translate${axis}(${sign}${this._thumbGap}px) scale3d(${scale})`,
331
- // iOS Safari has a bug where it won't re-render elements which start of as `scale(0)` until
332
- // something forces a style recalculation on it. Since we'll end up with `scale(0)` when
333
- // the value of the slider is 0, we can easily get into this situation. We force a
334
- // recalculation by changing the element's `display` when it goes from 0 to any other value.
335
- display: percent === 0 ? 'none' : ''
336
- };
337
- }
338
- /** CSS styles for the ticks container element. */
339
- get _ticksContainerStyles() {
340
- let axis = this.vertical ? 'Y' : 'X';
341
- // For a horizontal slider in RTL languages we push the ticks container off the left edge
342
- // instead of the right edge to avoid causing a horizontal scrollbar to appear.
343
- let sign = !this.vertical && this._getDirection() == 'rtl' ? '' : '-';
344
- let offset = this._tickIntervalPercent / 2 * 100;
345
- return {
346
- 'transform': `translate${axis}(${sign}${offset}%)`
347
- };
348
- }
349
- /** CSS styles for the ticks element. */
350
- get _ticksStyles() {
351
- let tickSize = this._tickIntervalPercent * 100;
352
- let backgroundSize = this.vertical ? `2px ${tickSize}%` : `${tickSize}% 2px`;
353
- let axis = this.vertical ? 'Y' : 'X';
354
- // Depending on the direction we pushed the ticks container, push the ticks the opposite
355
- // direction to re-center them but clip off the end edge. In RTL languages we need to flip the
356
- // ticks 180 degrees so we're really cutting off the end edge abd not the start.
357
- let sign = !this.vertical && this._getDirection() == 'rtl' ? '-' : '';
358
- let rotate = !this.vertical && this._getDirection() == 'rtl' ? ' rotate(180deg)' : '';
359
- let styles = {
360
- 'backgroundSize': backgroundSize,
361
- // Without translateZ ticks sometimes jitter as the slider moves on Chrome & Firefox.
362
- 'transform': `translateZ(0) translate${axis}(${sign}${tickSize / 2}%)${rotate}`
363
- };
364
- if (this._isMinValue && this._thumbGap) {
365
- let side;
366
- if (this.vertical) {
367
- side = this._invertAxis ? 'Bottom' : 'Top';
368
- }
369
- else {
370
- side = this._invertAxis ? 'Right' : 'Left';
110
+ this._ngZone.run(() => {
111
+ const oldValue = this.value;
112
+ const pointerPosition = getPointerPositionOnPage(event);
113
+ this._isSliding = true;
114
+ this._lastPointerEvent = event;
115
+ event.preventDefault();
116
+ this._focusHostElement();
117
+ this._onMouseenter(); // Simulate mouseenter in case this is a mobile device.
118
+ this._bindGlobalEvents(event);
119
+ this._focusHostElement();
120
+ this._updateValueFromPosition(pointerPosition);
121
+ this._valueOnSlideStart = this.value;
122
+ this._pointerPositionOnStart = pointerPosition;
123
+ // Emit a change and input event if the value changed.
124
+ if (oldValue != this.value) {
125
+ this._emitInputEvent();
126
+ this._emitChangeEvent();
371
127
  }
372
- styles[`padding${side}`] = `${this._thumbGap}px`;
373
- }
374
- return styles;
375
- }
376
- get _thumbContainerStyles() {
377
- let axis = this.vertical ? 'Y' : 'X';
378
- // For a horizontal slider in RTL languages we push the thumb container off the left edge
379
- // instead of the right edge to avoid causing a horizontal scrollbar to appear.
380
- let invertOffset = (this._getDirection() == 'rtl' && !this.vertical) ? !this._invertAxis : this._invertAxis;
381
- let offset = (invertOffset ? this.percent : 1 - this.percent) * 100;
382
- return {
383
- 'transform': `translate${axis}(-${offset}%)`
384
- };
385
- }
386
- /**
387
- * Whether mouse events should be converted to a slider position by calculating their distance
388
- * from the right or bottom edge of the slider as opposed to the top or left.
389
- */
390
- _shouldInvertMouseCoords() {
391
- return (this._getDirection() == 'rtl' && !this.vertical) ? !this._invertAxis : this._invertAxis;
392
- }
393
- /** The language direction for this slider element. */
394
- _getDirection() {
395
- return (this._dir && this._dir.value == 'rtl') ? 'rtl' : 'ltr';
396
- }
397
- ngAfterViewInit() {
398
- this._focusMonitor
399
- .monitor(this._elementRef, true)
400
- .subscribe((origin) => {
401
- this._isActive = !!origin && origin !== 'keyboard';
402
- this._changeDetectorRef.detectChanges();
403
128
  });
404
- if (this._dir) {
405
- this._dirChangeSubscription = this._dir.change.subscribe(() => {
406
- this._changeDetectorRef.markForCheck();
407
- });
408
- }
409
- }
410
- ngOnDestroy() {
411
- const element = this._elementRef.nativeElement;
412
- element.removeEventListener('mousedown', this._pointerDown, activeEventOptions);
413
- element.removeEventListener('touchstart', this._pointerDown, activeEventOptions);
414
- this._lastPointerEvent = null;
415
- this._removeGlobalEvents();
416
- this._focusMonitor.stopMonitoring(this._elementRef);
417
- this._dirChangeSubscription.unsubscribe();
418
- }
419
- _onMouseenter() {
420
- if (this.disabled) {
421
- return;
422
- }
423
- // We save the dimensions of the slider here so we can use them to update the spacing of the
424
- // ticks and determine where on the slider click and slide events happen.
425
- this._sliderDimensions = this._getSliderDimensions();
426
- this._updateTickIntervalPercent();
427
- }
428
- _onFocus() {
429
- // We save the dimensions of the slider here so we can use them to update the spacing of the
430
- // ticks and determine where on the slider click and slide events happen.
431
- this._sliderDimensions = this._getSliderDimensions();
432
- this._updateTickIntervalPercent();
433
- }
434
- _onBlur() {
435
- this.onTouched();
436
- }
437
- _onKeydown(event) {
438
- if (this.disabled || hasModifierKey(event)) {
439
- return;
440
- }
441
- const oldValue = this.value;
442
- switch (event.keyCode) {
443
- case PAGE_UP:
444
- this._increment(10);
445
- break;
446
- case PAGE_DOWN:
447
- this._increment(-10);
448
- break;
449
- case END:
450
- this.value = this.max;
451
- break;
452
- case HOME:
453
- this.value = this.min;
454
- break;
455
- case LEFT_ARROW:
456
- // NOTE: For a sighted user it would make more sense that when they press an arrow key on an
457
- // inverted slider the thumb moves in that direction. However for a blind user, nothing
458
- // about the slider indicates that it is inverted. They will expect left to be decrement,
459
- // regardless of how it appears on the screen. For speakers ofRTL languages, they probably
460
- // expect left to mean increment. Therefore we flip the meaning of the side arrow keys for
461
- // RTL. For inverted sliders we prefer a good a11y experience to having it "look right" for
462
- // sighted users, therefore we do not swap the meaning.
463
- this._increment(this._getDirection() == 'rtl' ? 1 : -1);
464
- break;
465
- case UP_ARROW:
466
- this._increment(1);
467
- break;
468
- case RIGHT_ARROW:
469
- // See comment on LEFT_ARROW about the conditions under which we flip the meaning.
470
- this._increment(this._getDirection() == 'rtl' ? -1 : 1);
471
- break;
472
- case DOWN_ARROW:
473
- this._increment(-1);
474
- break;
475
- default:
476
- // Return if the key is not one that we explicitly handle to avoid calling preventDefault on
477
- // it.
478
- return;
479
- }
480
- if (oldValue != this.value) {
481
- this._emitInputEvent();
482
- this._emitChangeEvent();
483
- }
484
- this._isSliding = true;
485
- event.preventDefault();
486
- }
487
- _onKeyup() {
488
- this._isSliding = false;
489
- }
490
- /** Use defaultView of injected document if available or fallback to global window reference */
491
- _getWindow() {
492
- return this._document.defaultView || window;
493
- }
129
+ };
494
130
  /**
495
- * Binds our global move and end events. They're bound at the document level and only while
496
- * dragging so that the user doesn't have to keep their pointer exactly over the slider
497
- * as they're swiping across the screen.
131
+ * Called when the user has moved their pointer after
132
+ * starting to drag. Bound on the document level.
498
133
  */
499
- _bindGlobalEvents(triggerEvent) {
500
- // Note that we bind the events to the `document`, because it allows us to capture
501
- // drag cancel events where the user's pointer is outside the browser window.
502
- const document = this._document;
503
- const isTouch = isTouchEvent(triggerEvent);
504
- const moveEventName = isTouch ? 'touchmove' : 'mousemove';
505
- const endEventName = isTouch ? 'touchend' : 'mouseup';
506
- document.addEventListener(moveEventName, this._pointerMove, activeEventOptions);
507
- document.addEventListener(endEventName, this._pointerUp, activeEventOptions);
508
- if (isTouch) {
509
- document.addEventListener('touchcancel', this._pointerUp, activeEventOptions);
134
+ this._pointerMove = (event) => {
135
+ if (this._isSliding) {
136
+ // Prevent the slide from selecting anything else.
137
+ event.preventDefault();
138
+ const oldValue = this.value;
139
+ this._lastPointerEvent = event;
140
+ this._updateValueFromPosition(getPointerPositionOnPage(event));
141
+ // Native range elements always emit `input` events when the value changed while sliding.
142
+ if (oldValue != this.value) {
143
+ this._emitInputEvent();
144
+ }
510
145
  }
511
- const window = this._getWindow();
512
- if (typeof window !== 'undefined' && window) {
513
- window.addEventListener('blur', this._windowBlur);
146
+ };
147
+ /** Called when the user has lifted their pointer. Bound on the document level. */
148
+ this._pointerUp = (event) => {
149
+ if (this._isSliding) {
150
+ const pointerPositionOnStart = this._pointerPositionOnStart;
151
+ const currentPointerPosition = getPointerPositionOnPage(event);
152
+ event.preventDefault();
153
+ this._removeGlobalEvents();
154
+ this._valueOnSlideStart = this._pointerPositionOnStart = this._lastPointerEvent = null;
155
+ this._isSliding = false;
156
+ if (this._valueOnSlideStart != this.value && !this.disabled &&
157
+ pointerPositionOnStart && (pointerPositionOnStart.x !== currentPointerPosition.x ||
158
+ pointerPositionOnStart.y !== currentPointerPosition.y)) {
159
+ this._emitChangeEvent();
160
+ }
514
161
  }
515
- }
516
- /** Removes any global event listeners that we may have added. */
517
- _removeGlobalEvents() {
518
- const document = this._document;
519
- document.removeEventListener('mousemove', this._pointerMove, activeEventOptions);
520
- document.removeEventListener('mouseup', this._pointerUp, activeEventOptions);
521
- document.removeEventListener('touchmove', this._pointerMove, activeEventOptions);
522
- document.removeEventListener('touchend', this._pointerUp, activeEventOptions);
523
- document.removeEventListener('touchcancel', this._pointerUp, activeEventOptions);
524
- const window = this._getWindow();
525
- if (typeof window !== 'undefined' && window) {
526
- window.removeEventListener('blur', this._windowBlur);
162
+ };
163
+ /** Called when the window has lost focus. */
164
+ this._windowBlur = () => {
165
+ // If the window is blurred while dragging we need to stop dragging because the
166
+ // browser won't dispatch the `mouseup` and `touchend` events anymore.
167
+ if (this._lastPointerEvent) {
168
+ this._pointerUp(this._lastPointerEvent);
527
169
  }
170
+ };
171
+ this._document = _document;
172
+ this.tabIndex = parseInt(tabIndex) || 0;
173
+ _ngZone.runOutsideAngular(() => {
174
+ const element = elementRef.nativeElement;
175
+ element.addEventListener('mousedown', this._pointerDown, activeEventOptions);
176
+ element.addEventListener('touchstart', this._pointerDown, activeEventOptions);
177
+ });
178
+ }
179
+ /** Whether the slider is inverted. */
180
+ get invert() { return this._invert; }
181
+ set invert(value) {
182
+ this._invert = coerceBooleanProperty(value);
183
+ }
184
+ /** The maximum value that the slider can have. */
185
+ get max() { return this._max; }
186
+ set max(v) {
187
+ this._max = coerceNumberProperty(v, this._max);
188
+ this._percent = this._calculatePercentage(this._value);
189
+ // Since this also modifies the percentage, we need to let the change detection know.
190
+ this._changeDetectorRef.markForCheck();
191
+ }
192
+ /** The minimum value that the slider can have. */
193
+ get min() { return this._min; }
194
+ set min(v) {
195
+ this._min = coerceNumberProperty(v, this._min);
196
+ // If the value wasn't explicitly set by the user, set it to the min.
197
+ if (this._value === null) {
198
+ this.value = this._min;
199
+ }
200
+ this._percent = this._calculatePercentage(this._value);
201
+ // Since this also modifies the percentage, we need to let the change detection know.
202
+ this._changeDetectorRef.markForCheck();
203
+ }
204
+ /** The values at which the thumb will snap. */
205
+ get step() { return this._step; }
206
+ set step(v) {
207
+ this._step = coerceNumberProperty(v, this._step);
208
+ if (this._step % 1 !== 0) {
209
+ this._roundToDecimal = this._step.toString().split('.').pop().length;
210
+ }
211
+ // Since this could modify the label, we need to notify the change detection.
212
+ this._changeDetectorRef.markForCheck();
213
+ }
214
+ /** Whether or not to show the thumb label. */
215
+ get thumbLabel() { return this._thumbLabel; }
216
+ set thumbLabel(value) { this._thumbLabel = coerceBooleanProperty(value); }
217
+ /**
218
+ * How often to show ticks. Relative to the step so that a tick always appears on a step.
219
+ * Ex: Tick interval of 4 with a step of 3 will draw a tick every 4 steps (every 12 values).
220
+ */
221
+ get tickInterval() { return this._tickInterval; }
222
+ set tickInterval(value) {
223
+ if (value === 'auto') {
224
+ this._tickInterval = 'auto';
225
+ }
226
+ else if (typeof value === 'number' || typeof value === 'string') {
227
+ this._tickInterval = coerceNumberProperty(value, this._tickInterval);
228
+ }
229
+ else {
230
+ this._tickInterval = 0;
528
231
  }
529
- /** Increments the slider by the given number of steps (negative number decrements). */
530
- _increment(numSteps) {
531
- this.value = this._clamp((this.value || 0) + this.step * numSteps, this.min, this.max);
232
+ }
233
+ /** Value of the slider. */
234
+ get value() {
235
+ // If the value needs to be read and it is still uninitialized, initialize it to the min.
236
+ if (this._value === null) {
237
+ this.value = this._min;
532
238
  }
533
- /** Calculate the new value from the new physical location. The value will always be snapped. */
534
- _updateValueFromPosition(pos) {
535
- if (!this._sliderDimensions) {
536
- return;
537
- }
538
- let offset = this.vertical ? this._sliderDimensions.top : this._sliderDimensions.left;
539
- let size = this.vertical ? this._sliderDimensions.height : this._sliderDimensions.width;
540
- let posComponent = this.vertical ? pos.y : pos.x;
541
- // The exact value is calculated from the event and used to find the closest snap value.
542
- let percent = this._clamp((posComponent - offset) / size);
543
- if (this._shouldInvertMouseCoords()) {
544
- percent = 1 - percent;
545
- }
546
- // Since the steps may not divide cleanly into the max value, if the user
547
- // slid to 0 or 100 percent, we jump to the min/max value. This approach
548
- // is slightly more intuitive than using `Math.ceil` below, because it
549
- // follows the user's pointer closer.
550
- if (percent === 0) {
551
- this.value = this.min;
552
- }
553
- else if (percent === 1) {
554
- this.value = this.max;
555
- }
556
- else {
557
- const exactValue = this._calculateValue(percent);
558
- // This calculation finds the closest step by finding the closest
559
- // whole number divisible by the step relative to the min.
560
- const closestValue = Math.round((exactValue - this.min) / this.step) * this.step + this.min;
561
- // The value needs to snap to the min and max.
562
- this.value = this._clamp(closestValue, this.min, this.max);
239
+ return this._value;
240
+ }
241
+ set value(v) {
242
+ if (v !== this._value) {
243
+ let value = coerceNumberProperty(v);
244
+ // While incrementing by a decimal we can end up with values like 33.300000000000004.
245
+ // Truncate it to ensure that it matches the label and to make it easier to work with.
246
+ if (this._roundToDecimal) {
247
+ value = parseFloat(value.toFixed(this._roundToDecimal));
563
248
  }
249
+ this._value = value;
250
+ this._percent = this._calculatePercentage(this._value);
251
+ // Since this also modifies the percentage, we need to let the change detection know.
252
+ this._changeDetectorRef.markForCheck();
564
253
  }
565
- /** Emits a change event if the current value is different from the last emitted value. */
566
- _emitChangeEvent() {
567
- this._controlValueAccessorChangeFn(this.value);
568
- this.valueChange.emit(this.value);
569
- this.change.emit(this._createChangeEvent());
570
- }
571
- /** Emits an input event when the current value is different from the last emitted value. */
572
- _emitInputEvent() {
573
- this.input.emit(this._createChangeEvent());
574
- }
575
- /** Updates the amount of space between ticks as a percentage of the width of the slider. */
576
- _updateTickIntervalPercent() {
577
- if (!this.tickInterval || !this._sliderDimensions) {
578
- return;
579
- }
580
- if (this.tickInterval == 'auto') {
581
- let trackSize = this.vertical ? this._sliderDimensions.height : this._sliderDimensions.width;
582
- let pixelsPerStep = trackSize * this.step / (this.max - this.min);
583
- let stepsPerTick = Math.ceil(MIN_AUTO_TICK_SEPARATION / pixelsPerStep);
584
- let pixelsPerTick = stepsPerTick * this.step;
585
- this._tickIntervalPercent = pixelsPerTick / trackSize;
254
+ }
255
+ /** Whether the slider is vertical. */
256
+ get vertical() { return this._vertical; }
257
+ set vertical(value) {
258
+ this._vertical = coerceBooleanProperty(value);
259
+ }
260
+ /** The value to be used for display purposes. */
261
+ get displayValue() {
262
+ if (this.displayWith) {
263
+ // Value is never null but since setters and getters cannot have
264
+ // different types, the value getter is also typed to return null.
265
+ return this.displayWith(this.value);
266
+ }
267
+ // Note that this could be improved further by rounding something like 0.999 to 1 or
268
+ // 0.899 to 0.9, however it is very performance sensitive, because it gets called on
269
+ // every change detection cycle.
270
+ if (this._roundToDecimal && this.value && this.value % 1 !== 0) {
271
+ return this.value.toFixed(this._roundToDecimal);
272
+ }
273
+ return this.value || 0;
274
+ }
275
+ /** set focus to the host element */
276
+ focus(options) {
277
+ this._focusHostElement(options);
278
+ }
279
+ /** blur the host element */
280
+ blur() {
281
+ this._blurHostElement();
282
+ }
283
+ /** The percentage of the slider that coincides with the value. */
284
+ get percent() { return this._clamp(this._percent); }
285
+ /**
286
+ * Whether the axis of the slider is inverted.
287
+ * (i.e. whether moving the thumb in the positive x or y direction decreases the slider's value).
288
+ */
289
+ get _invertAxis() {
290
+ // Standard non-inverted mode for a vertical slider should be dragging the thumb from bottom to
291
+ // top. However from a y-axis standpoint this is inverted.
292
+ return this.vertical ? !this.invert : this.invert;
293
+ }
294
+ /** Whether the slider is at its minimum value. */
295
+ get _isMinValue() {
296
+ return this.percent === 0;
297
+ }
298
+ /**
299
+ * The amount of space to leave between the slider thumb and the track fill & track background
300
+ * elements.
301
+ */
302
+ get _thumbGap() {
303
+ if (this.disabled) {
304
+ return DISABLED_THUMB_GAP;
305
+ }
306
+ if (this._isMinValue && !this.thumbLabel) {
307
+ return this._isActive ? MIN_VALUE_ACTIVE_THUMB_GAP : MIN_VALUE_NONACTIVE_THUMB_GAP;
308
+ }
309
+ return 0;
310
+ }
311
+ /** CSS styles for the track background element. */
312
+ get _trackBackgroundStyles() {
313
+ const axis = this.vertical ? 'Y' : 'X';
314
+ const scale = this.vertical ? `1, ${1 - this.percent}, 1` : `${1 - this.percent}, 1, 1`;
315
+ const sign = this._shouldInvertMouseCoords() ? '-' : '';
316
+ return {
317
+ // scale3d avoids some rendering issues in Chrome. See #12071.
318
+ transform: `translate${axis}(${sign}${this._thumbGap}px) scale3d(${scale})`
319
+ };
320
+ }
321
+ /** CSS styles for the track fill element. */
322
+ get _trackFillStyles() {
323
+ const percent = this.percent;
324
+ const axis = this.vertical ? 'Y' : 'X';
325
+ const scale = this.vertical ? `1, ${percent}, 1` : `${percent}, 1, 1`;
326
+ const sign = this._shouldInvertMouseCoords() ? '' : '-';
327
+ return {
328
+ // scale3d avoids some rendering issues in Chrome. See #12071.
329
+ transform: `translate${axis}(${sign}${this._thumbGap}px) scale3d(${scale})`,
330
+ // iOS Safari has a bug where it won't re-render elements which start of as `scale(0)` until
331
+ // something forces a style recalculation on it. Since we'll end up with `scale(0)` when
332
+ // the value of the slider is 0, we can easily get into this situation. We force a
333
+ // recalculation by changing the element's `display` when it goes from 0 to any other value.
334
+ display: percent === 0 ? 'none' : ''
335
+ };
336
+ }
337
+ /** CSS styles for the ticks container element. */
338
+ get _ticksContainerStyles() {
339
+ let axis = this.vertical ? 'Y' : 'X';
340
+ // For a horizontal slider in RTL languages we push the ticks container off the left edge
341
+ // instead of the right edge to avoid causing a horizontal scrollbar to appear.
342
+ let sign = !this.vertical && this._getDirection() == 'rtl' ? '' : '-';
343
+ let offset = this._tickIntervalPercent / 2 * 100;
344
+ return {
345
+ 'transform': `translate${axis}(${sign}${offset}%)`
346
+ };
347
+ }
348
+ /** CSS styles for the ticks element. */
349
+ get _ticksStyles() {
350
+ let tickSize = this._tickIntervalPercent * 100;
351
+ let backgroundSize = this.vertical ? `2px ${tickSize}%` : `${tickSize}% 2px`;
352
+ let axis = this.vertical ? 'Y' : 'X';
353
+ // Depending on the direction we pushed the ticks container, push the ticks the opposite
354
+ // direction to re-center them but clip off the end edge. In RTL languages we need to flip the
355
+ // ticks 180 degrees so we're really cutting off the end edge abd not the start.
356
+ let sign = !this.vertical && this._getDirection() == 'rtl' ? '-' : '';
357
+ let rotate = !this.vertical && this._getDirection() == 'rtl' ? ' rotate(180deg)' : '';
358
+ let styles = {
359
+ 'backgroundSize': backgroundSize,
360
+ // Without translateZ ticks sometimes jitter as the slider moves on Chrome & Firefox.
361
+ 'transform': `translateZ(0) translate${axis}(${sign}${tickSize / 2}%)${rotate}`
362
+ };
363
+ if (this._isMinValue && this._thumbGap) {
364
+ let side;
365
+ if (this.vertical) {
366
+ side = this._invertAxis ? 'Bottom' : 'Top';
586
367
  }
587
368
  else {
588
- this._tickIntervalPercent = this.tickInterval * this.step / (this.max - this.min);
369
+ side = this._invertAxis ? 'Right' : 'Left';
589
370
  }
371
+ styles[`padding${side}`] = `${this._thumbGap}px`;
590
372
  }
591
- /** Creates a slider change object from the specified value. */
592
- _createChangeEvent(value = this.value) {
593
- let event = new MatSliderChange();
594
- event.source = this;
595
- event.value = value;
596
- return event;
597
- }
598
- /** Calculates the percentage of the slider that a value is. */
599
- _calculatePercentage(value) {
600
- return ((value || 0) - this.min) / (this.max - this.min);
601
- }
602
- /** Calculates the value a percentage of the slider corresponds to. */
603
- _calculateValue(percentage) {
604
- return this.min + percentage * (this.max - this.min);
373
+ return styles;
374
+ }
375
+ get _thumbContainerStyles() {
376
+ let axis = this.vertical ? 'Y' : 'X';
377
+ // For a horizontal slider in RTL languages we push the thumb container off the left edge
378
+ // instead of the right edge to avoid causing a horizontal scrollbar to appear.
379
+ let invertOffset = (this._getDirection() == 'rtl' && !this.vertical) ? !this._invertAxis : this._invertAxis;
380
+ let offset = (invertOffset ? this.percent : 1 - this.percent) * 100;
381
+ return {
382
+ 'transform': `translate${axis}(-${offset}%)`
383
+ };
384
+ }
385
+ /**
386
+ * Whether mouse events should be converted to a slider position by calculating their distance
387
+ * from the right or bottom edge of the slider as opposed to the top or left.
388
+ */
389
+ _shouldInvertMouseCoords() {
390
+ return (this._getDirection() == 'rtl' && !this.vertical) ? !this._invertAxis : this._invertAxis;
391
+ }
392
+ /** The language direction for this slider element. */
393
+ _getDirection() {
394
+ return (this._dir && this._dir.value == 'rtl') ? 'rtl' : 'ltr';
395
+ }
396
+ ngAfterViewInit() {
397
+ this._focusMonitor
398
+ .monitor(this._elementRef, true)
399
+ .subscribe((origin) => {
400
+ this._isActive = !!origin && origin !== 'keyboard';
401
+ this._changeDetectorRef.detectChanges();
402
+ });
403
+ if (this._dir) {
404
+ this._dirChangeSubscription = this._dir.change.subscribe(() => {
405
+ this._changeDetectorRef.markForCheck();
406
+ });
605
407
  }
606
- /** Return a number between two numbers. */
607
- _clamp(value, min = 0, max = 1) {
608
- return Math.max(min, Math.min(value, max));
408
+ }
409
+ ngOnDestroy() {
410
+ const element = this._elementRef.nativeElement;
411
+ element.removeEventListener('mousedown', this._pointerDown, activeEventOptions);
412
+ element.removeEventListener('touchstart', this._pointerDown, activeEventOptions);
413
+ this._lastPointerEvent = null;
414
+ this._removeGlobalEvents();
415
+ this._focusMonitor.stopMonitoring(this._elementRef);
416
+ this._dirChangeSubscription.unsubscribe();
417
+ }
418
+ _onMouseenter() {
419
+ if (this.disabled) {
420
+ return;
421
+ }
422
+ // We save the dimensions of the slider here so we can use them to update the spacing of the
423
+ // ticks and determine where on the slider click and slide events happen.
424
+ this._sliderDimensions = this._getSliderDimensions();
425
+ this._updateTickIntervalPercent();
426
+ }
427
+ _onFocus() {
428
+ // We save the dimensions of the slider here so we can use them to update the spacing of the
429
+ // ticks and determine where on the slider click and slide events happen.
430
+ this._sliderDimensions = this._getSliderDimensions();
431
+ this._updateTickIntervalPercent();
432
+ }
433
+ _onBlur() {
434
+ this.onTouched();
435
+ }
436
+ _onKeydown(event) {
437
+ if (this.disabled || hasModifierKey(event)) {
438
+ return;
439
+ }
440
+ const oldValue = this.value;
441
+ switch (event.keyCode) {
442
+ case PAGE_UP:
443
+ this._increment(10);
444
+ break;
445
+ case PAGE_DOWN:
446
+ this._increment(-10);
447
+ break;
448
+ case END:
449
+ this.value = this.max;
450
+ break;
451
+ case HOME:
452
+ this.value = this.min;
453
+ break;
454
+ case LEFT_ARROW:
455
+ // NOTE: For a sighted user it would make more sense that when they press an arrow key on an
456
+ // inverted slider the thumb moves in that direction. However for a blind user, nothing
457
+ // about the slider indicates that it is inverted. They will expect left to be decrement,
458
+ // regardless of how it appears on the screen. For speakers ofRTL languages, they probably
459
+ // expect left to mean increment. Therefore we flip the meaning of the side arrow keys for
460
+ // RTL. For inverted sliders we prefer a good a11y experience to having it "look right" for
461
+ // sighted users, therefore we do not swap the meaning.
462
+ this._increment(this._getDirection() == 'rtl' ? 1 : -1);
463
+ break;
464
+ case UP_ARROW:
465
+ this._increment(1);
466
+ break;
467
+ case RIGHT_ARROW:
468
+ // See comment on LEFT_ARROW about the conditions under which we flip the meaning.
469
+ this._increment(this._getDirection() == 'rtl' ? -1 : 1);
470
+ break;
471
+ case DOWN_ARROW:
472
+ this._increment(-1);
473
+ break;
474
+ default:
475
+ // Return if the key is not one that we explicitly handle to avoid calling preventDefault on
476
+ // it.
477
+ return;
609
478
  }
610
- /**
611
- * Get the bounding client rect of the slider track element.
612
- * The track is used rather than the native element to ignore the extra space that the thumb can
613
- * take up.
614
- */
615
- _getSliderDimensions() {
616
- return this._sliderWrapper ? this._sliderWrapper.nativeElement.getBoundingClientRect() : null;
479
+ if (oldValue != this.value) {
480
+ this._emitInputEvent();
481
+ this._emitChangeEvent();
617
482
  }
618
- /**
619
- * Focuses the native element.
620
- * Currently only used to allow a blur event to fire but will be used with keyboard input later.
621
- */
622
- _focusHostElement(options) {
623
- this._elementRef.nativeElement.focus(options);
483
+ this._isSliding = true;
484
+ event.preventDefault();
485
+ }
486
+ _onKeyup() {
487
+ this._isSliding = false;
488
+ }
489
+ /** Use defaultView of injected document if available or fallback to global window reference */
490
+ _getWindow() {
491
+ return this._document.defaultView || window;
492
+ }
493
+ /**
494
+ * Binds our global move and end events. They're bound at the document level and only while
495
+ * dragging so that the user doesn't have to keep their pointer exactly over the slider
496
+ * as they're swiping across the screen.
497
+ */
498
+ _bindGlobalEvents(triggerEvent) {
499
+ // Note that we bind the events to the `document`, because it allows us to capture
500
+ // drag cancel events where the user's pointer is outside the browser window.
501
+ const document = this._document;
502
+ const isTouch = isTouchEvent(triggerEvent);
503
+ const moveEventName = isTouch ? 'touchmove' : 'mousemove';
504
+ const endEventName = isTouch ? 'touchend' : 'mouseup';
505
+ document.addEventListener(moveEventName, this._pointerMove, activeEventOptions);
506
+ document.addEventListener(endEventName, this._pointerUp, activeEventOptions);
507
+ if (isTouch) {
508
+ document.addEventListener('touchcancel', this._pointerUp, activeEventOptions);
509
+ }
510
+ const window = this._getWindow();
511
+ if (typeof window !== 'undefined' && window) {
512
+ window.addEventListener('blur', this._windowBlur);
624
513
  }
625
- /** Blurs the native element. */
626
- _blurHostElement() {
627
- this._elementRef.nativeElement.blur();
514
+ }
515
+ /** Removes any global event listeners that we may have added. */
516
+ _removeGlobalEvents() {
517
+ const document = this._document;
518
+ document.removeEventListener('mousemove', this._pointerMove, activeEventOptions);
519
+ document.removeEventListener('mouseup', this._pointerUp, activeEventOptions);
520
+ document.removeEventListener('touchmove', this._pointerMove, activeEventOptions);
521
+ document.removeEventListener('touchend', this._pointerUp, activeEventOptions);
522
+ document.removeEventListener('touchcancel', this._pointerUp, activeEventOptions);
523
+ const window = this._getWindow();
524
+ if (typeof window !== 'undefined' && window) {
525
+ window.removeEventListener('blur', this._windowBlur);
628
526
  }
629
- /**
630
- * Sets the model value. Implemented as part of ControlValueAccessor.
631
- * @param value
632
- */
633
- writeValue(value) {
634
- this.value = value;
527
+ }
528
+ /** Increments the slider by the given number of steps (negative number decrements). */
529
+ _increment(numSteps) {
530
+ this.value = this._clamp((this.value || 0) + this.step * numSteps, this.min, this.max);
531
+ }
532
+ /** Calculate the new value from the new physical location. The value will always be snapped. */
533
+ _updateValueFromPosition(pos) {
534
+ if (!this._sliderDimensions) {
535
+ return;
536
+ }
537
+ let offset = this.vertical ? this._sliderDimensions.top : this._sliderDimensions.left;
538
+ let size = this.vertical ? this._sliderDimensions.height : this._sliderDimensions.width;
539
+ let posComponent = this.vertical ? pos.y : pos.x;
540
+ // The exact value is calculated from the event and used to find the closest snap value.
541
+ let percent = this._clamp((posComponent - offset) / size);
542
+ if (this._shouldInvertMouseCoords()) {
543
+ percent = 1 - percent;
544
+ }
545
+ // Since the steps may not divide cleanly into the max value, if the user
546
+ // slid to 0 or 100 percent, we jump to the min/max value. This approach
547
+ // is slightly more intuitive than using `Math.ceil` below, because it
548
+ // follows the user's pointer closer.
549
+ if (percent === 0) {
550
+ this.value = this.min;
551
+ }
552
+ else if (percent === 1) {
553
+ this.value = this.max;
554
+ }
555
+ else {
556
+ const exactValue = this._calculateValue(percent);
557
+ // This calculation finds the closest step by finding the closest
558
+ // whole number divisible by the step relative to the min.
559
+ const closestValue = Math.round((exactValue - this.min) / this.step) * this.step + this.min;
560
+ // The value needs to snap to the min and max.
561
+ this.value = this._clamp(closestValue, this.min, this.max);
635
562
  }
636
- /**
637
- * Registers a callback to be triggered when the value has changed.
638
- * Implemented as part of ControlValueAccessor.
639
- * @param fn Callback to be registered.
640
- */
641
- registerOnChange(fn) {
642
- this._controlValueAccessorChangeFn = fn;
563
+ }
564
+ /** Emits a change event if the current value is different from the last emitted value. */
565
+ _emitChangeEvent() {
566
+ this._controlValueAccessorChangeFn(this.value);
567
+ this.valueChange.emit(this.value);
568
+ this.change.emit(this._createChangeEvent());
569
+ }
570
+ /** Emits an input event when the current value is different from the last emitted value. */
571
+ _emitInputEvent() {
572
+ this.input.emit(this._createChangeEvent());
573
+ }
574
+ /** Updates the amount of space between ticks as a percentage of the width of the slider. */
575
+ _updateTickIntervalPercent() {
576
+ if (!this.tickInterval || !this._sliderDimensions) {
577
+ return;
643
578
  }
644
- /**
645
- * Registers a callback to be triggered when the component is touched.
646
- * Implemented as part of ControlValueAccessor.
647
- * @param fn Callback to be registered.
648
- */
649
- registerOnTouched(fn) {
650
- this.onTouched = fn;
579
+ if (this.tickInterval == 'auto') {
580
+ let trackSize = this.vertical ? this._sliderDimensions.height : this._sliderDimensions.width;
581
+ let pixelsPerStep = trackSize * this.step / (this.max - this.min);
582
+ let stepsPerTick = Math.ceil(MIN_AUTO_TICK_SEPARATION / pixelsPerStep);
583
+ let pixelsPerTick = stepsPerTick * this.step;
584
+ this._tickIntervalPercent = pixelsPerTick / trackSize;
651
585
  }
652
- /**
653
- * Sets whether the component should be disabled.
654
- * Implemented as part of ControlValueAccessor.
655
- * @param isDisabled
656
- */
657
- setDisabledState(isDisabled) {
658
- this.disabled = isDisabled;
586
+ else {
587
+ this._tickIntervalPercent = this.tickInterval * this.step / (this.max - this.min);
659
588
  }
660
589
  }
661
- MatSlider.decorators = [
662
- { type: Component, args: [{
663
- selector: 'mat-slider',
664
- exportAs: 'matSlider',
665
- providers: [MAT_SLIDER_VALUE_ACCESSOR],
666
- host: {
667
- '(focus)': '_onFocus()',
668
- '(blur)': '_onBlur()',
669
- '(keydown)': '_onKeydown($event)',
670
- '(keyup)': '_onKeyup()',
671
- '(mouseenter)': '_onMouseenter()',
672
- // On Safari starting to slide temporarily triggers text selection mode which
673
- // show the wrong cursor. We prevent it by stopping the `selectstart` event.
674
- '(selectstart)': '$event.preventDefault()',
675
- 'class': 'mat-slider mat-focus-indicator',
676
- 'role': 'slider',
677
- '[tabIndex]': 'tabIndex',
678
- '[attr.aria-disabled]': 'disabled',
679
- '[attr.aria-valuemax]': 'max',
680
- '[attr.aria-valuemin]': 'min',
681
- '[attr.aria-valuenow]': 'value',
682
- '[attr.aria-orientation]': 'vertical ? "vertical" : "horizontal"',
683
- '[class.mat-slider-disabled]': 'disabled',
684
- '[class.mat-slider-has-ticks]': 'tickInterval',
685
- '[class.mat-slider-horizontal]': '!vertical',
686
- '[class.mat-slider-axis-inverted]': '_invertAxis',
687
- // Class binding which is only used by the test harness as there is no other
688
- // way for the harness to detect if mouse coordinates need to be inverted.
689
- '[class.mat-slider-invert-mouse-coords]': '_shouldInvertMouseCoords()',
690
- '[class.mat-slider-sliding]': '_isSliding',
691
- '[class.mat-slider-thumb-label-showing]': 'thumbLabel',
692
- '[class.mat-slider-vertical]': 'vertical',
693
- '[class.mat-slider-min-value]': '_isMinValue',
694
- '[class.mat-slider-hide-last-tick]': 'disabled || _isMinValue && _thumbGap && _invertAxis',
695
- '[class._mat-animation-noopable]': '_animationMode === "NoopAnimations"',
696
- },
697
- template: "<div class=\"mat-slider-wrapper\" #sliderWrapper>\n <div class=\"mat-slider-track-wrapper\">\n <div class=\"mat-slider-track-background\" [ngStyle]=\"_trackBackgroundStyles\"></div>\n <div class=\"mat-slider-track-fill\" [ngStyle]=\"_trackFillStyles\"></div>\n </div>\n <div class=\"mat-slider-ticks-container\" [ngStyle]=\"_ticksContainerStyles\">\n <div class=\"mat-slider-ticks\" [ngStyle]=\"_ticksStyles\"></div>\n </div>\n <div class=\"mat-slider-thumb-container\" [ngStyle]=\"_thumbContainerStyles\">\n <div class=\"mat-slider-focus-ring\"></div>\n <div class=\"mat-slider-thumb\"></div>\n <div class=\"mat-slider-thumb-label\">\n <span class=\"mat-slider-thumb-label-text\">{{displayValue}}</span>\n </div>\n </div>\n</div>\n",
698
- inputs: ['disabled', 'color', 'tabIndex'],
699
- encapsulation: ViewEncapsulation.None,
700
- changeDetection: ChangeDetectionStrategy.OnPush,
701
- styles: [".mat-slider{display:inline-block;position:relative;box-sizing:border-box;padding:8px;outline:none;vertical-align:middle}.mat-slider:not(.mat-slider-disabled):active,.mat-slider.mat-slider-sliding:not(.mat-slider-disabled){cursor:-webkit-grabbing;cursor:grabbing}.mat-slider-wrapper{position:absolute}.mat-slider-track-wrapper{position:absolute;top:0;left:0;overflow:hidden}.mat-slider-track-fill{position:absolute;transform-origin:0 0;transition:transform 400ms cubic-bezier(0.25, 0.8, 0.25, 1),background-color 400ms cubic-bezier(0.25, 0.8, 0.25, 1)}.mat-slider-track-background{position:absolute;transform-origin:100% 100%;transition:transform 400ms cubic-bezier(0.25, 0.8, 0.25, 1),background-color 400ms cubic-bezier(0.25, 0.8, 0.25, 1)}.mat-slider-ticks-container{position:absolute;left:0;top:0;overflow:hidden}.mat-slider-ticks{background-repeat:repeat;background-clip:content-box;box-sizing:border-box;opacity:0;transition:opacity 400ms cubic-bezier(0.25, 0.8, 0.25, 1)}.mat-slider-thumb-container{position:absolute;z-index:1;transition:transform 400ms cubic-bezier(0.25, 0.8, 0.25, 1)}.mat-slider-focus-ring{position:absolute;width:30px;height:30px;border-radius:50%;transform:scale(0);opacity:0;transition:transform 400ms cubic-bezier(0.25, 0.8, 0.25, 1),background-color 400ms cubic-bezier(0.25, 0.8, 0.25, 1),opacity 400ms cubic-bezier(0.25, 0.8, 0.25, 1)}.mat-slider.cdk-keyboard-focused .mat-slider-focus-ring,.mat-slider.cdk-program-focused .mat-slider-focus-ring{transform:scale(1);opacity:1}.mat-slider:not(.mat-slider-disabled):not(.mat-slider-sliding) .mat-slider-thumb-label,.mat-slider:not(.mat-slider-disabled):not(.mat-slider-sliding) .mat-slider-thumb{cursor:-webkit-grab;cursor:grab}.mat-slider-thumb{position:absolute;right:-10px;bottom:-10px;box-sizing:border-box;width:20px;height:20px;border:3px solid transparent;border-radius:50%;transform:scale(0.7);transition:transform 400ms cubic-bezier(0.25, 0.8, 0.25, 1),background-color 400ms cubic-bezier(0.25, 0.8, 0.25, 1),border-color 400ms cubic-bezier(0.25, 0.8, 0.25, 1)}.mat-slider-thumb-label{display:none;align-items:center;justify-content:center;position:absolute;width:28px;height:28px;border-radius:50%;transition:transform 400ms cubic-bezier(0.25, 0.8, 0.25, 1),border-radius 400ms cubic-bezier(0.25, 0.8, 0.25, 1),background-color 400ms cubic-bezier(0.25, 0.8, 0.25, 1)}.cdk-high-contrast-active .mat-slider-thumb-label{outline:solid 1px}.mat-slider-thumb-label-text{z-index:1;opacity:0;transition:opacity 400ms cubic-bezier(0.25, 0.8, 0.25, 1)}.mat-slider-sliding .mat-slider-track-fill,.mat-slider-sliding .mat-slider-track-background,.mat-slider-sliding .mat-slider-thumb-container{transition-duration:0ms}.mat-slider-has-ticks .mat-slider-wrapper::after{content:\"\";position:absolute;border-width:0;border-style:solid;opacity:0;transition:opacity 400ms cubic-bezier(0.25, 0.8, 0.25, 1)}.mat-slider-has-ticks.cdk-focused:not(.mat-slider-hide-last-tick) .mat-slider-wrapper::after,.mat-slider-has-ticks:hover:not(.mat-slider-hide-last-tick) .mat-slider-wrapper::after{opacity:1}.mat-slider-has-ticks.cdk-focused:not(.mat-slider-disabled) .mat-slider-ticks,.mat-slider-has-ticks:hover:not(.mat-slider-disabled) .mat-slider-ticks{opacity:1}.mat-slider-thumb-label-showing .mat-slider-focus-ring{display:none}.mat-slider-thumb-label-showing .mat-slider-thumb-label{display:flex}.mat-slider-axis-inverted .mat-slider-track-fill{transform-origin:100% 100%}.mat-slider-axis-inverted .mat-slider-track-background{transform-origin:0 0}.mat-slider:not(.mat-slider-disabled).cdk-focused.mat-slider-thumb-label-showing .mat-slider-thumb{transform:scale(0)}.mat-slider:not(.mat-slider-disabled).cdk-focused .mat-slider-thumb-label{border-radius:50% 50% 0}.mat-slider:not(.mat-slider-disabled).cdk-focused .mat-slider-thumb-label-text{opacity:1}.mat-slider:not(.mat-slider-disabled).cdk-mouse-focused .mat-slider-thumb,.mat-slider:not(.mat-slider-disabled).cdk-touch-focused .mat-slider-thumb,.mat-slider:not(.mat-slider-disabled).cdk-program-focused .mat-slider-thumb{border-width:2px;transform:scale(1)}.mat-slider-disabled .mat-slider-focus-ring{transform:scale(0);opacity:0}.mat-slider-disabled .mat-slider-thumb{border-width:4px;transform:scale(0.5)}.mat-slider-disabled .mat-slider-thumb-label{display:none}.mat-slider-horizontal{height:48px;min-width:128px}.mat-slider-horizontal .mat-slider-wrapper{height:2px;top:23px;left:8px;right:8px}.mat-slider-horizontal .mat-slider-wrapper::after{height:2px;border-left-width:2px;right:0;top:0}.mat-slider-horizontal .mat-slider-track-wrapper{height:2px;width:100%}.mat-slider-horizontal .mat-slider-track-fill{height:2px;width:100%;transform:scaleX(0)}.mat-slider-horizontal .mat-slider-track-background{height:2px;width:100%;transform:scaleX(1)}.mat-slider-horizontal .mat-slider-ticks-container{height:2px;width:100%}.cdk-high-contrast-active .mat-slider-horizontal .mat-slider-ticks-container{height:0;outline:solid 2px;top:1px}.mat-slider-horizontal .mat-slider-ticks{height:2px;width:100%}.mat-slider-horizontal .mat-slider-thumb-container{width:100%;height:0;top:50%}.mat-slider-horizontal .mat-slider-focus-ring{top:-15px;right:-15px}.mat-slider-horizontal .mat-slider-thumb-label{right:-14px;top:-40px;transform:translateY(26px) scale(0.01) rotate(45deg)}.mat-slider-horizontal .mat-slider-thumb-label-text{transform:rotate(-45deg)}.mat-slider-horizontal.cdk-focused .mat-slider-thumb-label{transform:rotate(45deg)}.cdk-high-contrast-active .mat-slider-horizontal.cdk-focused .mat-slider-thumb-label,.cdk-high-contrast-active .mat-slider-horizontal.cdk-focused .mat-slider-thumb-label-text{transform:none}.mat-slider-vertical{width:48px;min-height:128px}.mat-slider-vertical .mat-slider-wrapper{width:2px;top:8px;bottom:8px;left:23px}.mat-slider-vertical .mat-slider-wrapper::after{width:2px;border-top-width:2px;bottom:0;left:0}.mat-slider-vertical .mat-slider-track-wrapper{height:100%;width:2px}.mat-slider-vertical .mat-slider-track-fill{height:100%;width:2px;transform:scaleY(0)}.mat-slider-vertical .mat-slider-track-background{height:100%;width:2px;transform:scaleY(1)}.mat-slider-vertical .mat-slider-ticks-container{width:2px;height:100%}.cdk-high-contrast-active .mat-slider-vertical .mat-slider-ticks-container{width:0;outline:solid 2px;left:1px}.mat-slider-vertical .mat-slider-focus-ring{bottom:-15px;left:-15px}.mat-slider-vertical .mat-slider-ticks{width:2px;height:100%}.mat-slider-vertical .mat-slider-thumb-container{height:100%;width:0;left:50%}.mat-slider-vertical .mat-slider-thumb{-webkit-backface-visibility:hidden;backface-visibility:hidden}.mat-slider-vertical .mat-slider-thumb-label{bottom:-14px;left:-40px;transform:translateX(26px) scale(0.01) rotate(-45deg)}.mat-slider-vertical .mat-slider-thumb-label-text{transform:rotate(45deg)}.mat-slider-vertical.cdk-focused .mat-slider-thumb-label{transform:rotate(-45deg)}[dir=rtl] .mat-slider-wrapper::after{left:0;right:auto}[dir=rtl] .mat-slider-horizontal .mat-slider-track-fill{transform-origin:100% 100%}[dir=rtl] .mat-slider-horizontal .mat-slider-track-background{transform-origin:0 0}[dir=rtl] .mat-slider-horizontal.mat-slider-axis-inverted .mat-slider-track-fill{transform-origin:0 0}[dir=rtl] .mat-slider-horizontal.mat-slider-axis-inverted .mat-slider-track-background{transform-origin:100% 100%}.mat-slider._mat-animation-noopable .mat-slider-track-fill,.mat-slider._mat-animation-noopable .mat-slider-track-background,.mat-slider._mat-animation-noopable .mat-slider-ticks,.mat-slider._mat-animation-noopable .mat-slider-thumb-container,.mat-slider._mat-animation-noopable .mat-slider-focus-ring,.mat-slider._mat-animation-noopable .mat-slider-thumb,.mat-slider._mat-animation-noopable .mat-slider-thumb-label,.mat-slider._mat-animation-noopable .mat-slider-thumb-label-text,.mat-slider._mat-animation-noopable .mat-slider-has-ticks .mat-slider-wrapper::after{transition:none}\n"]
702
- },] }
703
- ];
704
- MatSlider.ctorParameters = () => [
705
- { type: ElementRef },
706
- { type: FocusMonitor },
707
- { type: ChangeDetectorRef },
708
- { type: Directionality, decorators: [{ type: Optional }] },
709
- { type: String, decorators: [{ type: Attribute, args: ['tabindex',] }] },
710
- { type: NgZone },
711
- { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] },
712
- { type: String, decorators: [{ type: Optional }, { type: Inject, args: [ANIMATION_MODULE_TYPE,] }] }
713
- ];
714
- MatSlider.propDecorators = {
715
- invert: [{ type: Input }],
716
- max: [{ type: Input }],
717
- min: [{ type: Input }],
718
- step: [{ type: Input }],
719
- thumbLabel: [{ type: Input }],
720
- tickInterval: [{ type: Input }],
721
- value: [{ type: Input }],
722
- displayWith: [{ type: Input }],
723
- vertical: [{ type: Input }],
724
- change: [{ type: Output }],
725
- input: [{ type: Output }],
726
- valueChange: [{ type: Output }],
727
- _sliderWrapper: [{ type: ViewChild, args: ['sliderWrapper',] }]
728
- };
729
- return MatSlider;
730
- })();
590
+ /** Creates a slider change object from the specified value. */
591
+ _createChangeEvent(value = this.value) {
592
+ let event = new MatSliderChange();
593
+ event.source = this;
594
+ event.value = value;
595
+ return event;
596
+ }
597
+ /** Calculates the percentage of the slider that a value is. */
598
+ _calculatePercentage(value) {
599
+ return ((value || 0) - this.min) / (this.max - this.min);
600
+ }
601
+ /** Calculates the value a percentage of the slider corresponds to. */
602
+ _calculateValue(percentage) {
603
+ return this.min + percentage * (this.max - this.min);
604
+ }
605
+ /** Return a number between two numbers. */
606
+ _clamp(value, min = 0, max = 1) {
607
+ return Math.max(min, Math.min(value, max));
608
+ }
609
+ /**
610
+ * Get the bounding client rect of the slider track element.
611
+ * The track is used rather than the native element to ignore the extra space that the thumb can
612
+ * take up.
613
+ */
614
+ _getSliderDimensions() {
615
+ return this._sliderWrapper ? this._sliderWrapper.nativeElement.getBoundingClientRect() : null;
616
+ }
617
+ /**
618
+ * Focuses the native element.
619
+ * Currently only used to allow a blur event to fire but will be used with keyboard input later.
620
+ */
621
+ _focusHostElement(options) {
622
+ this._elementRef.nativeElement.focus(options);
623
+ }
624
+ /** Blurs the native element. */
625
+ _blurHostElement() {
626
+ this._elementRef.nativeElement.blur();
627
+ }
628
+ /**
629
+ * Sets the model value. Implemented as part of ControlValueAccessor.
630
+ * @param value
631
+ */
632
+ writeValue(value) {
633
+ this.value = value;
634
+ }
635
+ /**
636
+ * Registers a callback to be triggered when the value has changed.
637
+ * Implemented as part of ControlValueAccessor.
638
+ * @param fn Callback to be registered.
639
+ */
640
+ registerOnChange(fn) {
641
+ this._controlValueAccessorChangeFn = fn;
642
+ }
643
+ /**
644
+ * Registers a callback to be triggered when the component is touched.
645
+ * Implemented as part of ControlValueAccessor.
646
+ * @param fn Callback to be registered.
647
+ */
648
+ registerOnTouched(fn) {
649
+ this.onTouched = fn;
650
+ }
651
+ /**
652
+ * Sets whether the component should be disabled.
653
+ * Implemented as part of ControlValueAccessor.
654
+ * @param isDisabled
655
+ */
656
+ setDisabledState(isDisabled) {
657
+ this.disabled = isDisabled;
658
+ }
659
+ }
660
+ MatSlider.decorators = [
661
+ { type: Component, args: [{
662
+ selector: 'mat-slider',
663
+ exportAs: 'matSlider',
664
+ providers: [MAT_SLIDER_VALUE_ACCESSOR],
665
+ host: {
666
+ '(focus)': '_onFocus()',
667
+ '(blur)': '_onBlur()',
668
+ '(keydown)': '_onKeydown($event)',
669
+ '(keyup)': '_onKeyup()',
670
+ '(mouseenter)': '_onMouseenter()',
671
+ // On Safari starting to slide temporarily triggers text selection mode which
672
+ // show the wrong cursor. We prevent it by stopping the `selectstart` event.
673
+ '(selectstart)': '$event.preventDefault()',
674
+ 'class': 'mat-slider mat-focus-indicator',
675
+ 'role': 'slider',
676
+ '[tabIndex]': 'tabIndex',
677
+ '[attr.aria-disabled]': 'disabled',
678
+ '[attr.aria-valuemax]': 'max',
679
+ '[attr.aria-valuemin]': 'min',
680
+ '[attr.aria-valuenow]': 'value',
681
+ '[attr.aria-orientation]': 'vertical ? "vertical" : "horizontal"',
682
+ '[class.mat-slider-disabled]': 'disabled',
683
+ '[class.mat-slider-has-ticks]': 'tickInterval',
684
+ '[class.mat-slider-horizontal]': '!vertical',
685
+ '[class.mat-slider-axis-inverted]': '_invertAxis',
686
+ // Class binding which is only used by the test harness as there is no other
687
+ // way for the harness to detect if mouse coordinates need to be inverted.
688
+ '[class.mat-slider-invert-mouse-coords]': '_shouldInvertMouseCoords()',
689
+ '[class.mat-slider-sliding]': '_isSliding',
690
+ '[class.mat-slider-thumb-label-showing]': 'thumbLabel',
691
+ '[class.mat-slider-vertical]': 'vertical',
692
+ '[class.mat-slider-min-value]': '_isMinValue',
693
+ '[class.mat-slider-hide-last-tick]': 'disabled || _isMinValue && _thumbGap && _invertAxis',
694
+ '[class._mat-animation-noopable]': '_animationMode === "NoopAnimations"',
695
+ },
696
+ template: "<div class=\"mat-slider-wrapper\" #sliderWrapper>\n <div class=\"mat-slider-track-wrapper\">\n <div class=\"mat-slider-track-background\" [ngStyle]=\"_trackBackgroundStyles\"></div>\n <div class=\"mat-slider-track-fill\" [ngStyle]=\"_trackFillStyles\"></div>\n </div>\n <div class=\"mat-slider-ticks-container\" [ngStyle]=\"_ticksContainerStyles\">\n <div class=\"mat-slider-ticks\" [ngStyle]=\"_ticksStyles\"></div>\n </div>\n <div class=\"mat-slider-thumb-container\" [ngStyle]=\"_thumbContainerStyles\">\n <div class=\"mat-slider-focus-ring\"></div>\n <div class=\"mat-slider-thumb\"></div>\n <div class=\"mat-slider-thumb-label\">\n <span class=\"mat-slider-thumb-label-text\">{{displayValue}}</span>\n </div>\n </div>\n</div>\n",
697
+ inputs: ['disabled', 'color', 'tabIndex'],
698
+ encapsulation: ViewEncapsulation.None,
699
+ changeDetection: ChangeDetectionStrategy.OnPush,
700
+ styles: [".mat-slider{display:inline-block;position:relative;box-sizing:border-box;padding:8px;outline:none;vertical-align:middle}.mat-slider:not(.mat-slider-disabled):active,.mat-slider.mat-slider-sliding:not(.mat-slider-disabled){cursor:-webkit-grabbing;cursor:grabbing}.mat-slider-wrapper{position:absolute}.mat-slider-track-wrapper{position:absolute;top:0;left:0;overflow:hidden}.mat-slider-track-fill{position:absolute;transform-origin:0 0;transition:transform 400ms cubic-bezier(0.25, 0.8, 0.25, 1),background-color 400ms cubic-bezier(0.25, 0.8, 0.25, 1)}.mat-slider-track-background{position:absolute;transform-origin:100% 100%;transition:transform 400ms cubic-bezier(0.25, 0.8, 0.25, 1),background-color 400ms cubic-bezier(0.25, 0.8, 0.25, 1)}.mat-slider-ticks-container{position:absolute;left:0;top:0;overflow:hidden}.mat-slider-ticks{background-repeat:repeat;background-clip:content-box;box-sizing:border-box;opacity:0;transition:opacity 400ms cubic-bezier(0.25, 0.8, 0.25, 1)}.mat-slider-thumb-container{position:absolute;z-index:1;transition:transform 400ms cubic-bezier(0.25, 0.8, 0.25, 1)}.mat-slider-focus-ring{position:absolute;width:30px;height:30px;border-radius:50%;transform:scale(0);opacity:0;transition:transform 400ms cubic-bezier(0.25, 0.8, 0.25, 1),background-color 400ms cubic-bezier(0.25, 0.8, 0.25, 1),opacity 400ms cubic-bezier(0.25, 0.8, 0.25, 1)}.mat-slider.cdk-keyboard-focused .mat-slider-focus-ring,.mat-slider.cdk-program-focused .mat-slider-focus-ring{transform:scale(1);opacity:1}.mat-slider:not(.mat-slider-disabled):not(.mat-slider-sliding) .mat-slider-thumb-label,.mat-slider:not(.mat-slider-disabled):not(.mat-slider-sliding) .mat-slider-thumb{cursor:-webkit-grab;cursor:grab}.mat-slider-thumb{position:absolute;right:-10px;bottom:-10px;box-sizing:border-box;width:20px;height:20px;border:3px solid transparent;border-radius:50%;transform:scale(0.7);transition:transform 400ms cubic-bezier(0.25, 0.8, 0.25, 1),background-color 400ms cubic-bezier(0.25, 0.8, 0.25, 1),border-color 400ms cubic-bezier(0.25, 0.8, 0.25, 1)}.mat-slider-thumb-label{display:none;align-items:center;justify-content:center;position:absolute;width:28px;height:28px;border-radius:50%;transition:transform 400ms cubic-bezier(0.25, 0.8, 0.25, 1),border-radius 400ms cubic-bezier(0.25, 0.8, 0.25, 1),background-color 400ms cubic-bezier(0.25, 0.8, 0.25, 1)}.cdk-high-contrast-active .mat-slider-thumb-label{outline:solid 1px}.mat-slider-thumb-label-text{z-index:1;opacity:0;transition:opacity 400ms cubic-bezier(0.25, 0.8, 0.25, 1)}.mat-slider-sliding .mat-slider-track-fill,.mat-slider-sliding .mat-slider-track-background,.mat-slider-sliding .mat-slider-thumb-container{transition-duration:0ms}.mat-slider-has-ticks .mat-slider-wrapper::after{content:\"\";position:absolute;border-width:0;border-style:solid;opacity:0;transition:opacity 400ms cubic-bezier(0.25, 0.8, 0.25, 1)}.mat-slider-has-ticks.cdk-focused:not(.mat-slider-hide-last-tick) .mat-slider-wrapper::after,.mat-slider-has-ticks:hover:not(.mat-slider-hide-last-tick) .mat-slider-wrapper::after{opacity:1}.mat-slider-has-ticks.cdk-focused:not(.mat-slider-disabled) .mat-slider-ticks,.mat-slider-has-ticks:hover:not(.mat-slider-disabled) .mat-slider-ticks{opacity:1}.mat-slider-thumb-label-showing .mat-slider-focus-ring{display:none}.mat-slider-thumb-label-showing .mat-slider-thumb-label{display:flex}.mat-slider-axis-inverted .mat-slider-track-fill{transform-origin:100% 100%}.mat-slider-axis-inverted .mat-slider-track-background{transform-origin:0 0}.mat-slider:not(.mat-slider-disabled).cdk-focused.mat-slider-thumb-label-showing .mat-slider-thumb{transform:scale(0)}.mat-slider:not(.mat-slider-disabled).cdk-focused .mat-slider-thumb-label{border-radius:50% 50% 0}.mat-slider:not(.mat-slider-disabled).cdk-focused .mat-slider-thumb-label-text{opacity:1}.mat-slider:not(.mat-slider-disabled).cdk-mouse-focused .mat-slider-thumb,.mat-slider:not(.mat-slider-disabled).cdk-touch-focused .mat-slider-thumb,.mat-slider:not(.mat-slider-disabled).cdk-program-focused .mat-slider-thumb{border-width:2px;transform:scale(1)}.mat-slider-disabled .mat-slider-focus-ring{transform:scale(0);opacity:0}.mat-slider-disabled .mat-slider-thumb{border-width:4px;transform:scale(0.5)}.mat-slider-disabled .mat-slider-thumb-label{display:none}.mat-slider-horizontal{height:48px;min-width:128px}.mat-slider-horizontal .mat-slider-wrapper{height:2px;top:23px;left:8px;right:8px}.mat-slider-horizontal .mat-slider-wrapper::after{height:2px;border-left-width:2px;right:0;top:0}.mat-slider-horizontal .mat-slider-track-wrapper{height:2px;width:100%}.mat-slider-horizontal .mat-slider-track-fill{height:2px;width:100%;transform:scaleX(0)}.mat-slider-horizontal .mat-slider-track-background{height:2px;width:100%;transform:scaleX(1)}.mat-slider-horizontal .mat-slider-ticks-container{height:2px;width:100%}.cdk-high-contrast-active .mat-slider-horizontal .mat-slider-ticks-container{height:0;outline:solid 2px;top:1px}.mat-slider-horizontal .mat-slider-ticks{height:2px;width:100%}.mat-slider-horizontal .mat-slider-thumb-container{width:100%;height:0;top:50%}.mat-slider-horizontal .mat-slider-focus-ring{top:-15px;right:-15px}.mat-slider-horizontal .mat-slider-thumb-label{right:-14px;top:-40px;transform:translateY(26px) scale(0.01) rotate(45deg)}.mat-slider-horizontal .mat-slider-thumb-label-text{transform:rotate(-45deg)}.mat-slider-horizontal.cdk-focused .mat-slider-thumb-label{transform:rotate(45deg)}.cdk-high-contrast-active .mat-slider-horizontal.cdk-focused .mat-slider-thumb-label,.cdk-high-contrast-active .mat-slider-horizontal.cdk-focused .mat-slider-thumb-label-text{transform:none}.mat-slider-vertical{width:48px;min-height:128px}.mat-slider-vertical .mat-slider-wrapper{width:2px;top:8px;bottom:8px;left:23px}.mat-slider-vertical .mat-slider-wrapper::after{width:2px;border-top-width:2px;bottom:0;left:0}.mat-slider-vertical .mat-slider-track-wrapper{height:100%;width:2px}.mat-slider-vertical .mat-slider-track-fill{height:100%;width:2px;transform:scaleY(0)}.mat-slider-vertical .mat-slider-track-background{height:100%;width:2px;transform:scaleY(1)}.mat-slider-vertical .mat-slider-ticks-container{width:2px;height:100%}.cdk-high-contrast-active .mat-slider-vertical .mat-slider-ticks-container{width:0;outline:solid 2px;left:1px}.mat-slider-vertical .mat-slider-focus-ring{bottom:-15px;left:-15px}.mat-slider-vertical .mat-slider-ticks{width:2px;height:100%}.mat-slider-vertical .mat-slider-thumb-container{height:100%;width:0;left:50%}.mat-slider-vertical .mat-slider-thumb{-webkit-backface-visibility:hidden;backface-visibility:hidden}.mat-slider-vertical .mat-slider-thumb-label{bottom:-14px;left:-40px;transform:translateX(26px) scale(0.01) rotate(-45deg)}.mat-slider-vertical .mat-slider-thumb-label-text{transform:rotate(45deg)}.mat-slider-vertical.cdk-focused .mat-slider-thumb-label{transform:rotate(-45deg)}[dir=rtl] .mat-slider-wrapper::after{left:0;right:auto}[dir=rtl] .mat-slider-horizontal .mat-slider-track-fill{transform-origin:100% 100%}[dir=rtl] .mat-slider-horizontal .mat-slider-track-background{transform-origin:0 0}[dir=rtl] .mat-slider-horizontal.mat-slider-axis-inverted .mat-slider-track-fill{transform-origin:0 0}[dir=rtl] .mat-slider-horizontal.mat-slider-axis-inverted .mat-slider-track-background{transform-origin:100% 100%}.mat-slider._mat-animation-noopable .mat-slider-track-fill,.mat-slider._mat-animation-noopable .mat-slider-track-background,.mat-slider._mat-animation-noopable .mat-slider-ticks,.mat-slider._mat-animation-noopable .mat-slider-thumb-container,.mat-slider._mat-animation-noopable .mat-slider-focus-ring,.mat-slider._mat-animation-noopable .mat-slider-thumb,.mat-slider._mat-animation-noopable .mat-slider-thumb-label,.mat-slider._mat-animation-noopable .mat-slider-thumb-label-text,.mat-slider._mat-animation-noopable .mat-slider-has-ticks .mat-slider-wrapper::after{transition:none}\n"]
701
+ },] }
702
+ ];
703
+ MatSlider.ctorParameters = () => [
704
+ { type: ElementRef },
705
+ { type: FocusMonitor },
706
+ { type: ChangeDetectorRef },
707
+ { type: Directionality, decorators: [{ type: Optional }] },
708
+ { type: String, decorators: [{ type: Attribute, args: ['tabindex',] }] },
709
+ { type: NgZone },
710
+ { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] },
711
+ { type: String, decorators: [{ type: Optional }, { type: Inject, args: [ANIMATION_MODULE_TYPE,] }] }
712
+ ];
713
+ MatSlider.propDecorators = {
714
+ invert: [{ type: Input }],
715
+ max: [{ type: Input }],
716
+ min: [{ type: Input }],
717
+ step: [{ type: Input }],
718
+ thumbLabel: [{ type: Input }],
719
+ tickInterval: [{ type: Input }],
720
+ value: [{ type: Input }],
721
+ displayWith: [{ type: Input }],
722
+ vertical: [{ type: Input }],
723
+ change: [{ type: Output }],
724
+ input: [{ type: Output }],
725
+ valueChange: [{ type: Output }],
726
+ _sliderWrapper: [{ type: ViewChild, args: ['sliderWrapper',] }]
727
+ };
731
728
  /** Returns whether an event is a touch event. */
732
729
  function isTouchEvent(event) {
733
730
  // This function is called for every pixel that the user has dragged so we need it to be
@@ -749,18 +746,15 @@ function getPointerPositionOnPage(event) {
749
746
  * Use of this source code is governed by an MIT-style license that can be
750
747
  * found in the LICENSE file at https://angular.io/license
751
748
  */
752
- let MatSliderModule = /** @class */ (() => {
753
- class MatSliderModule {
754
- }
755
- MatSliderModule.decorators = [
756
- { type: NgModule, args: [{
757
- imports: [CommonModule, MatCommonModule],
758
- exports: [MatSlider, MatCommonModule],
759
- declarations: [MatSlider],
760
- },] }
761
- ];
762
- return MatSliderModule;
763
- })();
749
+ class MatSliderModule {
750
+ }
751
+ MatSliderModule.decorators = [
752
+ { type: NgModule, args: [{
753
+ imports: [CommonModule, MatCommonModule],
754
+ exports: [MatSlider, MatCommonModule],
755
+ declarations: [MatSlider],
756
+ },] }
757
+ ];
764
758
 
765
759
  /**
766
760
  * @license