@ptsecurity/mosaic 13.6.1 → 13.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (907) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +6 -6
  3. package/_theming.scss +7238 -7141
  4. package/_visual.scss +2724 -2695
  5. package/autocomplete/autocomplete-origin.directive.d.ts +12 -12
  6. package/autocomplete/autocomplete-trigger.directive.d.ts +167 -167
  7. package/autocomplete/autocomplete.component.d.ts +73 -73
  8. package/autocomplete/autocomplete.module.d.ts +12 -12
  9. package/autocomplete/index.d.ts +1 -1
  10. package/autocomplete/ptsecurity-mosaic-autocomplete.d.ts +5 -5
  11. package/autocomplete/public-api.d.ts +4 -4
  12. package/button/button.component.d.ts +40 -40
  13. package/button/button.module.d.ts +10 -10
  14. package/button/index.d.ts +1 -1
  15. package/button/ptsecurity-mosaic-button.d.ts +5 -5
  16. package/button/public-api.d.ts +2 -2
  17. package/button-toggle/button-toggle.component.d.ts +141 -141
  18. package/button-toggle/button-toggle.module.d.ts +9 -9
  19. package/button-toggle/index.d.ts +1 -1
  20. package/button-toggle/ptsecurity-mosaic-button-toggle.d.ts +5 -5
  21. package/button-toggle/public-api.d.ts +2 -2
  22. package/card/card.component.d.ts +26 -26
  23. package/card/card.module.d.ts +10 -10
  24. package/card/index.d.ts +1 -1
  25. package/card/ptsecurity-mosaic-card.d.ts +5 -5
  26. package/card/public-api.d.ts +2 -2
  27. package/checkbox/README.md +1 -1
  28. package/checkbox/checkbox-config.d.ts +13 -13
  29. package/checkbox/checkbox-module.d.ts +9 -9
  30. package/checkbox/checkbox-required-validator.d.ts +13 -13
  31. package/checkbox/checkbox.d.ts +140 -140
  32. package/checkbox/index.d.ts +1 -1
  33. package/checkbox/ptsecurity-mosaic-checkbox.d.ts +5 -5
  34. package/checkbox/public-api.d.ts +4 -4
  35. package/core/animation/animation.d.ts +6 -6
  36. package/core/animation/fade-animations.d.ts +2 -2
  37. package/core/animation/index.d.ts +3 -3
  38. package/core/animation/select-animations.d.ts +12 -12
  39. package/core/common-behaviors/color.d.ts +19 -19
  40. package/core/common-behaviors/common-module.d.ts +25 -25
  41. package/core/common-behaviors/constructor.d.ts +9 -9
  42. package/core/common-behaviors/disabled.d.ts +8 -8
  43. package/core/common-behaviors/error-state.d.ts +25 -25
  44. package/core/common-behaviors/index.d.ts +5 -5
  45. package/core/common-behaviors/tabindex.d.ts +8 -8
  46. package/core/error/error-options.d.ts +14 -14
  47. package/core/formatters/date/formatter.d.ts +203 -203
  48. package/core/formatters/date/templates/en-US.d.ts +74 -74
  49. package/core/formatters/date/templates/ru-RU.d.ts +74 -74
  50. package/core/formatters/index.d.ts +9 -9
  51. package/core/formatters/number/formatter.d.ts +27 -27
  52. package/core/forms/forms-module.d.ts +7 -7
  53. package/core/forms/forms.directive.d.ts +22 -22
  54. package/core/forms/index.d.ts +2 -2
  55. package/core/highlight/highlight.pipe.d.ts +7 -7
  56. package/core/highlight/index.d.ts +9 -9
  57. package/core/index.d.ts +1 -1
  58. package/core/label/label-options.d.ts +13 -13
  59. package/core/line/line.d.ts +28 -28
  60. package/core/option/action.d.ts +42 -42
  61. package/core/option/index.d.ts +4 -4
  62. package/core/option/optgroup.d.ts +16 -16
  63. package/core/option/option-module.d.ts +11 -11
  64. package/core/option/option.d.ts +115 -115
  65. package/core/overlay/overlay-position-map.d.ts +34 -34
  66. package/core/pop-up/constants.d.ts +29 -29
  67. package/core/pop-up/index.d.ts +3 -3
  68. package/core/pop-up/pop-up-trigger.d.ts +70 -70
  69. package/core/pop-up/pop-up.d.ts +36 -36
  70. package/core/ptsecurity-mosaic-core.d.ts +5 -5
  71. package/core/public-api.d.ts +17 -17
  72. package/core/select/constants.d.ts +23 -23
  73. package/core/select/errors.d.ts +19 -19
  74. package/core/select/events.d.ts +1 -1
  75. package/core/select/index.d.ts +3 -3
  76. package/core/selection/constants.d.ts +4 -4
  77. package/core/selection/index.d.ts +3 -3
  78. package/core/selection/pseudo-checkbox/pseudo-checkbox.d.ts +30 -30
  79. package/core/selection/pseudo-checkbox/pseudo-checkbox.module.d.ts +8 -8
  80. package/core/services/measure-scrollbar.service.d.ts +11 -11
  81. package/core/utils/index.d.ts +1 -1
  82. package/core/utils/public-api.d.ts +1 -1
  83. package/core/utils/utils.d.ts +2 -2
  84. package/core/validation/index.d.ts +1 -1
  85. package/core/validation/validation.d.ts +18 -18
  86. package/core/version.d.ts +2 -2
  87. package/datepicker/calendar-body.component.d.ts +63 -63
  88. package/datepicker/calendar.component.d.ts +151 -151
  89. package/datepicker/datepicker-animations.d.ts +9 -9
  90. package/datepicker/datepicker-errors.d.ts +2 -2
  91. package/datepicker/datepicker-input.directive.d.ts +178 -178
  92. package/datepicker/datepicker-intl.d.ts +32 -32
  93. package/datepicker/datepicker-module.d.ts +20 -20
  94. package/datepicker/datepicker-toggle.component.d.ts +35 -35
  95. package/datepicker/datepicker.component.d.ts +158 -158
  96. package/datepicker/index.d.ts +1 -1
  97. package/datepicker/month-view.component.d.ts +93 -93
  98. package/datepicker/multi-year-view.component.d.ts +72 -72
  99. package/datepicker/ptsecurity-mosaic-datepicker.d.ts +5 -5
  100. package/datepicker/public-api.d.ts +11 -11
  101. package/datepicker/year-view.component.d.ts +90 -90
  102. package/design-tokens/index.d.ts +1 -1
  103. package/design-tokens/legacy-2017/tokens/components/alert.json5 +83 -83
  104. package/design-tokens/legacy-2017/tokens/components/autocomplete.json5 +11 -11
  105. package/design-tokens/legacy-2017/tokens/components/badge.json5 +174 -174
  106. package/design-tokens/legacy-2017/tokens/components/button-toggle.json5 +10 -10
  107. package/design-tokens/legacy-2017/tokens/components/button.json5 +142 -142
  108. package/design-tokens/legacy-2017/tokens/components/card.json5 +51 -51
  109. package/design-tokens/legacy-2017/tokens/components/checkbox.json5 +97 -97
  110. package/design-tokens/legacy-2017/tokens/components/datepicker.json5 +64 -64
  111. package/design-tokens/legacy-2017/tokens/components/divider.json5 +14 -14
  112. package/design-tokens/legacy-2017/tokens/components/dl.json5 +38 -38
  113. package/design-tokens/legacy-2017/tokens/components/dropdown.json5 +48 -48
  114. package/design-tokens/legacy-2017/tokens/components/form-field.json5 +92 -92
  115. package/design-tokens/legacy-2017/tokens/components/forms.json5 +52 -52
  116. package/design-tokens/legacy-2017/tokens/components/icon.json5 +104 -104
  117. package/design-tokens/legacy-2017/tokens/components/input.json5 +12 -12
  118. package/design-tokens/legacy-2017/tokens/components/link.json5 +50 -50
  119. package/design-tokens/legacy-2017/tokens/components/list.json5 +13 -13
  120. package/design-tokens/legacy-2017/tokens/components/loader-overlay.json5 +23 -0
  121. package/design-tokens/legacy-2017/tokens/components/modal.json5 +81 -81
  122. package/design-tokens/legacy-2017/tokens/components/navbar.json5 +70 -70
  123. package/design-tokens/legacy-2017/tokens/components/optgroup.json5 +10 -10
  124. package/design-tokens/legacy-2017/tokens/components/option.json5 +12 -12
  125. package/design-tokens/legacy-2017/tokens/components/popover.json5 +68 -68
  126. package/design-tokens/legacy-2017/tokens/components/popup.json5 +16 -16
  127. package/design-tokens/legacy-2017/tokens/components/progress-bar.json5 +13 -13
  128. package/design-tokens/legacy-2017/tokens/components/progress-spinner.json5 +7 -7
  129. package/design-tokens/legacy-2017/tokens/components/radio.json5 +45 -45
  130. package/design-tokens/legacy-2017/tokens/components/select.json5 +24 -24
  131. package/design-tokens/legacy-2017/tokens/components/sidepanel.json5 +44 -44
  132. package/design-tokens/legacy-2017/tokens/components/table.json5 +15 -15
  133. package/design-tokens/legacy-2017/tokens/components/tabs.json5 +101 -101
  134. package/design-tokens/legacy-2017/tokens/components/tags.json5 +134 -134
  135. package/design-tokens/legacy-2017/tokens/components/textarea.json5 +12 -12
  136. package/design-tokens/legacy-2017/tokens/components/timepicker.json5 +7 -7
  137. package/design-tokens/legacy-2017/tokens/components/toggle.json5 +79 -79
  138. package/design-tokens/legacy-2017/tokens/components/tooltip.json5 +83 -83
  139. package/design-tokens/legacy-2017/tokens/components/tree.json5 +15 -15
  140. package/design-tokens/legacy-2017/tokens/properties/aliases.json5 +3 -3
  141. package/design-tokens/legacy-2017/tokens/properties/colors.json5 +119 -119
  142. package/design-tokens/legacy-2017/tokens/properties/font.json5 +12 -12
  143. package/design-tokens/legacy-2017/tokens/properties/globals.json5 +49 -49
  144. package/design-tokens/legacy-2017/tokens/properties/padding.json5 +3 -3
  145. package/design-tokens/legacy-2017/tokens/properties/palette.json5 +163 -163
  146. package/design-tokens/legacy-2017/tokens/properties/typography.json5 +175 -175
  147. package/design-tokens/legacy-2017/tokens.d.ts +7873 -7844
  148. package/design-tokens/pt-2022/tokens/components/alert.json5 +83 -83
  149. package/design-tokens/pt-2022/tokens/components/autocomplete.json5 +11 -11
  150. package/design-tokens/pt-2022/tokens/components/badge.json5 +174 -174
  151. package/design-tokens/pt-2022/tokens/components/button-toggle.json5 +10 -10
  152. package/design-tokens/pt-2022/tokens/components/button.json5 +142 -142
  153. package/design-tokens/pt-2022/tokens/components/card.json5 +51 -51
  154. package/design-tokens/pt-2022/tokens/components/checkbox.json5 +97 -97
  155. package/design-tokens/pt-2022/tokens/components/datepicker.json5 +64 -64
  156. package/design-tokens/pt-2022/tokens/components/divider.json5 +14 -14
  157. package/design-tokens/pt-2022/tokens/components/dl.json5 +38 -38
  158. package/design-tokens/pt-2022/tokens/components/dropdown.json5 +48 -48
  159. package/design-tokens/pt-2022/tokens/components/form-field.json5 +92 -92
  160. package/design-tokens/pt-2022/tokens/components/forms.json5 +52 -52
  161. package/design-tokens/pt-2022/tokens/components/icon.json5 +104 -104
  162. package/design-tokens/pt-2022/tokens/components/input.json5 +12 -12
  163. package/design-tokens/pt-2022/tokens/components/link.json5 +50 -50
  164. package/design-tokens/pt-2022/tokens/components/list.json5 +13 -13
  165. package/design-tokens/pt-2022/tokens/components/loader-overlay.json5 +23 -0
  166. package/design-tokens/pt-2022/tokens/components/modal.json5 +81 -81
  167. package/design-tokens/pt-2022/tokens/components/navbar.json5 +70 -70
  168. package/design-tokens/pt-2022/tokens/components/optgroup.json5 +10 -10
  169. package/design-tokens/pt-2022/tokens/components/option.json5 +12 -12
  170. package/design-tokens/pt-2022/tokens/components/popover.json5 +68 -68
  171. package/design-tokens/pt-2022/tokens/components/popup.json5 +16 -16
  172. package/design-tokens/pt-2022/tokens/components/progress-bar.json5 +13 -13
  173. package/design-tokens/pt-2022/tokens/components/progress-spinner.json5 +7 -7
  174. package/design-tokens/pt-2022/tokens/components/radio.json5 +45 -45
  175. package/design-tokens/pt-2022/tokens/components/select.json5 +24 -24
  176. package/design-tokens/pt-2022/tokens/components/sidepanel.json5 +44 -44
  177. package/design-tokens/pt-2022/tokens/components/table.json5 +15 -15
  178. package/design-tokens/pt-2022/tokens/components/tabs.json5 +101 -101
  179. package/design-tokens/pt-2022/tokens/components/tags.json5 +137 -137
  180. package/design-tokens/pt-2022/tokens/components/textarea.json5 +12 -12
  181. package/design-tokens/pt-2022/tokens/components/timepicker.json5 +7 -7
  182. package/design-tokens/pt-2022/tokens/components/toggle.json5 +79 -79
  183. package/design-tokens/pt-2022/tokens/components/tooltip.json5 +83 -83
  184. package/design-tokens/pt-2022/tokens/components/tree.json5 +15 -15
  185. package/design-tokens/pt-2022/tokens/properties/aliases.json5 +3 -3
  186. package/design-tokens/pt-2022/tokens/properties/colors.json5 +122 -122
  187. package/design-tokens/pt-2022/tokens/properties/font.json5 +15 -15
  188. package/design-tokens/pt-2022/tokens/properties/globals.json5 +49 -49
  189. package/design-tokens/pt-2022/tokens/properties/padding.json5 +3 -3
  190. package/design-tokens/pt-2022/tokens/properties/palette.json5 +232 -232
  191. package/design-tokens/pt-2022/tokens/properties/typography.json5 +175 -175
  192. package/design-tokens/pt-2022/tokens.d.ts +9205 -9176
  193. package/design-tokens/ptsecurity-mosaic-design-tokens.d.ts +5 -5
  194. package/design-tokens/public-api.d.ts +3 -3
  195. package/design-tokens/style-dictionary/build.js +76 -63
  196. package/design-tokens/style-dictionary/configs/css.js +13 -13
  197. package/design-tokens/style-dictionary/configs/figma.js +11 -0
  198. package/design-tokens/style-dictionary/configs/index.js +48 -48
  199. package/design-tokens/style-dictionary/configs/js.js +9 -9
  200. package/design-tokens/style-dictionary/configs/scss.js +23 -23
  201. package/design-tokens/style-dictionary/figma-types.js +41 -0
  202. package/design-tokens/style-dictionary/filters/color.js +7 -7
  203. package/design-tokens/style-dictionary/filters/palette.js +7 -7
  204. package/design-tokens/style-dictionary/filters/size.js +7 -7
  205. package/design-tokens/style-dictionary/filters/typography.js +7 -7
  206. package/design-tokens/style-dictionary/formats/figma.js +104 -0
  207. package/design-tokens/style-dictionary/formats/palette.js +25 -25
  208. package/design-tokens/style-dictionary/formats/typography.js +52 -52
  209. package/design-tokens/style-dictionary/transformGroups/css.js +13 -13
  210. package/design-tokens/style-dictionary/transformGroups/figma.js +21 -0
  211. package/design-tokens/style-dictionary/transformGroups/scss.js +12 -12
  212. package/design-tokens/style-dictionary/transformGroups/ts.js +11 -11
  213. package/design-tokens/style-dictionary/transforms/attribute/figma-border.js +18 -0
  214. package/design-tokens/style-dictionary/transforms/attribute/figma-color.js +25 -0
  215. package/design-tokens/style-dictionary/transforms/attribute/figma-default.js +10 -0
  216. package/design-tokens/style-dictionary/transforms/attribute/figma-font.js +31 -0
  217. package/design-tokens/style-dictionary/transforms/attribute/figma-group.js +17 -0
  218. package/design-tokens/style-dictionary/transforms/attribute/figma-opacity.js +10 -0
  219. package/design-tokens/style-dictionary/transforms/attribute/figma-shadow.js +66 -0
  220. package/design-tokens/style-dictionary/transforms/attribute/figma-sizing.js +16 -0
  221. package/design-tokens/style-dictionary/transforms/attribute/figma-spacing.js +15 -0
  222. package/design-tokens/style-dictionary/transforms/attribute/figma-typography.js +24 -0
  223. package/design-tokens/style-dictionary/transforms/attribute/palette.js +9 -9
  224. package/design-tokens/style-dictionary/transforms/attribute/prefix.js +11 -11
  225. package/design-tokens/style-dictionary/transforms/attribute/size.js +8 -8
  226. package/design-tokens/style-dictionary/transforms/attribute/typography.js +9 -9
  227. package/design-tokens/style-dictionary/transforms/value/figma-values.js +7 -0
  228. package/divider/divider.component.d.ts +11 -11
  229. package/divider/divider.module.d.ts +8 -8
  230. package/divider/index.d.ts +1 -1
  231. package/divider/ptsecurity-mosaic-divider.d.ts +5 -5
  232. package/divider/public-api.d.ts +2 -2
  233. package/dl/dl.component.d.ts +26 -26
  234. package/dl/dl.module.d.ts +10 -10
  235. package/dl/index.d.ts +1 -1
  236. package/dl/ptsecurity-mosaic-dl.d.ts +5 -5
  237. package/dl/public-api.d.ts +2 -2
  238. package/dropdown/dropdown-animations.d.ts +11 -11
  239. package/dropdown/dropdown-content.directive.d.ts +32 -32
  240. package/dropdown/dropdown-errors.d.ts +17 -17
  241. package/dropdown/dropdown-item.component.d.ts +50 -50
  242. package/dropdown/dropdown-trigger.directive.d.ts +136 -136
  243. package/dropdown/dropdown.component.d.ts +121 -121
  244. package/dropdown/dropdown.module.d.ts +13 -13
  245. package/dropdown/dropdown.types.d.ts +53 -53
  246. package/dropdown/index.d.ts +1 -1
  247. package/dropdown/ptsecurity-mosaic-dropdown.d.ts +5 -5
  248. package/dropdown/public-api.d.ts +8 -8
  249. package/esm2020/autocomplete/autocomplete-origin.directive.mjs +21 -21
  250. package/esm2020/autocomplete/autocomplete-trigger.directive.mjs +555 -555
  251. package/esm2020/autocomplete/autocomplete.component.mjs +154 -154
  252. package/esm2020/autocomplete/autocomplete.module.mjs +34 -34
  253. package/esm2020/autocomplete/index.mjs +2 -2
  254. package/esm2020/autocomplete/ptsecurity-mosaic-autocomplete.mjs +4 -4
  255. package/esm2020/autocomplete/public-api.mjs +5 -5
  256. package/esm2020/button/button.component.mjs +137 -137
  257. package/esm2020/button/button.module.mjs +38 -38
  258. package/esm2020/button/index.mjs +2 -2
  259. package/esm2020/button/ptsecurity-mosaic-button.mjs +4 -4
  260. package/esm2020/button/public-api.mjs +3 -3
  261. package/esm2020/button-toggle/button-toggle.component.mjs +362 -362
  262. package/esm2020/button-toggle/button-toggle.module.mjs +19 -19
  263. package/esm2020/button-toggle/index.mjs +2 -2
  264. package/esm2020/button-toggle/ptsecurity-mosaic-button-toggle.mjs +4 -4
  265. package/esm2020/button-toggle/public-api.mjs +3 -3
  266. package/esm2020/card/card.component.mjs +80 -80
  267. package/esm2020/card/card.module.mjs +30 -30
  268. package/esm2020/card/index.mjs +2 -2
  269. package/esm2020/card/ptsecurity-mosaic-card.mjs +4 -4
  270. package/esm2020/card/public-api.mjs +3 -3
  271. package/esm2020/checkbox/checkbox-config.mjs +6 -6
  272. package/esm2020/checkbox/checkbox-module.mjs +19 -19
  273. package/esm2020/checkbox/checkbox-required-validator.mjs +27 -27
  274. package/esm2020/checkbox/checkbox.mjs +316 -316
  275. package/esm2020/checkbox/index.mjs +2 -2
  276. package/esm2020/checkbox/ptsecurity-mosaic-checkbox.mjs +4 -4
  277. package/esm2020/checkbox/public-api.mjs +5 -5
  278. package/esm2020/core/animation/animation.mjs +8 -8
  279. package/esm2020/core/animation/fade-animations.mjs +9 -9
  280. package/esm2020/core/animation/index.mjs +4 -4
  281. package/esm2020/core/animation/select-animations.mjs +45 -45
  282. package/esm2020/core/common-behaviors/color.mjs +30 -30
  283. package/esm2020/core/common-behaviors/common-module.mjs +83 -83
  284. package/esm2020/core/common-behaviors/constructor.mjs +2 -2
  285. package/esm2020/core/common-behaviors/disabled.mjs +17 -17
  286. package/esm2020/core/common-behaviors/error-state.mjs +31 -31
  287. package/esm2020/core/common-behaviors/index.mjs +6 -6
  288. package/esm2020/core/common-behaviors/tabindex.mjs +18 -18
  289. package/esm2020/core/error/error-options.mjs +26 -26
  290. package/esm2020/core/formatters/date/formatter.mjs +359 -359
  291. package/esm2020/core/formatters/date/templates/en-US.mjs +281 -281
  292. package/esm2020/core/formatters/date/templates/ru-RU.mjs +281 -281
  293. package/esm2020/core/formatters/index.mjs +20 -20
  294. package/esm2020/core/formatters/number/formatter.mjs +105 -105
  295. package/esm2020/core/forms/forms-module.mjs +24 -24
  296. package/esm2020/core/forms/forms.directive.mjs +66 -66
  297. package/esm2020/core/forms/index.mjs +3 -3
  298. package/esm2020/core/highlight/highlight.pipe.mjs +17 -17
  299. package/esm2020/core/highlight/index.mjs +19 -19
  300. package/esm2020/core/index.mjs +2 -2
  301. package/esm2020/core/label/label-options.mjs +4 -4
  302. package/esm2020/core/line/line.mjs +70 -70
  303. package/esm2020/core/option/action.mjs +121 -121
  304. package/esm2020/core/option/index.mjs +5 -5
  305. package/esm2020/core/option/optgroup.mjs +31 -31
  306. package/esm2020/core/option/option-module.mjs +21 -21
  307. package/esm2020/core/option/option.mjs +257 -257
  308. package/esm2020/core/overlay/overlay-position-map.mjs +244 -244
  309. package/esm2020/core/pop-up/constants.mjs +34 -34
  310. package/esm2020/core/pop-up/index.mjs +4 -4
  311. package/esm2020/core/pop-up/pop-up-trigger.mjs +239 -239
  312. package/esm2020/core/pop-up/pop-up.mjs +94 -94
  313. package/esm2020/core/ptsecurity-mosaic-core.mjs +4 -4
  314. package/esm2020/core/public-api.mjs +18 -18
  315. package/esm2020/core/select/constants.mjs +27 -27
  316. package/esm2020/core/select/errors.mjs +26 -26
  317. package/esm2020/core/select/events.mjs +2 -2
  318. package/esm2020/core/select/index.mjs +4 -4
  319. package/esm2020/core/selection/constants.mjs +6 -6
  320. package/esm2020/core/selection/index.mjs +4 -4
  321. package/esm2020/core/selection/pseudo-checkbox/pseudo-checkbox.mjs +49 -49
  322. package/esm2020/core/selection/pseudo-checkbox/pseudo-checkbox.module.mjs +18 -18
  323. package/esm2020/core/services/measure-scrollbar.service.mjs +48 -48
  324. package/esm2020/core/utils/index.mjs +2 -2
  325. package/esm2020/core/utils/public-api.mjs +2 -2
  326. package/esm2020/core/utils/utils.mjs +5 -5
  327. package/esm2020/core/validation/index.mjs +2 -2
  328. package/esm2020/core/validation/validation.mjs +118 -118
  329. package/esm2020/core/version.mjs +3 -3
  330. package/esm2020/datepicker/calendar-body.component.mjs +106 -106
  331. package/esm2020/datepicker/calendar.component.mjs +362 -362
  332. package/esm2020/datepicker/datepicker-animations.mjs +32 -32
  333. package/esm2020/datepicker/datepicker-errors.mjs +6 -6
  334. package/esm2020/datepicker/datepicker-input.directive.mjs +938 -938
  335. package/esm2020/datepicker/datepicker-intl.mjs +40 -40
  336. package/esm2020/datepicker/datepicker-module.mjs +107 -107
  337. package/esm2020/datepicker/datepicker-toggle.component.mjs +86 -86
  338. package/esm2020/datepicker/datepicker.component.mjs +404 -404
  339. package/esm2020/datepicker/index.mjs +2 -2
  340. package/esm2020/datepicker/month-view.component.mjs +257 -257
  341. package/esm2020/datepicker/multi-year-view.component.mjs +218 -218
  342. package/esm2020/datepicker/ptsecurity-mosaic-datepicker.mjs +4 -4
  343. package/esm2020/datepicker/public-api.mjs +12 -12
  344. package/esm2020/datepicker/year-view.component.mjs +253 -253
  345. package/esm2020/design-tokens/index.mjs +2 -2
  346. package/esm2020/design-tokens/legacy-2017/tokens.mjs +1167 -1138
  347. package/esm2020/design-tokens/pt-2022/tokens.mjs +1237 -1208
  348. package/esm2020/design-tokens/ptsecurity-mosaic-design-tokens.mjs +4 -4
  349. package/esm2020/design-tokens/public-api.mjs +4 -4
  350. package/esm2020/divider/divider.component.mjs +39 -39
  351. package/esm2020/divider/divider.module.mjs +18 -18
  352. package/esm2020/divider/index.mjs +2 -2
  353. package/esm2020/divider/ptsecurity-mosaic-divider.mjs +4 -4
  354. package/esm2020/divider/public-api.mjs +3 -3
  355. package/esm2020/dl/dl.component.mjs +78 -78
  356. package/esm2020/dl/dl.module.mjs +42 -42
  357. package/esm2020/dl/index.mjs +2 -2
  358. package/esm2020/dl/ptsecurity-mosaic-dl.mjs +4 -4
  359. package/esm2020/dl/public-api.mjs +3 -3
  360. package/esm2020/dropdown/dropdown-animations.mjs +41 -41
  361. package/esm2020/dropdown/dropdown-content.directive.mjs +64 -64
  362. package/esm2020/dropdown/dropdown-errors.mjs +29 -29
  363. package/esm2020/dropdown/dropdown-item.component.mjs +139 -139
  364. package/esm2020/dropdown/dropdown-trigger.directive.mjs +489 -489
  365. package/esm2020/dropdown/dropdown.component.mjs +292 -292
  366. package/esm2020/dropdown/dropdown.module.mjs +50 -50
  367. package/esm2020/dropdown/dropdown.types.mjs +24 -24
  368. package/esm2020/dropdown/index.mjs +2 -2
  369. package/esm2020/dropdown/ptsecurity-mosaic-dropdown.mjs +4 -4
  370. package/esm2020/dropdown/public-api.mjs +9 -9
  371. package/esm2020/form-field/cleaner.mjs +23 -23
  372. package/esm2020/form-field/form-field-control.mjs +5 -5
  373. package/esm2020/form-field/form-field-errors.mjs +7 -7
  374. package/esm2020/form-field/form-field.mjs +225 -225
  375. package/esm2020/form-field/form-field.module.mjs +57 -57
  376. package/esm2020/form-field/hint.mjs +34 -23
  377. package/esm2020/form-field/index.mjs +2 -2
  378. package/esm2020/form-field/password-hint.mjs +139 -139
  379. package/esm2020/form-field/prefix.mjs +13 -13
  380. package/esm2020/form-field/ptsecurity-mosaic-form-field.mjs +4 -4
  381. package/esm2020/form-field/public-api.mjs +11 -11
  382. package/esm2020/form-field/stepper.mjs +55 -55
  383. package/esm2020/form-field/suffix.mjs +13 -13
  384. package/esm2020/icon/icon.component.mjs +44 -44
  385. package/esm2020/icon/icon.module.mjs +38 -38
  386. package/esm2020/icon/index.mjs +2 -2
  387. package/esm2020/icon/ptsecurity-mosaic-icon.mjs +4 -4
  388. package/esm2020/icon/public-api.mjs +3 -3
  389. package/esm2020/index.mjs +2 -2
  390. package/esm2020/input/index.mjs +2 -2
  391. package/esm2020/input/input-errors.mjs +4 -4
  392. package/esm2020/input/input-number-validators.mjs +92 -92
  393. package/esm2020/input/input-number.mjs +163 -163
  394. package/esm2020/input/input-password.mjs +372 -372
  395. package/esm2020/input/input-value-accessor.mjs +3 -3
  396. package/esm2020/input/input.mjs +334 -334
  397. package/esm2020/input/input.module.mjs +65 -65
  398. package/esm2020/input/ptsecurity-mosaic-input.mjs +4 -4
  399. package/esm2020/input/public-api.mjs +7 -7
  400. package/esm2020/link/index.mjs +2 -2
  401. package/esm2020/link/link.component.mjs +107 -107
  402. package/esm2020/link/link.module.mjs +26 -26
  403. package/esm2020/link/ptsecurity-mosaic-link.mjs +4 -4
  404. package/esm2020/link/public-api.mjs +3 -3
  405. package/esm2020/list/index.mjs +2 -2
  406. package/esm2020/list/list-selection.component.mjs +689 -686
  407. package/esm2020/list/list.component.mjs +44 -44
  408. package/esm2020/list/list.module.mjs +55 -55
  409. package/esm2020/list/ptsecurity-mosaic-list.mjs +4 -4
  410. package/esm2020/list/public-api.mjs +4 -4
  411. package/esm2020/loader-overlay/index.mjs +2 -0
  412. package/esm2020/loader-overlay/loader-overlay.component.mjs +99 -0
  413. package/esm2020/loader-overlay/loader-overlay.module.mjs +50 -0
  414. package/esm2020/loader-overlay/ptsecurity-mosaic-loader-overlay.mjs +5 -0
  415. package/esm2020/loader-overlay/public-api.mjs +3 -0
  416. package/esm2020/modal/css-unit.pipe.mjs +17 -17
  417. package/esm2020/modal/index.mjs +2 -2
  418. package/esm2020/modal/modal-control.service.mjs +85 -85
  419. package/esm2020/modal/modal-ref.class.mjs +8 -8
  420. package/esm2020/modal/modal-util.mjs +17 -17
  421. package/esm2020/modal/modal.component.mjs +509 -501
  422. package/esm2020/modal/modal.directive.mjs +52 -52
  423. package/esm2020/modal/modal.module.mjs +72 -72
  424. package/esm2020/modal/modal.service.mjs +124 -124
  425. package/esm2020/modal/modal.type.mjs +7 -7
  426. package/esm2020/modal/ptsecurity-mosaic-modal.mjs +4 -4
  427. package/esm2020/modal/public-api.mjs +7 -7
  428. package/esm2020/navbar/index.mjs +2 -2
  429. package/esm2020/navbar/navbar-item.component.mjs +582 -582
  430. package/esm2020/navbar/navbar.component.mjs +239 -237
  431. package/esm2020/navbar/navbar.module.mjs +92 -92
  432. package/esm2020/navbar/ptsecurity-mosaic-navbar.mjs +4 -4
  433. package/esm2020/navbar/public-api.mjs +5 -5
  434. package/esm2020/navbar/vertical-navbar.animation.mjs +10 -10
  435. package/esm2020/navbar/vertical-navbar.component.mjs +114 -114
  436. package/esm2020/popover/index.mjs +2 -2
  437. package/esm2020/popover/popover-animations.mjs +16 -16
  438. package/esm2020/popover/popover-confirm.component.mjs +108 -108
  439. package/esm2020/popover/popover.component.mjs +253 -253
  440. package/esm2020/popover/popover.module.mjs +24 -24
  441. package/esm2020/popover/ptsecurity-mosaic-popover.mjs +4 -4
  442. package/esm2020/popover/public-api.mjs +5 -5
  443. package/esm2020/progress-bar/index.mjs +2 -2
  444. package/esm2020/progress-bar/progress-bar.component.mjs +42 -42
  445. package/esm2020/progress-bar/progress-bar.module.mjs +30 -30
  446. package/esm2020/progress-bar/ptsecurity-mosaic-progress-bar.mjs +4 -4
  447. package/esm2020/progress-bar/public-api.mjs +3 -3
  448. package/esm2020/progress-spinner/index.mjs +2 -2
  449. package/esm2020/progress-spinner/progress-spinner.component.mjs +46 -46
  450. package/esm2020/progress-spinner/progress-spinner.module.mjs +30 -30
  451. package/esm2020/progress-spinner/ptsecurity-mosaic-progress-spinner.mjs +4 -4
  452. package/esm2020/progress-spinner/public-api.mjs +3 -3
  453. package/esm2020/ptsecurity-mosaic.mjs +4 -4
  454. package/esm2020/public-api.mjs +2 -2
  455. package/esm2020/radio/index.mjs +2 -2
  456. package/esm2020/radio/ptsecurity-mosaic-radio.mjs +4 -4
  457. package/esm2020/radio/public-api.mjs +3 -3
  458. package/esm2020/radio/radio.component.mjs +458 -458
  459. package/esm2020/radio/radio.module.mjs +20 -20
  460. package/esm2020/select/index.mjs +2 -2
  461. package/esm2020/select/ptsecurity-mosaic-select.mjs +4 -4
  462. package/esm2020/select/public-api.mjs +4 -4
  463. package/esm2020/select/select-option.directive.mjs +65 -65
  464. package/esm2020/select/select.component.mjs +1117 -1117
  465. package/esm2020/select/select.module.mjs +73 -73
  466. package/esm2020/sidebar/index.mjs +2 -2
  467. package/esm2020/sidebar/ptsecurity-mosaic-sidebar.mjs +4 -4
  468. package/esm2020/sidebar/public-api.mjs +3 -3
  469. package/esm2020/sidebar/sidebar-animations.mjs +23 -23
  470. package/esm2020/sidebar/sidebar.component.mjs +146 -146
  471. package/esm2020/sidebar/sidebar.module.mjs +30 -30
  472. package/esm2020/sidepanel/index.mjs +2 -2
  473. package/esm2020/sidepanel/ptsecurity-mosaic-sidepanel.mjs +4 -4
  474. package/esm2020/sidepanel/public-api.mjs +7 -7
  475. package/esm2020/sidepanel/sidepanel-animations.mjs +26 -26
  476. package/esm2020/sidepanel/sidepanel-config.mjs +26 -26
  477. package/esm2020/sidepanel/sidepanel-container.component.mjs +106 -106
  478. package/esm2020/sidepanel/sidepanel-directives.mjs +159 -159
  479. package/esm2020/sidepanel/sidepanel-ref.mjs +53 -53
  480. package/esm2020/sidepanel/sidepanel.module.mjs +74 -74
  481. package/esm2020/sidepanel/sidepanel.service.mjs +167 -167
  482. package/esm2020/splitter/index.mjs +2 -2
  483. package/esm2020/splitter/ptsecurity-mosaic-splitter.mjs +4 -4
  484. package/esm2020/splitter/public-api.mjs +3 -3
  485. package/esm2020/splitter/splitter.component.mjs +482 -482
  486. package/esm2020/splitter/splitter.module.mjs +40 -40
  487. package/esm2020/table/index.mjs +2 -2
  488. package/esm2020/table/ptsecurity-mosaic-table.mjs +4 -4
  489. package/esm2020/table/public-api.mjs +3 -3
  490. package/esm2020/table/table.component.mjs +16 -16
  491. package/esm2020/table/table.module.mjs +30 -30
  492. package/esm2020/tabs/index.mjs +2 -2
  493. package/esm2020/tabs/paginated-tab-header.mjs +479 -479
  494. package/esm2020/tabs/ptsecurity-mosaic-tabs.mjs +4 -4
  495. package/esm2020/tabs/public-api.mjs +11 -11
  496. package/esm2020/tabs/tab-body.component.mjs +178 -178
  497. package/esm2020/tabs/tab-content.directive.mjs +15 -15
  498. package/esm2020/tabs/tab-group.component.mjs +350 -350
  499. package/esm2020/tabs/tab-header.component.mjs +67 -67
  500. package/esm2020/tabs/tab-label-wrapper.directive.mjs +78 -78
  501. package/esm2020/tabs/tab-label.directive.mjs +17 -17
  502. package/esm2020/tabs/tab-nav-bar/index.mjs +2 -2
  503. package/esm2020/tabs/tab-nav-bar/tab-nav-bar.mjs +110 -110
  504. package/esm2020/tabs/tab.component.mjs +133 -133
  505. package/esm2020/tabs/tabs-animations.mjs +24 -24
  506. package/esm2020/tabs/tabs.module.mjs +104 -104
  507. package/esm2020/tags/index.mjs +2 -2
  508. package/esm2020/tags/ptsecurity-mosaic-tags.mjs +4 -4
  509. package/esm2020/tags/public-api.mjs +6 -6
  510. package/esm2020/tags/tag-default-options.mjs +4 -4
  511. package/esm2020/tags/tag-input.mjs +229 -229
  512. package/esm2020/tags/tag-list.component.mjs +722 -722
  513. package/esm2020/tags/tag-text-control.mjs +2 -2
  514. package/esm2020/tags/tag.component.mjs +375 -375
  515. package/esm2020/tags/tag.module.mjs +56 -56
  516. package/esm2020/textarea/index.mjs +2 -2
  517. package/esm2020/textarea/ptsecurity-mosaic-textarea.mjs +4 -4
  518. package/esm2020/textarea/public-api.mjs +3 -3
  519. package/esm2020/textarea/textarea.component.mjs +269 -269
  520. package/esm2020/textarea/textarea.module.mjs +21 -21
  521. package/esm2020/timepicker/index.mjs +2 -2
  522. package/esm2020/timepicker/ptsecurity-mosaic-timepicker.mjs +4 -4
  523. package/esm2020/timepicker/public-api.mjs +4 -4
  524. package/esm2020/timepicker/timepicker.constants.mjs +25 -25
  525. package/esm2020/timepicker/timepicker.directive.mjs +665 -665
  526. package/esm2020/timepicker/timepicker.module.mjs +34 -34
  527. package/esm2020/toggle/index.mjs +2 -2
  528. package/esm2020/toggle/ptsecurity-mosaic-toggle.mjs +4 -4
  529. package/esm2020/toggle/public-api.mjs +3 -3
  530. package/esm2020/toggle/toggle.component.mjs +158 -158
  531. package/esm2020/toggle/toggle.module.mjs +20 -20
  532. package/esm2020/tooltip/index.mjs +2 -2
  533. package/esm2020/tooltip/ptsecurity-mosaic-tooltip.mjs +4 -4
  534. package/esm2020/tooltip/public-api.mjs +3 -3
  535. package/esm2020/tooltip/tooltip.animations.mjs +19 -19
  536. package/esm2020/tooltip/tooltip.component.mjs +295 -295
  537. package/esm2020/tooltip/tooltip.module.mjs +43 -43
  538. package/esm2020/tree/control/base-tree-control.mjs +60 -60
  539. package/esm2020/tree/control/flat-tree-control.mjs +126 -126
  540. package/esm2020/tree/control/nested-tree-control.mjs +41 -41
  541. package/esm2020/tree/control/tree-control.mjs +2 -2
  542. package/esm2020/tree/data-source/flat-data-source.mjs +162 -162
  543. package/esm2020/tree/data-source/nested-data-source.mjs +30 -30
  544. package/esm2020/tree/index.mjs +2 -2
  545. package/esm2020/tree/node.mjs +31 -31
  546. package/esm2020/tree/outlet.mjs +15 -15
  547. package/esm2020/tree/padding.directive.mjs +113 -113
  548. package/esm2020/tree/ptsecurity-mosaic-tree.mjs +4 -4
  549. package/esm2020/tree/public-api.mjs +16 -16
  550. package/esm2020/tree/toggle.mjs +80 -80
  551. package/esm2020/tree/tree-base.mjs +243 -243
  552. package/esm2020/tree/tree-errors.mjs +36 -36
  553. package/esm2020/tree/tree-option.component.mjs +248 -248
  554. package/esm2020/tree/tree-selection.component.mjs +541 -540
  555. package/esm2020/tree/tree.mjs +15 -15
  556. package/esm2020/tree/tree.module.mjs +57 -57
  557. package/esm2020/tree-select/index.mjs +2 -2
  558. package/esm2020/tree-select/ptsecurity-mosaic-tree-select.mjs +4 -4
  559. package/esm2020/tree-select/public-api.mjs +3 -3
  560. package/esm2020/tree-select/tree-select.component.mjs +939 -939
  561. package/esm2020/tree-select/tree-select.module.mjs +47 -47
  562. package/fesm2015/ptsecurity-mosaic-autocomplete.mjs +726 -726
  563. package/fesm2015/ptsecurity-mosaic-autocomplete.mjs.map +1 -1
  564. package/fesm2015/ptsecurity-mosaic-button-toggle.mjs +367 -367
  565. package/fesm2015/ptsecurity-mosaic-button-toggle.mjs.map +1 -1
  566. package/fesm2015/ptsecurity-mosaic-button.mjs +160 -160
  567. package/fesm2015/ptsecurity-mosaic-button.mjs.map +1 -1
  568. package/fesm2015/ptsecurity-mosaic-card.mjs +96 -96
  569. package/fesm2015/ptsecurity-mosaic-card.mjs.map +1 -1
  570. package/fesm2015/ptsecurity-mosaic-checkbox.mjs +348 -348
  571. package/fesm2015/ptsecurity-mosaic-checkbox.mjs.map +1 -1
  572. package/fesm2015/ptsecurity-mosaic-core.mjs +2652 -2652
  573. package/fesm2015/ptsecurity-mosaic-core.mjs.map +1 -1
  574. package/fesm2015/ptsecurity-mosaic-datepicker.mjs +2682 -2682
  575. package/fesm2015/ptsecurity-mosaic-datepicker.mjs.map +1 -1
  576. package/fesm2015/ptsecurity-mosaic-design-tokens.mjs +2432 -2345
  577. package/fesm2015/ptsecurity-mosaic-design-tokens.mjs.map +1 -1
  578. package/fesm2015/ptsecurity-mosaic-divider.mjs +48 -48
  579. package/fesm2015/ptsecurity-mosaic-divider.mjs.map +1 -1
  580. package/fesm2015/ptsecurity-mosaic-dl.mjs +108 -108
  581. package/fesm2015/ptsecurity-mosaic-dl.mjs.map +1 -1
  582. package/fesm2015/ptsecurity-mosaic-dropdown.mjs +1069 -1069
  583. package/fesm2015/ptsecurity-mosaic-dropdown.mjs.map +1 -1
  584. package/fesm2015/ptsecurity-mosaic-form-field.mjs +522 -512
  585. package/fesm2015/ptsecurity-mosaic-form-field.mjs.map +1 -1
  586. package/fesm2015/ptsecurity-mosaic-icon.mjs +73 -73
  587. package/fesm2015/ptsecurity-mosaic-icon.mjs.map +1 -1
  588. package/fesm2015/ptsecurity-mosaic-input.mjs +979 -979
  589. package/fesm2015/ptsecurity-mosaic-input.mjs.map +1 -1
  590. package/fesm2015/ptsecurity-mosaic-link.mjs +121 -121
  591. package/fesm2015/ptsecurity-mosaic-link.mjs.map +1 -1
  592. package/fesm2015/ptsecurity-mosaic-list.mjs +765 -762
  593. package/fesm2015/ptsecurity-mosaic-list.mjs.map +1 -1
  594. package/fesm2015/ptsecurity-mosaic-loader-overlay.mjs +155 -0
  595. package/fesm2015/ptsecurity-mosaic-loader-overlay.mjs.map +1 -0
  596. package/fesm2015/ptsecurity-mosaic-modal.mjs +833 -824
  597. package/fesm2015/ptsecurity-mosaic-modal.mjs.map +1 -1
  598. package/fesm2015/ptsecurity-mosaic-navbar.mjs +996 -994
  599. package/fesm2015/ptsecurity-mosaic-navbar.mjs.map +1 -1
  600. package/fesm2015/ptsecurity-mosaic-popover.mjs +364 -364
  601. package/fesm2015/ptsecurity-mosaic-popover.mjs.map +1 -1
  602. package/fesm2015/ptsecurity-mosaic-progress-bar.mjs +61 -61
  603. package/fesm2015/ptsecurity-mosaic-progress-bar.mjs.map +1 -1
  604. package/fesm2015/ptsecurity-mosaic-progress-spinner.mjs +65 -65
  605. package/fesm2015/ptsecurity-mosaic-progress-spinner.mjs.map +1 -1
  606. package/fesm2015/ptsecurity-mosaic-radio.mjs +464 -464
  607. package/fesm2015/ptsecurity-mosaic-radio.mjs.map +1 -1
  608. package/fesm2015/ptsecurity-mosaic-select.mjs +1213 -1213
  609. package/fesm2015/ptsecurity-mosaic-select.mjs.map +1 -1
  610. package/fesm2015/ptsecurity-mosaic-sidebar.mjs +185 -185
  611. package/fesm2015/ptsecurity-mosaic-sidebar.mjs.map +1 -1
  612. package/fesm2015/ptsecurity-mosaic-sidepanel.mjs +555 -555
  613. package/fesm2015/ptsecurity-mosaic-sidepanel.mjs.map +1 -1
  614. package/fesm2015/ptsecurity-mosaic-splitter.mjs +511 -511
  615. package/fesm2015/ptsecurity-mosaic-splitter.mjs.map +1 -1
  616. package/fesm2015/ptsecurity-mosaic-table.mjs +36 -36
  617. package/fesm2015/ptsecurity-mosaic-table.mjs.map +1 -1
  618. package/fesm2015/ptsecurity-mosaic-tabs.mjs +1460 -1460
  619. package/fesm2015/ptsecurity-mosaic-tabs.mjs.map +1 -1
  620. package/fesm2015/ptsecurity-mosaic-tags.mjs +1342 -1342
  621. package/fesm2015/ptsecurity-mosaic-tags.mjs.map +1 -1
  622. package/fesm2015/ptsecurity-mosaic-textarea.mjs +274 -274
  623. package/fesm2015/ptsecurity-mosaic-textarea.mjs.map +1 -1
  624. package/fesm2015/ptsecurity-mosaic-timepicker.mjs +703 -703
  625. package/fesm2015/ptsecurity-mosaic-timepicker.mjs.map +1 -1
  626. package/fesm2015/ptsecurity-mosaic-toggle.mjs +163 -163
  627. package/fesm2015/ptsecurity-mosaic-toggle.mjs.map +1 -1
  628. package/fesm2015/ptsecurity-mosaic-tooltip.mjs +344 -344
  629. package/fesm2015/ptsecurity-mosaic-tooltip.mjs.map +1 -1
  630. package/fesm2015/ptsecurity-mosaic-tree-select.mjs +954 -954
  631. package/fesm2015/ptsecurity-mosaic-tree-select.mjs.map +1 -1
  632. package/fesm2015/ptsecurity-mosaic-tree.mjs +1689 -1688
  633. package/fesm2015/ptsecurity-mosaic-tree.mjs.map +1 -1
  634. package/fesm2015/ptsecurity-mosaic.mjs +2 -2
  635. package/fesm2020/ptsecurity-mosaic-autocomplete.mjs +722 -722
  636. package/fesm2020/ptsecurity-mosaic-autocomplete.mjs.map +1 -1
  637. package/fesm2020/ptsecurity-mosaic-button-toggle.mjs +365 -365
  638. package/fesm2020/ptsecurity-mosaic-button-toggle.mjs.map +1 -1
  639. package/fesm2020/ptsecurity-mosaic-button.mjs +160 -160
  640. package/fesm2020/ptsecurity-mosaic-button.mjs.map +1 -1
  641. package/fesm2020/ptsecurity-mosaic-card.mjs +96 -96
  642. package/fesm2020/ptsecurity-mosaic-card.mjs.map +1 -1
  643. package/fesm2020/ptsecurity-mosaic-checkbox.mjs +346 -346
  644. package/fesm2020/ptsecurity-mosaic-checkbox.mjs.map +1 -1
  645. package/fesm2020/ptsecurity-mosaic-core.mjs +2681 -2681
  646. package/fesm2020/ptsecurity-mosaic-core.mjs.map +1 -1
  647. package/fesm2020/ptsecurity-mosaic-datepicker.mjs +2667 -2667
  648. package/fesm2020/ptsecurity-mosaic-datepicker.mjs.map +1 -1
  649. package/fesm2020/ptsecurity-mosaic-design-tokens.mjs +2432 -2345
  650. package/fesm2020/ptsecurity-mosaic-design-tokens.mjs.map +1 -1
  651. package/fesm2020/ptsecurity-mosaic-divider.mjs +48 -48
  652. package/fesm2020/ptsecurity-mosaic-divider.mjs.map +1 -1
  653. package/fesm2020/ptsecurity-mosaic-dl.mjs +108 -108
  654. package/fesm2020/ptsecurity-mosaic-dl.mjs.map +1 -1
  655. package/fesm2020/ptsecurity-mosaic-dropdown.mjs +1056 -1056
  656. package/fesm2020/ptsecurity-mosaic-dropdown.mjs.map +1 -1
  657. package/fesm2020/ptsecurity-mosaic-form-field.mjs +507 -497
  658. package/fesm2020/ptsecurity-mosaic-form-field.mjs.map +1 -1
  659. package/fesm2020/ptsecurity-mosaic-icon.mjs +71 -71
  660. package/fesm2020/ptsecurity-mosaic-icon.mjs.map +1 -1
  661. package/fesm2020/ptsecurity-mosaic-input.mjs +968 -968
  662. package/fesm2020/ptsecurity-mosaic-input.mjs.map +1 -1
  663. package/fesm2020/ptsecurity-mosaic-link.mjs +120 -120
  664. package/fesm2020/ptsecurity-mosaic-link.mjs.map +1 -1
  665. package/fesm2020/ptsecurity-mosaic-list.mjs +758 -755
  666. package/fesm2020/ptsecurity-mosaic-list.mjs.map +1 -1
  667. package/fesm2020/ptsecurity-mosaic-loader-overlay.mjs +153 -0
  668. package/fesm2020/ptsecurity-mosaic-loader-overlay.mjs.map +1 -0
  669. package/fesm2020/ptsecurity-mosaic-modal.mjs +828 -820
  670. package/fesm2020/ptsecurity-mosaic-modal.mjs.map +1 -1
  671. package/fesm2020/ptsecurity-mosaic-navbar.mjs +980 -978
  672. package/fesm2020/ptsecurity-mosaic-navbar.mjs.map +1 -1
  673. package/fesm2020/ptsecurity-mosaic-popover.mjs +360 -360
  674. package/fesm2020/ptsecurity-mosaic-popover.mjs.map +1 -1
  675. package/fesm2020/ptsecurity-mosaic-progress-bar.mjs +61 -61
  676. package/fesm2020/ptsecurity-mosaic-progress-bar.mjs.map +1 -1
  677. package/fesm2020/ptsecurity-mosaic-progress-spinner.mjs +65 -65
  678. package/fesm2020/ptsecurity-mosaic-progress-spinner.mjs.map +1 -1
  679. package/fesm2020/ptsecurity-mosaic-radio.mjs +462 -462
  680. package/fesm2020/ptsecurity-mosaic-radio.mjs.map +1 -1
  681. package/fesm2020/ptsecurity-mosaic-select.mjs +1208 -1208
  682. package/fesm2020/ptsecurity-mosaic-select.mjs.map +1 -1
  683. package/fesm2020/ptsecurity-mosaic-sidebar.mjs +185 -185
  684. package/fesm2020/ptsecurity-mosaic-sidebar.mjs.map +1 -1
  685. package/fesm2020/ptsecurity-mosaic-sidepanel.mjs +552 -552
  686. package/fesm2020/ptsecurity-mosaic-sidepanel.mjs.map +1 -1
  687. package/fesm2020/ptsecurity-mosaic-splitter.mjs +511 -511
  688. package/fesm2020/ptsecurity-mosaic-splitter.mjs.map +1 -1
  689. package/fesm2020/ptsecurity-mosaic-table.mjs +36 -36
  690. package/fesm2020/ptsecurity-mosaic-table.mjs.map +1 -1
  691. package/fesm2020/ptsecurity-mosaic-tabs.mjs +1445 -1445
  692. package/fesm2020/ptsecurity-mosaic-tabs.mjs.map +1 -1
  693. package/fesm2020/ptsecurity-mosaic-tags.mjs +1335 -1335
  694. package/fesm2020/ptsecurity-mosaic-tags.mjs.map +1 -1
  695. package/fesm2020/ptsecurity-mosaic-textarea.mjs +272 -272
  696. package/fesm2020/ptsecurity-mosaic-textarea.mjs.map +1 -1
  697. package/fesm2020/ptsecurity-mosaic-timepicker.mjs +700 -700
  698. package/fesm2020/ptsecurity-mosaic-timepicker.mjs.map +1 -1
  699. package/fesm2020/ptsecurity-mosaic-toggle.mjs +163 -163
  700. package/fesm2020/ptsecurity-mosaic-toggle.mjs.map +1 -1
  701. package/fesm2020/ptsecurity-mosaic-tooltip.mjs +336 -336
  702. package/fesm2020/ptsecurity-mosaic-tooltip.mjs.map +1 -1
  703. package/fesm2020/ptsecurity-mosaic-tree-select.mjs +951 -951
  704. package/fesm2020/ptsecurity-mosaic-tree-select.mjs.map +1 -1
  705. package/fesm2020/ptsecurity-mosaic-tree.mjs +1676 -1675
  706. package/fesm2020/ptsecurity-mosaic-tree.mjs.map +1 -1
  707. package/fesm2020/ptsecurity-mosaic.mjs +2 -2
  708. package/form-field/cleaner.d.ts +7 -7
  709. package/form-field/form-field-control.d.ts +37 -37
  710. package/form-field/form-field-errors.d.ts +2 -2
  711. package/form-field/form-field.d.ts +69 -69
  712. package/form-field/form-field.module.d.ts +15 -15
  713. package/form-field/hint.d.ts +14 -6
  714. package/form-field/index.d.ts +1 -1
  715. package/form-field/password-hint.d.ts +40 -40
  716. package/form-field/prefix.d.ts +5 -5
  717. package/form-field/ptsecurity-mosaic-form-field.d.ts +5 -5
  718. package/form-field/public-api.d.ts +10 -10
  719. package/form-field/stepper.d.ts +11 -11
  720. package/form-field/suffix.d.ts +5 -5
  721. package/icon/icon.component.d.ts +18 -18
  722. package/icon/icon.module.d.ts +10 -10
  723. package/icon/index.d.ts +1 -1
  724. package/icon/ptsecurity-mosaic-icon.d.ts +5 -5
  725. package/icon/public-api.d.ts +2 -2
  726. package/index.d.ts +1 -1
  727. package/input/index.d.ts +1 -1
  728. package/input/input-errors.d.ts +1 -1
  729. package/input/input-number-validators.d.ts +39 -39
  730. package/input/input-number.d.ts +33 -33
  731. package/input/input-password.d.ts +123 -123
  732. package/input/input-value-accessor.d.ts +4 -4
  733. package/input/input.d.ts +116 -116
  734. package/input/input.module.d.ts +14 -14
  735. package/input/ptsecurity-mosaic-input.d.ts +5 -5
  736. package/input/public-api.d.ts +6 -6
  737. package/link/index.d.ts +1 -1
  738. package/link/link.component.d.ts +38 -38
  739. package/link/link.module.d.ts +9 -9
  740. package/link/ptsecurity-mosaic-link.d.ts +5 -5
  741. package/link/public-api.d.ts +2 -2
  742. package/list/index.d.ts +1 -1
  743. package/list/list-selection.component.d.ts +168 -168
  744. package/list/list.component.d.ts +18 -18
  745. package/list/list.module.d.ts +11 -11
  746. package/list/ptsecurity-mosaic-list.d.ts +5 -5
  747. package/list/public-api.d.ts +3 -3
  748. package/{toggle → loader-overlay}/README.md +0 -0
  749. package/loader-overlay/index.d.ts +1 -0
  750. package/loader-overlay/loader-overlay.component.d.ts +33 -0
  751. package/loader-overlay/loader-overlay.module.d.ts +11 -0
  752. package/loader-overlay/package.json +10 -0
  753. package/loader-overlay/ptsecurity-mosaic-loader-overlay.d.ts +5 -0
  754. package/loader-overlay/public-api.d.ts +2 -0
  755. package/modal/README.md +33 -33
  756. package/modal/css-unit.pipe.d.ts +7 -7
  757. package/modal/index.d.ts +1 -1
  758. package/modal/modal-control.service.d.ts +20 -20
  759. package/modal/modal-ref.class.d.ts +36 -36
  760. package/modal/modal-util.d.ts +12 -12
  761. package/modal/modal.component.d.ts +128 -126
  762. package/modal/modal.directive.d.ts +17 -17
  763. package/modal/modal.module.d.ts +14 -14
  764. package/modal/modal.service.d.ts +33 -33
  765. package/modal/modal.type.d.ts +60 -59
  766. package/modal/ptsecurity-mosaic-modal.d.ts +5 -5
  767. package/modal/public-api.d.ts +6 -6
  768. package/navbar/README.md +41 -41
  769. package/navbar/index.d.ts +1 -1
  770. package/navbar/navbar-item.component.d.ts +161 -161
  771. package/navbar/navbar.component.d.ts +58 -58
  772. package/navbar/navbar.module.d.ts +14 -14
  773. package/navbar/ptsecurity-mosaic-navbar.d.ts +5 -5
  774. package/navbar/public-api.d.ts +4 -4
  775. package/navbar/vertical-navbar.animation.d.ts +2 -2
  776. package/navbar/vertical-navbar.component.d.ts +23 -23
  777. package/package.json +12 -4
  778. package/popover/README.md +32 -32
  779. package/popover/index.d.ts +1 -1
  780. package/popover/popover-animations.d.ts +4 -4
  781. package/popover/popover-confirm.component.d.ts +33 -33
  782. package/popover/popover.component.d.ts +74 -74
  783. package/popover/popover.module.d.ts +12 -12
  784. package/popover/ptsecurity-mosaic-popover.d.ts +5 -5
  785. package/popover/public-api.d.ts +4 -4
  786. package/prebuilt-themes/dark-theme.css +1 -1
  787. package/prebuilt-themes/default-theme.css +1 -1
  788. package/progress-bar/index.d.ts +1 -1
  789. package/progress-bar/progress-bar.component.d.ts +18 -18
  790. package/progress-bar/progress-bar.module.d.ts +9 -9
  791. package/progress-bar/ptsecurity-mosaic-progress-bar.d.ts +5 -5
  792. package/progress-bar/public-api.d.ts +2 -2
  793. package/progress-spinner/index.d.ts +1 -1
  794. package/progress-spinner/progress-spinner.component.d.ts +19 -19
  795. package/progress-spinner/progress-spinner.module.d.ts +9 -9
  796. package/progress-spinner/ptsecurity-mosaic-progress-spinner.d.ts +5 -5
  797. package/progress-spinner/public-api.d.ts +2 -2
  798. package/ptsecurity-mosaic.d.ts +5 -5
  799. package/public-api.d.ts +1 -1
  800. package/radio/index.d.ts +1 -1
  801. package/radio/ptsecurity-mosaic-radio.d.ts +5 -5
  802. package/radio/public-api.d.ts +2 -2
  803. package/radio/radio.component.d.ts +207 -207
  804. package/radio/radio.module.d.ts +10 -10
  805. package/schematics/README.md +35 -35
  806. package/select/index.d.ts +1 -1
  807. package/select/ptsecurity-mosaic-select.d.ts +5 -5
  808. package/select/public-api.d.ts +3 -3
  809. package/select/select-option.directive.d.ts +20 -20
  810. package/select/select.component.d.ts +310 -310
  811. package/select/select.module.d.ts +15 -15
  812. package/sidebar/index.d.ts +1 -1
  813. package/sidebar/ptsecurity-mosaic-sidebar.d.ts +5 -5
  814. package/sidebar/public-api.d.ts +2 -2
  815. package/sidebar/sidebar-animations.d.ts +8 -8
  816. package/sidebar/sidebar.component.d.ts +53 -53
  817. package/sidebar/sidebar.module.d.ts +8 -8
  818. package/sidepanel/index.d.ts +1 -1
  819. package/sidepanel/ptsecurity-mosaic-sidepanel.d.ts +5 -5
  820. package/sidepanel/public-api.d.ts +6 -6
  821. package/sidepanel/sidepanel-animations.d.ts +14 -14
  822. package/sidepanel/sidepanel-config.d.ts +25 -25
  823. package/sidepanel/sidepanel-container.component.d.ts +45 -45
  824. package/sidepanel/sidepanel-directives.d.ts +50 -50
  825. package/sidepanel/sidepanel-ref.d.ts +24 -24
  826. package/sidepanel/sidepanel.module.d.ts +15 -15
  827. package/sidepanel/sidepanel.service.d.ts +57 -57
  828. package/splitter/index.d.ts +1 -1
  829. package/splitter/ptsecurity-mosaic-splitter.d.ts +5 -5
  830. package/splitter/public-api.d.ts +2 -2
  831. package/splitter/splitter.component.d.ts +130 -130
  832. package/splitter/splitter.module.d.ts +9 -9
  833. package/table/index.d.ts +1 -1
  834. package/table/ptsecurity-mosaic-table.d.ts +5 -5
  835. package/table/public-api.d.ts +2 -2
  836. package/table/table.component.d.ts +5 -5
  837. package/table/table.module.d.ts +10 -10
  838. package/tabs/index.d.ts +1 -1
  839. package/tabs/paginated-tab-header.d.ts +179 -179
  840. package/tabs/ptsecurity-mosaic-tabs.d.ts +5 -5
  841. package/tabs/public-api.d.ts +10 -10
  842. package/tabs/tab-body.component.d.ts +95 -95
  843. package/tabs/tab-content.directive.d.ts +9 -9
  844. package/tabs/tab-group.component.d.ts +133 -133
  845. package/tabs/tab-header.component.d.ts +35 -35
  846. package/tabs/tab-label-wrapper.directive.d.ts +30 -30
  847. package/tabs/tab-label.directive.d.ts +9 -9
  848. package/tabs/tab-nav-bar/index.d.ts +1 -1
  849. package/tabs/tab-nav-bar/tab-nav-bar.d.ts +38 -38
  850. package/tabs/tab.component.d.ts +66 -66
  851. package/tabs/tabs-animations.d.ts +4 -4
  852. package/tabs/tabs.module.d.ts +20 -20
  853. package/tags/index.d.ts +1 -1
  854. package/tags/ptsecurity-mosaic-tags.d.ts +5 -5
  855. package/tags/public-api.d.ts +5 -5
  856. package/tags/tag-default-options.d.ts +8 -8
  857. package/tags/tag-input.d.ts +77 -77
  858. package/tags/tag-list.component.d.ts +240 -240
  859. package/tags/tag-text-control.d.ts +10 -10
  860. package/tags/tag.component.d.ts +135 -135
  861. package/tags/tag.module.d.ts +11 -11
  862. package/textarea/index.d.ts +1 -1
  863. package/textarea/ptsecurity-mosaic-textarea.d.ts +5 -5
  864. package/textarea/public-api.d.ts +2 -2
  865. package/textarea/textarea.component.d.ts +111 -111
  866. package/textarea/textarea.module.d.ts +11 -11
  867. package/timepicker/index.d.ts +1 -1
  868. package/timepicker/ptsecurity-mosaic-timepicker.d.ts +5 -5
  869. package/timepicker/public-api.d.ts +3 -3
  870. package/timepicker/timepicker.constants.d.ts +20 -20
  871. package/timepicker/timepicker.directive.d.ts +146 -146
  872. package/timepicker/timepicker.module.d.ts +11 -11
  873. package/toggle/index.d.ts +1 -1
  874. package/toggle/ptsecurity-mosaic-toggle.d.ts +5 -5
  875. package/toggle/public-api.d.ts +2 -2
  876. package/toggle/toggle.component.d.ts +54 -54
  877. package/toggle/toggle.module.d.ts +10 -10
  878. package/tooltip/index.d.ts +1 -1
  879. package/tooltip/ptsecurity-mosaic-tooltip.d.ts +5 -5
  880. package/tooltip/public-api.d.ts +2 -2
  881. package/tooltip/tooltip.animations.d.ts +8 -8
  882. package/tooltip/tooltip.component.d.ts +91 -91
  883. package/tooltip/tooltip.module.d.ts +9 -9
  884. package/tree/control/base-tree-control.d.ts +40 -40
  885. package/tree/control/flat-tree-control.d.ts +52 -52
  886. package/tree/control/nested-tree-control.d.ts +19 -19
  887. package/tree/control/tree-control.d.ts +44 -44
  888. package/tree/data-source/flat-data-source.d.ts +80 -80
  889. package/tree/data-source/nested-data-source.d.ts +15 -15
  890. package/tree/index.d.ts +1 -1
  891. package/tree/node.d.ts +34 -34
  892. package/tree/outlet.d.ts +9 -9
  893. package/tree/padding.directive.d.ts +47 -47
  894. package/tree/ptsecurity-mosaic-tree.d.ts +5 -5
  895. package/tree/public-api.d.ts +15 -15
  896. package/tree/toggle.d.ts +28 -28
  897. package/tree/tree-base.d.ts +97 -97
  898. package/tree/tree-errors.d.ts +25 -25
  899. package/tree/tree-option.component.d.ts +72 -72
  900. package/tree/tree-selection.component.d.ts +132 -132
  901. package/tree/tree.d.ts +6 -6
  902. package/tree/tree.module.d.ts +16 -16
  903. package/tree-select/index.d.ts +1 -1
  904. package/tree-select/ptsecurity-mosaic-tree-select.d.ts +5 -5
  905. package/tree-select/public-api.d.ts +2 -2
  906. package/tree-select/tree-select.component.d.ts +277 -277
  907. package/tree-select/tree-select.module.d.ts +14 -14
@@ -19,1724 +19,1725 @@ import { NG_VALUE_ACCESSOR } from '@angular/forms';
19
19
  import { FocusKeyManager } from '@ptsecurity/cdk/a11y';
20
20
  import * as i2$1 from '@angular/cdk/clipboard';
21
21
 
22
- /** Context provided to the tree node component. */
23
- class McTreeNodeOutletContext {
24
- constructor(data) {
25
- this.$implicit = data;
26
- }
27
- }
28
- /**
29
- * Data node definition for the McTree.
30
- * Captures the node's template and a when predicate that describes when this node should be used.
31
- */
32
- class McTreeNodeDef {
33
- /** @docs-private */
34
- constructor(template) {
35
- this.template = template;
36
- }
37
- }
38
- /** @nocollapse */ /** @nocollapse */ McTreeNodeDef.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTreeNodeDef, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
39
- /** @nocollapse */ /** @nocollapse */ McTreeNodeDef.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", type: McTreeNodeDef, selector: "[mcTreeNodeDef]", inputs: { when: ["mcTreeNodeDefWhen", "when"], data: ["mcTreeNode", "data"] }, ngImport: i0 });
40
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTreeNodeDef, decorators: [{
41
- type: Directive,
42
- args: [{
43
- selector: '[mcTreeNodeDef]',
44
- inputs: ['when: mcTreeNodeDefWhen']
45
- }]
46
- }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; }, propDecorators: { data: [{
47
- type: Input,
48
- args: ['mcTreeNode']
22
+ /** Context provided to the tree node component. */
23
+ class McTreeNodeOutletContext {
24
+ constructor(data) {
25
+ this.$implicit = data;
26
+ }
27
+ }
28
+ /**
29
+ * Data node definition for the McTree.
30
+ * Captures the node's template and a when predicate that describes when this node should be used.
31
+ */
32
+ class McTreeNodeDef {
33
+ /** @docs-private */
34
+ constructor(template) {
35
+ this.template = template;
36
+ }
37
+ }
38
+ /** @nocollapse */ /** @nocollapse */ McTreeNodeDef.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTreeNodeDef, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
39
+ /** @nocollapse */ /** @nocollapse */ McTreeNodeDef.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", type: McTreeNodeDef, selector: "[mcTreeNodeDef]", inputs: { when: ["mcTreeNodeDefWhen", "when"], data: ["mcTreeNode", "data"] }, ngImport: i0 });
40
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTreeNodeDef, decorators: [{
41
+ type: Directive,
42
+ args: [{
43
+ selector: '[mcTreeNodeDef]',
44
+ inputs: ['when: mcTreeNodeDefWhen']
45
+ }]
46
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; }, propDecorators: { data: [{
47
+ type: Input,
48
+ args: ['mcTreeNode']
49
49
  }] } });
50
50
 
51
- class McTreeNodeOutlet {
52
- constructor(viewContainer, changeDetectorRef) {
53
- this.viewContainer = viewContainer;
54
- this.changeDetectorRef = changeDetectorRef;
55
- }
56
- }
57
- /** @nocollapse */ /** @nocollapse */ McTreeNodeOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTreeNodeOutlet, deps: [{ token: i0.ViewContainerRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
58
- /** @nocollapse */ /** @nocollapse */ McTreeNodeOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", type: McTreeNodeOutlet, selector: "[mcTreeNodeOutlet]", ngImport: i0 });
59
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTreeNodeOutlet, decorators: [{
60
- type: Directive,
61
- args: [{ selector: '[mcTreeNodeOutlet]' }]
51
+ class McTreeNodeOutlet {
52
+ constructor(viewContainer, changeDetectorRef) {
53
+ this.viewContainer = viewContainer;
54
+ this.changeDetectorRef = changeDetectorRef;
55
+ }
56
+ }
57
+ /** @nocollapse */ /** @nocollapse */ McTreeNodeOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTreeNodeOutlet, deps: [{ token: i0.ViewContainerRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
58
+ /** @nocollapse */ /** @nocollapse */ McTreeNodeOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", type: McTreeNodeOutlet, selector: "[mcTreeNodeOutlet]", ngImport: i0 });
59
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTreeNodeOutlet, decorators: [{
60
+ type: Directive,
61
+ args: [{ selector: '[mcTreeNodeOutlet]' }]
62
62
  }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.ChangeDetectorRef }]; } });
63
63
 
64
- /**
65
- * Returns an error to be thrown when there is no usable data.
66
- * @docs-private
67
- */
68
- function getTreeNoValidDataSourceError() {
69
- return Error(`A valid data source must be provided.`);
70
- }
71
- /**
72
- * Returns an error to be thrown when there are multiple nodes that are missing a when function.
73
- * @docs-private
74
- */
75
- function getTreeMultipleDefaultNodeDefsError() {
76
- return Error(`There can only be one default row without a when predicate function.`);
77
- }
78
- /**
79
- * Returns an error to be thrown when there are no matching node defs for a particular set of data.
80
- * @docs-private
81
- */
82
- function getTreeMissingMatchingNodeDefError() {
83
- return Error(`Could not find a matching node definition for the provided node data.`);
84
- }
85
- /**
86
- * Returns an error to be thrown when there are tree control.
87
- * @docs-private
88
- */
89
- function getTreeControlMissingError() {
90
- return Error(`Could not find a tree control for the tree.`);
91
- }
92
- /**
93
- * Returns an error to be thrown when tree control did not implement functions for flat/nested node.
94
- * @docs-private
95
- */
96
- function getTreeControlFunctionsMissingError() {
97
- return Error(`Could not find functions for nested/flat tree in tree control.`);
64
+ /**
65
+ * Returns an error to be thrown when there is no usable data.
66
+ * @docs-private
67
+ */
68
+ function getTreeNoValidDataSourceError() {
69
+ return Error(`A valid data source must be provided.`);
70
+ }
71
+ /**
72
+ * Returns an error to be thrown when there are multiple nodes that are missing a when function.
73
+ * @docs-private
74
+ */
75
+ function getTreeMultipleDefaultNodeDefsError() {
76
+ return Error(`There can only be one default row without a when predicate function.`);
77
+ }
78
+ /**
79
+ * Returns an error to be thrown when there are no matching node defs for a particular set of data.
80
+ * @docs-private
81
+ */
82
+ function getTreeMissingMatchingNodeDefError() {
83
+ return Error(`Could not find a matching node definition for the provided node data.`);
84
+ }
85
+ /**
86
+ * Returns an error to be thrown when there are tree control.
87
+ * @docs-private
88
+ */
89
+ function getTreeControlMissingError() {
90
+ return Error(`Could not find a tree control for the tree.`);
91
+ }
92
+ /**
93
+ * Returns an error to be thrown when tree control did not implement functions for flat/nested node.
94
+ * @docs-private
95
+ */
96
+ function getTreeControlFunctionsMissingError() {
97
+ return Error(`Could not find functions for nested/flat tree in tree control.`);
98
98
  }
99
99
 
100
- class McTreeBase {
101
- constructor(differs, changeDetectorRef) {
102
- this.differs = differs;
103
- this.changeDetectorRef = changeDetectorRef;
104
- // TODO(tinayuangao): Setup a listener for scrolling, emit the calculated view to viewChange.
105
- // Remove the MAX_VALUE in viewChange
106
- /**
107
- * Stream containing the latest information on what rows are being displayed on screen.
108
- * Can be used by the data source to as a heuristic of what data should be provided.
109
- */
110
- this.viewChange = new BehaviorSubject({ start: 0, end: Number.MAX_VALUE });
111
- /** Subject that emits when the component has been destroyed. */
112
- this.onDestroy = new Subject();
113
- /** Level of nodes */
114
- this.levels = new Map();
115
- }
116
- /**
117
- * Provides a stream containing the latest data array to render. Influenced by the tree's
118
- * stream of view window (what dataNodes are currently on screen).
119
- * Data source can be an observable of data array, or a dara array to render.
120
- */
121
- get dataSource() {
122
- return this._dataSource;
123
- }
124
- set dataSource(dataSource) {
125
- if (this._dataSource !== dataSource) {
126
- this.switchDataSource(dataSource);
127
- }
128
- }
129
- ngOnInit() {
130
- this.dataDiffer = this.differs.find([]).create(this.trackBy);
131
- if (!this.treeControl) {
132
- throw getTreeControlMissingError();
133
- }
134
- }
135
- ngOnDestroy() {
136
- this.nodeOutlet.viewContainer.clear();
137
- this.onDestroy.next();
138
- this.onDestroy.complete();
139
- // tslint:disable-next-line:no-unbound-method
140
- if (this._dataSource && typeof this.dataSource.disconnect === 'function') {
141
- this.dataSource.disconnect(this);
142
- }
143
- if (this.dataSubscription) {
144
- this.dataSubscription.unsubscribe();
145
- this.dataSubscription = null;
146
- }
147
- }
148
- ngAfterContentChecked() {
149
- const defaultNodeDefs = this.nodeDefs.filter((def) => !def.when);
150
- if (defaultNodeDefs.length > 1) {
151
- throw getTreeMultipleDefaultNodeDefsError();
152
- }
153
- this.defaultNodeDef = defaultNodeDefs[0];
154
- if (this.dataSource && this.nodeDefs && !this.dataSubscription) {
155
- this.observeRenderChanges();
156
- }
157
- }
158
- /** Check for changes made in the data and render each change (node added/removed/moved). */
159
- renderNodeChanges(data, dataDiffer = this.dataDiffer, viewContainer = this.nodeOutlet.viewContainer, parentData) {
160
- const changes = dataDiffer.diff(data);
161
- if (!changes) {
162
- return;
163
- }
164
- changes.forEachOperation((item, adjustedPreviousIndex, currentIndex) => {
165
- if (item.previousIndex == null) {
166
- this.insertNode(data[currentIndex], currentIndex, viewContainer, parentData);
167
- }
168
- else if (currentIndex == null) {
169
- viewContainer.remove(adjustedPreviousIndex);
170
- this.levels.delete(item.item);
171
- }
172
- else {
173
- const view = viewContainer.get(adjustedPreviousIndex);
174
- viewContainer.move(view, currentIndex);
175
- }
176
- });
177
- this.changeDetectorRef.detectChanges();
178
- }
179
- /**
180
- * Finds the matching node definition that should be used for this node data. If there is only
181
- * one node definition, it is returned. Otherwise, find the node definition that has a when
182
- * predicate that returns true with the data. If none return true, return the default node
183
- * definition.
184
- */
185
- getNodeDef(data, i) {
186
- if (this.nodeDefs.length === 1) {
187
- return this.nodeDefs.first;
188
- }
189
- const nodeDef = this.nodeDefs.find((def) => def.when && def.when(i, data)) || this.defaultNodeDef;
190
- if (!nodeDef) {
191
- throw getTreeMissingMatchingNodeDefError();
192
- }
193
- return nodeDef;
194
- }
195
- /**
196
- * Create the embedded view for the data node template and place it in the correct index location
197
- * within the data node view container.
198
- */
199
- insertNode(nodeData, index, viewContainer, parentData) {
200
- const node = this.getNodeDef(nodeData, index);
201
- // Node context that will be provided to created embedded view
202
- const context = new McTreeNodeOutletContext(nodeData);
203
- // If the tree is flat tree, then use the `getLevel` function in flat tree control
204
- // Otherwise, use the level of parent node.
205
- if (this.treeControl.getLevel) {
206
- context.level = this.treeControl.getLevel(nodeData);
207
- /* tslint:disable-next-line:no-typeof-undefined */
208
- }
209
- else if (typeof parentData !== 'undefined' && this.levels.has(parentData)) {
210
- context.level = this.levels.get(parentData) + 1;
211
- }
212
- else {
213
- context.level = 0;
214
- }
215
- this.levels.set(nodeData, context.level);
216
- // Use default tree nodeOutlet, or nested node's nodeOutlet
217
- const container = viewContainer ? viewContainer : this.nodeOutlet.viewContainer;
218
- container.createEmbeddedView(node.template, context, index);
219
- // Set the data to just created `McTreeNode`.
220
- // The `McTreeNode` created from `createEmbeddedView` will be saved in static variable
221
- // `mostRecentTreeNode`. We get it from static variable and pass the node data to it.
222
- if (McTreeNode.mostRecentTreeNode) {
223
- McTreeNode.mostRecentTreeNode.data = nodeData;
224
- }
225
- }
226
- /** Set up a subscription for the data provided by the data source. */
227
- observeRenderChanges() {
228
- let dataStream;
229
- // Cannot use `instanceof DataSource` since the data source could be a literal with
230
- // `connect` function and may not extends DataSource.
231
- // tslint:disable-next-line:no-unbound-method
232
- if (typeof this._dataSource.connect === 'function') {
233
- dataStream = this._dataSource.connect(this);
234
- }
235
- else if (this._dataSource instanceof Observable) {
236
- dataStream = this._dataSource;
237
- }
238
- else if (Array.isArray(this._dataSource)) {
239
- dataStream = of(this._dataSource);
240
- }
241
- if (dataStream) {
242
- this.dataSubscription = dataStream
243
- .pipe(takeUntil(this.onDestroy))
244
- .subscribe((data) => this.renderNodeChanges(data));
245
- }
246
- else {
247
- throw getTreeNoValidDataSourceError();
248
- }
249
- }
250
- /**
251
- * Switch to the provided data source by resetting the data and unsubscribing from the current
252
- * render change subscription if one exists. If the data source is null, interpret this by
253
- * clearing the node outlet. Otherwise start listening for new data.
254
- */
255
- switchDataSource(dataSource) {
256
- // tslint:disable-next-line:no-unbound-method
257
- if (this._dataSource && typeof this._dataSource.disconnect === 'function') {
258
- this.dataSource.disconnect(this);
259
- }
260
- if (this.dataSubscription) {
261
- this.dataSubscription.unsubscribe();
262
- this.dataSubscription = null;
263
- }
264
- // Remove the all dataNodes if there is now no data source
265
- if (!dataSource) {
266
- this.nodeOutlet.viewContainer.clear();
267
- }
268
- this._dataSource = dataSource;
269
- if (this.nodeDefs) {
270
- this.observeRenderChanges();
271
- }
272
- }
273
- }
274
- /** @nocollapse */ /** @nocollapse */ McTreeBase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTreeBase, deps: [{ token: i0.IterableDiffers }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
275
- /** @nocollapse */ /** @nocollapse */ McTreeBase.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", 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 });
276
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTreeBase, decorators: [{
277
- type: Directive
278
- }], ctorParameters: function () { return [{ type: i0.IterableDiffers }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { treeControl: [{
279
- type: Input
280
- }], trackBy: [{
281
- type: Input
282
- }], nodeOutlet: [{
283
- type: ViewChild,
284
- args: [McTreeNodeOutlet, { static: true }]
285
- }], nodeDefs: [{
286
- type: ContentChildren,
287
- args: [McTreeNodeDef]
288
- }], dataSource: [{
289
- type: Input
290
- }] } });
291
- class McTreeNode {
292
- constructor(elementRef, tree) {
293
- this.elementRef = elementRef;
294
- this.tree = tree;
295
- this.destroyed = new Subject();
296
- McTreeNode.mostRecentTreeNode = this;
297
- }
298
- get data() {
299
- return this._data;
300
- }
301
- set data(value) {
302
- this._data = value;
303
- }
304
- get isExpanded() {
305
- return this.tree.treeControl.isExpanded(this.data);
306
- }
307
- get level() {
308
- return this.tree.treeControl.getLevel ? this.tree.treeControl.getLevel(this._data) : 0;
309
- }
310
- ngOnDestroy() {
311
- this.destroyed.next();
312
- this.destroyed.complete();
313
- }
314
- focus() {
315
- this.elementRef.nativeElement.focus();
316
- }
317
- }
318
- /**
319
- * The most recently created `McTreeNode`. We save it in static variable so we can retrieve it
320
- * in `McTree` and set the data to it.
321
- */
322
- McTreeNode.mostRecentTreeNode = null;
323
- /** @nocollapse */ /** @nocollapse */ McTreeNode.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTreeNode, deps: [{ token: i0.ElementRef }, { token: forwardRef(() => McTreeBase) }], target: i0.ɵɵFactoryTarget.Directive });
324
- /** @nocollapse */ /** @nocollapse */ McTreeNode.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", type: McTreeNode, selector: "mc-tree-node", exportAs: ["mcTreeNode"], ngImport: i0 });
325
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTreeNode, decorators: [{
326
- type: Directive,
327
- args: [{
328
- selector: 'mc-tree-node',
329
- exportAs: 'mcTreeNode'
330
- }]
331
- }], ctorParameters: function () {
332
- return [{ type: i0.ElementRef }, { type: McTreeBase, decorators: [{
333
- type: Inject,
334
- args: [forwardRef(() => McTreeBase)]
335
- }] }];
100
+ class McTreeBase {
101
+ constructor(differs, changeDetectorRef) {
102
+ this.differs = differs;
103
+ this.changeDetectorRef = changeDetectorRef;
104
+ // TODO(tinayuangao): Setup a listener for scrolling, emit the calculated view to viewChange.
105
+ // Remove the MAX_VALUE in viewChange
106
+ /**
107
+ * Stream containing the latest information on what rows are being displayed on screen.
108
+ * Can be used by the data source to as a heuristic of what data should be provided.
109
+ */
110
+ this.viewChange = new BehaviorSubject({ start: 0, end: Number.MAX_VALUE });
111
+ /** Subject that emits when the component has been destroyed. */
112
+ this.onDestroy = new Subject();
113
+ /** Level of nodes */
114
+ this.levels = new Map();
115
+ }
116
+ /**
117
+ * Provides a stream containing the latest data array to render. Influenced by the tree's
118
+ * stream of view window (what dataNodes are currently on screen).
119
+ * Data source can be an observable of data array, or a dara array to render.
120
+ */
121
+ get dataSource() {
122
+ return this._dataSource;
123
+ }
124
+ set dataSource(dataSource) {
125
+ if (this._dataSource !== dataSource) {
126
+ this.switchDataSource(dataSource);
127
+ }
128
+ }
129
+ ngOnInit() {
130
+ this.dataDiffer = this.differs.find([]).create(this.trackBy);
131
+ if (!this.treeControl) {
132
+ throw getTreeControlMissingError();
133
+ }
134
+ }
135
+ ngOnDestroy() {
136
+ this.nodeOutlet.viewContainer.clear();
137
+ this.onDestroy.next();
138
+ this.onDestroy.complete();
139
+ // tslint:disable-next-line:no-unbound-method
140
+ if (this._dataSource && typeof this.dataSource.disconnect === 'function') {
141
+ this.dataSource.disconnect(this);
142
+ }
143
+ if (this.dataSubscription) {
144
+ this.dataSubscription.unsubscribe();
145
+ this.dataSubscription = null;
146
+ }
147
+ }
148
+ ngAfterContentChecked() {
149
+ const defaultNodeDefs = this.nodeDefs.filter((def) => !def.when);
150
+ if (defaultNodeDefs.length > 1) {
151
+ throw getTreeMultipleDefaultNodeDefsError();
152
+ }
153
+ this.defaultNodeDef = defaultNodeDefs[0];
154
+ if (this.dataSource && this.nodeDefs && !this.dataSubscription) {
155
+ this.observeRenderChanges();
156
+ }
157
+ }
158
+ /** Check for changes made in the data and render each change (node added/removed/moved). */
159
+ renderNodeChanges(data, dataDiffer = this.dataDiffer, viewContainer = this.nodeOutlet.viewContainer, parentData) {
160
+ const changes = dataDiffer.diff(data);
161
+ if (!changes) {
162
+ return;
163
+ }
164
+ changes.forEachOperation((item, adjustedPreviousIndex, currentIndex) => {
165
+ if (item.previousIndex == null) {
166
+ this.insertNode(data[currentIndex], currentIndex, viewContainer, parentData);
167
+ }
168
+ else if (currentIndex == null) {
169
+ viewContainer.remove(adjustedPreviousIndex);
170
+ this.levels.delete(item.item);
171
+ }
172
+ else {
173
+ const view = viewContainer.get(adjustedPreviousIndex);
174
+ viewContainer.move(view, currentIndex);
175
+ }
176
+ });
177
+ this.changeDetectorRef.detectChanges();
178
+ }
179
+ /**
180
+ * Finds the matching node definition that should be used for this node data. If there is only
181
+ * one node definition, it is returned. Otherwise, find the node definition that has a when
182
+ * predicate that returns true with the data. If none return true, return the default node
183
+ * definition.
184
+ */
185
+ getNodeDef(data, i) {
186
+ if (this.nodeDefs.length === 1) {
187
+ return this.nodeDefs.first;
188
+ }
189
+ const nodeDef = this.nodeDefs.find((def) => def.when && def.when(i, data)) || this.defaultNodeDef;
190
+ if (!nodeDef) {
191
+ throw getTreeMissingMatchingNodeDefError();
192
+ }
193
+ return nodeDef;
194
+ }
195
+ /**
196
+ * Create the embedded view for the data node template and place it in the correct index location
197
+ * within the data node view container.
198
+ */
199
+ insertNode(nodeData, index, viewContainer, parentData) {
200
+ const node = this.getNodeDef(nodeData, index);
201
+ // Node context that will be provided to created embedded view
202
+ const context = new McTreeNodeOutletContext(nodeData);
203
+ // If the tree is flat tree, then use the `getLevel` function in flat tree control
204
+ // Otherwise, use the level of parent node.
205
+ if (this.treeControl.getLevel) {
206
+ context.level = this.treeControl.getLevel(nodeData);
207
+ /* tslint:disable-next-line:no-typeof-undefined */
208
+ }
209
+ else if (typeof parentData !== 'undefined' && this.levels.has(parentData)) {
210
+ context.level = this.levels.get(parentData) + 1;
211
+ }
212
+ else {
213
+ context.level = 0;
214
+ }
215
+ this.levels.set(nodeData, context.level);
216
+ // Use default tree nodeOutlet, or nested node's nodeOutlet
217
+ const container = viewContainer ? viewContainer : this.nodeOutlet.viewContainer;
218
+ container.createEmbeddedView(node.template, context, index);
219
+ // Set the data to just created `McTreeNode`.
220
+ // The `McTreeNode` created from `createEmbeddedView` will be saved in static variable
221
+ // `mostRecentTreeNode`. We get it from static variable and pass the node data to it.
222
+ if (McTreeNode.mostRecentTreeNode) {
223
+ McTreeNode.mostRecentTreeNode.data = nodeData;
224
+ }
225
+ }
226
+ /** Set up a subscription for the data provided by the data source. */
227
+ observeRenderChanges() {
228
+ let dataStream;
229
+ // Cannot use `instanceof DataSource` since the data source could be a literal with
230
+ // `connect` function and may not extends DataSource.
231
+ // tslint:disable-next-line:no-unbound-method
232
+ if (typeof this._dataSource.connect === 'function') {
233
+ dataStream = this._dataSource.connect(this);
234
+ }
235
+ else if (this._dataSource instanceof Observable) {
236
+ dataStream = this._dataSource;
237
+ }
238
+ else if (Array.isArray(this._dataSource)) {
239
+ dataStream = of(this._dataSource);
240
+ }
241
+ if (dataStream) {
242
+ this.dataSubscription = dataStream
243
+ .pipe(takeUntil(this.onDestroy))
244
+ .subscribe((data) => this.renderNodeChanges(data));
245
+ }
246
+ else {
247
+ throw getTreeNoValidDataSourceError();
248
+ }
249
+ }
250
+ /**
251
+ * Switch to the provided data source by resetting the data and unsubscribing from the current
252
+ * render change subscription if one exists. If the data source is null, interpret this by
253
+ * clearing the node outlet. Otherwise start listening for new data.
254
+ */
255
+ switchDataSource(dataSource) {
256
+ // tslint:disable-next-line:no-unbound-method
257
+ if (this._dataSource && typeof this._dataSource.disconnect === 'function') {
258
+ this.dataSource.disconnect(this);
259
+ }
260
+ if (this.dataSubscription) {
261
+ this.dataSubscription.unsubscribe();
262
+ this.dataSubscription = null;
263
+ }
264
+ // Remove the all dataNodes if there is now no data source
265
+ if (!dataSource) {
266
+ this.nodeOutlet.viewContainer.clear();
267
+ }
268
+ this._dataSource = dataSource;
269
+ if (this.nodeDefs) {
270
+ this.observeRenderChanges();
271
+ }
272
+ }
273
+ }
274
+ /** @nocollapse */ /** @nocollapse */ McTreeBase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTreeBase, deps: [{ token: i0.IterableDiffers }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
275
+ /** @nocollapse */ /** @nocollapse */ McTreeBase.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", 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 });
276
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTreeBase, decorators: [{
277
+ type: Directive
278
+ }], ctorParameters: function () { return [{ type: i0.IterableDiffers }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { treeControl: [{
279
+ type: Input
280
+ }], trackBy: [{
281
+ type: Input
282
+ }], nodeOutlet: [{
283
+ type: ViewChild,
284
+ args: [McTreeNodeOutlet, { static: true }]
285
+ }], nodeDefs: [{
286
+ type: ContentChildren,
287
+ args: [McTreeNodeDef]
288
+ }], dataSource: [{
289
+ type: Input
290
+ }] } });
291
+ class McTreeNode {
292
+ constructor(elementRef, tree) {
293
+ this.elementRef = elementRef;
294
+ this.tree = tree;
295
+ this.destroyed = new Subject();
296
+ McTreeNode.mostRecentTreeNode = this;
297
+ }
298
+ get data() {
299
+ return this._data;
300
+ }
301
+ set data(value) {
302
+ this._data = value;
303
+ }
304
+ get isExpanded() {
305
+ return this.tree.treeControl.isExpanded(this.data);
306
+ }
307
+ get level() {
308
+ return this.tree.treeControl.getLevel ? this.tree.treeControl.getLevel(this._data) : 0;
309
+ }
310
+ ngOnDestroy() {
311
+ this.destroyed.next();
312
+ this.destroyed.complete();
313
+ }
314
+ focus() {
315
+ this.elementRef.nativeElement.focus();
316
+ }
317
+ }
318
+ /**
319
+ * The most recently created `McTreeNode`. We save it in static variable so we can retrieve it
320
+ * in `McTree` and set the data to it.
321
+ */
322
+ McTreeNode.mostRecentTreeNode = null;
323
+ /** @nocollapse */ /** @nocollapse */ McTreeNode.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTreeNode, deps: [{ token: i0.ElementRef }, { token: forwardRef(() => McTreeBase) }], target: i0.ɵɵFactoryTarget.Directive });
324
+ /** @nocollapse */ /** @nocollapse */ McTreeNode.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", type: McTreeNode, selector: "mc-tree-node", exportAs: ["mcTreeNode"], ngImport: i0 });
325
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTreeNode, decorators: [{
326
+ type: Directive,
327
+ args: [{
328
+ selector: 'mc-tree-node',
329
+ exportAs: 'mcTreeNode'
330
+ }]
331
+ }], ctorParameters: function () {
332
+ return [{ type: i0.ElementRef }, { type: McTreeBase, decorators: [{
333
+ type: Inject,
334
+ args: [forwardRef(() => McTreeBase)]
335
+ }] }];
336
336
  } });
337
337
 
338
- class McTreeNodeToggleBase {
339
- }
340
- // tslint:disable-next-line:naming-convention
341
- const McTreeNodeToggleMixinBase = mixinDisabled(McTreeNodeToggleBase);
342
- /** @docs-private */
343
- class McTreeNodeToggleBaseDirective extends McTreeNodeToggleMixinBase {
344
- constructor(tree, treeNode) {
345
- super();
346
- this.tree = tree;
347
- this.treeNode = treeNode;
348
- this._recursive = false;
349
- this.tree.treeControl.filterValue
350
- .pipe(map((value) => (value === null || value === void 0 ? void 0 : value.length) > 0))
351
- .subscribe((state) => this.disabled = state);
352
- }
353
- get recursive() {
354
- return this._recursive;
355
- }
356
- set recursive(value) {
357
- this._recursive = coerceBooleanProperty(value);
358
- }
359
- get iconState() {
360
- return this.tree.treeControl.isExpanded(this.node);
361
- }
362
- toggle(event) {
363
- if (this.disabled) {
364
- return;
365
- }
366
- this.recursive
367
- ? this.tree.treeControl.toggleDescendants(this.treeNode.data)
368
- : this.tree.treeControl.toggle(this.treeNode.data);
369
- event.stopPropagation();
370
- }
371
- }
372
- /** @nocollapse */ /** @nocollapse */ McTreeNodeToggleBaseDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTreeNodeToggleBaseDirective, deps: [{ token: McTreeBase }, { token: McTreeNode }], target: i0.ɵɵFactoryTarget.Directive });
373
- /** @nocollapse */ /** @nocollapse */ McTreeNodeToggleBaseDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", type: McTreeNodeToggleBaseDirective, inputs: { node: "node", recursive: ["mcTreeNodeToggleRecursive", "recursive"] }, usesInheritance: true, ngImport: i0 });
374
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTreeNodeToggleBaseDirective, decorators: [{
375
- type: Directive
376
- }], ctorParameters: function () { return [{ type: McTreeBase }, { type: McTreeNode }]; }, propDecorators: { node: [{
377
- type: Input
378
- }], recursive: [{
379
- type: Input,
380
- args: ['mcTreeNodeToggleRecursive']
381
- }] } });
382
- class McTreeNodeToggleComponent extends McTreeNodeToggleBaseDirective {
383
- }
384
- /** @nocollapse */ /** @nocollapse */ McTreeNodeToggleComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTreeNodeToggleComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
385
- /** @nocollapse */ /** @nocollapse */ McTreeNodeToggleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: McTreeNodeToggleComponent, selector: "mc-tree-node-toggle", inputs: { disabled: "disabled" }, host: { listeners: { "click": "toggle($event)" }, properties: { "class.mc-expanded": "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;height:100%;padding-left:var(--mc-tree-size-toggle-padding, 4px);padding-right:var(--mc-tree-size-toggle-padding, 4px);cursor:pointer}.mc-tree-node-toggle .mc-icon{transform:rotate(-90deg)}.mc-tree-node-toggle.mc-expanded .mc-icon{transform:rotate(0)}.mc-tree-node-toggle[disabled]{cursor:default}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
386
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTreeNodeToggleComponent, decorators: [{
387
- type: Component,
388
- args: [{ selector: 'mc-tree-node-toggle', exportAs: 'mcTreeNodeToggle', template: `<i class="mc mc-icon mc-angle-down-S_16"></i>`, host: {
389
- class: 'mc-tree-node-toggle',
390
- '[class.mc-expanded]': 'iconState',
391
- '[attr.disabled]': 'disabled || null',
392
- '(click)': 'toggle($event)'
393
- }, inputs: ['disabled'], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, styles: [".mc-tree-node-toggle{display:flex;align-items:center;justify-content:center;flex-shrink:0;height:100%;padding-left:var(--mc-tree-size-toggle-padding, 4px);padding-right:var(--mc-tree-size-toggle-padding, 4px);cursor:pointer}.mc-tree-node-toggle .mc-icon{transform:rotate(-90deg)}.mc-tree-node-toggle.mc-expanded .mc-icon{transform:rotate(0)}.mc-tree-node-toggle[disabled]{cursor:default}\n"] }]
394
- }] });
395
- class McTreeNodeToggleDirective extends McTreeNodeToggleBaseDirective {
396
- }
397
- /** @nocollapse */ /** @nocollapse */ McTreeNodeToggleDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTreeNodeToggleDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
398
- /** @nocollapse */ /** @nocollapse */ McTreeNodeToggleDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", type: McTreeNodeToggleDirective, selector: "[mc-tree-node-toggle], [mcTreeNodeToggle]", host: { listeners: { "click": "toggle($event)" }, properties: { "attr.disabled": "disabled || null" } }, exportAs: ["mcTreeNodeToggle"], usesInheritance: true, ngImport: i0 });
399
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTreeNodeToggleDirective, decorators: [{
400
- type: Directive,
401
- args: [{
402
- selector: '[mc-tree-node-toggle], [mcTreeNodeToggle]',
403
- exportAs: 'mcTreeNodeToggle',
404
- host: {
405
- '[attr.disabled]': 'disabled || null',
406
- '(click)': 'toggle($event)'
407
- }
408
- }]
338
+ class McTreeNodeToggleBase {
339
+ }
340
+ // tslint:disable-next-line:naming-convention
341
+ const McTreeNodeToggleMixinBase = mixinDisabled(McTreeNodeToggleBase);
342
+ /** @docs-private */
343
+ class McTreeNodeToggleBaseDirective extends McTreeNodeToggleMixinBase {
344
+ constructor(tree, treeNode) {
345
+ super();
346
+ this.tree = tree;
347
+ this.treeNode = treeNode;
348
+ this._recursive = false;
349
+ this.tree.treeControl.filterValue
350
+ .pipe(map((value) => (value === null || value === void 0 ? void 0 : value.length) > 0))
351
+ .subscribe((state) => this.disabled = state);
352
+ }
353
+ get recursive() {
354
+ return this._recursive;
355
+ }
356
+ set recursive(value) {
357
+ this._recursive = coerceBooleanProperty(value);
358
+ }
359
+ get iconState() {
360
+ return this.tree.treeControl.isExpanded(this.node);
361
+ }
362
+ toggle(event) {
363
+ if (this.disabled) {
364
+ return;
365
+ }
366
+ this.recursive
367
+ ? this.tree.treeControl.toggleDescendants(this.treeNode.data)
368
+ : this.tree.treeControl.toggle(this.treeNode.data);
369
+ event.stopPropagation();
370
+ }
371
+ }
372
+ /** @nocollapse */ /** @nocollapse */ McTreeNodeToggleBaseDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTreeNodeToggleBaseDirective, deps: [{ token: McTreeBase }, { token: McTreeNode }], target: i0.ɵɵFactoryTarget.Directive });
373
+ /** @nocollapse */ /** @nocollapse */ McTreeNodeToggleBaseDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", type: McTreeNodeToggleBaseDirective, inputs: { node: "node", recursive: ["mcTreeNodeToggleRecursive", "recursive"] }, usesInheritance: true, ngImport: i0 });
374
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTreeNodeToggleBaseDirective, decorators: [{
375
+ type: Directive
376
+ }], ctorParameters: function () { return [{ type: McTreeBase }, { type: McTreeNode }]; }, propDecorators: { node: [{
377
+ type: Input
378
+ }], recursive: [{
379
+ type: Input,
380
+ args: ['mcTreeNodeToggleRecursive']
381
+ }] } });
382
+ class McTreeNodeToggleComponent extends McTreeNodeToggleBaseDirective {
383
+ }
384
+ /** @nocollapse */ /** @nocollapse */ McTreeNodeToggleComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTreeNodeToggleComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
385
+ /** @nocollapse */ /** @nocollapse */ McTreeNodeToggleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: McTreeNodeToggleComponent, selector: "mc-tree-node-toggle", inputs: { disabled: "disabled" }, host: { listeners: { "click": "toggle($event)" }, properties: { "class.mc-expanded": "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;height:100%;padding-left:var(--mc-tree-size-toggle-padding, 4px);padding-right:var(--mc-tree-size-toggle-padding, 4px);cursor:pointer}.mc-tree-node-toggle .mc-icon{transform:rotate(-90deg)}.mc-tree-node-toggle.mc-expanded .mc-icon{transform:rotate(0)}.mc-tree-node-toggle[disabled]{cursor:default}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
386
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTreeNodeToggleComponent, decorators: [{
387
+ type: Component,
388
+ args: [{ selector: 'mc-tree-node-toggle', exportAs: 'mcTreeNodeToggle', template: `<i class="mc mc-icon mc-angle-down-S_16"></i>`, host: {
389
+ class: 'mc-tree-node-toggle',
390
+ '[class.mc-expanded]': 'iconState',
391
+ '[attr.disabled]': 'disabled || null',
392
+ '(click)': 'toggle($event)'
393
+ }, inputs: ['disabled'], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, styles: [".mc-tree-node-toggle{display:flex;align-items:center;justify-content:center;flex-shrink:0;height:100%;padding-left:var(--mc-tree-size-toggle-padding, 4px);padding-right:var(--mc-tree-size-toggle-padding, 4px);cursor:pointer}.mc-tree-node-toggle .mc-icon{transform:rotate(-90deg)}.mc-tree-node-toggle.mc-expanded .mc-icon{transform:rotate(0)}.mc-tree-node-toggle[disabled]{cursor:default}\n"] }]
394
+ }] });
395
+ class McTreeNodeToggleDirective extends McTreeNodeToggleBaseDirective {
396
+ }
397
+ /** @nocollapse */ /** @nocollapse */ McTreeNodeToggleDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTreeNodeToggleDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
398
+ /** @nocollapse */ /** @nocollapse */ McTreeNodeToggleDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", type: McTreeNodeToggleDirective, selector: "[mc-tree-node-toggle], [mcTreeNodeToggle]", host: { listeners: { "click": "toggle($event)" }, properties: { "attr.disabled": "disabled || null" } }, exportAs: ["mcTreeNodeToggle"], usesInheritance: true, ngImport: i0 });
399
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTreeNodeToggleDirective, decorators: [{
400
+ type: Directive,
401
+ args: [{
402
+ selector: '[mc-tree-node-toggle], [mcTreeNodeToggle]',
403
+ exportAs: 'mcTreeNodeToggle',
404
+ host: {
405
+ '[attr.disabled]': 'disabled || null',
406
+ '(click)': 'toggle($event)'
407
+ }
408
+ }]
409
409
  }] });
410
410
 
411
- /**
412
- * Injection token used to provide the parent component to options.
413
- */
414
- const MC_TREE_OPTION_PARENT_COMPONENT = new InjectionToken('MC_TREE_OPTION_PARENT_COMPONENT');
415
- class McTreeOptionChange {
416
- constructor(source, isUserInput = false) {
417
- this.source = source;
418
- this.isUserInput = isUserInput;
419
- }
420
- }
421
- let uniqueIdCounter = 0;
422
- class McTreeOption extends McTreeNode {
423
- constructor(elementRef, changeDetectorRef, ngZone, tree) {
424
- super(elementRef, tree);
425
- this.changeDetectorRef = changeDetectorRef;
426
- this.ngZone = ngZone;
427
- this.tree = tree;
428
- this.onFocus = new Subject();
429
- this.onBlur = new Subject();
430
- this._disabled = false;
431
- this.onSelectionChange = new EventEmitter();
432
- this._selected = false;
433
- this._id = `mc-tree-option-${uniqueIdCounter++}`;
434
- this.hasFocus = false;
435
- }
436
- get externalPseudoCheckbox() {
437
- return !!this.pseudoCheckbox;
438
- }
439
- get value() {
440
- return this._value;
441
- }
442
- set value(value) {
443
- this._value = value;
444
- }
445
- get disabled() {
446
- return this._disabled || this.tree.disabled || this.tree.treeControl.isDisabled(this.data);
447
- }
448
- set disabled(value) {
449
- const newValue = coerceBooleanProperty(value);
450
- if (newValue !== this._disabled) {
451
- this._disabled = newValue;
452
- }
453
- }
454
- get showCheckbox() {
455
- return this._showCheckbox !== undefined ? this._showCheckbox : this.tree.showCheckbox;
456
- }
457
- set showCheckbox(value) {
458
- this._showCheckbox = coerceBooleanProperty(value);
459
- }
460
- get selected() {
461
- return this._selected;
462
- }
463
- set selected(value) {
464
- const isSelected = coerceBooleanProperty(value);
465
- if (isSelected !== this._selected) {
466
- this.setSelected(isSelected);
467
- }
468
- }
469
- get id() {
470
- return this._id;
471
- }
472
- get viewValue() {
473
- // TODO: Add input property alternative for node envs.
474
- return (this.getHostElement().textContent || '').trim();
475
- }
476
- get isExpandable() {
477
- var _a;
478
- return !((_a = this.toggleElement) === null || _a === void 0 ? void 0 : _a.disabled) && this.tree.treeControl.isExpandable(this.data);
479
- }
480
- get toggleElement() {
481
- return this.toggleElementComponent || this.toggleElementDirective;
482
- }
483
- get isToggleInDefaultPlace() {
484
- return this.toggleWrapper.nativeElement.childNodes.length > 0;
485
- }
486
- ngAfterContentInit() {
487
- this.value = this.tree.treeControl.getValue(this.data);
488
- }
489
- toggle() {
490
- this.selected = !this.selected;
491
- }
492
- setSelected(selected) {
493
- if (this._selected === selected || !this.tree.selectionModel) {
494
- return;
495
- }
496
- this._selected = selected;
497
- if (selected) {
498
- this.tree.selectionModel.select(this.data);
499
- }
500
- else {
501
- this.tree.selectionModel.deselect(this.data);
502
- }
503
- this.changeDetectorRef.markForCheck();
504
- }
505
- focus(focusOrigin) {
506
- var _a;
507
- if (focusOrigin === 'program') {
508
- return;
509
- }
510
- if (this.disabled || ((_a = this.actionButton) === null || _a === void 0 ? void 0 : _a.hasFocus)) {
511
- return;
512
- }
513
- this.elementRef.nativeElement.focus();
514
- if (!this.hasFocus) {
515
- this.onFocus.next({ option: this });
516
- Promise.resolve().then(() => {
517
- this.hasFocus = true;
518
- this.changeDetectorRef.markForCheck();
519
- });
520
- }
521
- }
522
- blur() {
523
- // When animations are enabled, Angular may end up removing the option from the DOM a little
524
- // earlier than usual, causing it to be blurred and throwing off the logic in the tree
525
- // that moves focus not the next item. To work around the issue, we defer marking the option
526
- // as not focused until the next time the zone stabilizes.
527
- this.ngZone.onStable
528
- .asObservable()
529
- .pipe(take(1))
530
- .subscribe(() => {
531
- this.ngZone.run(() => {
532
- var _a;
533
- if ((_a = this.actionButton) === null || _a === void 0 ? void 0 : _a.hasFocus) {
534
- return;
535
- }
536
- this.onBlur.next({ option: this });
537
- });
538
- });
539
- }
540
- getHeight() {
541
- const clientRects = this.elementRef.nativeElement.getClientRects();
542
- if (clientRects.length) {
543
- return clientRects[0].height;
544
- }
545
- return 0;
546
- }
547
- select(setFocus = true) {
548
- if (this._selected) {
549
- return;
550
- }
551
- this._selected = true;
552
- if (setFocus && !this.hasFocus) {
553
- this.focus();
554
- }
555
- this.changeDetectorRef.markForCheck();
556
- this.emitSelectionChangeEvent();
557
- }
558
- deselect() {
559
- if (!this._selected) {
560
- return;
561
- }
562
- this._selected = false;
563
- this.changeDetectorRef.markForCheck();
564
- }
565
- onKeydown($event) {
566
- if (!this.actionButton) {
567
- return;
568
- }
569
- if ($event.keyCode === TAB && !$event.shiftKey && !this.actionButton.hasFocus) {
570
- this.actionButton.focus();
571
- $event.preventDefault();
572
- }
573
- }
574
- selectViaInteraction($event) {
575
- if (this.disabled) {
576
- return;
577
- }
578
- this.changeDetectorRef.markForCheck();
579
- this.emitSelectionChangeEvent(true);
580
- const shiftKey = $event ? hasModifierKey($event, 'shiftKey') : false;
581
- const ctrlKey = $event ? hasModifierKey($event, 'ctrlKey') : false;
582
- this.tree.setSelectedOptionsByClick(this, shiftKey, ctrlKey);
583
- }
584
- emitSelectionChangeEvent(isUserInput = false) {
585
- this.onSelectionChange.emit(new McTreeOptionChange(this, isUserInput));
586
- }
587
- getHostElement() {
588
- return this.elementRef.nativeElement;
589
- }
590
- markForCheck() {
591
- this.changeDetectorRef.markForCheck();
592
- }
593
- }
594
- /** @nocollapse */ /** @nocollapse */ McTreeOption.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTreeOption, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: MC_TREE_OPTION_PARENT_COMPONENT }], target: i0.ɵɵFactoryTarget.Component });
595
- /** @nocollapse */ /** @nocollapse */ McTreeOption.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", 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: [
596
- { provide: McTreeNode, useExisting: McTreeOption },
597
- { provide: MC_OPTION_ACTION_PARENT, useExisting: McTreeOption }
598
- ], queries: [{ propertyName: "toggleElementDirective", first: true, predicate: McTreeNodeToggleDirective, descendants: true }, { propertyName: "toggleElementComponent", first: true, predicate: McTreeNodeToggleComponent, descendants: true }, { propertyName: "pseudoCheckbox", first: true, predicate: McPseudoCheckbox, 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 }], viewQueries: [{ propertyName: "toggleWrapper", first: true, predicate: ["toggleWrapper"], descendants: true }], exportAs: ["mcTreeOption"], usesInheritance: true, ngImport: i0, template: "<div class=\"toggle-wrapper\" #toggleWrapper>\r\n <ng-content select=\"mc-tree-node-toggle, [mc-tree-node-toggle], [mcTreeNodeToggle]\"></ng-content>\r\n</div>\r\n\r\n<ng-container [ngSwitch]=\"externalPseudoCheckbox\">\r\n <ng-content *ngSwitchCase=\"true\" select=\"mc-pseudo-checkbox\"></ng-content>\r\n\r\n <ng-container *ngSwitchCase=\"false\">\r\n <mc-pseudo-checkbox\r\n *ngIf=\"showCheckbox\"\r\n [state]=\"selected ? 'checked' : 'unchecked'\"\r\n [disabled]=\"disabled\">\r\n </mc-pseudo-checkbox>\r\n </ng-container>\r\n</ng-container>\r\n\r\n<ng-content select=\"mc-checkbox\"></ng-content>\r\n\r\n<ng-content select=\"[mc-icon]\"></ng-content>\r\n\r\n<ng-content select=\"mc-progress-spinner\"></ng-content>\r\n\r\n<span class=\"mc-option-text mc-no-select\"><ng-content></ng-content></span>\r\n\r\n<ng-content select=\"mc-option-action\"></ng-content>\r\n\r\n<div class=\"mc-option-overlay\"></div>\r\n", styles: [".mc-tree-option{box-sizing:border-box;display:flex;align-items:center;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:var(--mc-tree-size-padding-right, 16px)}.mc-tree-option>.mc-icon,.mc-tree-option>.toggle-wrapper>.mc-icon{margin-right:var(--mc-tree-size-icon-padding, 8px);cursor:pointer}.mc-tree-option>.mc-progress-spinner{margin-right:8px}.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:var(--mc-tree-size-icon-padding, 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: ["color", "state", "disabled"] }], directives: [{ type: i2.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i2.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
599
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTreeOption, decorators: [{
600
- type: Component,
601
- args: [{ selector: 'mc-tree-option', exportAs: 'mcTreeOption', host: {
602
- class: 'mc-tree-option',
603
- '[class.mc-selected]': 'selected',
604
- '[class.mc-focused]': 'hasFocus',
605
- '[class.mc-action-button-focused]': 'actionButton?.active',
606
- '[attr.id]': 'id',
607
- '[attr.tabindex]': '-1',
608
- '[attr.disabled]': 'disabled || null',
609
- '(focusin)': 'focus()',
610
- '(blur)': 'blur()',
611
- '(click)': 'selectViaInteraction($event)',
612
- '(keydown)': 'onKeydown($event)'
613
- }, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [
614
- { provide: McTreeNode, useExisting: McTreeOption },
615
- { provide: MC_OPTION_ACTION_PARENT, useExisting: McTreeOption }
616
- ], template: "<div class=\"toggle-wrapper\" #toggleWrapper>\r\n <ng-content select=\"mc-tree-node-toggle, [mc-tree-node-toggle], [mcTreeNodeToggle]\"></ng-content>\r\n</div>\r\n\r\n<ng-container [ngSwitch]=\"externalPseudoCheckbox\">\r\n <ng-content *ngSwitchCase=\"true\" select=\"mc-pseudo-checkbox\"></ng-content>\r\n\r\n <ng-container *ngSwitchCase=\"false\">\r\n <mc-pseudo-checkbox\r\n *ngIf=\"showCheckbox\"\r\n [state]=\"selected ? 'checked' : 'unchecked'\"\r\n [disabled]=\"disabled\">\r\n </mc-pseudo-checkbox>\r\n </ng-container>\r\n</ng-container>\r\n\r\n<ng-content select=\"mc-checkbox\"></ng-content>\r\n\r\n<ng-content select=\"[mc-icon]\"></ng-content>\r\n\r\n<ng-content select=\"mc-progress-spinner\"></ng-content>\r\n\r\n<span class=\"mc-option-text mc-no-select\"><ng-content></ng-content></span>\r\n\r\n<ng-content select=\"mc-option-action\"></ng-content>\r\n\r\n<div class=\"mc-option-overlay\"></div>\r\n", styles: [".mc-tree-option{box-sizing:border-box;display:flex;align-items:center;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:var(--mc-tree-size-padding-right, 16px)}.mc-tree-option>.mc-icon,.mc-tree-option>.toggle-wrapper>.mc-icon{margin-right:var(--mc-tree-size-icon-padding, 8px);cursor:pointer}.mc-tree-option>.mc-progress-spinner{margin-right:8px}.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:var(--mc-tree-size-icon-padding, 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"] }]
617
- }], ctorParameters: function () {
618
- return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: undefined, decorators: [{
619
- type: Inject,
620
- args: [MC_TREE_OPTION_PARENT_COMPONENT]
621
- }] }];
622
- }, propDecorators: { toggleWrapper: [{
623
- type: ViewChild,
624
- args: ['toggleWrapper']
625
- }], toggleElementDirective: [{
626
- type: ContentChild,
627
- args: [McTreeNodeToggleDirective]
628
- }], toggleElementComponent: [{
629
- type: ContentChild,
630
- args: [McTreeNodeToggleComponent]
631
- }], pseudoCheckbox: [{
632
- type: ContentChild,
633
- args: [McPseudoCheckbox]
634
- }], actionButton: [{
635
- type: ContentChild,
636
- args: [McOptionActionComponent]
637
- }], tooltipTrigger: [{
638
- type: ContentChild,
639
- args: [McTooltipTrigger]
640
- }], dropdownTrigger: [{
641
- type: ContentChild,
642
- args: [McDropdownTrigger]
643
- }], disabled: [{
644
- type: Input
645
- }], showCheckbox: [{
646
- type: Input
647
- }], onSelectionChange: [{
648
- type: Output
411
+ /**
412
+ * Injection token used to provide the parent component to options.
413
+ */
414
+ const MC_TREE_OPTION_PARENT_COMPONENT = new InjectionToken('MC_TREE_OPTION_PARENT_COMPONENT');
415
+ class McTreeOptionChange {
416
+ constructor(source, isUserInput = false) {
417
+ this.source = source;
418
+ this.isUserInput = isUserInput;
419
+ }
420
+ }
421
+ let uniqueIdCounter = 0;
422
+ class McTreeOption extends McTreeNode {
423
+ constructor(elementRef, changeDetectorRef, ngZone, tree) {
424
+ super(elementRef, tree);
425
+ this.changeDetectorRef = changeDetectorRef;
426
+ this.ngZone = ngZone;
427
+ this.tree = tree;
428
+ this.onFocus = new Subject();
429
+ this.onBlur = new Subject();
430
+ this._disabled = false;
431
+ this.onSelectionChange = new EventEmitter();
432
+ this._selected = false;
433
+ this._id = `mc-tree-option-${uniqueIdCounter++}`;
434
+ this.hasFocus = false;
435
+ }
436
+ get externalPseudoCheckbox() {
437
+ return !!this.pseudoCheckbox;
438
+ }
439
+ get value() {
440
+ return this._value;
441
+ }
442
+ set value(value) {
443
+ this._value = value;
444
+ }
445
+ get disabled() {
446
+ return this._disabled || this.tree.disabled || this.tree.treeControl.isDisabled(this.data);
447
+ }
448
+ set disabled(value) {
449
+ const newValue = coerceBooleanProperty(value);
450
+ if (newValue !== this._disabled) {
451
+ this._disabled = newValue;
452
+ }
453
+ }
454
+ get showCheckbox() {
455
+ return this._showCheckbox !== undefined ? this._showCheckbox : this.tree.showCheckbox;
456
+ }
457
+ set showCheckbox(value) {
458
+ this._showCheckbox = coerceBooleanProperty(value);
459
+ }
460
+ get selected() {
461
+ return this._selected;
462
+ }
463
+ set selected(value) {
464
+ const isSelected = coerceBooleanProperty(value);
465
+ if (isSelected !== this._selected) {
466
+ this.setSelected(isSelected);
467
+ }
468
+ }
469
+ get id() {
470
+ return this._id;
471
+ }
472
+ get viewValue() {
473
+ // TODO: Add input property alternative for node envs.
474
+ return (this.getHostElement().textContent || '').trim();
475
+ }
476
+ get isExpandable() {
477
+ var _a;
478
+ return !((_a = this.toggleElement) === null || _a === void 0 ? void 0 : _a.disabled) && this.tree.treeControl.isExpandable(this.data);
479
+ }
480
+ get toggleElement() {
481
+ return this.toggleElementComponent || this.toggleElementDirective;
482
+ }
483
+ get isToggleInDefaultPlace() {
484
+ return this.toggleWrapper.nativeElement.childNodes.length > 0;
485
+ }
486
+ ngAfterContentInit() {
487
+ this.value = this.tree.treeControl.getValue(this.data);
488
+ }
489
+ toggle() {
490
+ this.selected = !this.selected;
491
+ }
492
+ setSelected(selected) {
493
+ if (this._selected === selected || !this.tree.selectionModel) {
494
+ return;
495
+ }
496
+ this._selected = selected;
497
+ if (selected) {
498
+ this.tree.selectionModel.select(this.data);
499
+ }
500
+ else {
501
+ this.tree.selectionModel.deselect(this.data);
502
+ }
503
+ this.changeDetectorRef.markForCheck();
504
+ }
505
+ focus(focusOrigin) {
506
+ var _a;
507
+ if (focusOrigin === 'program') {
508
+ return;
509
+ }
510
+ if (this.disabled || ((_a = this.actionButton) === null || _a === void 0 ? void 0 : _a.hasFocus)) {
511
+ return;
512
+ }
513
+ this.elementRef.nativeElement.focus();
514
+ if (!this.hasFocus) {
515
+ this.onFocus.next({ option: this });
516
+ Promise.resolve().then(() => {
517
+ this.hasFocus = true;
518
+ this.changeDetectorRef.markForCheck();
519
+ });
520
+ }
521
+ }
522
+ blur() {
523
+ // When animations are enabled, Angular may end up removing the option from the DOM a little
524
+ // earlier than usual, causing it to be blurred and throwing off the logic in the tree
525
+ // that moves focus not the next item. To work around the issue, we defer marking the option
526
+ // as not focused until the next time the zone stabilizes.
527
+ this.ngZone.onStable
528
+ .asObservable()
529
+ .pipe(take(1))
530
+ .subscribe(() => {
531
+ this.ngZone.run(() => {
532
+ var _a;
533
+ if ((_a = this.actionButton) === null || _a === void 0 ? void 0 : _a.hasFocus) {
534
+ return;
535
+ }
536
+ this.onBlur.next({ option: this });
537
+ });
538
+ });
539
+ }
540
+ getHeight() {
541
+ const clientRects = this.elementRef.nativeElement.getClientRects();
542
+ if (clientRects.length) {
543
+ return clientRects[0].height;
544
+ }
545
+ return 0;
546
+ }
547
+ select(setFocus = true) {
548
+ if (this._selected) {
549
+ return;
550
+ }
551
+ this._selected = true;
552
+ if (setFocus && !this.hasFocus) {
553
+ this.focus();
554
+ }
555
+ this.changeDetectorRef.markForCheck();
556
+ this.emitSelectionChangeEvent();
557
+ }
558
+ deselect() {
559
+ if (!this._selected) {
560
+ return;
561
+ }
562
+ this._selected = false;
563
+ this.changeDetectorRef.markForCheck();
564
+ }
565
+ onKeydown($event) {
566
+ if (!this.actionButton) {
567
+ return;
568
+ }
569
+ if ($event.keyCode === TAB && !$event.shiftKey && !this.actionButton.hasFocus) {
570
+ this.actionButton.focus();
571
+ $event.preventDefault();
572
+ }
573
+ }
574
+ selectViaInteraction($event) {
575
+ if (this.disabled) {
576
+ return;
577
+ }
578
+ this.changeDetectorRef.markForCheck();
579
+ this.emitSelectionChangeEvent(true);
580
+ const shiftKey = $event ? hasModifierKey($event, 'shiftKey') : false;
581
+ const ctrlKey = $event ? hasModifierKey($event, 'ctrlKey') : false;
582
+ this.tree.setSelectedOptionsByClick(this, shiftKey, ctrlKey);
583
+ }
584
+ emitSelectionChangeEvent(isUserInput = false) {
585
+ this.onSelectionChange.emit(new McTreeOptionChange(this, isUserInput));
586
+ }
587
+ getHostElement() {
588
+ return this.elementRef.nativeElement;
589
+ }
590
+ markForCheck() {
591
+ this.changeDetectorRef.markForCheck();
592
+ }
593
+ }
594
+ /** @nocollapse */ /** @nocollapse */ McTreeOption.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTreeOption, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: MC_TREE_OPTION_PARENT_COMPONENT }], target: i0.ɵɵFactoryTarget.Component });
595
+ /** @nocollapse */ /** @nocollapse */ McTreeOption.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", 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: [
596
+ { provide: McTreeNode, useExisting: McTreeOption },
597
+ { provide: MC_OPTION_ACTION_PARENT, useExisting: McTreeOption }
598
+ ], queries: [{ propertyName: "toggleElementDirective", first: true, predicate: McTreeNodeToggleDirective, descendants: true }, { propertyName: "toggleElementComponent", first: true, predicate: McTreeNodeToggleComponent, descendants: true }, { propertyName: "pseudoCheckbox", first: true, predicate: McPseudoCheckbox, 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 }], viewQueries: [{ propertyName: "toggleWrapper", first: true, predicate: ["toggleWrapper"], descendants: true }], exportAs: ["mcTreeOption"], usesInheritance: true, ngImport: i0, template: "<div class=\"toggle-wrapper\" #toggleWrapper>\n <ng-content select=\"mc-tree-node-toggle, [mc-tree-node-toggle], [mcTreeNodeToggle]\"></ng-content>\n</div>\n\n<ng-container [ngSwitch]=\"externalPseudoCheckbox\">\n <ng-content *ngSwitchCase=\"true\" select=\"mc-pseudo-checkbox\"></ng-content>\n\n <ng-container *ngSwitchCase=\"false\">\n <mc-pseudo-checkbox\n *ngIf=\"showCheckbox\"\n [state]=\"selected ? 'checked' : 'unchecked'\"\n [disabled]=\"disabled\">\n </mc-pseudo-checkbox>\n </ng-container>\n</ng-container>\n\n<ng-content select=\"mc-checkbox\"></ng-content>\n\n<ng-content select=\"[mc-icon]\"></ng-content>\n\n<ng-content select=\"mc-progress-spinner\"></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: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:var(--mc-tree-size-padding-right, 16px)}.mc-tree-option>.mc-icon,.mc-tree-option>.toggle-wrapper>.mc-icon{margin-right:var(--mc-tree-size-icon-padding, 8px);cursor:pointer}.mc-tree-option>.mc-progress-spinner{margin-right:8px}.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:var(--mc-tree-size-icon-padding, 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: ["color", "state", "disabled"] }], directives: [{ type: i2.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i2.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
599
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTreeOption, decorators: [{
600
+ type: Component,
601
+ args: [{ selector: 'mc-tree-option', exportAs: 'mcTreeOption', host: {
602
+ class: 'mc-tree-option',
603
+ '[class.mc-selected]': 'selected',
604
+ '[class.mc-focused]': 'hasFocus',
605
+ '[class.mc-action-button-focused]': 'actionButton?.active',
606
+ '[attr.id]': 'id',
607
+ '[attr.tabindex]': '-1',
608
+ '[attr.disabled]': 'disabled || null',
609
+ '(focusin)': 'focus()',
610
+ '(blur)': 'blur()',
611
+ '(click)': 'selectViaInteraction($event)',
612
+ '(keydown)': 'onKeydown($event)'
613
+ }, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [
614
+ { provide: McTreeNode, useExisting: McTreeOption },
615
+ { provide: MC_OPTION_ACTION_PARENT, useExisting: McTreeOption }
616
+ ], template: "<div class=\"toggle-wrapper\" #toggleWrapper>\n <ng-content select=\"mc-tree-node-toggle, [mc-tree-node-toggle], [mcTreeNodeToggle]\"></ng-content>\n</div>\n\n<ng-container [ngSwitch]=\"externalPseudoCheckbox\">\n <ng-content *ngSwitchCase=\"true\" select=\"mc-pseudo-checkbox\"></ng-content>\n\n <ng-container *ngSwitchCase=\"false\">\n <mc-pseudo-checkbox\n *ngIf=\"showCheckbox\"\n [state]=\"selected ? 'checked' : 'unchecked'\"\n [disabled]=\"disabled\">\n </mc-pseudo-checkbox>\n </ng-container>\n</ng-container>\n\n<ng-content select=\"mc-checkbox\"></ng-content>\n\n<ng-content select=\"[mc-icon]\"></ng-content>\n\n<ng-content select=\"mc-progress-spinner\"></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: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:var(--mc-tree-size-padding-right, 16px)}.mc-tree-option>.mc-icon,.mc-tree-option>.toggle-wrapper>.mc-icon{margin-right:var(--mc-tree-size-icon-padding, 8px);cursor:pointer}.mc-tree-option>.mc-progress-spinner{margin-right:8px}.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:var(--mc-tree-size-icon-padding, 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"] }]
617
+ }], ctorParameters: function () {
618
+ return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: undefined, decorators: [{
619
+ type: Inject,
620
+ args: [MC_TREE_OPTION_PARENT_COMPONENT]
621
+ }] }];
622
+ }, propDecorators: { toggleWrapper: [{
623
+ type: ViewChild,
624
+ args: ['toggleWrapper']
625
+ }], toggleElementDirective: [{
626
+ type: ContentChild,
627
+ args: [McTreeNodeToggleDirective]
628
+ }], toggleElementComponent: [{
629
+ type: ContentChild,
630
+ args: [McTreeNodeToggleComponent]
631
+ }], pseudoCheckbox: [{
632
+ type: ContentChild,
633
+ args: [McPseudoCheckbox]
634
+ }], actionButton: [{
635
+ type: ContentChild,
636
+ args: [McOptionActionComponent]
637
+ }], tooltipTrigger: [{
638
+ type: ContentChild,
639
+ args: [McTooltipTrigger]
640
+ }], dropdownTrigger: [{
641
+ type: ContentChild,
642
+ args: [McDropdownTrigger]
643
+ }], disabled: [{
644
+ type: Input
645
+ }], showCheckbox: [{
646
+ type: Input
647
+ }], onSelectionChange: [{
648
+ type: Output
649
649
  }] } });
650
650
 
651
- /** Regex used to split a string on its CSS units. */
652
- const cssUnitPattern = /([A-Za-z%]+)$/;
653
- class McTreeNodePadding {
654
- constructor(treeNode, tree, renderer, element, option, dir) {
655
- var _a, _b;
656
- this.treeNode = treeNode;
657
- this.tree = tree;
658
- this.renderer = renderer;
659
- this.element = element;
660
- this.option = option;
661
- this.dir = dir;
662
- this._indent = 20;
663
- /** CSS units used for the indentation value. */
664
- this.indentUnits = 'px';
665
- this.baseLeftPadding = parseInt(TreeSizePaddingLeft);
666
- this.iconWidth = 24;
667
- this.destroyed = new Subject();
668
- (_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());
669
- }
670
- get level() {
671
- return this._level;
672
- }
673
- set level(value) {
674
- this.setLevelInput(value);
675
- }
676
- get indent() {
677
- return this._indent;
678
- }
679
- set indent(indent) {
680
- this.setIndentInput(indent);
681
- }
682
- get leftPadding() {
683
- return (this.withIcon ? 0 : this.iconWidth) + this.baseLeftPadding;
684
- }
685
- ngAfterViewInit() {
686
- this.withIcon = this.option.isToggleInDefaultPlace;
687
- this.setPadding();
688
- }
689
- ngOnDestroy() {
690
- this.destroyed.next();
691
- this.destroyed.complete();
692
- }
693
- paddingIndent() {
694
- const nodeLevel = (this.treeNode.data && this.tree.treeControl.getLevel)
695
- ? this.tree.treeControl.getLevel(this.treeNode.data)
696
- : 0;
697
- const level = this.level || nodeLevel;
698
- return level > 0 ? `${(level * this._indent) + this.leftPadding}px` : `${this.leftPadding}px`;
699
- }
700
- /**
701
- * This has been extracted to a util because of TS 4 and VE.
702
- * View Engine doesn't support property rename inheritance.
703
- * TS 4.0 doesn't allow properties to override accessors or vice-versa.
704
- * @docs-private
705
- */
706
- setLevelInput(value) {
707
- // Set to null as the fallback value so that _setPadding can fall back to the node level if the
708
- // consumer set the directive as `mcTreeNodePadding=""`. We still want to take this value if
709
- // they set 0 explicitly.
710
- this._level = coerceNumberProperty(value, null);
711
- this.setPadding();
712
- }
713
- /**
714
- * This has been extracted to a util because of TS 4 and VE.
715
- * View Engine doesn't support property rename inheritance.
716
- * TS 4.0 doesn't allow properties to override accessors or vice-versa.
717
- * @docs-private
718
- */
719
- setIndentInput(indent) {
720
- let value = indent;
721
- let units = 'px';
722
- if (typeof indent === 'string') {
723
- const parts = indent.split(cssUnitPattern);
724
- value = parts[0];
725
- units = parts[1] || units;
726
- }
727
- this.indentUnits = units;
728
- this._indent = coerceNumberProperty(value);
729
- this.setPadding();
730
- }
731
- setPadding() {
732
- var _a;
733
- const padding = this.paddingIndent();
734
- const paddingProp = ((_a = this.dir) === null || _a === void 0 ? void 0 : _a.value) === 'rtl' ? 'paddingRight' : 'paddingLeft';
735
- this.renderer.setStyle(this.element.nativeElement, paddingProp, padding);
736
- }
737
- }
738
- /** @nocollapse */ /** @nocollapse */ McTreeNodePadding.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTreeNodePadding, deps: [{ token: McTreeNode }, { token: McTreeBase }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: McTreeOption }, { token: i3.Directionality, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
739
- /** @nocollapse */ /** @nocollapse */ McTreeNodePadding.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", type: McTreeNodePadding, selector: "[mcTreeNodePadding]", inputs: { indent: ["mcTreeNodePaddingIndent", "indent"] }, exportAs: ["mcTreeNodePadding"], ngImport: i0 });
740
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTreeNodePadding, decorators: [{
741
- type: Directive,
742
- args: [{
743
- selector: '[mcTreeNodePadding]',
744
- exportAs: 'mcTreeNodePadding'
745
- }]
746
- }], ctorParameters: function () {
747
- return [{ type: McTreeNode }, { type: McTreeBase }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: McTreeOption }, { type: i3.Directionality, decorators: [{
748
- type: Optional
749
- }] }];
750
- }, propDecorators: { indent: [{
751
- type: Input,
752
- args: ['mcTreeNodePaddingIndent']
651
+ /** Regex used to split a string on its CSS units. */
652
+ const cssUnitPattern = /([A-Za-z%]+)$/;
653
+ class McTreeNodePadding {
654
+ constructor(treeNode, tree, renderer, element, option, dir) {
655
+ var _a, _b;
656
+ this.treeNode = treeNode;
657
+ this.tree = tree;
658
+ this.renderer = renderer;
659
+ this.element = element;
660
+ this.option = option;
661
+ this.dir = dir;
662
+ this._indent = 20;
663
+ /** CSS units used for the indentation value. */
664
+ this.indentUnits = 'px';
665
+ this.baseLeftPadding = parseInt(TreeSizePaddingLeft);
666
+ this.iconWidth = 24;
667
+ this.destroyed = new Subject();
668
+ (_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());
669
+ }
670
+ get level() {
671
+ return this._level;
672
+ }
673
+ set level(value) {
674
+ this.setLevelInput(value);
675
+ }
676
+ get indent() {
677
+ return this._indent;
678
+ }
679
+ set indent(indent) {
680
+ this.setIndentInput(indent);
681
+ }
682
+ get leftPadding() {
683
+ return (this.withIcon ? 0 : this.iconWidth) + this.baseLeftPadding;
684
+ }
685
+ ngAfterViewInit() {
686
+ this.withIcon = this.option.isToggleInDefaultPlace;
687
+ this.setPadding();
688
+ }
689
+ ngOnDestroy() {
690
+ this.destroyed.next();
691
+ this.destroyed.complete();
692
+ }
693
+ paddingIndent() {
694
+ const nodeLevel = (this.treeNode.data && this.tree.treeControl.getLevel)
695
+ ? this.tree.treeControl.getLevel(this.treeNode.data)
696
+ : 0;
697
+ const level = this.level || nodeLevel;
698
+ return level > 0 ? `${(level * this._indent) + this.leftPadding}px` : `${this.leftPadding}px`;
699
+ }
700
+ /**
701
+ * This has been extracted to a util because of TS 4 and VE.
702
+ * View Engine doesn't support property rename inheritance.
703
+ * TS 4.0 doesn't allow properties to override accessors or vice-versa.
704
+ * @docs-private
705
+ */
706
+ setLevelInput(value) {
707
+ // Set to null as the fallback value so that _setPadding can fall back to the node level if the
708
+ // consumer set the directive as `mcTreeNodePadding=""`. We still want to take this value if
709
+ // they set 0 explicitly.
710
+ this._level = coerceNumberProperty(value, null);
711
+ this.setPadding();
712
+ }
713
+ /**
714
+ * This has been extracted to a util because of TS 4 and VE.
715
+ * View Engine doesn't support property rename inheritance.
716
+ * TS 4.0 doesn't allow properties to override accessors or vice-versa.
717
+ * @docs-private
718
+ */
719
+ setIndentInput(indent) {
720
+ let value = indent;
721
+ let units = 'px';
722
+ if (typeof indent === 'string') {
723
+ const parts = indent.split(cssUnitPattern);
724
+ value = parts[0];
725
+ units = parts[1] || units;
726
+ }
727
+ this.indentUnits = units;
728
+ this._indent = coerceNumberProperty(value);
729
+ this.setPadding();
730
+ }
731
+ setPadding() {
732
+ var _a;
733
+ const padding = this.paddingIndent();
734
+ const paddingProp = ((_a = this.dir) === null || _a === void 0 ? void 0 : _a.value) === 'rtl' ? 'paddingRight' : 'paddingLeft';
735
+ this.renderer.setStyle(this.element.nativeElement, paddingProp, padding);
736
+ }
737
+ }
738
+ /** @nocollapse */ /** @nocollapse */ McTreeNodePadding.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTreeNodePadding, deps: [{ token: McTreeNode }, { token: McTreeBase }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: McTreeOption }, { token: i3.Directionality, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
739
+ /** @nocollapse */ /** @nocollapse */ McTreeNodePadding.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", type: McTreeNodePadding, selector: "[mcTreeNodePadding]", inputs: { indent: ["mcTreeNodePaddingIndent", "indent"] }, exportAs: ["mcTreeNodePadding"], ngImport: i0 });
740
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTreeNodePadding, decorators: [{
741
+ type: Directive,
742
+ args: [{
743
+ selector: '[mcTreeNodePadding]',
744
+ exportAs: 'mcTreeNodePadding'
745
+ }]
746
+ }], ctorParameters: function () {
747
+ return [{ type: McTreeNode }, { type: McTreeBase }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: McTreeOption }, { type: i3.Directionality, decorators: [{
748
+ type: Optional
749
+ }] }];
750
+ }, propDecorators: { indent: [{
751
+ type: Input,
752
+ args: ['mcTreeNodePaddingIndent']
753
753
  }] } });
754
754
 
755
- class McTree extends McTreeBase {
756
- }
757
- /** @nocollapse */ /** @nocollapse */ McTree.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTree, deps: null, target: i0.ɵɵFactoryTarget.Component });
758
- /** @nocollapse */ /** @nocollapse */ McTree.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", 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 });
759
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTree, decorators: [{
760
- type: Component,
761
- args: [{ selector: 'mc-tree', exportAs: 'mcTree', template: `<ng-container mcTreeNodeOutlet></ng-container>`, host: {
762
- class: 'mc-tree'
763
- }, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, styles: [".mc-tree{display:block}\n"] }]
755
+ class McTree extends McTreeBase {
756
+ }
757
+ /** @nocollapse */ /** @nocollapse */ McTree.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTree, deps: null, target: i0.ɵɵFactoryTarget.Component });
758
+ /** @nocollapse */ /** @nocollapse */ McTree.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", 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 });
759
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTree, decorators: [{
760
+ type: Component,
761
+ args: [{ selector: 'mc-tree', exportAs: 'mcTree', template: `<ng-container mcTreeNodeOutlet></ng-container>`, host: {
762
+ class: 'mc-tree'
763
+ }, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, styles: [".mc-tree{display:block}\n"] }]
764
764
  }] });
765
765
 
766
- const MC_SELECTION_TREE_VALUE_ACCESSOR = {
767
- provide: NG_VALUE_ACCESSOR,
768
- useExisting: forwardRef(() => McTreeSelection),
769
- multi: true
770
- };
771
- class McTreeSelectAllEvent {
772
- constructor(source, options) {
773
- this.source = source;
774
- this.options = options;
775
- }
776
- }
777
- class McTreeCopyEvent {
778
- constructor(source, option) {
779
- this.source = source;
780
- this.option = option;
781
- }
782
- }
783
- class McTreeNavigationChange {
784
- constructor(source, option) {
785
- this.source = source;
786
- this.option = option;
787
- }
788
- }
789
- class McTreeSelectionChange {
790
- constructor(source, option) {
791
- this.source = source;
792
- this.option = option;
793
- }
794
- }
795
- class McTreeSelection extends McTreeBase {
796
- constructor(elementRef, scheduler, differs, changeDetectorRef, multiple, clipboard) {
797
- super(differs, changeDetectorRef);
798
- this.elementRef = elementRef;
799
- this.scheduler = scheduler;
800
- this.clipboard = clipboard;
801
- this.renderedOptions = new QueryList();
802
- this.resetFocusedItemOnBlur = true;
803
- this.multipleMode = null;
804
- this.userTabIndex = null;
805
- this.navigationChange = new EventEmitter();
806
- this.selectionChange = new EventEmitter();
807
- this.onSelectAll = new EventEmitter();
808
- this.onCopy = new EventEmitter();
809
- this.sortedNodes = [];
810
- this._autoSelect = true;
811
- this._noUnselectLast = true;
812
- this._disabled = false;
813
- this._tabIndex = 0;
814
- this.destroy = new Subject();
815
- /** `View -> model callback called when value changes` */
816
- this.onChange = () => { };
817
- /** `View -> model callback called when select has been touched` */
818
- this.onTouched = () => { };
819
- this.updateRenderedOptions = () => {
820
- const orderedOptions = [];
821
- this.sortedNodes.forEach((node) => {
822
- const found = this.unorderedOptions.find((option) => option.value === this.treeControl.getValue(node));
823
- if (found) {
824
- orderedOptions.push(found);
825
- }
826
- });
827
- this.renderedOptions.reset(orderedOptions);
828
- this.renderedOptions.notifyOnChanges();
829
- this.updateScrollSize();
830
- };
831
- if (multiple === MultipleMode.CHECKBOX || multiple === MultipleMode.KEYBOARD) {
832
- this.multipleMode = multiple;
833
- }
834
- else if (multiple !== null) {
835
- this.multipleMode = MultipleMode.CHECKBOX;
836
- }
837
- if (this.multipleMode === MultipleMode.CHECKBOX) {
838
- this.autoSelect = false;
839
- this.noUnselectLast = false;
840
- }
841
- this.selectionModel = new SelectionModel(this.multiple);
842
- }
843
- get autoSelect() {
844
- return this._autoSelect;
845
- }
846
- set autoSelect(value) {
847
- this._autoSelect = coerceBooleanProperty(value);
848
- }
849
- get optionFocusChanges() {
850
- return merge(...this.renderedOptions.map((option) => option.onFocus));
851
- }
852
- get optionBlurChanges() {
853
- return merge(...this.renderedOptions.map((option) => option.onBlur));
854
- }
855
- get multiple() {
856
- return !!this.multipleMode;
857
- }
858
- get noUnselectLast() {
859
- return this._noUnselectLast;
860
- }
861
- set noUnselectLast(value) {
862
- this._noUnselectLast = coerceBooleanProperty(value);
863
- }
864
- get disabled() {
865
- return this._disabled;
866
- }
867
- set disabled(rawValue) {
868
- const value = coerceBooleanProperty(rawValue);
869
- if (this._disabled !== value) {
870
- this._disabled = value;
871
- this.markOptionsForCheck();
872
- }
873
- }
874
- get tabIndex() {
875
- return this.disabled ? -1 : this._tabIndex;
876
- }
877
- set tabIndex(value) {
878
- this._tabIndex = value;
879
- this.userTabIndex = value;
880
- }
881
- get showCheckbox() {
882
- return this.multipleMode === MultipleMode.CHECKBOX;
883
- }
884
- get isEmpty() {
885
- return this.sortedNodes.length === 0;
886
- }
887
- ngAfterContentInit() {
888
- this.unorderedOptions.changes
889
- .subscribe(this.updateRenderedOptions);
890
- this.keyManager = new FocusKeyManager(this.renderedOptions)
891
- .withVerticalOrientation(true)
892
- .withHorizontalOrientation(null);
893
- this.keyManager.change
894
- .pipe(takeUntil(this.destroy))
895
- .subscribe(() => {
896
- if (this.keyManager.activeItem) {
897
- this.emitNavigationEvent(this.keyManager.activeItem);
898
- // todo need check this logic
899
- if (this.autoSelect && !this.keyManager.activeItem.disabled) {
900
- this.updateOptionsFocus();
901
- }
902
- }
903
- });
904
- this.keyManager.tabOut
905
- .pipe(takeUntil(this.destroy))
906
- .subscribe(() => this.allowFocusEscape());
907
- this.selectionModel.changed
908
- .pipe(takeUntil(this.destroy))
909
- .subscribe(() => {
910
- this.onChange(this.getSelectedValues());
911
- this.renderedOptions.notifyOnChanges();
912
- });
913
- this.renderedOptions.changes
914
- .pipe(takeUntil(this.destroy), delay(0, this.scheduler))
915
- .subscribe((options) => {
916
- this.resetOptions();
917
- // Check to see if we need to update our tab index
918
- this.updateTabIndex();
919
- const selectedValues = this.multiple ? this.getSelectedValues() : [this.getSelectedValues()];
920
- options.forEach((option) => {
921
- if (selectedValues.includes(option.value)) {
922
- option.select(false);
923
- }
924
- else {
925
- option.deselect();
926
- }
927
- option.markForCheck();
928
- });
929
- });
930
- }
931
- ngOnDestroy() {
932
- this.destroy.next();
933
- this.destroy.complete();
934
- }
935
- focus($event) {
936
- if (this.renderedOptions.length === 0 || this.isFocusReceivedFromNestedOption($event)) {
937
- return;
938
- }
939
- this.keyManager.setFocusOrigin('keyboard');
940
- this.keyManager.setFirstItemActive();
941
- this.keyManager.setFocusOrigin('program');
942
- }
943
- blur() {
944
- if (!this.hasFocusedOption() && this.resetFocusedItemOnBlur) {
945
- this.keyManager.setActiveItem(-1);
946
- }
947
- this.onTouched();
948
- this.changeDetectorRef.markForCheck();
949
- }
950
- onKeyDown(event) {
951
- var _a, _b;
952
- this.keyManager.setFocusOrigin('keyboard');
953
- // tslint:disable-next-line: deprecation
954
- const keyCode = event.keyCode;
955
- if ([SPACE, LEFT_ARROW, RIGHT_ARROW].includes(keyCode) || isVerticalMovement(event)) {
956
- event.preventDefault();
957
- }
958
- if (this.multiple && isSelectAll(event)) {
959
- this.selectAllOptions();
960
- event.preventDefault();
961
- return;
962
- }
963
- else if (isCopy(event)) {
964
- this.copyActiveOption();
965
- return;
966
- }
967
- else if (keyCode === TAB) {
968
- this.keyManager.tabOut.next();
969
- return;
970
- }
971
- else if (keyCode === LEFT_ARROW && ((_a = this.keyManager.activeItem) === null || _a === void 0 ? void 0 : _a.isExpandable)) {
972
- this.treeControl.collapse(this.keyManager.activeItem.data);
973
- return;
974
- }
975
- else if (keyCode === RIGHT_ARROW && ((_b = this.keyManager.activeItem) === null || _b === void 0 ? void 0 : _b.isExpandable)) {
976
- this.treeControl.expand(this.keyManager.activeItem.data);
977
- return;
978
- }
979
- else if (keyCode === DOWN_ARROW) {
980
- this.keyManager.setNextItemActive();
981
- }
982
- else if (keyCode === UP_ARROW) {
983
- this.keyManager.setPreviousItemActive();
984
- }
985
- else if ([SPACE, ENTER].includes(keyCode)) {
986
- this.toggleFocusedOption();
987
- return;
988
- }
989
- else if (keyCode === HOME) {
990
- this.keyManager.setFirstItemActive();
991
- }
992
- else if (keyCode === END) {
993
- this.keyManager.setLastItemActive();
994
- }
995
- else if (keyCode === PAGE_UP) {
996
- this.keyManager.setPreviousPageItemActive();
997
- }
998
- else if (keyCode === PAGE_DOWN) {
999
- this.keyManager.setNextPageItemActive();
1000
- }
1001
- if (this.keyManager.activeItem && isVerticalMovement(event)) {
1002
- this.setSelectedOptionsByKey(this.keyManager.activeItem, hasModifierKey(event, 'shiftKey'), hasModifierKey(event, 'ctrlKey'));
1003
- }
1004
- }
1005
- updateScrollSize() {
1006
- if (!this.renderedOptions.first) {
1007
- return;
1008
- }
1009
- this.keyManager.withScrollSize(Math.floor(this.getHeight() / this.renderedOptions.first.getHeight()));
1010
- }
1011
- setSelectedOptionsByKey(option, shiftKey, ctrlKey) {
1012
- if (shiftKey && this.multiple) {
1013
- this.selectActiveOptions();
1014
- this.emitChangeEvent(option);
1015
- }
1016
- else if (ctrlKey) {
1017
- if (!this.canDeselectLast(option)) {
1018
- return;
1019
- }
1020
- }
1021
- else if (this.autoSelect) {
1022
- this.selectionModel.clear();
1023
- this.selectionModel.toggle(option.data);
1024
- this.emitChangeEvent(option);
1025
- }
1026
- }
1027
- setSelectedOptionsByClick(option, shiftKey, ctrlKey) {
1028
- if (!shiftKey && !ctrlKey) {
1029
- this.keyManager.setActiveItem(option);
1030
- }
1031
- if (shiftKey && this.multiple) {
1032
- this.selectActiveOptions();
1033
- }
1034
- else if (ctrlKey) {
1035
- if (!this.canDeselectLast(option)) {
1036
- return;
1037
- }
1038
- this.selectionModel.toggle(option.data);
1039
- this.keyManager.setActiveItem(option);
1040
- }
1041
- else if (this.autoSelect) {
1042
- this.selectionModel.clear();
1043
- this.selectionModel.toggle(option.data);
1044
- }
1045
- else {
1046
- this.selectionModel.toggle(option.data);
1047
- }
1048
- this.emitChangeEvent(option);
1049
- }
1050
- selectActiveOptions() {
1051
- const options = this.renderedOptions.toArray();
1052
- let fromIndex = this.keyManager.previousActiveItemIndex;
1053
- let toIndex = this.keyManager.previousActiveItemIndex = this.keyManager.activeItemIndex;
1054
- const selectedOptionState = options[fromIndex].selected;
1055
- if (toIndex === fromIndex) {
1056
- return;
1057
- }
1058
- if (fromIndex > toIndex) {
1059
- [fromIndex, toIndex] = [toIndex, fromIndex];
1060
- }
1061
- options
1062
- .slice(fromIndex, toIndex + 1)
1063
- .filter((item) => !item.disabled)
1064
- .forEach((renderedOption) => {
1065
- if (!selectedOptionState && this.noUnselectLast && this.selectionModel.selected.length === 1) {
1066
- return;
1067
- }
1068
- renderedOption.setSelected(selectedOptionState);
1069
- });
1070
- }
1071
- setFocusedOption(option) {
1072
- this.keyManager.setActiveItem(option);
1073
- }
1074
- toggleFocusedOption() {
1075
- const focusedOption = this.keyManager.activeItem;
1076
- if (focusedOption && (!focusedOption.selected || this.canDeselectLast(focusedOption))) {
1077
- focusedOption.toggle();
1078
- this.emitChangeEvent(focusedOption);
1079
- }
1080
- }
1081
- renderNodeChanges(data, dataDiffer = this.dataDiffer, viewContainer = this.nodeOutlet.viewContainer, parentData) {
1082
- super.renderNodeChanges(data, dataDiffer, viewContainer, parentData);
1083
- this.sortedNodes = this.getSortedNodes(viewContainer);
1084
- this.nodeOutlet.changeDetectorRef.detectChanges();
1085
- }
1086
- emitNavigationEvent(option) {
1087
- this.navigationChange.emit(new McTreeNavigationChange(this, option));
1088
- }
1089
- emitChangeEvent(option) {
1090
- this.selectionChange.emit(new McTreeNavigationChange(this, option));
1091
- }
1092
- selectAllOptions() {
1093
- const optionsToSelect = this.renderedOptions
1094
- .filter((option) => !option.disabled);
1095
- optionsToSelect
1096
- .forEach((option) => option.setSelected(true));
1097
- this.onSelectAll.emit(new McTreeSelectAllEvent(this, optionsToSelect));
1098
- }
1099
- copyActiveOption() {
1100
- if (this.onCopy.observers.length) {
1101
- this.onCopy.emit(new McTreeCopyEvent(this, this.keyManager.activeItem));
1102
- }
1103
- else {
1104
- this.onCopyDefaultHandler();
1105
- }
1106
- }
1107
- writeValue(value) {
1108
- if (this.multiple && value && !Array.isArray(value)) {
1109
- throw getMcSelectNonArrayValueError();
1110
- }
1111
- if (value) {
1112
- this.setOptionsFromValues(this.multiple ? value : [value]);
1113
- }
1114
- else {
1115
- this.selectionModel.clear();
1116
- }
1117
- }
1118
- registerOnChange(fn) {
1119
- this.onChange = fn;
1120
- }
1121
- registerOnTouched(fn) {
1122
- this.onTouched = fn;
1123
- }
1124
- /**
1125
- * Sets the disabled state of the control. Implemented as a part of ControlValueAccessor.
1126
- */
1127
- setDisabledState(isDisabled) {
1128
- this._disabled = isDisabled;
1129
- this.changeDetectorRef.markForCheck();
1130
- }
1131
- setOptionsFromValues(values) {
1132
- this.selectionModel.clear();
1133
- const valuesToSelect = values.reduce((result, value) => {
1134
- return this.treeControl.hasValue(value) ? [...result, this.treeControl.hasValue(value)] : [...result];
1135
- }, []);
1136
- this.selectionModel.select(...valuesToSelect);
1137
- }
1138
- getSelectedValues() {
1139
- const selectedValues = this.selectionModel.selected.map((selected) => this.treeControl.getValue(selected));
1140
- return this.multiple ? selectedValues : selectedValues[0];
1141
- }
1142
- getItemHeight() {
1143
- return this.renderedOptions.first ? this.renderedOptions.first.getHeight() : 0;
1144
- }
1145
- onCopyDefaultHandler() {
1146
- var _a;
1147
- (_a = this.clipboard) === null || _a === void 0 ? void 0 : _a.copy(this.keyManager.activeItem.value);
1148
- }
1149
- getHeight() {
1150
- const clientRects = this.elementRef.nativeElement.getClientRects();
1151
- if (clientRects.length) {
1152
- return clientRects[0].height;
1153
- }
1154
- return 0;
1155
- }
1156
- updateTabIndex() {
1157
- this._tabIndex = this.renderedOptions.length === 0 ? -1 : 0;
1158
- }
1159
- getSortedNodes(viewContainer) {
1160
- const array = [];
1161
- for (let i = 0; i < viewContainer.length; i++) {
1162
- const viewRef = viewContainer.get(i);
1163
- array.push(viewRef.context.$implicit);
1164
- }
1165
- return array;
1166
- }
1167
- allowFocusEscape() {
1168
- if (this._tabIndex !== -1) {
1169
- this._tabIndex = -1;
1170
- setTimeout(() => {
1171
- this._tabIndex = this.userTabIndex || 0;
1172
- this.changeDetectorRef.markForCheck();
1173
- });
1174
- }
1175
- }
1176
- resetOptions() {
1177
- this.dropSubscriptions();
1178
- this.listenToOptionsFocus();
1179
- }
1180
- dropSubscriptions() {
1181
- if (this.optionFocusSubscription) {
1182
- this.optionFocusSubscription.unsubscribe();
1183
- this.optionFocusSubscription = null;
1184
- }
1185
- if (this.optionBlurSubscription) {
1186
- this.optionBlurSubscription.unsubscribe();
1187
- this.optionBlurSubscription = null;
1188
- }
1189
- }
1190
- listenToOptionsFocus() {
1191
- this.optionFocusSubscription = this.optionFocusChanges
1192
- .subscribe((event) => {
1193
- const index = this.renderedOptions.toArray().indexOf(event.option);
1194
- this.renderedOptions
1195
- .filter((option) => option.hasFocus)
1196
- .forEach((option) => option.hasFocus = false);
1197
- if (this.isValidIndex(index)) {
1198
- this.keyManager.updateActiveItem(index);
1199
- }
1200
- });
1201
- this.optionBlurSubscription = this.optionBlurChanges
1202
- .subscribe(() => this.blur());
1203
- }
1204
- /**
1205
- * Utility to ensure all indexes are valid.
1206
- * @param index The index to be checked.
1207
- * @returns True if the index is valid for our list of options.
1208
- */
1209
- isValidIndex(index) {
1210
- return index >= 0 && index < this.renderedOptions.length;
1211
- }
1212
- /** Checks whether any of the options is focused. */
1213
- hasFocusedOption() {
1214
- return this.renderedOptions.some((option) => option.hasFocus);
1215
- }
1216
- markOptionsForCheck() {
1217
- this.renderedOptions.forEach((option) => option.markForCheck());
1218
- }
1219
- updateOptionsFocus() {
1220
- this.renderedOptions
1221
- .filter((option) => option.hasFocus)
1222
- .forEach((option) => option.hasFocus = false);
1223
- }
1224
- canDeselectLast(option) {
1225
- return !(this.noUnselectLast && this.selectionModel.selected.length === 1 && option.selected);
1226
- }
1227
- isFocusReceivedFromNestedOption($event) {
1228
- if (!$event || !$event.relatedTarget) {
1229
- return false;
1230
- }
1231
- return $event.relatedTarget.classList.contains('mc-tree-option');
1232
- }
1233
- }
1234
- /** @nocollapse */ /** @nocollapse */ McTreeSelection.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTreeSelection, deps: [{ token: i0.ElementRef }, { token: i1$1.AsyncScheduler }, { token: i0.IterableDiffers }, { token: i0.ChangeDetectorRef }, { token: 'multiple', attribute: true }, { token: i2$1.Clipboard, optional: true }], target: i0.ɵɵFactoryTarget.Component });
1235
- /** @nocollapse */ /** @nocollapse */ McTreeSelection.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", 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: [
1236
- MC_SELECTION_TREE_VALUE_ACCESSOR,
1237
- { provide: MC_TREE_OPTION_PARENT_COMPONENT, useExisting: McTreeSelection },
1238
- { provide: McTreeBase, useExisting: McTreeSelection }
1239
- ], 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 });
1240
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTreeSelection, decorators: [{
1241
- type: Component,
1242
- args: [{ selector: 'mc-tree-selection', exportAs: 'mcTreeSelection', template: '<ng-container mcTreeNodeOutlet></ng-container>', host: {
1243
- class: 'mc-tree-selection',
1244
- '[attr.tabindex]': 'tabIndex',
1245
- '[attr.disabled]': 'disabled || null',
1246
- '(blur)': 'blur()',
1247
- '(focus)': 'focus($event)',
1248
- '(keydown)': 'onKeyDown($event)',
1249
- '(window:resize)': 'updateScrollSize()'
1250
- }, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, providers: [
1251
- MC_SELECTION_TREE_VALUE_ACCESSOR,
1252
- { provide: MC_TREE_OPTION_PARENT_COMPONENT, useExisting: McTreeSelection },
1253
- { provide: McTreeBase, useExisting: McTreeSelection }
1254
- ], styles: [".mc-tree-selection{display:block}\n"] }]
1255
- }], ctorParameters: function () {
1256
- return [{ type: i0.ElementRef }, { type: i1$1.AsyncScheduler }, { type: i0.IterableDiffers }, { type: i0.ChangeDetectorRef }, { type: i1.MultipleMode, decorators: [{
1257
- type: Attribute,
1258
- args: ['multiple']
1259
- }] }, { type: i2$1.Clipboard, decorators: [{
1260
- type: Optional
1261
- }] }];
1262
- }, propDecorators: { nodeOutlet: [{
1263
- type: ViewChild,
1264
- args: [McTreeNodeOutlet, { static: true }]
1265
- }], unorderedOptions: [{
1266
- type: ContentChildren,
1267
- args: [McTreeOption]
1268
- }], treeControl: [{
1269
- type: Input
1270
- }], navigationChange: [{
1271
- type: Output
1272
- }], selectionChange: [{
1273
- type: Output
1274
- }], onSelectAll: [{
1275
- type: Output
1276
- }], onCopy: [{
1277
- type: Output
1278
- }], autoSelect: [{
1279
- type: Input
1280
- }], noUnselectLast: [{
1281
- type: Input
1282
- }], disabled: [{
1283
- type: Input
1284
- }], tabIndex: [{
1285
- type: Input
766
+ const MC_SELECTION_TREE_VALUE_ACCESSOR = {
767
+ provide: NG_VALUE_ACCESSOR,
768
+ useExisting: forwardRef(() => McTreeSelection),
769
+ multi: true
770
+ };
771
+ class McTreeSelectAllEvent {
772
+ constructor(source, options) {
773
+ this.source = source;
774
+ this.options = options;
775
+ }
776
+ }
777
+ class McTreeCopyEvent {
778
+ constructor(source, option) {
779
+ this.source = source;
780
+ this.option = option;
781
+ }
782
+ }
783
+ class McTreeNavigationChange {
784
+ constructor(source, option) {
785
+ this.source = source;
786
+ this.option = option;
787
+ }
788
+ }
789
+ class McTreeSelectionChange {
790
+ constructor(source, option) {
791
+ this.source = source;
792
+ this.option = option;
793
+ }
794
+ }
795
+ class McTreeSelection extends McTreeBase {
796
+ constructor(elementRef, scheduler, differs, changeDetectorRef, multiple, clipboard) {
797
+ super(differs, changeDetectorRef);
798
+ this.elementRef = elementRef;
799
+ this.scheduler = scheduler;
800
+ this.clipboard = clipboard;
801
+ this.renderedOptions = new QueryList();
802
+ this.resetFocusedItemOnBlur = true;
803
+ this.multipleMode = null;
804
+ this.userTabIndex = null;
805
+ this.navigationChange = new EventEmitter();
806
+ this.selectionChange = new EventEmitter();
807
+ this.onSelectAll = new EventEmitter();
808
+ this.onCopy = new EventEmitter();
809
+ this.sortedNodes = [];
810
+ this._autoSelect = true;
811
+ this._noUnselectLast = true;
812
+ this._disabled = false;
813
+ this._tabIndex = 0;
814
+ this.destroy = new Subject();
815
+ /** `View -> model callback called when value changes` */
816
+ this.onChange = () => { };
817
+ /** `View -> model callback called when select has been touched` */
818
+ this.onTouched = () => { };
819
+ this.updateRenderedOptions = () => {
820
+ const orderedOptions = [];
821
+ this.sortedNodes.forEach((node) => {
822
+ const found = this.unorderedOptions.find((option) => option.value === this.treeControl.getValue(node));
823
+ if (found) {
824
+ orderedOptions.push(found);
825
+ }
826
+ });
827
+ this.renderedOptions.reset(orderedOptions);
828
+ this.renderedOptions.notifyOnChanges();
829
+ this.updateScrollSize();
830
+ };
831
+ if (multiple === MultipleMode.CHECKBOX || multiple === MultipleMode.KEYBOARD) {
832
+ this.multipleMode = multiple;
833
+ }
834
+ else if (multiple !== null) {
835
+ this.multipleMode = MultipleMode.CHECKBOX;
836
+ }
837
+ if (this.multipleMode === MultipleMode.CHECKBOX) {
838
+ this.autoSelect = false;
839
+ this.noUnselectLast = false;
840
+ }
841
+ this.selectionModel = new SelectionModel(this.multiple);
842
+ }
843
+ get autoSelect() {
844
+ return this._autoSelect;
845
+ }
846
+ set autoSelect(value) {
847
+ this._autoSelect = coerceBooleanProperty(value);
848
+ }
849
+ get optionFocusChanges() {
850
+ return merge(...this.renderedOptions.map((option) => option.onFocus));
851
+ }
852
+ get optionBlurChanges() {
853
+ return merge(...this.renderedOptions.map((option) => option.onBlur));
854
+ }
855
+ get multiple() {
856
+ return !!this.multipleMode;
857
+ }
858
+ get noUnselectLast() {
859
+ return this._noUnselectLast;
860
+ }
861
+ set noUnselectLast(value) {
862
+ this._noUnselectLast = coerceBooleanProperty(value);
863
+ }
864
+ get disabled() {
865
+ return this._disabled;
866
+ }
867
+ set disabled(rawValue) {
868
+ const value = coerceBooleanProperty(rawValue);
869
+ if (this._disabled !== value) {
870
+ this._disabled = value;
871
+ this.markOptionsForCheck();
872
+ }
873
+ }
874
+ get tabIndex() {
875
+ return this.disabled ? -1 : this._tabIndex;
876
+ }
877
+ set tabIndex(value) {
878
+ this._tabIndex = value;
879
+ this.userTabIndex = value;
880
+ }
881
+ get showCheckbox() {
882
+ return this.multipleMode === MultipleMode.CHECKBOX;
883
+ }
884
+ get isEmpty() {
885
+ return this.sortedNodes.length === 0;
886
+ }
887
+ ngAfterContentInit() {
888
+ this.unorderedOptions.changes
889
+ .subscribe(this.updateRenderedOptions);
890
+ this.keyManager = new FocusKeyManager(this.renderedOptions)
891
+ .withVerticalOrientation(true)
892
+ .withHorizontalOrientation(null);
893
+ this.keyManager.change
894
+ .pipe(takeUntil(this.destroy))
895
+ .subscribe(() => {
896
+ if (this.keyManager.activeItem) {
897
+ this.emitNavigationEvent(this.keyManager.activeItem);
898
+ // todo need check this logic
899
+ if (this.autoSelect && !this.keyManager.activeItem.disabled) {
900
+ this.updateOptionsFocus();
901
+ }
902
+ }
903
+ });
904
+ this.keyManager.tabOut
905
+ .pipe(takeUntil(this.destroy))
906
+ .subscribe(() => this.allowFocusEscape());
907
+ this.selectionModel.changed
908
+ .pipe(takeUntil(this.destroy))
909
+ .subscribe(() => {
910
+ this.onChange(this.getSelectedValues());
911
+ this.renderedOptions.notifyOnChanges();
912
+ });
913
+ this.renderedOptions.changes
914
+ .pipe(takeUntil(this.destroy), delay(0, this.scheduler))
915
+ .subscribe((options) => {
916
+ this.resetOptions();
917
+ // Check to see if we need to update our tab index
918
+ this.updateTabIndex();
919
+ const selectedValues = this.multiple ? this.getSelectedValues() : [this.getSelectedValues()];
920
+ options.forEach((option) => {
921
+ if (selectedValues.includes(option.value)) {
922
+ option.select(false);
923
+ }
924
+ else {
925
+ option.deselect();
926
+ }
927
+ option.markForCheck();
928
+ });
929
+ });
930
+ }
931
+ ngOnDestroy() {
932
+ super.ngOnDestroy();
933
+ this.destroy.next();
934
+ this.destroy.complete();
935
+ }
936
+ focus($event) {
937
+ if (this.renderedOptions.length === 0 || this.isFocusReceivedFromNestedOption($event)) {
938
+ return;
939
+ }
940
+ this.keyManager.setFocusOrigin('keyboard');
941
+ this.keyManager.setFirstItemActive();
942
+ this.keyManager.setFocusOrigin('program');
943
+ }
944
+ blur() {
945
+ if (!this.hasFocusedOption() && this.resetFocusedItemOnBlur) {
946
+ this.keyManager.setActiveItem(-1);
947
+ }
948
+ this.onTouched();
949
+ this.changeDetectorRef.markForCheck();
950
+ }
951
+ onKeyDown(event) {
952
+ var _a, _b;
953
+ this.keyManager.setFocusOrigin('keyboard');
954
+ // tslint:disable-next-line: deprecation
955
+ const keyCode = event.keyCode;
956
+ if ([SPACE, LEFT_ARROW, RIGHT_ARROW].includes(keyCode) || isVerticalMovement(event)) {
957
+ event.preventDefault();
958
+ }
959
+ if (this.multiple && isSelectAll(event)) {
960
+ this.selectAllOptions();
961
+ event.preventDefault();
962
+ return;
963
+ }
964
+ else if (isCopy(event)) {
965
+ this.copyActiveOption();
966
+ return;
967
+ }
968
+ else if (keyCode === TAB) {
969
+ this.keyManager.tabOut.next();
970
+ return;
971
+ }
972
+ else if (keyCode === LEFT_ARROW && ((_a = this.keyManager.activeItem) === null || _a === void 0 ? void 0 : _a.isExpandable)) {
973
+ this.treeControl.collapse(this.keyManager.activeItem.data);
974
+ return;
975
+ }
976
+ else if (keyCode === RIGHT_ARROW && ((_b = this.keyManager.activeItem) === null || _b === void 0 ? void 0 : _b.isExpandable)) {
977
+ this.treeControl.expand(this.keyManager.activeItem.data);
978
+ return;
979
+ }
980
+ else if (keyCode === DOWN_ARROW) {
981
+ this.keyManager.setNextItemActive();
982
+ }
983
+ else if (keyCode === UP_ARROW) {
984
+ this.keyManager.setPreviousItemActive();
985
+ }
986
+ else if ([SPACE, ENTER].includes(keyCode)) {
987
+ this.toggleFocusedOption();
988
+ return;
989
+ }
990
+ else if (keyCode === HOME) {
991
+ this.keyManager.setFirstItemActive();
992
+ }
993
+ else if (keyCode === END) {
994
+ this.keyManager.setLastItemActive();
995
+ }
996
+ else if (keyCode === PAGE_UP) {
997
+ this.keyManager.setPreviousPageItemActive();
998
+ }
999
+ else if (keyCode === PAGE_DOWN) {
1000
+ this.keyManager.setNextPageItemActive();
1001
+ }
1002
+ if (this.keyManager.activeItem && isVerticalMovement(event)) {
1003
+ this.setSelectedOptionsByKey(this.keyManager.activeItem, hasModifierKey(event, 'shiftKey'), hasModifierKey(event, 'ctrlKey'));
1004
+ }
1005
+ }
1006
+ updateScrollSize() {
1007
+ if (!this.renderedOptions.first) {
1008
+ return;
1009
+ }
1010
+ this.keyManager.withScrollSize(Math.floor(this.getHeight() / this.renderedOptions.first.getHeight()));
1011
+ }
1012
+ setSelectedOptionsByKey(option, shiftKey, ctrlKey) {
1013
+ if (shiftKey && this.multiple) {
1014
+ this.selectActiveOptions();
1015
+ this.emitChangeEvent(option);
1016
+ }
1017
+ else if (ctrlKey) {
1018
+ if (!this.canDeselectLast(option)) {
1019
+ return;
1020
+ }
1021
+ }
1022
+ else if (this.autoSelect) {
1023
+ this.selectionModel.clear();
1024
+ this.selectionModel.toggle(option.data);
1025
+ this.emitChangeEvent(option);
1026
+ }
1027
+ }
1028
+ setSelectedOptionsByClick(option, shiftKey, ctrlKey) {
1029
+ if (!shiftKey && !ctrlKey) {
1030
+ this.keyManager.setActiveItem(option);
1031
+ }
1032
+ if (shiftKey && this.multiple) {
1033
+ this.selectActiveOptions();
1034
+ }
1035
+ else if (ctrlKey) {
1036
+ if (!this.canDeselectLast(option)) {
1037
+ return;
1038
+ }
1039
+ this.selectionModel.toggle(option.data);
1040
+ this.keyManager.setActiveItem(option);
1041
+ }
1042
+ else if (this.autoSelect) {
1043
+ this.selectionModel.clear();
1044
+ this.selectionModel.toggle(option.data);
1045
+ }
1046
+ else {
1047
+ this.selectionModel.toggle(option.data);
1048
+ }
1049
+ this.emitChangeEvent(option);
1050
+ }
1051
+ selectActiveOptions() {
1052
+ const options = this.renderedOptions.toArray();
1053
+ let fromIndex = this.keyManager.previousActiveItemIndex;
1054
+ let toIndex = this.keyManager.previousActiveItemIndex = this.keyManager.activeItemIndex;
1055
+ const selectedOptionState = options[fromIndex].selected;
1056
+ if (toIndex === fromIndex) {
1057
+ return;
1058
+ }
1059
+ if (fromIndex > toIndex) {
1060
+ [fromIndex, toIndex] = [toIndex, fromIndex];
1061
+ }
1062
+ options
1063
+ .slice(fromIndex, toIndex + 1)
1064
+ .filter((item) => !item.disabled)
1065
+ .forEach((renderedOption) => {
1066
+ if (!selectedOptionState && this.noUnselectLast && this.selectionModel.selected.length === 1) {
1067
+ return;
1068
+ }
1069
+ renderedOption.setSelected(selectedOptionState);
1070
+ });
1071
+ }
1072
+ setFocusedOption(option) {
1073
+ this.keyManager.setActiveItem(option);
1074
+ }
1075
+ toggleFocusedOption() {
1076
+ const focusedOption = this.keyManager.activeItem;
1077
+ if (focusedOption && (!focusedOption.selected || this.canDeselectLast(focusedOption))) {
1078
+ focusedOption.toggle();
1079
+ this.emitChangeEvent(focusedOption);
1080
+ }
1081
+ }
1082
+ renderNodeChanges(data, dataDiffer = this.dataDiffer, viewContainer = this.nodeOutlet.viewContainer, parentData) {
1083
+ super.renderNodeChanges(data, dataDiffer, viewContainer, parentData);
1084
+ this.sortedNodes = this.getSortedNodes(viewContainer);
1085
+ this.nodeOutlet.changeDetectorRef.detectChanges();
1086
+ }
1087
+ emitNavigationEvent(option) {
1088
+ this.navigationChange.emit(new McTreeNavigationChange(this, option));
1089
+ }
1090
+ emitChangeEvent(option) {
1091
+ this.selectionChange.emit(new McTreeNavigationChange(this, option));
1092
+ }
1093
+ selectAllOptions() {
1094
+ const optionsToSelect = this.renderedOptions
1095
+ .filter((option) => !option.disabled);
1096
+ optionsToSelect
1097
+ .forEach((option) => option.setSelected(true));
1098
+ this.onSelectAll.emit(new McTreeSelectAllEvent(this, optionsToSelect));
1099
+ }
1100
+ copyActiveOption() {
1101
+ if (this.onCopy.observers.length) {
1102
+ this.onCopy.emit(new McTreeCopyEvent(this, this.keyManager.activeItem));
1103
+ }
1104
+ else {
1105
+ this.onCopyDefaultHandler();
1106
+ }
1107
+ }
1108
+ writeValue(value) {
1109
+ if (this.multiple && value && !Array.isArray(value)) {
1110
+ throw getMcSelectNonArrayValueError();
1111
+ }
1112
+ if (value) {
1113
+ this.setOptionsFromValues(this.multiple ? value : [value]);
1114
+ }
1115
+ else {
1116
+ this.selectionModel.clear();
1117
+ }
1118
+ }
1119
+ registerOnChange(fn) {
1120
+ this.onChange = fn;
1121
+ }
1122
+ registerOnTouched(fn) {
1123
+ this.onTouched = fn;
1124
+ }
1125
+ /**
1126
+ * Sets the disabled state of the control. Implemented as a part of ControlValueAccessor.
1127
+ */
1128
+ setDisabledState(isDisabled) {
1129
+ this._disabled = isDisabled;
1130
+ this.changeDetectorRef.markForCheck();
1131
+ }
1132
+ setOptionsFromValues(values) {
1133
+ this.selectionModel.clear();
1134
+ const valuesToSelect = values.reduce((result, value) => {
1135
+ return this.treeControl.hasValue(value) ? [...result, this.treeControl.hasValue(value)] : [...result];
1136
+ }, []);
1137
+ this.selectionModel.select(...valuesToSelect);
1138
+ }
1139
+ getSelectedValues() {
1140
+ const selectedValues = this.selectionModel.selected.map((selected) => this.treeControl.getValue(selected));
1141
+ return this.multiple ? selectedValues : selectedValues[0];
1142
+ }
1143
+ getItemHeight() {
1144
+ return this.renderedOptions.first ? this.renderedOptions.first.getHeight() : 0;
1145
+ }
1146
+ onCopyDefaultHandler() {
1147
+ var _a;
1148
+ (_a = this.clipboard) === null || _a === void 0 ? void 0 : _a.copy(this.keyManager.activeItem.value);
1149
+ }
1150
+ getHeight() {
1151
+ const clientRects = this.elementRef.nativeElement.getClientRects();
1152
+ if (clientRects.length) {
1153
+ return clientRects[0].height;
1154
+ }
1155
+ return 0;
1156
+ }
1157
+ updateTabIndex() {
1158
+ this._tabIndex = this.renderedOptions.length === 0 ? -1 : 0;
1159
+ }
1160
+ getSortedNodes(viewContainer) {
1161
+ const array = [];
1162
+ for (let i = 0; i < viewContainer.length; i++) {
1163
+ const viewRef = viewContainer.get(i);
1164
+ array.push(viewRef.context.$implicit);
1165
+ }
1166
+ return array;
1167
+ }
1168
+ allowFocusEscape() {
1169
+ if (this._tabIndex !== -1) {
1170
+ this._tabIndex = -1;
1171
+ setTimeout(() => {
1172
+ this._tabIndex = this.userTabIndex || 0;
1173
+ this.changeDetectorRef.markForCheck();
1174
+ });
1175
+ }
1176
+ }
1177
+ resetOptions() {
1178
+ this.dropSubscriptions();
1179
+ this.listenToOptionsFocus();
1180
+ }
1181
+ dropSubscriptions() {
1182
+ if (this.optionFocusSubscription) {
1183
+ this.optionFocusSubscription.unsubscribe();
1184
+ this.optionFocusSubscription = null;
1185
+ }
1186
+ if (this.optionBlurSubscription) {
1187
+ this.optionBlurSubscription.unsubscribe();
1188
+ this.optionBlurSubscription = null;
1189
+ }
1190
+ }
1191
+ listenToOptionsFocus() {
1192
+ this.optionFocusSubscription = this.optionFocusChanges
1193
+ .subscribe((event) => {
1194
+ const index = this.renderedOptions.toArray().indexOf(event.option);
1195
+ this.renderedOptions
1196
+ .filter((option) => option.hasFocus)
1197
+ .forEach((option) => option.hasFocus = false);
1198
+ if (this.isValidIndex(index)) {
1199
+ this.keyManager.updateActiveItem(index);
1200
+ }
1201
+ });
1202
+ this.optionBlurSubscription = this.optionBlurChanges
1203
+ .subscribe(() => this.blur());
1204
+ }
1205
+ /**
1206
+ * Utility to ensure all indexes are valid.
1207
+ * @param index The index to be checked.
1208
+ * @returns True if the index is valid for our list of options.
1209
+ */
1210
+ isValidIndex(index) {
1211
+ return index >= 0 && index < this.renderedOptions.length;
1212
+ }
1213
+ /** Checks whether any of the options is focused. */
1214
+ hasFocusedOption() {
1215
+ return this.renderedOptions.some((option) => option.hasFocus);
1216
+ }
1217
+ markOptionsForCheck() {
1218
+ this.renderedOptions.forEach((option) => option.markForCheck());
1219
+ }
1220
+ updateOptionsFocus() {
1221
+ this.renderedOptions
1222
+ .filter((option) => option.hasFocus)
1223
+ .forEach((option) => option.hasFocus = false);
1224
+ }
1225
+ canDeselectLast(option) {
1226
+ return !(this.noUnselectLast && this.selectionModel.selected.length === 1 && option.selected);
1227
+ }
1228
+ isFocusReceivedFromNestedOption($event) {
1229
+ if (!$event || !$event.relatedTarget) {
1230
+ return false;
1231
+ }
1232
+ return $event.relatedTarget.classList.contains('mc-tree-option');
1233
+ }
1234
+ }
1235
+ /** @nocollapse */ /** @nocollapse */ McTreeSelection.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTreeSelection, deps: [{ token: i0.ElementRef }, { token: i1$1.AsyncScheduler }, { token: i0.IterableDiffers }, { token: i0.ChangeDetectorRef }, { token: 'multiple', attribute: true }, { token: i2$1.Clipboard, optional: true }], target: i0.ɵɵFactoryTarget.Component });
1236
+ /** @nocollapse */ /** @nocollapse */ McTreeSelection.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", 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: [
1237
+ MC_SELECTION_TREE_VALUE_ACCESSOR,
1238
+ { provide: MC_TREE_OPTION_PARENT_COMPONENT, useExisting: McTreeSelection },
1239
+ { provide: McTreeBase, useExisting: McTreeSelection }
1240
+ ], 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 });
1241
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTreeSelection, decorators: [{
1242
+ type: Component,
1243
+ args: [{ selector: 'mc-tree-selection', exportAs: 'mcTreeSelection', template: '<ng-container mcTreeNodeOutlet></ng-container>', host: {
1244
+ class: 'mc-tree-selection',
1245
+ '[attr.tabindex]': 'tabIndex',
1246
+ '[attr.disabled]': 'disabled || null',
1247
+ '(blur)': 'blur()',
1248
+ '(focus)': 'focus($event)',
1249
+ '(keydown)': 'onKeyDown($event)',
1250
+ '(window:resize)': 'updateScrollSize()'
1251
+ }, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, providers: [
1252
+ MC_SELECTION_TREE_VALUE_ACCESSOR,
1253
+ { provide: MC_TREE_OPTION_PARENT_COMPONENT, useExisting: McTreeSelection },
1254
+ { provide: McTreeBase, useExisting: McTreeSelection }
1255
+ ], styles: [".mc-tree-selection{display:block}\n"] }]
1256
+ }], ctorParameters: function () {
1257
+ return [{ type: i0.ElementRef }, { type: i1$1.AsyncScheduler }, { type: i0.IterableDiffers }, { type: i0.ChangeDetectorRef }, { type: i1.MultipleMode, decorators: [{
1258
+ type: Attribute,
1259
+ args: ['multiple']
1260
+ }] }, { type: i2$1.Clipboard, decorators: [{
1261
+ type: Optional
1262
+ }] }];
1263
+ }, propDecorators: { nodeOutlet: [{
1264
+ type: ViewChild,
1265
+ args: [McTreeNodeOutlet, { static: true }]
1266
+ }], unorderedOptions: [{
1267
+ type: ContentChildren,
1268
+ args: [McTreeOption]
1269
+ }], treeControl: [{
1270
+ type: Input
1271
+ }], navigationChange: [{
1272
+ type: Output
1273
+ }], selectionChange: [{
1274
+ type: Output
1275
+ }], onSelectAll: [{
1276
+ type: Output
1277
+ }], onCopy: [{
1278
+ type: Output
1279
+ }], autoSelect: [{
1280
+ type: Input
1281
+ }], noUnselectLast: [{
1282
+ type: Input
1283
+ }], disabled: [{
1284
+ type: Input
1285
+ }], tabIndex: [{
1286
+ type: Input
1286
1287
  }] } });
1287
1288
 
1288
- const MC_TREE_DIRECTIVES = [
1289
- McTreeNodeOutlet,
1290
- McTreeNodeDef,
1291
- McTreeNode,
1292
- McTreeNodePadding,
1293
- McTree,
1294
- McTreeSelection,
1295
- McTreeOption,
1296
- McTreeNodeToggleComponent,
1297
- McTreeNodeToggleDirective
1298
- ];
1299
- class McTreeModule {
1300
- }
1301
- /** @nocollapse */ /** @nocollapse */ McTreeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTreeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1302
- /** @nocollapse */ /** @nocollapse */ McTreeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTreeModule, declarations: [McTreeNodeOutlet,
1303
- McTreeNodeDef,
1304
- McTreeNode,
1305
- McTreeNodePadding,
1306
- McTree,
1307
- McTreeSelection,
1308
- McTreeOption,
1309
- McTreeNodeToggleComponent,
1310
- McTreeNodeToggleDirective], imports: [CommonModule, McPseudoCheckboxModule], exports: [McTreeNodeOutlet,
1311
- McTreeNodeDef,
1312
- McTreeNode,
1313
- McTreeNodePadding,
1314
- McTree,
1315
- McTreeSelection,
1316
- McTreeOption,
1317
- McTreeNodeToggleComponent,
1318
- McTreeNodeToggleDirective] });
1319
- /** @nocollapse */ /** @nocollapse */ McTreeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTreeModule, providers: [{ provide: AsyncScheduler, useValue: asyncScheduler }], imports: [[CommonModule, McPseudoCheckboxModule]] });
1320
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTreeModule, decorators: [{
1321
- type: NgModule,
1322
- args: [{
1323
- imports: [CommonModule, McPseudoCheckboxModule],
1324
- exports: MC_TREE_DIRECTIVES,
1325
- declarations: MC_TREE_DIRECTIVES,
1326
- providers: [{ provide: AsyncScheduler, useValue: asyncScheduler }]
1327
- }]
1289
+ const MC_TREE_DIRECTIVES = [
1290
+ McTreeNodeOutlet,
1291
+ McTreeNodeDef,
1292
+ McTreeNode,
1293
+ McTreeNodePadding,
1294
+ McTree,
1295
+ McTreeSelection,
1296
+ McTreeOption,
1297
+ McTreeNodeToggleComponent,
1298
+ McTreeNodeToggleDirective
1299
+ ];
1300
+ class McTreeModule {
1301
+ }
1302
+ /** @nocollapse */ /** @nocollapse */ McTreeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTreeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1303
+ /** @nocollapse */ /** @nocollapse */ McTreeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTreeModule, declarations: [McTreeNodeOutlet,
1304
+ McTreeNodeDef,
1305
+ McTreeNode,
1306
+ McTreeNodePadding,
1307
+ McTree,
1308
+ McTreeSelection,
1309
+ McTreeOption,
1310
+ McTreeNodeToggleComponent,
1311
+ McTreeNodeToggleDirective], imports: [CommonModule, McPseudoCheckboxModule], exports: [McTreeNodeOutlet,
1312
+ McTreeNodeDef,
1313
+ McTreeNode,
1314
+ McTreeNodePadding,
1315
+ McTree,
1316
+ McTreeSelection,
1317
+ McTreeOption,
1318
+ McTreeNodeToggleComponent,
1319
+ McTreeNodeToggleDirective] });
1320
+ /** @nocollapse */ /** @nocollapse */ McTreeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTreeModule, providers: [{ provide: AsyncScheduler, useValue: asyncScheduler }], imports: [[CommonModule, McPseudoCheckboxModule]] });
1321
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McTreeModule, decorators: [{
1322
+ type: NgModule,
1323
+ args: [{
1324
+ imports: [CommonModule, McPseudoCheckboxModule],
1325
+ exports: MC_TREE_DIRECTIVES,
1326
+ declarations: MC_TREE_DIRECTIVES,
1327
+ providers: [{ provide: AsyncScheduler, useValue: asyncScheduler }]
1328
+ }]
1328
1329
  }] });
1329
1330
 
1330
- /** Base tree control. It has basic toggle/expand/collapse operations on a single data node. */
1331
- /* tslint:disable-next-line:naming-convention */
1332
- class BaseTreeControl {
1333
- constructor() {
1334
- /** A selection model with multi-selection to track expansion status. */
1335
- this.expansionModel = new SelectionModel(true);
1336
- this.filterModel = new SelectionModel(true);
1337
- this.filterValue = new BehaviorSubject('');
1338
- }
1339
- /** Toggles one single data node's expanded/collapsed state. */
1340
- toggle(dataNode) {
1341
- if (this.filterValue.value) {
1342
- return;
1343
- }
1344
- this.expansionModel.toggle(dataNode);
1345
- }
1346
- /** Expands one single data node. */
1347
- expand(dataNode) {
1348
- if (this.filterValue.value) {
1349
- return;
1350
- }
1351
- this.expansionModel.select(dataNode);
1352
- }
1353
- /** Collapses one single data node. */
1354
- collapse(dataNode) {
1355
- if (this.filterValue.value) {
1356
- return;
1357
- }
1358
- this.expansionModel.deselect(dataNode);
1359
- }
1360
- /** Whether a given data node is expanded or not. Returns true if the data node is expanded. */
1361
- isExpanded(dataNode) {
1362
- return this.expansionModel.isSelected(dataNode);
1363
- }
1364
- /** Toggles a subtree rooted at `node` recursively. */
1365
- toggleDescendants(dataNode) {
1366
- this.expansionModel.isSelected(dataNode)
1367
- ? this.collapseDescendants(dataNode)
1368
- : this.expandDescendants(dataNode);
1369
- }
1370
- /** Collapse all dataNodes in the tree. */
1371
- collapseAll() {
1372
- this.expansionModel.clear();
1373
- }
1374
- /** Expands a subtree rooted at given data node recursively. */
1375
- expandDescendants(dataNode) {
1376
- const toBeProcessed = [dataNode];
1377
- toBeProcessed.push(...this.getDescendants(dataNode));
1378
- this.expansionModel.select(...toBeProcessed);
1379
- }
1380
- /** Collapses a subtree rooted at given data node recursively. */
1381
- collapseDescendants(dataNode) {
1382
- const toBeProcessed = [dataNode];
1383
- toBeProcessed.push(...this.getDescendants(dataNode));
1384
- this.expansionModel.deselect(...toBeProcessed);
1385
- }
1331
+ /** Base tree control. It has basic toggle/expand/collapse operations on a single data node. */
1332
+ /* tslint:disable-next-line:naming-convention */
1333
+ class BaseTreeControl {
1334
+ constructor() {
1335
+ /** A selection model with multi-selection to track expansion status. */
1336
+ this.expansionModel = new SelectionModel(true);
1337
+ this.filterModel = new SelectionModel(true);
1338
+ this.filterValue = new BehaviorSubject('');
1339
+ }
1340
+ /** Toggles one single data node's expanded/collapsed state. */
1341
+ toggle(dataNode) {
1342
+ if (this.filterValue.value) {
1343
+ return;
1344
+ }
1345
+ this.expansionModel.toggle(dataNode);
1346
+ }
1347
+ /** Expands one single data node. */
1348
+ expand(dataNode) {
1349
+ if (this.filterValue.value) {
1350
+ return;
1351
+ }
1352
+ this.expansionModel.select(dataNode);
1353
+ }
1354
+ /** Collapses one single data node. */
1355
+ collapse(dataNode) {
1356
+ if (this.filterValue.value) {
1357
+ return;
1358
+ }
1359
+ this.expansionModel.deselect(dataNode);
1360
+ }
1361
+ /** Whether a given data node is expanded or not. Returns true if the data node is expanded. */
1362
+ isExpanded(dataNode) {
1363
+ return this.expansionModel.isSelected(dataNode);
1364
+ }
1365
+ /** Toggles a subtree rooted at `node` recursively. */
1366
+ toggleDescendants(dataNode) {
1367
+ this.expansionModel.isSelected(dataNode)
1368
+ ? this.collapseDescendants(dataNode)
1369
+ : this.expandDescendants(dataNode);
1370
+ }
1371
+ /** Collapse all dataNodes in the tree. */
1372
+ collapseAll() {
1373
+ this.expansionModel.clear();
1374
+ }
1375
+ /** Expands a subtree rooted at given data node recursively. */
1376
+ expandDescendants(dataNode) {
1377
+ const toBeProcessed = [dataNode];
1378
+ toBeProcessed.push(...this.getDescendants(dataNode));
1379
+ this.expansionModel.select(...toBeProcessed);
1380
+ }
1381
+ /** Collapses a subtree rooted at given data node recursively. */
1382
+ collapseDescendants(dataNode) {
1383
+ const toBeProcessed = [dataNode];
1384
+ toBeProcessed.push(...this.getDescendants(dataNode));
1385
+ this.expansionModel.deselect(...toBeProcessed);
1386
+ }
1386
1387
  }
1387
1388
 
1388
- function defaultCompareValues(firstValue, secondValue) {
1389
- return firstValue === secondValue;
1390
- }
1391
- function defaultCompareViewValues(firstViewValue, secondViewValue) {
1392
- return RegExp(secondViewValue, 'gi').test(firstViewValue);
1393
- }
1394
- /** Flat tree control. Able to expand/collapse a subtree recursively for flattened tree. */
1395
- class FlatTreeControl extends BaseTreeControl {
1396
- /** Construct with flat tree data node functions getLevel, isExpandable, getValue and getViewValue. */
1397
- constructor(getLevel, isExpandable,
1398
- /** getValue will be used to determine if the tree contains value or not. Used in method hasValue */
1399
- getValue,
1400
- /** getViewValue will be used for filter nodes. Returned value will be first argument in filterNodesFunction */
1401
- getViewValue,
1402
- /** compareValues will be used to comparing values. */
1403
- compareValues = defaultCompareValues,
1404
- /** compareValues will be used to comparing values. */
1405
- compareViewValues = defaultCompareViewValues,
1406
- /** isDisabled will be used to determine if the node is disabled. */
1407
- isDisabled = () => false) {
1408
- super();
1409
- this.getLevel = getLevel;
1410
- this.isExpandable = isExpandable;
1411
- this.getValue = getValue;
1412
- this.getViewValue = getViewValue;
1413
- this.compareValues = compareValues;
1414
- this.compareViewValues = compareViewValues;
1415
- this.isDisabled = isDisabled;
1416
- }
1417
- /**
1418
- * Gets a list of the data node's subtree of descendent data nodes.
1419
- *
1420
- * To make this working, the `dataNodes` of the TreeControl must be flattened tree nodes
1421
- * with correct levels.
1422
- */
1423
- getDescendants(dataNode) {
1424
- const startIndex = this.dataNodes.indexOf(dataNode);
1425
- const results = [];
1426
- // Goes through flattened tree nodes in the `dataNodes` array, and get all descendants.
1427
- // The level of descendants of a tree node must be greater than the level of the given
1428
- // tree node.
1429
- // If we reach a node whose level is equal to the level of the tree node, we hit a sibling.
1430
- // If we reach a node whose level is greater than the level of the tree node, we hit a
1431
- // sibling of an ancestor.
1432
- for (let i = startIndex + 1; i < this.dataNodes.length && this.getLevel(dataNode) < this.getLevel(this.dataNodes[i]); i++) {
1433
- results.push(this.dataNodes[i]);
1434
- }
1435
- return results;
1436
- }
1437
- /**
1438
- * Expands all data nodes in the tree.
1439
- *
1440
- * To make this working, the `dataNodes` variable of the TreeControl must be set to all flattened
1441
- * data nodes of the tree.
1442
- */
1443
- expandAll() {
1444
- this.expansionModel.select(...this.dataNodes);
1445
- }
1446
- getParents(node, result) {
1447
- if (node.parent) {
1448
- result.unshift(node.parent);
1449
- return this.getParents(node.parent, result);
1450
- }
1451
- else {
1452
- return result;
1453
- }
1454
- }
1455
- hasValue(value) {
1456
- return this.dataNodes.find((node) => this.compareValues(this.getValue(node), value));
1457
- }
1458
- filterNodes(value) {
1459
- this.saveExpansionState();
1460
- this.filterModel.clear();
1461
- this.expansionModel.clear();
1462
- const filteredNodes = this.dataNodes
1463
- .filter((node) => this.compareViewValues(this.getViewValue(node), value));
1464
- const filteredNodesWithTheirParents = new Set();
1465
- filteredNodes.forEach((filteredNode) => {
1466
- this.getParents(filteredNode, [])
1467
- .forEach((node) => {
1468
- filteredNodesWithTheirParents.add(node);
1469
- this.expandDataNode(node);
1470
- });
1471
- filteredNodesWithTheirParents.add(filteredNode);
1472
- this.expandDataNode(filteredNode);
1473
- if (this.isExpandable(filteredNode)) {
1474
- const childNodeLevel = this.getLevel(filteredNode) + 1;
1475
- this.getDescendants(filteredNode)
1476
- .filter((childNode) => this.getLevel(childNode) === childNodeLevel)
1477
- .filter((childNode) => !this.isExpandable(childNode) || !this.hasFilteredDescendant(childNode, filteredNodes))
1478
- .forEach((childNode) => {
1479
- filteredNodesWithTheirParents.add(childNode);
1480
- this.expandDataNode(childNode);
1481
- });
1482
- }
1483
- });
1484
- this.filterModel.select(...Array.from(filteredNodesWithTheirParents));
1485
- this.filterValue.next(value);
1486
- this.restoreExpansionState();
1487
- }
1488
- expandDataNode(dataNode) {
1489
- if (this.isExpandable(dataNode)) {
1490
- this.expansionModel.select(dataNode);
1491
- }
1492
- }
1493
- saveExpansionState() {
1494
- if (this.filterValue.value === '') {
1495
- this.expandedItemsBeforeFiltration = this.expansionModel.selected;
1496
- }
1497
- }
1498
- restoreExpansionState() {
1499
- if (this.filterValue.value === '') {
1500
- this.expansionModel.clear();
1501
- this.expansionModel.select(...this.expandedItemsBeforeFiltration);
1502
- }
1503
- }
1504
- hasFilteredDescendant(dataNode, filteredNodes) {
1505
- const filteredViewValues = filteredNodes
1506
- .map((node) => this.getViewValue(node));
1507
- return this.getDescendants(dataNode)
1508
- .filter((node) => filteredViewValues.includes(this.getViewValue(node)))
1509
- .length > 0;
1510
- }
1389
+ function defaultCompareValues(firstValue, secondValue) {
1390
+ return firstValue === secondValue;
1391
+ }
1392
+ function defaultCompareViewValues(firstViewValue, secondViewValue) {
1393
+ return RegExp(secondViewValue, 'gi').test(firstViewValue);
1394
+ }
1395
+ /** Flat tree control. Able to expand/collapse a subtree recursively for flattened tree. */
1396
+ class FlatTreeControl extends BaseTreeControl {
1397
+ /** Construct with flat tree data node functions getLevel, isExpandable, getValue and getViewValue. */
1398
+ constructor(getLevel, isExpandable,
1399
+ /** getValue will be used to determine if the tree contains value or not. Used in method hasValue */
1400
+ getValue,
1401
+ /** getViewValue will be used for filter nodes. Returned value will be first argument in filterNodesFunction */
1402
+ getViewValue,
1403
+ /** compareValues will be used to comparing values. */
1404
+ compareValues = defaultCompareValues,
1405
+ /** compareValues will be used to comparing values. */
1406
+ compareViewValues = defaultCompareViewValues,
1407
+ /** isDisabled will be used to determine if the node is disabled. */
1408
+ isDisabled = () => false) {
1409
+ super();
1410
+ this.getLevel = getLevel;
1411
+ this.isExpandable = isExpandable;
1412
+ this.getValue = getValue;
1413
+ this.getViewValue = getViewValue;
1414
+ this.compareValues = compareValues;
1415
+ this.compareViewValues = compareViewValues;
1416
+ this.isDisabled = isDisabled;
1417
+ }
1418
+ /**
1419
+ * Gets a list of the data node's subtree of descendent data nodes.
1420
+ *
1421
+ * To make this working, the `dataNodes` of the TreeControl must be flattened tree nodes
1422
+ * with correct levels.
1423
+ */
1424
+ getDescendants(dataNode) {
1425
+ const startIndex = this.dataNodes.indexOf(dataNode);
1426
+ const results = [];
1427
+ // Goes through flattened tree nodes in the `dataNodes` array, and get all descendants.
1428
+ // The level of descendants of a tree node must be greater than the level of the given
1429
+ // tree node.
1430
+ // If we reach a node whose level is equal to the level of the tree node, we hit a sibling.
1431
+ // If we reach a node whose level is greater than the level of the tree node, we hit a
1432
+ // sibling of an ancestor.
1433
+ for (let i = startIndex + 1; i < this.dataNodes.length && this.getLevel(dataNode) < this.getLevel(this.dataNodes[i]); i++) {
1434
+ results.push(this.dataNodes[i]);
1435
+ }
1436
+ return results;
1437
+ }
1438
+ /**
1439
+ * Expands all data nodes in the tree.
1440
+ *
1441
+ * To make this working, the `dataNodes` variable of the TreeControl must be set to all flattened
1442
+ * data nodes of the tree.
1443
+ */
1444
+ expandAll() {
1445
+ this.expansionModel.select(...this.dataNodes);
1446
+ }
1447
+ getParents(node, result) {
1448
+ if (node.parent) {
1449
+ result.unshift(node.parent);
1450
+ return this.getParents(node.parent, result);
1451
+ }
1452
+ else {
1453
+ return result;
1454
+ }
1455
+ }
1456
+ hasValue(value) {
1457
+ return this.dataNodes.find((node) => this.compareValues(this.getValue(node), value));
1458
+ }
1459
+ filterNodes(value) {
1460
+ this.saveExpansionState();
1461
+ this.filterModel.clear();
1462
+ this.expansionModel.clear();
1463
+ const filteredNodes = this.dataNodes
1464
+ .filter((node) => this.compareViewValues(this.getViewValue(node), value));
1465
+ const filteredNodesWithTheirParents = new Set();
1466
+ filteredNodes.forEach((filteredNode) => {
1467
+ this.getParents(filteredNode, [])
1468
+ .forEach((node) => {
1469
+ filteredNodesWithTheirParents.add(node);
1470
+ this.expandDataNode(node);
1471
+ });
1472
+ filteredNodesWithTheirParents.add(filteredNode);
1473
+ this.expandDataNode(filteredNode);
1474
+ if (this.isExpandable(filteredNode)) {
1475
+ const childNodeLevel = this.getLevel(filteredNode) + 1;
1476
+ this.getDescendants(filteredNode)
1477
+ .filter((childNode) => this.getLevel(childNode) === childNodeLevel)
1478
+ .filter((childNode) => !this.isExpandable(childNode) || !this.hasFilteredDescendant(childNode, filteredNodes))
1479
+ .forEach((childNode) => {
1480
+ filteredNodesWithTheirParents.add(childNode);
1481
+ this.expandDataNode(childNode);
1482
+ });
1483
+ }
1484
+ });
1485
+ this.filterModel.select(...Array.from(filteredNodesWithTheirParents));
1486
+ this.filterValue.next(value);
1487
+ this.restoreExpansionState();
1488
+ }
1489
+ expandDataNode(dataNode) {
1490
+ if (this.isExpandable(dataNode)) {
1491
+ this.expansionModel.select(dataNode);
1492
+ }
1493
+ }
1494
+ saveExpansionState() {
1495
+ if (this.filterValue.value === '') {
1496
+ this.expandedItemsBeforeFiltration = this.expansionModel.selected;
1497
+ }
1498
+ }
1499
+ restoreExpansionState() {
1500
+ if (this.filterValue.value === '') {
1501
+ this.expansionModel.clear();
1502
+ this.expansionModel.select(...this.expandedItemsBeforeFiltration);
1503
+ }
1504
+ }
1505
+ hasFilteredDescendant(dataNode, filteredNodes) {
1506
+ const filteredViewValues = filteredNodes
1507
+ .map((node) => this.getViewValue(node));
1508
+ return this.getDescendants(dataNode)
1509
+ .filter((node) => filteredViewValues.includes(this.getViewValue(node)))
1510
+ .length > 0;
1511
+ }
1511
1512
  }
1512
1513
 
1513
- /** Nested tree control. Able to expand/collapse a subtree recursively for NestedNode type. */
1514
- class NestedTreeControl extends BaseTreeControl {
1515
- /** Construct with nested tree function getChildren. */
1516
- constructor(getChildren) {
1517
- super();
1518
- this.getChildren = getChildren;
1519
- }
1520
- /**
1521
- * Expands all dataNodes in the tree.
1522
- *
1523
- * To make this working, the `dataNodes` variable of the TreeControl must be set to all root level
1524
- * data nodes of the tree.
1525
- */
1526
- expandAll() {
1527
- this.expansionModel.clear();
1528
- const allNodes = this.dataNodes.reduce((accumulator, dataNode) => [...accumulator, ...this.getDescendants(dataNode), dataNode], []);
1529
- this.expansionModel.select(...allNodes);
1530
- }
1531
- /** Gets a list of descendant dataNodes of a subtree rooted at given data node recursively. */
1532
- getDescendants(dataNode) {
1533
- const descendants = [];
1534
- this._getDescendants(descendants, dataNode);
1535
- return descendants.splice(1);
1536
- }
1537
- /** A helper function to get descendants recursively. */
1538
- // todo нужно придумать другое название и понять в чем отличие между getDescendants и _getDescendants
1539
- /* tslint:disable-next-line:naming-convention */
1540
- _getDescendants(descendants, dataNode) {
1541
- descendants.push(dataNode);
1542
- this.getChildren(dataNode)
1543
- .pipe(take(1))
1544
- .subscribe((children) => {
1545
- if (children && children.length > 0) {
1546
- children.forEach((child) => this._getDescendants(descendants, child));
1547
- }
1548
- });
1549
- }
1514
+ /** Nested tree control. Able to expand/collapse a subtree recursively for NestedNode type. */
1515
+ class NestedTreeControl extends BaseTreeControl {
1516
+ /** Construct with nested tree function getChildren. */
1517
+ constructor(getChildren) {
1518
+ super();
1519
+ this.getChildren = getChildren;
1520
+ }
1521
+ /**
1522
+ * Expands all dataNodes in the tree.
1523
+ *
1524
+ * To make this working, the `dataNodes` variable of the TreeControl must be set to all root level
1525
+ * data nodes of the tree.
1526
+ */
1527
+ expandAll() {
1528
+ this.expansionModel.clear();
1529
+ const allNodes = this.dataNodes.reduce((accumulator, dataNode) => [...accumulator, ...this.getDescendants(dataNode), dataNode], []);
1530
+ this.expansionModel.select(...allNodes);
1531
+ }
1532
+ /** Gets a list of descendant dataNodes of a subtree rooted at given data node recursively. */
1533
+ getDescendants(dataNode) {
1534
+ const descendants = [];
1535
+ this._getDescendants(descendants, dataNode);
1536
+ return descendants.splice(1);
1537
+ }
1538
+ /** A helper function to get descendants recursively. */
1539
+ // todo нужно придумать другое название и понять в чем отличие между getDescendants и _getDescendants
1540
+ /* tslint:disable-next-line:naming-convention */
1541
+ _getDescendants(descendants, dataNode) {
1542
+ descendants.push(dataNode);
1543
+ this.getChildren(dataNode)
1544
+ .pipe(take(1))
1545
+ .subscribe((children) => {
1546
+ if (children && children.length > 0) {
1547
+ children.forEach((child) => this._getDescendants(descendants, child));
1548
+ }
1549
+ });
1550
+ }
1550
1551
  }
1551
1552
 
1552
- /**
1553
- * Tree flattener to convert a normal type of node to node with children & level information.
1554
- * Transform nested nodes of type `T` to flattened nodes of type `F`.
1555
- *
1556
- * For example, the input data of type `T` is nested, and contains its children data:
1557
- * SomeNode: {
1558
- * key: 'Fruits',
1559
- * children: [
1560
- * NodeOne: {
1561
- * key: 'Apple',
1562
- * },
1563
- * NodeTwo: {
1564
- * key: 'Pear',
1565
- * }
1566
- * ]
1567
- * }
1568
- * After flattener flatten the tree, the structure will become
1569
- * SomeNode: {
1570
- * key: 'Fruits',
1571
- * expandable: true,
1572
- * level: 1
1573
- * },
1574
- * NodeOne: {
1575
- * key: 'Apple',
1576
- * expandable: false,
1577
- * level: 2
1578
- * },
1579
- * NodeTwo: {
1580
- * key: 'Pear',
1581
- * expandable: false,
1582
- * level: 2
1583
- * }
1584
- * and the output flattened type is `F` with additional information.
1585
- */
1586
- class McTreeFlattener {
1587
- constructor(transformFunction, getLevel, isExpandable, getChildren) {
1588
- this.transformFunction = transformFunction;
1589
- this.getLevel = getLevel;
1590
- this.isExpandable = isExpandable;
1591
- this.getChildren = getChildren;
1592
- }
1593
- flattenNode(node, level, resultNodes, parent) {
1594
- const flatNode = this.transformFunction(node, level, parent);
1595
- resultNodes.push(flatNode);
1596
- if (this.isExpandable(flatNode)) {
1597
- const childrenNodes = this.getChildren(node);
1598
- if (childrenNodes) {
1599
- if (Array.isArray(childrenNodes)) {
1600
- this.flattenChildren(childrenNodes, level, resultNodes, flatNode);
1601
- }
1602
- else {
1603
- childrenNodes
1604
- .pipe(take(1))
1605
- .subscribe((children) => {
1606
- this.flattenChildren(children, level, resultNodes, flatNode);
1607
- });
1608
- }
1609
- }
1610
- }
1611
- return resultNodes;
1612
- }
1613
- flattenChildren(children, level, resultNodes, parent) {
1614
- children.forEach((child) => {
1615
- this.flattenNode(child, level + 1, resultNodes, parent);
1616
- });
1617
- }
1618
- /**
1619
- * Flatten a list of node type T to flattened version of node F.
1620
- * Please note that type T may be nested, and the length of `structuredData` may be different
1621
- * from that of returned list `F[]`.
1622
- */
1623
- flattenNodes(structuredData) {
1624
- const resultNodes = [];
1625
- structuredData.forEach((node) => this.flattenNode(node, 0, resultNodes, null));
1626
- return resultNodes;
1627
- }
1628
- /**
1629
- * Expand flattened node with current expansion status.
1630
- * The returned list may have different length.
1631
- */
1632
- expandFlattenedNodes(nodes, treeControl) {
1633
- const results = [];
1634
- const currentExpand = [];
1635
- currentExpand[0] = true;
1636
- nodes.forEach((node) => {
1637
- let expand = true;
1638
- for (let i = 0; i <= this.getLevel(node); i++) {
1639
- expand = expand && currentExpand[i];
1640
- }
1641
- if (expand) {
1642
- results.push(node);
1643
- }
1644
- if (this.isExpandable(node)) {
1645
- currentExpand[this.getLevel(node) + 1] = treeControl.isExpanded(node);
1646
- }
1647
- });
1648
- return results;
1649
- }
1650
- }
1651
- var McTreeDataSourceChangeTypes;
1652
- (function (McTreeDataSourceChangeTypes) {
1653
- McTreeDataSourceChangeTypes["Expansion"] = "expansion";
1654
- McTreeDataSourceChangeTypes["Filter"] = "filter";
1655
- })(McTreeDataSourceChangeTypes || (McTreeDataSourceChangeTypes = {}));
1656
- /**
1657
- * Data source for flat tree.
1658
- * The data source need to handle expansion/collapsion of the tree node and change the data feed
1659
- * to `McTree`.
1660
- * The nested tree nodes of type `T` are flattened through `MсTreeFlattener`, and converted
1661
- * to type `F` for `McTree` to consume.
1662
- */
1663
- class McTreeFlatDataSource extends DataSource {
1664
- constructor(treeControl, treeFlattener, initialData = []) {
1665
- super();
1666
- this.treeControl = treeControl;
1667
- this.treeFlattener = treeFlattener;
1668
- this.flattenedData = new BehaviorSubject([]);
1669
- this.expandedData = new BehaviorSubject([]);
1670
- this.filteredData = new BehaviorSubject([]);
1671
- this._data = new BehaviorSubject(initialData);
1672
- }
1673
- get data() {
1674
- return this._data.value;
1675
- }
1676
- set data(value) {
1677
- this._data.next(value);
1678
- this.flattenedData.next(this.treeFlattener.flattenNodes(this.data));
1679
- this.treeControl.dataNodes = this.flattenedData.value;
1680
- }
1681
- connect(collectionViewer) {
1682
- return merge(collectionViewer.viewChange, this.treeControl.expansionModel.changed
1683
- .pipe(map((value) => ({ type: McTreeDataSourceChangeTypes.Expansion, value }))), this.treeControl.filterValue
1684
- .pipe(map((value) => ({ type: McTreeDataSourceChangeTypes.Filter, value }))), this.flattenedData)
1685
- .pipe(map((changeObj) => {
1686
- if (changeObj.type === McTreeDataSourceChangeTypes.Filter) {
1687
- if (changeObj.value && changeObj.value.length > 0) {
1688
- return this.filterHandler();
1689
- }
1690
- else {
1691
- return this.expansionHandler(changeObj.value);
1692
- }
1693
- }
1694
- return this.expansionHandler(changeObj.value);
1695
- }));
1696
- }
1697
- filterHandler() {
1698
- this.filteredData.next(this.treeControl.filterModel.selected);
1699
- return this.filteredData.value;
1700
- }
1701
- expansionHandler(_change) {
1702
- const expandedNodes = this.treeFlattener.expandFlattenedNodes(this.flattenedData.value, this.treeControl);
1703
- this.expandedData.next(expandedNodes);
1704
- return this.expandedData.value;
1705
- }
1706
- disconnect() {
1707
- // no op
1708
- }
1553
+ /**
1554
+ * Tree flattener to convert a normal type of node to node with children & level information.
1555
+ * Transform nested nodes of type `T` to flattened nodes of type `F`.
1556
+ *
1557
+ * For example, the input data of type `T` is nested, and contains its children data:
1558
+ * SomeNode: {
1559
+ * key: 'Fruits',
1560
+ * children: [
1561
+ * NodeOne: {
1562
+ * key: 'Apple',
1563
+ * },
1564
+ * NodeTwo: {
1565
+ * key: 'Pear',
1566
+ * }
1567
+ * ]
1568
+ * }
1569
+ * After flattener flatten the tree, the structure will become
1570
+ * SomeNode: {
1571
+ * key: 'Fruits',
1572
+ * expandable: true,
1573
+ * level: 1
1574
+ * },
1575
+ * NodeOne: {
1576
+ * key: 'Apple',
1577
+ * expandable: false,
1578
+ * level: 2
1579
+ * },
1580
+ * NodeTwo: {
1581
+ * key: 'Pear',
1582
+ * expandable: false,
1583
+ * level: 2
1584
+ * }
1585
+ * and the output flattened type is `F` with additional information.
1586
+ */
1587
+ class McTreeFlattener {
1588
+ constructor(transformFunction, getLevel, isExpandable, getChildren) {
1589
+ this.transformFunction = transformFunction;
1590
+ this.getLevel = getLevel;
1591
+ this.isExpandable = isExpandable;
1592
+ this.getChildren = getChildren;
1593
+ }
1594
+ flattenNode(node, level, resultNodes, parent) {
1595
+ const flatNode = this.transformFunction(node, level, parent);
1596
+ resultNodes.push(flatNode);
1597
+ if (this.isExpandable(flatNode)) {
1598
+ const childrenNodes = this.getChildren(node);
1599
+ if (childrenNodes) {
1600
+ if (Array.isArray(childrenNodes)) {
1601
+ this.flattenChildren(childrenNodes, level, resultNodes, flatNode);
1602
+ }
1603
+ else {
1604
+ childrenNodes
1605
+ .pipe(take(1))
1606
+ .subscribe((children) => {
1607
+ this.flattenChildren(children, level, resultNodes, flatNode);
1608
+ });
1609
+ }
1610
+ }
1611
+ }
1612
+ return resultNodes;
1613
+ }
1614
+ flattenChildren(children, level, resultNodes, parent) {
1615
+ children.forEach((child) => {
1616
+ this.flattenNode(child, level + 1, resultNodes, parent);
1617
+ });
1618
+ }
1619
+ /**
1620
+ * Flatten a list of node type T to flattened version of node F.
1621
+ * Please note that type T may be nested, and the length of `structuredData` may be different
1622
+ * from that of returned list `F[]`.
1623
+ */
1624
+ flattenNodes(structuredData) {
1625
+ const resultNodes = [];
1626
+ structuredData.forEach((node) => this.flattenNode(node, 0, resultNodes, null));
1627
+ return resultNodes;
1628
+ }
1629
+ /**
1630
+ * Expand flattened node with current expansion status.
1631
+ * The returned list may have different length.
1632
+ */
1633
+ expandFlattenedNodes(nodes, treeControl) {
1634
+ const results = [];
1635
+ const currentExpand = [];
1636
+ currentExpand[0] = true;
1637
+ nodes.forEach((node) => {
1638
+ let expand = true;
1639
+ for (let i = 0; i <= this.getLevel(node); i++) {
1640
+ expand = expand && currentExpand[i];
1641
+ }
1642
+ if (expand) {
1643
+ results.push(node);
1644
+ }
1645
+ if (this.isExpandable(node)) {
1646
+ currentExpand[this.getLevel(node) + 1] = treeControl.isExpanded(node);
1647
+ }
1648
+ });
1649
+ return results;
1650
+ }
1651
+ }
1652
+ var McTreeDataSourceChangeTypes;
1653
+ (function (McTreeDataSourceChangeTypes) {
1654
+ McTreeDataSourceChangeTypes["Expansion"] = "expansion";
1655
+ McTreeDataSourceChangeTypes["Filter"] = "filter";
1656
+ })(McTreeDataSourceChangeTypes || (McTreeDataSourceChangeTypes = {}));
1657
+ /**
1658
+ * Data source for flat tree.
1659
+ * The data source need to handle expansion/collapsion of the tree node and change the data feed
1660
+ * to `McTree`.
1661
+ * The nested tree nodes of type `T` are flattened through `MсTreeFlattener`, and converted
1662
+ * to type `F` for `McTree` to consume.
1663
+ */
1664
+ class McTreeFlatDataSource extends DataSource {
1665
+ constructor(treeControl, treeFlattener, initialData = []) {
1666
+ super();
1667
+ this.treeControl = treeControl;
1668
+ this.treeFlattener = treeFlattener;
1669
+ this.flattenedData = new BehaviorSubject([]);
1670
+ this.expandedData = new BehaviorSubject([]);
1671
+ this.filteredData = new BehaviorSubject([]);
1672
+ this._data = new BehaviorSubject(initialData);
1673
+ }
1674
+ get data() {
1675
+ return this._data.value;
1676
+ }
1677
+ set data(value) {
1678
+ this._data.next(value);
1679
+ this.flattenedData.next(this.treeFlattener.flattenNodes(this.data));
1680
+ this.treeControl.dataNodes = this.flattenedData.value;
1681
+ }
1682
+ connect(collectionViewer) {
1683
+ return merge(collectionViewer.viewChange, this.treeControl.expansionModel.changed
1684
+ .pipe(map((value) => ({ type: McTreeDataSourceChangeTypes.Expansion, value }))), this.treeControl.filterValue
1685
+ .pipe(map((value) => ({ type: McTreeDataSourceChangeTypes.Filter, value }))), this.flattenedData)
1686
+ .pipe(map((changeObj) => {
1687
+ if (changeObj.type === McTreeDataSourceChangeTypes.Filter) {
1688
+ if (changeObj.value && changeObj.value.length > 0) {
1689
+ return this.filterHandler();
1690
+ }
1691
+ else {
1692
+ return this.expansionHandler(changeObj.value);
1693
+ }
1694
+ }
1695
+ return this.expansionHandler(changeObj.value);
1696
+ }));
1697
+ }
1698
+ filterHandler() {
1699
+ this.filteredData.next(this.treeControl.filterModel.selected);
1700
+ return this.filteredData.value;
1701
+ }
1702
+ expansionHandler(_change) {
1703
+ const expandedNodes = this.treeFlattener.expandFlattenedNodes(this.flattenedData.value, this.treeControl);
1704
+ this.expandedData.next(expandedNodes);
1705
+ return this.expandedData.value;
1706
+ }
1707
+ disconnect() {
1708
+ // no op
1709
+ }
1709
1710
  }
1710
1711
 
1711
- /**
1712
- * Data source for nested tree.
1713
- *
1714
- * The data source for nested tree doesn't have to consider node flattener, or the way to expand
1715
- * or collapse. The expansion/collapsion will be handled by TreeControl and each non-leaf node.
1716
- */
1717
- class McTreeNestedDataSource extends DataSource {
1718
- constructor() {
1719
- super(...arguments);
1720
- /* tslint:disable-next-line:naming-convention */
1721
- this._data = new BehaviorSubject([]);
1722
- }
1723
- get data() {
1724
- return this._data.value;
1725
- }
1726
- set data(value) {
1727
- this._data.next(value);
1728
- }
1729
- connect(collectionViewer) {
1730
- return merge(...[collectionViewer.viewChange, this._data])
1731
- .pipe(map(() => this.data));
1732
- }
1733
- disconnect() {
1734
- // no op
1735
- }
1712
+ /**
1713
+ * Data source for nested tree.
1714
+ *
1715
+ * The data source for nested tree doesn't have to consider node flattener, or the way to expand
1716
+ * or collapse. The expansion/collapsion will be handled by TreeControl and each non-leaf node.
1717
+ */
1718
+ class McTreeNestedDataSource extends DataSource {
1719
+ constructor() {
1720
+ super(...arguments);
1721
+ /* tslint:disable-next-line:naming-convention */
1722
+ this._data = new BehaviorSubject([]);
1723
+ }
1724
+ get data() {
1725
+ return this._data.value;
1726
+ }
1727
+ set data(value) {
1728
+ this._data.next(value);
1729
+ }
1730
+ connect(collectionViewer) {
1731
+ return merge(...[collectionViewer.viewChange, this._data])
1732
+ .pipe(map(() => this.data));
1733
+ }
1734
+ disconnect() {
1735
+ // no op
1736
+ }
1736
1737
  }
1737
1738
 
1738
- /**
1739
- * Generated bundle index. Do not edit.
1739
+ /**
1740
+ * Generated bundle index. Do not edit.
1740
1741
  */
1741
1742
 
1742
1743
  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 };