@angular/cdk 19.2.13 → 19.2.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (429) hide show
  1. package/_adev_assets/cdk_testing.json +7032 -1
  2. package/_adev_assets/cdk_testing_protractor.json +1747 -1
  3. package/_adev_assets/cdk_testing_selenium_webdriver.json +1801 -1
  4. package/_adev_assets/cdk_testing_testbed.json +1903 -1
  5. package/dialog/index.d.ts +17 -12
  6. package/fesm2022/cdk.mjs +1 -1
  7. package/fesm2022/cdk.mjs.map +1 -1
  8. package/fesm2022/dialog.mjs +21 -9
  9. package/fesm2022/dialog.mjs.map +1 -1
  10. package/fesm2022/testing.mjs +255 -52
  11. package/fesm2022/testing.mjs.map +1 -1
  12. package/{harness-environment.d-BatBdODN.d.ts → harness-environment.d-BbFzIFDE.d.ts} +362 -89
  13. package/package.json +1 -1
  14. package/schematics/ng-add/index.js +1 -1
  15. package/testing/index.d.ts +6 -2
  16. package/testing/selenium-webdriver/index.d.ts +1 -1
  17. package/testing/testbed/index.d.ts +1 -1
  18. package/npm_package/LICENSE +0 -21
  19. package/npm_package/README.md +0 -6
  20. package/npm_package/_adev_assets/cdk_testing.json +0 -1
  21. package/npm_package/_adev_assets/cdk_testing_protractor.json +0 -1
  22. package/npm_package/_adev_assets/cdk_testing_selenium_webdriver.json +0 -1
  23. package/npm_package/_adev_assets/cdk_testing_testbed.json +0 -1
  24. package/npm_package/_index.scss +0 -8
  25. package/npm_package/a11y/_index.scss +0 -60
  26. package/npm_package/a11y/index.d.ts +0 -550
  27. package/npm_package/a11y-module.d-DBHGyKoh.d.ts +0 -314
  28. package/npm_package/a11y-prebuilt.css +0 -1
  29. package/npm_package/accordion/index.d.ts +0 -90
  30. package/npm_package/activedescendant-key-manager.d-Bjic5obv.d.ts +0 -32
  31. package/npm_package/bidi/index.d.ts +0 -21
  32. package/npm_package/bidi-module.d-D-fEBKdS.d.ts +0 -54
  33. package/npm_package/clipboard/index.d.ts +0 -101
  34. package/npm_package/coercion/index.d.ts +0 -45
  35. package/npm_package/coercion/private/index.d.ts +0 -9
  36. package/npm_package/collections/index.d.ts +0 -99
  37. package/npm_package/data-source.d-Bblv7Zvh.d.ts +0 -43
  38. package/npm_package/dialog/index.d.ts +0 -426
  39. package/npm_package/drag-drop/index.d.ts +0 -1383
  40. package/npm_package/fesm2022/a11y-module-BYox5gpI.mjs +0 -952
  41. package/npm_package/fesm2022/a11y-module-BYox5gpI.mjs.map +0 -1
  42. package/npm_package/fesm2022/a11y.mjs +0 -539
  43. package/npm_package/fesm2022/a11y.mjs.map +0 -1
  44. package/npm_package/fesm2022/accordion.mjs +0 -210
  45. package/npm_package/fesm2022/accordion.mjs.map +0 -1
  46. package/npm_package/fesm2022/activedescendant-key-manager-DC3-fwQI.mjs +0 -16
  47. package/npm_package/fesm2022/activedescendant-key-manager-DC3-fwQI.mjs.map +0 -1
  48. package/npm_package/fesm2022/array-I1yfCXUO.mjs +0 -6
  49. package/npm_package/fesm2022/array-I1yfCXUO.mjs.map +0 -1
  50. package/npm_package/fesm2022/backwards-compatibility-DHR38MsD.mjs +0 -25
  51. package/npm_package/fesm2022/backwards-compatibility-DHR38MsD.mjs.map +0 -1
  52. package/npm_package/fesm2022/bidi.mjs +0 -80
  53. package/npm_package/fesm2022/bidi.mjs.map +0 -1
  54. package/npm_package/fesm2022/boolean-property-DaaVhX5A.mjs +0 -7
  55. package/npm_package/fesm2022/boolean-property-DaaVhX5A.mjs.map +0 -1
  56. package/npm_package/fesm2022/breakpoints-observer-CljOfYGy.mjs +0 -179
  57. package/npm_package/fesm2022/breakpoints-observer-CljOfYGy.mjs.map +0 -1
  58. package/npm_package/fesm2022/cdk.mjs +0 -7
  59. package/npm_package/fesm2022/cdk.mjs.map +0 -1
  60. package/npm_package/fesm2022/clipboard.mjs +0 -211
  61. package/npm_package/fesm2022/clipboard.mjs.map +0 -1
  62. package/npm_package/fesm2022/coercion/private.mjs +0 -15
  63. package/npm_package/fesm2022/coercion/private.mjs.map +0 -1
  64. package/npm_package/fesm2022/coercion.mjs +0 -39
  65. package/npm_package/fesm2022/coercion.mjs.map +0 -1
  66. package/npm_package/fesm2022/collections.mjs +0 -8
  67. package/npm_package/fesm2022/collections.mjs.map +0 -1
  68. package/npm_package/fesm2022/css-pixel-value-C_HEqLhI.mjs +0 -10
  69. package/npm_package/fesm2022/css-pixel-value-C_HEqLhI.mjs.map +0 -1
  70. package/npm_package/fesm2022/data-source-D34wiQZj.mjs +0 -15
  71. package/npm_package/fesm2022/data-source-D34wiQZj.mjs.map +0 -1
  72. package/npm_package/fesm2022/dialog.mjs +0 -870
  73. package/npm_package/fesm2022/dialog.mjs.map +0 -1
  74. package/npm_package/fesm2022/directionality-CBXD4hga.mjs +0 -72
  75. package/npm_package/fesm2022/directionality-CBXD4hga.mjs.map +0 -1
  76. package/npm_package/fesm2022/dispose-view-repeater-strategy-D_JReLI1.mjs +0 -44
  77. package/npm_package/fesm2022/dispose-view-repeater-strategy-D_JReLI1.mjs.map +0 -1
  78. package/npm_package/fesm2022/drag-drop.mjs +0 -4359
  79. package/npm_package/fesm2022/drag-drop.mjs.map +0 -1
  80. package/npm_package/fesm2022/element-x4z00URv.mjs +0 -29
  81. package/npm_package/fesm2022/element-x4z00URv.mjs.map +0 -1
  82. package/npm_package/fesm2022/fake-event-detection-DWOdFTFz.mjs +0 -24
  83. package/npm_package/fesm2022/fake-event-detection-DWOdFTFz.mjs.map +0 -1
  84. package/npm_package/fesm2022/focus-key-manager-C1rAQJ5z.mjs +0 -22
  85. package/npm_package/fesm2022/focus-key-manager-C1rAQJ5z.mjs.map +0 -1
  86. package/npm_package/fesm2022/focus-monitor-e2l_RpN3.mjs +0 -629
  87. package/npm_package/fesm2022/focus-monitor-e2l_RpN3.mjs.map +0 -1
  88. package/npm_package/fesm2022/id-generator-Dw_9dSDu.mjs +0 -37
  89. package/npm_package/fesm2022/id-generator-Dw_9dSDu.mjs.map +0 -1
  90. package/npm_package/fesm2022/keycodes-CpHkExLC.mjs +0 -122
  91. package/npm_package/fesm2022/keycodes-CpHkExLC.mjs.map +0 -1
  92. package/npm_package/fesm2022/keycodes.mjs +0 -15
  93. package/npm_package/fesm2022/keycodes.mjs.map +0 -1
  94. package/npm_package/fesm2022/layout.mjs +0 -43
  95. package/npm_package/fesm2022/layout.mjs.map +0 -1
  96. package/npm_package/fesm2022/list-key-manager-CyOIXo8P.mjs +0 -360
  97. package/npm_package/fesm2022/list-key-manager-CyOIXo8P.mjs.map +0 -1
  98. package/npm_package/fesm2022/listbox.mjs +0 -925
  99. package/npm_package/fesm2022/listbox.mjs.map +0 -1
  100. package/npm_package/fesm2022/menu.mjs +0 -1966
  101. package/npm_package/fesm2022/menu.mjs.map +0 -1
  102. package/npm_package/fesm2022/observers/private.mjs +0 -124
  103. package/npm_package/fesm2022/observers/private.mjs.map +0 -1
  104. package/npm_package/fesm2022/observers.mjs +0 -210
  105. package/npm_package/fesm2022/observers.mjs.map +0 -1
  106. package/npm_package/fesm2022/overlay-module-BUj0D19H.mjs +0 -3029
  107. package/npm_package/fesm2022/overlay-module-BUj0D19H.mjs.map +0 -1
  108. package/npm_package/fesm2022/overlay.mjs +0 -102
  109. package/npm_package/fesm2022/overlay.mjs.map +0 -1
  110. package/npm_package/fesm2022/passive-listeners-esHZRgIN.mjs +0 -31
  111. package/npm_package/fesm2022/passive-listeners-esHZRgIN.mjs.map +0 -1
  112. package/npm_package/fesm2022/platform-DmdVEw_C.mjs +0 -77
  113. package/npm_package/fesm2022/platform-DmdVEw_C.mjs.map +0 -1
  114. package/npm_package/fesm2022/platform.mjs +0 -74
  115. package/npm_package/fesm2022/platform.mjs.map +0 -1
  116. package/npm_package/fesm2022/portal-directives-Bw5woq8I.mjs +0 -653
  117. package/npm_package/fesm2022/portal-directives-Bw5woq8I.mjs.map +0 -1
  118. package/npm_package/fesm2022/portal.mjs +0 -29
  119. package/npm_package/fesm2022/portal.mjs.map +0 -1
  120. package/npm_package/fesm2022/private.mjs +0 -19
  121. package/npm_package/fesm2022/private.mjs.map +0 -1
  122. package/npm_package/fesm2022/recycle-view-repeater-strategy-DoWdPqVw.mjs +0 -156
  123. package/npm_package/fesm2022/recycle-view-repeater-strategy-DoWdPqVw.mjs.map +0 -1
  124. package/npm_package/fesm2022/scrolling-BkvA05C8.mjs +0 -99
  125. package/npm_package/fesm2022/scrolling-BkvA05C8.mjs.map +0 -1
  126. package/npm_package/fesm2022/scrolling.mjs +0 -1464
  127. package/npm_package/fesm2022/scrolling.mjs.map +0 -1
  128. package/npm_package/fesm2022/selection-model-CeeHVIcP.mjs +0 -226
  129. package/npm_package/fesm2022/selection-model-CeeHVIcP.mjs.map +0 -1
  130. package/npm_package/fesm2022/shadow-dom-B0oHn41l.mjs +0 -49
  131. package/npm_package/fesm2022/shadow-dom-B0oHn41l.mjs.map +0 -1
  132. package/npm_package/fesm2022/stepper.mjs +0 -614
  133. package/npm_package/fesm2022/stepper.mjs.map +0 -1
  134. package/npm_package/fesm2022/style-loader-Cu9AvjH9.mjs +0 -47
  135. package/npm_package/fesm2022/style-loader-Cu9AvjH9.mjs.map +0 -1
  136. package/npm_package/fesm2022/table.mjs +0 -2602
  137. package/npm_package/fesm2022/table.mjs.map +0 -1
  138. package/npm_package/fesm2022/test-environment-CT0XxPyp.mjs +0 -19
  139. package/npm_package/fesm2022/test-environment-CT0XxPyp.mjs.map +0 -1
  140. package/npm_package/fesm2022/testing/selenium-webdriver.mjs +0 -353
  141. package/npm_package/fesm2022/testing/selenium-webdriver.mjs.map +0 -1
  142. package/npm_package/fesm2022/testing/testbed.mjs +0 -782
  143. package/npm_package/fesm2022/testing/testbed.mjs.map +0 -1
  144. package/npm_package/fesm2022/testing.mjs +0 -698
  145. package/npm_package/fesm2022/testing.mjs.map +0 -1
  146. package/npm_package/fesm2022/text-field.mjs +0 -437
  147. package/npm_package/fesm2022/text-field.mjs.map +0 -1
  148. package/npm_package/fesm2022/tree-key-manager-KnCoIkIC.mjs +0 -360
  149. package/npm_package/fesm2022/tree-key-manager-KnCoIkIC.mjs.map +0 -1
  150. package/npm_package/fesm2022/tree.mjs +0 -1795
  151. package/npm_package/fesm2022/tree.mjs.map +0 -1
  152. package/npm_package/fesm2022/typeahead-9ZW4Dtsf.mjs +0 -88
  153. package/npm_package/fesm2022/typeahead-9ZW4Dtsf.mjs.map +0 -1
  154. package/npm_package/fesm2022/unique-selection-dispatcher-DtHZDqyJ.mjs +0 -49
  155. package/npm_package/fesm2022/unique-selection-dispatcher-DtHZDqyJ.mjs.map +0 -1
  156. package/npm_package/focus-key-manager.d-BIKDy8oD.d.ts +0 -34
  157. package/npm_package/focus-monitor.d-CvvJeQRc.d.ts +0 -210
  158. package/npm_package/harness-environment.d-BatBdODN.d.ts +0 -620
  159. package/npm_package/index.d.ts +0 -6
  160. package/npm_package/keycodes/index.d.ts +0 -129
  161. package/npm_package/layout/index.d.ts +0 -89
  162. package/npm_package/list-key-manager.d-BlK3jyRn.d.ts +0 -165
  163. package/npm_package/listbox/index.d.ts +0 -353
  164. package/npm_package/menu/index.d.ts +0 -821
  165. package/npm_package/number-property.d-CJVxXUcb.d.ts +0 -16
  166. package/npm_package/observers/index.d.ts +0 -84
  167. package/npm_package/observers/private/index.d.ts +0 -34
  168. package/npm_package/overlay/_index-deprecated.scss +0 -13
  169. package/npm_package/overlay/_index.scss +0 -193
  170. package/npm_package/overlay/index.d.ts +0 -42
  171. package/npm_package/overlay-module.d-B3qEQtts.d.ts +0 -791
  172. package/npm_package/overlay-prebuilt.css +0 -1
  173. package/npm_package/overlay.d-BdoMy0hX.d.ts +0 -296
  174. package/npm_package/package.json +0 -186
  175. package/npm_package/platform/index.d.ts +0 -83
  176. package/npm_package/platform.d-B3vREl3q.d.ts +0 -33
  177. package/npm_package/portal/index.d.ts +0 -86
  178. package/npm_package/portal-directives.d-BoG39gYN.d.ts +0 -232
  179. package/npm_package/private/index.d.ts +0 -13
  180. package/npm_package/schematics/collection.json +0 -18
  181. package/npm_package/schematics/index.d.ts +0 -14
  182. package/npm_package/schematics/index.js +0 -37
  183. package/npm_package/schematics/index.js.map +0 -1
  184. package/npm_package/schematics/migration.json +0 -15
  185. package/npm_package/schematics/ng-add/index.d.ts +0 -17
  186. package/npm_package/schematics/ng-add/index.js +0 -39
  187. package/npm_package/schematics/ng-add/index.js.map +0 -1
  188. package/npm_package/schematics/ng-add/package-config.d.ts +0 -12
  189. package/npm_package/schematics/ng-add/package-config.js +0 -51
  190. package/npm_package/schematics/ng-add/package-config.js.map +0 -1
  191. package/npm_package/schematics/ng-add/schema.d.ts +0 -11
  192. package/npm_package/schematics/ng-add/schema.js +0 -10
  193. package/npm_package/schematics/ng-add/schema.js.map +0 -1
  194. package/npm_package/schematics/ng-add/schema.json +0 -16
  195. package/npm_package/schematics/ng-generate/drag-drop/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.__style__.template +0 -53
  196. package/npm_package/schematics/ng-generate/drag-drop/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.html.template +0 -21
  197. package/npm_package/schematics/ng-generate/drag-drop/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.spec.ts.template +0 -25
  198. package/npm_package/schematics/ng-generate/drag-drop/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.ts.template +0 -45
  199. package/npm_package/schematics/ng-generate/drag-drop/index.d.ts +0 -11
  200. package/npm_package/schematics/ng-generate/drag-drop/index.js +0 -42
  201. package/npm_package/schematics/ng-generate/drag-drop/index.js.map +0 -1
  202. package/npm_package/schematics/ng-generate/drag-drop/schema.d.ts +0 -10
  203. package/npm_package/schematics/ng-generate/drag-drop/schema.js +0 -10
  204. package/npm_package/schematics/ng-generate/drag-drop/schema.js.map +0 -1
  205. package/npm_package/schematics/ng-generate/drag-drop/schema.json +0 -100
  206. package/npm_package/schematics/ng-update/data/attribute-selectors.d.ts +0 -15
  207. package/npm_package/schematics/ng-update/data/attribute-selectors.js +0 -12
  208. package/npm_package/schematics/ng-update/data/attribute-selectors.js.map +0 -1
  209. package/npm_package/schematics/ng-update/data/class-names.d.ts +0 -15
  210. package/npm_package/schematics/ng-update/data/class-names.js +0 -12
  211. package/npm_package/schematics/ng-update/data/class-names.js.map +0 -1
  212. package/npm_package/schematics/ng-update/data/constructor-checks.d.ts +0 -15
  213. package/npm_package/schematics/ng-update/data/constructor-checks.js +0 -17
  214. package/npm_package/schematics/ng-update/data/constructor-checks.js.map +0 -1
  215. package/npm_package/schematics/ng-update/data/css-selectors.d.ts +0 -27
  216. package/npm_package/schematics/ng-update/data/css-selectors.js +0 -12
  217. package/npm_package/schematics/ng-update/data/css-selectors.js.map +0 -1
  218. package/npm_package/schematics/ng-update/data/css-tokens.d.ts +0 -27
  219. package/npm_package/schematics/ng-update/data/css-tokens.js +0 -12
  220. package/npm_package/schematics/ng-update/data/css-tokens.js.map +0 -1
  221. package/npm_package/schematics/ng-update/data/element-selectors.d.ts +0 -15
  222. package/npm_package/schematics/ng-update/data/element-selectors.js +0 -12
  223. package/npm_package/schematics/ng-update/data/element-selectors.js.map +0 -1
  224. package/npm_package/schematics/ng-update/data/index.d.ts +0 -18
  225. package/npm_package/schematics/ng-update/data/index.js +0 -35
  226. package/npm_package/schematics/ng-update/data/index.js.map +0 -1
  227. package/npm_package/schematics/ng-update/data/input-names.d.ts +0 -22
  228. package/npm_package/schematics/ng-update/data/input-names.js +0 -12
  229. package/npm_package/schematics/ng-update/data/input-names.js.map +0 -1
  230. package/npm_package/schematics/ng-update/data/method-call-checks.d.ts +0 -17
  231. package/npm_package/schematics/ng-update/data/method-call-checks.js +0 -12
  232. package/npm_package/schematics/ng-update/data/method-call-checks.js.map +0 -1
  233. package/npm_package/schematics/ng-update/data/output-names.d.ts +0 -22
  234. package/npm_package/schematics/ng-update/data/output-names.js +0 -12
  235. package/npm_package/schematics/ng-update/data/output-names.js.map +0 -1
  236. package/npm_package/schematics/ng-update/data/property-names.d.ts +0 -20
  237. package/npm_package/schematics/ng-update/data/property-names.js +0 -12
  238. package/npm_package/schematics/ng-update/data/property-names.js.map +0 -1
  239. package/npm_package/schematics/ng-update/data/symbol-removal.d.ts +0 -17
  240. package/npm_package/schematics/ng-update/data/symbol-removal.js +0 -12
  241. package/npm_package/schematics/ng-update/data/symbol-removal.js.map +0 -1
  242. package/npm_package/schematics/ng-update/devkit-file-system.d.ts +0 -30
  243. package/npm_package/schematics/ng-update/devkit-file-system.js +0 -83
  244. package/npm_package/schematics/ng-update/devkit-file-system.js.map +0 -1
  245. package/npm_package/schematics/ng-update/devkit-migration-rule.d.ts +0 -24
  246. package/npm_package/schematics/ng-update/devkit-migration-rule.js +0 -142
  247. package/npm_package/schematics/ng-update/devkit-migration-rule.js.map +0 -1
  248. package/npm_package/schematics/ng-update/devkit-migration.d.ts +0 -35
  249. package/npm_package/schematics/ng-update/devkit-migration.js +0 -20
  250. package/npm_package/schematics/ng-update/devkit-migration.js.map +0 -1
  251. package/npm_package/schematics/ng-update/find-stylesheets.d.ts +0 -16
  252. package/npm_package/schematics/ng-update/find-stylesheets.js +0 -41
  253. package/npm_package/schematics/ng-update/find-stylesheets.js.map +0 -1
  254. package/npm_package/schematics/ng-update/html-parsing/angular.d.ts +0 -15
  255. package/npm_package/schematics/ng-update/html-parsing/angular.js +0 -51
  256. package/npm_package/schematics/ng-update/html-parsing/angular.js.map +0 -1
  257. package/npm_package/schematics/ng-update/html-parsing/elements.d.ts +0 -24
  258. package/npm_package/schematics/ng-update/html-parsing/elements.js +0 -63
  259. package/npm_package/schematics/ng-update/html-parsing/elements.js.map +0 -1
  260. package/npm_package/schematics/ng-update/index.d.ts +0 -10
  261. package/npm_package/schematics/ng-update/index.js +0 -29
  262. package/npm_package/schematics/ng-update/index.js.map +0 -1
  263. package/npm_package/schematics/ng-update/migrations/attribute-selectors.d.ts +0 -26
  264. package/npm_package/schematics/ng-update/migrations/attribute-selectors.js +0 -71
  265. package/npm_package/schematics/ng-update/migrations/attribute-selectors.js.map +0 -1
  266. package/npm_package/schematics/ng-update/migrations/class-inheritance.d.ts +0 -26
  267. package/npm_package/schematics/ng-update/migrations/class-inheritance.js +0 -58
  268. package/npm_package/schematics/ng-update/migrations/class-inheritance.js.map +0 -1
  269. package/npm_package/schematics/ng-update/migrations/class-names.d.ts +0 -32
  270. package/npm_package/schematics/ng-update/migrations/class-names.js +0 -91
  271. package/npm_package/schematics/ng-update/migrations/class-names.js.map +0 -1
  272. package/npm_package/schematics/ng-update/migrations/constructor-signature.d.ts +0 -29
  273. package/npm_package/schematics/ng-update/migrations/constructor-signature.js +0 -139
  274. package/npm_package/schematics/ng-update/migrations/constructor-signature.js.map +0 -1
  275. package/npm_package/schematics/ng-update/migrations/css-selectors.d.ts +0 -26
  276. package/npm_package/schematics/ng-update/migrations/css-selectors.js +0 -75
  277. package/npm_package/schematics/ng-update/migrations/css-selectors.js.map +0 -1
  278. package/npm_package/schematics/ng-update/migrations/css-tokens.d.ts +0 -26
  279. package/npm_package/schematics/ng-update/migrations/css-tokens.js +0 -83
  280. package/npm_package/schematics/ng-update/migrations/css-tokens.js.map +0 -1
  281. package/npm_package/schematics/ng-update/migrations/element-selectors.d.ts +0 -26
  282. package/npm_package/schematics/ng-update/migrations/element-selectors.js +0 -66
  283. package/npm_package/schematics/ng-update/migrations/element-selectors.js.map +0 -1
  284. package/npm_package/schematics/ng-update/migrations/input-names.d.ts +0 -26
  285. package/npm_package/schematics/ng-update/migrations/input-names.js +0 -59
  286. package/npm_package/schematics/ng-update/migrations/input-names.js.map +0 -1
  287. package/npm_package/schematics/ng-update/migrations/method-call-arguments.d.ts +0 -22
  288. package/npm_package/schematics/ng-update/migrations/method-call-arguments.js +0 -62
  289. package/npm_package/schematics/ng-update/migrations/method-call-arguments.js.map +0 -1
  290. package/npm_package/schematics/ng-update/migrations/misc-template.d.ts +0 -18
  291. package/npm_package/schematics/ng-update/migrations/misc-template.js +0 -25
  292. package/npm_package/schematics/ng-update/migrations/misc-template.js.map +0 -1
  293. package/npm_package/schematics/ng-update/migrations/output-names.d.ts +0 -22
  294. package/npm_package/schematics/ng-update/migrations/output-names.js +0 -46
  295. package/npm_package/schematics/ng-update/migrations/output-names.js.map +0 -1
  296. package/npm_package/schematics/ng-update/migrations/property-names.d.ts +0 -22
  297. package/npm_package/schematics/ng-update/migrations/property-names.js +0 -60
  298. package/npm_package/schematics/ng-update/migrations/property-names.js.map +0 -1
  299. package/npm_package/schematics/ng-update/migrations/symbol-removal.d.ts +0 -18
  300. package/npm_package/schematics/ng-update/migrations/symbol-removal.js +0 -47
  301. package/npm_package/schematics/ng-update/migrations/symbol-removal.js.map +0 -1
  302. package/npm_package/schematics/ng-update/public-api.d.ts +0 -19
  303. package/npm_package/schematics/ng-update/public-api.js +0 -36
  304. package/npm_package/schematics/ng-update/public-api.js.map +0 -1
  305. package/npm_package/schematics/ng-update/typescript/base-types.d.ts +0 -10
  306. package/npm_package/schematics/ng-update/typescript/base-types.js +0 -23
  307. package/npm_package/schematics/ng-update/typescript/base-types.js.map +0 -1
  308. package/npm_package/schematics/ng-update/typescript/imports.d.ts +0 -18
  309. package/npm_package/schematics/ng-update/typescript/imports.js +0 -53
  310. package/npm_package/schematics/ng-update/typescript/imports.js.map +0 -1
  311. package/npm_package/schematics/ng-update/typescript/literal.d.ts +0 -18
  312. package/npm_package/schematics/ng-update/typescript/literal.js +0 -32
  313. package/npm_package/schematics/ng-update/typescript/literal.js.map +0 -1
  314. package/npm_package/schematics/ng-update/typescript/module-specifiers.d.ts +0 -16
  315. package/npm_package/schematics/ng-update/typescript/module-specifiers.js +0 -35
  316. package/npm_package/schematics/ng-update/typescript/module-specifiers.js.map +0 -1
  317. package/npm_package/schematics/ng-update/upgrade-data.d.ts +0 -35
  318. package/npm_package/schematics/ng-update/upgrade-data.js +0 -40
  319. package/npm_package/schematics/ng-update/upgrade-data.js.map +0 -1
  320. package/npm_package/schematics/package.json +0 -3
  321. package/npm_package/schematics/paths.d.ts +0 -11
  322. package/npm_package/schematics/paths.js +0 -16
  323. package/npm_package/schematics/paths.js.map +0 -1
  324. package/npm_package/schematics/update-tool/component-resource-collector.d.ts +0 -44
  325. package/npm_package/schematics/update-tool/component-resource-collector.js +0 -164
  326. package/npm_package/schematics/update-tool/component-resource-collector.js.map +0 -1
  327. package/npm_package/schematics/update-tool/file-system.d.ts +0 -72
  328. package/npm_package/schematics/update-tool/file-system.js +0 -18
  329. package/npm_package/schematics/update-tool/file-system.js.map +0 -1
  330. package/npm_package/schematics/update-tool/index.d.ts +0 -74
  331. package/npm_package/schematics/update-tool/index.js +0 -172
  332. package/npm_package/schematics/update-tool/index.js.map +0 -1
  333. package/npm_package/schematics/update-tool/logger.d.ts +0 -15
  334. package/npm_package/schematics/update-tool/logger.js +0 -18
  335. package/npm_package/schematics/update-tool/logger.js.map +0 -1
  336. package/npm_package/schematics/update-tool/migration.d.ts +0 -87
  337. package/npm_package/schematics/update-tool/migration.js +0 -70
  338. package/npm_package/schematics/update-tool/migration.js.map +0 -1
  339. package/npm_package/schematics/update-tool/public-api.d.ts +0 -16
  340. package/npm_package/schematics/update-tool/public-api.js +0 -33
  341. package/npm_package/schematics/update-tool/public-api.js.map +0 -1
  342. package/npm_package/schematics/update-tool/target-version.d.ts +0 -16
  343. package/npm_package/schematics/update-tool/target-version.js +0 -27
  344. package/npm_package/schematics/update-tool/target-version.js.map +0 -1
  345. package/npm_package/schematics/update-tool/update-recorder.d.ts +0 -13
  346. package/npm_package/schematics/update-tool/update-recorder.js +0 -10
  347. package/npm_package/schematics/update-tool/update-recorder.js.map +0 -1
  348. package/npm_package/schematics/update-tool/utils/decorators.d.ts +0 -22
  349. package/npm_package/schematics/update-tool/utils/decorators.js +0 -41
  350. package/npm_package/schematics/update-tool/utils/decorators.js.map +0 -1
  351. package/npm_package/schematics/update-tool/utils/diagnostics.d.ts +0 -11
  352. package/npm_package/schematics/update-tool/utils/diagnostics.js +0 -18
  353. package/npm_package/schematics/update-tool/utils/diagnostics.js.map +0 -1
  354. package/npm_package/schematics/update-tool/utils/functions.d.ts +0 -14
  355. package/npm_package/schematics/update-tool/utils/functions.js +0 -20
  356. package/npm_package/schematics/update-tool/utils/functions.js.map +0 -1
  357. package/npm_package/schematics/update-tool/utils/imports.d.ts +0 -17
  358. package/npm_package/schematics/update-tool/utils/imports.js +0 -110
  359. package/npm_package/schematics/update-tool/utils/imports.js.map +0 -1
  360. package/npm_package/schematics/update-tool/utils/line-mappings.d.ts +0 -21
  361. package/npm_package/schematics/update-tool/utils/line-mappings.js +0 -75
  362. package/npm_package/schematics/update-tool/utils/line-mappings.js.map +0 -1
  363. package/npm_package/schematics/update-tool/utils/parse-tsconfig.d.ts +0 -18
  364. package/npm_package/schematics/update-tool/utils/parse-tsconfig.js +0 -45
  365. package/npm_package/schematics/update-tool/utils/parse-tsconfig.js.map +0 -1
  366. package/npm_package/schematics/update-tool/utils/property-name.d.ts +0 -18
  367. package/npm_package/schematics/update-tool/utils/property-name.js +0 -27
  368. package/npm_package/schematics/update-tool/utils/property-name.js.map +0 -1
  369. package/npm_package/schematics/update-tool/utils/virtual-host.d.ts +0 -36
  370. package/npm_package/schematics/update-tool/utils/virtual-host.js +0 -71
  371. package/npm_package/schematics/update-tool/utils/virtual-host.js.map +0 -1
  372. package/npm_package/schematics/update-tool/version-changes.d.ts +0 -32
  373. package/npm_package/schematics/update-tool/version-changes.js +0 -38
  374. package/npm_package/schematics/update-tool/version-changes.js.map +0 -1
  375. package/npm_package/schematics/utils/ast/ng-module-imports.d.ts +0 -12
  376. package/npm_package/schematics/utils/ast/ng-module-imports.js +0 -82
  377. package/npm_package/schematics/utils/ast/ng-module-imports.js.map +0 -1
  378. package/npm_package/schematics/utils/ast.d.ts +0 -25
  379. package/npm_package/schematics/utils/ast.js +0 -79
  380. package/npm_package/schematics/utils/ast.js.map +0 -1
  381. package/npm_package/schematics/utils/build-component.d.ts +0 -20
  382. package/npm_package/schematics/utils/build-component.js +0 -188
  383. package/npm_package/schematics/utils/build-component.js.map +0 -1
  384. package/npm_package/schematics/utils/get-project.d.ts +0 -13
  385. package/npm_package/schematics/utils/get-project.js +0 -28
  386. package/npm_package/schematics/utils/get-project.js.map +0 -1
  387. package/npm_package/schematics/utils/html-manipulation.d.ts +0 -15
  388. package/npm_package/schematics/utils/html-manipulation.js +0 -91
  389. package/npm_package/schematics/utils/html-manipulation.js.map +0 -1
  390. package/npm_package/schematics/utils/index.d.ts +0 -19
  391. package/npm_package/schematics/utils/index.js +0 -36
  392. package/npm_package/schematics/utils/index.js.map +0 -1
  393. package/npm_package/schematics/utils/parse5-element.d.ts +0 -12
  394. package/npm_package/schematics/utils/parse5-element.js +0 -30
  395. package/npm_package/schematics/utils/parse5-element.js.map +0 -1
  396. package/npm_package/schematics/utils/project-index-file.d.ts +0 -10
  397. package/npm_package/schematics/utils/project-index-file.js +0 -20
  398. package/npm_package/schematics/utils/project-index-file.js.map +0 -1
  399. package/npm_package/schematics/utils/project-main-file.d.ts +0 -10
  400. package/npm_package/schematics/utils/project-main-file.js +0 -25
  401. package/npm_package/schematics/utils/project-main-file.js.map +0 -1
  402. package/npm_package/schematics/utils/project-style-file.d.ts +0 -13
  403. package/npm_package/schematics/utils/project-style-file.js +0 -42
  404. package/npm_package/schematics/utils/project-style-file.js.map +0 -1
  405. package/npm_package/schematics/utils/project-targets.d.ts +0 -14
  406. package/npm_package/schematics/utils/project-targets.js +0 -46
  407. package/npm_package/schematics/utils/project-targets.js.map +0 -1
  408. package/npm_package/schematics/utils/project-tsconfig-paths.d.ts +0 -14
  409. package/npm_package/schematics/utils/project-tsconfig-paths.js +0 -46
  410. package/npm_package/schematics/utils/project-tsconfig-paths.js.map +0 -1
  411. package/npm_package/schematics/utils/schematic-options.d.ts +0 -20
  412. package/npm_package/schematics/utils/schematic-options.js +0 -89
  413. package/npm_package/schematics/utils/schematic-options.js.map +0 -1
  414. package/npm_package/scrolling/index.d.ts +0 -62
  415. package/npm_package/scrolling-module.d-ud2XrbF8.d.ts +0 -552
  416. package/npm_package/selection-model.d-C_vvNGP-.d.ts +0 -117
  417. package/npm_package/stepper/index.d.ts +0 -228
  418. package/npm_package/style-loader.d-BXZfQZTF.d.ts +0 -21
  419. package/npm_package/table/index.d.ts +0 -1100
  420. package/npm_package/testing/index.d.ts +0 -94
  421. package/npm_package/testing/selenium-webdriver/index.d.ts +0 -150
  422. package/npm_package/testing/testbed/index.d.ts +0 -157
  423. package/npm_package/text-field/_index.scss +0 -89
  424. package/npm_package/text-field/index.d.ts +0 -156
  425. package/npm_package/text-field-prebuilt.css +0 -1
  426. package/npm_package/tree/index.d.ts +0 -720
  427. package/npm_package/tree-key-manager-strategy.d-XB6M79l-.d.ts +0 -116
  428. package/npm_package/unique-selection-dispatcher.d-DSFqf1MM.d.ts +0 -33
  429. package/npm_package/view-repeater.d-BKljR8u8.d.ts +0 -89
@@ -1,1795 +0,0 @@
1
- import { S as SelectionModel } from './selection-model-CeeHVIcP.mjs';
2
- import { isObservable, Subject, BehaviorSubject, of, combineLatest, EMPTY, concat } from 'rxjs';
3
- import { take, filter, takeUntil, startWith, tap, switchMap, map, reduce, concatMap, distinctUntilChanged } from 'rxjs/operators';
4
- import * as i0 from '@angular/core';
5
- import { InjectionToken, inject, ViewContainerRef, Directive, TemplateRef, IterableDiffers, ChangeDetectorRef, ElementRef, Component, ViewEncapsulation, ChangeDetectionStrategy, Input, ViewChild, ContentChildren, EventEmitter, booleanAttribute, Output, numberAttribute, NgModule } from '@angular/core';
6
- import { T as TREE_KEY_MANAGER } from './tree-key-manager-KnCoIkIC.mjs';
7
- import { D as Directionality } from './directionality-CBXD4hga.mjs';
8
- import { i as isDataSource } from './data-source-D34wiQZj.mjs';
9
- import { coerceObservable } from './coercion/private.mjs';
10
- import './typeahead-9ZW4Dtsf.mjs';
11
- import './keycodes-CpHkExLC.mjs';
12
- import '@angular/common';
13
-
14
- /**
15
- * Base tree control. It has basic toggle/expand/collapse operations on a single data node.
16
- *
17
- * @deprecated Use one of levelAccessor or childrenAccessor. To be removed in a future version.
18
- * @breaking-change 21.0.0
19
- */
20
- class BaseTreeControl {
21
- /** Saved data node for `expandAll` action. */
22
- dataNodes;
23
- /** A selection model with multi-selection to track expansion status. */
24
- expansionModel = new SelectionModel(true);
25
- /**
26
- * Returns the identifier by which a dataNode should be tracked, should its
27
- * reference change.
28
- *
29
- * Similar to trackBy for *ngFor
30
- */
31
- trackBy;
32
- /** Get depth of a given data node, return the level number. This is for flat tree node. */
33
- getLevel;
34
- /**
35
- * Whether the data node is expandable. Returns true if expandable.
36
- * This is for flat tree node.
37
- */
38
- isExpandable;
39
- /** Gets a stream that emits whenever the given data node's children change. */
40
- getChildren;
41
- /** Toggles one single data node's expanded/collapsed state. */
42
- toggle(dataNode) {
43
- this.expansionModel.toggle(this._trackByValue(dataNode));
44
- }
45
- /** Expands one single data node. */
46
- expand(dataNode) {
47
- this.expansionModel.select(this._trackByValue(dataNode));
48
- }
49
- /** Collapses one single data node. */
50
- collapse(dataNode) {
51
- this.expansionModel.deselect(this._trackByValue(dataNode));
52
- }
53
- /** Whether a given data node is expanded or not. Returns true if the data node is expanded. */
54
- isExpanded(dataNode) {
55
- return this.expansionModel.isSelected(this._trackByValue(dataNode));
56
- }
57
- /** Toggles a subtree rooted at `node` recursively. */
58
- toggleDescendants(dataNode) {
59
- this.expansionModel.isSelected(this._trackByValue(dataNode))
60
- ? this.collapseDescendants(dataNode)
61
- : this.expandDescendants(dataNode);
62
- }
63
- /** Collapse all dataNodes in the tree. */
64
- collapseAll() {
65
- this.expansionModel.clear();
66
- }
67
- /** Expands a subtree rooted at given data node recursively. */
68
- expandDescendants(dataNode) {
69
- let toBeProcessed = [dataNode];
70
- toBeProcessed.push(...this.getDescendants(dataNode));
71
- this.expansionModel.select(...toBeProcessed.map(value => this._trackByValue(value)));
72
- }
73
- /** Collapses a subtree rooted at given data node recursively. */
74
- collapseDescendants(dataNode) {
75
- let toBeProcessed = [dataNode];
76
- toBeProcessed.push(...this.getDescendants(dataNode));
77
- this.expansionModel.deselect(...toBeProcessed.map(value => this._trackByValue(value)));
78
- }
79
- _trackByValue(value) {
80
- return this.trackBy ? this.trackBy(value) : value;
81
- }
82
- }
83
-
84
- /**
85
- * Flat tree control. Able to expand/collapse a subtree recursively for flattened tree.
86
- *
87
- * @deprecated Use one of levelAccessor or childrenAccessor instead. To be removed in a future
88
- * version.
89
- * @breaking-change 21.0.0
90
- */
91
- class FlatTreeControl extends BaseTreeControl {
92
- getLevel;
93
- isExpandable;
94
- options;
95
- /** Construct with flat tree data node functions getLevel and isExpandable. */
96
- constructor(getLevel, isExpandable, options) {
97
- super();
98
- this.getLevel = getLevel;
99
- this.isExpandable = isExpandable;
100
- this.options = options;
101
- if (this.options) {
102
- this.trackBy = this.options.trackBy;
103
- }
104
- }
105
- /**
106
- * Gets a list of the data node's subtree of descendent data nodes.
107
- *
108
- * To make this working, the `dataNodes` of the TreeControl must be flattened tree nodes
109
- * with correct levels.
110
- */
111
- getDescendants(dataNode) {
112
- const startIndex = this.dataNodes.indexOf(dataNode);
113
- const results = [];
114
- // Goes through flattened tree nodes in the `dataNodes` array, and get all descendants.
115
- // The level of descendants of a tree node must be greater than the level of the given
116
- // tree node.
117
- // If we reach a node whose level is equal to the level of the tree node, we hit a sibling.
118
- // If we reach a node whose level is greater than the level of the tree node, we hit a
119
- // sibling of an ancestor.
120
- for (let i = startIndex + 1; i < this.dataNodes.length && this.getLevel(dataNode) < this.getLevel(this.dataNodes[i]); i++) {
121
- results.push(this.dataNodes[i]);
122
- }
123
- return results;
124
- }
125
- /**
126
- * Expands all data nodes in the tree.
127
- *
128
- * To make this working, the `dataNodes` variable of the TreeControl must be set to all flattened
129
- * data nodes of the tree.
130
- */
131
- expandAll() {
132
- this.expansionModel.select(...this.dataNodes.map(node => this._trackByValue(node)));
133
- }
134
- }
135
-
136
- /**
137
- * Nested tree control. Able to expand/collapse a subtree recursively for NestedNode type.
138
- *
139
- * @deprecated Use one of levelAccessor or childrenAccessor instead. To be removed in a future
140
- * version.
141
- * @breaking-change 21.0.0
142
- */
143
- class NestedTreeControl extends BaseTreeControl {
144
- getChildren;
145
- options;
146
- /** Construct with nested tree function getChildren. */
147
- constructor(getChildren, options) {
148
- super();
149
- this.getChildren = getChildren;
150
- this.options = options;
151
- if (this.options) {
152
- this.trackBy = this.options.trackBy;
153
- }
154
- if (this.options?.isExpandable) {
155
- this.isExpandable = this.options.isExpandable;
156
- }
157
- }
158
- /**
159
- * Expands all dataNodes in the tree.
160
- *
161
- * To make this working, the `dataNodes` variable of the TreeControl must be set to all root level
162
- * data nodes of the tree.
163
- */
164
- expandAll() {
165
- this.expansionModel.clear();
166
- const allNodes = this.dataNodes.reduce((accumulator, dataNode) => [...accumulator, ...this.getDescendants(dataNode), dataNode], []);
167
- this.expansionModel.select(...allNodes.map(node => this._trackByValue(node)));
168
- }
169
- /** Gets a list of descendant dataNodes of a subtree rooted at given data node recursively. */
170
- getDescendants(dataNode) {
171
- const descendants = [];
172
- this._getDescendants(descendants, dataNode);
173
- // Remove the node itself
174
- return descendants.splice(1);
175
- }
176
- /** A helper function to get descendants recursively. */
177
- _getDescendants(descendants, dataNode) {
178
- descendants.push(dataNode);
179
- const childrenNodes = this.getChildren(dataNode);
180
- if (Array.isArray(childrenNodes)) {
181
- childrenNodes.forEach((child) => this._getDescendants(descendants, child));
182
- }
183
- else if (isObservable(childrenNodes)) {
184
- // TypeScript as of version 3.5 doesn't seem to treat `Boolean` like a function that
185
- // returns a `boolean` specifically in the context of `filter`, so we manually clarify that.
186
- childrenNodes.pipe(take(1), filter(Boolean)).subscribe(children => {
187
- for (const child of children) {
188
- this._getDescendants(descendants, child);
189
- }
190
- });
191
- }
192
- }
193
- }
194
-
195
- /**
196
- * Injection token used to provide a `CdkTreeNode` to its outlet.
197
- * Used primarily to avoid circular imports.
198
- * @docs-private
199
- */
200
- const CDK_TREE_NODE_OUTLET_NODE = new InjectionToken('CDK_TREE_NODE_OUTLET_NODE');
201
- /**
202
- * Outlet for nested CdkNode. Put `[cdkTreeNodeOutlet]` on a tag to place children dataNodes
203
- * inside the outlet.
204
- */
205
- class CdkTreeNodeOutlet {
206
- viewContainer = inject(ViewContainerRef);
207
- _node = inject(CDK_TREE_NODE_OUTLET_NODE, { optional: true });
208
- constructor() { }
209
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CdkTreeNodeOutlet, deps: [], target: i0.ɵɵFactoryTarget.Directive });
210
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.6", type: CdkTreeNodeOutlet, isStandalone: true, selector: "[cdkTreeNodeOutlet]", ngImport: i0 });
211
- }
212
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CdkTreeNodeOutlet, decorators: [{
213
- type: Directive,
214
- args: [{
215
- selector: '[cdkTreeNodeOutlet]',
216
- }]
217
- }], ctorParameters: () => [] });
218
-
219
- /** Context provided to the tree node component. */
220
- class CdkTreeNodeOutletContext {
221
- /** Data for the node. */
222
- $implicit;
223
- /** Depth of the node. */
224
- level;
225
- /** Index location of the node. */
226
- index;
227
- /** Length of the number of total dataNodes. */
228
- count;
229
- constructor(data) {
230
- this.$implicit = data;
231
- }
232
- }
233
- /**
234
- * Data node definition for the CdkTree.
235
- * Captures the node's template and a when predicate that describes when this node should be used.
236
- */
237
- class CdkTreeNodeDef {
238
- /** @docs-private */
239
- template = inject(TemplateRef);
240
- /**
241
- * Function that should return true if this node template should be used for the provided node
242
- * data and index. If left undefined, this node will be considered the default node template to
243
- * use when no other when functions return true for the data.
244
- * For every node, there must be at least one when function that passes or an undefined to
245
- * default.
246
- */
247
- when;
248
- constructor() { }
249
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CdkTreeNodeDef, deps: [], target: i0.ɵɵFactoryTarget.Directive });
250
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.6", type: CdkTreeNodeDef, isStandalone: true, selector: "[cdkTreeNodeDef]", inputs: { when: ["cdkTreeNodeDefWhen", "when"] }, ngImport: i0 });
251
- }
252
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CdkTreeNodeDef, decorators: [{
253
- type: Directive,
254
- args: [{
255
- selector: '[cdkTreeNodeDef]',
256
- inputs: [{ name: 'when', alias: 'cdkTreeNodeDefWhen' }],
257
- }]
258
- }], ctorParameters: () => [] });
259
-
260
- /**
261
- * Returns an error to be thrown when there is no usable data.
262
- * @docs-private
263
- */
264
- function getTreeNoValidDataSourceError() {
265
- return Error(`A valid data source must be provided.`);
266
- }
267
- /**
268
- * Returns an error to be thrown when there are multiple nodes that are missing a when function.
269
- * @docs-private
270
- */
271
- function getTreeMultipleDefaultNodeDefsError() {
272
- return Error(`There can only be one default row without a when predicate function.`);
273
- }
274
- /**
275
- * Returns an error to be thrown when there are no matching node defs for a particular set of data.
276
- * @docs-private
277
- */
278
- function getTreeMissingMatchingNodeDefError() {
279
- return Error(`Could not find a matching node definition for the provided node data.`);
280
- }
281
- /**
282
- * Returns an error to be thrown when there is no tree control.
283
- * @docs-private
284
- */
285
- function getTreeControlMissingError() {
286
- return Error(`Could not find a tree control, levelAccessor, or childrenAccessor for the tree.`);
287
- }
288
- /**
289
- * Returns an error to be thrown when there are multiple ways of specifying children or level
290
- * provided to the tree.
291
- * @docs-private
292
- */
293
- function getMultipleTreeControlsError() {
294
- return Error(`More than one of tree control, levelAccessor, or childrenAccessor were provided.`);
295
- }
296
-
297
- /**
298
- * CDK tree component that connects with a data source to retrieve data of type `T` and renders
299
- * dataNodes with hierarchy. Updates the dataNodes when new data is provided by the data source.
300
- */
301
- class CdkTree {
302
- _differs = inject(IterableDiffers);
303
- _changeDetectorRef = inject(ChangeDetectorRef);
304
- _elementRef = inject(ElementRef);
305
- _dir = inject(Directionality);
306
- /** Subject that emits when the component has been destroyed. */
307
- _onDestroy = new Subject();
308
- /** Differ used to find the changes in the data provided by the data source. */
309
- _dataDiffer;
310
- /** Stores the node definition that does not have a when predicate. */
311
- _defaultNodeDef;
312
- /** Data subscription */
313
- _dataSubscription;
314
- /** Level of nodes */
315
- _levels = new Map();
316
- /** The immediate parents for a node. This is `null` if there is no parent. */
317
- _parents = new Map();
318
- /**
319
- * Nodes grouped into each set, which is a list of nodes displayed together in the DOM.
320
- *
321
- * Lookup key is the parent of a set. Root nodes have key of null.
322
- *
323
- * Values is a 'set' of tree nodes. Each tree node maps to a treeitem element. Sets are in the
324
- * order that it is rendered. Each set maps directly to aria-posinset and aria-setsize attributes.
325
- */
326
- _ariaSets = new Map();
327
- /**
328
- * Provides a stream containing the latest data array to render. Influenced by the tree's
329
- * stream of view window (what dataNodes are currently on screen).
330
- * Data source can be an observable of data array, or a data array to render.
331
- */
332
- get dataSource() {
333
- return this._dataSource;
334
- }
335
- set dataSource(dataSource) {
336
- if (this._dataSource !== dataSource) {
337
- this._switchDataSource(dataSource);
338
- }
339
- }
340
- _dataSource;
341
- /**
342
- * The tree controller
343
- *
344
- * @deprecated Use one of `levelAccessor` or `childrenAccessor` instead. To be removed in a
345
- * future version.
346
- * @breaking-change 21.0.0
347
- */
348
- treeControl;
349
- /**
350
- * Given a data node, determines what tree level the node is at.
351
- *
352
- * One of levelAccessor or childrenAccessor must be specified, not both.
353
- * This is enforced at run-time.
354
- */
355
- levelAccessor;
356
- /**
357
- * Given a data node, determines what the children of that node are.
358
- *
359
- * One of levelAccessor or childrenAccessor must be specified, not both.
360
- * This is enforced at run-time.
361
- */
362
- childrenAccessor;
363
- /**
364
- * Tracking function that will be used to check the differences in data changes. Used similarly
365
- * to `ngFor` `trackBy` function. Optimize node operations by identifying a node based on its data
366
- * relative to the function to know if a node should be added/removed/moved.
367
- * Accepts a function that takes two parameters, `index` and `item`.
368
- */
369
- trackBy;
370
- /**
371
- * Given a data node, determines the key by which we determine whether or not this node is expanded.
372
- */
373
- expansionKey;
374
- // Outlets within the tree's template where the dataNodes will be inserted.
375
- _nodeOutlet;
376
- /** The tree node template for the tree */
377
- _nodeDefs;
378
- // TODO(tinayuangao): Setup a listener for scrolling, emit the calculated view to viewChange.
379
- // Remove the MAX_VALUE in viewChange
380
- /**
381
- * Stream containing the latest information on what rows are being displayed on screen.
382
- * Can be used by the data source to as a heuristic of what data should be provided.
383
- */
384
- viewChange = new BehaviorSubject({
385
- start: 0,
386
- end: Number.MAX_VALUE,
387
- });
388
- /** Keep track of which nodes are expanded. */
389
- _expansionModel;
390
- /**
391
- * Maintain a synchronous cache of flattened data nodes. This will only be
392
- * populated after initial render, and in certain cases, will be delayed due to
393
- * relying on Observable `getChildren` calls.
394
- */
395
- _flattenedNodes = new BehaviorSubject([]);
396
- /** The automatically determined node type for the tree. */
397
- _nodeType = new BehaviorSubject(null);
398
- /** The mapping between data and the node that is rendered. */
399
- _nodes = new BehaviorSubject(new Map());
400
- /**
401
- * Synchronous cache of nodes for the `TreeKeyManager`. This is separate
402
- * from `_flattenedNodes` so they can be independently updated at different
403
- * times.
404
- */
405
- _keyManagerNodes = new BehaviorSubject([]);
406
- _keyManagerFactory = inject(TREE_KEY_MANAGER);
407
- /** The key manager for this tree. Handles focus and activation based on user keyboard input. */
408
- _keyManager;
409
- _viewInit = false;
410
- constructor() { }
411
- ngAfterContentInit() {
412
- this._initializeKeyManager();
413
- }
414
- ngAfterContentChecked() {
415
- this._updateDefaultNodeDefinition();
416
- this._subscribeToDataChanges();
417
- }
418
- ngOnDestroy() {
419
- this._nodeOutlet.viewContainer.clear();
420
- this.viewChange.complete();
421
- this._onDestroy.next();
422
- this._onDestroy.complete();
423
- if (this._dataSource && typeof this._dataSource.disconnect === 'function') {
424
- this.dataSource.disconnect(this);
425
- }
426
- if (this._dataSubscription) {
427
- this._dataSubscription.unsubscribe();
428
- this._dataSubscription = null;
429
- }
430
- // In certain tests, the tree might be destroyed before this is initialized
431
- // in `ngAfterContentInit`.
432
- this._keyManager?.destroy();
433
- }
434
- ngOnInit() {
435
- this._checkTreeControlUsage();
436
- this._initializeDataDiffer();
437
- }
438
- ngAfterViewInit() {
439
- this._viewInit = true;
440
- }
441
- _updateDefaultNodeDefinition() {
442
- const defaultNodeDefs = this._nodeDefs.filter(def => !def.when);
443
- if (defaultNodeDefs.length > 1 && (typeof ngDevMode === 'undefined' || ngDevMode)) {
444
- throw getTreeMultipleDefaultNodeDefsError();
445
- }
446
- this._defaultNodeDef = defaultNodeDefs[0];
447
- }
448
- /**
449
- * Sets the node type for the tree, if it hasn't been set yet.
450
- *
451
- * This will be called by the first node that's rendered in order for the tree
452
- * to determine what data transformations are required.
453
- */
454
- _setNodeTypeIfUnset(newType) {
455
- const currentType = this._nodeType.value;
456
- if (currentType === null) {
457
- this._nodeType.next(newType);
458
- }
459
- else if ((typeof ngDevMode === 'undefined' || ngDevMode) && currentType !== newType) {
460
- console.warn(`Tree is using conflicting node types which can cause unexpected behavior. ` +
461
- `Please use tree nodes of the same type (e.g. only flat or only nested). ` +
462
- `Current node type: "${currentType}", new node type "${newType}".`);
463
- }
464
- }
465
- /**
466
- * Switch to the provided data source by resetting the data and unsubscribing from the current
467
- * render change subscription if one exists. If the data source is null, interpret this by
468
- * clearing the node outlet. Otherwise start listening for new data.
469
- */
470
- _switchDataSource(dataSource) {
471
- if (this._dataSource && typeof this._dataSource.disconnect === 'function') {
472
- this.dataSource.disconnect(this);
473
- }
474
- if (this._dataSubscription) {
475
- this._dataSubscription.unsubscribe();
476
- this._dataSubscription = null;
477
- }
478
- // Remove the all dataNodes if there is now no data source
479
- if (!dataSource) {
480
- this._nodeOutlet.viewContainer.clear();
481
- }
482
- this._dataSource = dataSource;
483
- if (this._nodeDefs) {
484
- this._subscribeToDataChanges();
485
- }
486
- }
487
- _getExpansionModel() {
488
- if (!this.treeControl) {
489
- this._expansionModel ??= new SelectionModel(true);
490
- return this._expansionModel;
491
- }
492
- return this.treeControl.expansionModel;
493
- }
494
- /** Set up a subscription for the data provided by the data source. */
495
- _subscribeToDataChanges() {
496
- if (this._dataSubscription) {
497
- return;
498
- }
499
- let dataStream;
500
- if (isDataSource(this._dataSource)) {
501
- dataStream = this._dataSource.connect(this);
502
- }
503
- else if (isObservable(this._dataSource)) {
504
- dataStream = this._dataSource;
505
- }
506
- else if (Array.isArray(this._dataSource)) {
507
- dataStream = of(this._dataSource);
508
- }
509
- if (!dataStream) {
510
- if (typeof ngDevMode === 'undefined' || ngDevMode) {
511
- throw getTreeNoValidDataSourceError();
512
- }
513
- return;
514
- }
515
- this._dataSubscription = this._getRenderData(dataStream)
516
- .pipe(takeUntil(this._onDestroy))
517
- .subscribe(renderingData => {
518
- this._renderDataChanges(renderingData);
519
- });
520
- }
521
- /** Given an Observable containing a stream of the raw data, returns an Observable containing the RenderingData */
522
- _getRenderData(dataStream) {
523
- const expansionModel = this._getExpansionModel();
524
- return combineLatest([
525
- dataStream,
526
- this._nodeType,
527
- // We don't use the expansion data directly, however we add it here to essentially
528
- // trigger data rendering when expansion changes occur.
529
- expansionModel.changed.pipe(startWith(null), tap(expansionChanges => {
530
- this._emitExpansionChanges(expansionChanges);
531
- })),
532
- ]).pipe(switchMap(([data, nodeType]) => {
533
- if (nodeType === null) {
534
- return of({ renderNodes: data, flattenedNodes: null, nodeType });
535
- }
536
- // If we're here, then we know what our node type is, and therefore can
537
- // perform our usual rendering pipeline, which necessitates converting the data
538
- return this._computeRenderingData(data, nodeType).pipe(map(convertedData => ({ ...convertedData, nodeType })));
539
- }));
540
- }
541
- _renderDataChanges(data) {
542
- if (data.nodeType === null) {
543
- this.renderNodeChanges(data.renderNodes);
544
- return;
545
- }
546
- // If we're here, then we know what our node type is, and therefore can
547
- // perform our usual rendering pipeline.
548
- this._updateCachedData(data.flattenedNodes);
549
- this.renderNodeChanges(data.renderNodes);
550
- this._updateKeyManagerItems(data.flattenedNodes);
551
- }
552
- _emitExpansionChanges(expansionChanges) {
553
- if (!expansionChanges) {
554
- return;
555
- }
556
- const nodes = this._nodes.value;
557
- for (const added of expansionChanges.added) {
558
- const node = nodes.get(added);
559
- node?._emitExpansionState(true);
560
- }
561
- for (const removed of expansionChanges.removed) {
562
- const node = nodes.get(removed);
563
- node?._emitExpansionState(false);
564
- }
565
- }
566
- _initializeKeyManager() {
567
- const items = combineLatest([this._keyManagerNodes, this._nodes]).pipe(map(([keyManagerNodes, renderNodes]) => keyManagerNodes.reduce((items, data) => {
568
- const node = renderNodes.get(this._getExpansionKey(data));
569
- if (node) {
570
- items.push(node);
571
- }
572
- return items;
573
- }, [])));
574
- const keyManagerOptions = {
575
- trackBy: node => this._getExpansionKey(node.data),
576
- skipPredicate: node => !!node.isDisabled,
577
- typeAheadDebounceInterval: true,
578
- horizontalOrientation: this._dir.value,
579
- };
580
- this._keyManager = this._keyManagerFactory(items, keyManagerOptions);
581
- }
582
- _initializeDataDiffer() {
583
- // Provide a default trackBy based on `_getExpansionKey` if one isn't provided.
584
- const trackBy = this.trackBy ?? ((_index, item) => this._getExpansionKey(item));
585
- this._dataDiffer = this._differs.find([]).create(trackBy);
586
- }
587
- _checkTreeControlUsage() {
588
- if (typeof ngDevMode === 'undefined' || ngDevMode) {
589
- // Verify that Tree follows API contract of using one of TreeControl, levelAccessor or
590
- // childrenAccessor. Throw an appropriate error if contract is not met.
591
- let numTreeControls = 0;
592
- if (this.treeControl) {
593
- numTreeControls++;
594
- }
595
- if (this.levelAccessor) {
596
- numTreeControls++;
597
- }
598
- if (this.childrenAccessor) {
599
- numTreeControls++;
600
- }
601
- if (!numTreeControls) {
602
- throw getTreeControlMissingError();
603
- }
604
- else if (numTreeControls > 1) {
605
- throw getMultipleTreeControlsError();
606
- }
607
- }
608
- }
609
- /** Check for changes made in the data and render each change (node added/removed/moved). */
610
- renderNodeChanges(data, dataDiffer = this._dataDiffer, viewContainer = this._nodeOutlet.viewContainer, parentData) {
611
- const changes = dataDiffer.diff(data);
612
- // Some tree consumers expect change detection to propagate to nodes
613
- // even when the array itself hasn't changed; we explicitly detect changes
614
- // anyways in order for nodes to update their data.
615
- //
616
- // However, if change detection is called while the component's view is
617
- // still initing, then the order of child views initing will be incorrect;
618
- // to prevent this, we only exit early if the view hasn't initialized yet.
619
- if (!changes && !this._viewInit) {
620
- return;
621
- }
622
- changes?.forEachOperation((item, adjustedPreviousIndex, currentIndex) => {
623
- if (item.previousIndex == null) {
624
- this.insertNode(data[currentIndex], currentIndex, viewContainer, parentData);
625
- }
626
- else if (currentIndex == null) {
627
- viewContainer.remove(adjustedPreviousIndex);
628
- }
629
- else {
630
- const view = viewContainer.get(adjustedPreviousIndex);
631
- viewContainer.move(view, currentIndex);
632
- }
633
- });
634
- // If the data itself changes, but keeps the same trackBy, we need to update the templates'
635
- // context to reflect the new object.
636
- changes?.forEachIdentityChange((record) => {
637
- const newData = record.item;
638
- if (record.currentIndex != undefined) {
639
- const view = viewContainer.get(record.currentIndex);
640
- view.context.$implicit = newData;
641
- }
642
- });
643
- // Note: we only `detectChanges` from a top-level call, otherwise we risk overflowing
644
- // the call stack since this method is called recursively (see #29733.)
645
- // TODO: change to `this._changeDetectorRef.markForCheck()`,
646
- // or just switch this component to use signals.
647
- if (parentData) {
648
- this._changeDetectorRef.markForCheck();
649
- }
650
- else {
651
- this._changeDetectorRef.detectChanges();
652
- }
653
- }
654
- /**
655
- * Finds the matching node definition that should be used for this node data. If there is only
656
- * one node definition, it is returned. Otherwise, find the node definition that has a when
657
- * predicate that returns true with the data. If none return true, return the default node
658
- * definition.
659
- */
660
- _getNodeDef(data, i) {
661
- if (this._nodeDefs.length === 1) {
662
- return this._nodeDefs.first;
663
- }
664
- const nodeDef = this._nodeDefs.find(def => def.when && def.when(i, data)) || this._defaultNodeDef;
665
- if (!nodeDef && (typeof ngDevMode === 'undefined' || ngDevMode)) {
666
- throw getTreeMissingMatchingNodeDefError();
667
- }
668
- return nodeDef;
669
- }
670
- /**
671
- * Create the embedded view for the data node template and place it in the correct index location
672
- * within the data node view container.
673
- */
674
- insertNode(nodeData, index, viewContainer, parentData) {
675
- const levelAccessor = this._getLevelAccessor();
676
- const node = this._getNodeDef(nodeData, index);
677
- const key = this._getExpansionKey(nodeData);
678
- // Node context that will be provided to created embedded view
679
- const context = new CdkTreeNodeOutletContext(nodeData);
680
- parentData ??= this._parents.get(key) ?? undefined;
681
- // If the tree is flat tree, then use the `getLevel` function in flat tree control
682
- // Otherwise, use the level of parent node.
683
- if (levelAccessor) {
684
- context.level = levelAccessor(nodeData);
685
- }
686
- else if (parentData !== undefined && this._levels.has(this._getExpansionKey(parentData))) {
687
- context.level = this._levels.get(this._getExpansionKey(parentData)) + 1;
688
- }
689
- else {
690
- context.level = 0;
691
- }
692
- this._levels.set(key, context.level);
693
- // Use default tree nodeOutlet, or nested node's nodeOutlet
694
- const container = viewContainer ? viewContainer : this._nodeOutlet.viewContainer;
695
- container.createEmbeddedView(node.template, context, index);
696
- // Set the data to just created `CdkTreeNode`.
697
- // The `CdkTreeNode` created from `createEmbeddedView` will be saved in static variable
698
- // `mostRecentTreeNode`. We get it from static variable and pass the node data to it.
699
- if (CdkTreeNode.mostRecentTreeNode) {
700
- CdkTreeNode.mostRecentTreeNode.data = nodeData;
701
- }
702
- }
703
- /** Whether the data node is expanded or collapsed. Returns true if it's expanded. */
704
- isExpanded(dataNode) {
705
- return !!(this.treeControl?.isExpanded(dataNode) ||
706
- this._expansionModel?.isSelected(this._getExpansionKey(dataNode)));
707
- }
708
- /** If the data node is currently expanded, collapse it. Otherwise, expand it. */
709
- toggle(dataNode) {
710
- if (this.treeControl) {
711
- this.treeControl.toggle(dataNode);
712
- }
713
- else if (this._expansionModel) {
714
- this._expansionModel.toggle(this._getExpansionKey(dataNode));
715
- }
716
- }
717
- /** Expand the data node. If it is already expanded, does nothing. */
718
- expand(dataNode) {
719
- if (this.treeControl) {
720
- this.treeControl.expand(dataNode);
721
- }
722
- else if (this._expansionModel) {
723
- this._expansionModel.select(this._getExpansionKey(dataNode));
724
- }
725
- }
726
- /** Collapse the data node. If it is already collapsed, does nothing. */
727
- collapse(dataNode) {
728
- if (this.treeControl) {
729
- this.treeControl.collapse(dataNode);
730
- }
731
- else if (this._expansionModel) {
732
- this._expansionModel.deselect(this._getExpansionKey(dataNode));
733
- }
734
- }
735
- /**
736
- * If the data node is currently expanded, collapse it and all its descendants.
737
- * Otherwise, expand it and all its descendants.
738
- */
739
- toggleDescendants(dataNode) {
740
- if (this.treeControl) {
741
- this.treeControl.toggleDescendants(dataNode);
742
- }
743
- else if (this._expansionModel) {
744
- if (this.isExpanded(dataNode)) {
745
- this.collapseDescendants(dataNode);
746
- }
747
- else {
748
- this.expandDescendants(dataNode);
749
- }
750
- }
751
- }
752
- /**
753
- * Expand the data node and all its descendants. If they are already expanded, does nothing.
754
- */
755
- expandDescendants(dataNode) {
756
- if (this.treeControl) {
757
- this.treeControl.expandDescendants(dataNode);
758
- }
759
- else if (this._expansionModel) {
760
- const expansionModel = this._expansionModel;
761
- expansionModel.select(this._getExpansionKey(dataNode));
762
- this._getDescendants(dataNode)
763
- .pipe(take(1), takeUntil(this._onDestroy))
764
- .subscribe(children => {
765
- expansionModel.select(...children.map(child => this._getExpansionKey(child)));
766
- });
767
- }
768
- }
769
- /** Collapse the data node and all its descendants. If it is already collapsed, does nothing. */
770
- collapseDescendants(dataNode) {
771
- if (this.treeControl) {
772
- this.treeControl.collapseDescendants(dataNode);
773
- }
774
- else if (this._expansionModel) {
775
- const expansionModel = this._expansionModel;
776
- expansionModel.deselect(this._getExpansionKey(dataNode));
777
- this._getDescendants(dataNode)
778
- .pipe(take(1), takeUntil(this._onDestroy))
779
- .subscribe(children => {
780
- expansionModel.deselect(...children.map(child => this._getExpansionKey(child)));
781
- });
782
- }
783
- }
784
- /** Expands all data nodes in the tree. */
785
- expandAll() {
786
- if (this.treeControl) {
787
- this.treeControl.expandAll();
788
- }
789
- else if (this._expansionModel) {
790
- this._forEachExpansionKey(keys => this._expansionModel?.select(...keys));
791
- }
792
- }
793
- /** Collapse all data nodes in the tree. */
794
- collapseAll() {
795
- if (this.treeControl) {
796
- this.treeControl.collapseAll();
797
- }
798
- else if (this._expansionModel) {
799
- this._forEachExpansionKey(keys => this._expansionModel?.deselect(...keys));
800
- }
801
- }
802
- /** Level accessor, used for compatibility between the old Tree and new Tree */
803
- _getLevelAccessor() {
804
- return this.treeControl?.getLevel?.bind(this.treeControl) ?? this.levelAccessor;
805
- }
806
- /** Children accessor, used for compatibility between the old Tree and new Tree */
807
- _getChildrenAccessor() {
808
- return this.treeControl?.getChildren?.bind(this.treeControl) ?? this.childrenAccessor;
809
- }
810
- /**
811
- * Gets the direct children of a node; used for compatibility between the old tree and the
812
- * new tree.
813
- */
814
- _getDirectChildren(dataNode) {
815
- const levelAccessor = this._getLevelAccessor();
816
- const expansionModel = this._expansionModel ?? this.treeControl?.expansionModel;
817
- if (!expansionModel) {
818
- return of([]);
819
- }
820
- const key = this._getExpansionKey(dataNode);
821
- const isExpanded = expansionModel.changed.pipe(switchMap(changes => {
822
- if (changes.added.includes(key)) {
823
- return of(true);
824
- }
825
- else if (changes.removed.includes(key)) {
826
- return of(false);
827
- }
828
- return EMPTY;
829
- }), startWith(this.isExpanded(dataNode)));
830
- if (levelAccessor) {
831
- return combineLatest([isExpanded, this._flattenedNodes]).pipe(map(([expanded, flattenedNodes]) => {
832
- if (!expanded) {
833
- return [];
834
- }
835
- return this._findChildrenByLevel(levelAccessor, flattenedNodes, dataNode, 1);
836
- }));
837
- }
838
- const childrenAccessor = this._getChildrenAccessor();
839
- if (childrenAccessor) {
840
- return coerceObservable(childrenAccessor(dataNode) ?? []);
841
- }
842
- throw getTreeControlMissingError();
843
- }
844
- /**
845
- * Given the list of flattened nodes, the level accessor, and the level range within
846
- * which to consider children, finds the children for a given node.
847
- *
848
- * For example, for direct children, `levelDelta` would be 1. For all descendants,
849
- * `levelDelta` would be Infinity.
850
- */
851
- _findChildrenByLevel(levelAccessor, flattenedNodes, dataNode, levelDelta) {
852
- const key = this._getExpansionKey(dataNode);
853
- const startIndex = flattenedNodes.findIndex(node => this._getExpansionKey(node) === key);
854
- const dataNodeLevel = levelAccessor(dataNode);
855
- const expectedLevel = dataNodeLevel + levelDelta;
856
- const results = [];
857
- // Goes through flattened tree nodes in the `flattenedNodes` array, and get all
858
- // descendants within a certain level range.
859
- //
860
- // If we reach a node whose level is equal to or less than the level of the tree node,
861
- // we hit a sibling or parent's sibling, and should stop.
862
- for (let i = startIndex + 1; i < flattenedNodes.length; i++) {
863
- const currentLevel = levelAccessor(flattenedNodes[i]);
864
- if (currentLevel <= dataNodeLevel) {
865
- break;
866
- }
867
- if (currentLevel <= expectedLevel) {
868
- results.push(flattenedNodes[i]);
869
- }
870
- }
871
- return results;
872
- }
873
- /**
874
- * Adds the specified node component to the tree's internal registry.
875
- *
876
- * This primarily facilitates keyboard navigation.
877
- */
878
- _registerNode(node) {
879
- this._nodes.value.set(this._getExpansionKey(node.data), node);
880
- this._nodes.next(this._nodes.value);
881
- }
882
- /** Removes the specified node component from the tree's internal registry. */
883
- _unregisterNode(node) {
884
- this._nodes.value.delete(this._getExpansionKey(node.data));
885
- this._nodes.next(this._nodes.value);
886
- }
887
- /**
888
- * For the given node, determine the level where this node appears in the tree.
889
- *
890
- * This is intended to be used for `aria-level` but is 0-indexed.
891
- */
892
- _getLevel(node) {
893
- return this._levels.get(this._getExpansionKey(node));
894
- }
895
- /**
896
- * For the given node, determine the size of the parent's child set.
897
- *
898
- * This is intended to be used for `aria-setsize`.
899
- */
900
- _getSetSize(dataNode) {
901
- const set = this._getAriaSet(dataNode);
902
- return set.length;
903
- }
904
- /**
905
- * For the given node, determine the index (starting from 1) of the node in its parent's child set.
906
- *
907
- * This is intended to be used for `aria-posinset`.
908
- */
909
- _getPositionInSet(dataNode) {
910
- const set = this._getAriaSet(dataNode);
911
- const key = this._getExpansionKey(dataNode);
912
- return set.findIndex(node => this._getExpansionKey(node) === key) + 1;
913
- }
914
- /** Given a CdkTreeNode, gets the node that renders that node's parent's data. */
915
- _getNodeParent(node) {
916
- const parent = this._parents.get(this._getExpansionKey(node.data));
917
- return parent && this._nodes.value.get(this._getExpansionKey(parent));
918
- }
919
- /** Given a CdkTreeNode, gets the nodes that renders that node's child data. */
920
- _getNodeChildren(node) {
921
- return this._getDirectChildren(node.data).pipe(map(children => children.reduce((nodes, child) => {
922
- const value = this._nodes.value.get(this._getExpansionKey(child));
923
- if (value) {
924
- nodes.push(value);
925
- }
926
- return nodes;
927
- }, [])));
928
- }
929
- /** `keydown` event handler; this just passes the event to the `TreeKeyManager`. */
930
- _sendKeydownToKeyManager(event) {
931
- // Only handle events directly on the tree or directly on one of the nodes, otherwise
932
- // we risk interfering with events in the projected content (see #29828).
933
- if (event.target === this._elementRef.nativeElement) {
934
- this._keyManager.onKeydown(event);
935
- }
936
- else {
937
- const nodes = this._nodes.getValue();
938
- for (const [, node] of nodes) {
939
- if (event.target === node._elementRef.nativeElement) {
940
- this._keyManager.onKeydown(event);
941
- break;
942
- }
943
- }
944
- }
945
- }
946
- /** Gets all nested descendants of a given node. */
947
- _getDescendants(dataNode) {
948
- if (this.treeControl) {
949
- return of(this.treeControl.getDescendants(dataNode));
950
- }
951
- if (this.levelAccessor) {
952
- const results = this._findChildrenByLevel(this.levelAccessor, this._flattenedNodes.value, dataNode, Infinity);
953
- return of(results);
954
- }
955
- if (this.childrenAccessor) {
956
- return this._getAllChildrenRecursively(dataNode).pipe(reduce((allChildren, nextChildren) => {
957
- allChildren.push(...nextChildren);
958
- return allChildren;
959
- }, []));
960
- }
961
- throw getTreeControlMissingError();
962
- }
963
- /**
964
- * Gets all children and sub-children of the provided node.
965
- *
966
- * This will emit multiple times, in the order that the children will appear
967
- * in the tree, and can be combined with a `reduce` operator.
968
- */
969
- _getAllChildrenRecursively(dataNode) {
970
- if (!this.childrenAccessor) {
971
- return of([]);
972
- }
973
- return coerceObservable(this.childrenAccessor(dataNode)).pipe(take(1), switchMap(children => {
974
- // Here, we cache the parents of a particular child so that we can compute the levels.
975
- for (const child of children) {
976
- this._parents.set(this._getExpansionKey(child), dataNode);
977
- }
978
- return of(...children).pipe(concatMap(child => concat(of([child]), this._getAllChildrenRecursively(child))));
979
- }));
980
- }
981
- _getExpansionKey(dataNode) {
982
- // In the case that a key accessor function was not provided by the
983
- // tree user, we'll default to using the node object itself as the key.
984
- //
985
- // This cast is safe since:
986
- // - if an expansionKey is provided, TS will infer the type of K to be
987
- // the return type.
988
- // - if it's not, then K will be defaulted to T.
989
- return this.expansionKey?.(dataNode) ?? dataNode;
990
- }
991
- _getAriaSet(node) {
992
- const key = this._getExpansionKey(node);
993
- const parent = this._parents.get(key);
994
- const parentKey = parent ? this._getExpansionKey(parent) : null;
995
- const set = this._ariaSets.get(parentKey);
996
- return set ?? [node];
997
- }
998
- /**
999
- * Finds the parent for the given node. If this is a root node, this
1000
- * returns null. If we're unable to determine the parent, for example,
1001
- * if we don't have cached node data, this returns undefined.
1002
- */
1003
- _findParentForNode(node, index, cachedNodes) {
1004
- // In all cases, we have a mapping from node to level; all we need to do here is backtrack in
1005
- // our flattened list of nodes to determine the first node that's of a level lower than the
1006
- // provided node.
1007
- if (!cachedNodes.length) {
1008
- return null;
1009
- }
1010
- const currentLevel = this._levels.get(this._getExpansionKey(node)) ?? 0;
1011
- for (let parentIndex = index - 1; parentIndex >= 0; parentIndex--) {
1012
- const parentNode = cachedNodes[parentIndex];
1013
- const parentLevel = this._levels.get(this._getExpansionKey(parentNode)) ?? 0;
1014
- if (parentLevel < currentLevel) {
1015
- return parentNode;
1016
- }
1017
- }
1018
- return null;
1019
- }
1020
- /**
1021
- * Given a set of root nodes and the current node level, flattens any nested
1022
- * nodes into a single array.
1023
- *
1024
- * If any nodes are not expanded, then their children will not be added into the array.
1025
- * This will still traverse all nested children in order to build up our internal data
1026
- * models, but will not include them in the returned array.
1027
- */
1028
- _flattenNestedNodesWithExpansion(nodes, level = 0) {
1029
- const childrenAccessor = this._getChildrenAccessor();
1030
- // If we're using a level accessor, we don't need to flatten anything.
1031
- if (!childrenAccessor) {
1032
- return of([...nodes]);
1033
- }
1034
- return of(...nodes).pipe(concatMap(node => {
1035
- const parentKey = this._getExpansionKey(node);
1036
- if (!this._parents.has(parentKey)) {
1037
- this._parents.set(parentKey, null);
1038
- }
1039
- this._levels.set(parentKey, level);
1040
- const children = coerceObservable(childrenAccessor(node));
1041
- return concat(of([node]), children.pipe(take(1), tap(childNodes => {
1042
- this._ariaSets.set(parentKey, [...(childNodes ?? [])]);
1043
- for (const child of childNodes ?? []) {
1044
- const childKey = this._getExpansionKey(child);
1045
- this._parents.set(childKey, node);
1046
- this._levels.set(childKey, level + 1);
1047
- }
1048
- }), switchMap(childNodes => {
1049
- if (!childNodes) {
1050
- return of([]);
1051
- }
1052
- return this._flattenNestedNodesWithExpansion(childNodes, level + 1).pipe(map(nestedNodes => (this.isExpanded(node) ? nestedNodes : [])));
1053
- })));
1054
- }), reduce((results, children) => {
1055
- results.push(...children);
1056
- return results;
1057
- }, []));
1058
- }
1059
- /**
1060
- * Converts children for certain tree configurations.
1061
- *
1062
- * This also computes parent, level, and group data.
1063
- */
1064
- _computeRenderingData(nodes, nodeType) {
1065
- // The only situations where we have to convert children types is when
1066
- // they're mismatched; i.e. if the tree is using a childrenAccessor and the
1067
- // nodes are flat, or if the tree is using a levelAccessor and the nodes are
1068
- // nested.
1069
- if (this.childrenAccessor && nodeType === 'flat') {
1070
- // clear previously generated data so we don't keep end up retaining data overtime causing
1071
- // memory leaks.
1072
- this._clearPreviousCache();
1073
- // This flattens children into a single array.
1074
- this._ariaSets.set(null, [...nodes]);
1075
- return this._flattenNestedNodesWithExpansion(nodes).pipe(map(flattenedNodes => ({
1076
- renderNodes: flattenedNodes,
1077
- flattenedNodes,
1078
- })));
1079
- }
1080
- else if (this.levelAccessor && nodeType === 'nested') {
1081
- // In the nested case, we only look for root nodes. The CdkNestedNode
1082
- // itself will handle rendering each individual node's children.
1083
- const levelAccessor = this.levelAccessor;
1084
- return of(nodes.filter(node => levelAccessor(node) === 0)).pipe(map(rootNodes => ({
1085
- renderNodes: rootNodes,
1086
- flattenedNodes: nodes,
1087
- })), tap(({ flattenedNodes }) => {
1088
- this._calculateParents(flattenedNodes);
1089
- }));
1090
- }
1091
- else if (nodeType === 'flat') {
1092
- // In the case of a TreeControl, we know that the node type matches up
1093
- // with the TreeControl, and so no conversions are necessary. Otherwise,
1094
- // we've already confirmed that the data model matches up with the
1095
- // desired node type here.
1096
- return of({ renderNodes: nodes, flattenedNodes: nodes }).pipe(tap(({ flattenedNodes }) => {
1097
- this._calculateParents(flattenedNodes);
1098
- }));
1099
- }
1100
- else {
1101
- // clear previously generated data so we don't keep end up retaining data overtime causing
1102
- // memory leaks.
1103
- this._clearPreviousCache();
1104
- // For nested nodes, we still need to perform the node flattening in order
1105
- // to maintain our caches for various tree operations.
1106
- this._ariaSets.set(null, [...nodes]);
1107
- return this._flattenNestedNodesWithExpansion(nodes).pipe(map(flattenedNodes => ({
1108
- renderNodes: nodes,
1109
- flattenedNodes,
1110
- })));
1111
- }
1112
- }
1113
- _updateCachedData(flattenedNodes) {
1114
- this._flattenedNodes.next(flattenedNodes);
1115
- }
1116
- _updateKeyManagerItems(flattenedNodes) {
1117
- this._keyManagerNodes.next(flattenedNodes);
1118
- }
1119
- /** Traverse the flattened node data and compute parents, levels, and group data. */
1120
- _calculateParents(flattenedNodes) {
1121
- const levelAccessor = this._getLevelAccessor();
1122
- if (!levelAccessor) {
1123
- return;
1124
- }
1125
- // clear previously generated data so we don't keep end up retaining data overtime causing
1126
- // memory leaks.
1127
- this._clearPreviousCache();
1128
- for (let index = 0; index < flattenedNodes.length; index++) {
1129
- const dataNode = flattenedNodes[index];
1130
- const key = this._getExpansionKey(dataNode);
1131
- this._levels.set(key, levelAccessor(dataNode));
1132
- const parent = this._findParentForNode(dataNode, index, flattenedNodes);
1133
- this._parents.set(key, parent);
1134
- const parentKey = parent ? this._getExpansionKey(parent) : null;
1135
- const group = this._ariaSets.get(parentKey) ?? [];
1136
- group.splice(index, 0, dataNode);
1137
- this._ariaSets.set(parentKey, group);
1138
- }
1139
- }
1140
- /** Invokes a callback with all node expansion keys. */
1141
- _forEachExpansionKey(callback) {
1142
- const toToggle = [];
1143
- const observables = [];
1144
- this._nodes.value.forEach(node => {
1145
- toToggle.push(this._getExpansionKey(node.data));
1146
- observables.push(this._getDescendants(node.data));
1147
- });
1148
- if (observables.length > 0) {
1149
- combineLatest(observables)
1150
- .pipe(take(1), takeUntil(this._onDestroy))
1151
- .subscribe(results => {
1152
- results.forEach(inner => inner.forEach(r => toToggle.push(this._getExpansionKey(r))));
1153
- callback(toToggle);
1154
- });
1155
- }
1156
- else {
1157
- callback(toToggle);
1158
- }
1159
- }
1160
- /** Clears the maps we use to store parents, level & aria-sets in. */
1161
- _clearPreviousCache() {
1162
- this._parents.clear();
1163
- this._levels.clear();
1164
- this._ariaSets.clear();
1165
- }
1166
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CdkTree, deps: [], target: i0.ɵɵFactoryTarget.Component });
1167
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.6", type: CdkTree, isStandalone: true, selector: "cdk-tree", inputs: { dataSource: "dataSource", treeControl: "treeControl", levelAccessor: "levelAccessor", childrenAccessor: "childrenAccessor", trackBy: "trackBy", expansionKey: "expansionKey" }, host: { attributes: { "role": "tree" }, listeners: { "keydown": "_sendKeydownToKeyManager($event)" }, classAttribute: "cdk-tree" }, queries: [{ propertyName: "_nodeDefs", predicate: CdkTreeNodeDef, descendants: true }], viewQueries: [{ propertyName: "_nodeOutlet", first: true, predicate: CdkTreeNodeOutlet, descendants: true, static: true }], exportAs: ["cdkTree"], ngImport: i0, template: `<ng-container cdkTreeNodeOutlet></ng-container>`, isInline: true, dependencies: [{ kind: "directive", type: CdkTreeNodeOutlet, selector: "[cdkTreeNodeOutlet]" }], changeDetection: i0.ChangeDetectionStrategy.Default, encapsulation: i0.ViewEncapsulation.None });
1168
- }
1169
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CdkTree, decorators: [{
1170
- type: Component,
1171
- args: [{
1172
- selector: 'cdk-tree',
1173
- exportAs: 'cdkTree',
1174
- template: `<ng-container cdkTreeNodeOutlet></ng-container>`,
1175
- host: {
1176
- 'class': 'cdk-tree',
1177
- 'role': 'tree',
1178
- '(keydown)': '_sendKeydownToKeyManager($event)',
1179
- },
1180
- encapsulation: ViewEncapsulation.None,
1181
- // The "OnPush" status for the `CdkTree` component is effectively a noop, so we are removing it.
1182
- // The view for `CdkTree` consists entirely of templates declared in other views. As they are
1183
- // declared elsewhere, they are checked when their declaration points are checked.
1184
- // tslint:disable-next-line:validate-decorators
1185
- changeDetection: ChangeDetectionStrategy.Default,
1186
- imports: [CdkTreeNodeOutlet],
1187
- }]
1188
- }], ctorParameters: () => [], propDecorators: { dataSource: [{
1189
- type: Input
1190
- }], treeControl: [{
1191
- type: Input
1192
- }], levelAccessor: [{
1193
- type: Input
1194
- }], childrenAccessor: [{
1195
- type: Input
1196
- }], trackBy: [{
1197
- type: Input
1198
- }], expansionKey: [{
1199
- type: Input
1200
- }], _nodeOutlet: [{
1201
- type: ViewChild,
1202
- args: [CdkTreeNodeOutlet, { static: true }]
1203
- }], _nodeDefs: [{
1204
- type: ContentChildren,
1205
- args: [CdkTreeNodeDef, {
1206
- // We need to use `descendants: true`, because Ivy will no longer match
1207
- // indirect descendants if it's left as false.
1208
- descendants: true,
1209
- }]
1210
- }] } });
1211
- /**
1212
- * Tree node for CdkTree. It contains the data in the tree node.
1213
- */
1214
- class CdkTreeNode {
1215
- _elementRef = inject(ElementRef);
1216
- _tree = inject(CdkTree);
1217
- _tabindex = -1;
1218
- _type = 'flat';
1219
- /**
1220
- * The role of the tree node.
1221
- *
1222
- * @deprecated This will be ignored; the tree will automatically determine the appropriate role
1223
- * for tree node. This input will be removed in a future version.
1224
- * @breaking-change 21.0.0
1225
- */
1226
- get role() {
1227
- return 'treeitem';
1228
- }
1229
- set role(_role) {
1230
- // ignore any role setting, we handle this internally.
1231
- }
1232
- /**
1233
- * Whether or not this node is expandable.
1234
- *
1235
- * If not using `FlatTreeControl`, or if `isExpandable` is not provided to
1236
- * `NestedTreeControl`, this should be provided for correct node a11y.
1237
- */
1238
- get isExpandable() {
1239
- return this._isExpandable();
1240
- }
1241
- set isExpandable(isExpandable) {
1242
- this._inputIsExpandable = isExpandable;
1243
- if ((this.data && !this._isExpandable) || !this._inputIsExpandable) {
1244
- return;
1245
- }
1246
- // If the node is being set to expandable, ensure that the status of the
1247
- // node is propagated
1248
- if (this._inputIsExpanded) {
1249
- this.expand();
1250
- }
1251
- else if (this._inputIsExpanded === false) {
1252
- this.collapse();
1253
- }
1254
- }
1255
- get isExpanded() {
1256
- return this._tree.isExpanded(this._data);
1257
- }
1258
- set isExpanded(isExpanded) {
1259
- this._inputIsExpanded = isExpanded;
1260
- if (isExpanded) {
1261
- this.expand();
1262
- }
1263
- else {
1264
- this.collapse();
1265
- }
1266
- }
1267
- /**
1268
- * Whether or not this node is disabled. If it's disabled, then the user won't be able to focus
1269
- * or activate this node.
1270
- */
1271
- isDisabled;
1272
- /**
1273
- * The text used to locate this item during typeahead. If not specified, the `textContent` will
1274
- * will be used.
1275
- */
1276
- typeaheadLabel;
1277
- getLabel() {
1278
- return this.typeaheadLabel || this._elementRef.nativeElement.textContent?.trim() || '';
1279
- }
1280
- /** This emits when the node has been programatically activated or activated by keyboard. */
1281
- activation = new EventEmitter();
1282
- /** This emits when the node's expansion status has been changed. */
1283
- expandedChange = new EventEmitter();
1284
- /**
1285
- * The most recently created `CdkTreeNode`. We save it in static variable so we can retrieve it
1286
- * in `CdkTree` and set the data to it.
1287
- */
1288
- static mostRecentTreeNode = null;
1289
- /** Subject that emits when the component has been destroyed. */
1290
- _destroyed = new Subject();
1291
- /** Emits when the node's data has changed. */
1292
- _dataChanges = new Subject();
1293
- _inputIsExpandable = false;
1294
- _inputIsExpanded = undefined;
1295
- /**
1296
- * Flag used to determine whether or not we should be focusing the actual element based on
1297
- * some user interaction (click or focus). On click, we don't forcibly focus the element
1298
- * since the click could trigger some other component that wants to grab its own focus
1299
- * (e.g. menu, dialog).
1300
- */
1301
- _shouldFocus = true;
1302
- _parentNodeAriaLevel;
1303
- /** The tree node's data. */
1304
- get data() {
1305
- return this._data;
1306
- }
1307
- set data(value) {
1308
- if (value !== this._data) {
1309
- this._data = value;
1310
- this._dataChanges.next();
1311
- }
1312
- }
1313
- _data;
1314
- /* If leaf node, return true to not assign aria-expanded attribute */
1315
- get isLeafNode() {
1316
- // If flat tree node data returns false for expandable property, it's a leaf node
1317
- if (this._tree.treeControl?.isExpandable !== undefined &&
1318
- !this._tree.treeControl.isExpandable(this._data)) {
1319
- return true;
1320
- // If nested tree node data returns 0 descendants, it's a leaf node
1321
- }
1322
- else if (this._tree.treeControl?.isExpandable === undefined &&
1323
- this._tree.treeControl?.getDescendants(this._data).length === 0) {
1324
- return true;
1325
- }
1326
- return false;
1327
- }
1328
- get level() {
1329
- // If the tree has a levelAccessor, use it to get the level. Otherwise read the
1330
- // aria-level off the parent node and use it as the level for this node (note aria-level is
1331
- // 1-indexed, while this property is 0-indexed, so we don't need to increment).
1332
- return this._tree._getLevel(this._data) ?? this._parentNodeAriaLevel;
1333
- }
1334
- /** Determines if the tree node is expandable. */
1335
- _isExpandable() {
1336
- if (this._tree.treeControl) {
1337
- if (this.isLeafNode) {
1338
- return false;
1339
- }
1340
- // For compatibility with trees created using TreeControl before we added
1341
- // CdkTreeNode#isExpandable.
1342
- return true;
1343
- }
1344
- return this._inputIsExpandable;
1345
- }
1346
- /**
1347
- * Determines the value for `aria-expanded`.
1348
- *
1349
- * For non-expandable nodes, this is `null`.
1350
- */
1351
- _getAriaExpanded() {
1352
- if (!this._isExpandable()) {
1353
- return null;
1354
- }
1355
- return String(this.isExpanded);
1356
- }
1357
- /**
1358
- * Determines the size of this node's parent's child set.
1359
- *
1360
- * This is intended to be used for `aria-setsize`.
1361
- */
1362
- _getSetSize() {
1363
- return this._tree._getSetSize(this._data);
1364
- }
1365
- /**
1366
- * Determines the index (starting from 1) of this node in its parent's child set.
1367
- *
1368
- * This is intended to be used for `aria-posinset`.
1369
- */
1370
- _getPositionInSet() {
1371
- return this._tree._getPositionInSet(this._data);
1372
- }
1373
- _changeDetectorRef = inject(ChangeDetectorRef);
1374
- constructor() {
1375
- CdkTreeNode.mostRecentTreeNode = this;
1376
- }
1377
- ngOnInit() {
1378
- this._parentNodeAriaLevel = getParentNodeAriaLevel(this._elementRef.nativeElement);
1379
- this._tree
1380
- ._getExpansionModel()
1381
- .changed.pipe(map(() => this.isExpanded), distinctUntilChanged())
1382
- .subscribe(() => this._changeDetectorRef.markForCheck());
1383
- this._tree._setNodeTypeIfUnset(this._type);
1384
- this._tree._registerNode(this);
1385
- }
1386
- ngOnDestroy() {
1387
- // If this is the last tree node being destroyed,
1388
- // clear out the reference to avoid leaking memory.
1389
- if (CdkTreeNode.mostRecentTreeNode === this) {
1390
- CdkTreeNode.mostRecentTreeNode = null;
1391
- }
1392
- this._dataChanges.complete();
1393
- this._destroyed.next();
1394
- this._destroyed.complete();
1395
- }
1396
- getParent() {
1397
- return this._tree._getNodeParent(this) ?? null;
1398
- }
1399
- getChildren() {
1400
- return this._tree._getNodeChildren(this);
1401
- }
1402
- /** Focuses this data node. Implemented for TreeKeyManagerItem. */
1403
- focus() {
1404
- this._tabindex = 0;
1405
- if (this._shouldFocus) {
1406
- this._elementRef.nativeElement.focus();
1407
- }
1408
- this._changeDetectorRef.markForCheck();
1409
- }
1410
- /** Defocus this data node. */
1411
- unfocus() {
1412
- this._tabindex = -1;
1413
- this._changeDetectorRef.markForCheck();
1414
- }
1415
- /** Emits an activation event. Implemented for TreeKeyManagerItem. */
1416
- activate() {
1417
- if (this.isDisabled) {
1418
- return;
1419
- }
1420
- this.activation.next(this._data);
1421
- }
1422
- /** Collapses this data node. Implemented for TreeKeyManagerItem. */
1423
- collapse() {
1424
- if (this.isExpandable) {
1425
- this._tree.collapse(this._data);
1426
- }
1427
- }
1428
- /** Expands this data node. Implemented for TreeKeyManagerItem. */
1429
- expand() {
1430
- if (this.isExpandable) {
1431
- this._tree.expand(this._data);
1432
- }
1433
- }
1434
- /** Makes the node focusable. Implemented for TreeKeyManagerItem. */
1435
- makeFocusable() {
1436
- this._tabindex = 0;
1437
- this._changeDetectorRef.markForCheck();
1438
- }
1439
- _focusItem() {
1440
- if (this.isDisabled) {
1441
- return;
1442
- }
1443
- this._tree._keyManager.focusItem(this);
1444
- }
1445
- _setActiveItem() {
1446
- if (this.isDisabled) {
1447
- return;
1448
- }
1449
- this._shouldFocus = false;
1450
- this._tree._keyManager.focusItem(this);
1451
- this._shouldFocus = true;
1452
- }
1453
- _emitExpansionState(expanded) {
1454
- this.expandedChange.emit(expanded);
1455
- }
1456
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CdkTreeNode, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1457
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "19.2.6", type: CdkTreeNode, isStandalone: true, selector: "cdk-tree-node", inputs: { role: "role", isExpandable: ["isExpandable", "isExpandable", booleanAttribute], isExpanded: "isExpanded", isDisabled: ["isDisabled", "isDisabled", booleanAttribute], typeaheadLabel: ["cdkTreeNodeTypeaheadLabel", "typeaheadLabel"] }, outputs: { activation: "activation", expandedChange: "expandedChange" }, host: { attributes: { "role": "treeitem" }, listeners: { "click": "_setActiveItem()", "focus": "_focusItem()" }, properties: { "attr.aria-expanded": "_getAriaExpanded()", "attr.aria-level": "level + 1", "attr.aria-posinset": "_getPositionInSet()", "attr.aria-setsize": "_getSetSize()", "tabindex": "_tabindex" }, classAttribute: "cdk-tree-node" }, exportAs: ["cdkTreeNode"], ngImport: i0 });
1458
- }
1459
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CdkTreeNode, decorators: [{
1460
- type: Directive,
1461
- args: [{
1462
- selector: 'cdk-tree-node',
1463
- exportAs: 'cdkTreeNode',
1464
- host: {
1465
- 'class': 'cdk-tree-node',
1466
- '[attr.aria-expanded]': '_getAriaExpanded()',
1467
- '[attr.aria-level]': 'level + 1',
1468
- '[attr.aria-posinset]': '_getPositionInSet()',
1469
- '[attr.aria-setsize]': '_getSetSize()',
1470
- '[tabindex]': '_tabindex',
1471
- 'role': 'treeitem',
1472
- '(click)': '_setActiveItem()',
1473
- '(focus)': '_focusItem()',
1474
- },
1475
- }]
1476
- }], ctorParameters: () => [], propDecorators: { role: [{
1477
- type: Input
1478
- }], isExpandable: [{
1479
- type: Input,
1480
- args: [{ transform: booleanAttribute }]
1481
- }], isExpanded: [{
1482
- type: Input
1483
- }], isDisabled: [{
1484
- type: Input,
1485
- args: [{ transform: booleanAttribute }]
1486
- }], typeaheadLabel: [{
1487
- type: Input,
1488
- args: ['cdkTreeNodeTypeaheadLabel']
1489
- }], activation: [{
1490
- type: Output
1491
- }], expandedChange: [{
1492
- type: Output
1493
- }] } });
1494
- function getParentNodeAriaLevel(nodeElement) {
1495
- let parent = nodeElement.parentElement;
1496
- while (parent && !isNodeElement(parent)) {
1497
- parent = parent.parentElement;
1498
- }
1499
- if (!parent) {
1500
- if (typeof ngDevMode === 'undefined' || ngDevMode) {
1501
- throw Error('Incorrect tree structure containing detached node.');
1502
- }
1503
- else {
1504
- return -1;
1505
- }
1506
- }
1507
- else if (parent.classList.contains('cdk-nested-tree-node')) {
1508
- return numberAttribute(parent.getAttribute('aria-level'));
1509
- }
1510
- else {
1511
- // The ancestor element is the cdk-tree itself
1512
- return 0;
1513
- }
1514
- }
1515
- function isNodeElement(element) {
1516
- const classList = element.classList;
1517
- return !!(classList?.contains('cdk-nested-tree-node') || classList?.contains('cdk-tree'));
1518
- }
1519
-
1520
- /**
1521
- * Nested node is a child of `<cdk-tree>`. It works with nested tree.
1522
- * By using `cdk-nested-tree-node` component in tree node template, children of the parent node will
1523
- * be added in the `cdkTreeNodeOutlet` in tree node template.
1524
- * The children of node will be automatically added to `cdkTreeNodeOutlet`.
1525
- */
1526
- class CdkNestedTreeNode extends CdkTreeNode {
1527
- _type = 'nested';
1528
- _differs = inject(IterableDiffers);
1529
- /** Differ used to find the changes in the data provided by the data source. */
1530
- _dataDiffer;
1531
- /** The children data dataNodes of current node. They will be placed in `CdkTreeNodeOutlet`. */
1532
- _children;
1533
- /** The children node placeholder. */
1534
- nodeOutlet;
1535
- constructor() {
1536
- super();
1537
- }
1538
- ngAfterContentInit() {
1539
- this._dataDiffer = this._differs.find([]).create(this._tree.trackBy);
1540
- this._tree
1541
- ._getDirectChildren(this.data)
1542
- .pipe(takeUntil(this._destroyed))
1543
- .subscribe(result => this.updateChildrenNodes(result));
1544
- this.nodeOutlet.changes
1545
- .pipe(takeUntil(this._destroyed))
1546
- .subscribe(() => this.updateChildrenNodes());
1547
- }
1548
- ngOnDestroy() {
1549
- this._clear();
1550
- super.ngOnDestroy();
1551
- }
1552
- /** Add children dataNodes to the NodeOutlet */
1553
- updateChildrenNodes(children) {
1554
- const outlet = this._getNodeOutlet();
1555
- if (children) {
1556
- this._children = children;
1557
- }
1558
- if (outlet && this._children) {
1559
- const viewContainer = outlet.viewContainer;
1560
- this._tree.renderNodeChanges(this._children, this._dataDiffer, viewContainer, this._data);
1561
- }
1562
- else {
1563
- // Reset the data differ if there's no children nodes displayed
1564
- this._dataDiffer.diff([]);
1565
- }
1566
- }
1567
- /** Clear the children dataNodes. */
1568
- _clear() {
1569
- const outlet = this._getNodeOutlet();
1570
- if (outlet) {
1571
- outlet.viewContainer.clear();
1572
- this._dataDiffer.diff([]);
1573
- }
1574
- }
1575
- /** Gets the outlet for the current node. */
1576
- _getNodeOutlet() {
1577
- const outlets = this.nodeOutlet;
1578
- // Note that since we use `descendants: true` on the query, we have to ensure
1579
- // that we don't pick up the outlet of a child node by accident.
1580
- return outlets && outlets.find(outlet => !outlet._node || outlet._node === this);
1581
- }
1582
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CdkNestedTreeNode, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1583
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.6", type: CdkNestedTreeNode, isStandalone: true, selector: "cdk-nested-tree-node", host: { classAttribute: "cdk-nested-tree-node" }, providers: [
1584
- { provide: CdkTreeNode, useExisting: CdkNestedTreeNode },
1585
- { provide: CDK_TREE_NODE_OUTLET_NODE, useExisting: CdkNestedTreeNode },
1586
- ], queries: [{ propertyName: "nodeOutlet", predicate: CdkTreeNodeOutlet, descendants: true }], exportAs: ["cdkNestedTreeNode"], usesInheritance: true, ngImport: i0 });
1587
- }
1588
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CdkNestedTreeNode, decorators: [{
1589
- type: Directive,
1590
- args: [{
1591
- selector: 'cdk-nested-tree-node',
1592
- exportAs: 'cdkNestedTreeNode',
1593
- providers: [
1594
- { provide: CdkTreeNode, useExisting: CdkNestedTreeNode },
1595
- { provide: CDK_TREE_NODE_OUTLET_NODE, useExisting: CdkNestedTreeNode },
1596
- ],
1597
- host: {
1598
- 'class': 'cdk-nested-tree-node',
1599
- },
1600
- }]
1601
- }], ctorParameters: () => [], propDecorators: { nodeOutlet: [{
1602
- type: ContentChildren,
1603
- args: [CdkTreeNodeOutlet, {
1604
- // We need to use `descendants: true`, because Ivy will no longer match
1605
- // indirect descendants if it's left as false.
1606
- descendants: true,
1607
- }]
1608
- }] } });
1609
-
1610
- /** Regex used to split a string on its CSS units. */
1611
- const cssUnitPattern = /([A-Za-z%]+)$/;
1612
- /**
1613
- * Indent for the children tree dataNodes.
1614
- * This directive will add left-padding to the node to show hierarchy.
1615
- */
1616
- class CdkTreeNodePadding {
1617
- _treeNode = inject(CdkTreeNode);
1618
- _tree = inject(CdkTree);
1619
- _element = inject(ElementRef);
1620
- _dir = inject(Directionality, { optional: true });
1621
- /** Current padding value applied to the element. Used to avoid unnecessarily hitting the DOM. */
1622
- _currentPadding;
1623
- /** Subject that emits when the component has been destroyed. */
1624
- _destroyed = new Subject();
1625
- /** CSS units used for the indentation value. */
1626
- indentUnits = 'px';
1627
- /** The level of depth of the tree node. The padding will be `level * indent` pixels. */
1628
- get level() {
1629
- return this._level;
1630
- }
1631
- set level(value) {
1632
- this._setLevelInput(value);
1633
- }
1634
- _level;
1635
- /**
1636
- * The indent for each level. Can be a number or a CSS string.
1637
- * Default number 40px from material design menu sub-menu spec.
1638
- */
1639
- get indent() {
1640
- return this._indent;
1641
- }
1642
- set indent(indent) {
1643
- this._setIndentInput(indent);
1644
- }
1645
- _indent = 40;
1646
- constructor() {
1647
- this._setPadding();
1648
- this._dir?.change.pipe(takeUntil(this._destroyed)).subscribe(() => this._setPadding(true));
1649
- // In Ivy the indentation binding might be set before the tree node's data has been added,
1650
- // which means that we'll miss the first render. We have to subscribe to changes in the
1651
- // data to ensure that everything is up to date.
1652
- this._treeNode._dataChanges.subscribe(() => this._setPadding());
1653
- }
1654
- ngOnDestroy() {
1655
- this._destroyed.next();
1656
- this._destroyed.complete();
1657
- }
1658
- /** The padding indent value for the tree node. Returns a string with px numbers if not null. */
1659
- _paddingIndent() {
1660
- const nodeLevel = (this._treeNode.data && this._tree._getLevel(this._treeNode.data)) ?? null;
1661
- const level = this._level == null ? nodeLevel : this._level;
1662
- return typeof level === 'number' ? `${level * this._indent}${this.indentUnits}` : null;
1663
- }
1664
- _setPadding(forceChange = false) {
1665
- const padding = this._paddingIndent();
1666
- if (padding !== this._currentPadding || forceChange) {
1667
- const element = this._element.nativeElement;
1668
- const paddingProp = this._dir && this._dir.value === 'rtl' ? 'paddingRight' : 'paddingLeft';
1669
- const resetProp = paddingProp === 'paddingLeft' ? 'paddingRight' : 'paddingLeft';
1670
- element.style[paddingProp] = padding || '';
1671
- element.style[resetProp] = '';
1672
- this._currentPadding = padding;
1673
- }
1674
- }
1675
- /**
1676
- * This has been extracted to a util because of TS 4 and VE.
1677
- * View Engine doesn't support property rename inheritance.
1678
- * TS 4.0 doesn't allow properties to override accessors or vice-versa.
1679
- * @docs-private
1680
- */
1681
- _setLevelInput(value) {
1682
- // Set to null as the fallback value so that _setPadding can fall back to the node level if the
1683
- // consumer set the directive as `cdkTreeNodePadding=""`. We still want to take this value if
1684
- // they set 0 explicitly.
1685
- this._level = isNaN(value) ? null : value;
1686
- this._setPadding();
1687
- }
1688
- /**
1689
- * This has been extracted to a util because of TS 4 and VE.
1690
- * View Engine doesn't support property rename inheritance.
1691
- * TS 4.0 doesn't allow properties to override accessors or vice-versa.
1692
- * @docs-private
1693
- */
1694
- _setIndentInput(indent) {
1695
- let value = indent;
1696
- let units = 'px';
1697
- if (typeof indent === 'string') {
1698
- const parts = indent.split(cssUnitPattern);
1699
- value = parts[0];
1700
- units = parts[1] || units;
1701
- }
1702
- this.indentUnits = units;
1703
- this._indent = numberAttribute(value);
1704
- this._setPadding();
1705
- }
1706
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CdkTreeNodePadding, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1707
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "19.2.6", type: CdkTreeNodePadding, isStandalone: true, selector: "[cdkTreeNodePadding]", inputs: { level: ["cdkTreeNodePadding", "level", numberAttribute], indent: ["cdkTreeNodePaddingIndent", "indent"] }, ngImport: i0 });
1708
- }
1709
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CdkTreeNodePadding, decorators: [{
1710
- type: Directive,
1711
- args: [{
1712
- selector: '[cdkTreeNodePadding]',
1713
- }]
1714
- }], ctorParameters: () => [], propDecorators: { level: [{
1715
- type: Input,
1716
- args: [{ alias: 'cdkTreeNodePadding', transform: numberAttribute }]
1717
- }], indent: [{
1718
- type: Input,
1719
- args: ['cdkTreeNodePaddingIndent']
1720
- }] } });
1721
-
1722
- /**
1723
- * Node toggle to expand and collapse the node.
1724
- */
1725
- class CdkTreeNodeToggle {
1726
- _tree = inject(CdkTree);
1727
- _treeNode = inject(CdkTreeNode);
1728
- /** Whether expand/collapse the node recursively. */
1729
- recursive = false;
1730
- constructor() { }
1731
- // Toggle the expanded or collapsed state of this node.
1732
- //
1733
- // Focus this node with expanding or collapsing it. This ensures that the active node will always
1734
- // be visible when expanding and collapsing.
1735
- _toggle() {
1736
- this.recursive
1737
- ? this._tree.toggleDescendants(this._treeNode.data)
1738
- : this._tree.toggle(this._treeNode.data);
1739
- this._tree._keyManager.focusItem(this._treeNode);
1740
- }
1741
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CdkTreeNodeToggle, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1742
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "19.2.6", type: CdkTreeNodeToggle, isStandalone: true, selector: "[cdkTreeNodeToggle]", inputs: { recursive: ["cdkTreeNodeToggleRecursive", "recursive", booleanAttribute] }, host: { attributes: { "tabindex": "-1" }, listeners: { "click": "_toggle(); $event.stopPropagation();", "keydown.Enter": "_toggle(); $event.preventDefault();", "keydown.Space": "_toggle(); $event.preventDefault();" } }, ngImport: i0 });
1743
- }
1744
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CdkTreeNodeToggle, decorators: [{
1745
- type: Directive,
1746
- args: [{
1747
- selector: '[cdkTreeNodeToggle]',
1748
- host: {
1749
- '(click)': '_toggle(); $event.stopPropagation();',
1750
- '(keydown.Enter)': '_toggle(); $event.preventDefault();',
1751
- '(keydown.Space)': '_toggle(); $event.preventDefault();',
1752
- 'tabindex': '-1',
1753
- },
1754
- }]
1755
- }], ctorParameters: () => [], propDecorators: { recursive: [{
1756
- type: Input,
1757
- args: [{ alias: 'cdkTreeNodeToggleRecursive', transform: booleanAttribute }]
1758
- }] } });
1759
-
1760
- const EXPORTED_DECLARATIONS = [
1761
- CdkNestedTreeNode,
1762
- CdkTreeNodeDef,
1763
- CdkTreeNodePadding,
1764
- CdkTreeNodeToggle,
1765
- CdkTree,
1766
- CdkTreeNode,
1767
- CdkTreeNodeOutlet,
1768
- ];
1769
- class CdkTreeModule {
1770
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CdkTreeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1771
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.6", ngImport: i0, type: CdkTreeModule, imports: [CdkNestedTreeNode,
1772
- CdkTreeNodeDef,
1773
- CdkTreeNodePadding,
1774
- CdkTreeNodeToggle,
1775
- CdkTree,
1776
- CdkTreeNode,
1777
- CdkTreeNodeOutlet], exports: [CdkNestedTreeNode,
1778
- CdkTreeNodeDef,
1779
- CdkTreeNodePadding,
1780
- CdkTreeNodeToggle,
1781
- CdkTree,
1782
- CdkTreeNode,
1783
- CdkTreeNodeOutlet] });
1784
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CdkTreeModule });
1785
- }
1786
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CdkTreeModule, decorators: [{
1787
- type: NgModule,
1788
- args: [{
1789
- imports: EXPORTED_DECLARATIONS,
1790
- exports: EXPORTED_DECLARATIONS,
1791
- }]
1792
- }] });
1793
-
1794
- export { BaseTreeControl, CDK_TREE_NODE_OUTLET_NODE, CdkNestedTreeNode, CdkTree, CdkTreeModule, CdkTreeNode, CdkTreeNodeDef, CdkTreeNodeOutlet, CdkTreeNodeOutletContext, CdkTreeNodePadding, CdkTreeNodeToggle, FlatTreeControl, NestedTreeControl, getMultipleTreeControlsError, getTreeControlMissingError, getTreeMissingMatchingNodeDefError, getTreeMultipleDefaultNodeDefsError, getTreeNoValidDataSourceError };
1795
- //# sourceMappingURL=tree.mjs.map