@ptsecurity/mosaic 11.6.0 → 12.2.1

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 (630) hide show
  1. package/_theming.scss +407 -99
  2. package/_visual.scss +63 -26
  3. package/autocomplete/autocomplete-origin.directive.d.ts +3 -0
  4. package/autocomplete/autocomplete-trigger.directive.d.ts +3 -0
  5. package/autocomplete/autocomplete.component.d.ts +3 -0
  6. package/autocomplete/autocomplete.module.d.ts +10 -0
  7. package/autocomplete/package.json +0 -1
  8. package/autocomplete/ptsecurity-mosaic-autocomplete.d.ts +1 -0
  9. package/bundles/ptsecurity-mosaic-autocomplete.umd.js +178 -114
  10. package/bundles/ptsecurity-mosaic-autocomplete.umd.js.map +1 -1
  11. package/bundles/ptsecurity-mosaic-button-toggle.umd.js +107 -71
  12. package/bundles/ptsecurity-mosaic-button-toggle.umd.js.map +1 -1
  13. package/bundles/ptsecurity-mosaic-button.umd.js +106 -77
  14. package/bundles/ptsecurity-mosaic-button.umd.js.map +1 -1
  15. package/bundles/ptsecurity-mosaic-card.umd.js +74 -43
  16. package/bundles/ptsecurity-mosaic-card.umd.js.map +1 -1
  17. package/bundles/ptsecurity-mosaic-checkbox.umd.js +114 -69
  18. package/bundles/ptsecurity-mosaic-checkbox.umd.js.map +1 -1
  19. package/bundles/ptsecurity-mosaic-core.umd.js +804 -256
  20. package/bundles/ptsecurity-mosaic-core.umd.js.map +1 -1
  21. package/bundles/ptsecurity-mosaic-datepicker.umd.js +599 -420
  22. package/bundles/ptsecurity-mosaic-datepicker.umd.js.map +1 -1
  23. package/bundles/ptsecurity-mosaic-design-tokens.umd.js +108 -26
  24. package/bundles/ptsecurity-mosaic-design-tokens.umd.js.map +1 -1
  25. package/bundles/ptsecurity-mosaic-divider.umd.js +55 -28
  26. package/bundles/ptsecurity-mosaic-divider.umd.js.map +1 -1
  27. package/bundles/ptsecurity-mosaic-dropdown.umd.js +263 -187
  28. package/bundles/ptsecurity-mosaic-dropdown.umd.js.map +1 -1
  29. package/bundles/ptsecurity-mosaic-form-field.umd.js +200 -125
  30. package/bundles/ptsecurity-mosaic-form-field.umd.js.map +1 -1
  31. package/bundles/ptsecurity-mosaic-icon.umd.js +79 -41
  32. package/bundles/ptsecurity-mosaic-icon.umd.js.map +1 -1
  33. package/bundles/ptsecurity-mosaic-input.umd.js +222 -124
  34. package/bundles/ptsecurity-mosaic-input.umd.js.map +1 -1
  35. package/bundles/ptsecurity-mosaic-link.umd.js +76 -45
  36. package/bundles/ptsecurity-mosaic-link.umd.js.map +1 -1
  37. package/bundles/ptsecurity-mosaic-list.umd.js +344 -200
  38. package/bundles/ptsecurity-mosaic-list.umd.js.map +1 -1
  39. package/bundles/ptsecurity-mosaic-modal.umd.js +324 -220
  40. package/bundles/ptsecurity-mosaic-modal.umd.js.map +1 -1
  41. package/bundles/ptsecurity-mosaic-navbar.umd.js +289 -208
  42. package/bundles/ptsecurity-mosaic-navbar.umd.js.map +1 -1
  43. package/bundles/ptsecurity-mosaic-popover.umd.js +346 -640
  44. package/bundles/ptsecurity-mosaic-popover.umd.js.map +1 -1
  45. package/bundles/ptsecurity-mosaic-progress-bar.umd.js +69 -40
  46. package/bundles/ptsecurity-mosaic-progress-bar.umd.js.map +1 -1
  47. package/bundles/ptsecurity-mosaic-progress-spinner.umd.js +69 -40
  48. package/bundles/ptsecurity-mosaic-progress-spinner.umd.js.map +1 -1
  49. package/bundles/ptsecurity-mosaic-radio.umd.js +126 -81
  50. package/bundles/ptsecurity-mosaic-radio.umd.js.map +1 -1
  51. package/bundles/ptsecurity-mosaic-select.umd.js +276 -154
  52. package/bundles/ptsecurity-mosaic-select.umd.js.map +1 -1
  53. package/bundles/ptsecurity-mosaic-sidebar.umd.js +105 -68
  54. package/bundles/ptsecurity-mosaic-sidebar.umd.js.map +1 -1
  55. package/bundles/ptsecurity-mosaic-sidepanel.umd.js +236 -158
  56. package/bundles/ptsecurity-mosaic-sidepanel.umd.js.map +1 -1
  57. package/bundles/ptsecurity-mosaic-splitter.umd.js +112 -83
  58. package/bundles/ptsecurity-mosaic-splitter.umd.js.map +1 -1
  59. package/bundles/ptsecurity-mosaic-table.umd.js +77 -44
  60. package/bundles/ptsecurity-mosaic-table.umd.js.map +1 -1
  61. package/bundles/ptsecurity-mosaic-tabs.umd.js +894 -687
  62. package/bundles/ptsecurity-mosaic-tabs.umd.js.map +1 -1
  63. package/bundles/ptsecurity-mosaic-tags.umd.js +313 -209
  64. package/bundles/ptsecurity-mosaic-tags.umd.js.map +1 -1
  65. package/bundles/ptsecurity-mosaic-textarea.umd.js +107 -53
  66. package/bundles/ptsecurity-mosaic-textarea.umd.js.map +1 -1
  67. package/bundles/ptsecurity-mosaic-timepicker.umd.js +116 -71
  68. package/bundles/ptsecurity-mosaic-timepicker.umd.js.map +1 -1
  69. package/bundles/ptsecurity-mosaic-toggle.umd.js +97 -58
  70. package/bundles/ptsecurity-mosaic-toggle.umd.js.map +1 -1
  71. package/bundles/ptsecurity-mosaic-tooltip.umd.js +347 -615
  72. package/bundles/ptsecurity-mosaic-tooltip.umd.js.map +1 -1
  73. package/bundles/ptsecurity-mosaic-tree-select.umd.js +223 -118
  74. package/bundles/ptsecurity-mosaic-tree-select.umd.js.map +1 -1
  75. package/bundles/ptsecurity-mosaic-tree.umd.js +1162 -344
  76. package/bundles/ptsecurity-mosaic-tree.umd.js.map +1 -1
  77. package/bundles/ptsecurity-mosaic.umd.js +2 -2
  78. package/button/button.component.d.ts +7 -0
  79. package/button/button.module.d.ts +8 -0
  80. package/button/package.json +0 -1
  81. package/button/ptsecurity-mosaic-button.d.ts +1 -0
  82. package/button-toggle/button-toggle.component.d.ts +5 -0
  83. package/button-toggle/button-toggle.module.d.ts +7 -0
  84. package/button-toggle/package.json +0 -1
  85. package/button-toggle/ptsecurity-mosaic-button-toggle.d.ts +1 -0
  86. package/card/card.component.d.ts +3 -0
  87. package/card/card.module.d.ts +8 -0
  88. package/card/package.json +0 -1
  89. package/card/ptsecurity-mosaic-card.d.ts +1 -0
  90. package/checkbox/checkbox-module.d.ts +7 -0
  91. package/checkbox/checkbox-required-validator.d.ts +3 -0
  92. package/checkbox/checkbox.d.ts +3 -0
  93. package/checkbox/package.json +0 -1
  94. package/checkbox/ptsecurity-mosaic-checkbox.d.ts +1 -0
  95. package/core/common-behaviors/color.d.ts +3 -3
  96. package/core/common-behaviors/common-module.d.ts +5 -0
  97. package/core/common-behaviors/disabled.d.ts +4 -3
  98. package/core/common-behaviors/tabindex.d.ts +2 -1
  99. package/core/error/error-options.d.ts +5 -0
  100. package/core/formatters/date/formatter.d.ts +3 -0
  101. package/core/formatters/index.d.ts +5 -0
  102. package/core/formatters/number/formatter.d.ts +4 -0
  103. package/core/forms/forms-module.d.ts +5 -0
  104. package/core/forms/forms.directive.d.ts +5 -0
  105. package/core/highlight/highlight.pipe.d.ts +3 -0
  106. package/core/highlight/index.d.ts +6 -0
  107. package/core/line/line.d.ts +6 -0
  108. package/core/option/action.d.ts +42 -0
  109. package/core/option/index.d.ts +1 -0
  110. package/core/option/optgroup.d.ts +3 -0
  111. package/core/option/option-module.d.ts +9 -0
  112. package/core/option/option.d.ts +3 -0
  113. package/core/overlay/overlay-position-map.d.ts +0 -4
  114. package/core/package.json +0 -1
  115. package/core/pop-up/constants.d.ts +29 -0
  116. package/core/pop-up/index.d.ts +3 -0
  117. package/core/pop-up/pop-up-trigger.d.ts +70 -0
  118. package/core/pop-up/pop-up.d.ts +35 -0
  119. package/core/ptsecurity-mosaic-core.d.ts +1 -1
  120. package/core/public-api.d.ts +1 -0
  121. package/core/selection/pseudo-checkbox/pseudo-checkbox.d.ts +3 -0
  122. package/core/selection/pseudo-checkbox/pseudo-checkbox.module.d.ts +6 -0
  123. package/core/services/measure-scrollbar.service.d.ts +3 -0
  124. package/datepicker/calendar-body.component.d.ts +5 -6
  125. package/datepicker/calendar.component.d.ts +5 -0
  126. package/datepicker/datepicker-input.directive.d.ts +6 -2
  127. package/datepicker/datepicker-intl.d.ts +3 -0
  128. package/datepicker/datepicker-module.d.ts +18 -0
  129. package/datepicker/datepicker-toggle.component.d.ts +5 -0
  130. package/datepicker/datepicker.component.d.ts +5 -0
  131. package/datepicker/month-view.component.d.ts +3 -0
  132. package/datepicker/multi-year-view.component.d.ts +3 -0
  133. package/datepicker/package.json +0 -1
  134. package/datepicker/ptsecurity-mosaic-datepicker.d.ts +1 -0
  135. package/datepicker/year-view.component.d.ts +3 -0
  136. package/design-tokens/package.json +0 -1
  137. package/design-tokens/ptsecurity-mosaic-design-tokens.d.ts +1 -0
  138. package/design-tokens/tokens/components/list.json5 +0 -4
  139. package/design-tokens/tokens/components/popover.json5 +32 -4
  140. package/design-tokens/tokens/components/tooltip.json5 +49 -3
  141. package/design-tokens/tokens/components/tree.json5 +3 -3
  142. package/design-tokens/tokens/properties/globals.json5 +1 -1
  143. package/design-tokens/tokens.d.ts +56 -15
  144. package/divider/divider.component.d.ts +3 -0
  145. package/divider/divider.module.d.ts +6 -0
  146. package/divider/package.json +0 -1
  147. package/divider/ptsecurity-mosaic-divider.d.ts +1 -0
  148. package/dropdown/dropdown-content.directive.d.ts +3 -0
  149. package/dropdown/dropdown-item.component.d.ts +3 -0
  150. package/dropdown/dropdown-trigger.directive.d.ts +6 -8
  151. package/dropdown/dropdown.component.d.ts +5 -1
  152. package/dropdown/dropdown.module.d.ts +11 -0
  153. package/dropdown/package.json +0 -1
  154. package/dropdown/ptsecurity-mosaic-dropdown.d.ts +1 -0
  155. package/esm2015/autocomplete/autocomplete-origin.directive.js +11 -11
  156. package/esm2015/autocomplete/autocomplete-trigger.directive.js +53 -38
  157. package/esm2015/autocomplete/autocomplete.component.js +56 -37
  158. package/esm2015/autocomplete/autocomplete.module.js +25 -15
  159. package/esm2015/button/button.component.js +52 -56
  160. package/esm2015/button/button.module.js +35 -20
  161. package/esm2015/button-toggle/button-toggle.component.js +76 -55
  162. package/esm2015/button-toggle/button-toggle.module.js +13 -8
  163. package/esm2015/card/card.component.js +32 -30
  164. package/esm2015/card/card.module.js +23 -12
  165. package/esm2015/checkbox/checkbox-module.js +13 -8
  166. package/esm2015/checkbox/checkbox-required-validator.js +12 -8
  167. package/esm2015/checkbox/checkbox.js +61 -44
  168. package/esm2015/core/common-behaviors/color.js +2 -5
  169. package/esm2015/core/common-behaviors/common-module.js +17 -11
  170. package/esm2015/core/common-behaviors/disabled.js +1 -1
  171. package/esm2015/core/common-behaviors/tabindex.js +4 -13
  172. package/esm2015/core/error/error-options.js +12 -8
  173. package/esm2015/core/formatters/date/formatter.js +13 -10
  174. package/esm2015/core/formatters/index.js +13 -8
  175. package/esm2015/core/formatters/number/formatter.js +16 -10
  176. package/esm2015/core/forms/forms-module.js +20 -13
  177. package/esm2015/core/forms/forms.directive.js +32 -29
  178. package/esm2015/core/highlight/highlight.pipe.js +8 -4
  179. package/esm2015/core/highlight/index.js +13 -8
  180. package/esm2015/core/line/line.js +22 -14
  181. package/esm2015/core/option/action.js +131 -0
  182. package/esm2015/core/option/index.js +2 -1
  183. package/esm2015/core/option/optgroup.js +22 -19
  184. package/esm2015/core/option/option-module.js +14 -8
  185. package/esm2015/core/option/option.js +44 -35
  186. package/esm2015/core/overlay/overlay-position-map.js +16 -18
  187. package/esm2015/core/pop-up/constants.js +34 -0
  188. package/esm2015/core/pop-up/index.js +4 -0
  189. package/esm2015/core/pop-up/pop-up-trigger.js +241 -0
  190. package/esm2015/core/pop-up/pop-up.js +87 -0
  191. package/esm2015/core/ptsecurity-mosaic-core.js +1 -2
  192. package/esm2015/core/public-api.js +2 -1
  193. package/esm2015/core/selection/pseudo-checkbox/pseudo-checkbox.js +25 -21
  194. package/esm2015/core/selection/pseudo-checkbox/pseudo-checkbox.module.js +13 -8
  195. package/esm2015/core/services/measure-scrollbar.service.js +12 -12
  196. package/esm2015/datepicker/calendar-body.component.js +39 -32
  197. package/esm2015/datepicker/calendar.component.js +92 -58
  198. package/esm2015/datepicker/datepicker-input.directive.js +92 -61
  199. package/esm2015/datepicker/datepicker-intl.js +7 -5
  200. package/esm2015/datepicker/datepicker-module.js +89 -48
  201. package/esm2015/datepicker/datepicker-toggle.component.js +44 -32
  202. package/esm2015/datepicker/datepicker.component.js +88 -63
  203. package/esm2015/datepicker/month-view.component.js +48 -29
  204. package/esm2015/datepicker/multi-year-view.component.js +40 -27
  205. package/esm2015/datepicker/year-view.component.js +45 -28
  206. package/esm2015/design-tokens/tokens.js +57 -16
  207. package/esm2015/divider/divider.component.js +24 -20
  208. package/esm2015/divider/divider.module.js +13 -8
  209. package/esm2015/dropdown/dropdown-content.directive.js +13 -15
  210. package/esm2015/dropdown/dropdown-item.component.js +40 -30
  211. package/esm2015/dropdown/dropdown-trigger.directive.js +75 -67
  212. package/esm2015/dropdown/dropdown.component.js +63 -38
  213. package/esm2015/dropdown/dropdown.module.js +40 -23
  214. package/esm2015/form-field/cleaner.js +20 -11
  215. package/esm2015/form-field/form-field.js +77 -53
  216. package/esm2015/form-field/form-field.module.js +41 -24
  217. package/esm2015/form-field/hint.js +16 -13
  218. package/esm2015/form-field/prefix.js +10 -6
  219. package/esm2015/form-field/stepper.js +22 -11
  220. package/esm2015/form-field/suffix.js +10 -6
  221. package/esm2015/icon/icon.component.js +27 -22
  222. package/esm2015/icon/icon.module.js +31 -18
  223. package/esm2015/input/input-number-validators.js +48 -29
  224. package/esm2015/input/input-number.js +42 -28
  225. package/esm2015/input/input.js +94 -52
  226. package/esm2015/input/input.module.js +13 -8
  227. package/esm2015/link/link.component.js +38 -34
  228. package/esm2015/link/link.module.js +20 -11
  229. package/esm2015/list/list-selection.component.js +224 -122
  230. package/esm2015/list/list.component.js +35 -32
  231. package/esm2015/list/list.module.js +47 -25
  232. package/esm2015/modal/css-unit.pipe.js +10 -6
  233. package/esm2015/modal/modal-control.service.js +11 -8
  234. package/esm2015/modal/modal.component.js +107 -61
  235. package/esm2015/modal/modal.directive.js +43 -30
  236. package/esm2015/modal/modal.module.js +59 -31
  237. package/esm2015/modal/modal.service.js +9 -9
  238. package/esm2015/modal/ptsecurity-mosaic-modal.js +1 -3
  239. package/esm2015/navbar/navbar-item.component.js +111 -95
  240. package/esm2015/navbar/navbar.component.js +40 -30
  241. package/esm2015/navbar/navbar.module.js +66 -35
  242. package/esm2015/navbar/ptsecurity-mosaic-navbar.js +1 -2
  243. package/esm2015/navbar/vertical-navbar.component.js +68 -46
  244. package/esm2015/popover/popover-confirm.component.js +115 -0
  245. package/esm2015/popover/popover.component.js +180 -587
  246. package/esm2015/popover/popover.module.js +18 -12
  247. package/esm2015/popover/public-api.js +2 -1
  248. package/esm2015/progress-bar/progress-bar.component.js +26 -24
  249. package/esm2015/progress-bar/progress-bar.module.js +24 -15
  250. package/esm2015/progress-spinner/progress-spinner.component.js +26 -24
  251. package/esm2015/progress-spinner/progress-spinner.module.js +24 -15
  252. package/esm2015/radio/radio.component.js +87 -67
  253. package/esm2015/radio/radio.module.js +13 -8
  254. package/esm2015/select/select.component.js +181 -105
  255. package/esm2015/select/select.module.js +54 -28
  256. package/esm2015/sidebar/ptsecurity-mosaic-sidebar.js +1 -2
  257. package/esm2015/sidebar/sidebar.component.js +61 -50
  258. package/esm2015/sidebar/sidebar.module.js +25 -16
  259. package/esm2015/sidepanel/ptsecurity-mosaic-sidepanel.js +1 -2
  260. package/esm2015/sidepanel/sidepanel-container.component.js +46 -40
  261. package/esm2015/sidepanel/sidepanel-directives.js +87 -57
  262. package/esm2015/sidepanel/sidepanel.module.js +63 -30
  263. package/esm2015/sidepanel/sidepanel.service.js +20 -12
  264. package/esm2015/splitter/splitter.component.js +62 -64
  265. package/esm2015/splitter/splitter.module.js +32 -19
  266. package/esm2015/table/table.component.js +13 -9
  267. package/esm2015/table/table.module.js +23 -12
  268. package/esm2015/tabs/paginated-tab-header.js +20 -18
  269. package/esm2015/tabs/ptsecurity-mosaic-tabs.js +1 -6
  270. package/esm2015/tabs/tab-body.component.js +52 -42
  271. package/esm2015/tabs/tab-content.directive.js +8 -8
  272. package/esm2015/tabs/tab-group.component.js +145 -74
  273. package/esm2015/tabs/tab-header.component.js +50 -36
  274. package/esm2015/tabs/tab-label-wrapper.directive.js +30 -16
  275. package/esm2015/tabs/tab-label.directive.js +11 -7
  276. package/esm2015/tabs/tab-nav-bar/tab-nav-bar.js +46 -46
  277. package/esm2015/tabs/tab.component.js +67 -33
  278. package/esm2015/tabs/tabs.module.js +87 -45
  279. package/esm2015/tags/tag-input.js +48 -34
  280. package/esm2015/tags/tag-list.component.js +93 -56
  281. package/esm2015/tags/tag.component.js +90 -73
  282. package/esm2015/tags/tag.module.js +46 -29
  283. package/esm2015/textarea/textarea.component.js +70 -41
  284. package/esm2015/textarea/textarea.module.js +13 -8
  285. package/esm2015/timepicker/timepicker.directive.js +64 -52
  286. package/esm2015/timepicker/timepicker.module.js +26 -13
  287. package/esm2015/toggle/toggle.component.js +65 -47
  288. package/esm2015/toggle/toggle.module.js +13 -8
  289. package/esm2015/tooltip/tooltip.animations.js +19 -0
  290. package/esm2015/tooltip/tooltip.component.js +239 -555
  291. package/esm2015/tooltip/tooltip.module.js +38 -11
  292. package/esm2015/tree/control/base-tree-control.js +60 -0
  293. package/esm2015/tree/control/flat-tree-control.js +123 -0
  294. package/esm2015/tree/control/nested-tree-control.js +41 -0
  295. package/esm2015/tree/control/tree-control.js +2 -0
  296. package/esm2015/tree/data-source/flat-data-source.js +1 -1
  297. package/esm2015/tree/node.js +31 -0
  298. package/esm2015/tree/outlet.js +15 -0
  299. package/esm2015/tree/padding.directive.js +98 -25
  300. package/esm2015/tree/public-api.js +9 -2
  301. package/esm2015/tree/toggle.js +65 -70
  302. package/esm2015/tree/tree-base.js +243 -0
  303. package/esm2015/tree/tree-errors.js +36 -0
  304. package/esm2015/tree/tree-option.component.js +102 -56
  305. package/esm2015/tree/tree-selection.component.js +180 -115
  306. package/esm2015/tree/tree.js +23 -0
  307. package/esm2015/tree/tree.module.js +38 -12
  308. package/esm2015/tree-select/tree-select.component.js +153 -85
  309. package/esm2015/tree-select/tree-select.module.js +33 -18
  310. package/fesm2015/ptsecurity-mosaic-autocomplete.js +140 -102
  311. package/fesm2015/ptsecurity-mosaic-autocomplete.js.map +1 -1
  312. package/fesm2015/ptsecurity-mosaic-button-toggle.js +87 -63
  313. package/fesm2015/ptsecurity-mosaic-button-toggle.js.map +1 -1
  314. package/fesm2015/ptsecurity-mosaic-button.js +86 -76
  315. package/fesm2015/ptsecurity-mosaic-button.js.map +1 -1
  316. package/fesm2015/ptsecurity-mosaic-card.js +54 -42
  317. package/fesm2015/ptsecurity-mosaic-card.js.map +1 -1
  318. package/fesm2015/ptsecurity-mosaic-checkbox.js +82 -59
  319. package/fesm2015/ptsecurity-mosaic-checkbox.js.map +1 -1
  320. package/fesm2015/ptsecurity-mosaic-core.js +758 -239
  321. package/fesm2015/ptsecurity-mosaic-core.js.map +1 -1
  322. package/fesm2015/ptsecurity-mosaic-datepicker.js +544 -376
  323. package/fesm2015/ptsecurity-mosaic-datepicker.js.map +1 -1
  324. package/fesm2015/ptsecurity-mosaic-design-tokens.js +57 -16
  325. package/fesm2015/ptsecurity-mosaic-design-tokens.js.map +1 -1
  326. package/fesm2015/ptsecurity-mosaic-divider.js +34 -26
  327. package/fesm2015/ptsecurity-mosaic-divider.js.map +1 -1
  328. package/fesm2015/ptsecurity-mosaic-dropdown.js +219 -171
  329. package/fesm2015/ptsecurity-mosaic-dropdown.js.map +1 -1
  330. package/fesm2015/ptsecurity-mosaic-form-field.js +184 -119
  331. package/fesm2015/ptsecurity-mosaic-form-field.js.map +1 -1
  332. package/fesm2015/ptsecurity-mosaic-icon.js +56 -39
  333. package/fesm2015/ptsecurity-mosaic-icon.js.map +1 -1
  334. package/fesm2015/ptsecurity-mosaic-input.js +191 -116
  335. package/fesm2015/ptsecurity-mosaic-input.js.map +1 -1
  336. package/fesm2015/ptsecurity-mosaic-link.js +57 -45
  337. package/fesm2015/ptsecurity-mosaic-link.js.map +1 -1
  338. package/fesm2015/ptsecurity-mosaic-list.js +301 -177
  339. package/fesm2015/ptsecurity-mosaic-list.js.map +1 -1
  340. package/fesm2015/ptsecurity-mosaic-modal.js +243 -159
  341. package/fesm2015/ptsecurity-mosaic-modal.js.map +1 -1
  342. package/fesm2015/ptsecurity-mosaic-navbar.js +280 -205
  343. package/fesm2015/ptsecurity-mosaic-navbar.js.map +1 -1
  344. package/fesm2015/ptsecurity-mosaic-popover.js +297 -597
  345. package/fesm2015/ptsecurity-mosaic-popover.js.map +1 -1
  346. package/fesm2015/ptsecurity-mosaic-progress-bar.js +48 -38
  347. package/fesm2015/ptsecurity-mosaic-progress-bar.js.map +1 -1
  348. package/fesm2015/ptsecurity-mosaic-progress-spinner.js +48 -38
  349. package/fesm2015/ptsecurity-mosaic-progress-spinner.js.map +1 -1
  350. package/fesm2015/ptsecurity-mosaic-radio.js +99 -76
  351. package/fesm2015/ptsecurity-mosaic-radio.js.map +1 -1
  352. package/fesm2015/ptsecurity-mosaic-select.js +236 -136
  353. package/fesm2015/ptsecurity-mosaic-select.js.map +1 -1
  354. package/fesm2015/ptsecurity-mosaic-sidebar.js +85 -66
  355. package/fesm2015/ptsecurity-mosaic-sidebar.js.map +1 -1
  356. package/fesm2015/ptsecurity-mosaic-sidepanel.js +207 -139
  357. package/fesm2015/ptsecurity-mosaic-sidepanel.js.map +1 -1
  358. package/fesm2015/ptsecurity-mosaic-splitter.js +92 -82
  359. package/fesm2015/ptsecurity-mosaic-splitter.js.map +1 -1
  360. package/fesm2015/ptsecurity-mosaic-table.js +33 -19
  361. package/fesm2015/ptsecurity-mosaic-table.js.map +1 -1
  362. package/fesm2015/ptsecurity-mosaic-tabs.js +557 -387
  363. package/fesm2015/ptsecurity-mosaic-tabs.js.map +1 -1
  364. package/fesm2015/ptsecurity-mosaic-tags.js +273 -192
  365. package/fesm2015/ptsecurity-mosaic-tags.js.map +1 -1
  366. package/fesm2015/ptsecurity-mosaic-textarea.js +83 -50
  367. package/fesm2015/ptsecurity-mosaic-textarea.js.map +1 -1
  368. package/fesm2015/ptsecurity-mosaic-timepicker.js +87 -64
  369. package/fesm2015/ptsecurity-mosaic-timepicker.js.map +1 -1
  370. package/fesm2015/ptsecurity-mosaic-toggle.js +77 -55
  371. package/fesm2015/ptsecurity-mosaic-toggle.js.map +1 -1
  372. package/fesm2015/ptsecurity-mosaic-tooltip.js +293 -566
  373. package/fesm2015/ptsecurity-mosaic-tooltip.js.map +1 -1
  374. package/fesm2015/ptsecurity-mosaic-tree-select.js +188 -106
  375. package/fesm2015/ptsecurity-mosaic-tree-select.js.map +1 -1
  376. package/fesm2015/ptsecurity-mosaic-tree.js +1001 -279
  377. package/fesm2015/ptsecurity-mosaic-tree.js.map +1 -1
  378. package/form-field/cleaner.d.ts +5 -0
  379. package/form-field/form-field.d.ts +5 -0
  380. package/form-field/form-field.module.d.ts +12 -0
  381. package/form-field/hint.d.ts +3 -0
  382. package/form-field/package.json +0 -1
  383. package/form-field/prefix.d.ts +3 -0
  384. package/form-field/ptsecurity-mosaic-form-field.d.ts +1 -0
  385. package/form-field/stepper.d.ts +3 -0
  386. package/form-field/suffix.d.ts +3 -0
  387. package/icon/icon.component.d.ts +5 -0
  388. package/icon/icon.module.d.ts +8 -0
  389. package/icon/package.json +0 -1
  390. package/icon/ptsecurity-mosaic-icon.d.ts +1 -0
  391. package/input/input-number-validators.d.ts +7 -2
  392. package/input/input-number.d.ts +3 -0
  393. package/input/input.d.ts +5 -0
  394. package/input/input.module.d.ts +11 -0
  395. package/input/package.json +0 -1
  396. package/input/ptsecurity-mosaic-input.d.ts +1 -0
  397. package/link/link.component.d.ts +3 -0
  398. package/link/link.module.d.ts +7 -0
  399. package/link/package.json +0 -1
  400. package/link/ptsecurity-mosaic-link.d.ts +1 -0
  401. package/list/list-selection.component.d.ts +30 -3
  402. package/list/list.component.d.ts +5 -0
  403. package/list/list.module.d.ts +9 -0
  404. package/list/package.json +0 -1
  405. package/list/ptsecurity-mosaic-list.d.ts +1 -0
  406. package/modal/css-unit.pipe.d.ts +3 -0
  407. package/modal/modal-control.service.d.ts +3 -0
  408. package/modal/modal.component.d.ts +5 -0
  409. package/modal/modal.directive.d.ts +9 -0
  410. package/modal/modal.module.d.ts +12 -0
  411. package/modal/modal.service.d.ts +3 -0
  412. package/modal/package.json +0 -1
  413. package/modal/ptsecurity-mosaic-modal.d.ts +1 -2
  414. package/navbar/navbar-item.component.d.ts +13 -0
  415. package/navbar/navbar.component.d.ts +5 -0
  416. package/navbar/navbar.module.d.ts +11 -0
  417. package/navbar/package.json +0 -1
  418. package/navbar/ptsecurity-mosaic-navbar.d.ts +1 -1
  419. package/navbar/vertical-navbar.component.d.ts +5 -0
  420. package/package.json +8 -9
  421. package/popover/package.json +0 -1
  422. package/popover/popover-confirm.component.d.ts +33 -0
  423. package/popover/popover.component.d.ts +50 -136
  424. package/popover/popover.module.d.ts +9 -0
  425. package/popover/ptsecurity-mosaic-popover.d.ts +1 -0
  426. package/popover/public-api.d.ts +1 -0
  427. package/prebuilt-themes/dark-theme.css +1 -1
  428. package/prebuilt-themes/default-theme.css +1 -1
  429. package/prebuilt-visual/default-visual.css +1 -0
  430. package/progress-bar/package.json +0 -1
  431. package/progress-bar/progress-bar.component.d.ts +3 -0
  432. package/progress-bar/progress-bar.module.d.ts +7 -0
  433. package/progress-bar/ptsecurity-mosaic-progress-bar.d.ts +1 -0
  434. package/progress-spinner/package.json +0 -1
  435. package/progress-spinner/progress-spinner.component.d.ts +3 -0
  436. package/progress-spinner/progress-spinner.module.d.ts +7 -0
  437. package/progress-spinner/ptsecurity-mosaic-progress-spinner.d.ts +1 -0
  438. package/ptsecurity-mosaic.d.ts +1 -0
  439. package/radio/package.json +0 -1
  440. package/radio/ptsecurity-mosaic-radio.d.ts +1 -0
  441. package/radio/radio.component.d.ts +5 -0
  442. package/radio/radio.module.d.ts +8 -0
  443. package/schematics/ng-update/update-9.0.0/secondary-entry-points-migration.js +6 -3
  444. package/schematics/ng-update/update-9.0.0/secondary-entry-points-migration.js.map +1 -1
  445. package/select/package.json +0 -1
  446. package/select/ptsecurity-mosaic-select.d.ts +1 -0
  447. package/select/select.component.d.ts +11 -7
  448. package/select/select.module.d.ts +11 -0
  449. package/sidebar/package.json +0 -1
  450. package/sidebar/ptsecurity-mosaic-sidebar.d.ts +1 -1
  451. package/sidebar/sidebar.component.d.ts +7 -0
  452. package/sidebar/sidebar.module.d.ts +6 -0
  453. package/sidepanel/package.json +0 -1
  454. package/sidepanel/ptsecurity-mosaic-sidepanel.d.ts +1 -1
  455. package/sidepanel/sidepanel-container.component.d.ts +3 -0
  456. package/sidepanel/sidepanel-directives.d.ts +13 -0
  457. package/sidepanel/sidepanel.module.d.ts +13 -0
  458. package/sidepanel/sidepanel.service.d.ts +3 -0
  459. package/splitter/package.json +0 -1
  460. package/splitter/ptsecurity-mosaic-splitter.d.ts +1 -0
  461. package/splitter/splitter.component.d.ts +7 -0
  462. package/splitter/splitter.module.d.ts +7 -0
  463. package/table/package.json +0 -1
  464. package/table/ptsecurity-mosaic-table.d.ts +1 -0
  465. package/table/table.component.d.ts +3 -0
  466. package/table/table.module.d.ts +8 -0
  467. package/tabs/package.json +0 -1
  468. package/tabs/paginated-tab-header.d.ts +3 -0
  469. package/tabs/ptsecurity-mosaic-tabs.d.ts +1 -5
  470. package/tabs/tab-body.component.d.ts +5 -0
  471. package/tabs/tab-content.directive.d.ts +3 -0
  472. package/tabs/tab-group.component.d.ts +24 -4
  473. package/tabs/tab-header.component.d.ts +3 -0
  474. package/tabs/tab-label-wrapper.directive.d.ts +9 -0
  475. package/tabs/tab-label.directive.d.ts +3 -0
  476. package/tabs/tab-nav-bar/tab-nav-bar.d.ts +5 -0
  477. package/tabs/tab.component.d.ts +12 -3
  478. package/tabs/tabs.module.d.ts +18 -0
  479. package/tags/package.json +0 -1
  480. package/tags/ptsecurity-mosaic-tags.d.ts +1 -0
  481. package/tags/tag-input.d.ts +3 -0
  482. package/tags/tag-list.component.d.ts +3 -0
  483. package/tags/tag.component.d.ts +9 -0
  484. package/tags/tag.module.d.ts +9 -0
  485. package/textarea/package.json +0 -1
  486. package/textarea/ptsecurity-mosaic-textarea.d.ts +1 -0
  487. package/textarea/textarea.component.d.ts +3 -0
  488. package/textarea/textarea.module.d.ts +9 -0
  489. package/timepicker/package.json +0 -1
  490. package/timepicker/ptsecurity-mosaic-timepicker.d.ts +1 -0
  491. package/timepicker/timepicker.directive.d.ts +5 -2
  492. package/timepicker/timepicker.module.d.ts +9 -0
  493. package/toggle/package.json +0 -1
  494. package/toggle/ptsecurity-mosaic-toggle.d.ts +1 -0
  495. package/toggle/toggle.component.d.ts +3 -0
  496. package/toggle/toggle.module.d.ts +8 -0
  497. package/tooltip/package.json +0 -1
  498. package/tooltip/ptsecurity-mosaic-tooltip.d.ts +1 -0
  499. package/tooltip/tooltip.animations.d.ts +8 -0
  500. package/tooltip/tooltip.component.d.ts +74 -134
  501. package/tooltip/tooltip.module.d.ts +7 -0
  502. package/tree/control/base-tree-control.d.ts +40 -0
  503. package/tree/control/flat-tree-control.d.ts +48 -0
  504. package/tree/control/nested-tree-control.d.ts +19 -0
  505. package/tree/control/tree-control.d.ts +44 -0
  506. package/tree/data-source/flat-data-source.d.ts +2 -1
  507. package/tree/node.d.ts +34 -0
  508. package/tree/outlet.d.ts +9 -0
  509. package/tree/package.json +0 -1
  510. package/tree/padding.directive.d.ts +36 -5
  511. package/tree/ptsecurity-mosaic-tree.d.ts +1 -0
  512. package/tree/public-api.d.ts +8 -1
  513. package/tree/toggle.d.ts +20 -15
  514. package/tree/tree-base.d.ts +97 -0
  515. package/tree/tree-errors.d.ts +25 -0
  516. package/tree/tree-option.component.d.ts +15 -4
  517. package/tree/tree-selection.component.d.ts +46 -24
  518. package/tree/tree.d.ts +6 -0
  519. package/tree/tree.module.d.ts +14 -0
  520. package/tree-select/package.json +0 -1
  521. package/tree-select/ptsecurity-mosaic-tree-select.d.ts +1 -0
  522. package/tree-select/tree-select.component.d.ts +8 -8
  523. package/tree-select/tree-select.module.d.ts +11 -0
  524. package/autocomplete/ptsecurity-mosaic-autocomplete.metadata.json +0 -1
  525. package/bundles/ptsecurity-mosaic-autocomplete.umd.min.js +0 -2
  526. package/bundles/ptsecurity-mosaic-autocomplete.umd.min.js.map +0 -1
  527. package/bundles/ptsecurity-mosaic-button-toggle.umd.min.js +0 -16
  528. package/bundles/ptsecurity-mosaic-button-toggle.umd.min.js.map +0 -1
  529. package/bundles/ptsecurity-mosaic-button.umd.min.js +0 -16
  530. package/bundles/ptsecurity-mosaic-button.umd.min.js.map +0 -1
  531. package/bundles/ptsecurity-mosaic-card.umd.min.js +0 -16
  532. package/bundles/ptsecurity-mosaic-card.umd.min.js.map +0 -1
  533. package/bundles/ptsecurity-mosaic-checkbox.umd.min.js +0 -16
  534. package/bundles/ptsecurity-mosaic-checkbox.umd.min.js.map +0 -1
  535. package/bundles/ptsecurity-mosaic-core.umd.min.js +0 -17
  536. package/bundles/ptsecurity-mosaic-core.umd.min.js.map +0 -1
  537. package/bundles/ptsecurity-mosaic-datepicker.umd.min.js +0 -2
  538. package/bundles/ptsecurity-mosaic-datepicker.umd.min.js.map +0 -1
  539. package/bundles/ptsecurity-mosaic-design-tokens.umd.min.js +0 -2
  540. package/bundles/ptsecurity-mosaic-design-tokens.umd.min.js.map +0 -1
  541. package/bundles/ptsecurity-mosaic-divider.umd.min.js +0 -2
  542. package/bundles/ptsecurity-mosaic-divider.umd.min.js.map +0 -1
  543. package/bundles/ptsecurity-mosaic-dropdown.umd.min.js +0 -17
  544. package/bundles/ptsecurity-mosaic-dropdown.umd.min.js.map +0 -1
  545. package/bundles/ptsecurity-mosaic-form-field.umd.min.js +0 -17
  546. package/bundles/ptsecurity-mosaic-form-field.umd.min.js.map +0 -1
  547. package/bundles/ptsecurity-mosaic-icon.umd.min.js +0 -16
  548. package/bundles/ptsecurity-mosaic-icon.umd.min.js.map +0 -1
  549. package/bundles/ptsecurity-mosaic-input.umd.min.js +0 -16
  550. package/bundles/ptsecurity-mosaic-input.umd.min.js.map +0 -1
  551. package/bundles/ptsecurity-mosaic-link.umd.min.js +0 -16
  552. package/bundles/ptsecurity-mosaic-link.umd.min.js.map +0 -1
  553. package/bundles/ptsecurity-mosaic-list.umd.min.js +0 -16
  554. package/bundles/ptsecurity-mosaic-list.umd.min.js.map +0 -1
  555. package/bundles/ptsecurity-mosaic-modal.umd.min.js +0 -16
  556. package/bundles/ptsecurity-mosaic-modal.umd.min.js.map +0 -1
  557. package/bundles/ptsecurity-mosaic-navbar.umd.min.js +0 -16
  558. package/bundles/ptsecurity-mosaic-navbar.umd.min.js.map +0 -1
  559. package/bundles/ptsecurity-mosaic-popover.umd.min.js +0 -16
  560. package/bundles/ptsecurity-mosaic-popover.umd.min.js.map +0 -1
  561. package/bundles/ptsecurity-mosaic-progress-bar.umd.min.js +0 -16
  562. package/bundles/ptsecurity-mosaic-progress-bar.umd.min.js.map +0 -1
  563. package/bundles/ptsecurity-mosaic-progress-spinner.umd.min.js +0 -16
  564. package/bundles/ptsecurity-mosaic-progress-spinner.umd.min.js.map +0 -1
  565. package/bundles/ptsecurity-mosaic-radio.umd.min.js +0 -16
  566. package/bundles/ptsecurity-mosaic-radio.umd.min.js.map +0 -1
  567. package/bundles/ptsecurity-mosaic-select.umd.min.js +0 -16
  568. package/bundles/ptsecurity-mosaic-select.umd.min.js.map +0 -1
  569. package/bundles/ptsecurity-mosaic-sidebar.umd.min.js +0 -2
  570. package/bundles/ptsecurity-mosaic-sidebar.umd.min.js.map +0 -1
  571. package/bundles/ptsecurity-mosaic-sidepanel.umd.min.js +0 -2
  572. package/bundles/ptsecurity-mosaic-sidepanel.umd.min.js.map +0 -1
  573. package/bundles/ptsecurity-mosaic-splitter.umd.min.js +0 -2
  574. package/bundles/ptsecurity-mosaic-splitter.umd.min.js.map +0 -1
  575. package/bundles/ptsecurity-mosaic-table.umd.min.js +0 -2
  576. package/bundles/ptsecurity-mosaic-table.umd.min.js.map +0 -1
  577. package/bundles/ptsecurity-mosaic-tabs.umd.min.js +0 -16
  578. package/bundles/ptsecurity-mosaic-tabs.umd.min.js.map +0 -1
  579. package/bundles/ptsecurity-mosaic-tags.umd.min.js +0 -16
  580. package/bundles/ptsecurity-mosaic-tags.umd.min.js.map +0 -1
  581. package/bundles/ptsecurity-mosaic-textarea.umd.min.js +0 -16
  582. package/bundles/ptsecurity-mosaic-textarea.umd.min.js.map +0 -1
  583. package/bundles/ptsecurity-mosaic-timepicker.umd.min.js +0 -2
  584. package/bundles/ptsecurity-mosaic-timepicker.umd.min.js.map +0 -1
  585. package/bundles/ptsecurity-mosaic-toggle.umd.min.js +0 -16
  586. package/bundles/ptsecurity-mosaic-toggle.umd.min.js.map +0 -1
  587. package/bundles/ptsecurity-mosaic-tooltip.umd.min.js +0 -16
  588. package/bundles/ptsecurity-mosaic-tooltip.umd.min.js.map +0 -1
  589. package/bundles/ptsecurity-mosaic-tree-select.umd.min.js +0 -16
  590. package/bundles/ptsecurity-mosaic-tree-select.umd.min.js.map +0 -1
  591. package/bundles/ptsecurity-mosaic-tree.umd.min.js +0 -16
  592. package/bundles/ptsecurity-mosaic-tree.umd.min.js.map +0 -1
  593. package/bundles/ptsecurity-mosaic.umd.min.js +0 -2
  594. package/bundles/ptsecurity-mosaic.umd.min.js.map +0 -1
  595. package/button/ptsecurity-mosaic-button.metadata.json +0 -1
  596. package/button-toggle/ptsecurity-mosaic-button-toggle.metadata.json +0 -1
  597. package/card/ptsecurity-mosaic-card.metadata.json +0 -1
  598. package/checkbox/ptsecurity-mosaic-checkbox.metadata.json +0 -1
  599. package/core/ptsecurity-mosaic-core.metadata.json +0 -1
  600. package/datepicker/ptsecurity-mosaic-datepicker.metadata.json +0 -1
  601. package/design-tokens/ptsecurity-mosaic-design-tokens.metadata.json +0 -1
  602. package/divider/ptsecurity-mosaic-divider.metadata.json +0 -1
  603. package/dropdown/ptsecurity-mosaic-dropdown.metadata.json +0 -1
  604. package/esm2015/tree/node.directive.js +0 -15
  605. package/form-field/ptsecurity-mosaic-form-field.metadata.json +0 -1
  606. package/icon/ptsecurity-mosaic-icon.metadata.json +0 -1
  607. package/input/ptsecurity-mosaic-input.metadata.json +0 -1
  608. package/link/ptsecurity-mosaic-link.metadata.json +0 -1
  609. package/list/ptsecurity-mosaic-list.metadata.json +0 -1
  610. package/modal/ptsecurity-mosaic-modal.metadata.json +0 -1
  611. package/navbar/ptsecurity-mosaic-navbar.metadata.json +0 -1
  612. package/popover/ptsecurity-mosaic-popover.metadata.json +0 -1
  613. package/progress-bar/ptsecurity-mosaic-progress-bar.metadata.json +0 -1
  614. package/progress-spinner/ptsecurity-mosaic-progress-spinner.metadata.json +0 -1
  615. package/ptsecurity-mosaic.metadata.json +0 -1
  616. package/radio/ptsecurity-mosaic-radio.metadata.json +0 -1
  617. package/select/ptsecurity-mosaic-select.metadata.json +0 -1
  618. package/sidebar/ptsecurity-mosaic-sidebar.metadata.json +0 -1
  619. package/sidepanel/ptsecurity-mosaic-sidepanel.metadata.json +0 -1
  620. package/splitter/ptsecurity-mosaic-splitter.metadata.json +0 -1
  621. package/table/ptsecurity-mosaic-table.metadata.json +0 -1
  622. package/tabs/ptsecurity-mosaic-tabs.metadata.json +0 -1
  623. package/tags/ptsecurity-mosaic-tags.metadata.json +0 -1
  624. package/textarea/ptsecurity-mosaic-textarea.metadata.json +0 -1
  625. package/timepicker/ptsecurity-mosaic-timepicker.metadata.json +0 -1
  626. package/toggle/ptsecurity-mosaic-toggle.metadata.json +0 -1
  627. package/tooltip/ptsecurity-mosaic-tooltip.metadata.json +0 -1
  628. package/tree/node.directive.d.ts +0 -4
  629. package/tree/ptsecurity-mosaic-tree.metadata.json +0 -1
  630. package/tree-select/ptsecurity-mosaic-tree-select.metadata.json +0 -1
@@ -1,41 +1,377 @@
1
+ import * as i2$1 from '@angular/common';
1
2
  import { CommonModule } from '@angular/common';
2
- import { Directive, Input, Component, ViewEncapsulation, InjectionToken, EventEmitter, ChangeDetectionStrategy, ElementRef, ChangeDetectorRef, NgZone, Inject, Output, forwardRef, QueryList, IterableDiffers, Attribute, ViewChild, ContentChildren, NgModule } from '@angular/core';
3
- import { CdkTreeNodeDef, CdkTreeNodePadding, CdkTree, CdkTreeNode, CdkTreeNodeOutlet, CdkTreeModule } from '@ptsecurity/cdk/tree';
4
- import { MultipleMode, getMcSelectNonArrayValueError, McPseudoCheckboxModule } from '@ptsecurity/mosaic/core';
5
- import { map, take, takeUntil } from 'rxjs/operators';
6
- import { coerceBooleanProperty } from '@angular/cdk/coercion';
7
- import { hasModifierKey, PAGE_DOWN, PAGE_UP, END, HOME, ENTER, SPACE, RIGHT_ARROW, LEFT_ARROW, UP_ARROW, DOWN_ARROW } from '@ptsecurity/cdk/keycodes';
8
- import { Subject, merge, BehaviorSubject } from 'rxjs';
3
+ import * as i0 from '@angular/core';
4
+ import { Directive, Input, ViewChild, ContentChildren, forwardRef, Inject, Optional, Component, ViewEncapsulation, ChangeDetectionStrategy, InjectionToken, EventEmitter, ContentChild, Output, QueryList, Attribute, NgModule } from '@angular/core';
5
+ import * as i1 from '@ptsecurity/mosaic/core';
6
+ import { mixinDisabled, MC_OPTION_ACTION_PARENT, McOptionActionComponent, MultipleMode, getMcSelectNonArrayValueError, McPseudoCheckboxModule } from '@ptsecurity/mosaic/core';
7
+ import * as i2 from '@angular/cdk/bidi';
8
+ import { coerceNumberProperty, coerceBooleanProperty } from '@angular/cdk/coercion';
9
+ import { TreeSizePaddingLeft } from '@ptsecurity/mosaic/design-tokens';
10
+ import { BehaviorSubject, Subject, Observable, of, merge } from 'rxjs';
11
+ import { takeUntil, map, take, delay } from 'rxjs/operators';
12
+ import { TAB, hasModifierKey, SPACE, LEFT_ARROW, RIGHT_ARROW, isVerticalMovement, isSelectAll, isCopy, DOWN_ARROW, UP_ARROW, ENTER, HOME, END, PAGE_UP, PAGE_DOWN } from '@ptsecurity/cdk/keycodes';
13
+ import { McDropdownTrigger } from '@ptsecurity/mosaic/dropdown';
14
+ import { McTooltipTrigger } from '@ptsecurity/mosaic/tooltip';
15
+ import * as i1$1 from '@angular/cdk/clipboard';
9
16
  import { SelectionModel, DataSource } from '@angular/cdk/collections';
10
17
  import { NG_VALUE_ACCESSOR } from '@angular/forms';
11
18
  import { FocusKeyManager } from '@ptsecurity/cdk/a11y';
12
19
 
13
- class McTreeNodeDef extends CdkTreeNodeDef {
14
- }
15
- McTreeNodeDef.decorators = [
16
- { type: Directive, args: [{
17
- selector: '[mcTreeNodeDef]',
18
- inputs: ['when: mcTreeNodeDefWhen'],
19
- providers: [{ provide: CdkTreeNodeDef, useExisting: McTreeNodeDef }]
20
- },] }
21
- ];
22
- McTreeNodeDef.propDecorators = {
23
- data: [{ type: Input, args: ['mcTreeNode',] }]
24
- };
20
+ /** Context provided to the tree node component. */
21
+ class McTreeNodeOutletContext {
22
+ constructor(data) {
23
+ this.$implicit = data;
24
+ }
25
+ }
26
+ /**
27
+ * Data node definition for the McTree.
28
+ * Captures the node's template and a when predicate that describes when this node should be used.
29
+ */
30
+ class McTreeNodeDef {
31
+ /** @docs-private */
32
+ constructor(template) {
33
+ this.template = template;
34
+ }
35
+ }
36
+ /** @nocollapse */ McTreeNodeDef.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: McTreeNodeDef, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
37
+ /** @nocollapse */ McTreeNodeDef.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.13", type: McTreeNodeDef, selector: "[mcTreeNodeDef]", inputs: { when: ["mcTreeNodeDefWhen", "when"], data: ["mcTreeNode", "data"] }, ngImport: i0 });
38
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: McTreeNodeDef, decorators: [{
39
+ type: Directive,
40
+ args: [{
41
+ selector: '[mcTreeNodeDef]',
42
+ inputs: ['when: mcTreeNodeDefWhen']
43
+ }]
44
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; }, propDecorators: { data: [{
45
+ type: Input,
46
+ args: ['mcTreeNode']
47
+ }] } });
25
48
 
26
- class McTreeNodePadding extends CdkTreeNodePadding {
27
- constructor() {
28
- super(...arguments);
29
- this.baseLeftPadding = 12;
30
- this.iconWidth = 20;
49
+ class McTreeNodeOutlet {
50
+ constructor(viewContainer, changeDetectorRef) {
51
+ this.viewContainer = viewContainer;
52
+ this.changeDetectorRef = changeDetectorRef;
53
+ }
54
+ }
55
+ /** @nocollapse */ McTreeNodeOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: McTreeNodeOutlet, deps: [{ token: i0.ViewContainerRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
56
+ /** @nocollapse */ McTreeNodeOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.13", type: McTreeNodeOutlet, selector: "[mcTreeNodeOutlet]", ngImport: i0 });
57
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: McTreeNodeOutlet, decorators: [{
58
+ type: Directive,
59
+ args: [{ selector: '[mcTreeNodeOutlet]' }]
60
+ }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.ChangeDetectorRef }]; } });
61
+
62
+ /**
63
+ * Returns an error to be thrown when there is no usable data.
64
+ * @docs-private
65
+ */
66
+ function getTreeNoValidDataSourceError() {
67
+ return Error(`A valid data source must be provided.`);
68
+ }
69
+ /**
70
+ * Returns an error to be thrown when there are multiple nodes that are missing a when function.
71
+ * @docs-private
72
+ */
73
+ function getTreeMultipleDefaultNodeDefsError() {
74
+ return Error(`There can only be one default row without a when predicate function.`);
75
+ }
76
+ /**
77
+ * Returns an error to be thrown when there are no matching node defs for a particular set of data.
78
+ * @docs-private
79
+ */
80
+ function getTreeMissingMatchingNodeDefError() {
81
+ return Error(`Could not find a matching node definition for the provided node data.`);
82
+ }
83
+ /**
84
+ * Returns an error to be thrown when there are tree control.
85
+ * @docs-private
86
+ */
87
+ function getTreeControlMissingError() {
88
+ return Error(`Could not find a tree control for the tree.`);
89
+ }
90
+ /**
91
+ * Returns an error to be thrown when tree control did not implement functions for flat/nested node.
92
+ * @docs-private
93
+ */
94
+ function getTreeControlFunctionsMissingError() {
95
+ return Error(`Could not find functions for nested/flat tree in tree control.`);
96
+ }
97
+
98
+ class McTreeBase {
99
+ constructor(differs, changeDetectorRef) {
100
+ this.differs = differs;
101
+ this.changeDetectorRef = changeDetectorRef;
102
+ // TODO(tinayuangao): Setup a listener for scrolling, emit the calculated view to viewChange.
103
+ // Remove the MAX_VALUE in viewChange
104
+ /**
105
+ * Stream containing the latest information on what rows are being displayed on screen.
106
+ * Can be used by the data source to as a heuristic of what data should be provided.
107
+ */
108
+ this.viewChange = new BehaviorSubject({ start: 0, end: Number.MAX_VALUE });
109
+ /** Subject that emits when the component has been destroyed. */
110
+ this.onDestroy = new Subject();
111
+ /** Level of nodes */
112
+ this.levels = new Map();
113
+ }
114
+ /**
115
+ * Provides a stream containing the latest data array to render. Influenced by the tree's
116
+ * stream of view window (what dataNodes are currently on screen).
117
+ * Data source can be an observable of data array, or a dara array to render.
118
+ */
119
+ get dataSource() {
120
+ return this._dataSource;
121
+ }
122
+ set dataSource(dataSource) {
123
+ if (this._dataSource !== dataSource) {
124
+ this.switchDataSource(dataSource);
125
+ }
126
+ }
127
+ ngOnInit() {
128
+ this.dataDiffer = this.differs.find([]).create(this.trackBy);
129
+ if (!this.treeControl) {
130
+ throw getTreeControlMissingError();
131
+ }
132
+ }
133
+ ngOnDestroy() {
134
+ this.nodeOutlet.viewContainer.clear();
135
+ this.onDestroy.next();
136
+ this.onDestroy.complete();
137
+ // tslint:disable-next-line:no-unbound-method
138
+ if (this._dataSource && typeof this.dataSource.disconnect === 'function') {
139
+ this.dataSource.disconnect(this);
140
+ }
141
+ if (this.dataSubscription) {
142
+ this.dataSubscription.unsubscribe();
143
+ this.dataSubscription = null;
144
+ }
145
+ }
146
+ ngAfterContentChecked() {
147
+ const defaultNodeDefs = this.nodeDefs.filter((def) => !def.when);
148
+ if (defaultNodeDefs.length > 1) {
149
+ throw getTreeMultipleDefaultNodeDefsError();
150
+ }
151
+ this.defaultNodeDef = defaultNodeDefs[0];
152
+ if (this.dataSource && this.nodeDefs && !this.dataSubscription) {
153
+ this.observeRenderChanges();
154
+ }
155
+ }
156
+ /** Check for changes made in the data and render each change (node added/removed/moved). */
157
+ renderNodeChanges(data, dataDiffer = this.dataDiffer, viewContainer = this.nodeOutlet.viewContainer, parentData) {
158
+ const changes = dataDiffer.diff(data);
159
+ if (!changes) {
160
+ return;
161
+ }
162
+ changes.forEachOperation((item, adjustedPreviousIndex, currentIndex) => {
163
+ if (item.previousIndex == null) {
164
+ this.insertNode(data[currentIndex], currentIndex, viewContainer, parentData);
165
+ }
166
+ else if (currentIndex == null) {
167
+ viewContainer.remove(adjustedPreviousIndex);
168
+ this.levels.delete(item.item);
169
+ }
170
+ else {
171
+ const view = viewContainer.get(adjustedPreviousIndex);
172
+ viewContainer.move(view, currentIndex);
173
+ }
174
+ });
175
+ this.changeDetectorRef.detectChanges();
176
+ }
177
+ /**
178
+ * Finds the matching node definition that should be used for this node data. If there is only
179
+ * one node definition, it is returned. Otherwise, find the node definition that has a when
180
+ * predicate that returns true with the data. If none return true, return the default node
181
+ * definition.
182
+ */
183
+ getNodeDef(data, i) {
184
+ if (this.nodeDefs.length === 1) {
185
+ return this.nodeDefs.first;
186
+ }
187
+ const nodeDef = this.nodeDefs.find((def) => def.when && def.when(i, data)) || this.defaultNodeDef;
188
+ if (!nodeDef) {
189
+ throw getTreeMissingMatchingNodeDefError();
190
+ }
191
+ return nodeDef;
192
+ }
193
+ /**
194
+ * Create the embedded view for the data node template and place it in the correct index location
195
+ * within the data node view container.
196
+ */
197
+ insertNode(nodeData, index, viewContainer, parentData) {
198
+ const node = this.getNodeDef(nodeData, index);
199
+ // Node context that will be provided to created embedded view
200
+ const context = new McTreeNodeOutletContext(nodeData);
201
+ // If the tree is flat tree, then use the `getLevel` function in flat tree control
202
+ // Otherwise, use the level of parent node.
203
+ if (this.treeControl.getLevel) {
204
+ context.level = this.treeControl.getLevel(nodeData);
205
+ /* tslint:disable-next-line:no-typeof-undefined */
206
+ }
207
+ else if (typeof parentData !== 'undefined' && this.levels.has(parentData)) {
208
+ context.level = this.levels.get(parentData) + 1;
209
+ }
210
+ else {
211
+ context.level = 0;
212
+ }
213
+ this.levels.set(nodeData, context.level);
214
+ // Use default tree nodeOutlet, or nested node's nodeOutlet
215
+ const container = viewContainer ? viewContainer : this.nodeOutlet.viewContainer;
216
+ container.createEmbeddedView(node.template, context, index);
217
+ // Set the data to just created `McTreeNode`.
218
+ // The `McTreeNode` created from `createEmbeddedView` will be saved in static variable
219
+ // `mostRecentTreeNode`. We get it from static variable and pass the node data to it.
220
+ if (McTreeNode.mostRecentTreeNode) {
221
+ McTreeNode.mostRecentTreeNode.data = nodeData;
222
+ }
223
+ }
224
+ /** Set up a subscription for the data provided by the data source. */
225
+ observeRenderChanges() {
226
+ let dataStream;
227
+ // Cannot use `instanceof DataSource` since the data source could be a literal with
228
+ // `connect` function and may not extends DataSource.
229
+ // tslint:disable-next-line:no-unbound-method
230
+ if (typeof this._dataSource.connect === 'function') {
231
+ dataStream = this._dataSource.connect(this);
232
+ }
233
+ else if (this._dataSource instanceof Observable) {
234
+ dataStream = this._dataSource;
235
+ }
236
+ else if (Array.isArray(this._dataSource)) {
237
+ dataStream = of(this._dataSource);
238
+ }
239
+ if (dataStream) {
240
+ this.dataSubscription = dataStream
241
+ .pipe(takeUntil(this.onDestroy))
242
+ .subscribe((data) => this.renderNodeChanges(data));
243
+ }
244
+ else {
245
+ throw getTreeNoValidDataSourceError();
246
+ }
247
+ }
248
+ /**
249
+ * Switch to the provided data source by resetting the data and unsubscribing from the current
250
+ * render change subscription if one exists. If the data source is null, interpret this by
251
+ * clearing the node outlet. Otherwise start listening for new data.
252
+ */
253
+ switchDataSource(dataSource) {
254
+ // tslint:disable-next-line:no-unbound-method
255
+ if (this._dataSource && typeof this._dataSource.disconnect === 'function') {
256
+ this.dataSource.disconnect(this);
257
+ }
258
+ if (this.dataSubscription) {
259
+ this.dataSubscription.unsubscribe();
260
+ this.dataSubscription = null;
261
+ }
262
+ // Remove the all dataNodes if there is now no data source
263
+ if (!dataSource) {
264
+ this.nodeOutlet.viewContainer.clear();
265
+ }
266
+ this._dataSource = dataSource;
267
+ if (this.nodeDefs) {
268
+ this.observeRenderChanges();
269
+ }
270
+ }
271
+ }
272
+ /** @nocollapse */ McTreeBase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: McTreeBase, deps: [{ token: i0.IterableDiffers }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
273
+ /** @nocollapse */ McTreeBase.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.13", type: McTreeBase, inputs: { treeControl: "treeControl", trackBy: "trackBy", dataSource: "dataSource" }, queries: [{ propertyName: "nodeDefs", predicate: McTreeNodeDef }], viewQueries: [{ propertyName: "nodeOutlet", first: true, predicate: McTreeNodeOutlet, descendants: true, static: true }], ngImport: i0 });
274
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: McTreeBase, decorators: [{
275
+ type: Directive
276
+ }], ctorParameters: function () { return [{ type: i0.IterableDiffers }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { treeControl: [{
277
+ type: Input
278
+ }], trackBy: [{
279
+ type: Input
280
+ }], nodeOutlet: [{
281
+ type: ViewChild,
282
+ args: [McTreeNodeOutlet, { static: true }]
283
+ }], nodeDefs: [{
284
+ type: ContentChildren,
285
+ args: [McTreeNodeDef]
286
+ }], dataSource: [{
287
+ type: Input
288
+ }] } });
289
+ class McTreeNode {
290
+ constructor(elementRef, tree) {
291
+ this.elementRef = elementRef;
292
+ this.tree = tree;
293
+ this.destroyed = new Subject();
294
+ McTreeNode.mostRecentTreeNode = this;
295
+ }
296
+ get data() {
297
+ return this._data;
298
+ }
299
+ set data(value) {
300
+ this._data = value;
301
+ }
302
+ get isExpanded() {
303
+ return this.tree.treeControl.isExpanded(this.data);
304
+ }
305
+ get level() {
306
+ return this.tree.treeControl.getLevel ? this.tree.treeControl.getLevel(this._data) : 0;
307
+ }
308
+ ngOnDestroy() {
309
+ this.destroyed.next();
310
+ this.destroyed.complete();
311
+ }
312
+ focus() {
313
+ this.elementRef.nativeElement.focus();
314
+ }
315
+ }
316
+ /**
317
+ * The most recently created `McTreeNode`. We save it in static variable so we can retrieve it
318
+ * in `McTree` and set the data to it.
319
+ */
320
+ McTreeNode.mostRecentTreeNode = null;
321
+ /** @nocollapse */ McTreeNode.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: McTreeNode, deps: [{ token: i0.ElementRef }, { token: forwardRef(() => McTreeBase) }], target: i0.ɵɵFactoryTarget.Directive });
322
+ /** @nocollapse */ McTreeNode.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.13", type: McTreeNode, selector: "mc-tree-node", exportAs: ["mcTreeNode"], ngImport: i0 });
323
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: McTreeNode, decorators: [{
324
+ type: Directive,
325
+ args: [{
326
+ selector: 'mc-tree-node',
327
+ exportAs: 'mcTreeNode'
328
+ }]
329
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: McTreeBase, decorators: [{
330
+ type: Inject,
331
+ args: [forwardRef(() => McTreeBase)]
332
+ }] }]; } });
333
+
334
+ /** Regex used to split a string on its CSS units. */
335
+ const cssUnitPattern = /([A-Za-z%]+)$/;
336
+ class McTreeNodePadding {
337
+ constructor(treeNode, tree, renderer, element, dir) {
338
+ var _a, _b;
339
+ this.treeNode = treeNode;
340
+ this.tree = tree;
341
+ this.renderer = renderer;
342
+ this.element = element;
343
+ this.dir = dir;
344
+ this._indent = 20;
345
+ /** CSS units used for the indentation value. */
346
+ this.indentUnits = 'px';
347
+ this.baseLeftPadding = parseInt(TreeSizePaddingLeft);
348
+ this.iconWidth = 24;
349
+ this.destroyed = new Subject();
350
+ (_b = (_a = this.dir) === null || _a === void 0 ? void 0 : _a.change) === null || _b === void 0 ? void 0 : _b.pipe(takeUntil(this.destroyed)).subscribe(() => this.setPadding());
351
+ }
352
+ get level() {
353
+ return this._level;
354
+ }
355
+ set level(value) {
356
+ this.setLevelInput(value);
357
+ }
358
+ get indent() {
359
+ return this._indent;
360
+ }
361
+ set indent(indent) {
362
+ this.setIndentInput(indent);
31
363
  }
32
- get level() { return this._level; }
33
- set level(value) { this.setLevelInput(value); }
34
- get indent() { return this._indent; }
35
- set indent(indent) { this.setIndentInput(indent); }
36
364
  get leftPadding() {
37
365
  return (this.withIcon ? 0 : this.iconWidth) + this.baseLeftPadding;
38
366
  }
367
+ ngOnInit() {
368
+ this.withIcon = this.tree.treeControl.isExpandable(this.treeNode.data);
369
+ this.setPadding();
370
+ }
371
+ ngOnDestroy() {
372
+ this.destroyed.next();
373
+ this.destroyed.complete();
374
+ }
39
375
  paddingIndent() {
40
376
  const nodeLevel = (this.treeNode.data && this.tree.treeControl.getLevel)
41
377
  ? this.tree.treeControl.getLevel(this.treeNode.data)
@@ -43,27 +379,69 @@ class McTreeNodePadding extends CdkTreeNodePadding {
43
379
  const level = this.level || nodeLevel;
44
380
  return level > 0 ? `${(level * this._indent) + this.leftPadding}px` : `${this.leftPadding}px`;
45
381
  }
46
- ngOnInit() {
47
- this.withIcon = this.tree.treeControl.isExpandable(this.treeNode.data);
382
+ /**
383
+ * This has been extracted to a util because of TS 4 and VE.
384
+ * View Engine doesn't support property rename inheritance.
385
+ * TS 4.0 doesn't allow properties to override accessors or vice-versa.
386
+ * @docs-private
387
+ */
388
+ setLevelInput(value) {
389
+ // Set to null as the fallback value so that _setPadding can fall back to the node level if the
390
+ // consumer set the directive as `mcTreeNodePadding=""`. We still want to take this value if
391
+ // they set 0 explicitly.
392
+ this._level = coerceNumberProperty(value, null);
48
393
  this.setPadding();
49
394
  }
395
+ /**
396
+ * This has been extracted to a util because of TS 4 and VE.
397
+ * View Engine doesn't support property rename inheritance.
398
+ * TS 4.0 doesn't allow properties to override accessors or vice-versa.
399
+ * @docs-private
400
+ */
401
+ setIndentInput(indent) {
402
+ let value = indent;
403
+ let units = 'px';
404
+ if (typeof indent === 'string') {
405
+ const parts = indent.split(cssUnitPattern);
406
+ value = parts[0];
407
+ units = parts[1] || units;
408
+ }
409
+ this.indentUnits = units;
410
+ this._indent = coerceNumberProperty(value);
411
+ this.setPadding();
412
+ }
413
+ setPadding() {
414
+ var _a;
415
+ const padding = this.paddingIndent();
416
+ const paddingProp = ((_a = this.dir) === null || _a === void 0 ? void 0 : _a.value) === 'rtl' ? 'paddingRight' : 'paddingLeft';
417
+ this.renderer.setStyle(this.element.nativeElement, paddingProp, padding);
418
+ }
50
419
  }
51
- McTreeNodePadding.decorators = [
52
- { type: Directive, args: [{
53
- selector: '[mcTreeNodePadding]',
54
- providers: [{ provide: CdkTreeNodePadding, useExisting: McTreeNodePadding }]
55
- },] }
56
- ];
57
- McTreeNodePadding.propDecorators = {
58
- level: [{ type: Input, args: ['mcTreeNodePadding',] }],
59
- indent: [{ type: Input, args: ['mcTreeNodePaddingIndent',] }]
60
- };
420
+ /** @nocollapse */ McTreeNodePadding.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: McTreeNodePadding, deps: [{ token: McTreeNode }, { token: McTreeBase }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i2.Directionality, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
421
+ /** @nocollapse */ McTreeNodePadding.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.13", type: McTreeNodePadding, selector: "[mcTreeNodePadding]", inputs: { indent: ["mcTreeNodePaddingIndent", "indent"] }, exportAs: ["mcTreeNodePadding"], ngImport: i0 });
422
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: McTreeNodePadding, decorators: [{
423
+ type: Directive,
424
+ args: [{
425
+ selector: '[mcTreeNodePadding]',
426
+ exportAs: 'mcTreeNodePadding'
427
+ }]
428
+ }], ctorParameters: function () { return [{ type: McTreeNode }, { type: McTreeBase }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i2.Directionality, decorators: [{
429
+ type: Optional
430
+ }] }]; }, propDecorators: { indent: [{
431
+ type: Input,
432
+ args: ['mcTreeNodePaddingIndent']
433
+ }] } });
61
434
 
62
- class McTreeNodeToggleComponent {
435
+ class McTreeNodeToggleBase {
436
+ }
437
+ // tslint:disable-next-line:naming-convention
438
+ const McTreeNodeToggleMixinBase = mixinDisabled(McTreeNodeToggleBase);
439
+ /** @docs-private */
440
+ class McTreeNodeToggleBaseDirective extends McTreeNodeToggleMixinBase {
63
441
  constructor(tree, treeNode) {
442
+ super();
64
443
  this.tree = tree;
65
444
  this.treeNode = treeNode;
66
- this.disabled = false;
67
445
  this._recursive = false;
68
446
  this.tree.treeControl.filterValue
69
447
  .pipe(map((value) => (value === null || value === void 0 ? void 0 : value.length) > 0))
@@ -73,82 +451,87 @@ class McTreeNodeToggleComponent {
73
451
  return this._recursive;
74
452
  }
75
453
  set recursive(value) {
76
- this._recursive = value;
454
+ this._recursive = coerceBooleanProperty(value);
77
455
  }
78
456
  get iconState() {
79
- return this.disabled || this.tree.treeControl.isExpanded(this.node);
457
+ return this.tree.treeControl.isExpanded(this.node);
80
458
  }
81
459
  toggle(event) {
460
+ if (this.disabled) {
461
+ return;
462
+ }
82
463
  this.recursive
83
464
  ? this.tree.treeControl.toggleDescendants(this.treeNode.data)
84
465
  : this.tree.treeControl.toggle(this.treeNode.data);
85
466
  event.stopPropagation();
86
467
  }
87
468
  }
88
- McTreeNodeToggleComponent.decorators = [
89
- { type: Component, args: [{
90
- selector: 'mc-tree-node-toggle',
91
- template: `
92
- <i class="mc mc-icon mc-angle-down-S_16"></i>
93
- `,
94
- host: {
95
- class: 'mc-tree-node-toggle',
96
- '[class.mc-opened]': 'iconState',
97
- '[attr.disabled]': 'disabled || null',
98
- '(click)': 'toggle($event)'
99
- },
100
- encapsulation: ViewEncapsulation.None
101
- },] }
102
- ];
103
- /** @nocollapse */
104
- McTreeNodeToggleComponent.ctorParameters = () => [
105
- { type: CdkTree },
106
- { type: CdkTreeNode }
107
- ];
108
- McTreeNodeToggleComponent.propDecorators = {
109
- node: [{ type: Input }],
110
- recursive: [{ type: Input, args: ['cdkTreeNodeToggleRecursive',] }]
111
- };
112
- class McTreeNodeToggleDirective {
113
- constructor(tree, treeNode) {
114
- this.tree = tree;
115
- this.treeNode = treeNode;
116
- this.disabled = false;
117
- this._recursive = false;
118
- this.tree.treeControl.filterValue
119
- .pipe(map((value) => value.length > 0))
120
- .subscribe((state) => this.disabled = state);
121
- }
122
- get recursive() {
123
- return this._recursive;
124
- }
125
- set recursive(value) {
126
- this._recursive = value;
127
- }
128
- toggle(event) {
129
- this.recursive
130
- ? this.tree.treeControl.toggleDescendants(this.treeNode.data)
131
- : this.tree.treeControl.toggle(this.treeNode.data);
132
- event.stopPropagation();
133
- }
469
+ /** @nocollapse */ McTreeNodeToggleBaseDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: McTreeNodeToggleBaseDirective, deps: [{ token: McTreeBase }, { token: McTreeNode }], target: i0.ɵɵFactoryTarget.Directive });
470
+ /** @nocollapse */ McTreeNodeToggleBaseDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.13", type: McTreeNodeToggleBaseDirective, inputs: { node: "node", recursive: ["mcTreeNodeToggleRecursive", "recursive"] }, usesInheritance: true, ngImport: i0 });
471
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: McTreeNodeToggleBaseDirective, decorators: [{
472
+ type: Directive
473
+ }], ctorParameters: function () { return [{ type: McTreeBase }, { type: McTreeNode }]; }, propDecorators: { node: [{
474
+ type: Input
475
+ }], recursive: [{
476
+ type: Input,
477
+ args: ['mcTreeNodeToggleRecursive']
478
+ }] } });
479
+ class McTreeNodeToggleComponent extends McTreeNodeToggleBaseDirective {
134
480
  }
135
- McTreeNodeToggleDirective.decorators = [
136
- { type: Directive, args: [{
137
- selector: '[mcTreeNodeToggle]',
138
- host: {
139
- '[attr.disabled]': 'disabled || null',
140
- '(click)': 'toggle($event)'
141
- }
142
- },] }
143
- ];
144
- /** @nocollapse */
145
- McTreeNodeToggleDirective.ctorParameters = () => [
146
- { type: CdkTree },
147
- { type: CdkTreeNode }
148
- ];
149
- McTreeNodeToggleDirective.propDecorators = {
150
- recursive: [{ type: Input, args: ['cdkTreeNodeToggleRecursive',] }]
151
- };
481
+ /** @nocollapse */ McTreeNodeToggleComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: McTreeNodeToggleComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
482
+ /** @nocollapse */ McTreeNodeToggleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.13", type: McTreeNodeToggleComponent, selector: "mc-tree-node-toggle", inputs: { disabled: "disabled" }, host: { listeners: { "click": "toggle($event)" }, properties: { "class.mc-opened": "iconState", "attr.disabled": "disabled || null" }, classAttribute: "mc-tree-node-toggle" }, exportAs: ["mcTreeNodeToggle"], usesInheritance: true, ngImport: i0, template: `<i class="mc mc-icon mc-angle-down-S_16"></i>`, isInline: true, styles: [".mc-tree-node-toggle{display:flex;align-items:center;justify-content:center;flex-shrink:0;width:24px;height:100%;cursor:pointer}.mc-tree-node-toggle .mc-icon{transform:rotate(-90deg)}.mc-tree-node-toggle.mc-opened .mc-icon{transform:rotate(0)}.mc-tree-node-toggle[disabled]{cursor:default}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
483
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: McTreeNodeToggleComponent, decorators: [{
484
+ type: Component,
485
+ args: [{
486
+ selector: 'mc-tree-node-toggle',
487
+ exportAs: 'mcTreeNodeToggle',
488
+ template: `<i class="mc mc-icon mc-angle-down-S_16"></i>`,
489
+ styleUrls: ['./toggle.scss'],
490
+ host: {
491
+ class: 'mc-tree-node-toggle',
492
+ '[class.mc-opened]': 'iconState',
493
+ '[attr.disabled]': 'disabled || null',
494
+ '(click)': 'toggle($event)'
495
+ },
496
+ inputs: ['disabled'],
497
+ encapsulation: ViewEncapsulation.None,
498
+ changeDetection: ChangeDetectionStrategy.OnPush
499
+ }]
500
+ }] });
501
+ class McTreeNodeToggleDirective extends McTreeNodeToggleBaseDirective {
502
+ }
503
+ /** @nocollapse */ McTreeNodeToggleDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: McTreeNodeToggleDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
504
+ /** @nocollapse */ McTreeNodeToggleDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.13", type: McTreeNodeToggleDirective, selector: "[mcTreeNodeToggle]", host: { listeners: { "click": "toggle($event)" }, properties: { "attr.disabled": "disabled || null" } }, exportAs: ["mcTreeNodeToggle"], usesInheritance: true, ngImport: i0 });
505
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: McTreeNodeToggleDirective, decorators: [{
506
+ type: Directive,
507
+ args: [{
508
+ selector: '[mcTreeNodeToggle]',
509
+ exportAs: 'mcTreeNodeToggle',
510
+ host: {
511
+ '[attr.disabled]': 'disabled || null',
512
+ '(click)': 'toggle($event)'
513
+ }
514
+ }]
515
+ }] });
516
+
517
+ class McTree extends McTreeBase {
518
+ }
519
+ /** @nocollapse */ McTree.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: McTree, deps: null, target: i0.ɵɵFactoryTarget.Component });
520
+ /** @nocollapse */ McTree.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.13", type: McTree, selector: "mc-tree", host: { classAttribute: "mc-tree" }, exportAs: ["mcTree"], usesInheritance: true, ngImport: i0, template: `<ng-container mcTreeNodeOutlet></ng-container>`, isInline: true, styles: [".mc-tree{display:block}\n"], directives: [{ type: McTreeNodeOutlet, selector: "[mcTreeNodeOutlet]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
521
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: McTree, decorators: [{
522
+ type: Component,
523
+ args: [{
524
+ selector: 'mc-tree',
525
+ exportAs: 'mcTree',
526
+ template: `<ng-container mcTreeNodeOutlet></ng-container>`,
527
+ styleUrls: ['./tree.scss'],
528
+ host: {
529
+ class: 'mc-tree'
530
+ },
531
+ encapsulation: ViewEncapsulation.None,
532
+ changeDetection: ChangeDetectionStrategy.OnPush
533
+ }]
534
+ }] });
152
535
 
153
536
  /**
154
537
  * Injection token used to provide the parent component to options.
@@ -161,7 +544,7 @@ class McTreeOptionChange {
161
544
  }
162
545
  }
163
546
  let uniqueIdCounter = 0;
164
- class McTreeOption extends CdkTreeNode {
547
+ class McTreeOption extends McTreeNode {
165
548
  constructor(elementRef, changeDetectorRef, ngZone, tree) {
166
549
  super(elementRef, tree);
167
550
  this.changeDetectorRef = changeDetectorRef;
@@ -182,7 +565,7 @@ class McTreeOption extends CdkTreeNode {
182
565
  this._value = value;
183
566
  }
184
567
  get disabled() {
185
- return this._disabled || (this.tree && this.tree.disabled);
568
+ return this._disabled || this.tree.disabled;
186
569
  }
187
570
  set disabled(value) {
188
571
  const newValue = coerceBooleanProperty(value);
@@ -208,13 +591,14 @@ class McTreeOption extends CdkTreeNode {
208
591
  get id() {
209
592
  return this._id;
210
593
  }
211
- get multiple() {
212
- return this.tree.multiple;
213
- }
214
594
  get viewValue() {
215
595
  // TODO: Add input property alternative for node envs.
216
596
  return (this.getHostElement().textContent || '').trim();
217
597
  }
598
+ get isExpandable() {
599
+ var _a;
600
+ return !((_a = this.toggleElement) === null || _a === void 0 ? void 0 : _a.disabled) && this.tree.treeControl.isExpandable(this.data);
601
+ }
218
602
  ngAfterContentInit() {
219
603
  this.value = this.tree.treeControl.getValue(this.data);
220
604
  }
@@ -235,10 +619,11 @@ class McTreeOption extends CdkTreeNode {
235
619
  this.changeDetectorRef.markForCheck();
236
620
  }
237
621
  focus(focusOrigin) {
622
+ var _a;
238
623
  if (focusOrigin === 'program') {
239
624
  return;
240
625
  }
241
- if (this.disabled || this.hasFocus) {
626
+ if (this.disabled || this.hasFocus || ((_a = this.actionButton) === null || _a === void 0 ? void 0 : _a.hasFocus)) {
242
627
  return;
243
628
  }
244
629
  this.elementRef.nativeElement.focus();
@@ -258,7 +643,11 @@ class McTreeOption extends CdkTreeNode {
258
643
  .pipe(take(1))
259
644
  .subscribe(() => {
260
645
  this.ngZone.run(() => {
646
+ var _a;
261
647
  this.hasFocus = false;
648
+ if ((_a = this.actionButton) === null || _a === void 0 ? void 0 : _a.hasFocus) {
649
+ return;
650
+ }
262
651
  this.onBlur.next({ option: this });
263
652
  });
264
653
  });
@@ -271,26 +660,38 @@ class McTreeOption extends CdkTreeNode {
271
660
  return 0;
272
661
  }
273
662
  select() {
274
- if (!this._selected) {
275
- this._selected = true;
276
- this.changeDetectorRef.markForCheck();
277
- this.emitSelectionChangeEvent();
663
+ if (this._selected) {
664
+ return;
278
665
  }
666
+ this._selected = true;
667
+ this.changeDetectorRef.markForCheck();
668
+ this.emitSelectionChangeEvent();
279
669
  }
280
670
  deselect() {
281
- if (this._selected) {
282
- this._selected = false;
283
- this.changeDetectorRef.markForCheck();
671
+ if (!this._selected) {
672
+ return;
673
+ }
674
+ this._selected = false;
675
+ this.changeDetectorRef.markForCheck();
676
+ }
677
+ onKeydown($event) {
678
+ if (!this.actionButton) {
679
+ return;
680
+ }
681
+ if ($event.keyCode === TAB && !$event.shiftKey && !this.actionButton.hasFocus) {
682
+ this.actionButton.focus();
683
+ $event.preventDefault();
284
684
  }
285
685
  }
286
686
  selectViaInteraction($event) {
287
- if (!this.disabled) {
288
- this.changeDetectorRef.markForCheck();
289
- this.emitSelectionChangeEvent(true);
290
- const shiftKey = $event ? hasModifierKey($event, 'shiftKey') : false;
291
- const ctrlKey = $event ? hasModifierKey($event, 'ctrlKey') : false;
292
- this.tree.setSelectedOptionsByClick(this, shiftKey, ctrlKey);
687
+ if (this.disabled) {
688
+ return;
293
689
  }
690
+ this.changeDetectorRef.markForCheck();
691
+ this.emitSelectionChangeEvent(true);
692
+ const shiftKey = $event ? hasModifierKey($event, 'shiftKey') : false;
693
+ const ctrlKey = $event ? hasModifierKey($event, 'ctrlKey') : false;
694
+ this.tree.setSelectedOptionsByClick(this, shiftKey, ctrlKey);
294
695
  }
295
696
  emitSelectionChangeEvent(isUserInput = false) {
296
697
  this.onSelectionChange.emit(new McTreeOptionChange(this, isUserInput));
@@ -302,39 +703,240 @@ class McTreeOption extends CdkTreeNode {
302
703
  this.changeDetectorRef.markForCheck();
303
704
  }
304
705
  }
305
- McTreeOption.decorators = [
306
- { type: Component, args: [{
307
- selector: 'mc-tree-option',
308
- exportAs: 'mcTreeOption',
309
- template: "<ng-content select=\"[mc-icon]\"></ng-content>\n\n<ng-content select=\"mc-tree-node-toggle\"></ng-content>\n\n<mc-pseudo-checkbox\n *ngIf=\"showCheckbox\"\n [state]=\"selected ? 'checked' : 'unchecked'\"\n [disabled]=\"disabled\">\n</mc-pseudo-checkbox>\n\n<span class=\"mc-option-text mc-no-select\"><ng-content></ng-content></span>\n\n<div class=\"mc-option-overlay\"></div>\n",
310
- host: {
311
- '[attr.id]': 'id',
312
- '[attr.tabindex]': '-1',
313
- '[attr.disabled]': 'disabled || null',
314
- class: 'mc-tree-option',
315
- '[class.mc-selected]': 'selected',
316
- '[class.mc-focused]': 'hasFocus',
317
- '(focusin)': 'focus()',
318
- '(blur)': 'blur()',
319
- '(click)': 'selectViaInteraction($event)'
320
- },
321
- changeDetection: ChangeDetectionStrategy.OnPush,
322
- encapsulation: ViewEncapsulation.None,
323
- providers: [{ provide: CdkTreeNode, useExisting: McTreeOption }]
324
- },] }
325
- ];
326
- /** @nocollapse */
327
- McTreeOption.ctorParameters = () => [
328
- { type: ElementRef },
329
- { type: ChangeDetectorRef },
330
- { type: NgZone },
331
- { type: undefined, decorators: [{ type: Inject, args: [MC_TREE_OPTION_PARENT_COMPONENT,] }] }
332
- ];
333
- McTreeOption.propDecorators = {
334
- disabled: [{ type: Input }],
335
- showCheckbox: [{ type: Input }],
336
- onSelectionChange: [{ type: Output }]
337
- };
706
+ /** @nocollapse */ McTreeOption.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: McTreeOption, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: MC_TREE_OPTION_PARENT_COMPONENT }], target: i0.ɵɵFactoryTarget.Component });
707
+ /** @nocollapse */ McTreeOption.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.13", type: McTreeOption, selector: "mc-tree-option", inputs: { disabled: "disabled", showCheckbox: "showCheckbox" }, outputs: { onSelectionChange: "onSelectionChange" }, host: { listeners: { "focusin": "focus()", "blur": "blur()", "click": "selectViaInteraction($event)", "keydown": "onKeydown($event)" }, properties: { "class.mc-selected": "selected", "class.mc-focused": "hasFocus", "class.mc-action-button-focused": "actionButton?.active", "attr.id": "id", "attr.tabindex": "-1", "attr.disabled": "disabled || null" }, classAttribute: "mc-tree-option" }, providers: [
708
+ { provide: McTreeNode, useExisting: McTreeOption },
709
+ { provide: MC_OPTION_ACTION_PARENT, useExisting: McTreeOption }
710
+ ], queries: [{ propertyName: "toggleElement", first: true, predicate: ["mcTreeNodeToggle"], descendants: true }, { propertyName: "actionButton", first: true, predicate: McOptionActionComponent, descendants: true }, { propertyName: "tooltipTrigger", first: true, predicate: McTooltipTrigger, descendants: true }, { propertyName: "dropdownTrigger", first: true, predicate: McDropdownTrigger, descendants: true }], exportAs: ["mcTreeOption"], usesInheritance: true, ngImport: i0, template: "<ng-content select=\"mc-tree-node-toggle\"></ng-content>\n\n<mc-pseudo-checkbox\n *ngIf=\"showCheckbox\"\n [state]=\"selected ? 'checked' : 'unchecked'\"\n [disabled]=\"disabled\">\n</mc-pseudo-checkbox>\n\n<ng-content select=\"mc-checkbox\"></ng-content>\n\n<ng-content select=\"[mc-icon]\"></ng-content>\n\n<span class=\"mc-option-text mc-no-select\"><ng-content></ng-content></span>\n\n<ng-content select=\"mc-option-action\"></ng-content>\n\n<div class=\"mc-option-overlay\"></div>\n", styles: [".mc-tree-option{box-sizing:border-box;display:flex;align-items:center;height:32px;height:var(--mc-tree-size-node-height, 32px);word-wrap:break-word;border:2px solid transparent}.mc-tree-option .mc-option-text{display:inline-block;flex-grow:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-right:16px;margin-right:var(--mc-tree-size-padding-right, 16px)}.mc-tree-option>.mc-icon{margin-right:8px;cursor:pointer}.mc-tree-option:focus{outline:none}.mc-tree-option:not([disabled]){cursor:pointer}.mc-tree-option>.mc-pseudo-checkbox,.mc-tree-option>.mc-checkbox{margin-right:8px}.mc-tree-option .mc-option-action{display:none}.mc-tree-option:not([disabled]):hover .mc-option-action,.mc-tree-option:not([disabled]).mc-focused .mc-option-action,.mc-tree-option:not([disabled]).mc-action-button-focused .mc-option-action{display:flex}\n"], components: [{ type: i1.McPseudoCheckbox, selector: "mc-pseudo-checkbox", inputs: ["state", "disabled"] }], directives: [{ type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
711
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: McTreeOption, decorators: [{
712
+ type: Component,
713
+ args: [{
714
+ selector: 'mc-tree-option',
715
+ exportAs: 'mcTreeOption',
716
+ templateUrl: './tree-option.html',
717
+ styleUrls: ['./tree-option.scss'],
718
+ host: {
719
+ class: 'mc-tree-option',
720
+ '[class.mc-selected]': 'selected',
721
+ '[class.mc-focused]': 'hasFocus',
722
+ '[class.mc-action-button-focused]': 'actionButton?.active',
723
+ '[attr.id]': 'id',
724
+ '[attr.tabindex]': '-1',
725
+ '[attr.disabled]': 'disabled || null',
726
+ '(focusin)': 'focus()',
727
+ '(blur)': 'blur()',
728
+ '(click)': 'selectViaInteraction($event)',
729
+ '(keydown)': 'onKeydown($event)'
730
+ },
731
+ changeDetection: ChangeDetectionStrategy.OnPush,
732
+ encapsulation: ViewEncapsulation.None,
733
+ providers: [
734
+ { provide: McTreeNode, useExisting: McTreeOption },
735
+ { provide: MC_OPTION_ACTION_PARENT, useExisting: McTreeOption }
736
+ ]
737
+ }]
738
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: undefined, decorators: [{
739
+ type: Inject,
740
+ args: [MC_TREE_OPTION_PARENT_COMPONENT]
741
+ }] }]; }, propDecorators: { toggleElement: [{
742
+ type: ContentChild,
743
+ args: ['mcTreeNodeToggle']
744
+ }], actionButton: [{
745
+ type: ContentChild,
746
+ args: [McOptionActionComponent]
747
+ }], tooltipTrigger: [{
748
+ type: ContentChild,
749
+ args: [McTooltipTrigger]
750
+ }], dropdownTrigger: [{
751
+ type: ContentChild,
752
+ args: [McDropdownTrigger]
753
+ }], disabled: [{
754
+ type: Input
755
+ }], showCheckbox: [{
756
+ type: Input
757
+ }], onSelectionChange: [{
758
+ type: Output
759
+ }] } });
760
+
761
+ /** Base tree control. It has basic toggle/expand/collapse operations on a single data node. */
762
+ /* tslint:disable-next-line:naming-convention */
763
+ class BaseTreeControl {
764
+ constructor() {
765
+ /** A selection model with multi-selection to track expansion status. */
766
+ this.expansionModel = new SelectionModel(true);
767
+ this.filterModel = new SelectionModel(true);
768
+ this.filterValue = new BehaviorSubject('');
769
+ }
770
+ /** Toggles one single data node's expanded/collapsed state. */
771
+ toggle(dataNode) {
772
+ if (this.filterValue.value) {
773
+ return;
774
+ }
775
+ this.expansionModel.toggle(dataNode);
776
+ }
777
+ /** Expands one single data node. */
778
+ expand(dataNode) {
779
+ if (this.filterValue.value) {
780
+ return;
781
+ }
782
+ this.expansionModel.select(dataNode);
783
+ }
784
+ /** Collapses one single data node. */
785
+ collapse(dataNode) {
786
+ if (this.filterValue.value) {
787
+ return;
788
+ }
789
+ this.expansionModel.deselect(dataNode);
790
+ }
791
+ /** Whether a given data node is expanded or not. Returns true if the data node is expanded. */
792
+ isExpanded(dataNode) {
793
+ return this.expansionModel.isSelected(dataNode);
794
+ }
795
+ /** Toggles a subtree rooted at `node` recursively. */
796
+ toggleDescendants(dataNode) {
797
+ this.expansionModel.isSelected(dataNode)
798
+ ? this.collapseDescendants(dataNode)
799
+ : this.expandDescendants(dataNode);
800
+ }
801
+ /** Collapse all dataNodes in the tree. */
802
+ collapseAll() {
803
+ this.expansionModel.clear();
804
+ }
805
+ /** Expands a subtree rooted at given data node recursively. */
806
+ expandDescendants(dataNode) {
807
+ const toBeProcessed = [dataNode];
808
+ toBeProcessed.push(...this.getDescendants(dataNode));
809
+ this.expansionModel.select(...toBeProcessed);
810
+ }
811
+ /** Collapses a subtree rooted at given data node recursively. */
812
+ collapseDescendants(dataNode) {
813
+ const toBeProcessed = [dataNode];
814
+ toBeProcessed.push(...this.getDescendants(dataNode));
815
+ this.expansionModel.deselect(...toBeProcessed);
816
+ }
817
+ }
818
+
819
+ function defaultCompareValues(firstValue, secondValue) {
820
+ return firstValue === secondValue;
821
+ }
822
+ function defaultCompareViewValues(firstViewValue, secondViewValue) {
823
+ return RegExp(secondViewValue, 'gi').test(firstViewValue);
824
+ }
825
+ /** Flat tree control. Able to expand/collapse a subtree recursively for flattened tree. */
826
+ class FlatTreeControl extends BaseTreeControl {
827
+ /** Construct with flat tree data node functions getLevel, isExpandable, getValue and getViewValue. */
828
+ constructor(getLevel, isExpandable,
829
+ /** getValue will be used to determine if the tree contains value or not. Used in method hasValue */
830
+ getValue,
831
+ /** getViewValue will be used for filter nodes. Returned value will be first argument in filterNodesFunction */
832
+ getViewValue,
833
+ /** compareValues will be used to comparing values. */
834
+ compareValues = defaultCompareValues,
835
+ /** compareValues will be used to comparing values. */
836
+ compareViewValues = defaultCompareViewValues) {
837
+ super();
838
+ this.getLevel = getLevel;
839
+ this.isExpandable = isExpandable;
840
+ this.getValue = getValue;
841
+ this.getViewValue = getViewValue;
842
+ this.compareValues = compareValues;
843
+ this.compareViewValues = compareViewValues;
844
+ }
845
+ /**
846
+ * Gets a list of the data node's subtree of descendent data nodes.
847
+ *
848
+ * To make this working, the `dataNodes` of the TreeControl must be flattened tree nodes
849
+ * with correct levels.
850
+ */
851
+ getDescendants(dataNode) {
852
+ const startIndex = this.dataNodes.indexOf(dataNode);
853
+ const results = [];
854
+ // Goes through flattened tree nodes in the `dataNodes` array, and get all descendants.
855
+ // The level of descendants of a tree node must be greater than the level of the given
856
+ // tree node.
857
+ // If we reach a node whose level is equal to the level of the tree node, we hit a sibling.
858
+ // If we reach a node whose level is greater than the level of the tree node, we hit a
859
+ // sibling of an ancestor.
860
+ for (let i = startIndex + 1; i < this.dataNodes.length && this.getLevel(dataNode) < this.getLevel(this.dataNodes[i]); i++) {
861
+ results.push(this.dataNodes[i]);
862
+ }
863
+ return results;
864
+ }
865
+ /**
866
+ * Expands all data nodes in the tree.
867
+ *
868
+ * To make this working, the `dataNodes` variable of the TreeControl must be set to all flattened
869
+ * data nodes of the tree.
870
+ */
871
+ expandAll() {
872
+ this.expansionModel.select(...this.dataNodes);
873
+ }
874
+ getParents(node, result) {
875
+ if (node.parent) {
876
+ result.unshift(node.parent);
877
+ return this.getParents(node.parent, result);
878
+ }
879
+ else {
880
+ return result;
881
+ }
882
+ }
883
+ hasValue(value) {
884
+ return this.dataNodes.find((node) => this.compareValues(this.getValue(node), value));
885
+ }
886
+ filterNodes(value) {
887
+ this.saveExpansionState();
888
+ this.filterModel.clear();
889
+ this.expansionModel.clear();
890
+ const filteredNodes = this.dataNodes
891
+ .filter((node) => this.compareViewValues(this.getViewValue(node), value));
892
+ const filteredNodesWithTheirParents = new Set();
893
+ filteredNodes.forEach((filteredNode) => {
894
+ this.getParents(filteredNode, [])
895
+ .forEach((node) => {
896
+ filteredNodesWithTheirParents.add(node);
897
+ this.expandDataNode(node);
898
+ });
899
+ filteredNodesWithTheirParents.add(filteredNode);
900
+ this.expandDataNode(filteredNode);
901
+ if (this.isExpandable(filteredNode)) {
902
+ const childNodeLevel = this.getLevel(filteredNode) + 1;
903
+ this.getDescendants(filteredNode)
904
+ .filter((childNode) => this.getLevel(childNode) === childNodeLevel)
905
+ .filter((childNode) => !this.isExpandable(childNode) || !this.hasFilteredDescendant(childNode, filteredNodes))
906
+ .forEach((childNode) => {
907
+ filteredNodesWithTheirParents.add(childNode);
908
+ this.expandDataNode(childNode);
909
+ });
910
+ }
911
+ });
912
+ this.filterModel.select(...Array.from(filteredNodesWithTheirParents));
913
+ this.filterValue.next(value);
914
+ this.restoreExpansionState();
915
+ }
916
+ expandDataNode(dataNode) {
917
+ if (this.isExpandable(dataNode)) {
918
+ this.expansionModel.select(dataNode);
919
+ }
920
+ }
921
+ saveExpansionState() {
922
+ if (this.filterValue.value === '') {
923
+ this.expandedItemsBeforeFiltration = this.expansionModel.selected;
924
+ }
925
+ }
926
+ restoreExpansionState() {
927
+ if (this.filterValue.value === '') {
928
+ this.expansionModel.clear();
929
+ this.expansionModel.select(...this.expandedItemsBeforeFiltration);
930
+ }
931
+ }
932
+ hasFilteredDescendant(dataNode, filteredNodes) {
933
+ const filteredViewValues = filteredNodes
934
+ .map((node) => this.getViewValue(node));
935
+ return this.getDescendants(dataNode)
936
+ .filter((node) => filteredViewValues.includes(this.getViewValue(node)))
937
+ .length > 0;
938
+ }
939
+ }
338
940
 
339
941
  /* tslint:disable:no-empty */
340
942
  const MC_SELECTION_TREE_VALUE_ACCESSOR = {
@@ -342,6 +944,18 @@ const MC_SELECTION_TREE_VALUE_ACCESSOR = {
342
944
  useExisting: forwardRef(() => McTreeSelection),
343
945
  multi: true
344
946
  };
947
+ class McTreeSelectAllEvent {
948
+ constructor(source, options) {
949
+ this.source = source;
950
+ this.options = options;
951
+ }
952
+ }
953
+ class McTreeCopyEvent {
954
+ constructor(source, option) {
955
+ this.source = source;
956
+ this.option = option;
957
+ }
958
+ }
345
959
  class McTreeNavigationChange {
346
960
  constructor(source, option) {
347
961
  this.source = source;
@@ -354,16 +968,19 @@ class McTreeSelectionChange {
354
968
  this.option = option;
355
969
  }
356
970
  }
357
- class McTreeSelection extends CdkTree {
358
- constructor(elementRef, differs, changeDetectorRef, multiple) {
971
+ class McTreeSelection extends McTreeBase {
972
+ constructor(elementRef, differs, changeDetectorRef, multiple, clipboard) {
359
973
  super(differs, changeDetectorRef);
360
974
  this.elementRef = elementRef;
975
+ this.clipboard = clipboard;
361
976
  this.renderedOptions = new QueryList();
362
977
  this.resetFocusedItemOnBlur = true;
363
- this.navigationChange = new EventEmitter();
364
- this.selectionChange = new EventEmitter();
365
978
  this.multipleMode = null;
366
979
  this.userTabIndex = null;
980
+ this.navigationChange = new EventEmitter();
981
+ this.selectionChange = new EventEmitter();
982
+ this.onSelectAll = new EventEmitter();
983
+ this.onCopy = new EventEmitter();
367
984
  this.sortedNodes = [];
368
985
  this._autoSelect = true;
369
986
  this._noUnselectLast = true;
@@ -384,6 +1001,7 @@ class McTreeSelection extends CdkTree {
384
1001
  });
385
1002
  this.renderedOptions.reset(orderedOptions);
386
1003
  this.renderedOptions.notifyOnChanges();
1004
+ this.updateScrollSize();
387
1005
  };
388
1006
  if (multiple === MultipleMode.CHECKBOX || multiple === MultipleMode.KEYBOARD) {
389
1007
  this.multipleMode = multiple;
@@ -439,7 +1057,8 @@ class McTreeSelection extends CdkTree {
439
1057
  return this.multipleMode === MultipleMode.CHECKBOX;
440
1058
  }
441
1059
  ngAfterContentInit() {
442
- this.unorderedOptions.changes.subscribe(this.updateRenderedOptions);
1060
+ this.unorderedOptions.changes
1061
+ .subscribe(this.updateRenderedOptions);
443
1062
  this.keyManager = new FocusKeyManager(this.renderedOptions)
444
1063
  .withVerticalOrientation(true)
445
1064
  .withHorizontalOrientation(null);
@@ -464,20 +1083,19 @@ class McTreeSelection extends CdkTree {
464
1083
  this.renderedOptions.notifyOnChanges();
465
1084
  });
466
1085
  this.renderedOptions.changes
467
- .pipe(takeUntil(this.destroy))
1086
+ .pipe(takeUntil(this.destroy), delay(0))
468
1087
  .subscribe((options) => {
469
1088
  this.resetOptions();
470
1089
  // Check to see if we need to update our tab index
471
1090
  this.updateTabIndex();
472
- // todo need to do optimisation
473
1091
  options.forEach((option) => {
474
- option.deselect();
475
- this.getSelectedValues().forEach((selectedValue) => {
476
- if (option.value === selectedValue) {
477
- option.select();
478
- }
479
- });
480
- option.changeDetectorRef.detectChanges();
1092
+ if (this.getSelectedValues().includes(option.value)) {
1093
+ option.select();
1094
+ }
1095
+ else {
1096
+ option.deselect();
1097
+ }
1098
+ option.markForCheck();
481
1099
  });
482
1100
  });
483
1101
  }
@@ -489,7 +1107,9 @@ class McTreeSelection extends CdkTree {
489
1107
  if (this.renderedOptions.length === 0 || this.isFocusReceivedFromNestedOption($event)) {
490
1108
  return;
491
1109
  }
1110
+ this.keyManager.setFocusOrigin('keyboard');
492
1111
  this.keyManager.setFirstItemActive();
1112
+ this.keyManager.setFocusOrigin('program');
493
1113
  }
494
1114
  blur() {
495
1115
  if (!this.hasFocusedOption() && this.resetFocusedItemOnBlur) {
@@ -499,51 +1119,54 @@ class McTreeSelection extends CdkTree {
499
1119
  this.changeDetectorRef.markForCheck();
500
1120
  }
501
1121
  onKeyDown(event) {
1122
+ var _a, _b;
502
1123
  this.keyManager.setFocusOrigin('keyboard');
503
1124
  // tslint:disable-next-line: deprecation
504
1125
  const keyCode = event.keyCode;
505
- switch (keyCode) {
506
- case DOWN_ARROW:
507
- this.keyManager.setNextItemActive();
508
- break;
509
- case UP_ARROW:
510
- this.keyManager.setPreviousItemActive();
511
- break;
512
- case LEFT_ARROW:
513
- if (this.keyManager.activeItem) {
514
- this.treeControl.collapse(this.keyManager.activeItem.data);
515
- }
516
- event.preventDefault();
517
- return;
518
- case RIGHT_ARROW:
519
- if (this.keyManager.activeItem) {
520
- this.treeControl.expand(this.keyManager.activeItem.data);
521
- }
522
- event.preventDefault();
523
- return;
524
- case SPACE:
525
- case ENTER:
526
- this.toggleFocusedOption();
527
- event.preventDefault();
528
- break;
529
- case HOME:
530
- this.keyManager.setFirstItemActive();
531
- event.preventDefault();
532
- break;
533
- case END:
534
- this.keyManager.setLastItemActive();
535
- event.preventDefault();
536
- break;
537
- case PAGE_UP:
538
- this.keyManager.setPreviousPageItemActive();
539
- event.preventDefault();
540
- break;
541
- case PAGE_DOWN:
542
- this.keyManager.setNextPageItemActive();
543
- event.preventDefault();
544
- break;
545
- default:
546
- return;
1126
+ if ([SPACE, LEFT_ARROW, RIGHT_ARROW].includes(keyCode) || isVerticalMovement(event)) {
1127
+ event.preventDefault();
1128
+ }
1129
+ if (this.multiple && isSelectAll(event)) {
1130
+ this.selectAllOptions();
1131
+ return;
1132
+ }
1133
+ else if (isCopy(event)) {
1134
+ this.copyActiveOption();
1135
+ return;
1136
+ }
1137
+ else if (keyCode === TAB) {
1138
+ this.keyManager.tabOut.next();
1139
+ return;
1140
+ }
1141
+ else if (keyCode === LEFT_ARROW && ((_a = this.keyManager.activeItem) === null || _a === void 0 ? void 0 : _a.isExpandable)) {
1142
+ this.treeControl.collapse(this.keyManager.activeItem.data);
1143
+ return;
1144
+ }
1145
+ else if (keyCode === RIGHT_ARROW && ((_b = this.keyManager.activeItem) === null || _b === void 0 ? void 0 : _b.isExpandable)) {
1146
+ this.treeControl.expand(this.keyManager.activeItem.data);
1147
+ return;
1148
+ }
1149
+ else if (keyCode === DOWN_ARROW) {
1150
+ this.keyManager.setNextItemActive();
1151
+ }
1152
+ else if (keyCode === UP_ARROW) {
1153
+ this.keyManager.setPreviousItemActive();
1154
+ }
1155
+ else if ([SPACE, ENTER].includes(keyCode)) {
1156
+ this.toggleFocusedOption();
1157
+ return;
1158
+ }
1159
+ else if (keyCode === HOME) {
1160
+ this.keyManager.setFirstItemActive();
1161
+ }
1162
+ else if (keyCode === END) {
1163
+ this.keyManager.setLastItemActive();
1164
+ }
1165
+ else if (keyCode === PAGE_UP) {
1166
+ this.keyManager.setPreviousPageItemActive();
1167
+ }
1168
+ else if (keyCode === PAGE_DOWN) {
1169
+ this.keyManager.setNextPageItemActive();
547
1170
  }
548
1171
  if (this.keyManager.activeItem) {
549
1172
  this.setSelectedOptionsByKey(this.keyManager.activeItem, hasModifierKey(event, 'shiftKey'), hasModifierKey(event, 'ctrlKey'));
@@ -558,6 +1181,7 @@ class McTreeSelection extends CdkTree {
558
1181
  setSelectedOptionsByKey(option, shiftKey, ctrlKey) {
559
1182
  if (shiftKey && this.multiple) {
560
1183
  this.setSelectedOptions(option);
1184
+ this.emitChangeEvent(option);
561
1185
  }
562
1186
  else if (ctrlKey) {
563
1187
  if (!this.canDeselectLast(option)) {
@@ -567,8 +1191,8 @@ class McTreeSelection extends CdkTree {
567
1191
  else if (this.autoSelect) {
568
1192
  this.selectionModel.clear();
569
1193
  this.selectionModel.toggle(option.data);
1194
+ this.emitChangeEvent(option);
570
1195
  }
571
- this.emitChangeEvent(option);
572
1196
  }
573
1197
  setSelectedOptionsByClick(option, shiftKey, ctrlKey) {
574
1198
  if (!shiftKey && !ctrlKey) {
@@ -627,25 +1251,29 @@ class McTreeSelection extends CdkTree {
627
1251
  renderNodeChanges(data, dataDiffer = this.dataDiffer, viewContainer = this.nodeOutlet.viewContainer, parentData) {
628
1252
  super.renderNodeChanges(data, dataDiffer, viewContainer, parentData);
629
1253
  this.sortedNodes = this.getSortedNodes(viewContainer);
630
- this.updateScrollSize();
631
1254
  this.nodeOutlet.changeDetectorRef.detectChanges();
632
1255
  }
633
- getHeight() {
634
- const clientRects = this.elementRef.nativeElement.getClientRects();
635
- if (clientRects.length) {
636
- return clientRects[0].height;
637
- }
638
- return 0;
639
- }
640
- getItemHeight() {
641
- return this.renderedOptions.first ? this.renderedOptions.first.getHeight() : 0;
642
- }
643
1256
  emitNavigationEvent(option) {
644
1257
  this.navigationChange.emit(new McTreeNavigationChange(this, option));
645
1258
  }
646
1259
  emitChangeEvent(option) {
647
1260
  this.selectionChange.emit(new McTreeNavigationChange(this, option));
648
1261
  }
1262
+ selectAllOptions() {
1263
+ const optionsToSelect = this.renderedOptions
1264
+ .filter((option) => !option.disabled);
1265
+ optionsToSelect
1266
+ .forEach((option) => option.setSelected(true));
1267
+ this.onSelectAll.emit(new McTreeSelectAllEvent(this, optionsToSelect));
1268
+ }
1269
+ copyActiveOption() {
1270
+ if (this.onCopy.observers.length) {
1271
+ this.onCopy.emit(new McTreeCopyEvent(this, this.keyManager.activeItem));
1272
+ }
1273
+ else {
1274
+ this.onCopyDefaultHandler();
1275
+ }
1276
+ }
649
1277
  writeValue(value) {
650
1278
  if (this.multiple && value && !Array.isArray(value)) {
651
1279
  throw getMcSelectNonArrayValueError();
@@ -680,6 +1308,20 @@ class McTreeSelection extends CdkTree {
680
1308
  getSelectedValues() {
681
1309
  return this.selectionModel.selected.map((selected) => this.treeControl.getValue(selected));
682
1310
  }
1311
+ getItemHeight() {
1312
+ return this.renderedOptions.first ? this.renderedOptions.first.getHeight() : 0;
1313
+ }
1314
+ onCopyDefaultHandler() {
1315
+ var _a;
1316
+ (_a = this.clipboard) === null || _a === void 0 ? void 0 : _a.copy(this.keyManager.activeItem.value);
1317
+ }
1318
+ getHeight() {
1319
+ const clientRects = this.elementRef.nativeElement.getClientRects();
1320
+ if (clientRects.length) {
1321
+ return clientRects[0].height;
1322
+ }
1323
+ return 0;
1324
+ }
683
1325
  updateTabIndex() {
684
1326
  this._tabIndex = this.renderedOptions.length === 0 ? -1 : 0;
685
1327
  }
@@ -758,66 +1400,146 @@ class McTreeSelection extends CdkTree {
758
1400
  return $event.relatedTarget.classList.contains('mc-tree-option');
759
1401
  }
760
1402
  }
761
- McTreeSelection.decorators = [
762
- { type: Component, args: [{
763
- selector: 'mc-tree-selection',
764
- exportAs: 'mcTreeSelection',
765
- template: '<ng-container cdkTreeNodeOutlet></ng-container>',
766
- host: {
767
- class: 'mc-tree-selection',
768
- '[attr.tabindex]': 'tabIndex',
769
- '[attr.disabled]': 'disabled || null',
770
- '(blur)': 'blur()',
771
- '(focus)': 'focus($event)',
772
- '(keydown)': 'onKeyDown($event)',
773
- '(window:resize)': 'updateScrollSize()'
774
- },
775
- encapsulation: ViewEncapsulation.None,
776
- changeDetection: ChangeDetectionStrategy.OnPush,
777
- providers: [
778
- MC_SELECTION_TREE_VALUE_ACCESSOR,
779
- { provide: MC_TREE_OPTION_PARENT_COMPONENT, useExisting: McTreeSelection },
780
- { provide: CdkTree, useExisting: McTreeSelection }
781
- ],
782
- styles: [".mc-tree-selection{display:block}.mc-tree-option{display:flex;align-items:center;padding-right:var(--mc-tree-size-padding-right,16px);height:var(--mc-tree-size-node-height,28px);word-wrap:break-word;border:var(--mc-tree-size-border-width,2px) solid transparent}.mc-tree-option>.mc-icon{margin-right:4px;cursor:pointer}.mc-tree-option:focus{outline:none}.mc-tree-option:not([disabled]){cursor:pointer}.mc-tree-option .mc-pseudo-checkbox{margin-right:8px}.mc-tree-node-toggle{margin-right:4px;cursor:pointer}.mc-tree-node-toggle .mc-icon{transform:rotate(-90deg)}.mc-tree-node-toggle.mc-opened .mc-icon{transform:rotate(0)}.mc-tree-node-toggle[disabled]{cursor:default}"]
783
- },] }
784
- ];
785
- /** @nocollapse */
786
- McTreeSelection.ctorParameters = () => [
787
- { type: ElementRef },
788
- { type: IterableDiffers },
789
- { type: ChangeDetectorRef },
790
- { type: MultipleMode, decorators: [{ type: Attribute, args: ['multiple',] }] }
791
- ];
792
- McTreeSelection.propDecorators = {
793
- nodeOutlet: [{ type: ViewChild, args: [CdkTreeNodeOutlet, { static: true },] }],
794
- unorderedOptions: [{ type: ContentChildren, args: [McTreeOption,] }],
795
- treeControl: [{ type: Input }],
796
- navigationChange: [{ type: Output }],
797
- selectionChange: [{ type: Output }],
798
- autoSelect: [{ type: Input }],
799
- noUnselectLast: [{ type: Input }],
800
- disabled: [{ type: Input }],
801
- tabIndex: [{ type: Input }]
802
- };
1403
+ /** @nocollapse */ McTreeSelection.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: McTreeSelection, deps: [{ token: i0.ElementRef }, { token: i0.IterableDiffers }, { token: i0.ChangeDetectorRef }, { token: 'multiple', attribute: true }, { token: i1$1.Clipboard, optional: true }], target: i0.ɵɵFactoryTarget.Component });
1404
+ /** @nocollapse */ McTreeSelection.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.13", type: McTreeSelection, selector: "mc-tree-selection", inputs: { treeControl: "treeControl", autoSelect: "autoSelect", noUnselectLast: "noUnselectLast", disabled: "disabled", tabIndex: "tabIndex" }, outputs: { navigationChange: "navigationChange", selectionChange: "selectionChange", onSelectAll: "onSelectAll", onCopy: "onCopy" }, host: { listeners: { "blur": "blur()", "focus": "focus($event)", "keydown": "onKeyDown($event)", "window:resize": "updateScrollSize()" }, properties: { "attr.tabindex": "tabIndex", "attr.disabled": "disabled || null" }, classAttribute: "mc-tree-selection" }, providers: [
1405
+ MC_SELECTION_TREE_VALUE_ACCESSOR,
1406
+ { provide: MC_TREE_OPTION_PARENT_COMPONENT, useExisting: McTreeSelection },
1407
+ { provide: McTreeBase, useExisting: McTreeSelection }
1408
+ ], queries: [{ propertyName: "unorderedOptions", predicate: McTreeOption }], viewQueries: [{ propertyName: "nodeOutlet", first: true, predicate: McTreeNodeOutlet, descendants: true, static: true }], exportAs: ["mcTreeSelection"], usesInheritance: true, ngImport: i0, template: '<ng-container mcTreeNodeOutlet></ng-container>', isInline: true, styles: [".mc-tree-selection{display:block}\n"], directives: [{ type: McTreeNodeOutlet, selector: "[mcTreeNodeOutlet]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1409
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: McTreeSelection, decorators: [{
1410
+ type: Component,
1411
+ args: [{
1412
+ selector: 'mc-tree-selection',
1413
+ exportAs: 'mcTreeSelection',
1414
+ template: '<ng-container mcTreeNodeOutlet></ng-container>',
1415
+ styleUrls: ['./tree-selection.scss'],
1416
+ host: {
1417
+ class: 'mc-tree-selection',
1418
+ '[attr.tabindex]': 'tabIndex',
1419
+ '[attr.disabled]': 'disabled || null',
1420
+ '(blur)': 'blur()',
1421
+ '(focus)': 'focus($event)',
1422
+ '(keydown)': 'onKeyDown($event)',
1423
+ '(window:resize)': 'updateScrollSize()'
1424
+ },
1425
+ encapsulation: ViewEncapsulation.None,
1426
+ changeDetection: ChangeDetectionStrategy.OnPush,
1427
+ providers: [
1428
+ MC_SELECTION_TREE_VALUE_ACCESSOR,
1429
+ { provide: MC_TREE_OPTION_PARENT_COMPONENT, useExisting: McTreeSelection },
1430
+ { provide: McTreeBase, useExisting: McTreeSelection }
1431
+ ]
1432
+ }]
1433
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.IterableDiffers }, { type: i0.ChangeDetectorRef }, { type: i1.MultipleMode, decorators: [{
1434
+ type: Attribute,
1435
+ args: ['multiple']
1436
+ }] }, { type: i1$1.Clipboard, decorators: [{
1437
+ type: Optional
1438
+ }] }]; }, propDecorators: { nodeOutlet: [{
1439
+ type: ViewChild,
1440
+ args: [McTreeNodeOutlet, { static: true }]
1441
+ }], unorderedOptions: [{
1442
+ type: ContentChildren,
1443
+ args: [McTreeOption]
1444
+ }], treeControl: [{
1445
+ type: Input
1446
+ }], navigationChange: [{
1447
+ type: Output
1448
+ }], selectionChange: [{
1449
+ type: Output
1450
+ }], onSelectAll: [{
1451
+ type: Output
1452
+ }], onCopy: [{
1453
+ type: Output
1454
+ }], autoSelect: [{
1455
+ type: Input
1456
+ }], noUnselectLast: [{
1457
+ type: Input
1458
+ }], disabled: [{
1459
+ type: Input
1460
+ }], tabIndex: [{
1461
+ type: Input
1462
+ }] } });
803
1463
 
804
1464
  const MC_TREE_DIRECTIVES = [
805
- McTreeSelection,
806
- McTreeOption,
1465
+ McTreeNodeOutlet,
807
1466
  McTreeNodeDef,
1467
+ McTreeNode,
808
1468
  McTreeNodePadding,
1469
+ McTree,
1470
+ McTreeSelection,
1471
+ McTreeOption,
809
1472
  McTreeNodeToggleComponent,
810
1473
  McTreeNodeToggleDirective
811
1474
  ];
812
1475
  class McTreeModule {
813
1476
  }
814
- McTreeModule.decorators = [
815
- { type: NgModule, args: [{
816
- imports: [CommonModule, CdkTreeModule, McPseudoCheckboxModule],
817
- exports: MC_TREE_DIRECTIVES,
818
- declarations: MC_TREE_DIRECTIVES
819
- },] }
820
- ];
1477
+ /** @nocollapse */ McTreeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: McTreeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1478
+ /** @nocollapse */ McTreeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: McTreeModule, declarations: [McTreeNodeOutlet,
1479
+ McTreeNodeDef,
1480
+ McTreeNode,
1481
+ McTreeNodePadding,
1482
+ McTree,
1483
+ McTreeSelection,
1484
+ McTreeOption,
1485
+ McTreeNodeToggleComponent,
1486
+ McTreeNodeToggleDirective], imports: [CommonModule, McPseudoCheckboxModule], exports: [McTreeNodeOutlet,
1487
+ McTreeNodeDef,
1488
+ McTreeNode,
1489
+ McTreeNodePadding,
1490
+ McTree,
1491
+ McTreeSelection,
1492
+ McTreeOption,
1493
+ McTreeNodeToggleComponent,
1494
+ McTreeNodeToggleDirective] });
1495
+ /** @nocollapse */ McTreeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: McTreeModule, imports: [[CommonModule, McPseudoCheckboxModule]] });
1496
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: McTreeModule, decorators: [{
1497
+ type: NgModule,
1498
+ args: [{
1499
+ imports: [CommonModule, McPseudoCheckboxModule],
1500
+ exports: MC_TREE_DIRECTIVES,
1501
+ declarations: MC_TREE_DIRECTIVES
1502
+ }]
1503
+ }] });
1504
+
1505
+ /** Nested tree control. Able to expand/collapse a subtree recursively for NestedNode type. */
1506
+ class NestedTreeControl extends BaseTreeControl {
1507
+ /** Construct with nested tree function getChildren. */
1508
+ constructor(getChildren) {
1509
+ super();
1510
+ this.getChildren = getChildren;
1511
+ }
1512
+ /**
1513
+ * Expands all dataNodes in the tree.
1514
+ *
1515
+ * To make this working, the `dataNodes` variable of the TreeControl must be set to all root level
1516
+ * data nodes of the tree.
1517
+ */
1518
+ expandAll() {
1519
+ this.expansionModel.clear();
1520
+ const allNodes = this.dataNodes.reduce((accumulator, dataNode) => [...accumulator, ...this.getDescendants(dataNode), dataNode], []);
1521
+ this.expansionModel.select(...allNodes);
1522
+ }
1523
+ /** Gets a list of descendant dataNodes of a subtree rooted at given data node recursively. */
1524
+ getDescendants(dataNode) {
1525
+ const descendants = [];
1526
+ this._getDescendants(descendants, dataNode);
1527
+ return descendants.splice(1);
1528
+ }
1529
+ /** A helper function to get descendants recursively. */
1530
+ // todo нужно придумать другое название и понять в чем отличие между getDescendants и _getDescendants
1531
+ /* tslint:disable-next-line:naming-convention */
1532
+ _getDescendants(descendants, dataNode) {
1533
+ descendants.push(dataNode);
1534
+ this.getChildren(dataNode)
1535
+ .pipe(take(1))
1536
+ .subscribe((children) => {
1537
+ if (children && children.length > 0) {
1538
+ children.forEach((child) => this._getDescendants(descendants, child));
1539
+ }
1540
+ });
1541
+ }
1542
+ }
821
1543
 
822
1544
  /**
823
1545
  * Tree flattener to convert a normal type of node to node with children & level information.
@@ -1009,5 +1731,5 @@ class McTreeNestedDataSource extends DataSource {
1009
1731
  * Generated bundle index. Do not edit.
1010
1732
  */
1011
1733
 
1012
- export { MC_SELECTION_TREE_VALUE_ACCESSOR, MC_TREE_OPTION_PARENT_COMPONENT, McTreeFlatDataSource, McTreeFlattener, McTreeModule, McTreeNavigationChange, McTreeNestedDataSource, McTreeNodeDef, McTreeNodePadding, McTreeNodeToggleComponent, McTreeNodeToggleDirective, McTreeOption, McTreeOptionChange, McTreeSelection, McTreeSelectionChange };
1734
+ export { BaseTreeControl, FlatTreeControl, MC_SELECTION_TREE_VALUE_ACCESSOR, MC_TREE_OPTION_PARENT_COMPONENT, McTree, McTreeBase, McTreeCopyEvent, McTreeFlatDataSource, McTreeFlattener, McTreeModule, McTreeNavigationChange, McTreeNestedDataSource, McTreeNode, McTreeNodeDef, McTreeNodeOutlet, McTreeNodeOutletContext, McTreeNodePadding, McTreeNodeToggleBase, McTreeNodeToggleBaseDirective, McTreeNodeToggleComponent, McTreeNodeToggleDirective, McTreeNodeToggleMixinBase, McTreeOption, McTreeOptionChange, McTreeSelectAllEvent, McTreeSelection, McTreeSelectionChange, NestedTreeControl, defaultCompareValues, defaultCompareViewValues };
1013
1735
  //# sourceMappingURL=ptsecurity-mosaic-tree.js.map