@angular/cdk 19.2.13 → 19.2.15

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 (429) hide show
  1. package/_adev_assets/cdk_testing.json +7032 -1
  2. package/_adev_assets/cdk_testing_protractor.json +1747 -1
  3. package/_adev_assets/cdk_testing_selenium_webdriver.json +1801 -1
  4. package/_adev_assets/cdk_testing_testbed.json +1903 -1
  5. package/dialog/index.d.ts +17 -12
  6. package/fesm2022/cdk.mjs +1 -1
  7. package/fesm2022/cdk.mjs.map +1 -1
  8. package/fesm2022/dialog.mjs +21 -9
  9. package/fesm2022/dialog.mjs.map +1 -1
  10. package/fesm2022/testing.mjs +255 -52
  11. package/fesm2022/testing.mjs.map +1 -1
  12. package/{harness-environment.d-BatBdODN.d.ts → harness-environment.d-BbFzIFDE.d.ts} +362 -89
  13. package/package.json +1 -1
  14. package/schematics/ng-add/index.js +1 -1
  15. package/testing/index.d.ts +6 -2
  16. package/testing/selenium-webdriver/index.d.ts +1 -1
  17. package/testing/testbed/index.d.ts +1 -1
  18. package/npm_package/LICENSE +0 -21
  19. package/npm_package/README.md +0 -6
  20. package/npm_package/_adev_assets/cdk_testing.json +0 -1
  21. package/npm_package/_adev_assets/cdk_testing_protractor.json +0 -1
  22. package/npm_package/_adev_assets/cdk_testing_selenium_webdriver.json +0 -1
  23. package/npm_package/_adev_assets/cdk_testing_testbed.json +0 -1
  24. package/npm_package/_index.scss +0 -8
  25. package/npm_package/a11y/_index.scss +0 -60
  26. package/npm_package/a11y/index.d.ts +0 -550
  27. package/npm_package/a11y-module.d-DBHGyKoh.d.ts +0 -314
  28. package/npm_package/a11y-prebuilt.css +0 -1
  29. package/npm_package/accordion/index.d.ts +0 -90
  30. package/npm_package/activedescendant-key-manager.d-Bjic5obv.d.ts +0 -32
  31. package/npm_package/bidi/index.d.ts +0 -21
  32. package/npm_package/bidi-module.d-D-fEBKdS.d.ts +0 -54
  33. package/npm_package/clipboard/index.d.ts +0 -101
  34. package/npm_package/coercion/index.d.ts +0 -45
  35. package/npm_package/coercion/private/index.d.ts +0 -9
  36. package/npm_package/collections/index.d.ts +0 -99
  37. package/npm_package/data-source.d-Bblv7Zvh.d.ts +0 -43
  38. package/npm_package/dialog/index.d.ts +0 -426
  39. package/npm_package/drag-drop/index.d.ts +0 -1383
  40. package/npm_package/fesm2022/a11y-module-BYox5gpI.mjs +0 -952
  41. package/npm_package/fesm2022/a11y-module-BYox5gpI.mjs.map +0 -1
  42. package/npm_package/fesm2022/a11y.mjs +0 -539
  43. package/npm_package/fesm2022/a11y.mjs.map +0 -1
  44. package/npm_package/fesm2022/accordion.mjs +0 -210
  45. package/npm_package/fesm2022/accordion.mjs.map +0 -1
  46. package/npm_package/fesm2022/activedescendant-key-manager-DC3-fwQI.mjs +0 -16
  47. package/npm_package/fesm2022/activedescendant-key-manager-DC3-fwQI.mjs.map +0 -1
  48. package/npm_package/fesm2022/array-I1yfCXUO.mjs +0 -6
  49. package/npm_package/fesm2022/array-I1yfCXUO.mjs.map +0 -1
  50. package/npm_package/fesm2022/backwards-compatibility-DHR38MsD.mjs +0 -25
  51. package/npm_package/fesm2022/backwards-compatibility-DHR38MsD.mjs.map +0 -1
  52. package/npm_package/fesm2022/bidi.mjs +0 -80
  53. package/npm_package/fesm2022/bidi.mjs.map +0 -1
  54. package/npm_package/fesm2022/boolean-property-DaaVhX5A.mjs +0 -7
  55. package/npm_package/fesm2022/boolean-property-DaaVhX5A.mjs.map +0 -1
  56. package/npm_package/fesm2022/breakpoints-observer-CljOfYGy.mjs +0 -179
  57. package/npm_package/fesm2022/breakpoints-observer-CljOfYGy.mjs.map +0 -1
  58. package/npm_package/fesm2022/cdk.mjs +0 -7
  59. package/npm_package/fesm2022/cdk.mjs.map +0 -1
  60. package/npm_package/fesm2022/clipboard.mjs +0 -211
  61. package/npm_package/fesm2022/clipboard.mjs.map +0 -1
  62. package/npm_package/fesm2022/coercion/private.mjs +0 -15
  63. package/npm_package/fesm2022/coercion/private.mjs.map +0 -1
  64. package/npm_package/fesm2022/coercion.mjs +0 -39
  65. package/npm_package/fesm2022/coercion.mjs.map +0 -1
  66. package/npm_package/fesm2022/collections.mjs +0 -8
  67. package/npm_package/fesm2022/collections.mjs.map +0 -1
  68. package/npm_package/fesm2022/css-pixel-value-C_HEqLhI.mjs +0 -10
  69. package/npm_package/fesm2022/css-pixel-value-C_HEqLhI.mjs.map +0 -1
  70. package/npm_package/fesm2022/data-source-D34wiQZj.mjs +0 -15
  71. package/npm_package/fesm2022/data-source-D34wiQZj.mjs.map +0 -1
  72. package/npm_package/fesm2022/dialog.mjs +0 -870
  73. package/npm_package/fesm2022/dialog.mjs.map +0 -1
  74. package/npm_package/fesm2022/directionality-CBXD4hga.mjs +0 -72
  75. package/npm_package/fesm2022/directionality-CBXD4hga.mjs.map +0 -1
  76. package/npm_package/fesm2022/dispose-view-repeater-strategy-D_JReLI1.mjs +0 -44
  77. package/npm_package/fesm2022/dispose-view-repeater-strategy-D_JReLI1.mjs.map +0 -1
  78. package/npm_package/fesm2022/drag-drop.mjs +0 -4359
  79. package/npm_package/fesm2022/drag-drop.mjs.map +0 -1
  80. package/npm_package/fesm2022/element-x4z00URv.mjs +0 -29
  81. package/npm_package/fesm2022/element-x4z00URv.mjs.map +0 -1
  82. package/npm_package/fesm2022/fake-event-detection-DWOdFTFz.mjs +0 -24
  83. package/npm_package/fesm2022/fake-event-detection-DWOdFTFz.mjs.map +0 -1
  84. package/npm_package/fesm2022/focus-key-manager-C1rAQJ5z.mjs +0 -22
  85. package/npm_package/fesm2022/focus-key-manager-C1rAQJ5z.mjs.map +0 -1
  86. package/npm_package/fesm2022/focus-monitor-e2l_RpN3.mjs +0 -629
  87. package/npm_package/fesm2022/focus-monitor-e2l_RpN3.mjs.map +0 -1
  88. package/npm_package/fesm2022/id-generator-Dw_9dSDu.mjs +0 -37
  89. package/npm_package/fesm2022/id-generator-Dw_9dSDu.mjs.map +0 -1
  90. package/npm_package/fesm2022/keycodes-CpHkExLC.mjs +0 -122
  91. package/npm_package/fesm2022/keycodes-CpHkExLC.mjs.map +0 -1
  92. package/npm_package/fesm2022/keycodes.mjs +0 -15
  93. package/npm_package/fesm2022/keycodes.mjs.map +0 -1
  94. package/npm_package/fesm2022/layout.mjs +0 -43
  95. package/npm_package/fesm2022/layout.mjs.map +0 -1
  96. package/npm_package/fesm2022/list-key-manager-CyOIXo8P.mjs +0 -360
  97. package/npm_package/fesm2022/list-key-manager-CyOIXo8P.mjs.map +0 -1
  98. package/npm_package/fesm2022/listbox.mjs +0 -925
  99. package/npm_package/fesm2022/listbox.mjs.map +0 -1
  100. package/npm_package/fesm2022/menu.mjs +0 -1966
  101. package/npm_package/fesm2022/menu.mjs.map +0 -1
  102. package/npm_package/fesm2022/observers/private.mjs +0 -124
  103. package/npm_package/fesm2022/observers/private.mjs.map +0 -1
  104. package/npm_package/fesm2022/observers.mjs +0 -210
  105. package/npm_package/fesm2022/observers.mjs.map +0 -1
  106. package/npm_package/fesm2022/overlay-module-BUj0D19H.mjs +0 -3029
  107. package/npm_package/fesm2022/overlay-module-BUj0D19H.mjs.map +0 -1
  108. package/npm_package/fesm2022/overlay.mjs +0 -102
  109. package/npm_package/fesm2022/overlay.mjs.map +0 -1
  110. package/npm_package/fesm2022/passive-listeners-esHZRgIN.mjs +0 -31
  111. package/npm_package/fesm2022/passive-listeners-esHZRgIN.mjs.map +0 -1
  112. package/npm_package/fesm2022/platform-DmdVEw_C.mjs +0 -77
  113. package/npm_package/fesm2022/platform-DmdVEw_C.mjs.map +0 -1
  114. package/npm_package/fesm2022/platform.mjs +0 -74
  115. package/npm_package/fesm2022/platform.mjs.map +0 -1
  116. package/npm_package/fesm2022/portal-directives-Bw5woq8I.mjs +0 -653
  117. package/npm_package/fesm2022/portal-directives-Bw5woq8I.mjs.map +0 -1
  118. package/npm_package/fesm2022/portal.mjs +0 -29
  119. package/npm_package/fesm2022/portal.mjs.map +0 -1
  120. package/npm_package/fesm2022/private.mjs +0 -19
  121. package/npm_package/fesm2022/private.mjs.map +0 -1
  122. package/npm_package/fesm2022/recycle-view-repeater-strategy-DoWdPqVw.mjs +0 -156
  123. package/npm_package/fesm2022/recycle-view-repeater-strategy-DoWdPqVw.mjs.map +0 -1
  124. package/npm_package/fesm2022/scrolling-BkvA05C8.mjs +0 -99
  125. package/npm_package/fesm2022/scrolling-BkvA05C8.mjs.map +0 -1
  126. package/npm_package/fesm2022/scrolling.mjs +0 -1464
  127. package/npm_package/fesm2022/scrolling.mjs.map +0 -1
  128. package/npm_package/fesm2022/selection-model-CeeHVIcP.mjs +0 -226
  129. package/npm_package/fesm2022/selection-model-CeeHVIcP.mjs.map +0 -1
  130. package/npm_package/fesm2022/shadow-dom-B0oHn41l.mjs +0 -49
  131. package/npm_package/fesm2022/shadow-dom-B0oHn41l.mjs.map +0 -1
  132. package/npm_package/fesm2022/stepper.mjs +0 -614
  133. package/npm_package/fesm2022/stepper.mjs.map +0 -1
  134. package/npm_package/fesm2022/style-loader-Cu9AvjH9.mjs +0 -47
  135. package/npm_package/fesm2022/style-loader-Cu9AvjH9.mjs.map +0 -1
  136. package/npm_package/fesm2022/table.mjs +0 -2602
  137. package/npm_package/fesm2022/table.mjs.map +0 -1
  138. package/npm_package/fesm2022/test-environment-CT0XxPyp.mjs +0 -19
  139. package/npm_package/fesm2022/test-environment-CT0XxPyp.mjs.map +0 -1
  140. package/npm_package/fesm2022/testing/selenium-webdriver.mjs +0 -353
  141. package/npm_package/fesm2022/testing/selenium-webdriver.mjs.map +0 -1
  142. package/npm_package/fesm2022/testing/testbed.mjs +0 -782
  143. package/npm_package/fesm2022/testing/testbed.mjs.map +0 -1
  144. package/npm_package/fesm2022/testing.mjs +0 -698
  145. package/npm_package/fesm2022/testing.mjs.map +0 -1
  146. package/npm_package/fesm2022/text-field.mjs +0 -437
  147. package/npm_package/fesm2022/text-field.mjs.map +0 -1
  148. package/npm_package/fesm2022/tree-key-manager-KnCoIkIC.mjs +0 -360
  149. package/npm_package/fesm2022/tree-key-manager-KnCoIkIC.mjs.map +0 -1
  150. package/npm_package/fesm2022/tree.mjs +0 -1795
  151. package/npm_package/fesm2022/tree.mjs.map +0 -1
  152. package/npm_package/fesm2022/typeahead-9ZW4Dtsf.mjs +0 -88
  153. package/npm_package/fesm2022/typeahead-9ZW4Dtsf.mjs.map +0 -1
  154. package/npm_package/fesm2022/unique-selection-dispatcher-DtHZDqyJ.mjs +0 -49
  155. package/npm_package/fesm2022/unique-selection-dispatcher-DtHZDqyJ.mjs.map +0 -1
  156. package/npm_package/focus-key-manager.d-BIKDy8oD.d.ts +0 -34
  157. package/npm_package/focus-monitor.d-CvvJeQRc.d.ts +0 -210
  158. package/npm_package/harness-environment.d-BatBdODN.d.ts +0 -620
  159. package/npm_package/index.d.ts +0 -6
  160. package/npm_package/keycodes/index.d.ts +0 -129
  161. package/npm_package/layout/index.d.ts +0 -89
  162. package/npm_package/list-key-manager.d-BlK3jyRn.d.ts +0 -165
  163. package/npm_package/listbox/index.d.ts +0 -353
  164. package/npm_package/menu/index.d.ts +0 -821
  165. package/npm_package/number-property.d-CJVxXUcb.d.ts +0 -16
  166. package/npm_package/observers/index.d.ts +0 -84
  167. package/npm_package/observers/private/index.d.ts +0 -34
  168. package/npm_package/overlay/_index-deprecated.scss +0 -13
  169. package/npm_package/overlay/_index.scss +0 -193
  170. package/npm_package/overlay/index.d.ts +0 -42
  171. package/npm_package/overlay-module.d-B3qEQtts.d.ts +0 -791
  172. package/npm_package/overlay-prebuilt.css +0 -1
  173. package/npm_package/overlay.d-BdoMy0hX.d.ts +0 -296
  174. package/npm_package/package.json +0 -186
  175. package/npm_package/platform/index.d.ts +0 -83
  176. package/npm_package/platform.d-B3vREl3q.d.ts +0 -33
  177. package/npm_package/portal/index.d.ts +0 -86
  178. package/npm_package/portal-directives.d-BoG39gYN.d.ts +0 -232
  179. package/npm_package/private/index.d.ts +0 -13
  180. package/npm_package/schematics/collection.json +0 -18
  181. package/npm_package/schematics/index.d.ts +0 -14
  182. package/npm_package/schematics/index.js +0 -37
  183. package/npm_package/schematics/index.js.map +0 -1
  184. package/npm_package/schematics/migration.json +0 -15
  185. package/npm_package/schematics/ng-add/index.d.ts +0 -17
  186. package/npm_package/schematics/ng-add/index.js +0 -39
  187. package/npm_package/schematics/ng-add/index.js.map +0 -1
  188. package/npm_package/schematics/ng-add/package-config.d.ts +0 -12
  189. package/npm_package/schematics/ng-add/package-config.js +0 -51
  190. package/npm_package/schematics/ng-add/package-config.js.map +0 -1
  191. package/npm_package/schematics/ng-add/schema.d.ts +0 -11
  192. package/npm_package/schematics/ng-add/schema.js +0 -10
  193. package/npm_package/schematics/ng-add/schema.js.map +0 -1
  194. package/npm_package/schematics/ng-add/schema.json +0 -16
  195. package/npm_package/schematics/ng-generate/drag-drop/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.__style__.template +0 -53
  196. package/npm_package/schematics/ng-generate/drag-drop/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.html.template +0 -21
  197. package/npm_package/schematics/ng-generate/drag-drop/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.spec.ts.template +0 -25
  198. package/npm_package/schematics/ng-generate/drag-drop/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.ts.template +0 -45
  199. package/npm_package/schematics/ng-generate/drag-drop/index.d.ts +0 -11
  200. package/npm_package/schematics/ng-generate/drag-drop/index.js +0 -42
  201. package/npm_package/schematics/ng-generate/drag-drop/index.js.map +0 -1
  202. package/npm_package/schematics/ng-generate/drag-drop/schema.d.ts +0 -10
  203. package/npm_package/schematics/ng-generate/drag-drop/schema.js +0 -10
  204. package/npm_package/schematics/ng-generate/drag-drop/schema.js.map +0 -1
  205. package/npm_package/schematics/ng-generate/drag-drop/schema.json +0 -100
  206. package/npm_package/schematics/ng-update/data/attribute-selectors.d.ts +0 -15
  207. package/npm_package/schematics/ng-update/data/attribute-selectors.js +0 -12
  208. package/npm_package/schematics/ng-update/data/attribute-selectors.js.map +0 -1
  209. package/npm_package/schematics/ng-update/data/class-names.d.ts +0 -15
  210. package/npm_package/schematics/ng-update/data/class-names.js +0 -12
  211. package/npm_package/schematics/ng-update/data/class-names.js.map +0 -1
  212. package/npm_package/schematics/ng-update/data/constructor-checks.d.ts +0 -15
  213. package/npm_package/schematics/ng-update/data/constructor-checks.js +0 -17
  214. package/npm_package/schematics/ng-update/data/constructor-checks.js.map +0 -1
  215. package/npm_package/schematics/ng-update/data/css-selectors.d.ts +0 -27
  216. package/npm_package/schematics/ng-update/data/css-selectors.js +0 -12
  217. package/npm_package/schematics/ng-update/data/css-selectors.js.map +0 -1
  218. package/npm_package/schematics/ng-update/data/css-tokens.d.ts +0 -27
  219. package/npm_package/schematics/ng-update/data/css-tokens.js +0 -12
  220. package/npm_package/schematics/ng-update/data/css-tokens.js.map +0 -1
  221. package/npm_package/schematics/ng-update/data/element-selectors.d.ts +0 -15
  222. package/npm_package/schematics/ng-update/data/element-selectors.js +0 -12
  223. package/npm_package/schematics/ng-update/data/element-selectors.js.map +0 -1
  224. package/npm_package/schematics/ng-update/data/index.d.ts +0 -18
  225. package/npm_package/schematics/ng-update/data/index.js +0 -35
  226. package/npm_package/schematics/ng-update/data/index.js.map +0 -1
  227. package/npm_package/schematics/ng-update/data/input-names.d.ts +0 -22
  228. package/npm_package/schematics/ng-update/data/input-names.js +0 -12
  229. package/npm_package/schematics/ng-update/data/input-names.js.map +0 -1
  230. package/npm_package/schematics/ng-update/data/method-call-checks.d.ts +0 -17
  231. package/npm_package/schematics/ng-update/data/method-call-checks.js +0 -12
  232. package/npm_package/schematics/ng-update/data/method-call-checks.js.map +0 -1
  233. package/npm_package/schematics/ng-update/data/output-names.d.ts +0 -22
  234. package/npm_package/schematics/ng-update/data/output-names.js +0 -12
  235. package/npm_package/schematics/ng-update/data/output-names.js.map +0 -1
  236. package/npm_package/schematics/ng-update/data/property-names.d.ts +0 -20
  237. package/npm_package/schematics/ng-update/data/property-names.js +0 -12
  238. package/npm_package/schematics/ng-update/data/property-names.js.map +0 -1
  239. package/npm_package/schematics/ng-update/data/symbol-removal.d.ts +0 -17
  240. package/npm_package/schematics/ng-update/data/symbol-removal.js +0 -12
  241. package/npm_package/schematics/ng-update/data/symbol-removal.js.map +0 -1
  242. package/npm_package/schematics/ng-update/devkit-file-system.d.ts +0 -30
  243. package/npm_package/schematics/ng-update/devkit-file-system.js +0 -83
  244. package/npm_package/schematics/ng-update/devkit-file-system.js.map +0 -1
  245. package/npm_package/schematics/ng-update/devkit-migration-rule.d.ts +0 -24
  246. package/npm_package/schematics/ng-update/devkit-migration-rule.js +0 -142
  247. package/npm_package/schematics/ng-update/devkit-migration-rule.js.map +0 -1
  248. package/npm_package/schematics/ng-update/devkit-migration.d.ts +0 -35
  249. package/npm_package/schematics/ng-update/devkit-migration.js +0 -20
  250. package/npm_package/schematics/ng-update/devkit-migration.js.map +0 -1
  251. package/npm_package/schematics/ng-update/find-stylesheets.d.ts +0 -16
  252. package/npm_package/schematics/ng-update/find-stylesheets.js +0 -41
  253. package/npm_package/schematics/ng-update/find-stylesheets.js.map +0 -1
  254. package/npm_package/schematics/ng-update/html-parsing/angular.d.ts +0 -15
  255. package/npm_package/schematics/ng-update/html-parsing/angular.js +0 -51
  256. package/npm_package/schematics/ng-update/html-parsing/angular.js.map +0 -1
  257. package/npm_package/schematics/ng-update/html-parsing/elements.d.ts +0 -24
  258. package/npm_package/schematics/ng-update/html-parsing/elements.js +0 -63
  259. package/npm_package/schematics/ng-update/html-parsing/elements.js.map +0 -1
  260. package/npm_package/schematics/ng-update/index.d.ts +0 -10
  261. package/npm_package/schematics/ng-update/index.js +0 -29
  262. package/npm_package/schematics/ng-update/index.js.map +0 -1
  263. package/npm_package/schematics/ng-update/migrations/attribute-selectors.d.ts +0 -26
  264. package/npm_package/schematics/ng-update/migrations/attribute-selectors.js +0 -71
  265. package/npm_package/schematics/ng-update/migrations/attribute-selectors.js.map +0 -1
  266. package/npm_package/schematics/ng-update/migrations/class-inheritance.d.ts +0 -26
  267. package/npm_package/schematics/ng-update/migrations/class-inheritance.js +0 -58
  268. package/npm_package/schematics/ng-update/migrations/class-inheritance.js.map +0 -1
  269. package/npm_package/schematics/ng-update/migrations/class-names.d.ts +0 -32
  270. package/npm_package/schematics/ng-update/migrations/class-names.js +0 -91
  271. package/npm_package/schematics/ng-update/migrations/class-names.js.map +0 -1
  272. package/npm_package/schematics/ng-update/migrations/constructor-signature.d.ts +0 -29
  273. package/npm_package/schematics/ng-update/migrations/constructor-signature.js +0 -139
  274. package/npm_package/schematics/ng-update/migrations/constructor-signature.js.map +0 -1
  275. package/npm_package/schematics/ng-update/migrations/css-selectors.d.ts +0 -26
  276. package/npm_package/schematics/ng-update/migrations/css-selectors.js +0 -75
  277. package/npm_package/schematics/ng-update/migrations/css-selectors.js.map +0 -1
  278. package/npm_package/schematics/ng-update/migrations/css-tokens.d.ts +0 -26
  279. package/npm_package/schematics/ng-update/migrations/css-tokens.js +0 -83
  280. package/npm_package/schematics/ng-update/migrations/css-tokens.js.map +0 -1
  281. package/npm_package/schematics/ng-update/migrations/element-selectors.d.ts +0 -26
  282. package/npm_package/schematics/ng-update/migrations/element-selectors.js +0 -66
  283. package/npm_package/schematics/ng-update/migrations/element-selectors.js.map +0 -1
  284. package/npm_package/schematics/ng-update/migrations/input-names.d.ts +0 -26
  285. package/npm_package/schematics/ng-update/migrations/input-names.js +0 -59
  286. package/npm_package/schematics/ng-update/migrations/input-names.js.map +0 -1
  287. package/npm_package/schematics/ng-update/migrations/method-call-arguments.d.ts +0 -22
  288. package/npm_package/schematics/ng-update/migrations/method-call-arguments.js +0 -62
  289. package/npm_package/schematics/ng-update/migrations/method-call-arguments.js.map +0 -1
  290. package/npm_package/schematics/ng-update/migrations/misc-template.d.ts +0 -18
  291. package/npm_package/schematics/ng-update/migrations/misc-template.js +0 -25
  292. package/npm_package/schematics/ng-update/migrations/misc-template.js.map +0 -1
  293. package/npm_package/schematics/ng-update/migrations/output-names.d.ts +0 -22
  294. package/npm_package/schematics/ng-update/migrations/output-names.js +0 -46
  295. package/npm_package/schematics/ng-update/migrations/output-names.js.map +0 -1
  296. package/npm_package/schematics/ng-update/migrations/property-names.d.ts +0 -22
  297. package/npm_package/schematics/ng-update/migrations/property-names.js +0 -60
  298. package/npm_package/schematics/ng-update/migrations/property-names.js.map +0 -1
  299. package/npm_package/schematics/ng-update/migrations/symbol-removal.d.ts +0 -18
  300. package/npm_package/schematics/ng-update/migrations/symbol-removal.js +0 -47
  301. package/npm_package/schematics/ng-update/migrations/symbol-removal.js.map +0 -1
  302. package/npm_package/schematics/ng-update/public-api.d.ts +0 -19
  303. package/npm_package/schematics/ng-update/public-api.js +0 -36
  304. package/npm_package/schematics/ng-update/public-api.js.map +0 -1
  305. package/npm_package/schematics/ng-update/typescript/base-types.d.ts +0 -10
  306. package/npm_package/schematics/ng-update/typescript/base-types.js +0 -23
  307. package/npm_package/schematics/ng-update/typescript/base-types.js.map +0 -1
  308. package/npm_package/schematics/ng-update/typescript/imports.d.ts +0 -18
  309. package/npm_package/schematics/ng-update/typescript/imports.js +0 -53
  310. package/npm_package/schematics/ng-update/typescript/imports.js.map +0 -1
  311. package/npm_package/schematics/ng-update/typescript/literal.d.ts +0 -18
  312. package/npm_package/schematics/ng-update/typescript/literal.js +0 -32
  313. package/npm_package/schematics/ng-update/typescript/literal.js.map +0 -1
  314. package/npm_package/schematics/ng-update/typescript/module-specifiers.d.ts +0 -16
  315. package/npm_package/schematics/ng-update/typescript/module-specifiers.js +0 -35
  316. package/npm_package/schematics/ng-update/typescript/module-specifiers.js.map +0 -1
  317. package/npm_package/schematics/ng-update/upgrade-data.d.ts +0 -35
  318. package/npm_package/schematics/ng-update/upgrade-data.js +0 -40
  319. package/npm_package/schematics/ng-update/upgrade-data.js.map +0 -1
  320. package/npm_package/schematics/package.json +0 -3
  321. package/npm_package/schematics/paths.d.ts +0 -11
  322. package/npm_package/schematics/paths.js +0 -16
  323. package/npm_package/schematics/paths.js.map +0 -1
  324. package/npm_package/schematics/update-tool/component-resource-collector.d.ts +0 -44
  325. package/npm_package/schematics/update-tool/component-resource-collector.js +0 -164
  326. package/npm_package/schematics/update-tool/component-resource-collector.js.map +0 -1
  327. package/npm_package/schematics/update-tool/file-system.d.ts +0 -72
  328. package/npm_package/schematics/update-tool/file-system.js +0 -18
  329. package/npm_package/schematics/update-tool/file-system.js.map +0 -1
  330. package/npm_package/schematics/update-tool/index.d.ts +0 -74
  331. package/npm_package/schematics/update-tool/index.js +0 -172
  332. package/npm_package/schematics/update-tool/index.js.map +0 -1
  333. package/npm_package/schematics/update-tool/logger.d.ts +0 -15
  334. package/npm_package/schematics/update-tool/logger.js +0 -18
  335. package/npm_package/schematics/update-tool/logger.js.map +0 -1
  336. package/npm_package/schematics/update-tool/migration.d.ts +0 -87
  337. package/npm_package/schematics/update-tool/migration.js +0 -70
  338. package/npm_package/schematics/update-tool/migration.js.map +0 -1
  339. package/npm_package/schematics/update-tool/public-api.d.ts +0 -16
  340. package/npm_package/schematics/update-tool/public-api.js +0 -33
  341. package/npm_package/schematics/update-tool/public-api.js.map +0 -1
  342. package/npm_package/schematics/update-tool/target-version.d.ts +0 -16
  343. package/npm_package/schematics/update-tool/target-version.js +0 -27
  344. package/npm_package/schematics/update-tool/target-version.js.map +0 -1
  345. package/npm_package/schematics/update-tool/update-recorder.d.ts +0 -13
  346. package/npm_package/schematics/update-tool/update-recorder.js +0 -10
  347. package/npm_package/schematics/update-tool/update-recorder.js.map +0 -1
  348. package/npm_package/schematics/update-tool/utils/decorators.d.ts +0 -22
  349. package/npm_package/schematics/update-tool/utils/decorators.js +0 -41
  350. package/npm_package/schematics/update-tool/utils/decorators.js.map +0 -1
  351. package/npm_package/schematics/update-tool/utils/diagnostics.d.ts +0 -11
  352. package/npm_package/schematics/update-tool/utils/diagnostics.js +0 -18
  353. package/npm_package/schematics/update-tool/utils/diagnostics.js.map +0 -1
  354. package/npm_package/schematics/update-tool/utils/functions.d.ts +0 -14
  355. package/npm_package/schematics/update-tool/utils/functions.js +0 -20
  356. package/npm_package/schematics/update-tool/utils/functions.js.map +0 -1
  357. package/npm_package/schematics/update-tool/utils/imports.d.ts +0 -17
  358. package/npm_package/schematics/update-tool/utils/imports.js +0 -110
  359. package/npm_package/schematics/update-tool/utils/imports.js.map +0 -1
  360. package/npm_package/schematics/update-tool/utils/line-mappings.d.ts +0 -21
  361. package/npm_package/schematics/update-tool/utils/line-mappings.js +0 -75
  362. package/npm_package/schematics/update-tool/utils/line-mappings.js.map +0 -1
  363. package/npm_package/schematics/update-tool/utils/parse-tsconfig.d.ts +0 -18
  364. package/npm_package/schematics/update-tool/utils/parse-tsconfig.js +0 -45
  365. package/npm_package/schematics/update-tool/utils/parse-tsconfig.js.map +0 -1
  366. package/npm_package/schematics/update-tool/utils/property-name.d.ts +0 -18
  367. package/npm_package/schematics/update-tool/utils/property-name.js +0 -27
  368. package/npm_package/schematics/update-tool/utils/property-name.js.map +0 -1
  369. package/npm_package/schematics/update-tool/utils/virtual-host.d.ts +0 -36
  370. package/npm_package/schematics/update-tool/utils/virtual-host.js +0 -71
  371. package/npm_package/schematics/update-tool/utils/virtual-host.js.map +0 -1
  372. package/npm_package/schematics/update-tool/version-changes.d.ts +0 -32
  373. package/npm_package/schematics/update-tool/version-changes.js +0 -38
  374. package/npm_package/schematics/update-tool/version-changes.js.map +0 -1
  375. package/npm_package/schematics/utils/ast/ng-module-imports.d.ts +0 -12
  376. package/npm_package/schematics/utils/ast/ng-module-imports.js +0 -82
  377. package/npm_package/schematics/utils/ast/ng-module-imports.js.map +0 -1
  378. package/npm_package/schematics/utils/ast.d.ts +0 -25
  379. package/npm_package/schematics/utils/ast.js +0 -79
  380. package/npm_package/schematics/utils/ast.js.map +0 -1
  381. package/npm_package/schematics/utils/build-component.d.ts +0 -20
  382. package/npm_package/schematics/utils/build-component.js +0 -188
  383. package/npm_package/schematics/utils/build-component.js.map +0 -1
  384. package/npm_package/schematics/utils/get-project.d.ts +0 -13
  385. package/npm_package/schematics/utils/get-project.js +0 -28
  386. package/npm_package/schematics/utils/get-project.js.map +0 -1
  387. package/npm_package/schematics/utils/html-manipulation.d.ts +0 -15
  388. package/npm_package/schematics/utils/html-manipulation.js +0 -91
  389. package/npm_package/schematics/utils/html-manipulation.js.map +0 -1
  390. package/npm_package/schematics/utils/index.d.ts +0 -19
  391. package/npm_package/schematics/utils/index.js +0 -36
  392. package/npm_package/schematics/utils/index.js.map +0 -1
  393. package/npm_package/schematics/utils/parse5-element.d.ts +0 -12
  394. package/npm_package/schematics/utils/parse5-element.js +0 -30
  395. package/npm_package/schematics/utils/parse5-element.js.map +0 -1
  396. package/npm_package/schematics/utils/project-index-file.d.ts +0 -10
  397. package/npm_package/schematics/utils/project-index-file.js +0 -20
  398. package/npm_package/schematics/utils/project-index-file.js.map +0 -1
  399. package/npm_package/schematics/utils/project-main-file.d.ts +0 -10
  400. package/npm_package/schematics/utils/project-main-file.js +0 -25
  401. package/npm_package/schematics/utils/project-main-file.js.map +0 -1
  402. package/npm_package/schematics/utils/project-style-file.d.ts +0 -13
  403. package/npm_package/schematics/utils/project-style-file.js +0 -42
  404. package/npm_package/schematics/utils/project-style-file.js.map +0 -1
  405. package/npm_package/schematics/utils/project-targets.d.ts +0 -14
  406. package/npm_package/schematics/utils/project-targets.js +0 -46
  407. package/npm_package/schematics/utils/project-targets.js.map +0 -1
  408. package/npm_package/schematics/utils/project-tsconfig-paths.d.ts +0 -14
  409. package/npm_package/schematics/utils/project-tsconfig-paths.js +0 -46
  410. package/npm_package/schematics/utils/project-tsconfig-paths.js.map +0 -1
  411. package/npm_package/schematics/utils/schematic-options.d.ts +0 -20
  412. package/npm_package/schematics/utils/schematic-options.js +0 -89
  413. package/npm_package/schematics/utils/schematic-options.js.map +0 -1
  414. package/npm_package/scrolling/index.d.ts +0 -62
  415. package/npm_package/scrolling-module.d-ud2XrbF8.d.ts +0 -552
  416. package/npm_package/selection-model.d-C_vvNGP-.d.ts +0 -117
  417. package/npm_package/stepper/index.d.ts +0 -228
  418. package/npm_package/style-loader.d-BXZfQZTF.d.ts +0 -21
  419. package/npm_package/table/index.d.ts +0 -1100
  420. package/npm_package/testing/index.d.ts +0 -94
  421. package/npm_package/testing/selenium-webdriver/index.d.ts +0 -150
  422. package/npm_package/testing/testbed/index.d.ts +0 -157
  423. package/npm_package/text-field/_index.scss +0 -89
  424. package/npm_package/text-field/index.d.ts +0 -156
  425. package/npm_package/text-field-prebuilt.css +0 -1
  426. package/npm_package/tree/index.d.ts +0 -720
  427. package/npm_package/tree-key-manager-strategy.d-XB6M79l-.d.ts +0 -116
  428. package/npm_package/unique-selection-dispatcher.d-DSFqf1MM.d.ts +0 -33
  429. package/npm_package/view-repeater.d-BKljR8u8.d.ts +0 -89
@@ -1,1966 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { Directive, InjectionToken, Optional, SkipSelf, Inject, inject, Injectable, Injector, ViewContainerRef, EventEmitter, NgZone, RendererFactory2, ElementRef, ChangeDetectorRef, Renderer2, booleanAttribute, Input, Output, signal, computed, ContentChildren, NgModule } from '@angular/core';
3
- import { startWith, debounceTime, distinctUntilChanged, takeUntil, mergeMap, mapTo, mergeAll, switchMap, skipWhile, skip } from 'rxjs/operators';
4
- import { U as UniqueSelectionDispatcher } from './unique-selection-dispatcher-DtHZDqyJ.mjs';
5
- import { Subject, merge, partition } from 'rxjs';
6
- import { _ as _IdGenerator } from './id-generator-Dw_9dSDu.mjs';
7
- import { a as Overlay, f as OverlayConfig, e as STANDARD_DROPDOWN_BELOW_POSITIONS, S as STANDARD_DROPDOWN_ADJACENT_POSITIONS, m as OverlayModule } from './overlay-module-BUj0D19H.mjs';
8
- import { T as TemplatePortal } from './portal-directives-Bw5woq8I.mjs';
9
- import { c as ENTER, S as SPACE, U as UP_ARROW, D as DOWN_ARROW, L as LEFT_ARROW, R as RIGHT_ARROW, T as TAB, g as ESCAPE } from './keycodes-CpHkExLC.mjs';
10
- import { I as InputModalityDetector, F as FocusMonitor } from './focus-monitor-e2l_RpN3.mjs';
11
- import { D as Directionality } from './directionality-CBXD4hga.mjs';
12
- import { hasModifierKey } from './keycodes.mjs';
13
- import { _ as _getEventTarget } from './shadow-dom-B0oHn41l.mjs';
14
- import { F as FocusKeyManager } from './focus-key-manager-C1rAQJ5z.mjs';
15
- import '@angular/common';
16
- import './platform-DmdVEw_C.mjs';
17
- import './backwards-compatibility-DHR38MsD.mjs';
18
- import './test-environment-CT0XxPyp.mjs';
19
- import './style-loader-Cu9AvjH9.mjs';
20
- import './css-pixel-value-C_HEqLhI.mjs';
21
- import './array-I1yfCXUO.mjs';
22
- import './scrolling.mjs';
23
- import './element-x4z00URv.mjs';
24
- import './scrolling-BkvA05C8.mjs';
25
- import './bidi.mjs';
26
- import './recycle-view-repeater-strategy-DoWdPqVw.mjs';
27
- import './data-source-D34wiQZj.mjs';
28
- import './fake-event-detection-DWOdFTFz.mjs';
29
- import './passive-listeners-esHZRgIN.mjs';
30
- import './list-key-manager-CyOIXo8P.mjs';
31
- import './typeahead-9ZW4Dtsf.mjs';
32
-
33
- /**
34
- * A grouping container for `CdkMenuItemRadio` instances, similar to a `role="radiogroup"` element.
35
- */
36
- class CdkMenuGroup {
37
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CdkMenuGroup, deps: [], target: i0.ɵɵFactoryTarget.Directive });
38
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.6", type: CdkMenuGroup, isStandalone: true, selector: "[cdkMenuGroup]", host: { attributes: { "role": "group" }, classAttribute: "cdk-menu-group" }, providers: [{ provide: UniqueSelectionDispatcher, useClass: UniqueSelectionDispatcher }], exportAs: ["cdkMenuGroup"], ngImport: i0 });
39
- }
40
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CdkMenuGroup, decorators: [{
41
- type: Directive,
42
- args: [{
43
- selector: '[cdkMenuGroup]',
44
- exportAs: 'cdkMenuGroup',
45
- host: {
46
- 'role': 'group',
47
- 'class': 'cdk-menu-group',
48
- },
49
- providers: [{ provide: UniqueSelectionDispatcher, useClass: UniqueSelectionDispatcher }],
50
- }]
51
- }] });
52
-
53
- /** Injection token used to return classes implementing the Menu interface */
54
- const CDK_MENU = new InjectionToken('cdk-menu');
55
-
56
- /** The relative item in the inline menu to focus after closing all popup menus. */
57
- var FocusNext;
58
- (function (FocusNext) {
59
- FocusNext[FocusNext["nextItem"] = 0] = "nextItem";
60
- FocusNext[FocusNext["previousItem"] = 1] = "previousItem";
61
- FocusNext[FocusNext["currentItem"] = 2] = "currentItem";
62
- })(FocusNext || (FocusNext = {}));
63
- /** Injection token used for an implementation of MenuStack. */
64
- const MENU_STACK = new InjectionToken('cdk-menu-stack');
65
- /** Provider that provides the parent menu stack, or a new menu stack if there is no parent one. */
66
- const PARENT_OR_NEW_MENU_STACK_PROVIDER = {
67
- provide: MENU_STACK,
68
- deps: [[new Optional(), new SkipSelf(), new Inject(MENU_STACK)]],
69
- useFactory: (parentMenuStack) => parentMenuStack || new MenuStack(),
70
- };
71
- /** Provider that provides the parent menu stack, or a new inline menu stack if there is no parent one. */
72
- const PARENT_OR_NEW_INLINE_MENU_STACK_PROVIDER = (orientation) => ({
73
- provide: MENU_STACK,
74
- deps: [[new Optional(), new SkipSelf(), new Inject(MENU_STACK)]],
75
- useFactory: (parentMenuStack) => parentMenuStack || MenuStack.inline(orientation),
76
- });
77
- /**
78
- * MenuStack allows subscribers to listen for close events (when a MenuStackItem is popped off
79
- * of the stack) in order to perform closing actions. Upon the MenuStack being empty it emits
80
- * from the `empty` observable specifying the next focus action which the listener should perform
81
- * as requested by the closer.
82
- */
83
- class MenuStack {
84
- /** The ID of this menu stack. */
85
- id = inject(_IdGenerator).getId('cdk-menu-stack-');
86
- /** All MenuStackItems tracked by this MenuStack. */
87
- _elements = [];
88
- /** Emits the element which was popped off of the stack when requested by a closer. */
89
- _close = new Subject();
90
- /** Emits once the MenuStack has become empty after popping off elements. */
91
- _empty = new Subject();
92
- /** Emits whether any menu in the menu stack has focus. */
93
- _hasFocus = new Subject();
94
- /** Observable which emits the MenuStackItem which has been requested to close. */
95
- closed = this._close;
96
- /** Observable which emits whether any menu in the menu stack has focus. */
97
- hasFocus = this._hasFocus.pipe(startWith(false), debounceTime(0), distinctUntilChanged());
98
- /**
99
- * Observable which emits when the MenuStack is empty after popping off the last element. It
100
- * emits a FocusNext event which specifies the action the closer has requested the listener
101
- * perform.
102
- */
103
- emptied = this._empty;
104
- /**
105
- * Whether the inline menu associated with this menu stack is vertical or horizontal.
106
- * `null` indicates there is no inline menu associated with this menu stack.
107
- */
108
- _inlineMenuOrientation = null;
109
- /** Creates a menu stack that originates from an inline menu. */
110
- static inline(orientation) {
111
- const stack = new MenuStack();
112
- stack._inlineMenuOrientation = orientation;
113
- return stack;
114
- }
115
- /**
116
- * Adds an item to the menu stack.
117
- * @param menu the MenuStackItem to put on the stack.
118
- */
119
- push(menu) {
120
- this._elements.push(menu);
121
- }
122
- /**
123
- * Pop items off of the stack up to and including `lastItem` and emit each on the close
124
- * observable. If the stack is empty or `lastItem` is not on the stack it does nothing.
125
- * @param lastItem the last item to pop off the stack.
126
- * @param options Options that configure behavior on close.
127
- */
128
- close(lastItem, options) {
129
- const { focusNextOnEmpty, focusParentTrigger } = { ...options };
130
- if (this._elements.indexOf(lastItem) >= 0) {
131
- let poppedElement;
132
- do {
133
- poppedElement = this._elements.pop();
134
- this._close.next({ item: poppedElement, focusParentTrigger });
135
- } while (poppedElement !== lastItem);
136
- if (this.isEmpty()) {
137
- this._empty.next(focusNextOnEmpty);
138
- }
139
- }
140
- }
141
- /**
142
- * Pop items off of the stack up to but excluding `lastItem` and emit each on the close
143
- * observable. If the stack is empty or `lastItem` is not on the stack it does nothing.
144
- * @param lastItem the element which should be left on the stack
145
- * @return whether or not an item was removed from the stack
146
- */
147
- closeSubMenuOf(lastItem) {
148
- let removed = false;
149
- if (this._elements.indexOf(lastItem) >= 0) {
150
- removed = this.peek() !== lastItem;
151
- while (this.peek() !== lastItem) {
152
- this._close.next({ item: this._elements.pop() });
153
- }
154
- }
155
- return removed;
156
- }
157
- /**
158
- * Pop off all MenuStackItems and emit each one on the `close` observable one by one.
159
- * @param options Options that configure behavior on close.
160
- */
161
- closeAll(options) {
162
- const { focusNextOnEmpty, focusParentTrigger } = { ...options };
163
- if (!this.isEmpty()) {
164
- while (!this.isEmpty()) {
165
- const menuStackItem = this._elements.pop();
166
- if (menuStackItem) {
167
- this._close.next({ item: menuStackItem, focusParentTrigger });
168
- }
169
- }
170
- this._empty.next(focusNextOnEmpty);
171
- }
172
- }
173
- /** Return true if this stack is empty. */
174
- isEmpty() {
175
- return !this._elements.length;
176
- }
177
- /** Return the length of the stack. */
178
- length() {
179
- return this._elements.length;
180
- }
181
- /** Get the top most element on the stack. */
182
- peek() {
183
- return this._elements[this._elements.length - 1];
184
- }
185
- /** Whether the menu stack is associated with an inline menu. */
186
- hasInlineMenu() {
187
- return this._inlineMenuOrientation != null;
188
- }
189
- /** The orientation of the associated inline menu. */
190
- inlineMenuOrientation() {
191
- return this._inlineMenuOrientation;
192
- }
193
- /** Sets whether the menu stack contains the focused element. */
194
- setHasFocus(hasFocus) {
195
- this._hasFocus.next(hasFocus);
196
- }
197
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MenuStack, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
198
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MenuStack });
199
- }
200
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MenuStack, decorators: [{
201
- type: Injectable
202
- }] });
203
-
204
- /** Injection token used for an implementation of MenuStack. */
205
- const MENU_TRIGGER = new InjectionToken('cdk-menu-trigger');
206
- /** Injection token used to configure the behavior of the menu when the page is scrolled. */
207
- const MENU_SCROLL_STRATEGY = new InjectionToken('cdk-menu-scroll-strategy', {
208
- providedIn: 'root',
209
- factory: () => {
210
- const overlay = inject(Overlay);
211
- return () => overlay.scrollStrategies.reposition();
212
- },
213
- });
214
- /**
215
- * Abstract directive that implements shared logic common to all menu triggers.
216
- * This class can be extended to create custom menu trigger types.
217
- */
218
- class CdkMenuTriggerBase {
219
- /** The DI injector for this component. */
220
- injector = inject(Injector);
221
- /** The view container ref for this component */
222
- viewContainerRef = inject(ViewContainerRef);
223
- /** The menu stack in which this menu resides. */
224
- menuStack = inject(MENU_STACK);
225
- /** Function used to configure the scroll strategy for the menu. */
226
- menuScrollStrategy = inject(MENU_SCROLL_STRATEGY);
227
- /**
228
- * A list of preferred menu positions to be used when constructing the
229
- * `FlexibleConnectedPositionStrategy` for this trigger's menu.
230
- */
231
- menuPosition;
232
- /** Emits when the attached menu is requested to open */
233
- opened = new EventEmitter();
234
- /** Emits when the attached menu is requested to close */
235
- closed = new EventEmitter();
236
- /** Template reference variable to the menu this trigger opens */
237
- menuTemplateRef;
238
- /** Context data to be passed along to the menu template */
239
- menuData;
240
- /** A reference to the overlay which manages the triggered menu */
241
- overlayRef = null;
242
- /** Emits when this trigger is destroyed. */
243
- destroyed = new Subject();
244
- /** Emits when the outside pointer events listener on the overlay should be stopped. */
245
- stopOutsideClicksListener = merge(this.closed, this.destroyed);
246
- /** The child menu opened by this trigger. */
247
- childMenu;
248
- /** The content of the menu panel opened by this trigger. */
249
- _menuPortal;
250
- /** The injector to use for the child menu opened by this trigger. */
251
- _childMenuInjector;
252
- ngOnDestroy() {
253
- this._destroyOverlay();
254
- this.destroyed.next();
255
- this.destroyed.complete();
256
- }
257
- /** Whether the attached menu is open. */
258
- isOpen() {
259
- return !!this.overlayRef?.hasAttached();
260
- }
261
- /** Registers a child menu as having been opened by this trigger. */
262
- registerChildMenu(child) {
263
- this.childMenu = child;
264
- }
265
- /**
266
- * Get the portal to be attached to the overlay which contains the menu. Allows for the menu
267
- * content to change dynamically and be reflected in the application.
268
- */
269
- getMenuContentPortal() {
270
- const hasMenuContentChanged = this.menuTemplateRef !== this._menuPortal?.templateRef;
271
- if (this.menuTemplateRef && (!this._menuPortal || hasMenuContentChanged)) {
272
- this._menuPortal = new TemplatePortal(this.menuTemplateRef, this.viewContainerRef, this.menuData, this._getChildMenuInjector());
273
- }
274
- return this._menuPortal;
275
- }
276
- /**
277
- * Whether the given element is inside the scope of this trigger's menu stack.
278
- * @param element The element to check.
279
- * @return Whether the element is inside the scope of this trigger's menu stack.
280
- */
281
- isElementInsideMenuStack(element) {
282
- for (let el = element; el; el = el?.parentElement ?? null) {
283
- if (el.getAttribute('data-cdk-menu-stack-id') === this.menuStack.id) {
284
- return true;
285
- }
286
- }
287
- return false;
288
- }
289
- /** Destroy and unset the overlay reference it if exists */
290
- _destroyOverlay() {
291
- if (this.overlayRef) {
292
- this.overlayRef.dispose();
293
- this.overlayRef = null;
294
- }
295
- }
296
- /** Gets the injector to use when creating a child menu. */
297
- _getChildMenuInjector() {
298
- this._childMenuInjector =
299
- this._childMenuInjector ||
300
- Injector.create({
301
- providers: [
302
- { provide: MENU_TRIGGER, useValue: this },
303
- { provide: MENU_STACK, useValue: this.menuStack },
304
- ],
305
- parent: this.injector,
306
- });
307
- return this._childMenuInjector;
308
- }
309
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CdkMenuTriggerBase, deps: [], target: i0.ɵɵFactoryTarget.Directive });
310
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.6", type: CdkMenuTriggerBase, isStandalone: true, host: { properties: { "attr.aria-controls": "childMenu?.id", "attr.data-cdk-menu-stack-id": "menuStack.id" } }, ngImport: i0 });
311
- }
312
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CdkMenuTriggerBase, decorators: [{
313
- type: Directive,
314
- args: [{
315
- host: {
316
- '[attr.aria-controls]': 'childMenu?.id',
317
- '[attr.data-cdk-menu-stack-id]': 'menuStack.id',
318
- },
319
- }]
320
- }] });
321
-
322
- /**
323
- * Throws an exception when an instance of the PointerFocusTracker is not provided.
324
- * @docs-private
325
- */
326
- function throwMissingPointerFocusTracker() {
327
- throw Error('expected an instance of PointerFocusTracker to be provided');
328
- }
329
- /**
330
- * Throws an exception when a reference to the parent menu is not provided.
331
- * @docs-private
332
- */
333
- function throwMissingMenuReference() {
334
- throw Error('expected a reference to the parent menu');
335
- }
336
-
337
- /** Injection token used for an implementation of MenuAim. */
338
- const MENU_AIM = new InjectionToken('cdk-menu-aim');
339
- /** Capture every nth mouse move event. */
340
- const MOUSE_MOVE_SAMPLE_FREQUENCY = 3;
341
- /** The number of mouse move events to track. */
342
- const NUM_POINTS = 5;
343
- /**
344
- * How long to wait before closing a sibling menu if a user stops short of the submenu they were
345
- * predicted to go into.
346
- */
347
- const CLOSE_DELAY = 300;
348
- /** Calculate the slope between point a and b. */
349
- function getSlope(a, b) {
350
- return (b.y - a.y) / (b.x - a.x);
351
- }
352
- /** Calculate the y intercept for the given point and slope. */
353
- function getYIntercept(point, slope) {
354
- return point.y - slope * point.x;
355
- }
356
- /**
357
- * Whether the given mouse trajectory line defined by the slope and y intercept falls within the
358
- * submenu as defined by `submenuPoints`
359
- * @param submenuPoints the submenu DOMRect points.
360
- * @param m the slope of the trajectory line.
361
- * @param b the y intercept of the trajectory line.
362
- * @return true if any point on the line falls within the submenu.
363
- */
364
- function isWithinSubmenu(submenuPoints, m, b) {
365
- const { left, right, top, bottom } = submenuPoints;
366
- // Check for intersection with each edge of the submenu (left, right, top, bottom)
367
- // by fixing one coordinate to that edge's coordinate (either x or y) and checking if the
368
- // other coordinate is within bounds.
369
- return ((m * left + b >= top && m * left + b <= bottom) ||
370
- (m * right + b >= top && m * right + b <= bottom) ||
371
- ((top - b) / m >= left && (top - b) / m <= right) ||
372
- ((bottom - b) / m >= left && (bottom - b) / m <= right));
373
- }
374
- /**
375
- * TargetMenuAim predicts if a user is moving into a submenu. It calculates the
376
- * trajectory of the user's mouse movement in the current menu to determine if the
377
- * mouse is moving towards an open submenu.
378
- *
379
- * The determination is made by calculating the slope of the users last NUM_POINTS moves where each
380
- * pair of points determines if the trajectory line points into the submenu. It uses consensus
381
- * approach by checking if at least NUM_POINTS / 2 pairs determine that the user is moving towards
382
- * to submenu.
383
- */
384
- class TargetMenuAim {
385
- _ngZone = inject(NgZone);
386
- _renderer = inject(RendererFactory2).createRenderer(null, null);
387
- _cleanupMousemove;
388
- /** The last NUM_POINTS mouse move events. */
389
- _points = [];
390
- /** Reference to the root menu in which we are tracking mouse moves. */
391
- _menu;
392
- /** Reference to the root menu's mouse manager. */
393
- _pointerTracker;
394
- /** The id associated with the current timeout call waiting to resolve. */
395
- _timeoutId;
396
- /** Emits when this service is destroyed. */
397
- _destroyed = new Subject();
398
- ngOnDestroy() {
399
- this._cleanupMousemove?.();
400
- this._destroyed.next();
401
- this._destroyed.complete();
402
- }
403
- /**
404
- * Set the Menu and its PointerFocusTracker.
405
- * @param menu The menu that this menu aim service controls.
406
- * @param pointerTracker The `PointerFocusTracker` for the given menu.
407
- */
408
- initialize(menu, pointerTracker) {
409
- this._menu = menu;
410
- this._pointerTracker = pointerTracker;
411
- this._subscribeToMouseMoves();
412
- }
413
- /**
414
- * Calls the `doToggle` callback when it is deemed that the user is not moving towards
415
- * the submenu.
416
- * @param doToggle the function called when the user is not moving towards the submenu.
417
- */
418
- toggle(doToggle) {
419
- // If the menu is horizontal the sub-menus open below and there is no risk of premature
420
- // closing of any sub-menus therefore we automatically resolve the callback.
421
- if (this._menu.orientation === 'horizontal') {
422
- doToggle();
423
- }
424
- this._checkConfigured();
425
- const siblingItemIsWaiting = !!this._timeoutId;
426
- const hasPoints = this._points.length > 1;
427
- if (hasPoints && !siblingItemIsWaiting) {
428
- if (this._isMovingToSubmenu()) {
429
- this._startTimeout(doToggle);
430
- }
431
- else {
432
- doToggle();
433
- }
434
- }
435
- else if (!siblingItemIsWaiting) {
436
- doToggle();
437
- }
438
- }
439
- /**
440
- * Start the delayed toggle handler if one isn't running already.
441
- *
442
- * The delayed toggle handler executes the `doToggle` callback after some period of time iff the
443
- * users mouse is on an item in the current menu.
444
- *
445
- * @param doToggle the function called when the user is not moving towards the submenu.
446
- */
447
- _startTimeout(doToggle) {
448
- // If the users mouse is moving towards a submenu we don't want to immediately resolve.
449
- // Wait for some period of time before determining if the previous menu should close in
450
- // cases where the user may have moved towards the submenu but stopped on a sibling menu
451
- // item intentionally.
452
- const timeoutId = setTimeout(() => {
453
- // Resolve if the user is currently moused over some element in the root menu
454
- if (this._pointerTracker.activeElement && timeoutId === this._timeoutId) {
455
- doToggle();
456
- }
457
- this._timeoutId = null;
458
- }, CLOSE_DELAY);
459
- this._timeoutId = timeoutId;
460
- }
461
- /** Whether the user is heading towards the open submenu. */
462
- _isMovingToSubmenu() {
463
- const submenuPoints = this._getSubmenuBounds();
464
- if (!submenuPoints) {
465
- return false;
466
- }
467
- let numMoving = 0;
468
- const currPoint = this._points[this._points.length - 1];
469
- // start from the second last point and calculate the slope between each point and the last
470
- // point.
471
- for (let i = this._points.length - 2; i >= 0; i--) {
472
- const previous = this._points[i];
473
- const slope = getSlope(currPoint, previous);
474
- if (isWithinSubmenu(submenuPoints, slope, getYIntercept(currPoint, slope))) {
475
- numMoving++;
476
- }
477
- }
478
- return numMoving >= Math.floor(NUM_POINTS / 2);
479
- }
480
- /** Get the bounding DOMRect for the open submenu. */
481
- _getSubmenuBounds() {
482
- return this._pointerTracker?.previousElement?.getMenu()?.nativeElement.getBoundingClientRect();
483
- }
484
- /**
485
- * Check if a reference to the PointerFocusTracker and menu element is provided.
486
- * @throws an error if neither reference is provided.
487
- */
488
- _checkConfigured() {
489
- if (typeof ngDevMode === 'undefined' || ngDevMode) {
490
- if (!this._pointerTracker) {
491
- throwMissingPointerFocusTracker();
492
- }
493
- if (!this._menu) {
494
- throwMissingMenuReference();
495
- }
496
- }
497
- }
498
- /** Subscribe to the root menus mouse move events and update the tracked mouse points. */
499
- _subscribeToMouseMoves() {
500
- this._cleanupMousemove?.();
501
- this._cleanupMousemove = this._ngZone.runOutsideAngular(() => {
502
- let eventIndex = 0;
503
- return this._renderer.listen(this._menu.nativeElement, 'mousemove', (event) => {
504
- if (eventIndex % MOUSE_MOVE_SAMPLE_FREQUENCY === 0) {
505
- this._points.push({ x: event.clientX, y: event.clientY });
506
- if (this._points.length > NUM_POINTS) {
507
- this._points.shift();
508
- }
509
- }
510
- eventIndex++;
511
- });
512
- });
513
- }
514
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: TargetMenuAim, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
515
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: TargetMenuAim });
516
- }
517
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: TargetMenuAim, decorators: [{
518
- type: Injectable
519
- }] });
520
- /**
521
- * CdkTargetMenuAim is a provider for the TargetMenuAim service. It can be added to an
522
- * element with either the `cdkMenu` or `cdkMenuBar` directive and child menu items.
523
- */
524
- class CdkTargetMenuAim {
525
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CdkTargetMenuAim, deps: [], target: i0.ɵɵFactoryTarget.Directive });
526
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.6", type: CdkTargetMenuAim, isStandalone: true, selector: "[cdkTargetMenuAim]", providers: [{ provide: MENU_AIM, useClass: TargetMenuAim }], exportAs: ["cdkTargetMenuAim"], ngImport: i0 });
527
- }
528
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CdkTargetMenuAim, decorators: [{
529
- type: Directive,
530
- args: [{
531
- selector: '[cdkTargetMenuAim]',
532
- exportAs: 'cdkTargetMenuAim',
533
- providers: [{ provide: MENU_AIM, useClass: TargetMenuAim }],
534
- }]
535
- }] });
536
-
537
- /** Checks whether a keyboard event will trigger a native `click` event on an element. */
538
- function eventDispatchesNativeClick(elementRef, event) {
539
- // Synthetic events won't trigger clicks.
540
- if (!event.isTrusted) {
541
- return false;
542
- }
543
- const el = elementRef.nativeElement;
544
- const keyCode = event.keyCode;
545
- // Buttons trigger clicks both on space and enter events.
546
- if (el.nodeName === 'BUTTON' && !el.disabled) {
547
- return keyCode === ENTER || keyCode === SPACE;
548
- }
549
- // Links only trigger clicks on enter.
550
- if (el.nodeName === 'A') {
551
- return keyCode === ENTER;
552
- }
553
- // Any other elements won't dispatch clicks from keyboard events.
554
- return false;
555
- }
556
-
557
- /**
558
- * A directive that turns its host element into a trigger for a popup menu.
559
- * It can be combined with cdkMenuItem to create sub-menus. If the element is in a top level
560
- * MenuBar it will open the menu on click, or if a sibling is already opened it will open on hover.
561
- * If it is inside of a Menu it will open the attached Submenu on hover regardless of its sibling
562
- * state.
563
- */
564
- class CdkMenuTrigger extends CdkMenuTriggerBase {
565
- _elementRef = inject(ElementRef);
566
- _overlay = inject(Overlay);
567
- _ngZone = inject(NgZone);
568
- _changeDetectorRef = inject(ChangeDetectorRef);
569
- _inputModalityDetector = inject(InputModalityDetector);
570
- _directionality = inject(Directionality, { optional: true });
571
- _renderer = inject(Renderer2);
572
- _cleanupMouseenter;
573
- /** The parent menu this trigger belongs to. */
574
- _parentMenu = inject(CDK_MENU, { optional: true });
575
- /** The menu aim service used by this menu. */
576
- _menuAim = inject(MENU_AIM, { optional: true });
577
- constructor() {
578
- super();
579
- this._setRole();
580
- this._registerCloseHandler();
581
- this._subscribeToMenuStackClosed();
582
- this._subscribeToMouseEnter();
583
- this._subscribeToMenuStackHasFocus();
584
- this._setType();
585
- }
586
- /** Toggle the attached menu. */
587
- toggle() {
588
- this.isOpen() ? this.close() : this.open();
589
- }
590
- /** Open the attached menu. */
591
- open() {
592
- if (!this.isOpen() && this.menuTemplateRef != null) {
593
- this.opened.next();
594
- this.overlayRef = this.overlayRef || this._overlay.create(this._getOverlayConfig());
595
- this.overlayRef.attach(this.getMenuContentPortal());
596
- this._changeDetectorRef.markForCheck();
597
- this._subscribeToOutsideClicks();
598
- }
599
- }
600
- /** Close the opened menu. */
601
- close() {
602
- if (this.isOpen()) {
603
- this.closed.next();
604
- this.overlayRef.detach();
605
- this._changeDetectorRef.markForCheck();
606
- }
607
- this._closeSiblingTriggers();
608
- }
609
- /**
610
- * Get a reference to the rendered Menu if the Menu is open and rendered in the DOM.
611
- */
612
- getMenu() {
613
- return this.childMenu;
614
- }
615
- ngOnChanges(changes) {
616
- if (changes['menuPosition'] && this.overlayRef) {
617
- this.overlayRef.updatePositionStrategy(this._getOverlayPositionStrategy());
618
- }
619
- }
620
- ngOnDestroy() {
621
- this._cleanupMouseenter();
622
- super.ngOnDestroy();
623
- }
624
- /**
625
- * Handles keyboard events for the menu item.
626
- * @param event The keyboard event to handle
627
- */
628
- _toggleOnKeydown(event) {
629
- const isParentVertical = this._parentMenu?.orientation === 'vertical';
630
- switch (event.keyCode) {
631
- case SPACE:
632
- case ENTER:
633
- // Skip events that will trigger clicks so the handler doesn't get triggered twice.
634
- if (!hasModifierKey(event) && !eventDispatchesNativeClick(this._elementRef, event)) {
635
- this.toggle();
636
- this.childMenu?.focusFirstItem('keyboard');
637
- }
638
- break;
639
- case RIGHT_ARROW:
640
- if (!hasModifierKey(event)) {
641
- if (this._parentMenu && isParentVertical && this._directionality?.value !== 'rtl') {
642
- event.preventDefault();
643
- this.open();
644
- this.childMenu?.focusFirstItem('keyboard');
645
- }
646
- }
647
- break;
648
- case LEFT_ARROW:
649
- if (!hasModifierKey(event)) {
650
- if (this._parentMenu && isParentVertical && this._directionality?.value === 'rtl') {
651
- event.preventDefault();
652
- this.open();
653
- this.childMenu?.focusFirstItem('keyboard');
654
- }
655
- }
656
- break;
657
- case DOWN_ARROW:
658
- case UP_ARROW:
659
- if (!hasModifierKey(event)) {
660
- if (!isParentVertical) {
661
- event.preventDefault();
662
- this.open();
663
- event.keyCode === DOWN_ARROW
664
- ? this.childMenu?.focusFirstItem('keyboard')
665
- : this.childMenu?.focusLastItem('keyboard');
666
- }
667
- }
668
- break;
669
- }
670
- }
671
- /** Handles clicks on the menu trigger. */
672
- _handleClick() {
673
- this.toggle();
674
- this.childMenu?.focusFirstItem('mouse');
675
- }
676
- /**
677
- * Sets whether the trigger's menu stack has focus.
678
- * @param hasFocus Whether the menu stack has focus.
679
- */
680
- _setHasFocus(hasFocus) {
681
- if (!this._parentMenu) {
682
- this.menuStack.setHasFocus(hasFocus);
683
- }
684
- }
685
- /**
686
- * Subscribe to the mouseenter events and close any sibling menu items if this element is moused
687
- * into.
688
- */
689
- _subscribeToMouseEnter() {
690
- this._cleanupMouseenter = this._ngZone.runOutsideAngular(() => {
691
- return this._renderer.listen(this._elementRef.nativeElement, 'mouseenter', () => {
692
- if (
693
- // Skip fake `mouseenter` events dispatched by touch devices.
694
- this._inputModalityDetector.mostRecentModality !== 'touch' &&
695
- !this.menuStack.isEmpty() &&
696
- !this.isOpen()) {
697
- // Closes any sibling menu items and opens the menu associated with this trigger.
698
- const toggleMenus = () => this._ngZone.run(() => {
699
- this._closeSiblingTriggers();
700
- this.open();
701
- });
702
- if (this._menuAim) {
703
- this._menuAim.toggle(toggleMenus);
704
- }
705
- else {
706
- toggleMenus();
707
- }
708
- }
709
- });
710
- });
711
- }
712
- /** Close out any sibling menu trigger menus. */
713
- _closeSiblingTriggers() {
714
- if (this._parentMenu) {
715
- // If nothing was removed from the stack and the last element is not the parent item
716
- // that means that the parent menu is a menu bar since we don't put the menu bar on the
717
- // stack
718
- const isParentMenuBar = !this.menuStack.closeSubMenuOf(this._parentMenu) &&
719
- this.menuStack.peek() !== this._parentMenu;
720
- if (isParentMenuBar) {
721
- this.menuStack.closeAll();
722
- }
723
- }
724
- else {
725
- this.menuStack.closeAll();
726
- }
727
- }
728
- /** Get the configuration object used to create the overlay. */
729
- _getOverlayConfig() {
730
- return new OverlayConfig({
731
- positionStrategy: this._getOverlayPositionStrategy(),
732
- scrollStrategy: this.menuScrollStrategy(),
733
- direction: this._directionality || undefined,
734
- });
735
- }
736
- /** Build the position strategy for the overlay which specifies where to place the menu. */
737
- _getOverlayPositionStrategy() {
738
- return this._overlay
739
- .position()
740
- .flexibleConnectedTo(this._elementRef)
741
- .withLockedPosition()
742
- .withFlexibleDimensions(false)
743
- .withPositions(this._getOverlayPositions());
744
- }
745
- /** Get the preferred positions for the opened menu relative to the menu item. */
746
- _getOverlayPositions() {
747
- return (this.menuPosition ??
748
- (!this._parentMenu || this._parentMenu.orientation === 'horizontal'
749
- ? STANDARD_DROPDOWN_BELOW_POSITIONS
750
- : STANDARD_DROPDOWN_ADJACENT_POSITIONS));
751
- }
752
- /**
753
- * Subscribe to the MenuStack close events if this is a standalone trigger and close out the menu
754
- * this triggers when requested.
755
- */
756
- _registerCloseHandler() {
757
- if (!this._parentMenu) {
758
- this.menuStack.closed.pipe(takeUntil(this.destroyed)).subscribe(({ item }) => {
759
- if (item === this.childMenu) {
760
- this.close();
761
- }
762
- });
763
- }
764
- }
765
- /**
766
- * Subscribe to the overlays outside pointer events stream and handle closing out the stack if a
767
- * click occurs outside the menus.
768
- */
769
- _subscribeToOutsideClicks() {
770
- if (this.overlayRef) {
771
- this.overlayRef
772
- .outsidePointerEvents()
773
- .pipe(takeUntil(this.stopOutsideClicksListener))
774
- .subscribe(event => {
775
- const target = _getEventTarget(event);
776
- const element = this._elementRef.nativeElement;
777
- if (target !== element && !element.contains(target)) {
778
- if (!this.isElementInsideMenuStack(target)) {
779
- this.menuStack.closeAll();
780
- }
781
- else {
782
- this._closeSiblingTriggers();
783
- }
784
- }
785
- });
786
- }
787
- }
788
- /** Subscribe to the MenuStack hasFocus events. */
789
- _subscribeToMenuStackHasFocus() {
790
- if (!this._parentMenu) {
791
- this.menuStack.hasFocus.pipe(takeUntil(this.destroyed)).subscribe(hasFocus => {
792
- if (!hasFocus) {
793
- this.menuStack.closeAll();
794
- }
795
- });
796
- }
797
- }
798
- /** Subscribe to the MenuStack closed events. */
799
- _subscribeToMenuStackClosed() {
800
- if (!this._parentMenu) {
801
- this.menuStack.closed.subscribe(({ focusParentTrigger }) => {
802
- if (focusParentTrigger && !this.menuStack.length()) {
803
- this._elementRef.nativeElement.focus();
804
- }
805
- });
806
- }
807
- }
808
- /** Sets the role attribute for this trigger if needed. */
809
- _setRole() {
810
- // If this trigger is part of another menu, the cdkMenuItem directive will handle setting the
811
- // role, otherwise this is a standalone trigger, and we should ensure it has role="button".
812
- if (!this._parentMenu) {
813
- this._elementRef.nativeElement.setAttribute('role', 'button');
814
- }
815
- }
816
- /** Sets thte `type` attribute of the trigger. */
817
- _setType() {
818
- const element = this._elementRef.nativeElement;
819
- if (element.nodeName === 'BUTTON' && !element.getAttribute('type')) {
820
- // Prevents form submissions.
821
- element.setAttribute('type', 'button');
822
- }
823
- }
824
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CdkMenuTrigger, deps: [], target: i0.ɵɵFactoryTarget.Directive });
825
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.6", type: CdkMenuTrigger, isStandalone: true, selector: "[cdkMenuTriggerFor]", inputs: { menuTemplateRef: ["cdkMenuTriggerFor", "menuTemplateRef"], menuPosition: ["cdkMenuPosition", "menuPosition"], menuData: ["cdkMenuTriggerData", "menuData"] }, outputs: { opened: "cdkMenuOpened", closed: "cdkMenuClosed" }, host: { listeners: { "focusin": "_setHasFocus(true)", "focusout": "_setHasFocus(false)", "keydown": "_toggleOnKeydown($event)", "click": "_handleClick()" }, properties: { "attr.aria-haspopup": "menuTemplateRef ? \"menu\" : null", "attr.aria-expanded": "menuTemplateRef == null ? null : isOpen()" }, classAttribute: "cdk-menu-trigger" }, providers: [
826
- { provide: MENU_TRIGGER, useExisting: CdkMenuTrigger },
827
- PARENT_OR_NEW_MENU_STACK_PROVIDER,
828
- ], exportAs: ["cdkMenuTriggerFor"], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
829
- }
830
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CdkMenuTrigger, decorators: [{
831
- type: Directive,
832
- args: [{
833
- selector: '[cdkMenuTriggerFor]',
834
- exportAs: 'cdkMenuTriggerFor',
835
- host: {
836
- 'class': 'cdk-menu-trigger',
837
- '[attr.aria-haspopup]': 'menuTemplateRef ? "menu" : null',
838
- '[attr.aria-expanded]': 'menuTemplateRef == null ? null : isOpen()',
839
- '(focusin)': '_setHasFocus(true)',
840
- '(focusout)': '_setHasFocus(false)',
841
- '(keydown)': '_toggleOnKeydown($event)',
842
- '(click)': '_handleClick()',
843
- },
844
- inputs: [
845
- { name: 'menuTemplateRef', alias: 'cdkMenuTriggerFor' },
846
- { name: 'menuPosition', alias: 'cdkMenuPosition' },
847
- { name: 'menuData', alias: 'cdkMenuTriggerData' },
848
- ],
849
- outputs: ['opened: cdkMenuOpened', 'closed: cdkMenuClosed'],
850
- providers: [
851
- { provide: MENU_TRIGGER, useExisting: CdkMenuTrigger },
852
- PARENT_OR_NEW_MENU_STACK_PROVIDER,
853
- ],
854
- }]
855
- }], ctorParameters: () => [] });
856
-
857
- /**
858
- * Directive which provides the ability for an element to be focused and navigated to using the
859
- * keyboard when residing in a CdkMenu, CdkMenuBar, or CdkMenuGroup. It performs user defined
860
- * behavior when clicked.
861
- */
862
- class CdkMenuItem {
863
- _dir = inject(Directionality, { optional: true });
864
- _elementRef = inject(ElementRef);
865
- _ngZone = inject(NgZone);
866
- _inputModalityDetector = inject(InputModalityDetector);
867
- _renderer = inject(Renderer2);
868
- _cleanupMouseEnter;
869
- /** The menu aim service used by this menu. */
870
- _menuAim = inject(MENU_AIM, { optional: true });
871
- /** The stack of menus this menu belongs to. */
872
- _menuStack = inject(MENU_STACK);
873
- /** The parent menu in which this menuitem resides. */
874
- _parentMenu = inject(CDK_MENU, { optional: true });
875
- /** Reference to the CdkMenuItemTrigger directive if one is added to the same element */
876
- _menuTrigger = inject(CdkMenuTrigger, { optional: true, self: true });
877
- /** Whether the CdkMenuItem is disabled - defaults to false */
878
- disabled = false;
879
- /**
880
- * The text used to locate this item during menu typeahead. If not specified,
881
- * the `textContent` of the item will be used.
882
- */
883
- typeaheadLabel;
884
- /**
885
- * If this MenuItem is a regular MenuItem, outputs when it is triggered by a keyboard or mouse
886
- * event.
887
- */
888
- triggered = new EventEmitter();
889
- /** Whether the menu item opens a menu. */
890
- get hasMenu() {
891
- return this._menuTrigger?.menuTemplateRef != null;
892
- }
893
- /**
894
- * The tabindex for this menu item managed internally and used for implementing roving a
895
- * tab index.
896
- */
897
- _tabindex = -1;
898
- /** Whether the item should close the menu if triggered by the spacebar. */
899
- closeOnSpacebarTrigger = true;
900
- /** Emits when the menu item is destroyed. */
901
- destroyed = new Subject();
902
- constructor() {
903
- this._setupMouseEnter();
904
- this._setType();
905
- if (this._isStandaloneItem()) {
906
- this._tabindex = 0;
907
- }
908
- }
909
- ngOnDestroy() {
910
- this._cleanupMouseEnter?.();
911
- this.destroyed.next();
912
- this.destroyed.complete();
913
- }
914
- /** Place focus on the element. */
915
- focus() {
916
- this._elementRef.nativeElement.focus();
917
- }
918
- /**
919
- * If the menu item is not disabled and the element does not have a menu trigger attached, emit
920
- * on the cdkMenuItemTriggered emitter and close all open menus.
921
- * @param options Options the configure how the item is triggered
922
- * - keepOpen: specifies that the menu should be kept open after triggering the item.
923
- */
924
- trigger(options) {
925
- const { keepOpen } = { ...options };
926
- if (!this.disabled && !this.hasMenu) {
927
- this.triggered.next();
928
- if (!keepOpen) {
929
- this._menuStack.closeAll({ focusParentTrigger: true });
930
- }
931
- }
932
- }
933
- /** Return true if this MenuItem has an attached menu and it is open. */
934
- isMenuOpen() {
935
- return !!this._menuTrigger?.isOpen();
936
- }
937
- /**
938
- * Get a reference to the rendered Menu if the Menu is open and it is visible in the DOM.
939
- * @return the menu if it is open, otherwise undefined.
940
- */
941
- getMenu() {
942
- return this._menuTrigger?.getMenu();
943
- }
944
- /** Get the CdkMenuTrigger associated with this element. */
945
- getMenuTrigger() {
946
- return this._menuTrigger;
947
- }
948
- /** Get the label for this element which is required by the FocusableOption interface. */
949
- getLabel() {
950
- return this.typeaheadLabel || this._elementRef.nativeElement.textContent?.trim() || '';
951
- }
952
- /** Reset the tabindex to -1. */
953
- _resetTabIndex() {
954
- if (!this._isStandaloneItem()) {
955
- this._tabindex = -1;
956
- }
957
- }
958
- /**
959
- * Set the tab index to 0 if not disabled and it's a focus event, or a mouse enter if this element
960
- * is not in a menu bar.
961
- */
962
- _setTabIndex(event) {
963
- if (this.disabled) {
964
- return;
965
- }
966
- // don't set the tabindex if there are no open sibling or parent menus
967
- if (!event || !this._menuStack.isEmpty()) {
968
- this._tabindex = 0;
969
- }
970
- }
971
- /**
972
- * Handles keyboard events for the menu item, specifically either triggering the user defined
973
- * callback or opening/closing the current menu based on whether the left or right arrow key was
974
- * pressed.
975
- * @param event the keyboard event to handle
976
- */
977
- _onKeydown(event) {
978
- switch (event.keyCode) {
979
- case SPACE:
980
- case ENTER:
981
- // Skip events that will trigger clicks so the handler doesn't get triggered twice.
982
- if (!hasModifierKey(event) && !eventDispatchesNativeClick(this._elementRef, event)) {
983
- const nodeName = this._elementRef.nativeElement.nodeName;
984
- // Avoid repeat events on non-native elements (see #30250). Note that we don't do this
985
- // on the native elements so we don't interfere with their behavior (see #26296).
986
- if (nodeName !== 'A' && nodeName !== 'BUTTON') {
987
- event.preventDefault();
988
- }
989
- this.trigger({ keepOpen: event.keyCode === SPACE && !this.closeOnSpacebarTrigger });
990
- }
991
- break;
992
- case RIGHT_ARROW:
993
- if (!hasModifierKey(event)) {
994
- if (this._parentMenu && this._isParentVertical()) {
995
- if (this._dir?.value !== 'rtl') {
996
- this._forwardArrowPressed(event);
997
- }
998
- else {
999
- this._backArrowPressed(event);
1000
- }
1001
- }
1002
- }
1003
- break;
1004
- case LEFT_ARROW:
1005
- if (!hasModifierKey(event)) {
1006
- if (this._parentMenu && this._isParentVertical()) {
1007
- if (this._dir?.value !== 'rtl') {
1008
- this._backArrowPressed(event);
1009
- }
1010
- else {
1011
- this._forwardArrowPressed(event);
1012
- }
1013
- }
1014
- }
1015
- break;
1016
- }
1017
- }
1018
- /** Whether this menu item is standalone or within a menu or menu bar. */
1019
- _isStandaloneItem() {
1020
- return !this._parentMenu;
1021
- }
1022
- /**
1023
- * Handles the user pressing the back arrow key.
1024
- * @param event The keyboard event.
1025
- */
1026
- _backArrowPressed(event) {
1027
- const parentMenu = this._parentMenu;
1028
- if (this._menuStack.hasInlineMenu() || this._menuStack.length() > 1) {
1029
- event.preventDefault();
1030
- this._menuStack.close(parentMenu, {
1031
- focusNextOnEmpty: this._menuStack.inlineMenuOrientation() === 'horizontal'
1032
- ? FocusNext.previousItem
1033
- : FocusNext.currentItem,
1034
- focusParentTrigger: true,
1035
- });
1036
- }
1037
- }
1038
- /**
1039
- * Handles the user pressing the forward arrow key.
1040
- * @param event The keyboard event.
1041
- */
1042
- _forwardArrowPressed(event) {
1043
- if (!this.hasMenu && this._menuStack.inlineMenuOrientation() === 'horizontal') {
1044
- event.preventDefault();
1045
- this._menuStack.closeAll({
1046
- focusNextOnEmpty: FocusNext.nextItem,
1047
- focusParentTrigger: true,
1048
- });
1049
- }
1050
- }
1051
- /**
1052
- * Subscribe to the mouseenter events and close any sibling menu items if this element is moused
1053
- * into.
1054
- */
1055
- _setupMouseEnter() {
1056
- if (!this._isStandaloneItem()) {
1057
- const closeOpenSiblings = () => this._ngZone.run(() => this._menuStack.closeSubMenuOf(this._parentMenu));
1058
- this._cleanupMouseEnter = this._ngZone.runOutsideAngular(() => this._renderer.listen(this._elementRef.nativeElement, 'mouseenter', () => {
1059
- // Skip fake `mouseenter` events dispatched by touch devices.
1060
- if (this._inputModalityDetector.mostRecentModality !== 'touch' &&
1061
- !this._menuStack.isEmpty() &&
1062
- !this.hasMenu) {
1063
- if (this._menuAim) {
1064
- this._menuAim.toggle(closeOpenSiblings);
1065
- }
1066
- else {
1067
- closeOpenSiblings();
1068
- }
1069
- }
1070
- }));
1071
- }
1072
- }
1073
- /**
1074
- * Return true if the enclosing parent menu is configured in a horizontal orientation, false
1075
- * otherwise or if no parent.
1076
- */
1077
- _isParentVertical() {
1078
- return this._parentMenu?.orientation === 'vertical';
1079
- }
1080
- /** Sets the `type` attribute of the menu item. */
1081
- _setType() {
1082
- const element = this._elementRef.nativeElement;
1083
- if (element.nodeName === 'BUTTON' && !element.getAttribute('type')) {
1084
- // Prevent form submissions.
1085
- element.setAttribute('type', 'button');
1086
- }
1087
- }
1088
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CdkMenuItem, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1089
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "19.2.6", type: CdkMenuItem, isStandalone: true, selector: "[cdkMenuItem]", inputs: { disabled: ["cdkMenuItemDisabled", "disabled", booleanAttribute], typeaheadLabel: ["cdkMenuitemTypeaheadLabel", "typeaheadLabel"] }, outputs: { triggered: "cdkMenuItemTriggered" }, host: { attributes: { "role": "menuitem" }, listeners: { "blur": "_resetTabIndex()", "focus": "_setTabIndex()", "click": "trigger()", "keydown": "_onKeydown($event)" }, properties: { "tabindex": "_tabindex", "attr.aria-disabled": "disabled || null" }, classAttribute: "cdk-menu-item" }, exportAs: ["cdkMenuItem"], ngImport: i0 });
1090
- }
1091
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CdkMenuItem, decorators: [{
1092
- type: Directive,
1093
- args: [{
1094
- selector: '[cdkMenuItem]',
1095
- exportAs: 'cdkMenuItem',
1096
- host: {
1097
- 'role': 'menuitem',
1098
- 'class': 'cdk-menu-item',
1099
- '[tabindex]': '_tabindex',
1100
- '[attr.aria-disabled]': 'disabled || null',
1101
- '(blur)': '_resetTabIndex()',
1102
- '(focus)': '_setTabIndex()',
1103
- '(click)': 'trigger()',
1104
- '(keydown)': '_onKeydown($event)',
1105
- },
1106
- }]
1107
- }], ctorParameters: () => [], propDecorators: { disabled: [{
1108
- type: Input,
1109
- args: [{ alias: 'cdkMenuItemDisabled', transform: booleanAttribute }]
1110
- }], typeaheadLabel: [{
1111
- type: Input,
1112
- args: ['cdkMenuitemTypeaheadLabel']
1113
- }], triggered: [{
1114
- type: Output,
1115
- args: ['cdkMenuItemTriggered']
1116
- }] } });
1117
-
1118
- /**
1119
- * PointerFocusTracker keeps track of the currently active item under mouse focus. It also has
1120
- * observables which emit when the users mouse enters and leaves a tracked element.
1121
- */
1122
- class PointerFocusTracker {
1123
- _renderer;
1124
- _items;
1125
- _eventCleanups;
1126
- _itemsSubscription;
1127
- /** Emits when an element is moused into. */
1128
- entered = new Subject();
1129
- /** Emits when an element is moused out. */
1130
- exited = new Subject();
1131
- /** The element currently under mouse focus. */
1132
- activeElement;
1133
- /** The element previously under mouse focus. */
1134
- previousElement;
1135
- constructor(_renderer, _items) {
1136
- this._renderer = _renderer;
1137
- this._items = _items;
1138
- this._bindEvents();
1139
- this.entered.subscribe(element => (this.activeElement = element));
1140
- this.exited.subscribe(() => {
1141
- this.previousElement = this.activeElement;
1142
- this.activeElement = undefined;
1143
- });
1144
- }
1145
- /** Stop the managers listeners. */
1146
- destroy() {
1147
- this._cleanupEvents();
1148
- this._itemsSubscription?.unsubscribe();
1149
- }
1150
- /** Binds the enter/exit events on all the items. */
1151
- _bindEvents() {
1152
- // TODO(crisbeto): this can probably be simplified by binding a single event on a parent node.
1153
- this._itemsSubscription = this._items.changes.pipe(startWith(this._items)).subscribe(() => {
1154
- this._cleanupEvents();
1155
- this._eventCleanups = [];
1156
- this._items.forEach(item => {
1157
- const element = item._elementRef.nativeElement;
1158
- this._eventCleanups.push(this._renderer.listen(element, 'mouseenter', () => {
1159
- this.entered.next(item);
1160
- }), this._renderer.listen(element, 'mouseout', () => {
1161
- this.exited.next(item);
1162
- }));
1163
- });
1164
- });
1165
- }
1166
- /** Cleans up the currently-bound events. */
1167
- _cleanupEvents() {
1168
- this._eventCleanups?.forEach(cleanup => cleanup());
1169
- this._eventCleanups = undefined;
1170
- }
1171
- }
1172
-
1173
- /**
1174
- * Abstract directive that implements shared logic common to all menus.
1175
- * This class can be extended to create custom menu types.
1176
- */
1177
- class CdkMenuBase extends CdkMenuGroup {
1178
- _focusMonitor = inject(FocusMonitor);
1179
- ngZone = inject(NgZone);
1180
- _renderer = inject(Renderer2);
1181
- /** The menu's native DOM host element. */
1182
- nativeElement = inject(ElementRef).nativeElement;
1183
- /** The stack of menus this menu belongs to. */
1184
- menuStack = inject(MENU_STACK);
1185
- /** The menu aim service used by this menu. */
1186
- menuAim = inject(MENU_AIM, { optional: true, self: true });
1187
- /** The directionality (text direction) of the current page. */
1188
- dir = inject(Directionality, { optional: true });
1189
- /** The id of the menu's host element. */
1190
- id = inject(_IdGenerator).getId('cdk-menu-');
1191
- /** All child MenuItem elements nested in this Menu. */
1192
- items;
1193
- /** The direction items in the menu flow. */
1194
- orientation = 'vertical';
1195
- /**
1196
- * Whether the menu is displayed inline (i.e. always present vs a conditional popup that the
1197
- * user triggers with a trigger element).
1198
- */
1199
- isInline = false;
1200
- /** Handles keyboard events for the menu. */
1201
- keyManager;
1202
- /** Emits when the MenuBar is destroyed. */
1203
- destroyed = new Subject();
1204
- /** The Menu Item which triggered the open submenu. */
1205
- triggerItem;
1206
- /** Tracks the users mouse movements over the menu. */
1207
- pointerTracker;
1208
- /** Whether this menu's menu stack has focus. */
1209
- _menuStackHasFocus = signal(false);
1210
- _tabIndexSignal = computed(() => {
1211
- const tabindexIfInline = this._menuStackHasFocus() ? -1 : 0;
1212
- return this.isInline ? tabindexIfInline : null;
1213
- });
1214
- ngAfterContentInit() {
1215
- if (!this.isInline) {
1216
- this.menuStack.push(this);
1217
- }
1218
- this._setKeyManager();
1219
- this._handleFocus();
1220
- this._subscribeToMenuStackHasFocus();
1221
- this._subscribeToMenuOpen();
1222
- this._subscribeToMenuStackClosed();
1223
- this._setUpPointerTracker();
1224
- }
1225
- ngOnDestroy() {
1226
- this._focusMonitor.stopMonitoring(this.nativeElement);
1227
- this.keyManager?.destroy();
1228
- this.destroyed.next();
1229
- this.destroyed.complete();
1230
- this.pointerTracker?.destroy();
1231
- }
1232
- /**
1233
- * Place focus on the first MenuItem in the menu and set the focus origin.
1234
- * @param focusOrigin The origin input mode of the focus event.
1235
- */
1236
- focusFirstItem(focusOrigin = 'program') {
1237
- this.keyManager.setFocusOrigin(focusOrigin);
1238
- this.keyManager.setFirstItemActive();
1239
- }
1240
- /**
1241
- * Place focus on the last MenuItem in the menu and set the focus origin.
1242
- * @param focusOrigin The origin input mode of the focus event.
1243
- */
1244
- focusLastItem(focusOrigin = 'program') {
1245
- this.keyManager.setFocusOrigin(focusOrigin);
1246
- this.keyManager.setLastItemActive();
1247
- }
1248
- /** Gets the tabindex for this menu. */
1249
- _getTabIndex() {
1250
- return this._tabIndexSignal();
1251
- }
1252
- /**
1253
- * Close the open menu if the current active item opened the requested MenuStackItem.
1254
- * @param menu The menu requested to be closed.
1255
- * @param options Options to configure the behavior on close.
1256
- * - `focusParentTrigger` Whether to focus the parent trigger after closing the menu.
1257
- */
1258
- closeOpenMenu(menu, options) {
1259
- const { focusParentTrigger } = { ...options };
1260
- const keyManager = this.keyManager;
1261
- const trigger = this.triggerItem;
1262
- if (menu === trigger?.getMenuTrigger()?.getMenu()) {
1263
- trigger?.getMenuTrigger()?.close();
1264
- // If the user has moused over a sibling item we want to focus the element under mouse focus
1265
- // not the trigger which previously opened the now closed menu.
1266
- if (focusParentTrigger) {
1267
- if (trigger) {
1268
- keyManager.setActiveItem(trigger);
1269
- }
1270
- else {
1271
- keyManager.setFirstItemActive();
1272
- }
1273
- }
1274
- }
1275
- }
1276
- /** Setup the FocusKeyManager with the correct orientation for the menu. */
1277
- _setKeyManager() {
1278
- this.keyManager = new FocusKeyManager(this.items).withWrap().withTypeAhead().withHomeAndEnd();
1279
- if (this.orientation === 'horizontal') {
1280
- this.keyManager.withHorizontalOrientation(this.dir?.value || 'ltr');
1281
- }
1282
- else {
1283
- this.keyManager.withVerticalOrientation();
1284
- }
1285
- }
1286
- /**
1287
- * Subscribe to the menu trigger's open events in order to track the trigger which opened the menu
1288
- * and stop tracking it when the menu is closed.
1289
- */
1290
- _subscribeToMenuOpen() {
1291
- const exitCondition = merge(this.items.changes, this.destroyed);
1292
- this.items.changes
1293
- .pipe(startWith(this.items), mergeMap((list) => list
1294
- .filter(item => item.hasMenu)
1295
- .map(item => item.getMenuTrigger().opened.pipe(mapTo(item), takeUntil(exitCondition)))), mergeAll(), switchMap((item) => {
1296
- this.triggerItem = item;
1297
- return item.getMenuTrigger().closed;
1298
- }), takeUntil(this.destroyed))
1299
- .subscribe(() => (this.triggerItem = undefined));
1300
- }
1301
- /** Subscribe to the MenuStack close events. */
1302
- _subscribeToMenuStackClosed() {
1303
- this.menuStack.closed
1304
- .pipe(takeUntil(this.destroyed))
1305
- .subscribe(({ item, focusParentTrigger }) => this.closeOpenMenu(item, { focusParentTrigger }));
1306
- }
1307
- /** Subscribe to the MenuStack hasFocus events. */
1308
- _subscribeToMenuStackHasFocus() {
1309
- if (this.isInline) {
1310
- this.menuStack.hasFocus.pipe(takeUntil(this.destroyed)).subscribe(hasFocus => {
1311
- this._menuStackHasFocus.set(hasFocus);
1312
- });
1313
- }
1314
- }
1315
- /**
1316
- * Set the PointerFocusTracker and ensure that when mouse focus changes the key manager is updated
1317
- * with the latest menu item under mouse focus.
1318
- */
1319
- _setUpPointerTracker() {
1320
- if (this.menuAim) {
1321
- this.ngZone.runOutsideAngular(() => {
1322
- this.pointerTracker = new PointerFocusTracker(this._renderer, this.items);
1323
- });
1324
- this.menuAim.initialize(this, this.pointerTracker);
1325
- }
1326
- }
1327
- /** Handles focus landing on the host element of the menu. */
1328
- _handleFocus() {
1329
- this._focusMonitor
1330
- .monitor(this.nativeElement, false)
1331
- .pipe(takeUntil(this.destroyed))
1332
- .subscribe(origin => {
1333
- // Don't forward focus on mouse interactions, because it can
1334
- // mess with the user's scroll position. See #30130.
1335
- if (origin !== null && origin !== 'mouse') {
1336
- this.focusFirstItem(origin);
1337
- }
1338
- });
1339
- }
1340
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CdkMenuBase, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1341
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.6", type: CdkMenuBase, isStandalone: true, inputs: { id: "id" }, host: { attributes: { "role": "menu" }, listeners: { "focusin": "menuStack.setHasFocus(true)", "focusout": "menuStack.setHasFocus(false)" }, properties: { "tabindex": "_getTabIndex()", "id": "id", "attr.aria-orientation": "orientation", "attr.data-cdk-menu-stack-id": "menuStack.id" } }, queries: [{ propertyName: "items", predicate: CdkMenuItem, descendants: true }], usesInheritance: true, ngImport: i0 });
1342
- }
1343
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CdkMenuBase, decorators: [{
1344
- type: Directive,
1345
- args: [{
1346
- host: {
1347
- 'role': 'menu',
1348
- 'class': '', // reset the css class added by the super-class
1349
- '[tabindex]': '_getTabIndex()',
1350
- '[id]': 'id',
1351
- '[attr.aria-orientation]': 'orientation',
1352
- '[attr.data-cdk-menu-stack-id]': 'menuStack.id',
1353
- '(focusin)': 'menuStack.setHasFocus(true)',
1354
- '(focusout)': 'menuStack.setHasFocus(false)',
1355
- },
1356
- }]
1357
- }], propDecorators: { id: [{
1358
- type: Input
1359
- }], items: [{
1360
- type: ContentChildren,
1361
- args: [CdkMenuItem, { descendants: true }]
1362
- }] } });
1363
-
1364
- /**
1365
- * Directive which configures the element as a Menu which should contain child elements marked as
1366
- * CdkMenuItem or CdkMenuGroup. Sets the appropriate role and aria-attributes for a menu and
1367
- * contains accessible keyboard and mouse handling logic.
1368
- *
1369
- * It also acts as a RadioGroup for elements marked with role `menuitemradio`.
1370
- */
1371
- class CdkMenu extends CdkMenuBase {
1372
- _parentTrigger = inject(MENU_TRIGGER, { optional: true });
1373
- /** Event emitted when the menu is closed. */
1374
- closed = new EventEmitter();
1375
- /** The direction items in the menu flow. */
1376
- orientation = 'vertical';
1377
- /** Whether the menu is displayed inline (i.e. always present vs a conditional popup that the user triggers with a trigger element). */
1378
- isInline = !this._parentTrigger;
1379
- constructor() {
1380
- super();
1381
- this.destroyed.subscribe(this.closed);
1382
- this._parentTrigger?.registerChildMenu(this);
1383
- }
1384
- ngAfterContentInit() {
1385
- super.ngAfterContentInit();
1386
- this._subscribeToMenuStackEmptied();
1387
- }
1388
- ngOnDestroy() {
1389
- super.ngOnDestroy();
1390
- this.closed.complete();
1391
- }
1392
- /**
1393
- * Handle keyboard events for the Menu.
1394
- * @param event The keyboard event to be handled.
1395
- */
1396
- _handleKeyEvent(event) {
1397
- const keyManager = this.keyManager;
1398
- switch (event.keyCode) {
1399
- case LEFT_ARROW:
1400
- case RIGHT_ARROW:
1401
- if (!hasModifierKey(event)) {
1402
- event.preventDefault();
1403
- keyManager.setFocusOrigin('keyboard');
1404
- keyManager.onKeydown(event);
1405
- }
1406
- break;
1407
- case ESCAPE:
1408
- if (!hasModifierKey(event)) {
1409
- event.preventDefault();
1410
- this.menuStack.close(this, {
1411
- focusNextOnEmpty: FocusNext.currentItem,
1412
- focusParentTrigger: true,
1413
- });
1414
- }
1415
- break;
1416
- case TAB:
1417
- if (!hasModifierKey(event, 'altKey', 'metaKey', 'ctrlKey')) {
1418
- this.menuStack.closeAll({ focusParentTrigger: true });
1419
- }
1420
- break;
1421
- default:
1422
- keyManager.onKeydown(event);
1423
- }
1424
- }
1425
- /**
1426
- * Set focus the either the current, previous or next item based on the FocusNext event.
1427
- * @param focusNext The element to focus.
1428
- */
1429
- _toggleMenuFocus(focusNext) {
1430
- const keyManager = this.keyManager;
1431
- switch (focusNext) {
1432
- case FocusNext.nextItem:
1433
- keyManager.setFocusOrigin('keyboard');
1434
- keyManager.setNextItemActive();
1435
- break;
1436
- case FocusNext.previousItem:
1437
- keyManager.setFocusOrigin('keyboard');
1438
- keyManager.setPreviousItemActive();
1439
- break;
1440
- case FocusNext.currentItem:
1441
- if (keyManager.activeItem) {
1442
- keyManager.setFocusOrigin('keyboard');
1443
- keyManager.setActiveItem(keyManager.activeItem);
1444
- }
1445
- break;
1446
- }
1447
- }
1448
- /** Subscribe to the MenuStack emptied events. */
1449
- _subscribeToMenuStackEmptied() {
1450
- this.menuStack.emptied
1451
- .pipe(takeUntil(this.destroyed))
1452
- .subscribe(event => this._toggleMenuFocus(event));
1453
- }
1454
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CdkMenu, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1455
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.6", type: CdkMenu, isStandalone: true, selector: "[cdkMenu]", outputs: { closed: "closed" }, host: { attributes: { "role": "menu" }, listeners: { "keydown": "_handleKeyEvent($event)" }, properties: { "class.cdk-menu-inline": "isInline" }, classAttribute: "cdk-menu" }, providers: [
1456
- { provide: CdkMenuGroup, useExisting: CdkMenu },
1457
- { provide: CDK_MENU, useExisting: CdkMenu },
1458
- PARENT_OR_NEW_INLINE_MENU_STACK_PROVIDER('vertical'),
1459
- ], exportAs: ["cdkMenu"], usesInheritance: true, ngImport: i0 });
1460
- }
1461
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CdkMenu, decorators: [{
1462
- type: Directive,
1463
- args: [{
1464
- selector: '[cdkMenu]',
1465
- exportAs: 'cdkMenu',
1466
- host: {
1467
- 'role': 'menu',
1468
- 'class': 'cdk-menu',
1469
- '[class.cdk-menu-inline]': 'isInline',
1470
- '(keydown)': '_handleKeyEvent($event)',
1471
- },
1472
- providers: [
1473
- { provide: CdkMenuGroup, useExisting: CdkMenu },
1474
- { provide: CDK_MENU, useExisting: CdkMenu },
1475
- PARENT_OR_NEW_INLINE_MENU_STACK_PROVIDER('vertical'),
1476
- ],
1477
- }]
1478
- }], ctorParameters: () => [], propDecorators: { closed: [{
1479
- type: Output
1480
- }] } });
1481
-
1482
- /**
1483
- * Directive applied to an element which configures it as a MenuBar by setting the appropriate
1484
- * role, aria attributes, and accessible keyboard and mouse handling logic. The component that
1485
- * this directive is applied to should contain components marked with CdkMenuItem.
1486
- *
1487
- */
1488
- class CdkMenuBar extends CdkMenuBase {
1489
- /** The direction items in the menu flow. */
1490
- orientation = 'horizontal';
1491
- /** Whether the menu is displayed inline (i.e. always present vs a conditional popup that the user triggers with a trigger element). */
1492
- isInline = true;
1493
- ngAfterContentInit() {
1494
- super.ngAfterContentInit();
1495
- this._subscribeToMenuStackEmptied();
1496
- }
1497
- /**
1498
- * Handle keyboard events for the Menu.
1499
- * @param event The keyboard event to be handled.
1500
- */
1501
- _handleKeyEvent(event) {
1502
- const keyManager = this.keyManager;
1503
- switch (event.keyCode) {
1504
- case UP_ARROW:
1505
- case DOWN_ARROW:
1506
- case LEFT_ARROW:
1507
- case RIGHT_ARROW:
1508
- if (!hasModifierKey(event)) {
1509
- const horizontalArrows = event.keyCode === LEFT_ARROW || event.keyCode === RIGHT_ARROW;
1510
- // For a horizontal menu if the left/right keys were clicked, or a vertical menu if the
1511
- // up/down keys were clicked: if the current menu is open, close it then focus and open the
1512
- // next menu.
1513
- if (horizontalArrows) {
1514
- event.preventDefault();
1515
- const prevIsOpen = keyManager.activeItem?.isMenuOpen();
1516
- keyManager.activeItem?.getMenuTrigger()?.close();
1517
- keyManager.setFocusOrigin('keyboard');
1518
- keyManager.onKeydown(event);
1519
- if (prevIsOpen) {
1520
- keyManager.activeItem?.getMenuTrigger()?.open();
1521
- }
1522
- }
1523
- }
1524
- break;
1525
- case ESCAPE:
1526
- if (!hasModifierKey(event)) {
1527
- event.preventDefault();
1528
- keyManager.activeItem?.getMenuTrigger()?.close();
1529
- }
1530
- break;
1531
- case TAB:
1532
- if (!hasModifierKey(event, 'altKey', 'metaKey', 'ctrlKey')) {
1533
- keyManager.activeItem?.getMenuTrigger()?.close();
1534
- }
1535
- break;
1536
- default:
1537
- keyManager.onKeydown(event);
1538
- }
1539
- }
1540
- /**
1541
- * Set focus to either the current, previous or next item based on the FocusNext event, then
1542
- * open the previous or next item.
1543
- * @param focusNext The element to focus.
1544
- */
1545
- _toggleOpenMenu(focusNext) {
1546
- const keyManager = this.keyManager;
1547
- switch (focusNext) {
1548
- case FocusNext.nextItem:
1549
- keyManager.setFocusOrigin('keyboard');
1550
- keyManager.setNextItemActive();
1551
- keyManager.activeItem?.getMenuTrigger()?.open();
1552
- break;
1553
- case FocusNext.previousItem:
1554
- keyManager.setFocusOrigin('keyboard');
1555
- keyManager.setPreviousItemActive();
1556
- keyManager.activeItem?.getMenuTrigger()?.open();
1557
- break;
1558
- case FocusNext.currentItem:
1559
- if (keyManager.activeItem) {
1560
- keyManager.setFocusOrigin('keyboard');
1561
- keyManager.setActiveItem(keyManager.activeItem);
1562
- }
1563
- break;
1564
- }
1565
- }
1566
- /** Subscribe to the MenuStack emptied events. */
1567
- _subscribeToMenuStackEmptied() {
1568
- this.menuStack?.emptied
1569
- .pipe(takeUntil(this.destroyed))
1570
- .subscribe(event => this._toggleOpenMenu(event));
1571
- }
1572
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CdkMenuBar, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1573
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.6", type: CdkMenuBar, isStandalone: true, selector: "[cdkMenuBar]", host: { attributes: { "role": "menubar" }, listeners: { "keydown": "_handleKeyEvent($event)" }, classAttribute: "cdk-menu-bar" }, providers: [
1574
- { provide: CdkMenuGroup, useExisting: CdkMenuBar },
1575
- { provide: CDK_MENU, useExisting: CdkMenuBar },
1576
- { provide: MENU_STACK, useFactory: () => MenuStack.inline('horizontal') },
1577
- ], exportAs: ["cdkMenuBar"], usesInheritance: true, ngImport: i0 });
1578
- }
1579
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CdkMenuBar, decorators: [{
1580
- type: Directive,
1581
- args: [{
1582
- selector: '[cdkMenuBar]',
1583
- exportAs: 'cdkMenuBar',
1584
- host: {
1585
- 'role': 'menubar',
1586
- 'class': 'cdk-menu-bar',
1587
- '(keydown)': '_handleKeyEvent($event)',
1588
- },
1589
- providers: [
1590
- { provide: CdkMenuGroup, useExisting: CdkMenuBar },
1591
- { provide: CDK_MENU, useExisting: CdkMenuBar },
1592
- { provide: MENU_STACK, useFactory: () => MenuStack.inline('horizontal') },
1593
- ],
1594
- }]
1595
- }] });
1596
-
1597
- /** Base class providing checked state for selectable MenuItems. */
1598
- class CdkMenuItemSelectable extends CdkMenuItem {
1599
- /** Whether the element is checked */
1600
- checked = false;
1601
- /** Whether the item should close the menu if triggered by the spacebar. */
1602
- closeOnSpacebarTrigger = false;
1603
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CdkMenuItemSelectable, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1604
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "19.2.6", type: CdkMenuItemSelectable, isStandalone: true, inputs: { checked: ["cdkMenuItemChecked", "checked", booleanAttribute] }, host: { properties: { "attr.aria-checked": "!!checked", "attr.aria-disabled": "disabled || null" } }, usesInheritance: true, ngImport: i0 });
1605
- }
1606
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CdkMenuItemSelectable, decorators: [{
1607
- type: Directive,
1608
- args: [{
1609
- host: {
1610
- '[attr.aria-checked]': '!!checked',
1611
- '[attr.aria-disabled]': 'disabled || null',
1612
- },
1613
- }]
1614
- }], propDecorators: { checked: [{
1615
- type: Input,
1616
- args: [{ alias: 'cdkMenuItemChecked', transform: booleanAttribute }]
1617
- }] } });
1618
-
1619
- /**
1620
- * A directive providing behavior for the "menuitemradio" ARIA role, which behaves similarly to
1621
- * a conventional radio-button. Any sibling `CdkMenuItemRadio` instances within the same `CdkMenu`
1622
- * or `CdkMenuGroup` comprise a radio group with unique selection enforced.
1623
- */
1624
- class CdkMenuItemRadio extends CdkMenuItemSelectable {
1625
- /** The unique selection dispatcher for this radio's `CdkMenuGroup`. */
1626
- _selectionDispatcher = inject(UniqueSelectionDispatcher);
1627
- /** An ID to identify this radio item to the `UniqueSelectionDispatcher`. */
1628
- _id = inject(_IdGenerator).getId('cdk-menu-item-radio-');
1629
- /** Function to unregister the selection dispatcher */
1630
- _removeDispatcherListener;
1631
- constructor() {
1632
- super();
1633
- this._registerDispatcherListener();
1634
- }
1635
- ngOnDestroy() {
1636
- super.ngOnDestroy();
1637
- this._removeDispatcherListener();
1638
- }
1639
- /**
1640
- * Toggles the checked state of the radio-button.
1641
- * @param options Options the configure how the item is triggered
1642
- * - keepOpen: specifies that the menu should be kept open after triggering the item.
1643
- */
1644
- trigger(options) {
1645
- super.trigger(options);
1646
- if (!this.disabled) {
1647
- this._selectionDispatcher.notify(this._id, '');
1648
- }
1649
- }
1650
- /** Configure the unique selection dispatcher listener in order to toggle the checked state */
1651
- _registerDispatcherListener() {
1652
- this._removeDispatcherListener = this._selectionDispatcher.listen((id) => {
1653
- this.checked = this._id === id;
1654
- });
1655
- }
1656
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CdkMenuItemRadio, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1657
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.6", type: CdkMenuItemRadio, isStandalone: true, selector: "[cdkMenuItemRadio]", host: { attributes: { "role": "menuitemradio" }, properties: { "class.cdk-menu-item-radio": "true" } }, providers: [
1658
- { provide: CdkMenuItemSelectable, useExisting: CdkMenuItemRadio },
1659
- { provide: CdkMenuItem, useExisting: CdkMenuItemSelectable },
1660
- ], exportAs: ["cdkMenuItemRadio"], usesInheritance: true, ngImport: i0 });
1661
- }
1662
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CdkMenuItemRadio, decorators: [{
1663
- type: Directive,
1664
- args: [{
1665
- selector: '[cdkMenuItemRadio]',
1666
- exportAs: 'cdkMenuItemRadio',
1667
- host: {
1668
- 'role': 'menuitemradio',
1669
- '[class.cdk-menu-item-radio]': 'true',
1670
- },
1671
- providers: [
1672
- { provide: CdkMenuItemSelectable, useExisting: CdkMenuItemRadio },
1673
- { provide: CdkMenuItem, useExisting: CdkMenuItemSelectable },
1674
- ],
1675
- }]
1676
- }], ctorParameters: () => [] });
1677
-
1678
- /**
1679
- * A directive providing behavior for the "menuitemcheckbox" ARIA role, which behaves similarly to a
1680
- * conventional checkbox.
1681
- */
1682
- class CdkMenuItemCheckbox extends CdkMenuItemSelectable {
1683
- /**
1684
- * Toggle the checked state of the checkbox.
1685
- * @param options Options the configure how the item is triggered
1686
- * - keepOpen: specifies that the menu should be kept open after triggering the item.
1687
- */
1688
- trigger(options) {
1689
- super.trigger(options);
1690
- if (!this.disabled) {
1691
- this.checked = !this.checked;
1692
- }
1693
- }
1694
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CdkMenuItemCheckbox, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1695
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.6", type: CdkMenuItemCheckbox, isStandalone: true, selector: "[cdkMenuItemCheckbox]", host: { attributes: { "role": "menuitemcheckbox" }, properties: { "class.cdk-menu-item-checkbox": "true" } }, providers: [
1696
- { provide: CdkMenuItemSelectable, useExisting: CdkMenuItemCheckbox },
1697
- { provide: CdkMenuItem, useExisting: CdkMenuItemSelectable },
1698
- ], exportAs: ["cdkMenuItemCheckbox"], usesInheritance: true, ngImport: i0 });
1699
- }
1700
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CdkMenuItemCheckbox, decorators: [{
1701
- type: Directive,
1702
- args: [{
1703
- selector: '[cdkMenuItemCheckbox]',
1704
- exportAs: 'cdkMenuItemCheckbox',
1705
- host: {
1706
- 'role': 'menuitemcheckbox',
1707
- '[class.cdk-menu-item-checkbox]': 'true',
1708
- },
1709
- providers: [
1710
- { provide: CdkMenuItemSelectable, useExisting: CdkMenuItemCheckbox },
1711
- { provide: CdkMenuItem, useExisting: CdkMenuItemSelectable },
1712
- ],
1713
- }]
1714
- }] });
1715
-
1716
- /** The preferred menu positions for the context menu. */
1717
- const CONTEXT_MENU_POSITIONS = STANDARD_DROPDOWN_BELOW_POSITIONS.map(position => {
1718
- // In cases where the first menu item in the context menu is a trigger the submenu opens on a
1719
- // hover event. We offset the context menu 2px by default to prevent this from occurring.
1720
- const offsetX = position.overlayX === 'start' ? 2 : -2;
1721
- const offsetY = position.overlayY === 'top' ? 2 : -2;
1722
- return { ...position, offsetX, offsetY };
1723
- });
1724
- /** Tracks the last open context menu trigger across the entire application. */
1725
- class ContextMenuTracker {
1726
- /** The last open context menu trigger. */
1727
- static _openContextMenuTrigger;
1728
- /**
1729
- * Close the previous open context menu and set the given one as being open.
1730
- * @param trigger The trigger for the currently open Context Menu.
1731
- */
1732
- update(trigger) {
1733
- if (ContextMenuTracker._openContextMenuTrigger !== trigger) {
1734
- ContextMenuTracker._openContextMenuTrigger?.close();
1735
- ContextMenuTracker._openContextMenuTrigger = trigger;
1736
- }
1737
- }
1738
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: ContextMenuTracker, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1739
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: ContextMenuTracker, providedIn: 'root' });
1740
- }
1741
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: ContextMenuTracker, decorators: [{
1742
- type: Injectable,
1743
- args: [{ providedIn: 'root' }]
1744
- }] });
1745
- /**
1746
- * A directive that opens a menu when a user right-clicks within its host element.
1747
- * It is aware of nested context menus and will trigger only the lowest level non-disabled context menu.
1748
- */
1749
- class CdkContextMenuTrigger extends CdkMenuTriggerBase {
1750
- /** The CDK overlay service. */
1751
- _overlay = inject(Overlay);
1752
- /** The directionality of the page. */
1753
- _directionality = inject(Directionality, { optional: true });
1754
- /** The app's context menu tracking registry */
1755
- _contextMenuTracker = inject(ContextMenuTracker);
1756
- _changeDetectorRef = inject(ChangeDetectorRef);
1757
- /** Whether the context menu is disabled. */
1758
- disabled = false;
1759
- constructor() {
1760
- super();
1761
- this._setMenuStackCloseListener();
1762
- }
1763
- /**
1764
- * Open the attached menu at the specified location.
1765
- * @param coordinates where to open the context menu
1766
- */
1767
- open(coordinates) {
1768
- this._open(null, coordinates);
1769
- this._changeDetectorRef.markForCheck();
1770
- }
1771
- /** Close the currently opened context menu. */
1772
- close() {
1773
- this.menuStack.closeAll();
1774
- }
1775
- /**
1776
- * Open the context menu and closes any previously open menus.
1777
- * @param event the mouse event which opens the context menu.
1778
- */
1779
- _openOnContextMenu(event) {
1780
- if (!this.disabled) {
1781
- // Prevent the native context menu from opening because we're opening a custom one.
1782
- event.preventDefault();
1783
- // Stop event propagation to ensure that only the closest enabled context menu opens.
1784
- // Otherwise, any context menus attached to containing elements would *also* open,
1785
- // resulting in multiple stacked context menus being displayed.
1786
- event.stopPropagation();
1787
- this._contextMenuTracker.update(this);
1788
- this._open(event, { x: event.clientX, y: event.clientY });
1789
- // A context menu can be triggered via a mouse right click or a keyboard shortcut.
1790
- if (event.button === 2) {
1791
- this.childMenu?.focusFirstItem('mouse');
1792
- }
1793
- else if (event.button === 0) {
1794
- this.childMenu?.focusFirstItem('keyboard');
1795
- }
1796
- else {
1797
- this.childMenu?.focusFirstItem('program');
1798
- }
1799
- }
1800
- }
1801
- /**
1802
- * Get the configuration object used to create the overlay.
1803
- * @param coordinates the location to place the opened menu
1804
- */
1805
- _getOverlayConfig(coordinates) {
1806
- return new OverlayConfig({
1807
- positionStrategy: this._getOverlayPositionStrategy(coordinates),
1808
- scrollStrategy: this.menuScrollStrategy(),
1809
- direction: this._directionality || undefined,
1810
- });
1811
- }
1812
- /**
1813
- * Get the position strategy for the overlay which specifies where to place the menu.
1814
- * @param coordinates the location to place the opened menu
1815
- */
1816
- _getOverlayPositionStrategy(coordinates) {
1817
- return this._overlay
1818
- .position()
1819
- .flexibleConnectedTo(coordinates)
1820
- .withLockedPosition()
1821
- .withGrowAfterOpen()
1822
- .withPositions(this.menuPosition ?? CONTEXT_MENU_POSITIONS);
1823
- }
1824
- /** Subscribe to the menu stack close events and close this menu when requested. */
1825
- _setMenuStackCloseListener() {
1826
- this.menuStack.closed.pipe(takeUntil(this.destroyed)).subscribe(({ item }) => {
1827
- if (item === this.childMenu && this.isOpen()) {
1828
- this.closed.next();
1829
- this.overlayRef.detach();
1830
- this.childMenu = undefined;
1831
- this._changeDetectorRef.markForCheck();
1832
- }
1833
- });
1834
- }
1835
- /**
1836
- * Subscribe to the overlays outside pointer events stream and handle closing out the stack if a
1837
- * click occurs outside the menus.
1838
- * @param userEvent User-generated event that opened the menu.
1839
- */
1840
- _subscribeToOutsideClicks(userEvent) {
1841
- if (this.overlayRef) {
1842
- let outsideClicks = this.overlayRef.outsidePointerEvents();
1843
- if (userEvent) {
1844
- const [auxClicks, nonAuxClicks] = partition(outsideClicks, ({ type }) => type === 'auxclick');
1845
- outsideClicks = merge(
1846
- // Using a mouse, the `contextmenu` event can fire either when pressing the right button
1847
- // or left button + control. Most browsers won't dispatch a `click` event right after
1848
- // a `contextmenu` event triggered by left button + control, but Safari will (see #27832).
1849
- // This closes the menu immediately. To work around it, we check that both the triggering
1850
- // event and the current outside click event both had the control key pressed, and that
1851
- // that this is the first outside click event.
1852
- nonAuxClicks.pipe(skipWhile((event, index) => userEvent.ctrlKey && index === 0 && event.ctrlKey)),
1853
- // If the menu was triggered by the `contextmenu` event, skip the first `auxclick` event
1854
- // because it fires when the mouse is released on the same click that opened the menu.
1855
- auxClicks.pipe(skip(1)));
1856
- }
1857
- outsideClicks.pipe(takeUntil(this.stopOutsideClicksListener)).subscribe(event => {
1858
- if (!this.isElementInsideMenuStack(_getEventTarget(event))) {
1859
- this.menuStack.closeAll();
1860
- }
1861
- });
1862
- }
1863
- }
1864
- /**
1865
- * Open the attached menu at the specified location.
1866
- * @param userEvent User-generated event that opened the menu
1867
- * @param coordinates where to open the context menu
1868
- */
1869
- _open(userEvent, coordinates) {
1870
- if (this.disabled) {
1871
- return;
1872
- }
1873
- if (this.isOpen()) {
1874
- // since we're moving this menu we need to close any submenus first otherwise they end up
1875
- // disconnected from this one.
1876
- this.menuStack.closeSubMenuOf(this.childMenu);
1877
- this.overlayRef.getConfig().positionStrategy.setOrigin(coordinates);
1878
- this.overlayRef.updatePosition();
1879
- }
1880
- else {
1881
- this.opened.next();
1882
- if (this.overlayRef) {
1883
- this.overlayRef.getConfig().positionStrategy.setOrigin(coordinates);
1884
- this.overlayRef.updatePosition();
1885
- }
1886
- else {
1887
- this.overlayRef = this._overlay.create(this._getOverlayConfig(coordinates));
1888
- }
1889
- this.overlayRef.attach(this.getMenuContentPortal());
1890
- this._subscribeToOutsideClicks(userEvent);
1891
- }
1892
- }
1893
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CdkContextMenuTrigger, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1894
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "19.2.6", type: CdkContextMenuTrigger, isStandalone: true, selector: "[cdkContextMenuTriggerFor]", inputs: { menuTemplateRef: ["cdkContextMenuTriggerFor", "menuTemplateRef"], menuPosition: ["cdkContextMenuPosition", "menuPosition"], menuData: ["cdkContextMenuTriggerData", "menuData"], disabled: ["cdkContextMenuDisabled", "disabled", booleanAttribute] }, outputs: { opened: "cdkContextMenuOpened", closed: "cdkContextMenuClosed" }, host: { listeners: { "contextmenu": "_openOnContextMenu($event)" }, properties: { "attr.data-cdk-menu-stack-id": "null" } }, providers: [
1895
- { provide: MENU_TRIGGER, useExisting: CdkContextMenuTrigger },
1896
- { provide: MENU_STACK, useClass: MenuStack },
1897
- ], exportAs: ["cdkContextMenuTriggerFor"], usesInheritance: true, ngImport: i0 });
1898
- }
1899
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CdkContextMenuTrigger, decorators: [{
1900
- type: Directive,
1901
- args: [{
1902
- selector: '[cdkContextMenuTriggerFor]',
1903
- exportAs: 'cdkContextMenuTriggerFor',
1904
- host: {
1905
- '[attr.data-cdk-menu-stack-id]': 'null',
1906
- '(contextmenu)': '_openOnContextMenu($event)',
1907
- },
1908
- inputs: [
1909
- { name: 'menuTemplateRef', alias: 'cdkContextMenuTriggerFor' },
1910
- { name: 'menuPosition', alias: 'cdkContextMenuPosition' },
1911
- { name: 'menuData', alias: 'cdkContextMenuTriggerData' },
1912
- ],
1913
- outputs: ['opened: cdkContextMenuOpened', 'closed: cdkContextMenuClosed'],
1914
- providers: [
1915
- { provide: MENU_TRIGGER, useExisting: CdkContextMenuTrigger },
1916
- { provide: MENU_STACK, useClass: MenuStack },
1917
- ],
1918
- }]
1919
- }], ctorParameters: () => [], propDecorators: { disabled: [{
1920
- type: Input,
1921
- args: [{ alias: 'cdkContextMenuDisabled', transform: booleanAttribute }]
1922
- }] } });
1923
-
1924
- const MENU_DIRECTIVES = [
1925
- CdkMenuBar,
1926
- CdkMenu,
1927
- CdkMenuItem,
1928
- CdkMenuItemRadio,
1929
- CdkMenuItemCheckbox,
1930
- CdkMenuTrigger,
1931
- CdkMenuGroup,
1932
- CdkContextMenuTrigger,
1933
- CdkTargetMenuAim,
1934
- ];
1935
- /** Module that declares components and directives for the CDK menu. */
1936
- class CdkMenuModule {
1937
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CdkMenuModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1938
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.6", ngImport: i0, type: CdkMenuModule, imports: [OverlayModule, CdkMenuBar,
1939
- CdkMenu,
1940
- CdkMenuItem,
1941
- CdkMenuItemRadio,
1942
- CdkMenuItemCheckbox,
1943
- CdkMenuTrigger,
1944
- CdkMenuGroup,
1945
- CdkContextMenuTrigger,
1946
- CdkTargetMenuAim], exports: [CdkMenuBar,
1947
- CdkMenu,
1948
- CdkMenuItem,
1949
- CdkMenuItemRadio,
1950
- CdkMenuItemCheckbox,
1951
- CdkMenuTrigger,
1952
- CdkMenuGroup,
1953
- CdkContextMenuTrigger,
1954
- CdkTargetMenuAim] });
1955
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CdkMenuModule, imports: [OverlayModule] });
1956
- }
1957
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CdkMenuModule, decorators: [{
1958
- type: NgModule,
1959
- args: [{
1960
- imports: [OverlayModule, ...MENU_DIRECTIVES],
1961
- exports: MENU_DIRECTIVES,
1962
- }]
1963
- }] });
1964
-
1965
- export { CDK_MENU, CdkContextMenuTrigger, CdkMenu, CdkMenuBar, CdkMenuBase, CdkMenuGroup, CdkMenuItem, CdkMenuItemCheckbox, CdkMenuItemRadio, CdkMenuItemSelectable, CdkMenuModule, CdkMenuTrigger, CdkMenuTriggerBase, CdkTargetMenuAim, ContextMenuTracker, FocusNext, MENU_AIM, MENU_SCROLL_STRATEGY, MENU_STACK, MENU_TRIGGER, MenuStack, PARENT_OR_NEW_INLINE_MENU_STACK_PROVIDER, PARENT_OR_NEW_MENU_STACK_PROVIDER, PointerFocusTracker, TargetMenuAim };
1966
- //# sourceMappingURL=menu.mjs.map