@angular/cdk 16.0.0-next.4 → 16.0.0-rc.0

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