@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
package/fesm2015/chips.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import { SPACE, BACKSPACE, DELETE, HOME, END, TAB, hasModifierKey, ENTER } from '@angular/cdk/keycodes';
2
- import { Directive, EventEmitter, ElementRef, NgZone, Optional, Inject, ChangeDetectorRef, Attribute, ContentChild, forwardRef, Input, Output, InjectionToken, Component, ViewEncapsulation, ChangeDetectionStrategy, Self, ContentChildren, NgModule } from '@angular/core';
2
+ import { InjectionToken, Directive, EventEmitter, ElementRef, NgZone, Optional, Inject, ChangeDetectorRef, Attribute, ContentChild, Input, Output, Component, ViewEncapsulation, ChangeDetectionStrategy, Self, ContentChildren, NgModule } from '@angular/core';
3
3
  import { mixinTabIndex, mixinColor, mixinDisableRipple, RippleRenderer, MAT_RIPPLE_GLOBAL_OPTIONS, mixinErrorState, ErrorStateMatcher } from '@angular/material/core';
4
- import { DOCUMENT } from '@angular/common';
5
4
  import { coerceBooleanProperty } from '@angular/cdk/coercion';
6
5
  import { Platform } from '@angular/cdk/platform';
6
+ import { DOCUMENT } from '@angular/common';
7
+ import { ANIMATION_MODULE_TYPE } from '@angular/platform-browser/animations';
7
8
  import { Subject, merge } from 'rxjs';
8
9
  import { take, takeUntil, startWith } from 'rxjs/operators';
9
- import { ANIMATION_MODULE_TYPE } from '@angular/platform-browser/animations';
10
10
  import { FocusKeyManager } from '@angular/cdk/a11y';
11
11
  import { Directionality } from '@angular/cdk/bidi';
12
12
  import { SelectionModel } from '@angular/cdk/collections';
@@ -34,6 +34,24 @@ class MatChipSelectionChange {
34
34
  this.isUserInput = isUserInput;
35
35
  }
36
36
  }
37
+ /**
38
+ * Injection token that can be used to reference instances of `MatChipRemove`. It serves as
39
+ * alternative token to the actual `MatChipRemove` class which could cause unnecessary
40
+ * retention of the class and its directive metadata.
41
+ */
42
+ const MAT_CHIP_REMOVE = new InjectionToken('MatChipRemove');
43
+ /**
44
+ * Injection token that can be used to reference instances of `MatChipAvatar`. It serves as
45
+ * alternative token to the actual `MatChipAvatar` class which could cause unnecessary
46
+ * retention of the class and its directive metadata.
47
+ */
48
+ const MAT_CHIP_AVATAR = new InjectionToken('MatChipAvatar');
49
+ /**
50
+ * Injection token that can be used to reference instances of `MatChipTrailingIcon`. It serves as
51
+ * alternative token to the actual `MatChipTrailingIcon` class which could cause unnecessary
52
+ * retention of the class and its directive metadata.
53
+ */
54
+ const MAT_CHIP_TRAILING_ICON = new InjectionToken('MatChipTrailingIcon');
37
55
  // Boilerplate for applying mixins to MatChip.
38
56
  /** @docs-private */
39
57
  class MatChipBase {
@@ -46,311 +64,304 @@ const _MatChipMixinBase = mixinTabIndex(mixinColor(mixinDisableRipple(MatChipBas
46
64
  * Dummy directive to add CSS class to chip avatar.
47
65
  * @docs-private
48
66
  */
49
- let MatChipAvatar = /** @class */ (() => {
50
- class MatChipAvatar {
51
- }
52
- MatChipAvatar.decorators = [
53
- { type: Directive, args: [{
54
- selector: 'mat-chip-avatar, [matChipAvatar]',
55
- host: { 'class': 'mat-chip-avatar' }
56
- },] }
57
- ];
58
- return MatChipAvatar;
59
- })();
67
+ class MatChipAvatar {
68
+ }
69
+ MatChipAvatar.decorators = [
70
+ { type: Directive, args: [{
71
+ selector: 'mat-chip-avatar, [matChipAvatar]',
72
+ host: { 'class': 'mat-chip-avatar' },
73
+ providers: [{ provide: MAT_CHIP_AVATAR, useExisting: MatChipAvatar }]
74
+ },] }
75
+ ];
60
76
  /**
61
77
  * Dummy directive to add CSS class to chip trailing icon.
62
78
  * @docs-private
63
79
  */
64
- let MatChipTrailingIcon = /** @class */ (() => {
65
- class MatChipTrailingIcon {
66
- }
67
- MatChipTrailingIcon.decorators = [
68
- { type: Directive, args: [{
69
- selector: 'mat-chip-trailing-icon, [matChipTrailingIcon]',
70
- host: { 'class': 'mat-chip-trailing-icon' }
71
- },] }
72
- ];
73
- return MatChipTrailingIcon;
74
- })();
80
+ class MatChipTrailingIcon {
81
+ }
82
+ MatChipTrailingIcon.decorators = [
83
+ { type: Directive, args: [{
84
+ selector: 'mat-chip-trailing-icon, [matChipTrailingIcon]',
85
+ host: { 'class': 'mat-chip-trailing-icon' },
86
+ providers: [{ provide: MAT_CHIP_TRAILING_ICON, useExisting: MatChipTrailingIcon }],
87
+ },] }
88
+ ];
75
89
  /**
76
90
  * Material design styled Chip component. Used inside the MatChipList component.
77
91
  */
78
- let MatChip = /** @class */ (() => {
79
- class MatChip extends _MatChipMixinBase {
80
- constructor(_elementRef, _ngZone, platform, globalRippleOptions,
81
- // @breaking-change 8.0.0 `animationMode` parameter to become required.
82
- animationMode,
83
- // @breaking-change 9.0.0 `_changeDetectorRef` parameter to become required.
84
- _changeDetectorRef, tabIndex,
85
- // @breaking-change 11.0.0 `_document` parameter to become required.
86
- _document) {
87
- super(_elementRef);
88
- this._elementRef = _elementRef;
89
- this._ngZone = _ngZone;
90
- this._changeDetectorRef = _changeDetectorRef;
91
- /** Whether the chip has focus. */
92
- this._hasFocus = false;
93
- /** Whether the chip list is selectable */
94
- this.chipListSelectable = true;
95
- /** Whether the chip list is in multi-selection mode. */
96
- this._chipListMultiple = false;
97
- /** Whether the chip list as a whole is disabled. */
98
- this._chipListDisabled = false;
99
- this._selected = false;
100
- this._selectable = true;
101
- this._disabled = false;
102
- this._removable = true;
103
- /** Emits when the chip is focused. */
104
- this._onFocus = new Subject();
105
- /** Emits when the chip is blured. */
106
- this._onBlur = new Subject();
107
- /** Emitted when the chip is selected or deselected. */
108
- this.selectionChange = new EventEmitter();
109
- /** Emitted when the chip is destroyed. */
110
- this.destroyed = new EventEmitter();
111
- /** Emitted when a chip is to be removed. */
112
- this.removed = new EventEmitter();
113
- this._addHostClassName();
114
- // Dynamically create the ripple target, append it within the chip, and use it as the
115
- // chip's ripple target. Adding the class '.mat-chip-ripple' ensures that it will have
116
- // the proper styles.
117
- this._chipRippleTarget = (_document || document).createElement('div');
118
- this._chipRippleTarget.classList.add('mat-chip-ripple');
119
- this._elementRef.nativeElement.appendChild(this._chipRippleTarget);
120
- this._chipRipple = new RippleRenderer(this, _ngZone, this._chipRippleTarget, platform);
121
- this._chipRipple.setupTriggerEvents(_elementRef);
122
- this.rippleConfig = globalRippleOptions || {};
123
- this._animationsDisabled = animationMode === 'NoopAnimations';
124
- this.tabIndex = tabIndex != null ? (parseInt(tabIndex) || -1) : -1;
125
- }
126
- /**
127
- * Whether ripples are disabled on interaction
128
- * @docs-private
129
- */
130
- get rippleDisabled() {
131
- return this.disabled || this.disableRipple || !!this.rippleConfig.disabled;
132
- }
133
- /** Whether the chip is selected. */
134
- get selected() { return this._selected; }
135
- set selected(value) {
136
- const coercedValue = coerceBooleanProperty(value);
137
- if (coercedValue !== this._selected) {
138
- this._selected = coercedValue;
139
- this._dispatchSelectionChange();
140
- }
141
- }
142
- /** The value of the chip. Defaults to the content inside `<mat-chip>` tags. */
143
- get value() {
144
- return this._value !== undefined
145
- ? this._value
146
- : this._elementRef.nativeElement.textContent;
147
- }
148
- set value(value) { this._value = value; }
149
- /**
150
- * Whether or not the chip is selectable. When a chip is not selectable,
151
- * changes to its selected state are always ignored. By default a chip is
152
- * selectable, and it becomes non-selectable if its parent chip list is
153
- * not selectable.
154
- */
155
- get selectable() { return this._selectable && this.chipListSelectable; }
156
- set selectable(value) {
157
- this._selectable = coerceBooleanProperty(value);
158
- }
159
- /** Whether the chip is disabled. */
160
- get disabled() { return this._chipListDisabled || this._disabled; }
161
- set disabled(value) {
162
- this._disabled = coerceBooleanProperty(value);
163
- }
164
- /**
165
- * Determines whether or not the chip displays the remove styling and emits (removed) events.
166
- */
167
- get removable() { return this._removable; }
168
- set removable(value) {
169
- this._removable = coerceBooleanProperty(value);
170
- }
171
- /** The ARIA selected applied to the chip. */
172
- get ariaSelected() {
173
- // Remove the `aria-selected` when the chip is deselected in single-selection mode, because
174
- // it adds noise to NVDA users where "not selected" will be read out for each chip.
175
- return this.selectable && (this._chipListMultiple || this.selected) ?
176
- this.selected.toString() : null;
177
- }
178
- _addHostClassName() {
179
- const basicChipAttrName = 'mat-basic-chip';
180
- const element = this._elementRef.nativeElement;
181
- if (element.hasAttribute(basicChipAttrName) ||
182
- element.tagName.toLowerCase() === basicChipAttrName) {
183
- element.classList.add(basicChipAttrName);
184
- return;
185
- }
186
- else {
187
- element.classList.add('mat-standard-chip');
188
- }
92
+ class MatChip extends _MatChipMixinBase {
93
+ constructor(_elementRef, _ngZone, platform, globalRippleOptions,
94
+ // @breaking-change 8.0.0 `animationMode` parameter to become required.
95
+ animationMode,
96
+ // @breaking-change 9.0.0 `_changeDetectorRef` parameter to become required.
97
+ _changeDetectorRef, tabIndex,
98
+ // @breaking-change 11.0.0 `_document` parameter to become required.
99
+ _document) {
100
+ super(_elementRef);
101
+ this._elementRef = _elementRef;
102
+ this._ngZone = _ngZone;
103
+ this._changeDetectorRef = _changeDetectorRef;
104
+ /** Whether the chip has focus. */
105
+ this._hasFocus = false;
106
+ /** Whether the chip list is selectable */
107
+ this.chipListSelectable = true;
108
+ /** Whether the chip list is in multi-selection mode. */
109
+ this._chipListMultiple = false;
110
+ /** Whether the chip list as a whole is disabled. */
111
+ this._chipListDisabled = false;
112
+ this._selected = false;
113
+ this._selectable = true;
114
+ this._disabled = false;
115
+ this._removable = true;
116
+ /** Emits when the chip is focused. */
117
+ this._onFocus = new Subject();
118
+ /** Emits when the chip is blured. */
119
+ this._onBlur = new Subject();
120
+ /** Emitted when the chip is selected or deselected. */
121
+ this.selectionChange = new EventEmitter();
122
+ /** Emitted when the chip is destroyed. */
123
+ this.destroyed = new EventEmitter();
124
+ /** Emitted when a chip is to be removed. */
125
+ this.removed = new EventEmitter();
126
+ this._addHostClassName();
127
+ // Dynamically create the ripple target, append it within the chip, and use it as the
128
+ // chip's ripple target. Adding the class '.mat-chip-ripple' ensures that it will have
129
+ // the proper styles.
130
+ this._chipRippleTarget = (_document || document).createElement('div');
131
+ this._chipRippleTarget.classList.add('mat-chip-ripple');
132
+ this._elementRef.nativeElement.appendChild(this._chipRippleTarget);
133
+ this._chipRipple = new RippleRenderer(this, _ngZone, this._chipRippleTarget, platform);
134
+ this._chipRipple.setupTriggerEvents(_elementRef);
135
+ this.rippleConfig = globalRippleOptions || {};
136
+ this._animationsDisabled = animationMode === 'NoopAnimations';
137
+ this.tabIndex = tabIndex != null ? (parseInt(tabIndex) || -1) : -1;
138
+ }
139
+ /**
140
+ * Whether ripples are disabled on interaction
141
+ * @docs-private
142
+ */
143
+ get rippleDisabled() {
144
+ return this.disabled || this.disableRipple || !!this.rippleConfig.disabled;
145
+ }
146
+ /** Whether the chip is selected. */
147
+ get selected() { return this._selected; }
148
+ set selected(value) {
149
+ const coercedValue = coerceBooleanProperty(value);
150
+ if (coercedValue !== this._selected) {
151
+ this._selected = coercedValue;
152
+ this._dispatchSelectionChange();
189
153
  }
190
- ngOnDestroy() {
191
- this.destroyed.emit({ chip: this });
192
- this._chipRipple._removeTriggerEvents();
154
+ }
155
+ /** The value of the chip. Defaults to the content inside `<mat-chip>` tags. */
156
+ get value() {
157
+ return this._value !== undefined
158
+ ? this._value
159
+ : this._elementRef.nativeElement.textContent;
160
+ }
161
+ set value(value) { this._value = value; }
162
+ /**
163
+ * Whether or not the chip is selectable. When a chip is not selectable,
164
+ * changes to its selected state are always ignored. By default a chip is
165
+ * selectable, and it becomes non-selectable if its parent chip list is
166
+ * not selectable.
167
+ */
168
+ get selectable() { return this._selectable && this.chipListSelectable; }
169
+ set selectable(value) {
170
+ this._selectable = coerceBooleanProperty(value);
171
+ }
172
+ /** Whether the chip is disabled. */
173
+ get disabled() { return this._chipListDisabled || this._disabled; }
174
+ set disabled(value) {
175
+ this._disabled = coerceBooleanProperty(value);
176
+ }
177
+ /**
178
+ * Determines whether or not the chip displays the remove styling and emits (removed) events.
179
+ */
180
+ get removable() { return this._removable; }
181
+ set removable(value) {
182
+ this._removable = coerceBooleanProperty(value);
183
+ }
184
+ /** The ARIA selected applied to the chip. */
185
+ get ariaSelected() {
186
+ // Remove the `aria-selected` when the chip is deselected in single-selection mode, because
187
+ // it adds noise to NVDA users where "not selected" will be read out for each chip.
188
+ return this.selectable && (this._chipListMultiple || this.selected) ?
189
+ this.selected.toString() : null;
190
+ }
191
+ _addHostClassName() {
192
+ const basicChipAttrName = 'mat-basic-chip';
193
+ const element = this._elementRef.nativeElement;
194
+ if (element.hasAttribute(basicChipAttrName) ||
195
+ element.tagName.toLowerCase() === basicChipAttrName) {
196
+ element.classList.add(basicChipAttrName);
197
+ return;
193
198
  }
194
- /** Selects the chip. */
195
- select() {
196
- if (!this._selected) {
197
- this._selected = true;
198
- this._dispatchSelectionChange();
199
- this._markForCheck();
200
- }
199
+ else {
200
+ element.classList.add('mat-standard-chip');
201
201
  }
202
- /** Deselects the chip. */
203
- deselect() {
204
- if (this._selected) {
205
- this._selected = false;
206
- this._dispatchSelectionChange();
207
- this._markForCheck();
208
- }
202
+ }
203
+ ngOnDestroy() {
204
+ this.destroyed.emit({ chip: this });
205
+ this._chipRipple._removeTriggerEvents();
206
+ }
207
+ /** Selects the chip. */
208
+ select() {
209
+ if (!this._selected) {
210
+ this._selected = true;
211
+ this._dispatchSelectionChange();
212
+ this._markForCheck();
209
213
  }
210
- /** Select this chip and emit selected event */
211
- selectViaInteraction() {
212
- if (!this._selected) {
213
- this._selected = true;
214
- this._dispatchSelectionChange(true);
215
- this._markForCheck();
216
- }
214
+ }
215
+ /** Deselects the chip. */
216
+ deselect() {
217
+ if (this._selected) {
218
+ this._selected = false;
219
+ this._dispatchSelectionChange();
220
+ this._markForCheck();
217
221
  }
218
- /** Toggles the current selected state of this chip. */
219
- toggleSelected(isUserInput = false) {
220
- this._selected = !this.selected;
221
- this._dispatchSelectionChange(isUserInput);
222
+ }
223
+ /** Select this chip and emit selected event */
224
+ selectViaInteraction() {
225
+ if (!this._selected) {
226
+ this._selected = true;
227
+ this._dispatchSelectionChange(true);
222
228
  this._markForCheck();
223
- return this.selected;
224
229
  }
225
- /** Allows for programmatic focusing of the chip. */
226
- focus() {
227
- if (!this._hasFocus) {
228
- this._elementRef.nativeElement.focus();
229
- this._onFocus.next({ chip: this });
230
- }
231
- this._hasFocus = true;
230
+ }
231
+ /** Toggles the current selected state of this chip. */
232
+ toggleSelected(isUserInput = false) {
233
+ this._selected = !this.selected;
234
+ this._dispatchSelectionChange(isUserInput);
235
+ this._markForCheck();
236
+ return this.selected;
237
+ }
238
+ /** Allows for programmatic focusing of the chip. */
239
+ focus() {
240
+ if (!this._hasFocus) {
241
+ this._elementRef.nativeElement.focus();
242
+ this._onFocus.next({ chip: this });
232
243
  }
233
- /**
234
- * Allows for programmatic removal of the chip. Called by the MatChipList when the DELETE or
235
- * BACKSPACE keys are pressed.
236
- *
237
- * Informs any listeners of the removal request. Does not remove the chip from the DOM.
238
- */
239
- remove() {
240
- if (this.removable) {
241
- this.removed.emit({ chip: this });
242
- }
244
+ this._hasFocus = true;
245
+ }
246
+ /**
247
+ * Allows for programmatic removal of the chip. Called by the MatChipList when the DELETE or
248
+ * BACKSPACE keys are pressed.
249
+ *
250
+ * Informs any listeners of the removal request. Does not remove the chip from the DOM.
251
+ */
252
+ remove() {
253
+ if (this.removable) {
254
+ this.removed.emit({ chip: this });
243
255
  }
244
- /** Handles click events on the chip. */
245
- _handleClick(event) {
246
- if (this.disabled) {
247
- event.preventDefault();
248
- }
249
- else {
250
- event.stopPropagation();
251
- }
256
+ }
257
+ /** Handles click events on the chip. */
258
+ _handleClick(event) {
259
+ if (this.disabled) {
260
+ event.preventDefault();
252
261
  }
253
- /** Handle custom key presses. */
254
- _handleKeydown(event) {
255
- if (this.disabled) {
256
- return;
257
- }
258
- switch (event.keyCode) {
259
- case DELETE:
260
- case BACKSPACE:
261
- // If we are removable, remove the focused chip
262
- this.remove();
263
- // Always prevent so page navigation does not occur
264
- event.preventDefault();
265
- break;
266
- case SPACE:
267
- // If we are selectable, toggle the focused chip
268
- if (this.selectable) {
269
- this.toggleSelected(true);
270
- }
271
- // Always prevent space from scrolling the page since the list has focus
272
- event.preventDefault();
273
- break;
274
- }
262
+ else {
263
+ event.stopPropagation();
275
264
  }
276
- _blur() {
277
- // When animations are enabled, Angular may end up removing the chip from the DOM a little
278
- // earlier than usual, causing it to be blurred and throwing off the logic in the chip list
279
- // that moves focus not the next item. To work around the issue, we defer marking the chip
280
- // as not focused until the next time the zone stabilizes.
281
- this._ngZone.onStable
282
- .asObservable()
283
- .pipe(take(1))
284
- .subscribe(() => {
285
- this._ngZone.run(() => {
286
- this._hasFocus = false;
287
- this._onBlur.next({ chip: this });
288
- });
289
- });
265
+ }
266
+ /** Handle custom key presses. */
267
+ _handleKeydown(event) {
268
+ if (this.disabled) {
269
+ return;
270
+ }
271
+ switch (event.keyCode) {
272
+ case DELETE:
273
+ case BACKSPACE:
274
+ // If we are removable, remove the focused chip
275
+ this.remove();
276
+ // Always prevent so page navigation does not occur
277
+ event.preventDefault();
278
+ break;
279
+ case SPACE:
280
+ // If we are selectable, toggle the focused chip
281
+ if (this.selectable) {
282
+ this.toggleSelected(true);
283
+ }
284
+ // Always prevent space from scrolling the page since the list has focus
285
+ event.preventDefault();
286
+ break;
290
287
  }
291
- _dispatchSelectionChange(isUserInput = false) {
292
- this.selectionChange.emit({
293
- source: this,
294
- isUserInput,
295
- selected: this._selected
288
+ }
289
+ _blur() {
290
+ // When animations are enabled, Angular may end up removing the chip from the DOM a little
291
+ // earlier than usual, causing it to be blurred and throwing off the logic in the chip list
292
+ // that moves focus not the next item. To work around the issue, we defer marking the chip
293
+ // as not focused until the next time the zone stabilizes.
294
+ this._ngZone.onStable
295
+ .asObservable()
296
+ .pipe(take(1))
297
+ .subscribe(() => {
298
+ this._ngZone.run(() => {
299
+ this._hasFocus = false;
300
+ this._onBlur.next({ chip: this });
296
301
  });
297
- }
298
- _markForCheck() {
299
- // @breaking-change 9.0.0 Remove this method once the _changeDetectorRef is a required param.
300
- if (this._changeDetectorRef) {
301
- this._changeDetectorRef.markForCheck();
302
- }
302
+ });
303
+ }
304
+ _dispatchSelectionChange(isUserInput = false) {
305
+ this.selectionChange.emit({
306
+ source: this,
307
+ isUserInput,
308
+ selected: this._selected
309
+ });
310
+ }
311
+ _markForCheck() {
312
+ // @breaking-change 9.0.0 Remove this method once the _changeDetectorRef is a required param.
313
+ if (this._changeDetectorRef) {
314
+ this._changeDetectorRef.markForCheck();
303
315
  }
304
316
  }
305
- MatChip.decorators = [
306
- { type: Directive, args: [{
307
- selector: `mat-basic-chip, [mat-basic-chip], mat-chip, [mat-chip]`,
308
- inputs: ['color', 'disableRipple', 'tabIndex'],
309
- exportAs: 'matChip',
310
- host: {
311
- 'class': 'mat-chip mat-focus-indicator',
312
- '[attr.tabindex]': 'disabled ? null : tabIndex',
313
- 'role': 'option',
314
- '[class.mat-chip-selected]': 'selected',
315
- '[class.mat-chip-with-avatar]': 'avatar',
316
- '[class.mat-chip-with-trailing-icon]': 'trailingIcon || removeIcon',
317
- '[class.mat-chip-disabled]': 'disabled',
318
- '[class._mat-animation-noopable]': '_animationsDisabled',
319
- '[attr.disabled]': 'disabled || null',
320
- '[attr.aria-disabled]': 'disabled.toString()',
321
- '[attr.aria-selected]': 'ariaSelected',
322
- '(click)': '_handleClick($event)',
323
- '(keydown)': '_handleKeydown($event)',
324
- '(focus)': 'focus()',
325
- '(blur)': '_blur()',
326
- },
327
- },] }
328
- ];
329
- MatChip.ctorParameters = () => [
330
- { type: ElementRef },
331
- { type: NgZone },
332
- { type: Platform },
333
- { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [MAT_RIPPLE_GLOBAL_OPTIONS,] }] },
334
- { type: String, decorators: [{ type: Optional }, { type: Inject, args: [ANIMATION_MODULE_TYPE,] }] },
335
- { type: ChangeDetectorRef },
336
- { type: String, decorators: [{ type: Attribute, args: ['tabindex',] }] },
337
- { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [DOCUMENT,] }] }
338
- ];
339
- MatChip.propDecorators = {
340
- avatar: [{ type: ContentChild, args: [MatChipAvatar,] }],
341
- trailingIcon: [{ type: ContentChild, args: [MatChipTrailingIcon,] }],
342
- removeIcon: [{ type: ContentChild, args: [forwardRef(() => MatChipRemove),] }],
343
- selected: [{ type: Input }],
344
- value: [{ type: Input }],
345
- selectable: [{ type: Input }],
346
- disabled: [{ type: Input }],
347
- removable: [{ type: Input }],
348
- selectionChange: [{ type: Output }],
349
- destroyed: [{ type: Output }],
350
- removed: [{ type: Output }]
351
- };
352
- return MatChip;
353
- })();
317
+ }
318
+ MatChip.decorators = [
319
+ { type: Directive, args: [{
320
+ selector: `mat-basic-chip, [mat-basic-chip], mat-chip, [mat-chip]`,
321
+ inputs: ['color', 'disableRipple', 'tabIndex'],
322
+ exportAs: 'matChip',
323
+ host: {
324
+ 'class': 'mat-chip mat-focus-indicator',
325
+ '[attr.tabindex]': 'disabled ? null : tabIndex',
326
+ 'role': 'option',
327
+ '[class.mat-chip-selected]': 'selected',
328
+ '[class.mat-chip-with-avatar]': 'avatar',
329
+ '[class.mat-chip-with-trailing-icon]': 'trailingIcon || removeIcon',
330
+ '[class.mat-chip-disabled]': 'disabled',
331
+ '[class._mat-animation-noopable]': '_animationsDisabled',
332
+ '[attr.disabled]': 'disabled || null',
333
+ '[attr.aria-disabled]': 'disabled.toString()',
334
+ '[attr.aria-selected]': 'ariaSelected',
335
+ '(click)': '_handleClick($event)',
336
+ '(keydown)': '_handleKeydown($event)',
337
+ '(focus)': 'focus()',
338
+ '(blur)': '_blur()',
339
+ },
340
+ },] }
341
+ ];
342
+ MatChip.ctorParameters = () => [
343
+ { type: ElementRef },
344
+ { type: NgZone },
345
+ { type: Platform },
346
+ { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [MAT_RIPPLE_GLOBAL_OPTIONS,] }] },
347
+ { type: String, decorators: [{ type: Optional }, { type: Inject, args: [ANIMATION_MODULE_TYPE,] }] },
348
+ { type: ChangeDetectorRef },
349
+ { type: String, decorators: [{ type: Attribute, args: ['tabindex',] }] },
350
+ { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [DOCUMENT,] }] }
351
+ ];
352
+ MatChip.propDecorators = {
353
+ avatar: [{ type: ContentChild, args: [MAT_CHIP_AVATAR,] }],
354
+ trailingIcon: [{ type: ContentChild, args: [MAT_CHIP_TRAILING_ICON,] }],
355
+ removeIcon: [{ type: ContentChild, args: [MAT_CHIP_REMOVE,] }],
356
+ selected: [{ type: Input }],
357
+ value: [{ type: Input }],
358
+ selectable: [{ type: Input }],
359
+ disabled: [{ type: Input }],
360
+ removable: [{ type: Input }],
361
+ selectionChange: [{ type: Output }],
362
+ destroyed: [{ type: Output }],
363
+ removed: [{ type: Output }]
364
+ };
354
365
  /**
355
366
  * Applies proper (click) support and adds styling for use with the Material Design "cancel" icon
356
367
  * available at https://material.io/icons/#ic_cancel.
@@ -364,46 +375,44 @@ let MatChip = /** @class */ (() => {
364
375
  * You *may* use a custom icon, but you may need to override the `mat-chip-remove` positioning
365
376
  * styles to properly center the icon within the chip.
366
377
  */
367
- let MatChipRemove = /** @class */ (() => {
368
- class MatChipRemove {
369
- constructor(_parentChip,
370
- // @breaking-change 11.0.0 `elementRef` parameter to be made required.
371
- elementRef) {
372
- this._parentChip = _parentChip;
373
- // @breaking-change 11.0.0 Remove null check for `elementRef`.
374
- if (elementRef && elementRef.nativeElement.nodeName === 'BUTTON') {
375
- elementRef.nativeElement.setAttribute('type', 'button');
376
- }
377
- }
378
- /** Calls the parent chip's public `remove()` method if applicable. */
379
- _handleClick(event) {
380
- const parentChip = this._parentChip;
381
- if (parentChip.removable && !parentChip.disabled) {
382
- parentChip.remove();
383
- }
384
- // We need to stop event propagation because otherwise the event will bubble up to the
385
- // form field and cause the `onContainerClick` method to be invoked. This method would then
386
- // reset the focused chip that has been focused after chip removal. Usually the parent
387
- // the parent click listener of the `MatChip` would prevent propagation, but it can happen
388
- // that the chip is being removed before the event bubbles up.
389
- event.stopPropagation();
378
+ class MatChipRemove {
379
+ constructor(_parentChip,
380
+ // @breaking-change 11.0.0 `elementRef` parameter to be made required.
381
+ elementRef) {
382
+ this._parentChip = _parentChip;
383
+ // @breaking-change 11.0.0 Remove null check for `elementRef`.
384
+ if (elementRef && elementRef.nativeElement.nodeName === 'BUTTON') {
385
+ elementRef.nativeElement.setAttribute('type', 'button');
390
386
  }
391
387
  }
392
- MatChipRemove.decorators = [
393
- { type: Directive, args: [{
394
- selector: '[matChipRemove]',
395
- host: {
396
- 'class': 'mat-chip-remove mat-chip-trailing-icon',
397
- '(click)': '_handleClick($event)',
398
- }
399
- },] }
400
- ];
401
- MatChipRemove.ctorParameters = () => [
402
- { type: MatChip },
403
- { type: ElementRef }
404
- ];
405
- return MatChipRemove;
406
- })();
388
+ /** Calls the parent chip's public `remove()` method if applicable. */
389
+ _handleClick(event) {
390
+ const parentChip = this._parentChip;
391
+ if (parentChip.removable && !parentChip.disabled) {
392
+ parentChip.remove();
393
+ }
394
+ // We need to stop event propagation because otherwise the event will bubble up to the
395
+ // form field and cause the `onContainerClick` method to be invoked. This method would then
396
+ // reset the focused chip that has been focused after chip removal. Usually the parent
397
+ // the parent click listener of the `MatChip` would prevent propagation, but it can happen
398
+ // that the chip is being removed before the event bubbles up.
399
+ event.stopPropagation();
400
+ }
401
+ }
402
+ MatChipRemove.decorators = [
403
+ { type: Directive, args: [{
404
+ selector: '[matChipRemove]',
405
+ host: {
406
+ 'class': 'mat-chip-remove mat-chip-trailing-icon',
407
+ '(click)': '_handleClick($event)',
408
+ },
409
+ providers: [{ provide: MAT_CHIP_REMOVE, useExisting: MatChipRemove }],
410
+ },] }
411
+ ];
412
+ MatChipRemove.ctorParameters = () => [
413
+ { type: MatChip },
414
+ { type: ElementRef }
415
+ ];
407
416
 
408
417
  /**
409
418
  * @license
@@ -451,642 +460,639 @@ class MatChipListChange {
451
460
  /**
452
461
  * A material design chips component (named ChipList for its similarity to the List component).
453
462
  */
454
- let MatChipList = /** @class */ (() => {
455
- class MatChipList extends _MatChipListMixinBase {
456
- constructor(_elementRef, _changeDetectorRef, _dir, _parentForm, _parentFormGroup, _defaultErrorStateMatcher,
457
- /** @docs-private */
458
- ngControl) {
459
- super(_defaultErrorStateMatcher, _parentForm, _parentFormGroup, ngControl);
460
- this._elementRef = _elementRef;
461
- this._changeDetectorRef = _changeDetectorRef;
462
- this._dir = _dir;
463
- this.ngControl = ngControl;
464
- /**
465
- * Implemented as part of MatFormFieldControl.
466
- * @docs-private
467
- */
468
- this.controlType = 'mat-chip-list';
469
- /**
470
- * When a chip is destroyed, we store the index of the destroyed chip until the chips
471
- * query list notifies about the update. This is necessary because we cannot determine an
472
- * appropriate chip that should receive focus until the array of chips updated completely.
473
- */
474
- this._lastDestroyedChipIndex = null;
475
- /** Subject that emits when the component has been destroyed. */
476
- this._destroyed = new Subject();
477
- /** Uid of the chip list */
478
- this._uid = `mat-chip-list-${nextUniqueId++}`;
479
- /** Tab index for the chip list. */
480
- this._tabIndex = 0;
481
- /**
482
- * User defined tab index.
483
- * When it is not null, use user defined tab index. Otherwise use _tabIndex
484
- */
485
- this._userTabIndex = null;
486
- /** Function when touched */
487
- this._onTouched = () => { };
488
- /** Function when changed */
489
- this._onChange = () => { };
490
- this._multiple = false;
491
- this._compareWith = (o1, o2) => o1 === o2;
492
- this._required = false;
493
- this._disabled = false;
494
- /** Orientation of the chip list. */
495
- this.ariaOrientation = 'horizontal';
496
- this._selectable = true;
497
- /** Event emitted when the selected chip list value has been changed by the user. */
498
- this.change = new EventEmitter();
499
- /**
500
- * Event that emits whenever the raw value of the chip-list changes. This is here primarily
501
- * to facilitate the two-way binding for the `value` input.
502
- * @docs-private
503
- */
504
- this.valueChange = new EventEmitter();
505
- if (this.ngControl) {
506
- this.ngControl.valueAccessor = this;
507
- }
508
- }
509
- /** The array of selected chips inside chip list. */
510
- get selected() {
511
- return this.multiple ? this._selectionModel.selected : this._selectionModel.selected[0];
512
- }
513
- /** The ARIA role applied to the chip list. */
514
- get role() { return this.empty ? null : 'listbox'; }
515
- /** Whether the user should be allowed to select multiple chips. */
516
- get multiple() { return this._multiple; }
517
- set multiple(value) {
518
- this._multiple = coerceBooleanProperty(value);
519
- this._syncChipsState();
520
- }
521
- /**
522
- * A function to compare the option values with the selected values. The first argument
523
- * is a value from an option. The second is a value from the selection. A boolean
524
- * should be returned.
525
- */
526
- get compareWith() { return this._compareWith; }
527
- set compareWith(fn) {
528
- this._compareWith = fn;
529
- if (this._selectionModel) {
530
- // A different comparator means the selection could change.
531
- this._initializeSelection();
532
- }
533
- }
534
- /**
535
- * Implemented as part of MatFormFieldControl.
536
- * @docs-private
537
- */
538
- get value() { return this._value; }
539
- set value(value) {
540
- this.writeValue(value);
541
- this._value = value;
542
- }
543
- /**
544
- * Implemented as part of MatFormFieldControl.
545
- * @docs-private
546
- */
547
- get id() {
548
- return this._chipInput ? this._chipInput.id : this._uid;
549
- }
550
- /**
551
- * Implemented as part of MatFormFieldControl.
552
- * @docs-private
553
- */
554
- get required() { return this._required; }
555
- set required(value) {
556
- this._required = coerceBooleanProperty(value);
557
- this.stateChanges.next();
558
- }
463
+ class MatChipList extends _MatChipListMixinBase {
464
+ constructor(_elementRef, _changeDetectorRef, _dir, _parentForm, _parentFormGroup, _defaultErrorStateMatcher,
465
+ /** @docs-private */
466
+ ngControl) {
467
+ super(_defaultErrorStateMatcher, _parentForm, _parentFormGroup, ngControl);
468
+ this._elementRef = _elementRef;
469
+ this._changeDetectorRef = _changeDetectorRef;
470
+ this._dir = _dir;
471
+ this.ngControl = ngControl;
559
472
  /**
560
473
  * Implemented as part of MatFormFieldControl.
561
474
  * @docs-private
562
475
  */
563
- get placeholder() {
564
- return this._chipInput ? this._chipInput.placeholder : this._placeholder;
565
- }
566
- set placeholder(value) {
567
- this._placeholder = value;
568
- this.stateChanges.next();
569
- }
570
- /** Whether any chips or the matChipInput inside of this chip-list has focus. */
571
- get focused() {
572
- return (this._chipInput && this._chipInput.focused) || this._hasFocusedChip();
573
- }
476
+ this.controlType = 'mat-chip-list';
574
477
  /**
575
- * Implemented as part of MatFormFieldControl.
576
- * @docs-private
478
+ * When a chip is destroyed, we store the index of the destroyed chip until the chips
479
+ * query list notifies about the update. This is necessary because we cannot determine an
480
+ * appropriate chip that should receive focus until the array of chips updated completely.
577
481
  */
578
- get empty() {
579
- return (!this._chipInput || this._chipInput.empty) && this.chips.length === 0;
580
- }
482
+ this._lastDestroyedChipIndex = null;
483
+ /** Subject that emits when the component has been destroyed. */
484
+ this._destroyed = new Subject();
485
+ /** Uid of the chip list */
486
+ this._uid = `mat-chip-list-${nextUniqueId++}`;
487
+ /** Tab index for the chip list. */
488
+ this._tabIndex = 0;
581
489
  /**
582
- * Implemented as part of MatFormFieldControl.
583
- * @docs-private
490
+ * User defined tab index.
491
+ * When it is not null, use user defined tab index. Otherwise use _tabIndex
584
492
  */
585
- get shouldLabelFloat() { return !this.empty || this.focused; }
493
+ this._userTabIndex = null;
494
+ /** Function when touched */
495
+ this._onTouched = () => { };
496
+ /** Function when changed */
497
+ this._onChange = () => { };
498
+ this._multiple = false;
499
+ this._compareWith = (o1, o2) => o1 === o2;
500
+ this._required = false;
501
+ this._disabled = false;
502
+ /** Orientation of the chip list. */
503
+ this.ariaOrientation = 'horizontal';
504
+ this._selectable = true;
505
+ /** Event emitted when the selected chip list value has been changed by the user. */
506
+ this.change = new EventEmitter();
586
507
  /**
587
- * Implemented as part of MatFormFieldControl.
508
+ * Event that emits whenever the raw value of the chip-list changes. This is here primarily
509
+ * to facilitate the two-way binding for the `value` input.
588
510
  * @docs-private
589
511
  */
590
- get disabled() { return this.ngControl ? !!this.ngControl.disabled : this._disabled; }
591
- set disabled(value) {
592
- this._disabled = coerceBooleanProperty(value);
593
- this._syncChipsState();
594
- }
595
- /**
596
- * Whether or not this chip list is selectable. When a chip list is not selectable,
597
- * the selected states for all the chips inside the chip list are always ignored.
598
- */
599
- get selectable() { return this._selectable; }
600
- set selectable(value) {
601
- this._selectable = coerceBooleanProperty(value);
602
- if (this.chips) {
603
- this.chips.forEach(chip => chip.chipListSelectable = this._selectable);
604
- }
605
- }
606
- set tabIndex(value) {
607
- this._userTabIndex = value;
608
- this._tabIndex = value;
512
+ this.valueChange = new EventEmitter();
513
+ if (this.ngControl) {
514
+ this.ngControl.valueAccessor = this;
609
515
  }
610
- /** Combined stream of all of the child chips' selection change events. */
611
- get chipSelectionChanges() {
612
- return merge(...this.chips.map(chip => chip.selectionChange));
613
- }
614
- /** Combined stream of all of the child chips' focus change events. */
615
- get chipFocusChanges() {
616
- return merge(...this.chips.map(chip => chip._onFocus));
617
- }
618
- /** Combined stream of all of the child chips' blur change events. */
619
- get chipBlurChanges() {
620
- return merge(...this.chips.map(chip => chip._onBlur));
516
+ }
517
+ /** The array of selected chips inside chip list. */
518
+ get selected() {
519
+ return this.multiple ? this._selectionModel.selected : this._selectionModel.selected[0];
520
+ }
521
+ /** The ARIA role applied to the chip list. */
522
+ get role() { return this.empty ? null : 'listbox'; }
523
+ /** Whether the user should be allowed to select multiple chips. */
524
+ get multiple() { return this._multiple; }
525
+ set multiple(value) {
526
+ this._multiple = coerceBooleanProperty(value);
527
+ this._syncChipsState();
528
+ }
529
+ /**
530
+ * A function to compare the option values with the selected values. The first argument
531
+ * is a value from an option. The second is a value from the selection. A boolean
532
+ * should be returned.
533
+ */
534
+ get compareWith() { return this._compareWith; }
535
+ set compareWith(fn) {
536
+ this._compareWith = fn;
537
+ if (this._selectionModel) {
538
+ // A different comparator means the selection could change.
539
+ this._initializeSelection();
621
540
  }
622
- /** Combined stream of all of the child chips' remove change events. */
623
- get chipRemoveChanges() {
624
- return merge(...this.chips.map(chip => chip.destroyed));
541
+ }
542
+ /**
543
+ * Implemented as part of MatFormFieldControl.
544
+ * @docs-private
545
+ */
546
+ get value() { return this._value; }
547
+ set value(value) {
548
+ this.writeValue(value);
549
+ this._value = value;
550
+ }
551
+ /**
552
+ * Implemented as part of MatFormFieldControl.
553
+ * @docs-private
554
+ */
555
+ get id() {
556
+ return this._chipInput ? this._chipInput.id : this._uid;
557
+ }
558
+ /**
559
+ * Implemented as part of MatFormFieldControl.
560
+ * @docs-private
561
+ */
562
+ get required() { return this._required; }
563
+ set required(value) {
564
+ this._required = coerceBooleanProperty(value);
565
+ this.stateChanges.next();
566
+ }
567
+ /**
568
+ * Implemented as part of MatFormFieldControl.
569
+ * @docs-private
570
+ */
571
+ get placeholder() {
572
+ return this._chipInput ? this._chipInput.placeholder : this._placeholder;
573
+ }
574
+ set placeholder(value) {
575
+ this._placeholder = value;
576
+ this.stateChanges.next();
577
+ }
578
+ /** Whether any chips or the matChipInput inside of this chip-list has focus. */
579
+ get focused() {
580
+ return (this._chipInput && this._chipInput.focused) || this._hasFocusedChip();
581
+ }
582
+ /**
583
+ * Implemented as part of MatFormFieldControl.
584
+ * @docs-private
585
+ */
586
+ get empty() {
587
+ return (!this._chipInput || this._chipInput.empty) && (!this.chips || this.chips.length === 0);
588
+ }
589
+ /**
590
+ * Implemented as part of MatFormFieldControl.
591
+ * @docs-private
592
+ */
593
+ get shouldLabelFloat() { return !this.empty || this.focused; }
594
+ /**
595
+ * Implemented as part of MatFormFieldControl.
596
+ * @docs-private
597
+ */
598
+ get disabled() { return this.ngControl ? !!this.ngControl.disabled : this._disabled; }
599
+ set disabled(value) {
600
+ this._disabled = coerceBooleanProperty(value);
601
+ this._syncChipsState();
602
+ }
603
+ /**
604
+ * Whether or not this chip list is selectable. When a chip list is not selectable,
605
+ * the selected states for all the chips inside the chip list are always ignored.
606
+ */
607
+ get selectable() { return this._selectable; }
608
+ set selectable(value) {
609
+ this._selectable = coerceBooleanProperty(value);
610
+ if (this.chips) {
611
+ this.chips.forEach(chip => chip.chipListSelectable = this._selectable);
625
612
  }
626
- ngAfterContentInit() {
627
- this._keyManager = new FocusKeyManager(this.chips)
628
- .withWrap()
629
- .withVerticalOrientation()
630
- .withHorizontalOrientation(this._dir ? this._dir.value : 'ltr');
631
- if (this._dir) {
632
- this._dir.change
633
- .pipe(takeUntil(this._destroyed))
634
- .subscribe(dir => this._keyManager.withHorizontalOrientation(dir));
613
+ }
614
+ set tabIndex(value) {
615
+ this._userTabIndex = value;
616
+ this._tabIndex = value;
617
+ }
618
+ /** Combined stream of all of the child chips' selection change events. */
619
+ get chipSelectionChanges() {
620
+ return merge(...this.chips.map(chip => chip.selectionChange));
621
+ }
622
+ /** Combined stream of all of the child chips' focus change events. */
623
+ get chipFocusChanges() {
624
+ return merge(...this.chips.map(chip => chip._onFocus));
625
+ }
626
+ /** Combined stream of all of the child chips' blur change events. */
627
+ get chipBlurChanges() {
628
+ return merge(...this.chips.map(chip => chip._onBlur));
629
+ }
630
+ /** Combined stream of all of the child chips' remove change events. */
631
+ get chipRemoveChanges() {
632
+ return merge(...this.chips.map(chip => chip.destroyed));
633
+ }
634
+ ngAfterContentInit() {
635
+ this._keyManager = new FocusKeyManager(this.chips)
636
+ .withWrap()
637
+ .withVerticalOrientation()
638
+ .withHorizontalOrientation(this._dir ? this._dir.value : 'ltr');
639
+ if (this._dir) {
640
+ this._dir.change
641
+ .pipe(takeUntil(this._destroyed))
642
+ .subscribe(dir => this._keyManager.withHorizontalOrientation(dir));
643
+ }
644
+ this._keyManager.tabOut.pipe(takeUntil(this._destroyed)).subscribe(() => {
645
+ this._allowFocusEscape();
646
+ });
647
+ // When the list changes, re-subscribe
648
+ this.chips.changes.pipe(startWith(null), takeUntil(this._destroyed)).subscribe(() => {
649
+ if (this.disabled) {
650
+ // Since this happens after the content has been
651
+ // checked, we need to defer it to the next tick.
652
+ Promise.resolve().then(() => {
653
+ this._syncChipsState();
654
+ });
635
655
  }
636
- this._keyManager.tabOut.pipe(takeUntil(this._destroyed)).subscribe(() => {
637
- this._allowFocusEscape();
638
- });
639
- // When the list changes, re-subscribe
640
- this.chips.changes.pipe(startWith(null), takeUntil(this._destroyed)).subscribe(() => {
641
- if (this.disabled) {
642
- // Since this happens after the content has been
643
- // checked, we need to defer it to the next tick.
644
- Promise.resolve().then(() => {
645
- this._syncChipsState();
646
- });
647
- }
648
- this._resetChips();
649
- // Reset chips selected/deselected status
650
- this._initializeSelection();
651
- // Check to see if we need to update our tab index
652
- this._updateTabIndex();
653
- // Check to see if we have a destroyed chip and need to refocus
654
- this._updateFocusForDestroyedChips();
655
- this.stateChanges.next();
656
- });
657
- }
658
- ngOnInit() {
659
- this._selectionModel = new SelectionModel(this.multiple, undefined, false);
656
+ this._resetChips();
657
+ // Reset chips selected/deselected status
658
+ this._initializeSelection();
659
+ // Check to see if we need to update our tab index
660
+ this._updateTabIndex();
661
+ // Check to see if we have a destroyed chip and need to refocus
662
+ this._updateFocusForDestroyedChips();
660
663
  this.stateChanges.next();
661
- }
662
- ngDoCheck() {
663
- if (this.ngControl) {
664
- // We need to re-evaluate this on every change detection cycle, because there are some
665
- // error triggers that we can't subscribe to (e.g. parent form submissions). This means
666
- // that whatever logic is in here has to be super lean or we risk destroying the performance.
667
- this.updateErrorState();
668
- if (this.ngControl.disabled !== this._disabled) {
669
- this.disabled = !!this.ngControl.disabled;
670
- }
664
+ });
665
+ }
666
+ ngOnInit() {
667
+ this._selectionModel = new SelectionModel(this.multiple, undefined, false);
668
+ this.stateChanges.next();
669
+ }
670
+ ngDoCheck() {
671
+ if (this.ngControl) {
672
+ // We need to re-evaluate this on every change detection cycle, because there are some
673
+ // error triggers that we can't subscribe to (e.g. parent form submissions). This means
674
+ // that whatever logic is in here has to be super lean or we risk destroying the performance.
675
+ this.updateErrorState();
676
+ if (this.ngControl.disabled !== this._disabled) {
677
+ this.disabled = !!this.ngControl.disabled;
671
678
  }
672
679
  }
673
- ngOnDestroy() {
674
- this._destroyed.next();
675
- this._destroyed.complete();
676
- this.stateChanges.complete();
677
- this._dropSubscriptions();
678
- }
679
- /** Associates an HTML input element with this chip list. */
680
- registerInput(inputElement) {
681
- this._chipInput = inputElement;
682
- }
683
- /**
684
- * Implemented as part of MatFormFieldControl.
685
- * @docs-private
686
- */
687
- setDescribedByIds(ids) { this._ariaDescribedby = ids.join(' '); }
688
- // Implemented as part of ControlValueAccessor.
689
- writeValue(value) {
690
- if (this.chips) {
691
- this._setSelectionByValue(value, false);
692
- }
680
+ }
681
+ ngOnDestroy() {
682
+ this._destroyed.next();
683
+ this._destroyed.complete();
684
+ this.stateChanges.complete();
685
+ this._dropSubscriptions();
686
+ }
687
+ /** Associates an HTML input element with this chip list. */
688
+ registerInput(inputElement) {
689
+ this._chipInput = inputElement;
690
+ }
691
+ /**
692
+ * Implemented as part of MatFormFieldControl.
693
+ * @docs-private
694
+ */
695
+ setDescribedByIds(ids) { this._ariaDescribedby = ids.join(' '); }
696
+ // Implemented as part of ControlValueAccessor.
697
+ writeValue(value) {
698
+ if (this.chips) {
699
+ this._setSelectionByValue(value, false);
693
700
  }
694
- // Implemented as part of ControlValueAccessor.
695
- registerOnChange(fn) {
696
- this._onChange = fn;
701
+ }
702
+ // Implemented as part of ControlValueAccessor.
703
+ registerOnChange(fn) {
704
+ this._onChange = fn;
705
+ }
706
+ // Implemented as part of ControlValueAccessor.
707
+ registerOnTouched(fn) {
708
+ this._onTouched = fn;
709
+ }
710
+ // Implemented as part of ControlValueAccessor.
711
+ setDisabledState(isDisabled) {
712
+ this.disabled = isDisabled;
713
+ this.stateChanges.next();
714
+ }
715
+ /**
716
+ * Implemented as part of MatFormFieldControl.
717
+ * @docs-private
718
+ */
719
+ onContainerClick(event) {
720
+ if (!this._originatesFromChip(event)) {
721
+ this.focus();
697
722
  }
698
- // Implemented as part of ControlValueAccessor.
699
- registerOnTouched(fn) {
700
- this._onTouched = fn;
723
+ }
724
+ /**
725
+ * Focuses the first non-disabled chip in this chip list, or the associated input when there
726
+ * are no eligible chips.
727
+ */
728
+ focus(options) {
729
+ if (this.disabled) {
730
+ return;
731
+ }
732
+ // TODO: ARIA says this should focus the first `selected` chip if any are selected.
733
+ // Focus on first element if there's no chipInput inside chip-list
734
+ if (this._chipInput && this._chipInput.focused) {
735
+ // do nothing
736
+ }
737
+ else if (this.chips.length > 0) {
738
+ this._keyManager.setFirstItemActive();
739
+ this.stateChanges.next();
701
740
  }
702
- // Implemented as part of ControlValueAccessor.
703
- setDisabledState(isDisabled) {
704
- this.disabled = isDisabled;
741
+ else {
742
+ this._focusInput(options);
705
743
  this.stateChanges.next();
706
744
  }
707
- /**
708
- * Implemented as part of MatFormFieldControl.
709
- * @docs-private
710
- */
711
- onContainerClick(event) {
712
- if (!this._originatesFromChip(event)) {
713
- this.focus();
714
- }
745
+ }
746
+ /** Attempt to focus an input if we have one. */
747
+ _focusInput(options) {
748
+ if (this._chipInput) {
749
+ this._chipInput.focus(options);
715
750
  }
716
- /**
717
- * Focuses the first non-disabled chip in this chip list, or the associated input when there
718
- * are no eligible chips.
719
- */
720
- focus(options) {
721
- if (this.disabled) {
722
- return;
723
- }
724
- // TODO: ARIA says this should focus the first `selected` chip if any are selected.
725
- // Focus on first element if there's no chipInput inside chip-list
726
- if (this._chipInput && this._chipInput.focused) {
727
- // do nothing
728
- }
729
- else if (this.chips.length > 0) {
751
+ }
752
+ /**
753
+ * Pass events to the keyboard manager. Available here for tests.
754
+ */
755
+ _keydown(event) {
756
+ const target = event.target;
757
+ // If they are on an empty input and hit backspace, focus the last chip
758
+ if (event.keyCode === BACKSPACE && this._isInputEmpty(target)) {
759
+ this._keyManager.setLastItemActive();
760
+ event.preventDefault();
761
+ }
762
+ else if (target && target.classList.contains('mat-chip')) {
763
+ if (event.keyCode === HOME) {
730
764
  this._keyManager.setFirstItemActive();
731
- this.stateChanges.next();
732
- }
733
- else {
734
- this._focusInput(options);
735
- this.stateChanges.next();
736
- }
737
- }
738
- /** Attempt to focus an input if we have one. */
739
- _focusInput(options) {
740
- if (this._chipInput) {
741
- this._chipInput.focus(options);
765
+ event.preventDefault();
742
766
  }
743
- }
744
- /**
745
- * Pass events to the keyboard manager. Available here for tests.
746
- */
747
- _keydown(event) {
748
- const target = event.target;
749
- // If they are on an empty input and hit backspace, focus the last chip
750
- if (event.keyCode === BACKSPACE && this._isInputEmpty(target)) {
767
+ else if (event.keyCode === END) {
751
768
  this._keyManager.setLastItemActive();
752
769
  event.preventDefault();
753
770
  }
754
- else if (target && target.classList.contains('mat-chip')) {
755
- if (event.keyCode === HOME) {
756
- this._keyManager.setFirstItemActive();
757
- event.preventDefault();
758
- }
759
- else if (event.keyCode === END) {
760
- this._keyManager.setLastItemActive();
761
- event.preventDefault();
762
- }
763
- else {
764
- this._keyManager.onKeydown(event);
765
- }
766
- this.stateChanges.next();
767
- }
768
- }
769
- /**
770
- * Check the tab index as you should not be allowed to focus an empty list.
771
- */
772
- _updateTabIndex() {
773
- // If we have 0 chips, we should not allow keyboard focus
774
- this._tabIndex = this._userTabIndex || (this.chips.length === 0 ? -1 : 0);
775
- }
776
- /**
777
- * If the amount of chips changed, we need to update the
778
- * key manager state and focus the next closest chip.
779
- */
780
- _updateFocusForDestroyedChips() {
781
- // Move focus to the closest chip. If no other chips remain, focus the chip-list itself.
782
- if (this._lastDestroyedChipIndex != null) {
783
- if (this.chips.length) {
784
- const newChipIndex = Math.min(this._lastDestroyedChipIndex, this.chips.length - 1);
785
- this._keyManager.setActiveItem(newChipIndex);
786
- }
787
- else {
788
- this.focus();
789
- }
790
- }
791
- this._lastDestroyedChipIndex = null;
792
- }
793
- /**
794
- * Utility to ensure all indexes are valid.
795
- *
796
- * @param index The index to be checked.
797
- * @returns True if the index is valid for our list of chips.
798
- */
799
- _isValidIndex(index) {
800
- return index >= 0 && index < this.chips.length;
801
- }
802
- _isInputEmpty(element) {
803
- if (element && element.nodeName.toLowerCase() === 'input') {
804
- let input = element;
805
- return !input.value;
771
+ else {
772
+ this._keyManager.onKeydown(event);
806
773
  }
807
- return false;
774
+ this.stateChanges.next();
808
775
  }
809
- _setSelectionByValue(value, isUserInput = true) {
810
- this._clearSelection();
811
- this.chips.forEach(chip => chip.deselect());
812
- if (Array.isArray(value)) {
813
- value.forEach(currentValue => this._selectValue(currentValue, isUserInput));
814
- this._sortValues();
776
+ }
777
+ /**
778
+ * Check the tab index as you should not be allowed to focus an empty list.
779
+ */
780
+ _updateTabIndex() {
781
+ // If we have 0 chips, we should not allow keyboard focus
782
+ this._tabIndex = this._userTabIndex || (this.chips.length === 0 ? -1 : 0);
783
+ }
784
+ /**
785
+ * If the amount of chips changed, we need to update the
786
+ * key manager state and focus the next closest chip.
787
+ */
788
+ _updateFocusForDestroyedChips() {
789
+ // Move focus to the closest chip. If no other chips remain, focus the chip-list itself.
790
+ if (this._lastDestroyedChipIndex != null) {
791
+ if (this.chips.length) {
792
+ const newChipIndex = Math.min(this._lastDestroyedChipIndex, this.chips.length - 1);
793
+ this._keyManager.setActiveItem(newChipIndex);
815
794
  }
816
795
  else {
817
- const correspondingChip = this._selectValue(value, isUserInput);
818
- // Shift focus to the active item. Note that we shouldn't do this in multiple
819
- // mode, because we don't know what chip the user interacted with last.
820
- if (correspondingChip) {
821
- if (isUserInput) {
822
- this._keyManager.setActiveItem(correspondingChip);
823
- }
824
- }
796
+ this.focus();
825
797
  }
826
798
  }
827
- /**
828
- * Finds and selects the chip based on its value.
829
- * @returns Chip that has the corresponding value.
830
- */
831
- _selectValue(value, isUserInput = true) {
832
- const correspondingChip = this.chips.find(chip => {
833
- return chip.value != null && this._compareWith(chip.value, value);
834
- });
835
- if (correspondingChip) {
836
- isUserInput ? correspondingChip.selectViaInteraction() : correspondingChip.select();
837
- this._selectionModel.select(correspondingChip);
838
- }
839
- return correspondingChip;
799
+ this._lastDestroyedChipIndex = null;
800
+ }
801
+ /**
802
+ * Utility to ensure all indexes are valid.
803
+ *
804
+ * @param index The index to be checked.
805
+ * @returns True if the index is valid for our list of chips.
806
+ */
807
+ _isValidIndex(index) {
808
+ return index >= 0 && index < this.chips.length;
809
+ }
810
+ _isInputEmpty(element) {
811
+ if (element && element.nodeName.toLowerCase() === 'input') {
812
+ let input = element;
813
+ return !input.value;
840
814
  }
841
- _initializeSelection() {
842
- // Defer setting the value in order to avoid the "Expression
843
- // has changed after it was checked" errors from Angular.
844
- Promise.resolve().then(() => {
845
- if (this.ngControl || this._value) {
846
- this._setSelectionByValue(this.ngControl ? this.ngControl.value : this._value, false);
847
- this.stateChanges.next();
815
+ return false;
816
+ }
817
+ _setSelectionByValue(value, isUserInput = true) {
818
+ this._clearSelection();
819
+ this.chips.forEach(chip => chip.deselect());
820
+ if (Array.isArray(value)) {
821
+ value.forEach(currentValue => this._selectValue(currentValue, isUserInput));
822
+ this._sortValues();
823
+ }
824
+ else {
825
+ const correspondingChip = this._selectValue(value, isUserInput);
826
+ // Shift focus to the active item. Note that we shouldn't do this in multiple
827
+ // mode, because we don't know what chip the user interacted with last.
828
+ if (correspondingChip) {
829
+ if (isUserInput) {
830
+ this._keyManager.setActiveItem(correspondingChip);
848
831
  }
849
- });
832
+ }
850
833
  }
851
- /**
852
- * Deselects every chip in the list.
853
- * @param skip Chip that should not be deselected.
854
- */
855
- _clearSelection(skip) {
834
+ }
835
+ /**
836
+ * Finds and selects the chip based on its value.
837
+ * @returns Chip that has the corresponding value.
838
+ */
839
+ _selectValue(value, isUserInput = true) {
840
+ const correspondingChip = this.chips.find(chip => {
841
+ return chip.value != null && this._compareWith(chip.value, value);
842
+ });
843
+ if (correspondingChip) {
844
+ isUserInput ? correspondingChip.selectViaInteraction() : correspondingChip.select();
845
+ this._selectionModel.select(correspondingChip);
846
+ }
847
+ return correspondingChip;
848
+ }
849
+ _initializeSelection() {
850
+ // Defer setting the value in order to avoid the "Expression
851
+ // has changed after it was checked" errors from Angular.
852
+ Promise.resolve().then(() => {
853
+ if (this.ngControl || this._value) {
854
+ this._setSelectionByValue(this.ngControl ? this.ngControl.value : this._value, false);
855
+ this.stateChanges.next();
856
+ }
857
+ });
858
+ }
859
+ /**
860
+ * Deselects every chip in the list.
861
+ * @param skip Chip that should not be deselected.
862
+ */
863
+ _clearSelection(skip) {
864
+ this._selectionModel.clear();
865
+ this.chips.forEach(chip => {
866
+ if (chip !== skip) {
867
+ chip.deselect();
868
+ }
869
+ });
870
+ this.stateChanges.next();
871
+ }
872
+ /**
873
+ * Sorts the model values, ensuring that they keep the same
874
+ * order that they have in the panel.
875
+ */
876
+ _sortValues() {
877
+ if (this._multiple) {
856
878
  this._selectionModel.clear();
857
879
  this.chips.forEach(chip => {
858
- if (chip !== skip) {
859
- chip.deselect();
880
+ if (chip.selected) {
881
+ this._selectionModel.select(chip);
860
882
  }
861
883
  });
862
884
  this.stateChanges.next();
863
885
  }
864
- /**
865
- * Sorts the model values, ensuring that they keep the same
866
- * order that they have in the panel.
867
- */
868
- _sortValues() {
869
- if (this._multiple) {
870
- this._selectionModel.clear();
871
- this.chips.forEach(chip => {
872
- if (chip.selected) {
873
- this._selectionModel.select(chip);
886
+ }
887
+ /** Emits change event to set the model value. */
888
+ _propagateChanges(fallbackValue) {
889
+ let valueToEmit = null;
890
+ if (Array.isArray(this.selected)) {
891
+ valueToEmit = this.selected.map(chip => chip.value);
892
+ }
893
+ else {
894
+ valueToEmit = this.selected ? this.selected.value : fallbackValue;
895
+ }
896
+ this._value = valueToEmit;
897
+ this.change.emit(new MatChipListChange(this, valueToEmit));
898
+ this.valueChange.emit(valueToEmit);
899
+ this._onChange(valueToEmit);
900
+ this._changeDetectorRef.markForCheck();
901
+ }
902
+ /** When blurred, mark the field as touched when focus moved outside the chip list. */
903
+ _blur() {
904
+ if (!this._hasFocusedChip()) {
905
+ this._keyManager.setActiveItem(-1);
906
+ }
907
+ if (!this.disabled) {
908
+ if (this._chipInput) {
909
+ // If there's a chip input, we should check whether the focus moved to chip input.
910
+ // If the focus is not moved to chip input, mark the field as touched. If the focus moved
911
+ // to chip input, do nothing.
912
+ // Timeout is needed to wait for the focus() event trigger on chip input.
913
+ setTimeout(() => {
914
+ if (!this.focused) {
915
+ this._markAsTouched();
874
916
  }
875
917
  });
876
- this.stateChanges.next();
877
- }
878
- }
879
- /** Emits change event to set the model value. */
880
- _propagateChanges(fallbackValue) {
881
- let valueToEmit = null;
882
- if (Array.isArray(this.selected)) {
883
- valueToEmit = this.selected.map(chip => chip.value);
884
918
  }
885
919
  else {
886
- valueToEmit = this.selected ? this.selected.value : fallbackValue;
920
+ // If there's no chip input, then mark the field as touched.
921
+ this._markAsTouched();
887
922
  }
888
- this._value = valueToEmit;
889
- this.change.emit(new MatChipListChange(this, valueToEmit));
890
- this.valueChange.emit(valueToEmit);
891
- this._onChange(valueToEmit);
892
- this._changeDetectorRef.markForCheck();
893
923
  }
894
- /** When blurred, mark the field as touched when focus moved outside the chip list. */
895
- _blur() {
896
- if (!this._hasFocusedChip()) {
897
- this._keyManager.setActiveItem(-1);
898
- }
899
- if (!this.disabled) {
900
- if (this._chipInput) {
901
- // If there's a chip input, we should check whether the focus moved to chip input.
902
- // If the focus is not moved to chip input, mark the field as touched. If the focus moved
903
- // to chip input, do nothing.
904
- // Timeout is needed to wait for the focus() event trigger on chip input.
905
- setTimeout(() => {
906
- if (!this.focused) {
907
- this._markAsTouched();
908
- }
909
- });
910
- }
911
- else {
912
- // If there's no chip input, then mark the field as touched.
913
- this._markAsTouched();
914
- }
915
- }
924
+ }
925
+ /** Mark the field as touched */
926
+ _markAsTouched() {
927
+ this._onTouched();
928
+ this._changeDetectorRef.markForCheck();
929
+ this.stateChanges.next();
930
+ }
931
+ /**
932
+ * Removes the `tabindex` from the chip list and resets it back afterwards, allowing the
933
+ * user to tab out of it. This prevents the list from capturing focus and redirecting
934
+ * it back to the first chip, creating a focus trap, if it user tries to tab away.
935
+ */
936
+ _allowFocusEscape() {
937
+ if (this._tabIndex !== -1) {
938
+ this._tabIndex = -1;
939
+ setTimeout(() => {
940
+ this._tabIndex = this._userTabIndex || 0;
941
+ this._changeDetectorRef.markForCheck();
942
+ });
916
943
  }
917
- /** Mark the field as touched */
918
- _markAsTouched() {
919
- this._onTouched();
920
- this._changeDetectorRef.markForCheck();
921
- this.stateChanges.next();
944
+ }
945
+ _resetChips() {
946
+ this._dropSubscriptions();
947
+ this._listenToChipsFocus();
948
+ this._listenToChipsSelection();
949
+ this._listenToChipsRemoved();
950
+ }
951
+ _dropSubscriptions() {
952
+ if (this._chipFocusSubscription) {
953
+ this._chipFocusSubscription.unsubscribe();
954
+ this._chipFocusSubscription = null;
922
955
  }
923
- /**
924
- * Removes the `tabindex` from the chip list and resets it back afterwards, allowing the
925
- * user to tab out of it. This prevents the list from capturing focus and redirecting
926
- * it back to the first chip, creating a focus trap, if it user tries to tab away.
927
- */
928
- _allowFocusEscape() {
929
- if (this._tabIndex !== -1) {
930
- this._tabIndex = -1;
931
- setTimeout(() => {
932
- this._tabIndex = this._userTabIndex || 0;
933
- this._changeDetectorRef.markForCheck();
934
- });
935
- }
956
+ if (this._chipBlurSubscription) {
957
+ this._chipBlurSubscription.unsubscribe();
958
+ this._chipBlurSubscription = null;
936
959
  }
937
- _resetChips() {
938
- this._dropSubscriptions();
939
- this._listenToChipsFocus();
940
- this._listenToChipsSelection();
941
- this._listenToChipsRemoved();
960
+ if (this._chipSelectionSubscription) {
961
+ this._chipSelectionSubscription.unsubscribe();
962
+ this._chipSelectionSubscription = null;
942
963
  }
943
- _dropSubscriptions() {
944
- if (this._chipFocusSubscription) {
945
- this._chipFocusSubscription.unsubscribe();
946
- this._chipFocusSubscription = null;
964
+ if (this._chipRemoveSubscription) {
965
+ this._chipRemoveSubscription.unsubscribe();
966
+ this._chipRemoveSubscription = null;
967
+ }
968
+ }
969
+ /** Listens to user-generated selection events on each chip. */
970
+ _listenToChipsSelection() {
971
+ this._chipSelectionSubscription = this.chipSelectionChanges.subscribe(event => {
972
+ event.source.selected
973
+ ? this._selectionModel.select(event.source)
974
+ : this._selectionModel.deselect(event.source);
975
+ // For single selection chip list, make sure the deselected value is unselected.
976
+ if (!this.multiple) {
977
+ this.chips.forEach(chip => {
978
+ if (!this._selectionModel.isSelected(chip) && chip.selected) {
979
+ chip.deselect();
980
+ }
981
+ });
947
982
  }
948
- if (this._chipBlurSubscription) {
949
- this._chipBlurSubscription.unsubscribe();
950
- this._chipBlurSubscription = null;
983
+ if (event.isUserInput) {
984
+ this._propagateChanges();
951
985
  }
952
- if (this._chipSelectionSubscription) {
953
- this._chipSelectionSubscription.unsubscribe();
954
- this._chipSelectionSubscription = null;
986
+ });
987
+ }
988
+ /** Listens to user-generated selection events on each chip. */
989
+ _listenToChipsFocus() {
990
+ this._chipFocusSubscription = this.chipFocusChanges.subscribe(event => {
991
+ let chipIndex = this.chips.toArray().indexOf(event.chip);
992
+ if (this._isValidIndex(chipIndex)) {
993
+ this._keyManager.updateActiveItem(chipIndex);
955
994
  }
956
- if (this._chipRemoveSubscription) {
957
- this._chipRemoveSubscription.unsubscribe();
958
- this._chipRemoveSubscription = null;
995
+ this.stateChanges.next();
996
+ });
997
+ this._chipBlurSubscription = this.chipBlurChanges.subscribe(() => {
998
+ this._blur();
999
+ this.stateChanges.next();
1000
+ });
1001
+ }
1002
+ _listenToChipsRemoved() {
1003
+ this._chipRemoveSubscription = this.chipRemoveChanges.subscribe(event => {
1004
+ const chip = event.chip;
1005
+ const chipIndex = this.chips.toArray().indexOf(event.chip);
1006
+ // In case the chip that will be removed is currently focused, we temporarily store
1007
+ // the index in order to be able to determine an appropriate sibling chip that will
1008
+ // receive focus.
1009
+ if (this._isValidIndex(chipIndex) && chip._hasFocus) {
1010
+ this._lastDestroyedChipIndex = chipIndex;
959
1011
  }
960
- }
961
- /** Listens to user-generated selection events on each chip. */
962
- _listenToChipsSelection() {
963
- this._chipSelectionSubscription = this.chipSelectionChanges.subscribe(event => {
964
- event.source.selected
965
- ? this._selectionModel.select(event.source)
966
- : this._selectionModel.deselect(event.source);
967
- // For single selection chip list, make sure the deselected value is unselected.
968
- if (!this.multiple) {
969
- this.chips.forEach(chip => {
970
- if (!this._selectionModel.isSelected(chip) && chip.selected) {
971
- chip.deselect();
972
- }
973
- });
974
- }
975
- if (event.isUserInput) {
976
- this._propagateChanges();
977
- }
978
- });
979
- }
980
- /** Listens to user-generated selection events on each chip. */
981
- _listenToChipsFocus() {
982
- this._chipFocusSubscription = this.chipFocusChanges.subscribe(event => {
983
- let chipIndex = this.chips.toArray().indexOf(event.chip);
984
- if (this._isValidIndex(chipIndex)) {
985
- this._keyManager.updateActiveItem(chipIndex);
986
- }
987
- this.stateChanges.next();
988
- });
989
- this._chipBlurSubscription = this.chipBlurChanges.subscribe(() => {
990
- this._blur();
991
- this.stateChanges.next();
992
- });
993
- }
994
- _listenToChipsRemoved() {
995
- this._chipRemoveSubscription = this.chipRemoveChanges.subscribe(event => {
996
- const chip = event.chip;
997
- const chipIndex = this.chips.toArray().indexOf(event.chip);
998
- // In case the chip that will be removed is currently focused, we temporarily store
999
- // the index in order to be able to determine an appropriate sibling chip that will
1000
- // receive focus.
1001
- if (this._isValidIndex(chipIndex) && chip._hasFocus) {
1002
- this._lastDestroyedChipIndex = chipIndex;
1003
- }
1004
- });
1005
- }
1006
- /** Checks whether an event comes from inside a chip element. */
1007
- _originatesFromChip(event) {
1008
- let currentElement = event.target;
1009
- while (currentElement && currentElement !== this._elementRef.nativeElement) {
1010
- if (currentElement.classList.contains('mat-chip')) {
1011
- return true;
1012
- }
1013
- currentElement = currentElement.parentElement;
1012
+ });
1013
+ }
1014
+ /** Checks whether an event comes from inside a chip element. */
1015
+ _originatesFromChip(event) {
1016
+ let currentElement = event.target;
1017
+ while (currentElement && currentElement !== this._elementRef.nativeElement) {
1018
+ if (currentElement.classList.contains('mat-chip')) {
1019
+ return true;
1014
1020
  }
1015
- return false;
1016
- }
1017
- /** Checks whether any of the chips is focused. */
1018
- _hasFocusedChip() {
1019
- return this.chips.some(chip => chip._hasFocus);
1021
+ currentElement = currentElement.parentElement;
1020
1022
  }
1021
- /** Syncs the list's state with the individual chips. */
1022
- _syncChipsState() {
1023
- if (this.chips) {
1024
- this.chips.forEach(chip => {
1025
- chip._chipListDisabled = this._disabled;
1026
- chip._chipListMultiple = this.multiple;
1027
- });
1028
- }
1023
+ return false;
1024
+ }
1025
+ /** Checks whether any of the chips is focused. */
1026
+ _hasFocusedChip() {
1027
+ return this.chips && this.chips.some(chip => chip._hasFocus);
1028
+ }
1029
+ /** Syncs the list's state with the individual chips. */
1030
+ _syncChipsState() {
1031
+ if (this.chips) {
1032
+ this.chips.forEach(chip => {
1033
+ chip._chipListDisabled = this._disabled;
1034
+ chip._chipListMultiple = this.multiple;
1035
+ });
1029
1036
  }
1030
1037
  }
1031
- MatChipList.decorators = [
1032
- { type: Component, args: [{
1033
- selector: 'mat-chip-list',
1034
- template: `<div class="mat-chip-list-wrapper"><ng-content></ng-content></div>`,
1035
- exportAs: 'matChipList',
1036
- host: {
1037
- '[attr.tabindex]': 'disabled ? null : _tabIndex',
1038
- '[attr.aria-describedby]': '_ariaDescribedby || null',
1039
- '[attr.aria-required]': 'role ? required : null',
1040
- '[attr.aria-disabled]': 'disabled.toString()',
1041
- '[attr.aria-invalid]': 'errorState',
1042
- '[attr.aria-multiselectable]': 'multiple',
1043
- '[attr.role]': 'role',
1044
- '[class.mat-chip-list-disabled]': 'disabled',
1045
- '[class.mat-chip-list-invalid]': 'errorState',
1046
- '[class.mat-chip-list-required]': 'required',
1047
- '[attr.aria-orientation]': 'ariaOrientation',
1048
- 'class': 'mat-chip-list',
1049
- '(focus)': 'focus()',
1050
- '(blur)': '_blur()',
1051
- '(keydown)': '_keydown($event)',
1052
- '[id]': '_uid',
1053
- },
1054
- providers: [{ provide: MatFormFieldControl, useExisting: MatChipList }],
1055
- encapsulation: ViewEncapsulation.None,
1056
- changeDetection: ChangeDetectionStrategy.OnPush,
1057
- styles: [".mat-chip{position:relative;box-sizing:border-box;-webkit-tap-highlight-color:transparent;transform:translateZ(0);border:none;-webkit-appearance:none;-moz-appearance:none}.mat-standard-chip{transition:box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1);display:inline-flex;padding:7px 12px;border-radius:16px;align-items:center;cursor:default;min-height:32px;height:1px}._mat-animation-noopable.mat-standard-chip{transition:none;animation:none}.mat-standard-chip .mat-chip-remove.mat-icon{width:18px;height:18px}.mat-standard-chip::after{top:0;left:0;right:0;bottom:0;position:absolute;border-radius:inherit;opacity:0;content:\"\";pointer-events:none;transition:opacity 200ms cubic-bezier(0.35, 0, 0.25, 1)}.mat-standard-chip:hover::after{opacity:.12}.mat-standard-chip:focus{outline:none}.mat-standard-chip:focus::after{opacity:.16}.cdk-high-contrast-active .mat-standard-chip{outline:solid 1px}.cdk-high-contrast-active .mat-standard-chip:focus{outline:dotted 2px}.mat-standard-chip.mat-chip-disabled::after{opacity:0}.mat-standard-chip.mat-chip-disabled .mat-chip-remove,.mat-standard-chip.mat-chip-disabled .mat-chip-trailing-icon{cursor:default}.mat-standard-chip.mat-chip-with-trailing-icon.mat-chip-with-avatar,.mat-standard-chip.mat-chip-with-avatar{padding-top:0;padding-bottom:0}.mat-standard-chip.mat-chip-with-trailing-icon.mat-chip-with-avatar{padding-right:8px;padding-left:0}[dir=rtl] .mat-standard-chip.mat-chip-with-trailing-icon.mat-chip-with-avatar{padding-left:8px;padding-right:0}.mat-standard-chip.mat-chip-with-trailing-icon{padding-top:7px;padding-bottom:7px;padding-right:8px;padding-left:12px}[dir=rtl] .mat-standard-chip.mat-chip-with-trailing-icon{padding-left:8px;padding-right:12px}.mat-standard-chip.mat-chip-with-avatar{padding-left:0;padding-right:12px}[dir=rtl] .mat-standard-chip.mat-chip-with-avatar{padding-right:0;padding-left:12px}.mat-standard-chip .mat-chip-avatar{width:24px;height:24px;margin-right:8px;margin-left:4px}[dir=rtl] .mat-standard-chip .mat-chip-avatar{margin-left:8px;margin-right:4px}.mat-standard-chip .mat-chip-remove,.mat-standard-chip .mat-chip-trailing-icon{width:18px;height:18px;cursor:pointer}.mat-standard-chip .mat-chip-remove,.mat-standard-chip .mat-chip-trailing-icon{margin-left:8px;margin-right:0}[dir=rtl] .mat-standard-chip .mat-chip-remove,[dir=rtl] .mat-standard-chip .mat-chip-trailing-icon{margin-right:8px;margin-left:0}.mat-chip-ripple{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none;border-radius:inherit;overflow:hidden}.mat-chip-list-wrapper{display:flex;flex-direction:row;flex-wrap:wrap;align-items:center;margin:-4px}.mat-chip-list-wrapper input.mat-input-element,.mat-chip-list-wrapper .mat-standard-chip{margin:4px}.mat-chip-list-stacked .mat-chip-list-wrapper{flex-direction:column;align-items:flex-start}.mat-chip-list-stacked .mat-chip-list-wrapper .mat-standard-chip{width:100%}.mat-chip-avatar{border-radius:50%;justify-content:center;align-items:center;display:flex;overflow:hidden;object-fit:cover}input.mat-chip-input{width:150px;margin:4px;flex:1 0 150px}\n"]
1058
- },] }
1059
- ];
1060
- MatChipList.ctorParameters = () => [
1061
- { type: ElementRef },
1062
- { type: ChangeDetectorRef },
1063
- { type: Directionality, decorators: [{ type: Optional }] },
1064
- { type: NgForm, decorators: [{ type: Optional }] },
1065
- { type: FormGroupDirective, decorators: [{ type: Optional }] },
1066
- { type: ErrorStateMatcher },
1067
- { type: NgControl, decorators: [{ type: Optional }, { type: Self }] }
1068
- ];
1069
- MatChipList.propDecorators = {
1070
- errorStateMatcher: [{ type: Input }],
1071
- multiple: [{ type: Input }],
1072
- compareWith: [{ type: Input }],
1073
- value: [{ type: Input }],
1074
- required: [{ type: Input }],
1075
- placeholder: [{ type: Input }],
1076
- disabled: [{ type: Input }],
1077
- ariaOrientation: [{ type: Input, args: ['aria-orientation',] }],
1078
- selectable: [{ type: Input }],
1079
- tabIndex: [{ type: Input }],
1080
- change: [{ type: Output }],
1081
- valueChange: [{ type: Output }],
1082
- chips: [{ type: ContentChildren, args: [MatChip, {
1083
- // We need to use `descendants: true`, because Ivy will no longer match
1084
- // indirect descendants if it's left as false.
1085
- descendants: true
1086
- },] }]
1087
- };
1088
- return MatChipList;
1089
- })();
1038
+ }
1039
+ MatChipList.decorators = [
1040
+ { type: Component, args: [{
1041
+ selector: 'mat-chip-list',
1042
+ template: `<div class="mat-chip-list-wrapper"><ng-content></ng-content></div>`,
1043
+ exportAs: 'matChipList',
1044
+ host: {
1045
+ '[attr.tabindex]': 'disabled ? null : _tabIndex',
1046
+ '[attr.aria-describedby]': '_ariaDescribedby || null',
1047
+ '[attr.aria-required]': 'role ? required : null',
1048
+ '[attr.aria-disabled]': 'disabled.toString()',
1049
+ '[attr.aria-invalid]': 'errorState',
1050
+ '[attr.aria-multiselectable]': 'multiple',
1051
+ '[attr.role]': 'role',
1052
+ '[class.mat-chip-list-disabled]': 'disabled',
1053
+ '[class.mat-chip-list-invalid]': 'errorState',
1054
+ '[class.mat-chip-list-required]': 'required',
1055
+ '[attr.aria-orientation]': 'ariaOrientation',
1056
+ 'class': 'mat-chip-list',
1057
+ '(focus)': 'focus()',
1058
+ '(blur)': '_blur()',
1059
+ '(keydown)': '_keydown($event)',
1060
+ '[id]': '_uid',
1061
+ },
1062
+ providers: [{ provide: MatFormFieldControl, useExisting: MatChipList }],
1063
+ encapsulation: ViewEncapsulation.None,
1064
+ changeDetection: ChangeDetectionStrategy.OnPush,
1065
+ styles: [".mat-chip{position:relative;box-sizing:border-box;-webkit-tap-highlight-color:transparent;transform:translateZ(0);border:none;-webkit-appearance:none;-moz-appearance:none}.mat-standard-chip{transition:box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1);display:inline-flex;padding:7px 12px;border-radius:16px;align-items:center;cursor:default;min-height:32px;height:1px}._mat-animation-noopable.mat-standard-chip{transition:none;animation:none}.mat-standard-chip .mat-chip-remove.mat-icon{width:18px;height:18px}.mat-standard-chip::after{top:0;left:0;right:0;bottom:0;position:absolute;border-radius:inherit;opacity:0;content:\"\";pointer-events:none;transition:opacity 200ms cubic-bezier(0.35, 0, 0.25, 1)}.mat-standard-chip:hover::after{opacity:.12}.mat-standard-chip:focus{outline:none}.mat-standard-chip:focus::after{opacity:.16}.cdk-high-contrast-active .mat-standard-chip{outline:solid 1px}.cdk-high-contrast-active .mat-standard-chip:focus{outline:dotted 2px}.mat-standard-chip.mat-chip-disabled::after{opacity:0}.mat-standard-chip.mat-chip-disabled .mat-chip-remove,.mat-standard-chip.mat-chip-disabled .mat-chip-trailing-icon{cursor:default}.mat-standard-chip.mat-chip-with-trailing-icon.mat-chip-with-avatar,.mat-standard-chip.mat-chip-with-avatar{padding-top:0;padding-bottom:0}.mat-standard-chip.mat-chip-with-trailing-icon.mat-chip-with-avatar{padding-right:8px;padding-left:0}[dir=rtl] .mat-standard-chip.mat-chip-with-trailing-icon.mat-chip-with-avatar{padding-left:8px;padding-right:0}.mat-standard-chip.mat-chip-with-trailing-icon{padding-top:7px;padding-bottom:7px;padding-right:8px;padding-left:12px}[dir=rtl] .mat-standard-chip.mat-chip-with-trailing-icon{padding-left:8px;padding-right:12px}.mat-standard-chip.mat-chip-with-avatar{padding-left:0;padding-right:12px}[dir=rtl] .mat-standard-chip.mat-chip-with-avatar{padding-right:0;padding-left:12px}.mat-standard-chip .mat-chip-avatar{width:24px;height:24px;margin-right:8px;margin-left:4px}[dir=rtl] .mat-standard-chip .mat-chip-avatar{margin-left:8px;margin-right:4px}.mat-standard-chip .mat-chip-remove,.mat-standard-chip .mat-chip-trailing-icon{width:18px;height:18px;cursor:pointer}.mat-standard-chip .mat-chip-remove,.mat-standard-chip .mat-chip-trailing-icon{margin-left:8px;margin-right:0}[dir=rtl] .mat-standard-chip .mat-chip-remove,[dir=rtl] .mat-standard-chip .mat-chip-trailing-icon{margin-right:8px;margin-left:0}.mat-chip-ripple{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none;border-radius:inherit;overflow:hidden}.mat-chip-list-wrapper{display:flex;flex-direction:row;flex-wrap:wrap;align-items:center;margin:-4px}.mat-chip-list-wrapper input.mat-input-element,.mat-chip-list-wrapper .mat-standard-chip{margin:4px}.mat-chip-list-stacked .mat-chip-list-wrapper{flex-direction:column;align-items:flex-start}.mat-chip-list-stacked .mat-chip-list-wrapper .mat-standard-chip{width:100%}.mat-chip-avatar{border-radius:50%;justify-content:center;align-items:center;display:flex;overflow:hidden;object-fit:cover}input.mat-chip-input{width:150px;margin:4px;flex:1 0 150px}\n"]
1066
+ },] }
1067
+ ];
1068
+ MatChipList.ctorParameters = () => [
1069
+ { type: ElementRef },
1070
+ { type: ChangeDetectorRef },
1071
+ { type: Directionality, decorators: [{ type: Optional }] },
1072
+ { type: NgForm, decorators: [{ type: Optional }] },
1073
+ { type: FormGroupDirective, decorators: [{ type: Optional }] },
1074
+ { type: ErrorStateMatcher },
1075
+ { type: NgControl, decorators: [{ type: Optional }, { type: Self }] }
1076
+ ];
1077
+ MatChipList.propDecorators = {
1078
+ errorStateMatcher: [{ type: Input }],
1079
+ multiple: [{ type: Input }],
1080
+ compareWith: [{ type: Input }],
1081
+ value: [{ type: Input }],
1082
+ required: [{ type: Input }],
1083
+ placeholder: [{ type: Input }],
1084
+ disabled: [{ type: Input }],
1085
+ ariaOrientation: [{ type: Input, args: ['aria-orientation',] }],
1086
+ selectable: [{ type: Input }],
1087
+ tabIndex: [{ type: Input }],
1088
+ change: [{ type: Output }],
1089
+ valueChange: [{ type: Output }],
1090
+ chips: [{ type: ContentChildren, args: [MatChip, {
1091
+ // We need to use `descendants: true`, because Ivy will no longer match
1092
+ // indirect descendants if it's left as false.
1093
+ descendants: true
1094
+ },] }]
1095
+ };
1090
1096
 
1091
1097
  /**
1092
1098
  * @license
@@ -1101,137 +1107,134 @@ let nextUniqueId$1 = 0;
1101
1107
  * Directive that adds chip-specific behaviors to an input element inside `<mat-form-field>`.
1102
1108
  * May be placed inside or outside of an `<mat-chip-list>`.
1103
1109
  */
1104
- let MatChipInput = /** @class */ (() => {
1105
- class MatChipInput {
1106
- constructor(_elementRef, _defaultOptions) {
1107
- this._elementRef = _elementRef;
1108
- this._defaultOptions = _defaultOptions;
1109
- /** Whether the control is focused. */
1110
- this.focused = false;
1111
- this._addOnBlur = false;
1112
- /**
1113
- * The list of key codes that will trigger a chipEnd event.
1114
- *
1115
- * Defaults to `[ENTER]`.
1116
- */
1117
- this.separatorKeyCodes = this._defaultOptions.separatorKeyCodes;
1118
- /** Emitted when a chip is to be added. */
1119
- this.chipEnd = new EventEmitter();
1120
- /** The input's placeholder text. */
1121
- this.placeholder = '';
1122
- /** Unique id for the input. */
1123
- this.id = `mat-chip-list-input-${nextUniqueId$1++}`;
1124
- this._disabled = false;
1125
- this._inputElement = this._elementRef.nativeElement;
1126
- }
1127
- /** Register input for chip list */
1128
- set chipList(value) {
1129
- if (value) {
1130
- this._chipList = value;
1131
- this._chipList.registerInput(this);
1132
- }
1133
- }
1110
+ class MatChipInput {
1111
+ constructor(_elementRef, _defaultOptions) {
1112
+ this._elementRef = _elementRef;
1113
+ this._defaultOptions = _defaultOptions;
1114
+ /** Whether the control is focused. */
1115
+ this.focused = false;
1116
+ this._addOnBlur = false;
1134
1117
  /**
1135
- * Whether or not the chipEnd event will be emitted when the input is blurred.
1118
+ * The list of key codes that will trigger a chipEnd event.
1119
+ *
1120
+ * Defaults to `[ENTER]`.
1136
1121
  */
1137
- get addOnBlur() { return this._addOnBlur; }
1138
- set addOnBlur(value) { this._addOnBlur = coerceBooleanProperty(value); }
1139
- /** Whether the input is disabled. */
1140
- get disabled() { return this._disabled || (this._chipList && this._chipList.disabled); }
1141
- set disabled(value) { this._disabled = coerceBooleanProperty(value); }
1142
- /** Whether the input is empty. */
1143
- get empty() { return !this._inputElement.value; }
1144
- ngOnChanges() {
1145
- this._chipList.stateChanges.next();
1146
- }
1147
- /** Utility method to make host definition/tests more clear. */
1148
- _keydown(event) {
1149
- // Allow the user's focus to escape when they're tabbing forward. Note that we don't
1150
- // want to do this when going backwards, because focus should go back to the first chip.
1151
- if (event && event.keyCode === TAB && !hasModifierKey(event, 'shiftKey')) {
1152
- this._chipList._allowFocusEscape();
1153
- }
1154
- this._emitChipEnd(event);
1122
+ this.separatorKeyCodes = this._defaultOptions.separatorKeyCodes;
1123
+ /** Emitted when a chip is to be added. */
1124
+ this.chipEnd = new EventEmitter();
1125
+ /** The input's placeholder text. */
1126
+ this.placeholder = '';
1127
+ /** Unique id for the input. */
1128
+ this.id = `mat-chip-list-input-${nextUniqueId$1++}`;
1129
+ this._disabled = false;
1130
+ this._inputElement = this._elementRef.nativeElement;
1131
+ }
1132
+ /** Register input for chip list */
1133
+ set chipList(value) {
1134
+ if (value) {
1135
+ this._chipList = value;
1136
+ this._chipList.registerInput(this);
1155
1137
  }
1156
- /** Checks to see if the blur should emit the (chipEnd) event. */
1157
- _blur() {
1158
- if (this.addOnBlur) {
1159
- this._emitChipEnd();
1160
- }
1161
- this.focused = false;
1162
- // Blur the chip list if it is not focused
1163
- if (!this._chipList.focused) {
1164
- this._chipList._blur();
1165
- }
1166
- this._chipList.stateChanges.next();
1138
+ }
1139
+ /**
1140
+ * Whether or not the chipEnd event will be emitted when the input is blurred.
1141
+ */
1142
+ get addOnBlur() { return this._addOnBlur; }
1143
+ set addOnBlur(value) { this._addOnBlur = coerceBooleanProperty(value); }
1144
+ /** Whether the input is disabled. */
1145
+ get disabled() { return this._disabled || (this._chipList && this._chipList.disabled); }
1146
+ set disabled(value) { this._disabled = coerceBooleanProperty(value); }
1147
+ /** Whether the input is empty. */
1148
+ get empty() { return !this._inputElement.value; }
1149
+ ngOnChanges() {
1150
+ this._chipList.stateChanges.next();
1151
+ }
1152
+ /** Utility method to make host definition/tests more clear. */
1153
+ _keydown(event) {
1154
+ // Allow the user's focus to escape when they're tabbing forward. Note that we don't
1155
+ // want to do this when going backwards, because focus should go back to the first chip.
1156
+ if (event && event.keyCode === TAB && !hasModifierKey(event, 'shiftKey')) {
1157
+ this._chipList._allowFocusEscape();
1158
+ }
1159
+ this._emitChipEnd(event);
1160
+ }
1161
+ /** Checks to see if the blur should emit the (chipEnd) event. */
1162
+ _blur() {
1163
+ if (this.addOnBlur) {
1164
+ this._emitChipEnd();
1167
1165
  }
1168
- _focus() {
1169
- this.focused = true;
1170
- this._chipList.stateChanges.next();
1166
+ this.focused = false;
1167
+ // Blur the chip list if it is not focused
1168
+ if (!this._chipList.focused) {
1169
+ this._chipList._blur();
1171
1170
  }
1172
- /** Checks to see if the (chipEnd) event needs to be emitted. */
1173
- _emitChipEnd(event) {
1174
- if (!this._inputElement.value && !!event) {
1175
- this._chipList._keydown(event);
1176
- }
1177
- if (!event || this._isSeparatorKey(event)) {
1178
- this.chipEnd.emit({ input: this._inputElement, value: this._inputElement.value });
1179
- if (event) {
1180
- event.preventDefault();
1181
- }
1171
+ this._chipList.stateChanges.next();
1172
+ }
1173
+ _focus() {
1174
+ this.focused = true;
1175
+ this._chipList.stateChanges.next();
1176
+ }
1177
+ /** Checks to see if the (chipEnd) event needs to be emitted. */
1178
+ _emitChipEnd(event) {
1179
+ if (!this._inputElement.value && !!event) {
1180
+ this._chipList._keydown(event);
1181
+ }
1182
+ if (!event || this._isSeparatorKey(event)) {
1183
+ this.chipEnd.emit({ input: this._inputElement, value: this._inputElement.value });
1184
+ if (event) {
1185
+ event.preventDefault();
1182
1186
  }
1183
1187
  }
1184
- _onInput() {
1185
- // Let chip list know whenever the value changes.
1186
- this._chipList.stateChanges.next();
1187
- }
1188
- /** Focuses the input. */
1189
- focus(options) {
1190
- this._inputElement.focus(options);
1191
- }
1192
- /** Checks whether a keycode is one of the configured separators. */
1193
- _isSeparatorKey(event) {
1194
- if (hasModifierKey(event)) {
1195
- return false;
1196
- }
1197
- const separators = this.separatorKeyCodes;
1198
- const keyCode = event.keyCode;
1199
- return Array.isArray(separators) ? separators.indexOf(keyCode) > -1 : separators.has(keyCode);
1188
+ }
1189
+ _onInput() {
1190
+ // Let chip list know whenever the value changes.
1191
+ this._chipList.stateChanges.next();
1192
+ }
1193
+ /** Focuses the input. */
1194
+ focus(options) {
1195
+ this._inputElement.focus(options);
1196
+ }
1197
+ /** Checks whether a keycode is one of the configured separators. */
1198
+ _isSeparatorKey(event) {
1199
+ if (hasModifierKey(event)) {
1200
+ return false;
1200
1201
  }
1202
+ const separators = this.separatorKeyCodes;
1203
+ const keyCode = event.keyCode;
1204
+ return Array.isArray(separators) ? separators.indexOf(keyCode) > -1 : separators.has(keyCode);
1201
1205
  }
1202
- MatChipInput.decorators = [
1203
- { type: Directive, args: [{
1204
- selector: 'input[matChipInputFor]',
1205
- exportAs: 'matChipInput, matChipInputFor',
1206
- host: {
1207
- 'class': 'mat-chip-input mat-input-element',
1208
- '(keydown)': '_keydown($event)',
1209
- '(blur)': '_blur()',
1210
- '(focus)': '_focus()',
1211
- '(input)': '_onInput()',
1212
- '[id]': 'id',
1213
- '[attr.disabled]': 'disabled || null',
1214
- '[attr.placeholder]': 'placeholder || null',
1215
- '[attr.aria-invalid]': '_chipList && _chipList.ngControl ? _chipList.ngControl.invalid : null',
1216
- '[attr.aria-required]': '_chipList && _chipList.required || null',
1217
- }
1218
- },] }
1219
- ];
1220
- MatChipInput.ctorParameters = () => [
1221
- { type: ElementRef },
1222
- { type: undefined, decorators: [{ type: Inject, args: [MAT_CHIPS_DEFAULT_OPTIONS,] }] }
1223
- ];
1224
- MatChipInput.propDecorators = {
1225
- chipList: [{ type: Input, args: ['matChipInputFor',] }],
1226
- addOnBlur: [{ type: Input, args: ['matChipInputAddOnBlur',] }],
1227
- separatorKeyCodes: [{ type: Input, args: ['matChipInputSeparatorKeyCodes',] }],
1228
- chipEnd: [{ type: Output, args: ['matChipInputTokenEnd',] }],
1229
- placeholder: [{ type: Input }],
1230
- id: [{ type: Input }],
1231
- disabled: [{ type: Input }]
1232
- };
1233
- return MatChipInput;
1234
- })();
1206
+ }
1207
+ MatChipInput.decorators = [
1208
+ { type: Directive, args: [{
1209
+ selector: 'input[matChipInputFor]',
1210
+ exportAs: 'matChipInput, matChipInputFor',
1211
+ host: {
1212
+ 'class': 'mat-chip-input mat-input-element',
1213
+ '(keydown)': '_keydown($event)',
1214
+ '(blur)': '_blur()',
1215
+ '(focus)': '_focus()',
1216
+ '(input)': '_onInput()',
1217
+ '[id]': 'id',
1218
+ '[attr.disabled]': 'disabled || null',
1219
+ '[attr.placeholder]': 'placeholder || null',
1220
+ '[attr.aria-invalid]': '_chipList && _chipList.ngControl ? _chipList.ngControl.invalid : null',
1221
+ '[attr.aria-required]': '_chipList && _chipList.required || null',
1222
+ }
1223
+ },] }
1224
+ ];
1225
+ MatChipInput.ctorParameters = () => [
1226
+ { type: ElementRef },
1227
+ { type: undefined, decorators: [{ type: Inject, args: [MAT_CHIPS_DEFAULT_OPTIONS,] }] }
1228
+ ];
1229
+ MatChipInput.propDecorators = {
1230
+ chipList: [{ type: Input, args: ['matChipInputFor',] }],
1231
+ addOnBlur: [{ type: Input, args: ['matChipInputAddOnBlur',] }],
1232
+ separatorKeyCodes: [{ type: Input, args: ['matChipInputSeparatorKeyCodes',] }],
1233
+ chipEnd: [{ type: Output, args: ['matChipInputTokenEnd',] }],
1234
+ placeholder: [{ type: Input }],
1235
+ id: [{ type: Input }],
1236
+ disabled: [{ type: Input }]
1237
+ };
1235
1238
 
1236
1239
  /**
1237
1240
  * @license
@@ -1251,24 +1254,21 @@ const CHIP_DECLARATIONS = [
1251
1254
  const ɵ0 = {
1252
1255
  separatorKeyCodes: [ENTER]
1253
1256
  };
1254
- let MatChipsModule = /** @class */ (() => {
1255
- class MatChipsModule {
1256
- }
1257
- MatChipsModule.decorators = [
1258
- { type: NgModule, args: [{
1259
- exports: CHIP_DECLARATIONS,
1260
- declarations: CHIP_DECLARATIONS,
1261
- providers: [
1262
- ErrorStateMatcher,
1263
- {
1264
- provide: MAT_CHIPS_DEFAULT_OPTIONS,
1265
- useValue: ɵ0
1266
- }
1267
- ]
1268
- },] }
1269
- ];
1270
- return MatChipsModule;
1271
- })();
1257
+ class MatChipsModule {
1258
+ }
1259
+ MatChipsModule.decorators = [
1260
+ { type: NgModule, args: [{
1261
+ exports: CHIP_DECLARATIONS,
1262
+ declarations: CHIP_DECLARATIONS,
1263
+ providers: [
1264
+ ErrorStateMatcher,
1265
+ {
1266
+ provide: MAT_CHIPS_DEFAULT_OPTIONS,
1267
+ useValue: ɵ0
1268
+ }
1269
+ ]
1270
+ },] }
1271
+ ];
1272
1272
 
1273
1273
  /**
1274
1274
  * @license
@@ -1282,5 +1282,5 @@ let MatChipsModule = /** @class */ (() => {
1282
1282
  * Generated bundle index. Do not edit.
1283
1283
  */
1284
1284
 
1285
- export { MAT_CHIPS_DEFAULT_OPTIONS, MatChip, MatChipAvatar, MatChipInput, MatChipList, MatChipListChange, MatChipRemove, MatChipSelectionChange, MatChipTrailingIcon, MatChipsModule, ɵ0 };
1285
+ export { MAT_CHIPS_DEFAULT_OPTIONS, MAT_CHIP_AVATAR, MAT_CHIP_REMOVE, MAT_CHIP_TRAILING_ICON, MatChip, MatChipAvatar, MatChipInput, MatChipList, MatChipListChange, MatChipRemove, MatChipSelectionChange, MatChipTrailingIcon, MatChipsModule, ɵ0 };
1286
1286
  //# sourceMappingURL=chips.js.map