@angular/cdk 14.0.0-next.9 → 14.0.0-rc.2

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